mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-13 10:27:12 +03:00
1ba8b5fb96
git-svn-id: svn://kolibrios.org@1803 a494cfbc-eb01-0410-851d-a64ba20cac60
218 lines
8.1 KiB
PHP
218 lines
8.1 KiB
PHP
;#**************************
|
||
;#* 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
|
||
{
|
||
|
||
; äãªæ¨ï ®âà¨á®¢ª¨ ®ª
|
||
draw_window:
|
||
mov eax,12 ; äãªæ¨ï 12: á®®¡é¨âì á¨á⥬¥ ®
|
||
; á®áâ®ï¨¨ ¯¥à¥à¨á®¢ª¨ ®ª
|
||
mov ebx,1 ; ¯®¤äãªæ¨ï 1, ç «® ¯¥à¥à¨á®¢ª¨
|
||
int 0x40
|
||
; ===== ŽŠ<EFBFBD>Ž !!1
|
||
mov eax,0 ; äãªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠®ª®
|
||
mov ebx,100*65536+270 ; [x ç «ìë©] *65536 + [x à §¬¥à]
|
||
mov ecx,100*65536+280 ; [y ç «ìë©] *65536 + [y à §¬¥à]
|
||
mov edx,0x02ccddff ; 梥â à ¡®ç¥© ®¡« á⨠RRGGBB
|
||
; 0x02000000 = ⨯ ®ª 2
|
||
mov esi,0x808899AA ; 梥⠮¡« á⨠§ £®«®¢ª RRGGBB
|
||
; 0x80000000 = 梥⠯¥à¥â¥ª ¥â
|
||
mov edi,0xFFAAcc ; 梥â à ¬ª¨ RRGGBB
|
||
int 0x40
|
||
; <EFBFBD>€„<EFBFBD>ˆ‘œ ¢ § £®«®¢ª¥ Lights v0.001
|
||
mov eax,4 ; äãªæ¨ï 4: ¯¨á âì ⥪áâ ¢ ®ª¥
|
||
mov ebx,8*65536+8 ; [x ç «ìë©] *65536 + [y ç «ìë©]
|
||
mov ecx,0x00224422 ; 梥â ⥪áâ RRGGBB
|
||
; áâ à訩 ¡ ©â (0x00) - à §¬¥à èà¨äâ
|
||
; (¬ «¥ìª¨©)
|
||
mov edx,text ; 㪠§ ⥫ì ç «® ⥪áâ
|
||
mov esi,texts-text ; ¤«¨ ⥪áâ ¢ ¡ ©â å
|
||
int 0x40
|
||
|
||
xor eax,eax ; <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 ; äãªæ¨ï 4: ¯¨á âì ⥪áâ ¢ ®ª¥
|
||
mov ebx,80*65536+250 ; [x ç «ìë©] *65536 + [y ç «ìë©]
|
||
mov ecx,0x10FF22FF ; 梥â ⥪áâ RRGGBB
|
||
; ; áâ à訩 ¡ ©â (0x10) - à §¬¥à èà¨äâ
|
||
; ; (¡®«ì让)
|
||
;mov edx,txthex
|
||
;mov esi,17
|
||
mov edx,texts ; 㪠§ ⥫ì ç «® ⥪áâ
|
||
mov esi,textend-texts ; ¤«¨ ⥪áâ ¢ ¡ ©â å
|
||
int 0x40
|
||
|
||
goon:
|
||
;-------------------------------------------------------------------------------
|
||
; ----Š<EFBFBD>Ž<EFBFBD>Šˆ----
|
||
; button()
|
||
;-------------------------------------------------------------------------------
|
||
|
||
mov eax,8 ; äãªæ¨ï 8: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠ª®¯ªã
|
||
mov ebx,(200-19)*65536+12 ; [x ç «ìë©] *65536 + [x à §¬¥à]
|
||
mov ecx,5*65536+12 ; [y ç «ìë©] *65536 + [y à §¬¥à]
|
||
mov edx,100 ; ¨¤¥â¨ä¨ª â®à ª®¯ª¨ =1
|
||
mov esi,0xFF6611 ; 梥⠪®¯ª¨ RRGGBB
|
||
int 0x40 ; ===Š<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 ; äãªæ¨ï 12: á®®¡é¨âì á¨á⥬¥ ®
|
||
; á®áâ®ï¨¨ ¯¥à¥à¨á®¢ª¨ ®ª
|
||
mov ebx,2 ; ¯®¤äãªæ¨ï 2, ¯¥à¥à¨á®¢ª ®ª®ç¥
|
||
int 0x40
|
||
;ret ; ª®¥æ äãªæ¨¨ - íâ® ¥ äãªæ¨ï!
|
||
|
||
event_wait:
|
||
;mov eax,10 ; äãªæ¨ï 10:=0A ®¦¨¤ ¨¥ ᮡëâ¨ï
|
||
mov eax,23
|
||
mov ebx,100
|
||
int 0x40
|
||
|
||
; ⨯ ᮡëâ¨ï ¢®§¢à éñ ¢ eax, ¤ «¥¥ ¯à®¢¥à塞, ª ª®¥ ᮡë⨥ ¯à®¨§®è«®
|
||
;-------------------------------------------------------------------------------
|
||
cmp eax,1 ; § ¯à®á ¯¥à¥à¨á®¢ªã?
|
||
je redraw
|
||
cmp eax,2 ; ¦ â ª« ¢¨è ª« ¢¨ âãàë?
|
||
je key
|
||
cmp eax,3 ; ¦ â ª®¯ª ¢ ®ª¥ ¯à®£à ¬¬ë?
|
||
je button
|
||
|
||
jmp event_wait ; ¢®§¢à é ¥¬áï ª ç «ã 横« ®¦¨¤ ¨ï ᮡë⨩
|
||
|
||
; ¯®á«¥ ⮣®, ª ª ᮡë⨥ ¨¤¥â¨ä¨æ¨à®¢ ®, ¥£® ¤® ®¡à ¡®â âì
|
||
;-------------------------------------------------------------------------------
|
||
redraw:
|
||
call draw_window ; ¢ë§ë¢ ¥¬ äãªæ¨î draw_window ¨
|
||
jmp event_wait ; ¢®§¢à é ¥¬áï § ¤ ª 横«ã ®¦¨¤ ¨ï
|
||
|
||
key:
|
||
mov eax,2 ; áç¨âë¢ ¥¬ ª®¤ ¦ ⮩ ª« ¢¨è¨. ‚®§¢à é¥ ¢ ah.
|
||
int 0x40 ; Š« ¢¨è ¤®«¦ ¡ëâì ¯à®ç¨â ¤«ï ®ç¨á⪨
|
||
cmp ah,27
|
||
je clos0 ; exit on ESC
|
||
;
|
||
jmp event_wait ; ¢®§¢à â ª event_wait
|
||
|
||
button:
|
||
mov eax,17 ; áç¨âë¢ ¥¬ ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
||
int 0x40 ; ¢®§¢à é¥ ah.
|
||
|
||
;-------------------------------------------------------------------------------
|
||
; ᬮâਬ, ª ª ï ª®¯ª ¡ë« ¦ â ¨ ᮮ⢥âáâ¢ãî騬 ®¡à §®¬ ॠ£¨à㥬.
|
||
;-------------------------------------------------------------------------------
|
||
cmp ah,100 ; ª®¯ª á id=100("§ ªàëâì")?
|
||
jne noclose
|
||
clos0:
|
||
mov eax,-1 ; äãªæ¨ï -1: § ¢¥àè¨âì ¯à®£à ¬¬ã
|
||
int 0x40 ; ª®¯ª 5-29
|
||
noclose:
|
||
|
||
xor ecx,ecx ;
|
||
mov cl,ah ;
|
||
sub ecx,5 ; ecx - index for tBut
|
||
|
||
mov edi,ecx
|
||
call x_lit ;+0 - æ¥âà
|
||
mov [tButIdx],edi ;save index
|
||
|
||
mov edi,[tButIdx]
|
||
cmp byte[edi+6],0
|
||
je next000
|
||
mov edi,ecx
|
||
inc edi
|
||
call x_lit ;+1 á¯à ¢
|
||
|
||
next000:
|
||
mov edi,[tButIdx]
|
||
cmp byte[edi+5],0
|
||
je next001
|
||
mov edi,ecx
|
||
dec edi
|
||
call x_lit ;-1 á«¥¢
|
||
|
||
next001:
|
||
mov edi,[tButIdx]
|
||
cmp byte[edi+4],0
|
||
je next002
|
||
mov edi,ecx
|
||
sub edi,5
|
||
call x_lit ;-5 ᢥàåã
|
||
|
||
next002:
|
||
mov edi,[tButIdx]
|
||
cmp byte[edi+7],0
|
||
je next003
|
||
mov edi,ecx
|
||
add edi,5
|
||
call x_lit ;+5 ᨧã
|
||
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 ; è ª®¯ª ;)
|
||
; §¤¥áì ¯à®¢¥à塞 ®áâ «ìë¥ ª®¯ª¨
|
||
jmp event_wait ;¢®§¢à é ¥¬áï ª 横«ã ®¦¨¤ ¨ï
|
||
}
|
||
|
||
|