forked from AbleOS/ableos
Bncha mouse driver stubs
This commit is contained in:
parent
f6dd752b77
commit
0da9467a0f
0
sysdata/libraries/mouse/src/lib.hb
Normal file
0
sysdata/libraries/mouse/src/lib.hb
Normal file
11
sysdata/programs/mouse_driver/meta.toml
Normal file
11
sysdata/programs/mouse_driver/meta.toml
Normal 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"
|
51
sysdata/programs/mouse_driver/src/main.hb
Normal file
51
sysdata/programs/mouse_driver/src/main.hb
Normal 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
|
||||||
|
}
|
11
sysdata/programs/mouse_test/meta.toml
Normal file
11
sysdata/programs/mouse_test/meta.toml
Normal 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"
|
3
sysdata/programs/mouse_test/src/main.hb
Normal file
3
sysdata/programs/mouse_test/src/main.hb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
main := fn(): int {
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -29,8 +29,8 @@ resolution = "1600x900x24"
|
||||||
# [boot.limine.ableos.modules.diskio_driver]
|
# [boot.limine.ableos.modules.diskio_driver]
|
||||||
# path = "boot:///diskio_driver.hbf"
|
# path = "boot:///diskio_driver.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.render_example]
|
# [boot.limine.ableos.modules.render_example]
|
||||||
path = "boot:///render_example.hbf"
|
# path = "boot:///render_example.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.serial_driver_test]
|
# [boot.limine.ableos.modules.serial_driver_test]
|
||||||
# path = "boot:///serial_driver_test.hbf"
|
# path = "boot:///serial_driver_test.hbf"
|
||||||
|
@ -56,5 +56,8 @@ path = "boot:///render_example.hbf"
|
||||||
# [boot.limine.ableos.modules.pumpkin_print]
|
# [boot.limine.ableos.modules.pumpkin_print]
|
||||||
# path = "boot:///pumpkin_print.hbf"
|
# path = "boot:///pumpkin_print.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.tetris]
|
[boot.limine.ableos.modules.mouse_driver]
|
||||||
# path = "boot:///tetris.hbf"
|
path = "boot:///mouse_driver.hbf"
|
||||||
|
|
||||||
|
[boot.limine.ableos.modules.mouse_test]
|
||||||
|
path = "boot:///mouse_test.hbf"
|
||||||
|
|
Loading…
Reference in a new issue