From 18868128e18d38b706e7df14e8e683e1a9739c17 Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Tue, 17 Mar 2026 20:49:22 +1000 Subject: chore: Initial commit --- Emulator/Chip/HIDDevice.cs | 49 ---------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 Emulator/Chip/HIDDevice.cs (limited to 'Emulator/Chip/HIDDevice.cs') diff --git a/Emulator/Chip/HIDDevice.cs b/Emulator/Chip/HIDDevice.cs deleted file mode 100644 index c8a7d04..0000000 --- a/Emulator/Chip/HIDDevice.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace Q1.Emulator.Chip; - -using System; - -public class HIDDevice : RamDevice -{ - public HIDDevice(u16 start) : base(start, HIDDevice.CalculateSize()) { } - - public static u16 CalculateSize() - { - return 4 + 256; - } - - public void SetMouse(u16 positionalIndex, bool leftDown, bool rightDown, bool middleDown) - { - this.WriteWord(this.AddressableStart, positionalIndex); - u16 buttons = (u16) ((leftDown ? 1 : 0) - | ((rightDown ? 1 : 0) << 1) - | ((middleDown ? 1 : 0) << 2)); - this.WriteWord((u16) (this.AddressableStart + 2), buttons); - } - - public void SetKeyboard(u8 scanCode, bool pressed) - { - int index = scanCode >> 3; // keyCode / 8 - int bit = scanCode & 7; // keyCode % 8 - - ushort addr = (ushort) (4 + index); - u8 value = this.Read((u16) (this.AddressableStart + addr)); - - if (pressed) - value |= (u8) (1 << bit); - else - value &= (u8) ~(1 << bit); - - this.Write((u16) (this.AddressableStart + addr), value); - } - - public bool GetKeyboard(int scanCode) - { - int index = scanCode >> 3; - int bit = scanCode & 7; - - ushort addr = (ushort) (4 + index); - byte value = this.Read((u16) (this.AddressableStart + addr)); - - return (value & (1 << bit)) != 0; - } -} \ No newline at end of file -- cgit v1.3.1