mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-01 21:17:05 +03:00
5b05341aae
git-svn-id: svn://kolibrios.org@2726 a494cfbc-eb01-0410-851d-a64ba20cac60
137 lines
5.3 KiB
NASM
137 lines
5.3 KiB
NASM
;------------------------------------------------------------------------------
|
||
; Mad Mouse
|
||
;---------------------------------------------------------------------
|
||
; version: 0.2
|
||
; last update: 03/06/2012
|
||
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
||
; changes: Some optimizations.
|
||
;---------------------------------------------------------------------
|
||
; €¢â®à í⮣® 㦠ᮠáâ६®£® ª®¤ : Sourcerer, 23.04.2010
|
||
; popovpa (29.05.2012)
|
||
; 1. ˆ§¬¥¥¨¥ «®£¨ª¨ à ¡®âë ¯à®£à ¬¬ë.
|
||
; 2. „®¡ ¢«¥® "¯¥à¥áª ª¨¢ ¨¥" ᢥàåã ¨ ¨§ã :)
|
||
; 3. Ž¯â¨¬¨§ æ¨ï ª®¤ .
|
||
;------------------------------------------------------------------------------
|
||
use32 ; âà á«ïâ®à, ¨á¯®«ì§ãî騩 32-å à §àï¤ë¥ ª®¬ ¤ë
|
||
org 0x0 ; ¡ §®¢ë© ¤à¥á ª®¤ , ¢á¥£¤ 0x0
|
||
|
||
db 'MENUET01' ; 1. ¨¤¥â¨ä¨ª â®à ¨á¯®«ï¥¬®£® ä ©« (8 ¡ ©â)
|
||
dd 0x01 ; 2. ¢¥àá¨ï ä®à¬ â § £®«®¢ª ¨á¯®«ï¥¬®£® ä ©«
|
||
dd START ; 3. ¤à¥á, ª®â®àë© á¨á⥬ ¯¥à¥¤ ñâ ã¯à ¢«¥¨¥
|
||
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥¨ï ¢ ¯ ¬ïâì
|
||
dd IM_END ; 4. à §¬¥à ¯à¨«®¦¥¨ï
|
||
dd I_END ; 5. ®¡êñ¬ ¥®¡å®¤¨¬®© ¯à¨«®¦¥¨î ¯ ¬ïâ¨
|
||
; ¬®¦® ®¡à é âìáï ª ¯ ¬ï⨠¢ ¤¨ ¯ §®¥ ®â 0x0
|
||
; ¤® § 票ï, ®¯à¥¤¥«ñ®£® §¤¥áì
|
||
dd stack_area ; 6. ¢¥àè¨ á⥪ ¢ ¤¨ ¯ §®¥ ¯ ¬ïâ¨, 㪠§ ®¬ ¢ëè¥
|
||
dd 0x0 ; 7. 㪠§ ⥫ì áâபã á ¯ à ¬¥âà ¬¨.
|
||
; ¥á«¨ ¯®á«¥ § ¯ã᪠¥à ¢® ã«î, ¯à¨«®¦¥¨¥ ¡ë«®
|
||
; § ¯ã饮 á ¯ à ¬¥âà ¬¨ ¨§ ª®¬ ¤®© áâப¨
|
||
dd 0x0 ; 8. 㪠§ ⥫ì áâபã, ¢ ª®â®àãî § ¯¨á ¯ãâì,
|
||
; ®âªã¤ § ¯ã饮 ¯à¨«®¦¥¨¥
|
||
;------------------------------------------------------------------------------
|
||
; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì ¯à®£à ¬¬¨áâ
|
||
include '../../macros.inc'
|
||
;------------------------------------------------------------------------------
|
||
;--- <20>€—€‹Ž <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||
;------------------------------------------------------------------------------
|
||
START: ; ¤à¥á ç « ¯à®£à ¬¬ë
|
||
mov eax,40 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩.
|
||
mov ebx,100000b ;㦮 ⮫쪮 ᮡë⨥ ¬ëè¨
|
||
int 0x40
|
||
;------------------------------------------------------------------------------
|
||
;--- –ˆŠ‹ Ž<><C5BD>€<EFBFBD>Ž’Šˆ ‘Ž<E28098>›’ˆ‰ ----------------------------------------
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
still:
|
||
mov eax,10 ;®¦¨¤ âì ᮡë⨩
|
||
int 0x40
|
||
|
||
mov eax,14 ;äãªæ¨ï 14 - ¯®«ãç¨âì à §¬¥à íªà
|
||
int 0x40 ;¢ë§®¢ ä.14 ¢ 横«¥ ¯®â®¬ã çâ® ¬®¦¥â
|
||
;¯®¬¥ïâìáï à §à¥è¥¨¥ íªà
|
||
mov ebx,eax
|
||
shl ebx,16
|
||
shr ebx,16
|
||
mov edi,ebx ;á®åà ¨¬ ã
|
||
shr eax,16 ;ᤢ¨£ ¥¬ eax ¢¯à ¢® 16 - ¯®«ãç ¥¬ x
|
||
mov esi,eax ;á®åà ¨¬ x
|
||
;¯®«ãç ¥¬ ª®®à¤¨ âë ªãàá®à
|
||
mov eax,37 ;äãªæ¨ï 37 - à ¡®â á ¬ëèìî
|
||
xor ebx,ebx ;¯®¤äãªæ¨ï 0 - ª®®à¤¨ âë ¬ëè¨
|
||
;®â®á¨â¥«ì® íªà
|
||
int 0x40
|
||
|
||
mov ebx,eax ;§ ¯®¬¨ ¥¬ ª®®à¤¨ âë
|
||
shr eax,16 ;⥯¥àì ã á ⮫쪮 x. 㦥 ¨ y
|
||
mov ecx,eax ;§ ¯®¬¨ ¥¬ x
|
||
shl ebx,16 ;ᤢ¨¥¬ ¢«¥® 16
|
||
shr ebx,16 ;ᤢ¨¥¬¢ ¯à ¢® 16, ã á ¥áâì ã
|
||
;------------------------------------------------------------------------------
|
||
;¢ esi ¨ edi ª®®à¤¨ âë à §¬¥à íªà X ¨ Y ᮮ⢥âᢥ®
|
||
;¢ ecx ¨ ebx ª®®à¤¨ âë ªãàá®à X ¨ Y ᮮ⢥⢥®
|
||
;------------------------------------------------------------------------------
|
||
;áà ¢¥¨¥ ª®®à¤¨ â x
|
||
test ecx,ecx ;à ¢ 0?
|
||
jz left_border ;¯¥à¥å®¤ ª ®¡à ¡®âª¥ ã «¥¢®£® ªà ï
|
||
|
||
cmp ecx,esi ;à ¢ è¨à¨¥ íªà ?
|
||
jz right_border ;¯¥à¥å®¤¨¬ ª ®¡à ¡®âª¥ ã ¯à ¢®£® ªà ï
|
||
;áà ¢¥¨¥ ª®®à¤¨ â y
|
||
test ebx,ebx ;à ¢ 0?
|
||
jz top_border ;¥á«¨ ¤ § ç¨â ªãàá®à ¢¢¥àåã
|
||
|
||
cmp ebx,edi ;à ¢ ¢ëá®â¥ íªà ?
|
||
jz bottom_border ;¯¥à¥å®¤ ª ®¡à ¡®âª¥ ã ¨¦¥£® ªà ï
|
||
|
||
jmp still ;¨ ç¥ ¨ç¥£® ¤¥« âì ¥ 㦮
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
left_border:
|
||
mov edx,esi ;¢ edx ¨¬¥¥¬ è¨à¨ã íªà
|
||
dec edx ;㬥ì訬 1
|
||
shl edx,16 ;⥯¥àì edx=(x-1)*65536
|
||
add edx,ebx ; ⥯¥àì edx=(x-1)*65536+y
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
set_mouse_position:
|
||
mov eax,18 ;äãªæ¨ï 18: ãáâ ®¢¨âì áâனª¨ ¬ëè¨
|
||
mov ebx,19 ;¯®¤äãªæ¨ï 19
|
||
mov ecx,4 ;¯®¤¯®¤äãªæ¨ï 4: ãáâ ®¢¨âì ¯®«®¦¥¨¥
|
||
;ªãàá®à
|
||
int 0x40
|
||
jmp still ;®â¤ëå ¥¬
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
right_border: ;ªãàá®à ã ¯à ¢®£® ªà ï
|
||
|
||
xor edx,edx
|
||
inc edx ;edx=1
|
||
shl edx,16 ;edx = 1*65536
|
||
add edx,ebx ;edx=1*65536+y
|
||
jmp set_mouse_position
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
top_border: ;ªãàá®à ã ¢¥à奣® ªà ï
|
||
|
||
mov edx,ecx ;• ª®®à¤¨ â ªãàá®à
|
||
shl edx,16 ;⥯¥àì edx=(x)*65536
|
||
add edx,edi ; ⥯¥àì edx=(x)*65536+y
|
||
dec edx ; ⥯¥àì edx=(x)*65536+(ã-1)
|
||
jmp set_mouse_position
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
bottom_border: ;ªãàá®à ã ¨¦¥£® ªà ï
|
||
mov edx,ecx ;edx=ecx x ª®®à¤¨ â ªãàá®à
|
||
shl edx,16 ;edx = å*65536
|
||
;ã ª®®à¤¨ â à ¢ 0
|
||
jmp set_mouse_position
|
||
;------------------------------------------------------------------------------
|
||
IM_END: ; ¬¥âª ª®æ ª®¤
|
||
;------------------------------------------------------------------------------
|
||
align 4
|
||
rb 1024
|
||
stack_area:
|
||
;------------------------------------------------------------------------------
|
||
I_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë
|
||
;------------------------------------------------------------------------------ |