Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 108 → Rev 109

/programs/games/15/trunk/15.ASM
0,0 → 1,489
;
; The famous game 15
; Author: Lloyd, coded by Ivushkin Andrey
; Compile with FASM
;
include 'lang.inc'
include 'macros.inc' ; decreases program size (not required)
 
BgdColor equ 0x02aabbcc
StatusColor equ 0x02ffffff
StatusColor2 equ 0x02dc1e14
BgdColor equ 0x03aabbcc
 
; Main window dimensions
XXwindow equ 200 shl 16+276
YYwindow equ 200 shl 16+300
; Status bar
XYstatus equ 35 shl 16+283
XXbar equ 35 shl 16+136
YYbar equ 280 shl 16+15
; Buttons
BtnTop equ 28
BtnLeft equ 13
BtnSize equ 60
BtnColor equ 0xafbb55
BtnColor2 equ 0x0228c314
 
NumColor equ 0x10000000
; Number shifting for nice look
NumShift equ 24 shl 16+27
NumShift2 equ 4 shl 16
; Shuffle button
XXSh equ 202 shl 16+60
YYSh equ 280 shl 16+12
XYShText equ 212 shl 16+283
 
; Conf button
XXCnf equ 13 shl 16+13
YYCnf equ 280 shl 16+12
XYCnfText equ 18 shl 16+283
 
; Position of the 'hole'
null equ (curconf+16)
; Amount of moves to perform shuffle
SH_CYCLES equ 400
; (Amount of tasks)-1
CONF_COUNT equ 2
 
use32
 
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x2000 ; 8 Kb
dd 0x2000
dd 0x0
dd 0x0
 
 
START:
mov [cptr],CONF_COUNT ; number of task
mov eax,3
int 0x40
mov cl,16
ror eax,cl
mov [generator],eax ; random generator from Tetris
init:
mov ecx,17
movzx eax,[cptr]
inc eax
cmp eax,CONF_COUNT
jna init_ok
xor eax,eax ; cycling 0..CONF_COUNT
init_ok:
mov [cptr],al
mov esi,eax
shl esi,4
add esi,conf
add esi,eax
add al,0x31
mov [lenTitle-1],al ;task number to program title
mov [task],esi
mov edi,curconf
rep movsb ; initial configuration
 
mov [sts],4
jmp red
SHUF:
call shuffle ; immediate shuffle
red: ; window redraw
 
call draw_window
 
still: ; MAIN PROGRAM CYCLE
 
mov eax,10 ; wait for event
int 0x40
 
cmp eax,1 ; redraw? -
je red ; goto red
cmp eax,2 ; key pressed? -
je key ; goto key
cmp eax,3 ; button pressed? -
je button ; goto button
 
jmp still ; no more events to process
 
key: ; Key pressed
mov eax,2
int 0x40
shr eax,8
cmp eax,32 ; <Space> = Shuffle
je SHUF
cmp eax,13 ; <Enter> = Choose task
je init
cmp eax,176
jl still
sub eax,176
cmp eax,3
ja still
movzx eax,byte [eax+correct] ; 'delta' value from correct[]
jmp m_check
 
button: ; Button pressed
mov eax,17
int 0x40
shr eax,8
sub eax,2
 
cmp eax,-1 ; id == 1 (closeme)?
jne noclose
int 0x40
 
noclose:
jl SHUF ; Shuffle (id=0) pressed
cmp eax,18
je init ; Conf button pressed
sub al,byte [null]
mov edi,correct
mov ecx,4
repne scasb ; checking for valid move-part 1
jne fail
m_check:
cmp byte[sts],4 ; puzzle completed, blocking buttons
ja still
call move_check ; checking for valid move-part 2
jnc fail
inc [move_count]
call draw_moves
fail:
jmp still ; ¢®§¢à é ¥¬áï
 
; *******************************
; ******* WINDOW DRAWING *******
; *******************************
 
draw_window:
mov eax,12
mov ebx,1 ; begin draw
int 0x40
 
; CREATING WINDOW
mov eax,0
mov ebx,XXwindow
mov ecx,YYwindow
mov edx,BgdColor
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
 
; PROGRAM TITLE
mov eax,4
mov ebx,8*65536+8
mov ecx,0x10ddeeff
mov edx,txtTitle
mov esi,lenTitle-txtTitle
int 0x40
 
mov eax,8 ; SHUFFLE BUTTON
mov ebx,XXSh
mov ecx,YYSh
xor edx,edx
mov esi,BtnColor
int 0x40
 
mov ebx,XXCnf ; CONF BUTTON
mov ecx,YYCnf
mov edx,20
mov esi,BtnColor
int 0x40
 
mov ebx, XYShText ; SHUFFLE TEXT
mov ecx, StatusColor
mov edx,txtSh
mov esi,lenSh-txtSh
mov eax,4
int 0x40
 
mov ebx, XYCnfText ; CONF TEXT
mov edx,lenVictory-1
mov esi,1
int 0x40
 
mov ecx, 16 ; FIELD BUTTONS
dbut:
call draw_button
loop dbut
 
call draw_moves
 
mov eax,12
mov ebx,2 ; end of drawing
int 0x40
ret
 
 
; *********************************************
; ******* DRAWING A FIELD BUTTON **************
; *********************************************
; ECX - button number
 
draw_button:
pusha
dec ecx
; calculating button dimensions
mov edi, ecx
lea edx,[ecx+2]
mov ebx,ecx
and ebx,11b
shr ecx,2
 
imul ebx,BtnSize+3
add ebx,BtnLeft
shl ebx,16
add ebx,BtnSize
 
imul ecx,BtnSize+3
add ecx,BtnTop
shl ecx,16
add ecx,BtnSize
movzx eax,byte [null]
cmp eax,edi
jne no_hole
 
pusha
inc ebx
inc ecx
mov edx,BgdColor
mov eax,13 ; clearing - 'hole'
int 0x40
popa
 
or edx,0x80000000 ; and removing button under it
no_hole:
mov al,byte[edi+curconf]
mov esi,[task]
cmp al,byte[edi+esi]
je highlight
mov esi,BtnColor
jmp s_rbutton
highlight:
mov esi,BtnColor2
s_rbutton:
mov eax,8 ; set/remove button
int 0x40
movzx eax,byte [null]
cmp eax,edi
je no_text ; no digits - that's hole
mov edx,ebx
shr ecx,16
mov dx,cx
add edx,NumShift
mov ebx,0x20000
movzx ecx,byte [edi+curconf]
cmp ecx,9
ja two_num
add edx,NumShift2 ; shift to center digits
sub ebx,0x10000
two_num:
mov esi,NumColor
mov eax,47
int 0x40
no_text:
popa
ret
 
 
; *********************************************
; ******* DRAWING STATUS LINE *****************
; *********************************************
 
draw_moves:
mov eax, 13 ; clear area
mov ebx, XXbar
mov ecx, YYbar
mov edx, BgdColor
int 0x40
 
mov eax, 4
mov ebx, XYstatus
mov ecx, StatusColor
cmp ax, [sts]
jl report_victory
jne report_moves
mov edx,txtCnf ; prompt to choose configuration
mov esi,lenCnf-txtCnf
jmp e_dm
report_moves:
mov edx,txtMoves ; how many moves done
mov esi,lenMoves-txtMoves
mov eax,4
int 0x40
mov esi,ecx
mov edx,ebx
add edx, 40 shl 16
mov ebx,0x030000
movzx ecx, byte[move_count]
mov eax,47
jmp e_dm
report_victory: ; puzzle completed
mov ecx,StatusColor2
mov edx,txtVictory
mov esi,lenVictory-txtVictory
e_dm:
int 0x40
ret
 
 
; *********************************************
; ********* SHUFFLE ***************************
; *********************************************
 
shuffle:
xor eax,eax
mov [sts],ax
mov [move_count],ax ; reset moves to 0
mov [sh_off],al
mov eax, [generator]
 
mov ecx,SH_CYCLES
sh_cycle:
sub eax,0x43ab45b5 ; next random number
ror eax,1
xor eax,0x32c4324f
ror eax,1
mov [generator],eax
 
push eax
and eax,11b ; direction 0..3
movzx eax,byte [eax+correct]
call move_check
pop eax
jnc sh_cycle ; if fails then retry
loop sh_cycle
inc byte[sh_off] ; shuffling complete
ret
 
 
; *********************************************
; ********* MOVE VALIDITY CHECK ***************
; *********************************************
; AL - 'DELTA' DIRECTION
 
move_check:
pusha
mov ah,byte [null]
mov bx,ax
cmp bh,3
ja no_top
cmp al,-4 ; top of field
je no_move
no_top:
cmp bh,12
jb no_bottom
cmp al,4 ; bottom of field
je no_move
no_bottom:
and bh,11b
cmp bh,0
jnz no_left
cmp al,-1 ; left of field
je no_move
no_left:
cmp bh,11b
jnz ok
cmp al,1 ; right of field
je no_move
ok:
mov bx,ax
add bh,bl ; bh-new hole
mov byte [null],bh
movzx ecx,ah
mov al,byte[ecx+curconf]
movzx edx,bh
mov bl,byte[edx+curconf] ; swapping button & hole
mov byte[ecx+curconf],bl
mov byte[edx+curconf],al
 
cmp byte[sh_off],0 ; if shuffle in progress,
jz no_win ; then no redraw
 
; drawing button & hole
inc ecx
call draw_button
movzx ecx,bh
inc ecx
call draw_button
; testing if task completed
mov esi,[task]
mov edi,curconf
mov ecx,16
repe cmpsb
cmp ecx,0
jne no_win
mov word[sts],6 ; puzzle done. Victory!
no_win:
popa
stc
ret
no_move:
popa
clc
ret
; this is deprecated debug routine
;ud:
; ud2
 
; These are data used by program
 
correct db 1,-4,4,-1
 
conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15
db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0
db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9
 
txtMoves:
if lang eq ru
db '•®¤®¢:'
else
db 'Moves:'
end if
lenMoves:
 
txtSh:
if lang eq ru
db '’ á®¢ª '
else
db 'Shuffle'
end if
lenSh:
 
txtCnf:
if lang eq ru
db '‚ë¡¥à¨â¥ § ¤ çã ¨ ­ ¦¬¨â¥->'
else
db 'Select task, then press ->'
end if
lenCnf:
 
txtTitle: ; áâப  § £®«®¢ª 
if lang eq ru
db 'ˆ£à  15 - § ¤ ç  X'
else
db 'Game 15 - puzzle X'
end if
lenTitle: ; ¨ ¥ñ ª®­¥æ
 
txtVictory:
if lang eq ru
db '‚ë à¥è¨«¨ § ¤ çã!  ¦¬¨â¥->'
else
db 'Puzzle completed! Press->'
end if
lenVictory:
 
arrow equ lenVictory-2
 
I_END: ; ª®­¥æ ¯à®£à ¬¬ë
;null db ?
move_count dw ?
cptr db ?
sts dw ?
sh_off db ?
task dd ?
generator dd ?
curconf:
/programs/games/15/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm 15.asm 15
@pause
/programs/games/15/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm 15.asm 15
@pause
/programs/games/15/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanii/trunk/arcanii.asm
0,0 → 1,921
VERSION equ 'ARCANOID II v. 0.30'
; by jj
; (jacek jerzy malinowski)
;
; contact: 4nic8@casiocalc.org
;----------------------------------------
; Compile with FASM for Menuet
;----------------------------------------
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
include 'asjc.inc'
 
X_SIZE equ 400
Y_SIZE equ 300
 
MAX_LEVEL equ 5
 
BACK_CL equ 0x00EFEF ; background color
 
; THE MAIN PROGRAM:
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x200000 ; memory for app
dd 0x7fff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
START: ; start of execution
 
bmptoimg bmp_file,img_bmp ; loading ... ;]
getimg img_bmp,0,0,10,10,img_ball
getimg img_bmp,20,0,20,10,img_bonus
getimg img_bmp,0,10,40,20,img_brick1
getimg img_bmp,0,30,40,20,img_brick2
getimg img_bmp,0,50,40,20,img_brick3
getimg img_bmp,0,70,40,20,img_brick4
 
call draw_window
 
still:
if_e dword [level],0,.no_intro
call intro
jmp .no_game
.no_intro:
 
if_e dword [mode],2,.end_if1
call level_info
jmp .no_game
.end_if1:
 
if_e dword [mode],4,.end_if2
call game_over
jmp .no_game
.end_if2:
 
call fast_gfx ; <-- the main engine
.no_game:
 
mov eax,11
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
cmp ah,key_Esc ; if Esc ?
jne .no_q
mov eax,-1
int 0x40
.no_q:
 
if_e dword [mode],4,.end_if6
jmp still
.end_if6:
 
cmp ah,key_Space
jne .no_space
if_e dword [mode],2,.end_if1
mov dword [mode],0
jmp .no_space
.end_if1:
mov dword [mode],1
call fast_gfx
.no_space:
xor ebx,ebx
mov bl,ah
if_e ebx,key_F1,.no_f1
inc dword [del]
.no_f1:
if_e ebx,key_F2,.no_f2
if_a dword [del],0,.end_if3
dec dword [del]
.end_if3:
.no_f2:
 
 
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jne noclose
 
mov eax,-1 ; close this program
int 0x40
noclose:
 
jmp still
 
; *********************************************
; ******* VIRTUAL SCREEN FUNCTIONS ************
; *********************************************
 
show_screen: ; flips the virtual screen to the window
push_abc
 
mov eax,7
mov ebx,screen
mov ecx,X_SIZE*65536+Y_SIZE
mov edx,4*65536+20
int 0x40
 
pop_abc
ret
 
put_bmp_screen: ; eax - y , ebx - x, esi - bmp
cmp ebx,X_SIZE-5
jb .ok1
ret
.ok1:
cmp eax,Y_SIZE-5
jb .ok2
ret
.ok2:
 
push_abc
xor ecx,ecx
xor edx,edx
mov edi,screen
mov ecx,3
mul ecx ; xx = 3*y*X_SIZE+3*x
mov ecx,X_SIZE
mul ecx
push eax ; #> 1
mov eax,ebx
mov ecx,3
mul ecx
mov ebx,eax
pop edx ; #< 1
add edx,ebx
add edi,edx ; sets the pointer to x,y of the screen
 
mov cx,[si] ; loops 1
xor ebx,ebx
mov ax,cx
mov dx,3
mul dx
mov bx,ax
 
push ebx ;#>4
 
add si,4
mov ax,[si] ; loops 2
mov cx,[si]
;shr ax,2
mov dx,3 ; dx = ax *3
mul dx
mov bx,ax
add si,4
 
 
pop ebx ;#<4
.l_y:
mov ax,cx
cld
mov cx,bx
rep movs byte [edi],[esi]
add edi,X_SIZE
add edi,X_SIZE
add edi,X_SIZE
sub edi,ebx
mov cx,ax
loop .l_y
 
pop_abc
ret
 
rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color
mov edi,ebx
add ebx,ecx
cmp ebx,X_SIZE
jb .ok1
ret
.ok1:
mov ebx,edi
 
mov edi,eax
add eax,edx
cmp eax,Y_SIZE
jb .ok2
ret
.ok2:
mov eax,edi
push_abc
push ecx ;#>2
push edx ;#>3
 
xor ecx,ecx
xor edx,edx
mov edi,screen
mov ecx,3
mul ecx ; xx = 3*y*X_SIZE+3*x
mov ecx,X_SIZE
mul ecx
push eax ; #> 1
mov eax,ebx
mov ecx,3
mul ecx
mov ebx,eax
pop edx ; #< 1
add edx,ebx
 
add edi,edx ; sets the pointer to x,y of the screen
 
pop ecx ; #<3
pop edx ; #<4
mov eax,esi
.l_y:
;mov ax,cx
push ecx
cld
mov ecx,edx
.l_x:
;rep movs byte [edi],[esi]
mov word [edi],ax
push eax
shr eax,16
mov byte [edi+2],al
add edi,3
pop eax
loop .l_x
 
add edi,X_SIZE
add edi,X_SIZE
add edi,X_SIZE
sub edi,edx
sub edi,edx
sub edi,edx
;mov cx,ax
pop ecx
loop .l_y
 
pop_abc
ret
 
grad_rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color, d
push edi ;#>0
mov edi,ebx
add ebx,ecx
cmp ebx,X_SIZE
jb .ok1
pop edi ;#<0
ret
.ok1:
mov ebx,edi
 
mov edi,eax
add eax,edx
cmp eax,Y_SIZE
jb .ok2
pop edi ;#<0
ret
.ok2:
mov eax,edi
 
pop edi ;#<0
push_abc
 
push edi ;#>5
push ecx ;#>2
push edx ;#>3
 
xor ecx,ecx
xor edx,edx
mov edi,screen
mov ecx,3
mul ecx ; xx = 3*y*X_SIZE+3*x
mov ecx,X_SIZE
mul ecx
push eax ; #> 1
mov eax,ebx
mov ecx,3
mul ecx
mov ebx,eax
pop edx ; #< 1
add edx,ebx
 
add edi,edx ; sets the pointer to x,y of the screen
 
pop ecx ; #<3
pop edx ; #<2
mov eax,esi
pop esi ; #<5
.l_y:
;mov ax,cx
push ecx
cld
mov ecx,edx
.l_x:
;rep movs byte [edi],[esi]
mov word [edi],ax
push eax
shr eax,16
mov byte [edi+2],al
add edi,3
pop eax
loop .l_x
 
add edi,X_SIZE
add edi,X_SIZE
add edi,X_SIZE
sub edi,edx
sub edi,edx
sub edi,edx
add eax,esi
;mov cx,ax
pop ecx
loop .l_y
 
pop_abc
ret
 
 
fill_screen: ; eax - screen color ( 0x00RRGGBB )
push_abc
mov edi,screen
cld
mov ecx,X_SIZE*Y_SIZE
.lab1:
mov [edi],eax
add edi,3
loop .lab1
pop_abc
ret
 
grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack
push_abc
mov edi,screen
cld
mov ecx,Y_SIZE
mov dl,0
.lab1:
push ecx
mov ecx,X_SIZE
.lab2:
mov [edi],eax
add edi,3
loop .lab2
mov dh,1 ; dl = 1 - dl
sub dh,dl
mov dl,dh
cmp dl,0
jne .no_ch ; if (dl==0)
add eax,ebx ; change gradient
.no_ch:
pop ecx
loop .lab1
pop_abc
ret
 
 
bmp_fill_screen: ; esi - pointer to a backgroung bmp
push_abc
mov edi,screen
cld
mov ecx,X_SIZE*Y_SIZE
rep movs dword [edi],[esi]
pop_abc
ret
 
;___________________
intro: ; INTRO ;
label 140,200,VERSION,0x100000FF
label 120,220,'by jj (jacek jerzy malinowski)',0x050505
label 100,240,'press SPACE to start a new game',0x10FF0800
label 15,240,'F1 + delay',0xFFA8FF
label 15,260,'F2 + delay',0xFFA8FF
delay 10
ret
 
;___________________
level_info:
label 170,230,'L E V E L',0x100000FF
outcount [level],195,250,0x100000FF,2*65536
label 100,270,'press SPACE to start the level',0x10FF0800
delay 10
ret
 
;_________________________
game_over: ; GAME OVER ;
mov eax,0x00FF00
mov ebx,0xFF01
.g_ok:
call grad_fill_screen
call show_screen ; flips the screen
label 120,150,'G A M E O V E R',0x10050505
label 140,200,'Thanks for playing',0x0FFF800
delay 20
ret
 
 
;-----------------------------;
; THE MAIN THE GAME'S ENGINE ;
;-----------------------------;
fast_gfx:
; the background gradient
if_e dword [level],0,.no_0
mov eax,0xFF
mov ebx,0xFEFF
jmp .g_ok
.no_0:
if_e dword [level],1,.no_1
mov eax,BACK_CL
mov ebx,0xFFFF
jmp .g_ok
.no_1:
if_e dword [level],2,.no_2
mov eax,0xFF0000
mov ebx,0xFF00FF
jmp .g_ok
.no_2:
 
mov eax,BACK_CL
mov ebx,0xFFFF
.g_ok:
call grad_fill_screen
 
mov eax,37 ; get mouse position
mov ebx,1
int 0x40
shr eax,16
mov [x],eax
add eax,[s_x]
cmp eax,X_SIZE ; controls if the pad is in the screen
jb .ok
cmp eax,0x7FFF ; if < 0
jb .upper
mov [x],0
jmp .ok
.upper: ; if > X_SIZE - pad size
mov dword [x],X_SIZE-1
mov eax,[s_x]
sub dword [x],eax
.ok:
mov ebx,[x]
mov eax,[y]
mov ecx,[s_x]
mov edx,15
mov esi,0xFF0000
mov edi,0xF0000F
call grad_rect_screen
 
call draw_level
 
cmp dword [mode],1
jne .no_go ; is the game started ?
mov eax,[v_x]
add dword [b_x],eax
mov eax,[v_y]
add dword [b_y],eax
jmp .go
.no_go:
mov eax,[x] ; b_x = x + x_s/2
mov ebx,[s_x]
shr ebx,1
add eax,ebx
mov dword [b_x],eax
mov eax,[y] ; b_y = y - 10
sub eax,10
mov dword [b_y],eax
 
mov dword [v_x],1
mov dword [v_y],-1
.go:
;TEST WHERE IS THE BALL:
cmp dword [b_x],0x7FFFFFFF
jb .b_ok2 ; if out of the screen (left)
mov dword [b_x],0
mov eax,0
sub eax,[v_x]
mov [v_x],eax
.b_ok2:
cmp dword [b_x],X_SIZE-10
jb .b_ok1 ; if out of the screen (right)
mov dword [b_x],X_SIZE-11
mov eax,0
sub eax,[v_x]
mov [v_x],eax
.b_ok1:
cmp dword [b_y],0x7FFFFFFF
jb .b_ok3 ; if out of the screen (up)
mov dword [b_y],0
mov eax,0
sub eax,[v_y]
mov [v_y],eax
.b_ok3:
cmp dword [b_y],Y_SIZE-10
jb .b_ok4 ; if out of the screen (down)
mov dword [mode],0
if_e dword [lives],0,.end_if5
mov dword [mode],4 ; GAME OVER
jmp still
.end_if5:
dec dword [lives]
.end_else4:
call draw_window
.b_ok4:
 
imgtoimg img_ball,dword [b_x],dword [b_y],screen_img
 
call show_screen ; flips the screen
delay dword [del]
 
call do_tests ; does all needed tests
ret
;----------------------;
; BALL & BRICKS EVENTS ;
;----------------------;
MAX_SPEED equ 3
do_tests:
; BALL <-> PAD
mov eax,[b_x]
add eax,10
cmp eax,[x] ; if (b_x+10)>[pad x]
jb .skip ; &&
mov eax,[b_x]
mov ebx,[s_x]
add ebx,[x]
cmp eax,ebx ; if b_x < x + s_x
ja .skip ; &&
mov eax,[b_y]
add eax,10
cmp eax,[y] ; if (b_y+10) > y
jb .skip
sub eax,15
cmp eax,[y] ; if b_y < y+15
ja .skip
cmp dword [v_y],0x7FFFFF ; if v_y > 0
ja .skip
cmp dword [v_y],MAX_SPEED; speedup:
ja .skip_s
inc dword [speed_t]
cmp dword [speed_t],5
jb .skip_s
inc dword [v_y]
mov dword [speed_t],0
.skip_s:
inc dword [speed_t]
mov eax,0
sub eax,[v_y]
mov [v_y],eax
;counting v_x:--------
mov eax,[b_x]
sub eax,[x]
sub eax,5
mov ecx,eax
if_a eax,100,.end_if3
mov eax,0
sub eax,[v_x]
mov [v_x],eax
jmp .skip
.end_if3:
if_a eax,20,.end_if2
sub eax,20
shr eax,2
mov [v_x],eax
jmp .skip
.end_if2:
mov ebx,20
sub ebx,ecx
shr ebx,2
mov dword [v_x],0
sub dword [v_x],ebx
.skip:
 
; BALL <-> BRICK
mov dword [coliz],0
call colision
if_e dword [coliz],1,.end_if6
;abs dword [v_y]
;abs dword [v_x]
ret
.end_if6:
add dword [b_x],10
call colision
sub dword [b_x],10
if_e dword [coliz],1,.end_if7
;abs dword [v_y]
;abs dword [v_x]
ch_sign dword [v_x]
ret
.end_if7:
add dword [b_y],10
call colision
sub dword [b_y],10
if_e dword [coliz],1,.end_if8
;abs dword [v_y]
;abs dword [v_x]
;ch_sign dword [v_y]
ret
.end_if8:
add dword [b_x],10
add dword [b_y],10
call colision
sub dword [b_x],10
sub dword [b_y],10
if_e dword [coliz],1,.end_if9
;abs dword [v_y]
;abs dword [v_x]
;ch_sign dword [v_x]
;ch_sign dword [v_y]
 
ret
.end_if9:
 
 
ret
 
colision:
 
mov esi,levels
mov eax,[level] ; eax = levels*100
mov bx,100
mul bx
add esi,eax
;--------------
xor edx,edx
mov eax,[b_x]
mov ebx,40
div ebx
mov ecx,eax
push edx ;#>1
 
xor edx,edx
mov eax,[b_y]
mov ebx,20
div ebx
push edx ;#>2
cmp eax,9 ; out of the bricks board
ja .ok2
mov ebx,10
mul ebx
add eax,ecx
add esi,eax
 
cmp byte [esi],0 ; 0 - no brick
je .ok2
if_ne byte [esi],4,.end_if1
dec byte [esi]
.end_if1:
mov dword [coliz],1
pop ebx ;#<2
pop eax ;#<1
cmp ecx,8 ; x < 5 || x >35 - x inv
jb .inv
cmp ecx,33
ja .inv
jmp .no_inv
.inv:
mov eax,0
sub eax,[v_x]
mov [v_x],eax
;jmp .no_ok
.no_inv:
cmp ebx,6 ; if y < 5 || y>15 - y inv
jb .inv_y
cmp ebx,14
ja .inv_y
jmp .no_ok
.inv_y:
mov eax,0
sub eax,[v_y]
mov [v_y],eax
.no_ok:
jmp .ok
.ok2:
pop eax ;#<1
pop eax ;#<2
.ok:
 
 
ret
 
;-----------------------------------;
; DRAWS CURRENT LEVEL ON THE SCREEN ;
;-----------------------------------;
draw_level:
mov esi,levels
mov eax,[level] ; eax = levels*100
mov bx,100
mul bx
add esi,eax
mov ecx,10
mov eax,0
mov dword [l_end],1
.l_y:
push ecx ;#>1
mov ebx,0
mov ecx,10
.l_x:
cmp byte [esi],1 ; if 1 ?
push esi;#>2
jne .no_1
mov esi,img_brick1
call put_bmp_screen
mov dword [l_end],0
.no_1:
cmp byte [esi],2 ; if 2 ?
jne .no_2
mov esi,img_brick2
call put_bmp_screen
mov dword [l_end],0
.no_2:
cmp byte [esi],3 ; if 3 ?
jne .no_3
mov esi,img_brick3
call put_bmp_screen
mov dword [l_end],0
.no_3:
cmp byte [esi],4 ; if 4 ?
jne .no_4
mov esi,img_brick4
call put_bmp_screen
.no_4:
 
add ebx,40
pop esi ;#<2
inc esi
loop .l_x
add eax,20 ;#<1
pop ecx
loop .l_y
;----------------
; NEXT LEVEL
if_e dword [l_end],1,.end_if ; all bricks are taken
if_e dword [mode],1,.end_if
add dword [level],1
if_a dword [level],MAX_LEVEL,.end_if2
mov dword [mode],4 ; game over
jmp still
.end_if2:
call fast_gfx
mov dword [mode],2
.end_if:
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
startwd
 
window 100,100,X_SIZE+8,Y_SIZE+21,0x03ffffff
label 8,8,VERSION,cl_White+font_Big
label 200,8,'LIVES:',0x10ddeeff
outcount dword [lives],250,8,0x10ddeeff,65536
 
call fast_gfx
 
endwd
 
ret
 
;-----------;####################
; DATA AREA ;####################
;-----------;####################
 
lives dd 5
mode dd 0
l_end dd 0 ; if 1 the level is over
; PAD x:
x dd 20
y dd Y_SIZE-20
; PAD length:
s_x dd 40
 
; the ball stuff ;-)
b_x dd 100
b_y dd 250
v_y dd 0
v_x dd 3
 
speed_t dd 0 ; 1/10 times speedup
del dd 1 ; delay
 
coliz dd 0 ; if 1 then colizion with a brick
 
; LEVELS:
level dd 0
levels:
;LEVEL 0:
db 0,0,0,0,0,0,0,0,0,0
db 0,4,0,0,4,4,0,0,0,4
db 4,0,4,0,4,0,4,0,4,0
db 4,0,4,0,4,0,4,0,4,0
db 4,4,4,0,4,4,0,0,4,0
db 4,0,4,0,4,0,4,0,4,0
db 4,0,4,0,4,0,4,0,0,4
db 0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0
 
;LEVEL 1:
db 1,1,1,1,1,1,1,1,1,1
db 0,3,0,0,3,3,0,0,0,3
db 3,0,3,0,3,0,3,0,3,0
db 3,0,3,0,3,0,3,0,3,0
db 3,3,3,0,3,3,0,0,3,0
db 3,0,3,0,3,0,3,0,3,0
db 3,0,3,0,3,0,3,0,0,3
db 2,2,2,2,2,2,2,2,2,2
db 1,1,1,1,1,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,1
;LEVEL 2:
db 3,3,3,3,0,0,3,3,3,3
db 3,1,1,1,0,0,1,1,1,3
db 3,1,2,1,3,3,1,2,1,3
db 0,1,0,1,3,3,1,0,1,0
db 2,1,2,1,1,1,1,2,1,2
db 0,1,0,1,2,2,1,0,1,0
db 2,1,2,1,1,1,1,2,1,2
db 0,1,0,1,1,1,1,0,1,0
db 0,0,0,1,0,0,1,0,0,0
db 0,0,0,1,0,0,1,0,0,0
;LEVEL 3:
db 1,2,3,1,2,3,1,3,2,1
db 2,3,1,2,3,1,3,3,1,2
db 3,1,2,3,1,2,3,1,2,3
db 1,2,3,1,2,3,1,3,2,1
db 2,3,1,2,3,1,3,3,1,2
db 3,1,2,3,1,2,3,1,2,3
db 1,2,1,2,1,2,1,2,1,2
db 1,0,1,0,1,0,1,0,1,0
db 0,0,3,0,0,0,0,3,0,0
db 0,0,3,0,0,0,0,3,0,0
;LEVEL 4:
db 0,0,0,1,1,1,1,0,0,0
db 0,0,1,2,2,2,2,1,0,0
db 1,1,1,2,2,2,2,1,1,1
db 1,0,1,0,2,2,0,1,0,1
db 0,1,1,2,2,2,2,1,1,0
db 0,0,1,2,2,2,2,1,0,0
db 0,0,1,2,2,2,2,1,0,0
db 0,0,1,2,3,3,2,1,0,0
db 0,0,1,2,2,2,2,1,0,0
db 0,0,0,1,1,1,1,0,0,0
;LEVEL 5:
db 1,1,1,1,1,1,1,1,1,1
db 1,2,0,0,3,2,0,0,2,1
db 1,2,0,0,2,3,0,0,2,1
db 2,2,0,0,3,2,0,0,2,2
db 0,0,0,0,2,3,0,0,0,0
db 0,0,0,1,1,1,1,0,0,0
db 0,0,1,1,0,0,1,1,0,0
db 0,0,1,1,0,0,1,1,0,0
db 2,1,2,1,2,1,2,1,2,1
db 1,2,1,2,1,2,1,2,1,2
 
 
; BITMAPs and IMAGEs
bmp_file:
file 'arcanii.bmp'
 
img_bmp:
rb 40*90*3+8
img_brick1:
rb 40*20*3+8
img_brick2:
rb 40*20*3+8
img_brick3:
rb 40*20*3+8
img_brick4:
rb 40*20*3+8
img_ball:
rb 10*10*3+8
img_bonus:
rb 20*10*3+8
 
 
screen_img:
dd X_SIZE
dd Y_SIZE
screen:
rb X_SIZE*Y_SIZE*3
 
I_END:
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanii/trunk/arcanii.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/arcanii/trunk/ascgl.inc
0,0 → 1,1387
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Graphics
; Libary
;
; Ver 0.18 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 LoadImage
;0.02 SetBmp
;0.03 Bmptoimg, Setimg ~01.03.2004
;0.04 Bug deleted, copyimg ~03.05.2004
;0.05 fullimg, collimg ~05.05.2004
;0.06 getimg ~09.05.2004
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by Halyavin A., add at ~07.06.2004
;0.11 many macros optimized by Halyavin A., add at ~30.08.2004
;0.12 bmptoimg ~07.09.2004
;0.13 imgtoimg ~08.09.2004
;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004
;0.15 giftoimg, giftoani ~10.09.2004
;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004
;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004
;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004
 
aframetoimg_use_count=0
macro aframetoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aframetoimg_use_count=aframetoimg_use_count+1
if aframetoimg_use_count = 1
 
jmp end_aframetoimg_proc
 
acolor dd 0
aframetoimg_proc:
;getout coord
mov [acolor],ebp
 
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aframetoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aframetoimg_proc
}
 
frametoimg_use_count=0
macro frametoimg img, x, y, canvas
{
local loo,loo2
frametoimg_use_count=frametoimg_use_count+1
if frametoimg_use_count = 1
 
jmp end_frametoimg_proc
 
frametoimg_proc:
;getout coord
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
 
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_frametoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call frametoimg_proc
}
 
 
aimgtoimg_use_count=0
macro aimgtoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aimgtoimg_use_count=aimgtoimg_use_count+1
if aimgtoimg_use_count = 1
 
jmp end_aimgtoimg_proc
 
acolor dd 0
aimgtoimg_proc:
;getout coord
mov [acolor],ebp
 
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
 
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aimgtoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aimgtoimg_proc
}
 
 
 
 
imgtoimg_use_count=0
macro imgtoimg img, x, y, canvas
{
local loo,loo2
imgtoimg_use_count=imgtoimg_use_count+1
if imgtoimg_use_count = 1
 
jmp end_imgtoimg_proc
imgtoimg_proc:
;getout coord
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_imgtoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call imgtoimg_proc
}
 
 
;DrawBox
macro drawfbox x,y,xs,ys,color
{
words2reg ebx,x,xs ;x*65536+xs
words2reg ecx,y,ys ;y*65536+ys
mov edx,color
mov eax,13
int 0x40
}
 
; FPS - Set Frame Per Second Display
fps_show_frequency=40
macro fps x,y,color,delcolor
{
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt
local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
int 0x40
cmp eax,[savetime]
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
mov [savetime],eax
mov ebx,[fps_cntr]
mov [fps],ebx
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+36
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
int 0x40
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,6*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
mov ecx,[fps]
int 0x40
no_out_fps:
}
 
; COLLIMG - Collusion image's
_1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if _1dbounce_count = 1
_1dbounce:
cmp ebx,eax
jb anot
add eax,esi
cmp eax,ebx
jbe nbc
bc:
mov ecx,1
ret
anot:
add ebx,edi
cmp ebx,eax
ja bc
nbc:
xor ecx,ecx
ret
end if
bounce:
mov otv,1
exit:
}
 
macro rgbtobgr image
{
local loo
mov eax,[image]
mul dword [image+4]
mov ecx,eax
mov esi,image+8
; add esi,8
loo:
mov al,[esi]
mov bl,[esi+2]
mov [esi],bl
mov [esi+2],al
add esi,3
dec ecx
jnz loo
}
 
 
macro setimg x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
mov cx,[arg3]
shl ecx,16
add cx,[arg3+4]
; wordstoreg ecx,[arg3],[arg3+4]
; wordstoreg edx,x,y
words2reg edx, x , y ;arg1*65536+arg2
int 0x40
}
 
macro setframe x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
words2reg edx, x , y ;arg1*65536+arg2
add edx,dword [arg3]
mov ecx,dword [arg3+4]
int 0x40
}
 
 
macro getimg imgsrc,x,y,xs,ys,imgdest
{
local cyc
if xs eqtype 0
mov dword [imgdest],xs
else
mov eax,xs
mov dword [imgdest],eax
end if
if ys eqtype 0
mov dword [imgdest+4],ys
else
mov eax,ys
mov dword [imgdest+4],eax
end if
 
mov eax,dword [imgsrc] ;getx size
; lea ecx,[eax+2*eax]
mov ecx,eax
shl ecx,1
add ecx,eax
 
mov ebx,y
mul ebx
add eax,x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
; mov ebp,eax
; shl eax,1
; add eax,ebp
 
mov ecx,xs
mov ebx,ys
 
mov edi,8+imgdest
lea esi,[eax+8+imgsrc]
; mov esi,eax
; add esi,8
; add esi,imgsrc
 
cld
cyc:
movsw
movsb
dec ecx
jne cyc
add esi,edx
mov ecx,xs
sub esi,ecx
sub esi,ecx
sub esi,ecx
dec ebx
jne cyc
}
 
macro copyimg img2_off,img1_off
{
mov eax,dword [img1_off]
mov ebx,dword [img1_off+4]
mul ebx
lea ecx,[eax+2*eax]
lea esi,[img1_off+8]
lea edi,[img2_off+8]
cld
rep movsb
}
 
macro fullimg img_off,xs,ys,color
{
local cop
mov eax,xs
mov ebx,ys
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ebp,[eax+2*eax]
mov esi,color
if color eqtype 0
6
else
mov ecx,esi
shr ecx,16
end if
xor edi,edi
cop:
mov word [img_off+8+edi],si
add edi,2
mov byte [img_off+8+edi],cl
inc edi
cmp edi,ebp
jne cop
}
 
 
 
; number of frame in ecx
; callculatin offset of raw data
 
macro getframeoff num_of_frame,offset_of_animation,offset_of_frame
{
local loo,setpic
mov ebp,num_of_frame ;ecx
mov esi,offset_of_animation;Image
loo:
cmp ebp,0
je setpic
movzx eax,word [esi+4]
movzx ebx,word [esi+6]
mul ebx ;dword [esi+4]
mov ebx,3
mul ebx
add eax,8
add esi,eax
dec ebp
jmp loo
setpic:
mov dword offset_of_frame,esi
}
 
 
; BMPTOIMG -Convert BMP format TO IMG format
; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset
; (SAMPLE) View BMPLS.ASM sample.
; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits
 
 
bmptoimg_data_area_count=0
macro bmptoimg bmp_load_area,img_dest_area
{
local fileinfo,string,end_bmp,nodix
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
;local qwe,bmpfn
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
add eax,31
shr eax,5
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov ebp,img_dest_area+8
 
mov eax,bmp_load_area
mov ebx,eax
add ebx, [bmp_load_area+2];file size
inc ebx
mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing
 
add eax, [bmp_load_area+10]
mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
lea eax,[eax+2*eax] ;3x pixels in eax
 
mov edi,dword [bmptoimg_soi] ;initializing
mov esi,dword [bmptoimg_data_area_eop]
sub esi,dword [bmptoimg_data_area_bps]
 
 
nextstring:
push edi
push ebp
cmp word [bmp_load_area+28],24
jne convertno32
 
mov edi,ebp
mov ecx,[bmptoimg_data_area_dwps]
cld
rep movsd
 
convert1:
pop ebp
pop edi
sub esi,dword [bmptoimg_data_area_bps]
sub esi,dword [bmptoimg_data_area_bps]
cmp esi,dword [bmptoimg_data_area_sop]
jb end_bmp
add edi,eax
add ebp,eax
jmp nextstring
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bmptoimg_data_area_bps]
mov dword [bmptoimg_data_area_eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
 
convert2:
pop eax
inc esi
cmp esi,dword [bmptoimg_data_area_eos]
jae convert1
add edi,3
 
add ebp,3
 
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
 
add ebp,3
 
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
js convert2
add edi,3
 
add ebp,3
 
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
; mov dword [edi],edx
mov [ebp],edx
ret
 
bmptoimg_data_area_count=bmptoimg_data_area_count+1
if bmptoimg_data_area_count = 1
; DATA AREA
bmptoimg_soi dd 0
bmptoimg_data_area_bps dd 0
bmptoimg_data_area_dwps dd 0
bmptoimg_data_area_sop dd 0
bmptoimg_data_area_eop dd 0
bmptoimg_data_area_eos dd 0
end if
 
end_bmp:
mov eax,dword [bmp_load_area+18]
mov ebx,dword [bmp_load_area+22]
mov dword [img_dest_area],eax
mov dword [img_dest_area+4],ebx
}
 
; For convert RGB to BGR
COLOR_ORDER equ MENUETOS
 
macro giftoani gifsrc,imgsrc,num_of_frames
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
; jmp sss
; if defined gif_hash_offset
; else
; hasharea:
; times 4096 dd 0 ;4096
; end if
;sss:
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
push ecx
pop dword num_of_frames
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
movsd
movsd
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
cmp byte[edi],0x3b ;read next frame
jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
 
 
macro giftoimg gifsrc,imgsrc
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
; movsd
; movsd
 
mov bp,word[esi+4]
movzx ebx,bp
mov [edi],ebx
 
mov bp,word[esi+6]
movzx ebx,bp
mov [edi+4],ebx
 
add edi,8
add esi,8
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
; cmp byte[edi],0x3b ;read next frame
; jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanii/trunk/ascl.inc
0,0 → 1,906
lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.14 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;Please compile aplications on FASM ver1.54 or higer!!!
 
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
;0.10 wordstoreg by halyavin, add at ~30.08.2004
; random bug deleted eax is use.
;0.11 loadfile from me +puttxt bug del ~07.09.2004
;0.12 open/save dialog ~13.09.2004
;0.13 dialogs bugs deleted
;0.14 drawlbut ~03.10.2004
;0.15 extendet label!
 
; LOADFILE
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area
 
 
macro loadfile file_name,file_load_area,file_temp_area
{
local open,fileinfo,string
jmp open
fileinfo:
dd 0
dd 0
dd 1
dd file_load_area
dd file_temp_area
string:
db file_name,0
open:
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[file_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
}
 
 
;macro wordstoreg reg,hiword,loword
;{
;if hiword eqtype 0 & loword eqtype 0
; mov reg,dword hiword*65536+loword
;else if hiword eqtype 12 & loword eqtype eax
; mov reg,dword hiword*65536
; add reg,dword loword
;else if hiword eqtype 12 & loword eqtype [123]
; mov reg,dword hiword*65536
; add reg,dword loword
;else
; mov reg,dword hiword
; shl reg,16
; add reg,dword loword
;end if
;}
 
macro dword2reg reg,doubleword
{
if doubleword eq
; not changes
else
mov reg,dword doubleword
end if
}
 
macro words2reg reg,hiword,lowword
{
if hiword eq
if lowword eq
; not changes
else
if lowword eqtype 12
and reg,dword 0xffff0000
add reg,dword lowword
else
and reg,dword 0xffff0000
add reg,dword lowword
end if
end if
else
if lowword eq
if hiword eqtype 12
and reg,dword 0x0000ffff
add reg,dword hiword*65536
else
shl reg,16
add reg,dword hiword
ror reg,16
end if
else
if lowword eqtype 12 & hiword eqtype 12
if lowword eq 0 & hiword eq 0
xor reg,reg
else
mov reg,dword hiword*65536+lowword
end if
else
mov reg,dword hiword
shl reg,16
add reg,dword lowword
end if
end if
end if
}
 
 
 
 
; DRAW BUTTON with label
 
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
{
local asd,lab
jmp asd
lab db text ;arg label
asd:
words2reg ebx,x,xs
words2reg ecx,y,ys
mov edx,id
mov esi,bcolor
mov eax,8
int 0x40
 
mov eax,asd-lab ;calc size
mov ebx,6
mul ebx
mov esi,eax
 
mov eax,xs
sub eax,esi
shr eax,1
add eax,x
 
mov edx,ys
sub edx,7
shr edx,1
add edx,y
 
mov ebx,eax
shl ebx,16
add ebx,edx
 
mov ecx,tcolor ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
 
macro opendialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
 
procinfo:
times 1024 db 0
}
 
 
macro savedialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, run_filepath, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo
;run_filepath:
db '/RD/1/SYSXTREE',0
 
procinfo:
times 1024 db 0
}
 
 
 
 
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
 
randomuse = 0
 
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
 
jmp rxproc
 
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
and eax,0000ffffh
; mov arg2,0
; mov arg2,eax
ret
end if
 
rxproc:
mov eax,arg1
call randomproc
mov arg2,eax
}
 
macro scank
{
mov eax,10
int 0x40
}
 
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
 
macro bar x,y,sizex,sizey,color
{
words2reg ebx,x,sizex
words2reg ecx,y,sizey
dword2reg edx,color
mov eax,13
int 0x40
 
}
 
macro puttxt x,y,offs,size,color
{
; mov ebx,x
; shl ebx,16
; add ebx,y
words2reg ebx,x,y
 
dword2reg ecx,color
dword2reg edx,offs
dword2reg esi,size
 
; mov ecx,color
; mov edx,offs
mov esi,size
mov eax,4
int 0x40
}
 
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
; mov edx,x*65536+y
words2reg edx,x,y
mov esi,color
mov eax,47
int 0x40
}
 
; SCEVENT - Scan event
 
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; WTEVENT - Wait event
 
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; TIMEEVENT - Wite for event with timeout
 
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
 
; CLOSE - Close program
 
macro close
{
mov eax,-1
int 0x40
}
 
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
 
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
 
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
 
macro window arg1,arg2,arg3,arg4,arg5
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
words2reg ebx,arg1,arg3
words2reg ecx,arg2,arg4
mov edx,arg5
mov eax,0
int 0x40
}
 
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
 
 
; STARTWD - Start of window draw
 
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
 
; ENDWD - End window draw
 
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
 
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
 
macro label arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
; mov ebx,arg1 ;arg1=y arg2=x
; shl ebx,16
; add ebx,arg2
 
words2reg ebx,arg1,arg2
 
dword2reg ecx,arg4
 
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
 
;Attributes
 
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
 
;Font Attributes
font_Big equ 0x10000000
 
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040f
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanii/trunk/asjc.inc
0,0 → 1,115
;-------------------------
;
; ASM JJ's 2 C macros ;-)
;
; version history:
;
; *0.01(02/08/05): if_e, if_ne, if_a, if_b
; *0.02(02/09/05): push_abc, pop_abc
; ch_sign, abs
;
; E.X.: if_e dword [x],100,.end_if
; if x = 100 do the instrucsions to .end_if:
; ==
macro if_e arg1,arg2,label
{
if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12
cmp arg1,arg2
jne label
else
push edx
mov edx,arg1
cmp edx,arg2
pop edx
jne label
end if
}
 
; !=
macro if_ne arg1,arg2,label
{
if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12
cmp arg1,arg2
je label
else
push edx
mov edx,arg1
cmp edx,arg2
pop edx
je label
end if
}
 
; >
macro if_a arg1,arg2,label
{
if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12
cmp arg1,arg2
jbe label
else
push edx
mov edx,arg1
cmp edx,arg2
pop edx
jbe label
end if
}
 
; <
macro if_b arg1,arg2,label
{
if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12
cmp arg1,arg2
jae label
else
push edx
mov edx,arg1
cmp edx,arg2
pop edx
jae label
end if
}
 
macro push_abc
{
push eax
push ebx
push ecx
push edx
push edi
push esi
}
 
macro pop_abc
{
pop esi
pop edi
pop edx
pop ecx
pop ebx
pop eax
}
 
UNDER_0 equ 0x7FFFFFFF
; changes sign e.x. ch_sign -1 = 1
macro ch_sign arg
{
push edx
mov edx,0
sub edx,arg
pop edx
}
 
; absolut e.x. abs -24 = 24
macro abs arg
{
local .end_if
if_a arg,UNDER_0,.end_if
ch_sign arg
.end_if:
}
;---------------------------------------
 
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanii/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm arcanii.asm arcanii
@pause
/programs/games/arcanii/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm arcanii.asm arcanii
@pause
/programs/games/arcanoid/trunk/ARC.BMP
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/arcanoid/trunk/arcanoid.asm
0,0 → 1,561
;
; Arcanoid Gaem 4Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru www.cyberdeck.fatal.ru www.deck4.narod.ru
; Play again and exit button added
;
; 3Ver Play again, Exit button.
; 4Ver Next level function.
;
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd 0x300000 ; memory for app
dd 0x300000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
include 'ascgml.inc'
 
 
START: ; start of execution
bmptoimg arc_file,pong
getimg pong,0,0,80,4,img
getimg pong,0,4,80,4,img2
getimg pong,5,38,15,15,img3
getimg pong,0,8,80,20,img5
fullimg img4 , 80 ,20 ,0x00000000 ;black for rocket
fullimg img6 , 15 ,15 ,0x00000000 ;black for ball
fullimg img7a , 60,20,0x0000cf00
fullimg img7b , 60,20,0x00af0000
fullimg img7c , 60,20,0x000000cf
fullimg img8 , 60,20,0x00000000
 
call draw_window
 
still:
 
scevent red,key,button
 
cmp [againbut],1
je stl2
 
outcount dword [scoreb],256,8,cl_Blue,5*65536
outcount dword [scorea],332,8,cl_Red,5*65536
outcount dword [level],368,8,cl_White,2*65536
 
del_images:
setimg dword [ply1x],dword [ply1y],img4
setimg dword [ballx],dword [bally],img6
setimg dword [gravx],dword [gravy],img4
 
del_blocks:
mov ecx,0
xxx:
pushad
mov esi,dword [mass+ecx]
mov edi,dword [mass+ecx+4]
mov ebp,dword [mass+ecx+8]
cmp ebp,0
jne notptx
setimg esi,edi,img8
notptx:
popad
add ecx,12
cmp ecx,[blocks_max]
jne xxx
 
 
 
move_ply1:
 
correct [ply1x],[ply1rx],2
correct [ply1y],[ply1ry],2
 
;automove ball
mov eax,dword [ballxv]
add dword [ballx],eax
mov eax,dword [ballyv]
add dword [bally],eax
 
;autoslow ball for rocket gravitation (Space key)
cmp dword [ballxv],0
jl ballb
balla:
cmp dword [ballxv],2
jng balln
dec dword [ballxv]
jmp balln
ballb:
cmp dword [ballxv],-2
jnl balln
inc dword [ballxv]
jmp balln
balln:
cmp dword [ballyv],2
jng by_n
dec dword [ballyv]
by_n:
 
;ball collusion of screen
cmp dword [ballx],400-12
jna xa_ok
neg dword [ballxv]
xa_ok:
cmp dword [ballx],6
jnb xb_ok
neg dword [ballxv]
xb_ok:
 
cmp dword [bally],30
jnb yb_ok
neg dword [ballyv]
yb_ok:
 
 
;if ball far out of screen come back
cmp dword [bally],466
jng yax_ok
call draw_window
dec dword [scoreb]
mov eax,[ply1ry]
sub eax,6
mov dword [bally],eax ;240
mov eax,[ply1rx]
add eax,30
mov dword [ballx],eax ;200
mov dword [ballyv],2
random 3,dword [ballxv]
sub dword [ballxv],1
yax_ok:
 
xorx:
cmp dword [ballxv],0
jne norx
random 3,dword [ballxv]
sub dword [ballxv],1
cmp dword [ballxv],0
je xorx
norx:
 
;test on collusion ply1 of ball
collusion_test:
collimg img,[ply1x],[ply1y],img3,[ballx],[bally],eax
cmp eax,1
jne not_coll
neg dword [ballyv]
sub dword [bally],4
; neg dword [ballxv]
not_coll:
 
;test on collusion gravity of ball
collusion_grav:
collimg img,[gravx],[gravy],img3,[ballx],[bally],eax
cmp eax,1
jne not_collg
sub dword [bally],30
neg dword [ballyv]
cmp dword [ballyv],0
jl ab
jg bf
jmp not_collgx
ab:
sub dword [ballyv],10
jmp not_collgx
bf:
add dword [ballyv],10
not_collgx:
cmp dword [ballxv],0
jl abx
jg bfx
jmp not_collg
abx:
sub dword [ballxv],0 ;8 ;15
jmp not_collg
bfx:
add dword [ballxv],0 ;8
 
 
; mov dword [ballyv],20
not_collg:
 
;ply contorl
control 12,316,[ply1rx]
control 380,470,[ply1ry]
 
;garvity
gravity:
cmp dword [gravtime],0
je no_dg
dec dword [gravtime]
no_dg:
 
draw_gravity:
cmp dword [gravtime],0
je nograv
mov eax,dword [ply1x]
mov ebx,dword [ply1y]
sub ebx,30
mov dword [gravx],eax
mov dword [gravy],ebx
jmp endgrav
nograv:
mov dword [gravx],1000
mov dword [gravy],1000
endgrav:
 
redraw_images:
setimg dword [ply1x],dword [ply1y],img2
setimg dword [ballx],dword [bally],img3
setimg dword [gravx],dword [gravy],img5
 
draw_blocks:
mov ecx,0
xxx2:
pushad
mov esi,dword [mass+ecx]
mov edi,dword [mass+ecx+4]
mov ebp,dword [mass+ecx+8]
cmp ebp,0
je notpt
cmp ebp,1
jne no_a
setimg esi,edi,img7a
jmp notpt
no_a:
cmp ebp,2
jne no_b
setimg esi,edi,img7b
jmp notpt
no_b:
cmp ebp,3
jne no_c
setimg esi,edi,img7c
jmp notpt
no_c:
 
notpt:
popad
add ecx,12
cmp ecx,[blocks_max]
jne xxx2
 
;collusion ball of blocks
coll_blocks:
mov [temp3],0
mov ecx,0
testloop:
pushad
mov ebp,dword [mass+ecx+8]
cmp ebp,0
jne testcol
jmp notest
testcol:
mov [temp3],1
mov esi,dword [mass+ecx]
mov edi,dword [mass+ecx+4]
mov [temp1],esi
mov [temp2],edi
push ecx
collimg img8,[temp1],[temp2],img3,[ballx],[bally],eax
pop ecx
cmp eax,1
jne notest
mov dword [mass+ecx+8],0
; neg [ballxv]
neg [ballyv]
add [scorea],30
call draw_window
jmp end_col
notest:
popad
add ecx,12
cmp ecx,[blocks_max]
jne testloop
end_col:
 
cmp [delay_cnt],0
jne no_delay
mov [delay_cnt],1
delay 1 ;don't generate delay for fast speed programm
no_delay:
dec [delay_cnt]
 
win_test:
cmp [temp3],1
je stl
; inc [level]
mov [nextlev],1
mov [againbut],1
call draw_window
; label 160,200,'You Win!',cl_Green+font_Big
; label 130,220,'Youre Score:',cl_Green+font_Big
; outcount dword [scorea],230,220,cl_Green,5*65536
; label 130,234,'Youre Lives:',cl_Green+font_Big
; outcount dword [scoreb],230,234,cl_Green,5*65536
; delay 600 ;wait 2sec
; close ;exit from program
stl:
 
lose_test:
cmp [scoreb],0
jne stl2
; call draw_window
; label 160,200,'You Lose!',cl_Red+font_Big
; label 130,220,'Youre Score:',cl_Red+font_Big
; outcount dword [scorea],230,220,cl_Red,5*65536
; delay 300 ;wait 2sec
; close ;exit from program
; mov ebx,10*65536+40
; mov ebx,10*65536+20
; mov edx,2
; mov esi,0x0000ff00
; mov eax,8
; int 0x40
mov [level],0
mov [nextlev],0
mov [againbut],1
call draw_window
 
stl2:
 
jmp still
 
red:
call draw_window
jmp still
 
key: ; key
mov eax,2
int 0x40
cmp ah,key_Left
jne no_l
sub dword [ply1rx],50 ;24 ;16
no_l:
cmp ah,key_Right
jne no_r
add dword [ply1rx],50 ;24 ;16
no_r:
cmp ah,key_Up
jne no_u
sub dword [ply1ry],20
no_u:
cmp ah,key_Down
jne no_d
add dword [ply1ry],20
no_d:
cmp ah,key_Space
jne no_sp
mov dword [gravtime],100
no_sp:
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
cmp ah,2
jne noplayagain
mov [xt],100
mov [yt],100
mov [gravtime],10
mov [gravx],1000
mov [gravy],1000
mov [ply1rx],160
mov [ply1ry],460
mov [ply1x],160
mov [ply1y],400
mov [ballx],200
mov [bally],300
mov [ballyv],2
mov [ballxv],1
 
cmp [nextlev],1
je noch
mov [scorex],0
mov [scorea],0
mov [scoreb],3
jmp noch2
noch:
inc [scoreb]
inc [level]
mov eax,[maxlev]
cmp [level],eax
jna noch2
mov [level],eax
noch2:
 
mov eax,18*4*5
mul [level]
mov ebp,eax
add ebp,levels
mov ecx,18*4*5 ;bytes
loo:
mov eax,dword [ebp+ecx]
mov dword [mass+ecx],eax
sub ecx,4
jnz loo
 
mov [againbut],0
 
call draw_window
noplayagain:
jmp still
 
 
draw_window:
startwd
window 0,0,400+8,480+24,window_Skinned
label 12,8,'ARCANOID: USE ARROW KEYS LIVES SCORE',cl_White+font_Big
 
cmp [againbut],0
je no_againbut
 
cmp [nextlev],1
je nlev
label 160,200,'You Lose!',cl_Red+font_Big
label 130,220,'Youre Score:',cl_Red+font_Big
outcount dword [scorea],230,220,cl_Red,5*65536
mov ebx,150*65536+80
mov ecx,240*65536+12
mov edx,2
mov esi,0x0000aa00
mov eax,8
int 0x40
mov ecx,260*65536+12
mov edx,1
int 0x40
label 152,244,'Play again?',cl_Red+font_Big
jmp elev
nlev:
label 160,200,'You Win!',cl_Green+font_Big
label 130,220,'Youre Score:',cl_Green+font_Big
outcount dword [scorea],230,220,cl_Green,5*65536
mov ebx,150*65536+80
mov ecx,240*65536+12
mov edx,2
mov esi,0x0000aa00
mov eax,8
int 0x40
mov ecx,260*65536+12
mov edx,1
int 0x40
label 152,244,'Next level?',cl_Red+font_Big
elev:
 
label 178,264,'Exit?',cl_Red+font_Big
no_againbut:
 
endwd
ret
 
 
; DATA AREA
againbut dd 0
 
xt dd 100
yt dd 100
 
gravtime dd 10
gravx dd 1000
gravy dd 1000
 
ply1rx dd 160
ply1ry dd 460
 
ply1x dd 160
ply1y dd 400
 
ballx dd 200
bally dd 300
 
ballyv dd 2
ballxv dd 1
 
temp1 dd 0
temp2 dd 0
temp3 dd 0
 
scorex dd 0
scorea dd 0
scoreb dd 3
 
level dd 0
nextlev dd 0
maxlev dd 2
 
counter dd 0
tsoi dd 0
 
delay_cnt dd 0
 
blocks_max dd 6*5*12 ;size in bytes 5*3 dd
 
mass:
dd 30,200,0 ,90,200,0 ,150,200,0 ,210,200,0 ,270,200,0 ,330,200,0
dd 30,180,0 ,90,180,0 ,150,180,0 ,210,180,0 ,270,180,0 ,330,180,0
dd 30,160,0 ,90,160,0 ,150,160,0 ,210,160,0 ,270,160,0 ,330,160,0
dd 30,140,0 ,90,140,1 ,150,140,1 ,210,140,1 ,270,140,0 ,330,140,0
dd 30,120,0 ,90,120,0 ,150,120,0 ,210,120,0 ,270,120,0 ,330,120,0
 
levels:
dd 30,200,0 ,90,200,0 ,150,200,0 ,210,200,2 ,270,200,0 ,330,200,0
dd 30,180,2 ,90,180,1 ,150,180,1 ,210,180,2 ,270,180,2 ,330,180,0
dd 30,160,1 ,90,160,3 ,150,160,1 ,210,160,2 ,270,160,2 ,330,160,2
dd 30,140,2 ,90,140,1 ,150,140,1 ,210,140,2 ,270,140,2 ,330,140,0
dd 30,120,0 ,90,120,0 ,150,120,0 ,210,120,2 ,270,120,0 ,330,120,0
;level2
dd 30,200,0 ,90,200,3 ,150,200,0 ,210,200,2 ,270,200,2 ,330,200,2
dd 30,180,0 ,90,180,1 ,150,180,0 ,210,180,2 ,270,180,2 ,330,180,2
dd 30,160,0 ,90,160,3 ,150,160,0 ,210,160,2 ,270,160,2 ,330,160,2
dd 30,140,0 ,90,140,1 ,150,140,0 ,210,140,2 ,270,140,2 ,330,140,2
dd 30,120,0 ,90,120,3 ,150,120,0 ,210,120,2 ,270,120,2 ,330,120,2
;level3
dd 30,200,1 ,90,200,3 ,150,200,1 ,210,200,2 ,270,200,2 ,330,200,2
dd 30,180,2 ,90,180,1 ,150,180,1 ,210,180,2 ,270,180,2 ,330,180,2
dd 30,160,1 ,90,160,3 ,150,160,1 ,210,160,2 ,270,160,2 ,330,160,2
dd 30,140,2 ,90,140,1 ,150,140,1 ,210,140,2 ,270,140,2 ,330,140,2
dd 30,120,1 ,90,120,3 ,150,120,1 ,210,120,2 ,270,120,2 ,330,120,2
 
arc_file:
file 'arc.bmp'
 
rb 20000
 
IM_END:
 
pong:
rb 80*60*3+8
img:
rb 32*32*3+8
img2:
rb 32*32*3+8
img3:
rb 32*32*3+8
img4:
rb 80*20*3+8
img5:
rb 80*20*3+8
img6:
rb 15*15*3+8
img7a:
rb 60*20*3+8
img7b:
rb 60*20*3+8
img7c:
rb 60*20*3+8
img8:
rb 60*40*3+8
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanoid/trunk/ascgl.inc
0,0 → 1,1385
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Graphics
; Libary
;
; Ver 0.18 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 LoadImage
;0.02 SetBmp
;0.03 Bmptoimg, Setimg ~01.03.2004
;0.04 Bug deleted, copyimg ~03.05.2004
;0.05 fullimg, collimg ~05.05.2004
;0.06 getimg ~09.05.2004
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by halyavin, add at ~07.06.2004
;0.11 many macros optimized by halyavin, add at ~30.08.2004
;0.12 bmptoimg ~07.09.2004
;0.13 imgtoimg ~08.09.2004
;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004
;0.15 giftoimg, giftoani ~10.09.2004
;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004
;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004
;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004
 
aframetoimg_use_count=0
macro aframetoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aframetoimg_use_count=aframetoimg_use_count+1
if aframetoimg_use_count = 1
 
jmp end_aframetoimg_proc
 
acolor dd 0
aframetoimg_proc:
;getout coord
mov [acolor],ebp
 
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aframetoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aframetoimg_proc
}
 
frametoimg_use_count=0
macro frametoimg img, x, y, canvas
{
local loo,loo2
frametoimg_use_count=frametoimg_use_count+1
if frametoimg_use_count = 1
 
jmp end_frametoimg_proc
 
frametoimg_proc:
;getout coord
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
 
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_frametoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call frametoimg_proc
}
 
 
aimgtoimg_use_count=0
macro aimgtoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aimgtoimg_use_count=aimgtoimg_use_count+1
if aimgtoimg_use_count = 1
 
jmp end_aimgtoimg_proc
 
acolor dd 0
aimgtoimg_proc:
;getout coord
mov [acolor],ebp
 
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
 
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aimgtoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aimgtoimg_proc
}
 
 
 
 
imgtoimg_use_count=0
macro imgtoimg img, x, y, canvas
{
local loo,loo2
imgtoimg_use_count=imgtoimg_use_count+1
if imgtoimg_use_count = 1
 
jmp end_imgtoimg_proc
imgtoimg_proc:
;getout coord
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_imgtoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call imgtoimg_proc
}
 
 
;DrawBox
macro drawfbox x,y,xs,ys,color
{
wordstoreg ebx,x,xs ;x*65536+xs
wordstoreg ecx,y,ys ;y*65536+ys
mov edx,color
mov eax,13
int 0x40
}
 
; FPS - Set Frame Per Second Display
fps_show_frequency=40
macro fps x,y,color,delcolor
{
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt
local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
int 0x40
cmp eax,[savetime]
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
mov [savetime],eax
mov ebx,[fps_cntr]
mov [fps],ebx
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+30
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
int 0x40
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,5*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
mov ecx,[fps]
int 0x40
no_out_fps:
}
 
; COLLIMG - Collusion image's
_1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if _1dbounce_count = 1
_1dbounce:
cmp ebx,eax
jb anot
add eax,esi
cmp eax,ebx
jbe nbc
bc:
mov ecx,1
ret
anot:
add ebx,edi
cmp ebx,eax
ja bc
nbc:
xor ecx,ecx
ret
end if
bounce:
mov otv,1
exit:
}
 
macro rgbtobgr image
{
local loo
mov eax,[image]
mul dword [image+4]
mov ecx,eax
mov esi,image+8
; add esi,8
loo:
mov al,[esi]
mov bl,[esi+2]
mov [esi],bl
mov [esi+2],al
add esi,3
dec ecx
jnz loo
}
 
 
macro setimg x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
mov cx,[arg3]
shl ecx,16
add cx,[arg3+4]
; wordstoreg ecx,[arg3],[arg3+4]
wordstoreg edx, x , y ;arg1*65536+arg2
int 0x40
}
 
macro setframe x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
wordstoreg edx, x , y ;arg1*65536+arg2
add edx,dword [arg3]
mov ecx,dword [arg3+4]
int 0x40
}
 
 
macro getimg imgsrc,x,y,xs,ys,imgdest
{
local cyc
if xs eqtype 0
mov dword [imgdest],xs
else
mov eax,xs
mov dword [imgdest],eax
end if
if ys eqtype 0
mov dword [imgdest+4],ys
else
mov eax,ys
mov dword [imgdest+4],eax
end if
 
mov eax,dword [imgsrc] ;getx size
; lea ecx,[eax+2*eax]
mov ecx,eax
shl ecx,1
add ecx,eax
 
mov ebx,y
mul ebx
add eax,x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
; mov ebp,eax
; shl eax,1
; add eax,ebp
 
mov ecx,xs
mov ebx,ys
 
mov edi,8+imgdest
lea esi,[eax+8+imgsrc]
; mov esi,eax
; add esi,8
; add esi,imgsrc
 
cld
cyc:
movsw
movsb
dec ecx
jne cyc
add esi,edx
mov ecx,xs
sub esi,ecx
sub esi,ecx
sub esi,ecx
dec ebx
jne cyc
}
 
macro copyimg img2_off,img1_off
{
mov eax,dword [img1_off]
mov ebx,dword [img1_off+4]
mul ebx
lea ecx,[eax+2*eax]
lea esi,[img1_off+8]
lea edi,[img2_off+8]
cld
rep movsb
}
 
macro fullimg img_off,xs,ys,color
{
local cop
mov eax,xs
mov ebx,ys
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ebp,[eax+2*eax]
mov esi,color
if color eqtype 0
mov ecx,color/65536
else
mov ecx,esi
shr ecx,16
end if
xor edi,edi
cop:
mov word [img_off+8+edi],si
add edi,2
mov byte [img_off+8+edi],cl
inc edi
cmp edi,ebp
jne cop
}
 
 
 
; number of frame in ecx
; callculatin offset of raw data
 
macro getframeoff num_of_frame,offset_of_animation,offset_of_frame
{
local loo,setpic
mov ebp,num_of_frame ;ecx
mov esi,offset_of_animation;Image
loo:
cmp ebp,0
je setpic
movzx eax,word [esi+4]
movzx ebx,word [esi+6]
mul ebx ;dword [esi+4]
mov ebx,3
mul ebx
add eax,8
add esi,eax
dec ebp
jmp loo
setpic:
mov dword offset_of_frame,esi
}
 
 
; BMPTOIMG -Convert BMP format TO IMG format
; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset
; (SAMPLE) View BMPLS.ASM sample.
; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits
 
 
bmptoimg_data_area_count=0
macro bmptoimg bmp_load_area,img_dest_area
{
local fileinfo,string,end_bmp,nodix
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
;local qwe,bmpfn
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
add eax,31
shr eax,5
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov ebp,img_dest_area+8
 
mov eax,bmp_load_area
mov ebx,eax
add ebx, [bmp_load_area+2];file size
inc ebx
mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing
 
add eax, [bmp_load_area+10]
mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
lea eax,[eax+2*eax] ;3x pixels in eax
 
mov edi,dword [bmptoimg_soi] ;initializing
mov esi,dword [bmptoimg_data_area_eop]
sub esi,dword [bmptoimg_data_area_bps]
 
 
nextstring:
push edi
push ebp
cmp word [bmp_load_area+28],24
jne convertno32
 
mov edi,ebp
mov ecx,[bmptoimg_data_area_dwps]
cld
rep movsd
 
convert1:
pop ebp
pop edi
sub esi,dword [bmptoimg_data_area_bps]
sub esi,dword [bmptoimg_data_area_bps]
cmp esi,dword [bmptoimg_data_area_sop]
jb end_bmp
add edi,eax
add ebp,eax
jmp nextstring
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bmptoimg_data_area_bps]
mov dword [bmptoimg_data_area_eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
 
convert2:
pop eax
inc esi
cmp esi,dword [bmptoimg_data_area_eos]
jae convert1
add edi,3
 
add ebp,3
 
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
 
add ebp,3
 
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
js convert2
add edi,3
 
add ebp,3
 
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
; mov dword [edi],edx
mov [ebp],edx
ret
 
bmptoimg_data_area_count=bmptoimg_data_area_count+1
if bmptoimg_data_area_count = 1
; DATA AREA
bmptoimg_soi dd 0
bmptoimg_data_area_bps dd 0
bmptoimg_data_area_dwps dd 0
bmptoimg_data_area_sop dd 0
bmptoimg_data_area_eop dd 0
bmptoimg_data_area_eos dd 0
end if
 
end_bmp:
mov eax,dword [bmp_load_area+18]
mov ebx,dword [bmp_load_area+22]
mov dword [img_dest_area],eax
mov dword [img_dest_area+4],ebx
}
 
; For convert RGB to BGR
COLOR_ORDER equ MENUETOS
 
macro giftoani gifsrc,imgsrc,num_of_frames
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
; jmp sss
; if defined gif_hash_offset
; else
; hasharea:
; times 4096 dd 0 ;4096
; end if
;sss:
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
push ecx
pop dword num_of_frames
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
movsd
movsd
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
cmp byte[edi],0x3b ;read next frame
jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
 
 
macro giftoimg gifsrc,imgsrc
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
; movsd
; movsd
 
mov bp,word[esi+4]
movzx ebx,bp
mov [edi],ebx
 
mov bp,word[esi+6]
movzx ebx,bp
mov [edi+4],ebx
 
add edi,8
add esi,8
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
; cmp byte[edi],0x3b ;read next frame
; jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanoid/trunk/ascgml.inc
0,0 → 1,49
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; GaMe
; Libary
;
; Ver 0.03 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 correct
;0.02 control ~14.05.2004
;0.03 all macros optimized by halyavin, add at ~07.06.2004
 
 
; corectiryemoe,corectnoe,step
macro correct arg1,arg2,arg3
{
local plus,minus,equal
mov eax,arg2
cmp arg1,eax
je equal
mov eax,arg3
ja minus
plus:
add arg1,eax
jmp equal
minus:
sub arg1,eax
equal:
}
 
macro control min,max,arg
{
local gr,low,norm
mov eax,max
cmp arg,eax
jg gr
mov eax,min
cmp arg,eax
jnl norm
gr:
low:
mov arg,eax
norm:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanoid/trunk/ascl.inc
0,0 → 1,835
lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.14 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;Please compile aplications on FASM ver1.54 or higer!!!
 
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
;0.10 wordstoreg by halyavin, add at ~30.08.2004
; random bug deleted eax is use.
;0.11 loadfile from me +puttxt bug del ~07.09.2004
;0.12 open/save dialog ~13.09.2004
;0.13 dialogs bugs deleted
;0.14 drawlbut ~03.10.2004
 
; LOADFILE
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area
 
macro loadfile file_name,file_load_area,file_temp_area
{
local open,fileinfo,string
jmp open
fileinfo:
dd 0
dd 0
dd 1
dd file_load_area
dd file_temp_area
string:
db file_name,0
open:
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[file_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
}
 
 
macro wordstoreg reg,hiword,loword
{
if hiword eqtype 0 & loword eqtype 0
mov reg,hiword*65536+loword
else if hiword eqtype 12 & loword eqtype eax
mov reg,hiword*65536
add reg,loword
else if hiword eqtype 12 & loword eqtype [123]
mov reg,hiword*65536
add reg,loword
else
mov reg,hiword
shl reg,16
add reg,loword
end if
}
 
 
; DRAW BUTTON with label
 
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
{
local asd,lab
jmp asd
lab db text ;arg label
asd:
wordstoreg ebx,x,xs
wordstoreg ecx,y,ys
mov edx,id
mov esi,bcolor
mov eax,8
int 0x40
 
mov eax,asd-lab ;calc size
mov ebx,6
mul ebx
mov esi,eax
 
mov eax,xs
sub eax,esi
shr eax,1
add eax,x
 
mov edx,ys
sub edx,7
shr edx,1
add edx,y
 
mov ebx,eax
shl ebx,16
add ebx,edx
 
mov ecx,tcolor ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
 
macro opendialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
 
procinfo:
times 256 db 0
}
 
 
macro savedialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, run_filepath, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,120 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
rb 4 ; My dec PID
rb 6 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo
run_filepath:
db '/RD/1/SYSXTREE',0
 
procinfo:
times 256 db 0
}
 
 
 
 
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
 
randomuse = 0
 
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
 
jmp rxproc
 
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
and eax,0000ffffh
; mov arg2,0
; mov arg2,eax
ret
end if
 
rxproc:
mov eax,arg1
call randomproc
mov arg2,eax
}
 
macro scank
{
mov eax,10
int 0x40
}
 
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
 
macro puttxt x,y,offs,size,color
{
; mov ebx,x
; shl ebx,16
; add ebx,y
wordstoreg ebx,x,y
mov ecx,color
mov edx,offs
mov esi,size
mov eax,4
int 0x40
}
 
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
; mov edx,x*65536+y
wordstoreg edx,x,y
mov esi,color
mov eax,47
int 0x40
}
 
; SCEVENT - Scan event
 
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; WTEVENT - Wait event
 
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; TIMEEVENT - Wite for event with timeout
 
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
 
; CLOSE - Close program
 
macro close
{
mov eax,-1
int 0x40
}
 
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
 
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
 
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
 
macro window arg1,arg2,arg3,arg4,arg5
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
wordstoreg ebx,arg1,arg3
wordstoreg ecx,arg2,arg4
mov edx,arg5
mov eax,0
int 0x40
}
 
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
 
 
; STARTWD - Start of window draw
 
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
 
; ENDWD - End window draw
 
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
 
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
 
macro label arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
; mov ebx,arg1 ;arg1=y arg2=x
; shl ebx,16
; add ebx,arg2
wordstoreg ebx,arg1,arg2
mov ecx,arg4 ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
 
;Attributes
 
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
 
;Font Attributes
font_Big equ 0x10000000
 
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040ff
cl_Cyan equ 0x0040e0ff
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/arcanoid/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm arcanoid.asm arcanoid
@pause
/programs/games/arcanoid/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm arcanoid.asm arcanoid
@pause
/programs/games/c4/trunk/Readme.txt
0,0 → 1,27
C4 0.1
Copyright (C) 2002 Thomas Mathys
killer@vantage.ch
 
 
What's this ?
-------------
 
C4 is a connect four clone for MenuetOS
(http://www.menuetos.org).
 
 
Installation
------------
 
Simply copy the executable (C4) onto your MenuetOS floppy.
You don't need to copy anything else, the image files are
linked into the executable.
 
If you want to compile C4 yourself you need NASM.
Get it from http://nasm.sourceforge.net.
 
Compile C4 using the following command:
 
nasm -f bin -o c4 c4.asm
(nasmw if you have the win32 version)
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/ai.inc
0,0 → 1,270
; C4
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This file is part of C4.
;
; C4 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; C4 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with C4; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%ifndef _AI_INC
%define _AI_INC
 
 
INFTY equ 1000000000
 
 
 
section .data
 
; table used to perform some primitive move "ordering":
; middle columns which are usually more important are
; searched first.
moveorder dd 1,7,2,6,3,5,4
 
; table used for static evaluation.
; this table is taken from 4st attack: it is ways better
; than the table i used before =)
evaltable: dd 0, 0, 0, 0, 0, 0, 0, 0, 0
dd 0, 3, 4, 5, 7, 5, 4, 3, 0
dd 0, 4, 6, 8,10, 8, 6, 4, 0
dd 0, 5, 8,12,13,12, 8, 5, 0
dd 0, 5, 8,12,13,12, 8, 5, 0
dd 0, 4, 6, 8,10, 8, 6, 4, 0
dd 0, 3, 4, 5, 7, 5, 4, 3, 0
dd 0, 0, 0, 0, 0, 0, 0, 0, 0
 
 
 
section .bss
 
cpulevel resd 1 ; level of current cpu player
bestval resd 1 ; value of best move found so far
nbestmoves resd 1 ; # of best moves found so far
bestmoves resd 7 ; array to hold all best moves
 
 
 
section .text
 
 
 
;**********************************************************
; aiGetMove
; returns a move for a computer player
;
; input : eax = cpu level ( >= 1)
; output : eax = move
; destroys : everything
;**********************************************************
aiGetMove:
 
; initialize variables
mov [cpulevel],eax
mov dword [bestval],-INFTY
mov dword [nbestmoves],0
; try every move
mov ecx,6
.evalmoves:
 
; get move to make from move order table
mov eax,[moveorder+ecx*4]
; if this is an invalid move, continue with next move
BOARDISVALIDMOVE eax
jz .nextmove
 
; make move for current player
mov ebx,[currentplayer]
call boardMakeMove
; evaluate move
push eax ; save move #
push ecx ; save loop counter
push dword [cpulevel] ; ply
mov ebx,[currentplayer] ; player
BOARDGETOTHERPLAYER ebx
push ebx
push dword -INFTY ; alpha
push dword INFTY ; beta
call alphabeta
neg eax ; damn, how could i forget this ???
mov ebx,eax ; save result for later
pop ecx ; restore loop counter
pop eax ; restore move #
; undo move (eax = move #)
call boardUndoMove
; let's see wether we have a new best move
cmp ebx,[bestval] ; new best value found ?
jle .nonewbestval
mov [bestval],ebx ; yes -> save it
mov dword [nbestmoves],1 ; delete everything that was in the list
mov [bestmoves+0],eax ; save move number in list
jmp short .nextmove ; continue with next move
.nonewbestval:
cmp ebx,[bestval] ; another best value found ?
jne .nextmove
mov ebx,[nbestmoves] ; yes -> add move to list
mov [bestmoves+ebx*4],eax
inc dword [nbestmoves]
 
.nextmove:
dec ecx
js .done
jmp .evalmoves
.done:
; randomly pick one of the best moves
call rand ; rand() % nbestmoves
xor edx,edx
div dword [nbestmoves]
mov eax,[bestmoves+edx*4] ; get move from list
ret
 
; test code : pick first move from list
mov eax,[bestmoves+0]
ret
 
 
 
;**********************************************************
; alphabeta
;
; input : see below
; output : eax = move value
; destroys : everything
;**********************************************************
alphabeta:
 
%define ply (ebp+20)
%define player (ebp+16)
%define alpha (ebp+12)
%define beta (ebp+ 8)
 
enter 0,0
; win for other player -> end search
mov eax,[player]
BOARDGETOTHERPLAYER eax
call boardIsWin
or eax,eax
jz .nowin
mov eax,-1000000
mov ebx,[ply]
shl ebx,10
sub eax,ebx
leave
ret 4*4
.nowin:
; board full but no win -> draw -> end search
BOARDISFULL
jnz .notfull
xor eax,eax
leave
ret 4*4
.notfull
; max search depth reached -> do static evaluation
cmp dword [ply],0
je .staticeval
 
; for each move
mov ecx,6
.evalmoves:
 
; while (alpha < beta)
mov eax,[alpha]
cmp eax,[beta]
jge .done
 
; pick move from move order table
mov eax,[moveorder+ecx*4]
; invalid move ? if so, continue with next move
BOARDISVALIDMOVE eax
jz .nextmove
; make move for current player
mov ebx,[player]
call boardMakeMove
; evaluate move
push eax
push ecx
mov eax,[ply] ; ply = ply-1
dec eax
push eax
mov ebx,[player] ; player = other player
BOARDGETOTHERPLAYER ebx
push ebx
mov ecx,[beta] ; alpha = -beta
neg ecx
push ecx
mov edx,[alpha] ; beta = -alpha
neg edx
push edx
call alphabeta
neg eax
; new alpha ?
cmp eax,[alpha]
jle .nonewalpha
mov [alpha],eax ; yes -> save it
.nonewalpha:
pop ecx
pop eax
; undo move
call boardUndoMove
 
.nextmove: ; evaluate next move
dec ecx
jns .evalmoves
.done:
mov eax,[alpha]
leave
ret 4*4
; static evaluation
.staticeval:
xor eax,eax
mov esi,BWIDTH*BHEIGHT-1
.l:
mov ebx,[board+esi*4] ; get stone from board
cmp ebx,[player] ; player's stone ?
jne .notplayer ; nope -> go on
add eax,[evaltable+esi*4] ; yes -> add stone value to eax
jmp .next ; next stone
.notplayer:
cmp ebx,EMPTY ; other player's stone ?
je .empty ; nope -> go on
sub eax,[evaltable+esi*4] ; yes -> sub stone value from eax
.empty:
.next: ; next stone
dec esi
jns .l
leave ; eax contains static value
ret 4*4
 
%undef ply
%undef player
%undef alpha
%undef beta
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/blue.pcx
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/c4/trunk/board.inc
0,0 → 1,318
; C4
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This file is part of C4.
;
; C4 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; C4 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with C4; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%ifndef _BOARD_INC
%define _BOARD_INC
 
 
;**********************************************************
; magic numbers
;**********************************************************
 
EMPTY equ 0
PLAYER1 equ 1
PLAYER2 equ 2
 
; board dimensions (+2 for border)
BWIDTH equ 9
BHEIGHT equ 8
 
 
 
;**********************************************************
; uninitialized data
;**********************************************************
 
section .bss
board resd BHEIGHT*BWIDTH ; the board
free resd BWIDTH ; # of free fields for each column
totalfree resd 1 ; total # of free fields
currentplayer resd 1 ; player to make next move
lastmove resd 1 ; last move done on the board
; (0 if no last move available)
 
 
 
;**********************************************************
; code
;**********************************************************
section .text
 
;**********************************************************
; boardReset
; reset board for new game
;
; input : nothing
; output : nothing
; destroys : nothing
;**********************************************************
boardReset:
pushfd
pushad
; clear all fields
mov edi,board
mov ecx,BHEIGHT * BWIDTH
mov eax,EMPTY
rep stosd
; init free array
mov edi,free
mov ecx,BWIDTH
mov eax,BHEIGHT - 2
rep stosd
mov dword [totalfree],(BWIDTH-2)*(BHEIGHT-2)
mov dword [currentplayer],PLAYER1
mov dword [lastmove],0
popad
popfd
ret
 
 
 
;**********************************************************
; BOARDISVALIDMOVE
; checks wether a move is valid
;
; input : 32 bit register containing a move
; number (1..7)
; output : zero flag set -> move is invalid
; zero flag clear -> move is valid
; destroys : nothing
;**********************************************************
%macro BOARDISVALIDMOVE 1
cmp dword [free+%1*4],0
%endmacro
 
 
 
;**********************************************************
; boardMakeMove
; make a move
;
; input : eax = move number (1..7)
; ebx = PLAYER1/PLAYER2
; output : nothing
; destroys : edi, flags
;**********************************************************
 
boardMakeMove:
mov edi,[free+eax*4] ; place stone
imul edi,BWIDTH
add edi,eax
mov [board+edi*4],ebx
dec dword [free+eax*4] ; one stone more in this column
dec dword [totalfree] ; one stone more on the board
mov [lastmove],eax ; store move for undo
ret
 
 
 
;**********************************************************
; boardUndoMove
; undo a move
;
; input : eax = move number to undo (1..7)
; output : move is undone
; destroys : edi, flags
;**********************************************************
boardUndoMove:
inc dword [free+eax*4] ; one stone less in this column
inc dword [totalfree] ; one stone less on the board
mov dword [lastmove],0 ; no last move available
mov edi,[free+eax*4] ; remove stone from board
imul edi,BWIDTH
add edi,eax
mov dword [board+edi*4],EMPTY
ret
 
 
 
;**********************************************************
; BOARDSWITCHPLAYERS
; switch current player
;
; input : nothing
; output : current player is switched
; destroys : flags
;**********************************************************
%macro BOARDSWITCHPLAYERS 0
xor dword [currentplayer],(PLAYER1 ^ PLAYER2)
%endmacro
 
 
 
;**********************************************************
; BOARDGETOTHERPLAYER
; get other player =)
;
; input : 32 bit register or variable
; output : player changed
; destroys : flags
;**********************************************************
%macro BOARDGETOTHERPLAYER 1
xor %1,(PLAYER1 ^ PLAYER2)
%endmacro
 
 
 
;**********************************************************
; BOARDISFULL
; check wether board is full
;
; input : nothing
; output : zero flag set -> board is full
; zero flag clear -> board isn't full
;**********************************************************
%macro BOARDISFULL 0
cmp dword [totalfree],0
%endmacro
 
 
 
;**********************************************************
; boardIsWin
; check wether the current board state is a win for the
; given player
;
; input : eax = player
; output : eax = nonzero -> win for player
; destroys : everything
;**********************************************************
 
boardIsWin:
 
; check wether last move is available
cmp dword [lastmove],0
jne .lastmoveok
xor eax,eax
ret
.lastmoveok:
 
; calculate the address of the most recently placed stone (edi)
mov edi,[lastmove]
mov esi,[free + edi*4]
inc esi
imul esi,BWIDTH
add edi,esi
shl edi,2
add edi,board
; check vertically
xor ecx,ecx ; reset counter
mov esi,edi ; start at last stone
.vertical:
cmp [esi],eax ; loop as long the stone [esi] belongs to player
jne .verticalend
add esi,BWIDTH*4 ; move to next stone
inc ecx ; one stone more in row
jmp short .vertical
.verticalend:
cmp ecx,4 ; 4 or more stones ?
jl .nope1 ; nope -> continue
mov eax,1 ; yeah -> tell caller =)
ret
.nope1:
 
; check horizontally
xor ecx,ecx
mov esi,edi
.horizontal1: ; left
cmp [esi],eax
jne .horizontalend1
sub esi,4
inc ecx
jmp short .horizontal1
.horizontalend1:
lea esi,[edi+4] ; right
.horizontal2:
cmp [esi],eax
jne .horizontalend2
add esi,4
inc ecx
jmp short .horizontal2
.horizontalend2:
cmp ecx,4
jl .nope2
mov eax,1
ret
.nope2:
 
; diagonally forward
xor ecx,ecx
mov esi,edi
.forward1:
cmp [esi],eax
jne .forwardend1
sub esi,(1+BWIDTH)*4
inc ecx
jmp short .forward1
.forwardend1:
lea esi,[edi+(1+BWIDTH)*4]
.forward2:
cmp [esi],eax
jne .forwardend2
add esi,(1+BWIDTH)*4
inc ecx
jmp short .forward2
.forwardend2:
cmp ecx,4
jl .nope3
mov eax,1
ret
.nope3:
 
; diagonally backward
xor ecx,ecx
mov esi,edi
.backward1:
cmp [esi],eax
jne .backwardend1
add esi,(1-BWIDTH)*4
inc ecx
jmp short .backward1
.backwardend1:
lea esi,[edi+(BWIDTH-1)*4]
.backward2:
cmp [esi],eax
jne .backwardend2
add esi,(BWIDTH-1)*4
inc ecx
jmp short .backward2
.backwardend2:
cmp ecx,4
jl .nope4
mov eax,1
ret
.nope4:
 
; no win for this player
xor eax,eax
ret
 
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/c4.asm
0,0 → 1,910
; C4
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This file is part of C4.
;
; C4 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; C4 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with C4; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
bits 32
%include 'mos.inc'
section .text
 
MOS_HEADER01 start,end
 
 
 
;**********************************************************
; magic numbers
;**********************************************************
 
; initial player types
PL1TYPE_INIT equ 0
PL2TYPE_INIT equ 4
 
; window
WND_WIDTH equ 259
WND_HEIGHT equ 300
WND_WORKCOLOR equ 0
 
; button dimensions
BUTTON_HEIGHT equ 12
 
BUTTON_NEW_X equ 14
BUTTON_NEW_Y equ 30
BUTTON_NEW_WIDTH equ 56
 
BUTTON_SPIN_WIDTH equ 8
BUTTON_PL1DN_X equ 228
BUTTON_PL1DN_Y equ 30
BUTTON_PL1UP_X equ (BUTTON_PL1DN_X + BUTTON_SPIN_WIDTH + 1)
BUTTON_PL1UP_Y equ BUTTON_PL1DN_Y
 
BUTTON_PL2DN_X equ BUTTON_PL1DN_X
BUTTON_PL2DN_Y equ (BUTTON_PL1DN_Y + 20)
BUTTON_PL2UP_X equ (BUTTON_PL2DN_X + BUTTON_SPIN_WIDTH + 1)
BUTTON_PL2UP_Y equ BUTTON_PL2DN_Y
 
; label dimensions
LABEL_PL1_X equ 90
LABEL_PL1_Y equ (1 + BUTTON_PL1DN_Y + (BUTTON_HEIGHT-8)/2)
LABEL_PL2_X equ LABEL_PL1_X
LABEL_PL2_Y equ (1 + BUTTON_PL2DN_Y + (BUTTON_HEIGHT-8)/2)
LABEL_PL1TYPE_X equ (LABEL_PL1_X + 10*6)
LABEL_PL1TYPE_Y equ LABEL_PL1_Y
LABEL_PL2TYPE_X equ LABEL_PL1TYPE_X
LABEL_PL2TYPE_Y equ LABEL_PL2_Y
LABEL_STATUS_X equ 14
LABEL_STATUS_Y equ 279
LABEL_STATUS_WIDTH equ 220
LABEL_STATUS_HEIGHT equ 8
 
 
 
; board and stones
STONESIZE equ 32 ; stone height and width
GRIDX equ 14 ; upper left corner
GRIDY equ 70
GRIDSPACING equ (STONESIZE + 1) ; space between lines
GRIDHEIGHT equ (6*GRIDSPACING+1) ; total grid width and height
GRIDWIDTH equ (7*GRIDSPACING+1)
GRIDCOLOR equ MOS_RGB(128,128,128)
 
 
 
; button id's
BT_QUIT equ 1
BT_NEW equ 2
BT_PLAYER1DN equ 3
BT_PLAYER1UP equ 4
BT_PLAYER2DN equ 5
BT_PLAYER2UP equ 6
 
 
start:
jmp main
 
%include "pcx.inc"
%include "windows.inc"
%include "board.inc"
%include "rng.inc"
; %include "randomai.inc"
%include "ai.inc"
 
 
 
;**********************************************************
; main program
;**********************************************************
main:
call randomize
call defineWindow
call decrunchImages
call newGame
 
.msgpump:
; wait for event
mov ebx,1
mov eax,MOS_SC_WAITEVENTTIMEOUT
int 0x40
 
; process events
cmp eax,MOS_EVT_REDRAW
je short .redraw
cmp eax,MOS_EVT_KEY
je short .key
cmp eax,MOS_EVT_BUTTON
je short .button
 
call pollMouse
call gameLoop
jmp short .msgpump
 
.redraw:
call defineWindow
jmp short .msgpump
.key:
call keyboardInput
jmp short .msgpump
.button:
call handleButton
jmp short .msgpump
 
 
 
;**********************************************************
; button handling function
;**********************************************************
handleButton:
mov eax,MOS_SC_GETPRESSEDBUTTON ; get button id
int 0x40
 
cmp al,1 ; button pressed ?
je short .bye ; nope -> nothing to do
 
cmp ah,BT_QUIT ; which button has been pressed ?
je short .quit
cmp ah,BT_NEW
je short .new
cmp ah,BT_PLAYER1DN
je short .player1dn
cmp ah,BT_PLAYER1UP
je short .player1up
cmp ah,BT_PLAYER2DN
je short .player2dn
cmp ah,BT_PLAYER2UP
je short .player2up
.bye:
ret
.quit:
MOS_EXIT
.new:
call newGame
ret
.player1dn:
mov eax,[player1_type] ; get current type
or eax,eax ; already zero ?
jz .bla
dec eax ; nope -> decrement
mov [player1_type],eax ; write back
mov edi,label_pl1type ; and update label
call updatePlayerType
.bla:
ret
.player1up:
mov eax,[player1_type] ; get current type
cmp eax,NPLAYERTYPES-1 ; already max ?
je .bla2
inc eax ; nope -> increment
mov [player1_type],eax ; write back
mov edi,label_pl1type ; update label
call updatePlayerType
.bla2:
ret
.player2dn:
mov eax,[player2_type] ; get current type
or eax,eax ; already zero ?
jz .bla3
dec eax ; nope -> decrement
mov [player2_type],eax ; write back
mov edi,label_pl2type ; and update label
call updatePlayerType
.bla3:
ret
.player2up:
mov eax,[player2_type]
cmp eax,NPLAYERTYPES-1
je .bla4
inc eax
mov [player2_type],eax
mov edi,label_pl2type
call updatePlayerType
.bla4:
ret
 
 
 
;**********************************************************
; window definition function
;**********************************************************
defineWindow:
MOS_STARTREDRAW
 
mov edi,window
call drawWindow
 
mov edi,buttons
mov ecx,NBUTTONS
call drawButtons
 
mov edi,labels
mov ecx,NLABELS
call drawLabels
 
xor eax,eax
call drawBoard
MOS_ENDREDRAW
ret
 
 
 
;**********************************************************
; updateStatusText
;
; input : esi = ptr to new string
; output : status bar is updated
; destroys : everything
;**********************************************************
updateStatusText:
 
; different text ?
cmp [statusbar + LABEL.caption],esi
je .bye ; nope -> bye
mov dword [statusbar + LABEL.caption],esi ; yeah -> save & redraw
 
; clear background
mov ebx,MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_WIDTH)
mov ecx,MOS_DWORD(LABEL_STATUS_Y,LABEL_STATUS_HEIGHT)
xor edx,edx
mov eax,MOS_SC_DRAWBAR
int 0x40
; redraw label
mov edi,statusbar
mov ecx,1
call drawLabels
.bye:
ret
 
 
 
;**********************************************************
; updatePlayerType
; update player type label
; input: eax = new type
; edi = address label structure to update
;**********************************************************
updatePlayerType:
mov ebx,PLAYERTYPELEN ; calculate type string address
mul ebx
add eax,playertypes
mov [edi + LABEL.caption],eax ; write address
mov ecx,1 ; and redraw label
call drawLabels
ret
 
 
 
;**********************************************************
; board drawing stuff
;**********************************************************
 
; drawBoard
; draw whole board
;
; input : eax nonzero = clear board background
drawBoard:
 
; clear background ?
or eax,eax
jz .noclear
mov ebx,MOS_DWORD(GRIDX,GRIDWIDTH)
mov ecx,MOS_DWORD(GRIDY,GRIDHEIGHT)
mov edx,WND_WORKCOLOR
mov eax,MOS_SC_DRAWBAR
int 0x40
.noclear:
call drawGrid
call drawStones
ret
 
 
 
drawGrid:
; vertical lines
mov ebx,MOS_DWORD(GRIDX,GRIDX)
mov ecx,MOS_DWORD(GRIDY,GRIDY+GRIDHEIGHT-1)
mov edx,GRIDCOLOR
mov eax,MOS_SC_DRAWLINE
mov esi,8
.vlines:
int 0x40
add ebx,MOS_DWORD(GRIDSPACING,GRIDSPACING)
dec esi
jnz .vlines
; horizontal lines
mov ebx,MOS_DWORD(GRIDX,GRIDX+GRIDWIDTH-1)
mov ecx,MOS_DWORD(GRIDY,GRIDY)
mov esi,7
.hlines:
int 0x40
add ecx,MOS_DWORD(GRIDSPACING,GRIDSPACING)
dec esi
jnz .hlines
ret
drawStones:
mov ebx,6
.col:
mov ecx,7
.row:
call drawStone
loop .row
dec ebx
jnz .col
ret
 
 
; ecx = column (1..7)
; ebx = row (1..6)
drawStone:
pushad
 
; see which image to draw.
; the image offset is stored in ebp
mov eax,BWIDTH ; calculate address
mul ebx
add eax,ecx
mov eax,[board+eax*4] ; get stone ?
cmp eax,EMPTY ; empty field -> nothing to do
je .bye
mov ebp,redstone ; assume red stone
cmp eax,PLAYER1 ; red ?
je .stoneok ; yeah -> continue
mov ebp,bluestone ; nope -> use blue stone
.stoneok:
 
; calculate image position (edx)
mov eax,GRIDSPACING
dec ecx
mul ecx
add eax,GRIDX + 1
shl eax,16
mov ecx,eax
mov eax,GRIDSPACING
dec ebx
mul ebx
add eax,GRIDY + 1
mov cx,ax
mov edx,ecx
 
; put image (position is already in edx)
mov ebx,ebp ; image address
mov ecx,MOS_DWORD(STONESIZE,STONESIZE) ; image dimensions
mov eax,MOS_SC_PUTIMAGE
int 0x40
 
.bye:
popad
ret
 
 
 
decrunchImages:
mov esi,redpcx ; red stone
mov edi,redstone
mov ebx,REDPCXSIZE
call loadPCX
mov esi,bluepcx ; blue stone
mov edi,bluestone
mov ebx,BLUEPCXSIZE
call loadPCX
ret
 
 
 
resetInput:
mov dword [playerinput],0 ; no player input
mov dword [mouseinput],0
ret
 
 
 
;**********************************************************
; newGame
; set up everything for a game
;
; input : nothing
; output : nothing
; destroys : everything
;**********************************************************
newGame:
call boardReset ; reset and redraw board
mov eax,1
call drawBoard
call resetInput ; reset input
mov dword [gameover],0 ; game is running
ret
 
 
 
;**********************************************************
; pollMouse
; mouse polling routine
;
; input : nothing
; output : playerinput will be updated, if
; the player clicked on a valid
; field
; destroys : everything
;**********************************************************
pollMouse:
mov ebx,2
mov eax,MOS_SC_GETMOUSEPOSITION
int 0x40
and eax,1
jz .mousenotpressed
.mousepressed:
mov dword [mouseinput],0
call isActiveApp
or al,al
jz .notactive1
call getMouseCol
mov [mouseinput],eax
.notactive1:
ret
.mousenotpressed:
call isActiveApp
or al,al
jz .notactive2
call getMouseCol
cmp eax,[mouseinput]
jne .nonewinput
cmp dword [playerinput],0
jne .nonewinput
mov [playerinput],eax
.nonewinput:
.notactive2:
mov dword [mouseinput],0
ret
 
 
 
;**********************************************************
; getMouseCol
; calculate in which column the mouse is. or so.
;
; input : nothing
; output : eax = 0 -> mouse outside board
; eax = 1..7 -> column
; destroys : everything
;**********************************************************
getMouseCol:
 
mov ebx,1 ; get mouse position, window relative
mov eax,MOS_SC_GETMOUSEPOSITION
int 0x40
 
movzx ebx,ax ; y clipping
cmp ebx,GRIDY
jl .outside
cmp ebx,GRIDY + GRIDHEIGHT - 1
jg .outside
 
shr eax,16 ; calculate column from x coordinate
sub eax,GRIDX
js .outside ; negative -> outside of board (left)
cdq ; !
mov ebx,GRIDSPACING
div ebx
cmp eax,BWIDTH-3 ; right outside of board ?
jg .outside ; yes -> bye
inc eax ; xform into range [1,7]
ret
.outside
xor eax,eax
ret
 
 
 
;**********************************************************
; isActiveApp
; check wether we're the active application
;
; input : nothing
; output : al nonzero -> we are the active app
; destroys : everything
;**********************************************************
isActiveApp:
 
%define PROCINFO (ebp-MOS_PROCESSINFO_size)
 
enter MOS_PROCESSINFO_size,0
; get process information
mov eax,MOS_SC_GETPROCESSINFO
lea ebx,[ebp-MOS_PROCESSINFO_size]
mov ecx,-1
int 0x40
 
; set al to 1 if we are the active application
cmp ax,[PROCINFO+MOS_PROCESSINFO.windowStackPos]
sete al
leave
ret
%undef PROCINFO
 
 
 
;**********************************************************
; keyboardInput
; keyboard input handler, called from main loop
;
; input : nothing
; output : playerinput is updated
; destroys : everything
;**********************************************************
keyboardInput:
mov eax,MOS_SC_GETKEY ; get key
int 0x40
or al,al ; key available ?
jnz .bye ; no -> bye
cmp dword [playerinput],0 ; unprocessed input available ?
jne .bye ; yes -> bye
 
sub ah,'1' ; valid key ?
cmp ah,BWIDTH-3
ja .bye ; treat as unsigned : keys below '1' will
; be greater too =)
 
mov al,ah ; save input
and eax,255
inc eax
mov [playerinput],eax
 
.bye:
ret
 
 
 
;**********************************************************
; gameLoop
; game logic code or however you wish to call it.
; actually this is not a loop, but is called from
; the main loop
;**********************************************************
gameLoop:
 
; if the game is over, return
cmp dword [gameover],0
je .gamerunning
ret
.gamerunning:
 
call updatePlayerStatusText
 
; get move
call getMoveForCurrentPlayer
or eax,eax
jnz .moveok
ret ; no move available -> bye
.moveok:
 
; make move and update board graphics
mov ebx,[currentplayer] ; ebx = current player, eax contains already move
call boardMakeMove
call drawStones
 
; check wether game is over (either by a win or because the board is full)
mov eax,[currentplayer] ; win for current player ?
call boardIsWin
or eax,eax
jz .nowin ; no -> continue
mov esi,player1wins ; yes -> display message...
cmp dword [currentplayer],PLAYER1
je .blubb
mov esi,player2wins
.blubb:
call updateStatusText
mov dword [gameover],1 ; ...and end game
ret
.nowin:
BOARDISFULL ; board full, but no win ?
jnz .notfull ; no -> continue
mov esi,itisadraw ; yes -> display message...
call updateStatusText
mov dword [gameover],1 ; ...and end game
ret
.notfull:
 
; switch players and return to main loop
BOARDSWITCHPLAYERS
ret
 
 
 
;**********************************************************
; getMoveForCurrentPlayer
; returns the move made by the current player
; (either cpu or human)
;
; input : nothing
; output : eax = 0 -> no move made. this is
; usually the case for human players,
; when no valid input is available.
; else eax = move number
;**********************************************************
getMoveForCurrentPlayer:
 
; get type of current player
mov eax,[player1_type]
cmp dword [currentplayer],PLAYER1
je .ok
mov eax,[player2_type]
.ok:
 
; get move for human/cpu player
or eax,eax
jnz .cpu
.human:
mov eax,[playerinput] ; get input
or eax,eax ; input available ?
jz .nomove ; no -> return no move available
call resetInput ; !
BOARDISVALIDMOVE eax ; valid move `?
jz .nomove ; no -> return no move available
ret ; valid move available -> return it (eax)
 
.cpu:
call dword [aicode] ; call ai machine. cpu level is already in eax
ret
.nomove:
xor eax,eax
ret
 
 
 
;**********************************************************
; update status bar : which player's turn it is
;**********************************************************
updatePlayerStatusText:
cmp dword [currentplayer],PLAYER2
je .player2
mov esi,player1hmnprmpt
cmp dword [player1_type],0
je .statustextok
mov esi,player1cpuprmpt
jmp short .statustextok
.player2:
mov esi,player2hmnprmpt
cmp dword [player2_type],0
je .statustextok
mov esi,player2cpuprmpt
.statustextok:
call updateStatusText
ret
 
 
 
;**********************************************************
; initialized data
;**********************************************************
 
section .data
 
;
; window definition
;
windowtitle db "C4 0.1",0
window:
istruc WND
at WND.xposandsize, dd MOS_DWORD(0,WND_WIDTH)
at WND.yposandsize, dd MOS_DWORD(0,WND_HEIGHT)
at WND.workcolor, dd 0x03000000 | WND_WORKCOLOR
at WND.grabcolor, dd 0
at WND.framecolor, dd 0
at WND.caption, dd windowtitle
at WND.captioncolor, dd 0
at WND.flags, dd WND_CENTER | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR
iend
 
;
; button table
;
buttons:
istruc BUTTON ; new
at BUTTON.xposandsize
dd MOS_DWORD(BUTTON_NEW_X,BUTTON_NEW_WIDTH)
dd MOS_DWORD(BUTTON_NEW_Y,BUTTON_HEIGHT)
dd BT_NEW
dd BUTTON_COLOR_WORK
iend
istruc BUTTON ; player 1 down
at BUTTON.xposandsize
dd MOS_DWORD(BUTTON_PL1DN_X,BUTTON_SPIN_WIDTH)
dd MOS_DWORD(BUTTON_PL1DN_Y,BUTTON_HEIGHT)
dd BT_PLAYER1DN
dd BUTTON_COLOR_WORK
iend
istruc BUTTON ; player 1 up
at BUTTON.xposandsize
dd MOS_DWORD(BUTTON_PL1UP_X,BUTTON_SPIN_WIDTH)
dd MOS_DWORD(BUTTON_PL1UP_Y,BUTTON_HEIGHT)
dd BT_PLAYER1UP
dd BUTTON_COLOR_WORK
iend
istruc BUTTON ; player 2 down
at BUTTON.xposandsize
dd MOS_DWORD(BUTTON_PL2DN_X,BUTTON_SPIN_WIDTH)
dd MOS_DWORD(BUTTON_PL2DN_Y,BUTTON_HEIGHT)
dd BT_PLAYER2DN
dd BUTTON_COLOR_WORK
iend
istruc BUTTON ; player 2 up
at BUTTON.xposandsize
dd MOS_DWORD(BUTTON_PL2UP_X,BUTTON_SPIN_WIDTH)
dd MOS_DWORD(BUTTON_PL2UP_Y,BUTTON_HEIGHT)
dd BT_PLAYER2UP
dd BUTTON_COLOR_WORK
iend
NBUTTONS equ (($-buttons)/BUTTON_size)
 
 
;
; label table
;
 
newgame db "New game",0
down db "<",0
up db ">",0
pl1 db "Player 1:",0
pl2 db "Player 2:",0
 
 
playertypes:
db "Human ",0
PLAYERTYPELEN equ ($ - playertypes)
db "CPU level 1 ",0
db "CPU level 2 ",0
db "CPU level 3 ",0
db "CPU level 4 ",0
db "CPU level 5 ",0
db "CPU level 6 ",0
db "CPU level 7 ",0
db "CPU level 8 ",0
NPLAYERTYPES equ (($-playertypes)/PLAYERTYPELEN)
 
labels:
istruc LABEL ; new
at LABEL.position
dd MOS_DWORD(BUTTON_NEW_X+4,1+BUTTON_NEW_Y+(BUTTON_HEIGHT-8)/2)
dd newgame
dd LABEL_COLOR_WORKBUTTON
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 1 down
at LABEL.position
dd MOS_DWORD(BUTTON_PL1DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1DN_Y+(BUTTON_HEIGHT-8)/2)
dd down
dd LABEL_COLOR_WORKBUTTON
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 1 up
at LABEL.position
dd MOS_DWORD(1+BUTTON_PL1UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1UP_Y+(BUTTON_HEIGHT-8)/2)
dd up
dd LABEL_COLOR_WORKBUTTON
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 2 down
at LABEL.position
dd MOS_DWORD(BUTTON_PL2DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2DN_Y+(BUTTON_HEIGHT-8)/2)
dd down
dd LABEL_COLOR_WORKBUTTON
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 2 up
at LABEL.position
dd MOS_DWORD(1+BUTTON_PL2UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2UP_Y+(BUTTON_HEIGHT-8)/2)
dd up
dd LABEL_COLOR_WORKBUTTON
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 1
at LABEL.position
dd MOS_DWORD(LABEL_PL1_X,LABEL_PL1_Y)
dd pl1
dd MOS_RGB(255,255,255)
dd LABEL_BGCOLOR_TRANSPARENT
iend
istruc LABEL ; player 2
at LABEL.position
dd MOS_DWORD(LABEL_PL2_X,LABEL_PL2_Y)
dd pl2
dd MOS_RGB(255,255,255)
dd LABEL_BGCOLOR_TRANSPARENT
iend
statusbar: ; status bar
istruc LABEL
at LABEL.position
dd MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_Y)
dd 0
dd MOS_RGB(255,255,255)
dd LABEL_BGCOLOR_TRANSPARENT
iend
label_pl1type:
istruc LABEL
at LABEL.position
dd MOS_DWORD(LABEL_PL1TYPE_X,LABEL_PL1TYPE_Y)
dd playertypes+PL1TYPE_INIT*PLAYERTYPELEN
dd MOS_RGB(255,255,255)
dd MOS_RGB(0,0,0)
iend
label_pl2type:
istruc LABEL
at LABEL.position
dd MOS_DWORD(LABEL_PL2TYPE_X,LABEL_PL2TYPE_Y)
dd playertypes+PL2TYPE_INIT*PLAYERTYPELEN
dd MOS_RGB(255,255,255)
dd MOS_RGB(0,0,0)
iend
NLABELS equ (($-labels)/LABEL_size)
 
 
; player types
player1_type dd PL1TYPE_INIT
player2_type dd PL2TYPE_INIT
 
 
; status messages
player1hmnprmpt db "Make your move, player 1.",0
player2hmnprmpt db "Make your move, player 2.",0
player1cpuprmpt db "Player 1 is thinking, please wait...",0
player2cpuprmpt db "Player 2 is thinking, please wait...",0
itisadraw db "It's a draw.",0
player1wins db "Player 1 wins.",0
player2wins db "Player 2 wins.",0
 
 
; pointer to ai player. future releases C4 might
; or might not support different ai players =)
aicode dd aiGetMove
 
 
; button images
redpcx: incbin "red.pcx"
REDPCXSIZE equ ($ - redpcx)
bluepcx: incbin "blue.pcx"
BLUEPCXSIZE equ ($ - bluepcx)
 
 
 
;**********************************************************
; uninitialized data
;**********************************************************
 
section .bss
 
; player input
; 0 : no input available
; 1..7 : column to drop stone into
playerinput resd 1
 
mouseinput resd 1
gameover resd 1
 
redstone resb STONESIZE*STONESIZE*3
bluestone resb STONESIZE*STONESIZE*3
 
end:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/mos.inc
0,0 → 1,305
; mos.inc 0.0.2
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;
;
;
; revision history
; ----------------
;
; 10-04-2002 version 0.0.2
; - removed MOS_WNDCOLORS_SIZE and similar constants.
; while reading the docs i realized that NASM creates
; such symbols already itself...
; + macros: MOS_WAITEVENT, MOS_WAITEVENT_S, MOS_STARTREDRAW,
; MOS_STARTREDRAW_S, MOS_ENDREDRAW, MOS_ENDREDRAW_S,
; MOS_GETSCREENMAX, MOS_GETSCREENMAX_S, MOS_EXIT, MOS_EXIT_S
; + event bit masks
; + some syscall numbers
; + process info structure
;
; 08-??-2002 version 0.0.1
; first release
;
%ifndef _MOS_INC
%define _MOS_INC
 
 
 
;**********************************************************
; generates a menuetos 01 header
; takes 2-6 parameters:
;
; MOS_HEADER01 start,end[,appmem,esp,i_param,i_icon]
;**********************************************************
 
%macro MOS_HEADER01 2-6 0x100000,0x7fff0,0,0
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd %1 ; start of code
dd %2 ; image size
dd %3 ; application memory
dd %4 ; esp
dd %5 ; i_param
dd %6 ; i_icon
%endmacro
 
 
;**********************************************************
; MOS_DWORD
; packs 2 words into a double word
;**********************************************************
 
%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff))
 
 
;**********************************************************
; MOS_RGB
; creates a menuet os compatible color (0x00RRGGBB)
;**********************************************************
 
%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255))
 
 
;**********************************************************
; window color structure
;**********************************************************
 
struc MOS_WNDCOLORS
.frame: resd 1
.grab: resd 1
.grabButton: resd 1
.grabButtonText: resd 1
.grabText: resd 1
.work: resd 1
.workButton: resd 1
.workButtonText: resd 1
.workText: resd 1
.workGraphics: resd 1
endstruc
 
 
;**********************************************************
; process info structure
;**********************************************************
 
struc MOS_PROCESSINFO
.CPUUsage: resd 1 ; cpu usage
.windowStackPos: resw 1 ; process' position in windowing stack
.windowStackVal: resw 1 ; window stack value at ecx
.reserved1: resw 1
.processName: resb 12 ; process name
.memStart: resd 1 ; start of process memory
.memUsed: resd 1 ; memory used by the process
.pid: resd 1 ; process id
.reserved2: resb (1024-34)
endstruc
 
 
 
;**********************************************************
; system call numbers
;**********************************************************
 
MOS_SC_EXIT equ -1
MOS_SC_DEFINEWINDOW equ 0
MOS_SC_PUTPIXEL equ 1
MOS_SC_GETKEY equ 2
MOS_SC_GETSYSCLOCK equ 3
MOS_SC_WRITETEXT equ 4
MOS_SC_DELAY equ 5
MOS_SC_OPENFILEFLOPPY equ 6
MOS_SC_PUTIMAGE equ 7
MOS_SC_DEFINEBUTTON equ 8
MOS_SC_GETPROCESSINFO equ 9
MOS_SC_WAITEVENT equ 10
MOS_SC_CHECKEVENT equ 11
MOS_SC_REDRAWSTATUS equ 12
MOS_SC_DRAWBAR equ 13
MOS_SC_GETSCREENMAX equ 14
MOS_SC_SETBACKGROUND equ 15
MOS_SC_GETPRESSEDBUTTON equ 17
MOS_SC_SYSTEMSERVICE equ 18
MOS_SC_STARTPROGRAM equ 19
MOS_SC_MIDIINTERFACE equ 20
MOS_SC_DEVICESETUP equ 21
MOS_SC_WAITEVENTTIMEOUT equ 23
MOS_SC_CDAUDIO equ 24
MOS_SC_SB16MIXER1 equ 25
MOS_SC_GETDEVICESETUP equ 26
MOS_SC_WSS equ 27
MOS_SC_SB16MIXER2 equ 28
MOS_SC_GETDATE equ 29
MOS_SC_READHD equ 30
MOS_SC_STARTPROGRAMHD equ 31
MOS_SC_GETSCREENPIXEL equ 35
MOS_SC_GETMOUSEPOSITION equ 37
MOS_SC_DRAWLINE equ 38
MOS_SC_GETBACKGROUND equ 39
MOS_SC_SETEVENTMASK equ 40
MOS_SC_WRITENUMBER equ 47
MOS_SC_WINDOWPROPERTIES equ 48
 
 
;**********************************************************
; event numbers
;**********************************************************
 
MOS_EVT_NONE equ 0
MOS_EVT_REDRAW equ 1
MOS_EVT_KEY equ 2
MOS_EVT_BUTTON equ 3
 
 
;**********************************************************
; event bits
;**********************************************************
 
MOS_EVTBIT_REDRAW equ (1 << 0)
MOS_EVTBIT_KEY equ (1 << 1)
MOS_EVTBIT_BUTTON equ (1 << 2)
MOS_EVTBIT_ENDREQUEST equ (1 << 3)
MOS_EVTBIT_BGDRAW equ (1 << 4)
MOS_EVTBIT_MOUSECHANGE equ (1 << 5)
MOS_EVTBIT_IPCEVENT equ (1 << 6)
MOS_EVTBIT_IRQ0 equ (1 << 16)
MOS_EVTBIT_IRQ1 equ (1 << 17)
MOS_EVTBIT_IRQ2 equ (1 << 18)
MOS_EVTBIT_IRQ3 equ (1 << 19)
MOS_EVTBIT_IRQ4 equ (1 << 20)
MOS_EVTBIT_IRQ5 equ (1 << 21)
MOS_EVTBIT_IRQ6 equ (1 << 22)
MOS_EVTBIT_IRQ7 equ (1 << 23)
MOS_EVTBIT_IRQ8 equ (1 << 24)
MOS_EVTBIT_IRQ9 equ (1 << 25)
MOS_EVTBIT_IRQ10 equ (1 << 26)
MOS_EVTBIT_IRQ11 equ (1 << 27)
MOS_EVTBIT_IRQ12 equ (1 << 28)
MOS_EVTBIT_IRQ13 equ (1 << 29)
MOS_EVTBIT_IRQ14 equ (1 << 30)
MOS_EVTBIT_IRQ15 equ (1 << 31)
 
 
;**********************************************************
; exit application (syscall -1)
;**********************************************************
 
; exit application
%macro MOS_EXIT 0
mov eax,MOS_SC_EXIT
int 0x40
%endmacro
 
; exit application, smaller version
%macro MOS_EXIT_S 0
xor eax,eax
dec eax
int 0x40
%endmacro
 
 
;**********************************************************
; wait event stuff
; (MOS_SC_WAITEVENT, syscall 10)
;**********************************************************
 
; wait for event
; destroys : nothing
; returns : eax = event type
%macro MOS_WAITEVENT 0
mov eax,MOS_SC_WAITEVENT
int 0x40
%endmacro
 
; wait for event, smaller version
; destroys : flags
; returns : eax = event type
%macro MOS_WAITEVENT_S 0
xor eax,eax
mov al,MOS_SC_WAITEVENT
int 0x40
%endmacro
 
 
;**********************************************************
; window redraw status stuff
; (MOS_SC_REDRAWSTATUS, syscall 12)
;**********************************************************
 
MOS_RS_STARTREDRAW equ 1
MOS_RS_ENDREDRAW equ 2
 
; start window redraw
; destroys: eax,ebx
%macro MOS_STARTREDRAW 0
mov ebx,MOS_RS_STARTREDRAW
mov eax,MOS_SC_REDRAWSTATUS
int 0x40
%endmacro
 
; start window redraw, smaller version
; destroys: eax,ebx,flags
%macro MOS_STARTREDRAW_S 0
xor ebx,ebx
inc ebx
xor eax,eax
mov al,MOS_SC_REDRAWSTATUS
int 0x40
%endmacro
 
; end window redraw
; destroys: eax,ebx
%macro MOS_ENDREDRAW 0
mov ebx,MOS_RS_ENDREDRAW
mov eax,MOS_SC_REDRAWSTATUS
int 0x40
%endmacro
 
; end window redraw, smaller version
; destroys: eax,ebx,flags
%macro MOS_ENDREDRAW_S 0
xor ebx,ebx
mov bl,MOS_RS_ENDREDRAW
xor eax,eax
mov al,MOS_SC_REDRAWSTATUS
int 0x40
%endmacro
 
 
;**********************************************************
; get screen max stuff (syscall 14)
;**********************************************************
 
; get screen dimensions in eax
; destroys: nothing
%macro MOS_GETSCREENMAX 0
mov eax,MOS_SC_GETSCREENMAX
int 0x40
%endmacro
 
; get screen dimensions in eax, smaller version
; destroys: flags
%macro MOS_GETSCREENMAX_S 0
xor eax,eax
mov al,MOS_SC_GETSCREENMAX
int 0x40
%endmacro
 
 
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/pcx.inc
0,0 → 1,137
; pcx.inc
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%ifndef _PCX_INC
%define _PCX_INC
 
 
;**********************************************************
; pcx header
;**********************************************************
 
PCXHEADER_SIZE equ 128
struc PCXHEADER
.id: resb 1 ; id, should be 10
.version: resb 1 ; pcx version
.encoding: resb 1 ; 1 = rle
.bpp: resb 1 ; bits per pixel
.xmin: resw 1 ; image dimensions
.ymin: resw 1
.xmax: resw 1
.ymax: resw 1
.hdpi: resw 1 ; horizontal resolution in dpi
.vdpi: resw 1 ; verttical resolution in dpi
.colormap: resb 48 ; 16 color palette
.reserved1: resb 1
.nplanes: resb 1 ; # of color planes
.bytesperline: resw 1 ; # of bytes per scanline. always even
.palinfo: resw 1 ; 1 = color/bw, 2 = grayscale
.hscreensize: resw 1 ; horizontal screen size
.vscreensize: resw 1 ; vertical screen size
.reserved2: resb 54
endstruc
 
 
section .text
 
 
 
;**********************************************************
; lousy pcx decoder. reads only 8 bit rle packed color images (pcx version 5)
; oh, and yes, currently it can't read images with an odd width.
;
; the routine does not only decode the image data, it converts
; it also to a menuetos putimage compatible format (24 bit, rrggbb)
;
; input : esi address of the pcx file in memory
; edi pointer to the memory where the depacked
; image data should go. (width*height*3 bytes)
; ebx file size in bytes
;
; output : decoded image in [edi]
;
; destroys : nothing
;
;**********************************************************
 
loadPCX:
pushad
pushfd
 
; calculate number of pixels to decode.
; this is actually wrong, because if the image has an odd
; width, there will be an unused pixel at the end of each
; scanline.
movzx eax,word [esi+PCXHEADER.xmax] ; eax = image width
sub ax,[esi+PCXHEADER.xmin]
inc eax
movzx ecx,word [esi+PCXHEADER.ymax] ; ecx = image height
sub cx,[esi+PCXHEADER.ymin]
inc ecx
mul ecx
mov ebp,eax ; ebp = # of pixels to decode
 
; move ebx to beginning of palette and
; esi to beginning of packed image data
sub ebx,768
add ebx,esi
add esi,PCXHEADER_SIZE
; decode image data
xor ecx,ecx ; clear bits 8..31 !
xor eax,eax ; "
.decode:
lodsb ; read byte from input stream
cmp al,192 ; encoded/unencoded byte ?
jae short .encoded
lea edx,[eax*2+eax] ; read color values from
mov al,[ebx+edx+2] ; palette and store them
stosb ; in the destination image
mov al,[ebx+edx+1]
stosb
mov al,[ebx+edx+0]
stosb
dec ebp ; one less to go...
jmp short .continue
.encoded:
and al,00111111b ; calc # of times to repeat
mov cl,al
lodsb ; read data byte
lea edx,[eax*2+eax] ; read color values from palette
mov al,[ebx+edx+2]
mov ah,[ebx+edx+1]
mov dl,[ebx+edx+0]
.bla: ; write color values
stosb
mov [edi],ah
inc edi
mov [edi],dl
inc edi
dec ebp ; one less to go...
loop .bla
xor ah,ah ; reset ah to 0 !
.continue:
or ebp,ebp ; all pixels decoded ?
jnz short .decode
 
popfd
popad
ret
 
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/randomai.inc
0,0 → 1,50
; C4
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This file is part of C4.
;
; C4 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; C4 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with C4; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%infdef _RANDOMAI_INC
%define _RANDOMAI_INC
 
section .text
 
 
 
;**********************************************************
; randomaiGetMove
; getmove routine for random "ai" player
;
; input : eax = cpu level (ignored by this player:)
; output : eax = move
; destroys : everything
;**********************************************************
randomaiGetMove
 
.l:
call rand ; get random number in the range [1,7]
xor edx,edx ; !
mov ebx,7
div ebx
inc edx
BOARDISVALIDMOVE edx ; is this a valid move ?
jz .l ; no -> try again
 
mov eax,edx ; return move
ret
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/red.pcx
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/c4/trunk/rng.inc
0,0 → 1,76
; C4
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This file is part of C4.
;
; C4 is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; C4 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with C4; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%ifndef _RNG_INC
%define _RNG_INC
 
section .data
 
 
; random seed
seed dd 0
 
 
 
section .text
 
 
;**********************************************************
; randomize
; initialize random number generator.
; initialization is done using the get system clock syscall
;
; input : nothing
; output : nothing
; destroys : nothing
;**********************************************************
randomize:
push eax
mov eax,MOS_SC_GETSYSCLOCK
int 0x40
mov [seed],eax
pop eax
ret
 
 
 
;**********************************************************
; rand
; return an unsigned 32 bit "random" number
;
; input : nothing
; output : eax = unsigned 32 bit random number
; destroys : nothing
;**********************************************************
rand:
pushfd
push edx
mov eax,32719
mul dword [seed]
add eax,123
xchg al,ah
rol eax,16
xchg al,ah
mov [seed],eax
pop edx
popfd
ret
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/c4/trunk/windows.inc
0,0 → 1,356
; windows.inc
; Copyright (c) 2002 Thomas Mathys
; killer@vantage.ch
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
%ifndef _WINDOWS_INC
%define _WINDOWS_INC
 
 
WND_CENTER equ (1 << 0)
WND_DEFAULT_WORKCOLOR equ (1 << 1)
WND_DEFAULT_GRABCOLOR equ (1 << 2)
WND_DEFAULT_FRAMECOLOR equ (1 << 3)
WND_DEFAULT_CAPTIONCOLOR equ (1 << 4)
WND_DEFAULT_COLORS equ (WND_DEFAULT_WORKCOLOR | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR)
 
 
struc WND
.xposandsize resd 1 ; x position and size (like syscall)
.yposandsize resd 1 ; y position and size (like syscall)
.workcolor resd 1 ; work area color (like syscall)
.grabcolor resd 1 ; grab bar color (like syscall)
.framecolor resd 1 ; frame color (like syscall)
.caption resd 1 ; pointer to caption (zero terminated)
; can be zero, if no caption is desired.
.captioncolor resd 1 ; caption color
.flags resd 1 ; combination of WND_xxx flags, or zero.
endstruc
 
 
BUTTON_COLOR_GRAB equ 0x01000000
BUTTON_COLOR_WORK equ 0x02000000
 
 
struc BUTTON
.xposandsize resd 1 ; x position and size (like syscall)
.yposandsize resd 1 ; y position and size (like syscall)
.id resd 1 ; button id
.color resd 1 ; button color. can be a real color
; or one of the BUTTON_COLOR_xxx constants
endstruc
 
 
LABEL_COLOR_GRABBUTTON equ 0x01000000 ; use grab button text default color
LABEL_COLOR_GRAB equ 0x02000000 ; use grab text default color
LABEL_COLOR_WORKBUTTON equ 0x03000000 ; use work button text default color
LABEL_COLOR_WORK equ 0x04000000 ; use work text default color
LABEL_BGCOLOR_TRANSPARENT equ 0x01000000 ; transparent
LABEL_BGCOLOR_WORK equ 0x02000000 ; use work area color
 
 
struc LABEL
.position resd 1 ; position, x in upper word, y in lower word
.caption resd 1 ; pointer to caption (zero terminated)
; if this is field is zero, the label will
; not be drawn.
.color resd 1 ; text color, or a LABEL_COLOR_xxx constant
.bgcolor resd 1 ; background color, or a LABEL_BGCOLOR_xxx constant
endstruc
 
 
section .text
 
 
;***********************************************************
; draw a window
;
; input: edi = pointer to a WND structure
; output: nothing
; destroys: nothing
; notes: you must call begin redraw/end redraw
; yourself, before and after calling
; this function.
;***********************************************************
drawWindow:
 
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
 
enter MOS_WNDCOLORS_size,0
pushfd
pushad
 
; get default window colors
mov ebx,3
lea ecx,[WNDCOLORS]
mov edx,MOS_WNDCOLORS_size
mov eax,MOS_SC_WINDOWPROPERTIES
int 0x40
 
;
; window position
;
test dword [edi + WND.flags],WND_CENTER ; center window ?
jnz short .center
mov ebx,[edi + WND.xposandsize] ; nope -> just load dimensions
mov ecx,[edi + WND.yposandsize]
jmp short .positionok
.center: ; so let's center this window...
MOS_GETSCREENMAX ; get screen dimensions
mov ebx,eax ; xpos = (screenx-width)/2
shr ebx,16
sub bx,[edi + WND.xposandsize]
jns short .xok
xor ebx,ebx
.xok:
shl ebx,15 ; / 2, move result to hi-word
mov bx,[edi + WND.xposandsize]
movzx ecx,ax ; same for ypos
sub cx,[edi + WND.yposandsize]
jns short .yok
xor ecx,ecx
.yok:
shl ecx,15
mov cx,[edi + WND.yposandsize]
.positionok: ; ebx/ecx contain dimensions
 
;
; colors
;
push edi
mov edx,[edi + WND.workcolor]
test dword [edi + WND.flags],WND_DEFAULT_WORKCOLOR
jz short .workcolorok
and edx,0xff000000
or edx,[WNDCOLORS + MOS_WNDCOLORS.work]
.workcolorok:
mov esi,[edi + WND.grabcolor]
test dword [edi + WND.flags],WND_DEFAULT_GRABCOLOR
jz short .grabcolorok
and esi,0xff000000
or esi,[WNDCOLORS + MOS_WNDCOLORS.grab]
.grabcolorok:
test dword [edi + WND.flags],WND_DEFAULT_FRAMECOLOR
mov edi,[edi + WND.framecolor]
jz short .framecolorok
and edi,0xff000000
or edi,[WNDCOLORS + MOS_WNDCOLORS.frame]
.framecolorok:
 
; define window
mov eax,MOS_SC_DEFINEWINDOW
int 0x40
pop edi
 
;
; caption
;
cmp dword [edi + WND.caption],0 ; is there a caption ?
je short .captionok ; nope -> do nothing
mov ebx,MOS_DWORD(8,8) ; ebx = position
mov edx,[edi + WND.caption] ; edx -> string
push edi ; get string length
mov edi,edx
mov ecx,-1
xor al,al ; scan for zero byte
repne scasb
sub edi,edx
dec edi
mov esi,edi
pop edi ; esi = string length
mov ecx,[edi + WND.captioncolor]
test dword [edi + WND.flags],WND_DEFAULT_CAPTIONCOLOR
jz short .captioncolorok
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText]
.captioncolorok:
mov eax,MOS_SC_WRITETEXT
int 0x40
.captionok:
 
popad
popfd
leave
ret
%undef WNDCOLORS
 
 
;***********************************************************
; draw a bunch of buttons
;
; input: edi = pointer to an array of BUTTON structs
; ecx = # of buttons to draw
; output: nothing
; destroys: nothing
; notes: you must call begin redraw/end redraw yourself
;***********************************************************
 
drawButtons:
 
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
 
or ecx,ecx
jnz short .ok
ret
.ok:
enter MOS_WNDCOLORS_size,0
pushfd
pushad
; get default window colors
push ecx
mov ebx,3
lea ecx,[WNDCOLORS]
mov edx,MOS_WNDCOLORS_size
mov eax,MOS_SC_WINDOWPROPERTIES
int 0x40
pop ecx
.drawall:
push ecx
mov ebx,[edi + BUTTON.xposandsize]
mov ecx,[edi + BUTTON.yposandsize]
mov edx,[edi + BUTTON.id]
mov esi,[edi + BUTTON.color]
cmp esi,BUTTON_COLOR_GRAB ; use a default color ?
jne .ok1
mov esi,[WNDCOLORS + MOS_WNDCOLORS.grabButton]
.ok1:
cmp esi,BUTTON_COLOR_WORK
jne .ok2
mov esi,[WNDCOLORS + MOS_WNDCOLORS.workButton]
.ok2:
mov eax,MOS_SC_DEFINEBUTTON
int 0x40
add edi,BUTTON_size
pop ecx
loop .drawall
popad
popfd
leave
ret
%undef WNDCOLORS
 
 
;***********************************************************
; draw a bunch of labels
;
; input: edi = pointer to an array of LABEL structs
; ecx = # of labels to draw
; output: nothing
; destroys: nothing
;***********************************************************
 
drawLabels:
 
%define WNDCOLORS ebp-MOS_WNDCOLORS_size
 
or ecx,ecx
jnz short .ok
ret
.ok:
enter MOS_WNDCOLORS_size,0
pushfd
pushad
; get default window colors
push ecx
mov ebx,3
lea ecx,[WNDCOLORS]
mov edx,MOS_WNDCOLORS_size
mov eax,MOS_SC_WINDOWPROPERTIES
int 0x40
pop ecx
.drawall:
push ecx
cmp dword [edi + LABEL.caption],0
jne short .notnull
jmp .next
.notnull:
; get caption length
push edi
mov edi,[edi + LABEL.caption]
mov ecx,-1
xor al,al
repne scasb ; search for zero byte
mov esi,edi
pop edi
sub esi,[edi + LABEL.caption]
dec esi ; esi = string length
; clear background, if necessary
cmp dword [edi + LABEL.bgcolor],LABEL_BGCOLOR_TRANSPARENT
je .clearok
mov ebx,[edi + LABEL.position] ; ebx = xstart/width
mov eax,esi ; width = stringlength * 6
mov edx,6
mul edx
mov bx,ax
mov ecx,[edi + LABEL.position] ; ecx = ystart/height
shl ecx,16
mov cx,8
mov edx,[edi + LABEL.bgcolor]
cmp edx,LABEL_BGCOLOR_WORK
jne short .bgcolorok
mov edx,[WNDCOLORS + MOS_WNDCOLORS.work]
.bgcolorok:
mov eax,MOS_SC_DRAWBAR
int 0x40
.clearok:
 
; draw label
mov ebx,[edi + LABEL.position] ; ebx = label position
mov edx,[edi + LABEL.caption] ; edx -> caption
mov ecx,[edi + LABEL.color] ; ecx = color
cmp ecx,LABEL_COLOR_GRABBUTTON
jne short .ok1
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabButtonText]
.ok1:
cmp ecx,LABEL_COLOR_GRAB
jne short .ok2
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText]
.ok2:
cmp ecx,LABEL_COLOR_WORKBUTTON
jne short .ok3
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workButtonText]
.ok3:
cmp ecx,LABEL_COLOR_WORK
jne short .ok4
mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workText]
.ok4:
mov eax,MOS_SC_WRITETEXT
int 0x40
 
.next
add edi,LABEL_size ; next label
pop ecx
dec ecx
jz .done
jmp .drawall
.done:
 
popad
popfd
leave
ret
%undef WNDCOLORS
 
 
%endif
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/chess/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm chess.asm chess
@pause
/programs/games/chess/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm chess.asm chess
@pause
/programs/games/chess/trunk/chess.asm
0,0 → 1,1323
;
; CHESS CLIENT for CHESSCLUB.COM (VT)
;
; Compile with FASM for Menuet
;
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
; esp = 0x7FFF0
dd 0x00000000 ; reserved=no extended header
include 'lang.inc'
include 'macros.inc'
file_info:
dd 0,0,-1,0x4000,0x20000
db '/rd/1/chess.bmp',0
pawn_color:
dd 0x000000
dd 0x222222
dd 0x444444
dd 0xf0f0f0
dd 0xc0c0c0
dd 0xa0a0a0
dd 0xa0a0a0
dd 0x707070
dd 0xb0b0b0
dd 0xc0c0c0
dd 0xd0d0d0
dd 0xd8d8d8
dd 0xe0e0e0
dd 0xe8e8e8
dd 0x00ff00
dd 0xffffff
texts equ board_old+80*30
text equ texts+80*32*4
START: ; start of execution
mov eax,58
mov ebx,file_info
int 0x40
mov esi,0x4000+22*3+4+24*2
mov edi,0x10000+18*3
mov ebx,0
mov ecx,0
newp:
xor eax,eax
mov al,[esi]
and al,0xf0
shr al,4
shl eax,2
mov eax,[pawn_color+eax]
mov [edi+0],eax
xor eax,eax
mov al,[esi]
and al,0x0f
shl eax,2
mov eax,[pawn_color+eax]
mov [edi+3],eax
add edi,6
add esi,1
inc ebx
cmp ebx,23
jbe newp
sub edi,12
mov ebx,0
inc ecx
cmp ecx,279
jb newp
; Clear the screen memory
mov eax, ' '
mov edi,text
mov ecx,80*30 /4
cld
rep stosd
call draw_window
still:
call check_for_board
call board_changed
call draw_board
; check connection status
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
mov ebx, [socket_status]
mov [socket_status], eax
cmp eax, ebx
je waitev
call display_status
waitev:
mov eax,23 ; wait here for event
mov ebx,20
int 0x40
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
; any data from the socket?
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
cmp eax, 0
jne read_input
jmp still
read_input:
push ecx
mov eax, 53
mov ebx, 3
mov ecx, [socket]
int 0x40
pop ecx
call handle_data
push ecx
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
pop ecx
cmp eax, 0
jne read_input
call draw_text
jmp still
check_for_board:
pusha
mov esi,text-80
news:
add esi,80
cmp esi,text+80*10
je board_not_found
cmp [esi+12],dword '----'
je cfb1
jmp news
cfb1:
cmp [esi+16*80+12],dword '----'
je cfb2
jmp news
cfb2:
cmp [esi+2*80+12],dword '+---'
jne news
cmp [esi+4*80+12],dword '+---'
jne news
board_found:
mov edi,chess_board
mov ecx,80*18
cld
rep movsb
board_not_found:
popa
ret
yst dd 150
textx equ 10
ysts equ 410
boardx dd 45
boardy dd 45
boardxs dd 44
boardys dd 44
conx equ 420
cony equ 118
dconx equ 420
dcony equ 148
statusx equ 420
statusy equ 178
drsq:
push eax ebx
mov ecx,ebx
mov ebx,eax
mov eax,ebx
add eax,ecx
imul ebx,[boardxs]
add ebx,[boardx]
shl ebx,16
imul ecx,[boardys]
add ecx,[boardy]
shl ecx,16
add ebx,[boardxs]
add ecx,[boardys]
mov edx,[sq_black]
test eax,1
jnz dbl22
mov edx,[sq_white]
dbl22:
mov eax,13
int 0x40
pop ebx eax
ret
draw_pawn:
; edi,0 ; white / black
; esi,0 ; from position 2 , 20 square
; eax,2 ; board x
; ebx,0 ; board y
pusha
call drsq
cmp esi,20
jne no_sqd
popa
ret
no_sqd:
imul eax,[boardxs]
imul ebx,[boardys]
add eax,[boardx]
add ebx,[boardy]
imul esi,44*45*3
add esi,0x10000+18*3
mov ecx,43
dp0:
pusha
mov ecx,44
ldp1:
pusha
mov ecx,ebx
mov ebx,eax
mov edx,[esi]
and edx,0xffffff
mov eax,1
cmp edx,0x00ff00
je nowp
cmp edi,1
jne nobl
shr edx,1
and edx,0x7f7f7f
nobl:
int 0x40
nowp:
popa
add esi,3
add eax,1
dec ecx
jnz ldp1
popa
add ebx,1
add esi,3*44
dec ecx
jnz dp0
popa
ret
board_changed:
pusha
mov eax,0
mov esi,chess_board
bcl1:
add eax,[esi]
add esi,4
cmp esi,chess_board+19*80
jb bcl1
cmp eax,[checksum]
je bcl2
mov [changed],1
bcl2:
mov [checksum],eax
popa
ret
checksum dd 0
changed db 1
draw_board:
pusha
cmp [changed],1
jne no_change_in_board
mov [changed],0
mov eax,0
mov ebx,0
scan_board:
push eax ebx
mov esi,ebx
imul esi,2
imul esi,80
add esi,80
imul eax,4
add eax,10
add esi,eax
movzx edx,word [chess_board+esi]
cmp dx,[board_old+esi]
je empty_slot
mov ecx,13
newseek2:
mov edi,ecx
imul edi,8
sub edi,8
cmp dx,[edi+nappulat]
je foundnappula2
loop newseek2
jmp empty_slot
foundnappula2:
mov esi,[edi+nappulat+4]
mov edi,0
cmp dl,'*'
jne nnbb
mov edi,1
nnbb:
mov eax,[esp+4]
mov ebx,[esp]
call draw_pawn
empty_slot:
pop ebx eax
inc eax
cmp eax,8
jb scan_board
mov eax,0
inc ebx
cmp ebx,8
jb scan_board
mov esi,chess_board
mov edi,board_old
mov ecx,80*19
cld
rep movsb
mov eax,13
mov ebx,[boardx]
sub ebx,14
shl ebx,16
add ebx,8
mov ecx,[boardy]
shl ecx,16
add ecx,46*8
mov edx,[wcolor]
int 0x40
mov eax,4 ; numbers at left
mov ebx,[boardx]
sub ebx,14
shl ebx,16
add ebx,[boardy]
add ebx,18
mov ecx,[tcolor]
mov edx,chess_board+80+5
mov esi,3
db1:
int 0x40
add edx,80*2
add ebx,[boardxs]
cmp edx,chess_board+80*16
jb db1
mov eax,13
mov ebx,[boardx]
shl ebx,16
add ebx,8*46
mov ecx,[boardys]
imul ecx,8
add ecx,[boardy]
add ecx,8
shl ecx,16
add ecx,10
mov edx,[wcolor]
int 0x40
mov eax,4 ; letters at bottom
mov ebx,[boardx]
add ebx,3
shl ebx,16
mov bx,word [boardys]
imul bx,8
add ebx,[boardy]
add ebx,8
mov ecx,[tcolor]
mov edx,chess_board+80*17+8
mov esi,4
db3:
int 0x40
mov edi,[boardxs]
shl edi,16
add ebx,edi
add edx,4
cmp edx,chess_board+80*17+8+4*8
jb db3
; print player times
mov edi,74
cmp [chess_board+80+5],byte '1'
jne nowww2
mov edi,371
nowww2:
mov eax,13
mov ebx,(conx)*65536+100
mov ecx,edi
shl ecx,16
add ecx,10
mov edx,[wcolor]
int 0x40
mov eax,4
mov ebx,(conx)*65536
add ebx,edi
mov ecx,[tcolor]
mov edx,chess_board+80*7+59-1
mov esi,20
int 0x40
mov edi,74
cmp [chess_board+80+5],byte '1'
je nowww
mov edi,371
nowww:
mov eax,13
mov ebx,(conx)*65536+100
mov ecx,edi
shl ecx,16
add ecx,10
mov edx,[wcolor]
int 0x40
mov eax,4
mov ebx,(conx)*65536
add ebx,edi
mov ecx,[tcolor]
mov edx,chess_board+80*9+59-1
mov esi,20
int 0x40
; move #
mov eax,13
mov ebx,conx*65536+120
mov ecx,200*65536+10
mov edx,[wcolor]
int 0x40
mov eax,4
mov ebx,conx*65536
add ebx,200
mov ecx,[tcolor]
mov edx,chess_board+80*1+46
mov esi,30
int 0x40
no_change_in_board:
popa
ret
handle_data:
; Telnet servers will want to negotiate options about our terminal window
; just reject them all.
; Telnet options start with the byte 0xff and are 3 bytes long.
mov al, [telnetstate]
cmp al, 0
je state0
cmp al, 1
je state1
cmp al, 2
je state2
jmp hd001
state0:
cmp bl, 255
jne hd001
mov al, 1
mov [telnetstate], al
ret
state1:
mov al, 2
mov [telnetstate], al
ret
state2:
mov al, 0
mov [telnetstate], al
mov [telnetrep+2], bl
mov edx, 3
mov eax,53
mov ebx,7
mov ecx,[socket]
mov esi, telnetrep
int 0x40
ret
hd001:
cmp bl,13 ; BEGINNING OF LINE
jne nobol
mov ecx,[pos]
add ecx,1
boll1:
sub ecx,1
mov eax,ecx
xor edx,edx
mov ebx,80
div ebx
cmp edx,0
jne boll1
mov [pos],ecx
call check_for_board
jmp newdata
nobol:
cmp bl,10 ; LINE DOWN
jne nolf
addx1:
add [pos],dword 1
mov eax,[pos]
xor edx,edx
mov ecx,80
div ecx
cmp edx,0
jnz addx1
mov eax,[pos]
jmp cm1
nolf:
cmp bl,9 ; TAB
jne notab
add [pos],dword 8
jmp newdata
notab:
cmp bl,8 ; BACKSPACE
jne nobasp
mov eax,[pos]
dec eax
mov [pos],eax
mov [eax+text],byte 32
mov [eax+text+60*80],byte 0
jmp newdata
nobasp:
cmp bl,15 ; CHARACTER
jbe newdata
mov eax,[pos]
mov [eax+text],bl
mov eax,[pos]
add eax,1
cm1:
mov ebx,[scroll+4]
imul ebx,80
cmp eax,ebx
jb noeaxz
mov esi,text+80
mov edi,text
mov ecx,ebx
cld
rep movsb
mov eax,ebx
sub eax,80
noeaxz:
mov [pos],eax
newdata:
ret
red: ; REDRAW WINDOW
call draw_window
jmp still
key: ; KEY
mov eax,2 ; send to modem
int 0x40
mov ebx, [socket_status]
cmp ebx, 4 ; connection open?
jne still ; no, so ignore key
shr eax,8
cmp eax,178 ; ARROW KEYS
jne noaup
mov al,'A'
call arrow
jmp still
noaup:
cmp eax,177
jne noadown
mov al,'B'
call arrow
jmp still
noadown:
cmp eax,179
jne noaright
mov al,'C'
call arrow
jmp still
noaright:
cmp eax,176
jne noaleft
mov al,'D'
call arrow
jmp still
noaleft:
modem_out:
call to_modem
jmp still
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,1 ; CLOSE PROGRAM
jne noclose
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
mov eax,-1
int 0x40
noclose:
cmp ah, 4 ; connect
jne notcon
mov eax, [socket_status]
cmp eax, 4
je still
call connect
jmp still
notcon:
cmp ah,5 ; disconnect
jne notdiscon
call disconnect
jmp still
notdiscon:
jmp still
arrow:
push eax
mov al,27
call to_modem
mov al,'['
call to_modem
pop eax
call to_modem
ret
to_modem:
pusha
push ax
mov [tx_buff], al
mov edx, 1
cmp al, 13
jne tm_000
mov edx, 2
tm_000:
mov eax,53
mov ebx,7
mov ecx,[socket]
mov esi, tx_buff
int 0x40
pop bx
mov al, [echo]
cmp al, 0
je tm_001
push bx
call handle_data
pop bx
cmp bl, 13
jne tm_002
mov bl, 10
call handle_data
tm_002:
call draw_text
tm_001:
popa
ret
disconnect:
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
ret
connect:
pusha
mov ecx, 1000 ; local port starting at 1000
getlp:
inc ecx
push ecx
mov eax, 53
mov ebx, 9
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
mov eax,53
mov ebx,5
mov dl, [ip_address + 3]
shl edx, 8
mov dl, [ip_address + 2]
shl edx, 8
mov dl, [ip_address + 1]
shl edx, 8
mov dl, [ip_address]
mov esi, edx
movzx edx, word [port] ; telnet port id
mov edi,1 ; active open
int 0x40
mov [socket], eax
popa
ret
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
pusha
mov eax,12
mov ebx,1
int 0x40
mov eax,14
int 0x40
mov ebx,eax
mov ecx,eax
shr ebx,16
and ebx,0xffff
and ecx,0xffff
shr ebx,1
shr ecx,1
sub ebx,275
sub ecx,235
shl ebx,16
shl ecx,16
mov eax,0 ; DRAW WINDOW
mov bx,550
mov cx,470
mov edx,[wcolor]
add edx,0x03000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
call display_status
mov eax,8 ; BUTTON 4: Connect
mov ebx,conx*65536+80
mov ecx,cony*65536+15
mov esi,[wbutton]
mov edx,4
int 0x40
mov eax,4 ; Button text
mov ebx,(conx+4)*65536+cony+4
mov ecx,0xffffff
mov edx,cont
mov esi,conlen-cont
int 0x40
mov eax,8 ; BUTTON 5: disconnect
mov ebx,dconx*65536+80
mov ecx,dcony*65536+15
mov edx,5
mov esi,[wbutton]
int 0x40
mov eax,4 ; Button text
mov ebx,(dconx+4)*65536+dcony+4
mov ecx,0x00ffffff
mov edx,dist
mov esi,dislen-dist
int 0x40
xor eax,eax
mov edi,text+80*30
mov ecx,80*30 /4
cld
rep stosd
call draw_text
mov [changed],1
mov edi,board_old
mov ecx,80*19
mov al,0
cld
rep stosb
mov eax,4
mov ebx,conx*65536+52
mov ecx,[tcolor]
mov edx,quick_start
mov esi,30
prqs:
int 0x40
add ebx,10
add edx,30
cmp [edx],byte 'x'
jne prqs
mov eax,12
mov ebx,2
int 0x40
popa
ret
display_status:
pusha
; draw status bar
mov eax, 13
mov ebx, statusx*65536+80
mov ecx, statusy*65536 + 16
mov edx, [wcolor]
int 0x40
mov esi,contlen-contt ; display connected status
mov edx, contt
mov eax, [socket_status]
cmp eax, 4 ; 4 is connected
je pcon
mov esi,discontlen-discontt
mov edx, discontt
pcon:
mov eax,4 ; status text
mov ebx,statusx*65536+statusy+2
mov ecx,[tcolor]
int 0x40
popa
ret
nappulat:
dd '*P ',5
dd '*K ',3
dd '*Q ',4
dd '*R ',0
dd '*N ',1
dd '*B ',2
dd ' ',20
dd 'P ',5
dd 'K ',3
dd 'Q ',4
dd 'R ',0
dd 'N ',1
dd 'B ',2
row dd 0x0
col dd 0x0
draw_text:
mov esi,text+80*24
mov edi,texts+80*3
dtl1:
cmp [esi],dword 'logi'
je add_text
cmp [esi],dword 'aics'
je add_text
cmp [esi],dword 'You '
je add_text
cmp [esi],dword 'Your'
je add_text
cmp [esi],dword 'Game'
je add_text
cmp [esi],dword 'Ille'
je add_text
cmp [esi],dword 'No s'
je add_text
sub esi,80
cmp esi,text
jge dtl1
dtl2:
mov eax,13
mov ebx,10*65536+532
mov ecx,420*65536+40
mov edx,[wtcom]
int 0x40
mov eax,4
mov ebx,10*65536+420
mov ecx,[wtxt]
mov edx,texts
mov esi,80
dtl3:
int 0x40
add edx,80
add ebx,10
cmp edx,texts+4*80
jb dtl3
ret
add_text:
pusha
cld
mov ecx,80
rep movsb
popa
sub esi,80
sub edi,80
cmp edi,texts
jb dtl2
jmp dtl1
read_string:
mov edi,string
mov eax,'_'
mov ecx,[string_length]
inc ecx
cld
rep stosb
call print_text
mov edi,string
f11:
mov eax,10
int 0x40
cmp eax,2
jne read_done
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je read_done
cmp eax,8
jnz nobsl
cmp edi,string
jz f11
sub edi,1
mov [edi],byte '_'
call print_text
jmp f11
nobsl:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
sub eax,32
keyok:
mov [edi],al
call print_text
inc edi
mov esi,string
add esi,[string_length]
cmp esi,edi
jnz f11
read_done:
call print_text
ret
print_text:
pusha
mov eax,13
mov ebx,[string_x]
shl ebx,16
add ebx,[string_length]
imul bx,6
mov ecx,[string_y]
shl ecx,16
mov cx,8
mov edx,[wcolor]
int 0x40
mov eax,4
mov ebx,[string_x]
shl ebx,16
add ebx,[string_y]
mov ecx,[tcolor]
mov edx,string
mov esi,[string_length]
int 0x40
popa
ret
; DATA AREA
telnetrep db 0xff,0xfc,0x00
telnetstate db 0
string_length dd 16
string_x dd 200
string_y dd 60
string db '________________'
tx_buff db 0, 10
ip_address db 204,178,125,65
port dw 5051 ; 0,0
echo db 1
socket dd 0x0
socket_status dd 0x0
pos dd 80 * 22
scroll dd 1
dd 24
wbutton dd 0x336688
wtcom dd 0x336688 ; 0x666666
wtxt dd 0xffffff
wcolor dd 0xe0e0e0
tcolor dd 0x000000
sq_black dd 0x336688 ; 666666
sq_white dd 0xffffff
labelt db 'Chess Client for Chessclub.com - v0.1'
labellen:
setipt db ' . . .'
setiplen:
setportt db ' '
setportlen:
cont db 'Connect'
conlen:
dist db 'Disconnect'
dislen:
contt db 'Connected'
contlen:
discontt db 'Disconnected'
discontlen:
echot db 'Echo On'
echolen:
echoot db 'Echo Off'
echoolen:
quick_start:
db '( OPPONENT ) '
times 16 db ' 1'
db 'Quick start: '
db ' '
db '1 Connect '
db '2 login: "guest" '
db '3 aics% "seek 10 0" '
db ' (for a player) '
db ' (wait) '
db '4 Play eg. "e7e5" '
db ' or "d2d4" '
db '5 aics% "resign" '
db ' (quit game) '
db '6 Disconnect '
times 5 db ' '
db '( YOU ) '
db 'x'
chess_board:
times 80 db 0
db ' 8 *R *N *B *Q *K *B *N *R'
db ' '
times 80 db 0
db ' 7 *P *P *P *P *P *P *P *P'
db ' '
times 80 db 0
db ' 6 '
db ' '
times 80 db 0
db ' 5 '
db ' '
times 80 db 0
db ' 4 '
db ' '
times 80 db 0
db ' 3 '
db ' '
times 80 db 0
db ' 2 P P P P P P P P '
db ' '
times 80 db 0
db ' 1 R N B Q K B N R '
db ' '
times 80 db 0
db ' a b c d e f g h '
db ' '
times 80*20 db 0
board_old:
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/chess/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/life/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm life.asm life
@pause
/programs/games/life/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm life.asm life
@pause
/programs/games/life/trunk/life.asm
0,0 → 1,254
;
; LIFE.ASM
;
; This program displays Conways game of life
;
; Compile with FASM v1.49 for DOS;
;
; Version 0.1a 20th May 2004
; Ivan Poddubny
;
; Version 0.1 30th March 2004
; Mike Hibbett
;
; This is an experiment to see how small a usefull application can get
 
include "lang.inc"
include "macros.inc"
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0xc1000 ; memory for app
dd 0xc1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;include "DEBUG.INC"
macro setcell x,y { mov [esi + 512*(y)*3 + (x)*3], al }
 
START:
 
mov al, 0xFF
mov esi, I_END
 
; This is the seed pattern.
 
; Life needs a seed pattern, which is 'hardcode' at compile time
; The grid is 512 wide (x direction) by 512 deep (y direction)
; setcell take the arguments setcell x,y
; 0,0 is the top left corner.
 
; setcell 200,120
; setcell 201,120
; setcell 200,121
; setcell 199,121
; setcell 200,122
 
; setcell 70,120
; setcell 71,120
; setcell 70,121
; setcell 69,121
; setcell 70,122
 
mov eax, 40
mov ebx, 100101b
int 0x40
 
call draw_window
 
still:
 
; mov eax, 23 ; wait here for event
; mov ebx, 5
; int 0x40
mov eax, 11
int 0x40
 
test eax, eax
je nokey
cmp eax,1 ; redraw request ?
je red
cmp eax,3 ; button in buffer ?
je button
cmp eax,6
je mouse
 
jmp still
 
 
mouse:
mov eax, 37
mov ebx, 2
int 0x40
test eax, eax
jz still
 
mov eax, 37
mov ebx, 1
int 0x40
sub eax, 5*65536+20
mov ebx, eax
shr eax, 16
and ebx, 0xffff
 
; WRITE COORDINATES
; dpd eax
; dps " "
; dpd ebx
; dps <10,13>
 
cmp ax, 0
js still
cmp bx, 0
js still
 
shl ebx, 9
add ebx, eax
imul ebx, 3
add ebx, I_END
mov [ebx], dword 0xFFFFFFFF
jmp draw
 
red: ; REDRAW WINDOW
call draw_window
jmp still
 
 
nokey:
; cycle life state
 
mov eax,5
mov ebx,5
int 0x40
 
mov esi, I_END + 512*3
 
mov al, 0xFF
 
lifeloop:
mov ah, 0
cmp [esi - 3], al
jne t2
inc ah
t2:
cmp [esi + 3], al
jne t3
inc ah
t3:
cmp [esi - 512*3], al
jne t4
inc ah
t4:
cmp [esi + 512*3], al
jne t5
inc ah
t5:
cmp [esi - 512*3 - 3], al
jne t6
inc ah
t6:
cmp [esi - 512*3 + 3], al
jne t7
inc ah
t7:
cmp [esi + 512*3 - 3], al
jne t8
inc ah
t8:
cmp [esi + 512*3 + 3], al
jne tend
inc ah
 
tend:
; If cell is empty but has 3 neigbours, birth
; If cell is occupied and has 2,3 neigbours, live
; else die
 
cmp ah, 3
jne btest
mov [esi+1], al
jmp nextcell
 
btest:
cmp ah, 2
jne nextcell
cmp [esi], al
jne nextcell
mov [esi+1], al
 
nextcell:
add esi, 3
cmp esi, I_END + 512*512*3
jne lifeloop
 
; copy new generation across
 
 
mov ecx, 512*512*3
mov esi, I_END+1
mov edi, I_END
rep movsb ; copy the data across
 
mov ecx, 512*512
mov esi, I_END
nc1:
mov [esi+2], byte 0
add esi, 3
loop nc1
draw:
mov ebx, I_END
mov ecx, 512*65536+512
mov edx, 5*65536+22
mov eax,7
int 0x40
 
jmp still
 
button: ; BUTTON - only close supported
or eax,-1
int 0x40
 
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
mov eax,12
mov ebx,1
int 0x40
 
mov eax,0 ; open window
mov ebx,50*65536+512+9
mov ecx,50*65536+512+22+4
mov edx,0x03000000
int 0x40
 
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x10ffffff
mov edx,header
mov esi,header.size
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
 
; DATA AREA
 
header db 'Life'
.size = $ - header
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/life/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/mblocks/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mblocks.asm mblocks
@pause
/programs/games/mblocks/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mblocks.asm mblocks
@pause
/programs/games/mblocks/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/mblocks/trunk/mblocks.asm
0,0 → 1,1642
;
; Memory Blocks for Menuet v0.1
; Crown Soft (c) crown_s@rambler.ru
;
; Compile with FASM for Menuet
;
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x4000 ; memory for app
dd 0x4000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'macros.inc'
labelt db 'Memory Blocks for Menuet v0.1 Crown Soft (c)'
labellen:
 
 
 
START: ; start of execution
call initpict
 
still:
mov eax,10 ; wait here for event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
 
cmp ah,1 ; button id=1 ?
jz close
 
cmp ah,100 ; button id=100 ?
jz init
 
movzx ebx,ah
 
dec bl
dec bl ; bl -number bitton
mov al,[bitstat+ebx*1]
cmp al,1 ; is pictures on bitton?
jz still
 
inc [nkeydown]
 
cmp [firstbit],0xff
jz tofirst
 
cmp [secondbit],0xff
jz tosecond
 
 
movzx eax,[firstbit]
mov [bitstat+eax*1],0
 
mov al,[secondbit]
mov [bitstat+eax*1],0
 
mov [secondbit],0xff
 
 
tofirst:
mov [firstbit],bl
mov [bitstat+ebx*1],1
call draw_window
jmp still
 
tosecond:
mov [secondbit],bl
mov [bitstat+ebx*1],1
 
mov al,[bitpict+ebx*1]
mov bl,[firstbit] ; comply pictures on first bitton
cmp [bitpict+ebx*1],al ; with pictures on second
jnz tosm1
mov [firstbit] ,0xff
mov [secondbit],0xff
tosm1:
 
call draw_window
jmp still
 
init:
call initpict
jmp still
 
close:
mov eax,-1 ; close program
int 0x40
 
 
 
;======================================================================
;=============== WINDOW DEFINITIONS AND DRAW ========================
;======================================================================
draw_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+413 ; [x start] *65536 + [x size]
mov ecx,100*65536+295 ; [y start] *65536 + [y size]
mov edx,0x83000000 ; color of work area RRGGBB,8->color gl
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl
mov edi,0x005080d0 ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ddeeff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
 
; ; CLOSE BUTTON
; mov eax,8 ; function 8 : define and draw button
; mov ebx,(411-19)*65536+12 ; [x start] *65536 + [x size]
; mov ecx,5*65536+12 ; [y start] *65536 + [y size]
; mov edx,1 ; button id
; mov esi,0x6688dd ; button color RRGGBB
; int 0x40
 
; init BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,10*65536+55 ; [x start] *65536 + [x size]
mov ecx,270*65536+12 ; [y start] *65536 + [y size]
mov edx,100 ; button id
mov esi,0x6688dd ; button color RRGGBB
int 0x40
; NEW GAME LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,15*65536+273 ; [x start] *65536 + [y start]
mov ecx,0x00ddeeff ; color of text RRGGBB
mov edx,labnew ; pointer to text beginning
mov esi,labnewlen-labnew ; text length
int 0x40
 
mov ebx,40001h
mov ecx,nkeydown
mov edx,135*65536+273
mov esi,0x00ffffff
mov eax,47
int 0x40
 
 
;--- draw buttons ---
mov [bitid],2
mov ecx,10
drm1:
mov ebx,ecx
mov ecx,6
drm2:
pushad
; BUTTON
imul bx,bx,40
sub bx,30
shl ebx,16
mov bx,34 ; ebx=[x start]*65536+[x size]
 
imul cx,cx,40
sub cx,13
shl ecx,16
mov cx,34 ; ecx=[y start]*65536+[y size]
 
movzx edx,[bitid] ; button id
 
mov esi,[coltbl+16*4] ; button color RRGGBB
mov eax,8 ; function 8 : define and draw button
int 0x40
 
; PICTURE
dec edx
dec edx
; edx - number of bitton
mov al,[bitstat+edx*1]
cmp al,0
jz drm3
movzx eax,[bitpict+edx*1] ; al - number of picture
call unpack
 
mov edx,ebx
shr ecx,16
mov dx,cx ; ecx=[x size]*65536+[y size]
add edx,10001h
 
mov ebx,mas
mov ecx,32*65536+32 ; image size
mov eax,7 ; function 7 : putimage
int 0x40
drm3:
 
inc [bitid]
popad
loop drm2
mov ecx,ebx
loop drm1
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
;========== put pictures number eax to mas ==================================
unpack:
pushad
cld
mov esi,[pict+eax*4]
 
mov edi, mas
 
lodsb ; al - mask color
mov dl,al ; dl - mask color
 
xor ecx,ecx
m2:
xor eax,eax
lodsb
mov cl,al
and cl,0Fh
shr al,4
 
cmp al,dl ; is color mask?
jnz m5
mov al,16
m5:
 
cmp cl,ch ; ch=00h
jz m1
mov eax,[coltbl+eax*4]
m3:
stosd
dec edi
loop m3
jmp m2
 
m1:
 
mov eax,[coltbl+16*4]
m7:
cmp edi,1024*3+mas
jnb m6
stosd
dec edi
jmp m7
 
m6:
popad
ret
;============================================================================
 
;============================= initpict =====================================
initpict:
pushad
mov edi,nkeydown
 
mov ecx,60+4
xor al,al
rep stosb ; nkeydown=0 bitstat=0
 
mov ecx,60+2
mov al,0ffh
rep stosb ; bitpict=0ffh firstbit=0ffh secondbit=0ffh
 
; Initialize RND
mov eax,3
int 0x40 ; eax=00SSMMHH
rol eax,16 ; eax=MMHH00SS - fist random number
 
mov ebx,8088405h
 
mov ecx,30
ck1:
ck2:
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
movzx edx,al
and dl,3fh
 
cmp dl,59
ja ck2
 
cmp [bitpict+edx*1],0ffh
jnz ck2
dec cl
mov [bitpict+edx*1],cl
inc cl
 
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
ck3:
mul ebx ; compute next random number
inc eax ; new := 8088405h * old + 1
 
movzx edx,al
and dl,3fh
 
cmp dl,59
ja ck3
 
cmp [bitpict+edx*1],0ffh
jnz ck3
dec cl
mov [bitpict+edx*1],cl
inc cl
 
loop ck1
 
call draw_window
popad
ret
 
;======================================================================
;======================== DATA AREA ===================================
;======================================================================
 
 
 
;----------------------- Compressed pictures --------------------------
 
key1 db 1 ; this color will background
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Dh ; each byte is 0CNh
db 005h,01Fh,01Ah,002h,0F1h,071h,0F1h,071h ; there C - color
db 0F1h,002h,01Fh,017h,001h,071h,0F1h,071h ; N - number pixels
db 0F1h,071h,0F1h,071h,0F1h,071h,001h,01Fh ;
db 011h,002h,012h,001h,071h,0F1h,071h,0F1h ; byte 0X0h - end of picture
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,001h
db 01Fh,001h,0F1h,001h,011h,001h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,001h,012h,00Eh,071h,002h,072h,0F1h
db 071h,0F1h,071h,0F1h,071h,003h,071h,0F1h
db 002h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,077h,0F1h
db 071h,0F1h,071h,001h,083h,001h,071h,002h
db 07Fh,074h,0F1h,071h,0F1h,071h,0F1h,001h
db 013h,001h,0F1h,001h,011h,001h,07Fh,074h
db 0F1h,071h,0F1h,071h,001h,013h,001h,071h
db 001h,012h,00Fh,001h,072h,0F1h,071h,0F1h
db 071h,0F1h,071h,003h,071h,0F1h,001h,013h
db 001h,082h,003h,084h,002h,081h,001h,011h
db 001h,072h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,001h,015h,002h,013h,004h
db 011h,002h,012h,001h,071h,0F1h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,001h
db 01Fh,015h,001h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,001h,01Fh,016h,081h
db 002h,0F1h,071h,0F1h,071h,0F1h,002h,081h
db 01Fh,011h,081h,013h,081h,011h,081h,011h
db 005h,011h,081h,011h,081h,01Fh,011h,081h
db 013h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,014h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,012h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,082h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 015h,081h,012h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,081h
db 012h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,014h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,013h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,011h,081h
db 016h,081h,015h,081h,011h,081h,011h,081h
db 013h,081h,011h,081h,011h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,01Fh,015h
db 081h,011h,081h,011h,081h,011h,081h,011h
db 081h,011h,081h,01Fh,017h,081h,011h,081h
db 011h,081h,011h,081h,011h,081h,01Fh,01Bh
db 081h,011h,081h,000h
 
globe db 1
db 01Ch,008h,01Fh,016h,003h,0C2h,0A1h,0C5h
db 003h,01Fh,011h,002h,0A4h,0C5h,0A2h,0C3h
db 002h,01Dh,001h,0A5h,0C4h,0A2h,0C1h,0A1h
db 0C4h,0A1h,001h,01Bh,001h,0A6h,0C4h,0A2h
db 0C1h,0A1h,0C4h,0A2h,001h,019h,001h,0A8h
db 0C1h,0A1h,0C1h,0A4h,0C4h,0A3h,001h,017h
db 001h,0AFh,0C6h,0A3h,001h,015h,001h,0C2h
db 0AEh,0C6h,0A4h,001h,014h,001h,0C2h,0AEh
db 0C7h,0A1h,0C2h,001h,013h,001h,0C3h,0ADh
db 0CBh,0A1h,001h,012h,001h,0C3h,0ADh,0CAh
db 0A2h,001h,012h,001h,0C3h,0A7h,0C1h,0A5h
db 0C9h,0A3h,001h,011h,001h,0C5h,0A6h,0C1h
db 0A2h,0C1h,0A2h,0C9h,0A4h,002h,0C6h,0A3h
db 0C7h,0A2h,0C8h,0A4h,002h,0C6h,0A4h,0C7h
db 0A1h,0C9h,0A3h,002h,0C7h,0A3h,0CFh,0C3h
db 0A2h,002h,0C9h,0A2h,0CFh,0C3h,0A1h,002h
db 0CBh,0A3h,0CFh,0A1h,002h,0CBh,0A3h,0CFh
db 0C1h,002h,0CDh,0A2h,0C1h,0A3h,0CBh,001h
db 011h,001h,0CCh,0AAh,0C6h,001h,012h,001h
db 0CCh,0ABh,0C5h,001h,012h,001h,0CCh,0ABh
db 0C5h,001h,013h,001h,0CBh,0ABh,0C4h,001h
db 014h,001h,0CDh,0A7h,0C6h,001h,015h,001h
db 0CCh,0A7h,0C5h,001h,017h,001h,0CDh,0A4h
db 0C5h,001h,019h,001h,0CCh,0A3h,0C5h,001h
db 01Bh,001h,0CBh,0A3h,0C4h,001h,01Dh,002h
db 0CAh,0A2h,0C2h,002h,01Fh,011h,003h,0C8h
db 003h,01Fh,016h,008h,000h
 
wa db 1
db 01Ch,008h,01Fh,016h,00Eh,01Fh,011h,004h
db 031h,0B8h,031h,004h,01Dh,003h,0BEh,003h
db 01Bh,002h,031h,0B3h,031h,008h,031h,0B3h
db 031h,002h,019h,002h,0B5h,00Ah,0B5h,002h
db 017h,002h,0B6h,00Ah,0B6h,002h,015h,002h
db 031h,0B7h,008h,0B7h,031h,002h,014h,002h
db 0B8h,008h,0B8h,002h,013h,002h,0BAh,006h
db 0BAh,002h,012h,002h,0BAh,006h,0BAh,002h
db 012h,001h,031h,0BBh,004h,0BBh,031h,001h
db 011h,002h,0BFh,0BDh,004h,0BCh,031h,002h
db 031h,0BCh,004h,0BBh,031h,004h,031h,0BBh
db 004h,0BBh,006h,0BBh,004h,0B2h,007h,031h
db 0B1h,006h,0B1h,031h,007h,0B2h,004h,0B2h
db 008h,0B1h,031h,004h,031h,0B1h,008h,0B2h
db 004h,0B2h,008h,031h,0B1h,031h,002h,031h
db 0B1h,031h,008h,0B2h,004h,0B2h,009h,0B6h
db 009h,0B2h,002h,011h,001h,031h,0B2h,007h
db 0B8h,007h,0B2h,031h,001h,012h,002h,0B2h
db 007h,0B8h,007h,0B2h,002h,012h,002h,0B3h
db 005h,0BAh,005h,0B3h,002h,013h,002h,0B3h
db 004h,0BAh,004h,0B3h,002h,014h,002h,031h
db 0B3h,002h,0BCh,002h,0B3h,031h,002h,015h
db 002h,0BFh,0B7h,002h,017h,002h,0BFh,0B5h
db 002h,019h,002h,031h,0BFh,0B1h,031h,002h
db 01Bh,003h,0BEh,003h,01Dh,004h,031h,0B8h
db 031h,004h,01Fh,011h,00Eh,01Fh,016h,008h
db 000h
 
sword db 2
db 02Fh,02Fh,023h,003h,02Fh,02Eh,001h,072h
db 001h,02Fh,02Dh,001h,072h,0F1h,001h,02Fh
db 02Dh,001h,0F1h,071h,0F1h,001h,02Fh,02Dh
db 001h,0F3h,001h,02Fh,02Dh,001h,0F3h,001h
db 02Fh,02Dh,001h,0F3h,001h,02Fh,02Dh,001h
db 0F3h,001h,02Fh,02Dh,001h,0F2h,071h,001h
db 02Fh,02Dh,001h,073h,001h,02Fh,02Dh,001h
db 073h,001h,02Fh,02Dh,001h,073h,001h,02Fh
db 02Dh,001h,073h,001h,02Fh,02Dh,001h,073h
db 001h,02Fh,02Dh,001h,072h,081h,001h,02Fh
db 02Dh,001h,083h,001h,02Fh,02Dh,001h,083h
db 001h,02Fh,02Dh,001h,083h,001h,02Fh,02Dh
db 001h,083h,001h,024h,001h,02Fh,028h,001h
db 083h,001h,022h,001h,02Fh,02Ah,001h,083h
db 002h,02Fh,02Ch,001h,082h,002h,02Fh,02Dh
db 002h,032h,001h,02Fh,02Ch,002h,031h,011h
db 0B1h,001h,02Fh,02Ah,001h,022h,001h,0B1h
db 031h,071h,001h,02Fh,028h,001h,024h,001h
db 071h,031h,0F1h,001h,02Fh,02Dh,001h,0F3h
db 001h,02Fh,02Dh,001h,0F2h,001h,02Fh,02Eh
db 002h,000h
 
cow db 1
db 018h,004h,01Fh,01Ch,004h,01Ch,003h,01Ch
db 001h,0B2h,001h,01Eh,002h,01Bh,002h,0B1h
db 001h,01Fh,003h,01Ah,001h,0B2h,001h,01Fh
db 001h,0B1h,001h,01Ah,001h,0B2h,001h,015h
db 004h,016h,001h,0B1h,001h,01Ah,001h,0B2h
db 002h,012h,003h,0F2h,002h,014h,002h,0B1h
db 001h,01Ah,002h,0B3h,003h,0F3h,071h,0F1h
db 006h,0B2h,001h,01Bh,001h,0B4h,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F2h,002h,0B4h
db 001h,01Bh,002h,0B3h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F2h,001h,0B4h,001h
db 01Ch,001h,0B1h,004h,071h,0F1h,071h,004h
db 071h,0F1h,001h,0B2h,002h,018h,006h,0E2h
db 005h,0E2h,003h,071h,001h,0B1h,002h,017h
db 002h,0F5h,001h,0E2h,003h,0F1h,001h,0E2h
db 003h,071h,005h,016h,001h,0F3h,002h,0F2h
db 004h,0F1h,071h,0F1h,004h,072h,001h,074h
db 001h,015h,003h,0F2h,003h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,075h
db 002h,071h,002h,017h,003h,0F1h,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 074h,002h,073h,002h,01Ah,001h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,075h
db 006h,01Ah,002h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,074h,002h,01Eh
db 001h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,076h,001h,01Dh,001h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,074h,003h,01Ch,001h,0F1h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,075h,001h,0F1h,001h,01Ch,001h
db 071h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 071h,0F1h,076h,001h,0F1h,001h,01Ch,001h
db 072h,0F1h,071h,0F1h,071h,0F1h,071h,0F1h
db 077h,003h,01Ch,001h,07Fh,071h,001h,0F1h
db 001h,01Ch,001h,073h,003h,072h,003h,0F1h
db 074h,001h,0F1h,001h,01Ch,002h,072h,003h
db 072h,003h,075h,003h,01Dh,002h,07Dh,001h
db 0F2h,001h,01Eh,002h,07Bh,003h,0F1h,001h
db 01Fh,003h,077h,003h,0F2h,001h,01Fh,013h
db 003h,073h,003h,0F2h,002h,01Fh,016h,009h
db 000h
 
mace db 1
db 01Fh,01Fh,01Bh,081h,01Fh,01Fh,011h,082h
db 01Ah,081h,01Fh,014h,081h,0F1h,081h,018h
db 082h,01Fh,014h,081h,0F1h,071h,085h,012h
db 081h,0F1h,081h,01Fh,013h,082h,0F1h,071h
db 081h,004h,082h,0F1h,071h,081h,01Fh,012h
db 081h,002h,082h,006h,081h,072h,081h,01Fh
db 011h,081h,00Ch,082h,01Fh,011h,081h,00Fh
db 001h,01Bh,085h,008h,082h,007h,01Bh,081h
db 0F1h,072h,081h,006h,081h,0F1h,071h,081h
db 006h,01Ch,081h,0F1h,071h,081h,006h,081h
db 072h,081h,006h,085h,017h,082h,0F1h,008h
db 082h,006h,081h,0F3h,081h,018h,081h,00Fh
db 003h,081h,072h,081h,019h,081h,005h,082h
db 00Ch,082h,01Ah,081h,004h,081h,0F1h,071h
db 081h,003h,082h,007h,01Bh,081h,004h,081h
db 072h,081h,002h,081h,072h,081h,006h,01Bh
db 082h,004h,082h,003h,081h,0F1h,071h,081h
db 006h,013h,082h,015h,081h,0F1h,071h,081h
db 009h,081h,0F1h,081h,005h,011h,083h,0B1h
db 081h,001h,013h,081h,0F1h,072h,081h,00Ah
db 082h,002h,082h,001h,081h,0B1h,004h,0B1h
db 001h,011h,086h,00Bh,081h,001h,081h,072h
db 081h,003h,013h,082h,001h,016h,004h,082h
db 007h,081h,0F1h,071h,081h,016h,081h,0B1h
db 001h,017h,002h,081h,0F1h,071h,081h,007h
db 081h,0F1h,081h,015h,082h,002h,018h,001h
db 081h,0F1h,071h,081h,006h,012h,082h,015h
db 081h,0B1h,001h,01Ah,081h,0F1h,081h,005h
db 015h,081h,013h,082h,003h,01Ah,082h,01Fh
db 081h,0B1h,001h,01Ch,081h,01Fh,081h,003h
db 01Fh,01Ch,081h,0B1h,001h,01Fh,01Eh,081h
db 002h,01Fh,01Eh,082h,001h,01Fh,01Eh,081h
db 0B1h,001h,01Fh,01Fh,001h,000h
 
cube db 1
db 01Dh,00Ah,01Fh,016h,001h,0C8h,002h,01Fh
db 015h,001h,0C8h,001h,0A1h,001h,01Fh,014h
db 001h,0C8h,001h,0A2h,001h,01Fh,013h,00Ah
db 0A3h,001h,01Fh,013h,001h,098h,001h,0A3h
db 005h,01Eh,001h,098h,001h,0A3h,001h,0C2h
db 002h,01Eh,001h,098h,001h,0A3h,001h,0C1h
db 001h,0A1h,001h,01Eh,001h,098h,001h,0A3h
db 002h,0A2h,001h,019h,006h,098h,001h,0A3h
db 00Ah,013h,001h,0C5h,001h,098h,001h,0A2h
db 001h,0C8h,002h,012h,001h,0C6h,001h,098h
db 001h,0A1h,001h,0C8h,001h,0A1h,001h,011h
db 001h,0C7h,001h,098h,002h,0C8h,001h,0A2h
db 00Fh,00Eh,0A3h,002h,097h,001h,0C8h,002h
db 098h,001h,0A3h,002h,096h,001h,0C8h,001h
db 0A1h,001h,098h,001h,0A3h,002h,095h,001h
db 0C8h,001h,0A2h,001h,098h,001h,0A3h,002h
db 094h,00Ah,0A3h,001h,098h,001h,0A3h,002h
db 094h,001h,098h,001h,0A3h,001h,098h,001h
db 0A3h,002h,094h,001h,098h,001h,0A3h,001h
db 098h,001h,0A2h,001h,011h,001h,094h,001h
db 098h,001h,0A3h,001h,098h,001h,0A1h,001h
db 012h,001h,094h,001h,098h,001h,0A3h,001h
db 098h,002h,013h,006h,098h,001h,0A3h,00Ah
db 019h,001h,098h,001h,0A2h,002h,0A3h,001h
db 01Eh,001h,098h,001h,0A1h,001h,091h,001h
db 0A3h,001h,01Eh,001h,098h,002h,092h,001h
db 0A3h,001h,01Eh,00Ah,093h,001h,0A3h,001h
db 01Fh,013h,001h,098h,001h,0A3h,001h,01Fh
db 013h,001h,098h,001h,0A2h,001h,01Fh,014h
db 001h,098h,001h,0A1h,001h,01Fh,015h,001h
db 098h,002h,01Fh,016h,00Ah,000h
 
ball db 1
db 01Fh,01Fh,01Eh,082h,004h,081h,01Fh,018h
db 083h,008h,01Fh,014h,082h,0F2h,071h,0F1h
db 071h,081h,001h,084h,002h,01Fh,011h,082h
db 0F4h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 083h,001h,01Eh,081h,001h,0F6h,071h,0F1h
db 071h,0F1h,071h,0F1h,071h,083h,001h,01Ch
db 081h,002h,0F7h,071h,0F1h,071h,0F1h,073h
db 083h,001h,01Bh,002h,081h,0F5h,071h,081h
db 0F1h,071h,0F1h,073h,081h,071h,081h,002h
db 01Ah,081h,001h,081h,0F5h,081h,002h,081h
db 0F1h,071h,0F1h,073h,082h,003h,019h,081h
db 001h,0F4h,071h,081h,004h,081h,0F1h,073h
db 081h,071h,004h,019h,081h,071h,0F4h,081h
db 006h,081h,072h,081h,071h,081h,005h,017h
db 081h,071h,0F5h,071h,006h,081h,073h,082h
db 005h,017h,081h,0F1h,071h,0F3h,071h,0F1h
db 006h,081h,072h,081h,071h,081h,005h,017h
db 081h,071h,0F3h,071h,0F1h,071h,081h,004h
db 081h,072h,081h,071h,083h,004h,017h,081h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,072h
db 083h,074h,085h,001h,081h,001h,017h,082h
db 0F1h,071h,0F1h,071h,0F1h,079h,081h,071h
db 086h,001h,017h,083h,072h,0F1h,077h,081h
db 071h,081h,071h,087h,001h,018h,081h,003h
db 079h,081h,071h,087h,001h,019h,081h,003h
db 076h,081h,071h,081h,071h,081h,071h,086h
db 001h,01Ah,004h,074h,081h,071h,081h,071h
db 004h,084h,001h,01Bh,081h,003h,071h,081h
db 071h,081h,071h,081h,071h,006h,083h,001h
db 01Ch,081h,002h,081h,071h,081h,071h,081h
db 071h,007h,082h,001h,01Eh,001h,081h,071h
db 081h,071h,081h,071h,081h,006h,082h,001h
db 01Fh,011h,002h,071h,081h,071h,082h,005h
db 081h,002h,021h,0A1h,01Dh,0A4h,002h,087h
db 002h,024h,0A1h,01Ah,0A6h,022h,007h,025h
db 0A1h,021h,0A1h,018h,0A7h,021h,0A1h,02Bh
db 081h,021h,0A2h,018h,0A8h,021h,0A1h,021h
db 0A1h,021h,081h,021h,081h,021h,081h,021h
db 0A1h,021h,0A1h,021h,0A1h,019h,0A8h,021h
db 0A1h,021h,0A1h,021h,0A1h,021h,0A1h,021h
db 0A1h,021h,0A1h,021h,0A1h,01Ch,0A9h,021h
db 0A1h,021h,0A1h,021h,0A1h,021h,0A1h,021h
db 0A1h,01Fh,011h,0AEh,000h
 
dish db 1
db 019h,091h,01Fh,01Ch,091h,013h,091h,01Dh
db 084h,01Bh,091h,012h,091h,01Bh,082h,0F3h
db 071h,001h,018h,091h,012h,091h,01Bh,082h
db 0F2h,083h,0F1h,001h,019h,091h,013h,082h
db 017h,081h,0F2h,085h,0F1h,001h,01Ah,091h
db 011h,082h,0F1h,001h,015h,081h,0F1h,086h
db 0F1h,002h,017h,092h,013h,083h,0F1h,001h
db 013h,081h,0F1h,087h,0F1h,002h,01Ah,091h
db 012h,005h,011h,081h,0F1h,087h,0F1h,001h
db 081h,001h,019h,091h,017h,002h,0F1h,088h
db 0F1h,001h,081h,001h,018h,091h,018h,003h
db 087h,0F1h,001h,082h,001h,01Fh,011h,081h
db 0F1h,081h,002h,086h,0F1h,001h,081h,001h
db 01Fh,011h,081h,0F1h,083h,002h,084h,0F1h
db 001h,082h,001h,01Fh,081h,0F1h,085h,002h
db 082h,0F1h,001h,083h,001h,01Eh,081h,0F1h
db 087h,002h,0F1h,001h,081h,071h,081h,001h
db 01Eh,081h,0F1h,089h,0F1h,001h,081h,072h
db 081h,001h,01Dh,081h,0F1h,089h,0F1h,001h
db 081h,072h,082h,001h,01Dh,081h,0F1h,088h
db 0F1h,001h,081h,073h,081h,001h,01Dh,081h
db 0F1h,088h,0F1h,001h,081h,074h,081h,003h
db 01Ah,081h,0F1h,088h,0F1h,001h,081h,074h
db 081h,002h,071h,081h,001h,019h,081h,0F1h
db 087h,0F1h,001h,081h,074h,081h,002h,072h
db 081h,001h,018h,081h,0F1h,087h,0F1h,001h
db 081h,074h,081h,002h,072h,082h,001h,018h
db 081h,0F1h,085h,0F2h,001h,081h,073h,081h
db 003h,073h,081h,001h,01Ah,081h,0F5h,002h
db 072h,081h,004h,074h,081h,001h,01Ch,00Ah
db 012h,001h,073h,082h,001h,01Fh,019h,001h
db 072h,083h,001h,01Fh,019h,001h,085h,001h
db 01Fh,019h,001h,085h,001h,01Fh,014h,085h
db 00Ch,01Eh,081h,0F1h,07Fh,081h,001h,01Ch
db 001h,08Fh,084h,001h,01Ch,00Fh,004h,000h
 
flag db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,012h,006h,01Fh
db 019h,009h,01Fh,016h,007h,0F2h,004h,01Fh
db 013h,008h,0F3h,003h,016h,002h,018h,003h
db 0F1h,006h,0F5h,004h,013h,002h,015h,004h
db 0F3h,006h,0F6h,008h,015h,002h,0F5h,006h
db 0F6h,008h,015h,007h,0F6h,006h,0F6h,002h
db 015h,007h,0F6h,006h,0F6h,002h,015h,007h
db 0F6h,006h,0F6h,002h,015h,007h,0F6h,006h
db 0F6h,002h,015h,007h,0F6h,006h,0F6h,002h
db 015h,007h,0F6h,006h,0F6h,002h,015h,002h
db 0F5h,006h,0F6h,008h,015h,002h,0F5h,006h
db 0F6h,008h,015h,002h,0F5h,009h,0F3h,008h
db 015h,002h,0F3h,00Dh,0F1h,008h,015h,002h
db 0F2h,006h,016h,00Bh,015h,006h,01Bh,004h
db 0F4h,002h,015h,004h,01Eh,009h,015h,003h
db 01Fh,012h,007h,01Fh,01Fh,002h,01Fh,01Fh
db 002h,01Fh,01Fh,002h,01Fh,01Fh,002h,01Fh
db 01Fh,002h,01Fh,01Fh,002h,01Fh,01Fh,002h
db 000h
 
apple db 4
db 04Fh,04Fh,04Fh,04Fh,04Ah,024h,04Fh,04Ah
db 023h,0A1h,021h,082h,001h,04Fh,04Ah,021h
db 0A3h,021h,081h,021h,001h,04Fh,04Ah,023h
db 0A2h,022h,001h,04Fh,04Ah,022h,0A1h,021h
db 082h,001h,043h,031h,001h,04Fh,047h,021h
db 0A1h,082h,021h,001h,041h,031h,0B1h,001h
db 04Fh,048h,022h,0A1h,021h,002h,0B1h,001h
db 04Fh,04Bh,023h,031h,071h,001h,015h,04Fh
db 044h,012h,092h,011h,031h,071h,001h,093h
db 014h,04Fh,041h,011h,091h,0F1h,071h,091h
db 012h,002h,0D2h,071h,092h,012h,001h,04Eh
db 011h,091h,0F1h,073h,0D7h,072h,091h,012h
db 001h,04Ch,011h,091h,0F3h,092h,077h,094h
db 012h,001h,04Bh,011h,091h,0F1h,091h,0F1h
db 071h,09Dh,011h,001h,04Bh,011h,091h,0F1h
db 092h,073h,09Bh,011h,001h,04Ch,013h,09Fh
db 012h,001h,04Bh,031h,071h,0F1h,012h,09Dh
db 012h,001h,04Ch,031h,071h,0F1h,0B1h,011h
db 09Ch,012h,001h,04Ch,031h,071h,0B1h,071h
db 011h,09Ch,012h,001h,04Dh,031h,071h,0F1h
db 071h,011h,09Bh,012h,001h,04Dh,031h,071h
db 0B1h,071h,011h,09Bh,012h,001h,04Dh,031h
db 071h,0F1h,071h,011h,09Bh,012h,001h,04Dh
db 031h,071h,0B1h,071h,011h,09Bh,011h,001h
db 04Dh,031h,071h,0F1h,071h,011h,09Ch,011h
db 001h,04Ch,031h,073h,011h,09Ch,011h,001h
db 04Dh,014h,09Dh,011h,001h,04Eh,011h,09Eh
db 011h,001h,04Fh,041h,011h,09Bh,012h,001h
db 04Fh,043h,012h,098h,011h,002h,04Fh,046h
db 009h,000h
 
ok db 1
db 01Fh,01Fh,01Eh,007h,01Fh,017h,003h,027h
db 003h,01Fh,012h,002h,02Dh,002h,01Eh,001h
db 02Fh,022h,001h,01Ch,001h,02Fh,024h,001h
db 01Ah,001h,02Fh,026h,001h,018h,001h,02Fh
db 028h,001h,017h,001h,02Fh,028h,001h,081h
db 015h,001h,02Fh,021h,0F4h,025h,001h,081h
db 014h,001h,02Fh,071h,0F3h,071h,025h,001h
db 081h,014h,001h,02Fh,0F4h,026h,001h,082h
db 012h,001h,02Fh,071h,0F3h,071h,027h,001h
db 081h,012h,001h,02Fh,0F4h,028h,001h,081h
db 012h,001h,02Eh,071h,0F3h,071h,028h,001h
db 082h,011h,001h,02Eh,0F4h,029h,001h,082h
db 011h,001h,027h,0F3h,071h,022h,071h,0F3h
db 071h,029h,001h,082h,011h,001h,027h,071h
db 0F3h,071h,021h,0F4h,02Ah,001h,082h,011h
db 001h,028h,071h,0F3h,071h,0F3h,071h,02Ah
db 001h,082h,012h,001h,028h,071h,0F6h,02Ah
db 001h,083h,012h,001h,029h,071h,0F4h,071h
db 02Ah,001h,083h,012h,001h,02Ah,071h,0F3h
db 02Bh,001h,082h,014h,001h,02Ah,071h,0F1h
db 071h,02Ah,001h,083h,014h,001h,02Fh,028h
db 001h,083h,015h,001h,02Fh,026h,001h,083h
db 017h,001h,02Fh,024h,001h,084h,018h,001h
db 02Fh,022h,001h,084h,01Ah,002h,02Dh,002h
db 084h,01Ch,081h,003h,027h,003h,085h,01Eh
db 083h,007h,087h,01Fh,012h,08Dh,01Fh,017h
db 087h,000h
 
speaker db 1
db 016h,08Fh,084h,01Ch,08Fh,086h,01Ah,081h
db 07Fh,076h,081h,019h,081h,071h,008h,083h
db 009h,081h,019h,081h,071h,007h,081h,003h
db 081h,008h,081h,019h,081h,071h,006h,081h
db 005h,081h,007h,081h,019h,081h,071h,006h
db 081h,001h,081h,001h,081h,001h,081h,007h
db 081h,019h,081h,071h,006h,081h,001h,081h
db 071h,081h,001h,081h,007h,081h,019h,081h
db 071h,007h,081h,003h,081h,008h,081h,019h
db 081h,071h,008h,083h,009h,081h,019h,081h
db 071h,00Fh,005h,081h,019h,081h,071h,007h
db 081h,003h,081h,008h,081h,019h,081h,071h
db 006h,081h,005h,081h,007h,081h,019h,081h
db 071h,006h,081h,001h,081h,001h,081h,001h
db 081h,007h,081h,019h,081h,071h,006h,081h
db 001h,081h,071h,081h,001h,081h,007h,081h
db 019h,081h,071h,007h,081h,003h,081h,008h
db 081h,019h,081h,071h,008h,083h,009h,081h
db 019h,081h,071h,00Fh,005h,081h,019h,081h
db 071h,005h,089h,006h,081h,019h,081h,071h
db 004h,081h,009h,081h,005h,081h,019h,081h
db 071h,003h,081h,00Bh,081h,004h,081h,019h
db 081h,071h,002h,081h,005h,081h,071h,081h
db 002h,081h,002h,081h,003h,081h,019h,081h
db 071h,002h,081h,002h,081h,001h,081h,003h
db 081h,002h,081h,001h,081h,003h,081h,019h
db 081h,071h,002h,081h,001h,081h,008h,081h
db 002h,081h,003h,081h,019h,081h,071h,002h
db 081h,002h,083h,003h,082h,001h,081h,001h
db 081h,003h,081h,019h,081h,071h,002h,081h
db 001h,082h,072h,081h,002h,072h,081h,002h
db 081h,003h,081h,019h,081h,071h,002h,081h
db 001h,081h,071h,0F1h,071h,003h,081h,0F1h
db 071h,081h,001h,081h,003h,081h,019h,081h
db 071h,003h,081h,001h,0F1h,071h,081h,004h
db 071h,0F1h,001h,081h,004h,081h,019h,081h
db 071h,004h,081h,009h,081h,005h,081h,019h
db 081h,071h,005h,089h,006h,081h,019h,081h
db 071h,00Fh,005h,081h,019h,08Fh,088h,000h
 
print db 1
db 01Fh,01Fh,01Fh,01Fh,01Dh,00Fh,001h,01Fh
db 011h,001h,0FEh,001h,01Fh,082h,0FDh,082h
db 01Fh,001h,0F2h,0C3h,0F9h,001h,01Fh,011h
db 001h,0FEh,001h,01Fh,011h,001h,0F2h,0C9h
db 0F3h,001h,01Ch,005h,0FEh,005h,014h,002h
db 011h,001h,074h,001h,0F2h,0CAh,0F2h,001h
db 081h,073h,001h,011h,003h,0F1h,002h,0F4h
db 001h,0FEh,001h,071h,0F3h,002h,0F1h,002h
db 0F1h,081h,001h,082h,005h,0F3h,084h,0F3h
db 005h,082h,001h,081h,0F1h,002h,081h,002h
db 081h,001h,0F1h,0B1h,0F1h,0B1h,0F1h,001h
db 0F1h,081h,0F4h,081h,0F1h,001h,0B1h,0F1h
db 0B1h,0F1h,031h,001h,081h,002h,081h,003h
db 011h,002h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,001h,076h,001h,0B1h,0F1h,0B1h,0F1h
db 0B1h,0F1h,031h,002h,011h,002h,013h,002h
db 0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h
db 006h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 031h,002h,017h,001h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,031h,001h,018h,001h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,031h,001h,018h,001h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,031h,001h,018h,001h,0B1h
db 0F1h,001h,0F2h,001h,0F2h,001h,0F2h,001h
db 0F2h,001h,0F2h,001h,0F2h,001h,031h,001h
db 017h,001h,0B1h,00Fh,006h,0B1h,031h,001h
db 015h,001h,0B1h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,031h,001h,013h,001h,0B1h
db 0F1h,00Fh,009h,0B1h,031h,001h,011h,001h
db 0B1h,0F3h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F2h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,031h,002h,0F1h,0B1h,00Fh
db 00Ch,031h,002h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 031h,002h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,0B1h,0F1h,031h
db 002h,03Fh,03Fh,001h,011h,00Fh,00Fh,012h
db 001h,0F1h,082h,001h,01Fh,013h,001h,0F1h
db 082h,001h,015h,003h,01Fh,015h,003h,000h
 
light db 1
db 01Dh,086h,01Fh,019h,082h,0F5h,071h,081h
db 001h,01Fh,016h,081h,071h,0B3h,0F4h,071h
db 081h,001h,01Fh,014h,081h,071h,0B2h,0F7h
db 071h,081h,001h,01Fh,012h,081h,071h,0B1h
db 0F9h,071h,082h,001h,01Fh,081h,071h,0B1h
db 0F1h,0B2h,0F7h,0B1h,071h,082h,001h,01Eh
db 081h,071h,0B1h,0F1h,0B2h,0F8h,0B1h,071h
db 081h,001h,081h,01Ch,081h,071h,0F1h,0B1h
db 0F1h,0B6h,0F4h,0B1h,071h,082h,001h,01Ch
db 081h,071h,0B3h,0F1h,0B1h,0F8h,0B1h,071h
db 082h,001h,01Ch,081h,071h,0B1h,0F1h,0B1h
db 0FAh,0B1h,071h,082h,001h,01Ch,081h,071h
db 0B1h,0F1h,0B1h,0FBh,071h,082h,001h,01Ch
db 081h,071h,0B1h,0F1h,0B1h,0FBh,071h,082h
db 001h,01Ch,081h,071h,0F2h,0B1h,0FBh,071h
db 082h,001h,01Ch,081h,071h,0F2h,0B1h,072h
db 081h,0F5h,081h,0F2h,071h,082h,001h,01Dh
db 081h,071h,0F1h,0B1h,081h,0F2h,081h,0F3h
db 082h,0F1h,071h,082h,001h,01Fh,081h,071h
db 0F1h,081h,0F1h,0B1h,081h,0F3h,082h,0F1h
db 071h,081h,001h,081h,01Fh,081h,071h,0F1h
db 081h,0F1h,0B1h,081h,0F3h,071h,081h,071h
db 082h,001h,01Fh,012h,081h,072h,082h,0F1h
db 071h,081h,071h,081h,0F1h,071h,081h,001h
db 01Fh,014h,081h,071h,0F3h,081h,0F1h,081h
db 0F1h,071h,081h,001h,01Fh,016h,081h,071h
db 0F1h,082h,0F2h,071h,081h,001h,01Fh,017h
db 081h,071h,0F2h,071h,081h,0F1h,071h,081h
db 001h,01Fh,018h,081h,071h,0F1h,081h,0F1h
db 071h,081h,001h,01Fh,019h,081h,071h,0F1h
db 081h,0F1h,071h,081h,001h,01Fh,019h,081h
db 071h,0F1h,081h,0F1h,071h,081h,001h,01Fh
db 019h,081h,071h,0F1h,081h,0F1h,071h,081h
db 001h,01Fh,019h,031h,071h,0F1h,081h,0F1h
db 071h,081h,001h,01Fh,019h,033h,0F2h,071h
db 002h,01Fh,019h,031h,0F1h,0B1h,003h,031h
db 001h,01Fh,019h,031h,0B1h,031h,0B1h,071h
db 031h,002h,01Fh,019h,031h,0F1h,0B1h,031h
db 002h,031h,001h,01Fh,01Ah,001h,031h,0B1h
db 071h,031h,001h,01Fh,01Ch,004h,000h
 
foto db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh
db 01Fh,017h,004h,01Fh,01Ch,001h,0F3h,081h
db 001h,01Fh,014h,002h,081h,013h,001h,074h
db 001h,081h,001h,012h,004h,081h,019h,002h
db 0F1h,081h,004h,076h,004h,0F3h,081h,003h
db 016h,001h,071h,003h,081h,072h,001h,086h
db 001h,081h,071h,005h,081h,072h,001h,014h
db 001h,0FFh,0F9h,071h,081h,001h,013h,001h
db 0F1h,07Fh,079h,082h,001h,013h,001h,0F1h
db 079h,005h,07Ah,082h,001h,013h,001h,0F1h
db 077h,002h,074h,0F1h,002h,078h,081h,002h
db 013h,009h,081h,0F5h,073h,00Bh,013h,001h
db 082h,001h,081h,001h,081h,001h,081h,075h
db 0F2h,071h,082h,001h,081h,001h,081h,001h
db 081h,002h,081h,001h,013h,001h,081h,001h
db 081h,001h,081h,001h,072h,005h,072h,082h
db 001h,081h,001h,081h,001h,081h,001h,081h
db 003h,013h,001h,082h,001h,081h,001h,071h
db 081h,001h,085h,001h,081h,071h,001h,081h
db 003h,081h,001h,081h,002h,081h,001h,013h
db 001h,081h,001h,081h,001h,081h,071h,001h
db 082h,071h,0F1h,071h,082h,001h,071h,081h
db 003h,081h,001h,081h,001h,081h,003h,013h
db 001h,082h,002h,071h,001h,082h,071h,0F1h
db 085h,001h,071h,004h,081h,001h,081h,002h
db 081h,001h,013h,001h,081h,001h,081h,001h
db 071h,001h,082h,0F1h,071h,085h,001h,071h
db 003h,081h,001h,081h,001h,081h,003h,013h
db 001h,082h,002h,071h,001h,082h,0F1h,086h
db 001h,071h,004h,081h,001h,081h,002h,081h
db 001h,013h,001h,081h,001h,081h,001h,071h
db 001h,082h,071h,086h,001h,071h,003h,081h
db 001h,081h,001h,081h,003h,013h,001h,082h
db 002h,071h,001h,089h,001h,071h,002h,081h
db 001h,081h,001h,081h,002h,081h,001h,013h
db 001h,081h,001h,081h,001h,081h,071h,001h
db 087h,001h,071h,081h,001h,081h,001h,081h
db 001h,081h,001h,081h,003h,013h,001h,082h
db 001h,081h,001h,071h,081h,001h,085h,001h
db 081h,071h,001h,081h,001h,081h,001h,081h
db 001h,081h,003h,015h,002h,081h,001h,081h
db 001h,072h,005h,072h,001h,081h,001h,081h
db 001h,081h,001h,081h,001h,081h,001h,017h
db 006h,081h,075h,081h,00Bh,01Eh,081h,005h
db 081h,000h
 
flop db 1
db 011h,00Fh,00Dh,013h,001h,073h,001h,0FFh
db 0F5h,001h,073h,001h,012h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,081h,011h,001h
db 073h,001h,0FFh,0F5h,001h,071h,001h,071h
db 001h,082h,001h,073h,001h,0FFh,0F5h,001h
db 071h,001h,071h,001h,082h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,082h,001h,073h
db 001h,0FFh,0F5h,001h,073h,001h,082h,001h
db 073h,001h,0FFh,0F5h,001h,073h,001h,082h
db 001h,073h,001h,0FFh,0F5h,001h,073h,001h
db 082h,001h,073h,001h,0FFh,0F5h,001h,073h
db 001h,082h,001h,073h,001h,0FFh,0F5h,001h
db 073h,001h,082h,001h,073h,001h,0FFh,0F5h
db 001h,073h,001h,082h,001h,073h,001h,0FFh
db 0F5h,001h,073h,001h,082h,001h,073h,001h
db 0FFh,0F5h,001h,073h,001h,082h,001h,073h
db 001h,0FFh,0F5h,001h,073h,001h,082h,001h
db 073h,001h,0FFh,0F5h,001h,073h,001h,082h
db 001h,073h,00Fh,007h,073h,001h,082h,001h
db 07Fh,07Dh,001h,082h,001h,07Fh,07Dh,001h
db 082h,001h,07Fh,07Dh,001h,082h,001h,077h
db 00Fh,003h,073h,001h,082h,001h,077h,001h
db 08Ch,001h,073h,001h,073h,001h,082h,001h
db 077h,001h,082h,004h,086h,001h,073h,001h
db 073h,001h,082h,001h,077h,001h,082h,001h
db 072h,001h,086h,001h,073h,001h,073h,001h
db 082h,001h,077h,001h,082h,001h,072h,001h
db 086h,001h,073h,001h,073h,001h,082h,001h
db 077h,001h,082h,001h,072h,001h,086h,001h
db 073h,001h,073h,001h,082h,001h,077h,001h
db 082h,001h,072h,001h,086h,001h,073h,001h
db 073h,001h,082h,001h,077h,001h,082h,004h
db 086h,001h,073h,001h,073h,001h,082h,011h
db 001h,076h,001h,08Ch,001h,073h,001h,073h
db 001h,082h,012h,00Fh,00Ch,083h,012h,08Fh
db 08Fh,013h,08Fh,08Dh,000h
 
pillar db 1
db 016h,08Fh,084h,01Bh,082h,0FFh,0F4h,082h
db 018h,081h,0F2h,073h,0F1h,071h,0F1h,071h
db 0F1h,071h,0F1h,071h,0F1h,071h,0F1h,071h
db 0F1h,075h,001h,017h,081h,0F1h,071h,083h
db 07Dh,083h,0F1h,071h,001h,016h,081h,0F1h
db 071h,081h,0F3h,001h,071h,081h,071h,081h
db 071h,081h,071h,081h,071h,081h,071h,001h
db 0F3h,081h,0F1h,071h,001h,015h,081h,0F1h
db 071h,081h,073h,0F1h,001h,089h,001h,071h
db 0F1h,072h,081h,0F1h,071h,001h,015h,081h
db 0F1h,071h,081h,071h,0F1h,081h,0F1h,00Bh
db 0F1h,081h,072h,081h,0F1h,071h,001h,016h
db 081h,0F1h,071h,082h,071h,0F1h,001h,0F7h
db 072h,001h,071h,0F1h,082h,0F1h,071h,001h
db 017h,081h,0F1h,071h,0F2h,071h,0F1h,001h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,001h,072h,0F2h,072h,001h,018h,001h
db 0F1h,073h,001h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,074h
db 001h,01Ah,004h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,005h
db 01Fh,081h,0F1h,071h,081h,0F1h,071h,081h
db 0F1h,071h,081h,071h,081h,001h,01Fh,014h
db 081h,0F1h,071h,081h,0F1h,071h,081h,0F1h
db 071h,081h,071h,081h,001h,01Fh,014h,081h
db 0F1h,071h,081h,0F1h,071h,081h,0F1h,071h
db 081h,071h,081h,001h,01Fh,014h,081h,0F1h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,081h,001h,01Fh,014h,081h,0F1h,071h
db 081h,0F1h,071h,081h,0F1h,071h,081h,071h
db 081h,001h,01Fh,014h,081h,0F1h,071h,081h
db 0F1h,071h,081h,0F1h,071h,081h,071h,081h
db 001h,01Fh,014h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,001h
db 01Fh,014h,081h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,01Fh
db 014h,081h,0F1h,071h,081h,0F1h,071h,081h
db 0F1h,071h,081h,071h,081h,001h,01Fh,014h
db 081h,0F1h,071h,081h,0F1h,071h,081h,0F1h
db 071h,081h,071h,081h,001h,01Fh,014h,081h
db 0F1h,071h,081h,0F1h,071h,081h,0F1h,071h
db 081h,071h,081h,001h,01Fh,014h,081h,0F1h
db 071h,081h,0F1h,071h,081h,0F1h,071h,081h
db 071h,081h,001h,01Fh,014h,081h,0F1h,071h
db 081h,0F1h,071h,081h,0F1h,071h,081h,071h
db 081h,001h,01Fh,014h,081h,0F1h,071h,081h
db 0F1h,071h,081h,0F1h,071h,081h,071h,081h
db 001h,01Fh,014h,081h,0F1h,071h,081h,0F1h
db 071h,081h,0F1h,071h,081h,071h,081h,001h
db 01Fh,014h,081h,0F1h,071h,081h,0F1h,071h
db 081h,0F1h,071h,081h,071h,081h,001h,01Fh
db 012h,08Fh,081h,001h,01Eh,081h,0F3h,07Eh
db 001h,01Ch,08Fh,084h,002h,01Ah,081h,0F2h
db 07Fh,073h,081h,001h,019h,00Fh,008h,000h
 
newspaper db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,013h
db 003h,01Fh,01Dh,001h,0F3h,002h,01Fh,01Ah
db 001h,0F2h,001h,0F3h,002h,01Fh,017h,001h
db 0F2h,002h,0F1h,001h,0F3h,002h,01Fh,014h
db 001h,0F2h,001h,0F1h,002h,0F2h,001h,081h
db 0F2h,002h,01Fh,011h,001h,0F2h,001h,0F2h
db 001h,0F2h,001h,0F1h,081h,001h,0F3h,002h
db 01Dh,001h,0F1h,071h,0F3h,001h,0F2h,001h
db 071h,001h,0F2h,001h,0F4h,002h,01Ah,001h
db 0F2h,081h,001h,081h,0F3h,001h,081h,0F3h
db 001h,0F1h,081h,0F1h,081h,0F3h,002h,017h
db 001h,0F1h,071h,0F3h,081h,001h,071h,0F2h
db 071h,001h,0F1h,001h,0F1h,082h,0F1h,001h
db 0F1h,001h,081h,0F2h,002h,014h,001h,0F2h
db 081h,001h,081h,0F3h,071h,001h,081h,0F3h
db 003h,0F1h,001h,0F1h,001h,0F1h,081h,001h
db 0F3h,001h,012h,001h,0F1h,071h,0F3h,081h
db 001h,071h,0F3h,081h,001h,081h,0F3h,002h
db 0F3h,001h,0F4h,001h,071h,011h,001h,0F2h
db 081h,001h,081h,0F3h,071h,001h,081h,0F3h
db 071h,0F1h,001h,0F3h,001h,081h,0F1h,001h
db 0F3h,001h,071h,002h,081h,071h,0F3h,081h
db 001h,071h,0F3h,081h,001h,081h,0F2h,001h
db 0F1h,002h,0F2h,081h,001h,0F3h,001h,071h
db 001h,071h,001h,0F1h,081h,001h,081h,0F3h
db 071h,001h,081h,0F3h,071h,0F1h,001h,071h
db 0F3h,002h,0F4h,001h,071h,001h,071h,002h
db 0F3h,081h,001h,071h,0F3h,081h,001h,081h
db 0F2h,001h,074h,0F3h,001h,0F2h,001h,071h
db 001h,071h,001h,071h,001h,071h,001h,081h
db 0F2h,071h,001h,081h,0F3h,071h,0F1h,001h
db 083h,074h,001h,0F2h,001h,071h,001h,071h
db 001h,071h,002h,081h,072h,001h,081h,0F2h
db 081h,001h,081h,0F3h,002h,084h,071h,001h
db 0F2h,001h,071h,001h,071h,001h,071h,001h
db 012h,002h,081h,073h,081h,0F2h,081h,072h
db 0F3h,002h,082h,001h,0F2h,001h,071h,001h
db 071h,001h,071h,001h,015h,002h,081h,072h
db 001h,081h,0F2h,071h,001h,081h,0F3h,002h
db 0F2h,001h,071h,001h,071h,001h,071h,001h
db 018h,002h,081h,072h,001h,081h,0F2h,081h
db 001h,081h,0F4h,001h,071h,001h,071h,001h
db 071h,001h,01Bh,002h,081h,071h,0F1h,071h
db 081h,0F2h,081h,001h,0F2h,001h,071h,001h
db 071h,001h,071h,001h,01Eh,002h,081h,071h
db 081h,001h,081h,0F3h,001h,071h,001h,071h
db 001h,071h,001h,01Fh,012h,002h,081h,072h
db 001h,0F1h,001h,071h,001h,071h,001h,071h
db 001h,01Fh,015h,002h,081h,072h,001h,071h
db 002h,071h,001h,01Fh,018h,002h,081h,001h
db 081h,072h,001h,01Fh,01Bh,005h,000h
 
umbrella db 1
db 01Fh,01Fh,01Fh,036h,01Fh,018h,033h,0F6h
db 032h,01Fh,014h,032h,0F3h,0B1h,0F1h,0B1h
db 0F1h,0B1h,0F1h,0B1h,0F1h,032h,015h,082h
db 019h,031h,0F2h,0B1h,0F1h,0B1h,0F1h,0B1h
db 0F1h,0B3h,032h,0B2h,032h,012h,081h,001h
db 081h,018h,038h,0F1h,0B2h,032h,0B6h,032h
db 001h,01Ah,03Bh,0B7h,031h,0B1h,071h,001h
db 01Ah,03Dh,0B4h,031h,0B3h,071h,001h,019h
db 03Eh,0B2h,031h,0B4h,071h,001h,019h,034h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,035h
db 0B6h,071h,001h,018h,032h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,031h,001h,0B6h,071h,001h,019h,031h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,001h,081h,001h,031h,0B6h
db 031h,001h,018h,031h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,001h,081h
db 001h,0B1h,032h,0B4h,031h,071h,001h,019h
db 031h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,032h
db 0B2h,031h,0B2h,071h,001h,018h,031h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,001h,081h
db 001h,0B1h,071h,0B1h,071h,034h,0B3h,071h
db 001h,019h,031h,0B1h,071h,0B1h,071h,0B1h
db 001h,081h,001h,0B1h,071h,0B1h,071h,0B1h
db 033h,0B4h,071h,001h,01Ah,031h,0B1h,071h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,071h
db 0B1h,071h,034h,0B3h,071h,001h,01Bh,031h
db 0B1h,001h,081h,001h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,034h,0B3h,071h,001h,01Ch
db 001h,081h,001h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,035h,0B2h,071h,001h,01Bh
db 081h,071h,001h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,035h,0B2h,071h,001h
db 01Ah,081h,071h,001h,011h,001h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,035h,0B1h
db 071h,001h,01Ah,081h,071h,001h,013h,001h
db 0B1h,071h,0B1h,071h,0B1h,071h,037h,071h
db 001h,019h,081h,071h,001h,015h,002h,071h
db 0B1h,071h,038h,001h,019h,081h,071h,001h
db 018h,002h,038h,001h,015h,082h,012h,081h
db 071h,001h,01Bh,008h,015h,081h,071h,001h
db 011h,081h,071h,001h,01Fh,019h,081h,071h
db 001h,011h,081h,071h,001h,01Fh,01Ah,001h
db 071h,011h,081h,071h,001h,01Fh,01Bh,002h
db 081h,071h,001h,01Fh,01Dh,003h,000h
 
books db 0
db 00Fh,00Fh,006h,061h,021h,003h,022h,00Fh
db 009h,061h,0A1h,024h,0A1h,021h,00Eh,052h
db 003h,052h,002h,061h,0A1h,021h,071h,0F1h
db 071h,0A1h,022h,00Dh,051h,0D1h,054h,0D1h
db 051h,001h,061h,0A1h,021h,071h,0F1h,071h
db 0A1h,023h,012h,003h,012h,005h,051h,0D1h
db 051h,071h,0F1h,071h,0D1h,052h,061h,022h
db 071h,0F1h,071h,024h,011h,091h,014h,091h
db 011h,004h,051h,0D1h,051h,071h,0F1h,071h
db 0D1h,053h,061h,0A1h,027h,011h,091h,011h
db 071h,0F1h,071h,091h,012h,042h,001h,041h
db 052h,071h,0F1h,071h,055h,061h,0A1h,063h
db 023h,011h,091h,011h,071h,0F1h,071h,091h
db 011h,091h,041h,071h,043h,0D1h,059h,061h
db 0A1h,062h,023h,013h,071h,0F1h,071h,012h
db 091h,041h,071h,041h,071h,0F1h,041h,0D1h
db 059h,061h,0A1h,034h,021h,011h,081h,014h
db 091h,011h,041h,071h,041h,071h,0F1h,071h
db 041h,0D1h,059h,061h,0A1h,062h,023h,011h
db 081h,095h,011h,042h,071h,0F1h,071h,042h
db 0D1h,059h,061h,0A1h,063h,022h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 034h,021h,011h,081h,034h,091h,011h,071h
db 046h,0D1h,059h,061h,0A1h,063h,022h,011h
db 081h,095h,011h,071h,046h,0D1h,059h,061h
db 0A1h,062h,023h,011h,081h,095h,011h,071h
db 0C4h,042h,0D1h,059h,061h,0A1h,063h,022h
db 011h,081h,034h,091h,011h,071h,046h,0D1h
db 059h,061h,0A1h,062h,023h,011h,081h,095h
db 011h,071h,0C4h,042h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,062h,023h,011h,081h
db 095h,011h,071h,046h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,059h,061h,0A1h,034h,021h,011h,081h
db 034h,091h,011h,071h,046h,0D1h,059h,061h
db 0A1h,063h,022h,011h,081h,095h,011h,071h
db 0C4h,042h,0D1h,059h,061h,0A1h,062h,023h
db 011h,081h,095h,011h,071h,046h,0D1h,059h
db 061h,0A1h,034h,021h,011h,081h,034h,091h
db 011h,071h,0C4h,042h,0D1h,059h,061h,0A1h
db 063h,022h,011h,081h,095h,011h,071h,046h
db 0D1h,058h,001h,061h,0A1h,062h,023h,011h
db 081h,095h,011h,071h,046h,0D1h,057h,003h
db 026h,001h,016h,001h,046h,001h,056h,000h
 
paint db 6
db 06Fh,06Fh,069h,008h,06Fh,067h,002h,071h
db 0F6h,071h,002h,06Fh,064h,001h,0F3h,071h
db 0B1h,071h,0B1h,071h,0B1h,072h,031h,001h
db 06Fh,062h,001h,0F1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,001h,06Bh,001h,063h,001h,0F1h,071h
db 0B1h,071h,0B1h,0D6h,071h,0B1h,071h,0B1h
db 031h,001h,06Ah,002h,062h,001h,0F1h,0B1h
db 071h,0B1h,071h,0B1h,0D6h,051h,0B1h,071h
db 031h,001h,06Ah,002h,061h,001h,071h,0F1h
db 071h,0B1h,071h,0B1h,0D7h,051h,071h,0B1h
db 071h,031h,001h,068h,001h,0F1h,001h,061h
db 001h,0F1h,071h,0B1h,071h,0B1h,071h,0B1h
db 051h,0D6h,051h,071h,0B1h,031h,001h,067h
db 001h,0F1h,002h,061h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,052h,0D3h,052h
db 0B1h,071h,0B1h,031h,001h,066h,004h,061h
db 001h,0F1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,054h,0B1h,071h,0B1h,071h
db 031h,001h,065h,004h,061h,001h,0F1h,071h
db 0B1h,071h,0A1h,021h,0A1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,031h,001h,063h,001h,0F1h,001h
db 063h,001h,0F1h,0B1h,071h,0A1h,021h,0A1h
db 021h,0A1h,021h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,031h
db 001h,061h,001h,0F1h,001h,064h,001h,0F1h
db 071h,0B1h,021h,0A1h,021h,0A1h,021h,0A1h
db 021h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,031h,001h,0F1h
db 001h,065h,001h,0F1h,0B1h,021h,0A1h,021h
db 0A1h,021h,0A1h,022h,071h,0B1h,071h,0B1h
db 071h,0B1h,072h,033h,071h,001h,0C1h,002h
db 065h,001h,0F1h,071h,022h,0A1h,021h,0A1h
db 022h,071h,0B1h,071h,0B1h,071h,0B1h,072h
db 031h,004h,0C1h,001h,082h,001h,064h,001h
db 0F1h,0B1h,071h,025h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,062h,001h
db 0C1h,002h,081h,071h,031h,001h,063h,001h
db 0F1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 031h,001h,061h,001h,0C1h,001h,061h,001h
db 073h,031h,001h,062h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,093h,071h,0B1h,071h
db 0B1h,071h,0B1h,031h,002h,0C1h,001h,062h
db 001h,071h,0B1h,071h,031h,001h,062h,001h
db 0F1h,071h,0B1h,071h,0B1h,071h,094h,011h
db 071h,0B1h,071h,0B1h,071h,0B1h,031h,002h
db 062h,001h,071h,0B1h,071h,0B1h,071h,031h
db 001h,062h,001h,0B1h,071h,0B1h,071h,095h
db 011h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,003h,071h,0B1h,071h,0B1h,071h,0B1h
db 031h,001h,062h,001h,071h,0B1h,071h,0B1h
db 096h,011h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,031h,001h,062h,001h,0B1h,071h
db 0B1h,071h,011h,096h,011h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,063h,001h
db 0B1h,071h,0B1h,071h,011h,093h,012h,0B1h
db 071h,0B1h,071h,0C3h,071h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,071h,031h,001h,063h
db 001h,0F1h,0B1h,071h,0B1h,071h,013h,071h
db 0B1h,071h,0B1h,0C6h,041h,0B1h,071h,0B1h
db 071h,0B1h,071h,0B1h,031h,001h,064h,001h
db 0F1h,0B1h,071h,0B1h,071h,0B1h,071h,0B1h
db 071h,0B1h,0C8h,041h,0B1h,071h,0B1h,071h
db 0B1h,032h,001h,065h,001h,0F1h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,0C8h,041h
db 071h,0B1h,071h,0B1h,071h,031h,001h,067h
db 001h,0F1h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,041h,0C5h,042h,071h,0B1h,071h,0B1h
db 071h,032h,001h,068h,001h,081h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,045h,0B1h,071h
db 0B1h,071h,0B1h,071h,032h,001h,06Ah,002h
db 031h,071h,0B1h,071h,0B1h,071h,0B1h,071h
db 0B1h,071h,0B1h,071h,0B1h,071h,033h,002h
db 06Bh,005h,03Bh,003h,06Ch,002h,064h,00Bh
db 000h
 
molecule db 1
db 01Eh,084h,01Fh,01Bh,082h,064h,002h,01Fh
db 018h,081h,068h,001h,01Fh,017h,081h,061h
db 0F1h,071h,065h,001h,01Fh,013h,033h,082h
db 061h,072h,066h,001h,033h,01Ch,032h,093h
db 002h,062h,034h,063h,001h,093h,002h,019h
db 031h,097h,032h,094h,002h,061h,001h,094h
db 031h,001h,018h,031h,091h,0F1h,071h,093h
db 031h,097h,031h,001h,0F1h,071h,093h,031h
db 001h,017h,031h,092h,072h,093h,031h,091h
db 0F1h,071h,094h,031h,001h,072h,093h,032h
db 001h,016h,031h,096h,031h,092h,072h,094h
db 032h,001h,094h,032h,001h,016h,031h,096h
db 031h,097h,033h,001h,093h,033h,001h,017h
db 001h,095h,031h,097h,033h,001h,082h,091h
db 032h,001h,016h,082h,001h,093h,083h,001h
db 094h,034h,001h,063h,002h,031h,003h,013h
db 081h,063h,001h,082h,063h,001h,038h,001h
db 064h,081h,001h,063h,001h,012h,081h,061h
db 0F1h,071h,081h,066h,002h,034h,002h,065h
db 081h,001h,063h,001h,011h,081h,062h,072h
db 081h,061h,0F1h,071h,064h,081h,004h,021h
db 0F1h,071h,064h,082h,001h,062h,081h,001h
db 081h,063h,081h,062h,072h,064h,081h,034h
db 021h,072h,063h,083h,001h,062h,081h,001h
db 081h,063h,081h,067h,032h,094h,002h,064h
db 083h,001h,061h,082h,002h,063h,081h,066h
db 031h,097h,031h,001h,063h,083h,001h,061h
db 082h,001h,011h,001h,063h,001h,065h,031h
db 091h,0F1h,071h,094h,031h,001h,085h,001h
db 031h,082h,001h,012h,001h,082h,031h,001h
db 084h,031h,092h,072h,094h,032h,001h,084h
db 001h,031h,082h,001h,013h,001h,031h,091h
db 071h,002h,082h,031h,097h,033h,001h,082h
db 002h,091h,031h,002h,015h,031h,094h,002h
db 031h,097h,033h,003h,093h,031h,001h,016h
db 031h,097h,001h,094h,034h,001h,095h,032h
db 001h,016h,031h,097h,001h,038h,001h,095h
db 032h,001h,017h,001h,094h,033h,002h,034h
db 002h,094h,033h,001h,018h,001h,037h,001h
db 061h,004h,061h,001h,037h,001h,019h,002h
db 033h,002h,066h,082h,002h,033h,002h,01Ch
db 004h,067h,083h,004h,01Fh,013h,001h,088h
db 001h,01Fh,018h,002h,084h,002h,01Fh,01Bh
db 004h,000h
 
cd db 1
db 01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,01Fh,014h
db 086h,01Fh,018h,083h,0B3h,073h,083h,01Fh
db 013h,083h,0E2h,0B3h,076h,002h,01Fh,081h
db 0A2h,0E3h,0B3h,078h,001h,01Dh,081h,0A4h
db 0E3h,0B2h,079h,001h,01Bh,081h,072h,0A3h
db 0E3h,0B2h,07Ah,001h,01Ah,081h,0E1h,072h
db 0A3h,0E2h,0B2h,07Ah,001h,019h,081h,0E3h
db 072h,0A2h,0E2h,0B2h,07Bh,001h,018h,081h
db 072h,0E2h,072h,0A2h,0E1h,0B2h,07Bh,001h
db 017h,081h,075h,0E1h,072h,0A2h,084h,07Ah
db 001h,016h,081h,076h,0E1h,072h,081h,005h
db 071h,0F1h,077h,001h,016h,081h,077h,0E1h
db 081h,001h,014h,001h,081h,078h,001h,016h
db 081h,078h,081h,001h,014h,001h,081h,078h
db 001h,016h,082h,071h,081h,071h,081h,071h
db 081h,071h,081h,001h,014h,001h,081h,078h
db 001h,016h,081h,071h,081h,071h,081h,071h
db 081h,071h,082h,001h,014h,001h,081h,078h
db 001h,016h,082h,071h,081h,071h,081h,071h
db 081h,0F1h,071h,081h,004h,081h,079h,001h
db 016h,081h,071h,081h,071h,081h,071h,081h
db 0F1h,071h,0F1h,071h,084h,0E1h,079h,001h
db 017h,081h,071h,081h,071h,081h,0F1h,071h
db 0F1h,074h,0B1h,071h,0E2h,077h,001h,018h
db 082h,071h,081h,0F1h,071h,0F1h,074h,0B2h
db 0A1h,071h,0E2h,076h,001h,019h,082h,0F1h
db 071h,0F1h,076h,0B1h,0A1h,071h,0E3h,074h
db 001h,01Ah,081h,0F1h,071h,0F1h,076h,0B2h
db 0A2h,071h,0E3h,073h,001h,01Bh,081h,0F1h
db 078h,0B1h,0A2h,071h,0E4h,071h,001h,01Dh
db 081h,077h,0B3h,0A2h,071h,0E3h,001h,01Fh
db 082h,076h,0B2h,0A2h,071h,081h,002h,01Fh
db 013h,082h,073h,0B3h,0A1h,003h,01Fh,017h
db 007h,000h
 
trumpet db 1
db 01Ch,03Dh,001h,01Fh,014h,031h,0F1h,0B2h
db 036h,071h,001h,01Fh,016h,031h,0F1h,0B1h
db 035h,071h,001h,01Fh,018h,031h,0F1h,0B1h
db 033h,071h,001h,01Fh,013h,034h,012h,031h
db 0F1h,0B1h,033h,071h,001h,01Fh,012h,031h
db 0B2h,072h,032h,011h,031h,0B1h,032h,071h
db 001h,01Fh,012h,031h,0B1h,071h,003h,071h
db 0B1h,032h,0B1h,032h,071h,001h,01Fh,011h
db 031h,0F1h,071h,001h,013h,001h,071h,081h
db 031h,0B1h,032h,071h,001h,01Fh,011h,031h
db 0F1h,001h,014h,031h,001h,0B1h,031h,0B1h
db 032h,071h,001h,01Fh,011h,031h,0B1h,001h
db 014h,031h,001h,0B1h,031h,0B1h,032h,071h
db 001h,01Fh,011h,031h,0F1h,001h,012h,031h
db 011h,031h,001h,0B1h,031h,0B1h,032h,071h
db 001h,01Fh,011h,031h,0B1h,001h,011h,034h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0F1h,001h,031h,0F1h,0B2h,081h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0B1h,001h,031h,0B1h,081h,071h
db 081h,001h,0B1h,031h,0F5h,032h,011h,031h
db 001h,01Bh,031h,071h,031h,0F1h,0B1h,081h
db 001h,0B1h,001h,0F2h,035h,002h,032h,001h
db 01Bh,031h,0B1h,032h,003h,0B1h,0F1h,032h
db 0B1h,032h,071h,001h,012h,001h,031h,001h
db 01Bh,031h,071h,031h,0B2h,031h,001h,0B1h
db 031h,0B1h,031h,0B1h,032h,071h,001h,013h
db 002h,01Bh,031h,071h,032h,003h,0B1h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,031h,0B2h,031h,001h,0B1h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,032h,003h,0B1h,001h,0B1h,031h
db 0B1h,032h,071h,001h,01Fh,011h,031h,071h
db 031h,0B2h,001h,0B1h,031h,001h,0B1h,031h
db 0B1h,032h,071h,001h,01Fh,011h,031h,071h
db 031h,0B1h,081h,001h,0B1h,081h,001h,0B1h
db 031h,0B1h,032h,071h,001h,01Fh,011h,031h
db 071h,031h,0B1h,081h,001h,0B1h,081h,001h
db 0B1h,031h,0B1h,032h,071h,001h,01Fh,011h
db 031h,071h,031h,0B1h,081h,001h,0B1h,031h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0B1h,031h,0B1h,081h,001h,032h
db 001h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 011h,031h,0F1h,031h,0B1h,001h,031h,001h
db 031h,001h,0B1h,031h,0B1h,032h,071h,001h
db 01Fh,011h,031h,0B1h,032h,0B1h,001h,031h
db 002h,0B1h,031h,0B1h,032h,071h,001h,01Fh
db 012h,031h,0B1h,001h,034h,001h,0B1h,031h
db 0B1h,031h,071h,001h,01Fh,013h,031h,071h
db 031h,004h,032h,0B1h,001h,031h,071h,001h
db 01Fh,014h,031h,071h,0B1h,001h,0B2h,003h
db 072h,001h,01Fh,016h,002h,036h,002h,01Fh
db 019h,006h,000h
 
liquid db 1
db 019h,08Dh,01Fh,084h,06Dh,084h,018h,083h
db 06Fh,066h,083h,014h,081h,071h,06Dh,071h
db 0F3h,071h,067h,071h,081h,013h,081h,071h
db 06Ch,071h,0F5h,071h,066h,071h,081h,013h
db 081h,071h,06Eh,073h,068h,071h,081h,014h
db 081h,073h,06Fh,064h,073h,001h,015h,081h
db 0F1h,062h,073h,06Dh,073h,062h,081h,001h
db 016h,061h,0F1h,064h,07Dh,064h,081h,001h
db 017h,061h,0F1h,06Fh,066h,081h,001h,017h
db 061h,0F1h,06Fh,066h,081h,001h,017h,061h
db 0F1h,061h,0F1h,073h,06Fh,061h,081h,001h
db 017h,061h,0F1h,061h,0F1h,071h,063h,0AAh
db 065h,081h,001h,017h,061h,0F1h,061h,0F1h
db 071h,0AFh,0A1h,062h,081h,001h,017h,061h
db 0F1h,0A1h,0F1h,071h,0AFh,0A3h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,073h,0ABh,0F1h
db 0A4h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 071h,0AEh,0F1h,0A3h,081h,001h,017h,061h
db 0F3h,071h,0A3h,0F3h,0A6h,0F2h,0A4h,081h
db 001h,017h,061h,0F1h,0A1h,0F1h,071h,0A6h
db 0F6h,0A5h,0F1h,081h,001h,017h,061h,0F1h
db 0A1h,0F1h,073h,0AEh,0F1h,0A1h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A1h,0F2h
db 0AAh,0F3h,0A2h,081h,001h,017h,061h,0F1h
db 0A1h,0F1h,071h,0A3h,0FAh,0A5h,081h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A3h,08Ah
db 0A5h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 073h,081h,0A5h,071h,0F2h,071h,0A1h,083h
db 0A2h,081h,001h,017h,061h,0F1h,0A1h,0F1h
db 071h,0A8h,071h,0F2h,071h,0A4h,083h,001h
db 017h,061h,0F1h,0A1h,0F1h,071h,0A9h,0F1h
db 071h,0A7h,081h,001h,017h,061h,0F1h,0A1h
db 0F1h,071h,0A9h,0F1h,071h,0A7h,081h,001h
db 018h,001h,081h,0A2h,072h,0A7h,0F2h,071h
db 0A5h,081h,001h,019h,001h,081h,0AAh,071h
db 0F2h,071h,0A5h,081h,001h,01Ah,001h,083h
db 0A7h,071h,0F2h,071h,0A2h,083h,001h,01Ch
db 003h,088h,072h,083h,003h,01Fh,011h,00Dh
db 000h
 
telephone db 1
db 01Fh,01Fh,01Fh,01Fh,01Dh,006h,01Fh,019h
db 002h,0F1h,0B5h,003h,01Fh,015h,001h,0B3h
db 0F5h,0B3h,003h,01Fh,011h,001h,0B4h,032h
db 002h,0B1h,0F3h,0B3h,002h,01Dh,001h,0B4h
db 032h,001h,0F1h,0B1h,001h,0B3h,0F2h,0B3h
db 002h,01Bh,002h,0B2h,033h,001h,0B1h,071h
db 031h,001h,0B4h,0F2h,0B3h,002h,019h,001h
db 0B1h,002h,031h,003h,0B1h,071h,031h,001h
db 031h,0B2h,002h,031h,0F2h,0B3h,001h,018h
db 001h,0B2h,031h,001h,071h,0B3h,071h,031h
db 001h,032h,001h,0F1h,0B1h,001h,031h,0B1h
db 0F1h,0B3h,001h,018h,001h,031h,001h,071h
db 0B7h,003h,0B1h,071h,031h,001h,031h,0B1h
db 0F1h,0B3h,001h,018h,001h,071h,0B2h,0F2h
db 031h,0B5h,001h,0B1h,071h,031h,001h,031h
db 0B2h,0F1h,0B3h,001h,016h,001h,071h,0B3h
db 031h,001h,0F2h,031h,0B5h,071h,031h,001h
db 031h,0B2h,0F1h,0B3h,0F1h,001h,014h,001h
db 071h,0B2h,0F2h,031h,0B1h,031h,001h,0F2h
db 031h,0B5h,001h,031h,0B3h,0F3h,031h,001h
db 013h,001h,071h,0B3h,031h,001h,0F2h,031h
db 0B1h,031h,001h,0B5h,071h,001h,031h,0B3h
db 071h,033h,001h,012h,001h,071h,0B2h,0F2h
db 031h,0B1h,031h,001h,0F2h,031h,0B5h,071h
db 031h,001h,031h,0B3h,071h,033h,001h,011h
db 001h,071h,0B3h,031h,001h,0F2h,031h,0B1h
db 031h,001h,0B5h,071h,032h,002h,0B3h,071h
db 033h,002h,071h,0F2h,0B4h,031h,001h,0F2h
db 031h,0B5h,071h,033h,001h,032h,0B2h,071h
db 032h,003h,071h,0F4h,0B4h,031h,001h,0B5h
db 071h,034h,001h,031h,0B1h,032h,003h,031h
db 002h,071h,0B2h,0F4h,0B8h,071h,036h,001h
db 0B3h,071h,033h,002h,071h,0B4h,0F4h,0B5h
db 071h,037h,002h,0B2h,033h,001h,011h,001h
db 071h,0B6h,0F4h,0B2h,071h,039h,006h,012h
db 002h,072h,0B6h,0F3h,071h,03Bh,002h,017h
db 002h,072h,0B6h,0F1h,03Ah,002h,01Bh,002h
db 072h,0B5h,038h,002h,01Fh,002h,072h,0B3h
db 036h,002h,01Fh,014h,002h,072h,0B1h,034h
db 002h,01Fh,018h,002h,071h,032h,002h,01Fh
db 01Ch,003h,000h
 
smile db 1
db 01Ch,008h,01Fh,016h,003h,0B8h,003h,01Fh
db 011h,002h,0BEh,002h,01Dh,002h,0BFh,0B1h
db 002h,01Bh,001h,0BFh,0B5h,001h,019h,001h
db 0BFh,0B7h,001h,017h,001h,0BFh,0B9h,001h
db 015h,002h,0BFh,0B9h,002h,014h,001h,0B8h
db 002h,0B6h,002h,0B8h,001h,013h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,012h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,012h,001h,0B8h
db 004h,0B4h,004h,0B8h,001h,011h,001h,0B9h
db 004h,0B4h,004h,0B9h,002h,0B9h,004h,0B4h
db 004h,0B9h,002h,0BAh,002h,0B6h,002h,0BAh
db 002h,0B7h,001h,0BEh,001h,0B7h,002h,0B7h
db 001h,0BEh,001h,0B7h,002h,0B6h,001h,0BFh
db 0B1h,001h,0B6h,002h,0B3h,004h,0BFh,0B1h
db 004h,0B3h,002h,0B7h,001h,0BEh,001h,0B7h
db 001h,011h,001h,0B7h,001h,0BCh,001h,0B7h
db 001h,012h,001h,0B7h,002h,0BAh,002h,0B7h
db 001h,012h,001h,0B8h,003h,0B6h,003h,0B8h
db 001h,013h,001h,0B8h,001h,091h,006h,091h
db 001h,0B8h,001h,014h,002h,0B8h,001h,096h
db 001h,0B8h,002h,015h,001h,0B9h,001h,094h
db 001h,0B9h,001h,017h,001h,0B9h,004h,0B9h
db 001h,019h,001h,0BFh,0B5h,001h,01Bh,002h
db 0BFh,0B1h,002h,01Dh,002h,0BEh,002h,01Fh
db 011h,003h,0B8h,003h,01Fh,016h,008h,000h
 
banana db 1
db 01Fh,01Fh,01Fh,01Fh,01Ah,002h,01Fh,01Eh
db 003h,01Fh,01Eh,003h,01Fh,01Eh,003h,01Fh
db 01Eh,003h,01Fh,01Dh,005h,01Fh,01Ch,001h
db 0B1h,001h,0B1h,001h,01Fh,01Bh,002h,0B1h
db 001h,0B2h,001h,01Fh,01Ah,001h,0B2h,001h
db 0B2h,001h,01Fh,01Ah,001h,0B2h,001h,0B3h
db 001h,01Fh,019h,001h,0B3h,001h,0B2h,001h
db 01Fh,019h,001h,0B3h,001h,0B3h,001h,01Fh
db 018h,001h,0B4h,001h,0B3h,001h,01Fh,017h
db 001h,0B4h,001h,0B4h,001h,01Fh,017h,001h
db 0B4h,001h,0B4h,001h,01Fh,016h,001h,0B5h
db 001h,0B4h,001h,01Fh,016h,001h,0B5h,001h
db 0B4h,002h,01Fh,015h,001h,0B5h,001h,0B5h
db 001h,01Fh,014h,001h,0B6h,001h,0B5h,002h
db 01Fh,013h,001h,0B6h,001h,0B6h,002h,01Fh
db 012h,001h,0B6h,002h,0B6h,002h,01Fh,011h
db 001h,0B7h,002h,0B6h,002h,01Fh,002h,0B7h
db 003h,0B5h,002h,01Fh,001h,0B9h,008h,01Fh
db 002h,0BCh,002h,01Fh,013h,004h,0B6h,003h
db 01Fh,018h,006h,000h
 
bolt db 1
db 01Fh,01Fh,01Fh,006h,01Fh,01Ah,001h,085h
db 002h,01Fh,018h,001h,078h,001h,01Fh,017h
db 081h,002h,071h,004h,081h,001h,01Fh,017h
db 001h,083h,073h,002h,081h,01Fh,017h,081h
db 001h,072h,085h,001h,01Fh,016h,002h,083h
db 073h,002h,081h,001h,01Fh,013h,002h,071h
db 081h,001h,072h,085h,001h,071h,002h,01Eh
db 002h,073h,001h,083h,073h,002h,081h,073h
db 002h,01Bh,001h,075h,081h,001h,087h,001h
db 075h,001h,01Ah,001h,0F2h,074h,081h,006h
db 081h,074h,003h,01Ah,001h,072h,0F2h,07Ch
db 002h,082h,001h,01Ah,001h,074h,0FBh,001h
db 084h,001h,01Ah,001h,075h,0F1h,078h,001h
db 085h,001h,01Ah,001h,075h,0F1h,078h,001h
db 085h,001h,01Bh,002h,073h,0F1h,078h,001h
db 083h,002h,01Eh,002h,071h,0F1h,078h,001h
db 081h,002h,01Fh,013h,00Ch,01Fh,016h,081h
db 001h,072h,085h,001h,01Fh,016h,002h,083h
db 073h,002h,081h,001h,01Fh,013h,002h,071h
db 081h,001h,072h,085h,001h,071h,002h,01Eh
db 002h,073h,001h,083h,073h,002h,081h,073h
db 002h,01Bh,001h,075h,081h,001h,072h,085h
db 001h,075h,001h,01Ah,001h,0F2h,074h,081h
db 006h,081h,074h,003h,01Ah,001h,072h,0F2h
db 07Ch,002h,082h,001h,01Ah,001h,074h,0FBh
db 001h,084h,001h,01Ah,001h,075h,0F1h,078h
db 001h,085h,001h,01Ah,001h,075h,0F1h,078h
db 001h,085h,001h,01Bh,002h,073h,0F1h,078h
db 001h,083h,002h,01Eh,002h,071h,0F1h,078h
db 001h,081h,002h,01Fh,013h,00Ch,000h
 
 
coltbl dd 000000h,800000h,008000h,808000h
dd 000080h,800080h,008080h,0C0C0C0h
dd 808080h,0FF0000h,00FF00h,0FFFF00h
dd 0000FFh,0FF00FFh,00FFFFh,0FFFFFFh
dd 0006688ddh ; bitton color
 
 
pict dd globe
dd wa
dd sword
dd cow
dd mace
dd cube
dd ball
dd dish
dd apple
dd ok
dd speaker
dd print
dd light
dd key1
dd foto
dd flop
dd pillar
dd newspaper
dd umbrella
dd books
dd flag
dd paint
dd molecule
dd cd
dd trumpet
dd liquid
dd telephone
dd smile
dd banana
dd bolt
 
labnew db 'New game Clicks:'
labnewlen:
 
 
nkeydown dd ?
bitstat db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
bitpict db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
db ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
firstbit db ?
secondbit db ?
 
 
bitid db ?
 
 
mas: ; mas db (32*32)*3+1 dup (?)
 
I_END=mas+(32*32)*3+1
 
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/mine/trunk/access.h--
0,0 → 1,68
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
:int get_value(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].value;
}
 
:void set_value(int x, y, byte val)
{
EBX=x*ncy+y;
massiv[EBX].value=val;
}
 
:int get_open(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].open;
}
 
:void set_open(int x, y, byte op)
{
EBX=x*ncy+y;
massiv[EBX].open=op;
}
 
:int get_press(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].press;
}
 
:void set_press(int x, y, byte pr)
{
EBX=x*ncy+y;
massiv[EBX].press=pr;
}
 
:int get_mark(int x, y)
{
EBX=x*ncy+y;
return massiv[EBX].mark;
}
 
:void set_mark(int x, y, byte mar)
{
EBX=x*ncy+y;
massiv[EBX].mark=mar;
}
/programs/games/mine/trunk/changelog.txt
0,0 → 1,15
v0.3a (11/08/2003)
- fixed a bug on old kernels
 
v0.3 (09/08/2003)
- fixed some bugs
- new timer
- better random number generator
- user can't blow up after first mouse click
- uses system colors
 
v0.2 (29/06/2003)
- fixed a lot of bugs
 
v0.1 (22/06/2003)
- first public version
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/mine/trunk/draw.h--
0,0 → 1,184
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
void draw_window()
// Ïðîöåäóðà îòðèñîâêè îêíà
{
mouse_disable();
 
sys_window_redraw(1);
sys_get_colors(#colors, 40);
 
// WINDOW
EBX = xpos << 16 + xsize;
ECX = ypos << 16 + ysize;
sys_draw_window(EBX, ECX, 0x02CCCCCC, colors.w_grab | 0x80000000, colors.w_frames);
 
// LABEL
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "MeOS MineSweeper", 16);
 
// <CLOSE> BUTTON (1)
EBX = xsize - 19; EBX = EBX<<16 + 12;
sys_draw_button(EBX, 5<<16+12, 1, colors.w_grab_button);
 
// <NEW GAME> BUTTON (911)
EBX = xsize / 2 - 10;
EBX = EBX << 16 + 20;
sys_draw_button(EBX, 25<<16+20, 911, clLightGray);
 
// <CHANGE MODE> BUTTON (1001)
sys_draw_button(10<<16+7, 23<<16+7, 1001, 0x118811);
 
// <USER FIELD> BUTTON (1002)
//sys_draw_button(20<<16+7, ECX, EDX+1, 0xddbb44);
 
// <OPTIONS> BUTTON (1003)
// sys_draw_button();
 
// <SCORES> BUTTON (1004)
// sys_draw_button();
 
// <ABOUT> BUTTON (1005)
// sys_draw_button();
 
sys_window_redraw(2);
 
draw_time(); // draw timer
draw_minesi(); // draw mines
draw_squares(); // draw field
 
mouse_enable();
}
 
dword num_colors[8]=
{
0x4444d0, // 1
0x118811, // 2
0xd04444, // 3
0x111199, // 4
0x991111, // 5
0x117089, // 6
0x000000, // 7
0x808080 // 8
};
 
void draw_square(int x, y)
// Îòðèñîâêà îäíîé êëåòêè
{
int xl, xr, yt, yb;
dword tcolor = clBlack;
byte tchar,tval;
 
xl = XPX * x + XST;
xr = xl + XPX - 1;
yt = YPX * y + YST;
yb = yt + YPX - 1;
 
EBX = xl << 16 + xr - xl;
ECX = yt << 16 + yb - yt;
$inc ebx
$inc ecx
sys_draw_bar(EBX, ECX, clLightGray);
 
if (!get_open(x, y))
{
ECX = yt << 16 + yb - 1;
sys_draw_line(xl<<16+xl, ECX, clWhite);
EBX = xl << 16 + xr - 1;
sys_draw_line(EBX, yt << 16 + yt, EDX);
sys_draw_line(xr << 16 + xl, yb << 16 + yb, clDarkGray);
sys_draw_line(xr << 16 + xr, yb << 16 + yt, EDX);
 
SWITCH (get_mark(x, y))
{
CASE 2: tcolor = 0x121288; tchar = '?'; BREAK;
CASE 1: tcolor = 0xd04444; tchar = 'P';
}
 
IF (get_mark(x,y))
{
EBX = xl + 5; EBX <<= 16; EBX += yt + 4;
sys_write_text(EBX, tcolor, #tchar, 1);
EBX += 0x00010000;
/* Âòîðîé ðàç - ðåãèñòðû ñîõðàíÿþòñÿ */
sys_write_text(EBX, ECX, EDX, ESI);
}
}
else // get_open(x,y)==TRUE
{
tval = get_value(x, y);
IF (tval == 0)
{
//tcolor=clLightGray;
//tchar=' ';
GOTO NOCHAR;
}
ELSE IF (tval == MINE)
{
tcolor = 0xee1111;
tchar = '*';
}
ELSE
{
tchar = tval + '0';
tcolor = num_colors[tval-1];
}
 
EBX = xl + 5; EBX <<= 16; EBX += yt + 5;
sys_write_text(EBX, tcolor, #tchar, 1);
EBX += 0x00010000;
sys_write_text(EBX, ECX, EDX, ESI);
NOCHAR:
sys_draw_line(xl << 16 + xl, yt << 16 + yb, clDarkGray);
sys_draw_line(xl << 16 + xr, yt << 16 + yt, EDX);
}
}
 
void draw_time()
// Òàéìåð
{
sys_draw_bar(XST<<16+25, 31<<16+10, 0xCCCCCC);
EBX = 0x00030000;
sys_write_number(EBX, time, XST<<16+32, 0x10ff0000);
}
 
void draw_minesi()
// Èíäèêàòîð êîëè÷åñòâà íåðàññòàâëåííûõ ìèí
{
EBX = xsize - XST - 25;
$PUSH EBX
EBX = EBX << 16 + 25;
sys_draw_bar(EBX, 31<<16+12, 0xCCCCCC);
$POP EDX
EDX <<= 16; EDX += 30;
EBX = 0x00030000;
sys_write_number(EBX, cmines, EDX, 0x10ff0000);
}
 
void draw_squares()
// Îòðèñîâêà ìèííîãî ïîëÿ
{
int x,y;
 
FOR (x=0; x < ncx; x++)
FOR (y=0; y < ncy; y++)
draw_square(x, y);
}
/programs/games/mine/trunk/mine.c--
0,0 → 1,468
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
//? pragma option LST // generate ASM listing file - ñîçäàòü àññåìáëåðíûé ëèñòèíã
//? warning TRUE // âêëþ÷èòü ðåæèì âûâîäà ïðåäóïðåæäåíèé
? pragma option meos
? jumptomain NONE
? include "msys.h--" // MenuetOS system functions - ñèñòåìíûå ôóíêöèè MenuetOS
 
? print "\nÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
? print "\n³ MeOS MineSweeper v0.3 ³"
? print "\n³ (C) Ivan Poddubny (ivan-yar@bk.ru) 2003 ³"
? print "\nÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\n"
 
/************************************** DATA **************************************/
 
? define XPX 16 // X pixels by square - ðàçìåð êëåòêè â ïèêñåëÿõ
? define YPX 16 // Y pixels by square
? define MINE 255 // çíà÷åíèå äëÿ ìèíû â ïîëå value
 
struct
{
byte value; // number of mines - êîëè÷åñòâî ìèí â îêðóæàþùèõ êëåòêàõ
byte open; // square is open - êëåòêà îòêðûòà
byte press; // reserved - çàðåçåðâèðîâàíî
byte mark; // square is marked - êëåòêà ïîìå÷åíà
} massiv[30*30];
 
struct
{
byte a_inc;
byte b_inc;
} matrix[8] = {-1,-1,1,0,1,0,0,1,-2,0,0,1,1,0,1,0};
 
struct
{
byte x_size;
byte y_size;
byte nmines;
} stdmodes[3] = {9,9,10, 16,16,40, 30,16,99}; // {x,y,m}
 
int XST, // offset of first pixel X - ñìåùåíèå ïîëÿ îò ãðàíèöû îêíà
YST,
ncx, // number of squares in X - ðàçìåð ïîë
ncy,
cmines, // mines discovered - êîëè÷åñòâî íåîòêðûòûõ ìèí
initmines, // number of initial mines - èçíà÷àëüíîå êîëè÷åñòâî ìèí
sqclosed; // squares still closed - êîëè÷åñòâî çàêðûòûõ êëåòîê
 
dword xpos = 100, // window coordinates - êîîðäèíàòû îêíà
ypos = 100,
xsize, // window size
ysize;
 
byte stop_game = FALSE, // game stopped - ïðèçíàê êîíöà èãðû
mouse_en = TRUE, // mouse enabled - ìûøü
mode = 3, // ðåæèì èãðû 1-íîâè÷îê 2-ëþáèòåëü 3-ýêñïåðò (0 îñîáûé)
mouse_status,
firstmine;
 
ProcessInfo procinfo;
SystemColors colors;
 
/************************************** CODE **************************************/
 
inline void fastcall mouse_enable()
{
$mov eax,40
$mov ebx,100111b
$int 0x40
}
 
inline void fastcall mouse_disable()
{
$mov eax,40
$mov ebx,000111b
$int 0x40
}
 
? include "timer.h--" // timer functions
? include "draw.h--" // drawing functions
? include "access.h--" // get & set functions
? include "random.h--" // random number generator
//? include "uf.h--" // user field window
 
void init()
// Èíèöèàëèçàöè
{
XST = 10; YST = 52; // FIELD POSITION IN WINDOW
 
ECX = mode;
IF (ECX != 0)
{
//ncx = stdmodes[ECX-1].x_size;
//ncy = stdmodes[ECX-1].y_size;
//cmines = initmines = stdmodes[ECX-1].nmines;
 
EBX = #stdmodes;
ECX--; ECX *= 3;
EBX += ECX;
 
ncx = DSBYTE[EBX]; EBX++;
ncy = DSBYTE[EBX]; EBX++;
cmines = initmines = DSBYTE[EBX];
}
 
xsize = ncx * XPX + XST + XST;
ysize = ncy * YPX + YST + XST;
} // init
 
void clear_all()
// Î÷èñòèòü ïîëå
{
EAX = 0;
EDI = #massiv;
ECX = ncx * ncy;
$REP $STOSD
} // clear_all
 
void new_game()
// Íîâàÿ èãðà
{
init(); // èíèöèàëèçàöè
randomize(); // ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
clear_all(); // î÷èñòèòü ïîëå
 
firstmine = TRUE; // èãðà íå íà÷àòà
mouse_en = TRUE; // ìûøü ðàçðåøåíà
stop_game = FALSE; // èãðà íå çàêîí÷åíà
stop_timer();
time = 0; // âðåìÿ = 0
} // new_game
 
void set_mines(int nminas, no_x, no_y)
// Ðàññòàâèòü ìèíû
{
int i, x, y, a, b;
 
sqclosed = ncx * ncy - nminas; // êîëè÷åñòâî ÍÅîòêðûòûõ êëåòîê = ïëîùàäü ïîëÿ - êîë-âî ìèí
 
FOR (i = nminas; i > 0; i--) // ðàññòàâèòü ìèíû
{
x = random(ncx); y = random(ncy);
WHILE ((get_value(x, y) == MINE) || ((x == no_x) && (y == no_y)))
{
x = random(ncx);
y = random(ncy);
}
set_value(x, y, MINE);
}
 
for (x = ncx-1; x >= 0; x--) // ðàññòàâèòü öèôðû
{
for (y = ncy-1; y >= 0; y--)
{
IF (get_value(x, y) == MINE)
continue;
EDX = x * ncy + y*4 + #massiv;
a = x; b = y;
FOR (i = 0; i < 8; i++)
{
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (get_value(a, b) == MINE))
DSBYTE[EDX]++;
}
}
}
} // set_mines
 
inline void do_mouse(void)
// Îáðàáîò÷èê ìûøè
{
int x,y;
 
EAX = sys_read_mouse(2); // ìûøü íå íàæàòà -> âûõîä
IF (EAX == 0) return;
 
mouse_status = AL;
 
EAX = sys_read_mouse(1); // ìûøü âíå ïîëÿ -> âûõîä
EBX = EAX; EAX >>= 16; EBX &= 0xffff;
ECX = ncx * XPX + XST - 1;
EDX = ncy * YPX + YST - 1;
IF ((EAX < XST) || (EBX < YST) || (EAX > ECX) || (EBX > EDX)) return;
 
EAX -= XST; EAX /= XPX; x = EAX; // âû÷èñëèòü x è y
EBX -= YST; EBX /= YPX; y = EBX;
 
IF ((mouse_status == 1) && (!get_open(x, y)) && (get_mark(x, y) != 1))
{
// íà íåîòêðûòîé êëåòêå áåç ôëàæêà íàæàòà ëåâàÿ êíîïêà ìûøè
// left mouse button is pressed
IF (firstmine == TRUE)
{
firstmine = FALSE;
set_mines(cmines, x, y);
start_timer();
}
IF (get_value(x, y) == MINE)
{
end_game();
return;
}
open_square(x, y);
}
else IF ((mouse_status == 2) && (!get_open(x, y)))
{
// íà íåîòêðûòîé êëåòêå íàæàòà ïðàâàÿ êíîïêà ìûøè
// right mouse button is pressed
EBX = get_mark(x, y); EBX++;
EBX = EBX%3;
SWITCH (EBX)
{
CASE 2: cmines++; BREAK;
CASE 1: cmines--;
}
 
set_mark(x, y, EBX);
 
draw_minesi();
draw_square(x, y);
return;
}
ELSE IF ((mouse_status == 3) && (get_open(x, y)))
{
// íà îòêðûòîé êëåòêå íàæàòû îáå êíîïêè ìûøè
// both mouse buttons are pressed
IF (open_near_squares(x, y) == TRUE)
end_game();
}
 
if (sqclosed == 0)
// îòêðûòû âñå êëåòêè
// all squares are opened
{
mouse_en = FALSE; // çàïðåòèòü ìûøü
stop_timer();
stop_game = TRUE; // èãðà çàâåðøåíà
 
// ïîñòàâèòü íåðàññòàâëåííûå ìèíû
FOR (x = 0; x < ncx; x++)
FOR (y = 0; y < ncy; y++)
IF ((get_value(x, y) == MINE) && (get_mark(x, y) != 1))
{
set_mark(x, y, 1);
cmines--;
draw_square(x, y);
}
draw_minesi();
}
} // do_mouse
 
void open_square(int x, y)
// Îòêðûòü êëåòêó
{
int a, b, i;
 
set_open(x, y, TRUE);
sqclosed--;
 
IF (get_value(x, y) != 0)
{
draw_square(x, y);
}
else
{
draw_square(x, y);
a = x; b = y;
FOR (i = 0; i < 8; i++)
{
//a += matrix[i].a_inc;
//b += matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (!get_open(a, b)) && (get_mark(a, b) != 1))
open_square(a, b);
}
}
} // open_square
 
int open_near_squares(int x, y)
// Îòêðûòü áëèçëåæàùèå êëåòêè (îáå êíîïêè ìûøè âìåñòå)
{
int a, b, i;
dword suma = 0;
 
a = x;
b = y;
FOR (i = 0; i < 8; i++)
{
//a+=matrix[i].a_inc;
//b+=matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (get_mark(a, b) == 1))
suma++;
}
 
if (suma == get_value(x, y))
{
suma = 0;
a = x;
b = y;
for (i = 0; i < 8; i++)
{
//a+=matrix[i].a_inc;
//b+=matrix[i].b_inc;
AL = matrix[i].a_inc;
$movsx eax,al
a += EAX;
AL = matrix[i].b_inc;
$movsx eax,al
b += EAX;
IF ((a >= 0) && (b >= 0) && (a < ncx) && (b < ncy) && (!get_open(a, b)) && (get_mark(a, b) != 1))
{
IF (get_value(a, b) == MINE)
suma = 1;
open_square(a, b);
}
}
RETURN suma;
}
ELSE
RETURN 0;
} // open_near_squares
 
void end_game()
{
int x,y;
 
stop_game = TRUE;
stop_timer();
for (x=0; x<ncx; x++)
{
for (y=0; y<ncy; y++)
{
IF (get_value(x, y) == MINE)
{
set_mark(x, y, FALSE); // ñíÿòü ôëàã
open_square(x, y);
}
ELSE IF (get_mark(x, y) == 1) // åñëè ìèíû íåò, à ôëàæîê åñòü
{
EBX = XPX * x + XST; // x left
ECX = EBX + XPX - 1; // x right
EBX <<= 16; EBX += ECX;
$PUSH EBX
 
ECX = YPX * y + YST; // y top
$PUSH ECX
EDX = ECX + YPX - 1; // y bottom
ECX <<= 16; ECX += EDX;
sys_draw_line(EBX, ECX, clBlack);
 
$POP EDX
ECX = EDX + YPX - 1;
ECX <<= 16; ECX += EDX;
$POP EBX
sys_draw_line(EBX, ECX, clBlack);
CONTINUE;
}
}
}
} // end_game
 
 
void main()
{
sys_delay(5); // for old kernel only!
new_game();
draw_window();
 
mouse_enable();
while()
{
switch (sys_wait_event_timeout(100)) // wait for 1 second
{
CASE evReDraw:
draw_window();
continue;
 
CASE evKey:
IF (sys_get_key() == 27)
sys_exit_process();
continue;
 
CASE evButton:
EAX = sys_get_button_id();
IF (EAX == 911) // new game
{
new_game();
draw_squares();
draw_time();
draw_minesi();
}
ELSE IF (EAX == 1001) // change mode
{
// mode++; mode%=3; mode++;
EAX = mode; EAX++; EAX = EAX%3; EAX++; mode = AL;
 
// get window position - ïîëó÷èòü êîîðäèíàòû îêíà
sys_process_info(#procinfo, -1);
xpos = procinfo.xstart;
ypos = procinfo.ystart;
 
// start a new process and terminate this one
sys_create_thread(#main, ESP);
sys_exit_process();
}
//ELSE IF (EAX == 1002)
//{
// start_uf();
//}
ELSE IF (EAX == 1) // close window
sys_exit_process();
CONTINUE;
 
case evMouse:
IF (!mouse_en) // is mouse enabled ?
CONTINUE;
do_mouse();
// wait for mouse release - æäàòü îòïóñêàíèÿ êíîïêè
WHILE (sys_read_mouse(2) == mouse_status)
{
check_timer();
sys_delay(6);
CONTINUE;
}
check_timer();
IF (stop_game) // disable mouse if game is stopped
mouse_en = FALSE;
CONTINUE;
}
check_timer();
sys_delay(2);
}
} // main
/programs/games/mine/trunk/msys.h--
0,0 → 1,806
/*
Sphinx C-- header file for MenuetOS applications.
Based on msys.h-- written by Alexey Sugonyaev and modified by Barry Kauler.
This extended version is written by Ivan Poddubny.
 
e-mail: ivan-yar@bk.ru
*/
 
// KeyCode constant
#define UP_KEY 130+48
#define DOWN_KEY 129+48
#define LEFT_KEY 128+48
#define RIGHT_KEY 131+48
#define RETURN_KEY 13
#define BACKSPACE_KEY 8
 
// Color constant
#define clWhite 0x00ffffff
#define clGray 0x00808080
#define clLightGray 0x00c0c0c0
#define clDarkGray 0x00707070
#define clBlack 0x00000000
#define clRed 0x00ff0000
#define clGreen 0x0000ff00
#define clBlue 0x000000ff
 
#define evReDraw 1
#define evKey 2
#define evButton 3
#define evMouse 6
#define evIPC 7
 
struct FileInfo
{
dword read,
firstBlock,
qnBlockRead,
retPtr,
Work;
byte filedir;
};
 
struct ProcessInfo
{
dword cpu_usage;
word winstackpos;
word winstackval;
word not_used1;
byte name[12];
dword memstart,
memory_used,
PID,
xstart,
ystart,
xsize,
ysize;
byte not_used2[974];
};
 
#define SystemColors SystemColours // usa/british
 
struct SystemColours
{
dword w_frames,
w_grab,
w_grab_button,
w_grab_button_text,
w_grab_text,
w_work,
w_work_button,
w_work_button_text,
w_work_text,
w_work_graph;
};
 
/*
0 = DEFINE WINDOW
{x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames
EBX = [x_start][x_size]
ECX = [y_start][y_size]
EDX, ESI, EDI = [00RRGGBB]
*/
inline fastcall void sys_draw_window(dword EBX, ECX, EDX, ESI, EDI)
{
EAX = 0; // function 0 : define and draw window
$int 0x40
}
 
/*
01 = PUTPIXEL
ebx [x]
ecx [y]
edx pixel color 0x0XRRGGBB
^ 0 normal put, 1 negative
ret: nothing changed
*/
inline fastcall void sys_put_pixel(dword EBX,ECX,EDX)
{
EAX=1;
$int 0x40
}
 
/*
02 = GET KEY
ret: al 0 successful -> ah = key
al 1 no key in buffer
MODIFIED, see below...
*/
inline fastcall dword sys_get_key()
{
EAX = 2; // just read it key from buffer
$int 0x40
$shr eax,8
} //return eax=key code.
 
/*
03 = GET SYSTEM CLOCK
ret: eax 0x00SSMMHH sec,min,hour
*/
inline fastcall dword sys_get_clock()
{
EAX=3;
$int 0x40
}
 
/*
04 = WRITE TEXT TO WINDOW
ebx [x start]*65536 + [y start]
ecx text color 0x00RRGGBB
edx pointer to text beginning
esi text length
ret: nothing changed
*/
inline fastcall void sys_write_text(dword EBX, ECX, EDX, ESI)
{
EAX = 4;
$int 0x40;
}
 
/*
05 = DELAY X/100 SECS
ebx delay in 1/100 secs
ret: nothing changed
*/
inline fastcall void sys_delay(dword EBX)
{
EAX = 5;
$int 0x40
}
 
/*
06 = OPEN FILE FROM FLOPPY
ebx pointer to filename -> 11 capital letters
ecx set 0x00000000 - reserved
edx set 0xffffffff - reserved
esi read to mem position
ret: nothing changed
*/
inline fastcall void sys_open_file_floppy(dword EBX, ESI)
{
$xor ecx,ecx
EDX = -1;
EAX = 6;
$int 0x40
}
 
/*
07 = PUTIMAGE
ebx pointer to image in memory - RRGGBBRRGGBB..
ecx image size [x]*65536+[y]
edx image position in window [x]*65536+[y]
ret: eax 0 succesful, 1 overlapped
*/
inline fastcall dword sys_put_image(dword EBX, ECX, EDX)
{
EAX = 7;
$int 0x40
}
 
/*
08 = DEFINE BUTTON
ebx [x start]*65536 + [x size]
ecx [y start]*65536 + [y size]
edx button id number
esi button color 0x 00 RR GG BB
ret: nothing changed
*/
inline fastcall void sys_draw_button(dword EBX, ECX, EDX, ESI)
{
EAX = 8;
$int 0x40
}
 
/*
09 = PROCESS INFO
ebx pointer to 1024 bytes table
ecx process number or -1 = who am I
ret: eax number of processes
table : +00 dword cpu usage
+04 word processes position in windowing stack
+06 word window stack value at ecx
+10 12 db name of the process
+22 dword start of processes memory
+26 dword memory used by process
+30 dword PID of the process
+34 dword window x start
+38 dword window y start
+42 dword window x size
+46 dword window y size
*/
inline fastcall dword sys_process_info(dword EBX, ECX)
{
EAX = 9;
$int 0x40
}
 
/*
10 = WAIT FOR EVENT
ret: eax event type, 1 window redraw, 2 key in buffer, 3 button pressed
*/
inline fastcall dword sys_wait_event()
{
EAX = 10; // wait here for event
$int 0x40
}
 
/*
11 = CHECK FOR EVENT, NO WAIT
ret: eax 0 no event, 1 window redraw, 2 key in buffer, 3 button pressed
*/
inline fastcall dword sys_nowait_event()
{
EAX = 11;
$int 0x40
}
 
/* 12 = WINDOW REDRAW
EBX=1 start of draw, =2 end of draw.
*/
inline fastcall void sys_window_redraw(dword EBX)
{
EAX = 12; // function 12:tell os about windowdraw
$int 0x40
}
 
/*
13 = DRAW BAR
DrawBar(EBX=[xstart][xsize],ECX=[ystart][ysize],EDX=[0x00RRGGBB])
ebx [x start]*65536 + [x size]
ecx [y start]*65536 + [y size]
edx color 0x00RRGGBB
ret: nothing changed
*/
inline fastcall void sys_draw_bar(dword EBX, ECX, EDX)
{
EAX = 13;
$int 0x40
}
 
/*
14 = GET SCREEN MAX
ret: eax [screen x max]*65536 + [screen y max]
*/
inline fastcall dword sys_get_screen_size()
{
EAX = 14;
$int 0x40
}
 
/*
15 = BACKGROUND
ebx 1 : set background size
ecx x size
edx y size
ebx 2 : write to background memory - max (0x100000-16)
ecx position in memory in bytes
edx color 0x00RRGGBB
ebx 3 : draw background
ebx 4 : type of background draw
ecx 1 - tile
ecx 2 - stretch
ebx 5 : blockmove image to os bgr memory
ecx - from
edx - to where in os bgr memory
esi - count of bytes to move
*/
inline fastcall void sys_set_background(dword EBX, ECX, EDX, ESI)
{
EAX = 15;
$int 0x40
}
 
 
/*
17 = GET PRESSED BUTTON ID
ret: al 0 successful -> ah = id number al 1 no key in buffer.
MODIFIED, see below.
*/
inline fastcall dword sys_get_button_id()
{
EAX = 17; // Get ID
$int 0x40
$shr eax,8
} //eax=id, eax=0 no id.
 
/*
18 = SYSTEM SERVICE
ebx 1 - system boot
ebx 2 - force terminate , ecx process no
ebx 4 - idle clock cycles / second
ebx 5 - time stamp counter / second - cpu speed
HD-> ebx 6 - save ramdisk to /hd/1/menuet.img
*/
inline fastcall dword sys_service(dword EBX, ECX)
{
EAX = 18;
$int 0x40
}
 
/*
19 = START PROGRAM from RAMDISK
ebx point to 11 char filename
ecx 0, or point to ASCIIZ start parameters - max 256 bytes
ret: eax 0 successful
eax other error code
*/
inline fastcall dword sys_exec_app_ramdisk(dword EBX, ECX)
{
EAX = 19;
$int 0x40
}
 
/*
20 = MIDI INTERFACE - MPU401
ebx 1 - reset device
ebx 2 - cl midi data to output
*/
inline fastcall void sys_midi(dword EBX)
{
EAX = 20;
$int 0x40
}
 
/*
21 = SETUP FOR DEVICES
ebx 1=roland mpu midi base , base io address
ebx 2=keyboard 1 base keymap 2 shift keymap (ecx pointer to keymap)
9 country 1eng 2fi 3ger 4rus
ebx 3=cd base 1 pri.master 2 pri slave,
3 sec master 4 sec slave
ebx 4=sb16 base, base io address
ebx 5=system language, 1eng 2fi 3ger 4rus
ebx 6=wss base, base io address
ebx 7=hd base, 1 pri.master 2 pri slave
3 sec master 4 sec slave
ebx 8=fat32 partition in hd
*/
inline fastcall void sys_setup_devices(dword EBX, ECX)
{
EAX = 21;
$int 0x40
}
 
/*
23 = WAIT FOR EVENT WITH TIMEOUT
ebx time to delay in hs
ret: eax event type: 0 no event, 1 window redraw,
2 key in buffer, 3 button
*/
inline fastcall dword sys_wait_event_timeout(dword EBX)
{
EAX = 23;
$int 0x40
}
 
/*
24 = CD AUDIO
ebx 1 - play from ecx 00 FR SS MM
ebx 2 - get playlist size of ecx to [edx]
ebx 3 - stop/pause play
*/
inline fastcall void sys_cd_audio(dword EBX, ECX, EDX)
{
EAX = 24;
$int 0x40
}
 
/*
25 = SB16 - mixer I
ebx 1 - set main volume cl [L]*16+[R]
ebx 2 - set cd volume cl [L]*16+[R]
*/
inline fastcall void sys_sb16_mixer_1(dword EBX, ECX)
{
EAX = 25;
$int 0x40
}
 
/*
26 = GET SETUP FOR DEVICES
ebx 1=roland mpu midi base , base io address
ebx 2=keyboard 1 base keymap 2 shift keymap
9 country 1eng 2fi 3ger 4rus
ebx 3=cd base 1 pri.master 2 pri slave,
3 sec master 4 sec slave
ebx 4=sb16 base, base io address
ebx 5=system language, 1eng 2fi 3ger 4rus
ebx 6=wss base, base io address
ebx 7=hd base, 1 pri.master 2 pri slave
3 sec master 4 sec slave
ebx 8=fat32 partition in hd
ebx 9=1/100 timer tics from stard -> eax
return value in eax
*/
inline fastcall dword sys_get_setup_devices(dword EBX)
{
EAX = 26;
$int 0x40
}
 
/*
27 = WINDOWS SOUND SYSTEM
ebx 1 - set main volume to cl 0-255
ebx 2 - set cd volume to cl 0-255
*/
inline fastcall void sys_windows_sound_system(dword EBX, ECX)
{
EAX = 27;
$int 0x40
}
 
/*
28 = SB16 - mixer II
ebx 1 - set main volume to cl 0-255
ebx 2 - set cd volume to cl 0-255
*/
inline fastcall void sys_sb16_mixer_2(dword EBX, ECX)
{
EAX = 28;
$int 0x40
}
 
/*
29 = GET DATE
ret: eax 0x00YYDDMM year date month
*/
inline fastcall dword sys_get_date()
{
EAX = 29;
$int 0x40
}
 
/*
30 = READ HD
ebx pointer to file
ecx file lenght
edx block to read, starts from 1, blocksize = 512 bytes
esi reserved, set as 1
edi pointer to return/work area (atleast 20 000 bytes)
return: work_area+1024 <- requested block of 512 bytes
*/
inline fastcall dword sys_read_hd(dword EBX, ECX, EDX, ESI, EDI)
{
EAX = 30;
$int 0x40
}
 
/*
31 = START APP FROM HD
ebx pointer to file
ecx file lenght
edx pointer to return/work area (atleast 20 000 bytes)
ret eax=0 successful, eax<>0 errorcode
*/
inline fastcall dword sys_exec_app_hd()
{
EAX = 31;
$int 0x40
}
 
/*
32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY
ebx pointer to filename
*/
 
inline fastcall dword sys_floppy_delete(EBX)
{
EAX = 32;
$int 0x40
}
 
/*
33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY
ebx pointer to file name
ecx pointer to data
edx count to write in bytes
esi 0 create new , ( 1 append - not implemented yet )
*/
inline fastcall dword sys_floppy_save(EBX,ECX,EDX)
{
EAX = 33;
ESI = 0;
$int 0x40
}
 
/*
34 = READ DIRECTORY FROM FLOPPY
ebx reserved : set as zero
ecx reserved : set as zero
edx start 512 block to read
esi reserved : set as 1
edi pointer to return area
 
 
35 = READ SCREEN PIXEL
ebx = pixel count from top left of the screen
return : eax = 0x00RRGGBB
*/
 
/*
37 = READ MOUSE POSITION
ebx=0 screen relative
ebx=1 window relative
ebx=2 buttons pressed
return in eax
*/
inline fastcall dword sys_read_mouse(dword EBX)
{
EAX = 37;
$int 0x40
}
 
/*
38 = DRAW LINE
ebx [x start] shl 16 + [x end]
ecx [y start] shl 16 + [y end]
edx colour 0x00RRGGBB
return : nothing changed
*/
inline fastcall void sys_draw_line(dword EBX, ECX, EDX)
{
EAX = 38;
$int 0x40
}
 
/*
39 = GET BACKGROUND
ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size]
ebx=2
ecx= postition of backgrounds memorymap to return in eax
ebx=4 -> eax=1 tiled, eax=2 stretched
*/
inline fastcall dword sys_get_background(dword EBX, ECX)
{
EAX = 39;
$int 0x40
}
 
/*
40 = SET BITFIELD FOR WANTED EVENTS
as default:
ebx = 00000000 00000000 00000000 00000111b events:
I window draw
I key in buffer
I button in buffer
I (end request)
I desktop background draw
I (mouse change)
I---------------I get irqs data
 
 
41 = GET IRQ OWNER
ebx = irq
return : PID of the process
 
 
42 = GET DATA READ BY IRQ
ebx IRQ number
return : eax number of bytes in buffer
bl data
ecx 0 = successful data read
1 = no data in buffer
2 = incorrect IRQ owner
 
 
43 = SEND DATA TO DEVICE
bx : port
cl : data
return : eax = if 0 successful, other = error
 
 
44 = PROGRAM IRQ's
ebx pointer to table
ecx irq number
 
 
45 = RESERVE/FREE IRQ
ebx 0 reserve 1 free
ecx IRQ number
ret eax 0 successful, 1 error
 
 
46 = RESERVE/FREE PORT AREA
ebx 0 reserve 1 free
ecx port area start
edx port area end
ret eax 0 successful, 1 error
*/
 
/*
47 = DISPLAY NUMBER TO WINDOW
ebx = print type, bl=0 -> ecx is number
bl=1 -> ecx is pointer
bh=0 -> display decimal
bh=1 -> display hexadecimal
bh=2 -> display binary
bits 16-21 = number of digits to display (0-32)
bits 22-31 = reserved
ecx = number or pointer
edx = x shl 16 + y
esi = color
*/
inline fastcall void sys_write_number(dword EBX, ECX, EDX, ESI)
{
EAX = 47;
$int 0x40
}
 
/*
48 = DEFINE GENERAL WINDOW PROPERTIES
ebx = 0 apply/redraw
ecx = 0 , apply/redraw desktop
ebx = 1 define button style
ecx = 0 , set flat buttons
ecx = 1 , set 3d buttons
ebx = 2 define window colors
ecx = pointer to table
edx = number of bytes defined
ebx = 3 get define window colors
ecx = pointer to table
edx = number of bytes to get
*/
 
inline fastcall void sys_redraw_desktop()
{
EAX = 48;
EBX = ECX = 0;
$int 0x40
}
 
inline fastcall void sys_set_button_style(dword ECX)
{
EAX = 48;
EBX = 1;
$int 0x40
}
 
inline fastcall void sys_set_colors(dword ECX,EDX)
{
EAX = 48;
EBX = 2;
$int 0x40
}
 
inline fastcall void sys_get_colors(dword ECX,EDX)
{
EAX = 48;
EBX = 3;
$int 0x40
}
 
/*
49 = DEFINE APPLICATIONS INTERNAL INTERRUPTS
ebx = 0
ecx point to dword x 256 table of interrupt entries
inside the application
return : nothing changed
 
 
50 = FREE FORM WINDOW SHAPE AND SCALE
ebx = 0 ; shape reference area
ecx = pointer to reference area
byte per pixel, 0 not used, 1=used, other = reserved
ebx = 1 ; scale of reference area (default 1:1)
ecx : scale is set to 2^ecx
return: nothing changed
 
 
51 = CREATE THREAD
ebx = 1 ; create
ecx ; = thread entry point
edx ; = thread stack position
return : eax = pid or 0xfffffff0+ for error
*/
 
inline fastcall dword sys_create_thread(dword ECX,EDX)
{
EAX = 51;
EBX = 1;
$int 0x40
}
 
/*
 
52 = STACK DRIVER STATUS
- see stack.txt
 
 
53 = SOCKET INTERFACE
- see stack.txt
 
 
54 = USER EVENTS
- not ready yet
 
 
55 = SOUND INTERFACE
ebx = 0 ; load 44 khz 8 bit mono sound block
ecx ; = pointer to 65536 byte soundblock
ebx = 1 ; play 44 khz 8 bit mono sound block
 
 
56 = WRITE FILE TO HD
ebx pointer to 12 char filename
ecx bytes to write
edx pointer to data to write
esi pointer to path
path db 0
 
 
57 = DELETE FILE FROM HD
ebx pointer to filename : 11 capital letters
edx pointer to path : path db 0
*/
 
 
/*
58 = SYSTEM TREE ACCESS
ebx pointer to fileinfo block
fileinfo:
dd 0x0 ; 0=read (/write/delete/append)
dd 0x0 ; 512 block to read 0+
dd 0x1 ; blocks to read (/bytes to write/append)
dd 0x20000 ; return data pointer
dd 0x10000 ; work area for os - 16384 bytes
db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename
*/
inline fastcall void sys_tree_access(dword EBX)
{
EAX = 58;
$int 0x40
}
 
/*
59 = TRACE FOR SYSTEM CALLS FROM PROCESSES
ebx = 0 ; get system events
ecx ; pointer to table -> ; 64 bytes/system call descriptor
; +00 PID
; +32 EDI
; +36 ESI
; +40 EBP
; +44 ESP
; +48 EBX
; +52 EDX
; +56 ECX
; +60 EAX
edx ; number of bytes to return to table (currently max 16*64)
return: eax = number of system calls from start
latest call is saved to (eax mod 16)*64 in table
ebx = 0 : above format
*/
 
/*
60 = IPC
ebx = 1 ; define receive area
ecx = pointer to start
edx = size of area
 
ebx = 2 ; send message
ecx = PID
edx = pointer to message
esi = length
*/
 
inline fastcall void sys_ipc_init(dword ECX, EDX)
{
EAX = 60;
EBX = 1;
$int 0x40
}
 
inline fastcall void sys_ipc_send(dword ECX, EDX, ESI)
{
EAX = 60;
EBX = 2;
$int 0x40
}
 
/* -1 = EXIT PROCESS */
 
inline fastcall void sys_exit_process()
{
$xor eax,eax
$dec eax
$int 0x40
}
/programs/games/mine/trunk/random.h--
0,0 → 1,52
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
 
:int random(int max)
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî
{
$rdtsc // eax & edx
$xor eax,edx
$not eax
 
EBX = generator;
$ror ebx,3
$xor ebx,0xdeadbeef
EBX += EAX;
generator = EBX;
EAX += EBX;
EAX = EAX % max;
return EAX;
}
 
:randomize()
// initialize random number generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
{
asm
{
mov eax,3
int 0x40
ror eax,16
}
generator = EAX;
}
/programs/games/mine/trunk/timer.h--
0,0 → 1,52
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
dword time,
ttime;
 
byte timer_life;
 
start_timer()
{
timer_life = TRUE;
ttime = sys_get_clock();
}
 
stop_timer()
{
timer_life = FALSE;
}
 
check_timer()
{
IF (!timer_life) return;
 
EAX = sys_get_clock();
IF (EAX == 0xffffff) return;
IF (ttime != EAX)
{
ttime = EAX;
IF (time < 999)
time++;
draw_time();
}
}
/programs/games/mine/trunk/uf.h--
0,0 → 1,135
/*******************************************************************************
 
MenuetOS MineSweeper
Copyright (C) 2003 Ivan Poddubny
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/
 
// USER FIELD WINDOW
 
byte px,py,pm;
 
byte uf_open = FALSE;
byte uf_stack[2048];
 
byte str1[5];
byte str2[5];
byte str3[5];
 
dword uf_x,
uf_y;
 
void draw_uf_window()
{
sys_get_colors(#colors, 40);
sys_window_redraw(1);
 
EDX = colors.w_work;
$bts edx,25
sys_draw_window(uf_x, uf_y, EDX, colors.w_grab | 0x80000000, colors.w_frames);
ECX = colors.w_grab_text | 0x10000000;
sys_write_text(8<<16+8, colors.w_grab_text | 0x10000000, "USER FIELD", 10);
sys_draw_button(81<<16+12, 5<<16+12, 1, colors.w_grab_button);
 
ECX = colors.w_work_text | 0x10000000;
sys_write_text(8<<16+31, ECX, "WIDTH", 5);
sys_write_text(8<<16+49, ECX, "HEIGHT", 6);
sys_write_text(8<<16+67, ECX, "MINES", 5);
 
// three buttons:
// 1) WIDTH 10
// 2) HEIGHT 11
// 3) MINES 12
// and also:
// OK, Cancel - 20,21
 
sys_draw_button(54<<16+38, 30<<16+10, 10, 0xe0e0e0); // WIDTH
EDX++; sys_draw_button(EBX, 48<<16+10, EDX, ESI); // HEIGHT
EDX++; sys_draw_button(EBX, 66<<16+10, EDX, ESI); // MINES
 
ESI = colors.w_work_button;
ECX = 84<<16+10;
sys_draw_button( 8<<16+38, ECX, 20, ESI); EDX++;
sys_draw_button(54<<16+38, ECX, EDX, ESI);
 
sys_write_text(21<<16+85, colors.w_work_button_text, "OK Cancel", 12);
 
sys_window_redraw(2);
}
 
void uf_main()
{
uf_x <<= 16; uf_x += 100;
uf_y <<= 16; uf_y += 104;
draw_uf_window();
 
WHILE()
{
SWITCH (sys_wait_event())
{
case 1: draw_uf_window();
break;
 
case 2: IF (sys_get_key() == 27)
{
uf_open = FALSE;
sys_exit_process();
}
break;
 
case 3: uf_button();
}
}
}
 
uf_button()
{
switch (sys_get_button_id())
{
//case 10:
//case 11:
//case 12:
 
case 20:
case 21:
 
case 1:
uf_open = FALSE;
sys_exit_process();
}
}
 
void start_uf()
{
sys_process_info(#procinfo, -1);
uf_x = procinfo.xstart + XST;
uf_y = procinfo.ystart + YST;
 
sys_create_thread(#uf_main, #uf_stack + 2048);
uf_open = TRUE;
mouse_disable();
WHILE (uf_open == TRUE)
{
SWITCH (sys_wait_event_timeout(5))
{
CASE 1: draw_window(); CONTINUE;
CASE 2: sys_get_key(); CONTINUE;
CASE 3: sys_get_button_id(); CONTINUE;
}
}
mouse_enable();
}
/programs/games/phenix/trunk/ascgl.inc
0,0 → 1,1385
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Graphics
; Libary
;
; Ver 0.18 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 LoadImage
;0.02 SetBmp
;0.03 Bmptoimg, Setimg ~01.03.2004
;0.04 Bug deleted, copyimg ~03.05.2004
;0.05 fullimg, collimg ~05.05.2004
;0.06 getimg ~09.05.2004
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by halyavin, add at ~07.06.2004
;0.11 many macros optimized by halyavin, add at ~30.08.2004
;0.12 bmptoimg ~07.09.2004
;0.13 imgtoimg ~08.09.2004
;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004
;0.15 giftoimg, giftoani ~10.09.2004
;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004
;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004
;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004
 
aframetoimg_use_count=0
macro aframetoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aframetoimg_use_count=aframetoimg_use_count+1
if aframetoimg_use_count = 1
 
jmp end_aframetoimg_proc
 
acolor dd 0
aframetoimg_proc:
;getout coord
mov [acolor],ebp
 
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aframetoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aframetoimg_proc
}
 
frametoimg_use_count=0
macro frametoimg img, x, y, canvas
{
local loo,loo2
frametoimg_use_count=frametoimg_use_count+1
if frametoimg_use_count = 1
 
jmp end_frametoimg_proc
 
frametoimg_proc:
;getout coord
mov edx,ebx ;img ;xsize
movzx eax,word [edx]
add eax,esi ;y cor
 
; mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
 
mov ebp,ebx ;img ;xsize
movzx edx,word [ebp]
add eax,edx
 
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
add ebx,4
mov eax,ebx ;img ;xsize
movzx esi,word [eax]
movzx edi,word [eax+2]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
 
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_frametoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call frametoimg_proc
}
 
 
aimgtoimg_use_count=0
macro aimgtoimg img, x, y, canvas,acol
{
local loo,loo2,acolor
aimgtoimg_use_count=aimgtoimg_use_count+1
if aimgtoimg_use_count = 1
 
jmp end_aimgtoimg_proc
 
acolor dd 0
aimgtoimg_proc:
;getout coord
mov [acolor],ebp
 
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
 
;test on alpha color
mov eax,[edx]
shl eax,8
shr eax,8
cmp eax,[acolor]
jne yx
add edx,3
add ebp,3
jmp nx
yx:
 
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
nx:
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_aimgtoimg_proc:
end if
push img
push canvas
push x
push y
push acol
pop ebp
pop esi
pop edi
pop ecx
pop ebx
call aimgtoimg_proc
}
 
 
 
 
imgtoimg_use_count=0
macro imgtoimg img, x, y, canvas
{
local loo,loo2
imgtoimg_use_count=imgtoimg_use_count+1
if imgtoimg_use_count = 1
 
jmp end_imgtoimg_proc
imgtoimg_proc:
;getout coord
mov eax,esi ;y cor
mul dword [ecx] ;canvas xsize
add eax,edi ;x cor
mov ebp,eax
shl eax,1
add ebp,eax
add ebp,ecx ;canvas+8;start
add ebp,8
;get img size
mov eax,ebx ;img ;xsize
mov esi,[eax]
add ebx,4
mov eax,ebx ; img+4 ;ysize
mov edi,[eax]
add ebx,4
mov edx,ebx ;img+8
loo2:
push esi
loo:
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
mov al,byte [edx]
mov byte [ebp],al
inc ebp
inc edx
dec esi
jnz loo
pop esi
sub ebp,3
mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3)
sub eax,esi
add ebp,eax
shl eax,1
add ebp,eax
 
add ebp,3
 
dec edi
jnz loo2
ret
end_imgtoimg_proc:
end if
push img
push canvas
push x
push y
pop esi
pop edi
pop ecx
pop ebx
call imgtoimg_proc
}
 
 
;DrawBox
macro drawfbox x,y,xs,ys,color
{
wordstoreg ebx,x,xs ;x*65536+xs
wordstoreg ecx,y,ys ;y*65536+ys
mov edx,color
mov eax,13
int 0x40
}
 
; FPS - Set Frame Per Second Display
fps_show_frequency=40
macro fps x,y,color,delcolor
{
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt
local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
int 0x40
cmp eax,[savetime]
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
mov [savetime],eax
mov ebx,[fps_cntr]
mov [fps],ebx
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+30
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
int 0x40
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,5*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
mov ecx,[fps]
int 0x40
no_out_fps:
}
 
; COLLIMG - Collusion image's
_1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if _1dbounce_count = 1
_1dbounce:
cmp ebx,eax
jb anot
add eax,esi
cmp eax,ebx
jbe nbc
bc:
mov ecx,1
ret
anot:
add ebx,edi
cmp ebx,eax
ja bc
nbc:
xor ecx,ecx
ret
end if
bounce:
mov otv,1
exit:
}
 
macro rgbtobgr image
{
local loo
mov eax,[image]
mul dword [image+4]
mov ecx,eax
mov esi,image+8
; add esi,8
loo:
mov al,[esi]
mov bl,[esi+2]
mov [esi],bl
mov [esi+2],al
add esi,3
dec ecx
jnz loo
}
 
 
macro setimg x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
mov cx,[arg3]
shl ecx,16
add cx,[arg3+4]
; wordstoreg ecx,[arg3],[arg3+4]
wordstoreg edx, x , y ;arg1*65536+arg2
int 0x40
}
 
macro setframe x , y ,arg3
{
mov eax,7
mov ebx,arg3
add ebx,8
wordstoreg edx, x , y ;arg1*65536+arg2
add edx,dword [arg3]
mov ecx,dword [arg3+4]
int 0x40
}
 
 
macro getimg imgsrc,x,y,xs,ys,imgdest
{
local cyc
if xs eqtype 0
mov dword [imgdest],xs
else
mov eax,xs
mov dword [imgdest],eax
end if
if ys eqtype 0
mov dword [imgdest+4],ys
else
mov eax,ys
mov dword [imgdest+4],eax
end if
 
mov eax,dword [imgsrc] ;getx size
; lea ecx,[eax+2*eax]
mov ecx,eax
shl ecx,1
add ecx,eax
 
mov ebx,y
mul ebx
add eax,x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
; mov ebp,eax
; shl eax,1
; add eax,ebp
 
mov ecx,xs
mov ebx,ys
 
mov edi,8+imgdest
lea esi,[eax+8+imgsrc]
; mov esi,eax
; add esi,8
; add esi,imgsrc
 
cld
cyc:
movsw
movsb
dec ecx
jne cyc
add esi,edx
mov ecx,xs
sub esi,ecx
sub esi,ecx
sub esi,ecx
dec ebx
jne cyc
}
 
macro copyimg img2_off,img1_off
{
mov eax,dword [img1_off]
mov ebx,dword [img1_off+4]
mul ebx
lea ecx,[eax+2*eax]
lea esi,[img1_off+8]
lea edi,[img2_off+8]
cld
rep movsb
}
 
macro fullimg img_off,xs,ys,color
{
local cop
mov eax,xs
mov ebx,ys
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ebp,[eax+2*eax]
mov esi,color
if color eqtype 0
mov ecx,color/65536
else
mov ecx,esi
shr ecx,16
end if
xor edi,edi
cop:
mov word [img_off+8+edi],si
add edi,2
mov byte [img_off+8+edi],cl
inc edi
cmp edi,ebp
jne cop
}
 
 
 
; number of frame in ecx
; callculatin offset of raw data
 
macro getframeoff num_of_frame,offset_of_animation,offset_of_frame
{
local loo,setpic
mov ebp,num_of_frame ;ecx
mov esi,offset_of_animation;Image
loo:
cmp ebp,0
je setpic
movzx eax,word [esi+4]
movzx ebx,word [esi+6]
mul ebx ;dword [esi+4]
mov ebx,3
mul ebx
add eax,8
add esi,eax
dec ebp
jmp loo
setpic:
mov dword offset_of_frame,esi
}
 
 
; BMPTOIMG -Convert BMP format TO IMG format
; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset
; (SAMPLE) View BMPLS.ASM sample.
; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits
 
 
bmptoimg_data_area_count=0
macro bmptoimg bmp_load_area,img_dest_area
{
local fileinfo,string,end_bmp,nodix
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
;local qwe,bmpfn
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
add eax,31
shr eax,5
mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov ebp,img_dest_area+8
 
mov eax,bmp_load_area
mov ebx,eax
add ebx, [bmp_load_area+2];file size
inc ebx
mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing
 
add eax, [bmp_load_area+10]
mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
lea eax,[eax+2*eax] ;3x pixels in eax
 
mov edi,dword [bmptoimg_soi] ;initializing
mov esi,dword [bmptoimg_data_area_eop]
sub esi,dword [bmptoimg_data_area_bps]
 
 
nextstring:
push edi
push ebp
cmp word [bmp_load_area+28],24
jne convertno32
 
mov edi,ebp
mov ecx,[bmptoimg_data_area_dwps]
cld
rep movsd
 
convert1:
pop ebp
pop edi
sub esi,dword [bmptoimg_data_area_bps]
sub esi,dword [bmptoimg_data_area_bps]
cmp esi,dword [bmptoimg_data_area_sop]
jb end_bmp
add edi,eax
add ebp,eax
jmp nextstring
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bmptoimg_data_area_bps]
mov dword [bmptoimg_data_area_eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
 
convert2:
pop eax
inc esi
cmp esi,dword [bmptoimg_data_area_eos]
jae convert1
add edi,3
 
add ebp,3
 
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
 
add ebp,3
 
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
js convert2
add edi,3
 
add ebp,3
 
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
; mov dword [edi],edx
mov [ebp],edx
ret
 
bmptoimg_data_area_count=bmptoimg_data_area_count+1
if bmptoimg_data_area_count = 1
; DATA AREA
bmptoimg_soi dd 0
bmptoimg_data_area_bps dd 0
bmptoimg_data_area_dwps dd 0
bmptoimg_data_area_sop dd 0
bmptoimg_data_area_eop dd 0
bmptoimg_data_area_eos dd 0
end if
 
end_bmp:
mov eax,dword [bmp_load_area+18]
mov ebx,dword [bmp_load_area+22]
mov dword [img_dest_area],eax
mov dword [img_dest_area+4],ebx
}
 
; For convert RGB to BGR
COLOR_ORDER equ MENUETOS
 
macro giftoani gifsrc,imgsrc,num_of_frames
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null equ 0x1000 ; 0x1000
 
; jmp sss
; if defined gif_hash_offset
; else
; hasharea:
; times 4096 dd 0 ;4096
; end if
;sss:
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
push ecx
pop dword num_of_frames
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
movsd
movsd
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
cmp byte[edi],0x3b ;read next frame
jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
 
 
macro giftoimg gifsrc,imgsrc
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
 
if defined gif_hash_offset
mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
 
call ReadGIF
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
; movsd
; movsd
 
mov bp,word[esi+4]
movzx ebx,bp
mov [edi],ebx
 
mov bp,word[esi+6]
movzx ebx,bp
mov [edi+4],ebx
 
add edi,8
add esi,8
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
; cmp byte[edi],0x3b ;read next frame
; jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/phenix/trunk/ascgml.inc
0,0 → 1,49
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; GaMe
; Libary
;
; Ver 0.03 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 correct
;0.02 control ~14.05.2004
;0.03 all macros optimized by halyavin, add at ~07.06.2004
 
 
; corectiryemoe,corectnoe,step
macro correct arg1,arg2,arg3
{
local plus,minus,equal
mov eax,arg2
cmp arg1,eax
je equal
mov eax,arg3
ja minus
plus:
add arg1,eax
jmp equal
minus:
sub arg1,eax
equal:
}
 
macro control min,max,arg
{
local gr,low,norm
mov eax,max
cmp arg,eax
jg gr
mov eax,min
cmp arg,eax
jnl norm
gr:
low:
mov arg,eax
norm:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/phenix/trunk/ascl.inc
0,0 → 1,895
;lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.14 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;Please compile aplications on FASM ver1.54 or higer!!!
 
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
;0.10 wordstoreg by halyavin, add at ~30.08.2004
; random bug deleted eax is use.
;0.11 loadfile from me +puttxt bug del ~07.09.2004
;0.12 open/save dialog ~13.09.2004
;0.13 dialogs bugs deleted
;0.14 drawlbut ~03.10.2004
;0.15 extendet label!
 
; LOADFILE
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area
 
 
macro loadfile file_name,file_load_area,file_temp_area
{
local open,fileinfo,string
jmp open
fileinfo:
dd 0
dd 0
dd 1
dd file_load_area
dd file_temp_area
string:
db file_name,0
open:
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[file_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
}
 
 
macro wordstoreg reg,hiword,loword
{
if hiword eqtype 0 & loword eqtype 0
mov reg,dword (hiword)*65536+(loword)
else if hiword eqtype 12 & loword eqtype eax
mov reg,dword (hiword)*65536
add reg,dword loword
else if hiword eqtype 12 & loword eqtype [123]
mov reg,dword (hiword)*65536
add reg,dword loword
else
mov reg,dword hiword
shl reg,16
add reg,dword loword
end if
}
 
 
 
macro dword2reg reg,doubleword
{
if doubleword eq
; not changes
else
mov reg,dword doubleword
end if
}
 
macro words2reg reg,hiword,lowword
{
if hiword eq
if lowword eq
; not changes
else
if lowword eqtype 12
and reg,dword 0xffff0000
add reg,dword lowword
else
and reg,dword 0xffff0000
add reg,dword lowword
end if
end if
else
if lowword eq
if hiword eqtype 12
and reg,dword 0x0000ffff
add reg,dword hiword*65536
else
shl reg,16
add reg,dword hiword
ror reg,16
end if
else
if lowword eqtype 12 & hiword eqtype 12
if lowword eq 0 & hiword eq 0
xor reg,reg
else
mov reg,dword hiword*65536+lowword
end if
else
mov reg,dword hiword
shl reg,16
add reg,dword lowword
end if
end if
end if
}
 
 
 
 
; DRAW BUTTON with label
 
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
{
local asd,lab
jmp asd
lab db text ;arg label
asd:
words2reg ebx,x,xs
words2reg ecx,y,ys
mov edx,id
mov esi,bcolor
mov eax,8
int 0x40
 
mov eax,asd-lab ;calc size
mov ebx,6
mul ebx
mov esi,eax
 
mov eax,xs
sub eax,esi
shr eax,1
add eax,x
 
mov edx,ys
sub edx,7
shr edx,1
add edx,y
 
mov ebx,eax
shl ebx,16
add ebx,edx
 
mov ecx,tcolor ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
 
macro opendialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
 
procinfo:
times 256 db 0
}
 
 
macro savedialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, run_filepath, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
 
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
 
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,120 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
call redproc
 
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
 
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
 
jmp erroff
 
dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
jae erroff
jmp getmesloop
 
mred:
call redproc
jmp getmesloop
mkey:
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
 
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
call redproc ;show DLG_PID
jmp getmesloop
 
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
 
 
; DATA AREA
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
 
param:
rb 4 ; My dec PID
rb 6 ; Type of dialog
 
run_fileinfo:
dd 16
dd 0
dd param
dd 0
dd procinfo
run_filepath:
db '/RD/1/SYSXTREE',0
 
procinfo:
times 256 db 0
}
 
 
 
 
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
 
randomuse = 0
 
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
 
jmp rxproc
 
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
and eax,0000ffffh
; mov arg2,0
; mov arg2,eax
ret
end if
 
rxproc:
mov eax,arg1
call randomproc
mov arg2,eax
}
 
macro scank
{
mov eax,10
int 0x40
}
 
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
 
macro puttxt x,y,offs,size,color
{
; mov ebx,x
; shl ebx,16
; add ebx,y
words2reg ebx,x,y
mov ecx,color
mov edx,offs
mov esi,size
mov eax,4
int 0x40
}
 
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
; mov edx,x*65536+y
words2reg edx,x,y
mov esi,color
mov eax,47
int 0x40
}
 
; SCEVENT - Scan event
 
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; WTEVENT - Wait event
 
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; TIMEEVENT - Wite for event with timeout
 
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
 
; CLOSE - Close program
 
macro close
{
mov eax,-1
int 0x40
}
 
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
 
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
 
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
 
macro window arg1,arg2,arg3,arg4,arg5
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
words2reg ebx,arg1,arg3
words2reg ecx,arg2,arg4
mov edx,arg5
mov eax,0
int 0x40
}
 
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
 
 
; STARTWD - Start of window draw
 
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
 
; ENDWD - End window draw
 
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
 
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
 
macro label arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
; mov ebx,arg1 ;arg1=y arg2=x
; shl ebx,16
; add ebx,arg2
 
 
words2reg ebx,arg1,arg2
 
dword2reg ecx,arg4
 
 
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
 
;Attributes
 
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
 
;Font Attributes
font_Big equ 0x10000000
 
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040ff
cl_Cyan equ 0x0040e0ff
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/phenix/trunk/ascml.inc
0,0 → 1,94
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Massive operation
; Libary
;
; Ver 0.1 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 readmas,compmas,findmas
 
macro readmas masoff,obroff
{
local loo
mov edi,masoff ;tekoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
}
 
 
macro compmas masoff1,masoff2,obroff
{
local loo,loo2
mov esi,masoff2
add esi,8
mov ecx,[masoff2]
mov ebx,[masoff2+4]
mov eax,0
 
loo2:
push eax
 
mov edi,masoff1 ;tekoff
add edi,8
mov ebp,[masoff1] ;elements1
mov edx,[masoff1+4] ;elemsize1
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
 
add esi,ebx
pop eax
inc eax
cmp eax,ecx
jne loo2
}
 
 
macro findmas masoff,obroff
{
local loo,looend,lend
mov edi,masoff ;tekoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
mov eax,0
call obroff
cmp eax,1
je looend
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
stc
jmp lend
looend:
popad
clc
lend:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/phenix/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm phenix.asm phenix
@pause
/programs/games/phenix/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm phenix.asm phenix
@pause
/programs/games/phenix/trunk/phenix.asm
0,0 → 1,1328
;
; Phenix Dynamic Game Created by Pavlushin Evgeni for ASCL
;
; 100% Full relase!
;
; www.waptap@mail.ru
;
 
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd I_END ; memory for app
dd I_END ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
 
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
include 'ascml.inc'
 
 
showmas:
cmp [edi+8],dword 0
je noshow
cmp [edi+8],dword 1
jne no_gun
mov eax,shoot
jmp outp
no_gun:
push edi
random 3,ebx
pop edi
cmp ebx,0
jne no_star
mov eax,star
jmp outp
no_star:
cmp ebx,1
jne no_star2
mov eax,star2
jmp outp
no_star2:
mov eax,star3
outp:
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshow:
ret
 
showobjmas:
cmp [edi+8],dword 0
je noshow1
cmp [edi+4],dword 380
jg noshow1
cmp [edi+4],dword 0
jl noshow1
cmp [edi+8],dword 1
jne no_warship1
mov eax,warship1
jmp outws
no_warship1:
cmp [edi+8],dword 2
jne no_warship2
mov eax,warship2
jmp outws
no_warship2:
cmp [edi+8],dword 3
jne no_meteor
mov eax,meteor
jmp outws
no_meteor:
cmp [edi+8],dword 4
jne no_box
mov eax,box
jmp outws
no_box:
outws:
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshow1:
ret
 
 
moveobjmas:
cmp [edi+8],dword 0
je no_ws
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
 
cmp dword [edi],600
jng xok1
sub dword [edi],20
neg dword [edi+12]
jmp xok2
xok1:
cmp dword [edi],0
jnl xok2
add dword [edi],20
neg dword [edi+12]
xok2:
cmp dword [edi+4],400
jng yok
mov dword [edi+8],0
ret
yok:
cmp dword [edi+8],2 ;green ship
jne no_grs
cmp dword [edi+4],100
jna no_grs
cmp dword [edi+4],103
jna grs
cmp dword [edi+4],200
jna no_grs
cmp dword [edi+4],203
jna grs
cmp dword [edi+4],300
jna no_grs
cmp dword [edi+4],303
ja no_grs
grs:
neg dword [edi+12]
mov [temp],edi
findmas massive,findzero
;in edi off to free element
jc close_app
mov esi,edi
mov edi,[temp]
mov eax,[edi]
mov [esi],eax
mov eax,[edi+4]
mov [esi+4],eax
mov [esi+8],dword 1
mov [esi+12],dword 0
mov [esi+16],dword 10
no_grs:
 
cmp dword [edi+8],1 ;blue ship
jne no_bls
cmp dword [edi+4],50
jna no_bls
cmp dword [edi+4],64
jna bls
cmp dword [edi+4],100
jna no_bls
cmp dword [edi+4],114
jna bls
cmp dword [edi+4],150
jna no_bls
cmp dword [edi+4],164
ja no_bls
bls:
mov [temp],edi
findmas massive,findzero
jc close_app
mov esi,edi
mov edi,[temp]
mov eax,[edi]
mov [esi],eax
mov eax,[edi+4]
mov [esi+4],eax
mov [esi+8],dword 2
mov [esi+12],dword 0
mov [esi+16],dword 5
no_bls:
 
no_ws:
ret
 
 
delfarshoot:
cmp [edi+4],dword 40
jb del
cmp [edi+4],dword 400
ja del
cmp [edi],dword 40
jb del
cmp [edi],dword 600
ja del
jmp nodel
del:
mov [edi+8],dword 0
nodel:
ret
 
 
movemas:
cmp [edi+8],dword 0
jne no_freeel
ret
no_freeel:
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
ret
 
 
 
endshowmas:
cmp [edi+8],dword 0
je noshowem
mov eax,star2
aimgtoimg eax,dword [edi],dword [edi+4],canvas,0x0
noshowem:
ret
 
 
 
endmovemas:
cmp [edi+8],dword 0
jne no_fr
ret
no_fr:
mov eax,[edi+12]
add [edi],eax
mov eax,[edi+16]
add [edi+4],eax
ret
 
 
findzero:
cmp [edi+8],dword 0
je iz_zero
xor eax,eax
ret
iz_zero:
mov eax,1
ret
 
compobr:
cmp [esi+8],dword 0
je no_crsh
cmp [edi+8],dword 0
je no_crsh
cmp [esi+16],dword 0
jg no_crsh
 
mov eax,[esi]
mov [temp],eax
mov eax,[esi+4]
mov [temp2],eax
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
 
pushad
collimg imgsize,[temp],[temp2],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_crsh
 
cmp [edi+8],dword 2
jne no_grship
inc [gship]
add [score],30
jmp setzero
no_grship:
cmp [edi+8],dword 1
jne no_blship
inc [bship]
add [score],20
jmp setzero
no_blship:
cmp [edi+8],dword 3
jne no_metr
dec dword [edi+16]
cmp dword [edi+16],0
jne mok
mov dword [edi+16],1
mok:
mov [esi+8],dword 0
ret
no_metr:
 
setzero:
mov [esi+8],dword 0
mov [edi+8],dword 0
no_crsh:
ret
 
shipobjtest:
cmp [edi+8],dword 0
je no_obj
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
pushad
collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_obj
cmp [edi+8],dword 4 ;if box
jne no_fbox
add [energy],5
add [score],50
mov [edi+8],dword 0
inc [boxget]
ret
no_fbox:
sub [energy],16
mov [edi+8],dword 0
no_obj:
ret
 
shipguntest:
cmp [edi+8],dword 0
je no_gobj
cmp [edi+16],dword 0
jl no_gobj
mov eax,[edi]
mov [temp3],eax
mov eax,[edi+4]
mov [temp4],eax
pushad
collimg imgsize,[shipx],[shipy],imgsize,[temp3],[temp4],[otv]
popad
cmp [otv],dword 0
je no_gobj
sub [energy],4
mov [edi+8],dword 0
no_gobj:
ret
 
 
START: ; start of execution
 
massize = 400
elemsize = 20
 
mov [massive],dword massize
mov [massive+4],dword elemsize
 
omassize = 100
oelemsize = 20
 
mov [objmas],dword omassize
mov [objmas+4],dword oelemsize
 
 
mov eax,66
mov ebx,1
mov ecx,1
int 0x40
 
mov eax,26
mov ebx,2
mov ecx,1
mov edx,keymap
int 0x40
 
startgame:
gif_hash_offset = gif_hash_area
giftoimg gif_file_area2,canvas
 
gif_hash_offset = gif_hash_area
giftoimg gif_file_area,img_area
 
getimg img_area,0,0,32,32,ship
getimg img_area,32,0,32,32,shoot
getimg img_area,64,0,32,32,warship1
getimg img_area,96,0,32,32,warship2
getimg img_area,128,0,32,32,meteor
getimg img_area,160,0,32,32,star
getimg img_area,192,0,32,32,star2
getimg img_area,224,0,32,32,star3
getimg img_area,0,32,32,32,box
 
 
 
main_menu:
call draw_logowindow
 
stillm:
wtevent redm,keym,buttonm
jmp stillm
redm:
call draw_logowindow
jmp stillm
keym:
mov eax,2
int 0x40
jmp stillm
buttonm:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close_app
cmp ah,2 ; button id=1 ?
je start_game
cmp ah,3 ; button id=1 ?
je help
cmp ah,4 ; button id=1 ?
je close_app
jmp stillm
 
draw_logowindow:
call draw_window
setimg 5,21,canvas
drawlbut 300,300,60,14,'START',2,0x990000,cl_Black
drawlbut 300,320,60,14,'HELP',3,0x990000,cl_Black
drawlbut 300,340,60,14,'EXIT',4,0x990000,cl_Black
ret
 
;***********************
; Draw help menu
;***********************
 
help:
call draw_helpwindow
 
stillh:
wtevent redh,keyh,buttonh
jmp stillh
redh:
call draw_helpwindow
jmp stillh
keyh:
mov eax,2
int 0x40
jmp stillh
buttonh:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
je close_app
cmp ah,2 ; button id=1 ?
je start_game
cmp ah,3 ; button id=1 ?
je help
cmp ah,4 ; button id=1 ?
je close_app
cmp ah,5 ; button id=1 ?
je main_menu
jmp stillh
 
draw_helpwindow:
call draw_window
setimg 5,21,canvas
 
drawfbox 40,50,580,380,cl_Grey
 
mov ebp,4*7
mov ebx,180*65536+90
mov edx,helptext
mov esi,50
mov ecx,cl_White
dec ebp
looht:
mov eax,4
int 0x40
add edx,esi
add ebx,10
dec ebp
jnz looht
 
setimg 90,90,ship
setimg 90,130,shoot
setimg 90,170,star
setimg 90,210,warship1
setimg 90,250,warship2
setimg 90,290,meteor
setimg 90,330,box
 
drawlbut 500,400,80,14,'<<BACK',5,0x990000,cl_Black
 
jmp stillh
 
helptext:
db 'Phenix '
db 'Controls: Num1 move left, Num3 move right '
db ' P-pause (use for screen shooting) '
db ' '
 
db 'Lazer cannon '
db 'Press Num5 for shoot '
db 'Core fast, speed fast, reload slow '
db ' '
 
db 'Plazma cannon '
db 'Press Num2 for Plazma Nuke and Num8 for shoot '
db 'Core slow, speed medium, reload fast '
db ' '
 
db 'Blue warship '
db 'Speed fast '
db 'Attack method: plazma bomb '
db ' '
 
db 'Green warship '
db 'Speed slow '
db 'Attack method: laser shoot '
db ' '
 
db 'Meteor '
db 'Dangeros object! '
db 'SuperSheld '
db ' '
 
db 'Fly Box '
db 'Sheld pack, sheld +5, score +30 '
db 'Get for sheld level up! '
db ' '
 
start_game:
 
; jmp end_gm
 
mov [canvas],dword 640
mov [canvas+4],dword 440
 
call draw_window
 
;Main loop wait for event with 10msec
still:
; scevent red,key,button ;for full speed
 
timeevent 1,no_event,red,key,button
no_event:
setimg 5,21,canvas
 
cmp [pause_on],0
jne still
 
cmp [energy],0
jl game_over
 
cmp [ctime],dword 0
je no_dct
dec dword [ctime]
no_dct:
 
cmp [xtime],dword 0
je no_dxt
dec dword [xtime]
no_dxt:
 
 
;
; Add to level new ships
;
inc dword [pathtime]
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp]
cmp [pathtime],eax ;500
jne no_nextloc
 
randobjmasx:
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
 
mov ecx,[ebp+8]
mov [shiptype],2
mov [xmoving],9
mov [xaccel],4
mov [ymoving],3
mov [yaccel],2
call add_ships
 
mov ecx,[ebp+12]
mov [shiptype],1
mov [xmoving],3
mov [xaccel],1
mov [ymoving],3
mov [yaccel],6
call add_ships
 
mov ecx,[ebp+16]
mov [shiptype],3
mov [xmoving],5
mov [xaccel],2
mov [ymoving],5
mov [yaccel],2
call add_ships
 
mov ecx,[ebp+20]
mov [shiptype],4
mov [xmoving],4
mov [xaccel],1
mov [ymoving],4
mov [yaccel],1
call add_ships
 
jmp newlocend
 
shiptype dd 0
xmoving dd 0
ymoving dd 0
xaccel dd 0
yaccel dd 0
 
add_ships:
looship:
cmp ecx,0
je no_ships
push ecx
findmas objmas,findzero
;in edi off to free element
jc close_app
mov ebp,[shiptype]
mov dword [edi+8],ebp ;2 ;green ship
; random x
push edi
random 600,eax
pop edi
mov [edi],eax
; random y
push edi
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov esi,[ebp+4] ;get max range
random esi,eax
neg eax
pop edi
mov [edi+4],eax
; x moving
push edi ;planers
random [xmoving],eax
sub eax,[xaccel];4
pop edi
mov [edi+12],eax
; y moving
push edi
random [ymoving],eax ;slow
add eax,[yaccel] ;2
pop edi
mov [edi+16],eax
pop ecx
dec ecx
jnz looship
no_ships:
ret
 
 
levelpart dd 0
levels:
;level1
dd 1,800,0,0,5,8,0,0 ;one at start
dd 500,2000,4,20,30,0,0,0
dd 500,2000,4,20,0,8,0,0
dd 500,2000,10,0,0,4,0,0
dd 500,4000,0,30,0,0,0,0
dd 400,400,0,0,10,0,0,0
dd 400,400,0,0,10,0,0,0
dd 0,0,0,0,0,0,0,0 ;end of level
;level2
dd 1,16000,0,30,0,0,0,0 ;one at start
dd 200,8000,0,20,0,0,0,0
dd 200,2000,0,10,0,8,0,0
dd 200,4000,0,10,0,0,0,0
dd 0,0,0,0,0,0,0,0 ;end of level
;level3
dd 1,4000,0,20,30,8,0,0 ;one at start
dd 400,4000,10,10,20,6,0,0
dd 400,4000,0,20,10,2,0,0
dd 400,4000,10,10,20,0,0,0
dd 0,-1,0,0,0,0,0,0 ;end of game
 
 
newlocend:
mov [pathtime],0
inc [levelpart]
jmp no_nextloc
 
endgame dd 0
objects dd 0
endtest:
cmp dword [edi+8],0
jne no_free
ret
no_free:
mov [endgame],0
inc [objects]
ret
 
 
no_nextloc:
mov [objects],0
mov [endgame],1
readmas objmas,endtest
cmp [endgame],1
jne no_end_lev ;no_nextloc
 
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp+4]
cmp eax,dword 0
je end_lev ;end of level
cmp eax,dword -1
je end_gm ;end of game
 
no_end_lev:
 
cmp [num5],dword 0
je no_addsh
cmp [ctime],dword 0
jne no_addsh
cmp [lazer],dword 0
je no_addsh
findmas massive,findzero
;in edi off to free element
jc close_app
mov eax,[shipx]
mov [edi],eax
mov eax,[shipy]
mov [edi+4],eax
mov [edi+8],dword 1 ;show
mov [edi+12],dword 0
mov [edi+16],dword -12
mov [ctime],dword 8 ;wait for cannon
dec [lazer]
no_addsh:
 
cmp [num8],dword 0
je no_addplx
cmp [xtime],dword 256-16
jae no_addplx
cmp [plazma],0
je no_addplx
findmas massive,findzero
;in edi off to free element
jc close_app
mov eax,[shipx]
mov [edi],eax
mov eax,[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show
add [xtime],dword 8 ;wait for cannon
cmp [xtime],dword 256
jna okx
mov [xtime],256
okx:
mov [edi+12],dword 0 ;wait for cannon
mov [edi+16],dword -8 ;wait for cannon
dec [plazma]
no_addplx:
 
 
 
cmp [num2],dword 0
je no_addsh2
cmp [xtime],dword 0
jne no_addsh2
cmp [plazma],0
je no_addsh2
mov eax,[shipy]
mov [temp3],eax
mov [temp2],dword 5
loox2:
mov [temp],dword 10
loox:
findmas massive,findzero
;in edi off to free element
jc close_app
random 25,eax
mov ebp,eax
sub eax,12
add eax,[shipx]
mov [edi],eax
shr ebp,3
random ebp,eax
neg eax
add eax,[temp3] ;[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show hstar
random 5,eax
sub eax,2
mov [edi+12],eax ;show hstar
random 7,eax
sub eax,8
mov [edi+16],eax ;show hstar
dec [temp]
jnz loox
sub [temp3],30
dec [temp2]
jnz loox2
mov [xtime],dword 256 ;wait for cannon
sub [plazma],50
no_addsh2:
 
 
cmp [num1],dword 0
je no_left
sub dword [shipx],6
no_left:
 
cmp [num3],dword 0
je no_right
add dword [shipx],6
no_right:
 
;ship correct
cmp [shipx],5
jnl xl_ok
mov [shipx],5
xl_ok:
cmp [shipx],603
jng xr_ok
mov [shipx],603
xr_ok:
 
 
;clear scrbuf
mov edi,canvas+8
cld
mov ecx,640*440*3/4
mov eax,0
rep stosd
 
compmas objmas,massive,compobr
 
readmas objmas,shipobjtest
readmas massive,shipguntest
 
readmas objmas,showobjmas
readmas objmas,moveobjmas
 
readmas massive,showmas
readmas massive,movemas
readmas massive,delfarshoot
; findmas massive,findzero
;in edi off to free element
; jc close_app
 
aimgtoimg ship,[shipx],[shipy],canvas,0x0
 
drawfbox 150,5,64,5,0x000000
mov eax,[xtime]
sub eax,256
neg eax
shr eax,2
drawfbox 150,5,eax,5,0x0000ff
 
drawfbox 150,12,64,5,0x000000
mov eax,[ctime]
sub eax,8
neg eax
shl eax,3
drawfbox 150,12,eax,5,0xffff00
 
drawfbox 220,2,6*5+2 ,9,cl_Grey
outcount [plazma],221,3,cl_Blue,5*65536
drawfbox 220,11,6*5+2 ,9,cl_Grey
outcount [lazer],221,12,0xffff00,5*65536
 
 
drawfbox 280,6,6*5+2 ,9,cl_Grey
outcount [gship],281,7,cl_Green,5*65536
drawfbox 320,6,6*5+2 ,9,cl_Grey
outcount [bship],321,7,cl_Blue,5*65536
drawfbox 360,6,6*5+2 ,9,cl_Grey
outcount [boxget],361,7,0xffaa00,5*65536
 
drawfbox 400,2,6*5+2 ,9,cl_Grey
outcount [objects],401,2,0x00ff00,5*65536
drawfbox 400,11,6*5+2 ,9,cl_Grey
outcount [energy],401,12,0xff0000,5*65536
 
drawfbox 450,11,6*5+2 ,9,cl_Grey
outcount [score],451,12,0xffff00,5*65536
 
 
jmp still
 
red:
call draw_window
jmp still
 
key: ; key
mov eax,2
int 0x40 ; read (eax=2)
 
shr eax,8
and eax,0xff
mov ah,al
 
cmp ah,153
jne no_pause
not [pause_on]
jmp still
no_pause:
 
 
cmp ah,76
jne no_num5d
mov [num5],1
jmp still
no_num5d:
cmp ah,204
jne no_num5u
mov [num5],0
jmp still
no_num5u:
 
cmp ah,80
jne no_num2d
mov [num2],1
jmp still
no_num2d:
cmp ah,208
jne no_num2u
mov [num2],0
jmp still
no_num2u:
 
cmp ah,79 ;key_Space 85 exit
jne no_num1d
mov [num1],1
jmp still
no_num1d:
cmp ah,207 ;key_Space 85 exit
jne no_num1u
mov [num1],0
jmp still
no_num1u:
 
cmp ah,81 ;key_Space 85 exit
jne no_num3d
mov [num3],1
jmp still
no_num3d:
cmp ah,209 ;key_Space 85 exit
jne no_num3u
mov [num3],0
jmp still
no_num3u:
 
cmp ah,72 ;key_Space 85 exit
jne no_num8d
mov [num8],1
jmp still
no_num8d:
cmp ah,200 ;key_Space 85 exit
jne no_num8u
mov [num8],0
jmp still
no_num8u:
 
jmp still ; not testing
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
close_app:
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still
 
draw_window:
startwd
window 40,40,(640+9),(440+26),window_Skinned+0x00
label 8,8,'ASCL DYNAMIC GAME',cl_White+font_Big
; setimg 5,22,img_area
endwd
ret
 
;**********************
; Game Over process
;**********************
 
game_over:
; close
call draw_gowindow
stillgo:
wtevent redgo,keygo,buttongo
jmp stillgo
redgo:
call draw_gowindow
jmp stillgo
keygo:
mov eax,2
int 0x40
jmp stillgo
buttongo:
mov eax,17 ; get id
int 0x40
cmp ah,1
je close_app
cmp ah,4
je close_app
cmp ah,5
je main_menu
cmp ah,7
je restart_lev
jmp stillgo
 
restart_lev:
mov [pathtime],0
 
prevpart:
mov ebp,[levelpart]
shl ebp,5
add ebp,levels
mov eax,[ebp]
cmp eax,dword 1
je rest ;end of level
dec [levelpart]
jmp prevpart
 
 
rest:
;massives reset - clear massives
mov edi,massive+8
cld
mov ecx,massize*elemsize/4
mov eax,0
rep stosd
 
mov edi,objmas+8
cld
mov ecx,omassize*oelemsize/4
mov eax,0
rep stosd
 
;counters reset
mov [boxget],0
mov [gship],0
mov [bship],0
 
;ship reset
mov [energy],100
mov [shipx],300
mov [shipy],400
mov [lazer],1000
mov [plazma],500
 
 
; reset keyboard
mov [num1],0
mov [num5],0
mov [num3],0
mov [num2],0
mov [num8],0
jmp start_game
 
draw_gowindow:
startwd
drawfbox 170,160,300,120,cl_Grey
drawlbut 180,260,80,14,'(X) EXIT',4,0x990000,cl_Black
drawlbut 280,260,80,14,'<MENU>',5,0x990000,cl_Black
drawlbut 380,260,80,14,'RESTART',7,0x990000,cl_Black
 
label 280,200,' GAME OVER ',cl_Black
endwd
ret
 
 
;**********************
; End level process
;**********************
 
end_lev:
; close
call draw_scorewindow
stilleg:
wtevent redeg,keyeg,buttoneg
jmp stilleg
redeg:
call draw_scorewindow
jmp stilleg
keyeg:
mov eax,2
int 0x40
jmp stilleg
buttoneg:
mov eax,17 ; get id
int 0x40
cmp ah,1
je close_app
cmp ah,2
je next_lev
cmp ah,3
je help
cmp ah,4
je close_app
cmp ah,5
je main_menu
jmp stilleg
 
next_lev:
mov [pathtime],0
inc [levelpart]
 
;ship reset
mov [energy],100
mov [shipx],300
mov [shipy],400
mov [lazer],1000
mov [plazma],500
 
;counters reset
mov [boxget],0
mov [gship],0
mov [bship],0
 
; reset keyboard
mov [num1],0
mov [num5],0
mov [num3],0
mov [num2],0
mov [num8],0
jmp start_game
 
draw_scorewindow:
call draw_window
startwd
drawfbox 170,130,300,190,cl_Grey
drawlbut 180,300,80,14,'(X) EXIT',4,0x990000,cl_Black
drawlbut 280,300,80,14,'<MENU>',5,0x990000,cl_Black
drawlbut 380,300,80,14,'NEXT >>',2,0x990000,cl_Black
 
setimg 180,140,warship1
outcount [bship],241,151,cl_Blue,5*65536
 
setimg 180,180,warship2
outcount [gship],241,191,cl_Green,5*65536
 
setimg 180,220,meteor
setimg 180,260,box
outcount [boxget],241,271,0xbbbb00,5*65536
endwd
ret
 
 
;**********************
; End of game process
;**********************
 
end_gm:
mov [pathtime],0
call draw_window
label 200 ,8,'YOU WIN PRESS ANY KEY TO EXIT',cl_White+font_Big
 
stilleg2:
; scevent redeg2,keyeg2,buttoneg2
timeevent 1,no_event2,redeg2,keyeg2,buttoneg2
 
no_event2:
setimg 5,21,canvas
 
;clear scrbuf
mov edi,canvas+8
cld
mov ecx,640*440*3/4
mov eax,0
rep stosd
 
aimgtoimg ship,320,220,canvas,0x0
 
readmas massive,endshowmas
readmas massive,endmovemas
readmas massive,delfarshoot
; findmas massive,findzero
;in edi off to free element
; jc close_app
 
inc [pathtime]
cmp [pathtime],30
jne no_firework
mov [pathtime],0
random 400,eax
mov [temp3],eax
random 600,eax
mov [temp2],eax
mov [temp],dword 8;10
xloox:
findmas massive,findzero
;in edi off to free element
jc close_app
 
mov eax,[temp2] ;[shipx]
mov [edi],eax
mov eax,[temp3] ;[shipy]
mov [edi+4],eax
mov [edi+8],dword 2 ;show hstar
rerand:
random 5,eax
sub eax,2
cmp eax,0
je rerand
mov [edi+12],eax ;show hstar
rerand2:
random 7,eax
sub eax,3
cmp eax,0
je rerand2
mov [edi+16],eax ;show hstar
dec [temp]
jnz xloox
no_firework:
jmp stilleg2
 
redeg2:
jmp end_gm ;stilleg2
keyeg2:
mov eax,2
int 0x40
jmp main_menu
buttoneg2:
mov eax,17 ; get id
int 0x40
jmp stilleg2
 
 
 
 
 
 
; DATA AREA
IM_END:
;global
pause_on dd 0
 
;massive
shipx dd 300
shipy dd 400
 
;guns
lazer dd 1000
plazma dd 500
 
;keys
num1 dd 0
num5 dd 0
num3 dd 0
num2 dd 0
num8 dd 0
 
;enemy countres
gship dd 0
bship dd 0
boxget dd 0
 
energy dd 100
score dd 0
 
;delay for cannon
ctime dd 0
;delay for nuke gun
xtime dd 0
;path time
pathtime dd 0
;
temp dd 0
temp2 dd 0
temp3 dd 0
temp4 dd 0
otv dd 0
 
;for collimg
imgsize:
dd 32
dd 32
 
;massive:
;dd 400 ;elements num
;dd 20 ;size of element in bytes
;rb 400*20
 
 
keymap:
rb 1000
 
;gif_file_area ~21500
gif_file_area2:
file 'phenix.gif'
rb 50
gif_file_area:
file 'star2.gif';include gif file
rb 50 ;50 bytes temp back zone
img_area:
rb 256*64*3+8
ship:
rb 32*32*3+8
shoot:
rb 32*32*3+8
warship1:
rb 32*32*3+8
warship2:
rb 32*32*3+8
meteor:
rb 32*32*3+8
star:
rb 32*32*3+8
star2:
rb 32*32*3+8
star3:
rb 32*32*3+8
box:
rb 32*32*3+8
 
gif_hash_area:
rd 4096+1 ;hash area size for unpacking GIF
 
massive:
rd massize ;elements num
rd elemsize ;size of element in bytes
rb massize*elemsize
 
objmas:
rd omassize ;elements num
rd oelemsize ;size of element in bytes
rb omassize*oelemsize
 
canvas:
canvas_x:
rd 1
canvas_y:
rd 1
rb (640*440*3)+2000
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/phenix/trunk/phenix.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/phenix/trunk/star2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/pong/trunk/ascgl.inc
0,0 → 1,624
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Graphics
; Libary
;
; Ver 0.10 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 LoadImage
;0.02 SetBmp
;0.03 Bmptoimg, Setimg ~01.03.2004
;0.04 Bug deleted, copyimg ~03.05.2004
;0.05 fullimg, collimg ~05.05.2004
;0.06 getimg ~09.05.2004
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by halyavin, add at ~07.06.2004
 
;DrawBox
macro drawfbox x,y,xs,ys,color
{
mov ecx,y
mov ebx,x
shl ebx,16
add ebx,xs
shl ecx,16
add ecx,ys
mov edx,color
mov eax,13
int 0x40
}
 
; FPS - Set Frame Per Second Display
fps_show_frequency=40
macro fps x,y,color,delcolor
{
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt
local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
int 0x40
cmp eax,[savetime]
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
mov [savetime],eax
mov ebx,[fps_cntr]
mov [fps],ebx
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+30
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
int 0x40
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,5*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
mov ecx,[fps]
int 0x40
no_out_fps:
}
 
 
 
; COLLIMG - Collusion image's
_1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if (_1dbounce_count = 1)
_1dbounce:
cmp ebx,eax
jnae anot
add eax,esi
cmp eax,ebx
jna nbc
jmp bc
anot:
add ebx,edi
cmp ebx,eax
jna nbc
bc:
mov ecx,1
ret
nbc:
mov ecx,0
ret
end if
bounce:
mov otv,1
exit:
}
 
; SETBMP - Set bmp to window
; (SYNTAX) SETBMP dd xstart ,dd ystart ,BMP_offset,dd soi
; (SAMPLE) SETBMP dword [xt],dword [yt],I_END,dword [tsoi]
; SETBMP 15,10,I_END,dword [tsoi]
; ( NOTE ) SOI - Start of image
 
macro setbmp arg1,arg2,arg3,arg4
{
local nodi
cmp word [arg3],word 'BM'
jne nodi
mov eax,7
mov ebx,arg4 ;[soi]
mov ecx,dword [arg3+18]
shl ecx,16
add ecx,dword [arg3+22]
if (arg1 eqtype 0) & (arg2 eqtype 0)
mov edx,arg1*65536+arg2
else
mov edx,arg1
shl edx,16
add edx,arg2
end if
int 0x40
nodi:
}
 
macro setimg arg1,arg2,arg3
{
local nodi
mov eax,7
mov ebx,arg3
add ebx,8
mov ecx,dword [arg3]
shl ecx,16
add ecx,dword [arg3+4]
if (arg1 eqtype 0) & (arg2 eqtype 0)
mov edx,arg1*65536+arg2
else
mov edx,arg1
shl edx,16
add edx,arg2
end if
int 0x40
}
 
;Not optimiz
macro getimg imgsrc,x,y,xs,ys,imgdest
{
local cyc
mov eax,xs
mov dword [imgdest],eax
mov eax,ys
mov dword [imgdest+4],eax
 
mov eax,dword [imgsrc] ;getx size
mov edi,eax
mov ebx,y
mul ebx
add eax,x
mov ebx,3
mul ebx ;eax=offset on imsrc
 
mov ecx,0
mov ebx,0
mov ebp,eax
mov esi,0
 
add esi,8
add ebp,8
 
cyc:
mov al,byte [imgsrc+ebp]
mov [imgdest+esi],al
mov al,byte [imgsrc+ebp+1]
mov [imgdest+esi+1],al
mov al,byte [imgsrc+ebp+2]
mov [imgdest+esi+2],al
add esi,3
add ebp,3
inc ecx
cmp ecx,xs
jne cyc
add ebp,edi
add ebp,edi
add ebp,edi
sub ebp,xs
sub ebp,xs
sub ebp,xs
mov ecx,0
inc ebx
cmp ebx,ys
jne cyc
 
}
 
;
macro bmptoimg bmp_off,soi,img_off
{
local nodix,conv
cmp word [bmp_off],word 'BM'
jne nodix
mov eax,dword [bmp_off+18]
mov ebx,dword [bmp_off+22]
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ecx,[eax+2*eax]
lea edi,[img_off+8]
mov esi,dword [soi]
cld
rep movsb
nodix:
}
 
macro copyimg img2_off,img1_off
{
local cop
mov eax,dword [img1_off]
mov ebx,dword [img1_off+4]
mul ebx
lea ecx,[eax+2*eax]
lea esi,[img1_off+8]
lea edi,[img2_off+8]
cld
rep movsb
}
 
macro fullimg img_off,xs,ys,color
{
local cop
mov eax,xs
mov ebx,ys
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ebp,[eax+2*eax]
mov esi,color
if color eqtype 0
mov ecx,color/65536
else
mov ecx,esi
shr ecx,16
end if
xor edi,edi
cop:
mov word [img_off+8+edi],si
add edi,2
mov byte [img_off+8+edi],cl
inc edi
cmp edi,ebp
jne cop
}
 
 
 
 
macro convbmp bmp_load_area,bmp_soi
{
local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
local noaddword
;local qwe,bmpfn
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov dword [dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov eax,bmp_load_area
mov ebx,eax
add ebx, [bmp_load_area+2];file size
inc ebx
mov dword [bmp_soi],ebx ;soi-start of image area for drawing
add eax, [bmp_load_area+10]
mov dword [sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
lea eax,[eax+2*eax] ;3x pixels in eax
 
mov edi,dword [bmp_soi] ;initializing
mov esi,dword [eop]
sub esi,dword [bps]
 
 
nextstring:
push edi
cmp word [bmp_load_area+28],24
jne convertno32
 
mov ecx,[dwps]
cld
rep movsd
convert1:
pop edi
sub esi,dword [bps]
sub esi,dword [bps]
cmp esi,dword [sop]
jb end_bmp;nomorestring
add edi,eax
jmp nextstring
 
; nomorestring:
; jmp end_bmp
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bps]
mov dword [eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
convert2:
pop eax
inc esi
cmp esi,dword [eos]
jae convert1
add edi,3
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
cmp edx,0xffffffff
je convert2
add edi,3
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
mov dword [edi],edx
ret
 
 
; DATA AREA
 
;status dd 0 ;bit0=1 if file thread is created
bps dd 0
dwps dd 0
;soi dd 0
sop dd 0
eop dd 0
eos dd 0
;process dd 0
 
end_bmp:
; mov eax,dword [soi]
; mov dword [bmp_soi],eax
 
}
 
 
 
 
; LOADBMP - Load bmp image from file
; (SYNTAX) LOADBMP 'file_path',temp_area(rb 0x10000),load_area,dd soi
; (SAMPLE) LOADBMP '/rd/1/menuet.bmp',temp_area,I_END,tsoi
; ( NOTE ) Macros create on Base of
; Picture browser by lisovin@26.ru & Ivan Poddubny
; SOI - Start of image
 
macro loadbmp bmp_file_name,bmp_temp_area,bmp_load_area,bmp_soi
{
local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
local noaddword
;local qwe,bmpfn
 
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[bmp_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
 
; jmp qwe
;bmpfn db bmp_file_name
;qwe:
; mov eax,6
; mov ebx,bmpfn
; mov ecx,0
; mov edx,0xFFFFFF
; mov esi,bmp_load_area
; mov edi,0
; int 0x40
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov dword [dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov eax,bmp_load_area
push eax
add eax, [bmp_load_area+2];file size
inc eax
mov dword [soi],eax ;soi-start of image area for drawing
pop eax
add eax, [bmp_load_area+10]
mov dword [sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
mov ebx,3
mul ebx ;3x pixels in eax
 
mov edi,dword [soi] ;initializing
mov esi,dword [eop]
sub esi,dword [bps]
 
 
nextstring:
push edi
cmp word [bmp_load_area+28],24
jne convertno32
 
mov ecx,[dwps]
cld
rep movsd
convert1:
pop edi
sub esi,dword [bps]
sub esi,dword [bps]
cmp esi,dword [sop]
jb nomorestring
add edi,eax
jmp nextstring
 
nomorestring:
jmp end_bmp
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bps]
mov dword [eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
convert2:
pop eax
inc esi
cmp esi,dword [eos]
jae convert1
add edi,3
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
cmp edx,0xffffffff
je convert2
add edi,3
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
mov dword [edi],edx
ret
 
 
; DATA AREA
 
;status dd 0 ;bit0=1 if file thread is created
bps dd 0
dwps dd 0
soi dd 0
sop dd 0
eop dd 0
eos dd 0
;process dd 0
 
; DATA AREA
fileinfo:
dd 0
dd 0
dd 1 ;number of blocks of 512 bytes
dd bmp_load_area
dd bmp_temp_area
string:
db bmp_file_name,0
db ' '
db ' '
db ' '
db ' ',0
 
 
end_bmp:
mov eax,dword [soi]
mov dword [bmp_soi],eax
 
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong/trunk/ascl.inc
0,0 → 1,499
lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.09 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
 
macro opendialog redproc,openoff,erroff,path,testtime
{
local still, dlg_file, clip_file, redwait
local button, key, red, zzz, still, zzz2, incf, file_is_open, zzz3
 
mov ecx,200
zzz3:
mov byte [path+ecx-1],0
loop zzz3
 
dec byte [clip_file+7]
incf:
inc byte [clip_file+7]
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp byte [clip_file+7],'Z'
je erroff
cmp eax,0xffffffff
jne incf
 
mov ecx,200
zzz2:
mov byte [path+ecx],0
loop zzz2
 
mov ebx,clip_file
mov ecx,path
mov edx,100
mov esi,0
mov eax,33
int 0x40
 
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
int 0x40
 
still:
scevent red,key,button
cmp byte [path],0
jne file_is_open
cmp dword [redwait],testtime ;20
jnae zzz
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp eax,0xffffffff
je erroff ;errexit
mov dword [redwait],0
zzz:
delay 5
inc dword [redwait]
jmp still
 
file_is_open:
mov eax,32
mov ebx,clip_file
int 0x40
jmp openoff
 
key: ; key
int 0x40 ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
int 0x40
 
red:
call redproc
jmp still
 
dlg_file db 'SYSXTREE '
clip_file db 'OPENCLPACLP'
db 'O' ;Dialog type O-open S-save
db 0 ;Marker
redwait dd 0
}
 
macro savedialog redproc,openoff,erroff,path,testtime
{
local still, dlg_file, clip_file, redwait, zzz3
local button, key, red, zzz, still, zzz2, incf, file_is_open
 
mov ecx,200
zzz3:
mov byte [path+ecx-1],0
loop zzz3
 
dec byte [clip_file+7]
incf:
inc byte [clip_file+7]
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp byte [clip_file+7],'Z'
je erroff
cmp eax,0xffffffff
jne incf
 
mov ecx,200
zzz2:
mov byte [path+ecx],0
loop zzz2
 
mov ebx,clip_file
mov ecx,path
mov edx,100
mov esi,0
mov eax,33
int 0x40
 
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
int 0x40
 
still:
scevent red,key,button
cmp byte [path],0
jne file_is_open
cmp dword [redwait],testtime ;20
jnae zzz
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp eax,0xffffffff
je erroff ;errexit
mov dword [redwait],0
zzz:
delay 5
inc dword [redwait]
jmp still
 
file_is_open:
mov eax,32
mov ebx,clip_file
int 0x40
jmp openoff
 
key: ; key
int 0x40 ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
int 0x40
 
red:
call redproc
jmp still
 
dlg_file db 'SYSXTREE '
clip_file db 'SAVECLPACLP'
db 'S' ;Dialog type O-open S-save
db 0 ;Marker
redwait dd 0
}
 
 
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
 
randomuse = 0
 
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
 
jmp rxproc
 
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
; mov arg2,0
; mov arg2,eax
ret
end if
 
rxproc:
mov eax,arg1
call randomproc
mov arg2,0
mov arg2,eax
}
 
macro scank
{
mov eax,10
int 0x40
}
 
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
 
macro puttxt x,y,offs,size,color
{
mov ebx,x
shl ebx,16
add ebx,y
mov ecx,color
mov edx,offs
mov esi,size
mov eax,4
int 0x40
}
 
;_ equ '____'
 
;macro libtest x,y,color
;{
;if x = as dword
; mov ebx,x
;end if
; mov ecx,y
; mov edx,color
; mov eax,1
; int 0x40
;}
 
 
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
mov edx,x*65536+y
mov esi,color
mov eax,47
int 0x40
}
 
; SCEVENT - Scan event
 
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; WTEVENT - Wait event
 
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; TIMEEVENT - Wite for event with timeout
 
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
 
; CLOSE - Close program
 
macro close
{
mov eax,-1
int 0x40
}
 
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
 
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
 
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
 
macro window arg1,arg2,arg3,arg4,arg5
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov eax,0
int 0x40
}
 
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
 
 
; STARTWD - Start of window draw
 
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
 
; ENDWD - End window draw
 
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
 
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
 
macro label arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
mov ebx,arg1 ;arg1=y arg2=x
shl ebx,16
add ebx,arg2
mov ecx,arg4 ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
 
;Attributes
 
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
 
;Font Attributes
font_Big equ 0x10000000
 
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040ff
cl_Cyan equ 0x0040e0ff
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pong.asm pong
@pause
/programs/games/pong/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pong.asm pong
@pause
/programs/games/pong/trunk/pong.asm
0,0 → 1,381
;
; Pong Gaem 2Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
;
 
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd 0x300000 ; memory for app
dd 0x300000 ; esp
dd temp_area , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
;5941 ;4523(with new random)
 
 
 
include 'lang.inc'
include 'ascl.inc'
include 'ascgl.inc'
 
START: ; start of execution
call draw_window
 
loadbmp '/RD/1/MFAR.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img
loadbmp '/RD/1/COPY.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img2
loadbmp '/RD/1/SMILE.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img3
 
fullimg img4 , 32 ,32 ,0x00000000 ;black
 
loadbmp '/RD/1/MBAR_I3.BMP',temp_area,I_END,tsoi
bmptoimg I_END,tsoi,img5
 
 
still:
 
mov eax,11 ; scan event
int 0x40
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
out_scorea:
mov eax,47
mov ebx,5*65536
mov ecx,[scorea]
mov edx,300*65536+8
mov esi,cl_Blue
int 0x40
out_scoreb:
mov eax,47
mov ebx,5*65536
mov ecx,[scoreb]
mov edx,350*65536+8
mov esi,cl_Red
int 0x40
 
del_images:
setimg dword [ply1x],dword [ply1y],img4
setimg dword [ply2x],dword [ply2y],img4
setimg dword [ballx],dword [bally],img4
setimg dword [gravx],dword [gravy],img4
 
 
move_images:
 
x_move:
mov eax,dword [ply1rx]
cmp dword [ply1x],eax
je no_m
cmp dword [ply1x],eax
ja m_m
m_p:
add dword [ply1x],4
jmp no_m
m_m:
sub dword [ply1x],4
no_m:
 
 
y_move:
mov eax,dword [ply1ry]
cmp dword [ply1y],eax
je no_m2
cmp dword [ply1y],eax
ja m_m2
m_p2:
add dword [ply1y],2
jmp no_m2
m_m2:
sub dword [ply1y],2
no_m2:
 
;automove ball
mov eax,dword [ballxv]
add dword [ballx],eax
mov eax,dword [ballyv]
add dword [bally],eax
 
 
;autoslow ball
cmp dword [ballxv],0
jl ballb
balla:
cmp dword [ballxv],2
jng balln
dec dword [ballxv]
; mov dword [ballxv],2
jmp balln
 
ballb:
cmp dword [ballxv],-2
jng balln
inc dword [ballxv]
; mov dword [ballxv],-2
jmp balln
 
balln:
 
cmp dword [ballyv],2
jng by_n
dec dword [ballyv]
by_n:
 
;test ball on collusion of screen
; cmp dword [bally],480+16-32
; jna ya_ok
; neg dword [ballyv]
;ya_ok:
; cmp dword [bally],30
; jnb yb_ok
; neg dword [ballyv]
;yb_ok:
cmp dword [ballx],640-32
jna xa_ok
neg dword [ballxv]
xa_ok:
cmp dword [ballx],6
jnb xb_ok
neg dword [ballxv]
xb_ok:
 
;if ball far out of screen come back
; is not work already
cmp dword [bally],466
jng yax_ok
call draw_window
inc dword [scoreb]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok:
cmp dword [bally],30
jnl yax_ok2
call draw_window
inc dword [scorea]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok2:
 
xorx:
cmp dword [ballxv],0
jne norx
random 5,dword [ballxv]
sub dword [ballxv],2
cmp dword [ballxv],0
je xorx
norx:
 
;test on collusion ply1 of ball
collusion_test:
collimg img,[ply1x],[ply1y],img3,[ballx],[bally],eax
cmp eax,1
jne not_coll
neg dword [ballyv]
add dword [bally],18
; neg dword [ballxv]
not_coll:
 
;test on collusion com of ball
collusion_com:
collimg img,[ply2x],[ply2y],img3,[ballx],[bally],eax
cmp eax,1
jne not_collcom
neg dword [ballyv]
sub dword [bally],18
; neg dword [ballxv]
not_collcom:
 
;test on collusion gravity of ball
collusion_grav:
collimg img,[gravx],[gravy],img3,[ballx],[bally],eax
cmp eax,1
jne not_collg
neg dword [ballyv]
 
; mov dword [ballxv],-20
 
cmp dword [ballyv],0
jl ab
jg bf
jmp not_collgx
ab:
sub dword [ballyv],30
jmp not_collgx
bf:
add dword [ballyv],30
not_collgx:
cmp dword [ballxv],0
jl abx
jg bfx
jmp not_collg
abx:
sub dword [ballxv],10
jmp not_collg
bfx:
add dword [ballxv],10
 
 
; mov dword [ballyv],20
not_collg:
 
;com move
cx_move:
cmp dword [bally],200
jna cno_m
mov eax,dword [ballx]
cmp dword [ply2x],eax
je cno_m
cmp dword [ply2x],eax
ja cm_m
cm_p:
add dword [ply2x],3
jmp cno_m
cm_m:
sub dword [ply2x],3
cno_m:
 
gravity:
cmp dword [gravtime],0
je no_dg
dec dword [gravtime]
no_dg:
 
draw_gravity:
cmp dword [gravtime],0
je nograv
mov eax,dword [ply1x]
mov ebx,dword [ply1y]
add ebx,20
mov dword [gravx],eax
mov dword [gravy],ebx
jmp endgrav
nograv:
mov dword [gravx],1000
mov dword [gravy],1000
endgrav:
 
redraw_images:
setimg dword [ply1x],dword [ply1y],img
setimg dword [ply2x],dword [ply2y],img2 ;2
setimg dword [ballx],dword [bally],img3
setimg dword [gravx],dword [gravy],img5
 
 
delay 2 ;don't generate delay for fast speed programm
 
jmp still
 
red:
call draw_window
jmp still
 
key: ; key
mov eax,2
int 0x40
cmp ah,key_Left
jne no_l
sub dword [ply1rx],16
no_l:
cmp ah,key_Right
jne no_r
add dword [ply1rx],16
no_r:
cmp ah,key_Up
jne no_u
sub dword [ply1ry],16
no_u:
cmp ah,key_Down
jne no_d
add dword [ply1ry],16
no_d:
cmp ah,key_Space
jne no_sp
mov dword [gravtime],100
no_sp:
 
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still
 
 
draw_window:
startwd
window 0,0,640+8,480+24,window_Skinned
label 12,8,'PONG: USE ARROW KEYS SCORE',cl_White+font_Big
endwd
ret
 
 
; DATA AREA
xt dd 100
yt dd 100
 
gravtime dd 10
gravx dd 1000
gravy dd 1000
 
ply1rx dd 200
ply1ry dd 50
 
ply1x dd 200
ply1y dd 50
 
ply2x dd 200
ply2y dd 400
 
ballx dd 200
bally dd 200
 
ballyv dd 3
ballxv dd 3
 
scorea dd 0
scoreb dd 0
 
counter dd 0
tsoi dd 0
 
IM_END:
 
img:
rd 32*32*3+8
img2:
rb 32*32*3+8
img3:
rb 32*32*3+8
img4:
rb 32*32*3+8
img5:
rb 32*32*3+8
 
temp_area:
rb 0x15000
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong3/trunk/ascgl.inc
0,0 → 1,624
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; Graphics
; Libary
;
; Ver 0.10 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 LoadImage
;0.02 SetBmp
;0.03 Bmptoimg, Setimg ~01.03.2004
;0.04 Bug deleted, copyimg ~03.05.2004
;0.05 fullimg, collimg ~05.05.2004
;0.06 getimg ~09.05.2004
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by halyavin, add at ~07.06.2004
 
;DrawBox
macro drawfbox x,y,xs,ys,color
{
mov ecx,y
mov ebx,x
shl ebx,16
add ebx,xs
shl ecx,16
add ecx,ys
mov edx,color
mov eax,13
int 0x40
}
 
; FPS - Set Frame Per Second Display
fps_show_frequency=40
macro fps x,y,color,delcolor
{
local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt
local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
int 0x40
cmp eax,[savetime]
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
mov [savetime],eax
mov ebx,[fps_cntr]
mov [fps],ebx
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+30
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
int 0x40
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,5*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
mov ecx,[fps]
int 0x40
no_out_fps:
}
 
 
 
; COLLIMG - Collusion image's
_1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if (_1dbounce_count = 1)
_1dbounce:
cmp ebx,eax
jnae anot
add eax,esi
cmp eax,ebx
jna nbc
jmp bc
anot:
add ebx,edi
cmp ebx,eax
jna nbc
bc:
mov ecx,1
ret
nbc:
mov ecx,0
ret
end if
bounce:
mov otv,1
exit:
}
 
; SETBMP - Set bmp to window
; (SYNTAX) SETBMP dd xstart ,dd ystart ,BMP_offset,dd soi
; (SAMPLE) SETBMP dword [xt],dword [yt],I_END,dword [tsoi]
; SETBMP 15,10,I_END,dword [tsoi]
; ( NOTE ) SOI - Start of image
 
macro setbmp arg1,arg2,arg3,arg4
{
local nodi
cmp word [arg3],word 'BM'
jne nodi
mov eax,7
mov ebx,arg4 ;[soi]
mov ecx,dword [arg3+18]
shl ecx,16
add ecx,dword [arg3+22]
if (arg1 eqtype 0) & (arg2 eqtype 0)
mov edx,arg1*65536+arg2
else
mov edx,arg1
shl edx,16
add edx,arg2
end if
int 0x40
nodi:
}
 
macro setimg arg1,arg2,arg3
{
local nodi
mov eax,7
mov ebx,arg3
add ebx,8
mov ecx,dword [arg3]
shl ecx,16
add ecx,dword [arg3+4]
if (arg1 eqtype 0) & (arg2 eqtype 0)
mov edx,arg1*65536+arg2
else
mov edx,arg1
shl edx,16
add edx,arg2
end if
int 0x40
}
 
;Not optimiz
macro getimg imgsrc,x,y,xs,ys,imgdest
{
local cyc
mov eax,xs
mov dword [imgdest],eax
mov eax,ys
mov dword [imgdest+4],eax
 
mov eax,dword [imgsrc] ;getx size
mov edi,eax
mov ebx,y
mul ebx
add eax,x
mov ebx,3
mul ebx ;eax=offset on imsrc
 
mov ecx,0
mov ebx,0
mov ebp,eax
mov esi,0
 
add esi,8
add ebp,8
 
cyc:
mov al,byte [imgsrc+ebp]
mov [imgdest+esi],al
mov al,byte [imgsrc+ebp+1]
mov [imgdest+esi+1],al
mov al,byte [imgsrc+ebp+2]
mov [imgdest+esi+2],al
add esi,3
add ebp,3
inc ecx
cmp ecx,xs
jne cyc
add ebp,edi
add ebp,edi
add ebp,edi
sub ebp,xs
sub ebp,xs
sub ebp,xs
mov ecx,0
inc ebx
cmp ebx,ys
jne cyc
 
}
 
;
macro bmptoimg bmp_off,soi,img_off
{
local nodix,conv
cmp word [bmp_off],word 'BM'
jne nodix
mov eax,dword [bmp_off+18]
mov ebx,dword [bmp_off+22]
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ecx,[eax+2*eax]
lea edi,[img_off+8]
mov esi,dword [soi]
cld
rep movsb
nodix:
}
 
macro copyimg img2_off,img1_off
{
local cop
mov eax,dword [img1_off]
mov ebx,dword [img1_off+4]
mul ebx
lea ecx,[eax+2*eax]
lea esi,[img1_off+8]
lea edi,[img2_off+8]
cld
rep movsb
}
 
macro fullimg img_off,xs,ys,color
{
local cop
mov eax,xs
mov ebx,ys
mov dword [img_off],eax
mov dword [img_off+4],ebx
mul ebx
lea ebp,[eax+2*eax]
mov esi,color
if color eqtype 0
mov ecx,color/65536
else
mov ecx,esi
shr ecx,16
end if
xor edi,edi
cop:
mov word [img_off+8+edi],si
add edi,2
mov byte [img_off+8+edi],cl
inc edi
cmp edi,ebp
jne cop
}
 
 
 
 
macro convbmp bmp_load_area,bmp_soi
{
local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
local noaddword
;local qwe,bmpfn
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov dword [dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov eax,bmp_load_area
mov ebx,eax
add ebx, [bmp_load_area+2];file size
inc ebx
mov dword [bmp_soi],ebx ;soi-start of image area for drawing
add eax, [bmp_load_area+10]
mov dword [sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
lea eax,[eax+2*eax] ;3x pixels in eax
 
mov edi,dword [bmp_soi] ;initializing
mov esi,dword [eop]
sub esi,dword [bps]
 
 
nextstring:
push edi
cmp word [bmp_load_area+28],24
jne convertno32
 
mov ecx,[dwps]
cld
rep movsd
convert1:
pop edi
sub esi,dword [bps]
sub esi,dword [bps]
cmp esi,dword [sop]
jb end_bmp;nomorestring
add edi,eax
jmp nextstring
 
; nomorestring:
; jmp end_bmp
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bps]
mov dword [eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
convert2:
pop eax
inc esi
cmp esi,dword [eos]
jae convert1
add edi,3
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
cmp edx,0xffffffff
je convert2
add edi,3
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
mov dword [edi],edx
ret
 
 
; DATA AREA
 
;status dd 0 ;bit0=1 if file thread is created
bps dd 0
dwps dd 0
;soi dd 0
sop dd 0
eop dd 0
eos dd 0
;process dd 0
 
end_bmp:
; mov eax,dword [soi]
; mov dword [bmp_soi],eax
 
}
 
 
 
 
; LOADBMP - Load bmp image from file
; (SYNTAX) LOADBMP 'file_path',temp_area(rb 0x10000),load_area,dd soi
; (SAMPLE) LOADBMP '/rd/1/menuet.bmp',temp_area,I_END,tsoi
; ( NOTE ) Macros create on Base of
; Picture browser by lisovin@26.ru & Ivan Poddubny
; SOI - Start of image
 
macro loadbmp bmp_file_name,bmp_temp_area,bmp_load_area,bmp_soi
{
local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp
local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2
local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
local noaddword
;local qwe,bmpfn
 
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[bmp_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
 
; jmp qwe
;bmpfn db bmp_file_name
;qwe:
; mov eax,6
; mov ebx,bmpfn
; mov ecx,0
; mov edx,0xFFFFFF
; mov esi,bmp_load_area
; mov edi,0
; int 0x40
 
; convert:
movzx eax,word [bmp_load_area+28]
mul dword [bmp_load_area+18]
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov dword [dwps],eax ;dwps-doublewords per string
shl eax,2
mov dword [bps],eax ;bps-bytes per string
 
cmp dword [bmp_load_area+34],0
jne yespicsize ;if picture size is defined
mul dword [bmp_load_area+22]
mov dword [bmp_load_area+34],eax
 
yespicsize:
mov eax,bmp_load_area
push eax
add eax, [bmp_load_area+2];file size
inc eax
mov dword [soi],eax ;soi-start of image area for drawing
pop eax
add eax, [bmp_load_area+10]
mov dword [sop],eax ;sop-start of picture in file
add eax, [bmp_load_area+34]
mov dword [eop],eax ;eop-end of picture in file
mov eax, [bmp_load_area+18]
mov ebx,3
mul ebx ;3x pixels in eax
 
mov edi,dword [soi] ;initializing
mov esi,dword [eop]
sub esi,dword [bps]
 
 
nextstring:
push edi
cmp word [bmp_load_area+28],24
jne convertno32
 
mov ecx,[dwps]
cld
rep movsd
convert1:
pop edi
sub esi,dword [bps]
sub esi,dword [bps]
cmp esi,dword [sop]
jb nomorestring
add edi,eax
jmp nextstring
 
nomorestring:
jmp end_bmp
 
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
push esi
add esi,dword [bps]
mov dword [eos],esi
pop esi
nextelem:
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
call converttable
convert2:
pop eax
inc esi
cmp esi,dword [eos]
jae convert1
add edi,3
jmp nextelem
 
convert4bpp:
shl ax,4
shr al,4
push ax
movzx eax,ah
call converttable
add edi,3
pop ax
movzx eax,al
call converttable
jmp convert2
 
convert1bpp:
mov ecx,eax
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
push edx
call converttable
pop edx
dec edx
cmp edx,0xffffffff
je convert2
add edi,3
jmp nextbit
 
converttable:
shl eax,2
add eax,ebx
mov edx, dword [eax]
mov dword [edi],edx
ret
 
 
; DATA AREA
 
;status dd 0 ;bit0=1 if file thread is created
bps dd 0
dwps dd 0
soi dd 0
sop dd 0
eop dd 0
eos dd 0
;process dd 0
 
; DATA AREA
fileinfo:
dd 0
dd 0
dd 1 ;number of blocks of 512 bytes
dd bmp_load_area
dd bmp_temp_area
string:
db bmp_file_name,0
db ' '
db ' '
db ' '
db ' ',0
 
 
end_bmp:
mov eax,dword [soi]
mov dword [bmp_soi],eax
 
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong3/trunk/ascgml.inc
0,0 → 1,49
lang equ ru
 
;
; Assembler
; SMALL
; CODE
; GaMe
; Libary
;
; Ver 0.03 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 correct
;0.02 control ~14.05.2004
;0.03 all macros optimized by halyavin, add at ~07.06.2004
 
 
; corectiryemoe,corectnoe,step
macro correct arg1,arg2,arg3
{
local plus,minus,equal
mov eax,arg2
cmp arg1,eax
je equal
mov eax,arg3
ja minus
plus:
add arg1,eax
jmp equal
minus:
sub arg1,eax
equal:
}
 
macro control min,max,arg
{
local gr,low,norm
mov eax,max
cmp arg,eax
jg gr
mov eax,min
cmp arg,eax
jnl norm
gr:
low:
mov arg,eax
norm:
}
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong3/trunk/ascl.inc
0,0 → 1,499
lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.09 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
 
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
 
macro opendialog redproc,openoff,erroff,path,testtime
{
local still, dlg_file, clip_file, redwait
local button, key, red, zzz, still, zzz2, incf, file_is_open, zzz3
 
mov ecx,200
zzz3:
mov byte [path+ecx-1],0
loop zzz3
 
dec byte [clip_file+7]
incf:
inc byte [clip_file+7]
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp byte [clip_file+7],'Z'
je erroff
cmp eax,0xffffffff
jne incf
 
mov ecx,200
zzz2:
mov byte [path+ecx],0
loop zzz2
 
mov ebx,clip_file
mov ecx,path
mov edx,100
mov esi,0
mov eax,33
int 0x40
 
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
int 0x40
 
still:
scevent red,key,button
cmp byte [path],0
jne file_is_open
cmp dword [redwait],testtime ;20
jnae zzz
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp eax,0xffffffff
je erroff ;errexit
mov dword [redwait],0
zzz:
delay 5
inc dword [redwait]
jmp still
 
file_is_open:
mov eax,32
mov ebx,clip_file
int 0x40
jmp openoff
 
key: ; key
int 0x40 ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
int 0x40
 
red:
call redproc
jmp still
 
dlg_file db 'SYSXTREE '
clip_file db 'OPENCLPACLP'
db 'O' ;Dialog type O-open S-save
db 0 ;Marker
redwait dd 0
}
 
macro savedialog redproc,openoff,erroff,path,testtime
{
local still, dlg_file, clip_file, redwait, zzz3
local button, key, red, zzz, still, zzz2, incf, file_is_open
 
mov ecx,200
zzz3:
mov byte [path+ecx-1],0
loop zzz3
 
dec byte [clip_file+7]
incf:
inc byte [clip_file+7]
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp byte [clip_file+7],'Z'
je erroff
cmp eax,0xffffffff
jne incf
 
mov ecx,200
zzz2:
mov byte [path+ecx],0
loop zzz2
 
mov ebx,clip_file
mov ecx,path
mov edx,100
mov esi,0
mov eax,33
int 0x40
 
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
int 0x40
 
still:
scevent red,key,button
cmp byte [path],0
jne file_is_open
cmp dword [redwait],testtime ;20
jnae zzz
mov eax,6
mov ebx,clip_file
mov ecx,0
mov edx,-1
mov esi,path
int 0x40
cmp eax,0xffffffff
je erroff ;errexit
mov dword [redwait],0
zzz:
delay 5
inc dword [redwait]
jmp still
 
file_is_open:
mov eax,32
mov ebx,clip_file
int 0x40
jmp openoff
 
key: ; key
int 0x40 ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
int 0x40
 
red:
call redproc
jmp still
 
dlg_file db 'SYSXTREE '
clip_file db 'SAVECLPACLP'
db 'S' ;Dialog type O-open S-save
db 0 ;Marker
redwait dd 0
}
 
 
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
 
randomuse = 0
 
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
 
jmp rxproc
 
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
; mov arg2,0
; mov arg2,eax
ret
end if
 
rxproc:
mov eax,arg1
call randomproc
mov arg2,0
mov arg2,eax
}
 
macro scank
{
mov eax,10
int 0x40
}
 
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
 
macro puttxt x,y,offs,size,color
{
mov ebx,x
shl ebx,16
add ebx,y
mov ecx,color
mov edx,offs
mov esi,size
mov eax,4
int 0x40
}
 
;_ equ '____'
 
;macro libtest x,y,color
;{
;if x = as dword
; mov ebx,x
;end if
; mov ecx,y
; mov edx,color
; mov eax,1
; int 0x40
;}
 
 
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
mov edx,x*65536+y
mov esi,color
mov eax,47
int 0x40
}
 
; SCEVENT - Scan event
 
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; WTEVENT - Wait event
 
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
; TIMEEVENT - Wite for event with timeout
 
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
 
 
; CLOSE - Close program
 
macro close
{
mov eax,-1
int 0x40
}
 
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
 
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
 
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
 
macro window arg1,arg2,arg3,arg4,arg5
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov eax,0
int 0x40
}
 
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
mov ebx,arg1*65536+arg3
mov ecx,arg2*65536+arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
 
 
; STARTWD - Start of window draw
 
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
 
; ENDWD - End window draw
 
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
 
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
 
macro label arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
mov ebx,arg1 ;arg1=y arg2=x
shl ebx,16
add ebx,arg2
mov ecx,arg4 ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
 
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
 
;Attributes
 
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
 
;Font Attributes
font_Big equ 0x10000000
 
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040ff
cl_Cyan equ 0x0040e0ff
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/pong3/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm pong3.asm pong3
@pause
/programs/games/pong3/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm pong3.asm pong3
@pause
/programs/games/pong3/trunk/pong.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/pong3/trunk/pong3.asm
0,0 → 1,357
;
; Pong Gaem 3Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
;
; Not use bmpfile!
 
;******************************************************************************
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd IM_END ; size of image
dd 0x300000 ; memory for app
dd 0x300000 ; esp
dd temp_area , 0x0 ; I_Param , I_Icon
 
;******************************************************************************
 
 
include 'ascl.inc'
include 'ascgl.inc'
include 'ascgml.inc'
 
 
START: ; start of execution
call draw_window
 
; loadbmp '/RD/1/PONG.BMP',temp_area,I_END,tsoi
convbmp pongfile,tsoi
bmptoimg pongfile,tsoi,pong
getimg pong,0,0,80,4,img
getimg pong,0,4,80,4,img2
getimg pong,5,38,15,15,img3
getimg pong,0,8,80,20,img5
fullimg img4 , 80 ,20 ,0x00000000 ;black for rocket
fullimg img6 , 15 ,15 ,0x00000000 ;black for ball
 
 
 
still:
 
scevent red,key,button
 
outcount dword [scoreb],300,8,cl_Blue,5*65536
outcount dword [scorea],350,8,cl_Red,5*65536
 
del_images:
setimg dword [ply1x],dword [ply1y],img4
setimg dword [ply2x],dword [ply2y],img4
setimg dword [ballx],dword [bally],img6
setimg dword [gravx],dword [gravy],img4
 
move_ply1:
 
correct [ply1x],[ply1rx],4
correct [ply1y],[ply1ry],2
 
;automove ball
mov eax,dword [ballxv]
add dword [ballx],eax
mov eax,dword [ballyv]
add dword [bally],eax
 
 
;autoslow ball
cmp dword [ballxv],0
jl ballb
balla:
cmp dword [ballxv],2
jng balln
dec dword [ballxv]
jmp balln
ballb:
cmp dword [ballxv],-2
jnl balln
inc dword [ballxv]
jmp balln
balln:
cmp dword [ballyv],2
jng by_n
dec dword [ballyv]
by_n:
 
;ball collusion of screen
cmp dword [ballx],640-32
jna xa_ok
neg dword [ballxv]
xa_ok:
cmp dword [ballx],6
jnb xb_ok
neg dword [ballxv]
xb_ok:
 
;if ball far out of screen come back
; is not work already
cmp dword [bally],466
jng yax_ok
call draw_window
inc dword [scoreb]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok:
cmp dword [bally],30
jnl yax_ok2
call draw_window
inc dword [scorea]
mov dword [bally],240
mov dword [ballx],310
mov dword [ballyv],2
random 5,dword [ballxv]
sub dword [ballxv],2
yax_ok2:
 
xorx:
cmp dword [ballxv],0
jne norx
random 5,dword [ballxv]
sub dword [ballxv],2
cmp dword [ballxv],0
je xorx
norx:
 
;test on collusion ply1 of ball
collusion_test:
collimg img,[ply1x],[ply1y],img3,[ballx],[bally],eax
cmp eax,1
jne not_coll
neg dword [ballyv]
add dword [bally],4
; neg dword [ballxv]
not_coll:
 
;test on collusion com of ball
collusion_com:
collimg img,[ply2x],[ply2y],img3,[ballx],[bally],eax
cmp eax,1
jne not_collcom
neg dword [ballyv]
sub dword [bally],4
; neg dword [ballxv]
not_collcom:
 
;test on collusion gravity of ball
collusion_grav:
collimg img,[gravx],[gravy],img3,[ballx],[bally],eax
cmp eax,1
jne not_collg
neg dword [ballyv]
 
; mov dword [ballxv],-20
 
cmp dword [ballyv],0
jl ab
jg bf
jmp not_collgx
ab:
sub dword [ballyv],25
jmp not_collgx
bf:
add dword [ballyv],25
not_collgx:
cmp dword [ballxv],0
jl abx
jg bfx
jmp not_collg
abx:
sub dword [ballxv],8 ;15
jmp not_collg
bfx:
add dword [ballxv],8
 
 
; mov dword [ballyv],20
not_collg:
 
;ply contorl
cmp dword [ply1rx],560
jna plyok
cmp dword [ply1rx],12000
jna paa
mov dword [ply1rx],4
jmp plyok
paa:
mov dword [ply1rx],560
plyok:
 
 
;com contorl
cmp dword [ply2x],560
jna cplyok
cmp dword [ply2x],12000
jna cpaa
mov dword [ply2x],4
jmp cplyok
cpaa:
mov dword [ply2x],560
cplyok:
 
 
;com move
cx_move:
cmp dword [bally],160
jna cno_m
mov eax,dword [ballx]
sub eax,30
cmp dword [ply2x],eax
je cno_m
cmp dword [ply2x],eax
ja cm_m
cm_p:
add dword [ply2x],3
jmp cno_m
cm_m:
sub dword [ply2x],3
cno_m:
 
;garvity
gravity:
cmp dword [gravtime],0
je no_dg
dec dword [gravtime]
no_dg:
 
draw_gravity:
cmp dword [gravtime],0
je nograv
mov eax,dword [ply1x]
mov ebx,dword [ply1y]
add ebx,10
mov dword [gravx],eax
mov dword [gravy],ebx
jmp endgrav
nograv:
mov dword [gravx],1000
mov dword [gravy],1000
endgrav:
 
redraw_images:
setimg dword [ply1x],dword [ply1y],img
setimg dword [ply2x],dword [ply2y],img2 ;2
setimg dword [ballx],dword [bally],img3
setimg dword [gravx],dword [gravy],img5
 
 
delay 1 ;don't generate delay for fast speed programm
 
jmp still
 
red:
call draw_window
jmp still
 
key: ; key
mov eax,2
int 0x40
cmp ah,key_Left
jne no_l
sub dword [ply1rx],32 ;16
no_l:
cmp ah,key_Right
jne no_r
add dword [ply1rx],32 ;16
no_r:
cmp ah,key_Up
jne no_u
sub dword [ply1ry],16
no_u:
cmp ah,key_Down
jne no_d
add dword [ply1ry],16
no_d:
cmp ah,key_Space
jne no_sp
mov dword [gravtime],100
no_sp:
 
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
jmp still
 
 
draw_window:
startwd
window 0,0,640+8,480+24,window_Skinned
label 12,8,'PONG: USE ARROW KEYS SCORE',cl_White+font_Big
endwd
ret
 
 
; DATA AREA
xt dd 100
yt dd 100
 
gravtime dd 10
gravx dd 1000
gravy dd 1000
 
ply1rx dd 200
ply1ry dd 50
 
ply1x dd 200
ply1y dd 50
 
ply2x dd 200
ply2y dd 400
 
ballx dd 200
bally dd 200
 
ballyv dd 3
ballxv dd 3
 
scorea dd 0
scoreb dd 0
 
counter dd 0
tsoi dd 0
 
pongfile:
file 'pong.bmp'
 
IM_END:
 
temp:
rb 20000
 
pong:
rb 80*60*3+8
img:
rb 32*32*3+8
img2:
rb 32*32*3+8
img3:
rb 32*32*3+8
img4:
rb 80*20*3+8
img5:
rb 32*32*3+8
img6:
rb 15*15*3+8
 
temp_area:
rb 0x15000
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tanks/trunk/Hi_win.txt
0,0 → 1,31
 
 
 
Hi!My name is andrew_programmer aka Andrey Ignatyev.This my firs programm and game for MenuetOS.
Game TANKS was made specially for MenuetOS.(x.8.2005)
All pictures and levels made i.
I bad speak an english.Please use translater for understanding next text.
 
 
 
Ïðèâåò!Ìåíÿ çîâóò Àíäðåé Èãíàòüåâ(andrew_programmer).
Ïî ïðîñüáå Ñåðãåÿ Êóçüìèíà(Wildwest), ïåðâîé èãðîé,êîòîðóþ ÿ ñîçäàë äëÿ Ìåîñ,
ñòàëà "Òàíêè".Ãðàôèêó íå ñóäèòå ñòðîãî-âñå ðèñîâàë ÿ ñàì,à ïîìî÷ü áûëî íåêîìó.
Êñòàòè,âñå êàðòèíêè áûëè ñîçäàíû èñêëþ÷èòåëüíî â ìåîñü â ìîåì ñîáñòâåííîì ôîðìàòå-pix.
 
 
Öåëü èãðû-ðàçáîìáèòü âñå áàçû ïðîòèâíèêà.Ïîìíèòå,÷òî â âîäå ñêîðîñòü òàíêà çàìåäëÿåòñÿ,
à â äåðåâüÿõ òàíê íåâèäåí.Õîòÿ òàíêè ïðîòèâíèêà íå îòëè÷àþòñÿ îñîáûì èíòåëëåêòîì,íî
âñåðàâíî îíè íå äàäóò âàì ñêó÷àòü.
 
 èãðå çàäóìûâàëîñü ñäåëàòü 32 óðîâíÿ.Íî ó ìåíÿ õâàòèëî ôàíòàçèè òîëüêî íà 15.
Åñëè êòî õî÷åò,ñäåëàéòå åùå 17 ïðèïîìîùè ðåäàêòîðà LevelEdit.Ó íåãî ïðîñòîé èíòåðôåéñ.
Ñòðåëêè ââåðõ,âíèç,âïðàâî,âëåâî óïðàâëÿþò ïîëîæåíèåì øàáëîíà íà êàðòå.Ïðîáåë- ýòî
ñìåíà øàáëîíà(èõ 10).Äëÿ ñîõðàíåíèÿ êàðòû íàæìèòå F2 è ââåäèòå ïîëíûé ïóòü ê ôàéëó âìåñòå
ñ íàçâàíèåì íîâîãî ôàéëà(ïðèìåð:'/hd/1/lev/lev01.lev').Äëÿ çàãðóçêè ñóùåñòâóþùåãî
óðîâíÿ íàæìèòå F1 è ââåäèòå ïóòü ê ôàéëó.Òàíêè ïîÿâëÿþòñÿ ñïðàâà îò áàçû.Âîò è âñå.
 
 
*************************************************************************************************
***************************Íàäåþñü ìîÿ èãðà âàì ïîíðàâèòüñÿ!*************************************
*************************************************************************************************
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tanks/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tanks.asm tanks
@pause
/programs/games/tanks/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tanks.asm tanks
@pause
/programs/games/tanks/trunk/lev01.lev
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/tanks/trunk/leveledit.asm
0,0 → 1,1151
use32
org 0x0
 
db 'MENUET01'
dd 0x1
dd START
dd I_END
dd 0x3000+640*400*3+16*20*20*3+512+640+1
dd 0x3000
dd 0x0
dd 0x0
include 'lang.inc'
include 'pixengin.inc'
START:
mov eax,40
mov ebx,111b
int 0x40
call drawwin
;main cycle(fps)
fpst:
call clock
mov eax,[time]
mov [old_time],eax
mov [old_frame_time],eax
;----------------------------------------------------------
;---------load all sprites from arrays to memory-----------
;----------------------------------------------------------
mov [number_sprite],0
xor eax,eax
nextfile:
mov ebx,[spisok+4*eax]
mov ecx,50
mov esi,ebx
add esi,2
mov edi,0x3000+(640*400*3)+(16*20*20*3)+10
rep movsb ;copy palitra to memory
mov esi,ebx
add esi,52
xor ecx,ecx
mov cl,byte [ebx]
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512
push eax
call unpakin
pop eax
mov ecx,20*20
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x3000+(640*400*3)
un:
xor ebx,ebx
mov bl,byte[esi]
lea ebx,[ebx+ebx*2]
add ebx,0x3000+(640*400*3)+(16*20*20*3)+10
mov edx,[ebx]
mov [edi],edx
add esi,1
add edi,3
sub ecx,1
jnz un
add [number_sprite],1
add eax,1
cmp [number_sprite],10;total number of pictures equal 10
jne nextfile
;--------------------------------------------------------
mov [total_time],0
mov [phas],0
mov [x],100
mov [y],100
animation:
call clock
mov eax,[time]
sub eax,[old_time]
cmp eax,5
jl next_action
mov eax,[time]
mov [old_time],eax
mov eax,[phas]
mov [black],eax
mov [phas],15
call PutSprite
call putimage
mov eax,5
mov ebx,2
int 0x40
mov eax,[black]
mov [phas],eax
call PutSprite
call putimage
call print_pos
add [frames],2
next_action:
call clock
mov eax,[time]
sub eax,[old_frame_time]
cmp eax,100
jl no_frames
mov eax,[time]
mov [old_frame_time],eax
mov eax,13
mov ebx,420*65536+30
mov ecx,425*65536+15
mov edx,0xffffff
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[frames]
mov edx,425*65536+427
mov esi,0
int 0x40
mov [frames],0
no_frames:
;----------------------
mov ebx,20
mov eax,[x]
cdq
idiv ebx
mov ecx,eax
mov eax,[y]
cdq
idiv ebx
imul eax,32
add eax,ecx
add eax,0x3000+(640*400*3)+(16*20*20*3)+512
xor ebx,ebx
mov bl,byte [phas]
mov [eax],bl;write number of shablon to the map-array
;-----------------------
;mov eax,11
;int 0x40
mov eax,23
mov ebx,2
int 0x40
cmp eax,2
jne animation
mov eax,2
int 0x40
shr eax,8
cmp eax,32
jne key2
add [phas],1
cmp [phas],10
jne animation
mov [phas],0
jmp animation
key2:cmp eax,176
jne key3
sub [x],20
jmp animation
key3:cmp eax,179
jne key4
add [x],20
jmp animation
key4:cmp eax,178
jne key5
sub [y],20
jmp animation
key5:cmp eax,177
jne key6
add [y],20
jmp animation
key6: cmp eax,51
jne key7
call save_level
jmp animation
key7:cmp eax,50
jne key8
call load_level
jmp animation
key8:cmp eax,27
jne animation
mov eax,-1
int 0x40
;-------------------------------------------
drawwin:
mov eax,12
mov ebx,1
int 0x40
;à¨á㥬 ®ª­® § ¤ ¢ ï ¢á¥ ­¥®¡å®¤¨¬ë¥ 梥â 
mov eax,0
mov ebx,50*65536+640
mov ecx,50*65536+450
mov edx,0x02AABBCC
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
;¯¨è¥¬ § £®«®¢®ª ®ª­ 
mov eax,4
mov ebx,5*65536+5
mov ecx,0x10ddeeff
mov edx,name
mov esi,7
int 0x40
;à¨á㥬 ª­®¯ªã § ªàëâ¨ï ®ª­ 
mov eax,8
mov ebx,(640-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x6688dd
int 0x40
ret
;----------------------------------------------------------
counter dd 0
;----------------------------------------------------
;draw sprite in video memory
PutSprite:
mov ebx,[x]
imul ebx,3
mov eax,[y]
imul eax,640*3
add eax,0x3000
add eax,ebx
cld
mov [counter],20
mov esi,[phas]
imul esi,1200
add esi,0x3000+(640*400*3)
mov ebx,esi
draw:
mov esi,ebx
mov edi,eax
mov ecx,20*3
rep movsb
add eax,640*3
add ebx,3*20
dec [counter]
jnz draw
ret
;-------------------------------------------------------------------------
;get time in 1/100 sec
clock: mov eax,26
mov ebx,9
int 0x40
mov [time],eax
ret
;---------------------------------------------------------
putimage:
mov eax,7
mov ebx,0x3000
mov ecx,640*65536+400
mov edx,1*65536+20
int 0x40
ret
;---------------------------------------------------------
print_pos:mov eax,13
mov ebx,490*65536+60
mov ecx,425*65536+15
mov edx,0xffffff
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[x]
mov edx,495*65536+430
mov esi,0
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[y]
mov edx,530*65536+430
mov esi,0
int 0x40
ret
;-----------------------------------------------------------
;-------------------------load files------------------------
;-----------------------------------------------------------
loadfile:
;ªã¤  § ¯¨á뢠âì ¯¥à¢ë© ¡«®ª
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
;§ £à㦠¥¬ ¯¥à¢ë© ¡«®ª ¤«ï ⮣® ç⮡ë 㧭 â à §¬¥à ä ©« 
mov eax,58
mov ebx,file_read
int 0x40
;¢ëç¨á«ï¥¬ ᪮«ìª® ¡«®ª®¢ ¯® 512 ¡ ©â ­ã¦­® ¨á¯®«ì§®¢ âì
;¤«ï § £à㧪¨ ä ©« 
mov ecx,ebx
shr ecx,9
add ecx,1
;§ ¯¨á뢠¥¬  ¤à¥á ªã¤  ­ã¦­® § ¯¨á âì ¯¥à¢ë© ¡«®ª
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
;§ ­®á¨¬ ¢ áâàãªâãàã file_read ­®¬¥à ¡«®ª  á ª®â®à®£® ­ã¦­® § £à㦠âì ä ©«
mov [file_read+4],dword 0
;§ ­®á¨¬ ¢ áâàãªâãàã file_read ç¨á«® ¡«®ª®¢ ª®â®àë¥ ­ã¦­® § £à㧨âì
mov [file_read+8],ecx
;§ £à㦠¥¬ ¡«®ª
mov eax,58
mov ebx,file_read
int 0x40
cmp eax,0
jne scock2
mov esi,0x3000+(640*400*3)+(16*20*20*3)
mov ecx,[esi+8]
add esi,60
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512
call unpakin
mov [addr_palitra],dword 0x3000+(640*400*3)+(16*20*20*3)+10
mov ecx,400
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x3000+(640*400*3)
unp:
xor eax,eax
mov al,byte[esi]
imul eax,3
add eax,[addr_palitra]
mov ebx,[eax]
and ebx,0xffffff
mov [edi],ebx
add esi,1
add edi,3
sub ecx,1
jnz unp
scock2:
ret
;---------------------------------------------------------------------------
;-----------------save level in file----------------------------------------
;---------------------------------------------------------------------------
save_level:
call input_path
xor ebx,ebx
copy_path:
xor eax,eax
mov al,byte [string+ebx]
cmp al,13
je end_copy
mov [file_write+20+ebx],eax
add ebx,1
jmp copy_path
end_copy:
mov esi,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
mov edi,0x3000+(640*400*3)+(16*20*20*3);0x1000
mov ecx,32*20
call save_image
mov eax,[SizeFile]
mov [file_write+8],eax
mov [file_write+12],dword 0x3000+(640*400*3)+(16*20*20*3);+(0x1000)
mov eax,58
mov ebx,file_write
int 0x40
cmp eax,0
jne scok
xor esi,esi
mov eax,55
mov ebx,eax
mov esi,sound
int 0x40
scok:
ret
;-----------------------------------------------------------------------------
;-----------------load level to memory----------------------------------------
;-----------------------------------------------------------------------------
load_level:
call input_path
xor ebx,ebx
copy_load:xor eax,eax
mov al,byte [string+ebx]
cmp al,13
je end_load
mov [file_read+20+ebx],eax
add ebx,1
jmp copy_load
end_load:
mov [file_read+12],dword 0x3000+(640*400*3)+(16*20*20*3)
mov eax,58
mov ebx,file_read
int 0x40
mov ecx,ebx
shr ebx,9
add ebx,1
mov [file_read+8],ebx
mov eax,58
mov ebx,file_read
int 0x40
cmp eax,0
jne nosound
mov esi,0x3000+(640*400*3)+(16*20*20*3)
mov edi,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
call unpakin
xor esi,esi
mov eax,55
mov ebx,55
mov esi,sound
int 0x40
xor esi,esi
mov [x_l],0
mov [y_l],0
c_y:
mov [x_l],0
c_x:
mov eax,[x_l]
mov ebx,[y_l]
imul ebx,32
add eax,ebx
add eax,0x3000+(640*400*3)+(16*20*20*3)+512;0x1000+0x1000
mov ecx,eax
xor eax,eax
mov al,byte [ecx]
imul eax,1200
add eax,0x3000+(640*400*3)
mov ebx,[x_l]
imul ebx,20*3
mov ecx,[y_l]
imul ecx,20*3*640
add ebx,ecx
add ebx,0x3000
mov esi,eax
mov edi,ebx
;----------------------------
xor edx,edx
next_line:
mov esi,eax
mov edi,ebx
mov ecx,60
rep movsb
add edx,1
add eax,20*3
add ebx,(640*3)
cmp edx,20
jne next_line
;----------------------------
add [x_l],1
cmp [x_l],32
jne c_x
add [y_l],1
cmp [y_l],20
jne c_y
nosound:
jmp animation
;-----------------------------------------------------------------------------
input_path:
mov [position],byte -1
call print_line
mov eax,13
mov ebx,25*65536+6
mov ecx,433*65536+12
mov edx,0xff6c58
int 0x40
opros:mov eax,10
int 0x40
cmp eax,2
jne opros
mov eax,2
int 0x40
shr eax,8
cmp eax,13
je exit_cycle
cmp eax,8
je backspace
cmp eax,176
je left
cmp eax,179
je right
cmp eax,32
je probel
add [position],1
xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte al
call print_line
call print_cursor
jmp opros
backspace:xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte ' '
sub [position],1
call print_line
call print_cursor
jmp opros
left:sub [position],1
call print_line
call print_cursor
jmp opros
right:add [position],1
call print_line
call print_cursor
jmp opros
probel:add [position],1
call print_line
call print_cursor
jmp opros
exit_cycle:add [position],1
xor ebx,ebx
mov bl,[position]
mov [string+ebx],byte 13
mov eax,13
mov ebx,20*65536+(64*6)+5
mov ecx,430*65536+15
mov edx,0xffffff
int 0x40
ret
;---------------------------------------------------------------
print_line:
mov eax,13
mov ebx,20*65536+(64*6)+5
mov ecx,430*65536+15
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,25*65536+435
mov ecx,0x1
mov edx,string
mov esi,64
int 0x40
ret
print_cursor:
mov eax,13
xor ebx,ebx
mov bl,[position]
imul ebx,6
add ebx,25+6
shl ebx,16
add ebx,6
mov ecx,433*65536+12
mov edx,0xff6c58
int 0x40
ret
;------------------------------------------------------------------------
string:
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
position db 0
total_time dd 0
time dd 0
old_time dd 0
frame dd 0
addr_palitra dd 0
;addr_array dd 0
number_sprite dd 0
offs dd 0
phas dd 0
black dd 0
x dd 0
y dd 0
x_l dd 0
y_l dd 0
name db 'testfps'
frames dd 0
old_frame_time dd 0
sound db 0x90,0x30,0
file_read:
dd 0
dd 0
dd 1
dd 0
dd 0x3000
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
file_write:
dd 1
dd 0
dd 0
dd 0
dd 0x3000
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
water:
db 247,0,0,0,0,0,255,0
 
db 0,128,0,255,128,0,128,255
 
db 0,255,0,0,255,255,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,7,0,2,1,19,2
 
db 1,2,1,2,17,2,1,18
 
db 35,49,19,2,49,2,17,2
 
db 17,3,6,5,19,2,19,17
 
db 18,35,18,1,2,51,5,1
 
db 2,5,3,6,18,1,19,5
 
db 3,17,2,19,6,5,19,6
 
db 1,3,33,19,6,3,5,3
 
db 2,17,51,2,1,19,18,3
 
db 6,67,18,1,2,3,5,35
 
db 1,2,17,19,5,6,5,6
 
db 3,1,18,51,2,3,18,3
 
db 6,3,5,6,19,5,19,1
 
db 19,33,18,1,18,3,6,3
 
db 6,67,1,2,1,2,65,2
 
db 1,19,5,3,21,3,17,34
 
db 1,66,1,18,67,2,17,2
 
db 33,2,1,18,1,2,1,34
 
db 1,2,1,18,1,18,17,2
 
db 33,34,17,50,17,2,17,66
 
db 1,2,1,19,5,3,2,17
 
db 2,17,50,17,34,19,6,3
 
db 6,19,1,2,65,19,6,3
 
db 17,3,5,19,5,35,18,17
 
db 3,6,3,5,19,18,3,6
 
db 5,19,5,19,18,17,3,21
 
db 3,21,2,1,35,21,19,17
 
db 2,1,2,3,6,3,6,5
 
db 3,1,18,1,35,2,17,50
 
db 1,3,5,6,35,1,2,1
 
db 2,1,2,17,2,17,2,17
 
db 2,51,16
voda1:
db 137,0,0,0,0,255,255,0
 
db 255,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,2,17,18,17
 
db 18,65,18,17,2,33,2,97
 
db 2,1,2,33,18,17,18,49
 
db 18,65,2,65,18,17,2,17
 
db 2,33,18,33,2,113,18,17
 
db 18,17,2,49,18,17,18,145
 
db 34,33,18,49,18,17,18,145
 
db 2,65,2,65,18,17,18,17
 
db 2,17,34,49,18,97,2,113
 
db 2,49,18,1,2,49,2,1
 
db 18,17,2,1,34,65,2,97
 
db 2,113,2,65,18,17,2,49
 
db 18,1,2,33,18,1,2,81
 
db 18,193,18,81,18,17,18,129
 
db 18,145,18,1,2,81,34,17
 
db 18,65,34,1,18,145,2,129
 
db 18,49,18,33,2,33,34,81
 
db 18,97,2,1,16
trava:
db 214,0,0,0,0,0,255,0
 
db 0,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,2,49,2,17
 
db 2,33,2,1,2,33,2,17
 
db 34,17,18,1,2,1,18,33
 
db 2,17,34,17,18,33,18,17
 
db 50,97,2,33,2,33,18,1
 
db 18,17,50,1,2,1,50,1
 
db 18,65,2,33,18,1,18,17
 
db 18,17,82,33,2,1,2,1
 
db 2,33,2,49,18,1,18,1
 
db 2,1,2,33,2,17,2,1
 
db 2,65,2,1,18,1,2,17
 
db 2,17,34,1,66,1,18,17
 
db 2,17,2,17,2,33,2,1
 
db 18,1,2,1,34,1,2,1
 
db 18,1,18,17,2,33,34,17
 
db 50,17,2,17,66,1,2,17
 
db 2,17,2,17,2,17,50,17
 
db 50,1,34,33,2,81,2,49
 
db 2,33,34,1,18,33,18,1
 
db 66,33,2,1,50,17,2,1
 
db 2,1,2,1,2,49,34,33
 
db 2,1,18,1,18,33,18,1
 
db 2,17,2,17,50,17,2,1
 
db 2,1,2,1,2,1,2,1
 
db 2,17,2,17,2,17,18,17
 
db 2,16
sten3:
db 104,0,0,0,0,128,128,128
 
db 192,192,192,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,3,0,226,66,65,2
 
db 81,2,65,2,81,2,81,2
 
db 65,2,81,2,81,2,65,2
 
db 1,226,66,33,2,81,2,81
 
db 2,65,2,81,2,81,2,65
 
db 2,81,2,81,2,17,226,66
 
db 1,2,81,2,81,2,65,2
 
db 81,2,81,2,65,2,81,2
 
db 81,2,49,226,66,65,2,97
 
db 2,65,2,65,2,97,2,65
 
db 2,65,2,97,2,65,226,82
 
db 33,2,81,2,81,2,65,2
 
db 81,2,81,2,65,2,81,2
 
db 81,2,17,16
sten1:
db 111,0,0,0,0,128,128,128
 
db 192,192,192,0,0,255,255,255
 
db 255,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,227,67,53,3
 
db 133,3,69,34,5,3,5,98
 
db 5,3,5,98,5,3,5,98
 
db 5,3,5,50,53,3,133,3
 
db 69,227,67,133,3,133,3,114
 
db 5,3,5,98,5,3,114,5
 
db 3,5,98,5,3,133,3,133
 
db 227,83,69,3,133,3,53,50
 
db 5,3,5,98,5,3,5,98
 
db 5,3,5,98,5,3,5,34
 
db 69,3,133,3,53,227,67,101
 
db 3,133,3,21,82,5,3,5
 
db 98,5,3,5,98,5,3,5
 
db 98,5,3,5,2,101,3,133
 
db 3,21,16
pesok:
db 120,0,0,0,0,0,255,255
 
db 0,64,128,0,128,128,64,128
 
db 128,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,225,81,2,33
 
db 2,65,2,3,33,2,1,5
 
db 49,5,49,2,129,3,225,97
 
db 3,17,2,33,2,1,5,33
 
db 2,1,5,129,5,65,2,65
 
db 2,225,97,2,33,3,17,2
 
db 49,3,145,2,177,3,49,5
 
db 81,5,1,2,33,2,65,3
 
db 17,2,17,3,145,2,209,3
 
db 81,2,49,5,33,2,177,3
 
db 145,2,17,2,5,113,2,225
 
db 1,2,33,3,17,3,49,3
 
db 17,3,161,2,1,5,97,2
 
db 177,2,49,2,33,5,33,2
 
db 193,2,49,3,33,2,81,3
 
db 1,5,1,16
palma:
db 209,0,0,0,0,0,255,0
 
db 0,128,0,0,255,255,64,128
 
db 128,64,128,255,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,6,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,51,1,2,17
 
db 2,1,35,1,2,33,115,2
 
db 51,21,19,1,2,35,69,35
 
db 53,35,18,3,21,67,5,3
 
db 21,19,1,18,19,2,5,3
 
db 50,1,3,5,3,5,67,17
 
db 3,1,19,17,67,5,99,34
 
db 3,2,35,5,3,5,3,5
 
db 3,5,3,5,35,1,18,1
 
db 2,19,5,35,5,3,5,35
 
db 21,19,33,19,5,35,5,35
 
db 5,51,5,3,34,35,17,51
 
db 20,3,5,35,5,3,2,1
 
db 35,18,3,5,3,36,5,19
 
db 1,35,1,18,3,17,2,3
 
db 2,52,35,50,1,2,17,2
 
db 17,2,1,52,3,34,17,50
 
db 1,34,33,36,49,2,49,2
 
db 33,34,1,36,17,18,1,66
 
db 33,2,1,2,1,36,1,2
 
db 1,2,1,2,1,2,49,66
 
db 36,18,1,18,33,18,1,2
 
db 17,84,2,17,2,1,2,1
 
db 2,1,2,1,2,1,84,2
 
db 17,18,17,2,16
kamni:
db 210,0,0,0,0,0,255,0
 
db 0,128,0,64,128,255,64,128
 
db 128,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,5,0,2,33,2,1
 
db 2,35,1,2,1,34,17,18
 
db 1,18,1,2,17,51,1,2
 
db 33,2,1,2,33,2,1,67
 
db 4,3,2,1,2,1,18,33
 
db 2,17,2,83,4,17,18,17
 
db 50,17,131,2,33,18,1,18
 
db 17,83,20,3,18,1,18,65
 
db 2,67,4,19,4,3,18,17
 
db 82,99,4,35,2,49,18,1
 
db 18,1,2,1,2,17,35,4
 
db 2,1,2,65,2,1,18,1
 
db 2,17,2,17,34,1,66,1
 
db 18,17,2,17,2,17,2,33
 
db 2,1,18,1,2,1,2,19
 
db 1,2,1,18,1,18,19,2
 
db 33,18,35,4,3,18,17,2
 
db 1,67,2,1,2,99,1,2
 
db 17,2,35,4,3,34,35,4
 
db 3,4,3,1,2,17,83,1
 
db 67,20,19,4,3,2,17,51
 
db 4,115,4,35,2,1,83,4
 
db 67,34,33,2,35,1,3,4
 
db 19,1,18,1,2,17,2,17
 
db 50,17,2,1,2,1,2,1
 
db 2,1,2,1,2,17,2,17
 
db 2,17,18,17,2,16
drevo:
db 240,0,0,0,0,0,255,0
 
db 0,128,0,255,0,128,0,64
 
db 128,64,128,128,128,0,128,255
 
db 128,128,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,8,0,2,33,2,1
 
db 2,19,1,35,34,17,18,1
 
db 18,1,2,17,3,38,7,22
 
db 3,1,2,1,2,33,2,1
 
db 19,7,6,23,6,23,3,6
 
db 18,33,2,17,2,3,7,19
 
db 6,3,54,7,19,50,33,3
 
db 22,7,6,3,6,7,22,3
 
db 23,2,1,18,17,22,7,6
 
db 7,3,7,3,7,22,7,6
 
db 35,17,35,54,55,6,23,22
 
db 19,18,19,7,3,7,6,7
 
db 22,7,3,22,3,22,7,3
 
db 18,19,23,3,182,3,33,3
 
db 22,3,7,6,7,6,7,22
 
db 7,6,7,22,3,34,7,22
 
db 7,22,3,39,38,7,6,7
 
db 19,2,1,3,7,6,23,38
 
db 7,38,39,6,7,3,1,2
 
db 19,54,3,38,3,70,3,2
 
db 1,2,1,3,7,6,7,19
 
db 4,5,4,19,6,7,6,3
 
db 1,50,1,34,3,1,36,17
 
db 3,22,2,49,2,33,34,21
 
db 4,33,18,1,66,33,2,1
 
db 52,17,2,1,2,1,2,1
 
db 2,49,18,20,5,4,5,4
 
db 18,1,18,33,18,1,2,1
 
db 132,1,2,1,2,1,2,1
 
db 2,1,36,5,20,5,4,21
 
db 36,17,2,16
baza1:
db 192,0,0,0,0,0,255,0
 
db 0,128,0,255,0,128,255,128
 
db 128,255,0,0,255,128,0,255
 
db 255,0,128,0,255,0,0,255
 
db 0,255,255,0,0,0,0,0
 
db 0,0,0,0,0,0,0,0
 
db 0,0,11,0,2,33,2,1
 
db 2,1,2,17,2,1,34,17
 
db 18,1,18,1,2,49,2,17
 
db 2,33,2,1,2,17,232,9
 
db 4,17,2,8,201,8,3,9
 
db 4,2,1,8,41,150,8,19
 
db 9,2,1,57,6,101,7,6
 
db 8,3,10,3,9,2,8,41
 
db 6,5,84,7,6,8,35,9
 
db 2,8,41,6,5,84,7,6
 
db 8,35,9,2,8,41,6,5
 
db 84,7,6,8,3,21,9,1
 
db 8,41,6,5,84,7,6,8
 
db 3,21,9,2,8,41,6,5
 
db 84,7,6,8,35,9,2,8
 
db 41,6,5,103,6,8,3,10
 
db 3,9,1,8,57,134,8,35
 
db 9,1,8,201,8,3,10,3
 
db 9,2,232,35,9,2,9,131
 
db 10,19,10,3,9,4,3,9
 
db 1,2,25,19,22,131,9,4
 
db 9,33,9,35,22,131,25,1
 
db 18,1,233,9,2,1,2,1
 
db 2,1,2,17,2,17,2,17
 
db 18,17,2,16
spisok:
dd sten1
dd sten3
dd trava
dd kamni
dd palma
dd water
dd voda1
dd baza1
dd drevo
dd pesok
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tanks/trunk/pixengin.inc
0,0 → 1,100
Color db 0
Counter db 0
LastColor db 0
SizeFile dd 0
;LitlCounter db 0
;LitlColor db 0
save_image:
;mov esi,addres_of_file_which_need_compress
;mov edi,addres_where_need_to_save_compressed_file
;mov ecx,size_of_file_which_need_compress
mov dl,byte [esi]
and dl,0xff
mov [LastColor],dl
mov [Counter],byte 1
mov [SizeFile],0
xor edx,edx
inc esi
NextColor:;ç¨â ¥¬ ­®¢ë© 梥⠨§ â ¡«¨æë
mov dl,byte [esi]
and dl,0xf
mov [Color],dl
cmp dl,[LastColor]
jne Different
;㢥«¨ç¨¢ ¥¬ áç¥â稪 ­  1 ¨ ᬮâਬ ¥£® §­ ç¥­¨¥
inc [Counter]
cmp [Counter],16
jl total
;áç¥â稪 à ¢¥­ 16,§­ ç¨â ­ã¦­® á®åà ­¨âì ¯®á«¥¤®¢ â¥«ì­®áâì
dec [Counter]
jmp Different
;’¥¯¥àì ⥪ã騩 梥â áâ « áâ àë¬,¯®í⮬ã á®åà ­¨¬ ¥£® ª ª áâ àë©.
;Ž¡­ã«¨¬ (ᤥ« ¥¬ à ¢­ë¬ 1) áç¥â稪 ¯®¢â®à¥­¨© 梥â (counter)
xor eax,eax
and [Counter],0
mov al,[Color]
mov [LastColor],al
xor eax,eax
jmp total
Different:;¯à®ç¨â ­­ë© 梥⠭¥ ᮢ¯ ¤ ¥â á® áâ àë¬
;§­ ç¨â ­ã¦­® á®åà ­¨âì áâ àë© ¨ ãáâ ­®¢¨âì §­ ç¥­¨ï ¤«ï ­®¢®£®
;
;á®å࠭塞 áâ àë© æ¢¥â
dec [Counter]
call SaveinByte
;add [SizeFile],1
inc edi
;ãáâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨ï ⥪ã饣® æ¢¥â  ª ª áâ à®£®
mov dl,[Color]
mov [LastColor],dl
mov [Counter],1
total:
xor edx,edx
mov dl,[Color]
mov [LastColor],dl
inc esi
dec ecx
cmp ecx,0
jne NextColor
;áç¥â稪 ¬®¦¥â ¡ëâì ­¥¯ãá⮩,¯®í⮬ã çâ®¡ë ­¥ â¥àïâì ¡ ©â®¢
;á®åà ­¨¬ §­ ç¥­¨¥ áç¥â稪  ¨ ¯®¢â®à塞®¥ §­ ç¥­¨¥
call SaveinByte
ret
SaveinByte:xor eax,eax
xor ebx,ebx
mov al,[Counter]
shl al,4
mov bl,[LastColor]
or al,bl
mov [edi],al
inc [SizeFile]
ret
;-----------------------------------------------------------------------
LitlCounter db 0
LitlColor db 0
unpakin:
xor edx,edx
NextLitlColor:xor edx,edx
mov dl,byte[esi]
xor eax,eax
xor ebx,ebx
mov al,dl
mov bl,al
shr al,4
and al,0xf
mov [LitlCounter],al
and bl,0xf
mov [LitlColor],bl
xor eax,eax
xor ebx,ebx
;-------------------------------
mov al,[LitlColor]
beg:mov [edi],al
add edi,1
dec [LitlCounter]
cmp [LitlCounter],-1
jne beg
inc esi
dec ecx
jnz NextLitlColor
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tanks/trunk/tanks.asm
0,0 → 1,2418
;************************************************************
;*GAME TANKS CRETED BY ANDREW_PROGRAMMER AKA ANDREY IGNATYEV*
;*********************/8/2005********************************
use32
org 0x0
include 'lang.inc'
db 'MENUET01'
dd 0x1
dd START
dd I_END
dd 0x4000+640*400*3+50*20*20*3+512+640+1+24*20*20*3+1
dd 0x4000
dd 0x0
dd 0x0
START:
mov eax,40
mov ebx,111b
int 0x40
;----------------------------------------------------------
;---------load all sprites from arrays to memory-----------
;----------------------------------------------------------
and [number_sprite],0
xor eax,eax
nextfile:
mov ebx,[spisok+4*eax]
mov ecx,50
mov esi,ebx
add esi,2
mov edi,0x4000+(640*400*3)+(50*20*20*3)+10
rep movsb ;copy palitra to memory
mov esi,ebx
add esi,52
xor ecx,ecx
mov cl,byte [ebx]
mov edi,0x4000+(640*400*3)+(50*20*20*3)+512
push eax
call unpakin
pop eax
mov ecx,20*20
mov esi,0x4000+(640*400*3)+(50*20*20*3)+512
mov edi,[number_sprite]
imul edi,3*20*20
add edi,0x4000+(640*400*3)
unp:
xor ebx,ebx
mov bl,byte[esi]
lea ebx,[ebx+ebx*2]
add ebx,0x4000+(640*400*3)+(50*20*20*3)+10
mov edx,[ebx]
mov [edi],edx
add esi,1
add edi,3
dec ecx
jnz unp
inc [number_sprite]
inc eax
cmp [number_sprite],26;total number of pictures equal 26
jne nextfile
;----------------------------------------------------------
;------rotate sprites of tanks to pi/2---------------------
;----------------------------------------------------------
mov [sp_pos],0x4000+(640*400*3)+18*20*20*3
and [num_blocks],0
next_block_rotate:
mov [number_sprite],0
next_sprite_rotate:
mov [x],19
and [y],0
rotate_90:
mov ebx,[number_sprite]
mov esi,[y]
imul esi,60
imul ebx,1200
add esi,ebx ;esi=number_sprite*1200+y*60
add esi,dword [sp_pos]
mov edi,0x4000+(640*400*3)+(50*20*20*3)
mov ecx,15
rep movsd
mov edi,[number_sprite]
imul edi,1200
add edi,dword [sp_pos]
add edi,8*20*20*3
mov ebx,[x]
lea ebx,[ebx+2*ebx]
add edi,ebx
mov esi,0x4000+(640*400*3)+(50*20*20*3)
mov ecx,20*3
vertical:
xor eax,eax
mov al,byte[esi+2]
mov [edi+2],al
xor eax,eax
mov ax,word[esi]
mov [edi],ax
add edi,60
add esi,3
sub ecx,3
jnz vertical
dec [x]
inc [y]
cmp [x],-1
jne rotate_90
inc [number_sprite]
cmp [number_sprite],9
jne next_sprite_rotate
add [sp_pos],8*20*20*3
inc [num_blocks]
cmp [num_blocks],3
jne next_block_rotate
;---------------------------------------------------------
restart_level:
call drawwin
;Start game(demo scen)
mov [y],18
@1:
mov [x],30
@2:
mov esi,[x]
mov edi,[y]
imul esi,20*3
imul edi,20*(640*3)
add edi,esi
add edi,0x4000
mov esi,0x4000+(640*400*3)+1200
mov [counter],20
mov eax,esi
mov ebx,edi
@3:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,640*3
dec [counter]
jnz @3
dec [x]
jnz @2
dec [y]
jnz @1
;draw script ******TANKS*******
mov eax,54
@11:
mov esi,5
mov edi,80
xor ebx,ebx
xor edx,edx
mov bl,byte[TANKS_script+2*eax] ;dx
mov dl,byte[TANKS_script+2*eax+1] ;dy
imul ebx,20
imul edx,20
add esi,ebx
add edi,edx
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add edi,esi
add edi,0x4000
mov esi,0x4000+(640*400*3)
mov ebx,esi
mov edx,edi
mov [counter],20
@22:
mov esi,ebx
mov edi,edx
mov ecx,15
rep movsd
add ebx,20*3
add edx,640*3
dec [counter]
jnz @22
dec eax
cmp eax,-1
jne @11
mov eax,7
mov ebx,0x4000
mov ecx,640*65536+400
mov edx,0*65536+20
int 0x40
call menu
;----------------------------
new_level:
call drawwin
mov [SpriteInfo+72+8],dword 100 ;Xo
mov [SpriteInfo+72+36],dword 100 ;Yo
mov edx,[number_level]
call load_level
;--------------------------
and [strike_action],0
and [bazas],0
and [y],0
mov eax,8
next_y:
and [x],0
next_x:
mov esi,[y]
shl esi,5
add esi,[x]
add esi,0x4000+(640*400*3)+(50*20*20*3)+512
xor ebx,ebx
mov bl,byte[esi]
cmp bl,7
jne no_baza
mov ecx,[x]
mov edx,[y]
inc ecx
inc [bazas]
add eax,4
imul ecx,20
imul edx,20
mov [SpriteInfo+9*eax+0],dword 3
mov [SpriteInfo+9*eax+4],dword 1
mov [SpriteInfo+9*eax+8],dword ecx
mov [SpriteInfo+9*eax+12],dword edx
mov [SpriteInfo+9*eax+16],dword 5
mov [SpriteInfo+9*eax+28],dword -5
mov edx,eax
shr edx,2
mov [LifesTanks+edx],byte 3;three lifes
mov [PulyTanks+edx],byte 1 ;can draw animation of "puly"
no_baza:
inc [x]
cmp [x],32
jne next_x
inc [y]
cmp [y],20
jne next_y
mov [LifesPlayer],3*4
and [score],0
;----------------------------------------------------------
;--------------------main loop-----------------------------
;----------------------------------------------------------
maincycle:
;save fon
mov eax,23*4
SaveFonForSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx ;if ebx<>0 then can save
jz NoSaveFon
mov esi,[SpriteInfo+9*eax+8] ; cordinat x
mov edi,[SpriteInfo+9*eax+12] ; cordinat y
mov edx,eax
shr edx,2
call SaveFon
NoSaveFon:
sub eax,4
cmp eax,-4
jne SaveFonForSprites
;put sprites
mov eax,23*4
PutSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jz NoPutSprite
and ebx,10000b
test ebx,ebx ; move to transparent shablon ?
jnz NoPutSprite
mov esi,[SpriteInfo+9*eax+8] ; x
mov edi,[SpriteInfo+9*eax+12] ; y
mov edx,[SpriteInfo+9*eax+0] ;number sprite in sprites table
shl edx,2
add edx,[SpriteInfo+9*eax+24] ;edx=4*NumSprites+phas
call PutSprite
NoPutSprite:
sub eax,4
cmp eax,-4
jne PutSprites
;put image
call clock
mov ebx,[time]
sub ebx,[time_frame_old]
cmp ebx,5
jl NoPutScreen
mov ebx,[time]
mov [time_frame_old],ebx
mov eax,7
mov ebx,0x4000
mov ecx,640*65536+400
mov edx,0*65536+20
int 0x40
NoPutScreen:
;put fon
mov eax,23*4
PutFonForSprites:
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jz NoPutFon
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov edx,eax
shr edx,2
call PutFon
NoPutFon:
sub eax,4
cmp eax,-4
jne PutFonForSprites
;change phas(if need)
mov eax,23*4
ChangePhasSprites:
push eax
call clock
pop eax
mov ebx,[SpriteInfo+9*eax+16] ;time of animation
mov ecx,[SpriteInfo+9*eax+20] ;time of last frame
mov edx,[time]
sub edx,ecx
cmp edx,ebx
jl no_change_phas
mov ebx,[time]
mov [SpriteInfo+9*eax+20],ebx ;save new time
;------------------------------
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
add esi,ecx ;x=x+dx
add edi,edx ;y=y+dy
mov [SpriteInfo+9*eax+8],dword esi
mov [SpriteInfo+9*eax+12],dword edi
;-------------------------------
mov edx,[SpriteInfo+9*eax+24] ;phas
add edx,1
cmp edx,4
jne no_limit_phas
xor edx,edx
mov [SpriteInfo+9*eax+24],dword edx
mov [SpriteInfo+9*eax+4],dword edx
jmp no_change_phas
no_limit_phas:
mov [SpriteInfo+9*eax+24],dword edx
no_change_phas:
sub eax,4
cmp eax,-4
jne ChangePhasSprites
;-------------------------------------------------
;----------------keys-----------------------------
;-------------------------------------------------
mov eax,23
mov ebx,3
int 0x40
cmp eax,1
jne keypressed
call drawwin
jmp action
keypressed:
cmp eax,2
jne action
and [_dx],0
and [_dy],0
mov eax,2
int 0x40
shr eax,8
;---------
cmp eax,32
jne key2
cmp [strike_action],0
jne action
mov [SpriteInfo+36+4],dword 1 ;can draw sprite "puly"
mov [strike_action],1 ;sprite is active
mov eax,[SpriteInfo+72+8]
mov ebx,[SpriteInfo+72+12]
mov ecx,[SpriteInfo+72+28]
mov edx,[SpriteInfo+72+32]
add eax,ecx
add ebx,edx
mov [SpriteInfo+36+8],dword eax
mov [SpriteInfo+36+12],dword ebx
jmp action
key2:cmp eax,176
jne key3
mov [SpriteInfo+8*9+0],dword 8
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword -5
mov [SpriteInfo+8*9+32],dword 0
mov [_dx],0
mov [_dy],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword -5
mov [SpriteInfo+36+32],dword 0
jmp action
key3:cmp eax,179
jne key4
mov [SpriteInfo+8*9+0],dword 4
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 5
mov [SpriteInfo+8*9+32],dword 0
mov [_dx],15
mov [_dy],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 5
mov [SpriteInfo+36+32],dword 0
jmp action
key4:cmp eax,178
jne key5
mov [SpriteInfo+8*9+0],dword 2
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword -5
mov [_dx],10
mov [_dy],1
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 0
mov [SpriteInfo+36+32],dword -5
jmp action
key5:cmp eax,177
jne key6
mov [SpriteInfo+8*9+0],dword 6
mov [SpriteInfo+8*9+4],dword 1
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword 5
mov [_dy],15
mov [_dx],10
cmp [strike_action],0
jne action
mov [SpriteInfo+36+28],dword 0
mov [SpriteInfo+36+32],dword 5
jmp action
key6:cmp eax,27
jne action
mov eax,-1
int 0x40
action:
mov [SpriteInfo+72+4],dword 1
mov [SpriteInfo+72+16],dword 5 ;usal speed of tank
mov esi,[SpriteInfo+8*9+8] ;cordinat x of sprite
mov edi,[SpriteInfo+8*9+12] ;cordinat y of sprite
mov ecx,[SpriteInfo+72+28]
mov edx,[SpriteInfo+72+32]
add ecx,[_dx]
add edx,[_dy]
add esi,ecx ;x=x+_dx+dx
add edi,edx ;y=y+_dy+dy
call map_x_y
cmp ecx,6
jne no_woter
mov [SpriteInfo+72+16],dword 7 ;in water tank slow move
no_woter:
cmp ecx,4
jne no_palma
mov [SpriteInfo+72+4],dword 10000b;if bit 4 than transparent sprite
no_palma:
cmp ecx,8
jne no_derevo
mov [SpriteInfo+72+4],dword 10000b
no_derevo:
test edx,edx
jnz ani
mov [SpriteInfo+8*9+28],dword 0
mov [SpriteInfo+8*9+32],dword 0
;-------------------------------------------------
ani:
mov eax,[strike_action]
test eax,eax
jz no_anim_strike
mov esi,[SpriteInfo+36+8]
mov edi,[SpriteInfo+36+12]
mov ecx,[SpriteInfo+36+28]
mov edx,[SpriteInfo+36+32]
add esi,ecx
add edi,edx
call map_x_y
cmp cl,0
jne no_stena
mov [ebx],byte 2 ;trava
jmp bum
no_stena:
cmp cl,1
jne no_brony
jmp bum
no_brony:
cmp cl,7
jne anim_action_puly
sub [bazas],1
mov [ebx],byte 2 ;trava
bum:
mov esi,[SpriteInfo+36+8]
mov edi,[SpriteInfo+36+12]
mov [SpriteInfo+4],dword 1
mov [SpriteInfo+8],dword esi
mov [SpriteInfo+12],dword edi
mov [SpriteInfo+36+4],dword 0
mov [end_bum],1
jmp no_anim_strike
anim_action_puly:
mov [SpriteInfo+36+4],dword 1
no_anim_strike:
;-------------------------------------------------
;¯à®¢¥à塞 ¯®¯ «  «¨ ¯ã«ï ¢ ¯à®â¨¢­¨ª®¢
mov esi,[SpriteInfo+4*9+8]
mov edi,[SpriteInfo+4*9+12]
mov [x],esi ;ª®®à¤¨­ â  x ¯ã«¨
mov [y],edi ;ª®®à¤¨­ â  y ¯ã«¨
mov eax,3*4
bum_tank:
mov ebx,eax
shr ebx,2
xor ecx,ecx
mov cl,byte [LifesTanks+ebx]
cmp ecx,0
jz no_strike
mov esi,[SpriteInfo+9*eax+8] ;x
mov edi,[SpriteInfo+9*eax+12] ;y
sub esi,[x]
sub edi,[y]
cmp esi,5
ja no_strike
cmp edi,5
ja no_strike
add [score],5
cmp [score],20
jl no_bonus
add [LifesPlayer],4
and [score],0
no_bonus:
dec ecx;,1
mov [LifesTanks+ebx],cl ;life=life-1
mov esi,[x]
mov edi,[y]
mov [SpriteInfo+4],dword 1
mov [SpriteInfo+8],dword esi
mov [SpriteInfo+12],dword edi
mov [SpriteInfo+36+4],dword 0
mov [end_bum],1
no_strike:
add eax,4
cmp eax,10*4
jne bum_tank
;-------------------------------------------------
xor eax,eax
mov al,[end_bum]
test eax,eax
jz no_end_strike
mov eax,[SpriteInfo+24]
cmp eax,3
jne no_end_strike
and [strike_action],0
and [end_bum],0
mov edx,[number_level]
mov ecx,15
call load_level
no_end_strike:
;----------------------------
;¯à®¢¥à塞,¯®¯ «¨ «¨ ¯à®â¨¢­¨ª¨ ¢ ¨£à®ª 
mov eax,3*4
mov esi,[SpriteInfo+72+8]
mov edi,[SpriteInfo+72+12]
mov [x],esi
mov [y],edi
strike_to_player:
mov ebx,eax
add ebx,28
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
sub esi,[x]
sub edi,[y]
cmp esi,5
ja no_strike_to_player
cmp edi,5
ja no_strike_to_player
mov esi,[x]
mov edi,[y]
mov [SpriteInfo+9*ebx+4],dword 0
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
sub [LifesPlayer],1
cmp [LifesPlayer],0
jne no_game_over
call end_game
jmp restart_level
no_game_over:
no_strike_to_player:
add eax,4
cmp eax,10*4
jne strike_to_player
;----------------------------
xor eax,eax
mov al,[bazas]
test eax,eax
jnz no_end_level
call you_won
inc [number_level]
cmp [number_level],25
jne no_end_game
mov eax,-1
int 0x40
no_end_game:
jmp new_level
no_end_level:
;-------------------------------------------------
;------------ logic of tanks----------------------
;-------------------------------------------------
mov eax,12
next_bad_tank:
mov ebx,eax
shr ebx,2
xor ecx,ecx
mov cl,byte[LifesTanks+ebx]
test ecx,ecx
jz no_action_bad_tank
mov ebx,[SpriteInfo+9*eax+4]
test ebx,ebx
jnz no_action_bad_tank
;---------------------
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov [x],esi
mov [y],edi
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
;ᬮâਬ çâ® ¢¯¥à¥¤¨ â ­ª -¯à®â¨¢­¨ª 
cmp ecx,0
ja more_null_x
lea ecx,[ecx+2*ecx]
jmp test_y
more_null_x:
shl ecx,2
add ecx,15
test_y:
cmp edx,0
ja more_null_y
lea edx,[edx+2*edx]
jmp add_numbers
more_null_y:
shl edx,2
add edx,15
add_numbers:
;--------------------
add esi,ecx
add edi,edx
call map_x_y
cmp ecx,4
jne no_palma_p
mov [SpriteInfo+9*eax+4],dword 10000b
no_palma_p:
cmp ecx,8
jne no_derevo_p
mov [SpriteInfo+9*eax+4],dword 10000b
no_derevo_p:
;¥á«¨ ­  ¯ã⨠⠭ª  ¯à¥¯ïâá⢨¥,â® ­ ¤® ¨§¬¥­¨âì
;­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï
test edx,edx
jnz lab1
;¯à®¢¥à塞 - ­¥ ¯®¯ « «¨ â ­ª ¢ â㯨ª(3 ­ ¯à¢«¥­¨ï § ­ïâë)
and [tupik],0
mov esi,[x]
mov edi,[y]
add esi,(20+15)
add edi,10
call map_x_y
test edx,edx
jnz direct1
inc [tupik]
direct1:
mov esi,[x]
mov edi,[y]
add esi,10
add edi,(20+15)
call map_x_y
test edx,edx
jnz direct2
inc [tupik]
direct2:
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz direct3
inc [tupik]
direct3:
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
test edx,edx
jnz direct4
inc [tupik]
direct4:
cmp [tupik],3
je no_move0
;------------------
;strategy1
mov esi,[x]
mov edi,[y]
add esi,(20+15)
add edi,10
call map_x_y
test edx,edx
jnz no_strategy1
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
jnz no_strategy1
jmp no_move3 ;going to left
no_strategy1:
;------------------
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz no_strategy2
mov esi,[x]
mov edi,[y]
add esi,10
add edi,-15
call map_x_y
test edx,edx
jnz no_strategy2
jmp no_move2
no_strategy2:
;------------------
mov esi,[x]
mov edi,[y]
add edi,(20+15)
add esi,10
call map_x_y
test edx,edx
jnz no_strategy3
mov esi,[x]
mov edi,[y]
add esi,-15
add edi,10
call map_x_y
test edx,edx
jnz no_strategy3
jmp no_move1
no_strategy3:
;-------------------------------------------------
no_move0:
mov esi,[x] ; x
mov edi,[y] ; y
add edi,-15 ; (y-20) up
add esi,10
call map_x_y
test edx,edx
jz no_move1
;¢¢¥àåã ᢮¡®¤­® - ¬®¦­® ¤¢¨£ âìáï up
mov [SpriteInfo+9*eax+0],dword 3
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword -5
jmp lab1
no_move1:
mov esi,[x]
mov edi,[y]
add esi,(20+15) ;x+20
add edi,10
call map_x_y
test edx,edx
jz no_move2
; right
mov [SpriteInfo+9*eax+0],dword 5
mov [SpriteInfo+9*eax+28],dword 5
mov [SpriteInfo+9*eax+32],dword 0
jmp lab1
no_move2:
mov esi,[x]
mov edi,[y]
add esi,10 ;x-20
add edi,(20+15)
call map_x_y
test edx,edx
jz no_move3
; down
mov [SpriteInfo+9*eax+0],dword 7
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword 5
jmp lab1
no_move3:
mov esi,[x]
mov edi,[y]
add edi,10 ;y+20
add esi,-15
call map_x_y
test edx,edx
jz no_move4
;¢­¨§ã ᢮¡®¤­®-¬®¦­® ¤¢¨£ âìáï left
mov [SpriteInfo+9*eax+0],dword 9
mov [SpriteInfo+9*eax+28],dword -5
mov [SpriteInfo+9*eax+32],dword 0
jmp lab1
no_move4:
mov [SpriteInfo+9*eax+28],dword 0
mov [SpriteInfo+9*eax+32],dword 0
lab1:
mov edx,dword[SpriteInfo+9*eax+4]
test edx,edx
jnz no_action_bad_tank
mov [SpriteInfo+9*eax+4],dword 1
no_action_bad_tank:
add eax,4
cmp eax,10*4
jne next_bad_tank
;-------------------------------------------------
mov eax,12
next_puly:
mov edx,eax
shr edx,2
xor ecx,ecx
mov cl,byte[PulyTanks+edx]
test ecx,ecx ;can change course of puly ?
jz no_change_course
xor ecx,ecx
mov cl,byte[LifesTanks+edx]
test ecx,ecx ;is tank not destroed ?
jz no_draw_s
mov ecx,[SpriteInfo+9*eax+24] ;tank's phas of animation
test ecx,ecx ; phas=0 ?
jnz no_change_course
mov esi,[SpriteInfo+9*eax+8]
mov edi,[SpriteInfo+9*eax+12]
mov ecx,[SpriteInfo+9*eax+28]
mov edx,[SpriteInfo+9*eax+32]
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+0],dword 1
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+28],dword ecx
mov [SpriteInfo+9*ebx+32],dword edx
mov [SpriteInfo+9*ebx+16],dword 3
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
mov ebx,eax
shr ebx,2
mov [PulyTanks+ebx],byte 0
jmp no_draw_s
;-------------------
no_change_course:
mov ebx,eax
add ebx,28
mov ecx,[SpriteInfo+9*ebx+24]
test ecx,ecx
jnz no_draw_s
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
mov ecx,[SpriteInfo+9*ebx+28]
mov edx,[SpriteInfo+9*ebx+32]
call map_x_y
cmp ecx,1
je bumm
cmp ecx,0
je strike_to_wall
jmp no_bumm
strike_to_wall:
mov [ebx],byte 2
bumm:
;-------------------
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+28],dword 0
mov [SpriteInfo+9*ebx+32],dword 0
mov esi,[SpriteInfo+9*ebx+8]
mov edi,[SpriteInfo+9*ebx+12]
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1
mov [SpriteInfo+9*ebx+8],dword esi
mov [SpriteInfo+9*ebx+12],dword edi
mov [SpriteInfo+9*ebx+16],dword 3
mov [SpriteInfo+9*ebx+28],dword 0
mov [SpriteInfo+9*ebx+32],dword 0
mov ebx,eax
shr ebx,2
mov [PulyTanks+ebx],byte 1
mov edx,[number_level]
mov ecx,15
push eax
call load_level
pop eax
jnp no_draw_s
;-------------------
no_bumm:
mov ebx,eax
add ebx,28
mov [SpriteInfo+9*ebx+4],dword 1 ; can draw sprite of puly
no_draw_s:
add eax,4
cmp eax,10*4
jne next_puly
;-------------------------------------------------
;-------------end of tanks logic------------------
;-------------------------------------------------
mov eax,13
mov ebx,180*65536+220
mov ecx,425*65536+17
mov edx,0xdfffff
int 0x40
mov eax,4
mov ebx,190*65536+430
mov ecx,0x1ded00;0
mov edx,Level
mov esi,5
int 0x40
mov eax,4
mov ebx,260*65536+430
mov ecx,0x3558ff
mov edx,Lifes
mov esi,5
int 0x40
mov eax,4
mov ebx,330*65536+430
mov ecx,0xf93500
mov edx,Score
mov esi,5
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[number_level]
inc ecx
mov edx,225*65536+430
mov esi,0x1ded00
int 0x40
mov eax,47
mov ebx,3*65536
xor ecx,ecx
mov cl,[LifesPlayer]
shr ecx,2
mov edx,295*65536+430
mov esi,0x3558ff
int 0x40
mov eax,47
mov ebx,3*65536
xor ecx,ecx
mov cl,byte[score]
mov edx,365*65536+430
mov esi,0xf93500
int 0x40
jmp maincycle
;----------------------------------------------------------
;-----------------end of main cycle------------------------
;----------------------------------------------------------
;draw sprite in video memory
PutSprite:
push eax
mov ebx,esi
mov eax,edi
lea ebx,[ebx+2*ebx]
lea eax,[eax+2*eax]
imul eax,640
add eax,0x4000
add eax,ebx
mov [counter],20
mov esi,edx
imul esi,1200
add esi,0x4000+(640*400*3)+10*1200
mov ebx,esi
mov edi,eax
draw:
mov esi,ebx
mov edi,eax
mov ecx,20
;--------------------
rep_movsb:
xor edx,edx
mov edx,[esi]
and edx,0xffffff
test edx,edx ;0 is transparent color
jz transparent_color
mov [edi],dx
shr edx,16
mov [edi+2],dl
transparent_color:
add esi,3
add edi,3
sub ecx,1
jnz rep_movsb
;--------------------
add eax,640*3
add ebx,20*3
dec [counter]
jnz draw
pop eax
ret
;----------------------------------------------------------
SaveFon:
push eax
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add esi,edi
add esi,0x4000
mov edi,edx
imul edi,1200
add edi,0x4000+(640*400*3)+(50*20*20*3)+512+641
mov [counter],20
mov eax,esi
mov ebx,edi
save_to:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,640*3
add ebx,20*3
dec [counter]
jnz save_to
pop eax
ret
;----------------------------------------------------------
PutFon:
push eax
lea esi,[esi+2*esi]
lea edi,[edi+2*edi]
imul edi,640
add edi,esi
add edi,0x4000
mov esi,edx
imul esi,1200
add esi,0x4000+(640*400*3)+(50*20*20*3)+512+641
mov [counter],20
mov eax,esi
mov ebx,edi
put_to:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,640*3
dec [counter]
jnz put_to
pop eax
ret
;----------------------------------------------------------
;get time in 1/100 sec
clock: mov eax,26
mov ebx,9
int 0x40
mov [time],eax
ret
;----------------------------------------------------------
;-----------------load level to memory---------------------
;----------------------------------------------------------
load_level:
cmp ecx,15
je no_load_level
mov eax,edx
mov ebx,[levels+4*eax]
mov esi,ebx
add esi,2
xor ecx,ecx
xor eax,eax
mov cl,byte[ebx]
mov al,byte[ebx+1]
add ecx,eax
mov edi,0x4000+(640*400*3)+(50*20*20*3)+512
call unpakin
no_load_level:
and [y],0
c_y:
and [x],0
c_x:
mov eax,[x]
mov ebx,[y]
shl ebx,5
add eax,ebx
add eax,0x4000+(640*400*3)+(50*20*20*3)+512
mov ecx,eax
xor eax,eax
mov al,byte [ecx]
imul eax,1200
add eax,0x4000+(640*400*3)
mov ebx,[x]
imul ebx,20*3
mov ecx,[y]
imul ecx,20*3*640
add ebx,ecx
add ebx,0x4000
mov esi,eax
mov edi,ebx
;----------------------------
mov edx,20
next_line:
mov esi,eax
mov edi,ebx
mov ecx,15
rep movsd
add eax,20*3
add ebx,(640*3)
dec edx
jnz next_line
;----------------------------
inc [x]
cmp [x],32
jne c_x
inc [y]
cmp [y],20
jne c_y
ret
;----------------------------------------------------------
map_x_y:
push eax
mov ecx,20
mov eax,esi
cdq
idiv ecx
mov esi,eax
mov eax,edi
cdq
idiv ecx
mov edi,eax
;------------------
mov ebx,edi
shl ebx,5
add ebx,esi
add ebx,0x4000+(640*400*3)+(50*20*20*3)+512
xor ecx,ecx
mov cl,byte[ebx]
cmp cl,0
je false_draw
cmp cl,1
je false_draw
cmp cl,3
je false_draw
cmp cl,7
je false_draw
mov edx,1
jmp lab2
false_draw:
xor edx,edx
lab2:
pop eax
ret
;----------------------------------------------------------
you_won:
mov eax,13
mov ebx,1*65536+640
mov ecx,20*65536+400
mov edx,0xc6e9
int 0x40
mov eax,4
mov ebx,220*65536+190
mov ecx,0xffffff
mov edx,won1
mov esi,29
int 0x40
mov eax,4
mov ebx,220*65536+200
mov ecx,0xffffff
mov edx,won2
mov esi,29
int 0x40
mov eax,4
mov ebx,220*65536+210
mov ecx,0xffffff
mov edx,won3
mov esi,29
int 0x40
mov eax,5
mov ebx,100
int 0x40
ret
;----------------------------------------------------------
end_game:
mov eax,13
mov ebx,0*65536+640
mov ecx,20*65536+400
mov edx,0
int 0x40
mov eax,4
mov ebx,280*65536+200
mov ecx,0xffffff
mov edx,game_over
mov esi,9
int 0x40
mov eax,5
mov ebx,150
int 0x40
ret
;----------------------------------------------------------
drawwin:
mov eax,12
mov ebx,1
int 0x40
;à¨á㥬 ®ª­® § ¤ ¢ ï ¢á¥ ­¥®¡å®¤¨¬ë¥ 梥â 
mov eax,0
mov ebx,50*65536+640
mov ecx,50*65536+480
mov edx,0x03AABBCC
mov esi,0x805080d0
mov edi,0x005080d0
int 0x40
;¯¨è¥¬ § £®«®¢®ª ®ª­ 
mov eax,4
mov ebx,5*65536+5
mov ecx,0x10ffffff
mov edx,name
mov esi,42
int 0x40
ret
;----------------------------------------------------------
menu:
cycle_menu:
mov eax,13
mov ebx,235*65536+140
mov ecx,230*65536+20
mov edx,0xed16
int 0x40
mov eax,4
mov ebx,255*65536+235
mov ecx,0xff0200
mov edx,start_menu
mov esi,11
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[number_level]
mov edx,345*65536+235
mov esi,0xff0200
int 0x40
still:
mov eax,10
int 0x40
cmp eax,2
jne still
mov eax,2
int 0x40
shr eax,8
cmp eax,32
je start_game
cmp eax,176
jne no_left
dec [number_level]
and [number_level],11111b
jmp cycle_menu
no_left:
cmp eax,179
jne no_right
inc [number_level]
and [number_level],11111b
jmp cycle_menu
no_right:
cmp eax,27
jne cycle_menu
mov eax,-1
int 0x40
start_game:
ret
;----------------------------------------------------------
;--------------unpak pix engin-----------------------------
;----------------------------------------------------------
unpakin:
NextLitlColor:
xor edx,edx
mov dl,byte[esi]
xor eax,eax
xor ebx,ebx
mov al,dl
mov bl,al
shr al,4
and al,0xf
mov [LitlCounter],al
and bl,0xf
mov [LitlColor],bl
xor eax,eax
;----------------------
mov al,[LitlColor]
beg:mov [edi],al
add edi,1
add [LitlCounter],-1
cmp [LitlCounter],-1
jne beg
inc esi
dec ecx
jnz NextLitlColor
ret
LitlCounter db 0
LitlColor db 0
;----------------------------------------------------------
time dd 0
time_frame_old dd 0
number_sprite dd 0
number_level dd 0
counter db 0
sp_pos dd 0
num_blocks dd 0
;-------------------
x dd 0
y dd 0
_dx dd 0
_dy dd 0
strike_action dd 0
end_bum db 0
bazas db 0
name db ' game *TANKS* creted by andrew_programmer'
won1 db '*****************************'
won2 db '* YOU WON LEVEL !!! *'
won3 db '*****************************'
game_over db 'GAME OVER'
Lifes db 'LIFES'
Level db 'LEVEL'
Score db 'SCORE'
start_menu db 'START LEVEL'
LifesTanks rb 16
PulyTanks rb 16
LifesPlayer db 0
tupik db 0
score db 0
SpriteInfo:
dd 0,0,0,0,4,0,0,0,0
dd 1,0,100,80,3,0,0,0,0
dd 2,1,100,100,5,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
dd 0,0,0,0,0,0,0,0,0
TANKS_script:
db 1,1,2,1,3,1,4,1,5,1,3,2,3,3,3,4,3,5 ;T
db 7,3,7,4,7,5,8,2,8,4,9,1,9,4,10,2,10,4,11,3,11,4,11,5 ;A
db 13,1,13,2,13,3,13,4,13,5,14,1,15,2,16,3,17,1,17,2,17,3,17,4,17,5 ;N
db 19,1,19,2,19,3,19,4,19,5,20,3,21,2,22,1,22,3,23,4,23,5 ;K
db 25,4,26,2,26,5,27,1,27,3,27,5,27,1,28,4,28,1,29,2 ;S
 
;----------------------------------------------------------
;-----------------------data-------------------------------
;----------------------------------------------------------
water:
db 247,0,0,0,0,0,255,0
db 0,128,0,255,128,0,128,255
db 0,255,0,0,255,255,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,2,1,19,2
db 1,2,1,2,17,2,1,18
db 35,49,19,2,49,2,17,2
db 17,3,6,5,19,2,19,17
db 18,35,18,1,2,51,5,1
db 2,5,3,6,18,1,19,5
db 3,17,2,19,6,5,19,6
db 1,3,33,19,6,3,5,3
db 2,17,51,2,1,19,18,3
db 6,67,18,1,2,3,5,35
db 1,2,17,19,5,6,5,6
db 3,1,18,51,2,3,18,3
db 6,3,5,6,19,5,19,1
db 19,33,18,1,18,3,6,3
db 6,67,1,2,1,2,65,2
db 1,19,5,3,21,3,17,34
db 1,66,1,18,67,2,17,2
db 33,2,1,18,1,2,1,34
db 1,2,1,18,1,18,17,2
db 33,34,17,50,17,2,17,66
db 1,2,1,19,5,3,2,17
db 2,17,50,17,34,19,6,3
db 6,19,1,2,65,19,6,3
db 17,3,5,19,5,35,18,17
db 3,6,3,5,19,18,3,6
db 5,19,5,19,18,17,3,21
db 3,21,2,1,35,21,19,17
db 2,1,2,3,6,3,6,5
db 3,1,18,1,35,2,17,50
db 1,3,5,6,35,1,2,1
db 2,1,2,17,2,17,2,17
db 2,51,16
voda1:
db 137,0,0,0,0,255,255,0
db 255,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,2,17,18,17
db 18,65,18,17,2,33,2,97
db 2,1,2,33,18,17,18,49
db 18,65,2,65,18,17,2,17
db 2,33,18,33,2,113,18,17
db 18,17,2,49,18,17,18,145
db 34,33,18,49,18,17,18,145
db 2,65,2,65,18,17,18,17
db 2,17,34,49,18,97,2,113
db 2,49,18,1,2,49,2,1
db 18,17,2,1,34,65,2,97
db 2,113,2,65,18,17,2,49
db 18,1,2,33,18,1,2,81
db 18,193,18,81,18,17,18,129
db 18,145,18,1,2,81,34,17
db 18,65,34,1,18,145,2,129
db 18,49,18,33,2,33,34,81
db 18,97,2,1,16
trava:
db 214,0,0,0,0,0,255,0
db 0,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,2,49,2,17
db 2,33,2,1,2,33,2,17
db 34,17,18,1,2,1,18,33
db 2,17,34,17,18,33,18,17
db 50,97,2,33,2,33,18,1
db 18,17,50,1,2,1,50,1
db 18,65,2,33,18,1,18,17
db 18,17,82,33,2,1,2,1
db 2,33,2,49,18,1,18,1
db 2,1,2,33,2,17,2,1
db 2,65,2,1,18,1,2,17
db 2,17,34,1,66,1,18,17
db 2,17,2,17,2,33,2,1
db 18,1,2,1,34,1,2,1
db 18,1,18,17,2,33,34,17
db 50,17,2,17,66,1,2,17
db 2,17,2,17,2,17,50,17
db 50,1,34,33,2,81,2,49
db 2,33,34,1,18,33,18,1
db 66,33,2,1,50,17,2,1
db 2,1,2,1,2,49,34,33
db 2,1,18,1,18,33,18,1
db 2,17,2,17,50,17,2,1
db 2,1,2,1,2,1,2,1
db 2,17,2,17,2,17,18,17
db 2,16
tan22:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 255,255,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,112,51,8,224
db 0,19,144,8,96,19,144,8
db 64,8,0,19,144,8,32,8
db 0,8,0,19,32,8,32,24
db 2,20,18,8,39,19,39,8
db 18,20,82,55,19,55,82,20
db 18,7,6,23,19,23,6,7
db 18,20,82,6,23,51,23,6
db 146,23,83,23,82,20,18,23
db 19,22,19,23,18,20,82,23
db 19,22,19,23,82,20,18,23
db 83,23,18,20,82,23,83,23
db 146,39,51,39,82,20,18,151
db 18,20,66,8,151,8,50,8
db 48,21,87,21,8,224,224,240
tan21:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 255,255,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,112,51,8,224
db 0,19,144,8,96,19,144,8
db 64,8,0,19,144,8,32,8
db 0,8,0,19,32,8,32,24
db 66,8,39,19,39,8,82,20
db 18,55,19,55,18,20,82,7
db 6,23,19,23,6,7,82,20
db 18,6,23,51,23,6,18,20
db 82,23,83,23,146,23,19,22
db 19,23,82,20,18,23,19,22
db 19,23,18,20,82,23,83,23
db 82,20,18,23,83,23,18,20
db 82,39,51,39,146,151,82,20
db 2,8,151,8,2,20,2,8
db 48,21,87,21,8,224,224,240
tan12:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,112,51,7,224
db 0,19,144,7,96,19,144,7
db 64,7,0,19,144,7,32,7
db 0,7,0,19,32,7,0,55
db 2,20,18,7,33,19,33,7
db 18,20,82,49,19,49,82,20
db 18,1,6,17,19,17,6,1
db 18,20,82,6,17,51,17,6
db 146,17,83,17,82,20,18,17
db 19,22,19,17,18,20,82,17
db 19,22,19,17,82,20,18,17
db 83,17,18,20,82,17,83,17
db 146,33,51,33,82,20,18,145
db 18,20,66,7,145,7,50,7
db 48,21,81,21,7,224,224,240
tan11:
db 116,0,0,0,0,128,0,255
db 192,192,192,64,128,255,128,128
db 128,0,255,0,0,128,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,7,0,112,51,7,224
db 0,19,144,7,96,19,144,7
db 64,7,0,19,144,7,32,7
db 0,7,0,19,32,7,32,23
db 66,7,33,19,33,7,82,20
db 18,49,19,49,18,20,82,1
db 6,17,19,17,6,1,82,20
db 18,6,17,51,17,6,18,20
db 82,17,83,17,146,17,19,22
db 19,17,82,20,18,17,19,22
db 19,17,18,20,82,17,83,17
db 82,20,18,17,83,17,18,20
db 82,33,51,33,146,145,82,20
db 2,7,145,7,2,20,2,7
db 48,21,81,21,7,224,224,240
sten3:
db 104,0,0,0,0,128,128,128
db 192,192,192,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,3,0,226,66,65,2
db 81,2,65,2,81,2,81,2
db 65,2,81,2,81,2,65,2
db 1,226,66,33,2,81,2,81
db 2,65,2,81,2,81,2,65
db 2,81,2,81,2,17,226,66
db 1,2,81,2,81,2,65,2
db 81,2,81,2,65,2,81,2
db 81,2,49,226,66,65,2,97
db 2,65,2,65,2,97,2,65
db 2,65,2,97,2,65,226,82
db 33,2,81,2,81,2,65,2
db 81,2,81,2,65,2,81,2
db 81,2,17,16
sten1:
db 111,0,0,0,0,128,128,128
db 192,192,192,0,0,255,255,255
db 255,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,227,67,53,3
db 133,3,69,34,5,3,5,98
db 5,3,5,98,5,3,5,98
db 5,3,5,50,53,3,133,3
db 69,227,67,133,3,133,3,114
db 5,3,5,98,5,3,114,5
db 3,5,98,5,3,133,3,133
db 227,83,69,3,133,3,53,50
db 5,3,5,98,5,3,5,98
db 5,3,5,98,5,3,5,34
db 69,3,133,3,53,227,67,101
db 3,133,3,21,82,5,3,5
db 98,5,3,5,98,5,3,5
db 98,5,3,5,2,101,3,133
db 3,21,16
puly1:
db 48,0,0,0,0,0,255,255
db 128,0,255,0,0,255,64,128
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,224,224,224,224
db 224,224,224,224,96,49,224,17
db 20,17,192,17,4,18,4,17
db 176,1,4,50,4,1,176,17
db 4,18,4,17,192,17,20,17
db 224,49,224,224,224,224,224,224
db 224,224,224,240
pesok:
db 120,0,0,0,0,0,255,255
db 0,64,128,0,128,128,64,128
db 128,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,225,81,2,33
db 2,65,2,3,33,2,1,5
db 49,5,49,2,129,3,225,97
db 3,17,2,33,2,1,5,33
db 2,1,5,129,5,65,2,65
db 2,225,97,2,33,3,17,2
db 49,3,145,2,177,3,49,5
db 81,5,1,2,33,2,65,3
db 17,2,17,3,145,2,209,3
db 81,2,49,5,33,2,177,3
db 145,2,17,2,5,113,2,225
db 1,2,33,3,17,3,49,3
db 17,3,161,2,1,5,97,2
db 177,2,49,2,33,5,33,2
db 193,2,49,3,33,2,81,3
db 1,5,1,16
palma:
db 209,0,0,0,0,0,255,0
db 0,128,0,0,255,255,64,128
db 128,64,128,255,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,6,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,51,1,2,17
db 2,1,35,1,2,33,115,2
db 51,21,19,1,2,35,69,35
db 53,35,18,3,21,67,5,3
db 21,19,1,18,19,2,5,3
db 50,1,3,5,3,5,67,17
db 3,1,19,17,67,5,99,34
db 3,2,35,5,3,5,3,5
db 3,5,3,5,35,1,18,1
db 2,19,5,35,5,3,5,35
db 21,19,33,19,5,35,5,35
db 5,51,5,3,34,35,17,51
db 20,3,5,35,5,3,2,1
db 35,18,3,5,3,36,5,19
db 1,35,1,18,3,17,2,3
db 2,52,35,50,1,2,17,2
db 17,2,1,52,3,34,17,50
db 1,34,33,36,49,2,49,2
db 33,34,1,36,17,18,1,66
db 33,2,1,2,1,36,1,2
db 1,2,1,2,1,2,49,66
db 36,18,1,18,33,18,1,2
db 17,84,2,17,2,1,2,1
db 2,1,2,1,2,1,84,2
db 17,18,17,2,16
kamni:
db 210,0,0,0,0,0,255,0
db 0,128,0,64,128,255,64,128
db 128,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,2,33,2,1
db 2,35,1,2,1,34,17,18
db 1,18,1,2,17,51,1,2
db 33,2,1,2,33,2,1,67
db 4,3,2,1,2,1,18,33
db 2,17,2,83,4,17,18,17
db 50,17,131,2,33,18,1,18
db 17,83,20,3,18,1,18,65
db 2,67,4,19,4,3,18,17
db 82,99,4,35,2,49,18,1
db 18,1,2,1,2,17,35,4
db 2,1,2,65,2,1,18,1
db 2,17,2,17,34,1,66,1
db 18,17,2,17,2,17,2,33
db 2,1,18,1,2,1,2,19
db 1,2,1,18,1,18,19,2
db 33,18,35,4,3,18,17,2
db 1,67,2,1,2,99,1,2
db 17,2,35,4,3,34,35,4
db 3,4,3,1,2,17,83,1
db 67,20,19,4,3,2,17,51
db 4,115,4,35,2,1,83,4
db 67,34,33,2,35,1,3,4
db 19,1,18,1,2,17,2,17
db 50,17,2,1,2,1,2,1
db 2,1,2,1,2,17,2,17
db 2,17,18,17,2,16
drevo:
db 240,0,0,0,0,0,255,0
db 0,128,0,255,0,128,0,64
db 128,64,128,128,128,0,128,255
db 128,128,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,8,0,2,33,2,1
db 2,19,1,35,34,17,18,1
db 18,1,2,17,3,38,7,22
db 3,1,2,1,2,33,2,1
db 19,7,6,23,6,23,3,6
db 18,33,2,17,2,3,7,19
db 6,3,54,7,19,50,33,3
db 22,7,6,3,6,7,22,3
db 23,2,1,18,17,22,7,6
db 7,3,7,3,7,22,7,6
db 35,17,35,54,55,6,23,22
db 19,18,19,7,3,7,6,7
db 22,7,3,22,3,22,7,3
db 18,19,23,3,182,3,33,3
db 22,3,7,6,7,6,7,22
db 7,6,7,22,3,34,7,22
db 7,22,3,39,38,7,6,7
db 19,2,1,3,7,6,23,38
db 7,38,39,6,7,3,1,2
db 19,54,3,38,3,70,3,2
db 1,2,1,3,7,6,7,19
db 4,5,4,19,6,7,6,3
db 1,50,1,34,3,1,36,17
db 3,22,2,49,2,33,34,21
db 4,33,18,1,66,33,2,1
db 52,17,2,1,2,1,2,1
db 2,49,18,20,5,4,5,4
db 18,1,18,33,18,1,2,1
db 132,1,2,1,2,1,2,1
db 2,1,36,5,20,5,4,21
db 36,17,2,16
bum41:
db 141,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,21,50,21
db 16,5,96,21,130,69,32,50
db 33,4,1,66,0,21,16,5
db 34,1,2,17,18,1,66,53
db 34,17,2,17,18,1,18,4
db 18,37,50,33,2,33,2,17
db 50,21,2,4,18,65,50,1
db 50,5,50,33,2,49,2,17
db 50,21,2,81,18,33,2,17
db 130,113,2,17,130,33,18,1
db 194,65,2,33,66,4,2,5
db 65,2,97,34,1,18,5,18
db 1,34,1,18,1,2,17,18
db 1,34,21,2,4,17,34,49
db 82,37,18,1,18,49,34,4
db 50,37,50,1,18,49,66,53
db 0,66,1,114,37,64,18,17
db 2,4,50,69,80,5,82,53
db 64
bum31:
db 114,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,53,18,21
db 144,53,82,85,48,5,18,3
db 18,4,66,5,0,21,16,21
db 146,4,18,85,3,18,3,2
db 49,82,53,98,3,66,1,18
db 53,178,3,1,4,18,21,2
db 3,114,3,50,1,18,21,34
db 4,50,3,130,21,210,3,18
db 3,98,3,194,21,130,3,114
db 21,18,4,18,3,146,3,2
db 21,2,3,114,3,34,1,18
db 37,34,3,2,4,98,4,2
db 3,2,53,226,101,50,4,98
db 69,0,37,146,53,80,37,2
db 3,18,101,80,165,64
bum21:
db 134,0,0,0,0,128,255,255
db 0,255,255,0,0,255,128,0
db 255,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,5,0,80,117,144,69
db 50,101,48,37,34,4,50,21
db 0,21,16,37,130,4,2,133
db 18,4,49,66,101,66,19,2
db 3,18,1,18,69,18,4,18
db 3,2,3,18,19,1,4,2
db 69,34,35,2,83,1,18,53
db 2,4,2,3,18,3,2,3
db 2,3,2,3,18,4,53,34
db 99,2,19,34,53,34,3,2
db 19,2,51,18,4,2,53,2
db 4,1,51,2,3,18,19,34
db 53,2,4,18,3,2,83,2
db 4,18,69,66,19,2,3,34
db 1,2,101,18,4,98,4,2
db 133,82,4,34,165,18,4,66
db 101,0,85,50,101,80,213,80
db 165,64
bum11:
db 79,0,0,0,0,128,255,255
db 0,255,255,0,0,255,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,4,0,80,100,176,196
db 80,196,0,20,16,100,50,100
db 0,84,2,49,18,1,164,34
db 51,18,1,148,2,115,1,2
db 116,2,147,1,100,1,2,147
db 18,84,1,2,147,2,1,84
db 18,147,2,1,100,1,147,1
db 2,100,18,115,2,1,132,34
db 51,34,1,148,130,196,50,116
db 0,228,36,32,228,20,80,196
db 96,164,64
baza1:
db 192,0,0,0,0,0,255,0
db 0,128,0,255,0,128,255,128
db 128,255,0,0,255,128,0,255
db 255,0,128,0,255,0,0,255
db 0,255,255,0,0,0,0,0
db 0,0,0,0,0,0,0,0
db 0,0,11,0,2,33,2,1
db 2,1,2,17,2,1,34,17
db 18,1,18,1,2,49,2,17
db 2,33,2,1,2,17,232,9
db 4,17,2,8,201,8,3,9
db 4,2,1,8,41,150,8,19
db 9,2,1,57,6,101,7,6
db 8,3,10,3,9,2,8,41
db 6,5,84,7,6,8,35,9
db 2,8,41,6,5,84,7,6
db 8,35,9,2,8,41,6,5
db 84,7,6,8,3,21,9,1
db 8,41,6,5,84,7,6,8
db 3,21,9,2,8,41,6,5
db 84,7,6,8,35,9,2,8
db 41,6,5,103,6,8,3,10
db 3,9,1,8,57,134,8,35
db 9,1,8,201,8,3,10,3
db 9,2,232,35,9,2,9,131
db 10,19,10,3,9,4,3,9
db 1,2,25,19,22,131,9,4
db 9,33,9,35,22,131,25,1
db 18,1,233,9,2,1,2,1
db 2,1,2,17,2,17,2,17
db 18,17,2,16
;-----------------------------------
;-----here begin levels-------------
;-----------------------------------
lev01:
db 171,0
db 225,225,33,150,7,2,1,7
db 41,192,17,150,18,1,57,144
db 1,16,17,182,1,57,112,33
db 16,17,38,225,65,96,17,6
db 1,6,1,7,5,80,1,7
db 117,1,96,17,38,1,18,80
db 1,69,24,21,1,96,17,38
db 1,112,1,34,40,37,1,96
db 17,38,128,1,19,224,17,38
db 1,112,1,0,3,96,1,96
db 17,38,1,224,32,1,96,17
db 38,1,224,32,65,0,49,38
db 129,0,145,6,7,6,1,32
db 17,86,48,1,148,70,1,32
db 17,86,48,1,148,22,1,22
db 1,32,17,6,1,54,4,3
db 16,1,116,16,70,1,32,17
db 70,35,16,1,20,17,36,32
db 70,1,8,7,8,17,70,66
db 1,100,112,1,40,17,70,2
db 7,34,1,116,96,1,40,225
db 225,33,16
lev02:
db 255,3
db 225,225,33,5,49,3,225,161
db 5,38,5,3,64,89,0,40
db 54,50,33,5,38,5,3,32
db 35,34,3,16,8,67,6,50
db 33,5,38,5,3,34,16,3
db 36,3,2,35,36,3,66,33
db 5,22,21,3,34,3,0,3
db 36,3,2,3,7,36,5,3
db 2,1,35,33,5,22,21,3
db 7,2,0,2,19,5,20,3
db 2,51,21,3,66,33,5,22
db 21,35,0,2,3,7,5,20
db 18,3,24,3,22,67,2,33
db 5,17,25,48,2,51,2,35
db 24,3,22,9,16,19,2,33
db 5,2,1,25,49,2,3,56
db 3,54,67,0,3,16,33,5
db 2,49,22,1,6,3,22,1
db 8,3,17,88,3,48,33,5
db 18,4,54,1,6,3,22,1
db 8,3,7,1,99,57,33,5
db 18,4,22,1,5,1,54,1
db 8,3,70,51,57,33,5,18
db 4,0,17,5,113,51,0,3
db 38,9,32,33,5,17,4,16
db 1,32,1,37,49,32,3,54
db 19,0,33,5,0,20,16,1
db 2,1,0,20,1,24,34,0
db 33,7,38,3,16,33,5,0
db 33,0,1,2,113,18,32,83
db 16,33,5,16,7,16,1,146
db 33,128,33,114,65,98,225,225
db 193,16
lev03:
db 118,0
db 225,225,33,85,50,35,162,86
db 17,5,7,53,166,34,7,8
db 18,86,17,85,34,19,6,19
db 50,72,2,86,193,6,225,1
db 6,33,160,230,54,17,18,128
db 102,65,102,17,7,2,128,102
db 1,166,17,160,230,54,225,113
db 6,145,214,224,0,17,214,96
db 81,32,17,214,96,1,7,38
db 17,16,17,214,224,0,113,6
db 225,145,82,198,1,144,17,82
db 1,182,1,48,1,54,0,17
db 18,38,2,7,2,166,1,48
db 1,54,0,17,114,230,6,1
db 7,48,225,225,33,16
lev04:
db 146,0
db 225,225,33,89,1,176,89,1
db 57,17,89,1,176,25,7,41
db 1,57,17,89,1,9,65,57
db 64,34,1,25,1,9,17,89
db 1,25,7,5,9,1,57,48
db 35,33,9,1,9,17,89,1
db 73,1,233,1,9,17,89,225
db 113,9,17,233,233,17,233,233
db 17,217,129,105,17,217,1,100
db 1,105,17,41,81,64,1,7
db 73,4,1,105,17,41,1,7
db 41,1,64,1,89,4,1,105
db 17,41,1,36,25,64,1,25
db 1,41,4,145,41,1,52,1
db 64,41,1,7,34,1,98,17
db 41,81,64,129,18,7,50,17
db 233,121,3,20,50,17,233,121
db 35,17,25,17,233,233,225,225
db 33,16
lev05:
db 229,0
db 225,225,33,224,224,17,0,134
db 50,72,34,24,2,40,2,0
db 17,0,134,34,83,2,56,2
db 40,2,0,17,0,134,18,19
db 56,3,2,24,2,8,2,56
db 0,17,0,22,8,86,19,6
db 72,3,40,2,8,2,56,0
db 17,0,22,8,50,22,18,6
db 40,35,2,24,2,8,2,56
db 0,17,0,22,72,22,18,54
db 3,6,56,2,8,2,32,8
db 0,17,0,40,86,18,40,6
db 3,6,88,2,7,8,0,8
db 0,17,0,40,6,7,70,2
db 40,6,3,54,8,54,8,0
db 8,0,17,0,56,38,8,22
db 40,7,86,8,54,8,0,8
db 0,17,0,2,51,56,6,40
db 2,166,8,0,8,0,17,0
db 50,3,34,8,6,40,2,6
db 66,70,16,8,0,17,0,18
db 7,2,72,22,7,8,0,6
db 66,70,0,24,0,17,0,6
db 51,120,0,6,66,8,54,0
db 24,0,17,0,118,3,64,6
db 104,22,7,0,24,0,17,0
db 118,83,6,136,16,24,0,17
db 0,230,22,19,136,0,17,224
db 224,225,225,33,16
lev06:
db 149,0
db 225,225,33,176,1,18,19,192
db 17,0,7,18,112,1,2,7
db 2,16,3,160,17,0,34,112
db 1,18,51,160,17,0,1,144
db 97,160,17,0,1,224,192,17
db 0,1,224,192,17,0,145,48
db 230,17,48,7,66,1,48,209
db 6,17,48,82,1,48,1,68
db 96,22,17,144,1,48,1,4
db 7,18,3,96,22,17,144,1
db 48,1,4,34,3,48,7,41
db 6,17,144,1,48,1,20,96
db 57,6,17,16,129,48,1,20
db 96,4,41,6,17,16,1,40
db 50,64,1,128,4,32,6,17
db 16,1,7,8,66,64,145,4
db 32,6,17,16,177,144,1,70
db 17,224,128,1,70,17,224,144
db 70,225,225,33,16
lev07:
db 159,0
db 225,225,33,0,7,229,197,17
db 64,225,113,21,17,64,1,37
db 134,133,1,21,17,32,33,37
db 6,37,33,7,6,133,1,21
db 17,37,1,37,1,5,134,133
db 1,21,17,133,209,5,49,21
db 17,5,1,229,197,17,5,1
db 133,1,229,37,17,5,1,85
db 1,229,85,17,5,65,21,1
db 21,1,101,113,38,17,5,1
db 32,37,1,149,1,7,8,53
db 1,38,17,5,1,8,16,37
db 1,21,1,7,85,1,3,2
db 53,1,38,17,5,1,8,16
db 21,193,3,69,1,38,17,5
db 1,8,1,0,229,3,69,1
db 38,17,5,1,7,232,117,1
db 38,17,5,1,232,8,129,38
db 17,5,225,33,7,98,38,17
db 229,69,150,225,225,33,16
lev08:
db 209,0
db 225,225,33,36,7,228,84,1
db 48,17,164,195,4,1,48,17
db 164,3,166,3,4,1,0,7
db 2,0,17,164,3,166,3,4
db 1,0,18,0,17,165,3,166
db 3,4,1,48,17,165,3,166
db 3,4,1,48,17,165,3,166
db 3,4,1,48,17,54,3,82
db 3,6,1,4,99,6,3,4
db 1,48,17,54,3,82,3,6
db 1,4,3,7,21,22,3,6
db 3,4,1,0,7,2,0,17
db 6,7,22,3,82,3,6,1
db 4,3,37,22,3,6,3,4
db 1,0,18,0,17,54,3,82
db 3,6,1,4,3,70,3,6
db 3,4,1,48,17,54,3,82
db 3,6,1,4,3,6,67,6
db 3,4,1,48,17,54,115,6
db 1,4,3,102,3,4,1,48
db 17,198,1,4,3,102,3,4
db 1,48,17,6,161,2,1,4
db 3,102,3,4,1,48,17,6
db 7,130,1,2,1,4,131,4
db 1,48,17,38,114,1,2,193
db 48,17,38,226,178,225,225,33
db 16
lev09:
db 162,0
db 225,225,33,229,5,214,17,21
db 33,7,149,1,198,17,21,208
db 1,32,150,17,226,2,1,18
db 80,70,17,2,83,130,1,18
db 0,7,34,0,70,17,2,3
db 144,1,0,18,1,18,0,50
db 0,70,17,2,3,144,1,0
db 18,1,18,0,50,0,70,17
db 2,3,32,7,50,16,1,0
db 66,0,50,0,70,17,2,3
db 32,66,16,1,0,66,0,7
db 130,17,2,3,144,1,48,18
db 64,82,17,18,144,1,0,7
db 50,0,2,32,82,17,18,144
db 1,0,66,0,1,64,50,17
db 178,1,0,66,0,2,80,34
db 17,178,1,96,6,80,34,145
db 0,34,113,150,17,7,82,1
db 0,34,230,38,17,98,16,226
db 82,17,98,16,226,82,225,225
db 33,16
lev10:
db 205,0
db 225,225,33,224,224,17,0,2
db 83,64,233,9,0,17,0,2
db 3,34,0,7,64,233,9,0
db 17,0,2,3,34,96,73,7
db 153,0,17,224,32,1,41,50
db 41,0,17,2,145,16,18,32
db 1,41,50,41,0,17,2,1
db 134,16,18,32,1,41,50,41
db 0,17,2,1,6,41,70,16
db 1,2,32,1,7,25,50,41
db 0,17,2,1,6,89,22,16
db 18,32,49,50,41,0,17,2
db 1,6,89,22,16,1,2,32
db 1,41,50,41,0,17,2,1
db 54,41,22,16,1,2,32,1
db 41,50,41,0,17,2,1,54
db 41,22,16,1,2,32,1,41
db 50,41,0,17,2,1,54,7
db 25,22,16,18,32,1,41,2
db 7,16,41,0,17,2,1,54
db 41,22,16,1,2,224,17,2
db 1,54,41,22,16,1,2,224
db 17,2,1,134,16,18,100,6
db 98,17,2,1,160,1,2,100
db 6,1,82,17,226,118,1,7
db 66,225,225,33,16
lev11:
db 228,0
db 225,225,33,230,230,17,6,104
 
db 1,104,6,1,7,152,6,17
 
db 6,104,1,104,6,1,24,1
 
db 120,6,17,6,104,1,8,102
 
db 49,8,64,24,6,17,6,104
 
db 1,8,6,72,38,40,0,88
 
db 6,17,6,8,97,8,6,33
 
db 56,6,40,64,24,6,17,6
 
db 8,1,104,6,1,64,1,6
 
db 104,0,24,6,17,6,8,1
 
db 104,6,1,0,40,0,1,6
 
db 104,0,24,6,17,6,8,1
 
db 7,88,6,1,0,40,0,1
 
db 6,40,16,24,0,24,6,17
 
db 6,8,33,72,6,1,0,8
 
db 7,8,0,1,6,40,0,40
 
db 0,24,6,17,6,136,6,1
 
db 0,40,0,1,6,40,0,40
 
db 0,24,6,17,166,1,0,40
 
db 0,1,6,40,64,7,8,6
 
db 17,6,8,49,6,56,1,64
 
db 1,6,152,6,17,6,8,7
 
db 24,1,6,56,97,182,17,6
 
db 56,1,6,168,6,24,80,40
 
db 17,6,56,1,198,24,0,56
 
db 0,40,17,6,72,6,216,0
 
db 56,0,40,17,102,120,1,7
 
db 56,0,1,7,8,1,0,40
 
db 225,225,33,16
lev12:
db 157,0
db 225,225,33,66,1,217,36,98
 
db 17,66,1,217,36,50,3,18
 
db 17,66,1,41,161,36,33,50
 
db 17,66,1,41,1,196,1,2
 
db 1,50,17,66,1,41,1,196
 
db 1,2,1,50,17,2,65,41
 
db 1,148,49,2,1,50,17,2
 
db 1,7,24,25,33,4,145,7
 
db 34,1,50,17,2,1,40,25
 
db 1,7,20,1,7,178,1,50
 
db 17,2,97,32,1,194,1,50
 
db 17,162,1,194,1,50,17,162
 
db 1,2,3,18,145,50,209,2
 
db 3,18,1,7,178,17,7,36
 
db 19,98,3,18,1,98,3,66
 
db 17,68,3,4,130,1,194,17
 
db 36,35,4,130,1,194,17,114
 
db 129,34,3,82,3,18,17,18
 
db 3,66,1,7,226,66,17,226
 
db 226,225,225,33,16
lev13:
db 233,0
db 225,225,33,224,224,17,0,53
 
db 225,49,16,1,21,0,17,0
 
db 53,1,230,22,1,16,1,21
 
db 0,17,0,53,1,230,22,1
 
db 16,1,21,0,17,0,53,1
 
db 38,177,22,1,16,1,21,0
 
db 17,0,5,1,21,1,38,1
 
db 7,133,1,22,1,16,1,21
 
db 0,17,0,5,1,21,1,38
 
db 1,6,1,7,101,1,22,1
 
db 16,1,21,0,17,0,5,1
 
db 21,1,70,1,117,1,22,1
 
db 16,1,21,0,17,0,5,1
 
db 21,1,38,1,6,1,5,7
 
db 85,1,22,1,16,1,21,0
 
db 17,0,5,1,21,1,38,1
 
db 38,81,5,1,38,16,1,21
 
db 0,17,0,5,1,21,1,38
 
db 1,70,7,53,1,22,1,16
 
db 1,7,5,0,17,0,5,1
 
db 21,1,38,177,22,1,16,1
 
db 21,0,17,0,5,1,21,1
 
db 230,22,1,16,1,21,0,17
 
db 0,5,1,21,1,7,230,6
 
db 1,16,1,21,0,17,0,5
 
db 1,21,225,49,16,1,21,0
 
db 17,0,5,1,7,5,224,80
 
db 1,21,0,17,0,5,225,145
 
db 21,0,17,224,224,225,225,33
 
db 16
lev14:
db 152,0
db 225,225,33,7,102,144,57,112
 
db 17,118,48,7,40,16,7,41
 
db 112,17,118,0,104,208,17,22
 
db 49,232,128,17,22,1,25,1
 
db 8,196,8,128,17,22,1,25
 
db 1,8,196,8,128,17,38,0
 
db 9,1,8,20,7,148,8,128
 
db 17,6,32,9,1,8,196,72
 
db 64,17,6,0,41,1,8,196
 
db 72,64,17,6,0,41,1,8
 
db 196,8,7,40,64,17,6,32
 
db 9,1,232,128,17,70,1,0
 
db 81,120,128,17,64,1,80,1
 
db 224,16,17,64,1,89,1,16
 
db 86,32,70,0,17,80,89,1
 
db 16,86,32,70,0,17,86,1
 
db 7,57,1,32,70,32,70,0
 
db 17,7,70,97,118,32,70,0
 
db 17,230,86,128,225,225,33,16
 
lev15:
db 242,0
db 225,225,33,182,224,32,17,22
 
db 69,70,0,54,0,54,0,54
 
db 0,20,17,22,69,32,22,0
 
db 54,0,54,0,54,0,20,17
 
db 22,69,0,5,4,22,0,1
 
db 38,0,54,0,54,0,20,17
 
db 22,69,0,3,4,22,0,1
 
db 38,0,54,0,33,6,0,20
 
db 17,22,69,0,3,4,22,0
 
db 17,7,6,0,54,0,1,7
 
db 22,0,20,17,22,69,0,3
 
db 4,22,0,1,38,0,54,0
 
db 1,38,0,20,17,22,80,3
 
db 4,22,0,1,38,0,54,0
 
db 1,38,0,20,17,22,0,83
 
db 4,22,0,54,0,54,0,49
 
db 0,20,17,22,0,3,84,22
 
db 0,54,0,56,0,54,0,20
 
db 17,22,0,3,84,22,0,54
 
db 0,56,0,54,0,20,17,22
 
db 0,3,7,68,22,0,54,0
 
db 8,7,24,0,54,0,25,17
 
db 22,0,83,4,22,0,54,0
 
db 56,0,54,0,7,9,17,22
 
db 112,22,0,54,0,54,0,54
 
db 0,25,17,182,0,54,0,54
 
db 0,54,0,20,17,192,54,0
 
db 54,0,54,0,20,225,1,7
 
db 22,0,54,0,54,0,20,17
 
db 7,2,116,224,32,20,225,225
 
db 33,16
 
;-----------------------------------
spisok:
dd sten1
dd sten3
dd trava
dd kamni
dd palma
dd water
dd voda1
dd baza1
dd drevo
dd pesok
dd bum11; here begin animate sprites
dd bum21
dd bum31
dd bum41
dd puly1
dd puly1
dd puly1
dd puly1
dd tan11
dd tan12
dd tan11
dd tan12
dd tan21
dd tan22
dd tan21
dd tan22
;-----------------------------------
levels:
dd lev01
dd lev02
dd lev03
dd lev04
dd lev05
dd lev06
dd lev07
dd lev08
dd lev09
dd lev10
dd lev11
dd lev12
dd lev13
dd lev14
dd lev15
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
dd lev02
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/block.inc
0,0 → 1,376
;--------------------------------------------------------------
;DRAW BLOCK
;
;--------------------------------------------------------------
draw_block: mov eax,13
mov edx,[color_table+edx*4]
 
mov ebx,[current_block_x]
mov ecx,[current_block_y]
mov edi,[current_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],4
adr_122: mov dword [TMP_0],4
adr_121: cmp byte [edi],0
je adr_120
 
int 040h
 
call draw_frames
 
adr_120: inc edi
add ebx,ADOBE_SIZE*65536
dec dword [TMP_0]
jnz adr_121
sub ebx,4*ADOBE_SIZE*65536
add ecx,ADOBE_SIZE*65536
dec dword [TMP_1]
jnz adr_122
 
ret
 
draw_frames:
cmp edx,0
jne df1
ret
df1:
pusha
mov bx,1
add edx,0x282828
mov eax,13
int 0x40
popa
 
pusha
mov cx,1
add edx,0x282828
mov eax,13
int 0x40
popa
 
pusha
push ebx
sub bx,1
add [esp+2],bx
pop ebx
mov bx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
 
pusha
push ecx
sub cx,1
add [esp+2],cx
pop ecx
mov cx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
 
ret
 
;-------------------------------------------------------------
; FIX BLOCK
;-------------------------------------------------------------
fix_block: mov ebx,[current_block_pointer]
 
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
 
add edx,table_tetris
 
mov ecx,4
mov al,[current_block_color]
 
adr_21: cmp byte [ebx],1
jne adr_22
mov [edx],al
adr_22: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_23
mov [edx],al
adr_23: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_24
mov [edx],al
adr_24: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_25
mov [edx],al
adr_25: inc ebx
add edx,LEN_X-3
 
loop adr_21
ret
 
;-------------------------------------------------------------
;NEW BLOCK
;-------------------------------------------------------------
new_block: mov dword [current_block_y],1
mov dword [current_block_x],7
 
mov eax,dword [next_block_pointer]
mov dword [current_block_pointer],eax
 
mov eax,dword [next_block_color]
mov dword [current_block_color],eax
 
call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
 
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
 
mov dword[delay],5
sub dword[delay],speed
 
ret
 
 
;-------------------------------------------------------------
;DRAW TITLE BLOCK
;-------------------------------------------------------------
draw_title_block:
; movzx edx,byte [current_block_color]
mov eax,13
 
; mov edx,[color_table+edx*4]
 
; mov ebx,[current_block_x]
; mov ecx,[current_block_y]
; mov edi,[current_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],5
call adr_122
 
ret
 
;-------------------------------------------------------------
;FIRST BLOCK
;-------------------------------------------------------------
first_block: call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
 
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
 
; call draw_next_block
 
; mov byte [delay],5 ;19 ;!!! 15
ret
ret
 
;-------------------------------------------------------------
;DRAW NEXT BLOCK
;-------------------------------------------------------------
 
draw_next_block:
movzx edx,byte [next_block_color]
mov eax,13
mov edx,[color_table+edx*4]
 
mov ebx,LEN_X+1
mov ecx,5
mov edi,[next_block_pointer]
 
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
 
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
 
mov dword [TMP_1],4
jmp adr_122
 
ret
 
;-------------------------------------------------------------
; ROTATE BLOCK
;-------------------------------------------------------------
 
rotate_block:
mov edx,[current_block_pointer]
mov edx,[edx+16]
mov esi,[current_block_pointer]
mov [current_block_pointer],edx
call check_crash
call attesa
mov [current_block_pointer],esi
 
ret
 
 
;-------------------------------------------------------------
; CHECK CRASH
; output Z flag => OK
; NZ flag => NO
;-------------------------------------------------------------
 
check_crash: mov ebx,[current_block_pointer]
 
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
 
add edx,table_tetris
 
mov ecx,4
xor ax,ax
 
adr_1: cmp byte [ebx],1
jne adr_2
add al,[edx]
adc ah,0
adr_2: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_3
add al,[edx]
adc ah,0
adr_3: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_4
add al,[edx]
adc ah,0
adr_4: inc ebx
inc edx
 
cmp byte [ebx],1
jne adr_5
add al,[edx]
adc ah,0
adr_5: inc ebx
add edx,LEN_X-3
 
loop adr_1
or ax,ax
ret
 
;--------------------------------------------------------------
;CHECK LINE
;--------------------------------------------------------------
;edx = pointer
;ebx = contatore
check_full_line:
std
mov al,0
mov edx,table_tetris+LEN_X*(LEN_Y-BORDER_BOTTOM)-1
mov ebx,(LEN_Y-BORDER_TOP-BORDER_BOTTOM-1)*LEN_X
 
adr_5000: mov edi,edx
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
repne scasb
jz no_full_line
 
lea esi,[edx-LEN_X]
mov edi,edx
mov ecx,ebx
rep movsb
sub edi,BORDER_RIGHT
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
 
add dword [score],100
add dword [lines],1
 
; mov esi,dword[score]
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; mov esi,dword [speed]
; imul esi,linestonewlevel
; add esi,linestonewlevel
; cmp dword [lines],esi
; jne adr_5000 1 line : 100
; cmp dword[speed],4 2 lines: 300
; je adr_51 3 lines: 700
; inc dword[speed] 4 lines:1500
; jmp adr_5000
; adr_51:
; mov dword[speed],0
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
jmp adr_5000
 
no_full_line: sub edx,LEN_X
sub ebx,LEN_X
jnz adr_5000
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/blocks.inc
0,0 → 1,235
;+---------------------------------+
;| DEFINITION BLOCKS |
;+---------------------------------+
 
t_block_0:
db 0,0,0,0
db 1,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_3
 
t_block_1:
db 0,1,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd t_block_0
 
t_block_2:
db 0,1,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd t_block_1
 
t_block_3:
db 0,1,0,0
db 0,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_2
 
;-----------------------------------
 
i_block_0:
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
dd i_block_1
 
i_block_1:
db 0,0,0,0
db 1,1,1,1
db 0,0,0,0
db 0,0,0,0
dd i_block_0
;-----------------------------------
 
q_block_0:
db 0,1,1,0
db 0,1,1,0
db 0,0,0,0
db 0,0,0,0
dd q_block_0
 
;-----------------------------------
 
s_block_0:
db 0,0,0,0
db 0,1,1,0
db 1,1,0,0
db 0,0,0,0
dd s_block_1
 
s_block_1:
db 1,0,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd s_block_0
 
;-----------------------------------
 
l_block_0:
db 0,0,0,0
db 1,1,1,0
db 1,0,0,0
db 0,0,0,0
dd l_block_3
 
l_block_1:
db 1,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd l_block_0
 
l_block_2:
db 0,0,1,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd l_block_1
 
l_block_3:
db 0,1,0,0
db 0,1,0,0
db 0,1,1,0
db 0,0,0,0
dd l_block_2
 
;-----------------------------------
 
g_block_0:
 
db 0,1,0,0
db 0,1,0,0
db 1,1,0,0
db 0,0,0,0
dd g_block_1
 
g_block_1:
db 0,0,0,0
db 1,1,1,0
db 0,0,1,0
db 0,0,0,0
dd g_block_2
 
g_block_2:
db 0,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd g_block_3
 
g_block_3:
db 1,0,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd g_block_0
 
;-----------------------------------
 
k_block_0:
db 0,0,0,0
db 1,1,0,0
db 0,1,1,0
db 0,0,0,0
dd k_block_1
 
k_block_1:
db 0,1,0,0
db 1,1,0,0
db 1,0,0,0
db 0,0,0,0
dd k_block_0
 
;-----------------------------------
;logo blocks
;-----------------------------------
 
tetris_t:
db 1,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
 
tetris_e:
db 1,1,1,0
db 1,0,0,0
db 1,1,0,0
db 1,0,0,0
db 1,1,1,0
 
tetris_r:
db 1,1,0,0
db 1,0,1,0
db 1,1,0,0
db 1,0,1,0
db 1,0,1,0
 
tetris_i:
db 0,1,0,0
db 0,0,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
 
tetris_s:
db 0,1,1,1
db 1,0,0,0
db 0,1,1,0
db 0,0,0,1
db 1,1,1,0
 
tetris_II:
db 1,1,1,1
db 0,1,1,0
db 0,1,1,0
db 0,1,1,0
db 1,1,1,1
 
;-----------------------------------
block_table:
dd t_block_0 ; t
dd t_block_1
dd t_block_2
dd t_block_3
dd i_block_0 ; i
dd i_block_1
dd i_block_0
dd i_block_1
dd q_block_0 ; q
dd q_block_0
dd q_block_0
dd q_block_0
dd s_block_0 ; s
dd s_block_1
dd s_block_0
dd s_block_1
dd l_block_0 ; l
dd l_block_1
dd l_block_2
dd l_block_3
dd g_block_0 ; g
dd g_block_1
dd g_block_2
dd g_block_3
dd k_block_0 ; k
dd k_block_1
dd k_block_0
dd k_block_1
 
color_table:
dd 00000000h ;black 0
dd 00cccccch ;white 1
dd 00cc0000h ;red 2
dd 0000cc00h ;green 3
dd 000000cch ;blue 4
dd 00cccc00h ;yellow 5
dd 0000cccch ;cyan 6
dd 00cc00cch ;pink 7
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm tetris.asm tetris
@pause
/programs/games/tetris/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm tetris.asm tetris
@pause
/programs/games/tetris/trunk/key.inc
0,0 → 1,161
UP_KEY equ 178 ; the ascii keycodes of some keys
DOWN_KEY equ 177
LEFT_KEY equ 176
RIGHT_KEY equ 179
ENTER_KEY equ 13
ESCAPE_KEY equ 27
 
key:
mov eax,2 ; Read key ascii and store it into ah
int 0x40
 
cmp ah,LEFT_KEY ; Check if left key is pressed
jne no_left
 
cmp byte[status],'1'
jne no_left
go_left:
dec dword [current_block_x]
call check_crash
jz no_left
inc dword [current_block_x]
 
no_left:
cmp ah,RIGHT_KEY ; Check if right key is pressed
jne no_right
 
cmp byte[status],'1'
jne no_right
go_right:
inc dword [current_block_x]
call check_crash
jz no_right
dec dword [current_block_x]
 
no_right:
cmp ah,UP_KEY ; Compare pressed key with up key
jne no_up ; Jump to nu_up if up key isnt pressed
 
cmp byte[status],'0' ; Check if menu is running
jne no_menu2 ; Jump to no_up ifgame isnt running
 
cmp byte[menu],'0' ; Compare menu state with 0
jne no_menu0 ; Jump to no_menu0 if menu state isnt zero
 
mov byte[menu],'3' ; Change menu state to 2
call draw_window ; Redraw the window
jmp no_menu2 ; Jump to no_menu2
 
no_menu0:
dec byte[menu] ; menu state = menu state - 1
call draw_window ; Redraw the window
 
no_menu2:
cmp byte[status],'1' ; Compare game state with 1
jne no_up ; Jump to no_up if game state isnt 1 (if game isnt running)
 
call rotate_block
 
no_up:
cmp ah,DOWN_KEY ; Check if down key is pressed
jne no_down
 
cmp byte[status],'0'
jne no_menu3
 
cmp byte[menu],'3'
jne no_menu1
 
mov byte[menu],'0'
call draw_window
jmp no_menu3
 
no_menu1:
inc byte[menu]
call draw_window
 
no_menu3:
cmp byte[status],'1'
jne no_down
 
inc dword [current_block_y]
call check_crash
jne block_crash
jmp still
 
 
no_down:
cmp ah,'n' ; Check if n key is pressed
jne no_n
jmp new_game
 
no_n:
cmp ah,'p' ; Check if p key is pressed
jne no_p
cmp byte[status],'2'
je unpause
cmp byte[status],'1' ; add this two line or p will work
jne no_p ; when your still in the menu
mov byte[status],'2'
call draw_window
jmp attesa
unpause:
mov byte[status],'1'
call draw_window
jmp still
 
no_p:
cmp byte[status],'0'
jne no_menu
 
no_menu:
cmp byte[status],'1'
jne no_game
 
no_game:
cmp byte[status],'2'
jne no_pause1
 
no_pause1:
cmp ah,ENTER_KEY ; Check if enter key is pressed
jne no_enter
cmp byte[status],'0'
jne no_enter
call exemenu
 
no_enter:
cmp ah,ESCAPE_KEY ; Check if escape key is pressed
jne no_escape
 
 
cmp byte[status],'0'
jne no_instr1
mov eax,-1
int 0x40
 
no_instr1:
cmp byte[status],'1'
jne no_menu4
mov byte[status],'0'
call draw_window
 
no_menu4:
cmp byte[status],'3'
jne no_menu5
mov byte[status],'0'
call draw_window
 
no_menu5:
cmp byte[status],'4'
jne no_escape
mov byte[status],'0'
call draw_window
 
no_escape:
 
cmp byte[status],'1'
jne still
jmp scendi
 
ret
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/macros.inc
0,0 → 1,265
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a { ; mike.dld
if ~a eq
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/menu.inc
0,0 → 1,137
draw_menu:
 
cmp byte[menu],'0'
jne menu1
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ffff00
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu1:
cmp byte[menu],'1'
jne menu2
 
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ffff00
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu2:
cmp byte[menu],'2'
jne menu3
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ffff00
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu3:
cmp byte[menu],'3'
jne menu4
 
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ffff00
mov edx,quit
mov esi,paused-quit
int 0x40
 
menu4:
 
 
ret
 
exemenu:
cmp byte[menu],'0' ;start
jne exemenu1
call new_game
 
exemenu1:
cmp byte[menu],'1' ;instr
jne exemenu2
mov byte[status],'4'
call draw_window
 
exemenu2:
cmp byte[menu],'2' ;history
jne exemenu3
mov byte[status],'3'
call draw_window
 
exemenu3:
cmp byte[menu],'3' ;exit
jne exemenu4
mov eax,-1
int 0x40
 
exemenu4:
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/mouse.inc
0,0 → 1,87
mouse:
 
 
mov eax,37 ; get mouse position ; EXPERIMENTAL !!!
mov ebx,1 ; window relative ;
int 0x40 ; ;
shr eax,16 ; we only need to know the x position ;
sub eax,X_LOCATION ;
;
cmp eax,ADOBE_SIZE*(LEN_X-2) ; check to see if mouse is in field ;
jg no_mouse ; ;
cmp eax,0 ; ;
jl no_mouse ; ;
;
mov ebx,0 ;
;
mouseloop: ;
cmp eax,ADOBE_SIZE ;
jl yes_mouse ;
sub eax,ADOBE_SIZE ;
inc ebx ;
jmp mouseloop ;
;
yes_mouse: ;
cmp ebx,[current_block_x]
jg go_right
jl go_left
; mov dword[current_block_x],ebx ;
 
mov eax,37 ; get mouse position ;
mov ebx,2 ; buttons pressed (1=left, 2=right, 3=both) ;
int 0x40 ;
;
cmp eax,0 ;
jne yes_mouse_button ;
mov byte[lastmousebutton],0 ;
jmp no_mouse ;
yes_mouse_button: ;
;
cmp eax,2 ;
jne no_left_mouse ;
cmp byte[status],'1' ;
jne no_left_mouse ;
mov byte[lastmousebutton],2 ;
inc dword [current_block_y] ;
call check_crash ;
jne block_crash ;
jmp no_mouse ;
;
no_left_mouse: ;
;
;
cmp eax,1 ;
jne no_right_mouse ;
cmp byte[status],'1' ;
jne no_right_mouse ;
cmp byte[lastmousebutton],1 ;
mov byte[lastmousebutton],1 ;
je no_right_mouse ;
call rotate_block ;
call check_crash ;
jne block_crash ;
call draw_block ;
jmp scendi ;
;
no_right_mouse: ;
;
;
cmp eax,3 ;
jne no_mouse ;
cmp byte[lastmousebutton],3 ;
mov byte[lastmousebutton],3 ;
je no_mouse ;
cmp byte[status],'2' ;
je unpause ;
mov byte[status],'2' ;
call draw_window ;
jmp attesa ;
; unpause: ;
; mov byte[status],'1' ;
; call draw_window ;
; jmp still ;
;
; ;
no_mouse: ;
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/random.inc
0,0 → 1,18
;--------------------------------------------------------------
 
random: mov eax,[generator]
add eax,-43ab45b5h
ror eax,1
xor eax,32c4324fh
ror eax,1
mov [generator],eax
; --- IVAN ---
push ebx
mov eax,22
mov ebx,9
int 0x40
pop ebx
xor eax,0xdeadbeef
add eax,[generator]
; --- IVAN ---
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/score.inc
0,0 → 1,100
write_score:
 
mov eax,13
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-3)*65536+95 ;clear box to write new score
mov ecx,20*65536+((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-20)
mov edx,0x00000000
int 40h
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,scoretext
mov esi,linestext-scoretext
mov eax,4
int 0x40
 
mov eax,[score]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,linestext
mov esi,speedtext-linestext
mov eax,4
int 0x40
 
mov eax,[lines]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,speedtext
mov esi,leveltext-speedtext
mov eax,4
int 0x40
 
mov eax,[speed]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,leveltext
mov esi,startgame-leveltext
mov eax,4
int 0x40
 
mov eax,[level]
call number_to_str
 
 
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
 
call draw_next_block
 
ret
 
 
number_to_str:
 
mov edi,end_number_str-1
mov ecx,9;size_of_number_str
mov ebx,10
cld
new_digit:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_digit
 
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/table.inc
0,0 → 1,56
;--------------------------------------------------------------
; DRAW_TABLE
;--------------------------------------------------------------
draw_table: mov esi,table_tetris+LEN_X*BORDER_TOP+BORDER_LEFT
 
mov ebx,X_LOCATION*65536+ADOBE_SIZE
mov ecx,Y_LOCATION*65536+ADOBE_SIZE
mov edi,LEN_Y-BORDER_TOP-BORDER_BOTTOM
y_draw: push edi
 
mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT
x_draw: push edi
mov ax,13
movzx edx,byte [esi]
mov edx,[color_table+edx*4]
int 0x40
call draw_frames
inc esi
add ebx,65536*ADOBE_SIZE
pop edi
dec edi
jnz x_draw
 
add esi,BORDER_LEFT+BORDER_RIGHT
mov ebx,X_LOCATION*65536+ADOBE_SIZE
add ecx,65536*ADOBE_SIZE
pop edi
dec edi
jnz y_draw
 
ret
 
;--------------------------------------------------------------
 
clear_table_tetris:
cld
mov al,1
mov edi,table_tetris
mov ecx,LEN_X*BORDER_TOP
rep stosb
 
mov edx,LEN_Y-BORDER_TOP-BORDER_BOTTOM
adr300: mov cl,BORDER_LEFT
rep stosb
dec ax ;AL=0
mov cl,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
inc ax ;AL=1
mov cl,BORDER_RIGHT
rep stosb
dec dx
jne adr300
 
mov ecx,LEN_X*BORDER_BOTTOM
rep stosb
ret
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/tetris.asm
0,0 → 1,253
; Date : 1st April 2001
; TETRIS for MENUET
; Author : Paolo Minazzi (email paolo.minazzi@inwind.it)
;
; -Note-
; 1. This program requires a PENTIUM or higher because uses the RDTSC
; instrucion for get a random number.
; 2. You must use NASM to compile. Compiling is OK with NASM 0.98, I
; don't know what happen with other versions.
; 3. You must use the arrow key to move and rotate a block.
; 4. In the near future there will be a new version of TETRIS. This is
; only the beginning.
;
; Thanks to Ville, the author of this wonderful OS !
; Join with us to code !
;
;
; Changelog:
;
; 28.06.2001 - fasm port & framed blocks - Ville Turjanmaa
; 31.10.2001 - rdtsc replaced - quickcode <quickcode@mail.ru>
; 03.11.2003 - added new blocks & random - Ivan Poddubny
;
 
LEN_X equ 14
LEN_Y equ 24
BORDER_LEFT equ 2
BORDER_RIGHT equ 2
BORDER_TOP equ 1
BORDER_BOTTOM equ 1
ADOBE_SIZE equ 12
X_LOCATION equ 6
Y_LOCATION equ 21
_MAXBLOCKS_ = 7*4
SCORE_TO_NEW_LEVEL equ 100000
 
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; program start
dd I_END ; program image size
dd IM_END ; reguired amount of memory
dd IM_END ; esp
dd 0x0,0x0 ; I_PARAM, I_ICON
include 'lang.inc'
START: ; start of execution
 
mov eax,3 ;
int 0x40 ;
mov cl,16 ;
ror eax,cl ; to make seconds more significant
mov [generator],eax ;
call random ;
 
mov byte[status],'0'
mov byte[menu],'0'
call draw_window ; at first, draw the window
 
still:
 
cmp byte[status],'2'
je attesa
 
cmp byte[status],'1'
 
jne attesa
xor edx,edx
 
call draw_block
 
 
attesa:
 
call mouse
;disabled because of bug
;EDIT: the bug is somewhere else..
;NOTE: dont release this without fixing the bug you lazy bastard!
 
mov eax,11 ; get event
int 0x40
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jnz check_button
jmp key
check_button:
cmp eax,3 ; button in buffer ?
jnz scendi
mov eax,-1 ; close this program
int 0x40
 
red: ; redraw
call draw_window
jmp still
 
parallel dd 1
 
scendi: cmp byte[status],'1'
jne still
 
cmp byte[blabla],10
je blabla_0
inc byte[blabla]
jmp blabla_1
blabla_0:
mov byte[blabla],0
inc dword [current_block_y]
call check_crash
jne block_crash
blabla_1:
 
 
draw: movzx edx,byte [current_block_color]
call draw_block
mov eax,5
mov ebx,5
sub ebx,[speed]
int 0x40
jmp still
 
block_crash: dec dword [current_block_y]
movzx edx,byte [current_block_color]
call draw_block
call fix_block
call check_full_line
call draw_table
call new_block
call write_score
call check_crash
jz adr400
aspetta: mov eax,10
int 0x40
cmp eax,1
jne adr10000
call draw_window
adr10000: cmp eax,3
jne aspetta
 
new_game: mov dword [score],0
mov dword [lines],0
mov dword [level],0
mov dword [speed],0
mov byte [status],'1'
call clear_table_tetris
call first_block
call new_block
call draw_window
 
adr400: movzx edx,byte [current_block_color]
call draw_block
jmp still
 
include 'key.inc'
include 'mouse.inc'
include 'menu.inc'
include 'window.inc'
include 'block.inc'
include 'table.inc'
include 'random.inc'
include 'score.inc'
 
; DATA AREA
 
include 'blocks.inc'
 
labelt: db 'TETRIS II'
scoretext: db 'Score:'
linestext: db 'Lines:'
speedtext: db 'Speed:'
leveltext: db 'Level:'
startgame: db 'START'
instr: db 'INSTRUCTIONS'
hist: db 'HISTORY'
quit: db 'EXIT'
paused: db 'PAUSED'
txt_end:
 
history:
db 'TETRIS for MENUET v2.0 '
db ' '
db ' '
db 'Originally made '
db ' by Paolo Minazzi '
db ' '
db 'Port & framed blocks '
db ' by Ville Turjanmaa '
db ' '
db 'RDTSC replaced '
db ' by quickcode '
db ' '
db 'New blocks & better random '
db ' by Ivan Poddubny '
db ' '
db 'Better control, logo, menu, pause '
db ' by Jeffrey Amelynck'
 
db 'x <- END MARKER, DONT DELETE '
 
instructions:
db 'TETRIS for MENUET v2.0 '
db ' '
db 'Controls: '
db ' '
db 'Use left & right key to navigate '
db 'Use up key to turn the block '
db 'Use down key to make block fall '
db 'Use P to pause game '
db 'Use N to start a new game '
db 'Use ESC to go back to menu or exit'
db 'You can also use the mouse to move'
db 'the blocks, left button to let the'
db 'blocks fall and right button to '
db 'rotate them '
db 'you can pause the game by pressing'
db 'both mouse buttons '
db ' '
db 'DONT FORGET: move mouse out of the'
db 'window if you want to use keyboard'
 
db 'x <- END MARKER, DONT DELETE '
 
I_END:
 
score: dd 0
level: dd 0
speed: dd 0
lines: dd 0
TMP_0: dd 0
TMP_1: dd 0
generator: dd 0
current_block_x: dd 0
current_block_y: dd 0
current_block_pointer: dd 0
current_block_color: db 0
next_block_pointer: dd 0
next_block_color: db 0
blabla dd 0
lastmousebutton dd 0
number_str: db 0,0,0,0,0,0,0,0,0
end_number_str:
size_of_number_str dd 7
delay: dd 5
status: dd 0 ; 0=menu, 1=playing, 2=paused, 3=history , 4=instructions
menu: dd 0 ; 0=start, 1=instructions, 2=history, 3=exit
 
table_tetris: rb 2048+55
 
IM_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/games/tetris/trunk/window.inc
0,0 → 1,142
draw_window:
 
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98
mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+4
mov edx,0x03000000 ; color of work area RRGGBB
mov esi,0x006688ee ; color of grab bar RRGGBB,8->col
mov edi,0x007799ff ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+5 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,scoretext-labelt ; text length
int 0x40
 
cmp byte[status],'0'
jne status1
call draw_logo
call draw_menu
 
status1:
cmp byte[status],'1'
jne status2
 
call draw_game
 
status2:
cmp byte[status],'2'
jne status3
 
call draw_game
 
mov eax,4 ; function 4 : write text to window
mov ebx,80*65536+170 ; [x start] *65536 + [y start]
mov ecx,0x10ff0000 ; color of text RRGGBB
mov edx,paused ; pointer to text beginning
mov esi,txt_end-paused ; text length
int 0x40
 
status3:
cmp byte[status],'3'
jne status4
 
call draw_logo
mov edx,history
call show_text
 
status4:
cmp byte[status],'4'
jne status5
 
call draw_logo
mov edx,instructions
call show_text
 
status5:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
draw_game:
 
call draw_table
movzx edx,byte [current_block_color]
call draw_block
 
call write_score
 
mov eax,38
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4) shl 16 + ((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4)
mov ecx,20 shl 16 + ((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+2-4)
mov edx,0x00ffffff
int 0x40
 
ret
 
draw_logo:
 
mov ebx,2
mov ecx,2
mov edx,[color_table+1*4]
mov edi,tetris_t
call draw_title_block
mov ebx,5
mov ecx,3
mov edx,[color_table+2*4]
mov edi,tetris_e
call draw_title_block
mov ebx,8
mov ecx,2
mov edx,[color_table+3*4]
mov edi,tetris_t
call draw_title_block
mov ebx,11
mov ecx,3
mov edx,[color_table+4*4]
mov edi,tetris_r
call draw_title_block
mov ebx,13
mov ecx,2
mov edx,[color_table+5*4]
mov edi,tetris_i
call draw_title_block
mov ebx,15
mov ecx,3
mov edx,[color_table+6*4]
mov edi,tetris_s
call draw_title_block
mov ebx,20
mov ecx,2
mov edx,[color_table+7*4]
mov edi,tetris_II
call draw_title_block
 
ret
 
show_text:
mov ebx,6*65536+120 ; draw info text with function 4
mov ecx,0xff0000
mov esi,34
newline:
mov eax,4
int 0x40
add ebx,10
add edx,34
cmp [edx],byte 'x'
jne newline
ret
 
 
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property