Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 204 → Rev 205

/kernel/trunk/drivers/build.bat
0,0 → 1,4
@fasm unisound.asm unisound.obj
@fasm sis.asm sis.obj
@fasm infinity.asm infinity.obj
@pause
/kernel/trunk/skin/build.bat
0,0 → 1,2
@fasm default.asm default.skn
@pause
/kernel/trunk/video/vesa20.inc
1033,18 → 1033,16
 
 
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
1051,12 → 1049,47
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
1066,12 → 1099,44
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
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
/programs/demos/colors/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/demos/colors/trunk/colors.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/demos/colors/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/demos/colors/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/demos/3dcube2/trunk/macros.inc
123,8 → 123,10
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
 
 
 
; 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 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
.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
 
/programs/demos/bgitest/trunk/bgifont.inc
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
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
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
.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
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
.color dd ?
.vec_end dd ?
BGIfont_Ptr dd 0
width dd ?
BGIheight dw ?
deform dd ?
BGIangle dd ?
Xscale dd ?
/programs/demos/bgitest/trunk/bgitest.asm
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
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
/programs/demos/bgitest/trunk/macros.inc
143,10 → 143,6
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
178,7 → 174,7
 
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
.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
 
/programs/demos/eyes/trunk/eyes.asm
20,7 → 20,7
db "MENUET01"
dd 0x01
dd ENTRANCE
dd I_END
dd EYES_END
dd 0x3000
dd 0x3000
dd 0x0
30,93 → 30,61
ENTRANCE: ; start of code
 
; ==== main ====
prepare_eyes:
 
mov esi,imagedata ; transform grayscale to putimage format
mov edi,skindata
mov ecx,30
transform_loop:
push ecx
mov ecx,30
lp1:
lodsb
stosb
stosb
stosb
loop lp1
sub esi,30
mov ecx,30
lp2:
lodsb
stosb
stosb
stosb
loop lp2
pop ecx
loop transform_loop
call prepare_eyes
 
mov eax,14 ; calculating screen position
call shape_window
 
still:
 
call draw_eyes ; draw those funny "eyes"
 
mov eax,23 ; wait for event with timeout
mov ebx,TIMEOUT
int 0x40
shr eax,1
mov ax,59
sub eax,30*65536
mov [win_ebx],eax
mov [win_ecx],dword 10*65536+44
 
mov esi,imagedata ; calculate shape reference area
mov edi,winref
mov ecx,900 ; disable drag bar
mov al,0
rep stosb
cmp eax,1 ; redraw ?
jnz no_draw
call redraw_overlap
no_draw:
 
mov ecx,30 ; calculate circles for eyes
shape_loop:
push ecx
cmp eax,2 ; key ?
jz key
 
call copy_line ; duplicate (we have two eyes :)
sub esi,30
call copy_line
cmp eax,3 ; button ?
jz button
 
pop ecx
loop shape_loop
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
xor ebx,ebx
mov ebx,0
mov ecx,winref
int 0x40
 
call draw_window
ret
 
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
130,22 → 98,8
redraw_ok:
mov [mouse],eax
 
redraw_eyes:
mov eax,7
mov ebx,skindata
mov ecx,60*65536+30
mov edx,15
int 0x40
redraw_overlap: ; label for redraw event (without checkmouse)
 
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
164,6 → 118,18
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
173,8 → 139,10
draw_eye_point: ; draw eye point (EAX=X, EBX=Y)
pusha
 
movzx ecx, word [mouse+2] ; ecx = mousex, esi = mousey
movzx esi, word [mouse]
mov ecx, [mouse] ; ecx = mousex, edx = mousey
mov edx,ecx
shr ecx,16
and edx,0xFFFF
 
; ===> calculate position
 
181,82 → 149,132
push eax
push ebx
mov byte [sign1],0
mov edx, [win_ebx]
shr edx,16
add eax,edx
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:
push ecx ; save x distance
mov [temp1],ecx
mov byte [sign2],0
mov edx,[win_ecx]
shr edx,16
add ebx,edx
sub esi,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX|
mov esi,[win_ecx]
shr esi,16
add ebx,esi
sub edx,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX|
jnc abs_ok_2
neg esi
neg edx
mov byte [sign2],1
abs_ok_2:
mov [temp2],esi
mov [temp2],edx
pop ebx
pop eax
 
; ESI = ECX*ECX+ESI*ESI
imul ecx, ecx
imul esi, esi
add esi, ecx
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
 
xor ecx,ecx ; EDX=SQRT(EBX)
push eax ; EDX*=EDX
push ecx
mov ecx,edx
xor eax,eax
xor edx,edx
mov eax,1
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:
; in this moment ecx=edx*edx, eax=1+2*edx
add ecx,eax
inc eax
inc eax
add eax,edi
inc edx
cmp ecx,esi
cmp ecx,ebx
jbe sqrt_loop
dec edx
mov eax,edx ; EDX=EDX/7
mov esi,edx
mov ax,si ; ESI=ESI/7
mov dl,7
div dl
and eax,0xFF
mov edx,eax ; EDX ? 0 : EDX=1
and ax,0xFF
mov si,ax ; ESI ? 0 : ESI=1
jnz nozeroflag1
inc edx
mov si,1
nozeroflag1:
 
pop eax ; EAX = x distance
; ECX=EAX/EDX
pop eax
pop edx
pop ecx
pop ebx
 
push eax ; ECX=[temp1]/ESI
push edx
mov eax,[temp1]
mov dx,si
div dl
movzx ecx,al
pop ebx
mov cl,al
and ecx,0xFF
pop edx
pop eax
 
cmp byte [sign1], 0
jz @f
neg ecx
@@:
add eax, ecx
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 ; ESI=[temp2]/EDX
push eax ; EDX=[temp2]/ESI
push ecx
mov eax,[temp2]
mov dx,si
div dl
movzx esi,al
mov dl,al
and dx,0xFF
pop ecx
pop eax
 
cmp byte [sign2], 0
jz @f
neg esi
@@:
add ebx, esi
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:
 
; <===
 
; draw point
lea ecx, [ebx-2]
lea ebx, [eax-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
270,13 → 288,82
 
; -====- working on images and window -====-
 
prepare_eyes:
 
;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:
push ecx
mov ecx,30
lp1:
lodsb
stosb
stosb
stosb
loop lp1
sub esi,30
mov ecx,30
lp2:
lodsb
stosb
stosb
stosb
loop lp2
pop ecx
loop transform_loop
 
mov eax,14 ; calculating screen position
int 0x40
shr eax,1
mov ax,59
sub eax,30*65536
mov [win_ebx],eax
mov [win_ecx],dword 10*65536+44
 
mov esi,imagedata+25 ; calculate shape reference area
mov edi,winref
mov ecx,900 ; disable drag bar
mov al,0
rep stosb
 
mov ecx,30 ; calculate circles for eyes
shape_loop:
push ecx
 
call copy_line ; duplicate (we have two eyes :)
sub esi,30
call copy_line
 
pop ecx
loop shape_loop
 
ret
 
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
win_ebx dd 0x0
win_ecx dd 0x0
mouse dd 0xFFFFFFFF
;graphix db "EYES.RAW "
 
EYES_END: ; end of code
imagedata:
; texture is 900 bytes starting from 25th
file "eyes.raw":25,900
I_END:
 
; 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"
/programs/demos/eyes/trunk/macros.inc
143,10 → 143,6
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
178,7 → 174,7
 
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
.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
 
/programs/demos/fire/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/demos/fire/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/demos/fire/trunk/build.bat
0,0 → 1,2
@fasm fire.asm fire
@pause
/programs/demos/fire/trunk/fire.asm
13,7 → 13,6
dd mem_end
dd 0,0 ; no parameters, no path
 
;include 'lang.inc'
include 'macros.inc'
 
START:
/programs/demos/fire/trunk/macros.inc
143,10 → 143,6
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
178,7 → 174,7
 
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
.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
 
/programs/demos/fire2/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/demos/fire2/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/demos/fire2/trunk/build.bat
0,0 → 1,2
@fasm fire2.asm fire2
@pause
/programs/demos/fire2/trunk/fire2.asm
9,7 → 9,6
dd mem_end
dd 0x0, 0x0
 
;include 'lang.inc'
START:
 
mov edi, my_img
/programs/develop/mview/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/develop/mview/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/develop/mview/trunk/mview.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/develop/mview/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/develop/cmd/trunk/macros.inc
143,9 → 143,6
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
177,7 → 174,7
 
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
.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
 
/programs/develop/examples/cpuspeed/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cpuspeed.asm cpuspeed
@pause
/programs/develop/examples/cpuspeed/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cpuspeed.asm cpuspeed
@pause
/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm
0,0 → 1,153
;
; CPU SPEED INDICATIOR
;
; 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
dd 0x00000000 ; reserved=no extended header
 
include 'lang.inc'
include 'macros.inc'
 
START: ; start of execution
 
mov eax,18
mov ebx,5
int 0x40
 
xor edx,edx
mov ebx,1000000
div ebx
mov ebx,10
mov edi,text+19
mov ecx,5
newnum:
xor edx,edx
mov ebx,10
div ebx
add dl,48
mov [edi],dl
sub edi,1
loop newnum
 
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 still
mov eax,-1 ; close this program
int 0x40
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
 
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+200 ; [x start] *65536 + [x size]
mov ecx,100*65536+65 ; [y start] *65536 + [y size]
mov edx,[sc.work] ; color of work area RRGGBB,8->color glide
mov esi,[sc.grab] ; color of grab bar RRGGBB,8->color
or esi,0x80000000
mov edi,[sc.frame] ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,[sc.grab_text] ; color of text RRGGBB
or ecx,0x10000000
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(200-17)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,[sc.grab_button] ; button color RRGGBB
int 0x40
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,[sc.work_text]
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,10
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
 
 
text:
db 'CPU RUNNING AT MHZ '
db 'x' ; <- END MARKER, DONT DELETE
 
labelt:
db 'CPU SPEED'
labellen:
 
I_END:
 
sc system_colors
 
/programs/develop/examples/cpuspeed/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs equ <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
/programs/develop/examples/ir/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm ir.asm ir
@pause
/programs/develop/examples/ir/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ir.asm ir
@pause
/programs/develop/examples/ir/trunk/ir.asm
0,0 → 1,268
;
; INFRARED
;
; Compile with FASM for Menuet
;
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 1 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x1000 ; required amount of memory
dd 0x1000 ; esp = 0x7FFF0
dd 0, 0
 
 
include 'macros.inc'
 
START: ; start of execution
 
set_variables:
 
mov eax,46 ; reserve ports 0x3f0 - 0x3ff
mov ebx,0
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
 
mov eax,44 ; set read ports for irq 4
mov ebx,irqtable
; mov ecx,4
int 0x40
 
mov dh, 3 ; all ports have number 3xx hex
 
mov dl, 0xf3+8
mov al, 0x80
out dx, al
 
mov dl, 0xf1+8
mov al, 0
out dx, al
 
mov dl, 0xf0+8
mov al, 0x30 / 4
out dx, al
 
mov dl, 0xf3+8
mov al, 3
out dx, al
 
mov dl, 0xf4+8
mov al, 0xB
out dx, al
 
mov dl, 0xf1+8
mov al, 1
out dx, al
 
mov eax,5
mov ebx,100
int 0x40
 
mov dl, 0xf8
mov al, 'I'
out dx, al
 
mov eax,5
mov ebx,10
int 0x40
 
mov al, 'R'
out dx, al
 
mov eax,40 ; get com 1 data with irq 4
mov ebx,0000000000010000b shl 16 + 101b
int 0x40
 
red:
call draw_window
 
still:
 
mov eax,10 ; wait here for event
int 0x40
dec eax
jz red
dec eax
dec eax
jnz readir
 
button: ; button
mov al,17 ; get id
int 0x40
 
; we have only one button, close
 
mov eax,45 ; free irq
mov ebx,1
mov ecx,4
int 0x40
 
mov eax,46 ; free ports 0x3f0-0x3ff
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
int 0x40
 
or eax,-1 ; close this program
int 0x40
 
pos dd 0x0
 
cdplayer:
dd 7
dd 0
dd 0
dd 0
dd 0
db '/RD/1/CDP',0
 
readir:
mov eax,42
mov ebx,4
int 0x40
 
cmp ebx,80
jne nocd
 
mov eax,70
mov ebx,cdplayer
int 0x40
 
 
nocd:
 
push ebx
mov eax,[pos]
add eax,1
cmp eax,10*20+1
jb noeaxz
mov esi,text+10*4
mov edi,text
mov ecx,10*21*4
cld
rep movsb
mov eax,13
mov ebx,20*65536+260
mov ecx,22*65536+220
mov edx,[wcolor]
int 0x40
mov eax,10*19+1
noeaxz:
mov [pos],eax
pop ebx
and ebx,0xff
call draw_data
jmp still
 
 
 
 
draw_data:
 
pusha
 
xchg eax,ebx
 
mov ecx,10
shl ebx,2
mov esi,3
newnum:
xor edx,edx
div ecx
add edx,48
mov [ebx+text-1],dl
dec ebx
dec esi
jnz newnum
 
call draw_text
 
popa
 
ret
 
 
irqtable:
 
dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word
dd 0
 
 
 
; *********************************************
; ******* 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+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+250 ; [y start] *65536 + [y size]
mov edx,[wcolor] ; color of work area RRGGBB,8->color
mov edi,labelt ; caption string
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,0x00ffffff ; color of text RRGGBB
; mov edx,labelt ; pointer to text beginning
; mov esi,labellen-labelt ; text length
; int 0x40
 
; CLOSE BUTTON
; mov eax,8 ; function 8 : define and draw button
; mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size]
; mov ecx,5*65536+12 ; [y start] *65536 + [y size]
; mov edx,1 ; button id
; mov esi,0x5599cc ; button color RRGGBB
; int 0x40
 
draw_text:
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0xffffff
mov edx,text
mov esi,40
mov edi,20
newline:
mov eax,4
int 0x40
add ebx,10
add edx,esi
dec edi
jne newline
 
mov eax,12
mov ebx,2
int 0x40
 
ret
 
 
; DATA AREA
 
wcolor dd 0x13000000
 
labelt db 'INFRARED RECEIVER FOR IRMAN IN COM 1',0
 
text:
 
I_END:
/programs/develop/examples/ir/trunk/macros.inc
0,0 → 1,267
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/programs/develop/examples/md5/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm md5.asm md5
@pause
/programs/develop/examples/md5/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm md5.asm md5
@pause
/programs/develop/examples/md5/trunk/md5.asm
0,0 → 1,445
; à¨¬¥à ॠ«¨§ æ¨¨ £¥­¥à â®à  MD5 - å¥è 
;
; MD5 Generator
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
; ˆ¤¥ï, ॠ«¨§ æ¨ï ¨ ®â« ¤ª .
;
; €¢â®à: Halyavin
; ‘ ©â: www.shade.msu.ru/~msu-se/home.html
; „®à ¡®âª , ®â« ¤ª  ¨ ®¯â¨¬¨§ æ¨ï.
;
; Š®¬¯¨«¨àã¥âìáï Fasm'®¬ ¤«ï Œ¥­ãí⎑
include 'lang.inc'
macro diff16 title,l2
{
local s,d,l1
s = l2
display title,': 0x'
repeat 8
d = 48 + s shr ((8-%) shl 2) and $0F
if d > 57
d = d + 65-57-1
end if
display d
end repeat
display 13,10
}
 
use32
 
org 0x0
 
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
dd 0x100000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd 0x100000 ;  ¤à¥á ¢¥à設ë áâíª 
dd 0x0 ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
 
START: ;  ç «® ¢ë¯®«­¥­¨ï ¯à®£à ¬¬ë
 
call draw_window ; ‘¯¥à¢  ¯¥à¥à¨á㥬 ®ª­®
 
still:
 
mov eax,23 ; ަ¨¤ ¥¬ ᮡë⨩
mov ebx,1
int 0x40
 
cmp eax,1 ; ‡ ¯à®á ­  ¯¥à¥à¨á®¢ªã ?
jz red
cmp eax,2 ; ­ ¦ â  ª« ¢¨è¨ ?
jz key
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
jz button
 
jmp still
 
red:
call draw_window
jmp still
 
key:
mov eax,2
int 0x40
jmp still
 
button:
mov eax,17
int 0x40
 
cmp ah,1 ; id ª­®¯ª¨ = 1 ?
jnz noclose
mov eax,-1
int 0x40
 
noclose:
 
cmp ah,2 ; ƒ¥­¥à¨à®¢ âì?
je procMD5hash
 
jmp still
 
 
procMD5hash:
 
; phase I - padding
mov edi,ptBuffer
mov eax,[dtBufferLength]
 
inc eax
add edi,eax
mov byte [edi-1],0x80
 
xor edx,edx
 
mov ebx,64
div ebx
 
neg edx
add edx,64
 
cmp edx,8
jae @f
 
add edx,64
@@: mov ecx,edx
xor al,al
rep stosb
 
mov eax,[dtBufferLength]
 
inc edx
add [dtBufferLength],edx
 
xor edx,edx
 
mov ebx,8
mul ebx
 
mov [edi-8],eax
mov [edi-4],edx
 
mov edx,[dtBufferLength]
 
mov edi,ptBuffer
 
; phase II - chaining variables initialization
mov dword [dtA],067452301h
mov dword [dtB],0efcdab89h
mov dword [dtC],098badcfeh
mov dword [dtD],010325476h
mov esi,ptMD5Result
 
hashloop:
;diff16 "hashloop",hashloop
mov eax,[dtA]
mov [dta],eax
mov eax,[dtB]
mov [dtb],eax
mov eax,[dtC]
mov [dtc],eax
mov eax,[dtD]
mov [dtd],eax
macro ff dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
and ebx,eax
not eax
and eax,ecx
or eax,ebx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro gg dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro hh dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
xor eax,ebx
xor eax,ecx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
macro ii dta,dtb,dtc,dtd,data,shift,cc
{
mov eax,dtb
mov ebx,dtc
mov ecx,dtd
not ecx
or eax,ecx
xor eax,ebx
add eax,dta
add eax,data
add eax,cc
rol eax,shift
add eax,dtb
mov dta,eax
}
; round 1
ff [dta],[dtb],[dtc],[dtd],dword [edi+00*4],07,0xd76aa478
ff [dtd],[dta],[dtb],[dtc],dword [edi+01*4],12,0xe8c7b756
ff [dtc],[dtd],[dta],[dtb],dword [edi+02*4],17,0x242070db
ff [dtb],[dtc],[dtd],[dta],dword [edi+03*4],22,0xc1bdceee
ff [dta],[dtb],[dtc],[dtd],dword [edi+04*4],07,0xf57c0faf
ff [dtd],[dta],[dtb],[dtc],dword [edi+05*4],12,0x4787c62a
ff [dtc],[dtd],[dta],[dtb],dword [edi+06*4],17,0xa8304613
ff [dtb],[dtc],[dtd],[dta],dword [edi+07*4],22,0xfd469501
ff [dta],[dtb],[dtc],[dtd],dword [edi+08*4],07,0x698098d8
ff [dtd],[dta],[dtb],[dtc],dword [edi+09*4],12,0x8b44f7af
ff [dtc],[dtd],[dta],[dtb],dword [edi+10*4],17,0xffff5bb1
ff [dtb],[dtc],[dtd],[dta],dword [edi+11*4],22,0x895cd7be
ff [dta],[dtb],[dtc],[dtd],dword [edi+12*4],07,0x6b901122
ff [dtd],[dta],[dtb],[dtc],dword [edi+13*4],12,0xfd987193
ff [dtc],[dtd],[dta],[dtb],dword [edi+14*4],17,0xa679438e
ff [dtb],[dtc],[dtd],[dta],dword [edi+15*4],22,0x49b40821
; round 2
gg [dta],[dtb],[dtc],[dtd],dword [edi+01*4],05,0xf61e2562
gg [dtd],[dta],[dtb],[dtc],dword [edi+06*4],09,0xc040b340
gg [dtc],[dtd],[dta],[dtb],dword [edi+11*4],14,0x265e5a51
gg [dtb],[dtc],[dtd],[dta],dword [edi+00*4],20,0xe9b6c7aa
gg [dta],[dtb],[dtc],[dtd],dword [edi+05*4],05,0xd62f105d
gg [dtd],[dta],[dtb],[dtc],dword [edi+10*4],09,0x02441453
gg [dtc],[dtd],[dta],[dtb],dword [edi+15*4],14,0xd8a1e681
gg [dtb],[dtc],[dtd],[dta],dword [edi+04*4],20,0xe7d3fbc8
gg [dta],[dtb],[dtc],[dtd],dword [edi+09*4],05,0x21e1cde6
gg [dtd],[dta],[dtb],[dtc],dword [edi+14*4],09,0xc33707d6
gg [dtc],[dtd],[dta],[dtb],dword [edi+03*4],14,0xf4d50d87
gg [dtb],[dtc],[dtd],[dta],dword [edi+08*4],20,0x455a14ed
gg [dta],[dtb],[dtc],[dtd],dword [edi+13*4],05,0xa9e3e905
gg [dtd],[dta],[dtb],[dtc],dword [edi+02*4],09,0xfcefa3f8
gg [dtc],[dtd],[dta],[dtb],dword [edi+07*4],14,0x676f02d9
gg [dtb],[dtc],[dtd],[dta],dword [edi+12*4],20,0x8d2a4c8a
; round 3
hh [dta],[dtb],[dtc],[dtd],dword [edi+05*4],04,0xfffa3942
hh [dtd],[dta],[dtb],[dtc],dword [edi+08*4],11,0x8771f681
hh [dtc],[dtd],[dta],[dtb],dword [edi+11*4],16,0x6d9d6122
hh [dtb],[dtc],[dtd],[dta],dword [edi+14*4],23,0xfde5380c
hh [dta],[dtb],[dtc],[dtd],dword [edi+01*4],04,0xa4beea44
hh [dtd],[dta],[dtb],[dtc],dword [edi+04*4],11,0x4bdecfa9
hh [dtc],[dtd],[dta],[dtb],dword [edi+07*4],16,0xf6bb4b60
hh [dtb],[dtc],[dtd],[dta],dword [edi+10*4],23,0xbebfbc70
hh [dta],[dtb],[dtc],[dtd],dword [edi+13*4],04,0x289b7ec6
hh [dtd],[dta],[dtb],[dtc],dword [edi+00*4],11,0xeaa127fa
hh [dtc],[dtd],[dta],[dtb],dword [edi+03*4],16,0xd4ef3085
hh [dtb],[dtc],[dtd],[dta],dword [edi+06*4],23,0x04881d05
hh [dta],[dtb],[dtc],[dtd],dword [edi+09*4],04,0xd9d4d039
hh [dtd],[dta],[dtb],[dtc],dword [edi+12*4],11,0xe6db99e5
hh [dtc],[dtd],[dta],[dtb],dword [edi+15*4],16,0x1fa27cf8
hh [dtb],[dtc],[dtd],[dta],dword [edi+02*4],23,0xc4ac5665
; round 4
ii [dta],[dtb],[dtc],[dtd],dword [edi+00*4],06,0xf4292244
ii [dtd],[dta],[dtb],[dtc],dword [edi+07*4],10,0x432aff97
ii [dtc],[dtd],[dta],[dtb],dword [edi+14*4],15,0xab9423a7
ii [dtb],[dtc],[dtd],[dta],dword [edi+05*4],21,0xfc93a039
ii [dta],[dtb],[dtc],[dtd],dword [edi+12*4],06,0x655b59c3
ii [dtd],[dta],[dtb],[dtc],dword [edi+03*4],10,0x8f0ccc92
ii [dtc],[dtd],[dta],[dtb],dword [edi+10*4],15,0xffeff47d
ii [dtb],[dtc],[dtd],[dta],dword [edi+01*4],21,0x85845dd1
ii [dta],[dtb],[dtc],[dtd],dword [edi+08*4],06,0x6fa87e4f
ii [dtd],[dta],[dtb],[dtc],dword [edi+15*4],10,0xfe2ce6e0
ii [dtc],[dtd],[dta],[dtb],dword [edi+06*4],15,0xa3014314
ii [dtb],[dtc],[dtd],[dta],dword [edi+13*4],21,0x4e0811a1
ii [dta],[dtb],[dtc],[dtd],dword [edi+04*4],06,0xf7537e82
ii [dtd],[dta],[dtb],[dtc],dword [edi+11*4],10,0xbd3af235
ii [dtc],[dtd],[dta],[dtb],dword [edi+02*4],15,0x2ad7d2bb
ii [dtb],[dtc],[dtd],[dta],dword [edi+09*4],21,0xeb86d391
mov eax,[dta]
add [dtA],eax
mov eax,[dtb]
add [dtB],eax
mov eax,[dtc]
add [dtC],eax
mov eax,[dtd]
add [dtD],eax
 
add edi,64
 
sub edx,64
jnz hashloop
 
; phase IV - results
 
mov ecx,4
mov esi,ptMD5Result
 
@@: mov eax,[esi]
xchg al,ah
rol eax,16
xchg al,ah
mov [esi],eax
 
add esi,4
loop @b
 
translate:
;diff16 "translate",translate
mov esi,ptMD5Result-5
mov edi,hexresult
mov ecx,16
@@:
test ecx,3
jnz .nojmp
add esi,8
.nojmp:
xor eax,eax
mov al,byte [esi]
mov edx,eax
shr eax,4
mov bl,byte [table+eax]
mov [edi],bl
inc edi
and edx,15
mov bl,byte [table+edx]
mov [edi],bl
dec esi
inc edi
loop @b
mov esi,hexresult
mov [text], esi
mov eax,32
mov [textlen], eax
call draw_window
 
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,60*65536+100 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
 
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
; ¨á㥬 ª­®¯ªã ¤«ï £¥­¥à æ¨¨
mov eax,8 ; function 8 : define and draw button
mov ebx,20*65536+80 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
;  §¢ ­¨¥ ­  ª­®¯ªã
mov eax,4 ; function 4 : write text to window
mov ebx,23*65536+38 ; [x start] *65536 + [y start]
mov ecx,0x000000 ; color of text RRGGBB
mov edx,gen_txt ; pointer to text beginning
mov esi,gen_len-gen_txt ; text length
int 0x40
 
mov eax,4 ; draw info text with function 4
mov ebx,20*65536+70
mov ecx,0x000000
mov edx,[text]
xor eax,eax
mov al, [textlen]
mov esi,eax
mov eax,4
int 0x40
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
;Ž¡« áâì ¤ ­­ëå
 
labeltext: db 'MD5 Generator'
lte:
 
text: dd 0
textlen: dd 0
 
gen_txt: db '‘£¥­¥à¨à®¢ âì'
gen_len:
 
InputMD5Rez: dd 0
InputMD5Rezlen:
 
ptBuffer: db '123' ;‡ ¬¥­¨âì ­  £¥­¥à¨à㥬®¥ á«®¢®
rb 61
dtBufferLength: dd 3 ; §¬¥à ptBuffer
 
ptMD5Result:
 
dtA: dd 0
dtB: dd 0
dtC: dd 0
dtD: dd 0
 
dta: dd 0
dtb: dd 0
dtc: dd 0
dtd: dd 0
 
x: dd 0
s: dd 0
t: dd 0
 
table: db '0123456789abcdef'
hexresult db 32
 
I_END:
/programs/develop/examples/rtdata/trunk/build_en.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix en >lang.inc
@fasm rtdata.asm rtdata
@pause
/programs/develop/examples/rtdata/trunk/build_ru.bat
0,0 → 1,4
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm rtdata.asm rtdata
@pause
/programs/develop/examples/rtdata/trunk/macros.inc
0,0 → 1,266
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/programs/develop/examples/rtdata/trunk/rtdata.asm
0,0 → 1,235
;
; COMMUNICATING WITH MODEM: PORTS & IRQ
;
; Compile with FASM for Menuet
;
 
include "lang.inc"
include "macros.inc"
 
use32
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x1000 ; memory for app
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
 
START: ; start of execution
 
 
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
 
mov eax,46 ; reserve ports 0x3f8-0x3ff
mov ebx,0
mov ecx,0x3f8
mov edx,0x3ff
int 0x40
 
mov eax,44 ; read these ports at interrupt/irq 4
mov ebx,irqtable
mov ecx,4
int 0x40
 
mov eax,40 ; enable event for interrupt/irq 4
mov ebx,10000b shl 16 + 111b
int 0x40
 
call program_com1
 
call draw_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
cmp eax,16+4 ; data read by interrupt ?
je irq4
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
 
mov al,ah
mov dx,0x3f8
out dx,al
 
jmp still
 
button: ; button
or eax,-1 ; close this program
int 0x40
 
 
irq4:
 
mov eax,42
mov ebx,4
int 0x40
 
; eax = number of bytes left
; ecx = 0 success, =1 fail
; bl = byte
 
inc [pos]
and [pos],31
mov eax,[pos]
 
mov [string+eax], bl
call draw_string
 
jmp still
 
 
baudrate_9600 equ 12
baudrate_57600 equ 2
 
program_com1:
 
mov dx,0x3f8+3
mov al,0x80
out dx,al
 
mov dx,0x3f8+1
mov al,0x00
out dx,al
 
mov dx,0x3f8+0
mov al,baudrate_9600
out dx,al
 
mov dx,0x3f8+3
mov al,0x3
out dx,al
 
mov dx,0x3f8+4
mov al,0xb
out dx,al
 
mov dx,0x3f8+1
mov al,0x1
out dx,al
 
ret
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax, 48
mov ebx, 3
mov ecx, sc
mov edx, sizeof.system_colors
int 0x40
 
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+250 ; [x start] *65536 + [x size]
mov ecx, 100*65536+85 ; [y start] *65536 + [y size]
mov edx, [sc.work]
or edx, 0x03000000 ; color of work area RRGGBB,8->color gl
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, [sc.grab_text]
or ecx, 0x10000000 ; font 1 & color ( 0xF0RRGGBB )
mov edx, header ; pointer to text beginning
mov esi, header.len ; text length
int 0x40
 
mov eax, 4 ; draw text
mov ebx, 20*65536+33
mov ecx, [sc.work_text]
mov edx, text+4
.nextstr:
mov esi, [edx-4]
test esi, 0xFF000000
jnz .finstr
int 0x40
add edx, esi
add edx, 4
add ebx, 10
jmp .nextstr
.finstr:
 
call draw_string
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
 
ret
 
 
draw_string:
mov eax, 4
mov ebx, 20*65536+65
mov ecx, [sc.work_text]
mov edx, string
mov esi, 32
int 0x40
ret
 
 
; DATA AREA
 
 
if lang eq ru
text mstr "‚‚Ž„ˆŒ›… ‘ˆŒ‚Ž‹› ……„€ž’‘Ÿ ŒŽ„…Œ“.",\
"„€›… Ž’ ŒŽ„…Œ€ ‘—ˆ’›‚€ž’‘Ÿ Ž",\
"…›‚€ˆž IRQ4 ˆ ޒށ€†€ž’‘Ÿ ˆ†…."
header:
db 'ŒŽ„…Œ € COM1'
.len = $ - header
else
text mstr "TYPED CHARACTERS ARE SENT TO MODEM.",\
"DATA FROM MODEM IS READ BY IRQ4",\
"INTERRUPT AND DISPLAYED BELOW."
header:
db 'MODEM AT COM1'
.len = $ - header
end if
 
pos dd 0x0
 
irqtable:
; port ; 1=byte, 2=word
dd 0x3f8 +0x01000000 ; read byte from port 0x3f8 at interrupt/irq 4
dd 0x0 ; no more ports ( max 15 ) to read
 
 
I_END:
 
string rb 32
sc system_colors
/programs/develop/fasm/trunk/fasm.asm
22,7 → 22,7
 
;; Menuet header
 
appname equ "FASM "
appname equ "flat assembler "
 
use32
 
392,11 → 392,11
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
/programs/develop/fasm/trunk/version.inc
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
/programs/develop/fasm/trunk/x86_64.inc
223,6 → 223,10
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
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
/programs/develop/mtdbg/build.bat
0,0 → 1,2
@fasm mtdbg.asm mtdbg
@pause
/programs/develop/mtdbg/mtdbg.asm
0,0 → 1,4825
format binary
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd used_mem
dd used_mem
dd i_param
dd 0
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
data_width equ 80
data_x_pos equ 12
data_x_size equ data_width*6
 
title_x_pos equ 30
title_y_pos equ 32
title_y_size equ 10
 
registers_x_pos equ data_x_pos
registers_y_pos equ (title_y_pos + title_y_size)
registers_y_size equ 30
 
dump_y_pos equ (registers_y_pos + registers_y_size + 5)
dump_height equ 4
dump_y_size equ (dump_height*10)
 
disasm_y_pos equ (dump_y_pos + dump_y_size + 4)
disasm_height equ 16
disasm_y_size equ (disasm_height*10)
 
messages_width equ data_width
messages_height equ 12
messages_x_pos equ data_x_pos
messages_y_pos equ (disasm_y_pos + disasm_y_size + 4)
messages_x_size equ messages_width*6
messages_y_size equ messages_height*10
 
cmdline_width equ data_width
cmdline_x_pos equ data_x_pos
cmdline_y_pos equ (messages_y_pos + messages_y_size + 10)
cmdline_x_size equ messages_x_size
cmdline_y_size equ 10
 
wnd_x_size equ (data_x_pos + messages_x_size + data_x_pos)
wnd_y_size equ (cmdline_y_pos + cmdline_y_size + data_x_pos)
 
start:
mov edi, messages
mov ecx, messages_width*messages_height
mov al, ' '
rep stosb
xor eax, eax
mov [messages_pos], eax
mov [cmdline_len], eax
mov [cmdline_pos], eax
mov edi, needzerostart
mov ecx, (needzeroend-needzerostart+3)/4
rep stosd
mov esi, begin_str
call put_message_nodraw
; set event mask - default events and debugging events
push 40
pop eax
mov ebx, 0x107
int 40h
; set debug messages buffer
mov ecx, dbgbufsize
mov dword [ecx], 256
xor ebx, ebx
mov [ecx+4], ebx
mov al, 69
int 40h
mov esi, i_param
call skip_spaces
test al, al
jz dodraw
push esi
call draw_window
pop esi
call OnLoadInit
jmp waitevent
dodraw:
call draw_window
waitevent:
push 10
pop eax
int 40h
cmp al, 9
jz debugmsg
dec eax
jz dodraw
dec eax
jz keypressed
dec eax
jnz waitevent
; button pressed - we have only one button (close)
push -1
pop eax
int 40h
keypressed:
mov al, 2
int 40h
shr eax, 8
cmp al, 8
jz .backspace
cmp al, 0xB0
jz .left
cmp al, 0xB3
jz .right
cmp al, 0x0D
jz .enter
cmp al, 0xB6
jz .del
cmp al, 0xB4
jz .home
cmp al, 0xB5
jz .end
cmp al, 0xB1
jz .down
cmp al, 0xB2
jz .up
cmp al, 0xD8
jz CtrlF7
cmp al, 0xD9
jz CtrlF8
cmp [cmdline_len], cmdline_width
jae waitevent
push eax
call clear_cmdline_end
pop eax
mov edi, cmdline
mov ecx, [cmdline_len]
add edi, ecx
lea esi, [edi-1]
sub ecx, [cmdline_pos]
std
rep movsb
cld
stosb
inc [cmdline_len]
call draw_cmdline_end
inc [cmdline_pos]
call draw_cursor
jmp waitevent
.backspace:
cmp [cmdline_pos], 0
jz waitevent
dec [cmdline_pos]
.delchar:
call clear_cmdline_end
mov edi, [cmdline_pos]
dec [cmdline_len]
mov ecx, [cmdline_len]
sub ecx, edi
add edi, cmdline
lea esi, [edi+1]
rep movsb
call draw_cmdline_end
call draw_cursor
jmp waitevent
.del:
mov eax, [cmdline_pos]
cmp eax, [cmdline_len]
jae waitevent
jmp .delchar
.left:
cmp [cmdline_pos], 0
jz waitevent
call hide_cursor
dec [cmdline_pos]
call draw_cursor
jmp waitevent
.right:
mov eax, [cmdline_pos]
cmp eax, [cmdline_len]
jae waitevent
call hide_cursor
inc [cmdline_pos]
call draw_cursor
jmp waitevent
.home:
call hide_cursor
and [cmdline_pos], 0
call draw_cursor
jmp waitevent
.end:
call hide_cursor
mov eax, [cmdline_len]
mov [cmdline_pos], eax
call draw_cursor
.up:
.down:
jmp waitevent
.enter:
mov ecx, [cmdline_len]
test ecx, ecx
jz waitevent
mov esi, cmdline
mov byte [esi+ecx], 0
and [cmdline_pos], 0
push esi
call clear_cmdline_end
call draw_cursor
pop esi
and [cmdline_len], 0
; skip leading spaces
call skip_spaces
cmp al, 0
jz waitevent
; now esi points to command
push esi
mov esi, prompt
call put_message_nodraw
pop esi
push esi
call put_message_nodraw
z1: mov esi, newline
call put_message
pop esi
push esi
call get_arg
mov [curarg], esi
pop edi
mov esi, commands
call find_cmd
mov eax, aUnknownCommand
jc .x11
; check command requirements
; flags field:
; &1: command may be called without parameters
; &2: command may be called with parameters
; &4: command may be called without loaded program
; &8: command may be called with loaded program
mov eax, [esi+8]
mov ecx, [curarg]
cmp byte [ecx], 0
jz .noargs
test byte [esi+16], 2
jz .x11
jmp @f
.noargs:
test byte [esi+16], 1
jz .x11
@@:
cmp [debuggee_pid], 0
jz .nodebuggee
mov eax, aAlreadyLoaded
test byte [esi+16], 8
jz .x11
jmp .x9
.nodebuggee:
mov eax, need_debuggee
test byte [esi+16], 4
jnz .x9
.x11:
xchg esi, eax
call put_message
.x10:
jmp waitevent
.x9:
call dword [esi+4]
jmp .x10
 
find_cmd:
; all commands are case-insensitive
push edi
.x4:
mov al, [edi]
cmp al, 0
jz .x5
cmp al, 'A'
jb @f
cmp al, 'Z'
ja @f
or al, 20h
@@:
stosb
jmp .x4
.x5:
; find command
pop edi
.x6:
cmp dword [esi], 0
jz .x7
push esi
mov esi, [esi]
lodsb
movzx ecx, al
push edi
repz cmpsb
pop edi
pop esi
jz .x8
add esi, 17
jmp .x6
.x7:
stc
.x8:
ret
 
get_arg:
lodsb
cmp al, ' '
ja get_arg
mov byte [esi-1], 0
cmp al, 0
jnz skip_spaces
dec esi
skip_spaces:
lodsb
cmp al, 0
jz @f
cmp al, ' '
jbe skip_spaces
@@: dec esi
ret
 
clear_cmdline_end:
mov ebx, [cmdline_pos]
mov ecx, [cmdline_len]
sub ecx, ebx
push 13
pop eax
imul ebx, 6
imul ecx, 6
inc ecx
add ebx, cmdline_x_pos
shl ebx, 16
or ebx, ecx
mov ecx, cmdline_y_pos*10000h + cmdline_y_size
mov edx, 0xFFFFFF
int 40h
ret
 
draw_cmdline:
xor ebx, ebx
jmp @f
draw_cmdline_end:
mov ebx, [cmdline_pos]
@@:
mov esi, [cmdline_len]
sub esi, ebx
push 4
pop eax
xor ecx, ecx
lea edx, [cmdline+ebx]
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
or ebx, cmdline_y_pos+1
int 40h
ret
 
put_message_nodraw:
; in: esi->ASCIZ message
mov edx, [messages_pos]
.m:
lea edi, [messages+edx]
.l:
lodsb
cmp al, 0
jz .done
call test_scroll
cmp al, 10
jz .newline
cmp al, '%'
jnz @f
cmp dword [esp], z1
jnz .format
@@:
stosb
inc edx
jmp .l
.newline:
push edx
mov ecx, messages_width
xor eax, eax
xchg eax, edx
div ecx
xchg eax, edx
pop edx
test eax, eax
jz .m
sub edx, eax
add edx, ecx
jmp .m
.done:
mov [messages_pos], edx
ret
.format:
; at moment all format specs must be %<digit>X
lodsb ; get <digit>
sub al, '0'
movzx ecx, al
lodsb
pop eax
pop ebp
push eax
; write number in ebp with ecx digits
dec ecx
shl ecx, 2
.writenibble:
push ecx
call test_scroll
pop ecx
mov eax, ebp
shr eax, cl
and al, 0xF
cmp al, 10
sbb al, 69h
das
stosb
inc edx
sub ecx, 4
jns .writenibble
jmp .l
 
test_scroll:
cmp edx, messages_width*messages_height
jnz .ret
push esi
mov edi, messages
lea esi, [edi+messages_width]
mov ecx, (messages_height-1)*messages_width/4
rep movsd
push eax
mov al, ' '
push edi
push messages_width
pop ecx
sub edx, ecx
rep stosb
pop edi
pop eax
pop esi
.ret: ret
 
put_message:
call put_message_nodraw
 
draw_messages:
push 13
pop eax
mov edx, 0xFFFFFF
mov ebx, messages_x_pos*10000h+messages_x_size
mov ecx, messages_y_pos*10000h+messages_y_size
int 40h
mov edx, messages
push messages_width
pop esi
xor ecx, ecx
mov al, 4
mov ebx, messages_x_pos*10000h+messages_y_pos
@@:
int 40h
add edx, esi
add ebx, 10
cmp edx, messages+messages_width*messages_height
jb @b
ret
 
draw_cursor:
push 38
pop eax
mov ecx, cmdline_y_pos*10001h+cmdline_y_size-1
mov ebx, [cmdline_pos]
imul ebx, 6
add ebx, cmdline_x_pos
mov edx, ebx
shl ebx, 16
or ebx, edx
xor edx, edx
int 40h
ret
hide_cursor:
mov ebx, [cmdline_pos]
push 13
pop eax
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
inc ebx
mov ecx, cmdline_y_pos*10000h + cmdline_y_size
mov edx, 0xFFFFFF
int 40h
mov ebx, [cmdline_pos]
cmp ebx, [cmdline_len]
jae .ret
mov al, 4
xor ecx, ecx
lea edx, [cmdline+ebx]
imul ebx, 6
add ebx, cmdline_x_pos
shl ebx, 16
or ebx, cmdline_y_pos+1
push 1
pop esi
int 40h
.ret:
ret
 
redraw_title:
push 13
pop eax
mov edx, 0xFFFFFF
mov ebx, title_x_pos*10000h + data_x_pos+data_x_size-title_x_pos
mov ecx, title_y_pos*10000h + title_y_size
int 40h
draw_title:
mov al, 38
mov ebx, (data_x_pos-2)*10000h + title_x_pos-5
mov ecx, (title_y_pos+5)*10001h
xor edx, edx
int 40h
push NoPrgLoaded_len
pop esi
cmp [debuggee_pid], 0
jz @f
mov esi, [prgname_len]
@@: imul ebx, esi, 6
add ebx, title_x_pos+4
shl ebx, 16
mov bx, data_x_pos+data_x_size-10-5-6*7
cmp [bSuspended], 0
jz @f
add ebx, 6
@@:
int 40h
mov ebx, (data_x_pos+data_x_size-10+4)*0x10000 + data_x_pos+data_x_size+2
int 40h
mov al, 4
mov ebx, title_x_pos*10000h+title_y_pos
xor ecx, ecx
mov edx, NoPrgLoaded_str
cmp [debuggee_pid], 0
jz @f
mov edx, [prgname_ptr]
@@:
int 40h
cmp [debuggee_pid], 0
jz .nodebuggee
mov ebx, (data_x_pos+data_x_size-10-6*7)*10000h + title_y_pos
mov edx, aRunning
push 7
pop esi
cmp [bSuspended], 0
jz @f
add ebx, 6*10000h
mov edx, aPaused
dec esi
@@:
int 40h
ret
.nodebuggee:
mov al, 38
mov ebx, (data_x_pos+data_x_size-10-6*7-5)*0x10000 + data_x_pos+data_x_size+2
mov ecx, (title_y_pos+5)*10001h
xor edx, edx
jmp @b
 
draw_register:
; in: esi->value, edx->string, ecx=string len, ebx=coord
push edx
push ecx
push esi
mov eax, esi
mov esi, ecx
; color
mov ecx, 808080h
cmp [debuggee_pid], 0
jz .cd
cmp [bSuspended], 0
jz .cd
xor ecx, ecx
mov edi, [eax]
cmp dword [eax+oldcontext-context], edi
jz .cd
mov ecx, 0x00AA00
.cd:
push 4
pop eax
int 40h
imul esi, 60000h
lea edx, [ebx+esi]
mov al, 47
mov ebx, 80101h
mov esi, ecx
pop ecx
int 40h
lea ebx, [edx+60000h*18]
mov esi, ecx
pop ecx
pop edx
add edx, ecx
ret
draw_flag:
movzx edi, byte [edx+7]
bt [_eflags], edi
jc .on
or byte [edx], 20h
jmp .onoff
.on:
and byte [edx], not 20h
.onoff:
mov ecx, 808080h
cmp [debuggee_pid], 0
jz .doit
cmp [bSuspended], 0
jz .doit
xor ecx, ecx
bt [_eflags], edi
lahf
bt dword [_eflags + oldcontext - context], edi
rcl ah, 1
test ah, 3
jp .doit
mov ecx, 0x00AA00
.doit:
mov ah, 0
int 40h
ret
 
redraw_registers:
push 13
pop eax
mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size
mov ecx, registers_y_pos*10000h + registers_y_size
int 40h
draw_registers:
mov esi, _eax
push 4
pop ecx
mov edx, regs_strs
mov ebx, registers_x_pos*10000h+registers_y_pos
call draw_register
add esi, _ebx-_eax
call draw_register
add esi, _ecx-_ebx
call draw_register
add esi, _edx-_ecx
call draw_register
mov ebx, registers_x_pos*10000h+registers_y_pos+10
add esi, _esi-_edx
call draw_register
add esi, _edi-_esi
call draw_register
add esi, _ebp-_edi
call draw_register
add esi, _esp-_ebp
call draw_register
mov ebx, registers_x_pos*10000h+registers_y_pos+20
add esi, _eip-_esp
call draw_register
mov cl, 7
add esi, _eflags-_eip
call draw_register
mov al, 4
mov ecx, 808080h
cmp [debuggee_pid], 0
jz @f
cmp [bSuspended], 0
jz @f
xor ecx, ecx
@@:
mov edx, aColon
xor esi, esi
inc esi
mov ebx, (registers_x_pos+37*6)*10000h + registers_y_pos+20
int 40h
mov edx, flags
@@:
add ebx, 2*6*10000h
call draw_flag
inc edx
cmp dl, flags_bits and 0xFF
jnz @b
ret
 
redraw_dump:
push 13
pop eax
mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size
mov ecx, dump_y_pos*10000h + dump_y_size
int 40h
draw_dump:
; addresses
mov al, 47
mov ebx, 80100h
mov edx, data_x_pos*10000h + dump_y_pos
mov ecx, [dumppos]
mov esi, 808080h
cmp [debuggee_pid], 0
jz @f
cmp [bSuspended], 0
jz @f
xor esi, esi
@@:
int 40h
add ecx, 10h
add edx, 10
cmp dl, dump_y_pos + dump_y_size
jb @b
; hex dump of data
mov ebx, 20101h
mov ecx, dumpdata
push ecx
xor edi, edi
mov edx, (data_x_pos+12*6)*10000h + dump_y_pos
cmp [dumpread], edi
jz .hexdumpdone1
.hexdumploop1:
int 40h
add edx, 3*6*10000h
inc ecx
inc edi
test edi, 15
jz .16
test edi, 7
jnz @f
add edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
.16:
add edx, 10 - 6*(3*10h+2)*10000h
@@:
cmp edi, [dumpread]
jb .hexdumploop1
.hexdumpdone1:
mov al, 4
mov ecx, esi
mov ebx, edx
push 2
pop esi
mov edx, aQuests
.hexdumploop2:
cmp edi, dump_height*10h
jae .hexdumpdone2
int 40h
add ebx, 3*6*10000h
inc edi
test edi, 15
jz .16x
test edi, 7
jnz .hexdumploop2
add ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
.16x:
add ebx, 10 - 6*(3*10h+2)*10000h
jmp .hexdumploop2
.hexdumpdone2:
dec esi
; colon, minus signs
mov ebx, (data_x_pos+8*6)*10000h + dump_y_pos
mov edx, aColon
@@:
int 40h
add ebx, 10
cmp bl, dump_y_pos+dump_height*10
jb @b
mov ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos
mov edx, aMinus
@@:
int 40h
add ebx, 10
cmp bl, dump_y_pos+dump_height*10
jb @b
; ASCII data
mov ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
mov edi, dump_height*10h
pop edx
.asciiloop:
push edx
cmp byte [edx], 20h
jae @f
mov edx, aPoint
@@:
int 40h
pop edx
inc edx
add ebx, 6*10000h
dec edi
jz .asciidone
test edi, 15
jnz .asciiloop
add ebx, 10 - 6*10h*10000h
jmp .asciiloop
.asciidone:
ret
 
redraw_disasm:
push 13
pop eax
mov edx, 0xFFFFFF
mov ebx, data_x_pos*10000h + data_x_size
mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
int 40h
draw_disasm:
mov eax, [disasm_start_pos]
mov [disasm_cur_pos], eax
and [disasm_cur_str], 0
.loop:
push [disasm_cur_pos]
call disasm_instr
pop ebp
jc .loopend
xor esi, esi ; default color: black
mov ebx, data_x_pos*10000h + data_x_size
mov ecx, [disasm_cur_str]
imul ecx, 10*10000h
add ecx, (disasm_y_pos-1)*10000h + 10
mov eax, ebp
pushad
call find_enabled_breakpoint
popad
jnz .nored
push 13
pop eax
mov edx, 0xFF0000
int 40h
.nored:
mov eax, [_eip]
cmp eax, ebp
jnz .noblue
push 13
pop eax
mov edx, 0x0000FF
int 40h
mov esi, 0xFFFFFF ; on blue bgr, use white color
.noblue:
push 47
pop eax
mov ebx, 80100h
mov edx, [disasm_cur_str]
imul edx, 10
add edx, data_x_pos*10000h + disasm_y_pos
mov ecx, ebp
int 40h
mov al, 4
lea ebx, [edx+8*6*10000h]
mov ecx, esi
push 1
pop esi
mov edx, aColon
int 40h
push 9
pop edi
lea edx, [ebx+2*6*10000h]
mov esi, ecx
mov al, 47
mov ebx, 20101h
mov ecx, ebp
sub ecx, [disasm_start_pos]
add ecx, disasm_buffer
.drawhex:
int 40h
add edx, 6*3*10000h
inc ecx
inc ebp
cmp ebp, [disasm_cur_pos]
jae .hexdone
dec edi
jnz .drawhex
push esi
mov esi, [disasm_cur_pos]
dec esi
cmp esi, ebp
pop esi
jbe .drawhex
mov al, 4
lea ebx, [edx-6*10000h]
mov ecx, esi
push 3
pop esi
mov edx, aDots
int 40h
mov esi, ecx
.hexdone:
xor eax, eax
mov edi, disasm_string
mov edx, edi
or ecx, -1
repnz scasb
not ecx
dec ecx
xchg ecx, esi
mov ebx, [disasm_cur_str]
imul ebx, 10
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
mov al, 4
int 40h
inc [disasm_cur_str]
cmp [disasm_cur_str], disasm_height
jb .loop
.loopend:
ret
 
update_disasm_eip:
; test if instruction at eip is showed
mov ecx, disasm_height
mov eax, [disasm_start_pos]
mov [disasm_cur_pos], eax
@@:
mov eax, [_eip]
cmp [disasm_cur_pos], eax
jz redraw_disasm
push ecx
call disasm_instr
pop ecx
jc @f
loop @b
@@:
update_disasm_eip_force:
mov eax, [_eip]
mov [disasm_start_pos], eax
update_disasm:
cmp [debuggee_pid], 0
jz .no
push 69
pop eax
push 6
pop ebx
mov ecx, [debuggee_pid]
mov edi, disasm_buffer
mov edx, 256
mov esi, [disasm_start_pos]
int 40h
cmp eax, -1
jnz @f
mov esi, read_mem_err
call put_message
.no:
xor eax, eax
@@:
mov [disasm_buf_size], eax
call restore_from_breaks
jmp redraw_disasm
 
draw_window:
; start redraw
push 12
pop eax
push 1
pop ebx
int 40h
; define window
xor eax, eax
mov ebx, wnd_x_size
mov ecx, wnd_y_size
mov edx, 3FFFFFFh
int 40h
; caption
mov al, 4
mov ecx, 0xFFFFFF
mov ebx, 80008h
mov edx, caption_str
push caption_len
pop esi
int 40h
; messages frame
mov al, 38
mov ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2)
push ebx
mov ecx, (messages_y_pos-2)*10001h
xor edx, edx
int 40h
mov ecx, (messages_y_pos+messages_y_size+2)*10001h
int 40h
mov ebx, (messages_x_pos-2)*10001h
push ebx
mov ecx, (messages_y_pos-2)*10000h + (messages_y_pos+messages_y_size+2)
int 40h
mov ebx, (messages_x_pos+messages_x_size+2)*10001h
push ebx
int 40h
; command line frame
mov ecx, (cmdline_y_pos-2)*10000h + (cmdline_y_pos+cmdline_y_size+2)
pop ebx
int 40h
pop ebx
int 40h
pop ebx
mov ecx, (cmdline_y_pos+cmdline_y_size+2)*10001h
int 40h
mov ecx, (cmdline_y_pos-2)*10001h
int 40h
; messages
call draw_messages
; command line & cursor
call draw_cmdline
call draw_cursor
; title & registers & dump & disasm
mov al, 38
mov ebx, (data_x_pos-2)*10001h
mov ecx, (title_y_pos+5)*10000h + (messages_y_pos-2)
int 40h
mov ebx, (data_x_pos+data_x_size+2)*10001h
int 40h
mov ebx, (data_x_pos-2)*10000h + (data_x_pos+data_x_size+2)
mov ecx, (dump_y_pos-3)*10001h
int 40h
mov ecx, (disasm_y_pos-4)*10001h
int 40h
call draw_title
call draw_registers
call draw_dump
call draw_disasm
; end redraw
mov al, 12
push 2
pop ebx
int 40h
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUGGING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
OnHelp:
mov esi, help_msg
mov edi, [curarg]
cmp byte [edi], 0
jz .x
mov esi, help_groups
call find_cmd
jc .nocmd
mov esi, [esi+12]
.x:
jmp put_message
.nocmd:
mov esi, aUnknownCommand
jmp .x
 
OnQuit:
xor eax, eax
dec eax
int 40h
 
get_new_context:
mov esi, context
mov edi, oldcontext
mov ecx, 10
rep movsd
get_context:
push 1
pop ebx
push 69
pop eax
mov ecx, [debuggee_pid]
mov esi, context
push 28h
pop edx
int 40h
ret
set_context:
push 2
pop ebx
push 69
pop eax
mov ecx, [debuggee_pid]
mov esi, context
push 28h
pop edx
int 40h
ret
 
get_dump:
mov edi, dumpdata
mov esi, [edi-4]
mov edx, dump_height*10h
mov ecx, edx
xor eax, eax
push edi
rep stosb
pop edi
mov ecx, [debuggee_pid]
mov al, 69
push 6
pop ebx
int 40h
cmp eax, -1
jnz @f
mov esi, read_mem_err
call put_message
xor eax, eax
@@:
mov [edi-8], eax
; call restore_from_breaks
; ret
restore_from_breaks:
; in: edi=buffer,eax=size,esi=address
mov ebx, breakpoints
@@:
test byte [ebx+4], 1
jz .cont ; ignore invalid
test byte [ebx+4], 2 or 8
jnz .cont ; ignore disabled and memory breaks
mov ecx, [ebx]
sub ecx, esi
cmp ecx, eax
jae .cont
mov dl, [ebx+5]
mov [edi+ecx], dl
.cont:
add ebx, 6
cmp ebx, breakpoints+breakpoints_n*6
jb @b
ret
 
OnLoad:
mov esi, [curarg]
OnLoadInit:
mov edi, loadname
or [prgname_len], -1
mov [prgname_ptr], edi
.copyname:
lodsb
stosb
inc [prgname_len]
cmp al, '/'
jnz @f
or [prgname_len], -1
mov [prgname_ptr], edi
@@:
cmp al, ' '
ja .copyname
mov byte [edi-1], 0
and [load_params], 0
dec esi
call skip_spaces
cmp al, 0
jz @f
mov [load_params], esi
@@:
and [dumppos], 0
do_reload:
push 18
pop eax
push 7
pop ebx
int 40h
mov [dbgwnd], eax
xchg ecx, eax
push 70
pop eax
mov ebx, fn70_load_block
int 40h
test eax, eax
jns .load_ok
.load_err:
push eax
mov esi, load_err_msg
call put_message
pop eax
not eax
cmp eax, 0x20
jae .unk_err
mov esi, [load_err_msgs+eax*4]
test esi, esi
jnz put_message
.unk_err:
mov esi, unk_err_msg
inc eax
push eax
call put_message_nodraw
jmp draw_messages
.load_ok:
mov [debuggee_pid], eax
mov [bSuspended], 1
push ecx
call get_context
mov edi, oldcontext
mov ecx, 10
rep movsd
; activate debugger window
pop ecx
mov bl, 3
push 18
pop eax
int 40h
call redraw_title
call redraw_registers
call get_dump
call redraw_dump
call update_disasm_eip_force
mov esi, load_succ_msg
push [debuggee_pid]
call put_message_nodraw
call draw_messages
; now test for packed progs
cmp [disasm_buf_size], 100h
jz @f
ret
@@:
mov esi, mxp_nrv_sig
mov ebp, disasm_buffer
mov edi, ebp
push 3
pop ecx
repz cmpsb
jnz .not_mxp_nrv
cmpsb
mov cl, mxp_nrv_sig_size-4
repz cmpsb
mov esi, mxp_nrv_name
jz .packed
.not_mxp_nrv:
mov esi, mxp_sig
mov edi, ebp
mov cl, mxp_sig_size
repz cmpsb
mov esi, mxp_name
jz .packed
.not_mxp:
mov esi, mxp_lzo_sig1
mov edi, ebp
mov cl, mxp_lzo_sig1_size
repz cmpsb
mov esi, mxp_lzo_name
jz .packed
mov esi, mxp_lzo_sig2
mov edi, ebp
mov cl, 8
repz cmpsb
jnz .not_mxp_lzo
cmpsb
mov cl, mxp_lzo_sig2_size - 9
repz cmpsb
mov esi, mxp_lzo_name
jz .packed
.not_mxp_lzo:
mov esi, mtappack_name
cmp dword [ebp], 0xBF5E246A
jnz .not_mtappack
cmp dword [ebp+8], 0xEC4E8B57
jnz .not_mtappack1
cmp dword [ebp+12], 0x8D5EA4F3
jnz .not_mtappack1
cmp byte [ebp+12h], 0xE9
jz .packed
.not_mtappack1:
cmp word [ebp+8], 0xB957
jnz .not_mtappack
cmp dword [ebp+14], 0x575EA4F3
jnz .not_mtappack2
cmp byte [ebp+17h], 0xE9
jz .packed
.not_mtappack2:
cmp dword [ebp+14], 0x5F8DA4F3
jnz .not_mtappack3
cmp word [ebp+18], 0xE9FC
jz .packed
.not_mtappack3:
cmp word [ebp+14], 0xA4F3
jnz .not_mtappack
cmp byte [ebp+15h], 0xE9
jz .packed
.not_mtappack:
ret
.packed:
push esi
mov esi, aPacked1
call put_message_nodraw
pop esi
call put_message_nodraw
mov esi, aPacked2
call put_message
call hide_cursor
push 40
pop eax
push 7
pop ebx
int 40h
.wait:
push 10
pop eax
int 40h
dec eax
jz .redraw
dec eax
jz .key
or eax, -1
int 40h
.redraw:
call draw_window
call hide_cursor
jmp .wait
.key:
mov al, 2
int 40h
cmp ah, 'y'
jz .yes
cmp ah, 'Y'
jz .yes
cmp ah, 0xD
jz .yes
cmp ah, 'n'
jz .no
cmp ah, 'N'
jnz .wait
.no:
push 40
pop eax
mov ebx, 0x107
int 40h
call draw_cursor
mov esi, aN_str
jmp put_message
.yes:
push 40
pop eax
mov ebx, 0x107
int 40h
call draw_cursor
mov esi, aY_str
call put_message
call OnUnpack
ret
 
mxp_nrv_sig:
xor eax, eax
mov ecx, 0x95 ; 0xA1 for programs with parameters
mov [eax], ecx
add ecx, [eax+24h]
push 40h
pop esi
mov edi, [eax+20h]
push edi
rep movsb
jmp dword [esp]
pop esi
add esi, [eax]
xor edi, edi
mxp_nrv_sig_size = $ - mxp_nrv_sig
 
mxp_sig:
mov ecx, 1CBh
push 46h
pop esi
mov edi, [20h]
rep movsb
mov ecx, [24h]
rep movsb
jmp dword [20h]
mov eax, [20h]
add eax, 1CBh
push eax
push dword [24h]
push 0
push 8
call $+0x25
mxp_sig_size = $ - mxp_sig
 
mxp_lzo_sig1:
xor eax, eax
mov ebp, 0FFh
mov ecx, 175h
mov [eax], ecx
add ecx, [eax+24h]
push 45h
pop esi
mov edi, [eax+20h]
push edi
rep movsb
jmp dword [esp]
pop ebx
add ebx, [eax]
xor edi, edi
cmp byte [ebx], 11h
jbe $+0x1A
mxp_lzo_sig1_size = $ - mxp_lzo_sig1
mxp_lzo_sig2:
xor eax, eax
mov ebp, 0FFh
mov ecx, 188h ; or 177h
mov [eax], ecx
add ecx, [eax+24h]
push 44h
pop esi
mov edi, [eax+20h]
rep movsb
jmp dword [eax+20h]
mov ebx, [eax+20h]
add ebx, [eax]
mxp_lzo_sig2_size = $ - mxp_lzo_sig2
 
OnReload:
cmp [debuggee_pid], 0
jnz terminate_reload
mov esi, need_debuggee
cmp byte [loadname], 0
jnz do_reload
jz put_message
terminate_reload:
mov [bReload], 1
OnTerminate:
mov ecx, [debuggee_pid]
push 8
pop ebx
push 69
pop eax
int 40h
ret
 
AfterSuspend:
mov [bSuspended], 1
call get_new_context
call get_dump
call redraw_title
call redraw_registers
call redraw_dump
call update_disasm_eip
ret
 
OnSuspend:
mov ecx, [debuggee_pid]
push 4
pop ebx
push 69
pop eax
int 40h
call AfterSuspend
mov esi, aSuspended
jmp put_message
DoResume:
mov ecx, [debuggee_pid]
push 5
pop ebx
push 69
pop eax
int 40h
mov [bSuspended], 0
ret
OnResume:
mov esi, [curarg]
cmp byte [esi], 0
jz GoOn
call calc_expression
jc .ret
mov eax, ebp
push eax
call find_enabled_breakpoint
pop eax
jz GoOn
mov bl, 5 ; valid enabled one-shot
call add_breakpoint
jnc GoOn
mov esi, aBreakpointLimitExceeded
call put_message
.ret:
ret
GoOn:
; test for enabled breakpoint at eip
mov eax, [_eip]
call find_enabled_breakpoint
jnz .nobreak
; temporarily disable breakpoint, make step, enable breakpoint, continue
inc eax
mov [temp_break], eax
mov [bAfterGo], 1
dec eax
call disable_breakpoint
call get_context
or byte [_eflags+1], 1 ; set TF
call set_context
and byte [_eflags+1], not 1
call DoResume
ret
.nobreak:
call DoResume
call redraw_title
call redraw_registers
call redraw_dump
ret
OnDetach:
mov ecx, [debuggee_pid]
push 3
pop ebx
push 69
pop eax
int 40h
and [debuggee_pid], 0
call redraw_title
call redraw_registers
call redraw_dump
mov esi, aContinued
jmp put_message
 
after_go_exception:
push eax
mov eax, [temp_break]
dec eax
push esi
call enable_breakpoint
; in any case, clear TF and RF
call get_new_context
and [_eflags], not 10100h ; clear TF,RF
call set_context
xor edx, edx
mov [temp_break], edx
xchg dl, [bAfterGo]
pop esi
pop eax
cmp dl, 2
jnz @f
lodsd
push esi
call get_dump
jmp exception.done
@@: test eax, eax
jz .notint1
; if exception is result of single step, simply ignore it and continue
test dword [esi], 0xF
jnz dbgmsgstart.5
lodsd
push esi
mov esi, oldcontext
mov edi, context
mov ecx, 28h/4
rep movsd
call DoResume
jmp dbgmsgend
.notint1:
; in other case, work as without temp_break
lodsd
push esi
push eax
jmp exception.4
.notour:
 
debugmsg:
neg [dbgbufsize]
mov esi, dbgbuf
dbgmsgstart:
lodsd
; push eax esi
; push dword [esi]
; mov esi, dbgmsg_str
; call put_message_nodraw
; pop esi eax
add esi, 4
dec eax
jz exception
dec eax
jz terminated
mov [bSuspended], 1
cmp [bAfterGo], 0
jnz after_go_exception
push esi
call get_new_context
and [_eflags], not 10100h ; clear TF,RF
call set_context
pop esi
.5:
push esi
call get_dump
pop esi
lodsd
xor ecx, ecx
.6:
bt eax, ecx
jnc .7
mov ebx, [drx_break+ecx*4]
test ebx, ebx
jz .7
pushad
dec ebx
push ebx
mov esi, aBreakStop
call put_message_nodraw
popad
.7:
inc ecx
cmp cl, 4
jb .6
push esi
jmp exception.done_draw
terminated:
push esi
mov esi, terminated_msg
call put_message
and [debuggee_pid], 0
and [temp_break], 0
mov [bAfterGo], 0
xor eax, eax
mov ecx, breakpoints_n*6/4+4
mov edi, breakpoints
rep stosd
cmp [bReload], 1
sbb [bReload], -1
jmp exception.done
exception:
mov [bSuspended], 1
cmp [bAfterGo], 0
jnz after_go_exception
lodsd
push esi
push eax
call get_new_context
and [_eflags], not 10100h ; clear TF,RF
call set_context
.4:
call get_dump
pop eax
; int3 command generates exception 0D, #GP
push eax
cmp al, 0Dh
jnz .notdbg
; check for 0xCC byte at eip
push 0
push 69
pop eax
push 6
pop ebx
mov ecx, [debuggee_pid]
mov edi, esp
mov esi, [_eip]
push 1
pop edx
int 40h
pop eax
cmp al, 0xCC
jnz .notdbg
; this is either dbg breakpoint or int3 cmd in debuggee
mov eax, [_eip]
call find_enabled_breakpoint
jnz .user_int3
; dbg breakpoint; clear if one-shot
pop ecx
push eax
mov esi, aBreakStop
test byte [edi+4], 4
jz .put_msg_eax
pop ecx
call clear_breakpoint
jmp .done
.user_int3:
mov eax, [_eip]
inc [_eip]
pop ecx
push eax
call set_context
mov esi, aUserBreak
jmp .put_msg_eax
.notdbg:
mov esi, aException
.put_msg_eax:
call put_message_nodraw
.done_draw:
call draw_messages
.done:
push 18
pop eax
push 3
pop ebx
mov ecx, [dbgwnd]
int 40h ; activate dbg window
call redraw_title
call redraw_registers
call redraw_dump
call update_disasm_eip
dbgmsgend:
pop esi
mov ecx, [dbgbuflen]
add ecx, dbgbuf
cmp esi, ecx
jnz dbgmsgstart
and [dbgbuflen], 0
neg [dbgbufsize]
cmp [bReload], 2
jnz @f
mov [bReload], 0
call do_reload
@@:
jmp waitevent
 
CtrlF7:
cmp [debuggee_pid], 0
jz .no
call OnStep
.no:
jmp waitevent
CtrlF8:
cmp [debuggee_pid], 0
jz CtrlF7.no
call OnProceed
jmp CtrlF7.no
 
OnStep:
cmp [bSuspended], 0
jz .running
call get_context
or byte [_eflags+1], 1 ; set TF
call set_context
and byte [_eflags+1], not 1
; if instruction at eip is "int xx", set one-shot breakpoint immediately after
mov eax, [_eip]
call find_enabled_breakpoint
jnz @f
cmp byte [edi+5], 0xCD
jz .int
@@:
push 0
push 69
pop eax
push 6
pop ebx
mov ecx, [debuggee_pid]
push 3
pop edx
mov edi, esp
mov esi, [_eip]
int 40h
cmp eax, edx
pop eax
jnz .doit
cmp al, 0xCD
jz .int
; resume process
.doit:
call GoOn
cmp [bAfterGo], 0
jz @f
mov [bAfterGo], 2
@@:
ret
.int:
mov eax, [_eip]
inc eax
inc eax
push eax
call find_enabled_breakpoint
pop eax
jz .doit
; there is no enabled breakpoint yet; set temporary breakpoint
mov bl, 5
call add_breakpoint
jmp .doit
.running:
mov esi, aRunningErr
jmp put_message
 
OnProceed:
cmp [bSuspended], 0
jz OnStep.running
mov esi, [_eip]
@@:
call get_byte_nobreak
jc OnStep
inc esi
; skip prefixes
call is_prefix
jz @b
cmp al, 0xE8 ; call
jnz @f
add esi, 4
jmp .doit
@@: ; A4,A5 = movs, A6,A7=cmps
cmp al, 0xA4
jb @f
cmp al, 0xA8
jb .doit
@@: ; AA,AB=stos, AC,AD=lods, AE,AF=scas
cmp al, 0xAA
jb @f
cmp al, 0xB0
jb .doit
@@: ; E0=loopnz,E1=loopz,E2=loop
cmp al, 0xE0
jb .noloop
cmp al, 0xE2
ja .noloop
inc esi
jmp .doit
.noloop: ; FF /2 = call
cmp al, 0xFF
jnz OnStep
call get_byte_nobreak
jc OnStep
inc esi
mov cl, al
and al, 00111000b
cmp al, 00010000b
jnz OnStep
; skip instruction
mov al, cl
and eax, 7
shr cl, 6
jz .mod0
jp .doit
cmp al, 4
jnz @f
inc esi
@@:
inc esi
dec cl
jz @f
add esi, 3
@@:
jmp .doit
.mod0:
cmp al, 4
jnz @f
call get_byte_nobreak
jc OnStep
inc esi
and al, 7
@@:
cmp al, 5
jnz .doit
add esi, 4
.doit:
; insert one-shot breakpoint at esi and resume
call get_byte_nobreak
jc OnStep
mov eax, esi
call find_enabled_breakpoint
jz .ret
mov eax, esi
mov bl, 5
call add_breakpoint
jmp OnStep.doit
.ret:
ret
 
get_byte_nobreak:
mov eax, esi
call find_enabled_breakpoint
jnz .nobreak
mov al, [edi+5]
clc
ret
.nobreak:
push 69
pop eax
push 6
pop ebx
mov ecx, [debuggee_pid]
xor edx, edx
push edx
inc edx
mov edi, esp
int 40h
dec eax
clc
jz @f
stc
@@: pop eax
ret
 
is_prefix:
cmp al, 0x64 ; fs:
jz .ret
cmp al, 0x65 ; gs:
jz .ret
cmp al, 0x66 ; use16/32
jz .ret
cmp al, 0x67 ; addr16/32
jz .ret
cmp al, 0xF0 ; lock
jz .ret
cmp al, 0xF2 ; repnz
jz .ret
cmp al, 0xF3 ; rep(z)
jz .ret
cmp al, 0x2E ; cs:
jz .ret
cmp al, 0x36 ; ss:
jz .ret
cmp al, 0x3E ; ds:
jz .ret
cmp al, 0x26 ; es:
.ret: ret
 
token_end equ 1
token_reg equ 2
token_hex equ 3
token_add equ 4
token_sub equ 5
token_mul equ 6
token_div equ 7
token_lp equ 8
token_rp equ 9
token_err equ -1
 
is_hex_digit:
cmp al, '0'
jb .no
cmp al, '9'
jbe .09
cmp al, 'A'
jb .no
cmp al, 'F'
jbe .AF
cmp al, 'a'
jb .no
cmp al, 'f'
jbe .af
.no:
stc
ret
.09:
sub al, '0'
; clc
ret
.AF:
sub al, 'A'-10
; clc
ret
.af:
sub al, 'a'-10
; clc
ret
 
find_reg:
mov edi, reg_table
.findreg:
movzx ecx, byte [edi]
stc
jecxz .regnotfound
inc edi
push esi edi ecx
@@:
lodsb
or al, 20h
scasb
loopz @b
pop ecx edi esi
lea edi, [edi+ecx+1]
jnz .findreg
movzx edi, byte [edi-1]
add esi, ecx
.regnotfound:
ret
 
expr_get_token:
lodsb
cmp al, 0
jz .end_token
cmp al, ' '
jbe expr_get_token
cmp al, '+'
jz .add
cmp al, '-'
jz .sub
cmp al, '*'
jz .mul
cmp al, '/'
jz .div
cmp al, '('
jz .lp
cmp al, ')'
jnz .notsign
.rp:
mov al, token_rp
ret
.div:
mov al, token_div
ret
.end_token:
mov al, token_end
ret
.add:
mov al, token_add
ret
.sub:
mov al, token_sub
ret
.mul:
mov al, token_mul
ret
.lp:
mov al, token_lp
ret
.notsign:
dec esi
call find_reg
jc .regnotfound
mov al, token_reg
ret
.regnotfound:
; test for hex number
xor ecx, ecx
xor edi, edi
xor eax, eax
@@:
lodsb
call is_hex_digit
jc @f
shl edi, 4
or edi, eax
inc ecx
jmp @b
@@:
dec esi
jecxz .err
cmp ecx, 8
ja .err
mov al, token_hex
ret
.err:
mov al, token_err
mov esi, aParseError
ret
 
expr_read2:
cmp al, token_hex
jz .hex
cmp al, token_reg
jz .reg
cmp al, token_lp
jz .lp
mov al, token_err
mov esi, aParseError
ret
.hex:
mov ebp, edi
.ret:
jmp expr_get_token
.reg:
cmp edi, 24
jz .eip
sub edi, 4
jb .8lo
sub edi, 4
jb .8hi
sub edi, 8
jb .16
mov ebp, [_eax+edi*4]
jmp .ret
.16:
movzx ebp, word [_eax+(edi+8)*4]
jmp .ret
.8lo:
movzx ebp, byte [_eax+(edi+4)*4]
jmp .ret
.8hi:
movzx ebp, byte [_eax+(edi+4)*4+1]
jmp .ret
.eip:
mov ebp, [_eip]
jmp .ret
.lp:
call expr_get_token
call expr_read0
cmp al, token_err
jz @f
cmp al, token_rp
jz expr_get_token
mov al, token_err
mov esi, aParseError
@@: ret
 
expr_read1:
call expr_read2
.1:
cmp al, token_mul
jz .mul
cmp al, token_div
jz .div
ret
.mul:
push ebp
call expr_get_token
call expr_read2
pop edx
; ebp := edx*ebp
imul ebp, edx
jmp .1
.div:
push ebp
call expr_get_token
call expr_read2
pop edx
; ebp := edx/ebp
test ebp, ebp
jz .div0
push eax
xor eax, eax
xchg eax, edx
div ebp
xchg eax, ebp
pop eax
jmp .1
.div0:
mov al, token_err
mov esi, aDivByZero
ret
 
expr_read0:
xor ebp, ebp
cmp al, token_add
jz .add
cmp al, token_sub
jz .sub
call expr_read1
.1:
cmp al, token_add
jz .add
cmp al, token_sub
jz .sub
ret
.add:
push ebp
call expr_get_token
call expr_read1
pop edx
; ebp := edx+ebp
add ebp, edx
jmp .1
.sub:
push ebp
call expr_get_token
call expr_read1
pop edx
; ebp := edx-ebp
xchg edx, ebp
sub ebp, edx
jmp .1
 
calc_expression:
; in: esi->expression
; out: CF=1 if error
; CF=0 and ebp=value if ok
call expr_get_token
call expr_read0
cmp al, token_end
jz .end
cmp al, token_err
jz @f
mov esi, aParseError
@@:
call put_message
stc
ret
.end:
clc
ret
 
OnCalc:
mov esi, [curarg]
call calc_expression
jc .ret
push ebp
mov esi, calc_string
call put_message_nodraw
jmp draw_messages
.ret:
ret
 
OnDump:
mov esi, [curarg]
cmp byte [esi], 0
jnz .param
add [dumppos], dump_height*10h
jmp .doit
.param:
call calc_expression
jc .ret
mov [dumppos], ebp
.doit:
call get_dump
call redraw_dump
.ret:
ret
 
OnUnassemble:
mov esi, [curarg]
cmp byte [esi], 0
jnz .param
mov eax, [disasm_start_pos]
mov ecx, disasm_height
mov [disasm_cur_pos], eax
@@:
push ecx
call disasm_instr
pop ecx
jc .err
loop @b
mov eax, [disasm_cur_pos]
jmp .doit
.param:
call calc_expression
jc .ret
mov eax, ebp
.doit:
push eax
push [disasm_start_pos]
mov [disasm_start_pos], eax
call update_disasm
pop [disasm_start_pos]
pop eax
cmp [disasm_cur_str], 0
jz @f
mov [disasm_start_pos], eax
.ret:
ret
@@:
call update_disasm
.err:
mov esi, aInvAddr
jmp put_message
 
OnReg:
mov esi, [curarg]
call skip_spaces
call find_reg
jnc @f
.err:
mov esi, RSyntax
jmp put_message
@@:
call skip_spaces
test al, al
jz .err
cmp al, '='
jnz @f
inc esi
call skip_spaces
test al, al
jz .err
@@:
push edi
call calc_expression
pop edi
jc .ret
; now edi=register id, ebp=value
cmp [bSuspended], 0
mov esi, aRunningErr
jz put_message
xchg eax, ebp
cmp edi, 24
jz .eip
sub edi, 4
jb .8lo
sub edi, 4
jb .8hi
sub edi, 8
jb .16
mov [_eax+edi*4], eax
jmp .ret
.16:
mov word [_eax+(edi+8)*4], ax
jmp .ret
.8lo:
mov byte [_eax+(edi+4)*4], al
jmp .ret
.8hi:
mov byte [_eax+(edi+4)*4+1], al
jmp .ret
.eip:
mov [_eip], eax
call update_disasm_eip
.ret:
call set_context
jmp redraw_registers
 
; Breakpoints manipulation
OnBp:
mov esi, [curarg]
call calc_expression
jc .ret
xchg eax, ebp
push eax
call find_breakpoint
inc eax
pop eax
jz .notfound
mov esi, aDuplicateBreakpoint
jmp .sayerr
.notfound:
mov bl, 1
call add_breakpoint
jnc .ret
mov esi, aBreakpointLimitExceeded
.sayerr:
call put_message
.ret:
jmp redraw_disasm
 
OnBpmb:
mov dh, 0011b
jmp DoBpm
OnBpmw:
mov dh, 0111b
jmp DoBpm
OnBpmd:
mov dh, 1111b
DoBpm:
mov esi, [curarg]
cmp byte [esi], 'w'
jnz @f
and dh, not 2
inc esi
@@:
push edx
call calc_expression
pop edx
jnc @f
ret
@@:
; ebp=expression, dh=flags
movzx eax, dh
shr eax, 2
test ebp, eax
jz @f
mov esi, aUnaligned
jmp put_message
@@:
mov eax, ebp
mov bl, 0Bh
call add_breakpoint
jnc @f
mov esi, aBreakpointLimitExceeded
jmp put_message
@@:
; now find index
push eax
xor ecx, ecx
.l1:
cmp [drx_break+ecx*4], 0
jnz .l2
push 69
pop eax
push ecx
mov dl, cl
mov ecx, [debuggee_pid]
mov esi, ebp
push 9
pop ebx
int 40h
test eax, eax
jz .ok
pop ecx
.l2:
inc ecx
cmp ecx, 4
jb .l1
pop eax
call clear_breakpoint
mov esi, aBreakpointLimitExceeded
jmp put_message
.ok:
pop ecx
pop eax
and byte [edi], not 2 ; breakpoint is enabled
shl dl, 6
or dl, dh
mov byte [edi+1], dl
inc eax
mov [drx_break+ecx*4], eax
ret
 
OnBc:
mov esi, [curarg]
@@: call get_hex_number
jc OnBp.ret
call clear_breakpoint
jmp @b
 
OnBd:
mov esi, [curarg]
@@: call get_hex_number
jc OnBp.ret
call disable_breakpoint
jmp @b
 
OnBe:
mov esi, [curarg]
@@: call get_hex_number
jc OnBp.ret
push eax
call find_enabled_breakpoint
pop eax
jz .err
call enable_breakpoint
jmp @b
.err:
mov esi, OnBeErrMsg
jmp put_message
 
get_hex_number:
call skip_spaces
xor ecx, ecx
xor edx, edx
@@:
lodsb
call is_hex_digit
jc .ret
shl edx, 4
or dl, al
inc ecx
jmp @b
.ret:
dec esi
cmp ecx, 1
xchg eax, edx
ret
 
OnBl:
mov esi, [curarg]
cmp byte [esi], 0
jz .listall
call get_hex_number
jc .ret
cmp eax, breakpoints_n
jae .err
push eax
add eax, eax
lea edi, [breakpoints + eax + eax*2]
pop eax
test byte [edi+4], 1
jz .err
call show_break_info
.ret:
ret
.err:
mov esi, aInvalidBreak
jmp put_message
.listall:
mov edi, breakpoints
xor eax, eax
@@:
test byte [edi+4], 1
jz .cont
push edi eax
call show_break_info
pop eax edi
.cont:
add edi, 6
inc eax
cmp eax, breakpoints_n
jb @b
ret
 
show_break_info:
push edi
test byte [edi+4], 8
jnz .dr
push dword [edi]
push eax
mov esi, aBreakNum
call put_message_nodraw
jmp .cmn
.dr:
push eax
mov esi, aMemBreak1
call put_message_nodraw
pop edi
push edi
mov esi, aMemBreak2
test byte [edi+5], 2
jz @f
mov esi, aMemBreak3
@@:
call put_message_nodraw
pop edi
push edi
mov esi, aMemBreak6
test byte [edi+5], 8
jnz @f
mov esi, aMemBreak5
test byte [edi+5], 4
jnz @f
mov esi, aMemBreak4
@@:
call put_message_nodraw
pop edi
push edi
push dword [edi]
mov esi, aMemBreak7
call put_message_nodraw
.cmn:
pop edi
test byte [edi+4], 2
jz @f
push edi
mov esi, aDisabled
call put_message_nodraw
pop edi
@@:
test byte [edi+4], 4
jz @f
mov esi, aOneShot
call put_message_nodraw
@@:
mov esi, newline
jmp put_message
 
add_breakpoint:
; in: eax=address, bl=flags
; out: CF=1 => error, CF=0 => eax=breakpoint number
xor ecx, ecx
mov edi, breakpoints
@@:
test byte [edi+4], 1
jz .found
add edi, 6
inc ecx
cmp ecx, breakpoints_n
jb @b
stc
ret
.found:
stosd
xchg eax, ecx
mov [edi], bl
test bl, 2
jnz @f
or byte [edi], 2
push eax
call enable_breakpoint
pop eax
@@:
clc
ret
 
clear_breakpoint:
cmp eax, breakpoints_n
jae .ret
mov ecx, 4
inc eax
.1:
cmp [drx_break-4+ecx*4], eax
jnz @f
and [drx_break-4+ecx*4], 0
@@: loop .1
dec eax
push eax
add eax, eax
lea edi, [breakpoints + eax + eax*2 + 4]
test byte [edi], 1
pop eax
jz .ret
push edi
call disable_breakpoint
pop edi
mov byte [edi], 0
.ret:
ret
 
disable_breakpoint:
cmp eax, breakpoints_n
jae .ret
add eax, eax
lea edi, [breakpoints + eax + eax*2 + 5]
test byte [edi-1], 1
jz .ret
test byte [edi-1], 2
jnz .ret
or byte [edi-1], 2
test byte [edi-1], 8
jnz .dr
push esi
push 7
pop ebx
push 69
pop eax
mov ecx, [debuggee_pid]
xor edx, edx
inc edx
mov esi, [edi-5]
int 40h
pop esi
.ret:
ret
.dr:
mov dl, [edi]
shr dl, 6
mov dh, 80h
push 69
pop eax
push 9
pop ebx
mov ecx, [debuggee_pid]
int 40h
ret
 
enable_breakpoint:
push esi
cmp eax, breakpoints_n
jae .ret
add eax, eax
lea edi, [breakpoints + eax + eax*2 + 5]
test byte [edi-1], 1
jz .ret
test byte [edi-1], 2
jz .ret
and byte [edi-1], not 2
test byte [edi-1], 8
jnz .dr
push 6
pop ebx
push 69
pop eax
mov esi, [edi-5]
mov ecx, [debuggee_pid]
xor edx, edx
inc edx
int 40h
dec eax
jnz .err
mov al, 69
push 0xCC
mov edi, esp
inc ebx
int 40h
pop eax
.ret:
pop esi
ret
.err:
or byte [edi-1], 2
mov esi, aBreakErr
call put_message
pop esi
ret
.dr:
push 9
pop ebx
push 69
pop eax
mov esi, [edi-5]
mov ecx, [debuggee_pid]
mov dl, [edi]
shr dl, 6
mov dh, [edi]
and dh, 0xF
int 40h
test eax, eax
jnz .err
pop esi
ret
 
find_breakpoint:
xor ecx, ecx
xchg eax, ecx
mov edi, breakpoints
@@:
test byte [edi+4], 1
jz .cont
test byte [edi+4], 8
jnz .cont
cmp [edi], ecx
jz .found
.cont:
add edi, 6
inc eax
cmp eax, breakpoints_n
jb @b
or eax, -1
.found:
ret
 
find_enabled_breakpoint:
xor ecx, ecx
xchg eax, ecx
mov edi, breakpoints
@@:
test byte [edi+4], 1
jz .cont
test byte [edi+4], 2 or 8
jnz .cont
cmp [edi], ecx
jz .found
.cont:
add edi, 6
inc eax
cmp eax, breakpoints_n
jb @b
or eax, -1
.found:
ret
 
OnUnpack:
; program must be loaded - checked when command was parsed
; program must be stopped
mov esi, aRunningErr
cmp [bSuspended], 0
jz put_message
; all breakpoints must be disabled
mov edi, breakpoints
@@:
test byte [edi+4], 1
jz .cont
test byte [edi+4], 2
jnz .cont
mov esi, aEnabledBreakErr
jmp put_message
.cont:
add edi, 6
cmp edi, breakpoints+breakpoints_n*6
jb @b
; ok, now do it
; set breakpoint on 0xC dword access
push 9
pop ebx
mov ecx, [debuggee_pid]
mov dx, 1111b*256
push 0xC
pop esi
@@:
push 69
pop eax
int 40h
test eax, eax
jz .breakok
inc edx
cmp dl, 4
jb @b
.breakok:
call GoOn
; now wait for event
.wait:
push 10
pop eax
int 40h
dec eax
jz .redraw
dec eax
jz .key
dec eax
jnz .debug
; button; we have only one button, close
or eax, -1
int 40h
.redraw:
call draw_window
jmp .wait
.key:
mov al, 2
int 40h
cmp ah, 3 ; Ctrl+C
jnz .wait
.userbreak:
mov esi, aInterrupted
.x1:
push edx esi
call put_message
pop esi edx
or dh, 80h
push 69
pop eax
push 9
pop ebx
mov ecx, [debuggee_pid]
int 40h
cmp esi, aUnpacked
jnz OnSuspend
jmp AfterSuspend
.debug:
cmp [dbgbuflen], 4*3
jnz .notour
cmp dword [dbgbuf], 3
jnz .notour
test byte [dbgbuf+8], 1
jnz .our
.notour:
mov esi, aInterrupted
push edx
call put_message
pop edx
or dh, 80h
push 69
pop eax
push 9
pop ebx
mov ecx, [debuggee_pid]
int 40h
jmp debugmsg
.our:
and [dbgbuflen], 0
push edx
call get_context
push eax
mov al, 69
mov bl, 6
mov ecx, [debuggee_pid]
mov edi, esp
push 4
pop edx
push 0xC
pop esi
int 40h
pop eax
pop edx
cmp eax, [_eip]
jz .done
call DoResume
jmp .wait
.done:
mov esi, aUnpacked
jmp .x1
 
disasm_get_byte:
; out: al=byte
push ecx
mov ecx, [disasm_cur_pos]
sub ecx, [disasm_start_pos]
cmp ecx, [disasm_buf_size]
jae disasm_err
mov al, [disasm_buffer+ecx]
pop ecx
inc [disasm_cur_pos]
ret
disasm_get_word:
push ecx
mov ecx, [disasm_cur_pos]
sub ecx, [disasm_start_pos]
inc ecx
cmp ecx, [disasm_buf_size]
jae disasm_err
mov ax, word [disasm_buffer-1+ecx]
pop ecx
add [disasm_cur_pos], 2
ret
disasm_get_dword:
push ecx
mov ecx, [disasm_cur_pos]
sub ecx, [disasm_start_pos]
add ecx, 3
cmp ecx, [disasm_buf_size]
jae disasm_err
mov eax, dword [disasm_buffer-3+ecx]
pop ecx
add [disasm_cur_pos], 4
ret
 
disasm_err:
mov esp, ebp
stc_ret:
stc
ret
disasm_ret:
mov esp, ebp
and byte [edi], 0
ret
 
disasm_instr:
mov ebp, esp
cmp [debuggee_pid], 0
jz stc_ret
mov edi, disasm_string
xor ecx, ecx
; ecx=flags
disasm_loop1:
xor eax, eax
call disasm_get_byte
jmp dword [disasm_table_1 + eax*4]
 
cop0:
clock:
crepnz:
crep:
csegcs:
csegds:
cseges:
csegss:
csegfs:
cseggs:
call @f
db 0x2E,3,'cs:'
db 0x36,3,'ss:'
db 0x3E,3,'ds:'
db 0x26,3,'es:'
db 0x64,3,'fs:'
db 0x65,3,'gs:'
db 0x06,10,'push es'
db 0x07,10,'pop es'
db 0x0E,10,'push cs'
db 0x16,10,'push ss'
db 0x17,10,'pop ss'
db 0x1E,10,'push ds'
db 0x1F,10,'pop ds'
db 0x27,3,'daa'
db 0x2F,3,'das'
db 0x37,3,'aaa'
db 0x3F,3,'aas'
db 0x60,6,0,'pusha'
db 0x61,5,0,'popa'
db 0x90,3,'nop'
db 0x9B,5,'fwait'
db 0x9C,6,0,'pushf'
db 0x9D,5,0,'popf'
db 0x9E,4,'sahf'
db 0x9F,4,'lahf'
db 0xA4,5,'movsb'
db 0xA5,5,0,'movs'
db 0xA6,5,'cmpsb'
db 0xA7,5,0,'cmps'
db 0xAA,5,'stosb'
db 0xAB,5,0,'stos'
db 0xAC,5,'lodsb'
db 0xAD,5,0,'lods'
db 0xAE,5,'scasb'
db 0xAF,5,0,'scas'
db 0xC3,3,'ret'
db 0xC9,5,'leave'
db 0xCC,4,'int3'
db 0xF0,4,'lock'
db 0xF2,5,'repnz'
db 0xF3,6,'rep(z)'
db 0xF5,3,'cmc'
db 0xF8,3,'clc'
db 0xF9,3,'stc'
db 0xFA,3,'cli'
db 0xFB,3,'sti'
db 0xFC,3,'cld'
db 0xFD,3,'std'
@@:
pop esi
@@:
cmp al, [esi]
jz .found
inc esi
movzx edx, byte [esi]
inc esi
add esi, edx
jmp @b
.found:
inc esi
lodsb
cmp byte [esi], 0
jz @f
movzx ecx, al
disasm_1:
rep movsb
and byte [edi], 0
ret
@@:
mov dl, ch
movzx ecx, al
dec ecx
inc esi
rep movsb
test dl, 1
mov al, 'w'
jnz @f
mov al, 'd'
@@: stosb
and byte [edi], 0
ret
 
c67:
or ch, 2
jmp disasm_loop1
c66:
or ch, 1
jmp disasm_loop1
 
center:
caam:
cxlat:
crdtsc:
csysenter:
ccpuid:
ccmpxchg:
cbsf:
cbsr:
ccmpxchg8b:
cunk:
cerr:
mov eax, '???'
stosd
clc
ret
 
cF:
call disasm_get_byte
jmp dword [disasm_table_2 + eax*4]
 
macro disasm_set_modew
{
test al, 1
jz @f
or ch, 80h
@@:
}
 
cmov2:
disasm_set_modew
; mov r/m,i
call disasm_get_byte
dec [disasm_cur_pos]
test al, 00111000b
jnz cunk
mov eax, 'mov '
stosd
mov eax, ' '
stosd
call disasm_readrmop
mov ax, ', '
stosw
xor eax, eax
test ch, 80h
jnz .1
call disasm_get_byte
jmp .3
.1:
test ch, 1
jnz .2
call disasm_get_dword
jmp .3
.2:
call disasm_get_word
.3:
call disasm_write_num
and byte [edi], 0
ret
 
cret2:
mov eax, 'ret '
stosd
mov eax, ' '
stosd
xor eax, eax
jmp cmov2.2
 
disasm_write_num:
push ecx eax
inc edi
@@:
mov ecx, eax
shr eax, 4
jz @f
inc edi
jmp @b
@@:
pop eax
cmp ecx, 10
jb @f
inc edi
@@:
push edi eax
@@:
mov ecx, eax
and al, 0xF
cmp al, 10
sbb al, 69h
das
dec edi
mov [edi], al
mov eax, ecx
shr eax, 4
jnz @b
cmp ecx, 10
jb @f
mov byte [edi-1], '0'
@@:
pop eax edi ecx
cmp eax, 10
jb @f
mov byte [edi], 'h'
inc edi
@@:
ret
 
label disasm_regs32 dword
label disasm_regs dword
db 'eax',0
db 'ecx',0
db 'edx',0
db 'ebx',0
db 'esp',0
db 'ebp',0
db 'esi',0
db 'edi',0
disasm_regs16 dw 'ax','cx','dx','bx','sp','bp','si','di'
disasm_regs8 dw 'al','cl','dl','bl','ah','ch','dh','bh'
disasm_scale db '1248'
disasm_readrmop:
call disasm_get_byte
test ch, 40h
jnz .skip_size
push eax
and al, 0xC0
cmp al, 0xC0
pop eax
jz .skip_size
test ch, 80h
jz .byte
test ch, 1
jnz .word
mov dword [edi], 'dwor'
mov byte [edi+4], 'd'
inc edi
jmp @f
.byte:
test ch, 20h
jz .qb
mov byte [edi], 't'
inc edi
.qb:
mov dword [edi], 'byte'
jmp @f
.word:
test ch, 20h
jz .qw
mov byte [edi], 'q'
inc edi
.qw:
mov dword [edi], 'word'
@@:
mov byte [edi+4], ' '
add edi, 5
.skip_size:
test ch, 2
jnz disasm_readrmop16
push ecx
movzx ecx, al
and eax, 7
shr ecx, 6
jz .vmod0
jp .vmod3
mov byte [edi], '['
inc edi
cmp al, 4
jz .sib1
mov eax, [disasm_regs+eax*4]
stosd
dec edi
jmp @f
.sib1:
call .parse_sib
@@:
mov al, '+'
stosb
dec ecx
jz .vmod1
call disasm_get_dword
jmp @f
.vmod1:
call disasm_get_byte
movsx eax, al
@@:
test eax, eax
jns .2
neg eax
mov byte [edi-1], '-'
.2:
call disasm_write_num
mov al, ']'
stosb
pop ecx
ret
.vmod3:
pop ecx
test ch, 80h
jz .vmod3_byte
test ch, 1
jnz .vmod3_word
test ch, 20h
jnz .vmod3_sti
mov eax, [disasm_regs32+eax*4]
stosd
dec edi
ret
.vmod3_byte:
mov ax, [disasm_regs8+eax*2]
@@:
stosw
ret
.vmod3_word:
mov ax, [disasm_regs16+eax*2]
jmp @b
.vmod3_sti:
mov word [edi], 'st'
add al, '0'
mov byte [edi+2], al
add edi, 3
ret
.vmod0:
mov byte [edi], '['
inc edi
cmp al, 4
jz .sib2
cmp al, 5
jz .ofs32
mov eax, [disasm_regs+eax*4]
stosd
mov byte [edi-1], ']'
pop ecx
ret
.ofs32:
call disasm_get_dword
jmp .2
.sib2:
call .parse_sib
mov al, ']'
stosb
pop ecx
ret
.parse_sib:
call disasm_get_byte
push edx
mov dl, al
mov dh, 0
and eax, 7
cmp al, 5
jnz @f
jecxz .sib0
@@:
mov eax, [disasm_regs+eax*4]
stosd
dec edi
mov dh, 1
.sib0:
mov al, dl
shr eax, 3
and eax, 7
cmp al, 4
jz .sibret
test dh, dh
jz @f
mov byte [edi], '+'
inc edi
@@:
mov eax, [disasm_regs+eax*4]
stosd
dec edi
shr dl, 6
jz @f
mov al, '*'
stosb
movzx eax, dl
mov al, [disasm_scale+eax]
stosb
@@:
.sibret:
test dh, dh
jnz .sibret2
call disasm_get_dword
cmp byte [edi-1], '['
jz @f
mov byte [edi], '+'
test eax, eax
jns .sibns
neg eax
mov byte [edi], '-'
.sibns:
inc edi
@@:
call disasm_write_num
.sibret2:
pop edx
ret
 
disasm_rm16_1 dd 'bxsi','bxdi','bpsi','bpdi'
disasm_rm16_2 dw 'si','di','bp','bx'
disasm_readrmop16:
push ecx
movzx ecx, al
and eax, 7
shr ecx, 6
jz .vmod0
jp disasm_readrmop.vmod3 ; mod=3 is the same in 16- and 32-bit code
; 1 or 2
mov byte [edi], '['
inc edi
cmp al, 4
jae @f
mov eax, [disasm_rm16_1+eax*4]
stosw
mov al, '+'
stosb
shr eax, 16
jmp .1
@@:
mov eax, dword [disasm_rm16_2+eax*2-4*2]
.1:
stosw
mov al, '+'
stosb
xor eax, eax
dec ecx
jnz .2
call disasm_get_byte
cbw
jmp @f
.2:
call disasm_get_word
@@:
test ax, ax
jns @f
mov byte [edi-1], '-'
neg ax
@@:
call disasm_write_num
.done1:
mov al, ']'
stosb
pop ecx
ret
.vmod0:
mov byte [edi], '['
inc edi
cmp al, 6
jz .ofs16
cmp al, 4
jae @f
mov eax, [disasm_rm16_1+eax*4]
stosw
mov al, '+'
stosb
shr eax, 16
jmp .3
@@:
mov eax, dword [disasm_rm16_2+eax*2-4*2]
.3:
stosw
jmp .done1
.ofs16:
xor eax, eax
call disasm_get_word
call disasm_write_num
jmp .done1
 
cpush21:
mov eax, 'push'
stosd
mov eax, ' '
stosd
disasm_i32:
call disasm_get_dword
call disasm_write_num
and byte [edi], 0
ret
 
cpush22:
mov eax, 'push'
stosd
mov eax, ' '
stosd
call disasm_get_byte
movsx eax, al
call disasm_write_num
and byte [edi], 0
ret
 
cinc1:
; inc reg32
cdec1:
; dec reg32
cpush1:
; push reg32
cpop1:
; pop reg32
cbswap:
; bswap reg32
mov edx, eax
and edx, 7
shr eax, 3
sub al, 8
mov esi, 'inc '
jz @f
mov esi, 'dec '
dec al
jz @f
mov esi, 'push'
dec al
jz @f
mov esi, 'pop '
dec al
jz @f
mov esi, 'bswa'
@@:
xchg eax, esi
stosd
mov eax, ' '
jz @f
mov al, 'p'
@@:
stosd
xchg eax, edx
call disasm_write_reg1632
and byte [edi], 0
ret
 
cxchg1:
; xchg eax,reg32
and eax, 7
xchg eax, edx
mov eax, 'xchg'
stosd
mov eax, ' '
stosd
xor eax, eax
call disasm_write_reg1632
mov ax, ', '
stosw
xchg eax, edx
call disasm_write_reg1632
and byte [edi], 0
ret
 
cint:
mov eax, 'int '
stosd
mov eax, ' '
stosd
disasm_i8u:
xor eax, eax
call disasm_get_byte
call disasm_write_num
and byte [edi], 0
ret
 
cmov11:
; mov r8,i8
mov ecx, eax
mov eax, 'mov '
stosd
mov eax, ' '
stosd
and ecx, 7
mov ax, [disasm_regs8+ecx*2]
stosw
mov ax, ', '
stosw
jmp disasm_i8u
 
cmov12:
; mov r32,i32
xchg eax, edx
mov eax, 'mov '
stosd
mov eax, ' '
stosd
xchg eax, edx
and eax, 7
call disasm_write_reg1632
mov ax, ', '
stosw
jmp cmov2.1
 
disasm_shifts dd 'rol ','ror ','rcl ','rcr ','shl ','shr ','sal ','sar '
cshift2:
; shift r/m,1 = D0/D1
cshift3:
; shift r/m,cl = D2/D3
disasm_set_modew
mov dl, al
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
mov eax, [disasm_shifts+eax*4]
stosd
mov eax, ' '
stosd
call disasm_readrmop
cmp dl, 0xD2
jb .s1
mov eax, ', cl'
stosd
and byte [edi], 0
ret
.s1:
mov eax, ', 1'
stosd
clc
ret
 
cshift1:
; shift r/m,i8 = C0/C1
disasm_set_modew
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
mov eax, [disasm_shifts+eax*4]
stosd
mov eax, ' '
stosd
call disasm_readrmop
mov ax, ', '
stosw
jmp disasm_i8u
 
 
cmov3:
; A0: mov al,[ofs32]
; A1: mov ax/eax,[ofs32]
; A2: mov [ofs32],al
; A3: mov [ofs32],ax/eax
mov edx, 'mov '
xchg eax, edx
stosd
mov eax, ' '
stosd
test dl, 2
jnz .1
call .write_acc
mov ax, ', '
stosw
call .write_ofs32
jmp .2
.1:
call .write_ofs32
mov ax, ', '
stosw
call .write_acc
.2: and byte [edi], 0
ret
.write_acc:
test dl, 1
jz .8bit
test ch, 1
jnz .16bit
mov eax, 'eax'
stosd
dec edi
ret
.16bit:
mov ax, 'ax'
stosw
ret
.8bit:
mov ax, 'al'
stosw
ret
.write_ofs32:
mov al, '['
stosb
call disasm_get_dword
call disasm_write_num
mov al, ']'
stosb
ret
 
disasm_write_reg:
test ch, 80h
jnz disasm_write_reg1632
mov ax, [disasm_regs8+eax*2]
stosw
ret
disasm_write_reg1632:
test ch, 1
jnz @f
mov eax, [disasm_regs32+eax*4]
stosd
dec edi
ret
@@:
mov ax, [disasm_regs16+eax*2]
stosw
ret
 
cmovzx: ; 0F B6/B7
cmovsx: ; 0F BE/BF
mov edx, eax
disasm_set_modew
mov eax, 'movz'
cmp dl, 0xB8
jb @f
mov eax, 'movs'
@@:
stosd
mov eax, 'x '
stosd
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
call disasm_write_reg1632
mov ax, ', '
stosw
or ch, 1 ; 2nd operand - 8 or 16 bits
call disasm_readrmop
and byte [edi], 0
ret
 
disasm_op2cmds dd 'add ','or ','adc ','sbb ','and ','sub ','xor ','cmp '
cop21:
disasm_set_modew
mov esi, 'test'
cmp al, 0A8h
jae @f
shr al, 3
and eax, 7
mov esi, [disasm_op2cmds+eax*4]
@@:
xchg eax, esi
stosd
mov eax, ' '
stosd
test ch, 80h
jnz .1632
mov eax, 'al, '
stosd
jmp disasm_i8u
.1632:
test ch, 1
jnz .16
mov eax, 'eax,'
stosd
mov al, ' '
stosb
call disasm_get_dword
jmp .x
.16:
mov eax, 'ax, '
stosd
xor eax, eax
call disasm_get_word
.x:
call disasm_write_num
and byte [edi], 0
ret
 
cop22:
disasm_set_modew
or ch, 40h
mov edx, eax
mov esi, 'lea '
cmp al, 8Dh
jz @f
mov esi, 'imul'
cmp al, 0xAF
jz @f
mov esi, 'mov '
cmp al, 88h
jae @f
mov esi, 'xchg'
cmp al, 86h
jae @f
mov esi, 'test'
cmp al, 84h
jae @f
shr al, 3
and eax, 7
mov esi, [disasm_op2cmds+eax*4]
@@:
xchg eax, esi
stosd
mov eax, ' '
stosd
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
cmp dl, 0x8D
jz @f
cmp dl, 0x86
jz @f
cmp dl, 0x87
jz @f
test dl, 2
jz .d0
@@:
call disasm_write_reg
mov ax, ', '
stosw
call disasm_readrmop
and byte [edi], 0
ret
.d0:
push eax
call disasm_readrmop
mov ax, ', '
stosw
pop eax
call disasm_write_reg
and byte [edi], 0
ret
 
cop23:
disasm_set_modew
xchg eax, edx
call disasm_get_byte
dec [disasm_cur_pos]
shr eax, 3
and eax, 7
mov eax, [disasm_op2cmds+eax*4]
ctest:
stosd
mov eax, ' '
stosd
call disasm_readrmop
mov ax, ', '
stosw
test ch, 80h
jz .i8
cmp dl, 83h
jz .i8
test ch, 1
jnz .i16
call disasm_get_dword
jmp .ic
.i8:
xor eax, eax
call disasm_get_byte
cmp dl, 83h
jnz .ic
movsx eax, al
jmp .ic
.i16:
xor eax, eax
call disasm_get_word
.ic:
call disasm_write_num
and byte [edi], 0
ret
 
cbtx1:
; btx r/m,i8 = 0F BA
or ch, 80h
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
cmp al, 4
jb cunk
mov eax, [btx1codes+eax*4-4*4]
stosd
mov eax, ' '
stosd
call disasm_readrmop
mov ax, ', '
stosw
jmp disasm_i8u
btx1codes dd 'bt ','bts ','btr ','btc '
cbtx2:
; btx r/m,r = 0F 101xx011 (A3,AB,B3,BB)
shr al, 3
and eax, 3
mov eax, [btx1codes+eax*4]
stosd
mov eax, ' '
stosd
or ch, 0xC0
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
push eax
call disasm_readrmop
mov ax, ', '
stosw
pop eax
call disasm_write_reg1632
and byte [edi], 0
ret
 
csetcc:
and eax, 0xF
mov ax, [disasm_jcc_codes + eax*2]
mov dword [edi], 'setc'
add edi, 3
stosw
mov ax, ' '
stosw
stosb
call disasm_readrmop
and byte [edi], 0
ret
 
disasm_jcc_codes dw 'o ','no','b ','ae','z ','nz','be','a ','s ','ns','p ','np','l ','ge','le','g '
cjcc1:
cjmp2:
cmp al, 0xEB
jz .1
and eax, 0xF
mov ax, [disasm_jcc_codes + eax*2]
jmp .2
.1:
mov ax, 'mp'
.2:
mov byte [edi], 'j'
inc edi
stosw
mov eax, ' '
stosb
stosd
call disasm_get_byte
movsx eax, al
disasm_rva:
add eax, [disasm_cur_pos]
call disasm_write_num
and byte [edi], 0
ret
 
ccall1:
cjmp1:
cjcc2:
mov edx, 'call'
cmp al, 0xE8
jz @f
mov edx, 'jmp '
cmp al, 0xE9
jz @f
mov edx, ' '
and eax, 0xF
mov dx, [disasm_jcc_codes+eax*2]
shl edx, 8
mov dl, 'j'
@@:
xchg eax, edx
stosd
mov eax, ' '
stosd
call disasm_get_dword
jmp disasm_rva
 
op11codes dd 'test',0,'not ','neg ','mul ','imul','div ','idiv'
op12codes dd 'inc ','dec ','call',0,'jmp ',0,'push',0
cop1:
disasm_set_modew
xchg eax, edx
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
cmp dl, 0xFE
jnz @f
cmp al, 1
ja cunk
@@:
and edx, 8
add eax, edx
mov eax, [op11codes+eax*4]
test eax, eax
jz cunk
cmp eax, 'test'
jz ctest
@@:
stosd
mov eax, ' '
stosd
call disasm_readrmop
and byte [edi], 0
ret
 
cpop2:
or ch, 80h
call disasm_get_byte
dec [disasm_cur_pos]
test al, 00111000b
jnz cunk
mov eax, 'pop '
jmp @b
 
cloopnz:
mov eax, 'loop'
stosd
mov eax, 'nz '
test ch, 2
jz @f
mov ah, 'w'
@@: jmp cloop.cmn
cloopz:
mov eax, 'loop'
stosd
mov eax, 'z '
test ch, 2
jz @f
mov eax, 'zw '
@@: jmp cloop.cmn
 
cjcxz:
cloop:
cmp al, 0xE2
jz .loop
test ch, 2
jnz .jcxz
mov eax, 'jecx'
stosd
mov eax, 'z '
jmp .cmn
.jcxz:
mov eax, 'jcxz'
stosd
mov eax, ' '
jmp .cmn
.loop:
mov eax, 'loop'
stosd
mov eax, ' '
test ch, 2
jz .cmn
mov al, 'w'
.cmn:
stosd
call disasm_get_byte
movsx eax, al
add eax, [disasm_cur_pos]
test ch, 1
jz @f
and eax, 0xFFFF
@@:
disasm_write_num_done:
call disasm_write_num
and byte [edi], 0
ret
 
cimul1:
; imul r,r/m,i
or ch, 80h ; 32bit operation
xchg eax, edx
mov eax, 'imul'
stosd
mov eax, ' '
stosd
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
call disasm_write_reg1632
mov ax, ', '
stosw
call disasm_readrmop
mov ax, ', '
stosw
test ch, 1
jnz .16
cmp dl, 0x69
jz .op32
call disasm_get_byte
movsx eax, al
jmp disasm_write_num_done
.op32:
call disasm_get_dword
jmp disasm_write_num_done
.16:
cmp dl, 0x69
jz .op16
call disasm_get_byte
cbw
jmp disasm_write_num_done
.op16:
xor eax, eax
call disasm_get_word
jmp disasm_write_num_done
 
cshld:
cshrd:
mov edx, 'shld'
test al, 8
jz @f
mov edx, 'shrd'
@@:
xchg eax, edx
stosd
mov eax, ' '
stosd
call disasm_get_byte
dec [disasm_cur_pos]
shr al, 3
and eax, 7
push eax
or ch, 80h
call disasm_readrmop
mov ax, ', '
stosw
pop eax
call disasm_write_reg1632
mov ax, ', '
stosw
test dl, 1
jz disasm_i8u
mov ax, 'cl'
stosw
and byte [edi], 0
ret
 
ccbw:
mov eax, 'cbw '
test ch, 1
jnz @f
mov eax, 'cwde'
@@: stosd
and byte [edi+1], 0
ret
ccwd:
mov eax, 'cwd '
test ch, 1
jnz @b
mov eax, 'cdq '
jmp @b
 
fpuD8 dd 'add ','mul ','com ','comp','sub ','subr','div ','divr'
 
cD8:
call disasm_get_byte
dec [disasm_cur_pos]
push eax
shr al, 3
and eax, 7
mov byte [edi], 'f'
inc edi
xchg eax, edx
mov eax, [fpuD8+edx*4]
stosd
mov ax, ' '
stosw
stosb
pop eax
cmp dl, 2
jb .1
cmp dl, 3
jbe .2
.1:
cmp al, 0xC0
jb .2
mov eax, 'st0,'
stosd
mov al, ' '
stosb
.2:
or ch, 80h or 20h
and ch, not 1
call disasm_readrmop
and byte [edi], 0
ret
 
fpuD9_2:
dq 'fchs ','fabs ',0,0,'ftst ','fxam ',0,0
db 'fld1 fldl2t fldl2e fldpi fldlg2 fldln2 fldz '
dq 0
db 'f2xm1 fyl2x fptan fpatan fxtract fprem1 fdecstp fincstp '
db 'fprem fyl2xp1 fsqrt fsincos frndint fscale fsin fcos '
fpuD9_fnop db 'fnop '
cD9:
call disasm_get_byte
sub al, 0xC0
jae .l1
dec [disasm_cur_pos]
shr al, 3
and eax, 7
cmp al, 7
jnz @f
mov eax, 'fnst'
stosd
mov eax, 'cw '
jmp .x1
@@:
cmp al, 5
jnz @f
mov eax, 'fldc'
stosd
mov eax, 'w '
.x1:
stosd
or ch, 0C1h
jmp .cmn
@@:
mov edx, 'fld '
test al, al
jz @f
mov edx, 'fst '
cmp al, 2
jz @f
mov edx, 'fstp'
cmp al, 3
jnz cunk
@@:
xchg eax, edx
stosd
mov eax, ' '
stosd
or ch, 80h
and ch, not 1
.cmn:
call disasm_readrmop
and byte [edi], 0
ret
.l1:
cmp al, 10h
jae .l2
mov edx, 'fld '
cmp al, 8
jb @f
mov edx, 'fxch'
@@:
xchg eax, edx
stosd
mov eax, ' '
stosd
xchg eax, edx
and al, 7
add al, '0'
shl eax, 16
mov ax, 'st'
stosd
clc
ret
.l2:
cmp al, 0x10
jnz @f
mov esi, fpuD9_fnop
jmp .l3
@@:
sub al, 0x20
jb cerr
lea esi, [fpuD9_2+eax*8]
cmp byte [esi], 0
jz cerr
.l3:
movsd
movsd
and byte [edi-1], 0
ret
 
cDA:
call disasm_get_byte
cmp al, 0xC0
jae cunk
dec [disasm_cur_pos]
shr al, 3
and eax, 7
mov word [edi], 'fi'
inc edi
inc edi
mov eax, [fpuD8+eax*4]
stosd
mov ax, ' '
stosw
or ch, 80h
and ch, not 1 ; 32-bit operand
call disasm_readrmop
and byte [edi], 0
ret
 
fpuDB dd 'ild ',0,'ist ','istp',0,'ld ',0,'stp '
cDB:
call disasm_get_byte
cmp al, 0xC0
jae .1
dec [disasm_cur_pos]
shr al, 3
and eax, 7
xchg eax, edx
mov eax, [fpuDB+edx*4]
test eax, eax
jz cerr
mov byte [edi], 'f'
inc edi
stosd
mov ax, ' '
stosw
stosb
or ch, 80h
and ch, not 1 ; 32-bit operand
cmp dl, 4
jb @f
or ch, 20h
and ch, not 80h ; 80-bit operand
@@:
call disasm_readrmop
and byte [edi], 0
ret
.1:
cmp al, 0xE3
jnz cunk
mov eax, 'fnin'
stosd
mov eax, 'it'
stosd
dec edi
ret ; CF cleared
 
fpuDC dd 'add ','mul ',0,0,'subr','sub ','divr','div '
cDC:
call disasm_get_byte
cmp al, 0xC0
jae .1
dec [disasm_cur_pos]
shr al, 3
and eax, 7
mov byte [edi], 'f'
inc edi
mov eax, [fpuD8+eax*4]
stosd
mov ax, ' '
stosw
stosb
or ch, 0A1h ; qword
call disasm_readrmop
and byte [edi], 0
ret
.1:
mov dl, al
shr al, 3
and eax, 7
mov eax, [fpuDC+eax*4]
test eax, eax
jz cerr
mov byte [edi], 'f'
inc edi
stosd
mov eax, ' s'
stosd
mov al, 't'
stosb
and edx, 7
lea eax, [edx+'0']
stosb
mov eax, ', st'
stosd
mov ax, '0'
stosw
ret ; CF cleared
 
fpuDD dd 'fld ',0,'fst ','fstp',0,0,0,0
fpuDD_2 dq 'ffree ',0,'fst ','fstp ','fucom ','fucomp ',0,0
cDD:
call disasm_get_byte
cmp al, 0xC0
jae .1
dec [disasm_cur_pos]
shr al, 3
and eax, 7
xchg eax, edx
mov eax, [fpuDD+edx*4]
test eax, eax
jz cunk
stosd
mov eax, ' '
stosd
or ch, 0A1h ; qword operand
call disasm_readrmop
and byte [edi], 0
ret
.1:
push eax
shr al, 3
and eax, 7
xchg eax, edx
mov eax, dword [fpuDD_2+edx*8]
test eax, eax
jz cerr
stosd
mov eax, dword [fpuDD_2+4+edx*8]
stosd
mov ax, 'st'
stosw
pop eax
and al, 7
add al, '0'
stosb
and byte [edi], 0
ret
 
fpuDE dd 'add ','mul ',0,0,'subr','sub ','divr','div '
cDE:
call disasm_get_byte
cmp al, 0xC0
jae .1
dec [disasm_cur_pos]
mov word [edi], 'fi'
inc edi
inc edi
shr al, 3
and eax, 7
mov eax, [fpuD8+eax*4]
stosd
mov ax, ' '
stosw
or ch, 81h ; force 16-bit
call disasm_readrmop
and byte [edi], 0
ret
.1:
push eax
shr al, 3
and eax, 7
xchg eax, edx
mov eax, [fpuDE+edx*4]
test eax, eax
jz .fcompp
mov byte [edi], 'f'
inc edi
stosd
mov al, 'p'
cmp byte [edi-1], ' '
jnz @f
mov byte [edi-1], al
mov al, ' '
@@: stosb
mov eax, ' st'
stosd
pop eax
and al, 7
add al, '0'
stosb
mov ax, ', '
stosw
mov eax, 'st0'
stosd
ret ; CF cleared
.fcompp:
pop eax
cmp al, 0xD9
jnz cerr
mov eax, 'fcom'
stosd
mov ax, 'pp'
stosw
and byte [edi], 0
ret
 
fpuDF dd 'ild ',0,'ist ','istp','bld ','ild ','bstp','istp'
 
cDF:
call disasm_get_byte
cmp al, 0xC0
jae .1
dec [disasm_cur_pos]
shr al, 3
and eax, 7
xchg eax, edx
mov eax, [fpuDF+edx*4]
test eax, eax
jz cerr
mov byte [edi], 'f'
inc edi
stosd
mov ax, ' '
stosw
stosb
or ch, 81h ; force 16-bit operand
cmp dl, 4
jb @f
or ch, 20h
test dl, 1
jnz @f
or ch, 40h
@@:
call disasm_readrmop
and byte [edi], 0
ret
.1:
cmp al, 0xE0
jnz cunk
mov eax, 'fnst'
stosd
mov eax, 'sw '
stosd
mov ax, 'ax'
stosw
and byte [edi], 0
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
caption_str db 'Kolibri Debugger',0
caption_len = $ - caption_str
begin_str db 'Kolibri Debugger, version 0.2',10
db 'Hint: type "help" for help, "quit" for quit'
newline db 10,0
prompt db '> ',0
 
help_groups:
dd aControl, 0, 0, help_control_msg
db 0
dd aData, 0, 0, help_data_msg
db 0
dd aBreakpoints, 0, 0, help_breaks_msg
db 0
; flags field:
; &1: command may be called without parameters
; &2: command may be called with parameters
; &4: command may be called without loaded program
; &8: command may be called with loaded program
commands:
dd _aH, OnHelp, HelpSyntax, HelpHelp
db 0Fh
dd aHelp, OnHelp, HelpSyntax, HelpHelp
db 0Fh
dd aQuit, OnQuit, QuitSyntax, QuitHelp
db 0Dh
dd aLoad, OnLoad, LoadSyntax, LoadHelp
db 6
dd aReload, OnReload, ReloadSyntax, ReloadHelp
db 0Dh
dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp
db 9
dd aDetach, OnDetach, DetachSyntax, DetachHelp
db 9
dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp
db 9
dd aResume, OnResume, ResumeSyntax, ResumeHelp
db 0Bh
dd aStep, OnStep, StepSyntax, StepHelp
db 9
dd aProceed, OnProceed, ProceedSyntax, ProceedHelp
db 9
dd aCalc, OnCalc, CalcSyntax, CalcHelp
db 0Eh
dd aDump, OnDump, DumpSyntax, DumpHelp
db 0Bh
dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp
db 0Bh
dd aBp, OnBp, BpSyntax, BpHelp
db 0Ah
dd aBpm, OnBpmb, BpmSyntax, BpmHelp
db 0Ah
dd aBpmb, OnBpmb, BpmSyntax, BpmHelp
db 0Ah
dd aBpmw, OnBpmw, BpmSyntax, BpmHelp
db 0Ah
dd aBpmd, OnBpmd, BpmSyntax, BpmHelp
db 0Ah
dd aBl, OnBl, BlSyntax, BlHelp
db 0Bh
dd aBc, OnBc, BcSyntax, BcHelp
db 0Ah
dd aBd, OnBd, BdSyntax, BdHelp
db 0Ah
dd aBe, OnBe, BeSyntax, BeHelp
db 0Ah
dd aReg, OnReg, RSyntax, RHelp
db 0Ah
dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp
db 9
dd 0
aHelp db 5,'help',0
_aH db 2,'h',0
HelpHelp db 'Help on specified function',10
HelpSyntax db 'Usage: h or help [group | command]',10,0
 
help_msg db 'List of known command groups:',10
db '"help control" - display list of control commands',10
db '"help data" - display list of commands concerning data',10
db '"help breakpoints" - display list of commands concerning breakpoints',10,0
aControl db 8,'control',0
help_control_msg db 'List of control commands:',10
db 'h = help - help',10
db 'quit - exit from debugger',10
db 'load <name> [params] - load program for debugging',10
db 'reload - reload debugging program',10
db 'terminate - terminate loaded program',10
db 'detach - detach from debugging program',10
db 'stop - suspend execution of debugging program',10
db 'g [<expression>] - go on (resume execution of debugging program)',10
db 's = <Ctrl+F7> - program step',10
db 'p = <Ctrl+F8> - program wide step',10
db 'unpack - try to bypass unpacker code (heuristic)',10,0
aData db 5,'data',0
help_data_msg db 'List of data commands:',10
db '? <expression> - calculate value of expression',10
db 'd [<expression>] - dump data at given address',10
db 'u [<expression>] - unassemble instructions at given address',10
db 'r <register> <expression> or',10
db 'r <register>=<expression> - set register value',10,0
aBreakpoints db 12,'breakpoints',0
help_breaks_msg db 'List of breakpoints commands:',10
db 'bp <expression> - set breakpoint on execution',10
db 'bpm[b|w|d] <type> <expression> - set breakpoint on memory access',10
db 'bl [<number>] - breakpoint(s) info',10
db 'bc <number>... - clear breakpoint',10
db 'bd <number>... - disable breakpoint',10
db 'be <number>... - enable breakpoint',10,0
 
aQuit db 5,'quit',0
QuitHelp db 'Quit from debugger',10
QuitSyntax db 'Usage: quit',10,0
 
aLoad db 5,'load',0
LoadHelp db 'Load program for debugging',10
LoadSyntax db 'Usage: load <program-name> [parameters]',10,0
 
aReload db 7,'reload',0
ReloadHelp db 'Reload debugging program (restart debug session)',10
ReloadSyntax db 'Usage: reload',10,0
 
aTerminate db 10,'terminate',0
TerminateHelp db 'Terminate debugged program',10
TerminateSyntax db 'Usage: terminate',10,0
 
aDetach db 7,'detach',0
DetachHelp db 'Detach from debugged program',10
DetachSyntax db 'Usage: detach',10,0
 
aSuspend db 5,'stop',0
SuspendHelp db 'Suspend execution of debugged program',10
SuspendSyntax db 'Usage: stop',10,0
 
aResume db 2,'g',0
ResumeHelp db 'Go (resume execution of debugged program)',10
ResumeSyntax db 'Usage: g',10
db ' or: g <expression> - wait until specified address is reached',10,0
 
aStep db 2,'s',0
StepHelp db 'Make step in debugged program',10
StepSyntax db 'Usage: s',10,0
 
aProceed db 2,'p',0
ProceedHelp db 'Make wide step in debugged program (step over CALL, REPxx, LOOP)',10
ProceedSyntax db 'Usage: p',10,0
 
aDump db 2,'d',0
DumpHelp db 'Dump data of debugged program',10
DumpSyntax db 'Usage: d <expression> - dump data at specified address',10
db ' or: d - continue current dump',10,0
 
aCalc db 2,'?',0
CalcHelp db 'Calculate value of expression',10
CalcSyntax db 'Usage: ? <expression>',10,0
 
aUnassemble db 2,'u',0
UnassembleHelp db 'Unassemble',10
UnassembleSyntax:
db 'Usage: u <expression> - unassemble instructions at specified address',10
db ' or: u - continue current unassemble screen',10,0
 
aReg db 2,'r',0
RHelp db 'Set register value',10
RSyntax:
db 'Usage: r <register> <expression>',10
db ' or: r <register>=<expression> - set value of <register> to <expression>',10,0
 
aBp db 3,'bp',0
BpHelp db 'set BreakPoint on execution',10
BpSyntax db 'Usage: bp <expression>',10,0
 
aBpm db 4,'bpm',0
aBpmb db 5,'bpmb',0
aBpmw db 5,'bpmw',0
aBpmd db 5,'bpmd',0
BpmHelp db 'set BreakPoint on Memory access',10
db 'Maximum 4 breakpoints of this type are allowed',10
db 'Note that for this breaks debugger is activated after access',10
BpmSyntax db 'Usage: bpmb [w] <expression>',10
db ' bpmw [w] <expression>',10
db ' bpmd [w] <expression>',10
db ' bpm is synonym for bpmd',10
db '"w" means break only on writes (default is on read/write)',10,0
 
aBl db 3,'bl',0
BlHelp db 'Breakpoint List',10
BlSyntax db 'Usage: bl - list all breakpoints',10
db ' bl <number> - display info on particular breakpoint',10,0
 
aBc db 3,'bc',0
BcHelp db 'Breakpoint Clear',10
BcSyntax db 'Usage: bc <number-list>',10
db 'Examples: bc 2',10
db ' bc 1 3 4 A',10,0
 
aBd db 3,'bd',0
BdHelp db 'Breakpoint Disable',10
BdSyntax db 'Usage: bd <number-list>',10
db 'Examples: bd 2',10
db ' bd 1 3 4 A',10,0
 
aBe db 3,'be',0
BeHelp db 'Breakpoint Enable',10
BeSyntax db 'Usage: be <number-list>',10
db 'Examples: be 2',10
db ' be 1 3 4 A',10,0
 
aUnpack db 7,'unpack',0
UnpackHelp db 'Try to bypass unpacker code',10
UnpackSyntax db 'Usage: unpack',10,0
 
aUnknownCommand db 'Unknown command',10,0
 
load_err_msg db 'Cannot load program. ',0
unk_err_msg db 'Unknown error code -%4X',10,0
load_err_msgs:
dd .1, 0, .3, 0, .5, .6, 0, 0, .9, .A, 0, 0, 0, 0, 0, 0
dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .1E, .1F, .20
.1 db 'HD undefined.',10,0
.3 db 'Unknown FS.',10,0
.5 db 'File not found.',10,0
.6 db 'Unexpected EOF.',10,0
.9 db 'FAT table corrupted.',10,0
.A db 'Access denied.',10,0
.1E db 'No memory.',10,0
.1F db 'Not Menuet/Kolibri executable.',10,0
.20 db 'Too many processes.',10,0
load_succ_msg db 'Program loaded successfully! PID=%4X. Use "g" to run.',10,0
need_debuggee db 'No program loaded. Use "load" command.',10,0
aAlreadyLoaded db 'Program is already loaded. Use "terminate" or "detach" commands',10,0
terminated_msg db 'Program terminated.',10,0
aException db 'Debugged program caused an exception %2X. '
aSuspended db 'Suspended',10,0
aContinued db 'Continuing',10,0
aRunningErr db 'Program is running',10,0
read_mem_err db 'ERROR: cannot read process memory!!!',10,0
aBreakpointLimitExceeded db 'Breakpoint limit exceeded',10,0
aBreakErr db 'Cannot activate breakpoint, it will be disabled',10,0
aDuplicateBreakpoint db 'Duplicate breakpoint',10,0
aInvalidBreak db 'Invalid breakpoint number',10,0
OnBeErrMsg db 'There is already enabled breakpoint on this address',10,0
aBreakNum db '%2X: at %8X',0
aMemBreak1 db '%2X: on ',0
aMemBreak2 db 'read from ',0
aMemBreak3 db 'access of ',0
aMemBreak4 db 'byte',0
aMemBreak5 db 'word',0
aMemBreak6 db 'dword',0
aMemBreak7 db ' at %8X',0
aOneShot db ', one-shot',0
aDisabled db ', disabled',0
aBreakStop db 'Breakpoint #%2X',10,0
aUserBreak db 'int3 command at %8X',10,0
;dbgmsg_str db 'Debug message for process %4X.',10,0
aInvAddr db 'Invalid address',10,0
NoPrgLoaded_str db 'No program loaded'
NoPrgLoaded_len = $ - NoPrgLoaded_str
aRunning db 'Running'
aPaused db 'Paused'
aPoint db 0x1C
aMinus db '-'
aColon db ':'
aQuests db '??'
aDots db '...'
aParseError db 'Parse error',10,0
aDivByZero db 'Division by 0',10,0
calc_string db '%8X',10,0
aUnaligned db 'Unaligned address',10,0
aEnabledBreakErr db 'Enabled breakpoints are not allowed',10,0
aInterrupted db 'Interrupted',10,0
aUnpacked db 'Unpacked successful!',10,0
aPacked1 db 'Program is probably packed with ',0
aPacked2 db '.',10,'Try to unpack automatically? [y/n]: ',0
aY_str db 'y',10,0
aN_str db 'n',10,0
mxp_nrv_name db 'mxp_nrv',0
mxp_name db 'mxp',0
mxp_lzo_name db 'mxp_lzo',0
mtappack_name db 'mtappack',0
flags db 'CPAZSDO'
flags_bits db 0,2,4,6,7,10,11
regs_strs:
db 'EAX='
db 'EBX='
db 'ECX='
db 'EDX='
db 'ESI='
db 'EDI='
db 'EBP='
db 'ESP='
db 'EIP='
db 'EFLAGS='
 
debuggee_pid dd 0
bSuspended db 0
bAfterGo db 0
temp_break dd 0
 
disasm_table_1:
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0 ; 0x
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cF
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0 ; 1x
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0
dd cop22, cop22, cop22, cop22, cop21, cop21, cseges,cop0 ; 2x
dd cop22, cop22, cop22, cop22, cop21, cop21, csegcs,cop0
dd cop22, cop22, cop22, cop22, cop21, cop21, csegss,cop0 ; 3x
dd cop22, cop22, cop22, cop22, cop21, cop21, csegds,cop0
dd cinc1, cinc1, cinc1, cinc1, cinc1, cinc1, cinc1, cinc1 ; 4x
dd cdec1, cdec1, cdec1, cdec1, cdec1, cdec1, cdec1, cdec1
dd cpush1,cpush1,cpush1,cpush1,cpush1,cpush1,cpush1,cpush1 ; 5x
dd cpop1, cpop1, cpop1, cpop1, cpop1, cpop1, cpop1, cpop1
dd cop0, cop0, cunk, cunk, csegfs,cseggs,c66, c67 ; 6x
dd cpush21,cimul1,cpush22,cimul1,cunk,cunk, cunk, cunk
dd cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1 ; 7x
dd cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1
dd cop23, cop23, cop23, cop23, cop22, cop22, cop22, cop22 ; 8x
dd cop22, cop22, cop22, cop22, cunk, cop22, cunk, cpop2
dd cop0, cxchg1,cxchg1,cxchg1,cxchg1,cxchg1,cxchg1,cxchg1 ; 9x
dd ccbw, ccwd, cunk, cop0, cop0, cop0, cop0, cop0
dd cmov3, cmov3, cmov3, cmov3, cop0, cop0, cop0, cop0 ; Ax
dd cop21, cop21, cop0, cop0, cop0, cop0, cop0, cop0
dd cmov11,cmov11,cmov11,cmov11,cmov11,cmov11,cmov11,cmov11 ; Bx
dd cmov12,cmov12,cmov12,cmov12,cmov12,cmov12,cmov12,cmov12
dd cshift1,cshift1,cret2,cop0, cunk, cunk, cmov2, cmov2 ; Cx
dd center,cop0, cunk, cunk, cop0, cint, cunk, cunk
dd cshift2,cshift2,cshift3,cshift3,caam,cunk,cunk, cxlat ; Dx
dd cD8, cD9, cDA, cDB, cDC, cDD, cDE, cDF
dd cloopnz,cloopz,cloop,cjcxz, cunk, cunk, cunk, cunk ; Ex
dd ccall1,cjmp1, cunk, cjmp2, cunk, cunk, cunk, cunk
dd clock, cunk, crepnz,crep, cunk, cop0, cop1, cop1 ; Fx
dd cop0, cop0, cop0, cop0, cop0, cop0, cop1, cop1
 
disasm_table_2:
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 0x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 1x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 2x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, crdtsc,cunk, cunk, csysenter,cunk,cunk, cunk ; 3x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 4x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 5x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 6x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 7x
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2 ; 8x
dd cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2
dd csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc ; 9x
dd csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc
dd cunk, cunk, ccpuid,cbtx2, cshld, cshld, cunk, cunk ; Ax
dd cunk, cunk, cunk, cbtx2, cshrd, cshrd, cunk, cop22
dd ccmpxchg,ccmpxchg,cunk,cbtx2,cunk, cunk, cmovzx,cmovzx ; Bx
dd cunk, cunk, cbtx1, cbtx2, cbsf, cbsr, cmovsx,cmovsx
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, ccmpxchg8b ; Cx
dd cbswap,cbswap,cbswap,cbswap,cbswap,cbswap,cbswap,cbswap
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Dx
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Ex
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Fx
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk
 
reg_table:
db 2,'al',0
db 2,'cl',1
db 2,'dl',2
db 2,'bl',3
db 2,'ah',4
db 2,'ch',5
db 2,'dh',6
db 2,'bh',7
db 2,'ax',8
db 2,'cx',9
db 2,'dx',10
db 2,'bx',11
db 2,'sp',12
db 2,'bp',13
db 2,'si',14
db 2,'di',15
db 3,'eax',16
db 3,'ecx',17
db 3,'edx',18
db 3,'ebx',19
db 3,'esp',20
db 3,'ebp',21
db 3,'esi',22
db 3,'edi',23
db 3,'eip',24
db 0
 
fn70_load_block:
dd 7
dd 1
load_params dd 0
dd 0
dd 0
i_end:
loadname:
db 0
rb 255
 
prgname_ptr dd ?
prgname_len dd ?
 
dbgwnd dd ?
 
messages rb messages_height*messages_width
messages_pos dd ?
 
cmdline rb cmdline_width+1
cmdline_len dd ?
cmdline_pos dd ?
curarg dd ?
 
was_temp_break db ?
 
dbgbufsize dd ?
dbgbuflen dd ?
dbgbuf rb 256
 
needzerostart:
 
context:
_eip dd ?
_eflags dd ?
_eax dd ?
_ecx dd ?
_edx dd ?
_ebx dd ?
_esp dd ?
_ebp dd ?
_esi dd ?
_edi dd ?
 
oldcontext rb $-context
 
dumpread dd ?
dumppos dd ?
dumpdata rb dump_height*10h
 
; breakpoint structure:
; dword +0: address
; byte +4: flags
; bit 0: 1 <=> breakpoint valid
; bit 1: 1 <=> breakpoint disabled
; bit 2: 1 <=> one-shot breakpoint
; bit 3: 1 <=> DRx breakpoint
; byte +5: overwritten byte
; for DRx breaks: flags + (index shl 6)
breakpoints_n = 256
breakpoints rb breakpoints_n*6
drx_break rd 4
 
disasm_buf_size dd ?
 
bReload db ?
 
needzeroend:
 
disasm_buffer rb 256
disasm_start_pos dd ?
disasm_cur_pos dd ?
disasm_cur_str dd ?
disasm_string rb 256
 
i_param rb 256
 
; stack
align 400h
rb 400h
used_mem:
/programs/develop/mtdbg/mtdbg.txt
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
/programs/fs/rdfdel/trunk/rdfdel.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/fs/rdfdel/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/fs/rdfdel/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/fs/rdfdel/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/fs/hexhd/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/fs/hexhd/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/fs/hexhd/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/fs/hexhd/trunk/hexhd.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/fs/copyr/trunk/macros.inc
143,9 → 143,6
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
177,7 → 174,7
 
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
.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
 
/programs/fs/kfar/trunk/kfar.asm
3596,12 → 3596,14
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
 
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
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
 
; ‡¤¥áì § ª ­ç¨¢ îâáï ª®­ä¨£ãà æ¨®­­ë¥ ¤ ­­ë¥
/programs/fs/sysxtree/trunk/macros.inc
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,72 → 77,35
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
name db data
.size = $-name
label name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
forward
if used name
label name
forward
if lang eq lng
db data
end if
common
if used name
.size = $-name
end if
}
 
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
macro lsz name,[lng,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
forward
if (used name)&(lang eq lng)
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
macro mpack dest, hsrc, lsrc
{
172,12 → 123,6
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,72 → 142,7
}
 
 
; -------------------------
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 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 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
/programs/fs/sysxtree/trunk/sysxtree.asm
607,9 → 607,11
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
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
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
 
/programs/games/life/trunk/life.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/games/life/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/games/life/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/games/life/trunk/ascl.inc
File deleted
/programs/games/life/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/games/freecell/Buben.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/Club.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/ClubSml.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/ClubUD.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/Cross.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/Diam.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/DiamSml.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/DiamUD.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/Heart.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/HeartSml.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/HeartUD.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/MACROS.INC
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
/programs/games/freecell/Pick.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/Spade.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/SpadeSml.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/SpadeUD.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/freecell/build.bat
0,0 → 1,2
@fasm freecell.asm freecell
@pause
/programs/games/freecell/freecell.ASM
0,0 → 1,2096
; <--- description --->
; compiler: FASM 1.50
; name: FreeCell for MeOS
; version: 1.00
; last update: 21/07/2004
; written by: Alexandr Gorbovets
; e-mail: gorsash@mail.ru
 
 
include "macros.inc"
meos_app_start
 
code
call randomize
call draw_window
 
wait_event:
mov eax, 10
int 0x40
 
cmp eax, 1 ; if event == 1
je redraw ; jump to redraw handler
cmp eax, 2 ; else if event == 2
je key ; jump to key handler
cmp eax, 3 ; else if event == 3
je button ; jump to button handler
 
 
jmp wait_event ;else return to the start of main cycle
 
 
redraw: ; redraw event handler
call draw_window
jmp wait_event
 
 
key: ; key event handler
mov eax, 2 ; get key code
int 0x40
 
jmp wait_event
 
button: ; button event handler
mov eax, 17 ; get button identifier
int 0x40
 
cmp ah, 1
je exit_app ; return if button id != 1
 
cmp ah, 1 + 8
jbe common_card ; if 1 < ah <= 9
 
cmp ah, 1 + 8 + 4 ; if 9 < ah <= 13
jbe temp_cell
 
cmp ah, 1 + 8 + 8
jbe home_cell
 
cmp ah, 1 + 8 + 4 + 4 + 1
je new_game_button
 
cmp ah, 1 + 8 + 4 + 4 + 2
je exit_app
 
 
jmp wait_event
 
 
exit_app:
mov eax, -1 ; exit application
int 0x40
 
common_card:
sub ah, 2 ;going from number of card to number of column
mov [columnclicked], 0
mov byte [columnclicked], ah
call common_card_click
jmp wait_event
 
temp_cell:
sub ah, 2 + 8
mov [columnclicked], 0
mov byte [columnclicked], ah
call temp_cell_click
jmp wait_event
 
 
home_cell:
sub ah, 2 + 8 + 4
mov [columnclicked], 0
mov byte [columnclicked], ah
call home_cell_click
jmp wait_event
 
new_game_button:
call new_game_click
jmp wait_event
 
 
;******************************************************************************
; common_card_click(columnclicked)
common_card_click:
 
; counting code of card, that has been clicked
mov eax, [columnclicked]
mov [ncolumn], eax
call get_row_of_top_card_in_column
mov eax, [topcardrow] ; eax = topcardrow * 8 + columnofselcard
mov bl, 8
mul bl
add eax, [columnclicked]
add eax, cards
 
mov ebx, 0
mov bl, byte [eax]
mov [cardclicked], ebx
 
 
call get_sel_card_code_and_addr
 
cmp [selcardcode], 52
jb .something_selected
 
 
cmp [cardclicked], 52
je .end
 
mov [whereisselcard], scCommonCells
mov eax, [columnclicked]
mov [columnofselcard], eax
call draw_window
jmp .end
 
 
.something_selected:
 
 
; checking if selected and clicked cards are equivalent
mov eax, [selcardcode]
cmp [cardclicked], eax
jne .not_same_card
 
mov [whereisselcard], scNotSelected
call draw_window
jmp .end
 
.not_same_card:
 
cmp [cardclicked], 52
jae .put_in_blank_cell
 
 
mov eax, [selcardcode]
mov bl, 4
div bl
 
mov ebx, 0
mov bl, ah
mov [cardfamily], ebx
 
mov ecx, 0
mov cl, al
mov [cardrange], ecx
 
 
mov eax, [cardclicked]
mov bl, 4
div bl ; reminder in ah, quotient in al
 
mov ebx, 0
mov bl, ah
mov [clickedcardfamily], ebx
 
mov ecx, 0
mov cl, al
mov [clickedcardrange], ecx
 
; clickedcardrange must be = cardrange + 1
mov eax, [cardrange]
inc eax
 
cmp [clickedcardrange], eax ; eax is such as needed
jne .end
 
 
cmp [cardfamily], 1
ja .black_card
 
; if selected red card
cmp [clickedcardfamily], 1
jbe .end ; if clicked red card (range <= 1) then exit
 
jmp .valid_cards
 
.black_card:
; if selected black card
cmp [clickedcardfamily], 1
ja .end ; if clicked black card then exit
 
jmp .valid_cards
 
.valid_cards:
; moving card from its place on clicked card
 
mov eax, [columnclicked]
mov [ncolumn], eax
call get_row_of_top_card_in_column
mov eax, [topcardrow]
inc eax
 
mov bl, 8
mul bl
 
and eax, $0000FFFF
add eax, [columnclicked]
add eax, cards
 
mov bl, byte [selcardcode]
mov byte [eax], bl
 
mov eax, [selcardaddr]
mov byte [eax], 52
 
mov [whereisselcard], scNotSelected
 
call draw_window
 
jmp .end
 
.put_in_blank_cell:
 
mov eax, cards
add eax, [columnclicked]
mov bl, byte [selcardcode]
mov byte [eax], bl
 
mov eax, [selcardaddr]
mov byte [eax], 52
 
mov [whereisselcard], scNotSelected
 
call draw_window
 
.end:
 
ret
 
 
;******************************************************************************
; temp_cell_click(columnclicked)
temp_cell_click:
call get_sel_card_code_and_addr
cmp [selcardcode], 52
jb .something_selected
 
 
mov [whereisselcard], scTempCells
mov eax, [columnclicked]
mov [columnofselcard], eax
call draw_window
jmp .end
 
.something_selected:
; checking if selected and clicked cards equivalent
mov eax, [columnclicked]
add eax, tempcells
 
mov ebx, 0
mov bl, byte [eax]
mov [cardclicked], ebx
 
mov eax, [selcardcode]
cmp [cardclicked], eax
jne .not_same_card
 
mov [whereisselcard], scNotSelected
call draw_window
 
.not_same_card:
 
;putting cards in temp cells
 
mov eax, [columnclicked]
add eax, tempcells
 
mov ebx, 0
mov bl, byte [eax]
mov [cardclicked], ebx
 
 
cmp [cardclicked], 52
jb .end
; if nothing lay in this cell
; move selected card to temp cell
mov eax, [columnclicked]
add eax, tempcells
mov bl, byte [selcardcode]
mov byte [eax], bl
 
mov eax, [selcardaddr]
mov byte [eax], 52
 
mov [whereisselcard], scNotSelected
 
call draw_window
 
 
jmp .end
 
 
.end:
 
ret
 
;******************************************************************************
; home_cell_click(column_clicked)
home_cell_click:
call get_sel_card_code_and_addr
 
mov eax, [columnclicked]
add eax, homecells
 
 
mov ebx, 0
mov bl, byte [eax]
mov [cardclicked], ebx
 
mov eax, [selcardcode]
mov bl, 4
div bl ; reminder in ah, quotient in al
 
mov ebx, 0
mov bl, ah
mov [cardfamily], ebx
 
mov ecx, 0
mov cl, al
mov [cardrange], ecx
 
 
cmp [cardclicked], 52
jb .not_blank
; if nothing lay in this cell
cmp [cardrange], 0
jne .end
; move ace to home
mov eax, [columnclicked]
add eax, homecells
mov bl, byte [selcardcode]
mov byte [eax], bl
 
mov eax, [selcardaddr]
mov byte [eax], 52
 
mov [whereisselcard], scNotSelected
 
call draw_window
 
 
jmp .end
 
.not_blank:
 
mov eax, [cardclicked]
mov bl, 4
div bl ; reminder in ah, quotient in al
 
mov ebx, 0
mov bl, ah
mov [clickedcardfamily], ebx
 
mov ecx, 0
mov cl, al
mov [clickedcardrange], ecx
 
cmp [cardfamily], ebx
jne .end
 
inc ecx
cmp [cardrange], ecx
jne .end
 
; moving card from its place to home with replacing
; of old card in home
mov eax, [columnclicked]
add eax, homecells
mov bl, byte [selcardcode]
mov byte [eax], bl
 
mov eax, [selcardaddr]
mov byte [eax], 52
 
mov [whereisselcard], scNotSelected
 
call draw_window
 
 
 
.end:
 
ret
 
 
;******************************************************************************
new_game_click:
 
mov [i], 0
.deleting_cards_from_common_cells:
mov eax, cards
add eax, [i]
mov byte [eax], 52
 
 
inc [i]
cmp [i], 19*8
jb .deleting_cards_from_common_cells
 
 
mov [i], 0
.filling_pack:
mov eax, pack
add eax, [i]
mov bl, byte [i]
mov byte [eax], bl
 
inc [i]
cmp [i], 52
jb .filling_pack
 
mov [i], 0
 
.putting_cards:
 
mov [range], 52
call random
mov eax, [random_value]
add eax, pack
 
mov ebx, 0
mov bl, byte [eax]
mov [randomcard], ebx
 
mov eax, [random_value]
mov [j], eax
 
cmp [randomcard], 52
jb .found_card
 
 
mov [range], 52
call random
cmp [random_value], 26
jae .decreasing_j
 
.increasing_j:
inc [j]
; j mod 52
mov eax, [j]
mov edx, 0
mov ebx, 52
div ebx
mov [j], edx
 
 
mov eax, [j]
add eax, pack
mov ebx, 0
mov bl, byte [eax]
mov [randomcard], ebx
cmp [randomcard], 52
jb .found_card
 
jmp .increasing_j
 
 
.decreasing_j:
dec [j]
; i mod 32
mov eax, [j]
mov edx, 0
mov ebx, 52
div ebx
mov [j], edx
 
mov eax, [j]
add eax, pack
mov ebx, 0
mov bl, byte [eax]
mov [randomcard], ebx
cmp [randomcard], 52
jb .found_card
 
jmp .decreasing_j
 
.found_card:
; putting card from pack
mov eax, cards
add eax, [i]
mov bl, byte [randomcard]
mov byte [eax], bl
; deleting card from pack
mov eax, pack
add eax, [j]
mov byte [eax], 52
 
 
inc [i]
cmp [i], 52
jb .putting_cards
 
 
 
 
mov [i], 0
.deleting_cards_from_temp_cells:
mov eax, tempcells
add eax, [i]
mov byte [eax], 52
 
 
inc [i]
cmp [i], 4
jb .deleting_cards_from_temp_cells
 
mov [i], 0
.deleting_cards_from_home_cells:
mov eax, homecells
add eax, [i]
mov byte [eax], 52
 
 
inc [i]
cmp [i], 4
jb .deleting_cards_from_home_cells
 
 
mov [whereisselcard], scNotSelected
call draw_window
 
 
ret
 
 
;******************************************************************************
; get_sel_card_code_and_addr(): selcardcode, selcardaddr
; if nothing selected, then selcardcode is 52
get_sel_card_code_and_addr:
cmp [whereisselcard], scNotSelected
jne .something_selected
 
mov [selcardcode], 52
jmp .end
 
.something_selected:
cmp [whereisselcard], scTempCells
je .temp_cells_selected
 
; common cells selected
mov eax, [columnofselcard]
mov [ncolumn], eax
call get_row_of_top_card_in_column
 
 
mov eax, [topcardrow]; eax = topcardrow * 8 + columnofselcard
mov bl, 8
mul bl ; result of multiplication in ax
add eax, [columnofselcard]
add eax, cards
 
 
mov [selcardaddr], eax
xor ebx, ebx
mov bl, byte [eax]
mov [selcardcode], ebx
 
jmp .end
 
.temp_cells_selected:
 
mov eax, tempcells
add eax, [columnofselcard]
mov [selcardaddr], eax
mov ebx, 0
mov bl, byte [eax]
mov [selcardcode], ebx
 
.end:
 
ret
 
;******************************************************************************
; draw_window()
 
draw_window:
mov eax,48 ; get system colors
mov ebx,3
mov ecx,syscolors
mov edx,sizeof.system_colors
int 0x40
 
 
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
 
mov eax, 0 ; create and draw the window
mov ebx, 100 * 65536 + 8 * cardwidth + 10 + 7 * columnspace
mov ecx, 100 * 65536 + 500
mov edx, 0x13008000
mov edi, header
int 0x40
 
mov eax, 9 ; getting window info
mov ebx, process_info
mov ecx, -1 ; we want to know info of our window
int 0x40
 
 
mov eax, [process_info.y_size]
mov [WindowHeight], ax
 
mov eax, [process_info.x_size]
mov [WindowWidth], ax
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw top panel
 
mov eax, 13
mov ebx, 5
shl ebx, 16
add bx, word [process_info.x_size]
sub bx, 9
mov ecx, 22 shl 16 + topbuttonsbarheight - 1
mov edx, [syscolors.work_graph]
int $40
 
; draw button "new game"
 
mov eax, 8
mov ebx, 5 shl 16 + 80
mov ecx, 22 shl 16 + topbuttonsbarheight - 2
mov edx, 1 + 8 + 4 + 4 + 1 ;button id
mov esi, [syscolors.work_button]
int $40
 
mov eax, 4
mov ebx, 20 shl 16 + 22 + topbuttonsbarheight/2 - 4
mov ecx, [syscolors.work_button_text]
mov edx, new_game
mov esi, new_game_len
int $40
 
 
; draw button "exit"
mov eax, 8
mov ebx, (5 + 85) shl 16 + 80 + 5
mov ecx, 22 shl 16 + topbuttonsbarheight - 2
mov edx, 1 + 8 + 4 + 4 + 2 ;button id
mov esi, [syscolors.work_button]
int $40
 
mov eax, 4
mov ebx, (40 + 80) shl 16 + 22 + topbuttonsbarheight/2 - 4
mov ecx, [syscolors.work_button_text]
mov edx, exit
mov esi, exit_len
int $40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw separators between home, temp and common cells
mov eax, 13
; horizontal line
mov ebx, 5
shl ebx, 16
add bx, word [process_info.x_size]
sub bx, 9
mov ecx, (21 + topbuttonsbarheight + cardheight + columnspace) shl 16+1
 
mov edx, [syscolors.work_graph]
int $40
; verical line
mov eax, [process_info.x_size]
mov edx, 0
mov ecx, 2
div ecx
 
mov ebx, eax
 
;
shl ebx, 16
add bx, 1
mov ecx, (21 + topbuttonsbarheight) shl 16 + cardheight + columnspace
mov edx, [syscolors.work_graph]
mov eax, 13
int $40
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw temp buttons
 
mov [j], 0 ;counter that loops from 0 to 51
 
draw_a_temp_card:
 
; code of card must be in ecx
mov eax, tempcells
add eax, [j]
xor ecx, ecx
mov cl, byte [eax] ; placing in cl value from memory
; with address [tempcells + j] or
; j-th element of array "tempcells"
 
mov [cardcode], ecx
 
mov eax, [j]
xor edx, edx
mov ebx, 8
div ebx ; divsion by 8 (8 columns),
; so in eax quotient - number of row
; and in edx remainder -
; number of column where lay card
 
mov [row], eax
mov [column], edx
 
mov eax, [process_info.x_size] ; width of window
sub eax, 10
sub eax, cardwidth
mov ebx, 7
mov edx, 0
div ebx
mov ebx, [column]
mul ebx
add eax, 5
 
mov [xpos], eax
 
 
mov eax, [row]
mov bl, rowsize
mul bl
add eax, 24 + topbuttonsbarheight
mov [ypos], eax
 
; checking, if this card selected
 
mov [negativedraw], 0
 
cmp [whereisselcard], scTempCells
jne .this_temp_cell_isnt_selected
 
mov eax, [column]
cmp [columnofselcard], eax
jne .this_temp_cell_isnt_selected
 
mov [negativedraw], 1
 
.this_temp_cell_isnt_selected:
 
call draw_card
 
; define button on place of card
mov eax, 8
mov ebx, [xpos]
shl ebx, 16
add bx, cardwidth - 1
mov ecx, [ypos]
shl ecx, 16
add cx, cardheight - 1
mov edx, [column]
add edx, 01000000000000000000000000000000b + 2 + 8; button id = column
; id = 1 reserved as close button
int $40
 
 
inc [j]
cmp [j], 4
jb draw_a_temp_card
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw home buttons
mov [j], 0 ;counter that loops from 0 to 51
 
draw_a_home_card:
 
 
; code of card must be in ecx
mov eax, homecells
add eax, [j]
xor ecx, ecx
mov cl, byte [eax] ; placing in cl value from memory
; with address [tempcells + j] or
; j-th element of array "tempcells"
 
mov [cardcode], ecx
 
mov eax, [j]
xor edx, edx
mov ebx, 8
div ebx ; divsion by 8 (8 columns),
; so in eax quotient - number of row
; and in edx remainder -
; number of column where lay card
 
mov [row], eax
mov [column], edx
 
mov eax, [process_info.x_size] ; width of window
sub eax, 10
sub eax, cardwidth
mov ebx, 7
mov edx, 0
div ebx
mov ebx, [column]
add ebx, 4
mul ebx
add eax, 5
 
mov [xpos], eax
 
mov eax, [row]
mov bl, rowsize
mul bl
add eax, 24 + topbuttonsbarheight
mov [ypos], eax
 
mov [negativedraw], 0
 
call draw_card
 
; define button on place of card
 
mov eax, 8
mov ebx, [xpos]
shl ebx, 16
add bx, cardwidth - 1
mov ecx, [ypos]
shl ecx, 16
add cx, cardheight - 1
mov edx, [column]
add edx, 01000000000000000000000000000000b + 2 + 8 + 4 ; button id
 
; id = 1 reserved as close button
int $40
 
 
inc [j]
cmp [j], 4
jb draw_a_home_card
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; draw common cards
 
mov [j], 0 ;counter that loops from 0 to 8 * 19
 
draw_a_card:
 
 
; code of card must be in ecx
mov eax, cards
add eax, [j]
xor ecx, ecx
mov cl, byte [eax] ; placing in cl value from memory
; with address [cards + j] or
; j-th element of array "cards"
; cmp ecx, 52 ; if code of card >= 52 then there is no card
; jae no_draw
;
; cmp ecx, 0 ; if code of card < 0 then there is no card
; jb no_draw
 
mov [cardcode], ecx
 
 
 
mov eax, [j]
xor edx, edx
mov ebx, 8
div ebx ; divsion by 8 (8 columns),
; so in eax quotient - number of row
; and in edx remainder -
; number of column where lay card
 
mov [row], eax
mov [column], edx
 
mov eax, [process_info.x_size] ; width of window
sub eax, 10
sub eax, cardwidth
mov ebx, 7
mov edx, 0
div ebx
mov ebx, [column]
mul ebx
add eax, 5
 
mov [xpos], eax
 
mov eax, [row]
mov bl, rowsize
mul bl
add eax, cardheight + 24 + topbuttonsbarheight + columnspace
mov [ypos], eax
 
 
mov [negativedraw], 0 ;checking, if this is selected card
 
cmp [whereisselcard], scCommonCells
jne .this_card_isnt_selected
 
mov eax, [column]
cmp [columnofselcard], eax
jne .this_card_isnt_selected
 
 
mov eax, [column]
mov [ncolumn], eax
call get_row_of_top_card_in_column
mov eax, [row]
cmp [topcardrow], eax
jne .this_card_isnt_selected
 
mov [negativedraw], 1
 
.this_card_isnt_selected:
 
call draw_card
 
 
 
; now checking if it is top card in its column
; if it does, we'll define button on its place
mov eax, [column]
mov [ncolumn], eax
call get_row_of_top_card_in_column
mov eax, [row]
cmp [topcardrow], eax
je .define_button
 
cmp [topcardrow], 0
jne .no_define_button
 
cmp [row], 0
jne .no_define_button
 
 
.define_button:
mov eax, 8
mov ebx, [xpos]
shl ebx, 16
add bx, cardwidth - 1
mov ecx, [ypos]
shl ecx, 16
add cx, cardheight - 1
mov edx, [column]
add edx, 01000000000000000000000000000000b + 2; button id = column + 2,
; id = 1 reserved as close button
int $40
 
 
.no_define_button:
 
inc [j]
cmp [j], 8 * 19
jb draw_a_card
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
mov eax, 12 ; finish drawing
mov ebx, 2
int $40
 
ret
 
 
;******************************************************************************
; get_row_of_top_card_in_column(ncolumn): topcardrow
 
get_row_of_top_card_in_column:
; number of column in ncolumn
; returns in topcardrow
 
mov [i], 0 ; i loops from 0 to 1, ... while card i * 8 + ncolumn
; is valid card (0 <= its code < 52)
 
.cycle:
xor eax, eax
mov al, 8
mov ebx, [i]
mul bl
add eax, [ncolumn]
add eax, cards
xor ecx, ecx
mov cl, byte [eax]
 
cmp ecx, 52
jae .endcycle
 
 
cmp [i], 18
ja .endcycle
 
 
inc [i]
 
jmp .cycle
 
.endcycle:
 
cmp [i], 0
je .dont_dec
 
dec [i]
 
.dont_dec:
 
mov eax, [i]
mov [topcardrow], eax
ret
 
 
;******************************************************************************
; invert_image_colors(imagetoinvert, sizeofimagetoinvert)
invert_image_colors:
mov [i], 0
 
.inverting:
mov eax, [imagetoinvert]
add eax, [i]
 
mov bl, byte [eax]
;xor ebx, ebx
;add ebx, 10
not ebx
 
mov byte [eax], bl
 
 
inc [i]
 
mov ecx, [sizeofimagetoinvert]
cmp [i], ecx
jb .inverting
 
jmp .later
 
 
.exit:
mov eax, -1
int $40
 
.later:
 
 
ret
 
 
 
;******************************************************************************
; draw_card(xpos, ypos, cardcode, negativedraw)
; if negativedraw = 1 then card drawn in inverted colors
 
draw_card: ; draws card with left top corner
; in point ([xpos],[ypos]),
; type of card in [cardcode]
 
cmp [cardcode], 52 ; if code of card >= 52 then there is no card
jae .no_draw_card
 
 
cmp [negativedraw], 1
jne .no_invert1
;doing if negativedraw
mov [bgcolor], $00000000
mov [blackcolor], $00FFFFFF
mov [redcolor], $0000FFFF
 
;inverting all images
call invert_all_images
 
jmp .colors_selection_done
 
.no_invert1:
;doing if not negativedraw
mov [bgcolor], $00FFFFFF
mov [blackcolor], $00000000
mov [redcolor], $00FF0000
 
 
.colors_selection_done:
 
mov eax, 13
 
mov ebx, [xpos] ; filling card with bgcolor
; (big background rectangle)
mov edx, [bgcolor]
add ebx, 2
shl ebx, 16
mov bx, cardwidth - 4
 
mov ecx, [ypos]
add ecx, 2
shl ecx, 16
mov cx, cardheight - 4
int $40
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
mov ebx, [xpos] ; left black line
shl ebx, 16
mov bx, 1
 
mov ecx, [ypos]
add ecx, 5
shl ecx, 16
xor cx, cx
mov cx, cardheight - 2 * radius - 2
mov edx, [blackcolor]
int $40
 
mov ebx, [xpos] ; left white line
inc ebx
shl ebx, 16
mov bx, 1
mov edx, [bgcolor]
int $40
 
mov ebx, [xpos] ; right black line
add ebx, cardwidth - 1
shl ebx, 16
mov bx, 1
mov edx, [blackcolor]
int $40
 
mov ebx, [xpos] ; right white line
add ebx, cardwidth - 2
shl ebx, 16
mov bx, 1
mov edx, [bgcolor]
int $40
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
mov ecx, [ypos] ; top black line
shl ecx, 16
mov cx, 1
 
mov ebx, [xpos]
add ebx, 5
shl ebx, 16
mov bx, cardwidth - 2 * radius - 2
mov edx, [blackcolor]
int $40
 
mov ecx, [ypos] ; top white line
inc ecx
shl ecx, 16
mov cx, 1
mov edx, [bgcolor]
int $40
 
mov ecx, [ypos] ; bottom black line
add ecx, cardheight - 1
shl ecx, 16
mov cx, 1
mov edx, [blackcolor]
int $40
 
mov ecx, [ypos] ; bottom white line
add ecx, cardheight - 2
shl ecx, 16
mov cx, 1
mov edx, [bgcolor]
int $40
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
mov eax, 1 ; drawing points
mov edx, [blackcolor] ; black color for all pixels
 
mov ebx, [xpos] ; draw top left corner
mov ecx, [ypos]
inc ebx
add ecx, 4
int $40
 
dec ecx
int $40
 
dec ecx
inc ebx
int $40
 
dec ecx
inc ebx
int $40
 
inc ebx
int $40
 
mov ebx, [xpos] ;drawing top right corner
mov ecx, [ypos]
add ebx, cardwidth - 2
add ecx, 4
int $40
 
dec ecx
int $40
 
dec ebx
dec ecx
int $40
 
dec ebx
dec ecx
int $40
 
dec ebx
int $40
;drawing bottom left corner
mov ebx, [xpos]
mov ecx, [ypos]
inc ebx
add ecx, cardheight - 5
int $40
 
inc ecx
int $40
 
inc ebx
inc ecx
int $40
 
inc ebx
inc ecx
int $40
 
inc ebx
int $40
;drawing bottom right corner
mov ebx, [xpos]
mov ecx, [ypos]
add ebx, cardwidth - 2
add ecx, cardheight - 5
int $40
 
inc ecx
int $40
 
dec ebx
inc ecx
int $40
 
dec ebx
inc ecx
int $40
 
dec ebx
int $40
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; drawing text and images
 
mov eax, [cardcode]
mov edx, 0
mov ebx, 4
div ebx
 
mov [cardfamily], edx
mov [cardrange], eax
 
; counting position of small card image
mov eax, 7
mov ecx, 8*65536+8
mov edx, [xpos]
add edx, radius
shl edx, 16
mov dx, word [ypos]
add dx, radius + 8
 
 
 
cmp [cardfamily], 0
je .heart
 
cmp [cardfamily], 1
je .diamond
 
cmp [cardfamily], 2
je .club
 
cmp [cardfamily], 3
je .spade
 
.heart:
mov esi, [redcolor]
mov [color], esi
mov [imageaddr], heart
mov [imageflipaddr], heart_updown
 
mov ebx, heart_small
int $40
 
jmp .selnumber
 
.diamond:
mov esi, [redcolor]
mov [color], esi
mov [imageaddr], diamond
mov [imageflipaddr], diamond_updown
 
mov ebx, diamond_small
int $40
 
jmp .selnumber
 
.club:
mov esi, [blackcolor]
mov [color], esi
mov [imageaddr], club
mov [imageflipaddr], club_updown
 
mov ebx, club_small
int $40
 
jmp .selnumber
 
.spade:
mov esi, [blackcolor]
mov [color], esi
mov [imageaddr], spade
mov [imageflipaddr], spade_updown
 
mov ebx, spade_small
int $40
 
 
 
.selnumber:
 
mov ebx, [xpos] ; counting position of text
; in ebx, same for all cards
add ebx, radius
shl ebx, 16
mov bx, word [ypos]
add bx, radius
 
 
mov ecx, [color]
 
 
cmp [cardrange], 0
je .ace
 
cmp [cardrange], 1
je .two
 
cmp [cardrange], 2
je .three
 
cmp [cardrange], 3
je .four
 
cmp [cardrange], 4
je .five
 
cmp [cardrange], 5
je .six
 
cmp [cardrange], 6
je .seven
 
cmp [cardrange], 7
je .eight
 
cmp [cardrange], 8
je .nine
 
cmp [cardrange], 9
je .ten
 
cmp [cardrange], 10
je .jack
 
cmp [cardrange], 11
je .queen
 
cmp [cardrange], 12
je .king
 
; +-------+-------+-------+
; | 3 | 2 | 3 | ace = 1
; +-------+-------+-------+ two = 2
; | | | | three = 2 + 1
; +-------+-------+-------+ four = 3
; | | 6 | | five = 3 + 1
; +-------+-------+-------+ six = 3 + 4
; | 5 | | 5 | seven = 3 + 4 + 6
; +-------+-------+-------+ eight = 3 + 5
; | 4 | 1 | 4 | nine = 3 + 5
; +-------+-------+-------+ ten = 3 + 5 + 6 + 7
; | 5 | | 5 |
; +-------+-------+-------+
; | | 7 | | 1 means draw_1
; +-------+-------+-------+
; | | | |
; +-------+-------+-------+
; | 3 | 2 | 3 |
; +-------+-------+-------+
 
 
 
.ace:
mov eax, 4
mov [s], byte 'A'
mov edx, s
mov esi, 1
int $40
 
call draw_1
jmp .end
 
.two:
mov eax, 4
mov [s], byte '2'
mov edx, s
mov esi, 1
int $40
 
call draw_2
jmp .end
 
 
.three:
mov eax, 4
mov [s], byte '3'
mov edx, s
mov esi, 1
int $40
 
call draw_1
call draw_2
 
jmp .end
 
.four:
mov eax, 4
mov [s], byte '4'
mov edx, s
mov esi, 1
int $40
 
call draw_3
jmp .end
 
.five:
mov eax, 4
mov [s], byte '5'
mov edx, s
mov esi, 1
int $40
 
call draw_1
call draw_3
 
jmp .end
 
.six:
mov eax, 4
mov [s], byte '6'
mov edx, s
mov esi, 1
int $40
 
call draw_3
call draw_4
 
jmp .end
 
.seven:
mov eax, 4
mov [s], byte '7'
mov edx, s
mov esi, 1
int $40
 
call draw_3
call draw_4
call draw_6
 
jmp .end
 
.eight:
mov eax, 4
mov [s], byte '8'
mov edx, s
mov esi, 1
int $40
 
call draw_3
call draw_5
 
jmp .end
 
.nine:
mov eax, 4
mov [s], byte '9'
mov edx, s
mov esi, 1
int $40
 
call draw_3
call draw_5
call draw_1
 
jmp .end
 
.ten:
mov eax, 4
mov [s], word '10'
mov edx, s
mov esi, 2
int $40
 
call draw_3
call draw_5
call draw_6
call draw_7
 
jmp .end
 
.jack:
mov eax, 4
mov [s], byte 'J'
mov edx, s
mov esi, 1
int $40
 
jmp .end
 
.queen:
mov eax, 4
mov [s], byte 'Q'
mov edx, s
mov esi, 1
int $40
 
jmp .end
 
.king:
mov eax, 4
mov [s], byte 'K'
mov edx,s
mov esi, 1
int $40
 
.end:
 
 
cmp [negativedraw], 1
jne .no_invert2
 
call invert_all_images
 
 
.no_invert2:
.no_draw_card:
 
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; invert_all_images()
invert_all_images:
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], heart
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], diamond
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], spade
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], club
call invert_image_colors
 
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], heart_updown
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], diamond_updown
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], spade_updown
call invert_image_colors
 
mov [sizeofimagetoinvert], 16 * 16 * 3
mov [imagetoinvert], club_updown
call invert_image_colors
 
 
mov [sizeofimagetoinvert], 8 * 8 * 3
mov [imagetoinvert], heart_small
call invert_image_colors
 
mov [sizeofimagetoinvert], 8 * 8 * 3
mov [imagetoinvert], diamond_small
call invert_image_colors
 
mov [sizeofimagetoinvert], 8 * 8 * 3
mov [imagetoinvert], spade_small
call invert_image_colors
 
mov [sizeofimagetoinvert], 8 * 8 * 3
mov [imagetoinvert], club_small
call invert_image_colors
 
 
 
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
draw_1:
;draw center image
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, cardwidth/2 - 8
shl edx, 16
mov dx, word [ypos]
add dx, cardheight/2 - 8
mov eax, 7
int $40
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
draw_2:
;draw top image
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, 40 - 8
shl edx, 16
mov dx, word [ypos]
add dx, margin
mov eax, 7
int $40
;draw bottom image
mov ebx, [imageflipaddr]
mov edx, [xpos]
add edx, cardwidth/2 - 8
shl edx, 16
mov dx, word [ypos]
add dx, cardheight - 16 - margin
mov eax, 7
int $40
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
draw_3:
;draw top left image
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, margin
shl edx, 16
mov dx, word [ypos]
add dx, margin
mov eax, 7
int $40
;draw bottom left image
mov ebx, [imageflipaddr]
mov edx, [xpos]
add edx, margin
shl edx, 16
mov dx, word [ypos]
add dx, cardheight - margin - 16
mov eax, 7
int $40
;draw top right image
mov ebx, [imageaddr]
mov edx, [xpos]
add edx, cardwidth - margin - 16
shl edx, 16
mov dx, word [ypos]
add dx, margin
mov eax, 7
int $40
;draw bottom right image
mov ebx, [imageflipaddr]
mov edx, [xpos]
add edx, cardwidth - margin - 16
shl edx, 16
mov dx, word [ypos]
add dx, cardheight - margin - 16
mov eax, 7
int $40
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
draw_4:
;draw center left image
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, margin
shl edx, 16
mov dx, word [ypos]
add dx, cardheight/2 - 8
mov eax, 7
int $40
;draw center right image
mov edx, [xpos]
add edx, cardwidth - margin - 16
shl edx, 16
mov dx, word [ypos]
add dx, cardheight/2 - 8
mov eax, 7
int $40
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
draw_5:
;draw top left image
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, margin
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 3 / 9
mov eax, 7
int $40
;draw bottom left image
mov ebx, [imageflipaddr]
mov edx, [xpos]
add edx, 16
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 5 / 9
mov eax, 7
int $40
;draw top right image
mov ebx, [imageaddr]
mov edx, [xpos]
add edx, cardwidth - margin - 16
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 3 / 9
mov eax, 7
int $40
;draw bottom right image
mov ebx, [imageflipaddr]
mov edx, [xpos]
add edx, cardwidth - margin - 16
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 5 / 9
mov eax, 7
int $40
ret
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
draw_6:
mov ebx, [imageaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, cardwidth/2 - 8
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 2 / 9
mov eax, 7
int $40
ret
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
draw_7:
mov ebx, [imageflipaddr]
mov ecx, 16 * 65536 + 16
mov edx, [xpos]
add edx, cardwidth/2 - 8
shl edx, 16
mov dx, word [ypos]
add dx, cardheight * 6 / 9
mov eax, 7
int $40
ret
 
 
;******************************************************************************
randomize:
push eax
 
mov eax, 3
int 0x40
 
mov ebx, $A59E3F1C
mul ebx
mov dword [randseed], eax
pop eax
ret
 
 
 
;******************************************************************************
; function Random(Range): RandomValue
random:
push ebx
 
mov eax, [randseed]
mov edx, 0
mov ebx, 7
div ebx
 
cmp edx, 0
je _0
 
cmp edx, 1
je _1
 
cmp edx, 2
je _2
 
cmp edx, 3
je _3
 
cmp edx, 4
je _4
 
cmp edx, 5
je _5
 
cmp edx, 6
je _6
 
jmp _end
 
 
_0:
;base := base + 58 + a[8];
mov eax, [randseed]
add eax, 58
add eax, dword [a + 8 * 4]
mov [randseed], eax
jmp _end;
 
_1:
;base := base + 1 + a[9];
mov eax, [randseed]
add eax, 1
add eax, dword [a + 9 * 4]
mov [randseed], eax
jmp _end;
 
_2:
;base := base + 4 + a[88];
mov eax, [randseed]
add eax, 4
add eax, dword [a + 88 * 4]
mov [randseed], eax
jmp _end;
 
_3:
;randseed := randseed + 79 + a[43];
mov eax, [randseed]
add eax, 79
add eax, dword [a + 43 * 4]
mov [randseed], eax
jmp _end;
 
_4:
;randseed := randseed + 3 + a[12];
mov eax, [randseed]
add eax, 3
add eax, dword [a + 12 * 4]
mov [randseed], eax
jmp _end;
 
_5:
;randseed := randseed + 2 + a[63];
mov eax, [randseed]
add eax, 2
add eax, dword [a + 63 * 4]
mov [randseed], eax
jmp _end;
 
_6:
;randseed := randseed + 151 + a[24];
mov eax, [randseed]
add eax, 151
add eax, dword [a + 24 * 4]
mov [randseed], eax
 
_end:
 
mov eax, [randseed]
mov edx, eax
shl edx, 16
mov bx, 100
div bx ; dx = randseed mod 100
 
mov ax, dx ; ax = randseed mod 100
mov bx, 4
mul bx ; dx:ax = (randseed mod 100) * 4
and eax, $0000FFFF
shr edx, 16
and edx, $FFFF0000
or eax, edx
 
mov eax, dword [a + eax] ; eax = dword[a + (randseed mod 100) * 4]
; ~ a[randseed mod 100]
mov ebx, dword [a + 47 * 4]
mul ebx ; eax = low(a[randseed mod 100] * a[47])
 
add eax, [randseed]
add eax, $4AE783A
mov [randseed], eax
 
mov eax, dword [a + 6 * 4]
mov edx, 0
mov ebx, 100
div ebx
mov eax, edx
mov ebx, 4
mul ebx ; eax = (dword [a + 6 * 4] mod 100) * 4 ~ a[6] mod 100
 
 
mov eax, dword [a + eax] ; eax = dword [a + (dword [a + 6 * 4] mod 100) * 4
 
; ~ a[a[6] mod 100]
add eax, [randseed]
mov [random_value], eax
 
mov edx, 0
 
mov ebx, [range]
div ebx
mov [random_value], edx
 
mov al, [TimesCalled]
xor ah, ah
inc al
mov bl, 100
div bl
mov [TimesCalled], ah ; TimesCalled = (TimesCalled + 1 ) mod 100
 
mov al, ah
mov bl, 4
mul bl
and eax, $0000FFFF
 
mov ebx, [randseed]
mov dword [a + eax], ebx ; a[TimesCalled] = randseed
 
pop ebx
ret
 
;******************************************************************************
 
; <--- initialised data --->
data
header db 'Freecell',0
 
new_game: db "New game"
new_game_len = $ - new_game
 
exit: db "Exit"
exit_len = $ - exit
 
s: db "10"
 
 
negativedraw db 0 ; for procedure draw_card
 
 
spade file 'SPADE.BMP': 54
spade_updown file 'SPADEUD.BMP': 54
spade_small file 'SPADESML.BMP': 54
 
club file 'CLUB.BMP': 54
club_updown file 'CLUBUD.BMP': 54
club_small file 'CLUBSML.BMP': 54
 
diamond file 'DIAM.BMP': 54
diamond_updown file 'DIAMUD.BMP': 54
diamond_small file 'DIAMSML.BMP': 54
 
heart file 'HEART.BMP': 54
heart_updown file 'HEARTUD.BMP': 54
heart_small file 'HEARTSML.BMP': 54
 
 
scNotSelected = 0
scCommonCells = 1
scTempCells = 2
 
 
whereisselcard dd scNotSelected
columnofselcard dd 0 ; if WhereIsSelCard = scGeneralCells
; then this can be 0 .. 7,
; if scTempCells then - 0 .. 3
; if scNotSelected - no matter
 
tempcells: times 4 db 52;
homecells: times 4 db 52 ; maximal card code is 51
cards: times 8 * 19 db 52; - %
pack: times 52 db ?
 
 
 
udata
process_info process_information
syscolors system_colors
 
WindowHeight rw 1
WindowWidth rw 1
 
xpos rd 1
ypos rd 1
bgcolor rd 1
blackcolor rd 1
redcolor rd 1
 
 
lastparam rd 1 ;
 
randomcard rd 1 ; for new_game_click
 
columnclicked rd 1 ; used in common_card_click, temp_cell_click,
cardclicked rd 1 ; home_cell_click
clickedcardrange rd 1 ;
clickedcardfamily rd 1 ;
 
 
selcardcode rd 1 ; for procedure get_sel_card_code_and_addr
selcardaddr rd 1 ;
 
column rd 1 ; for procedure draw_window
row rd 1 ;
 
imagetoinvert rd 1 ; for procedure invert_image_colors
sizeofimagetoinvert rd 1 ;
 
ncolumn rd 1 ; for procedure get_row_of_top_card_in_column
topcardrow rd 1 ;
 
 
color rd 1 ; for procedue draw_card
imageaddr rd 1 ;
imageflipaddr rd 1 ;
 
cardcode rd 1 ; used in differrent procedures
cardrange rd 1 ; cardcode = cardrange * 4 + cardfamily
cardfamily rd 1 ;
 
a: times 100 rd 1 ; for function Random
range rd 1 ;
random_value rd 1 ;
randseed rd 1 ;
TimesCalled rb 1 ;
 
j rd 1 ; number of card (in array cards) drawn now
i rd 1 ; used in many procedures of 1-st level
k rd 1
 
cardwidth = 80
cardheight = 120
radius = 4 ; not recommended to change
rowsize = 30 ; distance between top poins
;of cards in neighboring rows
columnspace = 5 ; minimal space between cards
margin = 14 ; margin of every card
 
topbuttonsbarheight = 20
 
 
meos_app_end
/programs/games/freecell/play.txt
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
/programs/games/pipes/build.bat
0,0 → 1,2
@fasm pipes.asm pipes
@pause
/programs/games/pipes/pipes.asm
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:
 
 
 
 
/programs/games/pipes/pipes.raw
0,0 → 1,0
z£ÇsœÀZƒ§g´r›¿f³cŒ°[„¨@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@užÂqš¾w ÄaŠ®m–ºqš¾y¢Æ]†ªy¢ÆcŒ°o˜¼{¤Èb‹¯Y‚¦m–ºd±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@]†ªvŸÃ[„¨e޲qš¾h‘µf³`‰­[„¨i’¶r›¿g´k”¸sœÀqš¾Y‚¦@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@sœÀh‘µn—»f³k”¸y¢Æn—»w Äo˜¼užÂvŸÃ^‡«p™½x¡Åw ÄY‚¦@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@n—»tÁsœÀg´aŠ®e޲X¥`‰­x¡Åy¢ÆcŒ°\…©e޲užÂf³h‘µ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@^‡«l•¹y¢Æx¡Åf³w ÄužÂz£Çz£ÇZƒ§d±cŒ°w ÄY‚¦n—»o˜¼@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@]†ªz£Çf³r›¿cŒ°sœÀf³tÁm–ºsœÀl•¹o˜¼aŠ®j“·k”¸Y‚¦@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@x¡Ån—»cŒ°x¡Åi’¶g´^‡«\…©užÂh‘µy¢ÆvŸÃo˜¼W€¤r›¿d±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@_ˆ¬r›¿sœÀ`‰­_ˆ¬k”¸W€¤_ˆ¬_ˆ¬{¤ÈcŒ°cŒ°Zƒ§qš¾]†ªcŒ°@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@g´k”¸W€¤_ˆ¬\…©cŒ°o˜¼k”¸e޲X¥tÁZƒ§tÁh‘µm–º^‡«@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@f³]†ªe޲g´\…©j“·Zƒ§Y‚¦b‹¯Zƒ§m–ºw Äqš¾cŒ°i’¶f³@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@x¡Åg´Y‚¦vŸÃr›¿o˜¼k”¸[„¨Y‚¦f³qš¾_ˆ¬r›¿sœÀ`‰­_ˆ¬@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@j“·]†ªW€¤w ÄsœÀcŒ°n—»y¢Æf³Y‚¦l•¹w ÄužÂtÁd±d±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@p™½n—»p™½Zƒ§]†ªz£ÇtÁe޲y¢Æ\…©j“·vŸÃo˜¼užÂZƒ§p™½@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@qš¾^‡«o˜¼W€¤n—»x¡ÅZƒ§Y‚¦Zƒ§`‰­aŠ®X¥n—»Zƒ§w Ä_ˆ¬@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@n—»j“·m–º\…©qš¾{¤Èf³Zƒ§j“·]†ªj“·e޲w ÄužÂqš¾`‰­@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@_ˆ¬w ÄtÁl•¹X¥^‡«tÁcŒ°b‹¯e޲[„¨[„¨Zƒ§j“·k”¸r›¿@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@`‰­cŒ°qš¾aŠ®f³x¡Å`‰­y¢Æj“·užÂvŸÃx¡Å^‡«[„¨d±qš¾@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@e޲užÂ[„¨tÁ^‡«e޲x¡Åh‘µn—»j“·\…©g´n—»k”¸]†ª\…©@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@Y‚¦d±W€¤]†ªi’¶l•¹tÁ\…©`‰­^‡«o˜¼`‰­o˜¼qš¾e޲W€¤@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@r›¿p™½w Äp™½`‰­qš¾b‹¯\…©X¥sœÀvŸÃZƒ§g´užÂf³h‘µ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@vŸÃx¡Åm–ºX¥Zƒ§r›¿x¡Åm–ºn—»`‰­X¥vŸÃz£Ç[„¨g´\…©@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@w Äh‘µvŸÃf³^‡«tÁcŒ°i’¶f³x¡ÅZƒ§]†ªp™½tÁ_ˆ¬{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@{¤È^‡«tÁi’¶h‘µk”¸m–º]†ª_ˆ¬cŒ°m–ºm–ºd±z£ÇcŒ°tÁ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@b‹¯p™½d±tÁw Äe޲w ÄX¥j“·p™½Y‚¦qš¾h‘µaŠ®m–ºm–º@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@f³{¤Èx¡ÅY‚¦aŠ®h‘µl•¹X¥\…©l•¹w Äj“·_ˆ¬g´]†ª_ˆ¬@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@W€¤{¤ÈsœÀ{¤ÈW€¤j“·r›¿Zƒ§n—»`‰­X¥vŸÃz£Ç[„¨g´\…©@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@w Äh‘µvŸÃf³^‡«tÁcŒ°i’¶w Äm–º_ˆ¬Zƒ§m–ºsœÀl•¹o˜¼@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@Y‚¦x¡Å^‡«b‹¯x¡Ån—»cŒ°x¡ÅvŸÃg´vŸÃf³f³w Äm–ºe޲@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@cŒ°cŒ°n—»d±i’¶d±_ˆ¬l•¹p™½užÂaŠ®]†ªp™½j“·X¥X¥@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@X¥vŸÃw ÄaŠ®aŠ®W€¤j“·Zƒ§d±m–ºZƒ§n—»qš¾vŸÃf³h‘µ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@i’¶k”¸y¢Æw Än—»b‹¯h‘µj“·Zƒ§W€¤i’¶z£ÇsœÀZƒ§g´r›¿@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@b‹¯r›¿f³užÂqš¾w ÄaŠ®m–ºe޲Zƒ§`‰­aŠ®X¥n—»Zƒ§w Ä_ˆ¬vŸÃe޲p™½f³n—»i’¶o˜¼y¢Æp™½o˜¼{¤Èz£Çi’¶e޲X¥^‡«n—»j“·m–º\…©qš¾{¤Èf³n—»n—»g´X¥užÂg´y¢ÆcŒ°h‘µ{¤Èl•¹j“·{¤ÈX¥^‡«z£ÇY‚¦užÂg´sœÀi’¶m–ºd±w ÄcŒ°{¤Èqš¾{¤Èy¢ÆY‚¦r›¿f³h‘µY‚¦`‰­sœÀw ÄsœÀx¡ÅY‚¦[„¨m–ºg´[„¨x¡ÅaŠ®užÂcŒ°e޲Y‚¦_ˆ¬sœÀ]†ªj“·_ˆ¬p™½X¥b‹¯[„¨j“·j“·n—»f³w Äm–ºX¥Zƒ§r›¿x¡Åm–ºtÁg´X¥l•¹j“·j“·W€¤qš¾^‡«o˜¼W€¤n—»x¡ÅZƒ§Y‚¦l•¹e޲]†ªe޲aŠ®i’¶k”¸r›¿i’¶Zƒ§užÂn—»užÂk”¸{¤ÈX¥cŒ°užÂn—»l•¹e޲j“·n—»_ˆ¬b‹¯aŠ®k”¸w Äz£Çg´l•¹r›¿f³vŸÃ_ˆ¬^‡«aŠ®vŸÃl•¹r›¿vŸÃx¡ÅZƒ§^‡«e޲h‘µqš¾n—»b‹¯h‘µy¢Æf³x¡Åj“·\…©z£Ç`‰­x¡ÅaŠ®i’¶h‘µb‹¯^‡«r›¿i’¶Zƒ§k”¸{¤ÈY‚¦\…©i’¶o˜¼g´e޲x¡ÅY‚¦y¢Æd±sœÀi’¶l•¹Zƒ§cŒ°^‡«užÂW€¤w Äm–º_ˆ¬Zƒ§m–ºsœÀl•¹o˜¼aŠ®j“·k”¸Y‚¦y¢Æ]†ªm–º^‡«j“·m–º[„¨_ˆ¬o˜¼n—»b‹¯h‘µj“·X¥l•¹y¢Æqš¾užÂ_ˆ¬užÂp™½vŸÃz£Çy¢Æn—»Y‚¦tÁj“·cŒ°tÁ\…©\…©sœÀi’¶p™½j“·m–ºtÁqš¾\…©h‘µ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppup€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€•••••••••••••••••••••••••••••••• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ ••••••••••••••••••••••••••••••••€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€puppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y‚¦sœÀk”¸cŒ°Y‚¦n—»]†ªX¥y¢Æ[„¨i’¶tÁf³W€¤z£ÇvŸÃe޲cŒ°n—»_ˆ¬cŒ°m–ºm–ºd±z£ÇcŒ°tÁW€¤qš¾Y‚¦l•¹\…©j“·o˜¼tÁk”¸i’¶_ˆ¬`‰­]†ªx¡ÅvŸÃqš¾b‹¯[„¨z£Çb‹¯j“·]†ªp™½y¢Æz£Ç]†ªcŒ°k”¸_ˆ¬vŸÃh‘µX¥z£Ç]†ªj“·z£ÇužÂb‹¯vŸÃužÂ`‰­aŠ®h‘µl•¹qš¾Zƒ§w ÄtÁ`‰­x¡ÅZƒ§n—»tÁx¡Åd±^‡«w Äe޲i’¶b‹¯sœÀ^‡«^‡«l•¹cŒ°]†ªvŸÃz£ÇtÁužÂo˜¼x¡Åqš¾h‘µg´x¡Åf³[„¨]†ªtÁk”¸h‘µx¡Åqš¾[„¨užÂr›¿vŸÃqš¾aŠ®n—»vŸÃ_ˆ¬vŸÃX¥g´e޲m–ºh‘µp™½l•¹l•¹d±tÁužÂZƒ§_ˆ¬w ÄtÁl•¹X¥^‡«tÁcŒ°^‡«z£Çqš¾x¡ÅX¥W€¤qš¾[„¨z£Çp™½`‰­p™½Zƒ§{¤Èf³[„¨e޲^‡«x¡Åi’¶l•¹tÁj“·[„¨[„¨p™½p™½j“·tÁaŠ®m–ºf³\…©tÁz£ÇW€¤{¤ÈsœÀ{¤ÈW€¤j“·r›¿Zƒ§g´k”¸\…©x¡Åb‹¯`‰­qš¾sœÀk”¸cŒ°w Äi’¶b‹¯i’¶\…©]†ª\…©i’¶m–ºw ÄcŒ°cŒ°aŠ®d±w Äp™½l•¹j“·p™½užÂj“·y¢Æ]†ªp™½]†ª[„¨j“·vŸÃqš¾k”¸aŠ®Y‚¦[„¨h‘µn—»aŠ®e޲qš¾užÂj“·]†ªj“·e޲w ÄužÂqš¾`‰­y¢Æ[„¨{¤È\…©g´m–ºr›¿X¥]†ªg´i’¶l•¹d±tÁužÂh‘µ\…©f³]†ªz£Çf³r›¿cŒ°@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@W€¤l•¹n—»w Äo˜¼m–ºsœÀY‚¦k”¸m–º]†ªo˜¼Y‚¦d±m–º{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@p™½w Äz£Ç^‡«d±^‡«h‘µf³[„¨r›¿Zƒ§_ˆ¬tÁW€¤j“·vŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@h‘µužÂ{¤Èy¢ÆX¥W€¤g´_ˆ¬qš¾cŒ°qš¾d±vŸÃg´Y‚¦m–º@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@`‰­aŠ®h‘µl•¹qš¾Zƒ§w ÄtÁl•¹p™½qš¾Zƒ§`‰­d±_ˆ¬vŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@{¤Èm–ºp™½r›¿h‘µm–ºcŒ°aŠ®sœÀe޲i’¶vŸÃx¡Åj“·X¥\…©@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@^‡«k”¸užÂ]†ª{¤Èx¡Åj“·X¥qš¾y¢Æ[„¨_ˆ¬užÂp™½j“·j“·@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@tÁr›¿x¡Å_ˆ¬o˜¼sœÀcŒ°m–ºX¥_ˆ¬aŠ®y¢Æl•¹o˜¼^‡«sœÀ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@@@@w ÄY‚¦n—»o˜¼vŸÃqš¾e޲Zƒ§j“·cŒ°sœÀg´qš¾]†ªp™½@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@{¤ÈcŒ°]†ªb‹¯p™½g´p™½cŒ°@@@@@@pup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@d±^‡«Zƒ§qš¾_ˆ¬h‘µi’¶Y‚¦@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppuppuppuppuppuppuppuppupZƒ§W€¤j“·Y‚¦\…©h‘µy¢ÆtÁ@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€€…€€…€€…€€…€€…€€…€€…€€…€W€¤k”¸i’¶qš¾\…©k”¸w Ä]†ªj“·@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •••••••••h‘µf³n—»m–ºo˜¼^‡«e޲b‹¯i’¶Zƒ§@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ _ˆ¬k”¸W€¤_ˆ¬^‡«tÁ[„¨m–ºqš¾j“·e޲@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ n—»z£ÇcŒ°p™½qš¾tÁ^‡«b‹¯m–ºi’¶Zƒ§l•¹@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°aŠ®užÂY‚¦z£Çqš¾vŸÃ`‰­m–ºz£Çqš¾f³e޲Zƒ§@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°aŠ®e޲p™½i’¶e޲p™½k”¸n—»h‘µm–ºW€¤p™½l•¹j“·@@@@@@@@@puppup€…€• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ ]†ªj“·cŒ°o˜¼{¤Èz£ÇZƒ§d±_ˆ¬z£Çe޲y¢Æi’¶Zƒ§Zƒ§@@@@@@@@@puppup€…€• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ l•¹tÁužÂ`‰­Zƒ§y¢Æh‘µtÁ`‰­h‘µr›¿W€¤qš¾f³e޲e޲@@@@@@@@@puppup€…€••••••••••w Ä{¤Èp™½d±`‰­tÁk”¸f³l•¹_ˆ¬užÂg´m–ºW€¤p™½l•¹l•¹@@@@@@@@@puppup€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€cŒ°m–ºp™½z£Ço˜¼cŒ°užÂW€¤i’¶`‰­\…©Zƒ§tÁb‹¯x¡Åj“·b‹¯Zƒ§@@@@@@@@@puppuppuppuppuppuppuppuppuppuppupn—»{¤ÈX¥sœÀužÂp™½z£Ço˜¼qš¾f³e޲m–ºp™½h‘µr›¿W€¤qš¾f³e޲@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Zƒ§y¢Æh‘µtÁz£Ç[„¨l•¹f³m–ºW€¤p™½l•¹sœÀ_ˆ¬užÂg´m–ºW€¤p™½l•¹@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@qš¾x¡Åo˜¼tÁb‹¯g´qš¾_ˆ¬Zƒ§n—»cŒ°w Äl•¹]†ªaŠ®aŠ®n—»_ˆ¬h‘µW€¤Zƒ§d±{¤ÈZƒ§X¥qš¾sœÀl•¹qš¾[„¨k”¸h‘µw Ä\…©w Ä`‰­i’¶užÂy¢Æl•¹y¢Æ{¤Èm–º{¤ÈtÁj“·e޲užÂz£Çk”¸f³k”¸W€¤^‡«cŒ°j“·_ˆ¬y¢Æe޲p™½cŒ°r›¿m–º\…©aŠ®Y‚¦w Äx¡Åy¢Æf³[„¨[„¨h‘µX¥p™½p™½užÂcŒ°p™½Y‚¦cŒ°W€¤n—»i’¶j“·Zƒ§]†ªcŒ°aŠ®[„¨i’¶qš¾qš¾Zƒ§]†ªf³m–ºy¢Æn—»Zƒ§o˜¼h‘µ_ˆ¬e޲tÁsœÀz£Çd±`‰­o˜¼i’¶z£Çp™½_ˆ¬m–ºqš¾Y‚¦qš¾b‹¯sœÀy¢Æ_ˆ¬vŸÃZƒ§d±_ˆ¬o˜¼]†ªqš¾aŠ®{¤Èn—»x¡År›¿užÂ^‡«z£ÇužÂo˜¼`‰­Zƒ§{¤Èe޲qš¾qš¾^‡«o˜¼\…©\…©_ˆ¬p™½g´l•¹užÂx¡Å`‰­vŸÃtÁY‚¦z£Çy¢Æk”¸X¥tÁ[„¨[„¨p™½`‰­[„¨p™½cŒ°tÁy¢Æz£Çp™½vŸÃtÁtÁ^‡«k”¸h‘µh‘µg´qš¾o˜¼p™½j“·d±g´W€¤d±f³]†ªy¢ÆsœÀx¡Ån—»sœÀj“·\…©l•¹z£ÇužÂk”¸h‘µZƒ§k”¸`‰­^‡«[„¨e޲w Äy¢Æi’¶p™½]†ª^‡«j“·X¥_ˆ¬Y‚¦j“·m–ºr›¿vŸÃd±užÂd±_ˆ¬z£Çj“·Zƒ§f³o˜¼W€¤f³tÁd±n—»m–ºb‹¯m–ºb‹¯]†ªtÁY‚¦cŒ°p™½sœÀj“·\…©vŸÃm–ºvŸÃ{¤ÈcŒ°qš¾x¡Åo˜¼tÁb‹¯g´qš¾_ˆ¬Zƒ§n—»cŒ°w Äl•¹]†ªaŠ®aŠ®n—»_ˆ¬h‘µW€¤Zƒ§d±{¤ÈZƒ§X¥qš¾sœÀl•¹qš¾[„¨k”¸h‘µw Ä\…©w Ä`‰­i’¶užÂy¢Æl•¹y¢Æ{¤Èm–º{¤ÈtÁj“·e޲užÂz£Çk”¸f³k”¸W€¤^‡«cŒ°j“·_ˆ¬y¢Æe޲p™½cŒ°r›¿m–º\…©aŠ®Y‚¦w Äx¡Åy¢Æf³[„¨[„¨h‘µX¥p™½p™½užÂcŒ°p™½Y‚¦cŒ°W€¤n—»i’¶j“·Zƒ§]†ªcŒ°aŠ®[„¨i’¶qš¾qš¾Zƒ§]†ªf³m–ºy¢Æn—»Zƒ§o˜¼h‘µ_ˆ¬e޲tÁsœÀz£Çd±`‰­o˜¼i’¶z£Çp™½_ˆ¬m–ºqš¾Y‚¦qš¾b‹¯sœÀy¢Æ_ˆ¬vŸÃZƒ§d±_ˆ¬o˜¼]†ªqš¾aŠ®{¤Èn—»x¡År›¿užÂ^‡«z£ÇužÂo˜¼`‰­Zƒ§{¤Èe޲qš¾qš¾^‡«o˜¼\…©\…©_ˆ¬p™½g´l•¹užÂx¡Å`‰­vŸÃtÁY‚¦z£Çy¢Æk”¸X¥tÁ[„¨[„¨p™½`‰­[„¨p™½cŒ°tÁy¢Æz£Çp™½vŸÃtÁtÁ^‡«k”¸h‘µh‘µg´qš¾o˜¼p™½j“·d±g´W€¤d±f³]†ªy¢ÆsœÀx¡Ån—»sœÀj“·\…©l•¹z£ÇužÂk”¸h‘µZƒ§k”¸`‰­^‡«[„¨e޲w Äy¢Æi’¶p™½]†ª^‡«j“·X¥_ˆ¬Y‚¦j“·m–ºr›¿vŸÃd±užÂd±_ˆ¬z£Çj“·Zƒ§f³o˜¼W€¤f³tÁd±n—»m–ºb‹¯m–ºb‹¯]†ªtÁY‚¦cŒ°p™½sœÀj“·\…©vŸÃm–ºvŸÃ{¤ÈcŒ°g´y¢Æp™½^‡«\…©o˜¼l•¹i’¶m–ºqš¾i’¶l•¹`‰­_ˆ¬h‘µz£Çm–ºqš¾i’¶j“·@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@tÁqš¾z£Çw Äh‘µb‹¯p™½Y‚¦W€¤f³`‰­_ˆ¬h‘µz£Çm–ºqš¾i’¶j“·Zƒ§@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@z£ÇvŸÃo˜¼e޲g´e޲qš¾tÁp™½e޲\…©užÂr›¿e޲W€¤f³Zƒ§e޲@@@@@@@@@puppuppuppuppuppuppuppuppuppuppup]†ªl•¹vŸÃi’¶l•¹y¢ÆZƒ§f³l•¹m–ºZƒ§g´W€¤y¢Æp™½e޲l•¹@@@@@@@@@puppup€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€p™½]†ªg´b‹¯W€¤\…©`‰­[„¨sœÀp™½tÁm–ºqš¾i’¶l•¹Zƒ§@@@@@@@@@puppup€…€••••••••••p™½cŒ°vŸÃsœÀaŠ®j“·d±X¥_ˆ¬h‘µb‹¯W€¤f³Zƒ§j“·@@@@@@@@@puppup€…€• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ m–ºaŠ®f³^‡«k”¸vŸÃ_ˆ¬i’¶užÂr›¿x¡Åp™½e޲Zƒ§@@@@@@@@@puppup€…€• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ f³o˜¼f³^‡«užÂo˜¼vŸÃi’¶g´W€¤j“·l•¹e޲@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°b‹¯p™½w Äl•¹w ÄužÂ\…©aŠ®m–ºqš¾b‹¯l•¹@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°qš¾\…©m–ºcŒ°j“·Zƒ§k”¸užÂW€¤f³Zƒ§@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ x¡Åg´e޲]†ªsœÀp™½e޲Y‚¦p™½e޲@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ g´qš¾sœÀvŸÃaŠ®_ˆ¬x¡Åz£Çl•¹@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •••••••••z£Çx¡Åi’¶z£Çg´vŸÃ^‡«qš¾@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€€…€€…€€…€€…€€…€€…€€…€€…€]†ªqš¾j“·tÁj“·x¡Å^‡«vŸÃ@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppuppuppuppuppuppuppuppupz£Çz£Çm–ºr›¿`‰­m–ºk”¸`‰­@@@@@@pup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@_ˆ¬h‘µz£ÇtÁ[„¨X¥\…©m–º@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@užÂr›¿e޲b‹¯y¢ÆZƒ§tÁb‹¯@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@@@@tÁ^‡«{¤È`‰­h‘µp™½W€¤g´W€¤y¢Æx¡Åy¢Ær›¿r›¿Y‚¦@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@w Är›¿k”¸m–ºaŠ®užÂw Äl•¹m–ºqš¾i’¶j“·X¥x¡Åx¡År›¿@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@Y‚¦x¡ÅužÂp™½h‘µ{¤Èz£Çn—»W€¤f³Zƒ§b‹¯Zƒ§m–º_ˆ¬vŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@n—»_ˆ¬]†ªr›¿l•¹y¢Æ^‡«w Äp™½e޲]†ªsœÀužÂtÁo˜¼užÂ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@o˜¼o˜¼{¤Èh‘µqš¾X¥d±o˜¼l•¹m–ºm–º]†ªg´g´sœÀ^‡«@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@vŸÃsœÀx¡Åm–ºZƒ§W€¤^‡«m–ºsœÀp™½Y‚¦tÁužÂX¥cŒ°{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@qš¾cŒ°j“·cŒ°w Äg´h‘µsœÀk”¸k”¸y¢ÆtÁw Äl•¹m–ºf³@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@e޲m–ºX¥aŠ®tÁ_ˆ¬f³Y‚¦k”¸sœÀl•¹p™½W€¤m–ºg´užÂ_ˆ¬z£Ç]†ªz£Çg´x¡Åqš¾b‹¯f³m–ºp™½p™½]†ªz£ÇtÁg´vŸÃ]†ªy¢Æqš¾m–ºaŠ®w Äqš¾k”¸p™½m–ºe޲f³qš¾W€¤r›¿h‘µz£Çqš¾x¡Åqš¾g´\…©p™½o˜¼aŠ®cŒ°]†ªl•¹vŸÃqš¾y¢Æd±y¢Æk”¸aŠ®y¢ÆY‚¦\…©x¡Åy¢ÆY‚¦m–º]†ªZƒ§i’¶y¢Æe޲z£Çm–ºj“·i’¶sœÀe޲m–ºw Äf³f³vŸÃg´vŸÃo˜¼z£Çp™½užÂsœÀX¥{¤Èn—»w Äw Äo˜¼tÁtÁ]†ªsœÀb‹¯j“·x¡Åb‹¯tÁr›¿tÁz£ÇvŸÃ]†ªcŒ°l•¹^‡«^‡«sœÀb‹¯i’¶e޲w Ä^‡«d±x¡ÅtÁn—»Zƒ§x¡Å`‰­tÁw ÄužÂg´užÂZƒ§X¥y¢Æy¢Æ[„¨`‰­j“·g´aŠ®sœÀj“·w ÄužÂk”¸aŠ®W€¤l•¹g´h‘µ\…©_ˆ¬n—»[„¨x¡Åo˜¼y¢Æi’¶b‹¯l•¹X¥g´tÁm–ºx¡År›¿Zƒ§X¥m–ºx¡ÅvŸÃ_ˆ¬p™½Zƒ§užÂo˜¼vŸÃj“·\…©y¢Æe޲b‹¯o˜¼z£ÇsœÀ[„¨r›¿h‘µf³užÂg´m–ºcŒ°sœÀo˜¼_ˆ¬x¡År›¿tÁ\…©k”¸^‡«^‡«x¡Åe޲k”¸\…©vŸÃ_ˆ¬d±`‰­Zƒ§qš¾p™½l•¹j“·j“·p™½užÂ_ˆ¬[„¨y¢Æqš¾f³{¤È^‡«užÂvŸÃr›¿Y‚¦b‹¯m–º`‰­vŸÃqš¾z£ÇY‚¦užÂaŠ®i’¶i’¶X¥[„¨f³tÁY‚¦i’¶Zƒ§\…©`‰­^‡«e޲[„¨l•¹_ˆ¬@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@l•¹p™½W€¤m–ºg´užÂ_ˆ¬sœÀl•¹p™½W€¤m–ºf³l•¹[„¨z£ÇtÁh‘µy¢ÆZƒ§@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@e޲f³qš¾W€¤r›¿h‘µp™½m–ºe޲f³qš¾o˜¼z£Çp™½užÂsœÀX¥{¤Èn—»puppuppuppuppuppuppuppuppuppuppup@@@@@@@@@Zƒ§b‹¯j“·x¡Åb‹¯tÁZƒ§\…©`‰­i’¶W€¤užÂcŒ°o˜¼z£Çp™½m–ºcŒ°€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€puppup@@@@@@@@@l•¹l•¹p™½W€¤m–ºg´užÂ_ˆ¬l•¹f³k”¸tÁ`‰­d±p™½{¤Èw Ä••••••••••€…€puppup@@@@@@@@@e޲e޲f³qš¾W€¤r›¿h‘µ`‰­tÁh‘µy¢ÆZƒ§`‰­užÂtÁl•¹ ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ •€…€puppup@@@@@@@@@Zƒ§Zƒ§i’¶y¢Æe޲z£Ç_ˆ¬d±Zƒ§z£Ç{¤Èo˜¼cŒ°j“·]†ª ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ •€…€puppup@@@@@@@@@j“·l•¹p™½W€¤m–ºh‘µn—»k”¸p™½e޲i’¶p™½e޲aŠ®°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@Zƒ§e޲f³qš¾z£Çm–º`‰­vŸÃqš¾z£ÇY‚¦užÂaŠ®°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@l•¹Zƒ§i’¶m–ºb‹¯^‡«tÁqš¾p™½cŒ°z£Çn—» ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@e޲j“·qš¾m–º[„¨tÁ^‡«_ˆ¬W€¤k”¸_ˆ¬ ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@Zƒ§i’¶b‹¯e޲^‡«o˜¼m–ºn—»f³h‘µ••••••••• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@j“·]†ªw Äk”¸\…©qš¾i’¶k”¸W€¤€…€€…€€…€€…€€…€€…€€…€€…€€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@tÁy¢Æh‘µ\…©Y‚¦j“·W€¤Zƒ§puppuppuppuppuppuppuppuppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@Y‚¦i’¶h‘µ_ˆ¬qš¾Zƒ§^‡«d±@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€pup@@@@@@cŒ°p™½g´p™½b‹¯]†ªcŒ°{¤È@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@p™½]†ªqš¾g´sœÀcŒ°j“·Zƒ§e޲qš¾vŸÃo˜¼n—»Y‚¦w Ä@@@@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@sœÀ^‡«o˜¼l•¹y¢ÆaŠ®_ˆ¬X¥m–ºcŒ°sœÀo˜¼_ˆ¬x¡År›¿tÁ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@j“·j“·p™½užÂ_ˆ¬[„¨y¢Æqš¾X¥j“·x¡Å{¤È]†ªužÂk”¸^‡«@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@\…©X¥j“·x¡ÅvŸÃi’¶e޲sœÀaŠ®cŒ°m–ºh‘µr›¿p™½m–º{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@vŸÃ_ˆ¬d±`‰­Zƒ§qš¾p™½l•¹tÁw ÄZƒ§qš¾l•¹h‘µaŠ®`‰­@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@m–ºY‚¦g´vŸÃd±qš¾cŒ°qš¾_ˆ¬g´W€¤X¥y¢Æ{¤ÈužÂh‘µ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@vŸÃj“·W€¤tÁ_ˆ¬Zƒ§r›¿[„¨f³h‘µ^‡«d±^‡«z£Çw Äp™½@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@{¤Èm–ºd±Y‚¦o˜¼]†ªm–ºk”¸Y‚¦sœÀm–ºo˜¼w Än—»l•¹W€¤@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@cŒ°r›¿f³z£Ç]†ªf³\…©h‘µY‚¦f³_ˆ¬tÁaŠ®X¥m–ºe޲@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@f³m–ºl•¹w ÄtÁy¢Æk”¸k”¸sœÀh‘µg´w ÄcŒ°j“·cŒ°qš¾@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@{¤ÈcŒ°X¥užÂtÁY‚¦p™½sœÀm–º^‡«W€¤Zƒ§m–ºx¡ÅsœÀvŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@^‡«sœÀg´g´]†ªm–ºm–ºl•¹o˜¼d±X¥qš¾h‘µ{¤Èo˜¼o˜¼@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@užÂo˜¼tÁužÂsœÀ]†ªe޲p™½w Ä^‡«y¢Æl•¹r›¿]†ª_ˆ¬n—»@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@vŸÃ_ˆ¬m–ºZƒ§b‹¯Zƒ§f³W€¤n—»z£Ç{¤Èh‘µp™½užÂx¡ÅY‚¦@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@r›¿x¡Åx¡ÅX¥j“·i’¶qš¾m–ºl•¹w ÄužÂaŠ®m–ºk”¸r›¿w Ä@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@Y‚¦r›¿r›¿y¢Æx¡Åy¢ÆW€¤g´W€¤p™½h‘µ`‰­{¤È^‡«tÁ@@@@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@b‹¯tÁZƒ§y¢Æb‹¯e޲r›¿užÂ@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@m–º\…©X¥[„¨tÁz£Çh‘µ_ˆ¬@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€pup@@@@@@`‰­k”¸m–º`‰­r›¿m–ºz£Çz£Çpuppuppuppuppuppuppuppuppup€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@vŸÃ^‡«x¡Åj“·tÁj“·qš¾]†ª€…€€…€€…€€…€€…€€…€€…€€…€€…€• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@b‹¯^‡«vŸÃg´z£Çi’¶x¡Åz£Ç••••••••• ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@l•¹j“·x¡Å_ˆ¬aŠ®vŸÃsœÀqš¾g´ ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@e޲p™½x¡Åe޲p™½sœÀ]†ªe޲g´x¡Å ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@Zƒ§f³W€¤b‹¯k”¸Zƒ§j“·cŒ°m–º\…©qš¾°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@l•¹b‹¯qš¾m–ºtÁy¢Æk”¸k”¸l•¹w Äp™½b‹¯°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@e޲l•¹j“·W€¤g´Zƒ§Y‚¦p™½sœÀ^‡«f³o˜¼f³ ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ •€…€puppup@@@@@@@@@Zƒ§e޲p™½x¡År›¿užÂ\…©m–ºm–ºl•¹^‡«f³aŠ®m–º ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ •€…€puppup@@@@@@@@@j“·Zƒ§f³W€¤b‹¯h‘µ_ˆ¬`‰­]†ªe޲p™½sœÀvŸÃcŒ°p™½••••••••••€…€puppup@@@@@@@@@Zƒ§l•¹i’¶qš¾m–ºtÁp™½sœÀb‹¯Zƒ§f³W€¤b‹¯g´]†ªp™½€…€€…€€…€€…€€…€€…€€…€€…€€…€€…€puppup@@@@@@@@@l•¹e޲p™½y¢ÆW€¤g´Zƒ§m–ºl•¹j“·i’¶qš¾m–ºi’¶vŸÃl•¹]†ªpuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@e޲Zƒ§f³W€¤e޲r›¿užÂ\…©e޲p™½x¡Åy¢ÆW€¤g´e޲o˜¼vŸÃz£Ç@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Zƒ§j“·i’¶qš¾m–ºz£Çh‘µ_ˆ¬`‰­f³W€¤b‹¯e޲r›¿užÂw Äz£Çqš¾tÁ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@j“·i’¶qš¾m–ºz£Çh‘µ_ˆ¬`‰­l•¹i’¶qš¾m–ºtÁz£Çh‘µ_ˆ¬^‡«p™½y¢Æg´cŒ°{¤ÈvŸÃm–ºvŸÃ\…©j“·sœÀp™½cŒ°Y‚¦tÁ]†ªb‹¯o˜¼tÁužÂsœÀ]†ªe޲p™½y¢ÆW€¤g´Zƒ§j“·z£Ç_ˆ¬d±užÂd±vŸÃr›¿m–ºj“·Y‚¦_ˆ¬X¥j“·^‡«]†ªp™½i’¶y¢Æw Äe޲_ˆ¬m–ºZƒ§b‹¯Zƒ§f³W€¤e޲r›¿užÂ\…©j“·sœÀn—»x¡ÅsœÀy¢Æ]†ªf³d±W€¤g´d±j“·p™½o˜¼qš¾g´h‘µh‘µk”¸^‡«x¡Åx¡ÅX¥j“·i’¶qš¾m–ºz£Çh‘µ_ˆ¬`‰­p™½[„¨[„¨tÁX¥k”¸y¢Æz£ÇY‚¦tÁvŸÃ`‰­x¡ÅužÂl•¹g´p™½_ˆ¬\…©\…©o˜¼r›¿r›¿y¢Æx¡Åy¢ÆW€¤g´o˜¼užÂz£Ç^‡«užÂr›¿x¡Ån—»{¤ÈaŠ®qš¾]†ªo˜¼_ˆ¬d±Zƒ§vŸÃ_ˆ¬y¢ÆsœÀb‹¯qš¾Y‚¦qš¾m–ºtÁZƒ§y¢Æb‹¯e޲r›¿užÂz£ÇsœÀtÁe޲_ˆ¬h‘µo˜¼Zƒ§n—»y¢Æm–ºf³]†ªZƒ§qš¾qš¾i’¶[„¨aŠ®cŒ°]†ªZƒ§j“·i’¶n—»\…©X¥[„¨tÁz£Çh‘µ_ˆ¬p™½X¥h‘µ[„¨[„¨f³y¢Æx¡Åw ÄY‚¦aŠ®\…©m–ºr›¿cŒ°p™½e޲y¢Æ_ˆ¬j“·cŒ°^‡«W€¤k”¸f³k”¸z£ÇužÂe޲j“·tÁ{¤Èm–º{¤Èy¢Æl•¹y¢ÆužÂi’¶`‰­w Ä\…©w Äh‘µk”¸[„¨qš¾l•¹sœÀqš¾X¥Zƒ§{¤Èd±Zƒ§W€¤h‘µ_ˆ¬n—»aŠ®aŠ®]†ªl•¹w ÄcŒ°n—»Zƒ§_ˆ¬qš¾g´b‹¯tÁo˜¼x¡Åqš¾h‘µ\…©f³]†ªz£Çf³r›¿cŒ°@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@W€¤l•¹n—»w Äo˜¼m–ºsœÀY‚¦k”¸m–º]†ªo˜¼Y‚¦d±m–º{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@p™½w Äz£Ç^‡«d±^‡«h‘µf³[„¨r›¿Zƒ§_ˆ¬tÁW€¤j“·vŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@h‘µužÂ{¤Èy¢ÆX¥W€¤g´_ˆ¬qš¾cŒ°qš¾d±vŸÃg´Y‚¦m–º@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@`‰­aŠ®h‘µl•¹qš¾Zƒ§w ÄtÁl•¹p™½qš¾Zƒ§`‰­d±_ˆ¬vŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@{¤Èm–ºp™½r›¿h‘µm–ºcŒ°aŠ®sœÀe޲i’¶vŸÃx¡Åj“·X¥\…©@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@^‡«k”¸užÂ]†ª{¤Èx¡Åj“·X¥qš¾y¢Æ[„¨_ˆ¬užÂp™½j“·j“·@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@tÁr›¿x¡Å_ˆ¬o˜¼sœÀcŒ°m–ºX¥_ˆ¬aŠ®y¢Æl•¹o˜¼^‡«@@@@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@@@@w ÄY‚¦n—»o˜¼vŸÃqš¾e޲@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppup€…€• ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥ •€…€puppuppuppuppuppuppuppuppup€…€€…€€…€€…€€…€€…€€…€€…€€…€• ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥ •€…€€…€€…€€…€€…€€…€€…€€…€€…€••••••••• ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥ ••••••••• ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥  ¥ ••••••••• ¥  ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥  ¥ •••••••••€…€€…€€…€€…€€…€€…€€…€€…€€…€• ¥  ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥  ¥ •€…€€…€€…€€…€€…€€…€€…€€…€€…€puppuppuppuppuppuppuppuppup€…€• ¥  ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥  ¥ •€…€puppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥  ¥ °µ°°µ° ¥  ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@_ˆ¬l•¹[„¨e޲^‡«`‰­\…©@@@@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@@@@Y‚¦r›¿vŸÃužÂ^‡«{¤Èf³qš¾y¢Æ[„¨_ˆ¬užÂp™½j“·j“·@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@tÁr›¿x¡Å_ˆ¬o˜¼sœÀcŒ°m–ºg´užÂf³h‘µr›¿[„¨sœÀz£Ç@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@Zƒ§r›¿x¡Åm–ºtÁg´X¥l•¹b‹¯i’¶y¢Æo˜¼x¡Å[„¨n—»_ˆ¬@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@y¢Æy¢ÆX¥Zƒ§užÂg´užÂw ÄtÁ`‰­x¡ÅZƒ§n—»tÁx¡Åd±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@b‹¯x¡Åj“·b‹¯sœÀ]†ªtÁtÁo˜¼w Äw Än—»{¤ÈX¥sœÀužÂ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@e޲y¢Æi’¶Zƒ§]†ªm–ºY‚¦y¢Æx¡Å\…©Y‚¦y¢ÆaŠ®k”¸y¢Æd±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@r›¿W€¤qš¾f³e޲m–ºp™½k”¸qš¾w ÄaŠ®m–ºqš¾y¢Æ]†ªvŸÃ@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@užÂg´m–ºW€¤p™½l•¹sœÀk”¸_ˆ¬vŸÃ\…©k”¸e޲x¡Å^‡«^‡«k”¸\…©tÁr›¿x¡Å_ˆ¬o˜¼sœÀcŒ°m–º{¤Èm–ºp™½r›¿h‘µm–ºcŒ°aŠ®cŒ°Zƒ§l•¹W€¤cŒ°cŒ°i’¶d±užÂvŸÃ^‡«`‰­k”¸y¢Æw Ä[„¨p™½d±z£ÇZƒ§z£Ç\…©m–ºY‚¦o˜¼w Äb‹¯cŒ°d±vŸÃw Än—»Y‚¦l•¹p™½_ˆ¬[„¨g´sœÀb‹¯tÁ[„¨j“·r›¿[„¨r›¿y¢Ær›¿vŸÃsœÀe޲i’¶vŸÃx¡ÅX¥\…©qš¾]†ª[„¨i’¶r›¿g´k”¸sœÀqš¾qš¾Y‚¦{¤Èk”¸w Äb‹¯_ˆ¬`‰­X¥cŒ°h‘µh‘µl•¹i’¶ vŸÃBAADCDDEEFFFFFFEEECDDAAA^‡« cŒ°g´h‘µW€¤W€¤qš¾l•¹r›¿g´k”¸\…©cŒ°W€¤X¥z£Çg´p™½ HGHJKKMMMOOONNOMMMKJJGHH p™½l•¹x¡Åx¡Å^‡«[„¨d±qš¾m–º_ˆ¬aŠ®n—»j“·cŒ°cŒ° @@@@@@ STSWWVYYYYYXWVWTSS @@@@@@ i’¶X¥X¥vŸÃe޲w Ä\…©y¢Æ]†ª{¤ÈvŸÃg´qš¾ @@@```@@@@@@ ^^^bbbdeeedeabb^^] @@@@@@```@@@ b‹¯b‹¯x¡Åe޲cŒ°tÁtÁ_ˆ¬{¤Èr›¿W€¤i’¶ @@@@@@```@@@ mmnqpqqqqmmn @@@```@@@@@@ o˜¼o˜¼Y‚¦d±m–º{¤Èw ÄužÂo˜¼X¥\…©{¤È^‡« @@@@@@@@@@@@ yyz}}}}}}zyz @@@@@@@@@@@@ vŸÃužÂužÂY‚¦j“·sœÀi’¶r›¿o˜¼k”¸[„¨p™½aŠ®AABHHH @@@@@@ Љ‰‰Š‰ @@@@@@ HHGAAAsœÀsœÀh‘µy¢Æx¡Åz£Çg´vŸÃf³f³w Äm–ºDCCKJKSTT^^^ •••••• ^^^STTJKKCDDi’¶i’¶d±_ˆ¬l•¹[„¨užÂvŸÃ^‡«p™½x¡Åw ÄEEEMMMVVVbbammmyyz yyynnnbbbWWWMMMEEEaŠ®aŠ®e޲X¥`‰­l•¹l•¹j“·r›¿r›¿k”¸r›¿FFFOOOYYYdedqpp}}}ЉЕ”• •••ŠŠ‰}}~qqpeddYYYONNFFFtÁtÁh‘µužÂd±e޲f³qš¾[„¨n—»W€¤užÂFFFNOOYYYdeeqqp~}}ŠŠ‰••• •”•‰Š‰}}}qpqeddXXYNOOFFFk”¸j“·]†ªm–º`‰­sœÀ`‰­l•¹b‹¯y¢ÆsœÀl•¹EDEMMMVWVbabmmmzzy yzznnmbbbWWWMMMEEEl•¹k”¸_ˆ¬_ˆ¬g´z£Ç]†ªk”¸`‰­i’¶vŸÃg´CCCJJKTTS^]^ ”•”••• ^^^SSSKKJDDCW€¤l•¹Y‚¦tÁi’¶qš¾W€¤\…©f³e޲užÂf³ABAGGG @@@@@@ ‰‰ŠŠ‰‰ @@@@@@ GHHAABf³W€¤o˜¼b‹¯h‘µ]†ªy¢ÆcŒ°\…©e޲`‰­y¢ÆvŸÃ @@@@@@@@@@@@ zyz}}}}}}yyy @@@@@@@@@@@@ ^‡«m–ºf³w ÄužÂz£Çx¡Åj“·f³g´y¢Æqš¾vŸÃ @@@@@@```@@@ nmmqqqqqqnmn @@@```@@@@@@ b‹¯m–ºj“·n—»p™½i’¶d±m–º{¤ÈaŠ®k”¸r›¿ @@@```@@@@@@ ^]^abbdeedddbbb^^^ @@@@@@```@@@ o˜¼b‹¯Y‚¦p™½[„¨^‡«]†ªe޲aŠ®i’¶Zƒ§y¢Æi’¶ @@@@@@ TTSVWVYYYYXYVWWTSS @@@@@@ cŒ°n—»o˜¼aŠ®j“·k”¸Y‚¦r›¿[„¨vŸÃw Ä[„¨r›¿l•¹p™½ HHGJJKMMMNNOONNMMMJKKGHG p™½g´m–ºn—»qš¾vŸÃf³h‘µZƒ§\…©sœÀaŠ®f³e޲h‘µg´@@@ @@@ABBCCCEEEFFFFFFEEECCCBBA@@@ @@@l•¹h‘µo˜¼m–ºr›¿`‰­{¤ÈsœÀvŸÃX¥W€¤\…©aŠ®[„¨sœÀi’¶@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y‚¦{¤Èi’¶o˜¼z£ÇW€¤o˜¼b‹¯vŸÃtÁp™½^‡«aŠ®[„¨sœÀi’¶@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y‚¦{¤Èi’¶r›¿k”¸Y‚¦o˜¼y¢Æk”¸\…©aŠ®^‡«b‹¯vŸÃužÂ`‰­@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@e޲i’¶b‹¯sœÀ^‡«^‡«l•¹cŒ°p™½k”¸w Äqš¾e޲Zƒ§_ˆ¬X¥@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@qš¾cŒ°z£Çj“·W€¤qš¾f³^‡«b‹¯h‘µ]†ª\…©W€¤e޲m–ºd±@@@@@@@@@@@@• ¥  ¥ °µ°°µ° ¥  ¥ •@@@@@@@@@@@@l•¹j“·\…©m–ºužÂf³vŸÃj“·l•¹f³p™½j“·n—»užÂk”¸{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@r›¿f³vŸÃ_ˆ¬^‡«aŠ®vŸÃl•¹_ˆ¬{¤Èr›¿W€¤i’¶n—»_ˆ¬f³@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@m–º]†ªo˜¼Y‚¦d±m–º{¤ÈaŠ®p™½X¥f³r›¿x¡Ån—»w Äd±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@qš¾vŸÃcŒ°`‰­p™½o˜¼]†ª[„¨^‡«]†ªm–º^‡«qš¾užÂ^‡«k”¸@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@l•¹]†ªcŒ°aŠ®o˜¼p™½\…©g´_ˆ¬vŸÃ\…©k”¸e޲užÂ^‡«k”¸@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@l•¹]†ªcŒ°aŠ®l•¹W€¤cŒ°cŒ°^‡«cŒ°{¤ÈcŒ°aŠ®x¡Å^‡«k”¸@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@l•¹aŠ®cŒ°Zƒ§z£Çn—»w Äe޲^‡«k”¸užÂ]†ª{¤È]†ªj“·b‹¯@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@]†ªh‘µf³m–ºsœÀm–ºh‘µužÂ]†ªg´{¤Èj“·užÂx¡Åj“·X¥@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@\…©W€¤g´]†ªl•¹_ˆ¬k”¸užÂaŠ®vŸÃY‚¦užÂm–º\…©e޲f³@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@d±Zƒ§e޲^‡«h‘µsœÀY‚¦]†ª`‰­z£Ç[„¨sœÀd±j“·p™½w Ä@@@@@@@@@@@@• ¥  ¥ °µ°°µ° ¥  ¥ •@@@@@@@@@@@@{¤ÈY‚¦b‹¯d±vŸÃl•¹W€¤x¡Ån—»g´r›¿\…©e޲Zƒ§e޲^‡«@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@tÁj“·Zƒ§vŸÃr›¿\…©g´cŒ°r›¿p™½w Äp™½`‰­z£Ç]†ªj“·@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@qš¾\…©g´\…©\…©p™½w Äk”¸sœÀužÂx¡Åh‘µh‘µqš¾b‹¯\…©@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o˜¼k”¸qš¾j“·p™½Zƒ§e޲tÁaŠ®l•¹b‹¯r›¿f³j“·aŠ®r›¿@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@aŠ®h‘µZƒ§sœÀz£Ç_ˆ¬užÂg´]†ªj“·p™½[„¨y¢Æe޲h‘µg´AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg´h‘µz£Ç]†ª[„¨^‡«_ˆ¬aŠ®{¤Èd±r›¿{¤È`‰­r›¿l•¹p™½AAAAAAAAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAAAAAAAAp™½l•¹d±^‡«g´x¡ÅY‚¦m–ºZƒ§p™½vŸÃ]†ªg´y¢Æi’¶^‡«AAAAAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAAAA^‡«i’¶vŸÃužÂ\…©_ˆ¬h‘µg´k”¸l•¹užÂh‘µy¢Ær›¿]†ª`‰­AAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`‰­]†ªz£Çn—»sœÀ`‰­_ˆ¬k”¸Y‚¦tÁj“·cŒ°tÁvŸÃh‘µAAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAh‘µ_ˆ¬r›¿l•¹W€¤aŠ®k”¸^‡«e޲x¡Åh‘µW€¤y¢Æp•µAAAGHHQQQ[\\ffgqppyyy~~~€€€€~~~yyyqppffg[\\QQQGHHAAAp•µh‘µg´Zƒ§m–ºj“·^‡«g´qš¾cŒ°z£Çj“·f³AAACCDLLMXWWdddppp|||†††ŒŒ†††|||pppdddXWWLLMCCDAAAh‘µ^‡«f³Zƒ§aŠ®k”¸cŒ°{¤Èqš¾{¤Èy¢Æg´AAAFFEPPP]]\jjjxxx†††‘‘‘š™šš™š‘‘‘†††xxxjjj]]\PPPFFEAAA]†ªe޲{¤Èi’¶aŠ®W€¤cŒ°p™½qš¾tÁ^‡«l•¹AAAHHGSRR```ono}~~Œšš™¤£¤¨¨¨¨¨¨¤£¤šš™Œ}~~ono```SRRHHGAAAx¡Åk”¸f³\…©tÁz£Ç[„¨^‡«g´Zƒ§\…©užÂ@@@IIHTSSbaappp€€œ¨§¨°°°°°°¨§¨œ€€pppbaaTSSIIH@@@aŠ®m–ºb‹¯r›¿m–ºr›¿p™½Y‚¦qš¾h‘µaŠ®r›¿@@@IIHTSSbaappp€€œ¨§¨°°°°°°¨§¨œ€€pppbaaTSSIIH@@@W€¤Zƒ§h‘µl•¹X¥^‡«sœÀsœÀe޲cŒ°užÂw ÄAAAHHGSRR```ono}~~Œšš™¤£¤¨¨¨¨¨¨¤£¤šš™Œ}~~ono```SRRHHGAAAY‚¦aŠ®{¤Èh‘µw ÄZƒ§n—»qš¾aŠ®{¤Èqš¾m–ºAAAFFEPPP]]\jjjxxx†††‘‘‘š™šš™š‘‘‘†††xxxjjj]]\PPPFFEAAAi’¶qš¾`‰­y¢Æb‹¯užÂl•¹m–ºX¥p™½[„¨aŠ®AAACCDLLMXWWdddppp|||†††ŒŒ†††|||pppdddXWWLLMCCDAAA{¤È^‡«W€¤j“·vŸÃZƒ§h‘µ`‰­X¥f³^‡«{¤Èp•µAAAGHHQQQ[\\ffgqppyyy~~~€€€€~~~yyyqppffg[\\QQQGHHAAAp•µ_ˆ¬l•¹W€¤X¥z£Çg´sœÀ{¤È]†ª_ˆ¬`‰­i’¶h‘µAAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAh‘µ^‡«cŒ°X¥^‡«n—»j“·[„¨e޲^‡«x¡Ål•¹qš¾]†ª`‰­AAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`‰­]†ªi’¶e޲o˜¼e޲`‰­{¤Èo˜¼f³p™½d±X¥cŒ°i’¶^‡«l•¹AAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAl•¹^‡«i’¶W€¤\…©l•¹tÁX¥o˜¼_ˆ¬{¤Èd±^‡«\…©z£Çl•¹p™½]†ª^‡«AAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAA^‡«]†ªp™½l•¹m–ºY‚¦]†ªx¡ÅvŸÃqš¾užÂg´^‡«x¡Åy¢Æh‘µh‘µg´cŒ°]†ª]†ª[ŸAAAAAAAAA@@@@@@AAAAAAAAA[Ÿ]†ª]†ªcŒ°g´h‘µ_ˆ¬`‰­l•¹y¢Æx¡Åf³^‡«h‘µf³b‹¯Y‚¦p™½[„¨^‡«e޲f³sœÀZƒ§d±d±x¡ÅZƒ§_ˆ¬l•¹]†ªn—»k”¸aŠ®\…©]†ªX¥]†ª]†ªi’¶j“·p™½d±g´tÁY‚¦vŸÃz£Çx¡ÅtÁm–º_ˆ¬aŠ®n—»j“·cŒ°cŒ°vŸÃ[„¨e޲o˜¼j“·r›¿Zƒ§e޲[„¨e޲b‹¯g´tÁW€¤aŠ®h‘µb‹¯Y‚¦cŒ°{¤ÈX¥y¢Æd±qš¾užÂg´l•¹f³tÁm–ºY‚¦d±]†ª`‰­g´Zƒ§k”¸r›¿{¤Èl•¹d±w ÄW€¤e޲r›¿h‘µg´r›¿z£Çm–ºk”¸h‘µw Äz£ÇužÂi’¶sœÀ`‰­e޲d±aŠ®\…©aŠ®^‡«^‡«qš¾[„¨y¢ÆY‚¦vŸÃm–ºqš¾^‡«\…©w Äp™½z£Çk”¸tÁsœÀk”¸{¤ÈcŒ°k”¸p™½j“·l•¹X¥e޲w Äg´]†ªx¡Åk”¸r›¿j“·e޲`‰­{¤ÈaŠ®p™½w ÄW€¤Y‚¦k”¸l•¹\…©l•¹`‰­^‡«y¢Æ\…©W€¤k”¸h‘µb‹¯d±]†ªZƒ§z£Çd±cŒ°h‘µw Äp™½]†ªo˜¼vŸÃe޲Zƒ§X¥g´z£Ç_ˆ¬w ÄcŒ°{¤Èh‘µj“·d±Zƒ§y¢Æe޲Zƒ§cŒ°`‰­e޲^‡«y¢Æ{¤ÈZƒ§cŒ°p™½^‡«[„¨l•¹užÂsœÀp™½z£Çg´_ˆ¬p™½y¢Æw Ä_ˆ¬e޲qš¾tÁ{¤È^‡«e޲{¤ÈX¥y¢Æd±qš¾užÂg´Y‚¦g´qš¾f³y¢Æz£ÇužÂZƒ§p™½W€¤z£Çqš¾k”¸e޲i’¶vŸÃn—»k”¸r›¿W€¤Y‚¦užÂ_ˆ¬Zƒ§sœÀW€¤p™½n—»{¤Èb‹¯w Äd±{¤Èx¡Åy¢Æ_ˆ¬w Äx¡Åb‹¯\…©W€¤x¡ÅY‚¦i’¶k”¸d±_ˆ¬f³f³`‰­sœÀo˜¼tÁi’¶^‡«]†ªaŠ®{¤Èm–ºY‚¦qš¾m–ºl•¹h‘µx¡Åk”¸r›¿j“·e޲`‰­{¤ÈaŠ®p™½w ÄW€¤Y‚¦k”¸l•¹\…©l•¹`‰­^‡«y¢Æ\…©W€¤k”¸h‘µf³tÁqš¾tÁ^‡«X¥užÂvŸÃcŒ°z£Çi’¶užÂk”¸aŠ®vŸÃz£Çr›¿l•¹aŠ®qš¾užÂp™½i’¶qš¾qš¾tÁz£Çf³r›¿i’¶X¥cŒ°sœÀW€¤m–ºz£Ç`‰­y¢ÆaŠ®x¡ÅvŸÃz£Çqš¾h‘µg´užÂi’¶b‹¯^‡«[„¨qš¾{¤ÈtÁr›¿Y‚¦užÂcŒ°e޲cŒ°e޲W€¤`‰­Y‚¦sœÀw ÄW€¤y¢Æm–ºg´tÁy¢Æz£Çm–º{¤ÈtÁužÂk”¸b‹¯`‰­Y‚¦Y‚¦qš¾W€¤d±e޲Zƒ§\…©X¥_ˆ¬f³l•¹tÁ]†ª_ˆ¬aŠ®z£Çp™½x¡Å`‰­tÁn—»k”¸r›¿m–ºw Äm–ºo˜¼{¤ÈcŒ°y¢ÆvŸÃz£Ç{¤ÈcŒ°e޲f³vŸÃh‘µ_ˆ¬k”¸p™½aŠ®[„¨sœÀf³užÂ_ˆ¬`‰­n—»sœÀ`‰­sœÀužÂr›¿W€¤d±e޲vŸÃl•¹\…©z£Çx¡Åz£Çm–º{¤È`‰­i’¶r›¿vŸÃm–ºužÂaŠ®m–ºcŒ°k”¸f³tÁ^‡«[„¨r›¿sœÀh‘µw ÄW€¤y¢ÆY‚¦r›¿j“·e޲qš¾{¤ÈtÁr›¿Y‚¦užÂcŒ°e޲cŒ°e޲W€¤`‰­Y‚¦sœÀw ÄW€¤y¢Æm–ºg´tÁy¢Æz£Çm–ºZƒ§Zƒ§Zƒ§[„¨x¡Åy¢Æj“·Zƒ§_ˆ¬Zƒ§j“·i’¶[„¨Zƒ§y¢Æh‘µ^‡«l•¹{¤Èj“·\…©Zƒ§tÁZƒ§f³{¤Èn—»\…©o˜¼qš¾x¡Åj“·h‘µi’¶o˜¼x¡Åi’¶f³b‹¯x¡ÅsœÀo˜¼cŒ°e޲sœÀW€¤^‡«sœÀ\…©_ˆ¬[„¨j“·qš¾p™½w Ä^‡«^‡«p™½o˜¼z£Çf³]†ªj“·Zƒ§X¥z£ÇvŸÃi’¶]†ªf³užÂd±cŒ°vŸÃi’¶k”¸n—»f³[„¨j“·{¤Èf³d±W€¤b‹¯W€¤Zƒ§\…©z£Çe޲sœÀ`‰­cŒ°vŸÃj“·`‰­_ˆ¬z£Çj“·]†ªe޲x¡ÅvŸÃz£Çe޲n—»e޲n—»\…©^‡«[„¨qš¾f³j“·b‹¯\…©p™½m–ºj“·k”¸r›¿l•¹aŠ®\…©g´h‘µf³x¡Åp™½_ˆ¬r›¿e޲cŒ°k”¸sœÀcŒ°n—»tÁ^‡«[„¨r›¿sœÀh‘µw ÄW€¤y¢ÆY‚¦r›¿j“·e޲r›¿g´h‘µx¡Åj“·b‹¯g´b‹¯z£ÇužÂ]†ªaŠ®Y‚¦^‡«p™½aŠ®i’¶`‰­qš¾o˜¼e޲qš¾\…©g´b‹¯Zƒ§g´o˜¼b‹¯d±]†ªZƒ§z£Çd±cŒ°h‘µw Äp™½]†ªo˜¼vŸÃe޲Zƒ§X¥g´z£Ç_ˆ¬w ÄcŒ°{¤Èh‘µz£Çk”¸j“·o˜¼sœÀ_ˆ¬y¢Æg´w Äz£Çh‘µtÁm–ºp™½l•¹qš¾i’¶p™½m–ºaŠ®tÁ{¤ÈW€¤užÂb‹¯k”¸sœÀsœÀsœÀb‹¯f³j“·k”¸p™½]†ªtÁ{¤ÈtÁ_ˆ¬z£ÇY‚¦`‰­l•¹[„¨qš¾Zƒ§w Ä]†ªd±[„¨j“·Zƒ§vŸÃtÁcŒ°l•¹sœÀg´\…©r›¿f³o˜¼i’¶_ˆ¬užÂvŸÃb‹¯\…©g´e޲tÁY‚¦g´aŠ®z£Çm–ºtÁd±f³y¢Æo˜¼`‰­`‰­l•¹z£Ç{¤Èy¢Æ\…©r›¿Y‚¦{¤ÈaŠ®qš¾z£ÇX¥]†ªf³\…©p™½p™½p™½w ÄZƒ§w Äh‘µcŒ°r›¿m–ºvŸÃb‹¯aŠ®z£Çr›¿_ˆ¬k”¸j“·j“·m–ºn—»e޲cŒ°i’¶Zƒ§y¢Æx¡ÅtÁw Äl•¹g´o˜¼l•¹aŠ®tÁ\…©\…©h‘µp™½]†ªz£ÇužÂvŸÃb‹¯\…©g´e޲tÁY‚¦g´aŠ®z£Çm–ºtÁd±f³y¢Æo˜¼`‰­`‰­l•¹z£Çk”¸w Äp™½k”¸p™½užÂy¢ÆcŒ°z£Çf³n—»qš¾p™½m–ºqš¾{¤È`‰­_ˆ¬p™½^‡«\…©h‘µe޲e޲Zƒ§p™½d±f³]†ªw ÄsœÀo˜¼cŒ°p™½^‡«[„¨l•¹užÂsœÀp™½z£Çg´_ˆ¬p™½y¢Æw Ä_ˆ¬e޲qš¾tÁ{¤È^‡«e޲{¤ÈX¥y¢Æd±qš¾užÂg´l•¹f³tÁm–ºvŸÃy¢Æh‘µh‘µ{¤Èk”¸z£Çi’¶užÂk”¸aŠ®vŸÃz£Çr›¿l•¹aŠ®qš¾užÂp™½i’¶qš¾qš¾tÁz£Çf³r›¿i’¶X¥cŒ°sœÀW€¤m–ºZƒ§p™½X¥i’¶_ˆ¬n—»vŸÃaŠ®k”¸cŒ°Y‚¦qš¾y¢Æd±\…©_ˆ¬[„¨z£Çj“·tÁo˜¼w Äm–ºo˜¼{¤ÈcŒ°y¢ÆvŸÃz£Ç{¤ÈcŒ°e޲W€¤y¢Æm–ºg´tÁy¢Æz£Çm–ºZƒ§Zƒ§Zƒ§[„¨x¡Åy¢Æj“·Zƒ§_ˆ¬tÁw Äp™½p™½e޲b‹¯r›¿l•¹`‰­b‹¯^‡«_ˆ¬i’¶sœÀh‘µm–ºg´_ˆ¬e޲{¤ÈX¥užÂvŸÃj“·aŠ®X¥]†ªužÂm–ºg´r›¿e޲e޲_ˆ¬\…©z£Çn—»Y‚¦f³tÁl•¹n—»qš¾]†ªqš¾X¥j“·h‘µm–ºcŒ°cŒ°x¡Å`‰­g´cŒ°Zƒ§w Äg´sœÀb‹¯h‘µz£ÇW€¤tÁb‹¯d±r›¿aŠ®i’¶o˜¼_ˆ¬[„¨tÁz£ÇcŒ°i’¶Y‚¦d±i’¶m–ºz£Çl•¹`‰­y¢ÆY‚¦vŸÃe޲Zƒ§x¡Ål•¹k”¸f³e޲tÁ{¤Èf³_ˆ¬e޲n—»vŸÃw ÄaŠ®]†ª^‡«x¡Åg´h‘µg´]†ªy¢Æe޲_ˆ¬vŸÃ\…©k”¸e޲x¡Å^‡«^‡«k”¸\…©tÁr›¿x¡Å_ˆ¬o˜»sœÀcŒ°m–º{¤Èm–ºp™½r›¿h‘µm–ºcŒ°aŠ®cŒ°Zƒ§l•¹W€¤cŒ°cŒ°i’¶d±užÂvŸÃ^‡«`‰­k”¸y¢Æw Ä[„¨k‘³d±\x<O`Pfz(-2b†¥Y‚¦o˜¼w Äb‹¯cŒ°d±vŸÃw Än—»Y‚¦l•¹p™½_ˆ¬[„¨g´sœÀb‹¯tÁ[„¨j“·r›¿[„¨r›¿y¢Æ^‡«CZm1<E###"%''''4CP\…©qš¾]†ª[„¨i’¶r›¿g´k”¸sœÀqš¾qš¾Y‚¦{¤Èk”¸w Äb‹¯_ˆ¬`‰­X¥cŒ°h‘µh‘µl•¹[„¨j“·(-0 333HHHFFF(((!!!EEECDDAAAn—»W€¤X¥[„¨g´h‘µW€¤W€¤qš¾l•¹r›¿g´k”¸\…©cŒ°W€¤X¥z£Çg´^‡«X¥cŒ°DXjBBB]]]AAA999IIIKJJGHHMMMX¥cŒ°j“·^‡«l•¹x¡Åx¡Å^‡«[„¨d±qš¾m–º_ˆ¬aŠ®n—»j“·cŒ°[„¨j“·W€¤X¥III>>>GGGUUU999(((POPTSSSTSSTSMMMh‘µr›¿`‰­i’¶X¥X¥vŸÃe޲w Ä\…©y¢Æ]†ª{¤ÈvŸÃg´qš¾X¥cŒ°n—»MMMSTS'''&&&===GGG***!!!abb^^]^^^STTSTSMMMn—ºW€¤Ps‘[„¨b‹¯x¡Åe޲cŒ°tÁtÁ_ˆ¬{¤Èr›¿W€¤i’¶W€¤X¥MMMSTSSTT^^^///DDD:::///kklmmm^^^^^^STTEEEFFF9L\$&(CWh^‡«Y‚¦d±m–º{¤Èw ÄužÂo˜¼X¥\…©{¤Èn—»MMMSTSSTT^^^^^^AAA!!!777'''222zyzzzymmmVVV^^^)))*** `‰­Y‚¦j“·sœÀi’¶r›¿o˜¼k”¸[„¨p™½aŠ®AABHHHSTT^^^^^^mmmzzy555 ---Љ‰†……zzy<<<'''(((888GGG777c‡§h‘µy¢Æx¡Åz£Çg´vŸÃf³f³w Äm–ºDCCKJKSTT^^^mmmzzyЉ‰rrr))) ]]]•••feeEEE"""555888[[[RRROOONdwd±_ˆ¬l•¹[„¨užÂvŸÃ^‡«p™½x¡Åw ÄEEE@@@VVV\\[mmmyyzЉ‰•••kkk ZZZ000333KKK@@@XXX???JJJ%%%%'*e޲X¥`‰­l•¹l•¹j“·r›¿r›¿[{—Tn…###(((###9:9'''WWW+++kjk+++ """888%%%333///...).2h‘µužÂd±e޲f³qš¾[„¨n—»*29---***999&&&999&&& +++zyz888UUU-,-333***$$$&&&TqŠPj‚]†ªm–º`‰­sœÀ`‰­l•¹b‹¯y¢Æ7BL!!!DDDBBB[[[BBBIII:::%%%ggg''' RRR•••Љ‰vwwnnmVVVWWW>>>EEEl•¹k”¸_ˆ¬_ˆ¬g´z£Ç]†ªk”¸`‰­i’¶cƒŸFFFYYYWWW>>>222&&&NNNVVV•••vvv !!!```Љ‰zzymmm^^^SSSKKJDDCW€¤l•¹Y‚¦tÁi’¶qš¾W€¤\…©f³e޲užÂ000GGG222---+++444zzy„ƒƒŠ‰‰444zzymmm^^^^^^STSGHHAABf³W€¤o˜¼b‹¯h‘µ]†ªy¢ÆcŒ°\…©e޲`‰­%'(((("""$%%ZZZTTTmmmzzyzyzKKK###999$$$777^^^^^^STTSTSMMMn—»m–ºf³w ÄužÂz£Çx¡Åj“·f³g´y¢Æqš¾Zu%'(@Xl@@@BCBSTT^^^^^^mmmnmm333333CCC888[[[STTSTSMMMX¥n—»b‹¯m–ºj“·n—»p™½i’¶d±m–º{¤ÈaŠ®k”¸r›¿gް[„¨@@@MMMSTSSTT^^^^]^abb)))$$$HHH???+++###QRQMMM@@@X¥W€¤o˜¼b‹¯Y‚¦p™½[„¨^‡«]†ªe޲aŠ®i’¶Zƒ§y¢Æ`‰­r›¿@@@@@@MMMSTSSTSTTSVWV111666LLLPPPDDD>>>@@@@@@cŒ°X¥n—»o˜¼aŠ®j“·k”¸Y‚¦r›¿[„¨vŸÃw Ä[„¨r›¿^‡«j“·@@@@@@@@@MMMHHGJJKMMM 000>>>ccc@@@$$$5?G@@@@@@j“·[„¨m–ºn—»qš¾vŸÃf³h‘µZƒ§\…©sœÀaŠ®f³e޲h‘µ[„¨@@@@@@@@@@@@ABBCCCEEE)))###EEEFFF777!!! !!@@@@@@^‡«h‘µo˜¼m–ºr›¿`‰­{¤ÈsœÀvŸÃX¥W€¤\…©aŠ®[„¨sœÀi’¶@@@@@@@@@@@@@@@@@@@@@555###"""!!!***...@@@@@@Y‚¦{¤Èi’¶o˜¼z£ÇW€¤o˜¼b‹¯vŸÃtÁp™½^‡«aŠ®[„¨sœÀi’¶@@@@@@@@@@@@@@@@@@@@@>>>'''...+++888@@@===@@@@@@Y‚¦{¤Èi’¶r›¿k”¸Y‚¦o˜¼y¢Æk”¸\…©aŠ®^‡«b‹¯vŸÃužÂ`‰­@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@e޲i’¶b‹¯sœÀ^‡«^‡«l•¹cŒ°p™½k”¸w Äqš¾e޲Zƒ§_ˆ¬X¥@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@qš¾cŒ°z£Çj“·W€¤qš¾f³^‡«b‹¯h‘µ]†ª\…©W€¤e޲m–ºd±@@@@@@@@@@@@• ¥  ¥ °µ°°µ° ¥  ¥ •@@@@@@@@@@@@l•¹j“·\…©m–ºužÂf³vŸÃj“·l•¹f³p™½j“·n—»užÂk”¸{¤È@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@r›¿f³vŸÃ_ˆ¬^‡«aŠ®vŸÃl•¹_ˆ¬{¤Èr›¿W€¤i’¶n—»_ˆ¬f³@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@m–º]†ªo˜¼Y‚¦d±m–º{¤ÈaŠ®p™½X¥f³r›¿x¡Ån—»w Äd±@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@qš¾vŸÃcŒ°`‰­p™½o˜¼]†ª[„¨^‡«]†ªm–º^‡«qš¾užÂ^‡«k”¸@@@@@@pup€…€• ¥  ¥ °µ°°µ° ¥  ¥ •€…€pup@@@@@@l•¹]†ªcŒ°aŠ®o˜¼p™½\…©g´`‰­sœÀo˜¼tÁi’¶^‡«]†ªaŠ®{¤Èm–ºY‚¦qš¾m–ºl•¹h‘µk”¸Zƒ§\…©h‘µn—»b‹¯b‹¯y¢ÆY‚¦i’¶]†ªo˜¼tÁx¡Åk”¸`‰­r›¿w ÄužÂW€¤n—»]†ªw Äh‘µd±i’¶o˜¼n—»aŠ®n—»y¢Æy¢Æx¡Åf³užÂl•¹]†ªY‚¦p™½_ˆ¬k”¸p™½j“·l•¹X¥e޲w Äg´]†ªp™½cŒ°W€¤i’¶d±f³n—»W€¤y¢Æb‹¯Zƒ§n—»r›¿X¥tÁg´{¤Èb‹¯\…©l•¹r›¿\…©b‹¯\…©w ÄZƒ§m–ºo˜¼tÁo˜¼^‡«w ÄcŒ°w Ä{¤Èi’¶Zƒ§o˜¼z£ÇcŒ°qš¾h‘µd±tÁk”¸`‰­d±w Äg´y¢Æ{¤Èw Äo˜¼l•¹z£ÇY‚¦tÁo˜¼W€¤n—»vŸÃX¥z£ÇvŸÃužÂqš¾y¢Æ_ˆ¬j“·W€¤k”¸Y‚¦m–ºvŸÃj“·d±n—»e޲W€¤qš¾n—»x¡Åqš¾d±p™½cŒ°W€¤i’¶d±f³n—»W€¤y¢Æb‹¯Zƒ§n—»Zƒ§tÁ^‡«W€¤h‘µ^‡«k”¸n—»l•¹]†ª{¤Èl•¹z£ÇtÁy¢ÆcŒ°{¤È`‰­`‰­j“·g´j“·`‰­k”¸vŸÃ[„¨Y‚¦x¡Åb‹¯h‘µX¥qš¾_ˆ¬cŒ°_ˆ¬f³sœÀužÂj“·^‡«[„¨]†ªo˜¼y¢Æf³i’¶r›¿_ˆ¬qš¾Y‚¦l•¹p™½tÁvŸÃh‘µn—»{¤Èx¡Åg´y¢Æm–ºX¥W€¤cŒ°k”¸Y‚¦e޲y¢Æd±cŒ°Y‚¦qš¾]†ªg´]†ªZƒ§i’¶b‹¯qš¾Y‚¦cŒ°k”¸Zƒ§^‡«l•¹sœÀz£Çm–ºcŒ°j“·`‰­\…©y¢Æ^‡«o˜¼X¥y¢Æ^‡«_ˆ¬h‘µy¢Æi’¶o˜¼e޲\…©l•¹^‡«sœÀh‘µsœÀaŠ®sœÀe޲b‹¯m–ºd±n—»Y‚¦n—»o˜¼`‰­i’¶cŒ°\…©w ÄužÂW€¤n—»z£Çr›¿_ˆ¬k”¸j“·j“·m–ºn—»e޲cŒ°i’¶Zƒ§y¢Æx¡ÅtÁw Äl•¹d±]†ª`‰­W€¤]†ª`‰­d±e޲w Äi’¶o˜¼]†ªcŒ°Y‚¦aŠ®Y‚¦X¥l•¹m–º^‡«užÂk”¸sœÀg´g´h‘µ[„¨f³i’¶l•¹w Ä{¤ÈaŠ®e޲h‘µz£Çx¡ÅcŒ°f³sœÀX¥užÂqš¾y¢Æ_ˆ¬j“·W€¤aŠ®m–ºcŒ°k”¸f³tÁ^‡«[„¨r›¿sœÀh‘µw ÄW€¤y¢ÆY‚¦r›¿j“·e޲r›¿g´h‘µx¡Åj“·b‹¯g´b‹¯z£ÇužÂ]†ªaŠ®Y‚¦^‡«]†ªb‹¯l•¹{¤ÈX¥\…©vŸÃp™½p™½_ˆ¬`‰­X¥k”¸tÁz£Ço˜¼vŸÃm–ºg´_ˆ¬z£Çh‘µqš¾g´n—»k”¸Y‚¦^‡«o˜¼^‡«Y‚¦sœÀl•¹sœÀk”¸\…©i’¶_ˆ¬z£Çj“·vŸÃw Äm–ºw ÄvŸÃw Ä\…©[„¨W€¤e޲sœÀX¥užÂZƒ§d±qš¾w ÄW€¤z£ÇW€¤k”¸f³`‰­z£ÇW€¤j“·g´d±h‘µtÁužÂg´Zƒ§užÂk”¸i’¶d±h‘µr›¿{¤Èx¡Åh‘µaŠ®_ˆ¬k”¸y¢Æ]†ªn—»tÁcŒ°aŠ®e޲n—»Y‚¦qš¾{¤È`‰­i’¶[„¨qš¾aŠ®r›¿d±Zƒ§o˜¼qš¾n—»tÁZƒ§n—»f³f³tÁw ÄY‚¦užÂz£ÇaŠ®x¡Åf³h‘µh‘µg´]†ªk”¸h‘µtÁh‘µ_ˆ¬W€¤b‹¯h‘µh‘µY‚¦cŒ°d±i’¶^‡«]†ªn—»o˜¼p™½z£Ç`‰­Y‚¦z£ÇsœÀl•¹vŸÃb‹¯n—»X¥l•¹sœÀW€¤k”¸sœÀZƒ§z£Çb‹¯n—»W€¤e޲r›¿tÁ]†ªZƒ§z£Çqš¾h‘µg´užÂi’¶b‹¯^‡«[„¨qš¾{¤ÈtÁr›¿Y‚¦užÂcŒ°e޲cŒ°e޲W€¤`‰­Y‚¦sœÀw ÄW€¤y¢Æi’¶[„¨^‡«vŸÃ\…©W€¤Y‚¦i’¶Zƒ§]†ªužÂqš¾aŠ®p™½b‹¯X¥m–ºužÂZƒ§{¤ÈtÁn—»d±cŒ°j“·[„¨vŸÃx¡ÅaŠ®r›¿r›¿W€¤o˜¼w Äk”¸užÂe޲r›¿[„¨tÁ]†ªZƒ§r›¿z£Çi’¶z£Ço˜¼`‰­[„¨d±b‹¯p™½l•¹j“·]†ª]†ªx¡Åx¡Åp™½vŸÃo˜¼`‰­n—»užÂb‹¯k”¸sœÀsœÀsœÀb‹¯f³j“·f³aŠ®g´i’¶r›¿b‹¯tÁj“·b‹¯z£ÇW€¤vŸÃg´cŒ°sœÀ^‡«cŒ°Y‚¦m–ºe޲]†ªe޲z£Çm–ºY‚¦užÂW€¤Y‚¦Y‚¦b‹¯b‹¯n—»Zƒ§cŒ°sœÀx¡ÅtÁz£Çj“·\…©_ˆ¬Y‚¦n—»n—»m–ºvŸÃy¢Æh‘µh‘µ{¤Èk”¸z£Çi’¶užÂk”¸[„¨Y‚¦x¡Åb‹¯h‘µX¥qš¾m–ºd±\…©[„¨\…©x¡ÅtÁZƒ§vŸÃk”¸sœÀf³m–º[„¨r›¿^‡«e޲Zƒ§f³x¡Åb‹¯[„¨z£Çh‘µo˜¼i’¶w Äi’¶vŸÃn—»cŒ°p™½X¥W€¤cŒ°k”¸Y‚¦e޲y¢Æd±cŒ°Y‚¦qš¾]†ªg´]†ªZƒ§i’¶b‹¯qš¾Y‚¦cŒ°k”¸Zƒ§^‡«l•¹sœÀd±x¡Å^‡«y¢Æ{¤ÈZƒ§cŒ°p™½^‡«[„¨l•¹užÂsœÀp™½z£Çg´_ˆ¬p™½y¢Æw Ä_ˆ¬e޲qš¾tÁ{¤È^‡«e޲{¤ÈX¥y¢Æd±qš¾`‰­\…©Y‚¦b‹¯g´W€¤p™½g´X¥b‹¯užÂd±]†ªY‚¦^‡«m–ºužÂaŠ®užÂf³o˜¼W€¤Zƒ§j“·i’¶[„¨Zƒ§y¢Æh‘µ^‡«l•¹{¤È`‰­e޲j“·_ˆ¬^‡«x¡Å[„¨užÂn—»w Ä]†ªr›¿Zƒ§`‰­z£ÇvŸÃj“·`‰­z£Çd±tÁ]†ªd±x¡ÅZƒ§g´j“·qš¾`‰­_ˆ¬i’¶r›¿x¡Åk”¸r›¿j“·e޲`‰­{¤ÈaŠ®p™½w ÄW€¤Y‚¦k”¸l•¹\…©l•¹`‰­^‡«y¢Æ\…©W€¤k”¸h‘µf³tÁqš¾tÁ^‡«X¥užÂvŸÃcŒ°x¡Åw Äh‘µW€¤x¡Åo˜¼p™½{¤È\…©tÁvŸÃl•¹\…©z£Çx¡Åz£Çm–º{¤È`‰­i’¶r›¿vŸÃm–ºužÂaŠ®m–ºcŒ°k”¸f³tÁ^‡«[„¨tÁn—»z£ÇY‚¦qš¾g´{¤ÈaŠ®[„¨užÂX¥Zƒ§g´]†ªužÂcŒ°Y‚¦g´f³k”¸i’¶f³b‹¯b‹¯{¤È{¤Èi’¶i’¶p™½n—»`‰­X¥i’¶b‹¯\…©n—»{¤Èb‹¯w ÄaŠ®cŒ°n—»m–º[„¨j“·užÂm–ºW€¤x¡Åx¡Åy¢Æd±o˜¼tÁb‹¯j“·h‘µy¢ÆužÂ]†ªn—»x¡ÅtÁy¢Æh‘µw Äz£ÇužÂi’¶sœÀ`‰­e޲d±aŠ®\…©aŠ®^‡«^‡«qš¾[„¨y¢ÆY‚¦vŸÃm–ºqš¾^‡«\…©w Äp™½z£Çk”¸tÁsœÀk”¸{¤ÈcŒ°k”¸p™½j“·l•¹X¥e޲w Äg´]†ªx¡Åk”¸r›¿j“·e޲`‰­{¤ÈaŠ®p™½w ÄW€¤Y‚¦k”¸l•¹\…©l•¹`‰­^‡«y¢Æ\…©W€¤k”¸h‘µb‹¯d±]†ªZƒ§z£Çd±cŒ°h‘µw Äp™½]†ªo˜¼vŸÃe޲Zƒ§X¥g´z£Ç_ˆ¬w ÄcŒ°{¤Èh‘µj“·d±Zƒ§y¢Æe޲Zƒ§cŒ°`‰­e޲^‡«y¢Æ{¤ÈZƒ§cŒ°p™½^‡«[„¨l•¹užÂsœÀp™½z£Çg´_ˆ¬p™½y¢Æw Ä_ˆ¬e޲qš¾tÁ{¤È^‡«e޲{¤ÈX¥y¢Æd±qš¾užÂg´Y‚¦g´qš¾f³y¢Æz£ÇužÂZƒ§p™½W€¤z£Çqš¾k”¸e޲i’¶vŸÃn—»k”¸r›¿W€¤Y‚¦užÂ_ˆ¬Zƒ§sœÀW€¤p™½n—»{¤Èb‹¯w Äd±{¤Èx¡Åy¢Æ_ˆ¬w Äx¡Åb‹¯\…©W€¤x¡ÅY‚¦i’¶k”¸d±_ˆ¬f³f³`‰­sœÀo˜¼tÁi’¶^‡«]†ªaŠ®{¤Èm–ºY‚¦qš¾m–ºl•¹h‘µx¡Åk”¸r›¿j“·e޲`‰­{¤ÈaŠ®p™½w ÄW€¤Y‚¦k”¸l•¹\…©l•¹`‰­^‡«y¢Æ\…©W€¤k”¸h‘µf³tÁqš¾tÁ^‡«X¥užÂvŸÃcŒ°z£Çi’¶užÂk”¸aŠ®vŸÃz£Çr›¿l•¹aŠ®qš¾užÂp™½i’¶qš¾qš¾tÁz£Çf³r›¿i’¶X¥cŒ°sœÀW€¤m–ºz£Ç`‰­y¢ÆaŠ®x¡ÅvŸÃz£Çqš¾h‘µg´užÂi’¶b‹¯^‡«[„¨qš¾{¤ÈtÁr›¿Y‚¦užÂcŒ°e޲cŒ°e޲W€¤`‰­Y‚¦sœÀw ÄW€¤y¢Æm–ºg´tÁy¢Æz£Çm–º{¤ÈtÁužÂk”¸b‹¯`‰­Y‚¦Y‚¦qš¾W€¤d±e޲Zƒ§\…©X¥_ˆ¬f³l•¹tÁ]†ª_ˆ¬aŠ®z£Çp™½x¡Å`‰­tÁn—»k”¸r›¿m–ºw Äm–ºo˜¼{¤ÈcŒ°y¢ÆvŸÃz£Ç{¤ÈcŒ°e޲f³vŸÃh‘µ_ˆ¬k”¸p™½aŠ®[„¨sœÀf³užÂ_ˆ¬`‰­n—»sœÀ`‰­sœÀužÂr›¿W€¤d±e޲vŸÃl•¹\…©z£Çx¡Åz£Çm–º{¤È`‰­i’¶r›¿vŸÃm–ºužÂaŠ®m–ºcŒ°k”¸f³tÁ^‡«[„¨r›¿sœÀh‘µw ÄW€¤y¢ÆY‚¦r›¿j“·e޲qš¾{¤ÈtÁr›¿Y‚¦užÂcŒ°e޲cŒ°e޲W€¤`‰­Y‚¦sœÀw ÄW€¤y¢Æm–ºg´tÁy¢Æz£Çm–ºZƒ§Zƒ§Zƒ§[„¨x¡Åy¢Æj“·Zƒ§_ˆ¬Zƒ§j“·i’¶[„¨Zƒ§y¢Æh‘µ^‡«l•¹{¤Èj“·\…©Zƒ§tÁZƒ§f³{¤Èn—»\…©o˜¼qš¾x¡Åj“·h‘µi’¶o˜¼x¡Åi’¶f³b‹¯x¡ÅsœÀo˜¼cŒ°e޲sœÀW€¤^‡«sœÀ\…©_ˆ¬[„¨j“·qš¾p™½w Ä^‡«^‡«p™½o˜¼z£Çf³]†ªj“·Zƒ§X¥z£ÇvŸÃi’¶]†ªf³užÂd±cŒ°vŸÃi’¶k”¸n—»f³[„¨j“·{¤Èf³d±W€¤b‹¯W€¤Zƒ§\…©z£Çe޲sœÀ`‰­cŒ°vŸÃj“·`‰­_ˆ¬z£Çj“·]†ªe޲x¡ÅvŸÃz£Çe޲n—»e޲n—»\…©^‡«[„¨qš¾f³j“·b‹¯\…©p™½m–ºj“·k”¸r›¿l•¹aŠ®\…©g´h‘µf³x¡Åp™½_ˆ¬r›¿e޲cŒ°k”¸sœÀcŒ°n—»tÁ^‡«[„¨r›¿sœÀh‘µw ÄW€¤y¢ÆY‚¦r›¿j“·e޲r›¿g´h‘µx¡Åj“·b‹¯g´b‹¯z£ÇužÂ]†ªaŠ®Y‚¦^‡«p™½aŠ®i’¶`‰­qš¾o˜¼e޲qš¾\…©g´b‹¯Zƒ§g´o˜¼b‹¯d±]†ªZƒ§z£Çd±cŒ°h‘µw Äp™½]†ªo˜¼vŸÃe޲Zƒ§X¥g´z£Ç_ˆ¬w ÄcŒ°{¤Èh‘µz£Çk”¸j“·o˜¼sœÀ_ˆ¬y¢Æg´w Äz£Çh‘µtÁm–ºp™½l•¹qš¾i’¶p™½m–ºaŠ®tÁ{¤ÈW€¤užÂb‹¯k”¸sœÀsœÀsœÀb‹¯f³j“·k”¸p™½]†ªtÁ{¤ÈtÁ_ˆ¬z£ÇY‚¦`‰­l•¹[„¨qš¾Zƒ§w Ä]†ªd±[„¨j“·Zƒ§vŸÃtÁcŒ°l•¹sœÀg´\…©r›¿f³o˜¼i’¶_ˆ¬užÂvŸÃb‹¯\…©g´e޲tÁY‚¦g´aŠ®z£Çm–ºtÁd±f³y¢Æo˜¼`‰­`‰­l•¹z£Ç{¤Èy¢Æ\…©r›¿Y‚¦{¤ÈaŠ®qš¾z£ÇX¥]†ªf³\…©p™½p™½p™½w ÄZƒ§w Äh‘µcŒ°r›¿m–ºvŸÃb‹¯aŠ®z£Çr›¿_ˆ¬k”¸j“·j“·m–ºn—»e޲cŒ°i’¶Zƒ§y¢Æx¡ÅtÁw Äl•¹g´o˜¼l•¹aŠ®tÁ\…©\…©h‘µp™½]†ªz£ÇužÂvŸÃb‹¯\…©g´e޲tÁY‚¦g´aŠ®z£Çm–ºtÁd±f³y¢Æo˜¼`‰­`‰­l•¹z£Çk”¸w Äp™½k”¸p™½užÂy¢ÆcŒ°z£Çf³n—»qš¾p™½m–ºqš¾{¤È`‰­_ˆ¬p™½^‡«\…©h‘µe޲e޲Zƒ§p™½d±f³]†ªw ÄsœÀo˜¼cŒ°p™½^‡«[„¨l•¹užÂsœÀp™½z£Çg´_ˆ¬p™½y¢Æw Ä_ˆ¬e޲qš¾tÁ{¤È^‡«e޲{¤ÈX¥y¢Æd±qš¾užÂg´l•¹f³tÁm–ºvŸÃy¢Æh‘µh‘µ{¤Èk”¸z£Çi’¶užÂk”¸aŠ®vŸÃz£Çr›¿l•¹aŠ®qš¾užÂp™½i’¶qš¾qš¾tÁz£Çf³r›¿i’¶X¥cŒ°sœÀW€¤m–ºZƒ§p™½X¥i’¶_ˆ¬n—»vŸÃaŠ®k”¸cŒ°Y‚¦qš¾y¢Æd±\…©_ˆ¬[„¨z£Çj“·tÁo˜¼w Äm–ºo˜¼{¤ÈcŒ°y¢ÆvŸÃz£Ç{¤ÈcŒ°e޲W€¤y¢Æm–ºg´tÁy¢Æz£Çm–ºZƒ§Zƒ§Zƒ§[„¨x¡Åy¢Æj“·Zƒ§_ˆ¬tÁw Äp™½p™½e޲b‹¯r›¿l•¹`‰­b‹¯^‡«_ˆ¬i’¶sœÀh‘µm–ºg´_ˆ¬e޲{¤ÈX¥užÂvŸÃj“·aŠ®X¥]†ªužÂm–ºg´r›¿e޲e޲_ˆ¬\…©z£Çn—»Y‚¦f³tÁl•¹n—»qš¾]†ªqš¾X¥j“·h‘µm–ºcŒ°cŒ°x¡Å`‰­g´cŒ°Zƒ§w Äg´sœÀb‹¯h‘µz£ÇW€¤tÁb‹¯d±r›¿aŠ®i’¶o˜¼_ˆ¬[„¨tÁz£ÇcŒ°i’¶Y‚¦d±i’¶m–ºz£Çl•¹`‰­y¢ÆY‚¦vŸÃe޲Zƒ§x¡Ål•¹k”¸f³e޲tÁ{¤Èf³_ˆ¬e޲n—»vŸÃw ÄaŠ®]†ª^‡«x¡Åg´h‘µg´]†ªy¢Æe޲
/programs/games/tetris/trunk/tetris.asm
220,7 → 220,7
jmp still
 
end_program:
mov eax,-1 ; close this program
or eax,-1 ; close this program
int 0x40
 
go_new_game:
/programs/media/xpaint/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/xpaint/trunk/ascgml.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/xpaint/trunk/ascgl.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/xpaint/trunk/xpaint.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/xpaint/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/xpaint/trunk/ascml.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/xpaint/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/xpaint/trunk/ascl.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/pci.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/codec.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/ac97wav/trunk/meosfunc.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/frontend.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/ac97wav/trunk/ac97.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/debug.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/includes.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/ac97wav.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97wav/trunk/constant.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/cdplay/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/cdplay/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/cdplay/trunk/cdplay.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/cdplay/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/ac97 mp3/trunk/ac97wav.h
File deleted
/programs/media/ac97 mp3/trunk/crt.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/window.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3sf.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/e_pow.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/windowb.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3msis.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/fdct.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3hybrid.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.h
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3side.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3quant.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3huff.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/math_private.h
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3alias.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/sbt.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l1dec.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l2dec.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3dec.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/sbtb.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.vcproj
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3huff.h
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/bstream.c
File deleted
\ No newline at end of file
/programs/media/ac97 mp3/trunk/mp3dec/PROC32.INC
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/imdct.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l1init.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l2init.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/l3init.c
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/bstream.h
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/pow.asm
File deleted
/programs/media/ac97 mp3/trunk/mp3dec/layer3.h
File deleted
/programs/media/ac97 mp3/trunk/ac97.sln
File deleted
/programs/media/ac97 mp3/trunk/crt.h
File deleted
/programs/media/ac97 mp3/trunk/k_lib.asm
File deleted
/programs/media/ac97 mp3/trunk/PROC32.INC
File deleted
/programs/media/ac97 mp3/trunk/kolibri.h
File deleted
/programs/media/ac97 mp3/trunk/ac97wav.c
File deleted
/programs/media/scrshot/trunk/readme.txt
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/scrshot/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/scrshot/trunk/scrshot.asm
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/scrshot/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/scrshot/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/scrshot/trunk/ascl.inc
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/bmpview/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/bmpview/trunk/bmpview.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/bmpview/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/bmpview/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/vscreen/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/vscreen/trunk/vscreen.asm
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/media/vscreen/trunk/build_en.bat
File deleted
\ No newline at end of file
/programs/media/vscreen/trunk/build_ru.bat
File deleted
\ No newline at end of file
/programs/media/ac97snd/trunk/PROC32.INC
0,0 → 1,268
 
; Macroinstructions for defining and calling procedures
 
macro stdcall proc,[arg] ; directly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call proc }
 
macro invoke proc,[arg] ; indirectly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call [proc] }
 
macro ccall proc,[arg] ; directly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call proc
if size@ccall
add esp,size@ccall
end if }
 
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call [proc]
if size@ccall
add esp,size@ccall
end if }
 
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
 
prologue@proc equ prologuedef
 
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,localbytes
end if
end if
irps reg, reglist \{ push reg \} }
 
epilogue@proc equ epiloguedef
 
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
{ irps reg, reglist \{ reverse pop reg \}
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if }
 
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
match =stdcall args, statement \{ params equ args
flag = 11b \}
match =stdcall, statement \{ params equ
flag = 11b \}
match =c args, statement \{ params equ args
flag = 10001b \}
match =c, statement \{ params equ
flag = 10001b \}
match =params, params \{ params equ statement
flag = 0 \}
virtual at ebp+8
match =uses reglist=,args, params \{ regs equ reglist
params equ args \}
match =regs =uses reglist, regs params \{ regs equ reglist
params equ \}
match =regs, regs \{ regs equ \}
match =,args, params \{ defargs@proc args \}
match =args@proc args, args@proc params \{ defargs@proc args \}
parmbytes = $ - (ebp+8)
end virtual
name # % = parmbytes/4
all@vars equ
current = 0
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
macro locals
\{ virtual at ebp-localbytes+current
macro label . \\{ deflocal@proc .,:, \\}
struc db [val] \\{ \common deflocal@proc .,db,val \\}
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
macro endl
\{ purge label
restruc db,dw,dp,dd,dt,dq
restruc rb,rw,rp,rd,rt,rq
restruc byte,word,dword,pword,tword,qword
current = $-(ebp-localbytes)
end virtual \}
macro ret operand
\{ match any, operand \\{ retn operand \\}
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
end if \} }
 
macro defargs@proc [arg]
{ common
if ~ arg eq
forward
local ..arg,current@arg
match argname:type, arg
\{ current@arg equ argname
label ..arg type
argname equ ..arg
if dqword eq type
dd ?,?,?,?
else if tbyte eq type
dd ?,?,?
else if qword eq type | pword eq type
dd ?,?
else
dd ?
end if \}
match =current@arg,current@arg
\{ current@arg equ arg
arg equ ..arg
..arg dd ? \}
common
args@proc equ current@arg
forward
restore current@arg
common
end if }
 
macro deflocal@proc name,def,[val]
{ common
match vars, all@vars \{ all@vars equ all@vars, \}
all@vars equ all@vars name
forward
local ..var,..tmp
..var def val
match =?, val \{ ..tmp equ \}
match any =dup (=?), val \{ ..tmp equ \}
match tmp : value, ..tmp : val
\{ tmp: end virtual
initlocal@proc ..var,def value
virtual at tmp\}
common
match first rest, ..var, \{ name equ first \} }
 
macro initlocal@proc name,def
{ virtual at name
def
size@initlocal = $ - name
end virtual
position@initlocal = 0
while size@initlocal > position@initlocal
virtual at name
def
if size@initlocal - position@initlocal < 2
current@initlocal = 1
load byte@initlocal byte from name+position@initlocal
else if size@initlocal - position@initlocal < 4
current@initlocal = 2
load word@initlocal word from name+position@initlocal
else
current@initlocal = 4
load dword@initlocal dword from name+position@initlocal
end if
end virtual
if current@initlocal = 1
mov byte [name+position@initlocal],byte@initlocal
else if current@initlocal = 2
mov word [name+position@initlocal],word@initlocal
else
mov dword [name+position@initlocal],dword@initlocal
end if
position@initlocal = position@initlocal + current@initlocal
end while }
 
macro endp
{ purge ret,locals,endl
finish@proc
purge finish@proc
restore regs@proc
match all,args@proc \{ restore all \}
restore args@proc
match all,all@vars \{ restore all \} }
 
macro local [var]
{ common
locals
forward done@local equ
match varname[count]:vartype, var
\{ match =BYTE, vartype \\{ varname rb count
restore done@local \\}
match =WORD, vartype \\{ varname rw count
restore done@local \\}
match =DWORD, vartype \\{ varname rd count
restore done@local \\}
match =PWORD, vartype \\{ varname rp count
restore done@local \\}
match =QWORD, vartype \\{ varname rq count
restore done@local \\}
match =TBYTE, vartype \\{ varname rt count
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
rq count+count
restore done@local \\}
match , done@local \\{ virtual
varname vartype
end virtual
rb count*sizeof.\#vartype
restore done@local \\} \}
match :varname:vartype, done@local:var
\{ match =BYTE, vartype \\{ varname db ?
restore done@local \\}
match =WORD, vartype \\{ varname dw ?
restore done@local \\}
match =DWORD, vartype \\{ varname dd ?
restore done@local \\}
match =PWORD, vartype \\{ varname dp ?
restore done@local \\}
match =QWORD, vartype \\{ varname dq ?
restore done@local \\}
match =TBYTE, vartype \\{ varname dt ?
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
dq ?,?
restore done@local \\}
match , done@local \\{ varname vartype
restore done@local \\} \}
match ,done@local
\{ var
restore done@local \}
common
endl }
/programs/media/ac97snd/trunk/ac97.sln
0,0 → 1,38

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pe2kos", "pe2kos\pe2kos.vcproj", "{50E3FB09-4E3A-4998-A824-6830405193AE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp3dec", "mp3dec\mp3dec.vcproj", "{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pow_test", "pow_test\pow_test.vcproj", "{9FE40739-2ADC-4241-8182-20E1B3C661A7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97", "ac97\ac97.vcproj", "{1C94A897-DA4F-45B2-B8A6-B97AD837828E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.ActiveCfg = Debug|Win32
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.Build.0 = Debug|Win32
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.ActiveCfg = Release|Win32
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.Build.0 = Release|Win32
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.ActiveCfg = Debug|Win32
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.Build.0 = Debug|Win32
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.ActiveCfg = Release|Win32
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.Build.0 = Release|Win32
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.ActiveCfg = Debug|Win32
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.Build.0 = Debug|Win32
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.ActiveCfg = Release|Win32
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.Build.0 = Release|Win32
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.ActiveCfg = Debug|Win32
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.Build.0 = Debug|Win32
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.ActiveCfg = Release|Win32
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
/programs/media/ac97snd/trunk/ac97wav.c
0,0 → 1,718
//
// This file is part of the AC97 mp3 player.
// (C) copyright Serge 2006
// email: infinity_sound@mail.ru
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
 
#include "kolibri.h"
#include "stdio.h"
#include "string.h"
#include "ac97wav.h"
#include "mp3dec/mp3dec.h"
 
void thread_proc();
void touch(char *buf, int size);
 
extern char *__argv;
 
//extern char __path;
 
/***** for debug output only
char formats[37][12] =
{ "PCM_ALL",
"PCM_2_16_48","PCM_1_16_48","PCM_2_16_44","PCM_1_16_44",
"PCM_2_16_32","PCM_1_16_32","PCM_2_16_24","PCM_1_16_24",
"PCM_2_16_22","PCM_1_16_22","PCM_2_16_16","PCM_1_16_16",
"PCM_2_16_12","PCM_1_16_12","PCM_2_16_11","PCM_1_16_11",
"PCM_2_16_8","PCM_1_16_8","PCM_2_8_48","PCM_1_8_48",
"PCM_2_8_44","PCM_1_8_44","PCM_2_8_32","PCM_1_8_32",
"PCM_2_8_24","PCM_1_8_24","PCM_2_8_22","PCM_1_8_22",
"PCM_2_8_16","PCM_1_8_16","PCM_2_8_12","PCM_1_8_12",
"PCM_2_8_11","PCM_1_8_11","PCM_2_8_8","PCM_1_8_8"
};
*******/
 
DWORD hDrv;
DWORD hSound;
DWORD hBuff;
DWORD event[2];
 
CTRL_INFO info;
 
FILEINFO fileinfo;
 
int m_vol;
DWORD status;
DWORD offset;
DWORD first_sync;
 
char *testbuff;
char *outbuf;
char *inpbuf;
int inpsize;
int outsize;
 
char srv_name[] = "INFINITY";
char srv_intel[] = "SOUND";
char header[] = "AC97 MP3 player";
char buttons_text[]=" Play Stop << >> Vol- Vol+";
 
MPEG_DECODE_INFO mpginfo;
MPEG_DECODE_PARAM param;
 
void (*snd_play)();
 
void draw_window()
{
BeginDraw();
 
DrawWindow(100,100,299,72,0x404040,3,0,0,0);
 
make_button(7,24,45,13, 0x10|BT_NORMAL,0x808080);
make_button(56,24,45,13, 0x11|BT_NORMAL,0x808080);
make_button(104,24,45,13, 0x12|BT_NORMAL,0x808080);
make_button(152,24,45,13, 0x13|BT_NORMAL,0x808080);
make_button(200,24,45,13, 0x14|BT_NORMAL,0x808080);
make_button(248,24,45,13, 0x15|BT_NORMAL,0x808080);
 
make_button(7,41,286,11, 0x30|BT_HIDE|BT_NOFRAME,0x404040);
draw_bar(7,41,286,11,0x404040);
 
draw_bar(7,55,286,11,0x404040);
write_text(12,58,0x004000|FONT0, __argv, strlen(__argv));
write_text(11,57,0x00FF20|FONT0, __argv, strlen(__argv));
 
write_text(8,8,0xFFFFFF|FONT0, header, strlen(header));
write_text(12,28,0x404040|FONT0,buttons_text,strlen(buttons_text));
write_text(11,27,0xA0FFA0|FONT0,buttons_text,strlen(buttons_text));
 
EndDraw();
};
 
void draw_progress_bar()
{ DWORD x;
x = 286.0f * (float)offset/(float)fileinfo.size;
if(x==0) return;
draw_bar(7,41,x,11,0xA0A0A0);
draw_bar(x+7,41,286-x,11,0x404040);
};
 
void debug_out_str(char* str)
{
while (*str != 0)
{
debug_out(*str);
str++;
}
}
 
int main() //int argc, char *argv[])
{ DWORD fmt;
char *thread_stack;
DWORD r_bytes;
int retval;
 
InitHeap(1024*1024);
if(get_fileinfo(__argv, &fileinfo)==FILE_NOT_FOUND)
return 0;
 
if((hDrv=GetService(srv_intel))==0)
return 0;
 
if ((hSound=GetService(srv_name))==0)
return 0;
 
GetDevInfo(hDrv, &info);
 
m_vol = GetMasterVol(hDrv,&m_vol);
if (m_vol > 85)
{ m_vol = 85;
SetMasterVol(hDrv,m_vol);
};
 
_asm {fninit};
mp3DecodeInit();
testbuff = UserAlloc(4096);
get_fileinfo(__argv, &fileinfo);
offset = 0;
retval=read_file (__argv,testbuff,0,2048,&r_bytes);
if (retval) return 0;
fmt = test_wav((WAVEHEADER*)testbuff);
if (fmt != 0)
{
snd_play = &play_wave;
outbuf = UserAlloc(32*1024);
touch(outbuf, 32768);
offset = 44;
}
else
{ fmt = test_mp3(testbuff);
if(fmt ==0) return 0;
snd_play = &play_mp3;
inpsize = mpginfo.maxInputSize*30;
inpbuf = UserAlloc(inpsize);
touch(inpbuf, inpsize);
outsize = mpginfo.outputSize*30+0x10000;
outbuf = UserAlloc(outsize);
touch(outbuf, outsize);
first_sync = offset;
};
 
status = ST_PLAY;
hBuff = CreateBuffer(hSound,fmt);
if (hBuff == 0) return 0;
thread_stack = UserAlloc(4096);
thread_stack+=4092;
 
CreateThread(thread_proc, thread_stack);
 
while(1)
{ delay(10);
switch(status)
{ case ST_PLAY:
snd_play();
continue;
 
case ST_STOP:
StopBuffer(hSound, hBuff);
status = ST_DONE;
continue;
 
case ST_EXIT:
StopBuffer(hSound, hBuff);
DestroyBuffer(hSound, hBuff);
return 0;
};
};
return 0;
};
 
void touch(char *buf, int size)
{ int i;
for ( i = 0;i < size; i+=4096)
buf[i] = 0;
};
 
DWORD test_mp3(char *buf)
{ int retval;
int sync;
WAVEHEADER whdr;
DWORD r_bytes=2048;
for (;;)
{
if (!mp3FindSync(buf, 2048, &sync))
offset+= 2048;
else break;
if (offset >= fileinfo.size || offset >= 102400)
return 0;
 
retval = read_file (__argv,buf,offset,2048,&r_bytes);
if(retval != 0) return 0;
};
offset+=sync;
retval = read_file (__argv,buf,offset,2048,&r_bytes);
if(retval != 0) return 0;
mp3GetDecodeInfo(buf, r_bytes, &mpginfo, 1);
whdr.riff_id = 0x46464952;
whdr.riff_format = 0x45564157;
whdr.wFormatTag = 0x01;
whdr.nSamplesPerSec = mpginfo.frequency;
whdr.nChannels = mpginfo.channels;
whdr.wBitsPerSample = mpginfo.bitsPerSample;
return test_wav(&whdr);
};
void wave_out(char* buff)
{ DWORD ev[2];
 
GetNotify(&ev[0]);
SetBuffer(hSound,hBuff,buff,ev[1],0x8000);
}
 
void play_mp3()
{ int retval;
DWORD r_bytes;
char *inpPtr;
char *outPtr;
int inpBytes;
int totalout;
offset = first_sync;
retval = read_file (__argv,inpbuf,offset,inpsize,&r_bytes);
if(retval != 0)
{ status = ST_STOP;
return ;
};
offset+=inpsize;
 
mp3DecodeStart(inpbuf, inpsize);
inpPtr = inpbuf+mpginfo.skipSize;
inpBytes = inpsize-mpginfo.skipSize;
outPtr = outbuf;
totalout=0;
memset(outbuf,0,0x10000);
SetBuffer(hSound,hBuff,outbuf,0,0x10000);
PlayBuffer(hSound, hBuff);
 
_asm { fninit }
while(1)
{ if(status!=ST_PLAY)
break;
for(;;)
{ param.inputBuf = inpPtr;
param.inputSize = inpBytes;
param.outputBuf = outPtr;
 
if(!mp3DecodeFrame(&param))
if( mp3GetLastError()== MP3_ERROR_OUT_OF_BUFFER)
break;
 
inpPtr += param.inputSize;
inpBytes -= param.inputSize;
outPtr+=param.outputSize;
totalout+=param.outputSize;
};
memmove(inpbuf, inpPtr, inpBytes);
retval = read_file(__argv, &inpbuf[inpBytes],offset, inpsize-inpBytes, &r_bytes);
offset+=r_bytes;
if (r_bytes== 0) break;
inpPtr = inpbuf;
inpBytes += r_bytes;
if(totalout < 32768) continue;
outPtr = outbuf;
while (totalout > 32768)
{ wave_out(outPtr);
totalout-=0x8000;
outPtr+=0x8000;
};
memmove(outbuf,outPtr, totalout);
outPtr = outbuf+totalout;
};
if(status != ST_EXIT)
status = ST_STOP;
};
 
void play_wave()
{
int retval;
int remain;
int i;
 
offset = 44;
 
read_file (__argv,outbuf,offset,32*1024,0);
offset+=32*1024;
SetBuffer(hSound,hBuff,outbuf,0,0x8000);
 
read_file (__argv,outbuf,offset,32*1024,0);
offset+=32*1024;
SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000);
 
PlayBuffer(hSound, hBuff);
 
retval = 0;
while(1)
{
if(status!=ST_PLAY)
break;
 
GetNotify(&event[0]);
if(retval == FILE_EOF)
break;
remain = fileinfo.size-offset;
if(remain >=32768)
{ retval = read_file (__argv,outbuf,offset,32*1024,0);
offset+=32*1024;
SetBuffer(hSound,hBuff,outbuf,event[1],0x8000);
continue;
};
if(remain == 0)
{ retval = FILE_EOF;
continue;
};
read_file (__argv,outbuf,offset,remain,0);
for(i=remain;i<32768;i++)
outbuf[i] = 0;
SetBuffer(hSound,hBuff,outbuf,event[1],0x8000);
retval= FILE_EOF;
};
 
if(status != ST_EXIT)
status = ST_STOP;
};
 
void snd_stop()
{
StopBuffer(hSound, hBuff);
};
 
void thread_proc()
{ int evnt;
int pos;
int key;
 
_asm { fninit };
draw_window();
 
while(1)
{ if(status==ST_PLAY)
{ draw_progress_bar();
evnt = wait_for_event(80);
// debug_out_str("BIG ERROR...\x0D\x0A\x00");
}
else
evnt = wait_for_event_infinite();
 
switch(evnt)
{
case EV_REDRAW:
draw_window();
break;
 
case EV_KEY:
key = get_key();
if(key==27)
{ status = ST_EXIT;
exit();
};
if((key==45)||key==54)
{ if(m_vol > 0)
{ m_vol--;
SetMasterVol(hDrv,m_vol);
};
break;
};
if((key==61)||key==56)
{ if(m_vol < 90)
{ m_vol++;
SetMasterVol(hDrv,m_vol);
};
};
break;
 
case EV_BUTTON:
switch(get_button_id())
{ case 1:
status = ST_EXIT;
exit();
break;
case 0x10:
status = ST_PLAY;
continue;
 
case 0x11:
status = ST_STOP;
break;
// case 0x12:
// case 0x13:
case 0x14:
if(m_vol > 0)
{ m_vol--;
SetMasterVol(hDrv,m_vol);
};
break;
 
case 0x15:
if(m_vol < 90)
{ m_vol++;
SetMasterVol(hDrv,m_vol);
};
break;
 
case 0x30:
if(status==ST_DONE)
break;
if(snd_play == play_mp3)
continue;
pos = (GetMousePos(REL_WINDOW)>>16)-7;
offset = ((fileinfo.size-44)/286*pos+44)&0xFFFFFFFC;
draw_progress_bar();
break;
};
};
};
};
 
DWORD test_wav(WAVEHEADER *hdr)
{
if(hdr->riff_id != 0x46464952)
return 0;
 
if(hdr->riff_format != 0x45564157)
return 0;
 
if (hdr->wFormatTag != 0x01)
return 0;
 
switch(hdr->nSamplesPerSec)
{ case 48000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_48;
else
return PCM_1_8_48;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_48;
else
return PCM_2_8_48;
};
 
case 44100:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_44;
else
return PCM_1_8_44;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_44;
else
return PCM_2_8_44;
};
 
case 32000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_32;
else
return PCM_1_8_32;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_32;
else
return PCM_2_8_32;
};
 
case 24000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_24;
else
return PCM_1_8_24;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_24;
else
return PCM_2_8_24;
};
 
case 22050:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_22;
else
return PCM_1_8_22;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_22;
else
return PCM_2_8_22;
};
 
case 16000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_16;
else
return PCM_1_8_16;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_16;
else
return PCM_2_8_16;
};
 
case 12000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_12;
else
return PCM_1_8_12;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_12;
else
return PCM_2_8_12;
};
 
case 11025:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_11;
else
return PCM_1_8_11;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_11;
else
return PCM_2_8_11;
};
 
case 8000:
switch (hdr->nChannels)
{ case 1:
if(hdr->wBitsPerSample == 16)
return PCM_1_16_8;
else
return PCM_1_8_8;
 
case 2:
if(hdr->wBitsPerSample == 16)
return PCM_2_16_8;
else
return PCM_2_8_8;
};
default:
return 0;
};
};
 
void delay (int val)
{
_asm
{ mov eax,5
mov ebx, [val]
int 0x40
};
}
 
int wait_for_event(int time)
{ int retval;
_asm
{ mov eax,23
mov ebx,[time]
int 0x40
mov [retval], eax
};
return retval;
};
int wait_for_event_infinite()
{ int retval;
_asm
{ mov eax,10
int 0x40
mov [retval], eax
};
return retval;
};
 
void BeginDraw()
{_asm
{ mov eax,12
mov ebx, 1
int 0x40
};
};
 
void EndDraw()
{ _asm
{ mov eax,12
mov ebx, 2
int 0x40
};
};
 
void * __cdecl memmove ( void * dst, const void * src, size_t count)
{ void * ret = dst;
 
if (dst <= src || (char *)dst >= ((char *)src + count))
{
while (count--)
{ *(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
}
else
{
dst = (char *)dst + count - 1;
src = (char *)src + count - 1;
while (count--)
{ *(char *)dst = *(char *)src;
dst = (char *)dst - 1;
src = (char *)src - 1;
}
}
return(ret);
};
 
 
 
 
// debug_out_str(formats[fmt]);
// debug_out_str("\x0D\x0A\x00");
 
// debug_out_str("pci cmd: ");
// debug_out_hex(info.pci_cmd);
// debug_out_str("\x0D\x0A\x00");
 
// debug_out_str("irq line: ");
// debug_out_hex(info.irq);
// debug_out_str("\x0D\x0A\x00");
 
// debug_out_str("global control: ");
// debug_out_hex(info.glob_cntrl);
// debug_out_str("\x0D\x0A\x00");
 
// debug_out_str("global status: ");
// debug_out_hex(info.glob_sta);
// debug_out_str("\x0D\x0A\x00");
 
 
// call _print_volume
 
// debug_out_hex(whdr.nChannels);
// debug_out_str("\x0D\x0A\x00");
// debug_out_hex(whdr.nSamplesPerSec);
// debug_out_str("\x0D\x0A\x00");
 
// debug_out_hex(fmt);
// debug_out_str("\x0D\x0A\x00");
 
 
 
/programs/media/ac97snd/trunk/ac97wav.h
0,0 → 1,86
//
// This file is part of the AC97 mp3 player.
// (C) copyright Serge 2006
// email: infinity_sound@mail.ru
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
 
 
#define PCM_2_16_48 1
#define PCM_1_16_48 2
#define PCM_2_16_44 3
#define PCM_1_16_44 4
#define PCM_2_16_32 5
#define PCM_1_16_32 6
#define PCM_2_16_24 7
#define PCM_1_16_24 8
#define PCM_2_16_22 9
#define PCM_1_16_22 10
#define PCM_2_16_16 11
#define PCM_1_16_16 12
#define PCM_2_16_12 13
#define PCM_1_16_12 14
#define PCM_2_16_11 15
#define PCM_1_16_11 16
#define PCM_2_16_8 17
#define PCM_1_16_8 18
#define PCM_2_8_48 19
#define PCM_1_8_48 20
#define PCM_2_8_44 21
#define PCM_1_8_44 22
#define PCM_2_8_32 23
#define PCM_1_8_32 24
#define PCM_2_8_24 25
#define PCM_1_8_24 26
#define PCM_2_8_22 27
#define PCM_1_8_22 28
#define PCM_2_8_16 29
#define PCM_1_8_16 30
#define PCM_2_8_12 31
#define PCM_1_8_12 32
#define PCM_2_8_11 33
#define PCM_1_8_11 34
#define PCM_2_8_8 35
#define PCM_1_8_8 36
 
#define ST_DONE 0x0
#define ST_PLAY 0x1
#define ST_EXIT 0x2
#define ST_STOP 0x4
 
typedef struct
{ DWORD riff_id;
DWORD riff_size;
DWORD riff_format;
 
DWORD fmt_id;
DWORD fmt_size;
 
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
DWORD data_id;
DWORD data_size;
} WAVEHEADER;
 
DWORD test_wav(WAVEHEADER *hdr);
DWORD test_mp3(char *buf);
 
//void (*snd_play)();
void wave_out(char* buff);
 
void play_wave();
void play_mp3();
 
void snd_stop();
/programs/media/ac97snd/trunk/crt.c
0,0 → 1,70
#include "crt.h"
 
#define atexitBufferSize 32
 
char pureCallMessage[] = "PURE function call!";
 
char *__argv = 0;
 
void (__cdecl *atExitList[atexitBufferSize])();
int atExitFnNum = 0;
 
void exit()
{ int i;
 
for ( i = atExitFnNum - 1; i >= 0; i-- )
atExitList[i]();
__asm
{
mov eax, -1
int 0x40
};
};
 
int __cdecl atexit( void (__cdecl *func )( void ))
{
//
if ( atExitFnNum < atexitBufferSize )
{
//
atExitList[atExitFnNum++] = func;
return 0;
}
else
{
return 1;
}
}
 
int __cdecl _purecall()
{
exit();
return 0;
}
 
#pragma section(".CRT$XCA",long,read,write)
#pragma section(".CRT$XCZ",long,read,write)
typedef void (__cdecl *_PVFV)(void);
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { 0 };
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { 0 };
//
#pragma comment(linker, "/merge:.CRT=.rdata")
//
void crtStartUp()
{_PVFV *pbegin;
 
_asm {fninit};
 
for ( pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
{
//
if ( *pbegin != 0 )
(**pbegin)();
}
__argv = *((char **)0x1C);
main();
exit();
}
 
 
/programs/media/ac97snd/trunk/crt.h
0,0 → 1,13
typedef unsigned __int32 Dword;
typedef unsigned __int16 Word;
typedef unsigned __int8 Byte;
typedef unsigned __int32 size_t;
 
 
extern char *__argv;
 
void crtStartUp();
int __cdecl _purecall();
int __cdecl atexit( void (__cdecl *func )( void ));
void exit();
int main();
/programs/media/ac97snd/trunk/k_lib.asm
0,0 → 1,714
;
; This file is part of the AC97 mp3 player.
; (C) copyright Serge 2006
; email: infinity_sound@mail.ru
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
 
 
format MS COFF
 
include "proc32.inc"
 
section '.text' code readable executable
 
public _GetService@4
public _GetDevInfo@8
public _GetMasterVol@8
public _SetMasterVol@8
public _CreateBuffer@8
public _DestroyBuffer@8
public _SetBuffer@20
public _PlayBuffer@8
public _StopBuffer@8
 
public _InitHeap@4
public _UserAlloc@4
public _GetNotify@4
public _CreateThread@8
public _GetMousePos@4
public _get_fileinfo@8
public _read_file@20
public _get_key
public _get_button_id
public _DrawWindow@36
public _make_button@24
public _draw_bar@20
public _write_text@20
public _debug_out@4
public _debug_out_hex@4
 
public _memset
 
struc FILEIO
{ .cmd dd ?
.offset dd ?
dd ?
.count dd ?
.buff dd ?
db ?
.name dd ?
};
 
struc CTRL_INFO
{ .pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
.codec_io_base dd ?
.ctrl_io_base dd ?
.codec_mem_base dd ?
.ctrl_mem_base dd ?
.codec_id dd ?
}
CTRL_INFO_SIZE equ 9*4
 
 
SND_CREATE_DEV equ 1
SND_CREATE_BUFF equ 2
SND_PLAY equ 3
SND_STOP equ 4
SND_SETBUFF equ 5
SND_DESTROY_BUFF equ 6
 
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
 
 
align 4
proc _get_button_id
mov eax,17
int 0x40
test al,al
jnz @F
shr eax,8
ret
@@:
xor eax,eax
dec eax
ret
endp
 
align 4
proc _get_fileinfo@8 stdcall, name:dword, info:dword
push ebx
push esi
push edi
xor eax, eax
mov ebx, [name]
mov ecx, [info]
 
mov [fileio.cmd], 5
mov [fileio.offset], eax
mov [fileio.offset+4], eax
mov [fileio.count], eax
mov [fileio.buff], ecx
mov byte [fileio.buff+4], al
mov [fileio.name], ebx
 
mov eax, 70
lea ebx, [fileio]
int 0x40
pop edi
pop esi
pop ebx
ret
endp
 
align 4
proc _read_file@20 stdcall,name:dword, buff:dword, offset:dword,\
count:dword,reads:dword
push ebx
push esi
push edi
xor eax, eax
mov ebx, [name]
mov edx, [offset]
mov esi, [buff]
mov edi, [count]
 
mov [fileio.cmd], eax
mov [fileio.offset], edx
mov [fileio.offset+4], eax
mov [fileio.count], edi
mov [fileio.buff], esi
mov byte [fileio.buff+4], al
mov [fileio.name], ebx
 
mov eax, 70
lea ebx, [fileio]
int 0x40
mov esi, [reads]
test esi, esi
jz @f
mov [esi], ebx
@@:
pop edi
pop esi
pop ebx
ret
endp
 
align 4
proc _get_key
mov eax, 2
int 0x40
shr eax, 8
ret
endp
 
align 4
proc _InitHeap@4 stdcall, heap_size:dword
push ebx
mov eax, 68
mov ebx, 11
mov ecx, [heap_size]
int 0x40
pop ebx
ret
endp
 
align 4
proc _UserAlloc@4 stdcall, alloc_size:dword
push ebx
mov eax, 68
mov ebx, 12
mov ecx, [alloc_size]
int 0x40
pop ebx
ret
endp
 
align 4
proc _GetNotify@4 stdcall, p_ev:dword
push ebx
mov eax, 68
mov ebx, 14
mov ecx, [p_ev]
int 0x40
pop ebx
ret
endp
 
align 4
proc _CreateThread@8 stdcall, fn:dword, p_stack:dword
push ebx
mov eax, 51
mov ebx, 1
mov ecx, [fn]
mov edx,[p_stack]
int 0x40
pop ebx
ret
endp
 
align 4
proc _GetMousePos@4 stdcall,rel_type:dword
push ebx
mov eax, 37
mov ebx, [rel_type]
int 0x40
pop ebx
ret
endp
 
align 4
proc CallServiceEx stdcall, ioctl:dword
push ebx
mov eax, 68
mov ebx, 17
mov ecx, [ioctl]
int 0x40
pop ebx
ret
endp
 
align 4
proc _GetService@4 stdcall, name:dword
push ebx
mov eax, 68
mov ebx, 16
mov ecx, [name]
int 0x40
pop ebx
ret
endp
 
align 4
proc _GetDevInfo@8 stdcall, hSrv:dword, p_info:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
push ebx
mov eax, [hSrv]
xor ebx, ebx
mov ecx, [p_info]
 
mov [handle], eax
mov [io_code], DEV_GET_INFO
mov [input], ebx
mov [inp_size], ebx
mov [output], ecx
mov [out_size], CTRL_INFO_SIZE
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _GetMasterVol@8 stdcall, hSrv:dword,pvol:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
push ebx
mov eax, [hSrv]
mov ecx, [pvol]
xor ebx, ebx
mov [handle], eax
mov [io_code], DEV_GET_MASTERVOL
mov [input], ebx
mov [inp_size], ebx
mov [output], ecx
mov [out_size], 4
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _SetMasterVol@8 stdcall,hSrv:dword,vol:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
push ebx
mov eax, [hSrv]
lea ecx, [vol]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], DEV_SET_MASTERVOL
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _CreateBuffer@8 stdcall, hSound:dword,format:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
push ebx
mov eax, [hSound]
lea ecx, [format]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], SND_CREATE_BUFF
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _DestroyBuffer@8 stdcall, hSound:dword, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
push ebx
mov eax, [hSound]
lea ecx, [str]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], SND_DESTROY_BUFF
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _SetBuffer@20 stdcall,hSound:dword, str:dword, src:dword, offs:dword, size:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
push ebx
mov eax, [hSound]
lea ecx, [str]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], SND_SETBUFF
mov [input], ecx
mov [inp_size], 16
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _PlayBuffer@8 stdcall, hSound:dword, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
push ebx
mov eax, [hSound]
lea ecx, [str]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], SND_PLAY
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _StopBuffer@8 stdcall, hSound:dword, str:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
endl
 
push ebx
mov eax, [hSound]
lea ecx, [str]
xor ebx, ebx
 
mov [handle], eax
mov [io_code], SND_STOP
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
 
lea eax, [handle]
stdcall CallServiceEx, eax
pop ebx
ret
endp
 
align 4
proc _DrawWindow@36 stdcall, x:dword, y:dword, sx:dword, sy:dword,\
workcolor:dword, style:dword, captioncolor:dword,\
windowtype:dword, bordercolor:dword
push ebx edi esi
mov ebx, [x]
mov ecx, [y]
shl ebx, 16
shl ecx, 16
mov bx, word [sx]
mov cx, word [sy]
mov edx,[style]
shl edx,24
add edx,[workcolor]
mov esi,[windowtype]
shl esi,24
add esi,[captioncolor]
mov edi,[bordercolor]
xor eax,eax
int 0x40
pop esi edi ebx
ret
endp
 
align 4
_make_button@24:
;arg1 - x
;arg2 - y
;arg3 - xsize
;arg4 - ysize
;arg5 - id
;arg6 - color
push ebx esi
mov ebx,[esp+12]
shl ebx,16
mov bx,[esp+20]
mov ecx,[esp+16]
shl ecx,16
mov cx,[esp+24]
mov edx,[esp+28]
mov esi,[esp+32]
mov eax,8
int 0x40
pop esi ebx
ret 24
 
align 4
_draw_bar@20:
;arg1 - x
;arg2 - y
;arg3 - xsize
;arg4 - ysize
;arg5 - color
push ebx
mov eax,13
mov ebx,[esp+8]
shl ebx,16
mov bx,[esp+16]
mov ecx,[esp+12]
shl ecx,16
mov cx,[esp+20]
mov edx,[esp+24]
int 0x40
pop ebx
ret 20
 
_write_text@20:
;arg1 - x
;arg2 - y
;arg3 - color
;arg4 - text
;arg5 - len
push ebx esi
mov eax,4
mov ebx,[esp+12]
shl ebx,16
mov bx,[esp+16]
mov ecx,[esp+20]
mov edx,[esp+24]
mov esi,[esp+28]
int 0x40
pop esi ebx
ret 20
 
align 4
proc _debug_out@4 stdcall, val:dword
push ebx
mov ecx,[val]
mov ebx,1
mov eax,63
int 0x40
pop ebx
ret
endp
 
align 4
proc _debug_out_hex@4 stdcall val:dword
locals
count dd ?
endl
 
mov [count], 8
.new_char:
rol [val], 4
mov ecx, [val]
and ecx, 0x0f
mov cl,byte [__hexdigits+ecx]
mov eax, 63
mov ebx, 1
int 0x40
dec [count]
jnz .new_char
ret
endp
align 4
_memset:
mov edx,[esp + 0ch]
mov ecx,[esp + 4]
 
test edx,edx
jz short toend
xor eax,eax
mov al,[esp + 8]
 
push edi
mov edi,ecx
 
cmp edx,4
jb tail
neg ecx
and ecx,3
jz short dwords
sub edx,ecx
adjust_loop:
mov [edi],al
add edi,1
sub ecx,1
jnz adjust_loop
 
dwords:
mov ecx,eax
shl eax,8
add eax,ecx
mov ecx,eax
shl eax,10h
add eax,ecx
mov ecx,edx
and edx,3
shr ecx,2
jz tail
 
cld
rep stosd
main_loop_tail:
test edx,edx
jz finish
 
 
tail:
mov [edi],al
add edi,1
 
sub edx,1
jnz tail
 
finish:
mov eax,[esp + 8]
pop edi
 
ret
 
toend:
mov eax,[esp + 4]
 
ret
 
public __ftol2_sse
 
align 4
__ftol2_sse:
push ebp
mov ebp, esp
sub esp, 20
and esp, 0xFFFFFFF0
fld st0
fst dword [esp+18]
fistp qword [esp+10]
fild qword [esp+10]
mov edx, [esp+18]
mov eax, [esp+10]
test eax, eax
jz .QnaNZ
.not_QnaNZ:
fsubp st1, st0
test edx, edx
jns .pos
fstp dword [esp]
mov ecx, [esp]
xor ecx, 0x80000000
add ecx, 0x7FFFFFFF
adc eax, 0
mov edx, [esp+14]
adc edx, 0
jmp .exit
.pos:
fstp dword [esp]
mov ecx, [esp]
add ecx, 0x7FFFFFFF
sbb eax, 0
jmp .exit
.QnaNZ:
mov edx, [esp+14]
test edx, 0x7FFFFFFF
jne .not_QnaNZ
fstp dword [esp+18]
fstp dword [esp+18]
.exit:
leave
ret
 
public __fltused
__fltused dd 0
align 4
__hexdigits db '0123456789ABCDEF'
 
align 4
fileio FILEIO
 
/programs/media/ac97snd/trunk/kolibri.h