Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 6217 → Rev 6218

/programs/games/almaz/ALMAZ.ASM
0,0 → 1,2174
 
WND_COLOR equ 0x02aa00FF
 
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x300000
dd 0x27fff0
dd 0x0
dd 0x0
 
include 'lang.inc'
include '..\..\macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
 
include 'ASCL.INC'
include 'ASCGL.INC'
 
 
 
gif_hash_offset = gif_hash_area
COLOR_ORDER equ MENUETOS
 
DELAY equ 2 ; ‡ ¤¥à¦ª  ¯¥à¥¤ ¯¥à¥å®¤®¬ ª á«¥¤ãî饬㠪 ¤àã ¢ ¬á¥ª
 
START:
;****************
; Žâªà뢠¥¬ ä ¨«
;****************
openfile:
; and [entered],0
; mov ecx,499*3*4 ;at start
xor ecx,ecx
mov ecx,1
 
; Convert gif to animation format
giftoani workarea,Image,ecx
bmptoimg bullet_bmp, img_bullet
bmptoimg level_bmp, img_level
bmptoimg kirpich, img_area
bmptoimg kirpich2, img_area2
bmptoimg kirpich3, img_area3
bmptoimg lest_bmp, img_lestniza
bmptoimg water1_bmp, img_water1
bmptoimg water2_bmp, img_water2
bmptoimg door1_bmp, img_door1
bmptoimg door2_bmp, img_door2
 
 
red:
call timer
call draw_window
; call load_level
; delay 200
 
still:
timeevent DELAY,no_event, red, key, button
 
no_event:
call draw_subimage
jmp still
 
key:
; ¡«®ª  ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
mov eax,2
int 0x40
cmp ah, 179 ; ¯à ¢® 4
je go_mov
cmp ah, 176 ; «¥¢® 1
je go_mov
cmp ah, 178 ; ¢¥àå 3
je go_mov
cmp ah, 177 ; ­¨§ 2
je go_mov
cmp ah, 120 ; ­¨§ 2
je go_fire
cmp ah, 122 ; ­¨§ 2
je go_fire
cmp ah, 239 ; ­¨§ 2
je go_fire_left
cmp ah, 231 ; ­¨§ 2
je go_fire
 
 
jmp no_mov ; if not left, right, up, down, then go NO MOV
 
go_mov:
;mov ebx, [v_mov2]
mov [v_mov2], ah
sub word [v_mov2], 175 ; ®â­¨¬ ¥¬ ®â ª®¤  ª« ¢¨è¨ 175 ¨ ®áâ ¥âáï 1,2,3 ¨«¨ 4 ᮮ⢥âá⢥­­® ­ ¯à ¢«¥­¨ï ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
jmp no_mov ; if not left, right, up, down, then go NO MOV
 
go_fire_left:
xor eax,eax
mov ah, 122
call fire
jmp no_mov
go_fire:
call fire
no_mov:
; ª®­¥æ ¡«®ª  ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
jmp still
 
button:
mov eax, 17
int 0x40
 
cmp ah,1
jne noclose
_close:
or eax,-1
int 0x40
noclose:
jmp still
 
; *********************************************
; ******* Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€ *******
; *********************************************
 
draw_window:
startwd
 
mov eax,0
mov ebx,50*65536+522
mov ecx,50*65536+536
mov edx,WND_COLOR
mov esi,0x8050FFd0
mov edi,0x005080d0
int 0x40
 
label 8,6,'Ž„‡…Œ…‹œ… ¤«ï Š®«¨¡à¨ Ž‘ <<<RU095@YANDEX.RU>>> z/x áâ५ïâì',cl_White+font_Big
 
mov eax,8
mov ebx,(500)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x000000
int 0x40
 
xor ecx,ecx
call draw_subimage
cmp [imgcount],1
je .enddraw
 
mov ecx,[img_index]
 
call draw_subimage
 
.enddraw:
 
endwd
 
 
ret
 
;*******************************************
; LABIRINT
;*******************************************
 
labirint:
 
; ¢ë¢®¤ ¡«®ª®¢ « ¡¨à¨­â 
cycle:
 
mov eax, [Lab]
shl eax, 5 ; ᤢ¨£ ॣ¨áâà  ¢ ¯à ¢® ­  5 ¯®§¨æ¨¨ ¢á¥ à ¢­® ç⮠㬭®¦¨«¨ ­  32
mov [perem1], eax
mov eax, [Lab]
shr eax, 4 ; ᤢ¨£ ॣ¨áâà  ¢ «¥¢®
shl eax, 5 ; ᤢ¨£ ®¡à â­® (¢á¥ à ¢­® ç⮠楫®ç¨á«¥­­®¥ ¤¥«¥­¨¥­  256)
mov [perem2], eax
shl eax, 4 ; ¢á¥ à ¢­® çâ® ®â­¨¬ ¥¬ ®â ª®®à¤¨­ â ­¥­ã¦­ë© ¯à¨à®áâ -> “-256*X
sbb dword [perem1], eax;
 
mov ebx, [Lab]
sbb ebx, 1
mov eax,[Dangeon + ebx] ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
 
cmp ah, 1 ;
je go_block
 
cmp ah, 0 ;
je back_block
 
cmp ah, 12 ; § ªà áª  ä®­  §   «¬ §®¬
je back_block
 
cmp ah, 3 ;
je boom_block
 
cmp ah, 16 ;
je door_block
 
cmp ah, 2 ; § ªà áª  ä®­  §   «¬ §®¬
je cool_block
 
jmp end_block
go_block:
imgtoimg img_area,dword [perem1],dword [perem2],canvas
jmp end_block
 
cool_block:
imgtoimg img_area3,dword [perem1],dword [perem2],canvas
jmp end_block
 
 
back_block:
imgtoimg img_area2,dword [perem1],dword [perem2],canvas
jmp end_block
 
door_block:
imgtoimg img_door1,dword [perem1],dword [perem2],canvas
 
mov eax, [gold]
cmp ax, 10 ; ¥á«¨ ᮡ࠭® ¡®«¥¥ 10  «¬ §®¢ ¤¢¥àì ®âªàëâ 
jna end_block
imgtoimg img_door2,dword [perem1],dword [perem2],canvas
jmp end_block
 
 
boom_block:
imgtoimg img_area,dword [perem1],dword [perem2],canvas
mov ebp,18 ; ª ¤à
mov eax, dword [perem1]
mov dword [X_anime], eax
mov eax, dword [perem2]
mov dword [Y_anime], eax
call animashka
 
mov ecx, [timer1] ;
and ecx, 15
cmp ecx, 0
jne end_block
 
mov ebx, [Lab]
mov byte [Dangeon + ebx], 0 ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
 
 
end_block:
 
add word [Lab],1
mov eax, [Lab]
 
cmp eax, 256 ; if eax == 0
je cycle_end ; jump to cycle_end:
jmp cycle ;
 
cycle_end:
 
mov eax, 0
mov [Lab],eax
 
ret ; END labirint
 
 
;*******************************************
; ‹…‘’ˆ–€
;*******************************************
lestniza:
; ¢ë¢®¤ ¡«®ª®¢ « ¡¨à¨­â 
cycle2:
 
mov eax, [Lab]
shl eax, 5 ; ᤢ¨£ ॣ¨áâà  ¢ ¯à ¢® ­  5 ¯®§¨æ¨¨ ¢á¥ à ¢­® ç⮠㬭®¦¨«¨ ­  32
mov [perem1], eax
mov eax, [Lab]
shr eax, 4 ; ᤢ¨£ ॣ¨áâà  ¢ «¥¢®
shl eax, 5 ; ᤢ¨£ ®¡à â­® (¢á¥ à ¢­® ç⮠楫®ç¨á«¥­­®¥ ¤¥«¥­¨¥­  256)
mov [perem2], eax
shl eax, 4 ; ¢á¥ à ¢­® çâ® ®â­¨¬ ¥¬ ®â ª®®à¤¨­ â ­¥­ã¦­ë© ¯à¨à®áâ -> “-256*X
sbb dword [perem1], eax;
 
 
mov ebx, [Lab]
sbb ebx, 1
mov eax,[Dangeon + ebx] ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
 
cmp ah, 8 ;
je go_lestniza
 
jmp end_lestniza
go_lestniza:
 
imgtoimg img_lestniza,dword [perem1],dword [perem2],canvas
end_lestniza:
 
add word [Lab],1
mov eax, [Lab]
 
cmp eax, 256 ; if eax == 0
je cycle2_end ; jump to cycle_end:
jmp cycle2 ;
 
cycle2_end:
 
mov eax, 0
mov [Lab],eax
 
 
ret ; END lestniza
 
 
 
;*******************************************
; ‚Ž„€ ¨ €‹Œ€‡›
;*******************************************
water:
 
; ¢ë¢®¤ ¢®¤ë « ¡¨à¨­â 
cycle3:
 
mov eax, [Lab]
shl eax, 5 ; ᤢ¨£ ॣ¨áâà  ¢ ¯à ¢® ­  5 ¯®§¨æ¨¨ ¢á¥ à ¢­® ç⮠㬭®¦¨«¨ ­  32
mov [perem1], eax
mov eax, [Lab]
shr eax, 4 ; ᤢ¨£ ॣ¨áâà  ¢ «¥¢®
shl eax, 5 ; ᤢ¨£ ®¡à â­® (¢á¥ à ¢­® ç⮠楫®ç¨á«¥­­®¥ ¤¥«¥­¨¥­  256)
mov [perem2], eax
shl eax, 4 ; ¢á¥ à ¢­® çâ® ®â­¨¬ ¥¬ ®â ª®®à¤¨­ â ­¥­ã¦­ë© ¯à¨à®áâ -> “-256*X
sbb dword [perem1], eax;
 
 
mov ebx, [Lab]
sbb ebx, 1
mov eax,[Dangeon + ebx] ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
 
cmp ah, 4 ;
je go_water
 
cmp ah, 12 ; à¨á®¢ ­¨¥  «¬ §®¢
je go_almaz
 
jmp end_water
go_water:
mov eax,0 ;
mov eax, [timer1];
and eax, 15
cmp eax, 7 ;
jb go_water2
 
imgtoimg img_water1,dword [perem1],dword [perem2],canvas
jmp end_water
 
go_water2:
imgtoimg img_water2,dword [perem1],dword [perem2],canvas
 
jmp end_water
go_almaz:
 
mov eax,0 ;
mov eax, [timer1];
and eax, 31
 
cmp eax, 10
ja almaz2
 
mov ebp,14 ; ª ¤à
mov eax, dword [perem1]
mov dword [X_anime], eax
mov eax, dword [perem2]
mov dword [Y_anime], eax
call animashka
jmp end_water
 
almaz2:
cmp eax, 20
ja almaz3
 
mov ebp,15 ; ª ¤à
mov eax, dword [perem1]
mov dword [X_anime], eax
mov eax, dword [perem2]
mov dword [Y_anime], eax
call animashka
jmp end_water
 
almaz3:
mov ebp,16 ; ª ¤à
mov eax, dword [perem1]
mov dword [X_anime], eax
mov eax, dword [perem2]
mov dword [Y_anime], eax
call animashka
 
 
end_water:
 
add word [Lab],1
mov eax, [Lab]
 
cmp eax, 256 ; if eax == 0
je cycle3_end ; jump to cycle_end:
jmp cycle3 ;
 
cycle3_end:
 
mov eax, 0
mov [Lab],eax
 
 
ret ; END water
 
 
;*******************************************
; ‚뢮¤¨¬ á«¥¤ãî騩 ª ¤à ¨§ ᯨ᪠ ª à⨭®ª
;*******************************************
draw_subimage:
;aframetoimg Image,32, 32,canvas,0x00ffffff ; …‚ˆ„ˆŒ›‰, ¯à®§à ç­ë© –‚…’ ˆ‹ˆ … ˆ‘“…Œ›‰
 
call labirint
call lestniza
call enemy_mas
call enemy_mov
;-------------------------------------------------------------------------------
mov ebx, [gold]
cmp bx, 5 ;㢥«¨ç¥­¨¥ ᪮à®á⨠¢à £®¢ ¥á«¨ ãªà « ¡®«¥¥ 9
jna lov_velo
call enemy_mas
call enemy_mov
lov_velo:
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
mov ebx, [gold]
cmp bx, 9 ;㢥«¨ç¥­¨¥ ᪮à®á⨠¢à £®¢ ¥á«¨ ãªà « ¡®«¥¥ 9
jna lov_velo2
call enemy_mas
call enemy_mov
lov_velo2:
;-------------------------------------------------------------------------------
; call enemy_mas
; call enemy_mov
call hiro
call hiro_mov
call water
 
call bullet_mov
call bullet_mov
call bullet_mov
call bullet_mas
call bullet_mov
call bullet_mov
call bullet_mov
call bullet_mas
call proverka_gold
call potop
 
setimg 6,20,canvas
 
call timer
call tablo
ret
 
;@@@@@@@@@@@@@@@@@@
animashka:
;!!!‚€†Ž ¯¥à¥¤ ¢ë§®¢®¬ ¯à®æ¥¤ãàë ¤®«¦¥­ ¡ëâì ãáâ ­®¢«¥­ ebx[­®¬¥à ª ¤à ] ¨ x,y
 
mov edi,coords
mov esi, Image ; £¨ä  ­¨¬ èª  ¢ ¯ ¬ïâ¨
;
; mov ebp, dword [edi+8] ;ecx §¤¥áì ª®­ªà¥â­ë© ­®¬¥à ¢ë¢®¤¨¬®£® ª ¤à 
; inc ebp ; 㢥«¨ç¥­¨¥ ª ¤à 
; cmp ebp,3 ; ¬ ªá¨¬ «ì­®¥ ª®«¨ç¥á⢮ ª ¤à®¢ !!!!!!!
; jna ok_fr ; ¥á«¨ ¢ë¢®¤¨¬ë ª ¤à ¬¥­ìè¥ ¬ ªá¨¬ «ì­®£® ª®«¨ç¥á⢠ ª ¤à®¢
;!!!!!!!!! mov ebp,2 ;®¡­ã«¥­¨¥ ª ¤à 
 
ok_fr:
mov dword [edi+8], ebp ;­®¬¥à ¢ë¢®¤¨¬®£® ª ¤à 
loo:
cmp ebp,0 ; ¥á«¨ ª ¤à ­ã«¥¢®© â® áࠧ㠭  ¢ë¢®¤ ?
je setpic
movzx eax,word [esi+4] ; ¥á«¨ ­¥â ⮠㢥«¨ç¨¢ ¥¬ å ã ?
movzx ebx,word [esi+6]
mul ebx ;dword [esi+4] 㬭®¦ ¥â ebx ­  eax ¨ १ã«ìâ â ¢ eax edx
mov ebx,3 ; ª®«¨ç¥á⢮ ª ¤à®¢ ???
mul ebx
add eax,8
add esi,eax
dec ebp
jmp loo
setpic:
 
pushad
; aframetoimg esi,dword [edi], dword [edi+4],canvas,0x00ffffff ; …‚ˆ„ˆŒ›‰, ¯à®§à ç­ë© –‚…’ ˆ‹ˆ … ˆ‘“…Œ›‰
; aframetoimg esi,32, 32,canvas,0x00ffffff ; …‚ˆ„ˆŒ›‰, ¯à®§à ç­ë© –‚…’ ˆ‹ˆ … ˆ‘“…Œ›‰
aframetoimg esi,dword [X_anime],dword [Y_anime],canvas,0x00ffffff ; …‚ˆ„ˆŒ›‰, ¯à®§à ç­ë© –‚…’ ˆ‹ˆ … ˆ‘“…Œ›‰
;call enemy_mas
popad
ret
;@@@@@@@@@@@@@@
 
 
;-------------- TIMER --------------
timer:
mov eax,0 ;
mov eax,[timer1] ;
add eax, 1;
mov [timer1], eax
 
cmp eax, 64 ; â ©¬¥à ®â 0 ¤® 64
je nul_timer
jmp timer_dalee
nul_timer :
mov [timer1], 0
timer_dalee:
ret
;-------------- TIMER --------------
 
 
 
 
 
;*******************************************
; ENEMY
;*******************************************
 
enemy_mas: ; ¢ë¢®¤ ENEmy ENEMYYYYYYYYYYYYYYY ENEMYYYYYYYYYYYYYY !!!
 
mov word [Lab2], 0 ; ¢á¥ ¤¥« âì ¢ WORD ®¤¨­ í«¥¬¥­â ¢ ¬ áᨢ¥ +2 á«¥¤ãî騩 ¢à £ á®®â¢â¥âá⢥­­® 6*2= + 12
 
cycle4:
 
mov ebx, 0
mov ecx, 0
mov edx, 0
mov esi, 0
 
mov word bx, [Lab2]
mov word ax,[Enemy+bx] ; ¡¥à¥â ¡ ©â ¨§ Enemy + ᬥ饭¨¥
 
cmp ax, 1 ; ®¡ëç­ë© ¢à £ ­®¬¥à 1
je go_enemy
 
jmp end_enemy
go_enemy:
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + bx]
mov word [X_enemy], ax
 
add word bx, 2 ; Y ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [Y_enemy], ax
 
add word bx, 2 ; ¯®«®¦¥­¨¥ ¢ ¬ áᨢ¥ ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [lab_enemy], ax
 
add word bx, 2 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [mov_enemy], ax
 
add word bx, 2 ; enemy LIFE
mov word ax, [Enemy + ebx]
mov word [life_enemy], ax
 
cmp ax, 499; ; § ¬®à®¦¥­­ë¥ ¢à £¨
ja enemy_dalee
mov ebp,2 ; ª ¤à
mov eax, dword [X_enemy]
mov dword [X_anime], eax
mov eax, dword [Y_enemy]
mov dword [Y_anime], eax
call animashka
jmp enemy_bmp_end
 
 
 
enemy_dalee:
xor eax,eax ;
mov eax, [X_enemy] ;
and eax, 15
cmp ax, 7;
ja enemy_1
 
jmp enemy_2
 
enemy_1:
 
mov ebp,0 ; ª ¤à
mov eax, dword [X_enemy]
mov dword [X_anime], eax
mov eax, dword [Y_enemy]
mov dword [Y_anime], eax
call animashka
 
jmp enemy_bmp_end
 
enemy_2:
mov ebp,1 ; ª ¤à
mov eax, dword [X_enemy]
mov dword [X_anime], eax
mov eax, dword [Y_enemy]
mov dword [Y_anime], eax
call animashka
enemy_bmp_end:
 
end_enemy:
 
mov eax, 0
mov word ax, [Lab2]
 
cmp ax, 96 ; if eax == 0
je cycle4_end ; jump to cycle_end:
 
add word [Lab2],12
 
jmp cycle4 ;
 
cycle4_end:
 
ret ; END eNEMYYYYYYYYYYYYYYY ENEMYYYYYYYYYYYYYY !!!
 
;$$$$$$$$$$$$$$$$$$$$$$$$$$
; ENEMY MOV
;$$$$$$$$$$$$$$$$$$$$$$$$$$
enemy_mov:
mov word [Lab2], 0 ; ¢á¥ ¤¥« âì ¢ WORD ®¤¨­ í«¥¬¥­â ¢ ¬ áᨢ¥ +2 á«¥¤ãî騩 ¢à £ á®®â¢â¥âá⢥­­® 6*2= + 12
 
cycle5:
 
mov ebx, 0
mov ecx, 0
mov edx, 0
mov esi, 0
 
mov word bx, [Lab2]
mov word ax,[Enemy+bx] ; ¡¥à¥â ¡ ©â ¨§ Enemy + ᬥ饭¨¥
 
cmp ax, 1 ; ®¡ëç­ë© ¢à £ ­®¬¥à 1
je go_mov_enemy
 
jmp end_mov_enemy
go_mov_enemy:
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + bx]
mov word [X_enemy], ax
 
add word bx, 2 ; Y ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [Y_enemy], ax
 
add word bx, 2 ; ¯®«®¦¥­¨¥ ¢ ¬ áᨢ¥ ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [lab_enemy], ax
 
add word bx, 2 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word ax, [Enemy + ebx]
mov word [mov_enemy], ax
 
add word bx, 2 ; enemy LIFE
mov word ax, [Enemy + ebx]
mov word [life_enemy], ax
 
cmp ax, 499; ; § ¬®à®¦¥­­ë¥ ¢à £¨
ja dalee_enemy_mov
add ax, 1
 
mov word [Enemy + ebx], ax
 
jmp end_mov_enemy
 
dalee_enemy_mov:
; ¡«®ª ¯®¥¤ ­¨ï £¥à®ï
mov ax, [Xpl]
add ax, 23
cmp ax, [X_enemy]
jna ne_em
sbb ax, 45
cmp ax, [X_enemy]
ja ne_em
mov ax, [Ypl]
add ax, 23
cmp ax, [Y_enemy]
jna ne_em
sbb ax, 45
cmp ax, [Y_enemy]
ja ne_em
call load_level ; DEAD HIRO
delay 150
 
ne_em:
;«®ª ¯®¯ ¤ ­¨ï 1 ¯ã«¨
 
mov word bx, 0
mov word ax,[Bullet + ebx]
cmp ax, 0
je no_bullet
 
add word bx, 2 ; [Xpl]
mov word cx, [Bullet + ebx]
 
add word bx, 2 ; [Ypl]
mov word dx, [Bullet + ebx]
 
cmp dx, [Y_enemy]
jna no_bullet
sbb dx, 32
cmp dx, [Y_enemy]
ja no_bullet
cmp cx, [X_enemy]
jna no_bullet
sbb cx, 32
cmp cx, [X_enemy]
ja no_bullet
mov word bx, [Lab2]
add word bx, 10 ; enemy LIFE
mov word [Enemy + ebx],0
 
mov byte [Bullet], 0 ;
 
no_bullet:
 
 
;‹ŽŠ ˆŽ‘’€ „‚ˆ†…ˆŸ ‚€ƒŽ‚
mov word ax, [mov_enemy] ;
cmp ax, 1 ; left ;
jne next_2 ;
sbb word [X_enemy], 1 ;
mov word ax, [X_enemy] ;
mov word bx, [Lab2] ;
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;
next_2: ;
cmp ax, 2 ; down ;
jne next_3 ;
add word [Y_enemy], 1 ;
mov word ax, [Y_enemy] ;
mov word bx, [Lab2] ;
add word bx, 4 ; Y ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;
next_3: ;
cmp ax, 3 ; up ;
jne next_4 ;
sbb word [Y_enemy], 1 ;
mov word ax, [Y_enemy] ;
mov word bx, [Lab2] ;
add word bx, 4 ; Y ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;
next_4: ;
cmp ax, 4 ; right ;
jne next_end
 
;ƒà ¢¨â æ¨®­­ ï § ¯« âª  «¥ç¨â âà ¡« - ª®£¤  ¢à £ ¤¢¨£ ¥âáï á«¥¢  ­  ¯à ¢® â® ¯à®«¥â ¥â ®¤¨­ ¯ãá⮩ ¡«®ª
mov word bx, [X_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp bx, 0 ;
jne n4_dalee ;
mov bx,[lab_enemy]
add bx,16
mov ax, [Dangeon + bx]
and eax,15
cmp word ax, 0
je next_end
cmp word ax, 4
je next_end
;ª®­¥æ § ¯« âª¨
 
n4_dalee:
;
add word [X_enemy], 1 ;
mov word ax, [X_enemy] ;
mov word bx, [Lab2] ;
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;
next_end:
;END ‹ŽŠ ˆŽ‘’€ „‚ˆ†…ˆŸ ‚€ƒ
 
;
 
;  ­¤®¬­ë© ¢ë¡®à ­  «¥á­¨æ¥
mov word bx, [X_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp bx, 0 ;
jne end_les ;
mov word bx, [Y_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp bx, 0 ;
jne end_les ;
 
random 300, eax
 
cmp eax, 150
ja les2
jmp end_up_or_down
les2:
 
mov eax, [Ypl]
cmp eax, [Y_enemy]
jna bolee
mov word [mov_enemy],2 ; ¢­¨§
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
jmp end_les
 
bolee:
mov word [mov_enemy],3 ; up
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
jmp end_les
 
end_up_or_down:
 
random 300, eax
cmp eax, 150
ja les22
jmp end_les
les22:
 
mov eax, [Xpl]
cmp eax, [X_enemy]
jna bolee2
mov word [mov_enemy],4 ; ¢­¨§
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
jmp end_les
 
bolee2:
mov word [mov_enemy],1 ; up
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
 
end_les:
; end  ­¤®¬­ë© ¢ë¡®à ­  «¥á­¨æ¥
 
;ƒà ¢¨â æ¨ï
mov word bx, [X_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp bx, 0 ;
jne end_grava ;
 
mov bx,[lab_enemy]
add bx,16
mov ax, [Dangeon + bx]
 
and eax,15
cmp word ax, 0
je grava
cmp word ax, 4
je grava
jmp end_grava
grava:
mov word [mov_enemy], 2 ; padenie ‚€ƒ€
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
 
end_grava:
;ª®­¥æ £à ¢¨â æ¨¨
 
;¡«®ª à áç¥â  ¯®«®¦¥­¨ï ¢à £  ¢ « ¡¨à¨­â¥
mov eax, 0 ;
mov eax, [Y_enemy] ;
shr eax, 5 ;
shl eax, 4 ;
mov ebx, 0 ;
mov ebx, [X_enemy] ;
shr ebx, 5 ;
add eax, ebx ;
mov [lab_enemy], eax ;
mov word bx, [Lab2] ;
add word bx, 6 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;¡«®ª à áç¥â  ¯®«®¦¥­¨ï ¢à £  ¢ « ¡¨à¨­â¥
 
 
 
 
 
 
;‹ŽŠ ‡€…’€ „‚¨¦¥­¨ï
mov word bx, [Y_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and bx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp bx, 0 ;
jne end_zapret ;
mov word ax, [X_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ax, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp ax, 0 ;
jne end_zapret ;
 
mov word ax, [mov_enemy] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
 
cmp ax, 0
jne duma1
;  ­¤®¬­ë© ¢ë¡®à ¤¢¨¦¥­¨ï
mov eax, [timer1]
and eax, 3
cmp eax, 0
jne dalee_duma1
add eax, 4
dalee_duma1:
 
mov word [mov_enemy], ax ;
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
 
 
 
duma1:
cmp ax, 4
jne duma2 ; ¯à¢¥àª  á¯à ¢ 
mov bx,[lab_enemy]
add bx,1
mov ax, [Dangeon + bx]
and eax,3
cmp ax, 0
jne duma_stop
jmp duma_end
 
duma2:
cmp ax, 1
jne duma3 ; á«¥¢ 
mov bx,[lab_enemy]
sbb bx,1
mov ax, [Dangeon + bx]
and eax,3
cmp ax, 0
jne duma_stop
jmp duma_end
 
duma3:
cmp ax, 2
jne duma4 ; á­¨§ã
mov bx,[lab_enemy]
add bx,16
mov ax, [Dangeon + bx]
and eax,3
cmp ax, 0
jne duma_stop
jmp duma_end
 
duma4:
cmp ax, 3
jne duma_stop ; ᢥàåã
 
mov bx,[lab_enemy] ; ¥á«¨ ª¨à¯¨ç ­ ¤ £®«®¢®©
sbb bx,16
mov ax, [Dangeon + bx]
and eax,3
cmp ax, 0 ; ¥á«¨ ª¨à¯¨ç ­ ¤ £®«®¢®©
jne duma_stop
 
mov bx,[lab_enemy] ; ¥á«¨ ¢à £ ­¥ ­  «¥á­¨æ¥
mov ax, [Dangeon + bx]
and eax,15
cmp ax, 8
jne duma_stop
 
jmp duma_end
 
duma_stop:
 
mov word [mov_enemy], 0 ; Ž‘’€Ž‚Š€ ‚€ƒ€
mov word ax, [mov_enemy] ;
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
 
duma_end:
 
end_zapret:
;ª®­¥æ § ¯à¥â 
 
end_mov_enemy:
 
mov eax, 0
mov word ax, [Lab2]
 
cmp ax, 96 ; if eax == 0
je cycle5_end ; jump to cycle_end:
 
add word [Lab2],12
 
jmp cycle5 ;
 
cycle5_end:
 
 
ret
 
;*****************************
; HIRO
;*****************************
 
hiro:
 
mov ecx, [v_fire] ;áâ५졠
cmp ecx, 0
je next_anima
cmp ecx, 1
je wprawo
mov ebp,12 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
mov ecx, [timer1] ;áâ५졠
and ecx, 15
cmp ecx, 0
jne end_hiro
mov dword [v_fire], 0
jmp end_hiro
 
wprawo:
mov ebp,11 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
mov ecx, [timer1] ;áâ५졠
and ecx, 15
cmp ecx, 0
jne end_hiro
mov dword [v_fire], 0
jmp end_hiro
 
;áâ५졠
jmp end_hiro
 
next_anima:
mov eax, [v_mov]
cmp eax, 1
jne next_r
mov eax,0 ;
mov eax, [Xpl];
and eax, 15
cmp eax, 7 ;
ja next_l1
 
mov ebp,3 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
jmp end_hiro
 
next_l1:
mov ebp,5 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
pusha
mcall 55, eax, , , Music_mov ; §¢ãª ¢ëáâ५ 
popa
 
jmp end_hiro
 
next_r:
cmp eax, 4
jne next_d
 
mov eax,0 ;
mov eax, [Xpl];
and eax, 15
cmp eax, 7 ;
ja next_d1
 
mov ebp,4 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
 
pusha
mcall 55, eax, , , Music_mov ; §¢ãª ¢ëáâ५ 
popa
jmp end_hiro
 
next_d1:
mov ebp,6 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
 
jmp end_hiro
 
next_d:
cmp eax, 2
jne next_u
mov ebp,13 ; ª ¤à
mov eax, [temp2]
cmp eax, 8
jne padaem
mov ebp,10 ; ª ¤à
padaem:
mov eax, [temp5]
cmp eax, 8
jne padaem2
mov ebp,10 ; ª ¤à
padaem2:
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
jmp end_hiro
 
next_u:
cmp eax, 3
jne next_s
mov eax,0 ;
mov eax, [Ypl];
and eax, 15
cmp eax, 7 ;
ja next_u1
 
mov ebp,10 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
jmp end_hiro
 
next_u1:
mov ebp,9 ; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
 
jmp end_hiro
 
next_s:
cmp eax, 0
jne next_s
mov ebp,17; ª ¤à
mov eax, dword [Xpl]
mov dword [X_anime], eax
mov eax, dword [Ypl]
mov dword [Y_anime], eax
call animashka
jmp end_hiro
 
end_hiro:
 
ret ; END Hiro
;**************
; end HIRO
;**************
 
 
;****************
; Hiro MOV
;****************
hiro_mov:
 
;…ƒ€„
 
; ¢ëç¨á«¥­¨¥ á®á¥¤­¨å ¡«®ª®¢
mov ebx, [hiro_lab]
sbb ebx,2
mov eax,[Dangeon + bx] ; up
mov [temp1], ah ; temp4
;
add ebx,1 ; left hiro right
mov eax,[Dangeon + bx] ; temp1 temp2 temp3
mov [temp2], ah ;
 
;-------------------------------------------------------------------------------
; ‘¡®à  «¬ §®¢
;-------------------------------------------------------------------------------
mov ecx, [Ypl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ecx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
 
mov edx, [Xpl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and edx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
or edx,ecx ; Œë ç¥âª® ᯮ§¨æ¨®­¨à®¢ ­ë ¯® • ¨ “
cmp edx, 0
jne no_almaz
 
cmp ah, 12
jne no_almaz
xor cx, cx
add ebx,1 ; ‡€‹€’Š€ !!! ¡¥§ ­¥¥ ¯®ç¥¬ãâ® ®¡­ã«ï¥â ­¥  «¬ §ë   á®á¥¤­¨¥ ¡«®ª¨
mov [Dangeon + bx], ch
sbb ebx, 1 ; ‡€‹€’Š€ !!!
mov ecx, [gold]
add ecx, 1
mov [gold], ecx
pusha
mcall 55, eax, , , Music_almaz ; §¢ãª Almaz
popa
no_almaz:
;-------------------------------------------------------------------------------
; ‘¡®à  «¬ §®¢
;-------------------------------------------------------------------------------
; down
add ebx,1 ; temp5
mov eax,[Dangeon + bx] ;
mov [temp3], ah
 
sbb ebx,16 ; !!!!!!!!!!!!
mov eax,[Dangeon + bx] ; ¯à¨ ®âáãâá⢨¨ ¡¨¡«¨®â¥ª¨ MACROS.INC ebx=17
mov [temp4], ah
 
add ebx,32 ;
mov eax,[Dangeon + bx] ;
mov [temp5], ah
; ¢ëç¨á«¥­¨¥ á®á¥¤­¨å ¡«®ª®¢
 
 
 
 
 
;à §à¥è¥­¨¥ ­  ¤¢¨¦¥­¨¥
mov eax,0 ;
mov eax,[v_mov2] ;
and eax,7
and eax,2
cmp eax, 2
je smena
 
mov ebx, [Ypl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp ebx, 0 ;
jne end_tamgna ;
smena:
 
mov eax,0 ;
mov eax,[v_mov2] ;
and eax,7
and eax,2
cmp eax, 0
je smena2
 
mov ebx, [Xpl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp ebx, 0 ;
jne end_tamgna ;
 
smena2:
mov eax, [v_mov2]
and eax, 7
mov [v_mov], eax
end_tamgna:
;à §à¥è¥­¨¥ ­  ¤¢¨¦¥­¨¥
 
 
;“ˆ€ˆ… ‚ …ƒ€„“
mov ebx, [Ypl] ;
and ebx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp ebx, 0 ;
jne end_stop ;
mov eax, [Xpl] ; ¡¥§ ¬ ªà®á  í⮣® ¡«®ª  ­¥ ¡ë«® ®­ ¡ë« ¢­ãâਠ¡«®ª  㯨࠭¨©
and eax, 31 ; X ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
cmp eax, 0 ;
jne end_stop ;
mov eax, [v_mov]
 
cmp eax, 2
je stop_d
jmp stop_u
 
stop_d:
mov ebx, [temp5]
;§ ¯« âª  2 à ¢­® 1 ¥á«¨ ¡¥â®­ â® íâ® ª ª ª¨à¯¨ç, ¨­ ç¥ £¥à®© ¯à®å®¤¨â ᪢®§ì ¡¥â®­
 
cmp ebx, 2
jne no_zaplat1
 
sbb ebx,1
 
no_zaplat1:
 
and ebx,3
or eax, ebx
 
cmp eax, 2
je end_stop
mov ebx, 0
mov [v_mov], ebx
 
stop_u:
cmp eax, 3
jne stop_l
 
mov ebx, [temp4]
and ebx,3
and eax, ebx
 
; mov ebx, [Ypl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
; and ebx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
; cmp ebx, 0 ;
; jne end_stop ;
 
 
cmp eax, 0
je end_stop
mov ebx, 0
mov [v_mov], ebx
 
stop_l:
cmp eax, 1
jne stop_r
 
mov ebx, [temp1]
and ebx,3
 
; mov eax, [Xpl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
; and eax, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
; cmp eax, 0 ;
; jne end_stop ;
 
cmp ebx, 0
je end_stop
mov ebx, 0
mov [v_mov], ebx
 
stop_r:
cmp eax, 4
jne end_stop
 
mov ebx, [temp3]
and ebx,3
 
cmp ebx, 0
je end_stop
mov ebx, 0
mov [v_mov], ebx
 
end_stop:
;…ƒ€„›
 
 
;GRAVITACION
mov ebx, [Ypl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and ebx, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
 
mov eax, [Xpl] ; â® ãá«®¢¨¥ ¯®§¢®«ï¥â ¤®¡¥¦ âì ¤® ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
and eax, 31 ; Y ¢ ¯®§¨æ¨¨ ­ ¯à®â¨¢ ¡«®ª 
or eax,ebx ; Œë ç¥âª® ᯮ§¨æ¨®­¨à®¢ ­ë ¯® • ¨ “
cmp eax, 0
jne end_grav
 
mov ebx, [temp2] ;
cmp ebx, 0 ; § ¯à¥â ­  ¯à릪¨ ¢¢¥àå
jne end_grav ;
mov ebx, [v_mov] ;
cmp ebx, 3 ;
jne dalee_gra ;
mov ebx, 0 ;
mov [v_mov],ebx ;
mov ebx, 0 ;
mov [v_mov2],ebx ;
 
dalee_gra:
add eax, [temp5] ;
cmp eax, 0 ; ¯ ¤¥­¨¥ ¢ ¯ãáâ®âã
jne dalee_g ;
mov eax, 2 ;
mov [v_mov],eax ;
mov eax, 0 ;
mov [v_mov2],eax ;
 
dalee_g:
cmp eax, 4 ;
jne dalee_g2 ; ¯ ¤¥­¨¥ ¢ ¢®¤ã
mov eax, 2 ;
mov [v_mov],eax ;
mov eax, 0 ;
mov [v_mov2],eax ;
 
dalee_g2:
cmp eax, 12 ;
jne end_grav ; ¯ ¤¥­¨¥ ­   «¬ §
mov eax, 2 ;
mov [v_mov],eax ;
mov eax, 0 ;
mov [v_mov2],eax ;
 
end_grav:
;end GRAVITACION
 
 
 
 
; ˆŽ‘’ ŠŽŽ„ˆ€’ ƒ…ŽŸ
mov eax,0 ;
mov eax,[v_mov] ;
cmp eax, 2 ;
je h_down ;
jmp proverka2 ;
jmp hiro_mov_end ;
h_down: ;
mov ebx, [Ypl] ;
add ebx, 2 ; 3
mov [Ypl], ebx ; 1 4
jmp hiro_mov_end ;
;
proverka2: ;
cmp eax, 3 ; ;
je h_up ; PRIROST X Y
jmp proverka3 ;
jmp hiro_mov_end ;
h_up: ;
mov ebx, [Ypl] ;
sbb ebx, 2 ;
mov [Ypl], ebx ;
jmp hiro_mov_end ;
;
proverka3: ;
cmp eax, 1 ; ;
je h_left ;
jmp proverka4 ;
jmp hiro_mov_end ;
h_left: ;
mov ebx, [Xpl] ;
sbb ebx, 2 ;
mov [Xpl], ebx ;
jmp hiro_mov_end ;
;
proverka4: ;
cmp eax, 4 ;
je h_right ;
jmp hiro_mov_end ;
jmp hiro_mov_end ;
h_right: ;
mov ebx, [Xpl] ;
add ebx, 2 ;
mov [Xpl], ebx ;
jmp hiro_mov_end ;¯à¨à®áâ
; ˆŽ‘’ ŠŽŽ„ˆ€’ ƒ…ŽŸ
 
hiro_mov_end:
 
; ¢ëç¨á«ï¥¬ ¯®«®¦¥­¨¥ £¥à®ï ¢ « ¡¨à¨­â¥
mov eax, 0 ;
mov dword eax, [Ypl] ;
shr eax, 5 ;
shl eax, 4 ;
mov ebx, 0 ;
mov dword ebx, [Xpl] ;
shr ebx, 5 ;
add eax, ebx ;
mov [hiro_lab], eax ;
; ¢ëç¨á«ï¥¬ ¯®«®¦¥­¨¥ £¥à®ï ¢ « ¡¨à¨­â¥
ret
;****************
; end Hiro mov
;****************
 
 
;*******************************************
; BULLET
;*******************************************
bullet_mas:
mov word [Lab3], 0 ; ¢á¥ ¤¥« âì ¢ WORD ®¤¨­ í«¥¬¥­â ¢ ¬ áᨢ¥ +2 á«¥¤ãî騩 ¢à £ á®®â¢â¥âá⢥­­® 6*2= + 12
cycle7:
mov word bx, [Lab3]
mov word ax, [Bullet+bx] ; ¡¥à¥â ¡ ©â ¨§ Enemy + ᬥ饭¨¥
 
cmp ax, 1 ; bullet ok
je go_bullet
 
jmp end_bullet
go_bullet:
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Bullet + bx]
mov word [X_bul], ax
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Bullet + bx]
mov word [Y_bul], ax
 
imgtoimg img_bullet, dword [X_bul], dword [Y_bul],canvas
end_bullet:
 
mov eax, 0
mov word ax, [Lab3]
 
cmp ax, 36 ; if eax == 0
je cycle7_end ; jump to cycle_end:
 
add word [Lab3],12
 
jmp cycle7 ;
 
cycle7_end:
ret ; end BULLET
;-------------------------------------------------------------------------------
 
 
;*******************************************
; BULLET MOV
;*******************************************
bullet_mov:
mov word [Lab3], 0 ; ¢á¥ ¤¥« âì ¢ WORD ®¤¨­ í«¥¬¥­â ¢ ¬ áᨢ¥ +2 á«¥¤ãî騩 ¢à £ á®®â¢â¥âá⢥­­® 6*2= + 12
 
cycle8:
mov word bx, [Lab3]
mov word ax, [Bullet+bx] ; ¡¥à¥â ¡ ©â ¨§ Enemy + ᬥ饭¨¥
 
cmp ax, 1 ; bullet ok
je go_bullet_mov
 
jmp end_bullet_mov
go_bullet_mov:
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Bullet + bx]
mov word [X_bul], ax
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word ax, [Bullet + bx]
mov word [Y_bul], ax
 
add word bx, 2 ;
mov word ax, [Bullet + bx]
mov word [mov_bullet], ax
 
cmp ax, 1
jne bul_muv_left
mov word ax, [X_bul]
sbb ax, 2
mov word bx, [Lab3]
add word bx, 2
mov word [Bullet + bx], ax
 
jmp end_bullet_mov
bul_muv_left:
mov word ax, [X_bul]
add ax, 2
mov word bx, [Lab3]
add word bx, 2
mov word [Bullet + bx], ax
 
end_bullet_mov:
 
; ¢ëç¨á«ï¥¬ ¯®«®¦¥­¨¥ BULLET ¢ « ¡¨à¨­â¥
mov eax, 0 ;
mov eax, [Y_bul] ;
shr eax, 5 ;
shl eax, 4 ;
mov ebx, 0 ;
mov ebx, [X_bul] ;
shr ebx, 5 ;
add eax, ebx ;
mov [lab_bullet], ax ;
; ¢ëç¨á«ï¥¬ ¯®«®¦¥­¨¥ BULLET ¢ « ¡¨à¨­â¥
 
mov word bx,[lab_bullet]
mov dx, [Dangeon + bx]
and edx,3
cmp dx, 0
je letit_dalee
 
cmp dx, 2
je beton
mov byte [Dangeon + bx], 3 ; €‡“˜…ˆ… Šˆˆ—…‰
beton:
mov bx, [Lab3]
mov byte [Bullet + ebx], 0 ; ¡¥à¥â ¡ ©â ¨§ Enemy + ᬥ饭¨¥
 
 
 
 
 
letit_dalee:
mov eax, 0
mov word ax, [Lab3]
 
cmp ax, 36 ; if eax == 0
je cycle8_end ; jump to cycle_end:
 
add word [Lab3],12
 
jmp cycle8 ;
 
cycle8_end:
 
 
ret ; end BULLET
;-------------------------------------------------------------------------------
 
;-------------------------------------------------------------------------------
; TABLO TABLO TABLO TABLO TABLO TABLO
;*****************************************
tablo:
; WIWOD CIFR
;; mov eax, 13
; mov ebx, 140*65536 + 18
; mov ecx, 10*65536 + 8
; mov edx, 0x00ffffff
; int 0x40
; outcount [numer_level],140,10,0x224466,3*65536
 
; WIWOD CIFR
; mov eax, 13
; mov ebx, 160*65536 + 18
; mov ecx, 10*65536 + 8
; mov edx, 0x00ffffff
; int 0x40
; outcount [delta_level],160,10,0x224466,3*65536
 
; WIWOD CIFR
; mov eax, 13
; mov ebx, 180*65536 + 18
; mov ecx, 10*65536 + 8
; mov edx, 0x00ffffff
; int 0x40
; outcount [delta_level_end],180,10,0x224466,3*65536
 
ret
;-------------------------------------------------------------------------------
fire:
sbb ah, 121
mov [v_fire], ah
 
mov word bx, 0
mov cx, [Bullet + ebx]
cmp cx, 0
jne end_fire
pusha
mcall 55, eax, , , Music_bah ; §¢ãª ¢ëáâ५ 
popa
 
mov byte [Bullet + ebx], 1
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov ax, [Xpl]
add ax, 8
mov word [Bullet + ebx],ax
 
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov ax, [Ypl]
add ax, 16
mov word [Bullet + ebx],ax
 
add word bx, 2 ;
mov ax,[v_fire]
mov word [Bullet + ebx],ax
 
end_fire:
ret
;-------------------------------------------------------------------------------
 
 
;------------------------‡ £à㧪  ã஢­¥©---------------------------------------
load_level:
imgtoimg img_level,32,32,canvas
setimg 6,20,canvas
 
xor eax,eax
xor ebx,ebx
xor edx,edx
xor ecx,ecx
mov dword [Bullet], eax
mov dword [Bullet+2], eax
mov dword [Bullet+4], eax
mov dword [Bullet+6], eax
mov dword [Bullet+8], eax
mov dword [Bullet+10], eax
mov byte [Lab], 1
mov [lab_bullet], eax
mov [mov_bullet], eax
mov [X_bul], eax
mov [Y_bul], eax
mov [gold], eax
mov dword [Xpl], 32
mov dword [Ypl], 448
mov dword [hiro_lab],0 ; ¯à®¥ªæ¨ï £¥à®ï ¢ « ¡¨à¨­â
mov dword [v_mov], 0
mov dword [v_mov2], 0
mov dword [v_fire], 0
 
xor eax,eax
mov eax, [numer_level]
shl eax, 8
mov dword [delta_level], eax
add eax, 256
mov dword [delta_level_end], eax
 
cycleL:
 
xor ebx, ebx
mov ebx, [Lab]
add ebx, [delta_level]
mov ax,[Dangeon2 + ebx] ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
 
sbb ebx, [delta_level]
mov [Dangeon + ebx], ax ; ¡¥à¥â ¡ ©â ¨§ ¤ ­£¥®­ + ᬥ饭¨¥
add word [Lab],1
mov eax, [Lab]
 
 
cmp eax, [delta_level_end] ; if eax == 0
je cycleL_end ; jump to cycle_end:
jmp cycleL ;
cycleL_end:
 
mov eax, 0
mov [Lab],eax
 
call enemy_plaz
 
ret
;-------------------------------------------------------------------------------
 
;************************************
;GOLD
proverka_gold:
mov eax, [gold]
cmp ax, 10
jna net_deneg
mov eax, [temp2] ; ¤®¡¥¦ âì ¤® ¤¢¥à¨
cmp ax, 16
jne net_deneg
mov ax, [numer_level] ; 㢥«¨ç¥­¨¥ «¥¢¥« 
 
add ax, 1
mov [numer_level], ax
mov [demon_kolvo], ax ;
 
call load_level
delay 100
 
net_deneg:
ret
 
;-------------------------------------------------------------------------------
; “’Ž
potop:
mov eax, [temp2] ; ¤®¡¥¦ âì ¤® ¤¢¥à¨
cmp ax, 4
jne jiwoy
mov dword [gold], 0 ; 㢥«¨ç¥­¨¥ «¥¢¥« 
 
call load_level
delay 100
jiwoy:
ret
 
;************************************
;¯®«®¦¥­¨¥ ¢à £®¢ ­  ­®¢®¬ ã஢­¥
enemy_plaz:
mov word [Lab2], 0 ; ¢á¥ ¤¥« âì ¢ WORD ®¤¨­ í«¥¬¥­â ¢ ¬ áᨢ¥ +2 á«¥¤ãî騩 ¢à £ á®®â¢â¥âá⢥­­® 6*2= + 12
mov ax, [demon_kolvo]
mov [demon], ax
 
cycle55:
mov ebx, 0
mov ecx, 0
mov edx, 0
mov esi, 0
 
mov cx, [demon]
cmp cx, 0
je end_demon
mov word bx, [Lab2] ;
mov word [Enemy + bx], 1 ;
sbb cx, 1
mov [demon], cx
end_demon:
 
random 14, eax
add eax, 1
shl eax,5
mov word bx, [Lab2] ;
add word bx, 2 ; X ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
;
random 12, eax
add eax, 1
shl eax,5
mov word bx, [Lab2] ;
add word bx, 4 ; Y ª®®à¨¤¨­ â  ¤ ­­®£® ¢à £ 
mov word [Enemy + bx], ax ;
 
mov word bx, [Lab2] ;
add word bx, 8 ; ­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï
mov word [Enemy + bx], 0 ;
add word bx, 2 ; ¦¨§­ì
mov word [Enemy + bx], 500 ;
 
 
mov eax, 0
mov word ax, [Lab2]
 
cmp ax, 96 ; if eax == 0
je cycle55_end ; jump to cycle_end:
 
add word [Lab2],12
 
jmp cycle55 ;
 
cycle55_end:
 
ret
 
 
I_END: ; ª®­¥æ ¯à®£à ¬¬ë
 
 
 
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Xpl: dd 32 ; ª®®à¤¨­ âë £¥à®ï
Ypl: dd 448
hiro_lab: dd 0 ; ¯à®¥ªæ¨ï £¥à®ï ¢ « ¡¨à¨­â
numer_level: dd 0
delta_level: dd 0
delta_level_end: dd 256
demon: dd 0
demon_kolvo: dd 1
 
gold: dd 0
 
X_enemy: dd 0
Y_enemy: dd 0
 
 
X_bul: dd 0
Y_bul: dd 0
 
X_anime: dd 0
Y_anime: dd 0
 
mov_bullet: dw 0
lab_bullet: dw 0
mov_enemy: dw 0
lab_enemy: dw 0
life_enemy: dw 0
 
anime : dd 0 ; ¯¥à¥¬¥­­ ï ¤«ï  ­¨¬ æ¨¨ £¥à®ï ¨ ¯à
anime2 : dd 0 ; ¯¥à¥¬¥­­ ï ¤«ï  ­¨¬ æ¨¨ £¥à®ï ¨ ¯à
 
temp1: dd 0
temp2: dd 0
temp3: dd 0
temp4: dd 0
temp5: dd 0
 
 
v_mov: dd 0 ; ­ ¯à ¢«¥­¨ï ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
v_mov2: dd 0 ; ­ ¯à ¢«¥­¨ï ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
v_fire: dd 0 ; ­ ¯à ¢«¥­¨ï ¤¢¨¦¥­¨ï ¯¥àá®­ ¦ 
Lab: dd 0
Lab2: dw 0
Lab3: dw 0
perem1: dd 0
perem2: dd 0
 
timer1 dd 0 ; â ©¬¥à ¨á¯®«ì§ã¥¬ë© ¤«ï  ­¨¬ æ¨¨ ¢®¤ë, ¢à £®¢ --- ¡¥£ ¥â ®â 0 ¤® 10
 
;-------------------------------------------------------------------------------
;1 ®¡ëç­ ï á⥭ , 2 ­¥¯à®¡¨¢ ¥¬ ï, 4 ¢®¤ , 8 «¥á­¨æ , 12  «¬ §, 0 ¯ãáâ®â  16 - exit
;-------------------------------------------------------------------------------
Dangeon:
db 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
db 2,1,1,1,1,1,1,0,12,0,0,0,0,0,0,2
db 2,0,12,12,0,0,0,8,1,8,1,1,1,0,0,2
db 2,8,1,1,1,1,1,8,1,8,0,0,0,0,0,2
db 2,8,0,0,0,0,0,8,1,8,2,4,4,2,0,2
db 2,8,2,4,4,4,2,8,1,8,2,2,2,2,0,2
db 2,0,2,2,2,2,2,8,1,8,0,0,0,0,0,2
db 2,0,1,0,0,0,0,8,1,1,1,1,1,1,8,2
db 2,0,1,1,8,1,1,1,0,0,0,0,0,0,8,2
db 2,12,1,1,8,0,12,0,1,8,1,1,8,1,1,2
db 2,0,0,0,8,8,1,8,0,8,0,0,0,0,0,2
db 2,12,1,8,1,8,1,1,8,1,1,1,1,1,1,2
db 2,0,1,8,12,12,0,0,0,0,0,0,0,0,0,2
db 2,0,1,1,1,1,1,8,1,1,1,0,0,0,0,2
db 2,0,0,0,12,0,0,8,0,0,0,16,0,12,12,2
db 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
 
Dangeon2:
db 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
db 2,1,1,0,1,1,1,0,12,0,0,0,0,0,0,2
db 2,0,12,12,0,0,0,8,1,8,1,1,1,0,0,2
db 2,8,1,1,1,1,1,8,1,8,0,0,0,0,0,2
db 2,8,0,0,0,0,0,8,1,8,2,4,4,2,0,2 ;0
db 2,8,2,4,4,4,2,8,1,8,2,2,2,2,0,2
db 2,0,2,2,2,2,2,8,1,8,0,0,0,0,0,2
db 2,0,1,0,0,0,0,8,1,1,1,1,1,1,8,2
db 2,0,1,1,8,1,1,1,0,0,0,0,0,0,8,2
db 2,12,1,1,8,0,12,0,1,8,1,1,8,1,1,2
db 2,0,0,0,8,8,1,8,0,8,0,0,0,0,0,2
db 2,12,1,8,1,8,1,1,8,1,1,1,1,1,1,2
db 2,0,1,8,12,12,0,0,0,0,0,0,0,0,0,2
db 2,0,1,1,1,1,1,8,1,1,1,0,0,0,0,2
db 2,0,0,0,12,0,0,8,0,0,0,16,0,12,12,2
db 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
db 2,0,0,0,0,0,0,0,0,0,0,16,0,0,0,2
db 2,12,1,8,1,0,0,0,0,0,0,1,8,0,0,2
db 2,0,1,8,1,0,0,0,0,0,0,1,0,8,0,2 ;1
db 2,12,1,8,1,1,0,0,0,0,1,1,0,8,0,2
db 2,0,1,8,1,0,12,12,12,12,0,1,8,8,0,2
db 2,12,1,8,1,0,1,1,1,1,0,1,8,0,0,2
db 2,0,1,8,0,0,0,0,0,0,0,0,8,0,0,2
db 2,0,1,1,1,1,8,1,8,1,1,1,1,1,8,2
db 2,0,0,0,12,0,8,0,8,0,0,0,12,0,8,2
db 2,0,1,1,1,1,1,0,1,8,1,1,8,1,1,2
db 2,0,0,0,0,0,0,0,0,8,1,0,8,0,0,2
db 2,0,1,1,1,1,1,8,1,1,1,1,1,1,8,2
db 2,0,0,12,0,0,0,8,0,0,12,0,0,0,8,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
db 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
db 2,0,0,0,0,0,0,0,0,12,0,12,0,0,0,2
db 2,0,0,0,0,0,0,8,1,1,1,1,1,1,0,2 ;2
db 2,0,8,0,12,12,0,8,0,0,0,0,0,2,4,2
db 2,0,8,1,1,1,1,0,0,0,0,0,0,2,2,2
db 2,0,8,0,0,0,0,12,1,1,1,1,0,0,0,2
db 2,0,8,1,0,1,0,12,0,0,0,0,0,0,0,2
db 2,0,8,0,1,1,12,12,0,0,0,8,1,1,1,2
db 2,0,8,0,12,0,0,12,0,0,0,8,0,12,0,2
db 2,0,8,0,0,0,8,1,8,0,0,1,8,1,8,2
db 2,0,8,0,0,8,1,1,1,8,0,0,8,0,8,2
db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,8,2
db 2,0,0,0,0,0,0,0,16,0,0,0,0,0,8,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,0,0,0,12,0,0,0,0,0,0,16,0,0,2
db 2,0,8,1,1,1,1,1,1,1,1,1,1,1,0,2
db 2,0,8,0,0,0,0,0,12,0,0,0,0,0,0,2
db 2,0,8,0,0,0,0,1,8,1,0,0,0,0,0,2
db 2,0,8,0,0,0,1,1,8,1,1,0,0,0,0,2
db 2,0,8,0,12,1,1,1,8,1,1,1,12,0,0,2
db 2,0,8,0,1,1,12,1,8,1,12,1,1,0,0,2
db 2,0,0,1,1,1,1,1,8,1,1,1,1,0,0,2 ;3
db 2,0,1,0,0,0,0,0,8,1,0,0,0,1,0,2
db 2,0,1,0,1,1,1,1,8,1,1,1,0,1,0,2
db 2,0,1,1,12,1,12,1,8,1,1,1,0,1,0,2
db 2,0,1,1,1,1,1,1,8,1,1,1,0,1,0,2
db 2,0,1,1,12,1,12,1,8,1,1,1,12,1,0,2
db 2,0,0,0,0,0,0,0,8,0,0,0,0,0,0,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,12,0,0,0,0,0,0,0,0,0,16,0,0,2
db 2,0,1,8,1,1,1,1,1,1,8,1,1,1,8,2
db 2,0,0,8,0,0,0,0,0,0,8,0,0,0,8,2
db 2,0,1,1,1,1,1,8,1,1,1,1,1,1,0,2
db 2,0,0,12,0,0,12,8,0,0,12,0,0,0,0,2
db 2,12,1,1,1,8,1,1,1,1,8,1,1,1,8,2
db 2,0,0,0,0,8,0,0,0,0,8,0,0,0,8,2
db 2,8,1,1,1,1,1,1,8,1,1,1,1,1,0,2 ;4
db 2,8,0,0,0,12,0,0,8,0,0,12,0,0,0,2
db 2,0,1,8,1,1,1,1,1,1,1,1,8,1,0,2
db 2,0,0,8,12,0,0,0,0,12,0,0,8,0,0,2
db 2,8,1,1,1,1,1,1,8,1,1,1,1,1,8,2
db 2,8,12,0,0,0,0,0,0,0,0,0,0,12,8,2
db 2,8,2,4,4,4,4,4,4,4,4,4,4,2,8,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,8,1,8,12,8,1,8,1,8,1,8,1,8,1,2
db 2,8,2,8,1,8,1,8,1,8,1,8,12,8,12,2
db 2,8,1,8,1,8,2,8,12,8,1,8,1,8,1,2
db 2,8,12,8,0,8,0,8,0,8,0,8,0,8,0,2
db 2,1,8,1,1,1,1,1,8,1,1,1,1,1,8,2
db 2,0,8,0,0,0,0,0,8,0,0,12,0,0,8,2
db 2,0,8,12,0,2,12,0,8,1,1,1,1,1,8,2
db 2,0,1,1,8,1,1,1,8,0,0,0,0,0,8,2 ;5
db 2,0,1,0,8,0,0,0,8,0,0,12,0,0,8,2
db 2,0,1,0,8,0,0,0,8,1,1,1,1,1,8,2
db 2,0,1,12,8,0,0,2,8,0,0,0,0,0,8,2
db 2,8,1,1,1,1,8,1,1,1,1,8,1,1,1,2
db 2,8,0,0,0,0,8,2,0,0,2,8,0,0,0,2
db 2,0,8,0,12,8,8,2,4,4,2,8,0,0,16,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,8,0,8,0,8,0,8,0,0,8,0,8,16,2
db 2,1,8,1,8,1,8,1,8,1,1,8,1,8,1,2
db 2,0,8,0,8,0,8,0,8,8,0,8,0,8,0,2
db 2,1,1,8,1,1,1,1,1,8,1,1,8,1,1,2
db 2,0,0,8,8,0,12,8,0,8,8,12,8,8,0,2
db 2,1,1,1,8,1,1,8,1,1,8,1,1,8,1,2
db 2,0,8,0,8,0,12,8,0,0,8,0,12,8,0,2 ;6
db 2,1,8,1,1,1,1,1,8,1,1,1,1,1,1,2
db 2,0,8,0,12,8,0,0,8,12,0,8,0,0,0,2
db 2,1,8,1,1,8,1,1,8,1,1,8,1,1,1,2
db 2,0,0,8,0,8,8,0,8,8,0,8,8,0,0,2
db 2,1,1,8,1,1,8,1,1,8,1,1,8,1,1,2
db 2,0,0,8,12,0,8,0,12,8,0,12,8,12,12,2
db 2,8,8,1,1,1,1,1,1,1,1,1,1,1,1,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,12,0,12,0,12,0,0,12,0,12,0,0,0,2
db 2,1,1,1,8,1,1,1,1,1,1,8,1,1,1,2
db 2,0,0,0,8,0,0,12,0,0,0,8,0,0,0,2
db 2,1,1,1,1,1,1,1,8,1,1,1,1,1,1,2
db 2,0,0,0,12,0,0,0,8,12,0,0,0,0,0,2
db 2,1,1,1,8,1,1,1,1,1,1,8,1,1,1,2
db 2,0,0,0,8,0,0,0,0,0,0,8,0,0,0,2 ; 7
db 2,1,1,1,1,1,1,1,1,1,1,1,1,8,1,2
db 2,0,0,0,0,0,0,0,0,0,0,0,0,8,0,2
db 2,1,1,1,1,1,1,8,1,1,1,1,1,8,1,2
db 2,0,0,0,0,0,0,8,0,0,0,0,0,8,0,2
db 2,1,1,8,1,8,1,1,8,1,8,1,1,1,1,2
db 2,0,0,8,0,8,12,0,8,0,8,12,0,0,16,2
db 2,8,1,1,1,1,1,1,1,1,1,1,1,1,1,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
db 2,0,0,0,0,0,0,0,0,0,0,0,0,16,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,8,0,8,0,12,0,0,8,0,8,0,0,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,0,8,12,0,0,8,0,0,8,0,0,0,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,0,0,0,0,0,0,0,8,0,0,0,12,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,8,0,0,0,8,12,0,0,8,0,8,12,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,0,8,0,0,0,0,12,8,0,12,8,0,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,0,0,8,0,8,12,0,0,8,12,0,8,12,0,2
db 2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,2
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2;-------------------------------------------------------------------------------
 
 
;-------------------------------------------------------------------------------
Bullet: dw 0,0,0,0,0,0
dw 0,0,0,0,0,0
dw 0,0,0,0,0,0
dw 0,0,0,0,0,0
;-------------------------------------------------------------------------------
 
 
Enemy: dw 1,448,128,0,0,500 ;¢à £¨ ª« áá,•,“,¯®«®¦¥­¨¥ ¢ « ¡¨à¨­â¥,­ ¯à ¢«¥­¨¥ ¤¢¨¦¥­¨ï,¦¨§­ì
dw 0,32,32,0,0,0
dw 0,64,32,0,0,0
dw 0,416,32,0,0,0
dw 0,256,256,0,0,0
dw 0,256,224,0,0,0
dw 0,320,192,0,0,0
dw 0,32,256,0,0,0
dw 0,448,448,0,0,0
 
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
bullet_bmp:
file 'bullet.bmp'
rb 1
 
level_bmp:
file 'level2.bmp'
rb 1
 
kirpich:
file 'kirpich.bmp'
rb 1
 
kirpich3:
file 'kirpich2.bmp'
rb 1
 
kirpich2:
file 'oldkirpich.bmp'
rb 1
 
lest_bmp:
file 'lestnica.bmp'
rb 1
 
water1_bmp:
file 'water1.bmp'
rb 1
 
water2_bmp:
file 'water2.bmp'
rb 1
 
door1_bmp:
file 'door1.bmp'
rb 1
 
door2_bmp:
file 'door2.bmp'
rb 1
 
 
img_level:
rb 448*448*3+8
 
;img_ded1:
;rb 448*448*3+8
 
img_area:
rb 32*32*3+8
 
img_area2:
rb 32*32*3+8
 
img_area3:
rb 32*32*3+8
 
img_bullet:
rb 4*8*3+8
 
img_lestniza:
rb 32*32*3+8
 
img_water1:
rb 32*32*3+8
 
img_water2:
rb 32*32*3+8
 
img_door1:
rb 32*32*3+8
 
img_door2:
rb 32*32*3+8
 
img_enemy1:
rb 32*32*3+8
 
img_enemy2:
rb 32*32*3+8
 
 
Music_bah:
db 0x0f, 0x09, 0
 
Music_mov:
db 0x00, 0x00, 0
 
Music_almaz:
db 0x09, 0x03, 0
 
entered rd 1
 
imgcount rd 1 ; ª®«-¢® ¢á¥£® ª ¤à®¢ ¢  ­¨¬ æ¨¨
img_index rd 1 ; ­®¬¥à ⥪ã饣® ª ¤à 
 
;hashtable rd 4096 ; à ¡®ç ï ®¡« áâì ¤«ï ¥ ¤ƒˆ” ¯à®æ¥¤ãàë
workarea:
file 'aniall.gif'
 
 
;temp rb 0x100000 ; ¬¥áâ® ¤«ï ƒˆ” ä ¨« 
rb 10
 
canvas:
xs dd 512
ys dd 512
rb 512*512*3
 
gif_hash_area:
rd 4096+1
 
coords:
rd 2
 
Image:
/programs/games/almaz/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 = 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:
}
 
/programs/games/almaz/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
/programs/games/almaz/BULLET.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/almaz/BULLET.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/almaz/ENEMY.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/almaz/ENEMY1.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/almaz/ENEMY2.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/almaz/EXPLODE1.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/almaz/KIRPICH.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/almaz/KIRPICH2.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/almaz/KIRPICH22.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/almaz/LESTNICA.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/almaz/OLD1234.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/almaz/OLDKIRPICH.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/almaz/WATER1.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/almaz/WATER2.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/almaz/almaz1.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/almaz/almaz2.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/almaz/almaz3.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/almaz/aniall.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/almaz/build_ru.bat
0,0 → 1,6
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ALMAZ.asm ALMAZ
@erase lang.inc
@kpack ALMAZ
@pause
/programs/games/almaz/ded1.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/almaz/ded2.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/almaz/door1.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/almaz/door2.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/almaz/gold.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/almaz/gold2.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/almaz/level.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/almaz/level2.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