/programs/demos/colors/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/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/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/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/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/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/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/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/hexhd/trunk/hexhd.asm |
---|
File deleted |
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/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/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/life/trunk/life.asm |
---|
File deleted |
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]]\jjjxxxxxxjjj]]\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]]\jjjxxxxxxjjj]]\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^^^mmmzzyrrr))) ]]]feeEEE"""555888[[[RRROOONdwd±_¬l¹[¨uÂvÃ^«p½x¡Åw ÄEEE@@@VVV\\[mmmyyzkkk 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***$$$&&&TqPj]ªmº`sÀ`l¹b¯y¢Æ7BL!!!DDDBBB[[[BBBIII:::%%%ggg''' RRRvwwnnmVVVWWW>>>EEEl¹k¸_¬_¬g´z£Ç]ªk¸`i¶cFFFYYYWWW>>>222&&&NNNVVVvvv !!!```zzymmm^^^SSSKKJDDCW¤l¹Y¦tÁi¶q¾W¤\ ©f³e²uÂ000GGG222---+++444zzy444zzymmm^^^^^^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/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/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/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/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/mp3dec/window.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3sf.c |
---|
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/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/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/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(¶m)) |
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 |
---|
0,0 → 1,109 |
// |
// 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 FONT0 0x00000000 |
#define FONT1 0x10000000 |
#define BT_NORMAL 0x00000000 |
#define BT_NOFRAME 0x20000000 |
#define BT_HIDE 0x40000000 |
#define BT_DEL 0x80000000 |
#define EV_REDRAW 1 |
#define EV_KEY 2 |
#define EV_BUTTON 3 |
#define REL_SCREEN 0 |
#define REL_WINDOW 1 |
#define FILE_NOT_FOUND 5 |
#define FILE_EOF 6 |
typedef unsigned int DWORD; |
typedef unsigned short int WORD; |
typedef struct |
{ DWORD pci_cmd; |
DWORD irq; |
DWORD glob_cntrl; |
DWORD glob_sta; |
DWORD codec_io_base; |
DWORD ctrl_io_base; |
DWORD codec_mem_base; |
DWORD ctrl_mem_base; |
DWORD codec_id; |
} CTRL_INFO; |
typedef struct |
{ DWORD cmd; |
DWORD offset; |
DWORD r1; |
DWORD count; |
DWORD buff; |
char r2; |
char *name; |
} FILEIO; |
typedef struct |
{ DWORD attr; |
DWORD flags; |
DWORD cr_time; |
DWORD cr_date; |
DWORD acc_time; |
DWORD acc_date; |
DWORD mod_time; |
DWORD mod_date; |
DWORD size; |
} FILEINFO; |
void _stdcall InitHeap(int heap_size); |
void* _stdcall UserAlloc(int size); |
void _stdcall GetNotify(DWORD *event); |
void _stdcall CreateThread(void *fn, char *p_stack); |
DWORD _stdcall GetMousePos(DWORD rel_type); |
int _stdcall GetService(char *srv_name); |
void _stdcall GetDevInfo(DWORD hSrv,CTRL_INFO *pInfo); |
int _stdcall GetMasterVol(DWORD hSrv,int* vol); |
int _stdcall SetMasterVol(DWORD hSrv, int vol); |
DWORD _stdcall CreateBuffer(DWORD hSrv, DWORD format); |
int _stdcall DestroyBuffer(DWORD hSrv, DWORD hBuff); |
int _stdcall SetBuffer(DWORD hSrv, DWORD hBuff,char* buff, |
DWORD offs, int size); |
int _stdcall PlayBuffer(DWORD hSrv, DWORD hBuff); |
int _stdcall StopBuffer(DWORD hSrv, DWORD hBuff); |
void _stdcall debug_out_hex(DWORD val); |
void debug_out_str(char* str); |
int _stdcall get_fileinfo(char *name,FILEINFO* pinfo); |
int _stdcall read_file (char *name,char*buff,int offset,int count,int *reads); |
void exit(); |
int get_key(void); |
int get_button_id(); |
void delay(int val); |
int wait_for_event(int time); |
int wait_for_event_infinite(); |
void BeginDraw(void); |
void EndDraw(void); |
void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style, |
int captioncolor,int windowtype,int bordercolor); |
void _stdcall debug_out(int ch); |
void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color); |
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color); |
void _stdcall |