From 2c4528ee506f6346b810622c93e98f8bdd309169 Mon Sep 17 00:00:00 2001 From: pathoswithin Date: Tue, 15 Dec 2015 17:20:18 +0000 Subject: [PATCH] Mouse acceleration options git-svn-id: svn://kolibrios.org@5966 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/hid/mousedrv.inc | 42 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/kernel/trunk/hid/mousedrv.inc b/kernel/trunk/hid/mousedrv.inc index 0f42768450..28123f2a9b 100644 --- a/kernel/trunk/hid/mousedrv.inc +++ b/kernel/trunk/hid/mousedrv.inc @@ -551,39 +551,35 @@ proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dwo endp ;----------------------------------------------------------------------------- - +; 3 = x^2 /2 +; 2 = (x+1)^2 /4 +; 1 = (x+2)^2 /8 align 4 mouse_acceleration: - cmp [mouse_delay], 1 - jz .slight - jc .end + cmp [mouse_delay], 0 + jz .end push eax @@: neg eax jl @b - mov edx, eax - shr edx, 1 - jc @f - mul dl - add eax, edx - jmp .next -@@: - inc edx - mul dl -.next: + cmp [mouse_delay], 3 + adc eax, 0 + cmp [mouse_delay], 2 + adc eax, 0 + mul al + shr eax, 1 + adc eax, 0 + cmp [mouse_delay], 2 + jz .2 + jnc .3 + shr eax, 1 +.2: + shr eax, 1 +.3: pop edx test edx, edx jns .end neg eax - jmp .end -;-------------------------------------- -.slight: - shl eax, 1 - js @f - dec eax - jmp .end -@@: - inc eax .end: imul [mouse_speed_factor] ret