stn := @use("../../../libraries/stn/src/lib.hb"); .{memory, log, buffer} := stn intouch := @use("../../../libraries/intouch/src/lib.hb"); .{KeyEvent} := intouch send_byte := fn(byte: u8): u8 { memory.outb(96, byte) return memory.inb(96) } main := fn(): int { buf := buffer.create("PS/2 Keyboard\0") _ = send_byte(238) log.info("PS/2 Driver Loaded\0") if send_byte(238) == 238 { log.info("PS/2 Keyboard Echoed\0") } if send_byte(244) == 250 { log.info("Enabled scanning\0") } prev_input := 250 loop { loop if (memory.inb(0x64) & 0x20) == 0x20 break input := memory.inb(96) if input == prev_input { continue } prev_input = input kevent := KeyEvent.(false, true, input) buffer.write(KeyEvent, buf, &kevent) } return 0 }