Optimize mainloop by consolidating mouse position in bx

This commit is contained in:
Juhani Krekelä 2023-03-19 22:54:14 +02:00
parent b38f9a663c
commit 56f7cbcfa6
1 changed files with 4 additions and 6 deletions

View File

@ -108,9 +108,8 @@ mainloop:
shr bx, 1
mov cx, [di - mouse_column + mouse_y]
shr cx, 2
cmp [di], bl
jne .update_cursor
cmp [di - mouse_column + mouse_row], cl
mov bh, cl
cmp [di], bx
jne .update_cursor
hlt
@ -118,8 +117,7 @@ mainloop:
.update_cursor:
call flip_mouse_cursor
mov [di], bl
mov [di - mouse_column + mouse_row], cl
mov [di], bx
call flip_mouse_cursor
jmp mainloop
@ -488,7 +486,7 @@ mouse_y resw 1 ; mouse_x + 2, do not touch
mouse_buttons resb 1
mouse_column resb 1
mouse_row resb 1
mouse_row resb 1 ; mouse_column + 1
window_chain_head resw 1
redraw resb 1