1
0
Fork 0
forked from AbleOS/ableos
ableos_time/sysdata/programs/ps2_driver/src/main.hb
koniifer 3df6f18c85 fix buffers
update hblang
auto cpu feature detection for repbuild
less verbose buffer api
add peony's tetris stub
2024-10-12 13:35:49 +01:00

29 lines
590 B
Plaintext

.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb")
send_byte := fn(byte: u8): u8 {
memory.outb(96, byte)
return memory.inb(96)
}
main := fn(): int {
buf := buffer.create("XKeyboard\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")
}
ptr := memory.request_page(1)
prev_input := 250
loop {
input := memory.inb(96)
if input == prev_input {
continue
}
prev_input = input
buffer.write(&input, buf, 1)
}
return 0
}