forked from KolibriOS/kolibrios
Added source code of games 'kox', 'lights', 'sw'. Changed MakeFile to have them compile from sources. Removed pre-compiled versions.
git-svn-id: svn://kolibrios.org@1803 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
53e439f8a0
commit
1ba8b5fb96
@ -126,6 +126,8 @@ FASM_PROGRAMS:=\
|
||||
games/arcanii:GAMES/ARCANII:$(PROGS)/games/arcanii/trunk/arcanii.asm \
|
||||
games/freecell:GAMES/FREECELL:$(PROGS)/games/freecell/freecell.ASM \
|
||||
games/invaders:GAMES/INVADERS:$(PROGS)/games/invaders/invaders.asm \
|
||||
games/kox:GAMES/KOX:$(PROGS)/games/kox/trunk/kox.asm \
|
||||
games/lights:GAMES/LIGHTS:$(PROGS)/games/lights/trunk/lights.asm \
|
||||
games/lines:GAMES/LINES:$(PROGS)/games/lines/lines.asm \
|
||||
games/mblocks:GAMES/MBLOCKS:$(PROGS)/games/mblocks/trunk/mblocks.asm \
|
||||
games/phenix:GAMES/PHENIX:$(PROGS)/games/phenix/trunk/phenix.asm \
|
||||
@ -134,6 +136,7 @@ FASM_PROGRAMS:=\
|
||||
games/pong3:GAMES/PONG3:$(PROGS)/games/pong3/trunk/pong3.asm \
|
||||
games/rsquare:GAMES/RSQUARE:$(PROGS)/games/rsquare/trunk/rsquare.asm \
|
||||
games/snake:GAMES/SNAKE:$(PROGS)/games/snake/trunk/snake.asm \
|
||||
games/sw:GAMES/SW:$(PROGS)/games/sw/trunk/sw.asm \
|
||||
games/tetris:GAMES/TETRIS:$(PROGS)/games/tetris/trunk/tetris.asm \
|
||||
lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \
|
||||
lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \
|
||||
@ -238,13 +241,11 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
||||
games/checkers:GAMES/CHECKERS \
|
||||
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
||||
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
||||
games/lights:GAMES/LIGHTS games/megamaze:GAMES/MEGAMAZE \
|
||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/megamaze:GAMES/MEGAMAZE \
|
||||
games/msquare:GAMES/MSQUARE \
|
||||
games/reversi:GAMES/REVERSI games/rforces:GAMES/RFORCES \
|
||||
games/sq_game:GAMES/SQ_GAME \
|
||||
games/sudoku:GAMES/SUDOKU games/sw:GAMES/SW \
|
||||
games/xonix:GAMES/XONIX \
|
||||
games/sudoku:GAMES/SUDOKU games/xonix:GAMES/XONIX \
|
||||
lib/cnv_png.obj:LIB/CNV_PNG.OBJ lib/msgbox.obj:LIB/MSGBOX.OBJ \
|
||||
lib/pixlib.obj:LIB/PIXLIB.OBJ lib/sort.obj:LIB/SORT.OBJ \
|
||||
media/ac97snd:MEDIA/AC97SND media/kiv.ini:MEDIA/KIV.INI \
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -126,6 +126,8 @@ FASM_PROGRAMS:=\
|
||||
games/arcanii:GAMES/ARCANII:$(PROGS)/games/arcanii/trunk/arcanii.asm \
|
||||
games/freecell:GAMES/FREECELL:$(PROGS)/games/freecell/freecell.ASM \
|
||||
games/invaders:GAMES/INVADERS:$(PROGS)/games/invaders/invaders.asm \
|
||||
games/kox:GAMES/KOX:$(PROGS)/games/kox/trunk/kox.asm \
|
||||
games/lights:GAMES/LIGHTS:$(PROGS)/games/lights/trunk/lights.asm \
|
||||
games/lines:GAMES/LINES:$(PROGS)/games/lines/lines.asm \
|
||||
games/mblocks:GAMES/MBLOCKS:$(PROGS)/games/mblocks/trunk/mblocks.asm \
|
||||
games/phenix:GAMES/PHENIX:$(PROGS)/games/phenix/trunk/phenix.asm \
|
||||
@ -134,6 +136,7 @@ FASM_PROGRAMS:=\
|
||||
games/pong3:GAMES/PONG3:$(PROGS)/games/pong3/trunk/pong3.asm \
|
||||
games/rsquare:GAMES/RSQUARE:$(PROGS)/games/rsquare/trunk/rsquare.asm \
|
||||
games/snake:GAMES/SNAKE:$(PROGS)/games/snake/trunk/snake.asm \
|
||||
games/sw:GAMES/SW:$(PROGS)/games/sw/trunk/sw.asm \
|
||||
games/tetris:GAMES/TETRIS:$(PROGS)/games/tetris/trunk/tetris.asm \
|
||||
lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \
|
||||
lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \
|
||||
@ -239,12 +242,11 @@ OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \
|
||||
games/checkers:GAMES/CHECKERS \
|
||||
games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \
|
||||
games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \
|
||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \
|
||||
games/lights:GAMES/LIGHTS games/megamaze:GAMES/MEGAMAZE \
|
||||
games/kosskin.gfx:GAMES/KOSSKIN.GFX games/megamaze:GAMES/MEGAMAZE \
|
||||
games/msquare:GAMES/MSQUARE games/padenie:GAMES/PADENIE \
|
||||
games/reversi:GAMES/REVERSI games/rforces:GAMES/RFORCES \
|
||||
games/sq_game:GAMES/SQ_GAME \
|
||||
games/sudoku:GAMES/SUDOKU games/sw:GAMES/SW games/whowtbam:GAMES/WHOWTBAM \
|
||||
games/sudoku:GAMES/SUDOKU games/whowtbam:GAMES/WHOWTBAM \
|
||||
games/xonix:GAMES/XONIX \
|
||||
lib/cnv_png.obj:LIB/CNV_PNG.OBJ lib/msgbox.obj:LIB/MSGBOX.OBJ \
|
||||
lib/pixlib.obj:LIB/PIXLIB.OBJ lib/sort.obj:LIB/SORT.OBJ \
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
66
programs/games/kox/trunk/data.inc
Normal file
66
programs/games/kox/trunk/data.inc
Normal file
@ -0,0 +1,66 @@
|
||||
;#**************************
|
||||
;#* X.0.X - DATA
|
||||
;#************************** 21/10/2007
|
||||
|
||||
macro DATA_SECTION
|
||||
{
|
||||
; „€<EFBFBD><EFBFBD>›… <EFBFBD><EFBFBD>Žƒ<EFBFBD>€ŒŒ›
|
||||
;-----------------------------------------------------------------------------
|
||||
lootxt: db 'oops! - Looser...' ; los
|
||||
text: db 'KOX v0.003 [ESC] - quit' ; winheader string
|
||||
texts: db 'Congratulations! You are winner.' ; in window win
|
||||
textend: db 'New' ;button id=200
|
||||
px: dw 50 ;x,y -
|
||||
py: dw 50 ; - for x_put/o_put
|
||||
seed: dd 0 ;rnd
|
||||
idx: dd 0 ;N cell
|
||||
;============ X = Y ============= coords of cells
|
||||
pole: dw 50, 50 ;+0 or - dd 50*65536+50
|
||||
dw 100, 50 ;+4
|
||||
dw 150, 50 ;+8
|
||||
dw 50,100 ;+..
|
||||
dw 100,100 ;+
|
||||
dw 150,100 ;
|
||||
dw 50,150 ;
|
||||
dw 100,150 ;
|
||||
dw 150,150 ;
|
||||
pox: dd 0,0 ;POLE ( 3x3 )= 9 _bytes_: 'x' / 'o' / empty
|
||||
pox_: db 0 ;9= 8+1
|
||||
fill: db 0 ;turn counter 0..9
|
||||
xwin: db 0 ;who is winner 0/1
|
||||
owin: db 0 ;who is looser 0/1
|
||||
poxl: dw 0 ;16 bits - x memory
|
||||
pool: dw 0 ;16 bits - o memory
|
||||
;----------------------------------------------------------------------------
|
||||
oxwall: dw 100100100b,0010010010b,0001001001b ;vert.
|
||||
dw 111000000b,0000111000b,0000000111b ;horiz
|
||||
dw 100010001b,0001010100b ;diag -winning combinations
|
||||
prav: ;==== ¯à ¢¨« -ª®¬¡¨ 樨=====
|
||||
dw 000000110b,0 ;á¨âã æ¨ï - 室 ¢ á¨âã 樨
|
||||
dw 000000101b,1
|
||||
dw 000000011b,2
|
||||
dw 000110000b,3
|
||||
dw 000101000b,4
|
||||
dw 000011000b,5
|
||||
dw 110000000b,6
|
||||
dw 101000000b,7
|
||||
dw 011000000b,8 ;horiz
|
||||
|
||||
dw 001001000b,0
|
||||
dw 001000001b,3
|
||||
dw 000001001b,6
|
||||
dw 010010000b,1
|
||||
dw 010000010b,4
|
||||
dw 000010010b,7
|
||||
dw 100100000b,2
|
||||
dw 100000100b,5
|
||||
dw 000100100b,8 ;vert
|
||||
|
||||
dw 000010001b,8
|
||||
dw 100010000b,0
|
||||
dw 100000001b,4
|
||||
dw 000010100b,6
|
||||
dw 001010000b,2
|
||||
dw 001000100b,4 ;diag
|
||||
|
||||
}
|
20
programs/games/kox/trunk/kox.asm
Normal file
20
programs/games/kox/trunk/kox.asm
Normal file
@ -0,0 +1,20 @@
|
||||
;************************************************
|
||||
;* X-0-X / Kolibri OS /
|
||||
;************************** 17/10/2007 **********
|
||||
include 'main.inc'
|
||||
include 'data.inc'
|
||||
include 'macs.inc'
|
||||
|
||||
BeginProgram
|
||||
|
||||
SetEventMask 100111b
|
||||
call rndseed
|
||||
|
||||
main_loop
|
||||
|
||||
Subroutines
|
||||
|
||||
DATA_SECTION
|
||||
|
||||
EndProgram
|
||||
|
27
programs/games/kox/trunk/kox.txt
Normal file
27
programs/games/kox/trunk/kox.txt
Normal file
@ -0,0 +1,27 @@
|
||||
Kox v0.003
|
||||
----------------
|
||||
Šà¥á⨪¨-®«¨ª¨ ¢ ª®¬¬¥â à¨ïå ¥ 㦤 îâáï.
|
||||
‚ᥠ¨£à «¨? ‚ᯮ¬¨ ©â¥... - ¯ «ì楬 § ¯®â¥¢è¥¬ á⥪«¥,
|
||||
¬¥«®¬ ¤®áª¥, ¯ «ª®© ᥣã, §¥¬«¥, àã窮©
|
||||
ãப å ¢ ª«¥âç ⮩ â¥âà ¤¨...
|
||||
’¥¯¥àì ¨ ¢ Š®«¨¡à¨.
|
||||
|
||||
–¥«ì ª ¦¤®£® ¨£à®ª - ¯¥à¢ë¬ ¢ëáâநâì àï¤ ¨§ âà¥å ᢮¨å
|
||||
䨣ãà (ªà¥á⨪®¢ ¨«¨ ®«¨ª®¢) å®¤ï ¯®®ç¥à¥¤® ¯®«¥ 3x3.
|
||||
Šâ® ¯¥à¢ë© - â®â ¢ë¨£à «.
|
||||
|
||||
‚ë ¨£à ¥â¥ ªà¥á⨪ ¬¨, ®«¨ª ¬¨ - ¢ è ᮯ¥à¨ª, ª®¬¯ìîâ¥à.
|
||||
Ž ¤®áâ â®ç® 㬥, è ᮢ ¢ë¨£à âì - ¥ ®ç¥ì ¬®£®.
|
||||
|
||||
<20>ਫ £ î ¨áå®¤ë© â¥ªáâ áᥬ¡«¥à¥, ¤¥« ©â¥ á ¨¬ çâ® å®â¨â¥.
|
||||
Ž á«¥£ª ®¯â¨¬¨§¨à®¢ (¯® à §¬¥àã) ® १¥à¢ë ¥é¥ ¥áâì.
|
||||
Œ®¦¥â ¯®å㤥âì ¥é¥ ¡ ©â ¤¢¥áâ¨...
|
||||
|
||||
Œ®¦® ¥é¥ ã«ãçè¨âì «£®à¨â¬ ¨áªãá⢥®£® ¨â¥««¥ªâ
|
||||
(§ âªãâì ¯®á«¥¤îî ¤ëàªã, ç⮡ë ìë« ¨ç¥© ï ᬥàâì)
|
||||
¢â®àë¬ å®¤®¬ 室¨âì ¢ 㣮« (¯à®¯ã᪠âì ¥ç¥âë© idx)
|
||||
¥á«¨ ®â¢¥â¨â ¢ ¯à®â¨¢®¯®«®¦ë© - ᮢ ¢ 㣮«.
|
||||
Œ¥ «¥¨¢® ¤®¡ ¢«ïâì ¥áª®«ìª® ¤¥áï⪮¢ ¡ ©â ¨§-§ 1 室 .
|
||||
ˆ â ª ¥¯«®å® ¢à®¤¥...
|
||||
|
||||
== 21/10/2007 == board.kolibrios.org
|
317
programs/games/kox/trunk/macs.inc
Normal file
317
programs/games/kox/trunk/macs.inc
Normal file
@ -0,0 +1,317 @@
|
||||
;************************************
|
||||
;******** Œ€Š<EFBFBD>Ž‘› *******************
|
||||
;************************************
|
||||
;------------------------------------
|
||||
; constants
|
||||
;-----------------------梥â:0xRRGGBB
|
||||
cBLACK = 0x000000 ; ç¥àë©
|
||||
cRED = 0xFF0000 ; ªà áë©
|
||||
cYELLOW = 0xFFFF00 ; ¦¥«âë©
|
||||
cGREEN = 0x00FF00 ; §¥«¥ë©
|
||||
cNAVY = 0x0000FF ; ᨨ©
|
||||
cMAGENTA = 0xFF00FF ; ¬ «¨®¢ë©
|
||||
cBLUE = 0x00FFFF ; £®«ã¡®©
|
||||
cWHITE = 0xFFFFFF ; ¡¥«ë©
|
||||
cBROWN = 0x554433 ; ª®à¨ç¥¢ë©
|
||||
|
||||
;-------------------------------
|
||||
cMAGENTAl = 0xB800B8 ; magenta light
|
||||
cVIOLETl = 0xF800F8 ; 䨮«¥â®¢ë© ᢥâ«
|
||||
|
||||
macro BeginProgram
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd 0x10000 ;__memory
|
||||
dd 0x10000 ;__stack
|
||||
dd 0x0 ; dd __params
|
||||
dd 0x0
|
||||
__start:
|
||||
}
|
||||
|
||||
macro EndProgram
|
||||
{
|
||||
align 32
|
||||
rb 256
|
||||
__end:
|
||||
;org 0x10000
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
|
||||
|
||||
macro LoopBegin lab,begi
|
||||
{
|
||||
push ecx ; ECX->STACK store old
|
||||
mov ecx,begi
|
||||
lab:
|
||||
push ecx ; ECX->STACK counter store
|
||||
}
|
||||
|
||||
macro LoopEnd lab,endi
|
||||
{
|
||||
pop ecx ;ECX<-STACK counter restore
|
||||
inc ecx
|
||||
cmp ecx,endi
|
||||
jne lab
|
||||
pop ecx ;ECX<-STACK restore old
|
||||
}
|
||||
|
||||
macro SetEventMask mmm
|
||||
{
|
||||
mov eax,40
|
||||
mov ebx,mmm
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro Subroutines
|
||||
{
|
||||
;------------------------------------------------------------------------------
|
||||
rndseed:
|
||||
mov eax,26
|
||||
mov ebx,9
|
||||
int 0x40
|
||||
mov dword[seed],eax
|
||||
ret
|
||||
rndnext:
|
||||
mov eax,3
|
||||
int 0x40
|
||||
shr eax,16
|
||||
add eax,dword[seed]
|
||||
; not eax
|
||||
ror eax,3
|
||||
xor eax,0xdeadbeef
|
||||
mov dword[seed],eax
|
||||
ret
|
||||
;============0========== word[px],word[py]
|
||||
o_put:
|
||||
mov ax,word[px]
|
||||
shl eax,16 ;*65536
|
||||
add eax,35 ;+35
|
||||
mov ebx,eax ;posX*65536+dX ; [x0] *65536 + [dx]
|
||||
mov ax,word[py] ;
|
||||
shl eax,16 ;*65536
|
||||
add eax,35 ;+35
|
||||
mov ecx,eax ;posY*65536+dY ; [y0] *65536 + [dy]
|
||||
mov edx,cB
|
||||
mov eax,13 ; äãªæ¨ï 13 - box
|
||||
int 0x40 ;BLACK BOX---------------
|
||||
|
||||
mov ax,word[px]
|
||||
inc ax ;+1
|
||||
inc ax ;+1
|
||||
shl eax,16 ;*65536
|
||||
add eax,31 ;3 ;+35
|
||||
mov ebx,eax ;posX*65536+dX ; [x0] *65536 + [dx]
|
||||
|
||||
mov ax,word[py]
|
||||
add eax,2
|
||||
;inc eax
|
||||
;inc eax
|
||||
shl eax,16
|
||||
add eax,31 ;3 ;-2
|
||||
mov ecx,eax ;posY*65536+dY ; [y0] *65536 + [dy]
|
||||
mov edx,cW
|
||||
mov eax,13 ; äãªæ¨ï 13 - box
|
||||
int 0x40 ;WHITE BOX----------
|
||||
ret
|
||||
;============X==========
|
||||
x_put:
|
||||
;xor eax,eax
|
||||
mov ax,word[px]
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[px]
|
||||
add eax,35 ;+35
|
||||
mov ebx,eax ;posX*65536+dX
|
||||
|
||||
xor eax,eax
|
||||
mov ax,word[py]
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[py]
|
||||
add eax,35 ;+35
|
||||
mov ecx,eax ;posX*65536+dX
|
||||
mov edx,cB
|
||||
mov eax,38 ; äãªæ¨ï 38 - line \
|
||||
int 0x40
|
||||
;------------------------------xx
|
||||
xor eax,eax
|
||||
mov ax,word[px]
|
||||
inc eax
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[px]
|
||||
add eax,36 ;+35+1
|
||||
mov ebx,eax ;posX*65536+dX
|
||||
xor eax,eax
|
||||
mov ax,word[py]
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[py]
|
||||
add eax,35 ;+35
|
||||
mov ecx,eax ;posX*65536+dX ; [x0] *65536 + [dx]
|
||||
mov edx,cB
|
||||
mov eax,38 ; äãªæ¨ï 38 - line \\
|
||||
int 0x40
|
||||
;---------------------------------
|
||||
xor eax,eax
|
||||
mov ax,word[px]
|
||||
shl eax,16 ;*65536
|
||||
mov ebx,eax ;posX*65536 = .BX
|
||||
|
||||
xor eax,eax
|
||||
mov ax,word[px]
|
||||
add eax,35
|
||||
add ebx,eax ;---------------------------BX
|
||||
|
||||
xor eax,eax
|
||||
mov ax,word[py]
|
||||
add eax,35
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[py] ;+y
|
||||
mov ecx,eax ;(posY+35)*65536+posY = .CX
|
||||
mov edx,cB ; 梥â : ç¥àë©
|
||||
mov eax,38 ; äãªæ¨ï 38 - line /
|
||||
int 0x40
|
||||
;----------------------------------------
|
||||
xor eax,eax
|
||||
mov ax,word[px]
|
||||
inc ax
|
||||
shl eax,16 ;*65536
|
||||
mov ebx,eax ;posX*65536 = .BX
|
||||
|
||||
xor eax,eax
|
||||
mov ax,word[px]
|
||||
add eax,36 ;+35+1
|
||||
add ebx,eax ;---------------------------BX
|
||||
|
||||
xor eax,eax
|
||||
mov ax,word[py]
|
||||
add eax,35
|
||||
shl eax,16 ;*65536
|
||||
add ax,word[py] ;+y
|
||||
mov ecx,eax ;(posY+35)*65536+posY = .CX
|
||||
mov edx,cB
|
||||
mov eax,38 ; äãªæ¨ï 38 - line //
|
||||
int 0x40
|
||||
ret
|
||||
;------------------------------------<EFBFBD><EFBFBD>Ž‚…<EFBFBD>Š€ H ¢ë¨£àëèãî á¨âã æ¨î-----x
|
||||
x_win: xor ecx,ecx
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
lx0: mov bx,word[poxl] ;áà ¢¨âì ⥪ãéãî á¨âã æ¨î ¯®«¥ X
|
||||
mov esi,ecx
|
||||
shl esi,1 ;*2
|
||||
mov ax,word[oxwall+esi] ; next pattern
|
||||
and ebx,eax ;á ¯®¡¥¤ë¬¨ , ¥á«¨ å®âì ®¤ ᮢ¯ ¤ ¥â -
|
||||
sub eax,ebx
|
||||
jz wx ;¯®¡¥¤ -> set byte xwin=1
|
||||
inc ecx
|
||||
cmp ecx,8 ;横« ecx < 8
|
||||
jb lx0
|
||||
g00: ;¥â ᮢ¯ ¤¥¨©
|
||||
ret
|
||||
wx:
|
||||
inc byte[xwin] ;mov byte[xwin],1
|
||||
ret
|
||||
;------------------------------------<EFBFBD><EFBFBD>Ž‚…<EFBFBD>Š€ H ¢ë¨£àëèãî á¨âã æ¨î-----0
|
||||
o_win: xor ecx,ecx
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
lo0: mov bx,word[pool] ;áà ¢¨âì ⥪ãéãî á¨âã æ¨î ¯®«¥ O
|
||||
mov esi,ecx
|
||||
shl esi,1 ;*2
|
||||
mov ax,word[oxwall+esi] ; next pattern
|
||||
and ebx,eax ;á ¯®¡¥¤ë¬¨ , ¥á«¨ å®âì ®¤ ᮢ¯ ¤ ¥â -
|
||||
sub eax,ebx
|
||||
jz wo ;¯®¡¥¤ -> set byte owin=1
|
||||
inc ecx
|
||||
cmp ecx,8 ;横«
|
||||
jb lo0
|
||||
ret
|
||||
wo: inc byte[owin] ;mov byte[owin],1
|
||||
ret
|
||||
;==================================COmbinations -0- =============
|
||||
o_com: xor ecx,ecx
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
l000: mov bx,word[poxl] ; ⥪ãéãî á¨âã æ¨î ¯®«¥ X
|
||||
; or bx,word[pool] ;+ ⥪ãéãî á¨âã æ¨î ¯®«¥ O
|
||||
mov esi,ecx
|
||||
shl esi,2 ;*4 -ᤢ¨£ -á«®¢
|
||||
mov ax,word[prav+esi] ; á«¥¤ãî饥 ¯à ¢¨«®
|
||||
and ebx,eax ; ¥á«¨ ¥ ᮢ¯ ¤ ¥â -
|
||||
sub eax,ebx
|
||||
jnz @F ;next ecx
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov ax,word[prav+esi+2] ;esi<-¨§ â ¡«¨æë ¯à ¢¨«
|
||||
mov bl,byte[pox+eax]
|
||||
cmp ebx,0 ;empty?
|
||||
je g00d
|
||||
@@:
|
||||
inc ecx
|
||||
cmp ecx,24 ;横« ¤® 24
|
||||
jb l000
|
||||
ret ;¥â ᮢ¯ ¤¥¨© - do nothing
|
||||
g00d:
|
||||
;¯à¨¬¥¨âì ¥£®
|
||||
xor eax,eax
|
||||
mov ax,word[prav+esi+2] ;esi<-¨§ â ¡«¨æë ¯à ¢¨«
|
||||
mov esi,eax
|
||||
mov dword[idx],esi ;á®åà ¨¬ ¢ idx
|
||||
ret
|
||||
|
||||
;==================================¯à¥¤¢ë¨£àëè ï ª®¬¡¨ æ¨ï...
|
||||
x_com: xor ecx,ecx
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
l111: mov bx,word[pool] ; ⥪ãéãî á¨âã æ¨î ¯®«¥ O
|
||||
mov esi,ecx
|
||||
shl esi,2 ;*4 -ᤢ¨£ -á«®¢
|
||||
mov ax,word[prav+esi] ; á«¥¤ãî饥 ¯à ¢¨«®
|
||||
and ebx,eax ; ¥á«¨ ¥ ᮢ¯ ¤ ¥â -
|
||||
sub eax,ebx
|
||||
jnz @F ;next ecx
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov ax,word[prav+esi+2] ;esi<-¨§ â ¡«¨æë ¯à ¢¨«
|
||||
mov bl,byte[pox+eax]
|
||||
cmp ebx,0 ;empty?
|
||||
je g11d
|
||||
@@:
|
||||
inc ecx
|
||||
cmp ecx,24 ;横« ¤® 24
|
||||
jb l111
|
||||
ret ;¥â ᮢ¯ ¤¥¨© - do nothing
|
||||
|
||||
g11d:
|
||||
;¯à¨¬¥¨âì ¥£®
|
||||
xor eax,eax
|
||||
mov ax,word[prav+esi+2] ;esi<-¨§ â ¡«¨æë ¯à ¢¨«
|
||||
mov esi,eax
|
||||
mov dword[idx],esi ;á®åà ¨¬ ¢ idx
|
||||
ret
|
||||
}
|
||||
|
||||
macro playing_field
|
||||
{
|
||||
pole_x0:
|
||||
mov eax,38 ; func 38
|
||||
mov edx,cB ; the color is black
|
||||
|
||||
mov ebx,92*65536+92 ;x
|
||||
mov ecx,42*65536+192 ;y
|
||||
int 0x40 ;- line vert 1
|
||||
mov ebx,142*65536+142 ;x
|
||||
mov ecx,42*65536+192 ;y
|
||||
int 0x40 ;- line vert 2
|
||||
mov ebx,42*65536+192 ;x
|
||||
mov ecx,92*65536+92 ;y
|
||||
int 0x40 ;- line horiz 1
|
||||
mov ebx,42*65536+192 ;x
|
||||
mov ecx,142*65536+142 ;y
|
||||
int 0x40 ;- line horiz 2
|
||||
}
|
290
programs/games/kox/trunk/main.inc
Normal file
290
programs/games/kox/trunk/main.inc
Normal file
@ -0,0 +1,290 @@
|
||||
;#**************************
|
||||
;#* X-0-X = MAIN()
|
||||
;#************************** 21/10/2007
|
||||
cB equ cBLACK
|
||||
cW equ cWHITE
|
||||
|
||||
macro main_loop
|
||||
{
|
||||
|
||||
; äãªæ¨ï ®âà¨á®¢ª¨ ®ª
|
||||
;========================================
|
||||
draw_window:
|
||||
mov eax,12 ; äãªæ¨ï 12: á®®¡é¨âì á¨á⥬¥
|
||||
mov ebx,1 ; ¯®¤äãªæ¨ï 1, ç «® ¯¥à¥à¨á®¢ª¨
|
||||
int 0x40
|
||||
; ===== ŽŠ<EFBFBD>Ž !!!
|
||||
mov eax,0 ; äãªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠®ª®
|
||||
mov ebx,100*65536+250 ; [x ç «ìë©] *65536 + [x à §¬¥à]
|
||||
mov ecx,ebx ;,100*65536+250 ; [y ç «ìë©] *65536 + [y à §¬¥à]
|
||||
mov edx,0x02FFFFFF
|
||||
|
||||
mov esi,0x808899AA ; 梥⠧ £®«®¢ª RRGGBB
|
||||
mov edi,0xFFAAcc ; 梥â à ¬ª¨ RRGGBB
|
||||
int 0x40
|
||||
; <EFBFBD>€„<EFBFBD>ˆ‘œ ¢ § £®«®¢ª¥ KOX v0.001
|
||||
mov eax,4 ; äãªæ¨ï 4: ¯¨á âì ⥪áâ ¢ ®ª¥
|
||||
mov ebx,8*65536+8 ; [x ç «ìë©] *65536 + [y ç «ìë©]
|
||||
mov ecx,0x00224422 ; 梥â ⥪áâ RRGGBB
|
||||
mov edx,text ; 㪠§ ⥫ì ç «® ⥪áâ
|
||||
mov esi,texts-text ; ¤«¨ ⥪áâ ¢ ¡ ©â å
|
||||
int 0x40
|
||||
;-----------------------------------#-----------------------------------------
|
||||
; SCENE OF GAME - PLAY YARD - BOARD - DESK - PLAYING FIELD
|
||||
;---------------
|
||||
playing_field ;macro in macs.inc
|
||||
;-------------------------------------------------------------------------------
|
||||
; ----Š<EFBFBD>Ž<EFBFBD>Šˆ----
|
||||
;-------------------------------------------------------------------------------
|
||||
;buttons:
|
||||
mov eax,8 ; äãªæ¨ï 8: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠ª®¯ªã
|
||||
mov ebx,230*65536+12 ; [x ç «ìë©] *65536 + [x à §¬¥à]
|
||||
mov ecx,5*65536+12 ; [y ç «ìë©] *65536 + [y à §¬¥à]
|
||||
mov edx,100 ; ¨¤¥â¨ä¨ª â®à ª®¯ª¨ =100
|
||||
mov esi,0xFF6611 ; 梥⠪®¯ª¨ RRGGBB
|
||||
int 0x40 ; ===Š<EFBFBD>Ž<EFBFBD>Š€ ‡€Š<EFBFBD>›’ˆŸ ŽŠ<EFBFBD>€===
|
||||
;--------------------------------------------
|
||||
mov eax,8 ;
|
||||
mov ebx,200*65536+35 ; ;
|
||||
mov ecx,25*65536+20 ;
|
||||
mov edx,200 ;== NEW GAME ==
|
||||
mov esi,0xCC66CC
|
||||
int 0x40
|
||||
;--------------------------------------------
|
||||
mov eax,4 ; ¯¨á âì ⥪áâ ª®¯ª¥ NEW
|
||||
mov ebx,210*65536+30
|
||||
mov ecx,cB
|
||||
mov edx,textend
|
||||
mov esi,3
|
||||
int 0x40
|
||||
endbut:
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
;============================= draw_window: END
|
||||
event_wait:
|
||||
mov eax,23 ;==‘Ž<EFBFBD>›’ˆŸ==
|
||||
mov ebx,100 ;¦¤ âì ᥪã¤ã
|
||||
int 0x40
|
||||
;-------------------------------------------------------------------------------
|
||||
; ⨯ ᮡëâ¨ï ¢®§¢à éñ ¢ eax, ¤ «¥¥ ¯à®¢¥à塞, ª ª®¥ ᮡë⨥ ¯à®¨§®è«®
|
||||
;-------------------------------------------------------------------------------
|
||||
cmp eax,1 ; § ¯à®á ¯¥à¥à¨á®¢ªã?
|
||||
je redraw
|
||||
cmp eax,2 ; ¦ â ª« ¢¨è ª« ¢¨ âãàë?
|
||||
je key
|
||||
cmp eax,3 ; ¦ â ª®¯ª ¢ ®ª¥ ¯à®£à ¬¬ë?
|
||||
je button
|
||||
cmp eax,6 ; mouse - click or move?
|
||||
je MOUSE
|
||||
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 ;
|
||||
noclose: ; ª®¯ª id=200( "New" )
|
||||
mov dword[pox],0
|
||||
mov dword[pox+4],0 ;clear memory
|
||||
mov dword[pox_],0 ;rest and other stuff
|
||||
mov word[poxl],0 ; bits of pole X
|
||||
mov word[pool],0 ; bits of pole O
|
||||
;mov byte[fill],0 ; ®¡ã«ï¥¬ áç¥â稪 室®¢
|
||||
;mov byte[xwin],0 ; flag - x winner
|
||||
;mov byte[owin],0 ; flag - o winner
|
||||
jmp redraw ; ç¨á⮥ ¨£à®¢®¥ ¯®«¥ ==>>
|
||||
;-------------------------------------------------------------------------------
|
||||
; ᬮâਬ, £¤¥ ¡ë« ¦ â ¬ëèì
|
||||
;-------------------------------------------------------------------------------
|
||||
MOUSE:
|
||||
mov eax,37 ; ¬ëèìî..
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
cmp eax,0 ; ..¨ç¥£® ¥ ¦ â® - ¦¤ âì ᮡë⨩
|
||||
je event_wait
|
||||
; ¦ â ª®¯ª ¬ëè¨
|
||||
mov eax,37 ; cursor coords
|
||||
mov ebx,1
|
||||
int 0x40 ;eax=x*65536+y
|
||||
mov [px],eax ;[px][py] - ª®®à¤¨ â âªã⮣® ¬¥áâ
|
||||
|
||||
xor eax,eax
|
||||
g11: ;1st cell======
|
||||
cmp word[px],92
|
||||
ja g12 ;>92
|
||||
cmp word[py],92
|
||||
ja g12 ;>92
|
||||
|
||||
;mov dword[idx],0 ;N=(0..8)
|
||||
jmp puts
|
||||
|
||||
g12: ;2nd cell========
|
||||
inc al
|
||||
cmp word[py],145
|
||||
ja g13 ;>142
|
||||
cmp word[px],92
|
||||
ja g13 ;>92
|
||||
;mov dword[idx],1 ;N=(0..8)
|
||||
jmp puts
|
||||
g13: ;3=========
|
||||
inc al
|
||||
cmp word[px],92
|
||||
ja g21 ;>92
|
||||
;mov dword[idx],2 ;N=(0..8)
|
||||
jmp puts
|
||||
g21: ;4========
|
||||
inc al
|
||||
cmp word[px],145
|
||||
ja g22
|
||||
cmp word[py],92
|
||||
ja g22
|
||||
;mov dword[idx],3 ;N=(0..8)
|
||||
jmp puts
|
||||
g22: ;5=======
|
||||
inc al
|
||||
cmp word[px],145
|
||||
ja g23
|
||||
cmp word[py],145
|
||||
ja g23
|
||||
;mov dword[idx],4 ;N=(0..8)
|
||||
jmp puts
|
||||
g23: ;6=======
|
||||
inc al
|
||||
cmp word[px],142
|
||||
ja g31 ;>142
|
||||
;mov dword[idx],5 ;N=(0..8)
|
||||
jmp puts
|
||||
g31: ;7=======
|
||||
inc al
|
||||
cmp word[py],92
|
||||
ja g32
|
||||
;mov dword[idx],6 ;N=(0..8)
|
||||
jmp puts
|
||||
g32: ;8======
|
||||
inc al
|
||||
cmp word[py],145
|
||||
ja g33
|
||||
;mov dword[idx],7 ;N=(0..8)
|
||||
jmp puts
|
||||
g33: ;9======
|
||||
inc al
|
||||
;mov dword[idx],8 ;N=(0..8)
|
||||
|
||||
puts: ;㦥 ®¯à¥¤¥«¨«¨ ª«¥âªã
|
||||
push eax
|
||||
pop dword[idx]
|
||||
mov esi,dword[idx] ;
|
||||
cmp byte[pox+esi],0 ;¯®«¥ ᢮¡®¤®? (0-᢮¡®¤®¥ ¯®«¥)
|
||||
jne event_wait ;¢®§¢à é ¥¬áï § ¤ ª 横«ã ®¦¨¤ ¨ï
|
||||
|
||||
shl esi,2 ;*4
|
||||
mov eax,dword[pole+esi]
|
||||
mov dword[px],eax ;x coord from tabl ->px
|
||||
;mov ax,word[pole+esi+2]
|
||||
;mov word[py],ax ;y coord from tabl ->py
|
||||
|
||||
call x_put ;"X"
|
||||
|
||||
mov esi,dword[idx] ;esi - cell number =0..8
|
||||
mov byte[pox+esi],'x'
|
||||
inc byte[fill] ;turn+1
|
||||
|
||||
xor eax,eax ;eax=0
|
||||
inc eax ;bit=1 eax=1
|
||||
mov ecx,dword[idx] ; esi=n
|
||||
shl ax,cl ; <<n-bit bit[n]=1
|
||||
or word[poxl],ax ;set bit in [poxl]
|
||||
|
||||
call x_win ;¯à®¢¥àª ¢ë¨£àëè •
|
||||
cmp byte[xwin],1 ;ä« £ ¯®¡¥¤ë ãáâ ®¢«¥?
|
||||
jne del5 ;¥â - ¯¥à¥áª®ª delay
|
||||
|
||||
mov eax,4 ; ä㪠4: ¯¨á âì ⥪áâ 'WINNER!'
|
||||
mov ebx,18*65536+215 ; [x ç] *65536 + [y ç]
|
||||
mov ecx,0x10FF22FF ; 梥â ⥪áâ RRGGBB
|
||||
mov edx,texts ; 㪠§ ⥫ì ç «® ⥪áâ
|
||||
mov esi,textend-texts ; ¤«¨ ⥪áâ ¢ ¡ ©â å
|
||||
int 0x40 ;
|
||||
jmp event_wait ; ¢®§¢à é ¥¬áï § ¤ ª 横«ã ®¦¨¤ ¨ï
|
||||
|
||||
;===========================================================
|
||||
del5: mov eax,5 ;=== delay 0,5 sec ===
|
||||
mov ebx,50
|
||||
int 0x40
|
||||
|
||||
cmp byte[fill],8 ;¢á¥ ¯®«ï § ïâë - 室¨âì ¥ªã¤
|
||||
jnb event_wait ;¢®§¢à é ¥¬áï § ¤ ª 横«ã ®¦¨¤ ¨ï - ª®¥æ.
|
||||
|
||||
rnew: ;
|
||||
call rndnext ; á«ãç ©®¥ ç¨á«® ¢ eax
|
||||
and eax, 0111b ; eax = 0..7
|
||||
mov esi,eax ; eax->esi
|
||||
call rndnext ; á«ãç ©®¥ ç¨á«® ¢ eax
|
||||
and eax, 01b ; eax= 0..1
|
||||
add esi,eax ; esi+=eax
|
||||
;esi=0..8 - index
|
||||
cmp byte[pox+esi],0 ;á«ãç ©®¥ ¯®«¥ ᢮¡®¤®?
|
||||
jne rnew ;¥â - ®¢®¥ á«ãç ©®¥ ç¨á«®
|
||||
|
||||
cmp byte[pox+4],0 ;æ¥âà ᢮¡®¤¥?
|
||||
jne @F ;¥â - á«ãç ©ë© å®¤ (㦥 ¢ esi)
|
||||
mov esi,4 ;¤ - 室¨¬ ¢ æ¥âà (4) ¢¬¥áâ® á«ãç.
|
||||
@@:
|
||||
mov dword[idx],esi ;á®åà ¨¬ ¢ idx
|
||||
;esi=0..8 - index
|
||||
call o_com ;¯à®¢¥àª 24åê ª®¬¡¨ 権 XX0
|
||||
call x_com ;¯à®¢¥àª 24åê ª®¬¡¨ 権 00*
|
||||
|
||||
mov esi,dword[idx] ;idx-¨¤¥ªá ª«¥âª¨(0..8) ªã¤ 室
|
||||
shl esi,2 ; esi*4 - ¯®«¥ á®á⮨⠨§ § ¯¨á¥© ¯® dword
|
||||
mov eax,dword[pole+esi] ;
|
||||
mov dword[px],eax ;x coord from tabl ->px
|
||||
; mov ax,word[pole+esi+2] ;
|
||||
; mov word[py],ax ;y coord from tabl ->py
|
||||
call o_put ; à¨á㥬 ®«¨ª 'O'
|
||||
|
||||
mov esi,dword[idx]
|
||||
mov byte[pox+esi],'o'
|
||||
inc byte[fill] ;turn++
|
||||
|
||||
xor eax,eax ;eax=0
|
||||
inc eax ;bit=1 eax=1
|
||||
mov ecx,dword[idx] ; ecx=n
|
||||
shl ax,cl ; <<n-bit bit[n]=1
|
||||
or word[pool],ax ;set bit in [pool]
|
||||
|
||||
call o_win
|
||||
cmp byte[owin],1
|
||||
jne event_wait
|
||||
|
||||
mov eax,4 ; ä㪠4: ¯¨á âì ⥪áâ 'LOOSER!'
|
||||
mov ebx,48*65536+215 ; [x ç] *65536 + [y ç]
|
||||
mov ecx,0x10FF22FF ; 梥â ⥪áâ RRGGBB
|
||||
mov edx,lootxt ; 㪠§ ⥫ì ç «® ⥪áâ
|
||||
mov esi,text-lootxt ; ¤«¨ ⥪áâ ¢ ¡ ©â å
|
||||
int 0x40 ;
|
||||
jmp event_wait ; ¢®§¢à é ¥¬áï § ¤ ª 横«ã ®¦¨¤ ¨ï
|
||||
;===========================================--
|
||||
;
|
||||
}
|
||||
|
||||
|
BIN
programs/games/lights/trunk/Lights_HINT.PNG
Normal file
BIN
programs/games/lights/trunk/Lights_HINT.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 295 B |
53
programs/games/lights/trunk/data.inc
Normal file
53
programs/games/lights/trunk/data.inc
Normal file
@ -0,0 +1,53 @@
|
||||
;#**************************
|
||||
;#* LIGHTS (c)* data.inc
|
||||
;#************************** 15/10/2007
|
||||
L0 equ 0x0000F8 ; light off
|
||||
L1 equ 0xFFFF00 ; light on
|
||||
deltaX equ 35
|
||||
deltaY equ 35
|
||||
posX equ 50
|
||||
posY equ 50
|
||||
|
||||
macro DATA_SECTION
|
||||
{
|
||||
; „€<EFBFBD><EFBFBD>›… <EFBFBD><EFBFBD>Žƒ<EFBFBD>€ŒŒ›
|
||||
;-----------------------------------------------------------------------------
|
||||
text: db 'LIGHTS v0.002 [ESC] - quit' ; winheader string
|
||||
texts: db 'Congratulations!!!' ; in window
|
||||
textend:
|
||||
|
||||
;=================Table===================== 18x18 :: N,Color,X,Y , up,lf,rt,dn
|
||||
tButIdx: dd 0
|
||||
tBut:
|
||||
db 5,0, posX+deltaX*0, posY+deltaY*0 , 0 , 0 , 1 , 1
|
||||
db 6,0, posX+deltaX*1, posY+deltaY*0 , 0 , 1 , 1 , 1
|
||||
db 7,0, posX+deltaX*2, posY+deltaY*0 , 0 , 1 , 1 , 1
|
||||
db 8,0, posX+deltaX*3, posY+deltaY*0 , 0 , 1 , 1 , 1
|
||||
db 9,0, posX+deltaX*4, posY+deltaY*0 , 0 , 1 , 0 , 1
|
||||
|
||||
db 10,0, posX+deltaX*0, posY+deltaY*1 , 1 , 0 , 1 , 1
|
||||
db 11,0, posX+deltaX*1, posY+deltaY*1 , 1 , 1 , 1 , 1
|
||||
db 12,0, posX+deltaX*2, posY+deltaY*1 , 1 , 1 , 1 , 1
|
||||
db 13,0, posX+deltaX*3, posY+deltaY*1 , 1 , 1 , 1 , 1
|
||||
db 14,0, posX+deltaX*4, posY+deltaY*1 , 1 , 1 , 0 , 1
|
||||
|
||||
db 15,0, posX+deltaX*0, posY+deltaY*2 , 1 , 0 , 1 , 1
|
||||
db 16,0, posX+deltaX*1, posY+deltaY*2 , 1 , 1 , 1 , 1
|
||||
db 17,0, posX+deltaX*2, posY+deltaY*2 , 1 , 1 , 1 , 1
|
||||
db 18,0, posX+deltaX*3, posY+deltaY*2 , 1 , 1 , 1 , 1
|
||||
db 19,0, posX+deltaX*4, posY+deltaY*2 , 1 , 1 , 0 , 1
|
||||
|
||||
db 20,0, posX+deltaX*0, posY+deltaY*3 , 1 , 0 , 1 , 1
|
||||
db 21,0, posX+deltaX*1, posY+deltaY*3 , 1 , 1 , 1 , 1
|
||||
db 22,0, posX+deltaX*2, posY+deltaY*3 , 1 , 1 , 1 , 1
|
||||
db 23,0, posX+deltaX*3, posY+deltaY*3 , 1 , 1 , 1 , 1
|
||||
db 24,0, posX+deltaX*4, posY+deltaY*3 , 1 , 1 , 0 , 1
|
||||
|
||||
db 25,0, posX+deltaX*0, posY+deltaY*4 , 1 , 0 , 1 , 0
|
||||
db 26,0, posX+deltaX*1, posY+deltaY*4 , 1 , 1 , 1 , 0
|
||||
db 27,0, posX+deltaX*2, posY+deltaY*4 , 1 , 1 , 1 , 0
|
||||
db 28,0, posX+deltaX*3, posY+deltaY*4 , 1 , 1 , 1 , 0
|
||||
db 29,0, posX+deltaX*4, posY+deltaY*4 , 1 , 1 , 0 , 0
|
||||
;=======================================:: N,Color,X,Y , up,lf,rt,dn
|
||||
;----------------------------------------------------------------------------
|
||||
}
|
15
programs/games/lights/trunk/lights.asm
Normal file
15
programs/games/lights/trunk/lights.asm
Normal file
@ -0,0 +1,15 @@
|
||||
;#**************************
|
||||
;#* LIGHTS * Kolibri OS
|
||||
;#************************** 15/10/2007
|
||||
include 'main.inc'
|
||||
include 'data.inc'
|
||||
include 'macs.inc'
|
||||
|
||||
BeginProgram
|
||||
|
||||
main_loop
|
||||
|
||||
DATA_SECTION
|
||||
|
||||
EndProgram
|
||||
|
11
programs/games/lights/trunk/lights.txt
Normal file
11
programs/games/lights/trunk/lights.txt
Normal file
@ -0,0 +1,11 @@
|
||||
LIGHTS v0.002
|
||||
|
||||
<EFBFBD>« αα¨η¥α<EFBFBD> ο ¨£ΰ Ά ‹ ¬―®η<C2AE>¨ ¨§Ά¥αβ ¤ Ά®.
|
||||
<EFBFBD>ΰ Ά¨« ―ΰ®αβλ. –¥«μ ¨£ΰλ Ά<>«ξη¨βμ Άα¥ 25 "« ¬―®η¥<CEB7>".
|
||||
<EFBFBD> ¦ ⨥ ¬λθ<CEBB>®© <20>«¥β<C2A5>㠡㤥⠯¥ΰ¥<CEB0>«ξη βμ « ¬―®η<C2AE>γ
|
||||
( β <CEB2>¦¥ ᬥ¦λ¥) β <CEB2>¦¥ α®α¥¤¨¥ Ά α®αβ®ο¨¥ Ά<>«./Άλ<CE86>«.
|
||||
|
||||
<EFBFBD> ¦¥βαο «¥£<C2A5>®, ® νβ® ¤®Ά®«μ® βΰ㤮.
|
||||
|
||||
|
||||
===16/10/2007===http://board.kolibrios.org/
|
72
programs/games/lights/trunk/macs.inc
Normal file
72
programs/games/lights/trunk/macs.inc
Normal file
@ -0,0 +1,72 @@
|
||||
macro BeginProgram
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd 0x10000 ;__memory
|
||||
dd 0x10000 ;__stack
|
||||
dd 0x0 ; dd __params
|
||||
dd 0x0
|
||||
__start:
|
||||
}
|
||||
|
||||
macro EndProgram
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__end:
|
||||
;org 0x10000
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
|
||||
macro mButton nn,crgb,x,y,dx,dy
|
||||
{
|
||||
mov eax,8 ; äãªæ¨ï 8: ®¯à¥¤¥«¨âì ¨ ¢ë¢¥á⨠ª®¯ªã
|
||||
mov ebx,x*65536+dx ; [x ç «ìë©] *65536 + [x à §¬¥à]
|
||||
mov ecx,y*65536+dy ; [y ç «ìë©] *65536 + [y à §¬¥à]
|
||||
mov edx,nn ; ¨¤¥â¨ä¨ª â®à ª®¯ª¨ =1
|
||||
mov esi,crgb ;0x116611 ; 梥⠪®¯ª¨ RRGGBB
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro LoopBegin lab,begi
|
||||
{
|
||||
push ecx ; ECX->STACK store
|
||||
mov ecx,begi
|
||||
lab:
|
||||
push ecx ; ECX->STACK counter
|
||||
}
|
||||
|
||||
macro LoopEnd lab,endi
|
||||
{
|
||||
pop ecx ;ECX<-STACK counter
|
||||
inc ecx
|
||||
cmp ecx,endi
|
||||
jne lab
|
||||
pop ecx ;ECX<-STACK restore
|
||||
}
|
||||
|
||||
|
||||
|
||||
;------------------------------------
|
||||
; constants
|
||||
;-----------------------梥â:0xRRGGBB
|
||||
cBLACK = 0x000000 ; ç¥àë©
|
||||
cRED = 0xFF0000 ; ªà áë©
|
||||
cYELLOW = 0x3FFFF00 ; ¦¥«âë©
|
||||
cGREEN = 0x00FF00 ; §¥«¥ë©
|
||||
cNAVY = 0x0000FF ; ᨨ©
|
||||
cMAGENTA = 0xFF00FF ; ¬ «¨®¢ë©
|
||||
cBLUE = 0x00FFFF ; £®«ã¡®©
|
||||
cWHITE = 0xFFFFFF ; ¡¥«ë©
|
||||
cBROWN = 0x554433 ;
|
||||
|
||||
;-------------------------------
|
||||
cMAGENTAl = 0xB800B8 ; magenta
|
||||
cVIOLETl = 0xF800F8 ; 䨮«¥â®¢ë©
|
||||
|
217
programs/games/lights/trunk/main.inc
Normal file
217
programs/games/lights/trunk/main.inc
Normal file
@ -0,0 +1,217 @@
|
||||
;#**************************
|
||||
;#* 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 ;¢®§¢à é ¥¬áï ª 横«ã ®¦¨¤ ¨ï
|
||||
}
|
||||
|
||||
|
1372
programs/games/sw/trunk/sw.asm
Normal file
1372
programs/games/sw/trunk/sw.asm
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user