kolibrios-fun/programs/other/madmouse/madmouse.asm

134 lines
5.2 KiB
NASM
Raw Normal View History

;------------------------------------------------------------------------------
; Mad Mouse
;---------------------------------------------------------------------
; version: 0.2
; last update: 03/06/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Some optimizations.
;---------------------------------------------------------------------
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> 㦠᭮ <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: Sourcerer, 23.04.2010
; popovpa (29.05.2012)
; 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A0A1><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>.
; 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><E1AAA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" ᢥ<><E1A2A5><EFBFBD> <20> <20><><EFBFBD><EFBFBD> :)
; 3. <20><><EFBFBD><E2A8AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
;------------------------------------------------------------------------------
use32 ; <20><EFBFBD><E0A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD>騩 32-<2D><><EFBFBD><EFA4AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
org 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><EFBFBD><E1A5A3> 0x0
db 'MENUET01' ; 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9> (8 <20><><EFBFBD><EFBFBD>)
dd 0x01 ; 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0ACA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9>
dd START ; 3. <20><><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD>
; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd IM_END ; 4. ࠧ<><E0A0A7><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dd I_END ; 5. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 0x0
; <20><> <20><><EFBFBD><EFBFBD><E7A5AD>, <20><><EFBFBD><E0A5A4>񭭮<EFBFBD><F1ADADAE> <20><><EFBFBD><EFBFBD><EFBFBD>
dd stack_area ; 6. <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 㪠<><E3AAA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
dd 0x0 ; 7. 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD> <20> <20><><EFBFBD><E0A0AC><EFBFBD>.
; <20><20><><20><><EFBFBD><EFBFBD><20><><EFBFBD><E0A0A2> <20><><EFBFBD><EFBFBD>, <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>
; <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A0AC><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
dd 0x0 ; 8. 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>,
; <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;------------------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------------
;------------------------------------------------------------------------------
START: ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
mov eax,40 ;<3B><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>⨩.
mov ebx,100000b ;<3B><EFBFBD> ⮫쪮 ᮡ<><20><><EFBFBD><EFBFBD>
int 0x40
;------------------------------------------------------------------------------
;--- <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ----------------------------------------
;------------------------------------------------------------------------------
align 4
still:
mov eax,10 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>
int 0x40
mov eax,14 ;<3B><EFBFBD><E3ADAA><EFBFBD> 14 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD> <20><><EFBFBD>
int 0x40 ;<3B><EFBFBD> <20>.14 <20><><E6A8AA> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><E8A5AD> <20><><EFBFBD>
mov ebx,eax
shl ebx,16
shr ebx,16
mov edi,ebx ;<3B><><EFBFBD><EFBFBD><E0A0AD> <20>
shr eax,16 ;ᤢ<><E1A4A2><EFBFBD><EFBFBD><EFBFBD> eax <20><><EFBFBD> <20><> 16 - <20><><EFBFBD><EFBFBD><EFBFBD> x
mov esi,eax ;<3B><><EFBFBD><EFBFBD><E0A0AD> x
;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,37 ;<3B><EFBFBD><E3ADAA><EFBFBD> 37 - ࠡ<><E0A0A1><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
xor ebx,ebx ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 - <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
;<3B><EFBFBD><E2ADAE>⥫쭮 <20><><EFBFBD>
int 0x40
mov ebx,eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD>
shr eax,16 ;⥯<><E2A5AF><EFBFBD> <20> <20><><EFBFBD> ⮫쪮 x. <20><EFBFBD> <20> y
mov ecx,eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> x
shl ebx,16 ;ᤢ<><E1A4A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> 16
shr ebx,16 ;ᤢ<><E1A4A2><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20><> 16, <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20>
;------------------------------------------------------------------------------
;<3B> esi <20> edi <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><EFBFBD> <20><><EFBFBD> X <20> Y ᮮ⢥<E1AEAE><EFBFBD><E1A2A5><EFBFBD>
;<3B> ecx <20> ebx <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X <20> Y ᮮ⢥⢥<E2A2A5><E2A2A5><EFBFBD>
;------------------------------------------------------------------------------
;<3B><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD> x
test ecx,ecx ;ࠢ<><E0A0A2> 0?
jz left_border ;<3B><><EFBFBD><EFBFBD><20> <20><><EFBFBD><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
cmp ecx,esi ;ࠢ<><E0A0A2> <20><><EFBFBD> <20><><EFBFBD>?
jz right_border ;<3B><><EFBFBD><EFBFBD><EFBFBD><E5AEA4> <20> <20><><EFBFBD><20> <20><EFBFBD><E0A0A2><EFBFBD> <20><><EFBFBD><EFBFBD>
;<3B><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD> y
test ebx,ebx ;ࠢ<><E0A0A2> 0?
jz top_border ;<3B><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp ebx,edi ;ࠢ<><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>?
jz bottom_border ;<3B><><EFBFBD><EFBFBD><20> <20><><EFBFBD><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
jmp still ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD>
;------------------------------------------------------------------------------
align 4
left_border:
mov edx,esi ;<3B> edx <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>
dec edx ;㬥<><E3ACA5><20><> 1
shl edx,16 ;⥯<><E2A5AF><EFBFBD> edx=(x-1)*65536
add edx,ebx ;<3B><><E2A5AF><EFBFBD> edx=(x-1)*65536+y
;------------------------------------------------------------------------------
align 4
set_mouse_position:
mov eax,18 ;<3B><EFBFBD><E3ADAA><EFBFBD> 18: <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA9> <20><><EFBFBD><EFBFBD>
mov ebx,19 ;<3B><><EFBFBD><EFBFBD><EFBFBD><E3ADAA><EFBFBD> 19
mov ecx,4 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3ADAA><EFBFBD> 4: <20><><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
jmp still ;<3B><><EFBFBD><EFBFBD><EFBFBD>
;------------------------------------------------------------------------------
align 4
right_border: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E0A0A2><EFBFBD> <20><><EFBFBD><EFBFBD>
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: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E5ADA5> <20><><EFBFBD><EFBFBD>
mov edx,ecx ;<3B> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
shl edx,16 ;⥯<><E2A5AF><EFBFBD> edx=(x)*65536
add edx,edi ;<3B><><E2A5AF><EFBFBD> edx=(x)*65536+y
dec edx ;<3B><><E2A5AF><EFBFBD> edx=(x)*65536+(<28>-1)
jmp set_mouse_position
;------------------------------------------------------------------------------
align 4
bottom_border: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov edx,ecx ;edx=ecx x <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
shl edx,16 ;edx = <20>*65536
inc edx ;<3B> <20><><EFBFBD><EFBFBD><E0A4A8><EFBFBD><EFBFBD><><E0A0A2> 1
jmp set_mouse_position
;------------------------------------------------------------------------------
IM_END: ; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
;------------------------------------------------------------------------------
align 4
rb 1024
stack_area:
;------------------------------------------------------------------------------
I_END: ; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
;------------------------------------------------------------------------------