1
0
Fork 0
forked from AbleOS/ableos

Literally 0 mouse driver work

This commit is contained in:
peony 2024-10-25 15:57:53 +02:00
parent f023773b2e
commit 382a4f5510

View file

@ -1,5 +1,7 @@
.{memory, buffer, log, string} := @use("../../../libraries/stn/src/lib.hb") .{memory, buffer, log, string} := @use("../../../libraries/stn/src/lib.hb")
ACK := 250
wait_for := fn(for: u8): void { wait_for := fn(for: u8): void {
loop { loop {
if (memory.inb(0x64) & 2 >> for) == for { if (memory.inb(0x64) & 2 >> for) == for {
@ -21,14 +23,14 @@ send_command := fn(command: u8): void {
} }
get_response := fn(): u8 { get_response := fn(): u8 {
@inline(wait_for, 0) @inline(wait_for, 1)
return memory.inb(0x60) return memory.inb(0x60)
} }
main := fn(): int { main := fn(): int {
format_page := memory.alloc(u8, 1024) format_page := memory.alloc(u8, 1024)
wait_for(1) wait_for(0)
memory.outb(0x64, 0xA8) memory.outb(0x64, 0xA8)
log.info("Aux mouse device enabled.\0") log.info("Aux mouse device enabled.\0")
@ -39,16 +41,14 @@ main := fn(): int {
get_response() get_response()
loop { loop {
loop { loop if (memory.inb(0x64) & 0x20) == 0x20 break
if (memory.inb(0x64) & 0x21) == 0x21 break
}
status := memory.inb(0x60) status := memory.inb(0x60)
//log.info("NEGATIVE Y MOVEMENT\0\0") //log.info("NEGATIVE Y MOVEMENT\0\0")
log.info(string.display_int(status, format_page)) log.info(string.display_int(status, format_page, 10))
d_x := memory.inb(0x60) d_x := memory.inb(0x60)
log.info(string.display_int(d_x, format_page)) log.info(string.display_int(d_x, format_page, 10))
d_y := memory.inb(0x60) d_y := memory.inb(0x60)
log.info(string.display_int(d_y, format_page)) log.info(string.display_int(d_y, format_page, 10))
} }
return 0 return 0