@@ -1,306 +1,312 @@
; <--- description --->
; SPDX-License-Identifier: NOASSERTION
; compiler: FASM 1.67.23
;
; name: Mouse Emulation For KolibriOS
;-----------------------------------------------------------------------------
; Text encoded with Code Page 866 - Cyrillic
; version: 1.2
; last update: 01/06/2012
; written by: Marat Zakiyanov aka Mario79, aka Mario
; <--- description --->
; changes: using new functions 66.6 and 66.7
; compiler: FASM 1.67.23
;-----------------------------------------------------------------------------
; name: Mouse Emulation For KolibriOS
; version: 1.1
;-----------------------------------------------------------------------------
; last update: 26/05/201 2
; version: 1. 2
; written by: Lipatov Kirill aka Leency
; last update: 01/06/2012
; changes: shows notify with instructions, while opening program
; written by: Marat Zakiyanov aka Mario79, aka Mario
;-----------------------------------------------------------------------------
; changes: using new functions 66.6 and 66.7
; version: 1.0
;-----------------------------------------------------------------------------
; last update: 04/09/2010
; version: 1.1
; written by: Marat Zakiyanov aka Mario79, aka Mario
; last update: 26/05/2012
; changes: total optimization of code,
; written by: Lipatov Kirill aka Leency
; different events for Up and Down of key Num 5
; changes: shows notify with instructions, while opening program
; advansed acceleration mode
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
; version: 1.0
; version: 0.8
; last update: 04/09/2010
; last update: 03/10/2007
; written by: Marat Zakiyanov aka Mario79, aka Mario
; written by: Zlobny_Gluk
; changes: total optimization of code,
; e-mail: umbrosia@land.ru
; different events for Up and Down of key Num 5
;-----------------------------------------------------------------------------
; advansed acceleration mode
; <--- include all KolibriOS stuff --->
;-------------------------------------------------------------------------- ---
include "lang.inc"
; version: 0.8
include '../../../macros.inc'
; last update: 03/10/2007
; written by: Zlobny_Gluk
; <--- start of KolibriOS application --->
; e-mail: umbrosia@land.ru
MEOS_APP_START
;-----------------------------------------------------------------------------
; <--- include all KolibriOS stuff --->
; <--- start of code --->
include "lang.inc"
CODE
include '../../macros.inc'
;-----------------------------------------------------------------------------
start:
; <--- start of KolibriOS application --->
mcall 70 , notifyapp
MEOS_APP_START
start1:
; <--- start of code --->
xor ebx , ebx
CODE
mcall 40
;-----------------------------------------------------------------------------
@ @ :
start :
mcall 23 , 10
mcall 70 , notifyapp
mcall 66 , 3
start1:
test ea x , 0x80 ;NumLock status
xor eb x , ebx
jz @ r
mcall 40
@ @ :
mov ebx , 4
mcall 23 , 10
call hotkeys_common
mcall 66 , 3
mcall 40 , 10b
test eax , 0x80 ;NumLock status
still:
jz @ r
mcall 10
mov ebx , 4
cmp eax , 2 ; if event == 2
call hotkeys_common
jne still
;-----------------------------------------------------------------------------
mcall 40 , 10b
key: ; key event handler
still:
call mouse_acceleration
m call 10
mcall 2 ; get key code
cmp eax , 2 ; if event == 2
jne still
push eax
;-----------------------------------------------------------------------------
mcall 66 , 3
key: ; key event handler
test eax , 0x80 ;NumLock status
call mouse_acceleration
pop eax
jnz @ f
mcall 2 ; get key code
mov ebx , 5
call hotkeys_common
push eax
jmp start1
mcall 66 , 3
@ @ :
test eax , 0x80 ;NumLock status
cm p al , 2
po p eax
jne still
jnz @ f
mov ebx , 5
xor edx , edx
call hotkeys_common
jmp start1
cmp ah , 80 ; Down Num 2
@ @ :
je keytwo
cmp al , 2
cmp ah , 81 ; Down Num 3
jne still
je keythree
cmp ah , 75 ; Down Num 4
xor edx , edx
je keyfour
cmp ah , 77 ; Down Num 6
cmp ah , 80 ; Down Num 2
je keysix
je keytwo
cmp ah , 7 1 ; Down Num 7
cmp ah , 8 1 ; Down Num 3
je keyseven
je keythree
cmp ah , 72 ; Down Num 8
cmp ah , 75 ; Down Num 4
je keyeight
je keyfour
cmp ah , 73 ; Down Num 9
cmp ah , 77 ; Down Num 6
je keynine
je keysix
cmp ah , 76 ; Down Num 5
cmp ah , 71 ; Down Num 7
je keyfi ve
je keyse ven
cmp ah , 204 ; Up Num 5
cmp ah , 7 2 ; Down Num 8
je keyfive_1
je keyeight
cmp ah , 79 ; Down Num 1
cmp ah , 73 ; Down Num 9
jn e still
je keynine
;-----------------------------------------------------------------------------
cmp ah , 76 ; Down Num 5
keyone:
je keyfive
call down
cmp ah , 204 ; Up Num 5
keyfour:
je keyfive_1
call left
cmp ah , 79 ; Down Num 1
jmp mouseread
jne still
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
keythre e:
keyon e:
call right
call down
keytwo :
keyfour :
call down
call left
jmp mouseread
jmp mouseread
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
keyseven :
keythree :
call lef t
call righ t
keyeight :
keytwo :
call up
call down
jmp mouseread
jmp mouseread
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
keynine :
keyseven :
call up
call left
keysix :
keyeight :
call right
call up
jmp mouseread
jmp mouseread
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
keyfiv e:
keynin e:
inc edx
call up
keyfive_1 :
keysix :
m call 18 , 19 , 5
call right
jmp still
jmp mouseread
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
left :
keyfive :
mov ea x , esi
inc ed x
shl eax , 16
keyfive_1:
sub edx , eax
mcall 18 , 19 , 5
ret
jmp still
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
righ t:
lef t:
mov eax , esi
mov eax , esi
shl eax , 16
shl eax , 16
add edx , eax
sub edx , eax
ret
ret
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
down :
right :
add ed x , esi
mov ea x , esi
ret
shl eax , 16
;-----------------------------------------------------------------------------
add edx , eax
up:
ret
sub edx , esi
;-----------------------------------------------------------------------------
ret
down:
;-----------------------------------------------------------------------------
add edx , esi
mouseread:
ret
xor ebx , ebx
;-----------------------------------------------------------------------------
mcall 37
up:
add edx , eax
sub edx , esi
ret
sravn:
;-----------------------------------------------------------------------------
xor ebx , ebx
mouseread:
xor edi , edi
xor ebx , ebx
mcall 37
real:
add edx , eax
mov ebx , edx
mov edi , ebx
sravn:
sh r ebx , 16 ; get x1
xo r ebx , ebx
; shl edi,16 ; get y1
xor edi , edi
; shr edi,16
and edi , 0xffff
real:
mov ebx , edx
nullli:
mov edi , ebx
add ebx , 16
shr ebx , 16 ; get x1
cmp ebx , 65535
; shl edi,16 ; get y1
jg xmin
; shr edi,16
sub ebx , 15
and edi , 0xffff
add edi , 16
nullli:
cmp edi , 65535
add ebx , 1 6
jg ymin
cmp ebx , 65535
sub edi , 15
jg xmin
sub ebx , 15
razr:
mcall 14
add edi , 16
cmp edi , 65535
mov ecx , eax
jg ymin
shr eax , 16 ; get x2
sub edi , 15
; shl ecx,16 ; get y2
; shr ecx,16
razr:
and ecx , 0xffff
mcall 14
rightdownli:
mov ecx , eax
cmp eax , ebx
shr eax , 16 ; get x2
jl xmax
; shl ecx,16 ; get y2
cmp ecx , edi
; shr ecx,16
jl ymax
and ecx , 0xffff
mousewrite :
rightdownli :
mcall 18 , 19 , 4
cmp eax , ebx
mcall 26 , 9
jl xmax
mov [ mouse_timer_ticks ] ,eax
cmp ecx , edi
jmp still
jl ymax
;-----------------------------------------------------------------------------
mouse_acceleration :
mousewrite :
xor esi , esi
mcall 18 , 19 , 4
inc esi
mcall 26 , 9
mcall 18 , 19 , 2
mov [ mouse_timer_ticks ] ,eax
mov ecx , eax
jmp still
mcall 26 , 9
;-----------------------------------------------------------------------------
sub eax ,[ mouse_tim er_ ticks ]
mouse_accel era tion:
cmp eax , ecx ; mouse_delay
xor esi , esi
ja @ f
inc esi
xor ecx , ecx
mcall 18 , 19 , 2
mcall 18 , 19 ; checkspeed
mov ecx , eax
mov esi , eax
mcall 26 , 9
shl esi ,2
sub eax ,[ mouse_timer_ticks ]
@ @ :
cmp eax , ecx ; mouse_delay
ret
ja @ f
;-----------------------------------------------------------------------------
xor ecx , ecx
xmax:
mcall 18 , 19 ; checkspeed
dec eax
mov esi , eax
dec ebx
shl esi , 2
dec edi
@ @ :
shl eax , 16
ret
add edi , eax
;-----------------------------------------------------------------------------
mov edx , edi
xmax:
jmp sravn
dec eax
;-----------------------------------------------------------------------------
dec ebx
xmin:
dec edi
mov ed x , edi
shl ea x , 16
jmp sravn
add edi , eax
;-----------------------------------------------------------------------------
mov edx , edi
ymax:
jmp sravn
dec ecx
;-----------------------------------------------------------------------------
dec ebx
xmin:
mov edx , edi
shl ebx , 16
jmp sravn
mov edi , ebx
;-----------------------------------------------------------------------------
add edi , ecx
ymax:
mov ed x , edi
dec ec x
jmp sravn
dec ebx
;-----------------------------------------------------------------------------
ymin:
shl ebx , 16
shl ebx , 16
mov edi , ebx
mov edx , eb x
add edi , ec x
shr eb x , 16
mov ed x , edi
jmp sravn
jmp sravn
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
hotkeys_commo n:
ymi n:
xor ec x , ecx
shl eb x , 16
xor edx , ed x
mov edx , eb x
mov cl , 79 ; Down Num 1
shr ebx , 16
mcall 66
jmp sravn
;-----------------------------------------------------------------------------
mov cl , 80 ; Down Num 2
hotkeys_common:
mcall 66
xor ecx , ecx
xor edx , edx
mov cl , 81 ; Down Num 3
mov cl , 79 ; Down Num 1
mcall 66
mcall 66
mov cl , 75 ; Down Num 4
mov cl , 80 ; Down Num 2
mcall 66
mcall 66
mov cl , 76 ; Down Num 5
mov cl , 81 ; Down Num 3
mcall 66
mcall 66
mov cl , 204 ; Up Num 5
mov cl , 75 ; Down Num 4
mcall 66
mcall 66
mov cl , 77 ; Down Num 6
mov cl , 76 ; Down Num 5
mcall 66
mcall 66
mov cl , 71 ; Down Num 7
mov cl , 204 ; Up Num 5
mcall 66
mcall 66
mov cl , 72 ; Down Num 8
mov cl , 77 ; Down Num 6
mcall 66
mcall 66
mov cl , 73 ; Down Num 9
mov cl , 71 ; Down Num 7
mcall 66
mcall 66
; disable/enable input, work only hotkeys (f.66.6,66.7)
add ebx , 2
mov cl , 7 2 ; Down Num 8
mcall 66
mcall 66
ret
;-----------------------------------------------------------------------------
mov cl , 73 ; Down Num 9
; <--- initialised data --->
mcall 66
DATA
; disable/enable input, work only hotkeys (f.66.6,66.7)
;-----------------------------------------------------------------------------
add ebx , 2
; <--- uninitialised data --->
mcall 66
UDATA
ret
mouse_timer_ticks dd 0
;-----------------------------------------------------------------------------
;------------------------------------------------------------------------ -----
; <--- initialised data --->
if lang eq ru_RU
DATA
ud_user_message db '"NumLock ¢ª«îç ¥â ¨ ¢ëª«îç ¥â í¬ã«ïâ®à ¬ëè¨.\n“¯à ¢«¥ ¨¥ ç¥à¥§ Numpad." -I' , 0
;-----------------------------------------------------------------------------
else if lang eq it_IT
; <--- uninitialised data --->
ud_user_message db '"NumLock - on/off - usa Numpad per muovere il cursore." -I' , 0
UDATA
else
mouse_timer_ticks dd 0
ud_user_message db '"NumLock - on/off mouse emul. Numpad - move cursor." -I' , 0
;-----------------------------------------------------------------------------
end if
if lang eq ru_RU
ud_user_message db '"NumLock ¢ª«îç ¥â ¨ ¢ëª«îç ¥â í¬ã«ïâ®à ¬ëè¨.\n“¯à ¢«¥ ¨¥ ç¥à¥§ Numpad." -I' , 0
notifyapp:
else if lang eq it_IT
dd 7
ud_user_message db '"NumLock - on/off - usa Numpad per muovere il cursore." -I' , 0
dd 0
else
dd ud_user_message
ud_user_message db '"NumLock - on/off mouse emul. Numpad - move cursor." -I' , 0
dd 0
end if
dd 0
db '@notify' , 0
notifyapp:
;-----------------------------------------------------------------------------
dd 7
MEOS_APP_END
dd 0
; <--- end of KolibriOS application --->
dd ud_user_message
; ZG
dd 0
dd 0
db '@notify' , 0
;-----------------------------------------------------------------------------
MEOS_APP_END
; <--- end of KolibriOS application --->
; ZG