From e60fa7740cd7d245d1b22a25fea9df0768d32668 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 19 May 2024 04:34:40 -0400 Subject: mouse support (working in qemu, semi-working in virtualbox) --- euler/source/euler/syscall.asm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'euler/source') 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 -- cgit v1.2.3