kolibrios-fun/programs/other/madmouse/madmouse.asm
pathoswithin ff6211368f bugfix
git-svn-id: svn://kolibrios.org@6331 a494cfbc-eb01-0410-851d-a64ba20cac60
2016-03-13 04:04:08 +00:00

134 lines
5.2 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;------------------------------------------------------------------------------
; 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. 㪠§ â¥«ì ­  áâபã, ¢ ª®â®àãî § ¯¨á ­ ¯ãâì,
; ®âªã¤  § ¯ã饭® ¯à¨«®¦¥­¨¥
;------------------------------------------------------------------------------
;--- <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
inc edx ;ã ª®®à¤¨­ â  à ¢­  1
jmp set_mouse_position
;------------------------------------------------------------------------------
IM_END: ; ¬¥âª  ª®­æ  ª®¤ 
;------------------------------------------------------------------------------
align 4
rb 1024
stack_area:
;------------------------------------------------------------------------------
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
;------------------------------------------------------------------------------