2024-10-23 15:22:28 -05:00
|
|
|
.{memory, log, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
2024-09-15 11:01:29 -05:00
|
|
|
|
|
|
|
send_byte := fn(byte: u8): u8 {
|
|
|
|
memory.outb(96, byte)
|
|
|
|
return memory.inb(96)
|
|
|
|
}
|
|
|
|
|
|
|
|
main := fn(): int {
|
2024-10-12 07:35:49 -05:00
|
|
|
buf := buffer.create("XKeyboard\0")
|
2024-11-03 16:31:53 -06:00
|
|
|
_ = send_byte(238)
|
2024-09-16 14:45:19 -05:00
|
|
|
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 {
|
|
|
|
input := memory.inb(96)
|
|
|
|
if input == prev_input {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
prev_input = input
|
2024-10-23 15:22:28 -05:00
|
|
|
buffer.write(u8, &input, buf)
|
2024-09-16 14:45:19 -05:00
|
|
|
}
|
2024-09-15 11:01:29 -05:00
|
|
|
return 0
|
|
|
|
}
|