From e636f2499553732af6d3fb2f4bd68826c71091c5 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sun, 22 Oct 2017 21:18:01 +0100 Subject: [PATCH] Starting work on a PS2 keyboard driver. --- kernel/arch/i386/ps2.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 kernel/arch/i386/ps2.nim diff --git a/kernel/arch/i386/ps2.nim b/kernel/arch/i386/ps2.nim new file mode 100644 index 0000000..21c2247 --- /dev/null +++ b/kernel/arch/i386/ps2.nim @@ -0,0 +1,16 @@ +import io + +const keyboardAddress = 0x60 + +type + KeypressEvent = tuple + character: char + pressed: bool + +proc getScancode(): char = + while true: + let c = io.inb(keyboardAddress) + if(c > 0): return c + +proc getChar*(): char = + discard # TODO: Implement lookup to a scan table to get actual character