kolibrios-fun/programs/games/lights/trunk/main.inc

218 lines
8.1 KiB
PHP
Raw Normal View History

;#**************************
;#* LIGHTS (c)* main.inc
;#************************** 15/10/2007
L0 equ 0x0000F8 ; light off
L1 equ 0xFFFF00 ; light on
LAG equ 2
deltaX equ 35
deltaY equ 35
posX equ 50
posY equ 50
macro main_loop
{
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
draw_window:
mov eax,12 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,1 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
; ===== <EFBFBD><EFBFBD><EFBFBD><EFBFBD> !!1
mov eax,0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,100*65536+270 ; [x <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [x <EFBFBD><EFBFBD><EFBFBD>]
mov ecx,100*65536+280 ; [y <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [y <EFBFBD><EFBFBD><EFBFBD>]
mov edx,0x02ccddff ; <EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RRGGBB
; 0x02000000 = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
mov esi,0x808899AA ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RRGGBB
; 0x80000000 = <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov edi,0xFFAAcc ; <EFBFBD> <EFBFBD><EFBFBD> RRGGBB
int 0x40
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Lights v0.001
mov eax,4 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,8*65536+8 ; [x <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [y <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]
mov ecx,0x00224422 ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> RRGGBB
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0x00) - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
mov edx,text ; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
mov esi,texts-text ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
xor eax,eax ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!
mov ecx,eax
lb: ;loop ecx
mov edi,ecx ;
shl edi,3 ;
add edi,tBut ;
add al,byte[edi+1] ;
;
inc ecx ;
cmp ecx,25 ;
jne lb ;ecx<25
cmp eax, 0xE7 ;25
jne goon
;int3
;call Bin2Hex
mov eax,4 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,80*65536+250 ; [x <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [y <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]
mov ecx,0x10FF22FF ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> RRGGBB
; ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0x10) - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; ; (<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
;mov edx,txthex
;mov esi,17
mov edx,texts ; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
mov esi,textend-texts ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
goon:
;-------------------------------------------------------------------------------
; ----<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>----
; button()
;-------------------------------------------------------------------------------
mov eax,8 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,(200-19)*65536+12 ; [x <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [x <EFBFBD><EFBFBD><EFBFBD>]
mov ecx,5*65536+12 ; [y <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>] *65536 + [y <EFBFBD><EFBFBD><EFBFBD>]
mov edx,100 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =1
mov esi,0xFF6611 ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RRGGBB
int 0x40 ; ===<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>===
LoopBegin labl,0 ;ecx - loop index
;add ecx,5
mov edi,ecx
shl edi,3 ;edi*8 -index of table
add edi,tBut
xor ebx,ebx
mov bl,byte[edi+2] ;X
shl ebx,16 ;*65536=256*256
add ebx,deltaX-LAG ;dX
xor ecx,ecx
mov cl,byte[edi+3] ;Y
shl ecx,16 ;*65536=256*256
add ecx,deltaY-LAG ;dY
xor edx,edx
mov dl,byte[edi] ;N
xor esi,esi
cmp byte[edi+1], 0 ;Color = 0/1
je lit_off
mov esi,L1 ;on
jmp lend
lit_off:
mov esi,L0 ;off
lend:
mov eax,8 ;8-BUTTON
int 0x40
LoopEnd labl,25
;=============================================================
endbut:
mov eax,12 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 12: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebx,2 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40
;ret ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨 - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
event_wait:
;mov eax,10 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10:=0A <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax,23
mov ebx,100
int 0x40
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> eax, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
;-------------------------------------------------------------------------------
cmp eax,1 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
je redraw
cmp eax,2 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
je key
cmp eax,3 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD>?
je button
jmp event_wait ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
; <EFBFBD><EFBFBD> <EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;-------------------------------------------------------------------------------
redraw:
call draw_window ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> draw_window <EFBFBD>
jmp event_wait ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
key:
mov eax,2 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> ah.
int 0x40 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp ah,27
je clos0 ; exit on ESC
;
jmp event_wait ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> event_wait
button:
mov eax,17 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int 0x40 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ah.
;-------------------------------------------------------------------------------
; <EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> ᮮ⢥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>.
;-------------------------------------------------------------------------------
cmp ah,100 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> id=100("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")?
jne noclose
clos0:
mov eax,-1 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD>
int 0x40 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5-29
noclose:
xor ecx,ecx ;
mov cl,ah ;
sub ecx,5 ; ecx - index for tBut
mov edi,ecx
call x_lit ;+0 - <EFBFBD><EFBFBD>
mov [tButIdx],edi ;save index
mov edi,[tButIdx]
cmp byte[edi+6],0
je next000
mov edi,ecx
inc edi
call x_lit ;+1 <EFBFBD><EFBFBD><EFBFBD>
next000:
mov edi,[tButIdx]
cmp byte[edi+5],0
je next001
mov edi,ecx
dec edi
call x_lit ;-1 <EFBFBD><EFBFBD>
next001:
mov edi,[tButIdx]
cmp byte[edi+4],0
je next002
mov edi,ecx
sub edi,5
call x_lit ;-5 <EFBFBD><EFBFBD><EFBFBD>
next002:
mov edi,[tButIdx]
cmp byte[edi+7],0
je next003
mov edi,ecx
add edi,5
call x_lit ;+5 <EFBFBD><EFBFBD>
next003:
call draw_window
jmp event_wait
;================================--
x_lit: ; edi - index
shl edi,3 ; edi*8 -index of table tBut
add edi,tBut ;
not byte[edi+1] ; invert second byte = L0/L1
ret ;
;================================--
call draw_window ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;)
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jmp event_wait ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}