summaryrefslogtreecommitdiff
path: root/euler/source
diff options
context:
space:
mode:
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