1
0
Fork 0
forked from AbleOS/ableos

Bncha mouse driver stubs

This commit is contained in:
peony 2024-10-20 14:18:16 +02:00
parent f6dd752b77
commit 0da9467a0f
6 changed files with 83 additions and 4 deletions

View file

View file

@ -0,0 +1,11 @@
[package]
name = "mouse_driver"
authors = ["peony"]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang src/main.hb"

View file

@ -0,0 +1,51 @@
.{memory, buffer, log, string} := @use("../../../libraries/stn/src/lib.hb")
wait_for := fn(for: u8): void {
loop {
if (memory.inb(0x64) & 2 >> for) == for {
return
}
}
}
send_info := fn(info: u8): void {
wait_for(1)
memory.outb(0x64, info)
}
send_command := fn(command: u8): void {
@inline(send_info, 0xD4)
@inline(wait_for, 1)
memory.outb(0x60, command)
return
}
get_response := fn(): u8 {
@inline(wait_for, 0)
return memory.inb(0x60)
}
main := fn(): int {
format_page := memory.alloc(u8, 1024)
wait_for(1)
memory.outb(0x64, 0xA8)
log.info("Aux mouse device enabled.\0")
send_command(0xF6)
get_response()
send_command(0xF4)
get_response()
loop {
wait_for(0)
status := memory.inb(0x60)
//log.info("NEGATIVE Y MOVEMENT\0\0")
log.info(string.display_int(status, format_page))
d_x := memory.inb(0x60)
d_y := memory.inb(0x60)
}
return 0
}

View file

@ -0,0 +1,11 @@
[package]
name = "mouse_test"
authors = ["peony"]
[dependants.libraries]
[dependants.binaries]
hblang.version = "1.0.0"
[build]
command = "hblang src/main.hb"

View file

@ -0,0 +1,3 @@
main := fn(): int {
return 0
}

View file

@ -29,8 +29,8 @@ resolution = "1600x900x24"
# [boot.limine.ableos.modules.diskio_driver]
# path = "boot:///diskio_driver.hbf"
[boot.limine.ableos.modules.render_example]
path = "boot:///render_example.hbf"
# [boot.limine.ableos.modules.render_example]
# path = "boot:///render_example.hbf"
# [boot.limine.ableos.modules.serial_driver_test]
# path = "boot:///serial_driver_test.hbf"
@ -56,5 +56,8 @@ path = "boot:///render_example.hbf"
# [boot.limine.ableos.modules.pumpkin_print]
# path = "boot:///pumpkin_print.hbf"
# [boot.limine.ableos.modules.tetris]
# path = "boot:///tetris.hbf"
[boot.limine.ableos.modules.mouse_driver]
path = "boot:///mouse_driver.hbf"
[boot.limine.ableos.modules.mouse_test]
path = "boot:///mouse_test.hbf"