diff --git a/programs/system/mousemul/trunk/MOUSEMUL.DBG b/programs/system/mousemul/trunk/MOUSEMUL.DBG deleted file mode 100644 index 64501b8509..0000000000 --- a/programs/system/mousemul/trunk/MOUSEMUL.DBG +++ /dev/null @@ -1,117 +0,0 @@ -0x0 RECT.left -0x4 RECT.top -0x8 RECT.right -0xC RECT.bottom -0x0 BOX.left -0x4 BOX.top -0x8 BOX.width -0xC BOX.height -0x0 process_information.cpu_usage -0x4 process_information.window_stack_position -0x6 process_information.window_stack_value -0x8 process_information.anonymous?0000014 -0xA process_information.process_name -0x16 process_information.memory_start -0x1A process_information.used_memory -0x1E process_information.PID -0x22 process_information.box -0x22 process_information.box.left -0x26 process_information.box.top -0x2A process_information.box.width -0x2E process_information.box.height -0x32 process_information.slot_state -0x34 process_information.anonymous?0000015 -0x36 process_information.client_box -0x36 process_information.client_box.left -0x3A process_information.client_box.top -0x3E process_information.client_box.width -0x42 process_information.client_box.height -0x46 process_information.wnd_state -0x47 process_information.anonymous?0000016 -0x0 system_colors.frame -0x4 system_colors.grab -0x8 system_colors.grab_button -0xC system_colors.grab_button_text -0x10 system_colors.grab_text -0x14 system_colors.work -0x18 system_colors.work_button -0x1C system_colors.work_button_text -0x20 system_colors.work_text -0x24 system_colors.work_graph -0x0 FILEDATE.Second -0x1 FILEDATE.Minute -0x2 FILEDATE.Hour -0x3 FILEDATE.anonymous?000004B -0x4 FILEDATE.Day -0x5 FILEDATE.Month -0x6 FILEDATE.Year -0x0 FILEINFO.Attributes -0x4 FILEINFO.IsUnicode -0x5 FILEINFO.anonymous?000005C -0x8 FILEINFO.DateCreate -0x8 FILEINFO.DateCreate.Second -0x9 FILEINFO.DateCreate.Minute -0xA FILEINFO.DateCreate.Hour -0xB FILEINFO.DateCreate.anonymous?000004B -0xC FILEINFO.DateCreate.Day -0xD FILEINFO.DateCreate.Month -0xE FILEINFO.DateCreate.Year -0x10 FILEINFO.DateAccess -0x10 FILEINFO.DateAccess.Second -0x11 FILEINFO.DateAccess.Minute -0x12 FILEINFO.DateAccess.Hour -0x13 FILEINFO.DateAccess.anonymous?000004B -0x14 FILEINFO.DateAccess.Day -0x15 FILEINFO.DateAccess.Month -0x16 FILEINFO.DateAccess.Year -0x18 FILEINFO.DateModify -0x18 FILEINFO.DateModify.Second -0x19 FILEINFO.DateModify.Minute -0x1A FILEINFO.DateModify.Hour -0x1B FILEINFO.DateModify.anonymous?000004B -0x1C FILEINFO.DateModify.Day -0x1D FILEINFO.DateModify.Month -0x1E FILEINFO.DateModify.Year -0x20 FILEINFO.Size -0x24 __start -0x346 __end -0xB60 __memory -0xB60 __stack -0x24 start -0x2C wait_event_one -0x15D checkspeed -0x53 wait_event_two -0xEA unset_hotkeys -0x76 set_hotkeys -0x67 key -0x202 mousewriteli -0x16A mouseread -0x186 sravn -0x18A real -0x197 nullli -0x1E7 xmin -0x1F8 ymin -0x1B3 razr -0x1C3 rightdownli -0x1DB xmax -0x1EB ymax -0x1CB mousewrite -0x244 keyone -0x259 keytwo -0x26E keythree -0x283 keyfour -0x298 keysix -0x2AD keyseven -0x2C2 keyeight -0x2D7 keynine -0x2EC keyfive -0x314 left -0x332 down -0x323 right -0x33C up -0x316 leftstart -0x325 rightstart -0x334 downstart -0x33E upstart -0x346 __data -0x346 __udata diff --git a/programs/system/mousemul/trunk/build.bat b/programs/system/mousemul/trunk/build.bat index e9db324544..5e2ced9449 100644 --- a/programs/system/mousemul/trunk/build.bat +++ b/programs/system/mousemul/trunk/build.bat @@ -1,2 +1,2 @@ -@fasm mousEmul.asm mousemul +@fasm mousemul.asm mousemul @pause \ No newline at end of file diff --git a/programs/system/mousemul/trunk/build.sh b/programs/system/mousemul/trunk/build.sh new file mode 100755 index 0000000000..532a80e2f1 --- /dev/null +++ b/programs/system/mousemul/trunk/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# This script does for linux the same as build.bat for DOS, +# it compiles the KoOS kernel, hopefully ;-) + + echo "lang fix en" + echo "lang fix en" > lang.inc + fasm -m 16384 mousemul.asm mousemul + rm -f lang.inc + exit 0 + + + + diff --git a/programs/system/mousemul/trunk/macros.inc b/programs/system/mousemul/trunk/macros.inc deleted file mode 100644 index a4b724b1bf..0000000000 --- a/programs/system/mousemul/trunk/macros.inc +++ /dev/null @@ -1,263 +0,0 @@ -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if used name - db data - end if - common - if used name - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if (used name)&(lang eq lng) - db data - end if - common - if used name - .size = $-name - end if -} - - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,b { ; mike.dld - if (~a eq)&(~b eq) - mpack reg,a,b - else if (~a eq)&(b eq) - mov reg,a - end if -} - -macro mcall a,b,c,d,e,f { ; mike.dld - __mov eax,a - __mov ebx,b - __mov ecx,c - __mov edx,d - __mov esi,e - __mov edi,f - int 0x40 -} - - - -; optimize the code for size -__regs fix - -macro add arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - inc arg1 - else - add arg1,arg2 - end if - else - add arg1,arg2 - end if - } - -macro sub arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - dec arg1 - else - sub arg1,arg2 - end if - else - sub arg1,arg2 - end if - } - -macro mov arg1,arg2 - { - if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) - if (arg2) = 0 - xor arg1,arg1 - else if (arg2) = 1 - xor arg1,arg1 - inc arg1 - else if (arg2) = -1 - or arg1,-1 - else if (arg2) > -128 & (arg2) < 128 - push arg2 - pop arg1 - else - mov arg1,arg2 - end if - else - mov arg1,arg2 - end if - } - - -macro struct name - { - virtual at 0 - name name - sizeof.#name = $ - name - end virtual - } - -; structures used in MeOS -struc process_information - { - .cpu_usage dd ? ; +0 - .window_stack_position dw ? ; +4 - .window_stack_value dw ? ; +6 - .not_used1 dw ? ; +8 - .process_name rb 12 ; +10 - .memory_start dd ? ; +22 - .used_memory dd ? ; +26 - .PID dd ? ; +30 - .x_start dd ? ; +34 - .y_start dd ? ; +38 - .x_size dd ? ; +42 - .y_size dd ? ; +46 - .slot_state dw ? ; +50 - rb (1024-52) - } -struct process_information - -struc system_colors - { - .frame dd ? - .grab dd ? - .grab_button dd ? - .grab_button_text dd ? - .grab_text dd ? - .work dd ? - .work_button dd ? - .work_button_text dd ? - .work_text dd ? - .work_graph dd ? - } -struct system_colors - - -; constants - -; events -EV_IDLE = 0 -EV_TIMER = 0 -EV_REDRAW = 1 -EV_KEY = 2 -EV_BUTTON = 3 -EV_EXIT = 4 -EV_BACKGROUND = 5 -EV_MOUSE = 6 -EV_IPC = 7 -EV_STACK = 8 - -; event mask bits for function 40 -EVM_REDRAW = 1b -EVM_KEY = 10b -EVM_BUTTON = 100b -EVM_EXIT = 1000b -EVM_BACKGROUND = 10000b -EVM_MOUSE = 100000b -EVM_IPC = 1000000b -EVM_STACK = 10000000b \ No newline at end of file diff --git a/programs/system/mousemul/trunk/mousEmul.ASM b/programs/system/mousemul/trunk/mousEmul.ASM deleted file mode 100644 index fc28623b6c..0000000000 --- a/programs/system/mousemul/trunk/mousEmul.ASM +++ /dev/null @@ -1,513 +0,0 @@ -; <--- description ---> -; compiler: FASM 1.67.23 -; name: Mouse Emulation For KolibriOS -; version: 0.8 -; last update: 03/10/2007 -; written by: Zlobny_Gluk -; e-mail: umbrosia@land.ru - - -; <--- include all KolibriOS stuff ---> -;include "lang.inc" -include "MACROS.INC" - - -; <--- start of KolibriOS application ---> -MEOS_APP_START - - -; <--- start of code ---> -CODE - - start: - - ;set an waiting mask - mcall 40,10b - - - wait_event_one: - - call checkspeed - - - mov eax,66 - mov ebx,3 - int 0x40 - test eax,0x80 - jnz wait_event_two - - cmp ebp,1 - je unset_hotkeys - - - mov eax,5 - mov ebx,10 - int 0x40 - - jmp wait_event_one - - - wait_event_two: - cmp ebp,0 - je set_hotkeys - mov ebp,1 - mov eax,10 - int 0x40 - - cmp eax, 2 ; if event == 2 - jmp key ; jump to key handler - - jmp wait_event_one ; else return to the start of main cycle - - - - key: ; key event handler - mov eax, 2 ; get key code - int 0x40 - cmp al,2 - je mousewriteli - jmp wait_event_one - - - - set_hotkeys: - - - mov eax,66 - mov ebx,4 - mov cl,79d - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,80 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,81 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,75 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,76 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,77 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,71 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,72 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,4 - mov cl,73 - mov edx,0 - int 0x40 - - - mov ebp,1 - - jmp wait_event_two - - - unset_hotkeys: - - - mov eax,66 - mov ebx,5 - mov cl,79 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,80 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,81 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,75 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,76 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,77 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,71 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,72 - mov edx,0 - int 0x40 - - mov eax,66 - mov ebx,5 - mov cl,73 - mov edx,0 - int 0x40 - - - xor ebp,ebp - - jmp wait_event_one - -checkspeed: - mov eax,18 - mov ebx,19 - xor ecx,ecx - int 0x40 - mov esi,eax -ret - - - mouseread: - - ;numchecking - mov eax,66 - mov ebx,3 - int 0x40 - test eax,0x80 - jz wait_event_one - - ;mousereading - mov eax,37 - mov ebx,0 - int 0x40 - add edx,eax - - - sravn: - xor ebx,ebx - xor edi,edi - - - real: - mov ebx,edx - mov edi,ebx - shr ebx,16 ; get x1 - shl edi,16 ; get y1 - shr edi,16 - - nullli: - add ebx,16 - cmp ebx,65535 - jg xmin - sub ebx,15 - - add edi,16 - cmp edi,65535 - jg ymin - sub edi,15 - - razr: - mov eax,14 - int 0x40 - - - mov ecx,eax - shr eax,16 ; get x2 - shl ecx,16 ; get y2 - shr ecx,16 - - rightdownli: - cmp eax,ebx - jl xmax - cmp ecx,edi - jl ymax - - - mousewrite: - mov eax,18 - mov ebx,19 - mov ecx,4 - int 0x40 - jmp wait_event_one - - xmax: - - dec eax - dec ebx - dec edi - shl eax,16 - add edi,eax - mov edx,edi - jmp sravn - - xmin: - - mov edx,edi - jmp sravn - - - ymax: - - dec ecx - dec ebx - - shl ebx,16 - mov edi,ebx - add edi,ecx - mov edx,edi - jmp sravn - - ymin: - shl ebx,16 - mov edx,ebx - shr ebx,16 - jmp sravn - - - - - - - - mousewriteli: - cmp ah,79 - je keyone - cmp ah,80 - je keytwo - cmp ah,81 - je keythree - cmp ah,75 - je keyfour - cmp ah,77 - je keysix - cmp ah,71 - je keyseven - cmp ah,72 - je keyeight - cmp ah,73 - je keynine - cmp ah,76 - je keyfive - - jmp wait_event_one - - -;how_much_time: -;mov eax,26 -;mov ebx,9 -;int 0x40 -;push eax -;ret - - -;oldkeyvsyakoe! -;incesi: -;inc esi -;ret - -;nullesi: -;xor esi, esi -;ret - - -;oldkey: -;cmp ah, bh -;je incesi -;cmp ah, bh -;jne nullesi -;ret - - -keyone: - -;call oldkey -xor edx,edx -call left -call down -xor ah,ah -mov bh,79 -jmp mouseread - -keytwo: - -;call oldkey -xor edx,edx -call down -call down -xor ah,ah -mov bh,80 -jmp mouseread - -keythree: - -;call oldkey -xor edx,edx -call right -call down -xor ah,ah -mov bh,81 -jmp mouseread - -keyfour: - -;call oldkey -xor edx,edx -call left -call left -xor ah,ah -mov bh,75 -jmp mouseread - -keysix: - -;call oldkey -xor edx,edx -call right -call right -xor ah,ah -mov bh,77 -jmp mouseread - -keyseven: - -;call oldkey -xor edx,edx -call left -call up -xor ah,ah -mov bh,71 -jmp mouseread - -keyeight: - -;call oldkey -xor edx,edx -call up -call up -xor ah,ah -mov bh,72 -jmp mouseread - -keynine: - -;call oldkey -xor edx,edx -call right -call up -xor ah,ah -mov bh,73 -jmp mouseread - -keyfive: - - mcall 18, 19, 5, 1 - mov eax,5 - mov ebx,1 - int 0x40 - mcall 18, 19, 5, 0 -jmp wait_event_one - - - - -left: -mov eax,esi - -leftstart: -dec eax -sub edx,65536 -cmp eax,0 -ja leftstart -ret - - -right: -mov eax,esi - -rightstart: -dec eax -add edx,65536 -cmp eax,0 -ja rightstart -ret - - -down: -mov eax,esi - -downstart: -dec eax -add edx,1 -cmp eax,0 -ja downstart -ret - - -up: -mov eax,esi - -upstart: -dec eax -sub edx,1 -cmp eax,0 -ja upstart -ret - - - - - - - - - - - -; <--- initialised data ---> -DATA - - -; <--- uninitialised data ---> -UDATA - - -MEOS_APP_END -; <--- end of KolibriOS application ---> -; ZG \ No newline at end of file diff --git a/programs/system/mousemul/trunk/mousemul.asm b/programs/system/mousemul/trunk/mousemul.asm new file mode 100644 index 0000000000..f7f53fb4a0 --- /dev/null +++ b/programs/system/mousemul/trunk/mousemul.asm @@ -0,0 +1,274 @@ +; <--- description ---> +; compiler: FASM 1.67.23 +; name: Mouse Emulation For KolibriOS +;----------------------------------------------------------------------------- +; version: 1.0 +; last update: 04/09/2010 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: total optimization of code, +; different events for Up and Down of key Num 5 +; advansed acceleration mode +;----------------------------------------------------------------------------- +; version: 0.8 +; last update: 03/10/2007 +; written by: Zlobny_Gluk +; e-mail: umbrosia@land.ru +;----------------------------------------------------------------------------- +; <--- include all KolibriOS stuff ---> +;include "lang.inc" +include '../../../macros.inc' + +; <--- start of KolibriOS application ---> +MEOS_APP_START + +; <--- start of code ---> +CODE +;----------------------------------------------------------------------------- +start: + xor ebx,ebx + mcall 40 +@@: + mcall 23,10 + + mcall 66,3 + test eax,0x80 + jz @r + + mov ebx,4 + call hotkeys_common + + mcall 40,10b +still: + mcall 10 + + cmp eax,2 ; if event == 2 + jne still +;----------------------------------------------------------------------------- +key: ; key event handler + call mouse_acceleration + + mcall 2 ; get key code + + push eax + mcall 66,3 + test eax,0x80 + pop eax + jnz @f + mov ebx,5 + call hotkeys_common + jmp start +@@: + cmp al,2 + jne still + + xor edx,edx + + cmp ah,80 ; Down Num 2 + je keytwo + cmp ah,81 ; Down Num 3 + je keythree + cmp ah,75 ; Down Num 4 + je keyfour + cmp ah,77 ; Down Num 6 + je keysix + cmp ah,71 ; Down Num 7 + je keyseven + cmp ah,72 ; Down Num 8 + je keyeight + cmp ah,73 ; Down Num 9 + je keynine + cmp ah,76 ; Down Num 5 + je keyfive + cmp ah,204 ; Up Num 5 + je keyfive_1 + cmp ah,79 ; Down Num 1 + jne still +;----------------------------------------------------------------------------- +keyone: + call down +keyfour: + call left + jmp mouseread +;----------------------------------------------------------------------------- +keythree: + call right +keytwo: + call down + jmp mouseread +;----------------------------------------------------------------------------- +keyseven: + call left +keyeight: + call up + jmp mouseread +;----------------------------------------------------------------------------- +keynine: + call up +keysix: + call right + jmp mouseread +;----------------------------------------------------------------------------- +keyfive: + inc edx +keyfive_1: + mcall 18,19,5 + jmp still +;----------------------------------------------------------------------------- +left: + mov eax,esi + shl eax,16 + sub edx,eax + ret +;----------------------------------------------------------------------------- +right: + mov eax,esi + shl eax,16 + add edx,eax + ret +;----------------------------------------------------------------------------- +down: + add edx,esi + ret +;----------------------------------------------------------------------------- +up: + sub edx,esi + ret +;----------------------------------------------------------------------------- +mouseread: + xor ebx,ebx + mcall 37 + add edx,eax + +sravn: + xor ebx,ebx + xor edi,edi + +real: + mov ebx,edx + mov edi,ebx + shr ebx,16 ; get x1 +; shl edi,16 ; get y1 +; shr edi,16 + and edi,0xffff + +nullli: + add ebx,16 + cmp ebx,65535 + jg xmin + sub ebx,15 + + add edi,16 + cmp edi,65535 + jg ymin + sub edi,15 + +razr: + mcall 14 + + mov ecx,eax + shr eax,16 ; get x2 +; shl ecx,16 ; get y2 +; shr ecx,16 + and ecx,0xffff + +rightdownli: + cmp eax,ebx + jl xmax + cmp ecx,edi + jl ymax + +mousewrite: + mcall 18,19,4 + mcall 26,9 + mov [mouse_timer_ticks],eax + jmp still +;----------------------------------------------------------------------------- +mouse_acceleration: + xor esi,esi + inc esi + mcall 18,19,2 + mov ecx,eax + mcall 26,9 + sub eax,[mouse_timer_ticks] + cmp eax,ecx ; mouse_delay + ja @f + xor ecx,ecx + mcall 18,19 ; checkspeed + mov esi,eax + shl esi,2 +@@: + ret +;----------------------------------------------------------------------------- +xmax: + dec eax + dec ebx + dec edi + shl eax,16 + add edi,eax + mov edx,edi + jmp sravn +;----------------------------------------------------------------------------- +xmin: + mov edx,edi + jmp sravn +;----------------------------------------------------------------------------- +ymax: + dec ecx + dec ebx + + shl ebx,16 + mov edi,ebx + add edi,ecx + mov edx,edi + jmp sravn +;----------------------------------------------------------------------------- +ymin: + shl ebx,16 + mov edx,ebx + shr ebx,16 + jmp sravn +;----------------------------------------------------------------------------- +hotkeys_common: + xor ecx,ecx + xor edx,edx + mov cl,79 ; Down Num 1 + mcall 66 + + mov cl,80 ; Down Num 2 + mcall 66 + + mov cl,81 ; Down Num 3 + mcall 66 + + mov cl,75 ; Down Num 4 + mcall 66 + + mov cl,76 ; Down Num 5 + mcall 66 + + mov cl,204 ; Up Num 5 + mcall 66 + + mov cl,77 ; Down Num 6 + mcall 66 + + mov cl,71 ; Down Num 7 + mcall 66 + + mov cl,72 ; Down Num 8 + mcall 66 + + mov cl,73 ; Down Num 9 + mcall 66 + ret +;----------------------------------------------------------------------------- +; <--- initialised data ---> +DATA +;----------------------------------------------------------------------------- +; <--- uninitialised data ---> +UDATA +mouse_timer_ticks dd 0 +;----------------------------------------------------------------------------- +MEOS_APP_END +; <--- end of KolibriOS application ---> +; ZG \ No newline at end of file