kolibrios/programs/other/madmouse.asm
popovpa 2ac31d5946 [madmouse]
+ The first version of the program.

git-svn-id: svn://kolibrios.org@2724 a494cfbc-eb01-0410-851d-a64ba20cac60
2012-06-02 20:10:17 +00:00

140 lines
4.5 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
; €¢â®à í⮣® 㦠᭮ áâ६­®£® ª®¤ : 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 I_END ; 4. à §¬¥à ¯à¨«®¦¥­¨ï
dd 0x100000 ; 5. ®¡êñ¬ ­¥®¡å®¤¨¬®© ¯à¨«®¦¥­¨î ¯ ¬ïâ¨
; ¬®¦­® ®¡à é âìáï ª ¯ ¬ï⨠¢ ¤¨ ¯ §®­¥ ®â 0x0
; ¤® §­ ç¥­¨ï, ®¯à¥¤¥«ñ­­®£® §¤¥áì
dd 0x100000 ; 6. ¢¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd 0x0 ; 7. 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
; ¥á«¨ ¯®á«¥ § ¯ã᪠ ­¥à ¢­® ­ã«î, ¯à¨«®¦¥­¨¥ ¡ë«®
; § ¯ã饭® á ¯ à ¬¥âà ¬¨ ¨§ ª®¬ ­¤­®© áâப¨
dd 0x0 ; 8. 㪠§ â¥«ì ­  áâபã, ¢ ª®â®àãî § ¯¨á ­ ¯ãâì,
; ®âªã¤  § ¯ã饭® ¯à¨«®¦¥­¨¥
;---------------------------------------------------------------------
;--- <20>€—€Ž <20><>Žƒ<C5BD>€ŒŒ ----------------------------------------------
;---------------------------------------------------------------------
START: ; ¤à¥á ­ ç «  ¯à®£à ¬¬ë
mov eax,14 ;äã­ªæ¨ï 14 - ¯®«ãç¨âì à §¬¥à íªà ­ 
int 0x40
mov ebx,eax
shl ebx,16
shr ebx,16
mov edi,ebx ;á®åà ­¨¬ ã
shr eax,16 ;ᤢ¨£ ¥¬ eax ¢¯à ¢® ­  16 - ¯®«ãç ¥¬ x
mov esi,eax ;á®åà ­¨¬ x
;---------------------------------------------------------------------
;--- –ˆŠ‹ Ž<><C5BD><EFBFBD>ŽŠˆ Ž<E28098>ˆ‰ ----------------------------------------
;---------------------------------------------------------------------
still:
;®à£ ­¨§ã¥¬ ¯ ã§ã ¢ 100 ¬á
mov eax,5 ;äã­ªæ¨ï 5 - ¯ ã§ , ¢ ebx ¢à¥¬ï ¢ ¬á
mov ebx,1 ;§ ¤¥à¦ª  100 ¬á
int 0x40
;¯®«ãç ¥¬ ª®®à¤¨­ âë ªãàá®à 
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 ;¨­ ç¥ ­¨ç¥£® ¤¥« âì ­¥ ­ã¦­®
left_border:
mov edx,esi ;¢ edx ¨¬¥¥¬ è¨à¨­ã íªà ­ 
dec edx ;㬥­ì訬 ­  1
shl edx,16 ;⥯¥àì edx=(x-1)*65536
add edx,ebx ;  ⥯¥àì edx=(x-1)*65536+y
mov eax,18 ;äã­ªæ¨ï 18: ãáâ ­®¢¨âì ­ áâனª¨ ¬ëè¨
mov ebx,19 ;¯®¤äã­ªæ¨ï 19
mov ecx,4 ;¯®¤¯®¤äã­ªæ¨ï 4: ãáâ ­®¢¨âì ¯®«®¦¥­¨¥
;ªãàá®à 
int 0x40
jmp still ;®â¤ëå ¥¬
right_border: ;ªãàá®à 㠯ࠢ®£® ªà ï
xor edx,edx
inc edx ;edx=1
shl edx,16 ;edx = 1*65536
add edx,ebx ;edx=1*65536+y
mov eax,18 ;äã­ªæ¨ï 18: ãáâ ­®¢¨âì ­ áâனª¨ ¬ëè¨
mov ebx,19 ;¯®¤äã­ªæ¨ï 19
mov ecx,4 ;¯®¤¯®¤äã­ªæ¨ï 4: ãáâ ­®¢¨âì ¯®«®¦¥­¨¥
;ªãàá®à 
int 0x40
jmp still ;®â¤ëå ¥¬
top_border: ;ªãàá®à ã ¢¥àå­¥£® ªà ï
mov edx,ecx ;• ª®®à¤¨­ â  ªãàá®à 
shl edx,16 ;⥯¥àì edx=(x)*65536
add edx,edi ;  ⥯¥àì edx=(x)*65536+y
dec edx ;  ⥯¥àì edx=(x)*65536+(ã-1)
mov eax,18 ;äã­ªæ¨ï 18: ãáâ ­®¢¨âì ­ áâனª¨ ¬ëè¨
mov ebx,19 ;¯®¤äã­ªæ¨ï 19
mov ecx,4 ;¯®¤¯®¤äã­ªæ¨ï 4: ãáâ ­®¢¨âì ¯®«®¦¥­¨¥
;ªãàá®à 
int 0x40
jmp still ;¨ ®â¤ëå ¥¬
bottom_border: ;ªãàá®à ã ­¨¦­¥£® ªà ï
mov edx,ecx ;edx=ecx x ª®®à¤¨­ â  ªãàá®à 
shl edx,16 ;edx = å*65536
;ã ª®®à¤¨­ â  à ¢­  0
mov eax,18 ;äã­ªæ¨ï 18: ãáâ ­®¢¨âì ­ áâனª¨ ¬ëè¨
mov ebx,19 ;¯®¤äã­ªæ¨ï 19
mov ecx,4 ;¯®¤¯®¤äã­ªæ¨ï 4: ãáâ ­®¢¨âì ¯®«®¦¥­¨¥
;ªãàá®à 
int 0x40
jmp still ;¨ ®â¤ëå ¥¬
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë