1
0
Fork 0
forked from AbleOS/ableos
ableOS_v1Change/sysdata/programs/ps2_driver/src/main.hb
koniifer f7b970eaf0 hexadecimal support!!
remove fb_driver_stresstest, move examples back to fb_driver, update hblang, update Cargo.lock
2024-09-01 22:29:42 +01:00

30 lines
691 B
Plaintext

.{memory, log, string, buffer} := @use("../../../libraries/stn/src/lib.hb")
send_byte := fn(byte: u8): u8 {
memory.outb(0x6000, byte)
return memory.inb(0x6000)
}
main := fn(): int {
log.info("PS/2 Driver Loaded\0")
if send_byte(0xEE) == 0xEE {
log.info("PS/2 Keyboard Echoed\0")
}
if send_byte(0xF4) == 0xFA {
log.info("Enabled scanning\0")
}
buf := buffer.create("XKeyboard\0")
ptr := memory.request_page(1)
prev_input := 0xFA
loop {
input := memory.inb(0x6000)
if input == prev_input {
continue
}
prev_input = input
keycode_str := string.display_int(input, ptr)
log.info(string.display_int(input, ptr))
buffer.send_message(keycode_str, buf)
}
return 0
}