Upload optimized Phoenix and ASCL by Kolibrius

git-svn-id: svn://kolibrios.org@9241 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-11-03 18:23:06 +00:00
parent b69f000608
commit 251d03d5f0
9 changed files with 2545 additions and 2710 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,33 +7,83 @@ lang equ ru
; GaMe ; GaMe
; Libary ; Libary
; ;
; Ver 0.03 By Pavlushin Evgeni (RUSSIA) ; Ver 0.05
; www.waptap@mail.ru ;
;InfoList ; game_collision_2d - get collision of two 2d rectangles
;0.01 correct ; result of collision test placed in CF.
;0.02 control ~14.05.2004 ; if CF = 1, objects is collided
;0.03 all macros optimized by halyavin, add at ~07.06.2004 _1dbounce_count=0;
macro game_collision_2d xy1,wh1,xy2,wh2 ;img1_off,x1,y1,img2_off,x2,y2 ;,otv
{
movt eax,xy1
movt ebx,wh1
movt ecx,xy2
movt edx,wh2
call game_collision_proc
if ~ defined game_collision_used
game_collision_used equ 1
jmp exit
; eax = x1*65536+y1
; ebx = w1*65536+h1
; ecx = x2*65536+y2
; edx = w2*65536+h2
game_collision_proc:
; y h test
call _1dbounce
jnc @f
; x w test
shr eax,16 ;eax,y1 ;
shr ebx,16 ;mov ebx,[img1_off+4] ;h1
shr ecx,16 ;mov ecx,y2 ;
shr edx,16 ;mov edx,[img2_off+4] ;h2
call _1dbounce
@@:
ret
; ax - x1, bx - w1, cx - x2, dx - w2
; or
; ax - y1, bx - h1, cx - y2, dx - h2
; if collision ecx is incremented
_1dbounce:
cmp cx,ax ; if x2 < x1 jmp anot
jb anot
add ax,bx
cmp ax,cx ; if x1+xs <= x2 not coll
jbe not_coll
coll:
stc ; CF = 1
ret
anot:
add cx,dx
cmp cx,ax ; x2 + xs2 > x1
ja coll
not_coll:
clc ; CF = 0
ret
exit:
; corectiryemoe,corectnoe,step end if
macro correct arg1,arg2,arg3 }
; approxto
macro approxto value,target_value,step
{ {
local plus,minus,equal local plus,minus,equal
mov eax,arg2 mov eax,target_value
cmp arg1,eax cmp value,eax
je equal je equal
mov eax,arg3 mov eax,step
ja minus ja minus
plus: plus:
add arg1,eax add value,eax
jmp equal jmp equal
minus: minus:
sub arg1,eax sub value,eax
equal: equal:
} }
macro control min,max,arg macro clamp min,max,arg
{ {
local gr,low,norm local gr,low,norm
mov eax,max mov eax,max

View File

@ -0,0 +1,120 @@
lang equ ru
;
; Assembler
; SMALL
; CODE
; GUI
; Libary
;
; Ver 0.01
;
macro gui_text x,y,color,font_size,text {
db 4 ; type of gui element 4 - text
dw y, x
dd (1 shl 31)+color+((font_size-1) shl 24)
db text, 0
}
macro gui_button id,x,y,w,h,bcolor,tcolor,text {
db 8 ; type of gui element 8 - button with text
dw id, w, x, h, y
dd bcolor
dd (1 shl 31)+tcolor
db text, 0
}
macro gui_end {
db 255 ; type of gui element 255 - end of gui marker
}
macro draw_gui address
{
mov esi,address
call draw_gui_proc
if ~ defined draw_gui_used
draw_gui_used equ 1
jmp end_draw_gui_proc
draw_gui_proc:
next_element:
xor eax,eax
mov al,byte [esi]
; eax =4 draw label
cmp eax,4
jne no_label
mov ebx,[esi+1] ; x,y
mov ecx,[esi+1+4] ; color
lea edx,[esi+1+4+4] ; text offset
add esi,9
mcall
jmp skip_string
no_label:
; eax = 8 draw button
cmp eax,8
jne no_draw_button
xor edx,edx
mov dx,[esi+1] ; id
mov ebx,[esi+3] ; x,xs
mov ecx,[esi+7] ; y,ys
push esi
mov esi,[esi+11] ; button color
mcall
pop esi
lea ebp,[esi+19] ; start of text
call get_size_of_string
mov ebx,6
mul ebx
mov bx,[esi+3]
sub bx,ax
shr bx,1
add bx,[esi+5]
mov dx,[esi+7]
sub dx,7
shr dx,1
add dx,[esi+9]
shl ebx,16
mov bx,dx
mov ecx,[esi+15] ; text color
lea edx,[esi+19] ; text offset
mov eax,4
add esi,19
mcall
jmp skip_string
no_draw_button:
cmp eax,255
je end_of_gui
; unknown gui element
int3
end_of_gui:
ret
get_size_of_string:
xor eax,eax
next_bt:
cmp byte [ebp],0
jne no_en
ret
no_en:
inc ebp
inc eax
jmp next_bt
; function for skip string of text
next_byte:
inc esi
skip_string:
cmp byte [esi],0
jne next_byte
inc esi
jmp next_element
end_draw_gui_proc:
end if
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
lang equ ru
;
; Assembler
; SMALL
; CODE
; Arrays
; Processing
; Libary
;
; Ver 0.04
;
; This macro iterates through an array of elements,
; processing each element using the specified process.
; modificate eax,{ebx},{ecx},edx,esi,[edi],[ebp]
macro array_processing object_array,process
{
movt edi,object_array
movt ebp,process
call array_processing_proc
if ~ defined array_processing_used
array_processing_used equ 1
jmp end_ap
array_processing_proc:
push ecx
push ebx
mov ecx,[edi] ; dword contain quantity of elements
mov ebx,[edi+4] ; dword contain size of each element
add edi,8
ap_read_next:
;pop ebx
;pop ecx
pushad
call ebp ;eax ;process
popad
;push ecx
;push ebx
add edi,ebx
dec ecx
jnz ap_read_next
pop ebx
pop ecx
ret
end_ap:
end if
}
; This macro iterates through an array of elements,
; processing each element using the specified process
; if object finded ina array macro returned
; with CF=0 and address of element in edi.
; if object not finded macro return CF=1
; process must be return CF=0 if value euqal finded value
; and CF=1 if value not equal
; modificate eax,{ebx},{ecx},edx,esi,[edi],[ebp]
macro array_find object_array,process
{
movt edi,object_array
movt ebp,process
call array_find_proc
if ~ defined array_find_used
array_find_used equ 1
jmp end_af
array_find_proc:
push ecx
push ebx
mov ecx,[edi] ; dword contain quantity of elements
mov ebx,[edi+4] ; dword contain size of each element
add edi,8
af_read_next:
pushad
call ebp ;eax ;process
popad
jnc af_finded
add edi,ebx
dec ecx
jnz af_read_next
; not finded
stc ; if not finded CF = 1
af_finded: ; if finded CF = 0
pop ebx
pop ecx
ret
end_af:
end if
}
;
; process may get offests of elements from registers.
macro compmas object_array_1,object_array_2,process
{
local loo,loo2
;lea,[oa+8]
mov esi,object_array_2 ; current position
add esi,8
mov ecx,[object_array_2] ; dword contain quantity of elements
mov ebx,[object_array_2+4] ; dword contain size of each element
mov eax,0
loo2:
push eax
mov edi,object_array_1 ; current position
add edi,8
mov ebp,[object_array_1] ; dword contain quantity of elements
mov edx,[object_array_1+4] ; dword contain size of each element
mov eax,0 ;count
loo:
pushad
call process
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
add esi,ebx
pop eax
inc eax
cmp eax,ecx
jne loo2
}
macro array_processing_nocall object_array,process
{
local read_next
lea edi,[object_array+8]
mov ecx,[object_array] ; dword contain quantity of elements
read_next:
pushad
call process
popad
add edi,[object_array+4] ; edi = edi + size of one element
dec ecx
jnz read_next
}
macro array_find_nocall object_array,process
{
local read_next,finded
lea edi,[object_array+8] ; edi = current position
mov ecx,[object_array] ; dword contain quantity of elements
read_next:
pushad
call process
popad
jnc finded
add edi,[object_array+4] ; dword contain size of each element
dec ecx
jnz read_next
; not finded
stc ; if not finded CF = 1
finded: ; if finded CF = 0
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB