summaryrefslogtreecommitdiff
path: root/euler/source
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-05-19 04:34:40 -0400
committerBenji Dial <benji@benjidial.net>2024-05-19 04:34:40 -0400
commite60fa7740cd7d245d1b22a25fea9df0768d32668 (patch)
tree728fa422d3a2abc66a3e2d89e4ef03b72074bb3e /euler/source
parentb1a912a8a6ff472a49b2e0a09cfd433adfc2cb24 (diff)
downloadhilbert-os-e60fa7740cd7d245d1b22a25fea9df0768d32668.tar.gz
mouse support (working in qemu, semi-working in virtualbox)
Diffstat (limited to 'euler/source')
-rw-r--r--euler/source/euler/syscall.asm28
1 files changed, 26 insertions, 2 deletions
diff --git a/euler/source/euler/syscall.asm b/euler/source/euler/syscall.asm
index 34f2735..41bd05c 100644
--- a/euler/source/euler/syscall.asm
+++ b/euler/source/euler/syscall.asm
@@ -11,7 +11,7 @@ global __euler_end_this_thread
global __euler_read_from_stream
global __euler_get_framebuffer
global __euler_encode_color
-global __euler_read_key_packet
+global __euler_get_input_packet
section .text
@@ -96,7 +96,31 @@ __euler_encode_color:
syscall
ret
-__euler_read_key_packet:
+__euler_get_input_packet:
+ push rdi
+ push rsi
+ push rdx
+ push rcx
mov rax, 5
syscall
+
+ test al, 0x80
+ jnz .mouse_packet
+
+ pop rcx
+ mov dword [rcx], edi
+ add rsp, 24
+ mov al, 2
+ ret
+
+.mouse_packet:
+ add rsp, 8
+ pop rdx
+ mov word [rdx], si
+ pop rdx
+ mov word [rdx], di
+ pop rdx
+ and al, 0x7f
+ mov byte [rdx], al
+ mov al, 1
ret