summaryrefslogtreecommitdiff
path: root/Emulator/Chip/HIDDevice.cs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
commit18868128e18d38b706e7df14e8e683e1a9739c17 (patch)
tree6f0e0e5eee646f10cbad9c0c89c24d330bc58cc6 /Emulator/Chip/HIDDevice.cs
parentd87ab8af4c86a3fc6ee237444e372d87e536e3ef (diff)
chore: Initial commit
Diffstat (limited to 'Emulator/Chip/HIDDevice.cs')
-rw-r--r--Emulator/Chip/HIDDevice.cs49
1 files changed, 0 insertions, 49 deletions
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