Separate out mouse sensitivity

This commit is contained in:
shikhin 2023-03-23 04:38:07 +05:30
parent be727d8757
commit 7367a4cf34
1 changed files with 8 additions and 6 deletions

View File

@ -11,6 +11,9 @@ org 0x7c00
COLUMNS equ 80 COLUMNS equ 80
ROWS equ 25 ROWS equ 25
X_SENSITIVITY equ 1
Y_SENSITIVITY equ 2
jmp 0:start jmp 0:start
initialize_mouse_error: initialize_mouse_error:
@ -108,9 +111,9 @@ mainloop:
jz .mouse_change_end jz .mouse_change_end
.mouse_change: .mouse_change:
mov cx, [di - mouse_column + mouse_x] mov cx, [di - mouse_column + mouse_x]
shr cx, 1 shr cx, X_SENSITIVITY
mov bx, [di - mouse_column + mouse_y] mov bx, [di - mouse_column + mouse_y]
shr bx, 2 shr bx, Y_SENSITIVITY
mov ch, bl mov ch, bl
call flip_mouse_cursor call flip_mouse_cursor
@ -412,8 +415,8 @@ Y_OVERFLOW equ 0x80
X_OVERFLOW equ 0x40 X_OVERFLOW equ 0x40
BUTTONS equ 0x03 BUTTONS equ 0x03
X_MAX_VALUE equ 2*COLUMNS-1 X_MAX_VALUE equ (1 << X_SENSITIVITY)*COLUMNS-1
Y_MAX_VALUE equ 4*ROWS-1 Y_MAX_VALUE equ (1 << Y_SENSITIVITY)*ROWS-1
; in: ; in:
; si = non-zero for Y ; si = non-zero for Y
@ -484,8 +487,7 @@ mouse_handler:
inc si ; will be non-zero inc si ; will be non-zero
mov ax, [bp+2*8+6] mov ax, [bp+2*8+6]
mov cl, 2 mov cl, 2
;mov dx mov dx, Y_MAX_VALUE
mov dl, Y_MAX_VALUE
test bl, Y_OVERFLOW test bl, Y_OVERFLOW
call xy_handler call xy_handler