diff --git a/sysdata/libraries/mouse/src/lib.hb b/sysdata/libraries/mouse/src/lib.hb new file mode 100644 index 0000000..e69de29 diff --git a/sysdata/programs/mouse_driver/meta.toml b/sysdata/programs/mouse_driver/meta.toml new file mode 100644 index 0000000..551d882 --- /dev/null +++ b/sysdata/programs/mouse_driver/meta.toml @@ -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" diff --git a/sysdata/programs/mouse_driver/src/main.hb b/sysdata/programs/mouse_driver/src/main.hb new file mode 100644 index 0000000..504c87b --- /dev/null +++ b/sysdata/programs/mouse_driver/src/main.hb @@ -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 +} \ No newline at end of file diff --git a/sysdata/programs/mouse_test/meta.toml b/sysdata/programs/mouse_test/meta.toml new file mode 100644 index 0000000..705384c --- /dev/null +++ b/sysdata/programs/mouse_test/meta.toml @@ -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" diff --git a/sysdata/programs/mouse_test/src/main.hb b/sysdata/programs/mouse_test/src/main.hb new file mode 100644 index 0000000..02cc278 --- /dev/null +++ b/sysdata/programs/mouse_test/src/main.hb @@ -0,0 +1,3 @@ +main := fn(): int { + return 0 +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 9b95d71..f5ad582 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -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"