Kernel: Smoothing image code from Mario79, build scripts for skin and drivers/build.bat
Programs: fasm updated to 1.67.14, small fixes in desktop, stackcfg, calc, board, pipes, freecell, big cleanup of unused programs, added some applications from 0.6.3.0 distr... git-svn-id: svn://kolibrios.org@205 a494cfbc-eb01-0410-851d-a64ba20cac60
4
kernel/trunk/drivers/build.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@fasm unisound.asm unisound.obj
|
||||
@fasm sis.asm sis.obj
|
||||
@fasm infinity.asm infinity.obj
|
||||
@pause
|
2
kernel/trunk/skin/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm default.asm default.skn
|
||||
@pause
|
@ -1032,45 +1032,110 @@ vesa20_drawbackground_stretch:
|
||||
call calculate_edi
|
||||
|
||||
|
||||
sdp3: ; MAIN LOOP
|
||||
sdp3: ; MAIN LOOP
|
||||
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
|
||||
jne snbgp
|
||||
push eax
|
||||
push ebx
|
||||
mov eax,dword [WinMapAddress-8]
|
||||
imul eax, [esp+4] ;4
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenWidth]
|
||||
div ebx
|
||||
mov cx,dx
|
||||
lea esi,[eax+eax*2]
|
||||
mov eax,dword [WinMapAddress-4]
|
||||
imul eax, [esp+0] ;0
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenHeight]
|
||||
div ebx
|
||||
shl ecx,16
|
||||
mov cx,dx
|
||||
imul eax, [esp+8] ;8
|
||||
add esi,eax
|
||||
mov eax,[esi+0x300000]
|
||||
push eax
|
||||
ror ecx,16
|
||||
xor eax,eax
|
||||
mov ax,cx
|
||||
shl eax,1 ; óìíîæåíèå íà 2
|
||||
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenWidth]
|
||||
div ebx
|
||||
cmp eax,5
|
||||
pop eax
|
||||
jb @f
|
||||
mov ebx,[esi+0x300000+3]
|
||||
call overlapping_of_points
|
||||
@@:
|
||||
push eax
|
||||
ror ecx,16
|
||||
xor eax,eax
|
||||
mov ax,cx
|
||||
shl eax,1 ; óìíîæåíèå íà 2
|
||||
lea eax,[eax+eax*4] ; óìíîæåíèå íà
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenHeight]
|
||||
div ebx
|
||||
cmp eax,5
|
||||
pop eax
|
||||
jb @f
|
||||
mov ebx,[display_data-8]
|
||||
shl ebx,1
|
||||
add ebx,[display_data-8]
|
||||
add ebx,0x300000
|
||||
add ebx,esi
|
||||
mov ebx,[ebx]
|
||||
call overlapping_of_points
|
||||
@@:
|
||||
and eax,0xffffff
|
||||
xchg edi, ebp
|
||||
stosw
|
||||
shr eax,16
|
||||
stosb
|
||||
xchg ebp, edi ; ebp+=3
|
||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
||||
jz @f
|
||||
inc ebp ; +1
|
||||
@@:
|
||||
pop ebx
|
||||
pop eax
|
||||
jmp shook1
|
||||
|
||||
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
|
||||
jne snbgp
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
|
||||
mov eax,dword [WinMapAddress-8]
|
||||
imul eax, [esp+4] ;4
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenWidth]
|
||||
div ebx
|
||||
lea esi,[eax+eax*2]
|
||||
mov eax,dword [WinMapAddress-4]
|
||||
imul eax, [esp+0] ;0
|
||||
xor edx,edx
|
||||
mov ebx,[ScreenHeight]
|
||||
div ebx
|
||||
imul eax, [esp+8] ;8
|
||||
add esi,eax
|
||||
|
||||
mov eax,[esi+0x300000]
|
||||
and eax,0xffffff
|
||||
|
||||
xchg edi, ebp
|
||||
stosw
|
||||
shr eax,16
|
||||
stosb
|
||||
xchg ebp, edi ; ebp+=3
|
||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
||||
jz @f
|
||||
inc ebp ; +1
|
||||
@@:
|
||||
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
jmp shook1
|
||||
overlapping_of_points:
|
||||
push ecx edi
|
||||
mov ecx,eax
|
||||
mov edx,ebx
|
||||
xor eax,eax
|
||||
mov al,cl
|
||||
xor ebx,ebx
|
||||
mov bl,dl
|
||||
add eax,ebx
|
||||
rcr eax,1
|
||||
xor edi,edi
|
||||
mov di,ax
|
||||
xor eax,eax
|
||||
mov al,ch
|
||||
xor ebx,ebx
|
||||
mov bl,dh
|
||||
add eax,ebx
|
||||
rcr eax,1
|
||||
ror edi,8
|
||||
add edi,eax
|
||||
ror ecx,8
|
||||
ror edx,8
|
||||
xor eax,eax
|
||||
mov al,ch
|
||||
xor ebx,ebx
|
||||
mov bl,dh
|
||||
add eax,ebx
|
||||
rcr eax,1
|
||||
ror edi,8
|
||||
add eax,edi
|
||||
ror eax,16
|
||||
pop edi ecx
|
||||
ret
|
||||
|
||||
snbgp:
|
||||
add ebp,3 ; +3
|
||||
|
@ -123,8 +123,10 @@ macro mpack dest, hsrc, lsrc
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a { ; mike.dld
|
||||
if ~a eq
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
@ -141,11 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
; language for programs
|
||||
lang fix ru ; ru en fr ge fi
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -177,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -221,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
;
|
||||
; Created: December 16, 2004
|
||||
;
|
||||
; Last changed: February 2, 2005
|
||||
; Last changed: August 27, 2006
|
||||
;
|
||||
; Compile with FASM
|
||||
|
||||
@ -237,18 +237,16 @@ _BGIfont_Prepare:
|
||||
mov esi,edi ; esi->FontName
|
||||
mov [.dest],edi ; ptr to load font
|
||||
if ~ BGI_LEVEL eq KERNEL
|
||||
mov [.fsize],1
|
||||
mov eax,58
|
||||
mov ebx,.fontinfo
|
||||
mov eax, 70
|
||||
mov ebx, .fontattr
|
||||
int 0x40
|
||||
test eax,eax
|
||||
test eax, eax
|
||||
jnz .fail
|
||||
dps2 '1'
|
||||
shr ebx,9
|
||||
inc ebx
|
||||
mov [.fsize],ebx
|
||||
mov eax, [.fileattr+32]
|
||||
mov [.fsize], eax
|
||||
mov ebx,.fontinfo
|
||||
mov eax,58
|
||||
mov eax,70
|
||||
int 0x40 ; ebx - file size
|
||||
else
|
||||
push edi esi edx
|
||||
@ -340,11 +338,22 @@ if ~ BGI_LEVEL eq KERNEL
|
||||
.fontinfo:
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
.fsize dd 0
|
||||
.dest dd 0
|
||||
dd 0x10000
|
||||
.fontfullname:
|
||||
db BGIFONT_PATH
|
||||
.font db 'FONT.CHR',0
|
||||
|
||||
.fontattr:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd .fileattr
|
||||
db 0
|
||||
dd .fontfullname
|
||||
.fileattr rd 40/4
|
||||
else
|
||||
.dest dd 0
|
||||
.font db 'FONT CHR'
|
||||
@ -479,6 +488,7 @@ end if
|
||||
loop .next
|
||||
mov ecx,edx ; ecx - x size
|
||||
movzx dx,byte[edi+6]
|
||||
mov [BGIheight],dx
|
||||
mov ebx,[esp+36]
|
||||
and ebx,BGI_HAMASK
|
||||
cmp ebx,BGI_HARIGHT
|
||||
@ -690,7 +700,7 @@ end if
|
||||
.color dd ?
|
||||
.vec_end dd ?
|
||||
BGIfont_Ptr dd 0
|
||||
width dd ?
|
||||
BGIheight dw ?
|
||||
deform dd ?
|
||||
BGIangle dd ?
|
||||
Xscale dd ?
|
||||
|
@ -7,7 +7,7 @@
|
||||
; Last changed: February 2, 2005
|
||||
;
|
||||
|
||||
BGIFONT_PATH equ '/RD/1/'
|
||||
BGIFONT_PATH equ '/RD/1/FONTS/'
|
||||
_X equ 340
|
||||
_Y equ 240
|
||||
|
||||
@ -35,8 +35,8 @@ macro ListFonts
|
||||
mcall 47,0x80100,,,0x10ffffff
|
||||
jecxz .nofont
|
||||
lea ebx,[edx+80 shl 16+12]
|
||||
mov edx,_BGIfont_Prepare.dest+8
|
||||
mov esi,BGIfont_Coo-1
|
||||
mov edx,_BGIfont_Prepare.fontfullname
|
||||
mov esi,_BGIfont_Prepare.fontattr-1
|
||||
sub esi,edx
|
||||
add ecx,0x3b800b8
|
||||
BGIfont_Outtext
|
||||
|
@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -178,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -222,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
@ -1,206 +0,0 @@
|
||||
;
|
||||
; COLOR TABLE
|
||||
;
|
||||
; Compile with FASM for Menuet
|
||||
;
|
||||
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET00' ; 8 byte id
|
||||
dd 38 ; required os
|
||||
dd START ; program start
|
||||
dd I_END ; program image size
|
||||
dd 0x1000 ; required amount of memory
|
||||
dd 0x1000 ; esp = 0x7FFF0
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
call shape_window
|
||||
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
jz red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
jz key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
jz button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jnz noclose
|
||||
mov eax,0xffffffff ; close this program
|
||||
int 0x40
|
||||
noclose:
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
shape_window:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,50 ; give the address of reference area
|
||||
mov ebx,0
|
||||
mov ecx,shape_reference
|
||||
int 0x40
|
||||
|
||||
mov eax,50 ; give the scaling ( 5 -> 2^5 )
|
||||
mov ebx,1
|
||||
mov ecx,5
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
shape_reference:
|
||||
|
||||
db 1,0,1,0,1,0,1,0
|
||||
db 0,1,0,1,0,1,0,1
|
||||
db 1,0,1,0,1,0,1,0
|
||||
db 0,1,0,1,0,1,0,1
|
||||
db 1,0,1,0,1,0,1,0
|
||||
db 0,1,0,1,0,1,0,1
|
||||
db 1,0,1,0,1,0,1,0
|
||||
db 0,1,0,1,0,1,0,1
|
||||
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
mov ebx,100*65536+255 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+255 ; [y start] *65536 + [y size]
|
||||
mov edx,0x00000000
|
||||
mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide
|
||||
mov edi,0x0099bbee ; color of frames RRGGBB
|
||||
int 0x40
|
||||
|
||||
call draw_colors
|
||||
|
||||
; CLOSE BUTTON
|
||||
mov eax,8 ; function 8 : define and draw button
|
||||
mov ebx,5*65536+12 ; [x start] *65536 + [x size]
|
||||
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
|
||||
mov edx,1 ; button id
|
||||
mov esi,0xccaa22 ; button color RRGGBB
|
||||
int 0x40
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
|
||||
draw_colors:
|
||||
|
||||
pusha
|
||||
|
||||
mov [bar],dword 0
|
||||
|
||||
mov eax,-1
|
||||
mov ebx,0
|
||||
mov ecx,0
|
||||
mov edx,0
|
||||
|
||||
mov edi,0
|
||||
|
||||
dc1:
|
||||
|
||||
add eax,1
|
||||
cmp eax,256
|
||||
jb na1
|
||||
mov eax,0
|
||||
add ebx,1
|
||||
cmp ebx,256
|
||||
jb na1
|
||||
mov ebx,0
|
||||
add ecx,5
|
||||
na1:
|
||||
|
||||
mov dl,al
|
||||
shl edx,8
|
||||
mov dl,bl
|
||||
shl edx,8
|
||||
mov dl,cl
|
||||
|
||||
na2:
|
||||
|
||||
pusha
|
||||
push edx
|
||||
|
||||
xor edx,edx
|
||||
mov eax,edi
|
||||
mov ebx,256
|
||||
div ebx
|
||||
mov ebx,edx
|
||||
mov ecx,eax
|
||||
|
||||
add ebx,[addx]
|
||||
add ecx,[addy]
|
||||
|
||||
pop edx
|
||||
mov eax,1
|
||||
int 0x40
|
||||
popa
|
||||
|
||||
add edi,1
|
||||
|
||||
cmp edi,256*256
|
||||
jb dc1
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
I_END:
|
||||
|
||||
bar dd ?
|
||||
|
||||
add1 dd ?
|
||||
add2 dd ?
|
||||
|
||||
addx dd ?
|
||||
addy dd ?
|
@ -20,7 +20,7 @@ use32
|
||||
db "MENUET01"
|
||||
dd 0x01
|
||||
dd ENTRANCE
|
||||
dd I_END
|
||||
dd EYES_END
|
||||
dd 0x3000
|
||||
dd 0x3000
|
||||
dd 0x0
|
||||
@ -30,9 +30,280 @@ include 'macros.inc'
|
||||
ENTRANCE: ; start of code
|
||||
|
||||
; ==== main ====
|
||||
|
||||
call prepare_eyes
|
||||
|
||||
call shape_window
|
||||
|
||||
still:
|
||||
|
||||
call draw_eyes ; draw those funny "eyes"
|
||||
|
||||
mov eax,23 ; wait for event with timeout
|
||||
mov ebx,TIMEOUT
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw ?
|
||||
jnz no_draw
|
||||
call redraw_overlap
|
||||
no_draw:
|
||||
|
||||
cmp eax,2 ; key ?
|
||||
jz key
|
||||
|
||||
cmp eax,3 ; button ?
|
||||
jz button
|
||||
|
||||
jmp still ; loop
|
||||
|
||||
; EVENTS
|
||||
|
||||
key:
|
||||
mov eax,2 ; just read and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
|
||||
button: ; analyze button
|
||||
mov eax,-1 ; this is button 1 - we have only one button :-)
|
||||
int 0x40
|
||||
jmp still
|
||||
|
||||
; -====- declarations -====-
|
||||
|
||||
imagedata equ EYES_END
|
||||
skindata equ EYES_END+925
|
||||
winref equ EYES_END+6325
|
||||
|
||||
; -====- shape -====-
|
||||
|
||||
shape_window:
|
||||
|
||||
mov eax,50 ; set up shape reference area
|
||||
mov ebx,0
|
||||
mov ecx,winref
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
; -====- redrawing -====-
|
||||
|
||||
draw_eyes: ; check mousepos to disable blinking
|
||||
|
||||
mov eax,37
|
||||
xor ebx,ebx
|
||||
int 0x40
|
||||
cmp dword [mouse],eax
|
||||
jne redraw_ok
|
||||
ret
|
||||
redraw_ok:
|
||||
mov [mouse],eax
|
||||
|
||||
redraw_overlap: ; label for redraw event (without checkmouse)
|
||||
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
|
||||
xor eax,eax ; define window
|
||||
mov ebx,[win_ebx]
|
||||
mov ecx,[win_ecx]
|
||||
xor edx,edx
|
||||
xor esi,esi
|
||||
xor edi,edi
|
||||
int 0x40
|
||||
|
||||
mov eax,8 ; define closebutton
|
||||
mov ebx,60
|
||||
mov ecx,45
|
||||
mov edx,1
|
||||
int 0x40
|
||||
|
||||
mov eax,7
|
||||
mov ebx,skindata
|
||||
mov ecx,60*65536+30
|
||||
mov edx,15
|
||||
int 0x40
|
||||
|
||||
mov eax,15
|
||||
mov ebx,30
|
||||
call draw_eye_point
|
||||
add eax,30
|
||||
call draw_eye_point
|
||||
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
draw_eye_point: ; draw eye point (EAX=X, EBX=Y)
|
||||
pusha
|
||||
|
||||
mov ecx, [mouse] ; ecx = mousex, edx = mousey
|
||||
mov edx,ecx
|
||||
shr ecx,16
|
||||
and edx,0xFFFF
|
||||
|
||||
; ===> calculate position
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
mov byte [sign1],0
|
||||
mov esi, [win_ebx]
|
||||
shr esi,16
|
||||
add eax,esi
|
||||
sub ecx,eax ; ECX=ECX-EAX (signed) , ECX=|ECX|
|
||||
jnc abs_ok_1
|
||||
neg ecx
|
||||
mov byte [sign1],1
|
||||
abs_ok_1:
|
||||
mov [temp1],ecx
|
||||
mov byte [sign2],0
|
||||
mov esi,[win_ecx]
|
||||
shr esi,16
|
||||
add ebx,esi
|
||||
sub edx,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX|
|
||||
jnc abs_ok_2
|
||||
neg edx
|
||||
mov byte [sign2],1
|
||||
abs_ok_2:
|
||||
mov [temp2],edx
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
push eax ; ECX*=ECX
|
||||
push edx
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
mov ax,cx
|
||||
mul cx
|
||||
shl edx,16
|
||||
or eax,edx
|
||||
mov ecx,eax
|
||||
pop edx
|
||||
pop eax
|
||||
|
||||
push eax ; EDX*=EDX
|
||||
push ecx
|
||||
mov ecx,edx
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
mov ax,cx
|
||||
mul cx
|
||||
shl edx,16
|
||||
or eax,edx
|
||||
mov edx,eax
|
||||
pop ecx
|
||||
pop eax
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push eax
|
||||
mov ebx,ecx ; EBX=ECX+EDX
|
||||
add ebx,edx
|
||||
xor edi,edi ; ESI=SQRT(EBX)
|
||||
mov ecx,edi
|
||||
mov edx,edi
|
||||
inc edi
|
||||
mov eax,edi
|
||||
inc edi
|
||||
sqrt_loop:
|
||||
add ecx,eax
|
||||
add eax,edi
|
||||
inc edx
|
||||
cmp ecx,ebx
|
||||
jbe sqrt_loop
|
||||
dec edx
|
||||
mov esi,edx
|
||||
mov ax,si ; ESI=ESI/7
|
||||
mov dl,7
|
||||
div dl
|
||||
and ax,0xFF
|
||||
mov si,ax ; ESI ? 0 : ESI=1
|
||||
jnz nozeroflag1
|
||||
mov si,1
|
||||
nozeroflag1:
|
||||
|
||||
pop eax
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
push eax ; ECX=[temp1]/ESI
|
||||
push edx
|
||||
mov eax,[temp1]
|
||||
mov dx,si
|
||||
div dl
|
||||
mov cl,al
|
||||
and ecx,0xFF
|
||||
pop edx
|
||||
pop eax
|
||||
|
||||
cmp byte [sign1],1
|
||||
je subtract_1
|
||||
add eax,ecx ; EAX=EAX+ECX
|
||||
jmp calc_ok_1
|
||||
subtract_1:
|
||||
sub eax,ecx ; EAX=EAX-ECX
|
||||
calc_ok_1:
|
||||
|
||||
push eax ; EDX=[temp2]/ESI
|
||||
push ecx
|
||||
mov eax,[temp2]
|
||||
mov dx,si
|
||||
div dl
|
||||
mov dl,al
|
||||
and dx,0xFF
|
||||
pop ecx
|
||||
pop eax
|
||||
|
||||
cmp byte [sign2],1
|
||||
je subtract_2
|
||||
add ebx,edx ; EBX=EBX+EDX
|
||||
jmp calc_ok_2
|
||||
subtract_2:
|
||||
sub ebx,edx ; EBX=EBX-EDX
|
||||
calc_ok_2:
|
||||
|
||||
; <===
|
||||
|
||||
mov ecx,ebx ; draw point
|
||||
mov ebx,eax
|
||||
mov eax,13
|
||||
dec ecx
|
||||
dec ecx
|
||||
dec ebx
|
||||
dec ebx
|
||||
shl ecx,16
|
||||
add ecx,4
|
||||
shl ebx,16
|
||||
add ebx,4
|
||||
mov eax,13
|
||||
xor edx,edx
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
; -====- working on images and window -====-
|
||||
|
||||
prepare_eyes:
|
||||
|
||||
mov esi,imagedata ; transform grayscale to putimage format
|
||||
;mov eax,6 ; load EYES.RAW
|
||||
;mov ebx,graphix
|
||||
;mov ecx,0x00000000
|
||||
;mov edx,0xFFFFFFFF
|
||||
;mov esi,imagedata
|
||||
;int 0x40
|
||||
;cmp eax,0xFFFFFFFF
|
||||
;jnz filefound
|
||||
|
||||
;mov eax,-1 ; file not exists...
|
||||
;int 0x40
|
||||
|
||||
;filefound:
|
||||
mov esi,imagedata+25 ; transform grayscale to putimage format
|
||||
mov edi,skindata
|
||||
mov ecx,30
|
||||
transform_loop:
|
||||
@ -63,7 +334,7 @@ sub eax,30*65536
|
||||
mov [win_ebx],eax
|
||||
mov [win_ecx],dword 10*65536+44
|
||||
|
||||
mov esi,imagedata ; calculate shape reference area
|
||||
mov esi,imagedata+25 ; calculate shape reference area
|
||||
mov edi,winref
|
||||
mov ecx,900 ; disable drag bar
|
||||
mov al,0
|
||||
@ -80,203 +351,19 @@ call copy_line
|
||||
pop ecx
|
||||
loop shape_loop
|
||||
|
||||
; -====- shape -====-
|
||||
|
||||
shape_window:
|
||||
|
||||
mov eax,50 ; set up shape reference area
|
||||
xor ebx,ebx
|
||||
mov ecx,winref
|
||||
int 0x40
|
||||
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
|
||||
call draw_eyes ; draw those funny "eyes"
|
||||
|
||||
_wait:
|
||||
mov eax,23 ; wait for event with timeout
|
||||
mov ebx,TIMEOUT
|
||||
int 0x40
|
||||
dec eax
|
||||
jz redraw
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jnz still
|
||||
button:
|
||||
or eax, -1
|
||||
int 0x40
|
||||
key:
|
||||
mov al, 2
|
||||
int 0x40
|
||||
jmp still
|
||||
redraw:
|
||||
call draw_window
|
||||
call redraw_eyes
|
||||
jmp _wait
|
||||
|
||||
; -====- redrawing -====-
|
||||
|
||||
draw_eyes: ; check mousepos to disable blinking
|
||||
|
||||
mov eax,37
|
||||
xor ebx,ebx
|
||||
int 0x40
|
||||
cmp dword [mouse],eax
|
||||
jne redraw_ok
|
||||
ret
|
||||
redraw_ok:
|
||||
mov [mouse],eax
|
||||
|
||||
redraw_eyes:
|
||||
mov eax,7
|
||||
mov ebx,skindata
|
||||
mov ecx,60*65536+30
|
||||
mov edx,15
|
||||
int 0x40
|
||||
|
||||
mov eax,15
|
||||
mov ebx,30
|
||||
call draw_eye_point
|
||||
add eax,30
|
||||
call draw_eye_point
|
||||
ret
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
|
||||
xor eax,eax ; define window
|
||||
mov ebx,[win_ebx]
|
||||
mov ecx,[win_ecx]
|
||||
xor edx,edx
|
||||
xor esi,esi
|
||||
xor edi,edi
|
||||
int 0x40
|
||||
|
||||
mov eax,8 ; define closebutton
|
||||
mov ebx,60
|
||||
mov ecx,45
|
||||
mov edx,1
|
||||
int 0x40
|
||||
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
draw_eye_point: ; draw eye point (EAX=X, EBX=Y)
|
||||
pusha
|
||||
|
||||
movzx ecx, word [mouse+2] ; ecx = mousex, esi = mousey
|
||||
movzx esi, word [mouse]
|
||||
|
||||
; ===> calculate position
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
mov byte [sign1],0
|
||||
mov edx, [win_ebx]
|
||||
shr edx,16
|
||||
add eax,edx
|
||||
sub ecx,eax ; ECX=ECX-EAX (signed) , ECX=|ECX|
|
||||
jnc abs_ok_1
|
||||
neg ecx
|
||||
mov byte [sign1],1
|
||||
abs_ok_1:
|
||||
push ecx ; save x distance
|
||||
mov byte [sign2],0
|
||||
mov edx,[win_ecx]
|
||||
shr edx,16
|
||||
add ebx,edx
|
||||
sub esi,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX|
|
||||
jnc abs_ok_2
|
||||
neg esi
|
||||
mov byte [sign2],1
|
||||
abs_ok_2:
|
||||
mov [temp2],esi
|
||||
|
||||
; ESI = ECX*ECX+ESI*ESI
|
||||
imul ecx, ecx
|
||||
imul esi, esi
|
||||
add esi, ecx
|
||||
|
||||
xor ecx,ecx ; EDX=SQRT(EBX)
|
||||
xor edx,edx
|
||||
mov eax,1
|
||||
sqrt_loop:
|
||||
; in this moment ecx=edx*edx, eax=1+2*edx
|
||||
add ecx,eax
|
||||
inc eax
|
||||
inc eax
|
||||
inc edx
|
||||
cmp ecx,esi
|
||||
jbe sqrt_loop
|
||||
dec edx
|
||||
mov eax,edx ; EDX=EDX/7
|
||||
mov dl,7
|
||||
div dl
|
||||
and eax,0xFF
|
||||
mov edx,eax ; EDX ? 0 : EDX=1
|
||||
jnz nozeroflag1
|
||||
inc edx
|
||||
nozeroflag1:
|
||||
|
||||
pop eax ; EAX = x distance
|
||||
; ECX=EAX/EDX
|
||||
div dl
|
||||
movzx ecx,al
|
||||
pop ebx
|
||||
pop eax
|
||||
|
||||
cmp byte [sign1], 0
|
||||
jz @f
|
||||
neg ecx
|
||||
@@:
|
||||
add eax, ecx
|
||||
|
||||
push eax ; ESI=[temp2]/EDX
|
||||
mov eax,[temp2]
|
||||
div dl
|
||||
movzx esi,al
|
||||
pop eax
|
||||
|
||||
cmp byte [sign2], 0
|
||||
jz @f
|
||||
neg esi
|
||||
@@:
|
||||
add ebx, esi
|
||||
|
||||
; <===
|
||||
|
||||
; draw point
|
||||
lea ecx, [ebx-2]
|
||||
lea ebx, [eax-2]
|
||||
shl ecx,16
|
||||
add ecx,4
|
||||
shl ebx,16
|
||||
add ebx,4
|
||||
mov eax,13
|
||||
xor edx,edx
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
; -====- working on images and window -====-
|
||||
|
||||
copy_line: ; copy single line to shape reference area
|
||||
mov ecx,30
|
||||
cpl_loop:
|
||||
lodsb
|
||||
; input is image: 0xFF = white pixel, 0 = black pixel
|
||||
; output is membership boolean: 0 = pixel no, 1 = pixel ok
|
||||
inc eax
|
||||
cmp al,0xFF
|
||||
jnz set_one
|
||||
mov al,0
|
||||
jmp cpl_ok
|
||||
set_one:
|
||||
mov al,1
|
||||
cpl_ok:
|
||||
stosb
|
||||
loop cpl_loop
|
||||
ret
|
||||
@ -288,19 +375,14 @@ ret
|
||||
win_ebx dd 0x0
|
||||
win_ecx dd 0x0
|
||||
mouse dd 0xFFFFFFFF
|
||||
|
||||
EYES_END: ; end of code
|
||||
imagedata:
|
||||
; texture is 900 bytes starting from 25th
|
||||
file "eyes.raw":25,900
|
||||
I_END:
|
||||
;graphix db "EYES.RAW "
|
||||
|
||||
; temporary storage for math routines
|
||||
|
||||
sign1 db ?
|
||||
sign2 db ?
|
||||
align 4
|
||||
temp2 dd ?
|
||||
temp1 dd 0
|
||||
temp2 dd 0
|
||||
sign1 db 0
|
||||
sign2 db 0
|
||||
|
||||
skindata rb 60*30*3
|
||||
winref rb 45*60
|
||||
EYES_END: ; end of code
|
||||
file "EYES.RAW"
|
||||
|
@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -178,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -222,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
2
programs/demos/fire/trunk/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm fire.asm fire
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm fire.asm fire
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm fire.asm fire
|
||||
@pause
|
@ -13,7 +13,6 @@ use32
|
||||
dd mem_end
|
||||
dd 0,0 ; no parameters, no path
|
||||
|
||||
;include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
|
||||
START:
|
||||
|
@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -178,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -222,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
2
programs/demos/fire2/trunk/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm fire2.asm fire2
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm fire2.asm fire2
|
||||
@pause
|
@ -9,7 +9,6 @@ use32
|
||||
dd mem_end
|
||||
dd 0x0, 0x0
|
||||
|
||||
;include 'lang.inc'
|
||||
START:
|
||||
|
||||
mov edi, my_img
|
||||
|
@ -143,9 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -177,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -221,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
@ -146,7 +146,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
@ -22,7 +22,7 @@ APP_MEMORY = 0x00800000
|
||||
|
||||
;; Menuet header
|
||||
|
||||
appname equ "FASM "
|
||||
appname equ "flat assembler "
|
||||
|
||||
use32
|
||||
|
||||
@ -392,11 +392,11 @@ text:
|
||||
s_compile db 'COMPILE'
|
||||
s_run db ' RUN '
|
||||
|
||||
infile db 'EXAMPLE.ASM'
|
||||
infile db 'example.asm'
|
||||
times MAX_PATH+$-infile db 0
|
||||
outfile db 'EXAMPLE'
|
||||
outfile db 'example'
|
||||
times MAX_PATH+$-outfile db 0
|
||||
path db '/RD/1/'
|
||||
path db '/rd/1/'
|
||||
times MAX_PATH+$-path db 0
|
||||
|
||||
lf db 13,10,0
|
||||
|
@ -33,7 +33,7 @@
|
||||
; cannot simply be copied and put under another distribution licence
|
||||
; (including the GNU Public Licence).
|
||||
|
||||
VERSION_STRING equ "1.67.13"
|
||||
VERSION_STRING equ "1.67.14"
|
||||
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 67
|
||||
|
@ -223,6 +223,10 @@ basic_instruction:
|
||||
cdq
|
||||
cmp ecx,edx
|
||||
jne value_out_of_range
|
||||
cmp [value_type],4
|
||||
jne get_simm32_ok
|
||||
mov [value_type],2
|
||||
get_simm32_ok:
|
||||
ret
|
||||
basic_reg:
|
||||
lods byte [esi]
|
||||
@ -6019,6 +6023,9 @@ get_address:
|
||||
mov edx,[symbol_identifier]
|
||||
mov [address_symbol],edx
|
||||
mov edx,eax
|
||||
ror ecx,16
|
||||
mov cl,[value_type]
|
||||
rol ecx,16
|
||||
mov bx,0FF00h
|
||||
address_ok:
|
||||
ret
|
||||
|
2
programs/develop/mtdbg/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm mtdbg.asm mtdbg
|
||||
@pause
|
4825
programs/develop/mtdbg/mtdbg.asm
Normal file
203
programs/develop/mtdbg/mtdbg.txt
Normal file
@ -0,0 +1,203 @@
|
||||
Введение.
|
||||
|
||||
mtdbg представляет собой отладчик для операционной системы Kolibri. Данная
|
||||
документация описывает возможности отладчика и работу с ним. Если нужны
|
||||
какие-то возможности отладчика, которых ещё нет, либо обращайтесь на форум
|
||||
meos.sysbin.com (раздел "Программы"), либо мыльте мне на адрес, указанный в
|
||||
конце данного файла.
|
||||
|
||||
Общее описание.
|
||||
|
||||
В каждый момент времени mtdbg может отлаживать только одну программу. Назовём
|
||||
такую программу загруженной для отладки. Если никакая программа не загружена,
|
||||
абсолютное большинство действий по отладке недоступно.
|
||||
|
||||
mtdbg управляется командной строкой, вводимой с клавиатуры. Командная строка
|
||||
изображается в нижней части окна отладчика. Обрабатываются стандартные клавиши
|
||||
ввода Backspace,Delete,Home,End,стрелки влево/вправо.
|
||||
Команды нечувствительны к регистру символов. В качестве разделителя
|
||||
используется произвольное ненулевое число пробелов.
|
||||
|
||||
В любой момент отладчик можно завершить командой "quit" (без аргументов).
|
||||
Впрочем, можно и просто нажать на кнопку закрытия в левом верхнем углу окна.
|
||||
|
||||
Запуск отладчика без параметров командной строки приводит к тому, что
|
||||
никакая программа не загружена. Также mtdbg можно запускать с командной
|
||||
строкой, в этом случае он попытается загрузить программу с именем, указанным
|
||||
как первый аргумент командной строки, и параметрами, указанными как
|
||||
последующие (если они есть).
|
||||
|
||||
Если никакая программа не загружена, то можно загрузить программу командой
|
||||
load <полное имя исполняемого файла> [<аргументы>]
|
||||
Например:
|
||||
load /rd/1/example
|
||||
LOAD /rd/1/aclock w200 h200
|
||||
LoaD /hd0/1/menuetos/dosbox/dosbox
|
||||
Всё, что стоит после первого пробела после имени исполняемого файла, дословно
|
||||
передаётся программе в качестве командной строки.
|
||||
Команда load сообщает о результате в окне сообщений (немного выше окна
|
||||
командной строки). Если программу удалось загрузить, то об этом появится
|
||||
соответствующее сообщение; если не удалось, то в сообщении будет указана
|
||||
причина ошибки. Наиболее вероятная - "file not found", если неправильно указано
|
||||
имя файла.
|
||||
Может случиться так, что загруженная программа упакована. Общий принцип
|
||||
упаковки программ следующий: сначала исходный файл пакуется (каким-нибудь
|
||||
алгоритмом сжатия), потом приписывается небольшой по размеру код, который
|
||||
получает управление при запуске программы, распаковывает в памяти исходный код,
|
||||
после чего передаёт ему управление. Если программа упакована, то её "настоящий"
|
||||
код не виден и для отладки нужно предварительно пройти код распаковщика.
|
||||
mtdbg определяет большинство существующих упаковщиков (mxp,mxp_lzo,mxp_nrv,
|
||||
mtappack) и в этом случае предлагает автоматически пройти до "настоящего" кода.
|
||||
Рекомендуется согласиться (нажать 'y' или <Enter>), но можно и отказаться.
|
||||
При отказе и в случае, когда программа упакована чем-то неизвестным, можно
|
||||
использовать команду "unpack" (без аргументов). Вызывайте её только в случае,
|
||||
когда вы уверены, что программа упакована и что управление ещё не дошло до
|
||||
основного кода!
|
||||
|
||||
Загруженную программу можно прибить командой "terminate" (без аргументов).
|
||||
Команда "detach" (без аргументов) отключается от программы, после чего
|
||||
программа продолжает выполняться нормально, как если бы отладчика не было.
|
||||
После обеих этих команд программа перестаёт быть отлаживаемой.
|
||||
|
||||
Можно заново загрузить программу для отладки командой "reload" (без
|
||||
аргументов). Если уже есть загруженная программа, то она прибивается и
|
||||
запускается (с самого начала) новый экземпляр (с той же командной строкой),
|
||||
в этом случае команда аналогична командам
|
||||
terminate
|
||||
load <last program name> <last program arguments>
|
||||
В противном случае заново загружается программа, которую отлаживали последней
|
||||
(в текущем сеансе работы с mtdbg) (с той же командной строкой), т.е. почти то
|
||||
же самое, что и
|
||||
load <last program name> <last program arguments>,
|
||||
но команда reload в обоих случаях короче и удобнее; кроме того, load считает,
|
||||
что загружается новая программа, и переводит окно данных (см. ниже) на
|
||||
нулевой адрес, а reload сохраняет текущий адрес.
|
||||
|
||||
Всегда доступна команда "help", которую можно сокращать до "h".
|
||||
Все команды разбиты на группы.
|
||||
help без аргументов показывает список групп команд.
|
||||
help с указанием группы выводит список команд этой группы с краткими
|
||||
комментариями.
|
||||
help с указанием команды выводит информацию о заданной команде.
|
||||
Например:
|
||||
help
|
||||
help control
|
||||
h LoaD
|
||||
|
||||
Окно отладчика состоит из следующих элементов, перечисляемых сверху вниз:
|
||||
- строка состояния. При наличии загруженной программы показывает ее имя и
|
||||
состояние ("Running"/"Paused"), при отсутствии сообщает "No program loaded".
|
||||
- окно регистров - показывает значения регистров общего назначения, регистра
|
||||
eip и регистра флагов. Последний записан двумя способами: полное hex-значение
|
||||
и состояния отдельных флагов: CF,PF,AF,ZF,SF,DF,OF: если флаг сброшен, то
|
||||
изображается маленькая буква, если установлен, то заглавная.
|
||||
Регистры, изменившиеся с предыдущего момента, подсвечиваются зеленым.
|
||||
- окно данных (окно дампа) - показывает содержимое памяти загруженной программы
|
||||
- окно кода (окно дизассемблера) - показывает код программы в виде
|
||||
дизассемблированных инструкций
|
||||
- окно сообщений
|
||||
- окно командной строки
|
||||
|
||||
В окне дампа можно просматривать данные, начиная с любого адреса, для этого
|
||||
есть команда
|
||||
d <выражение>
|
||||
Команда d без аргументов пролистывает окно дампа вниз.
|
||||
То же самое относится к окну кода и команде
|
||||
u <выражение>
|
||||
или просто u.
|
||||
Например:
|
||||
d esi - показывает данные, находящиеся по адресу esi (например, полезна перед
|
||||
выполнением инструкции rep movsb)
|
||||
d esp - показывает стек
|
||||
u eip - дизассемблирует инструкции, начиная с текущей
|
||||
|
||||
Выражения в mtdbg могут включать
|
||||
- шестнадцатеричные константы
|
||||
- имена всех регистров общего назначения (8 32-битных, 8 16-битных и
|
||||
8 8-битных) и регистра eip; значения 16- и 8-битных регистров расширяются
|
||||
нулями до 32 бит
|
||||
- четыре арифметические операции +,-,*,/ (со стандартными приоритетами) и
|
||||
скобки.
|
||||
Все вычисления производятся по модулю 2^32.
|
||||
Примеры выражений:
|
||||
eax
|
||||
eip+2
|
||||
ecx-esi-1F
|
||||
al+AH*bl
|
||||
ax + 2* bH*(eip+a73)
|
||||
3*esi*di/EAX
|
||||
Команда
|
||||
? <выражение>
|
||||
вычисляет значение указанного выражения.
|
||||
|
||||
Значения регистров загруженной программы можно изменять командой r, имеющей
|
||||
две абсолютно эквивалентные формы:
|
||||
r <регистр> <выражение>
|
||||
r <регистр>=<выражение>
|
||||
(в обоих случаях можно расставлять пробелы по вкусу). В качестве регистра можно
|
||||
указывать любой из вышеупомянутых - 24 регистра общего назначения и eip.
|
||||
|
||||
|
||||
Допустим, команда load успешно загрузила программу для отладки.
|
||||
Сразу после загрузки программа приостановлена и не выполняется.
|
||||
Нажатие Ctrl+F7 (аналог командной строки - команда "s") делает один шаг в
|
||||
загруженной программе, после чего управление возвращается отладчику, который
|
||||
показывает новое содержимое регистров и памяти. Системный вызов int 40h при
|
||||
этом считается одним шагом.
|
||||
Нажатие Ctrl+F8 (аналог командной строки - команда "p") также делает шаг в
|
||||
загруженной программе, но при этом вызовы процедур, строковые операции с
|
||||
префиксом rep/repz/repnz и циклы loop выполняются как один шаг.
|
||||
Команды пошагового выполнения используются, как правило, на отдельных участках
|
||||
программы, когда нужно, например, регулярно отслеживать значения регистров
|
||||
и/или каких-то переменных в памяти.
|
||||
Команда
|
||||
g <выражение>
|
||||
возобновляет выполнение программы и ждёт, пока управление дойдёт до
|
||||
eip=соответствующему адресу, а в этот момент приостанавливает программу.
|
||||
Команда "g" без аргументов просто возобновляет выполнение программы.
|
||||
|
||||
Приостановить выполнение программы можно командой "stop" (без аргументов).
|
||||
|
||||
Обычно требуется, чтобы программа нормально выполнялась, но при наступлении
|
||||
определённых условий программа приостанавалась и управление получал отладчик.
|
||||
Соответствующие условия называются точками останова, breakpoint(s), в
|
||||
просторечии - бряками. Простейший тип точек останова - на конкретный адрес,
|
||||
т.е. прерывать выполнение при eip=<заданное значение>. Такие точки останова
|
||||
устанавливаются командой
|
||||
bp <выражение>
|
||||
Замечание. Если есть только одна такая точка останова, удобнее вместо неё
|
||||
использовать команду "g" с аргументом.
|
||||
|
||||
Другой тип точек останова - по обращению к заданному участку памяти.
|
||||
Таких точек останова может быть не больше четырёх (поскольку используются
|
||||
аппаратные возможности процессоров x86, где допускаются только 4 таких точки).
|
||||
bpm <выражение> - брякается на любой доступ к байту по указанному адресу
|
||||
bpm w <выражение> - брякается на запись байта по указанному адресу
|
||||
bpmb,bpmw,bpmd <выражение> - брякаются на доступ к соответственно байту, слову
|
||||
и двойному слову по указанному адресу. bpm и bpmb - синонимы. При использовании
|
||||
bpmw,bpmd адрес должен быть выровнен соответственно на границу слова (т.е. быть
|
||||
чётным) или на границу двойного слова (т.е. делиться на 4).
|
||||
bpmb,bpmw,bpmd w <выражение> - аналогично для бряка на запись.
|
||||
|
||||
Список установленных точек останова можно просмотреть командой "bl", информацию
|
||||
о конкретной точке останова можно получить с помощью "bl <номер>". Ненужные
|
||||
точки останова удаляются командой "bc <номер>", временно ненужные можно
|
||||
запретить командой "bd <номер>", когда они станут снова нужны, используйте
|
||||
команду "be <номер>".
|
||||
|
||||
Замечания.
|
||||
|
||||
1. При отладке собственных программ можно вставлять в код инструкции
|
||||
int3 (обратите внимание на отсутствие пробела!). Такая инструкция вызывает
|
||||
исключение при нормальном запуске, что приведёт к завершению процесса,
|
||||
но при работе под отладчиком просто активизируется отладчик (с сообщением
|
||||
"int3 command at xxx"). Это позволяет не думать о том, какие адреса
|
||||
использовать в командах g и/или bp.
|
||||
2. Весь вывод и весь ввод ориентирован на 16-ричную систему счисления.
|
||||
3. Когда программа выполняется, окна регистров и данных показывают информацию,
|
||||
относящуюся к моменту до возобновления; установка значений регистров в
|
||||
этом режиме невозможна. Впрочем, команда "d" в этом режиме показывает
|
||||
информацию, верную в момент выдачи команды.
|
||||
|
||||
diamond
|
||||
mailto:diamondz@land.ru
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm mview.asm mview
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm mview.asm mview
|
||||
@pause
|
@ -143,9 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
@ -177,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -221,7 +218,13 @@ struc process_information
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm hexhd.asm hexhd
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm hexhd.asm hexhd
|
||||
@pause
|
@ -1,235 +0,0 @@
|
||||
;
|
||||
; EXAMPLE APPLICATION
|
||||
;
|
||||
; Compile with FASM for Menuet
|
||||
;
|
||||
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET00' ; 8 byte id
|
||||
dd 38 ; required os
|
||||
dd START ; program start
|
||||
dd I_END ; program image size
|
||||
dd 0x5000 ; required amount of memory
|
||||
dd 0x5000 ; esp = 0x7FFF0
|
||||
dd 0x00000000 ; reserved=no extended header
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
call open_file
|
||||
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne noclose
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
noclose:
|
||||
|
||||
cmp ah,2
|
||||
jne noexam
|
||||
jmp still
|
||||
noexam:
|
||||
|
||||
cmp ah,3
|
||||
jne noback
|
||||
mov edi,block
|
||||
cmp dword [edi],0
|
||||
je nonext
|
||||
dec dword [edi]
|
||||
call open_file
|
||||
call draw_window
|
||||
noback:
|
||||
|
||||
cmp ah,4
|
||||
jne nonext
|
||||
mov edi,block
|
||||
inc dword [edi]
|
||||
call open_file
|
||||
call draw_window
|
||||
nonext:
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
mov ebx,0*65536+400 ; [x start] *65536 + [x size]
|
||||
mov ecx,0*65536+270+200 ; [y start] *65536 + [y size]
|
||||
mov edx,0x038899aa;1111cc ; color of work area RRGGBB,8->c
|
||||
int 0x40
|
||||
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,144*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx,0x00ffffff ; color of text RRGGBB
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
|
||||
mov eax,47 ;decimal
|
||||
mov ecx,[block]
|
||||
mov edx,64*65536+34
|
||||
mov ebx,10
|
||||
shl ebx,16
|
||||
mov esi,0x00ffffff
|
||||
int 0x40
|
||||
|
||||
add edx,128*65536 ;hex
|
||||
mov bh,1
|
||||
int 0x40
|
||||
|
||||
mov eax,8
|
||||
mov ebx,280*65536+16*6
|
||||
mov ecx,30*65536+14
|
||||
|
||||
mov edx,2
|
||||
mov esi,0x3f49df;5599cc
|
||||
int 0x40
|
||||
|
||||
mov ebx,15*65536+32
|
||||
add edx,1
|
||||
mov eax,8
|
||||
int 0x40
|
||||
|
||||
add ebx,127*65536
|
||||
add edx,1
|
||||
mov eax,8
|
||||
int 0x40
|
||||
|
||||
|
||||
mov eax,4
|
||||
mov ebx,14*65536+33
|
||||
mov ecx,0xffffff
|
||||
mov edx,buttons
|
||||
mov esi,blen-buttons
|
||||
int 0x40
|
||||
|
||||
|
||||
mov ebx,280*65536+65 ; draw info text with function 4
|
||||
mov ecx,0xffffff
|
||||
mov edx,text
|
||||
mov esi,16
|
||||
mov edi,16*2
|
||||
newline:
|
||||
|
||||
pusha ; hext
|
||||
|
||||
mov edi,16
|
||||
|
||||
mov ecx,edx
|
||||
|
||||
mov edx,ebx
|
||||
sub edx,265*65536
|
||||
|
||||
newhex:
|
||||
|
||||
mov eax,47
|
||||
mov ebx,0x00020101
|
||||
xor esi,0xffff00
|
||||
int 0x40
|
||||
|
||||
add edx,16*65536
|
||||
add ecx,1
|
||||
|
||||
dec edi
|
||||
jne newhex
|
||||
|
||||
popa
|
||||
|
||||
mov eax,4 ; text
|
||||
int 0x40
|
||||
add ebx,12
|
||||
add edx,16
|
||||
dec edi
|
||||
jnz newline
|
||||
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
open_file:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,58
|
||||
mov ebx,fileinfo
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
fileinfo:
|
||||
dd 8
|
||||
block dd 0
|
||||
dd 1
|
||||
dd text
|
||||
dd os
|
||||
db '/HARDDISK/FIRST',0
|
||||
|
||||
|
||||
labelt:
|
||||
db 'EDITOR HEXADECIMAL'
|
||||
labellen:
|
||||
|
||||
buttons db ' << >> << OPTIONS >> '
|
||||
blen:
|
||||
|
||||
os:
|
||||
times 16384 db ?
|
||||
text:
|
||||
|
||||
I_END:
|
@ -1,265 +0,0 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a { ; mike.dld
|
||||
if ~a eq
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
@ -3596,12 +3596,14 @@ associations:
|
||||
dd aJpg, jpegview
|
||||
dd aJpeg, jpegview
|
||||
dd aGif, gifview
|
||||
dd aWav, ac97wav
|
||||
dd aMp3, ac97wav
|
||||
dd aWav, ac97
|
||||
dd aMp3, ac97
|
||||
dd aMid, midamp
|
||||
dd aBmp, mv
|
||||
dd aPng, archer
|
||||
dd aRtf, rtfread
|
||||
dd a3ds, view3ds
|
||||
dd aLif, life2
|
||||
associations_end:
|
||||
|
||||
aAsm db 'asm',0
|
||||
@ -3618,7 +3620,7 @@ gifview db '/rd/1/GIFVIEW',0
|
||||
|
||||
aWav db 'wav',0
|
||||
aMp3 db 'mp3',0
|
||||
ac97wav db '/rd/1/AC97WAV',0
|
||||
ac97 db '/rd/1/AC97SND',0
|
||||
|
||||
aMid db 'mid',0
|
||||
midamp db '/rd/1/MIDAMP',0
|
||||
@ -3632,6 +3634,12 @@ archer db '/rd/1/@rcher',0
|
||||
aRtf db 'rtf',0
|
||||
rtfread db '/rd/1/RtfRead',0
|
||||
|
||||
a3ds db '3ds',0
|
||||
view3ds db '/rd/1/3d/view3ds',0
|
||||
|
||||
aLif db 'lif',0
|
||||
life2 db '/rd/1/demos/life2',0
|
||||
|
||||
bConfirmDelete db 1
|
||||
|
||||
; ‡¤¥áì § ª 稢 îâáï ª®ä¨£ãà æ¨®ë¥ ¤ ë¥
|
||||
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm rdfdel.asm rdfdel
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm rdfdel.asm rdfdel
|
||||
@pause
|
@ -1,232 +0,0 @@
|
||||
;
|
||||
; FILE COPIER
|
||||
;
|
||||
; Compile with FASM for Menuet
|
||||
;
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET00' ; 8 byte id
|
||||
dd 38 ; required os
|
||||
dd START ; program start
|
||||
dd I_END ; program image size
|
||||
dd 0x1000 ; required amount of memory
|
||||
dd 0x1000
|
||||
dd 0 ; reserved=no extended header
|
||||
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
jz red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
jz key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
jz button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jnz noclose
|
||||
mov eax,0xffffffff ; close this program
|
||||
int 0x40
|
||||
noclose:
|
||||
|
||||
|
||||
cmp ah,3 ; delete ?
|
||||
jnz nodelete
|
||||
mov eax,32
|
||||
mov ebx,destination
|
||||
int 0x40
|
||||
jmp still
|
||||
nodelete:
|
||||
|
||||
|
||||
cmp ah,4
|
||||
jz f2
|
||||
jmp nof12
|
||||
|
||||
f2:
|
||||
mov [addr],dword destination
|
||||
mov [ya],dword 35
|
||||
jmp rk
|
||||
|
||||
rk:
|
||||
mov edi,[addr]
|
||||
mov al,' '
|
||||
mov ecx,11
|
||||
rep stosb
|
||||
|
||||
call print_text
|
||||
|
||||
mov edi,[addr]
|
||||
|
||||
f11:
|
||||
mov eax,10
|
||||
int 0x40
|
||||
cmp eax,2
|
||||
jz fbu
|
||||
jmp still
|
||||
fbu:
|
||||
mov eax,2
|
||||
int 0x40
|
||||
shr eax,8
|
||||
cmp eax,8
|
||||
jnz nobs
|
||||
cmp edi,[addr]
|
||||
jz f11
|
||||
sub edi,1
|
||||
mov [edi],byte 0
|
||||
call print_text
|
||||
jmp f11
|
||||
nobs:
|
||||
cmp eax,dword 31
|
||||
jbe f11
|
||||
cmp eax,dword 95
|
||||
jb keyok
|
||||
sub eax,32
|
||||
keyok:
|
||||
mov [edi],al
|
||||
|
||||
call print_text
|
||||
|
||||
add edi,1
|
||||
mov esi,[addr]
|
||||
add esi,11
|
||||
cmp esi,edi
|
||||
jnz f11
|
||||
|
||||
jmp still
|
||||
|
||||
print_text:
|
||||
|
||||
mov eax,13
|
||||
mov ebx,109*65536+11*6
|
||||
mov ecx,[ya]
|
||||
shl ecx,16
|
||||
mov cx,8
|
||||
mov edx,0xffffff
|
||||
int 0x40
|
||||
|
||||
mov eax,4
|
||||
mov ebx,109*65536
|
||||
add ebx,[ya]
|
||||
mov ecx,0x000000
|
||||
mov edx,[addr]
|
||||
mov esi,11
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
nof12:
|
||||
jmp still
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+105 ; [y start] *65536 + [y size]
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB
|
||||
int 0x40
|
||||
|
||||
; WINDOW LABEL
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx,0x10ffffff ; color of text RRGGBB
|
||||
mov edx,header ; pointer to text beginning
|
||||
mov esi,header.len ; text length
|
||||
int 0x40
|
||||
|
||||
mov esi,0xbbbbbb
|
||||
|
||||
mov eax,8 ; DELETE BUTTON
|
||||
mov ebx,20*65536+190
|
||||
mov ecx,63*65536+15
|
||||
mov edx,3
|
||||
int 0x40
|
||||
|
||||
mov eax,8
|
||||
mov ebx,200*65536+10
|
||||
mov ecx,33*65536+10
|
||||
mov edx,4
|
||||
int 0x40
|
||||
|
||||
mov esi,destination
|
||||
mov edi,text+14
|
||||
mov ecx,11
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
mov ebx,25*65536+35 ; draw info text with function 4
|
||||
mov ecx,0x0
|
||||
mov edx,text
|
||||
mov esi,40
|
||||
newline:
|
||||
mov eax,4
|
||||
int 0x40
|
||||
add ebx,16*2
|
||||
add edx,40
|
||||
cmp [edx],byte 'x'
|
||||
jnz newline
|
||||
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
destination db 'EXAMPLE.ASM'
|
||||
|
||||
addr dd 0x0
|
||||
ya dd 0x0
|
||||
|
||||
text:
|
||||
db 'FILENAME : yyyyyyyyyyy '
|
||||
db ' DELETE FROM RAMDISK '
|
||||
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
|
||||
header:
|
||||
db 'RAMDISK FILE DELETE'
|
||||
.len = $ - header
|
||||
|
||||
I_END:
|
@ -1,15 +1,3 @@
|
||||
; language for programs
|
||||
lang fix en ; ru en fr ge fi
|
||||
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
|
||||
macro m2m dest,src {
|
||||
push src
|
||||
pop dest
|
||||
}
|
||||
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
@ -89,7 +77,14 @@ struc mstr [sstring]
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
name db data
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
@ -98,61 +93,17 @@ macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if lang eq lng
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m
|
||||
m = 0
|
||||
if used name
|
||||
label name
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
end if
|
||||
}
|
||||
|
||||
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m,c
|
||||
m = 0
|
||||
c = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
c = c+1
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
.count = c
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; easy system call macro
|
||||
@ -172,12 +123,6 @@ macro mpack dest, hsrc, lsrc
|
||||
end if
|
||||
}
|
||||
|
||||
;macro __mov reg,a { ; mike.dld
|
||||
; if ~a eq
|
||||
; mov reg,a
|
||||
; end if
|
||||
;}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
@ -197,71 +142,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
}
|
||||
|
||||
|
||||
; -------------------------
|
||||
macro header a,[b] {
|
||||
common
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET',a
|
||||
forward
|
||||
if b eq
|
||||
dd 0
|
||||
else
|
||||
dd b
|
||||
end if }
|
||||
macro section name { align 16
|
||||
label name }
|
||||
macro func name {
|
||||
if ~used name
|
||||
display 'FUNC NOT USED: ',`name,13,10
|
||||
else
|
||||
align 4
|
||||
name:
|
||||
;pushad
|
||||
;pushfd
|
||||
;dps `name
|
||||
;newline
|
||||
;mcall 5,1
|
||||
;popfd
|
||||
;popad
|
||||
}
|
||||
macro endf { end if }
|
||||
|
||||
macro diff16 title,l1,l2
|
||||
{
|
||||
local s,d
|
||||
s = l2-l1
|
||||
display title,': 0x'
|
||||
repeat 8
|
||||
d = '0' + s shr ((8-%) shl 2) and $0F
|
||||
if d > '9'
|
||||
d = d + 'A'-'9'-1
|
||||
end if
|
||||
display d
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
macro diff10 title,l1,l2
|
||||
{
|
||||
local s,d,z,m
|
||||
s = l2-l1
|
||||
z = 0
|
||||
m = 1000000000
|
||||
display title,': '
|
||||
repeat 10
|
||||
d = '0' + s / m
|
||||
s = s - (s/m)*m
|
||||
m = m / 10
|
||||
if d <> '0'
|
||||
z = 1
|
||||
end if
|
||||
if z <> 0
|
||||
display d
|
||||
end if
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
@ -294,7 +174,7 @@ macro sub arg1,arg2
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
@ -314,230 +194,54 @@ macro mov arg1,arg2
|
||||
}
|
||||
|
||||
|
||||
macro RGB [a] {
|
||||
common
|
||||
match (r=,g=,b),a \{
|
||||
\dd ((r) shl 16) or ((g) shl 8) or (b)
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
struc POINT _t,_dx,_dy {
|
||||
.x _t _dx
|
||||
.y _t _dy
|
||||
}
|
||||
|
||||
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
{
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
not_used1 dw ? ; +8
|
||||
process_name rb 12 ; +10
|
||||
memory_start dd ? ; +22
|
||||
used_memory dd ? ; +26
|
||||
PID dd ? ; +30
|
||||
x_start dd ? ; +34
|
||||
y_start dd ? ; +38
|
||||
x_size dd ? ; +42
|
||||
y_size dd ? ; +46
|
||||
slot_state dw ? ; +50
|
||||
rb (1024-52)
|
||||
ends
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
frame dd ?
|
||||
grab dd ?
|
||||
grab_button dd ?
|
||||
grab_button_text dd ?
|
||||
grab_text dd ?
|
||||
work dd ?
|
||||
work_button dd ?
|
||||
work_button_text dd ?
|
||||
work_text dd ?
|
||||
work_graph dd ?
|
||||
ends
|
||||
|
||||
|
||||
; constants
|
||||
|
@ -607,9 +607,11 @@ is_brow:
|
||||
mov ebx, gifview
|
||||
cmp ecx, 'GIF'
|
||||
jz run
|
||||
mov ebx, ac97wav
|
||||
mov ebx, ac97
|
||||
cmp ecx, 'WAV'
|
||||
jz run
|
||||
cmp ecx, 'MP3'
|
||||
jz run
|
||||
mov ebx, midamp
|
||||
cmp ecx, 'MID'
|
||||
jz run
|
||||
@ -631,6 +633,12 @@ is_brow:
|
||||
jz run
|
||||
cmp ecx, 'INC'
|
||||
jz run
|
||||
mov ebx, life2
|
||||
cmp ecx, 'LIF'
|
||||
jz run
|
||||
mov ebx, view3ds
|
||||
cmp ecx, '3DS' and not 0x20202020
|
||||
jz run
|
||||
jmp still
|
||||
|
||||
execute:
|
||||
@ -2540,12 +2548,14 @@ editor db '/RD/1/TINYPAD',0
|
||||
bmpview db '/RD/1/MV',0
|
||||
jpgview db '/RD/1/JPEGVIEW',0
|
||||
gifview db '/RD/1/GIFVIEW',0
|
||||
ac97wav db '/RD/1/AC97WAV',0
|
||||
ac97 db '/RD/1/AC97SND',0
|
||||
rtfread db '/RD/1/RTFREAD',0
|
||||
; //// Willow
|
||||
pngview db '/RD/1/@RCHER',0
|
||||
; //// Willow
|
||||
midamp db '/RD/1/MIDAMP',0
|
||||
view3ds db '/RD/1/3D/VIEW3DS',0
|
||||
life2 db '/RD/1/DEMOS/LIFE2',0
|
||||
|
||||
more_char db 10h
|
||||
|
||||
|
BIN
programs/games/freecell/Buben.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/Club.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/ClubSml.bmp
Normal file
After Width: | Height: | Size: 248 B |
BIN
programs/games/freecell/ClubUD.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/Cross.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/Diam.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/DiamSml.bmp
Normal file
After Width: | Height: | Size: 248 B |
BIN
programs/games/freecell/DiamUD.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/Heart.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/HeartSml.bmp
Normal file
After Width: | Height: | Size: 248 B |
BIN
programs/games/freecell/HeartUD.bmp
Normal file
After Width: | Height: | Size: 824 B |
269
programs/games/freecell/MACROS.INC
Normal file
@ -0,0 +1,269 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
BIN
programs/games/freecell/Pick.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/Spade.bmp
Normal file
After Width: | Height: | Size: 824 B |
BIN
programs/games/freecell/SpadeSml.bmp
Normal file
After Width: | Height: | Size: 248 B |
BIN
programs/games/freecell/SpadeUD.bmp
Normal file
After Width: | Height: | Size: 824 B |
2
programs/games/freecell/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm freecell.asm freecell
|
||||
@pause
|
2096
programs/games/freecell/freecell.ASM
Normal file
26
programs/games/freecell/play.txt
Normal file
@ -0,0 +1,26 @@
|
||||
FreeCell.
|
||||
|
||||
You can find this games in Windows XP and Linux Mandrake 9.0 distributions.
|
||||
|
||||
Rules to FreeCell can be found in help files for those games but I place here
|
||||
game rules from site www.freecell.org:
|
||||
|
||||
4 cells (top left) - storage locations for cards.
|
||||
Only 1 card allowed in each cell.
|
||||
|
||||
8 tableau piles (below foundations and cells) - build down by alternate color.
|
||||
Move groups of cards if they are in sequence down by alternate color and if
|
||||
there are enough free cells that the cards could be moved individually.
|
||||
Spaces can be filled by any card or legal group of cards (see KingOnly for
|
||||
option). At the start of the game 7 cards are dealt face up to the leftmost 4
|
||||
piles, 6 cards are dealt face up to the remaining piles.
|
||||
|
||||
Some features not implemented yet: moving groups of cards - you
|
||||
can move only one card at one time, no automatic moving of
|
||||
some cards in home.
|
||||
|
||||
|
||||
You only need to copy the file freecell to the floppy; The rest of the
|
||||
files are for assembling the code.
|
||||
|
||||
Alexandr Gorbovets gorsash@mail.ru
|
@ -1,835 +0,0 @@
|
||||
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
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm life.asm life
|
||||
@pause
|
@ -1,4 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm life.asm life
|
||||
@pause
|
@ -1,190 +0,0 @@
|
||||
;
|
||||
; LIFE.ASM
|
||||
;
|
||||
; This program displays Conways game of life
|
||||
;
|
||||
; Compile with FASM for Menuet;
|
||||
;
|
||||
;
|
||||
; Version 0.1 30th March 2004
|
||||
; Mike Hibbett
|
||||
;
|
||||
; Version 0.2 23th May 2004
|
||||
; Random generation dots with start
|
||||
;
|
||||
; Convert to ASCL Libary by Pavlushin Evgeni
|
||||
;
|
||||
; This is an experiment to see how small a usefull application can get
|
||||
;
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0x100000 ; memory for app
|
||||
dd 0x100000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
include 'ascl.inc'
|
||||
|
||||
macro setcell x,y { mov [esi + 512*(y)*3 + (x)*3], al }
|
||||
|
||||
START:
|
||||
|
||||
mov al, 0xFF
|
||||
mov esi, I_END
|
||||
|
||||
; This is the seed pattern.
|
||||
|
||||
; Life needs a seed pattern, which is 'hardcode' at compile time
|
||||
; The grid is 512 wide (x direction) by 512 deep (y direction)
|
||||
; setcell take the arguments setcell x,y
|
||||
; 0,0 is the top left corner.
|
||||
|
||||
setcell 200,120
|
||||
setcell 201,120
|
||||
setcell 200,121
|
||||
setcell 199,121
|
||||
setcell 200,122
|
||||
|
||||
setcell 70,120
|
||||
setcell 71,120
|
||||
setcell 70,121
|
||||
setcell 69,121
|
||||
setcell 70,122
|
||||
|
||||
call draw_window
|
||||
|
||||
;Random generation dots
|
||||
|
||||
mov ecx,20000
|
||||
xxx:
|
||||
push ecx
|
||||
random 30000,edi ;up pice of screen
|
||||
mov al,0xff
|
||||
shl edi,3
|
||||
; mov [I_END+edi],al
|
||||
; random 50000,edi ;down pice of screen
|
||||
; mov al,0xff
|
||||
; shl edi,3
|
||||
add edi,512*460 ;760
|
||||
mov [I_END+edi],al
|
||||
pop ecx
|
||||
dec ecx
|
||||
jnz xxx
|
||||
|
||||
still:
|
||||
|
||||
timeevent 5,nokey,red,key,button ;Wait EVENT with 5 fps
|
||||
jmp still
|
||||
|
||||
red: ; REDRAW WINDOW
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; KEY
|
||||
mov eax,2 ; get it, but ignore
|
||||
int 0x40
|
||||
|
||||
nokey:
|
||||
|
||||
; cycle life state
|
||||
|
||||
mov esi, I_END + 512*3
|
||||
|
||||
mov al, 0xFF
|
||||
|
||||
lifeloop:
|
||||
mov ah, 0
|
||||
cmp [esi - 3], al
|
||||
jne t2
|
||||
inc ah
|
||||
t2:
|
||||
cmp [esi + 3], al
|
||||
jne t3
|
||||
inc ah
|
||||
t3:
|
||||
cmp [esi - 512*3], al
|
||||
jne t4
|
||||
inc ah
|
||||
t4:
|
||||
cmp [esi + 512*3], al
|
||||
jne t5
|
||||
inc ah
|
||||
t5:
|
||||
cmp [esi - 512*3 - 3], al
|
||||
jne t6
|
||||
inc ah
|
||||
t6:
|
||||
cmp [esi - 512*3 + 3], al
|
||||
jne t7
|
||||
inc ah
|
||||
t7:
|
||||
cmp [esi + 512*3 - 3], al
|
||||
jne t8
|
||||
inc ah
|
||||
t8:
|
||||
cmp [esi + 512*3 + 3], al
|
||||
jne tend
|
||||
inc ah
|
||||
|
||||
tend:
|
||||
; If cell is empty but has 3 neigbours, birth
|
||||
; If cell is occupied and has 2,3 neigbours, live
|
||||
; else die
|
||||
|
||||
cmp ah, 3
|
||||
jne btest
|
||||
mov [esi+1], al
|
||||
jmp nextcell
|
||||
|
||||
btest:
|
||||
cmp ah, 2
|
||||
jne nextcell
|
||||
cmp [esi], al
|
||||
jne nextcell
|
||||
mov [esi+1], al
|
||||
|
||||
nextcell:
|
||||
add esi, 3
|
||||
cmp esi, I_END + 512*512*3
|
||||
jne lifeloop
|
||||
|
||||
; copy new generation across
|
||||
|
||||
mov ecx, 512*512*3
|
||||
mov esi, I_END+1
|
||||
mov edi, I_END
|
||||
rep movsb ; copy the data across
|
||||
|
||||
mov ecx, 512*512
|
||||
mov esi, I_END
|
||||
nc1:
|
||||
mov [esi+2], byte 0
|
||||
add esi, 3
|
||||
loop nc1
|
||||
|
||||
mov ebx, I_END
|
||||
mov ecx, 512*65536+512
|
||||
mov edx, 5*65536+20
|
||||
mov eax,7
|
||||
int 0x40
|
||||
|
||||
jmp still
|
||||
|
||||
button: ; BUTTON - only close supported
|
||||
close
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
draw_window:
|
||||
startwd
|
||||
window 50,50,512+9,512+23,window_Skinned
|
||||
label 8,8,'Life Screen',cl_White+font_Big
|
||||
endwd
|
||||
ret
|
||||
|
||||
I_END:
|
2
programs/games/pipes/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@fasm pipes.asm pipes
|
||||
@pause
|
649
programs/games/pipes/pipes.asm
Normal file
@ -0,0 +1,649 @@
|
||||
;
|
||||
; pipes for menuet {and now kolibri}
|
||||
; v1.2
|
||||
; 2006 by Mario Birkner
|
||||
;
|
||||
; l.mod. 27.08.06/15:11
|
||||
;
|
||||
; Compile with FASM
|
||||
;
|
||||
bgcolor equ 0x0074744A ;thx
|
||||
fgcolor equ 0x00E7C750 ;to
|
||||
fg2color equ 0x00E0B0A0 ;colorref
|
||||
fg3color equ 0x007F7F55
|
||||
btcolor equ 0x005B6200
|
||||
|
||||
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0x100000 ; memory for app
|
||||
dd 0x7fff0 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
call draw_window
|
||||
call draw_board
|
||||
|
||||
still:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
call draw_board
|
||||
call draw_message
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
button: ; button
|
||||
call get_input
|
||||
jmp still
|
||||
|
||||
|
||||
|
||||
get_input:
|
||||
pusha
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne .noclose
|
||||
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
.noclose:
|
||||
cmp ah,4
|
||||
jne .moderate
|
||||
mov [diffic],1
|
||||
jmp .enddiffic
|
||||
.moderate:
|
||||
cmp ah,3
|
||||
jne .easy
|
||||
mov [diffic],3
|
||||
jmp .enddiffic
|
||||
.easy:
|
||||
cmp ah,2
|
||||
jne .board
|
||||
mov [diffic],5
|
||||
.enddiffic:
|
||||
mov [score],0
|
||||
mov [speed],40
|
||||
mov [level],1
|
||||
mov [stat],0
|
||||
mov [time],0
|
||||
call draw_window
|
||||
call scramble_board
|
||||
call draw_board
|
||||
call countdown
|
||||
call wassermarsch
|
||||
jmp .getno
|
||||
.board:
|
||||
cmp [stat],2
|
||||
jge .getno
|
||||
shr eax,8 ; -> 24bit id
|
||||
cmp eax,10
|
||||
jle .getno
|
||||
cmp eax,150
|
||||
jg .getno
|
||||
sub eax,10
|
||||
mov edi,eax
|
||||
add edi,map
|
||||
cmp [edi], byte 1
|
||||
jg .nogerade
|
||||
xor byte [edi], 1
|
||||
call draw_board
|
||||
jmp .getno
|
||||
.nogerade:
|
||||
cmp [edi], byte 6
|
||||
jge .getno
|
||||
cmp [edi], byte 5
|
||||
jne .rota
|
||||
sub byte [edi],4
|
||||
.rota:
|
||||
inc byte [edi]
|
||||
call draw_board
|
||||
.getno:
|
||||
popa
|
||||
ret
|
||||
;//// end of event detection
|
||||
get_direction: ;Setzt Richtungs-Konstanten
|
||||
pusha ;IN:
|
||||
mov eax,[esp+28] ;eax - Richtung IN
|
||||
mov ebx,[esp+16] ;ebx - Teilchen (Map-Wert)
|
||||
cmp ebx,0 ;OUT:
|
||||
jne .no0 ;eax - Richtung OUT
|
||||
cmp eax,14
|
||||
jne .o0
|
||||
jmp .setout
|
||||
.o0:
|
||||
cmp eax,-14
|
||||
jne .col
|
||||
jmp .setout
|
||||
.no0:
|
||||
cmp ebx,1
|
||||
jne .no1
|
||||
cmp eax,1
|
||||
jne .o1
|
||||
jmp .setout
|
||||
.o1:
|
||||
cmp eax,-1
|
||||
jne .col
|
||||
jmp .setout
|
||||
.no1:
|
||||
cmp ebx,2
|
||||
jne .no2
|
||||
cmp eax,14
|
||||
jne .o2
|
||||
sub eax,13
|
||||
jmp .setout
|
||||
.o2:
|
||||
cmp eax,-1
|
||||
jne .col
|
||||
sub eax,13
|
||||
jmp .setout
|
||||
.no2:
|
||||
cmp ebx,3
|
||||
jne .no3
|
||||
cmp eax,-14
|
||||
jne .o3
|
||||
add eax,15
|
||||
jmp .setout
|
||||
.o3:
|
||||
cmp eax,-1
|
||||
jne .col
|
||||
add eax,15
|
||||
jmp .setout
|
||||
.no3:
|
||||
cmp ebx,4
|
||||
jne .no4
|
||||
cmp eax,-14
|
||||
jne .o4
|
||||
add eax,13
|
||||
jmp .setout
|
||||
.o4:
|
||||
cmp eax,1
|
||||
jne .col
|
||||
add eax,13
|
||||
jmp .setout
|
||||
.no4:
|
||||
cmp ebx,5
|
||||
jne .no5
|
||||
cmp eax,14
|
||||
jne .o5
|
||||
sub eax,15
|
||||
jmp .setout
|
||||
.o5:
|
||||
cmp eax,1
|
||||
jne .col
|
||||
sub eax,15
|
||||
jmp .setout
|
||||
.no5:
|
||||
cmp ebx,6
|
||||
jne .no6
|
||||
jmp .setout
|
||||
.no6:
|
||||
cmp ebx,7
|
||||
jne .no7
|
||||
mov eax,14
|
||||
jmp .setout
|
||||
.no7:
|
||||
cmp ebx,8
|
||||
jne .no8
|
||||
cmp eax,14
|
||||
jne .col
|
||||
mov [stat],1
|
||||
jmp .setout
|
||||
.no8:
|
||||
cmp ebx,16 ; cross 2x
|
||||
jne .col
|
||||
add [score],10 ; + 10 bonus points
|
||||
jmp .setout
|
||||
.col:
|
||||
xor eax,eax
|
||||
.setout:
|
||||
xor ebx,ebx
|
||||
mov [esp+28],eax
|
||||
mov [esp+16],ebx
|
||||
popa
|
||||
ret
|
||||
|
||||
countdown:
|
||||
pusha
|
||||
xor eax,eax
|
||||
mov al,[diffic]
|
||||
imul eax,10
|
||||
mov [time],eax
|
||||
.udown:
|
||||
call show_score
|
||||
mov ecx,10
|
||||
.down:
|
||||
mov eax,5
|
||||
mov ebx,10
|
||||
int 0x40
|
||||
mov eax,11
|
||||
int 0x40
|
||||
cmp eax,1
|
||||
jne .nored
|
||||
call draw_window
|
||||
call draw_board
|
||||
jmp .nothing
|
||||
.nored:
|
||||
cmp eax,3
|
||||
jne .nothing
|
||||
call get_input
|
||||
.nothing:
|
||||
cmp [stat],0 ;bugfix 210806
|
||||
jnz .exitsub ;bugfix 210806
|
||||
dec ecx
|
||||
jnz .down
|
||||
dec [time]
|
||||
jnz .udown
|
||||
.exitsub: ;bugfix 210806
|
||||
popa
|
||||
ret
|
||||
|
||||
wassermarsch:
|
||||
pusha
|
||||
.restart:
|
||||
mov esi,map+16 ;start position
|
||||
mov eax, 14 ;start-richtung
|
||||
.findway:
|
||||
movzx ebx, byte [esi]
|
||||
call get_direction
|
||||
test eax,eax
|
||||
jz .collision
|
||||
push eax
|
||||
xor eax,eax
|
||||
mov al,6
|
||||
sub al,[diffic]
|
||||
add [score],eax ;points/item = 6 - difficulty
|
||||
mov ecx,dword [speed]
|
||||
add byte [esi],10
|
||||
.down:
|
||||
mov eax,5
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
mov eax,11
|
||||
int 0x40
|
||||
cmp eax,1
|
||||
jne .nored
|
||||
call draw_window
|
||||
.nored:
|
||||
cmp eax,3
|
||||
jne .noevnt
|
||||
call get_input
|
||||
.noevnt:
|
||||
dec ecx
|
||||
jnz .down
|
||||
pop eax
|
||||
|
||||
add esi,eax
|
||||
call draw_board
|
||||
call show_score
|
||||
jmp .findway
|
||||
.collision:
|
||||
cmp [stat],1
|
||||
jne .loose
|
||||
call draw_message
|
||||
mov eax,5
|
||||
mov ebx,500
|
||||
int 0x40
|
||||
mov [stat],0
|
||||
inc [level]
|
||||
cmp [speed],6 ;waterflowdelay < 6 ?
|
||||
jle .skipsub
|
||||
sub [speed],2
|
||||
.skipsub:
|
||||
call draw_window
|
||||
call scramble_board
|
||||
call draw_board
|
||||
call countdown
|
||||
jmp .restart
|
||||
.loose:
|
||||
mov [stat],2
|
||||
call draw_message
|
||||
popa
|
||||
ret
|
||||
|
||||
show_score:
|
||||
pusha
|
||||
mov eax,13 ;clear time and score area
|
||||
mov ebx,50 shl 16 +15
|
||||
mov ecx,395 shl 16 +15
|
||||
mov edx,bgcolor
|
||||
int 0x40
|
||||
add ebx,60 shl 16 + 20
|
||||
int 0x40
|
||||
add ebx,80 shl 16
|
||||
int 0x40
|
||||
mov eax,47
|
||||
mov ebx,0x20000
|
||||
mov ecx,[time]
|
||||
mov edx,50*65536+398
|
||||
mov esi,fg2color
|
||||
int 0x40
|
||||
mov ebx,0x50000
|
||||
mov ecx,[score]
|
||||
add edx,60 shl 16
|
||||
int 0x40
|
||||
mov ebx,0x20000
|
||||
mov ecx,[level]
|
||||
add edx,80 shl 16
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
scramble_board:
|
||||
pusha
|
||||
mov edi,map+16 ;startpunkt
|
||||
mov eax,7 ;wieder-
|
||||
stosb ;herstellen
|
||||
|
||||
mov ebx, 0x00000007 ;modul m max-wert
|
||||
.loop_through:
|
||||
mov esi,edi
|
||||
lodsb
|
||||
cmp eax, 9
|
||||
je .skip
|
||||
inc eax
|
||||
xor edx, edx
|
||||
div ebx ;modulo -> edx
|
||||
mov eax, edx
|
||||
cmp eax,6
|
||||
jne .skip
|
||||
dec [half]
|
||||
movzx eax, byte [half]
|
||||
jnz .skip
|
||||
mov [half], byte 7
|
||||
.skip:
|
||||
stosb
|
||||
cmp edi,map+125 ;endpunkt erhalten
|
||||
jge .exit
|
||||
jmp .loop_through
|
||||
.exit:
|
||||
mov eax,8
|
||||
stosb
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
gen_image:
|
||||
pusha
|
||||
xor ebx,ebx ;default: kein wasser
|
||||
movzx eax,byte [map] ;erstes byte der map lesen (position)
|
||||
inc byte [map] ;position inkrementieren
|
||||
add eax,map ;zur position die map-adresse addieren
|
||||
movzx esi,byte [eax]
|
||||
cmp esi,10
|
||||
jl .nowater
|
||||
sub esi,10 ;map-werte+10 sind mit wasser gefuellt
|
||||
mov ebx,1
|
||||
cmp esi,16
|
||||
jne .nowater
|
||||
sub esi,10
|
||||
.nowater:
|
||||
imul esi,3072 ;mapwert * 32*32*3 = image-adresse
|
||||
add esi,images
|
||||
mov edi,0x10000
|
||||
mov ecx,32*32*3
|
||||
.gendd: ;RGB-Image im Speicher generieren
|
||||
mov eax,dword [esi] ;byte aus imagemap lesen
|
||||
shl eax,8
|
||||
shr eax,8
|
||||
cmp ebx,0
|
||||
jz .nowcolor
|
||||
mov ebx,eax
|
||||
cmp ebx,0x00B0B5B0
|
||||
jne .nog1
|
||||
jmp .wcolor
|
||||
.nog1:
|
||||
cmp ebx,0x00A0A5A0
|
||||
jne .nog2
|
||||
jmp .wcolor
|
||||
.nog2:
|
||||
cmp ebx,0x00909590
|
||||
jne .nog3
|
||||
jmp .wcolor
|
||||
.nog3:
|
||||
cmp ebx,0x00808580
|
||||
jne .nog4
|
||||
jmp .wcolor
|
||||
.nog4:
|
||||
cmp ebx,0x00707570
|
||||
jne .nowcolor
|
||||
jmp .wcolor
|
||||
.wcolor:
|
||||
add eax,0x40
|
||||
.nowcolor:
|
||||
add esi,3
|
||||
stosd
|
||||
dec edi
|
||||
loop .gendd
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
draw_message:
|
||||
pusha
|
||||
cmp [stat],0
|
||||
je .nomessage
|
||||
cmp [stat],3
|
||||
je .nomessage
|
||||
mov eax,13
|
||||
mov ebx,146 shl 16 + 200
|
||||
mov ecx,190 shl 16 + 40
|
||||
mov edx,0x0
|
||||
int 0x40
|
||||
add ebx,2 shl 16 - 4
|
||||
add ecx,2 shl 16 - 4
|
||||
mov edx,fgcolor
|
||||
int 0x40
|
||||
|
||||
cmp [stat],1
|
||||
je .winmessage
|
||||
mov eax,4
|
||||
mov ebx,186 shl 16 +200
|
||||
mov edx,lbl_gameover+1
|
||||
movzx esi,byte [lbl_gameover]
|
||||
mov ecx,btcolor
|
||||
add ecx,0x10000000
|
||||
int 0x40
|
||||
add ebx,8 shl 16 +17
|
||||
mov edx,lbl_yscore+1
|
||||
movzx esi,byte [lbl_yscore]
|
||||
mov ecx,btcolor
|
||||
int 0x40
|
||||
mov esi,ecx ;color
|
||||
mov edx,ebx ;pos
|
||||
add edx,80 shl 16
|
||||
mov ebx,0x50000 ;type
|
||||
mov ecx,[score] ;inp
|
||||
mov eax,47
|
||||
int 0x40
|
||||
jmp .nomessage
|
||||
.winmessage:
|
||||
mov eax,4
|
||||
mov ebx,152 shl 16 +200
|
||||
mov edx,lbl_win+1
|
||||
movzx esi,byte [lbl_win]
|
||||
mov ecx,btcolor
|
||||
add ecx,0x10000000
|
||||
int 0x40
|
||||
mov ebx,152 shl 16 +217
|
||||
add edx,esi
|
||||
mov ecx,btcolor
|
||||
int 0x40
|
||||
.nomessage:
|
||||
popa
|
||||
ret
|
||||
|
||||
draw_board:
|
||||
pusha
|
||||
mov ebx,15*65536+32
|
||||
mov ecx,50*65536+32
|
||||
mov edx,15*65536+50 ;Spielfeldposition
|
||||
mov esi,10 ;Spielfeldgroesse Y
|
||||
.vloop:
|
||||
mov edi,14 ;Spielfeldgroesse X
|
||||
.hloop:
|
||||
call gen_image
|
||||
push edx
|
||||
mov eax,8
|
||||
movsx edx, byte [map]
|
||||
add edx,9 ;button-id = map-pos + 10;gen_image inkrements
|
||||
add edx,0x50000000 ;no button image - no esi need
|
||||
int 0x40
|
||||
pop edx
|
||||
push ebx
|
||||
push ecx
|
||||
mov eax,7
|
||||
mov ebx,0x10000
|
||||
mov ecx,32 shl 16 +32
|
||||
int 0x40
|
||||
pop ecx
|
||||
pop ebx
|
||||
add edx,33 shl 16
|
||||
add ebx,33 shl 16
|
||||
dec edi
|
||||
jnz .hloop
|
||||
sub edx,14*(33 shl 16) ;Spielfeldgroesse X
|
||||
sub ebx,14*(33 shl 16)
|
||||
add edx,33
|
||||
add ecx,33 shl 16
|
||||
dec esi
|
||||
jnz .vloop
|
||||
mov [map], byte 1 ;Map-Position zuruecksetzen
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
draw_window:
|
||||
pusha
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
int 0x40
|
||||
|
||||
; DRAW WINDOW
|
||||
mov eax,0 ; function 0 : define and draw window
|
||||
mov ebx,100*65536+492 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+420 ; [y start] *65536 + [y size]
|
||||
mov edx,bgcolor ; color of work area RRGGBB,8->color gl
|
||||
or edx,0x13000000
|
||||
mov edi,header
|
||||
int 0x40
|
||||
|
||||
mov eax,8
|
||||
mov ebx,84*65536+72
|
||||
mov ecx,28*65536+15
|
||||
mov edx,2
|
||||
mov esi,btcolor
|
||||
int 0x40
|
||||
add ebx,76 shl 16
|
||||
inc edx
|
||||
int 0x40
|
||||
add ebx,76 shl 16
|
||||
inc edx
|
||||
int 0x40
|
||||
|
||||
mov eax,4
|
||||
mov ebx,26 shl 16 +32
|
||||
mov ecx,fgcolor
|
||||
mov edx,lbl_toolbar+1
|
||||
movsx esi, byte [lbl_toolbar]
|
||||
int 0x40
|
||||
mov ebx,18 shl 16 +398
|
||||
mov edx,lbl_score+1
|
||||
movsx esi, byte [lbl_score]
|
||||
int 0x40
|
||||
mov ebx,350 shl 16 +405
|
||||
mov ecx,fg3color
|
||||
mov edx,lbl_copy+1
|
||||
movsx esi,byte [lbl_copy]
|
||||
int 0x40
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
|
||||
header db 'PIPES',0
|
||||
lbl_gameover:
|
||||
db 19
|
||||
db 'G a m e O v e r !'
|
||||
lbl_win:
|
||||
db 32
|
||||
db ' G r e a t ! '
|
||||
db " Let's goin'on! "
|
||||
lbl_yscore:
|
||||
db 11
|
||||
db 'Your Score:'
|
||||
lbl_toolbar:
|
||||
db 43
|
||||
db 'New Game: Easy Moderate Hard'
|
||||
lbl_copy:
|
||||
db 23
|
||||
db 'v1.2 2006,Mario Birkner'
|
||||
lbl_score:
|
||||
db 28
|
||||
db 'Time: Score: Level:'
|
||||
stat db 3 ;0=gameplay 1=won 2-lost 3=stopped
|
||||
speed db 0
|
||||
time dd 0
|
||||
diffic db 0 ;1=hard 3=moderate 5=easy 8=dedicated to Wildwest - try it out!
|
||||
score dd 0
|
||||
level dd 1
|
||||
half db 1 ;reduces the random-crosses
|
||||
|
||||
map: ;14*10 blocks + position
|
||||
db 1 ;<- act. position
|
||||
db 9,9,9,9,9,9,9,9,9,9,9,9,9,9
|
||||
db 9,7,1,3,2,0,1,1,0,3,4,4,3,9
|
||||
db 9,5,0,2,2,1,3,0,3,1,1,6,4,9
|
||||
db 9,4,0,4,6,0,3,3,2,6,0,1,2,9
|
||||
db 9,3,0,1,2,4,6,4,5,1,2,4,1,9
|
||||
db 9,5,3,2,6,3,2,1,2,1,2,6,0,9
|
||||
db 9,4,0,2,3,0,4,1,2,3,2,3,4,9
|
||||
db 9,2,0,4,5,6,3,1,3,0,4,1,0,9
|
||||
db 9,1,0,3,5,4,2,2,4,1,6,0,8,9
|
||||
db 9,9,9,9,9,9,9,9,9,9,9,9,9,9
|
||||
images:
|
||||
file 'pipes.raw'
|
||||
I_END:
|
||||
|
||||
|
||||
|
||||
|
1
programs/games/pipes/pipes.raw
Normal file
@ -220,7 +220,7 @@ button: ; button
|
||||
jmp still
|
||||
|
||||
end_program:
|
||||
mov eax,-1 ; close this program
|
||||
or eax,-1 ; close this program
|
||||
int 0x40
|
||||
|
||||
go_new_game:
|
||||
|