*correct pong (the previous one was duplicate of pong3)

*small fixes in icon_new
*title with fn0 in copyr
*fixed chess

git-svn-id: svn://kolibrios.org@503 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2007-05-17 02:22:27 +00:00
parent 5d1134a0a8
commit 3a9217ff57
10 changed files with 417 additions and 1523 deletions

View File

@ -182,18 +182,12 @@ draw_window:
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,160*65536+415 ; [x start] *65536 + [x size]
mov ecx,160*65536+90 ; [y start] *65536 + [y size]
mov edx,0x03DDDDDD ; color of work area RRGGBB
mcall
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
mov ecx,160*65536+90 ; [y start] *65536 + [y size]
mov edx,0x13DDDDDD ; color of work area RRGGBB
mov edi,labelt ; WINDOW LABEL
mcall
mov eax,8
mov ebx,105*65536+290
mov ecx,33*65536+12
@ -220,8 +214,8 @@ draw_window:
xor ecx,ecx
mov edx,text
mov esi,62
newline:
mov eax,4
newline:
mcall
add ebx,16
add edx,62
@ -248,9 +242,9 @@ text:
db ' Š“„€: | <20> ¢«î設 …¢£¥­¨©, waptap@mail.ru '
db ' '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'ŠŽ<C5A0>ˆ<EFBFBD>Ž<E2809A>ˆ… ”€‰‹€'
labellen:
db 'ŠŽŹ<C5BD><C5B9>Ž€Ť<E282AC>… ”€‰‹€',0
errors:
db "ä ©« ᪮¯¨à®¢ ­ ãᯥ譮 "

View File

@ -13,8 +13,8 @@ use32
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd I_END+0x10000 ; required memory
dd I_END+0x10000 ; esp
dd 0x100000 ; required memory
dd 0x100000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
include 'lang.inc'
@ -31,7 +31,7 @@ file_info:
dd 0
dd -1
dd 0x4000
db '/rd/1/chess.bmp',0
db '/rd/1/network/chess.bmp',0
pawn_color:
@ -61,9 +61,7 @@ text equ texts+80*32*4
START: ; start of execution
; mov eax,58
mov eax,70
; mov ebx,file_info
mov ebx,file_info
mcall

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,624 +0,0 @@
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
mcall
}
; 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
mcall
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
mcall
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]
mcall
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
mcall
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
mcall
}
;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
mcall
mov eax,[bmp_load_area+2]
shr eax,9 ; ŻŽ¤ĽŤ¨Ź ­  512 ¨ Żŕ¨Ą ˘¨Ź 1 - ŻŽŤă稏 ç¨áŤŽ ĄŤŽŞŽ˘
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
mcall
; 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
; mcall
; 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
}

View File

@ -1,499 +0,0 @@
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
mcall
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
mcall
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
mcall
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
mcall
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
mcall
jmp openoff
key: ; key
mcall ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
mcall
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
mcall
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
mcall
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
mcall
mov ebx,dlg_file
mov ecx,clip_file
mov eax,19
mcall
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
mcall
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
mcall
jmp openoff
key: ; key
mcall ; read (eax=2)
jmp still
button: ; button
mov eax,17 ; get id
mcall
cmp ah,1 ; button id=1 ?
jne still
mov eax,-1 ; close this program
mcall
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
mcall
}
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
mcall
}
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
mcall
}
;_ equ '____'
;macro libtest x,y,color
;{
;if x = as dword
; mov ebx,x
;end if
; mov ecx,y
; mov edx,color
; mov eax,1
; mcall
;}
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
mcall
}
; SCEVENT - Scan event
macro scevent red,key,but
{
mov eax,11
mcall
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
; WTEVENT - Wait event
macro wtevent red,key,but
{
mov eax,10
mcall
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
mcall
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
mcall
}
; 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
mcall
}
; 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
mcall
}
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
mcall
}
; STARTWD - Start of window draw
macro startwd
{
mov eax,12
mov ebx,1
mcall
}
; ENDWD - End window draw
macro endwd
{
mov eax,12
mov ebx,2
mcall
}
; 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
mcall
}
;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

Binary file not shown.

Binary file not shown.

View File

@ -1,382 +1,420 @@
;
; Pong Gaem 2Ver Mini Sample by Pavlushin Evgeni for ASCL
; www.waptap@mail.ru
; PONG for MENUET v1.0
; 2001 by Mario Birkner, Germany
; cyflexx@digitalrice.com
;
; PONG for MENUET is
; a small PONG-clone for MenuetOS
;
; HINT: If the Paddle moves too slow,increase the
; typematic Rate in your BIOS
;
;******************************************************************************
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 '..\..\..\macros.inc'
include 'ascl.inc'
include 'ascgl.inc'
START: ; start of execution
CK_UP1 equ 113
CK_DOWN1 equ 97
CK_UP2 equ 130+48
CK_DOWN2 equ 129+48
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x2000 ; required amount of memory
dd 0x2000 ; esp = 0x7FFF0
dd 0x00000000 ; reserved=no extended header
START:
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
mov eax,10
add eax,[control]
mcall
cmp eax,1 ; redraw request ?
cmp eax,1
je red
cmp eax,2 ; key in buffer ?
cmp eax,2
je key
cmp eax,3 ; button in buffer ?
cmp eax,3
je button
cmp [control],1
jne still
out_scorea:
mov eax,47
mov ebx,5*65536
mov ecx,[scorea]
mov edx,300*65536+8
mov esi,cl_Blue
mcall
out_scoreb:
mov eax,47
mov ebx,5*65536
mov ecx,[scoreb]
mov edx,350*65536+8
mov esi,cl_Red
mov eax,5
mov ebx,[delay]
mcall
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
jmp move
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
red:
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
cmp [control],1
jne still
call clall
call drawpad
jmp still
key:
mov eax,2
mcall
cmp [control],1
jne still
up1:
cmp ah,CK_UP1
jne dn1
cmp [posya],52*65536+64
je still
sub [posya],4*65536
call cl0
call drawpad
jmp still
dn1:
cmp ah,CK_DOWN1
jne up2
cmp [posya],140*65536+64
je still
add [posya],4*65536
call cl0
call drawpad
jmp still
up2:
cmp ah,CK_UP2
jne dn2
cmp [posyb],52*65536+64
je still
sub [posyb],4*65536
call cl1
call drawpad
jmp still
dn2:
cmp ah,CK_DOWN2
jne still
cmp [posyb],140*65536+64
je still
add [posyb],4*65536
call cl1
call drawpad
jmp still
button:
mov eax,17
mcall
cmp ah,1
jne button2
mov eax,-1
mcall
jmp still
button2:
cmp ah,2
jne still
mov [control],1
mov [scp1],0
mov [scp2],0
jmp res
move:
mov eax,[mposx]
mov ebx,[mposy]
add [bposx],eax
add [bposy],ebx
cmp [bposx],16*65536+16
je pf1
cmp [bposx],272*65536+16
je pf2
cmp [bposy],191*65536+16
je bot
cmp [bposy],48*65536+16
je top
cmp [bposx],247*65536+16
je rig
jg padr
cmp [bposx],55*65536+16
je lef
jl padl
jmp draw
padr:
mov ecx,[posyb]
jmp pad
padl:
mov ecx,[posya]
pad:
mov eax,[bposy]
sub eax,16
mov ebx,eax
add ebx,17*65536
sub ecx,64
mov edx,ecx
add edx,65*65536
cmp eax,edx
je top
cmp ebx,ecx
je bot
jmp draw
bot:
mov [mposy],-65536
jmp draw
top:
mov [mposy],65536
jmp draw
rig:
mov eax,[posyb]
sub eax,1*65536-64 ;verhindert das der ball ins paddle eindringt
mov ebx,[posyb]
add ebx,64*65536-64
mov ecx,[bposy]
add ecx,16*65536-16
mov edx,[bposy]
sub edx,16
cmp ecx,eax
je blr
jl draw
cmp edx,ebx
je blr
jl blr
jg draw
blr:
mov [mposx],-65536
jmp draw
lef:
mov eax,[posya]
sub eax,1*65536+64
mov ebx,[posya]
add ebx,64*65536-64
mov ecx,[bposy]
add ecx,16*65536-16
mov edx,[bposy]
add edx,16
cmp ecx,eax
je bll
jl draw
cmp edx,ebx
je bll
jl bll
jg draw
bll:
mov [mposx],65536
jmp draw
drawpad:
; draw paddle
mov edx,[posya]
shr edx,16
add edx,32*65536
mov ecx,24*65536+64
mov ebx,paddle
mov eax,7
mcall
mov edx,[posyb]
shr edx,16
add edx,264*65536
mov eax,7
mov ebx,paddle
mov ecx,24*65536+64
mcall
ret
draw:
; draw ball
mov eax,13
mov ebx,-65536+2
mov ecx,-65536+2
add ebx,[bposx]
add ecx,[bposy]
xor edx,edx
mcall
add ebx,65536-2
add ecx,65536-2
mov edx,ebx
and edx,0xffff0000
mov esi,ecx
shr esi,16
add edx,esi
mov esi,ebx
shl esi,16
mov edi,ecx
and edi,0x0000ffff
add esi,edi
mov ecx,esi
mov ebx,ball
mov eax,7
mcall
jmp still
cls:
mov eax,13
mov edx,0x00000000
mcall
ret
cl0:
mov ebx,32*65536+24
mov ecx,[posya]
sub ecx,4*65536+60
call cls
mov ecx,[posya]
add ecx,64*65536-60
call cls
ret
cl1:
mov ebx,264*65536+24
mov ecx,[posyb]
sub ecx,4*65536+60
call cls
mov ecx,[posyb]
add ecx,64*65536-60
call cls
ret
clall:
mov ebx,16*65536+288
mov ecx,47*65536+161
call cls
ret
pf1:
inc [scp2]
jmp res
pf2:
inc [scp1]
res:
cmp [scp2],20
je over
cmp [scp1],20
je over
mov [bposx],152*65536+16 ;default position ball
mov [bposy],119*65536+16
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 clall
call drawpad
jmp draw
over:
mov [control],0
call draw_window
mov eax,4
mov ebx,120*65536+100
mov ecx,0x00ffdd00
mov esi,14
cmp [scp1],20
jne win
mov edx,w1
mcall
jmp still
win:
mov edx,w2
mcall
jmp still
key: ; key
mov eax,2
mcall
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
mcall
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
mcall
noclose:
jmp still
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
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
mov eax,12
mov ebx,1
mcall
mov eax,0
mov ebx,100*65536+320
mov ecx,100*65536+250
mov edx,0x134873a0 ;70d0
mov edi,labelt
mcall
mov eax,8
mov ebx,20*65536+80
mov ecx,220*65536+20
mov edx,2
mov esi,0x900000
mcall
mov eax,4
mov ebx,38*65536+227
mov ecx,0x00FFFFFF
mov edx,b0lab
mov esi,8
mcall
mov eax,4
mov ebx,25*65536+30
mov ecx,0x00ffdd00
mov edx,welcome
mov esi,40
mcall
mov eax,4
mov ebx,220*65536+228
mov ecx,0x00ffdd00
mov edx,scotext
mov esi,11
mcall
mov eax,47
mov ebx,0x00020000
mov ecx,[scp1]
mov edx,268 shl 16+228
mov esi,0x0000ddff
mcall
mov eax,47
mov ebx,0x00020000
mov ecx,[scp2]
mov edx,285 shl 16+228
mov esi,0x0000ddff
mcall
mov eax,12
mov ebx,2
mcall
ret
; DATA AREA
xt dd 100
yt dd 100
posya dd 96*65536+64 ;default position paddle
posyb dd 96*65536+64
bposx dd 152*65536+16 ;default position ball
bposy dd 119*65536+16
mposx dd 65536 ;richtung ball
mposy dd 65536
control dd 0x0
delay dd 0x1 ;delay betw. frames
scp1 dd 0x0
scp2 dd 0x0
gravtime dd 10
gravx dd 1000
gravy dd 1000
ply1rx dd 200
ply1ry dd 50
scotext:
db 'SCORE: :'
welcome:
db 'PLAYER1: Q , A PLAYER2:  , '
b0lab:
db 'NEW GAME'
labelt:
db 'PONG FOR MENUET v1.0',0
w1:
db 'Player 1 wins!'
w2:
db 'Player 2 wins!'
clsign:
db 'x'
ply1x dd 200
ply1y dd 50
ball:
file "ball.raw"
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
paddle:
file "paddle.raw"
I_END:

View File

@ -24,7 +24,7 @@ include '..\..\..\macros.inc'
;__DEBUG__ fix 1
;__DEBUG_LEVEL__ fix 1
;include 'debug-fdo.inc'
flipdelay = 5
flipdelay = 7
START: ; start of execution
@ -454,14 +454,11 @@ draw_text:
mcall
sub ebx,1 shl 16
mcall
dec ebx
sub ebx,1 shl 16
sub ebx,1 shl 16 +1
mcall
sub ebx,1 shl 16
dec ebx
sub ebx,1 shl 16 + 1
mcall
dec ebx
add ebx,1 shl 16
add ebx,1 shl 16 - 1
mcall
inc ebx
mov ecx,0xffffff

View File

@ -209,9 +209,9 @@ still:
mcall
mov eax,4
mov ebx,19*65536+225
mov ecx,0xff0000
mov ecx,0xc0ff0000
mov edx,add_text
mov esi,add_text_len-add_text
mov edi,0xffffff
mcall
mov eax,10
@ -277,9 +277,9 @@ still:
mcall
mov eax,4
mov ebx,19*65536+225
mov ecx,0xff0000
mov ecx,0xc0ff0000
mov edx,rem_text
mov esi,rem_text_len-rem_text
mov edi,0xffffff
mcall
mov eax,10
@ -469,8 +469,6 @@ load_icon_list:
add esi,76+2
loop ldl1
;popa
ret
@ -489,8 +487,6 @@ positions dd 65,34,3
read_string:
;pusha
sub eax,11
shl eax,2
add eax,positions
@ -532,8 +528,6 @@ read_string:
nobsl:
cmp eax,31
jbe f11
keyok:
mov [edi],al
call print_strings
@ -554,8 +548,6 @@ read_string:
call print_strings
;popa
ret
@ -672,17 +664,17 @@ draw_window:
cmp ah,9
jbe newbline
mov ebx,19*65536+225
mov ebx,24*65536+225
mov ecx,0xffffff
mov edx,text
mov esi,37
mov esi,36
mov eax,4
newline:
mov ecx,[edx]
add edx,4
mcall
add ebx,14
add edx,37
add edx,36
cmp [edx],byte 'x'
jne newline
@ -712,16 +704,16 @@ icons_reserved:
text:
db 0,0,0,0, 'CLICK ON ICON POSITION TO EDIT '
db 0,0,0,0, ' '
db 255,255,255,0 , ' ICON TEXT '
db 255,255,255,0 , ' ICON APP '
db 255,255,255,0 , ' ICON FILE '
db 0,0,0,0, ' '
db 255,255,255,0, ' SAVE AND APPLY ALL CHANGES '
db 0,0,0,0, ' '
db 255,255,255,0, ' ADD ICON REMOVE ICON'
db 'x' ; <- END MARKER, DONT DELETE
db 0,0,0,0, 'Click on icon position to edit '
db 0,0,0,0, ' '
db 255,255,255,0 , 'Icon text '
db 255,255,255,0 , 'Icon app '
db 255,255,255,0 , 'Icon file '
db 0,0,0,0, ' '
db 255,255,255,0, ' Save and apply all changes '
db 0,0,0,0, ' '
db 255,255,255,0, ' Add icon Remove icon'
db 'x' ; <- End marker, dont delete
title db 'Icon manager',0
@ -731,11 +723,9 @@ icons dd 0
addr dd 0
ya dd 0
add_text db 'PRESS BUTTON OF UNUSED ICON POSITION'
add_text_len:
add_text db 'Press button of unused icon position',0
rem_text db 'PRESS BUTTON OF USED ICON'
rem_text_len:
rem_text db 'Press button of used icon ',0
finfo_start:
dd 7