forked from AbleOS/ableos
38 lines
847 B
Plaintext
38 lines
847 B
Plaintext
.{memory, log, string} := @use("../../../libraries/stn/src/lib.hb");
|
|
.{Mouse3Button} := @use("devices.hb")
|
|
controller := @use("controller.hb")
|
|
format_page := memory.dangling(u8)
|
|
|
|
info := controller.Info.(0)
|
|
|
|
process := fn(port: ^controller.Port): bool {
|
|
}
|
|
|
|
check_complete := fn(port: ^controller.Port): bool {
|
|
}
|
|
|
|
main := fn(): void {
|
|
format_page = memory.alloc(u8, 1024)
|
|
|
|
controller.init()
|
|
|
|
loop {
|
|
info = controller.get_info()
|
|
|
|
if controller.timed_out(info) {
|
|
log.error("Timeout error! Cannot handle these!\0")
|
|
}
|
|
if controller.check_parity(info) {
|
|
log.error("Parity error! Cannot handle these!\0")
|
|
}
|
|
|
|
if controller.has_input(info) {
|
|
port := controller.get_port(info)
|
|
port.packet[port.packet_length] = controller.get_input()
|
|
port.packet_length += 1
|
|
if @inline(check_complete, port) {
|
|
process(port)
|
|
}
|
|
}
|
|
}
|
|
} |