diff --git a/kernel/trunk/drivers/build.bat b/kernel/trunk/drivers/build.bat new file mode 100644 index 0000000000..9ee5512801 --- /dev/null +++ b/kernel/trunk/drivers/build.bat @@ -0,0 +1,4 @@ +@fasm unisound.asm unisound.obj +@fasm sis.asm sis.obj +@fasm infinity.asm infinity.obj +@pause \ No newline at end of file diff --git a/kernel/trunk/skin/build.bat b/kernel/trunk/skin/build.bat new file mode 100644 index 0000000000..ac54f13566 --- /dev/null +++ b/kernel/trunk/skin/build.bat @@ -0,0 +1,2 @@ +@fasm default.asm default.skn +@pause \ No newline at end of file diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index c962808d34..145dc50886 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -1032,45 +1032,110 @@ vesa20_drawbackground_stretch: call calculate_edi - sdp3: ; MAIN LOOP +sdp3: ; MAIN LOOP +cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) +jne snbgp +push eax +push ebx +mov eax,dword [WinMapAddress-8] +imul eax, [esp+4] ;4 +xor edx,edx +mov ebx,[ScreenWidth] +div ebx +mov cx,dx +lea esi,[eax+eax*2] +mov eax,dword [WinMapAddress-4] +imul eax, [esp+0] ;0 +xor edx,edx +mov ebx,[ScreenHeight] +div ebx +shl ecx,16 +mov cx,dx +imul eax, [esp+8] ;8 +add esi,eax +mov eax,[esi+0x300000] +push eax +ror ecx,16 +xor eax,eax +mov ax,cx +shl eax,1 ; єьэюцхэшх эр 2 +lea eax,[eax+eax*4] ; єьэюцхэшх эр 5 +xor edx,edx +mov ebx,[ScreenWidth] +div ebx +cmp eax,5 +pop eax +jb @f +mov ebx,[esi+0x300000+3] +call overlapping_of_points +@@: +push eax +ror ecx,16 +xor eax,eax +mov ax,cx +shl eax,1 ; єьэюцхэшх эр 2 +lea eax,[eax+eax*4] ; єьэюцхэшх эр +xor edx,edx +mov ebx,[ScreenHeight] +div ebx +cmp eax,5 +pop eax +jb @f +mov ebx,[display_data-8] +shl ebx,1 +add ebx,[display_data-8] +add ebx,0x300000 +add ebx,esi +mov ebx,[ebx] +call overlapping_of_points +@@: +and eax,0xffffff +xchg edi, ebp +stosw +shr eax,16 +stosb +xchg ebp, edi ; ebp+=3 +cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size +jz @f +inc ebp ; +1 +@@: +pop ebx +pop eax +jmp shook1 - cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) - jne snbgp - - push eax - push ebx - - mov eax,dword [WinMapAddress-8] - imul eax, [esp+4] ;4 - xor edx,edx - mov ebx,[ScreenWidth] - div ebx - lea esi,[eax+eax*2] - mov eax,dword [WinMapAddress-4] - imul eax, [esp+0] ;0 - xor edx,edx - mov ebx,[ScreenHeight] - div ebx - imul eax, [esp+8] ;8 - add esi,eax - - mov eax,[esi+0x300000] - and eax,0xffffff - - xchg edi, ebp - stosw - shr eax,16 - stosb - xchg ebp, edi ; ebp+=3 - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - inc ebp ; +1 - @@: - - pop ebx - pop eax - - jmp shook1 +overlapping_of_points: +push ecx edi +mov ecx,eax +mov edx,ebx +xor eax,eax +mov al,cl +xor ebx,ebx +mov bl,dl +add eax,ebx +rcr eax,1 +xor edi,edi +mov di,ax +xor eax,eax +mov al,ch +xor ebx,ebx +mov bl,dh +add eax,ebx +rcr eax,1 +ror edi,8 +add edi,eax +ror ecx,8 +ror edx,8 +xor eax,eax +mov al,ch +xor ebx,ebx +mov bl,dh +add eax,ebx +rcr eax,1 +ror edi,8 +add eax,edi +ror eax,16 +pop edi ecx +ret snbgp: add ebp,3 ; +3 diff --git a/programs/demos/3dcube2/trunk/macros.inc b/programs/demos/3dcube2/trunk/macros.inc index 5527ff55c1..0ddc650b65 100644 --- a/programs/demos/3dcube2/trunk/macros.inc +++ b/programs/demos/3dcube2/trunk/macros.inc @@ -123,8 +123,10 @@ macro mpack dest, hsrc, lsrc end if } -macro __mov reg,a { ; mike.dld - if ~a eq +macro __mov reg,a,b { ; mike.dld + if (~a eq)&(~b eq) + mpack reg,a,b + else if (~a eq)&(b eq) mov reg,a end if } @@ -141,11 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld -; language for programs -lang fix ru ; ru en fr ge fi - - - ; optimize the code for size __regs fix @@ -177,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -221,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/demos/bgitest/trunk/bgifont.inc b/programs/demos/bgitest/trunk/bgifont.inc index 745b83c992..c32527e35b 100644 --- a/programs/demos/bgitest/trunk/bgifont.inc +++ b/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 @@ _BGIfont_Prepare: mov esi,edi ; esi->FontName mov [.dest],edi ; ptr to load font if ~ BGI_LEVEL eq KERNEL - mov [.fsize],1 - mov eax,58 + mov eax, 70 + mov ebx, .fontattr + int 0x40 + test eax, eax + jnz .fail + dps2 '1' + mov eax, [.fileattr+32] + mov [.fsize], eax mov ebx,.fontinfo - int 0x40 - test eax,eax - jnz .fail - dps2 '1' - shr ebx,9 - inc ebx - mov [.fsize],ebx - mov ebx,.fontinfo - mov eax,58 + mov eax,70 int 0x40 ; ebx - file size else push edi esi edx @@ -340,11 +338,22 @@ if ~ BGI_LEVEL eq KERNEL .fontinfo: dd 0 dd 0 + dd 0 .fsize dd 0 .dest dd 0 - dd 0x10000 +.fontfullname: db BGIFONT_PATH .font db 'FONT.CHR',0 + +.fontattr: + dd 5 + dd 0 + dd 0 + dd 0 + dd .fileattr + db 0 + dd .fontfullname +.fileattr rd 40/4 else .dest dd 0 .font db 'FONT CHR' @@ -479,6 +488,7 @@ end if loop .next mov ecx,edx ; ecx - x size movzx dx,byte[edi+6] + mov [BGIheight],dx mov ebx,[esp+36] and ebx,BGI_HAMASK cmp ebx,BGI_HARIGHT @@ -690,7 +700,7 @@ end if .color dd ? .vec_end dd ? BGIfont_Ptr dd 0 -width dd ? +BGIheight dw ? deform dd ? BGIangle dd ? Xscale dd ? diff --git a/programs/demos/bgitest/trunk/bgitest.asm b/programs/demos/bgitest/trunk/bgitest.asm index aef9e8c62e..088076820c 100644 --- a/programs/demos/bgitest/trunk/bgitest.asm +++ b/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 @@ macro ListFonts mcall 47,0x80100,,,0x10ffffff jecxz .nofont lea ebx,[edx+80 shl 16+12] - mov edx,_BGIfont_Prepare.dest+8 - mov esi,BGIfont_Coo-1 + mov edx,_BGIfont_Prepare.fontfullname + mov esi,_BGIfont_Prepare.fontattr-1 sub esi,edx add ecx,0x3b800b8 BGIfont_Outtext diff --git a/programs/demos/bgitest/trunk/macros.inc b/programs/demos/bgitest/trunk/macros.inc index d599dea0e0..0ddc650b65 100644 --- a/programs/demos/bgitest/trunk/macros.inc +++ b/programs/demos/bgitest/trunk/macros.inc @@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld - - - - ; optimize the code for size __regs fix @@ -178,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -222,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/demos/colors/trunk/build_en.bat b/programs/demos/colors/trunk/build_en.bat deleted file mode 100644 index 82e54d9fca..0000000000 --- a/programs/demos/colors/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm colors.asm colors -@pause \ No newline at end of file diff --git a/programs/demos/colors/trunk/build_ru.bat b/programs/demos/colors/trunk/build_ru.bat deleted file mode 100644 index b3e5e7de48..0000000000 --- a/programs/demos/colors/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm colors.asm colors -@pause \ No newline at end of file diff --git a/programs/demos/colors/trunk/colors.asm b/programs/demos/colors/trunk/colors.asm deleted file mode 100644 index 59af1f7d98..0000000000 --- a/programs/demos/colors/trunk/colors.asm +++ /dev/null @@ -1,206 +0,0 @@ -; -; COLOR TABLE -; -; Compile with FASM for Menuet -; - -use32 - - org 0x0 - - db 'MENUET00' ; 8 byte id - dd 38 ; required os - dd START ; program start - dd I_END ; program image size - dd 0x1000 ; required amount of memory - dd 0x1000 ; esp = 0x7FFF0 - dd 0x00000000 ; reserved=no extended header - -include 'lang.inc' -include 'macros.inc' - - -START: ; start of execution - - call shape_window - - call draw_window ; at first, draw the window - -still: - - mov eax,10 ; wait here for event - int 0x40 - - cmp eax,1 ; redraw request ? - jz red - cmp eax,2 ; key in buffer ? - jz key - cmp eax,3 ; button in buffer ? - jz button - - jmp still - - red: ; redraw - call draw_window - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - jmp still - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jnz noclose - mov eax,0xffffffff ; close this program - int 0x40 - noclose: - - jmp still - - -shape_window: - - pusha - - mov eax,50 ; give the address of reference area - mov ebx,0 - mov ecx,shape_reference - int 0x40 - - mov eax,50 ; give the scaling ( 5 -> 2^5 ) - mov ebx,1 - mov ecx,5 - int 0x40 - - popa - - ret - - -shape_reference: - - db 1,0,1,0,1,0,1,0 - db 0,1,0,1,0,1,0,1 - db 1,0,1,0,1,0,1,0 - db 0,1,0,1,0,1,0,1 - db 1,0,1,0,1,0,1,0 - db 0,1,0,1,0,1,0,1 - db 1,0,1,0,1,0,1,0 - db 0,1,0,1,0,1,0,1 - - - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* - - -draw_window: - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw - int 0x40 - - ; DRAW WINDOW - mov eax,0 ; function 0 : define and draw window - mov ebx,100*65536+255 ; [x start] *65536 + [x size] - mov ecx,100*65536+255 ; [y start] *65536 + [y size] - mov edx,0x00000000 - mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide - mov edi,0x0099bbee ; color of frames RRGGBB - int 0x40 - - call draw_colors - - ; CLOSE BUTTON - mov eax,8 ; function 8 : define and draw button - mov ebx,5*65536+12 ; [x start] *65536 + [x size] - mov ecx,5*65536+12 ; [y start] *65536 + [y size] - mov edx,1 ; button id - mov esi,0xccaa22 ; button color RRGGBB - int 0x40 - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw - int 0x40 - - ret - - -draw_colors: - - pusha - - mov [bar],dword 0 - - mov eax,-1 - mov ebx,0 - mov ecx,0 - mov edx,0 - - mov edi,0 - - dc1: - - add eax,1 - cmp eax,256 - jb na1 - mov eax,0 - add ebx,1 - cmp ebx,256 - jb na1 - mov ebx,0 - add ecx,5 - na1: - - mov dl,al - shl edx,8 - mov dl,bl - shl edx,8 - mov dl,cl - - na2: - - pusha - push edx - - xor edx,edx - mov eax,edi - mov ebx,256 - div ebx - mov ebx,edx - mov ecx,eax - - add ebx,[addx] - add ecx,[addy] - - pop edx - mov eax,1 - int 0x40 - popa - - add edi,1 - - cmp edi,256*256 - jb dc1 - - popa - ret - - - -; DATA AREA - -I_END: - -bar dd ? - -add1 dd ? -add2 dd ? - -addx dd ? -addy dd ? diff --git a/programs/demos/eyes/trunk/eyes.asm b/programs/demos/eyes/trunk/eyes.asm index e3b1454fc4..6efba894ea 100644 --- a/programs/demos/eyes/trunk/eyes.asm +++ b/programs/demos/eyes/trunk/eyes.asm @@ -20,7 +20,7 @@ use32 db "MENUET01" dd 0x01 dd ENTRANCE - dd I_END + dd EYES_END dd 0x3000 dd 0x3000 dd 0x0 @@ -30,9 +30,280 @@ include 'macros.inc' ENTRANCE: ; start of code ; ==== main ==== + +call prepare_eyes + +call shape_window + +still: + +call draw_eyes ; draw those funny "eyes" + +mov eax,23 ; wait for event with timeout +mov ebx,TIMEOUT +int 0x40 + +cmp eax,1 ; redraw ? +jnz no_draw +call redraw_overlap +no_draw: + +cmp eax,2 ; key ? +jz key + +cmp eax,3 ; button ? +jz button + +jmp still ; loop + +; EVENTS + +key: +mov eax,2 ; just read and ignore +int 0x40 +jmp still + +button: ; analyze button +mov eax,-1 ; this is button 1 - we have only one button :-) +int 0x40 +jmp still + +; -====- declarations -====- + +imagedata equ EYES_END +skindata equ EYES_END+925 +winref equ EYES_END+6325 + +; -====- shape -====- + +shape_window: + +mov eax,50 ; set up shape reference area +mov ebx,0 +mov ecx,winref +int 0x40 + +ret + +; -====- redrawing -====- + +draw_eyes: ; check mousepos to disable blinking + +mov eax,37 +xor ebx,ebx +int 0x40 +cmp dword [mouse],eax +jne redraw_ok +ret +redraw_ok: +mov [mouse],eax + +redraw_overlap: ; label for redraw event (without checkmouse) + +mov eax,12 +mov ebx,1 +int 0x40 + +xor eax,eax ; define window +mov ebx,[win_ebx] +mov ecx,[win_ecx] +xor edx,edx +xor esi,esi +xor edi,edi +int 0x40 + +mov eax,8 ; define closebutton +mov ebx,60 +mov ecx,45 +mov edx,1 +int 0x40 + +mov eax,7 +mov ebx,skindata +mov ecx,60*65536+30 +mov edx,15 +int 0x40 + +mov eax,15 +mov ebx,30 +call draw_eye_point +add eax,30 +call draw_eye_point + +mov eax,12 +mov ebx,2 +int 0x40 + +ret + +draw_eye_point: ; draw eye point (EAX=X, EBX=Y) +pusha + +mov ecx, [mouse] ; ecx = mousex, edx = mousey +mov edx,ecx +shr ecx,16 +and edx,0xFFFF + +; ===> calculate position + +push eax +push ebx +mov byte [sign1],0 +mov esi, [win_ebx] +shr esi,16 +add eax,esi +sub ecx,eax ; ECX=ECX-EAX (signed) , ECX=|ECX| +jnc abs_ok_1 +neg ecx +mov byte [sign1],1 +abs_ok_1: +mov [temp1],ecx +mov byte [sign2],0 +mov esi,[win_ecx] +shr esi,16 +add ebx,esi +sub edx,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX| +jnc abs_ok_2 +neg edx +mov byte [sign2],1 +abs_ok_2: +mov [temp2],edx +pop ebx +pop eax + +push eax ; ECX*=ECX +push edx +xor eax,eax +xor edx,edx +mov ax,cx +mul cx +shl edx,16 +or eax,edx +mov ecx,eax +pop edx +pop eax + +push eax ; EDX*=EDX +push ecx +mov ecx,edx +xor eax,eax +xor edx,edx +mov ax,cx +mul cx +shl edx,16 +or eax,edx +mov edx,eax +pop ecx +pop eax + +push ebx +push ecx +push edx +push eax +mov ebx,ecx ; EBX=ECX+EDX +add ebx,edx +xor edi,edi ; ESI=SQRT(EBX) +mov ecx,edi +mov edx,edi +inc edi +mov eax,edi +inc edi +sqrt_loop: +add ecx,eax +add eax,edi +inc edx +cmp ecx,ebx +jbe sqrt_loop +dec edx +mov esi,edx +mov ax,si ; ESI=ESI/7 +mov dl,7 +div dl +and ax,0xFF +mov si,ax ; ESI ? 0 : ESI=1 +jnz nozeroflag1 +mov si,1 +nozeroflag1: + +pop eax +pop edx +pop ecx +pop ebx + +push eax ; ECX=[temp1]/ESI +push edx +mov eax,[temp1] +mov dx,si +div dl +mov cl,al +and ecx,0xFF +pop edx +pop eax + +cmp byte [sign1],1 +je subtract_1 +add eax,ecx ; EAX=EAX+ECX +jmp calc_ok_1 +subtract_1: +sub eax,ecx ; EAX=EAX-ECX +calc_ok_1: + +push eax ; EDX=[temp2]/ESI +push ecx +mov eax,[temp2] +mov dx,si +div dl +mov dl,al +and dx,0xFF +pop ecx +pop eax + +cmp byte [sign2],1 +je subtract_2 +add ebx,edx ; EBX=EBX+EDX +jmp calc_ok_2 +subtract_2: +sub ebx,edx ; EBX=EBX-EDX +calc_ok_2: + +; <=== + +mov ecx,ebx ; draw point +mov ebx,eax +mov eax,13 +dec ecx +dec ecx +dec ebx +dec ebx +shl ecx,16 +add ecx,4 +shl ebx,16 +add ebx,4 +mov eax,13 +xor edx,edx +int 0x40 + +popa +ret + +; -====- working on images and window -====- + prepare_eyes: -mov esi,imagedata ; transform grayscale to putimage format +;mov eax,6 ; load EYES.RAW +;mov ebx,graphix +;mov ecx,0x00000000 +;mov edx,0xFFFFFFFF +;mov esi,imagedata +;int 0x40 +;cmp eax,0xFFFFFFFF +;jnz filefound + +;mov eax,-1 ; file not exists... +;int 0x40 + +;filefound: +mov esi,imagedata+25 ; transform grayscale to putimage format mov edi,skindata mov ecx,30 transform_loop: @@ -63,7 +334,7 @@ sub eax,30*65536 mov [win_ebx],eax mov [win_ecx],dword 10*65536+44 -mov esi,imagedata ; calculate shape reference area +mov esi,imagedata+25 ; calculate shape reference area mov edi,winref mov ecx,900 ; disable drag bar mov al,0 @@ -80,203 +351,19 @@ call copy_line pop ecx loop shape_loop -; -====- shape -====- - -shape_window: - -mov eax,50 ; set up shape reference area -xor ebx,ebx -mov ecx,winref -int 0x40 - -call draw_window - -still: - -call draw_eyes ; draw those funny "eyes" - -_wait: -mov eax,23 ; wait for event with timeout -mov ebx,TIMEOUT -int 0x40 - dec eax - jz redraw - dec eax - jz key - dec eax - jnz still -button: - or eax, -1 - int 0x40 -key: - mov al, 2 - int 0x40 - jmp still -redraw: - call draw_window - call redraw_eyes - jmp _wait - -; -====- redrawing -====- - -draw_eyes: ; check mousepos to disable blinking - -mov eax,37 -xor ebx,ebx -int 0x40 -cmp dword [mouse],eax -jne redraw_ok ret -redraw_ok: -mov [mouse],eax - -redraw_eyes: -mov eax,7 -mov ebx,skindata -mov ecx,60*65536+30 -mov edx,15 -int 0x40 - -mov eax,15 -mov ebx,30 -call draw_eye_point -add eax,30 -call draw_eye_point -ret - -draw_window: - -mov eax,12 -mov ebx,1 -int 0x40 - -xor eax,eax ; define window -mov ebx,[win_ebx] -mov ecx,[win_ecx] -xor edx,edx -xor esi,esi -xor edi,edi -int 0x40 - -mov eax,8 ; define closebutton -mov ebx,60 -mov ecx,45 -mov edx,1 -int 0x40 - -mov eax,12 -mov ebx,2 -int 0x40 - -ret - -draw_eye_point: ; draw eye point (EAX=X, EBX=Y) -pusha - - movzx ecx, word [mouse+2] ; ecx = mousex, esi = mousey - movzx esi, word [mouse] - -; ===> calculate position - -push eax -push ebx -mov byte [sign1],0 -mov edx, [win_ebx] -shr edx,16 -add eax,edx -sub ecx,eax ; ECX=ECX-EAX (signed) , ECX=|ECX| -jnc abs_ok_1 -neg ecx -mov byte [sign1],1 -abs_ok_1: - push ecx ; save x distance -mov byte [sign2],0 -mov edx,[win_ecx] -shr edx,16 -add ebx,edx -sub esi,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX| -jnc abs_ok_2 -neg esi -mov byte [sign2],1 -abs_ok_2: -mov [temp2],esi - -; ESI = ECX*ECX+ESI*ESI - imul ecx, ecx - imul esi, esi - add esi, ecx - -xor ecx,ecx ; EDX=SQRT(EBX) -xor edx,edx -mov eax,1 -sqrt_loop: -; in this moment ecx=edx*edx, eax=1+2*edx -add ecx,eax -inc eax -inc eax -inc edx -cmp ecx,esi -jbe sqrt_loop -dec edx -mov eax,edx ; EDX=EDX/7 -mov dl,7 -div dl -and eax,0xFF -mov edx,eax ; EDX ? 0 : EDX=1 -jnz nozeroflag1 -inc edx -nozeroflag1: - - pop eax ; EAX = x distance - ; ECX=EAX/EDX -div dl -movzx ecx,al -pop ebx -pop eax - - cmp byte [sign1], 0 - jz @f - neg ecx -@@: - add eax, ecx - -push eax ; ESI=[temp2]/EDX -mov eax,[temp2] -div dl -movzx esi,al -pop eax - - cmp byte [sign2], 0 - jz @f - neg esi -@@: - add ebx, esi - -; <=== - -; draw point - lea ecx, [ebx-2] - lea ebx, [eax-2] -shl ecx,16 -add ecx,4 -shl ebx,16 -add ebx,4 -mov eax,13 -xor edx,edx -int 0x40 - -popa -ret - -; -====- working on images and window -====- copy_line: ; copy single line to shape reference area mov ecx,30 cpl_loop: lodsb -; input is image: 0xFF = white pixel, 0 = black pixel -; output is membership boolean: 0 = pixel no, 1 = pixel ok -inc eax +cmp al,0xFF +jnz set_one +mov al,0 +jmp cpl_ok +set_one: +mov al,1 +cpl_ok: stosb loop cpl_loop ret @@ -288,19 +375,14 @@ ret win_ebx dd 0x0 win_ecx dd 0x0 mouse dd 0xFFFFFFFF - -EYES_END: ; end of code -imagedata: -; texture is 900 bytes starting from 25th -file "eyes.raw":25,900 -I_END: +;graphix db "EYES.RAW " ; temporary storage for math routines -sign1 db ? -sign2 db ? -align 4 -temp2 dd ? +temp1 dd 0 +temp2 dd 0 +sign1 db 0 +sign2 db 0 -skindata rb 60*30*3 -winref rb 45*60 +EYES_END: ; end of code +file "EYES.RAW" diff --git a/programs/demos/eyes/trunk/macros.inc b/programs/demos/eyes/trunk/macros.inc index d599dea0e0..0ddc650b65 100644 --- a/programs/demos/eyes/trunk/macros.inc +++ b/programs/demos/eyes/trunk/macros.inc @@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld - - - - ; optimize the code for size __regs fix @@ -178,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -222,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/demos/fire/trunk/build.bat b/programs/demos/fire/trunk/build.bat new file mode 100644 index 0000000000..81602fe001 --- /dev/null +++ b/programs/demos/fire/trunk/build.bat @@ -0,0 +1,2 @@ +@fasm fire.asm fire +@pause \ No newline at end of file diff --git a/programs/demos/fire/trunk/build_en.bat b/programs/demos/fire/trunk/build_en.bat deleted file mode 100644 index 3e927bbf2d..0000000000 --- a/programs/demos/fire/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm fire.asm fire -@pause \ No newline at end of file diff --git a/programs/demos/fire/trunk/build_ru.bat b/programs/demos/fire/trunk/build_ru.bat deleted file mode 100644 index 691aab83b5..0000000000 --- a/programs/demos/fire/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm fire.asm fire -@pause \ No newline at end of file diff --git a/programs/demos/fire/trunk/fire.asm b/programs/demos/fire/trunk/fire.asm index 36001d914a..eede1e0e0b 100644 --- a/programs/demos/fire/trunk/fire.asm +++ b/programs/demos/fire/trunk/fire.asm @@ -13,7 +13,6 @@ use32 dd mem_end dd 0,0 ; no parameters, no path -;include 'lang.inc' include 'macros.inc' START: diff --git a/programs/demos/fire/trunk/macros.inc b/programs/demos/fire/trunk/macros.inc index d599dea0e0..0ddc650b65 100644 --- a/programs/demos/fire/trunk/macros.inc +++ b/programs/demos/fire/trunk/macros.inc @@ -143,10 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld - - - - ; optimize the code for size __regs fix @@ -178,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -222,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/demos/fire2/trunk/build.bat b/programs/demos/fire2/trunk/build.bat new file mode 100644 index 0000000000..2376b6a0eb --- /dev/null +++ b/programs/demos/fire2/trunk/build.bat @@ -0,0 +1,2 @@ +@fasm fire2.asm fire2 +@pause \ No newline at end of file diff --git a/programs/demos/fire2/trunk/build_en.bat b/programs/demos/fire2/trunk/build_en.bat deleted file mode 100644 index e85ef4789f..0000000000 --- a/programs/demos/fire2/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm fire2.asm fire2 -@pause \ No newline at end of file diff --git a/programs/demos/fire2/trunk/build_ru.bat b/programs/demos/fire2/trunk/build_ru.bat deleted file mode 100644 index 97b8211907..0000000000 --- a/programs/demos/fire2/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm fire2.asm fire2 -@pause \ No newline at end of file diff --git a/programs/demos/fire2/trunk/fire2.asm b/programs/demos/fire2/trunk/fire2.asm index 2795a6ab16..4fe8de1dee 100644 --- a/programs/demos/fire2/trunk/fire2.asm +++ b/programs/demos/fire2/trunk/fire2.asm @@ -9,7 +9,6 @@ use32 dd mem_end dd 0x0, 0x0 -;include 'lang.inc' START: mov edi, my_img diff --git a/programs/develop/cmd/trunk/macros.inc b/programs/develop/cmd/trunk/macros.inc index 1d153e8723..0ddc650b65 100644 --- a/programs/develop/cmd/trunk/macros.inc +++ b/programs/develop/cmd/trunk/macros.inc @@ -143,9 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld - - - ; optimize the code for size __regs fix @@ -177,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -221,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/system/cpuspeed/trunk/build_en.bat b/programs/develop/examples/cpuspeed/trunk/build_en.bat similarity index 100% rename from programs/system/cpuspeed/trunk/build_en.bat rename to programs/develop/examples/cpuspeed/trunk/build_en.bat diff --git a/programs/system/cpuspeed/trunk/build_ru.bat b/programs/develop/examples/cpuspeed/trunk/build_ru.bat similarity index 100% rename from programs/system/cpuspeed/trunk/build_ru.bat rename to programs/develop/examples/cpuspeed/trunk/build_ru.bat diff --git a/programs/system/cpuspeed/trunk/cpuspeed.asm b/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm similarity index 96% rename from programs/system/cpuspeed/trunk/cpuspeed.asm rename to programs/develop/examples/cpuspeed/trunk/cpuspeed.asm index aec0d17b53..85a91c852a 100644 --- a/programs/system/cpuspeed/trunk/cpuspeed.asm +++ b/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm @@ -1,153 +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 - +; +; 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 + diff --git a/programs/system/cpuspeed/trunk/macros.inc b/programs/develop/examples/cpuspeed/trunk/macros.inc similarity index 93% rename from programs/system/cpuspeed/trunk/macros.inc rename to programs/develop/examples/cpuspeed/trunk/macros.inc index 83b3eddabe..4a055a831e 100644 --- a/programs/system/cpuspeed/trunk/macros.inc +++ b/programs/develop/examples/cpuspeed/trunk/macros.inc @@ -1,266 +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 - -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 +; 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 + +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 \ No newline at end of file diff --git a/programs/system/ir/trunk/build_en.bat b/programs/develop/examples/ir/trunk/build_en.bat similarity index 100% rename from programs/system/ir/trunk/build_en.bat rename to programs/develop/examples/ir/trunk/build_en.bat diff --git a/programs/system/ir/trunk/build_ru.bat b/programs/develop/examples/ir/trunk/build_ru.bat similarity index 100% rename from programs/system/ir/trunk/build_ru.bat rename to programs/develop/examples/ir/trunk/build_ru.bat diff --git a/programs/system/ir/trunk/ir.asm b/programs/develop/examples/ir/trunk/ir.asm similarity index 95% rename from programs/system/ir/trunk/ir.asm rename to programs/develop/examples/ir/trunk/ir.asm index b779a55cf3..b2e0ecff8e 100644 --- a/programs/system/ir/trunk/ir.asm +++ b/programs/develop/examples/ir/trunk/ir.asm @@ -1,268 +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: +; +; 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: diff --git a/programs/games/life/trunk/macros.inc b/programs/develop/examples/ir/trunk/macros.inc similarity index 93% rename from programs/games/life/trunk/macros.inc rename to programs/develop/examples/ir/trunk/macros.inc index d599dea0e0..a04ab1d2e7 100644 --- a/programs/games/life/trunk/macros.inc +++ b/programs/develop/examples/ir/trunk/macros.inc @@ -1,267 +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 - -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 +; 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 + +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 \ No newline at end of file diff --git a/programs/network/md5/trunk/build_en.bat b/programs/develop/examples/md5/trunk/build_en.bat similarity index 100% rename from programs/network/md5/trunk/build_en.bat rename to programs/develop/examples/md5/trunk/build_en.bat diff --git a/programs/network/md5/trunk/build_ru.bat b/programs/develop/examples/md5/trunk/build_ru.bat similarity index 100% rename from programs/network/md5/trunk/build_ru.bat rename to programs/develop/examples/md5/trunk/build_ru.bat diff --git a/programs/network/md5/trunk/md5.asm b/programs/develop/examples/md5/trunk/md5.asm similarity index 96% rename from programs/network/md5/trunk/md5.asm rename to programs/develop/examples/md5/trunk/md5.asm index 7a67a79b7e..a0e55457be 100644 --- a/programs/network/md5/trunk/md5.asm +++ b/programs/develop/examples/md5/trunk/md5.asm @@ -1,445 +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: +; Пример реализации генератора 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: diff --git a/programs/network/rtdata/trunk/build_en.bat b/programs/develop/examples/rtdata/trunk/build_en.bat similarity index 100% rename from programs/network/rtdata/trunk/build_en.bat rename to programs/develop/examples/rtdata/trunk/build_en.bat diff --git a/programs/network/rtdata/trunk/build_ru.bat b/programs/develop/examples/rtdata/trunk/build_ru.bat similarity index 100% rename from programs/network/rtdata/trunk/build_ru.bat rename to programs/develop/examples/rtdata/trunk/build_ru.bat diff --git a/programs/develop/mview/trunk/macros.inc b/programs/develop/examples/rtdata/trunk/macros.inc similarity index 93% rename from programs/develop/mview/trunk/macros.inc rename to programs/develop/examples/rtdata/trunk/macros.inc index d599dea0e0..5824e42816 100644 --- a/programs/develop/mview/trunk/macros.inc +++ b/programs/develop/examples/rtdata/trunk/macros.inc @@ -1,267 +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 - -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 +; 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 + +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 \ No newline at end of file diff --git a/programs/network/rtdata/trunk/rtdata.asm b/programs/develop/examples/rtdata/trunk/rtdata.asm similarity index 95% rename from programs/network/rtdata/trunk/rtdata.asm rename to programs/develop/examples/rtdata/trunk/rtdata.asm index e252416b6c..8da75fa01e 100644 --- a/programs/network/rtdata/trunk/rtdata.asm +++ b/programs/develop/examples/rtdata/trunk/rtdata.asm @@ -1,235 +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 +; +; 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 diff --git a/programs/develop/fasm/trunk/expressi.inc b/programs/develop/fasm/trunk/expressi.inc index 2446f71694..ee537135ae 100644 --- a/programs/develop/fasm/trunk/expressi.inc +++ b/programs/develop/fasm/trunk/expressi.inc @@ -2,7 +2,7 @@ ; flat assembler core ; Copyright (c) 1999-2006, Tomasz Grysztar. ; All rights reserved. - + convert_expression: push ebp call get_fp_value diff --git a/programs/develop/fasm/trunk/fasm.asm b/programs/develop/fasm/trunk/fasm.asm index a6f9ea00b9..c814da3979 100644 --- a/programs/develop/fasm/trunk/fasm.asm +++ b/programs/develop/fasm/trunk/fasm.asm @@ -22,7 +22,7 @@ APP_MEMORY = 0x00800000 ;; Menuet header -appname equ "FASM " +appname equ "flat assembler " use32 @@ -392,11 +392,11 @@ text: s_compile db 'COMPILE' s_run db ' RUN ' -infile db 'EXAMPLE.ASM' +infile db 'example.asm' times MAX_PATH+$-infile db 0 -outfile db 'EXAMPLE' +outfile db 'example' times MAX_PATH+$-outfile db 0 -path db '/RD/1/' +path db '/rd/1/' times MAX_PATH+$-path db 0 lf db 13,10,0 diff --git a/programs/develop/fasm/trunk/formats.inc b/programs/develop/fasm/trunk/formats.inc index e14f8a3409..63d77bdafe 100644 --- a/programs/develop/fasm/trunk/formats.inc +++ b/programs/develop/fasm/trunk/formats.inc @@ -1,4 +1,4 @@ - + ; flat assembler core ; Copyright (c) 1999-2006, Tomasz Grysztar. ; All rights reserved. diff --git a/programs/develop/fasm/trunk/version.inc b/programs/develop/fasm/trunk/version.inc index 7d10689443..26024f9587 100644 --- a/programs/develop/fasm/trunk/version.inc +++ b/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 diff --git a/programs/develop/fasm/trunk/x86_64.inc b/programs/develop/fasm/trunk/x86_64.inc index 2c71648209..3e3abffeb5 100644 --- a/programs/develop/fasm/trunk/x86_64.inc +++ b/programs/develop/fasm/trunk/x86_64.inc @@ -223,6 +223,10 @@ basic_instruction: cdq cmp ecx,edx jne value_out_of_range + cmp [value_type],4 + jne get_simm32_ok + mov [value_type],2 + get_simm32_ok: ret basic_reg: lods byte [esi] @@ -6019,6 +6023,9 @@ get_address: mov edx,[symbol_identifier] mov [address_symbol],edx mov edx,eax + ror ecx,16 + mov cl,[value_type] + rol ecx,16 mov bx,0FF00h address_ok: ret diff --git a/programs/develop/mtdbg/build.bat b/programs/develop/mtdbg/build.bat new file mode 100644 index 0000000000..47925939ee --- /dev/null +++ b/programs/develop/mtdbg/build.bat @@ -0,0 +1,2 @@ +@fasm mtdbg.asm mtdbg +@pause diff --git a/programs/develop/mtdbg/mtdbg.asm b/programs/develop/mtdbg/mtdbg.asm new file mode 100644 index 0000000000..e5252aea5d --- /dev/null +++ b/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 %X + lodsb ; get + 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 [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 [] - go on (resume execution of debugging program)',10 + db 's = - program step',10 + db 'p = - 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 '? - calculate value of expression',10 + db 'd [] - dump data at given address',10 + db 'u [] - unassemble instructions at given address',10 + db 'r or',10 + db 'r = - set register value',10,0 +aBreakpoints db 12,'breakpoints',0 +help_breaks_msg db 'List of breakpoints commands:',10 + db 'bp - set breakpoint on execution',10 + db 'bpm[b|w|d] - set breakpoint on memory access',10 + db 'bl [] - breakpoint(s) info',10 + db 'bc ... - clear breakpoint',10 + db 'bd ... - disable breakpoint',10 + db 'be ... - 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 [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 - 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 - 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: ? ',10,0 + +aUnassemble db 2,'u',0 +UnassembleHelp db 'Unassemble',10 +UnassembleSyntax: + db 'Usage: u - 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 ',10 + db ' or: r = - set value of to ',10,0 + +aBp db 3,'bp',0 +BpHelp db 'set BreakPoint on execution',10 +BpSyntax db 'Usage: bp ',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] ',10 + db ' bpmw [w] ',10 + db ' bpmd [w] ',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 - display info on particular breakpoint',10,0 + +aBc db 3,'bc',0 +BcHelp db 'Breakpoint Clear',10 +BcSyntax db 'Usage: bc ',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 ',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 ',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: diff --git a/programs/develop/mtdbg/mtdbg.txt b/programs/develop/mtdbg/mtdbg.txt new file mode 100644 index 0000000000..fd852538ba --- /dev/null +++ b/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' шыш ), эю ьюцэю ш юЄърчрЄ№ё . +╧Ёш юЄърчх ш т ёыєўрх, ъюуфр яЁюуЁрььр єяръютрэр ўхь-Єю эхшчтхёЄэ√ь, ьюцэю +шёяюы№чютрЄ№ ъюьрэфє "unpack" (схч рЁуєьхэЄют). ┬√ч√трщЄх х╕ Єюы№ъю т ёыєўрх, +ъюуфр т√ єтхЁхэ√, ўЄю яЁюуЁрььр єяръютрэр ш ўЄю єяЁртыхэшх х∙╕ эх фю°ыю фю +юёэютэюую ъюфр! + +╟руЁєцхээє■ яЁюуЁрььє ьюцэю яЁшсшЄ№ ъюьрэфющ "terminate" (схч рЁуєьхэЄют). +╩юьрэфр "detach" (схч рЁуєьхэЄют) юЄъы■ўрхЄё  юЄ яЁюуЁрьь√, яюёых ўхую +яЁюуЁрььр яЁюфюыцрхЄ т√яюыэ Є№ё  эюЁьры№эю, ъръ хёыш с√ юЄырфўшър эх с√ыю. +╧юёых юсхшї ¤Єшї ъюьрэф яЁюуЁрььр яхЁхёЄр╕Є с√Є№ юЄырцштрхьющ. + +╠юцэю чрэютю чруЁєчшЄ№ яЁюуЁрььє фы  юЄырфъш ъюьрэфющ "reload" (схч +рЁуєьхэЄют). ┼ёыш єцх хёЄ№ чруЁєцхээр  яЁюуЁрььр, Єю юэр яЁшсштрхЄё  ш +чряєёърхЄё  (ё ёрьюую эрўрыр) эют√щ ¤ъчхьяы Ё (ё Єющ цх ъюьрэфэющ ёЄЁюъющ), +т ¤Єюь ёыєўрх ъюьрэфр рэрыюушўэр ъюьрэфрь +terminate +load +┬ яЁюЄштэюь ёыєўрх чрэютю чруЁєцрхЄё  яЁюуЁрььр, ъюЄюЁє■ юЄырцштрыш яюёыхфэхщ +(т Єхъє∙хь ёхрэёх ЁрсюЄ√ ё mtdbg) (ё Єющ цх ъюьрэфэющ ёЄЁюъющ), Є.х. яюўЄш Єю +цх ёрьюх, ўЄю ш +load , +эю ъюьрэфр 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 diff --git a/programs/develop/mview/trunk/build_en.bat b/programs/develop/mview/trunk/build_en.bat deleted file mode 100644 index 6d2ebfe88a..0000000000 --- a/programs/develop/mview/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm mview.asm mview -@pause \ No newline at end of file diff --git a/programs/develop/mview/trunk/build_ru.bat b/programs/develop/mview/trunk/build_ru.bat deleted file mode 100644 index 11e9ec8481..0000000000 --- a/programs/develop/mview/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm mview.asm mview -@pause \ No newline at end of file diff --git a/programs/develop/mview/trunk/mview.asm b/programs/develop/mview/trunk/mview.asm deleted file mode 100644 index ca4f529aca..0000000000 --- a/programs/develop/mview/trunk/mview.asm +++ /dev/null @@ -1,1439 +0,0 @@ -; CODE VIEWER - Compile with FASM for Menuet - -;B+ System header -use32 -org 0x0 - db 'MENUET00' - dd 38 - dd START - dd I_END - dd 0x100000 - dd 0x00000000 - -include 'lang.inc' -include 'macros.inc' -;E:. - -;B+ Definitions -type_begin equ 0 -type_end_normal equ 2 -type_not_end equ 4 -type_end_plus equ 6 -type_include equ 8 -type_file_end equ 11 -; +1, if active jump - -char_end equ 11 -new_line equ 10 - -win_width equ (496+6*6) -win_field equ (4+10+6*6) -win_toptext equ 38+4 -;B+ Keys -KEY_UP equ (130+48) -KEY_DOWN equ (129+48) -KEY_PGUP equ (136+48) -KEY_PGDOWN equ (135+48) -;E:. -start_data equ (I_END+10+27+16) -;E:. - -;B+ Execution -START: - jmp load_file1 -;B+ Main cicle -redr: - call draw_window -still: - mov eax,10 - int 0x40 -still_: - cmp eax,1 - je redr - cmp eax,2 - jne no_key - mov eax,2 - int 0x40 - jmp key -no_key: - cmp eax,3 - jne still - mov eax,17 - int 0x40 - cmp ah,1 - jne .no_close - mov eax,-1 - int 0x40 -.no_close: - jmp button - jmp still -;E:. -key: -;B+ Scroll text - mov ebx,[top_pos] - mov [activ_pos],ebx - mov bx,[top_line] - mov [activ_line],bx - mov bx,[top_depth] - mov [activ_depth],bx - mov ebx,[top_file] - mov [activ_file],ebx - cmp ah,KEY_DOWN ;key_up - jne .no_down - call line_down - jmp .save_shift -.no_down: - cmp ah,KEY_UP ;key down - jne .no_up - call line_up - jmp .save_shift -.no_up: - cmp ah,KEY_PGUP ;key page up - jne .no_pgup - mov edi,35 -.next_line: - call line_up - dec edi - jnz .next_line - jmp .save_shift -.no_pgup: - cmp ah,KEY_PGDOWN ;key page down - jne .no_pgdown - mov edi,35 -.next_line1: - call line_down - dec edi - jnz .next_line1 - jmp .save_shift -.no_pgdown: - jmp still -.save_shift: - mov ebx,[activ_pos] - mov [top_pos],ebx - mov bx,[activ_line] - mov [top_line],bx - mov bx,[activ_depth] - mov [top_depth],bx - mov ebx,[activ_file] - mov [top_file],ebx - ; Show new text - mov ebx,1 - mov eax,12 - int 0x40 - call show_text - mov ebx,2 - mov eax,12 - int 0x40 - jmp still -;E:. -button: -;B+ Distribute button events - shr eax,8 - and eax,0xff - cmp eax,100 - jge down_buttons -;B+ Left buttons -;B+ Find line place - sub eax,2 - mov ebx,[top_pos] - mov [activ_pos],ebx - mov bx,[top_depth] - mov [activ_depth],bx - mov ebx,[top_file] - mov [activ_file],ebx - mov bx,[top_line] - mov [activ_line],bx - mov ecx,eax - or ecx,ecx - jz .line_find -.next_line: - push ecx - call line_down - pop ecx - loop .next_line -.line_find: - mov ebx,[activ_pos] -;E:. -;B+ Switch, if special line - mov cx,[ebx] - test cx,not 15 - jnz still - cmp cx,type_begin - je .is_begin_end - cmp cx,type_begin+1 - jne .not_begin_end -.is_begin_end: - xor [ebx],word 1 - mov ebx,[ebx+4] - add ebx,[activ_file] - xor [ebx],word 1 - jmp .paint -.not_begin_end: - cmp cx,type_include - je .open_file - ;close file - cmp cx,type_include+1 - jne .not_include - xor [ebx],word 1 - jmp .paint -.open_file: - ;Open file - cmp dword [ebx+4],-1 - je .load_file - xor [ebx],word 1 - jmp .paint -.paint1: - pop ebx - jmp .paint -.load_file: - push ebx -;B+ Prepare file name - mov ecx,26 - mov edi,incl_filename - mov al,' ' - cld -rep stosb - mov cl,[skoba_txt] - mov ch,[skoba_txt+1] - add ebx,12 -.next_char: - cmp [ebx],cl - je .begin - cmp byte [ebx],new_line - je .paint1 - inc ebx - jmp .next_char -.begin: - inc ebx - mov esi,ebx -.next_char1: - cmp [ebx],ch - je .end - cmp byte [ebx],new_line - je .paint1 - inc ebx - jmp .next_char1 -.end: - sub ebx,esi - mov edi,incl_filename - mov ecx,ebx - push ecx -rep movsb -; mov al,0 -; stosb - - ;Save in memory - mov ecx,[esp] - mov esi,incl_filename - mov edi,[end_of_file] -rep movsb - pop ecx - mov [edi],ecx - add ecx,2 - add [end_of_file],ecx - - mov ebx,[esp] -;E:. - mov edi,[top_free_file] - mov [ebx+4],edi - - mov [activ_pos],ebx - mov eax,[activ_file] - sub ebx,eax - mov [incl_line],ebx - push eax - call line_down - pop eax - mov ebx,[activ_pos] - sub ebx,eax - mov [incl_next],ebx - pop ebx - xor [ebx],word 1 - push eax - mov eax,[end_of_file] - add eax,16 - mov [activ_file],eax - lea edi,[file_array+4*edi] - mov [edi],eax - mov [activ_pos],eax - - mov ebx,[incl_line] - mov [eax-12],ebx - mov bx,[activ_line] - dec bx - mov word [eax-6],bx -;B+ Save number for new file - mov ebx,[esp] - cmp ebx,[file_array] - jne .no_root - mov [eax-8],word 0 - jmp .parent_ok -.no_root: - mov ebx,[esp] - mov bl,[ebx-2] - and ebx,0xff - mov [eax-8],bx -.parent_ok: - push eax -;E:. - call add_file - mov edi,[block_pointer] - mov word [edi+4],char_end - add [block_pointer],8 - push edi - call fresh_file - pop edi eax - mov [block_pointer],edi - -;B+ Save newfile line count - mov edi,[line_] - mov word [eax-4],di -;E:. - pop eax - - mov [activ_file],eax - inc [top_free_file] - jmp .paint -.not_include: - -.paint: - mov ebx,1 - mov eax,12 - int 0x40 - call show_text - mov ebx,2 - mov eax,12 - int 0x40 -;E:. - jmp still -;E:. -down_buttons: -;B+ If down buttons - cmp eax,101 - je load_file ;Button 'Load' - sub eax,100 - mov edx,[str_table+4*eax] - mov [str_start],edx -;B+ Clear old info - push edx - ;clear text - mov ecx,0xaa0000 - call print_str - pop edx - ;clear memory place - mov ecx,[edx] - lea edi,[edx+8] - mov eax,' ' - cld -rep stosb -;E:. - mov ebx,[edx] - mov [max_len],ebx - mov ebx,[edx+4] - jmp load_str -save_str: -;B+ Save in base place -;B+ If file convert to upper case - mov eax,it1 - cmp eax,[str_start] - jne .no_file - mov ecx,0xaa0000 - mov edx,str_ - mov esi,[it1] - mov ebx,[it1+4] - mov eax,4 - int 0x40 - mov edx,edi - mov eax,str_ - dec eax - inc edx -.next_char: - inc eax - dec edx - jz .no_file - cmp byte [eax],'a' - jl .next_char - cmp byte [eax],'z' - jg .next_char - add byte [eax],'A'-'a' - jmp .next_char -.no_file: -;E:. - mov edx,[str_start] - add edx,8 - mov ecx,edi - add edi,edx - mov byte [edi],char_end - mov eax,it1 - cmp eax,[str_start] - jne .no_null - mov byte [edi],' ' ;0 -.no_null: - mov esi,str_ - mov edi,edx - cld -rep movsb - mov ecx,0xffffff - jmp print_str -;E:. -;E:. -;E:. -;B+ String tools -;B+ Data for load string -curs db '_' -str_: times 100 db ' ' - db char_end -max_len dd 10 -;E:. -load_str: -;B+ Load text field - xor edi,edi - mov ecx,0xffaaaa - mov esi,1 -.next_char: - mov edx,curs - mov eax,4 - int 0x40 -;B+ Get key event - mov eax,10 - int 0x40 - push eax - mov ecx,0xaa0000 - mov eax,4 - int 0x40 - pop eax - cmp eax,2 - je .yes_key - call save_str - jmp still_ -.yes_key: - mov eax,2 - int 0x40 -;E:. -;B+ Test enter - cmp ah,13 - jne .no_ok - call save_str - jmp still -.no_ok: -;E:. -;B+ Test backspace - cmp ah,8 - jne .no_backsp - or edi,edi - jz .next_char - mov byte [str_+edi],' ' - mov ecx,0xaa0000 - mov eax,4 - int 0x40 - dec edi - sub ebx,6*65536 - lea edx,[str_+edi] - int 0x40 - mov ecx,0xffaaaa - jmp .next_char - .no_backsp: -;E:. -;B+ Prin 1 char - mov [str_+edi],ah - mov ecx,0xaa0000 - mov eax,4 - int 0x40 - mov ecx,0xffaaaa - lea edx,[str_+edi] - cmp [max_len],edi - je .next_char - int 0x40 - add ebx,6*65536 - inc edi -;E:. - jmp .next_char -;E:. -print_str: -;B+ Print select string - mov ebx,[str_start] - lea edx,[ebx+8] - mov esi,[ebx] - mov ebx,[ebx+4] - mov eax,4 - int 0x40 -;B+ Test special strings - pusha - mov eax,[str_start] - cmp eax,it2 - jge .is_ok1 - popa - ret -.is_ok1: - cmp eax,it3 - jle .is_ok - popa - ret -.is_ok: -;E:. - add eax,8 -.next_char: - mov esi,1 - cmp byte [eax],' ' - jne .no_space -;B+ Draw special space - push eax - mov edx,space - mov eax,4 - int 0x40 - push ebx - sub ebx,1*65536 - mov edx,dot - int 0x40 - add ebx,3*65536 - int 0x40 - pop ebx - pop eax -;E:. -.no_space: - add ebx,6*65536 - cmp byte [eax],char_end - jne .no_ret - popa - ret -.no_ret: - inc eax - jmp .next_char - -space db '_' -dot db '.' -;E:. -;E:. -;B+ Add / remove files -add_file: -;B+ Load and link file - mov eax,[activ_file] - push eax - mov ebx,incl_filename - mov ecx,0 - mov edx,-1 - mov esi,eax - mov eax,6 - int 0x40 - - mov ebx,[esp] - inc eax - mov [ebx-16],eax - dec eax - add ebx,eax - add eax,16+15 +20 ;??? - add [end_of_file],eax - mov byte [ebx],new_line - mov word [ebx+1],char_end - mov ax,[activ_line] - mov word [ebx+3],ax - mov eax,[incl_next] - mov [ebx+5],eax - mov dword [ebx+9],new_line - mov byte [ebx+13],new_line - pop ebx - mov eax,[top_free_file] - mov byte [ebx-2],al ; this file num - mov byte [ebx-1],new_line - ret -;E:. -;B+ Include file data -incl_filename db 'KERNEL.ASM' -if_e: -times (26+incl_filename-if_e) db ' ' -incl_line dd 0x0 -incl_next dd 0x0 -;E:. -;E:. -;E:. - -;B+ Visualization tools -draw_window: -;B+ Redraw window - mov ebx,1 - mov eax,12 - int 0x40 -;B+ Draw window - mov ebx,((640-win_width)/2)*65536+win_width - mov ecx,10*65536+win_toptext+35*10+1+2*16 - mov edx,[color_depth] - or edx,0x03000000 - mov esi,0x80aaaaff - mov edi,0x00009000 - mov eax,0x0 - int 0x40 -;E:. -;B+ Draw caption - mov ebx,8*65537 - mov ecx,0xffffff - mov edx,caption - mov esi,caption_end-caption - mov eax,4 - int 0x40 -;E:. -;B+ Draw first line - mov ebx,5*65536+win_width-9 - mov ecx,25*65536+win_toptext-22-4 - mov edx,0xaa0000 - mov eax,13 - int 0x40 - mov ebx,21*65536+29 - mov ecx,0xffffff - mov edx,line1up1 - mov esi,line1up1_end-line1up1 - mov eax,4 - int 0x40 - mov ebx,(win_field+6)*65536+29 - mov edx,line1up2 - mov esi,line1up2_end-line1up2 - int 0x40 -;E:. -;B+ Main text zone -;B+ Fill text - ;Clear type lines - mov edi,lines_view - mov ecx,35 - mov eax,0 - cld -repe stosd - call show_text -;E:. -;B+ Define left buttons -; mov ebx,5*65536+9 -; mov ecx,win_toptext*65536+9 -; mov edx,0 -; mov esi,0x9000a0 -; mov eax,8 -; mov edi,35 -;.new_button: -; int 0x40 -; add ecx,10*65536 -; inc edx -; dec edi -; jnz .new_button -;E:. -;B+ Vertical line - mov ebx,(win_field-1)*65537 - mov ecx,24*65536+win_toptext+35*10 - mov edx,0xffffff - mov eax,38 - int 0x40 -;E:. -;E:. -;B+ Down controle zone - mov ebx,5*65536+win_width-9 - mov ecx,(35*10+win_toptext+1)*65536+28 - mov edx,0xaa0000 - mov eax,13 - int 0x40 - - mov eax,line1down - mov ebx,filetxt - mov ecx,filetxt_end - call ins_button_prep - mov edx,100 - mov eax,8 - int 0x40 - mov eax,line1down - mov ebx,loadtxt - mov ecx,loadtxt_end - call ins_button_prep - inc edx - mov eax,8 - int 0x40 - mov eax,line1down - mov ebx,begintxt - mov ecx,begintxt_end - call ins_button_prep - inc edx - mov eax,8 - int 0x40 - mov eax,line1down - mov ebx,endtxt - mov ecx,endtxt_end - call ins_button_prep - inc edx - mov eax,8 - int 0x40 - mov eax,line2down - mov ebx,inctxt - mov ecx,inctxt_end - call ins_button_prep - add ecx,14*65536 - inc edx - mov eax,8 - int 0x40 - mov eax,line2down - mov ebx,septxt - mov ecx,septxt_end - call ins_button_prep - add ecx,14*65536 - inc edx - mov eax,8 - int 0x40 - - mov ebx,22*65536+35*10+win_toptext+4 - mov ecx,0xffffff - mov edx,line1down - mov esi,line1down_end-line1down - mov eax,4 - int 0x40 - add ebx,14 - mov edx,line2down - mov esi,line2down_end-line2down - int 0x40 -;E:. -;B+ Down controle strings - mov ecx,0xffffff - mov eax,it1 - mov [str_start],eax - call print_str - mov eax,it2 - mov [str_start],eax - call print_str - mov eax,it3 - mov [str_start],eax - call print_str - mov eax,it4 - mov [str_start],eax - call print_str - mov eax,it5 - mov [str_start],eax - call print_str -;E:. - mov ebx,2 - mov eax,12 - int 0x40 - ret -;E:. -ins_button_prep: -;B+ Insert button - push edx - push eax - sub ecx,ebx - mov eax,6 - mul ecx - add eax,6 - push ax - mov eax,[esp+2] - sub ebx,eax - mov eax,6 - mul ebx - add eax,18 - xchg eax,ebx - shl ebx,16 - pop bx - mov ecx,(35*10+win_toptext+1)*65536+13 - mov esi,0x00a050 - pop eax - pop edx - ret -;E:. -show_text: -;B+ Show text -;B+ Show file on top - mov ebx,(win_field+45)*65536+win_width-(win_field+45+8) - mov ecx,25*65536+win_toptext-22-4 - mov edx,0xaa0000 - mov eax,13 - int 0x40 - - mov edx,[top_file] - xor esi,esi - mov si,[edx-18] - sub edx,18 - sub edx,esi - mov ebx,(win_field+45)*65536+29 - mov ecx,0xffaaaa - mov eax,4 - int 0x40 -;E:. - mov ax,[top_line] - mov [activ_line],ax - mov ebx,[top_pos] - mov [activ_pos],ebx - mov ax,[top_depth] - mov [activ_depth],ax - mov eax,[top_file] - mov [activ_file],eax - mov ecx,35 - mov [line_],0 -.next_line: - cmp [activ_depth],0 - jne .next - cmp byte [ebx],char_end - je .end_of_file -.next: - push ecx - call show_line - call line_down - inc [line_] - pop ecx - loop .next_line - ret -.end_of_file: - push ecx - call clear_line - - inc [activ_pos] - inc [line_] - pop ecx - loop .end_of_file - ret -;E:. -;B+ Button chars -leftchars db '-','+',' ','H' - db '?', 0 ,'!','H' - db '&','x',' ', 0 -;E:. -show_line: -;B+ Show line - call clear_line - mov ebx,ecx - shr ebx,16 - inc ebx - or ebx,(win_field+6)*65536 - push ebx - push eax -;B+ Draw left button char - mov eax,[activ_pos] - mov ax,[eax] - test ax,not 15 - jnz .no_text - and eax,0xff - lea edx,[leftchars+eax] - and ebx,0xffff - or ebx,8*65536 - mov ecx,0xffffff - mov esi,1 - mov eax,4 - int 0x40 - mov ebx,[esp+4] -.no_text: -;E:. -;B+ Draw line number - xor ecx,ecx - mov cx,[activ_line] - mov edx,(10+4+4)*65536 - mov dx,bx - mov ebx,5*65536 - mov esi,0xeeeeee - mov eax,47 - int 0x40 -;E:. -;B+ Find line length - xor esi,esi - mov eax,[activ_pos] - cmp byte [eax],new_line - je .len_ok - test word [eax],not 15 - jnz .next_char - add eax,12 ;sckip system zone -.next_char: - cmp byte [eax],new_line - je .len_ok - inc esi - inc eax - jmp .next_char -.len_ok: - mov eax,6 - mul esi - mov ecx,eax - add ecx,6 - pop eax - mov [eax+2],cx -;E:. - mov ecx,[textcolor] - mov edx,[activ_pos] - xor edi,edi - xor ebx,ebx - mov bx,word [edx] - cmp bl,new_line - je .normal_show_line - test bx,not 15 - jnz .normal_show_line - or edi,ebx - mov ecx,[color_type+4*ebx] - add edx,12 ;sckip system zone -.normal_show_line: - pop ebx - mov eax,4 - int 0x40 - test edi,4 ;bad type close block - jz .nobad - add ebx,65536 - int 0x40 -.nobad: - ret -;E:. -color_type: -;B+ Color data - dd 0x00dddd,0x00ee00 ;0/1 begin 00ee00 - dd 0x00b5b5,0xffa000 ;2/3 end 00d000 - dd 0xffffff,-1 ;4 text end - dd 0x00b5b5,0xffa000 ;6/7 auto end - dd 0x80ccff,0x80aaff ;8/9 include - dd -1 ,0xffa000 ;11 file end -textcolor dd 0xffffff -;E:. -clear_line: -;B+ Clear text in line -;B+ Find line position - mov eax,[line_] - mov ecx,10 - mul cx - mov ecx,eax - add ecx,win_toptext -;E:. -;B+ Draw/clear button - push ecx - shl ecx,16 - mov cx,9 - mov ebx,5*65536+9 - mov edx,[line_] - add edx,2 - mov esi,0x9000a0 - mov eax,8 - int 0x40 - pop ecx -;E:. -;B+ Clear zone for line - shl ecx,16 - mov cx,10 - mov ebx,(5+11)*65536+win_field-5-12 - xor edx,edx - mov dx,[activ_depth] - mov edx,[color_depth+4*edx] - mov eax,13 - int 0x40 -;E:. -;B+ Clear main text zone - mov ebx,(win_field)*65536+(win_width-win_field-8) - mov eax,[line_] - lea eax,[lines_view+4*eax] - push eax - mov ax,[eax] - cmp ax,[activ_depth] - jne .draw_all_line - mov eax,[esp] - cmp bx,[eax+2] - jle .draw_all_line - mov bx,[eax+2] -.draw_all_line: - mov eax,13 - int 0x40 -;E:. -;B+ Update line type I - pop eax - mov bx,[activ_depth] - mov [eax],bx -;E:. - ret - -activ_depth dw 0x0 -color_depth dd 0x404040,0x606060,0x707070,0x7a7a7a - dd 0x878787,0x909090,0x9a9a9a,0xa5a5a5 - dd 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 -lines_view: times 35 dd 0 -;E:. -line_up: -;B+ Line up -;B+ Test jumps I - mov ebx,[activ_pos] - cmp ebx,[activ_file] - jne .yes_scroll - cmp [activ_depth],0 - jz .top_of_file - dec [activ_depth] - xor eax,eax - mov ax,[ebx-8] - mov eax,[file_array+4*eax] - mov [activ_file],eax - add eax,[ebx-12] - mov [activ_pos],eax - mov ax,[ebx-6] - mov [activ_line],ax -.top_of_file: - ret -;E:. -.yes_scroll: - sub ebx,2 -.normal_line_up1: - cmp byte [ebx],new_line - je .line_ok - dec ebx - jmp .normal_line_up1 -.line_ok: -;B+ Test for special line - cmp dword [ebx],new_line - jne .line_ok1 - sub ebx,9 -;E:. -.line_ok1: - inc ebx - test word [ebx],not 15 - jnz .normal_line_up - test word [ebx],1 - jz .normal_line_up -;B+ Test jumps II - cmp word [ebx],type_end_normal+1 - je .to_begin - cmp word [ebx],type_end_plus+1 - je .to_begin - cmp word [ebx],type_include+1 - je .to_incl - jmp .normal_line_up -;E:. -.to_begin: - mov eax,[ebx+4] - add eax,[activ_file] - mov [activ_pos],eax - mov ax,[ebx+2] - inc ax - sub [activ_line],ax - ret -.to_incl: - inc [activ_depth] - mov eax,[ebx+4] - mov eax,[file_array+4*eax] - mov [activ_file],eax - mov bx,[eax-4] - mov [activ_line],bx - add eax,[eax-16] - mov [activ_pos],eax - ret -.normal_line_up: - mov [activ_pos],ebx - dec [activ_line] - ret -;E:. -line_down: -;B+ Line down - mov ebx,[activ_pos] - cmp byte [ebx],char_end - jne .yes_scroll - cmp [activ_depth],0 - jne .yes_scroll - ret -.yes_scroll: - cmp byte [ebx],new_line - je .normal_line_down - test word [ebx],not 15 - jnz .normal_line_down - test word [ebx],1 - jz .not_activated -;B+ Test jumps - cmp word [ebx],type_begin+1 - jne .no_begin - mov eax,[ebx+4] - add eax,[activ_file] - mov [activ_pos],eax - mov ax,[ebx+2] - add [activ_line],ax - call line_down - ret -.no_begin: - cmp word [ebx],type_end_normal+1 - je .not_activated - cmp word [ebx],type_end_plus+1 - je .not_activated - ;goto include - cmp word [ebx],type_include+1 - jne .no_incl - inc [activ_depth] - mov eax,[ebx+4] - mov eax,[file_array+4*eax] - mov [activ_file],eax - mov [activ_pos],eax - mov [activ_line],1 - ret -.no_incl: - ;return from include - cmp word [ebx],type_file_end - jne .no_end -;CHECK FOR FIRST - mov ax,[ebx+2] - mov [activ_line],ax - dec [activ_depth] - mov ecx,[activ_file] - xor eax,eax - mov ax,[ecx-8] - mov eax,[file_array+4*eax] - mov [activ_file],eax - add eax,[ebx+4] - mov [activ_pos],eax - mov ebx,eax - ret -.no_end: -;E:. -.not_activated: - add ebx,12 ;sckip system zone -.normal_line_down: - cmp byte [ebx],new_line - je .line_ok - cmp byte [ebx],char_end - inc ebx - jmp .normal_line_down -.line_ok: - inc ebx - mov [activ_pos],ebx - inc [activ_line] - ret -;E:. -;B+ File possition var. -line_ dd 0x0 ;Line on screen - -top_pos dd start_data -top_line dw 1 -top_depth dw 0x0 -activ_pos dd start_data -activ_line dw 0x0 ;Abs line in file -;E:. -;E:. - -;B+ Load file tools -load_file: -;B+ Main -;B+ Init parameters - mov [top_pos],start_data - mov [activ_pos],start_data - mov [top_file],start_data - mov [activ_file],start_data - mov [file_array],start_data - mov [top_free_file],1 - mov [end_of_file],start_data - mov [top_line],1 - mov esi,file_txt - mov edi,incl_filename - mov ecx,25 - cld -rep movsb -;E:. -load_file1: -;B+ Load and fresh file - mov eax,[end_of_file] - push eax - call add_file - mov edi,[esp] - mov esi,incl_filename - sub edi,16+25+2 - mov ecx,27 - cld -rep movsb - pop edi - mov word [edi-18],25 - mov eax,[top_pos] - mov [activ_pos],eax - call fresh_file - - call draw_window - - jmp still -;E:. -;E:. -fresh_file: -;B+ Fresh file - mov [line_],0 - mov [next_],next -.fresh_next: - inc [line_] - ;Test open block - mov eax,[begin_txt] - mov ebx,[activ_pos] - cmp [ebx],eax - je block_begin - ;Test close block - mov eax,[end_txt] - cmp [ebx],eax - je block_end -;B+ Test include - mov esi,ebx - mov edi,include_txt - mov ecx,20 - cld -rep cmpsb - cmp byte [edi-1],char_end - je include_file -;E:. -next: -;B+ Go to next line - mov ebx,[activ_pos] -.next_char: - cmp byte [ebx],new_line - je yes_next - cmp byte [ebx],char_end - je file_end - inc ebx - jmp .next_char -yes_next: - inc ebx - inc [activ_line] - mov [activ_pos],ebx - jmp fresh_file.fresh_next -;E:. -file_end: -;B+ Auto set close block - mov [next_],.try_fill_next - sub ebx,5 - dec [activ_line] - mov [activ_pos],ebx -.try_fill_next: - add [activ_pos],5 - inc [activ_line] - mov ebx,[activ_pos] - mov eax,[end_txt] - mov ecx,[block_pointer] - cmp word [ecx-4],char_end - je .fill_ok - inc [line_] - call ins_5_bytes - mov dword [ebx],eax - mov byte [ebx+4],new_line - mov byte [ebx+5],char_end - mov [activ_pos],ebx - jmp block_end -;E:. -.fill_ok: - ret -;E:. -;B+ Specify line markers -block_begin: -;B+ Mark block begin -;B+ Mark info in stack - mov eax,[activ_pos] - mov ebx,[block_pointer] - push eax - sub eax,[activ_file] - mov [ebx],eax - pop eax - mov word [ebx+4],0 - mov cx,[activ_line] - mov word [ebx+6],cx - add ebx,8 - mov [block_pointer],ebx -;E:. - call ins_12_bytes - ;line / possition not ready - mov word [eax],type_begin+1 - mov dword [eax+8],new_line - add [activ_pos],12 - jmp [next_] -;E:. -block_end: -;B+ Mark block end -;B+ Mark end type I - mov eax,[activ_pos] - call ins_12_bytes - mov ecx,[block_pointer] - cmp word [ecx-4],char_end - je .normal_line -;E:. - ;Pop stack - sub [block_pointer],8 - sub ecx,8 -;B+ Form this (END) line/place to BEGIN - mov edx,[ecx] - add edx,[activ_file] - mov eax,[activ_pos] - sub eax,[activ_file] - mov [edx+4],eax - mov bx,[activ_line] - sub bx,[ecx+6] - mov [edx+2],bx -;E:. -;B+ From stack line/place to this (END) - mov eax,[activ_pos] - mov edx,[ecx] - mov [eax+4],edx - mov [eax+2],bx -;E:. -;B+ Mark end type II - mov word [eax],type_end_normal+1 - mov ecx,[next_] - cmp ecx,next - je .yes_normal - mov word [eax],type_end_plus+1 -.yes_normal: - mov dword [eax+8],new_line - add [activ_pos],12 - jmp [next_] -.normal_line: - mov word [eax],type_not_end - mov dword [eax+8],new_line - add [activ_pos],12 - jmp [next_] -;E:. -;E:. -include_file: -;B+ Include and attach file - mov eax,[activ_pos] - push eax - call ins_12_bytes - pop eax - mov word [eax],type_include - mov word [eax+2],0 - mov dword [eax+4],-1 - mov dword [eax+8],new_line - dec [line_] - jmp [next_] -;E:. - -next_ dd next -;E:. -;B+ Additional tools -ins_12_bytes: - mov ecx,[end_of_file] - add [end_of_file],12 - mov esi,ecx - add ecx,12 - mov edi,ecx - sub ecx,11 - sub ecx,eax - std -rep movsb - mov ecx,[activ_file] - add dword [ecx-16],12 - ret - -ins_5_bytes: - mov ecx,[end_of_file] - add [end_of_file],5 - mov esi,ecx - add ecx,5 - mov edi,ecx - sub ecx,4 - sub ecx,ebx - std -rep movsb - mov ecx,[activ_file] - add dword [ecx-16],5 - ret - -ins_1_byte: - mov ecx,[end_of_file] - inc [end_of_file] - mov esi,ecx - inc ecx - mov edx,ecx - sub ecx,ebx - std -rep movsb - mov ecx,[activ_file] - inc dword [ecx-16] - ret -;E:. -;E:. - -;B+ Data section - -;B+ View data -caption db 'CODE VIEWER - ver. 0.2' -caption_end: - -line1up1 db 'LINE' -line1up1_end: -line1up2 db 'FILE:' -line1up2_end: - -line1down: -filetxt db 'FILE->' -filetxt_end: -times 28 db ' ' -loadtxt db 'LOAD' -loadtxt_end: -db ' BLOCK: ' -begintxt db 'BEGIN->' -begintxt_end: -times 10 db ' ' -db '...' -times 10 db ' ' -endtxt db '<-END' -endtxt_end: -line1down_end: - -line2down: -inctxt db 'INCLUDE KEYWORD->' -inctxt_end: -times 46 db ' ' -septxt db 'SEPARATORS->' -septxt_end: -line2down_end: -;E:. -;B+ Parameter strings -str_start dd it1 -str_table dd it1,0,it2,it3,it4,it5 -;align -it1: - dd 25 - dd (20+6*7)*65536+35*10+win_toptext+3 -file_txt: - db 'KERNEL.ASM ',char_end -;align 4 -it2: - dd 4 - dd (20+56*6)*65536+35*10+win_toptext+3 -begin_txt: - db ';B+ ',char_end -;align 4 -it3: - dd 4 - dd (20+71*6)*65536+35*10+win_toptext+3 -end_txt: - db ';E:.',char_end -;align 4 -it4: - dd 43 - dd (20+18*6)*65536+35*10+win_toptext+3+14 -include_txt: - db 'include ',char_end,' ' - ;align 4 -it5: - dd 2 - dd (20+76*6)*65536+35*10+win_toptext+3+14 -skoba_txt: - db '"" ',char_end -;E:. - -block_pointer dd block_stack+8 -block_stack dw 0,0,char_end,0 - times 10*2 dd 0x0 - -; STACK BOX: -; ┌─────────┬────┬────╧ -; ╙abs place╙ 0 ╙line╙ -; └─────────┴────┴────┘ -; or 0000 'char_end' 00 - bottom - -top_file dd start_data -activ_file dd start_data -top_free_file dd 1 -file_array dd start_data - times 50 dd 0x0 - -end_of_file dd start_data - -; TEXT MARKER: -; ┌────┬────┬─────────┬─────────╧ -; ╙type╙n.l.╙new place╙ 13 ╙ -; └────┴────┴─────────┴─────────┘ - -;E:. - -;B+ Program preview -;┌───── -;╙CODE VIEWER - ver. 0.2 o _ x -;├─────────────────────── -;╙ Line | File: -;╙---------+--------------------- -;╙[+] | -;╙[-] | -;╙[ ] | -;╙[#] | -;├────────────────────────── -;╙ [FILE->]___________ [LOAD] BLOCK: [BEGIN->];B+· ... ;E:.[<-END] ╙ -;╙ [INCLUDE KEYWORD->]include [SEPARATORS->]"" -;└──────────────────── -;E:. - -I_END: - diff --git a/programs/fs/copyr/trunk/copyr.asm b/programs/fs/copyr/trunk/copyr.asm index 8ba3358bf6..97fb5a991b 100644 --- a/programs/fs/copyr/trunk/copyr.asm +++ b/programs/fs/copyr/trunk/copyr.asm @@ -8,7 +8,7 @@ ; ; ; On base SYSTREE FILE COPIER 1.02 ; ; Ivan Poddubny ivan-yar@bk.ru ; -; ; +; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Данная прога еще сырая и глючная но уже кое как работает diff --git a/programs/fs/copyr/trunk/macros.inc b/programs/fs/copyr/trunk/macros.inc index 1d153e8723..0ddc650b65 100644 --- a/programs/fs/copyr/trunk/macros.inc +++ b/programs/fs/copyr/trunk/macros.inc @@ -143,9 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld - - - ; optimize the code for size __regs fix @@ -177,7 +174,7 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 xor arg1,arg1 else if (arg2) = 1 @@ -221,7 +218,13 @@ struc process_information .x_size dd ? ; +42 .y_size dd ? ; +46 .slot_state dw ? ; +50 - rb (1024-52) + dw ? ; +52 - reserved + .client_left dd ? ; +54 + .client_top dd ? ; +58 + .client_width dd ? ; +62 + .client_height dd ? ; +66 + .wnd_state db ? ; +70 + rb (1024-71) } struct process_information diff --git a/programs/fs/hexhd/trunk/build_en.bat b/programs/fs/hexhd/trunk/build_en.bat deleted file mode 100644 index a9ac3eeedf..0000000000 --- a/programs/fs/hexhd/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm hexhd.asm hexhd -@pause \ No newline at end of file diff --git a/programs/fs/hexhd/trunk/build_ru.bat b/programs/fs/hexhd/trunk/build_ru.bat deleted file mode 100644 index 097bef2d74..0000000000 --- a/programs/fs/hexhd/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm hexhd.asm hexhd -@pause \ No newline at end of file diff --git a/programs/fs/hexhd/trunk/hexhd.asm b/programs/fs/hexhd/trunk/hexhd.asm deleted file mode 100644 index 4e32583a86..0000000000 --- a/programs/fs/hexhd/trunk/hexhd.asm +++ /dev/null @@ -1,235 +0,0 @@ -; -; EXAMPLE APPLICATION -; -; Compile with FASM for Menuet -; - -use32 - - org 0x0 - - db 'MENUET00' ; 8 byte id - dd 38 ; required os - dd START ; program start - dd I_END ; program image size - dd 0x5000 ; required amount of memory - dd 0x5000 ; esp = 0x7FFF0 - dd 0x00000000 ; reserved=no extended header - -include 'lang.inc' -include 'macros.inc' - -START: ; start of execution - - call open_file - - call draw_window ; at first, draw the window - -still: - - mov eax,10 ; wait here for event - int 0x40 - - cmp eax,1 ; redraw request ? - je red - cmp eax,2 ; key in buffer ? - je key - cmp eax,3 ; button in buffer ? - je button - - jmp still - - red: ; redraw - call draw_window - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - jmp still - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jne noclose - mov eax,-1 ; close this program - int 0x40 - noclose: - - cmp ah,2 - jne noexam - jmp still - noexam: - - cmp ah,3 - jne noback - mov edi,block - cmp dword [edi],0 - je nonext - dec dword [edi] - call open_file - call draw_window - noback: - - cmp ah,4 - jne nonext - mov edi,block - inc dword [edi] - call open_file - call draw_window - nonext: - - jmp still - - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* - - -draw_window: - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw - int 0x40 - - ; DRAW WINDOW - mov eax,0 ; function 0 : define and draw window - mov ebx,0*65536+400 ; [x start] *65536 + [x size] - mov ecx,0*65536+270+200 ; [y start] *65536 + [y size] - mov edx,0x038899aa;1111cc ; color of work area RRGGBB,8->c - int 0x40 - - mov eax,4 ; function 4 : write text to window - mov ebx,144*65536+8 ; [x start] *65536 + [y start] - mov ecx,0x00ffffff ; color of text RRGGBB - mov edx,labelt ; pointer to text beginning - mov esi,labellen-labelt ; text length - int 0x40 - - mov eax,47 ;decimal - mov ecx,[block] - mov edx,64*65536+34 - mov ebx,10 - shl ebx,16 - mov esi,0x00ffffff - int 0x40 - - add edx,128*65536 ;hex - mov bh,1 - int 0x40 - - mov eax,8 - mov ebx,280*65536+16*6 - mov ecx,30*65536+14 - - mov edx,2 - mov esi,0x3f49df;5599cc - int 0x40 - - mov ebx,15*65536+32 - add edx,1 - mov eax,8 - int 0x40 - - add ebx,127*65536 - add edx,1 - mov eax,8 - int 0x40 - - - mov eax,4 - mov ebx,14*65536+33 - mov ecx,0xffffff - mov edx,buttons - mov esi,blen-buttons - int 0x40 - - - mov ebx,280*65536+65 ; draw info text with function 4 - mov ecx,0xffffff - mov edx,text - mov esi,16 - mov edi,16*2 - newline: - - pusha ; hext - - mov edi,16 - - mov ecx,edx - - mov edx,ebx - sub edx,265*65536 - - newhex: - - mov eax,47 - mov ebx,0x00020101 - xor esi,0xffff00 - int 0x40 - - add edx,16*65536 - add ecx,1 - - dec edi - jne newhex - - popa - - mov eax,4 ; text - int 0x40 - add ebx,12 - add edx,16 - dec edi - jnz newline - - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw - int 0x40 - - ret - - - -open_file: - - pusha - - mov eax,58 - mov ebx,fileinfo - int 0x40 - - popa - - ret - - - - -; DATA AREA - -fileinfo: - dd 8 -block dd 0 - dd 1 - dd text - dd os - db '/HARDDISK/FIRST',0 - - -labelt: - db 'EDITOR HEXADECIMAL' -labellen: - -buttons db ' << >> << OPTIONS >> ' -blen: - -os: -times 16384 db ? -text: - -I_END: diff --git a/programs/fs/hexhd/trunk/macros.inc b/programs/fs/hexhd/trunk/macros.inc deleted file mode 100644 index d45b69e6e3..0000000000 --- a/programs/fs/hexhd/trunk/macros.inc +++ /dev/null @@ -1,265 +0,0 @@ -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if used name - db data - end if - common - if used name - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if (used name)&(lang eq lng) - db data - end if - common - if used name - .size = $-name - end if -} - - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a { ; mike.dld - if ~a eq - mov reg,a - end if -} - -macro mcall a,b,c,d,e,f { ; mike.dld - __mov eax,a - __mov ebx,b - __mov ecx,c - __mov edx,d - __mov esi,e - __mov edi,f - int 0x40 -} - - - - - - - -; optimize the code for size -__regs fix - -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 \ No newline at end of file diff --git a/programs/fs/kfar/trunk/kfar.asm b/programs/fs/kfar/trunk/kfar.asm index 91f8e8cee2..b42bcc7f0f 100644 --- a/programs/fs/kfar/trunk/kfar.asm +++ b/programs/fs/kfar/trunk/kfar.asm @@ -3596,12 +3596,14 @@ associations: dd aJpg, jpegview dd aJpeg, jpegview dd aGif, gifview - dd aWav, ac97wav - dd aMp3, ac97wav + dd aWav, ac97 + dd aMp3, ac97 dd aMid, midamp dd aBmp, mv dd aPng, archer dd aRtf, rtfread + dd a3ds, view3ds + dd aLif, life2 associations_end: aAsm db 'asm',0 @@ -3618,7 +3620,7 @@ gifview db '/rd/1/GIFVIEW',0 aWav db 'wav',0 aMp3 db 'mp3',0 -ac97wav db '/rd/1/AC97WAV',0 +ac97 db '/rd/1/AC97SND',0 aMid db 'mid',0 midamp db '/rd/1/MIDAMP',0 @@ -3632,6 +3634,12 @@ archer db '/rd/1/@rcher',0 aRtf db 'rtf',0 rtfread db '/rd/1/RtfRead',0 +a3ds db '3ds',0 +view3ds db '/rd/1/3d/view3ds',0 + +aLif db 'lif',0 +life2 db '/rd/1/demos/life2',0 + bConfirmDelete db 1 ; Здесь заканчиваются конфигурационные данные diff --git a/programs/fs/rdfdel/trunk/build_en.bat b/programs/fs/rdfdel/trunk/build_en.bat deleted file mode 100644 index fa9617dfcb..0000000000 --- a/programs/fs/rdfdel/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm rdfdel.asm rdfdel -@pause \ No newline at end of file diff --git a/programs/fs/rdfdel/trunk/build_ru.bat b/programs/fs/rdfdel/trunk/build_ru.bat deleted file mode 100644 index ece53dc448..0000000000 --- a/programs/fs/rdfdel/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm rdfdel.asm rdfdel -@pause \ No newline at end of file diff --git a/programs/fs/rdfdel/trunk/rdfdel.asm b/programs/fs/rdfdel/trunk/rdfdel.asm deleted file mode 100644 index e4a8a401f0..0000000000 --- a/programs/fs/rdfdel/trunk/rdfdel.asm +++ /dev/null @@ -1,232 +0,0 @@ -; -; FILE COPIER -; -; Compile with FASM for Menuet -; - - use32 - org 0x0 - - db 'MENUET00' ; 8 byte id - dd 38 ; required os - dd START ; program start - dd I_END ; program image size - dd 0x1000 ; required amount of memory - dd 0x1000 - dd 0 ; reserved=no extended header - -include "lang.inc" -include "macros.inc" - -START: ; start of execution - - call draw_window ; at first, draw the window - -still: - - mov eax,10 ; wait here for event - int 0x40 - - cmp eax,1 ; redraw request ? - jz red - cmp eax,2 ; key in buffer ? - jz key - cmp eax,3 ; button in buffer ? - jz button - - jmp still - - red: ; redraw - call draw_window - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - jmp still - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jnz noclose - mov eax,0xffffffff ; close this program - int 0x40 - noclose: - - - cmp ah,3 ; delete ? - jnz nodelete - mov eax,32 - mov ebx,destination - int 0x40 - jmp still - nodelete: - - - cmp ah,4 - jz f2 - jmp nof12 - - f2: - mov [addr],dword destination - mov [ya],dword 35 - jmp rk - - rk: - mov edi,[addr] - mov al,' ' - mov ecx,11 - rep stosb - - call print_text - - mov edi,[addr] - - f11: - mov eax,10 - int 0x40 - cmp eax,2 - jz fbu - jmp still - fbu: - mov eax,2 - int 0x40 - shr eax,8 - cmp eax,8 - jnz nobs - cmp edi,[addr] - jz f11 - sub edi,1 - mov [edi],byte 0 - call print_text - jmp f11 - nobs: - cmp eax,dword 31 - jbe f11 - cmp eax,dword 95 - jb keyok - sub eax,32 - keyok: - mov [edi],al - - call print_text - - add edi,1 - mov esi,[addr] - add esi,11 - cmp esi,edi - jnz f11 - - jmp still - -print_text: - - mov eax,13 - mov ebx,109*65536+11*6 - mov ecx,[ya] - shl ecx,16 - mov cx,8 - mov edx,0xffffff - int 0x40 - - mov eax,4 - mov ebx,109*65536 - add ebx,[ya] - mov ecx,0x000000 - mov edx,[addr] - mov esi,11 - int 0x40 - - ret - - nof12: - jmp still - - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* - - -draw_window: - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw - int 0x40 - - ; DRAW WINDOW - mov eax,0 ; function 0 : define and draw window - mov ebx,100*65536+230 ; [x start] *65536 + [x size] - mov ecx,100*65536+105 ; [y start] *65536 + [y size] - mov edx,0x03ffffff ; color of work area RRGGBB - int 0x40 - - ; WINDOW LABEL - mov eax,4 ; function 4 : write text to window - mov ebx,8*65536+8 ; [x start] *65536 + [y start] - mov ecx,0x10ffffff ; color of text RRGGBB - mov edx,header ; pointer to text beginning - mov esi,header.len ; text length - int 0x40 - - mov esi,0xbbbbbb - - mov eax,8 ; DELETE BUTTON - mov ebx,20*65536+190 - mov ecx,63*65536+15 - mov edx,3 - int 0x40 - - mov eax,8 - mov ebx,200*65536+10 - mov ecx,33*65536+10 - mov edx,4 - int 0x40 - - mov esi,destination - mov edi,text+14 - mov ecx,11 - cld - rep movsb - - mov ebx,25*65536+35 ; draw info text with function 4 - mov ecx,0x0 - mov edx,text - mov esi,40 - newline: - mov eax,4 - int 0x40 - add ebx,16*2 - add edx,40 - cmp [edx],byte 'x' - jnz newline - - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw - int 0x40 - - ret - - -; DATA AREA - -destination db 'EXAMPLE.ASM' - -addr dd 0x0 -ya dd 0x0 - -text: - db 'FILENAME : yyyyyyyyyyy ' - db ' DELETE FROM RAMDISK ' - - db 'x' ; <- END MARKER, DONT DELETE - - -header: - db 'RAMDISK FILE DELETE' - .len = $ - header - -I_END: diff --git a/programs/fs/sysxtree/trunk/macros.inc b/programs/fs/sysxtree/trunk/macros.inc index 9c0841da62..0ddc650b65 100644 --- a/programs/fs/sysxtree/trunk/macros.inc +++ b/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 { @@ -86,73 +74,36 @@ struc mstr [sstring] ; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - name db data - .size = $-name - end if +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 - forward - if lang eq lng - db data - end if - common - .size = $-name - end if + 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 } -macro szc name,elsz,[data] { ; from MFAR [mike.dld] - common - local s,m - m = 0 - if used name - label name - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - .size = $-name - .maxl = m - end if -} - -macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] - common - local s,m,c - m = 0 - c = 0 - if used name - label name - forward - if lang eq lng - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - c = c+1 - end if - common - .size = $-name - .maxl = m - .count = c - end if -} ; easy system call macro @@ -172,13 +123,7 @@ macro mpack dest, hsrc, lsrc end if } -;macro __mov reg,a { ; mike.dld -; if ~a eq -; mov reg,a -; end if -;} - -macro __mov reg,a,b { ; mike.dld +macro __mov reg,a,b { ; mike.dld if (~a eq)&(~b eq) mpack reg,a,b else if (~a eq)&(b eq) @@ -197,71 +142,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld } -; ------------------------- -macro header a,[b] { - common - use32 - org 0 - db 'MENUET',a - forward - if b eq - dd 0 - else - dd b - end if } -macro section name { align 16 - label name } -macro func name { - if ~used name - display 'FUNC NOT USED: ',`name,13,10 - else - align 4 - name: -;pushad -;pushfd -;dps `name -;newline -;mcall 5,1 -;popfd -;popad -} -macro endf { end if } - -macro diff16 title,l1,l2 - { - local s,d - s = l2-l1 - display title,': 0x' - repeat 8 - d = '0' + s shr ((8-%) shl 2) and $0F - if d > '9' - d = d + 'A'-'9'-1 - end if - display d - end repeat - display 13,10 - } - -macro diff10 title,l1,l2 - { - local s,d,z,m - s = l2-l1 - z = 0 - m = 1000000000 - display title,': ' - repeat 10 - d = '0' + s / m - s = s - (s/m)*m - m = m / 10 - if d <> '0' - z = 1 - end if - if z <> 0 - display d - end if - end repeat - display 13,10 - } ; optimize the code for size __regs fix @@ -270,9 +150,9 @@ macro add arg1,arg2 { if (arg2 eqtype 0) if (arg2) = 1 - inc arg1 + inc arg1 else - add arg1,arg2 + add arg1,arg2 end if else add arg1,arg2 @@ -283,9 +163,9 @@ macro sub arg1,arg2 { if (arg2 eqtype 0) if (arg2) = 1 - dec arg1 + dec arg1 else - sub arg1,arg2 + sub arg1,arg2 end if else sub arg1,arg2 @@ -294,19 +174,19 @@ macro sub arg1,arg2 macro mov arg1,arg2 { - if (arg1 in __regs) & (arg2 eqtype 0) + if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) if (arg2) = 0 - xor arg1,arg1 + xor arg1,arg1 else if (arg2) = 1 - xor arg1,arg1 - inc arg1 + xor arg1,arg1 + inc arg1 else if (arg2) = -1 - or arg1,-1 + or arg1,-1 else if (arg2) > -128 & (arg2) < 128 - push arg2 - pop arg1 + push arg2 + pop arg1 else - mov arg1,arg2 + mov arg1,arg2 end if else mov arg1,arg2 @@ -314,230 +194,54 @@ macro mov arg1,arg2 } -macro RGB [a] { - common - match (r=,g=,b),a \{ - \dd ((r) shl 16) or ((g) shl 8) or (b) - \} -} - - -struc POINT _t,_dx,_dy { - .x _t _dx - .y _t _dy -} - - -; Macroinstructions for defining data structures - macro struct name - { fields@struct equ name - match child parent, name \{ fields@struct equ child,fields@\#parent \} - sub@struct equ - struc db [val] \{ \common fields@struct equ fields@struct,.,db, \} - struc dw [val] \{ \common fields@struct equ fields@struct,.,dw, \} - struc du [val] \{ \common fields@struct equ fields@struct,.,du, \} - struc dd [val] \{ \common fields@struct equ fields@struct,.,dd, \} - struc dp [val] \{ \common fields@struct equ fields@struct,.,dp, \} - struc dq [val] \{ \common fields@struct equ fields@struct,.,dq, \} - struc dt [val] \{ \common fields@struct equ fields@struct,.,dt, \} - 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, \} - macro dw [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dw, \} - macro du [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,du, \} - macro dd [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dd, \} - macro dp [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dp, \} - macro dq [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dq, \} - macro dt [val] \{ \common \local anonymous - fields@struct equ fields@struct,anonymous,dt, \} - 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, \} - 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 - common - sizeof.#name = $ - restruc name - match values, list \{ - struc name value \\{ - match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\} - 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, \\} - \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 - 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 \} } + { + 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 - 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 @@ -546,20 +250,20 @@ ends EV_IDLE = 0 EV_TIMER = 0 EV_REDRAW = 1 -EV_KEY = 2 +EV_KEY = 2 EV_BUTTON = 3 EV_EXIT = 4 EV_BACKGROUND = 5 EV_MOUSE = 6 -EV_IPC = 7 +EV_IPC = 7 EV_STACK = 8 ; event mask bits for function 40 -EVM_REDRAW = 1b +EVM_REDRAW = 1b EVM_KEY = 10b EVM_BUTTON = 100b EVM_EXIT = 1000b EVM_BACKGROUND = 10000b EVM_MOUSE = 100000b EVM_IPC = 1000000b -EVM_STACK = 10000000b +EVM_STACK = 10000000b \ No newline at end of file diff --git a/programs/fs/sysxtree/trunk/sysxtree.asm b/programs/fs/sysxtree/trunk/sysxtree.asm index 140fd1f5e3..599721973b 100644 --- a/programs/fs/sysxtree/trunk/sysxtree.asm +++ b/programs/fs/sysxtree/trunk/sysxtree.asm @@ -607,9 +607,11 @@ is_brow: mov ebx, gifview cmp ecx, 'GIF' jz run - mov ebx, ac97wav + mov ebx, ac97 cmp ecx, 'WAV' jz run + cmp ecx, 'MP3' + jz run mov ebx, midamp cmp ecx, 'MID' jz run @@ -631,6 +633,12 @@ is_brow: jz run cmp ecx, 'INC' jz run + mov ebx, life2 + cmp ecx, 'LIF' + jz run + mov ebx, view3ds + cmp ecx, '3DS' and not 0x20202020 + jz run jmp still execute: @@ -2540,12 +2548,14 @@ editor db '/RD/1/TINYPAD',0 bmpview db '/RD/1/MV',0 jpgview db '/RD/1/JPEGVIEW',0 gifview db '/RD/1/GIFVIEW',0 -ac97wav db '/RD/1/AC97WAV',0 +ac97 db '/RD/1/AC97SND',0 rtfread db '/RD/1/RTFREAD',0 ; //// Willow pngview db '/RD/1/@RCHER',0 ; //// Willow midamp db '/RD/1/MIDAMP',0 +view3ds db '/RD/1/3D/VIEW3DS',0 +life2 db '/RD/1/DEMOS/LIFE2',0 more_char db 10h diff --git a/programs/games/freecell/Buben.bmp b/programs/games/freecell/Buben.bmp new file mode 100644 index 0000000000..6c9e52cd75 Binary files /dev/null and b/programs/games/freecell/Buben.bmp differ diff --git a/programs/games/freecell/Club.bmp b/programs/games/freecell/Club.bmp new file mode 100644 index 0000000000..57bf2faafe Binary files /dev/null and b/programs/games/freecell/Club.bmp differ diff --git a/programs/games/freecell/ClubSml.bmp b/programs/games/freecell/ClubSml.bmp new file mode 100644 index 0000000000..e0700f5ad0 Binary files /dev/null and b/programs/games/freecell/ClubSml.bmp differ diff --git a/programs/games/freecell/ClubUD.bmp b/programs/games/freecell/ClubUD.bmp new file mode 100644 index 0000000000..e2634a8546 Binary files /dev/null and b/programs/games/freecell/ClubUD.bmp differ diff --git a/programs/games/freecell/Cross.bmp b/programs/games/freecell/Cross.bmp new file mode 100644 index 0000000000..bf6aefdfc3 Binary files /dev/null and b/programs/games/freecell/Cross.bmp differ diff --git a/programs/games/freecell/Diam.bmp b/programs/games/freecell/Diam.bmp new file mode 100644 index 0000000000..9bcb576470 Binary files /dev/null and b/programs/games/freecell/Diam.bmp differ diff --git a/programs/games/freecell/DiamSml.bmp b/programs/games/freecell/DiamSml.bmp new file mode 100644 index 0000000000..7099ddabd3 Binary files /dev/null and b/programs/games/freecell/DiamSml.bmp differ diff --git a/programs/games/freecell/DiamUD.bmp b/programs/games/freecell/DiamUD.bmp new file mode 100644 index 0000000000..db0ffda222 Binary files /dev/null and b/programs/games/freecell/DiamUD.bmp differ diff --git a/programs/games/freecell/Heart.bmp b/programs/games/freecell/Heart.bmp new file mode 100644 index 0000000000..7ee38b72c0 Binary files /dev/null and b/programs/games/freecell/Heart.bmp differ diff --git a/programs/games/freecell/HeartSml.bmp b/programs/games/freecell/HeartSml.bmp new file mode 100644 index 0000000000..74e9e7b8a8 Binary files /dev/null and b/programs/games/freecell/HeartSml.bmp differ diff --git a/programs/games/freecell/HeartUD.bmp b/programs/games/freecell/HeartUD.bmp new file mode 100644 index 0000000000..12e7a0dfab Binary files /dev/null and b/programs/games/freecell/HeartUD.bmp differ diff --git a/programs/games/freecell/MACROS.INC b/programs/games/freecell/MACROS.INC new file mode 100644 index 0000000000..14185dbfce --- /dev/null +++ b/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 + +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 \ No newline at end of file diff --git a/programs/games/freecell/Pick.bmp b/programs/games/freecell/Pick.bmp new file mode 100644 index 0000000000..24fd652f95 Binary files /dev/null and b/programs/games/freecell/Pick.bmp differ diff --git a/programs/games/freecell/Spade.bmp b/programs/games/freecell/Spade.bmp new file mode 100644 index 0000000000..520db1262b Binary files /dev/null and b/programs/games/freecell/Spade.bmp differ diff --git a/programs/games/freecell/SpadeSml.bmp b/programs/games/freecell/SpadeSml.bmp new file mode 100644 index 0000000000..fcdbf65ed7 Binary files /dev/null and b/programs/games/freecell/SpadeSml.bmp differ diff --git a/programs/games/freecell/SpadeUD.bmp b/programs/games/freecell/SpadeUD.bmp new file mode 100644 index 0000000000..179dbfcfd2 Binary files /dev/null and b/programs/games/freecell/SpadeUD.bmp differ diff --git a/programs/games/freecell/build.bat b/programs/games/freecell/build.bat new file mode 100644 index 0000000000..ab77b06378 --- /dev/null +++ b/programs/games/freecell/build.bat @@ -0,0 +1,2 @@ +@fasm freecell.asm freecell +@pause \ No newline at end of file diff --git a/programs/games/freecell/freecell.ASM b/programs/games/freecell/freecell.ASM new file mode 100644 index 0000000000..d4e89ed012 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/programs/games/freecell/play.txt b/programs/games/freecell/play.txt new file mode 100644 index 0000000000..c7dc141334 --- /dev/null +++ b/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 diff --git a/programs/games/life/trunk/ascl.inc b/programs/games/life/trunk/ascl.inc deleted file mode 100644 index f5a3cf2db3..0000000000 --- a/programs/games/life/trunk/ascl.inc +++ /dev/null @@ -1,835 +0,0 @@ -lang equ ru ; ru en fr ge fi - -; -; Assembler -; SMALL -; CODE -; Libary -; -; Ver 0.14 By Pavlushin Evgeni (RUSSIA) -; www.waptap@mail.ru - -;Please compile aplications on FASM ver1.54 or higer!!! - -;InfoList -;0.01 scank,putpix,puttxt -;0.02 label,random,colors -;0.03 window,startwd,endwd,attributes -;0.04 close,delay,scevent ~30.04.2004 -;0.05 small random, ~04.05.2004 -;0.06 wtevent ~09.05.2004 -;0.07 timeevent ~23.05.2004 -;0.08 txtput ~14.06.2004 -;0.09 opendialog,savedialog ~20.06.2004 -;0.10 wordstoreg by halyavin, add at ~30.08.2004 -; random bug deleted eax is use. -;0.11 loadfile from me +puttxt bug del ~07.09.2004 -;0.12 open/save dialog ~13.09.2004 -;0.13 dialogs bugs deleted -;0.14 drawlbut ~03.10.2004 - -; LOADFILE -; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area -; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area - -macro loadfile file_name,file_load_area,file_temp_area -{ -local open,fileinfo,string - jmp open -fileinfo: - dd 0 - dd 0 - dd 1 - dd file_load_area - dd file_temp_area -string: - db file_name,0 -open: - mov dword [fileinfo+8],1 ; how many blocks to read (1) - mov eax,58 - mov ebx,fileinfo - int 0x40 - mov eax,[file_load_area+2] - shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков - inc eax - mov dword [fileinfo+8],eax - mov eax,58 - mov ebx,fileinfo - int 0x40 -} - - -macro wordstoreg reg,hiword,loword -{ -if hiword eqtype 0 & loword eqtype 0 - mov reg,hiword*65536+loword -else if hiword eqtype 12 & loword eqtype eax - mov reg,hiword*65536 - add reg,loword -else if hiword eqtype 12 & loword eqtype [123] - mov reg,hiword*65536 - add reg,loword -else - mov reg,hiword - shl reg,16 - add reg,loword -end if -} - - -; DRAW BUTTON with label - -macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor -{ -local asd,lab - jmp asd -lab db text ;arg label -asd: - wordstoreg ebx,x,xs - wordstoreg ecx,y,ys - mov edx,id - mov esi,bcolor - mov eax,8 - int 0x40 - - mov eax,asd-lab ;calc size - mov ebx,6 - mul ebx - mov esi,eax - - mov eax,xs - sub eax,esi - shr eax,1 - add eax,x - - mov edx,ys - sub edx,7 - shr edx,1 - add edx,y - - mov ebx,eax - shl ebx,16 - add ebx,edx - - mov ecx,tcolor ;arg4 color - mov edx,lab - mov esi,asd-lab ;calc size - mov eax,4 - int 0x40 -} - - -macro opendialog redproc,openoff,erroff,path -{ -local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc -local run_fileinfo, param -local getmesloop, loox, mred, mkey, mbutton, mgetmes -local dlg_is_work, ready, procinfo -; -; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, -; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) -; - - cld -;; mov esi,path - mov edi,path - mov eax,0 - mov ecx,200 - rep stosb - -;mov [get_loops],0 -mov [dlg_pid_get],0 - -; Get my PID in dec format 4 bytes - mov eax,9 - mov ebx,procinfo - mov ecx,-1 - int 0x40 - -; convert eax bin to param dec - mov eax,dword [procinfo+30] ;offset of myPID - mov edi,param+4-1 ;offset to 4 bytes - mov ecx,4 - mov ebx,10 - cld -new_d: - xor edx,edx - div ebx - add dl,'0' - mov [edi],dl - dec edi - loop new_d - -; wirite 1 byte space to param - mov [param+4],byte 32 ;Space for next parametr -; and 1 byte type of dialog to param - mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) - -; -; STEP2 prepare IPC area for get messages -; - -; prepare IPC area - mov [path],dword 0 - mov [path+4],dword 8 - -; define IPC memory - mov eax,60 - mov ebx,1 ; define IPC - mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes - int 0x40 - -; change wanted events list 7-bit IPC event - mov eax,40 - mov ebx,01000111b - int 0x40 - -; -; STEP 3 run SYSTEM XTREE with parameters -; - - mov eax,58 - mov ebx,run_fileinfo - int 0x40 - - call redproc - - mov [get_loops],0 -getmesloop: - mov eax,23 - mov ebx,50 ;0.5 sec - int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes - -; Get number of procces - mov ebx,procinfo - mov ecx,-1 - mov eax,9 - int 0x40 - mov ebp,eax - -loox: - mov eax,9 - mov ebx,procinfo - mov ecx,ebp - int 0x40 - mov eax,[DLGPID] - cmp [procinfo+30],eax ;IF Dialog find - je dlg_is_work ;jmp to dlg_is_work - dec ebp - jnz loox - - jmp erroff - -dlg_is_work: - cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated - je erroff ;TESTODP2 terminated too - - cmp [dlg_pid_get],dword 1 - je getmesloop - inc [get_loops] - cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated - jae erroff - jmp getmesloop - -mred: - call redproc - jmp getmesloop -mkey: - mov eax,2 - int 0x40 ; read (eax=2) - jmp getmesloop -mbutton: - mov eax,17 ; get id - int 0x40 - cmp ah,1 ; button id=1 ? - jne getmesloop - mov eax,-1 ; close this program - int 0x40 -mgetmes: - -; If dlg_pid_get then second message get jmp to still - cmp [dlg_pid_get],dword 1 - je ready - -; First message is number of PID SYSXTREE dialog - -; convert PID dec to PID bin - movzx eax,byte [path+16] - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+1] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+2] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+3] - add eax,ebx - sub eax,48 - mov [DLGPID],eax - -; Claear and prepare IPC area for next message - mov [path],dword 0 - mov [path+4],dword 8 - mov [path+8],dword 0 - mov [path+12],dword 0 - mov [path+16],dword 0 - -; Set dlg_pid_get for get next message - mov [dlg_pid_get],dword 1 - call redproc ;show DLG_PID - jmp getmesloop - -ready: -; -; The second message get -; Second message is 100 bytes path to SAVE/OPEN file -; shl path string on 16 bytes -; - cld - mov esi,path+16 - mov edi,path - mov ecx,200 - rep movsb - mov [edi],byte 0 - - jmp openoff - - -; DATA AREA -get_loops dd 0 -dlg_pid_get dd 0 -DLGPID dd 0 - -param: - dd 0 ; My dec PID - dd 0,0 ; Type of dialog - -run_fileinfo: - dd 16 - dd 0 - dd param - dd 0 - dd procinfo ; 0x10000 -;run_filepath - db '/RD/1/SYSXTREE',0 - -procinfo: -times 256 db 0 -} - - -macro savedialog redproc,openoff,erroff,path -{ -local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc -local run_fileinfo, run_filepath, param -local getmesloop, loox, mred, mkey, mbutton, mgetmes -local dlg_is_work, ready, procinfo -; -; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, -; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) -; - - cld -;; mov esi,path - mov edi,path - mov eax,0 - mov ecx,200 - rep stosb - -;mov [get_loops],0 -mov [dlg_pid_get],0 - -; Get my PID in dec format 4 bytes - mov eax,9 - mov ebx,procinfo - mov ecx,-1 - int 0x40 - -; convert eax bin to param dec - mov eax,dword [procinfo+30] ;offset of myPID - mov edi,param+4-1 ;offset to 4 bytes - mov ecx,4 - mov ebx,10 - cld -new_d: - xor edx,edx - div ebx - add dl,'0' - mov [edi],dl - dec edi - loop new_d - -; wirite 1 byte space to param - mov [param+4],byte 32 ;Space for next parametr -; and 1 byte type of dialog to param - mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) - -; -; STEP2 prepare IPC area for get messages -; - -; prepare IPC area - mov [path],dword 0 - mov [path+4],dword 8 - -; define IPC memory - mov eax,60 - mov ebx,1 ; define IPC - mov ecx,path ; offset of area - mov edx,120 ; size 150 bytes - int 0x40 - -; change wanted events list 7-bit IPC event - mov eax,40 - mov ebx,01000111b - int 0x40 - -; -; STEP 3 run SYSTEM XTREE with parameters -; - - mov eax,58 - mov ebx,run_fileinfo - int 0x40 - - call redproc - - mov [get_loops],0 -getmesloop: - mov eax,23 - mov ebx,50 ;0.5 sec - int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes - -; Get number of procces - mov ebx,procinfo - mov ecx,-1 - mov eax,9 - int 0x40 - mov ebp,eax - -loox: - mov eax,9 - mov ebx,procinfo - mov ecx,ebp - int 0x40 - mov eax,[DLGPID] - cmp [procinfo+30],eax ;IF Dialog find - je dlg_is_work ;jmp to dlg_is_work - dec ebp - jnz loox - - jmp erroff - -dlg_is_work: - cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated - je erroff ;TESTODP2 terminated too - - cmp [dlg_pid_get],dword 1 - je getmesloop - inc [get_loops] - cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated - jae erroff - jmp getmesloop - -mred: - call redproc - jmp getmesloop -mkey: - int 0x40 ; read (eax=2) - jmp getmesloop -mbutton: - mov eax,17 ; get id - int 0x40 - cmp ah,1 ; button id=1 ? - jne getmesloop - mov eax,-1 ; close this program - int 0x40 -mgetmes: - -; If dlg_pid_get then second message get jmp to still - cmp [dlg_pid_get],dword 1 - je ready - -; First message is number of PID SYSXTREE dialog - -; convert PID dec to PID bin - movzx eax,byte [path+16] - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+1] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+2] - add eax,ebx - sub eax,48 - imul eax,10 - movzx ebx,byte [path+16+3] - add eax,ebx - sub eax,48 - mov [DLGPID],eax - -; Claear and prepare IPC area for next message - mov [path],dword 0 - mov [path+4],dword 8 - mov [path+8],dword 0 - mov [path+12],dword 0 - mov [path+16],dword 0 - -; Set dlg_pid_get for get next message - mov [dlg_pid_get],dword 1 - call redproc ;show DLG_PID - jmp getmesloop - -ready: -; -; The second message get -; Second message is 100 bytes path to SAVE/OPEN file -; shl path string on 16 bytes -; - cld - mov esi,path+16 - mov edi,path - mov ecx,200 - rep movsb - mov [edi],byte 0 - - jmp openoff - - -; DATA AREA -get_loops dd 0 -dlg_pid_get dd 0 -DLGPID dd 0 - -param: - rb 4 ; My dec PID - rb 6 ; Type of dialog - -run_fileinfo: - dd 16 - dd 0 - dd param - dd 0 - dd procinfo -run_filepath: - db '/RD/1/SYSXTREE',0 - -procinfo: -times 256 db 0 -} - - - - -; RANDOM - generate random count (small) -; (SYNTAX) RANDOM MaxCount,OutArgument -; (SAMPLE) RANDOM 10000,eax -; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations - -randomuse = 0 - -macro random arg1,arg2 -{ -local rxproc -randomuse = randomuse + 1 - - jmp rxproc - -if defined randomuse & randomuse = 1 -randomproc: - jmp rnj -rsx1 dw 0x4321 -rsx2 dw 0x1234 -rnj: -; mov eax,arg1 - push bx - push cx - push dx - push si - push di - mov cx,ax - mov ax,word ptr rsx1 - mov bx,word ptr rsx2 - mov si,ax - mov di,bx - mov dl,ah - mov ah,al - mov al,bh - mov bh,bl - xor bl,bl - rcr dl,1 - rcr ax,1 - rcr bx,1 - add bx,di - adc ax,si - add bx,0x62e9 - adc ax,0x3619 - mov word ptr rsx1,bx - mov word ptr rsx2,ax - xor dx,dx - cmp ax,0 - je nodiv - cmp cx,0 - je nodiv - div cx -nodiv: - mov ax,dx - pop di - pop si - pop dx - pop cx - pop bx - and eax,0000ffffh -; mov arg2,0 -; mov arg2,eax - ret -end if - -rxproc: - mov eax,arg1 - call randomproc - mov arg2,eax -} - -macro scank -{ - mov eax,10 - int 0x40 -} - -macro putpix x,y,color -{ - mov ebx,x - mov ecx,y - mov edx,color - mov eax,1 - int 0x40 -} - -macro puttxt x,y,offs,size,color -{ -; mov ebx,x -; shl ebx,16 -; add ebx,y - wordstoreg ebx,x,y - mov ecx,color - mov edx,offs - mov esi,size - mov eax,4 - int 0x40 -} - -macro outcount data, x, y, color, numtype -{ - mov ecx,data - mov ebx,numtype - mov bl,0 -; mov edx,x*65536+y - wordstoreg edx,x,y - mov esi,color - mov eax,47 - int 0x40 -} - -; SCEVENT - Scan event - -macro scevent red,key,but -{ - mov eax,11 - int 0x40 - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - -; WTEVENT - Wait event - -macro wtevent red,key,but -{ - mov eax,10 - int 0x40 - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - -; TIMEEVENT - Wite for event with timeout - -macro timeevent xfps,noevent,red,key,but -{ - mov eax,23 - mov ebx,xfps - int 0x40 - cmp eax,0 - je noevent - dec eax - jz red - dec eax - jz key - dec eax - jz but -} - - -; CLOSE - Close program - -macro close -{ - mov eax,-1 - int 0x40 -} - -; DELAY - Create delay 1/100 sec -; (SYNTAX) Delay time -; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec - -macro delay arg1 -{ - mov eax,5 - mov ebx,arg1 - int 0x40 -} - -; WINDOW - Draw window -; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color -; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned - -macro window arg1,arg2,arg3,arg4,arg5 -{ -; mov ebx,arg1*65536+arg3 -; mov ecx,arg2*65536+arg4 - wordstoreg ebx,arg1,arg3 - wordstoreg ecx,arg2,arg4 - mov edx,arg5 - mov eax,0 - int 0x40 -} - -macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 -{ - mov ebx,arg1*65536+arg3 - mov ecx,arg2*65536+arg4 - mov edx,arg5 - mov esi,arg6 - mov edi,arg7 - mov eax,0 - int 0x40 -} - - -; STARTWD - Start of window draw - -macro startwd -{ - mov eax,12 - mov ebx,1 - int 0x40 -} - -; ENDWD - End window draw - -macro endwd -{ - mov eax,12 - mov ebx,2 - int 0x40 -} - -; LABEL - Put text to frame -; (SYNTAX) LABEL Xstart,Ystart,'Text',Color -; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big - -macro label arg1,arg2,arg3,arg4 -{ -local asd,lab - jmp asd -lab db arg3 ;arg label -asd: -; mov ebx,arg1 ;arg1=y arg2=x -; shl ebx,16 -; add ebx,arg2 - wordstoreg ebx,arg1,arg2 - mov ecx,arg4 ;arg4 color - mov edx,lab - mov esi,asd-lab ;calc size - mov eax,4 - int 0x40 -} - -;Key's -key_Up equ 178 -key_Down equ 177 -key_Right equ 179 -key_Left equ 176 -key_Esc equ 27 -key_Space equ 32 -key_Enter equ 13 -key_Bspace equ 8 -key_F1 equ 50 -key_F2 equ 51 -key_F3 equ 52 -key_F4 equ 53 -key_F5 equ 54 -key_F6 equ 55 -key_F7 equ 56 -key_F8 equ 57 -key_F9 equ 48 -key_F10 equ 49 -key_F11 equ 68 -key_F12 equ 255 -key_Home equ 180 -key_End equ 181 -key_PgUp equ 184 -key_PgDown equ 183 - -;Attributes - -;Window Attributes -window_Skinned equ 0x03000000 -window_Type2 equ 0x02000000 -window_Type1 equ 0x00000000 -window_Reserve equ 0x01000000 - -;Font Attributes -font_Big equ 0x10000000 - -;Colors -cl_White equ 0x00ffffff -cl_Black equ 0x00000000 -cl_Grey equ 0x00888888 -cl_Red equ 0x00ff0000 -cl_Lime equ 0x0000ff00 -cl_Green equ 0x0000af00 -cl_Blue equ 0x000000ff -cl_Purple equ 0x008080ff -cl_Violet equ 0x008040ff -cl_Cyan equ 0x0040e0ff diff --git a/programs/games/life/trunk/build_en.bat b/programs/games/life/trunk/build_en.bat deleted file mode 100644 index d9a494ff04..0000000000 --- a/programs/games/life/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm life.asm life -@pause \ No newline at end of file diff --git a/programs/games/life/trunk/build_ru.bat b/programs/games/life/trunk/build_ru.bat deleted file mode 100644 index 8348f3ee65..0000000000 --- a/programs/games/life/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm life.asm life -@pause \ No newline at end of file diff --git a/programs/games/life/trunk/life.asm b/programs/games/life/trunk/life.asm deleted file mode 100644 index 52b3e54bc9..0000000000 --- a/programs/games/life/trunk/life.asm +++ /dev/null @@ -1,190 +0,0 @@ -; -; LIFE.ASM -; -; This program displays Conways game of life -; -; Compile with FASM for Menuet; -; -; -; Version 0.1 30th March 2004 -; Mike Hibbett -; -; Version 0.2 23th May 2004 -; Random generation dots with start -; -; Convert to ASCL Libary by Pavlushin Evgeni -; -; This is an experiment to see how small a usefull application can get -; - -use32 - org 0x0 - - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd 0x100000 ; memory for app - dd 0x100000 ; esp - dd 0x0 , 0x0 ; I_Param , I_Icon -include 'ascl.inc' - -macro setcell x,y { mov [esi + 512*(y)*3 + (x)*3], al } - -START: - - mov al, 0xFF - mov esi, I_END - - ; This is the seed pattern. - - ; Life needs a seed pattern, which is 'hardcode' at compile time - ; The grid is 512 wide (x direction) by 512 deep (y direction) - ; setcell take the arguments setcell x,y - ; 0,0 is the top left corner. - - setcell 200,120 - setcell 201,120 - setcell 200,121 - setcell 199,121 - setcell 200,122 - - setcell 70,120 - setcell 71,120 - setcell 70,121 - setcell 69,121 - setcell 70,122 - - call draw_window - - ;Random generation dots - - mov ecx,20000 -xxx: - push ecx - random 30000,edi ;up pice of screen - mov al,0xff - shl edi,3 -; mov [I_END+edi],al -; random 50000,edi ;down pice of screen -; mov al,0xff -; shl edi,3 - add edi,512*460 ;760 - mov [I_END+edi],al - pop ecx - dec ecx - jnz xxx - -still: - - timeevent 5,nokey,red,key,button ;Wait EVENT with 5 fps - jmp still - -red: ; REDRAW WINDOW - call draw_window - jmp still - -key: ; KEY - mov eax,2 ; get it, but ignore - int 0x40 - -nokey: - - ; cycle life state - - mov esi, I_END + 512*3 - - mov al, 0xFF - -lifeloop: - mov ah, 0 - cmp [esi - 3], al - jne t2 - inc ah -t2: - cmp [esi + 3], al - jne t3 - inc ah -t3: - cmp [esi - 512*3], al - jne t4 - inc ah -t4: - cmp [esi + 512*3], al - jne t5 - inc ah -t5: - cmp [esi - 512*3 - 3], al - jne t6 - inc ah -t6: - cmp [esi - 512*3 + 3], al - jne t7 - inc ah -t7: - cmp [esi + 512*3 - 3], al - jne t8 - inc ah -t8: - cmp [esi + 512*3 + 3], al - jne tend - inc ah - -tend: - ; If cell is empty but has 3 neigbours, birth - ; If cell is occupied and has 2,3 neigbours, live - ; else die - - cmp ah, 3 - jne btest - mov [esi+1], al - jmp nextcell - -btest: - cmp ah, 2 - jne nextcell - cmp [esi], al - jne nextcell - mov [esi+1], al - -nextcell: - add esi, 3 - cmp esi, I_END + 512*512*3 - jne lifeloop - - ; copy new generation across - - mov ecx, 512*512*3 - mov esi, I_END+1 - mov edi, I_END - rep movsb ; copy the data across - - mov ecx, 512*512 - mov esi, I_END -nc1: - mov [esi+2], byte 0 - add esi, 3 - loop nc1 - - mov ebx, I_END - mov ecx, 512*65536+512 - mov edx, 5*65536+20 - mov eax,7 - int 0x40 - - jmp still - -button: ; BUTTON - only close supported - close - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* -draw_window: - startwd - window 50,50,512+9,512+23,window_Skinned - label 8,8,'Life Screen',cl_White+font_Big - endwd - ret - -I_END: diff --git a/programs/games/pipes/build.bat b/programs/games/pipes/build.bat new file mode 100644 index 0000000000..48d7036ad4 --- /dev/null +++ b/programs/games/pipes/build.bat @@ -0,0 +1,2 @@ +@fasm pipes.asm pipes +@pause \ No newline at end of file diff --git a/programs/games/pipes/pipes.asm b/programs/games/pipes/pipes.asm new file mode 100644 index 0000000000..2bf5361961 --- /dev/null +++ b/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: + + + + diff --git a/programs/games/pipes/pipes.raw b/programs/games/pipes/pipes.raw new file mode 100644 index 0000000000..c225f610e6 --- /dev/null +++ b/programs/games/pipes/pipes.raw @@ -0,0 +1 @@ +zг╟sЬ└ZГзgР┤rЫ┐fП│cМ░[Ди@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@uЮ┬qЪ╛wа─aКоmЦ║qЪ╛yв╞]Жкyв╞cМ░oШ╝{д╚bЛпYВжmЦ║dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@]ЖкvЯ├[ДиeО▓qЪ╛hС╡fП│`Йн[ДиiТ╢rЫ┐gР┤kФ╕sЬ└qЪ╛YВж@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@sЬ└hС╡nЧ╗fП│kФ╕yв╞nЧ╗wа─oШ╝uЮ┬vЯ├^ЗлpЩ╜xб┼wа─YВж@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@nЧ╗tЭ┴sЬ└gР┤aКоeО▓XБе`Йнxб┼yв╞cМ░\ЕйeО▓uЮ┬fП│hС╡@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@^ЗлlХ╣yв╞xб┼fП│wа─uЮ┬zг╟zг╟ZГзdН▒cМ░wа─YВжnЧ╗oШ╝@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@]Жкzг╟fП│rЫ┐cМ░sЬ└fП│tЭ┴mЦ║sЬ└lХ╣oШ╝aКоjУ╖kФ╕YВж@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@xб┼nЧ╗cМ░xб┼iТ╢gР┤^Зл\ЕйuЮ┬hС╡yв╞vЯ├oШ╝WАдrЫ┐dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@_ИмrЫ┐sЬ└`Йн_ИмkФ╕WАд_Им_Им{д╚cМ░cМ░ZГзqЪ╛]ЖкcМ░@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@gР┤kФ╕WАд_Им\ЕйcМ░oШ╝kФ╕eО▓XБеtЭ┴ZГзtЭ┴hС╡mЦ║^Зл@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@fП│]ЖкeО▓gР┤\ЕйjУ╖ZГзYВжbЛпZГзmЦ║wа─qЪ╛cМ░iТ╢fП│@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@xб┼gР┤YВжvЯ├rЫ┐oШ╝kФ╕[ДиYВжfП│qЪ╛_ИмrЫ┐sЬ└`Йн_Им@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@jУ╖]ЖкWАдwа─sЬ└cМ░nЧ╗yв╞fП│YВжlХ╣wа─uЮ┬tЭ┴dН▒dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@pЩ╜nЧ╗pЩ╜ZГз]Жкzг╟tЭ┴eО▓yв╞\ЕйjУ╖vЯ├oШ╝uЮ┬ZГзpЩ╜@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@qЪ╛^ЗлoШ╝WАдnЧ╗xб┼ZГзYВжZГз`ЙнaКоXБеnЧ╗ZГзwа─_Им@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@nЧ╗jУ╖mЦ║\ЕйqЪ╛{д╚fП│ZГзjУ╖]ЖкjУ╖eО▓wа─uЮ┬qЪ╛`Йн@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@_Имwа─tЭ┴lХ╣XБе^ЗлtЭ┴cМ░bЛпeО▓[Ди[ДиZГзjУ╖kФ╕rЫ┐@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@`ЙнcМ░qЪ╛aКоfП│xб┼`Йнyв╞jУ╖uЮ┬vЯ├xб┼^Зл[ДиdН▒qЪ╛@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@eО▓uЮ┬[ДиtЭ┴^ЗлeО▓xб┼hС╡nЧ╗jУ╖\ЕйgР┤nЧ╗kФ╕]Жк\Ей@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@YВжdН▒WАд]ЖкiТ╢lХ╣tЭ┴\Ей`Йн^ЗлoШ╝`ЙнoШ╝qЪ╛eО▓WАд@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@rЫ┐pЩ╜wа─pЩ╜`ЙнqЪ╛bЛп\ЕйXБеsЬ└vЯ├ZГзgР┤uЮ┬fП│hС╡@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@vЯ├xб┼mЦ║XБеZГзrЫ┐xб┼mЦ║nЧ╗`ЙнXБеvЯ├zг╟[ДиgР┤\Ей@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@wа─hС╡vЯ├fП│^ЗлtЭ┴cМ░iТ╢fП│xб┼ZГз]ЖкpЩ╜tЭ┴_Им{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@{д╚^ЗлtЭ┴iТ╢hС╡kФ╕mЦ║]Жк_ИмcМ░mЦ║mЦ║dН▒zг╟cМ░tЭ┴@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@bЛпpЩ╜dН▒tЭ┴wа─eО▓wа─XБеjУ╖pЩ╜YВжqЪ╛hС╡aКоmЦ║mЦ║@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@fП│{д╚xб┼YВжaКоhС╡lХ╣XБе\ЕйlХ╣wа─jУ╖_ИмgР┤]Жк_Им@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@WАд{д╚sЬ└{д╚WАдjУ╖rЫ┐ZГзnЧ╗`ЙнXБеvЯ├zг╟[ДиgР┤\Ей@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@wа─hС╡vЯ├fП│^ЗлtЭ┴cМ░iТ╢wа─mЦ║_ИмZГзmЦ║sЬ└lХ╣oШ╝@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@YВжxб┼^ЗлbЛпxб┼nЧ╗cМ░xб┼vЯ├gР┤vЯ├fП│fП│wа─mЦ║eО▓@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@cМ░cМ░nЧ╗dН▒iТ╢dН▒_ИмlХ╣pЩ╜uЮ┬aКо]ЖкpЩ╜jУ╖XБеXБе@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@XБеvЯ├wа─aКоaКоWАдjУ╖ZГзdН▒mЦ║ZГзnЧ╗qЪ╛vЯ├fП│hС╡@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@iТ╢kФ╕yв╞wа─nЧ╗bЛпhС╡jУ╖ZГзWАдiТ╢zг╟sЬ└ZГзgР┤rЫ┐@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@bЛпrЫ┐fП│uЮ┬qЪ╛wа─aКоmЦ║eО▓ZГз`ЙнaКоXБеnЧ╗ZГзwа─_ИмvЯ├eО▓pЩ╜fП│nЧ╗iТ╢oШ╝yв╞pЩ╜oШ╝{д╚zг╟iТ╢eО▓XБе^ЗлnЧ╗jУ╖mЦ║\ЕйqЪ╛{д╚fП│nЧ╗nЧ╗gР┤XБеuЮ┬gР┤yв╞cМ░hС╡{д╚lХ╣jУ╖{д╚XБе^Злzг╟YВжuЮ┬gР┤sЬ└iТ╢mЦ║dН▒wа─cМ░{д╚qЪ╛{д╚yв╞YВжrЫ┐fП│hС╡YВж`ЙнsЬ└wа─sЬ└xб┼YВж[ДиmЦ║gР┤[Диxб┼aКоuЮ┬cМ░eО▓YВж_ИмsЬ└]ЖкjУ╖_ИмpЩ╜XБеbЛп[ДиjУ╖jУ╖nЧ╗fП│wа─mЦ║XБеZГзrЫ┐xб┼mЦ║tЭ┴gР┤XБеlХ╣jУ╖jУ╖WАдqЪ╛^ЗлoШ╝WАдnЧ╗xб┼ZГзYВжlХ╣eО▓]ЖкeО▓aКоiТ╢kФ╕rЫ┐iТ╢ZГзuЮ┬nЧ╗uЮ┬kФ╕{д╚XБеcМ░uЮ┬nЧ╗lХ╣eО▓jУ╖nЧ╗_ИмbЛпaКоkФ╕wа─zг╟gР┤lХ╣rЫ┐fП│vЯ├_Им^ЗлaКоvЯ├lХ╣rЫ┐vЯ├xб┼ZГз^ЗлeО▓hС╡qЪ╛nЧ╗bЛпhС╡yв╞fП│xб┼jУ╖\Ейzг╟`Йнxб┼aКоiТ╢hС╡bЛп^ЗлrЫ┐iТ╢ZГзkФ╕{д╚YВж\ЕйiТ╢oШ╝gР┤eО▓xб┼YВжyв╞dН▒sЬ└iТ╢lХ╣ZГзcМ░^ЗлuЮ┬WАдwа─mЦ║_ИмZГзmЦ║sЬ└lХ╣oШ╝aКоjУ╖kФ╕YВжyв╞]ЖкmЦ║^ЗлjУ╖mЦ║[Ди_ИмoШ╝nЧ╗bЛпhС╡jУ╖XБеlХ╣yв╞qЪ╛uЮ┬_ИмuЮ┬pЩ╜vЯ├zг╟yв╞nЧ╗YВжtЭ┴jУ╖cМ░tЭ┴\Ей\ЕйsЬ└iТ╢pЩ╜jУ╖mЦ║tЭ┴qЪ╛\ЕйhС╡@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppupАЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАpuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@YВжsЬ└kФ╕cМ░YВжnЧ╗]ЖкXБеyв╞[ДиiТ╢tЭ┴fП│WАдzг╟vЯ├eО▓cМ░nЧ╗_ИмcМ░mЦ║mЦ║dН▒zг╟cМ░tЭ┴WАдqЪ╛YВжlХ╣\ЕйjУ╖oШ╝tЭ┴kФ╕iТ╢_Им`Йн]Жкxб┼vЯ├qЪ╛bЛп[Диzг╟bЛпjУ╖]ЖкpЩ╜yв╞zг╟]ЖкcМ░kФ╕_ИмvЯ├hС╡XБеzг╟]ЖкjУ╖zг╟uЮ┬bЛпvЯ├uЮ┬`ЙнaКоhС╡lХ╣qЪ╛ZГзwа─tЭ┴`Йнxб┼ZГзnЧ╗tЭ┴xб┼dН▒^Злwа─eО▓iТ╢bЛпsЬ└^Зл^ЗлlХ╣cМ░]ЖкvЯ├zг╟tЭ┴uЮ┬oШ╝xб┼qЪ╛hС╡gР┤xб┼fП│[Ди]ЖкtЭ┴kФ╕hС╡xб┼qЪ╛[ДиuЮ┬rЫ┐vЯ├qЪ╛aКоnЧ╗vЯ├_ИмvЯ├XБеgР┤eО▓mЦ║hС╡pЩ╜lХ╣lХ╣dН▒tЭ┴uЮ┬ZГз_Имwа─tЭ┴lХ╣XБе^ЗлtЭ┴cМ░^Злzг╟qЪ╛xб┼XБеWАдqЪ╛[Диzг╟pЩ╜`ЙнpЩ╜ZГз{д╚fП│[ДиeО▓^Злxб┼iТ╢lХ╣tЭ┴jУ╖[Ди[ДиpЩ╜pЩ╜jУ╖tЭ┴aКоmЦ║fП│\ЕйtЭ┴zг╟WАд{д╚sЬ└{д╚WАдjУ╖rЫ┐ZГзgР┤kФ╕\Ейxб┼bЛп`ЙнqЪ╛sЬ└kФ╕cМ░wа─iТ╢bЛпiТ╢\Ей]Жк\ЕйiТ╢mЦ║wа─cМ░cМ░aКоdН▒wа─pЩ╜lХ╣jУ╖pЩ╜uЮ┬jУ╖yв╞]ЖкpЩ╜]Жк[ДиjУ╖vЯ├qЪ╛kФ╕aКоYВж[ДиhС╡nЧ╗aКоeО▓qЪ╛uЮ┬jУ╖]ЖкjУ╖eО▓wа─uЮ┬qЪ╛`Йнyв╞[Ди{д╚\ЕйgР┤mЦ║rЫ┐XБе]ЖкgР┤iТ╢lХ╣dН▒tЭ┴uЮ┬hС╡\ЕйfП│]Жкzг╟fП│rЫ┐cМ░@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@WАдlХ╣nЧ╗wа─oШ╝mЦ║sЬ└YВжkФ╕mЦ║]ЖкoШ╝YВжdН▒mЦ║{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@pЩ╜wа─zг╟^ЗлdН▒^ЗлhС╡fП│[ДиrЫ┐ZГз_ИмtЭ┴WАдjУ╖vЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@hС╡uЮ┬{д╚yв╞XБеWАдgР┤_ИмqЪ╛cМ░qЪ╛dН▒vЯ├gР┤YВжmЦ║@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@`ЙнaКоhС╡lХ╣qЪ╛ZГзwа─tЭ┴lХ╣pЩ╜qЪ╛ZГз`ЙнdН▒_ИмvЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@{д╚mЦ║pЩ╜rЫ┐hС╡mЦ║cМ░aКоsЬ└eО▓iТ╢vЯ├xб┼jУ╖XБе\Ей@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@^ЗлkФ╕uЮ┬]Жк{д╚xб┼jУ╖XБеqЪ╛yв╞[Ди_ИмuЮ┬pЩ╜jУ╖jУ╖@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@tЭ┴rЫ┐xб┼_ИмoШ╝sЬ└cМ░mЦ║XБе_ИмaКоyв╞lХ╣oШ╝^ЗлsЬ└@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@@@@wа─YВжnЧ╗oШ╝vЯ├qЪ╛eО▓ZГзjУ╖cМ░sЬ└gР┤qЪ╛]ЖкpЩ╜@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@{д╚cМ░]ЖкbЛпpЩ╜gР┤pЩ╜cМ░@@@@@@pupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@dН▒^ЗлZГзqЪ╛_ИмhС╡iТ╢YВж@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppuppuppuppuppuppuppuppupZГзWАдjУ╖YВж\ЕйhС╡yв╞tЭ┴@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕАWАдkФ╕iТ╢qЪ╛\ЕйkФ╕wа─]ЖкjУ╖@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРhС╡fП│nЧ╗mЦ║oШ╝^ЗлeО▓bЛпiТ╢ZГз@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеааеа_ИмkФ╕WАд_Им^ЗлtЭ┴[ДиmЦ║qЪ╛jУ╖eО▓@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеаnЧ╗zг╟cМ░pЩ╜qЪ╛tЭ┴^ЗлbЛпmЦ║iТ╢ZГзlХ╣@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░aКоuЮ┬YВжzг╟qЪ╛vЯ├`ЙнmЦ║zг╟qЪ╛fП│eО▓ZГз@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░aКоeО▓pЩ╜iТ╢eО▓pЩ╜kФ╕nЧ╗hС╡mЦ║WАдpЩ╜lХ╣jУ╖@@@@@@@@@puppupАЕАРХРаеааеааеааеааеааеааеааеааеааеааеа]ЖкjУ╖cМ░oШ╝{д╚zг╟ZГзdН▒_Имzг╟eО▓yв╞iТ╢ZГзZГз@@@@@@@@@puppupАЕАРХРаеааеааеааеааеааеааеааеааеааеаlХ╣tЭ┴uЮ┬`ЙнZГзyв╞hС╡tЭ┴`ЙнhС╡rЫ┐WАдqЪ╛fП│eО▓eО▓@@@@@@@@@puppupАЕАРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРwа─{д╚pЩ╜dН▒`ЙнtЭ┴kФ╕fП│lХ╣_ИмuЮ┬gР┤mЦ║WАдpЩ╜lХ╣lХ╣@@@@@@@@@puppupАЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАcМ░mЦ║pЩ╜zг╟oШ╝cМ░uЮ┬WАдiТ╢`Йн\ЕйZГзtЭ┴bЛпxб┼jУ╖bЛпZГз@@@@@@@@@puppuppuppuppuppuppuppuppuppuppupnЧ╗{д╚XБеsЬ└uЮ┬pЩ╜zг╟oШ╝qЪ╛fП│eО▓mЦ║pЩ╜hС╡rЫ┐WАдqЪ╛fП│eО▓@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ZГзyв╞hС╡tЭ┴zг╟[ДиlХ╣fП│mЦ║WАдpЩ╜lХ╣sЬ└_ИмuЮ┬gР┤mЦ║WАдpЩ╜lХ╣@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@qЪ╛xб┼oШ╝tЭ┴bЛпgР┤qЪ╛_ИмZГзnЧ╗cМ░wа─lХ╣]ЖкaКоaКоnЧ╗_ИмhС╡WАдZГзdН▒{д╚ZГзXБеqЪ╛sЬ└lХ╣qЪ╛[ДиkФ╕hС╡wа─\Ейwа─`ЙнiТ╢uЮ┬yв╞lХ╣yв╞{д╚mЦ║{д╚tЭ┴jУ╖eО▓uЮ┬zг╟kФ╕fП│kФ╕WАд^ЗлcМ░jУ╖_Имyв╞eО▓pЩ╜cМ░rЫ┐mЦ║\ЕйaКоYВжwа─xб┼yв╞fП│[Ди[ДиhС╡XБеpЩ╜pЩ╜uЮ┬cМ░pЩ╜YВжcМ░WАдnЧ╗iТ╢jУ╖ZГз]ЖкcМ░aКо[ДиiТ╢qЪ╛qЪ╛ZГз]ЖкfП│mЦ║yв╞nЧ╗ZГзoШ╝hС╡_ИмeО▓tЭ┴sЬ└zг╟dН▒`ЙнoШ╝iТ╢zг╟pЩ╜_ИмmЦ║qЪ╛YВжqЪ╛bЛпsЬ└yв╞_ИмvЯ├ZГзdН▒_ИмoШ╝]ЖкqЪ╛aКо{д╚nЧ╗xб┼rЫ┐uЮ┬^Злzг╟uЮ┬oШ╝`ЙнZГз{д╚eО▓qЪ╛qЪ╛^ЗлoШ╝\Ей\Ей_ИмpЩ╜gР┤lХ╣uЮ┬xб┼`ЙнvЯ├tЭ┴YВжzг╟yв╞kФ╕XБеtЭ┴[Ди[ДиpЩ╜`Йн[ДиpЩ╜cМ░tЭ┴yв╞zг╟pЩ╜vЯ├tЭ┴tЭ┴^ЗлkФ╕hС╡hС╡gР┤qЪ╛oШ╝pЩ╜jУ╖dН▒gР┤WАдdН▒fП│]Жкyв╞sЬ└xб┼nЧ╗sЬ└jУ╖\ЕйlХ╣zг╟uЮ┬kФ╕hС╡ZГзkФ╕`Йн^Зл[ДиeО▓wа─yв╞iТ╢pЩ╜]Жк^ЗлjУ╖XБе_ИмYВжjУ╖mЦ║rЫ┐vЯ├dН▒uЮ┬dН▒_Имzг╟jУ╖ZГзfП│oШ╝WАдfП│tЭ┴dН▒nЧ╗mЦ║bЛпmЦ║bЛп]ЖкtЭ┴YВжcМ░pЩ╜sЬ└jУ╖\ЕйvЯ├mЦ║vЯ├{д╚cМ░qЪ╛xб┼oШ╝tЭ┴bЛпgР┤qЪ╛_ИмZГзnЧ╗cМ░wа─lХ╣]ЖкaКоaКоnЧ╗_ИмhС╡WАдZГзdН▒{д╚ZГзXБеqЪ╛sЬ└lХ╣qЪ╛[ДиkФ╕hС╡wа─\Ейwа─`ЙнiТ╢uЮ┬yв╞lХ╣yв╞{д╚mЦ║{д╚tЭ┴jУ╖eО▓uЮ┬zг╟kФ╕fП│kФ╕WАд^ЗлcМ░jУ╖_Имyв╞eО▓pЩ╜cМ░rЫ┐mЦ║\ЕйaКоYВжwа─xб┼yв╞fП│[Ди[ДиhС╡XБеpЩ╜pЩ╜uЮ┬cМ░pЩ╜YВжcМ░WАдnЧ╗iТ╢jУ╖ZГз]ЖкcМ░aКо[ДиiТ╢qЪ╛qЪ╛ZГз]ЖкfП│mЦ║yв╞nЧ╗ZГзoШ╝hС╡_ИмeО▓tЭ┴sЬ└zг╟dН▒`ЙнoШ╝iТ╢zг╟pЩ╜_ИмmЦ║qЪ╛YВжqЪ╛bЛпsЬ└yв╞_ИмvЯ├ZГзdН▒_ИмoШ╝]ЖкqЪ╛aКо{д╚nЧ╗xб┼rЫ┐uЮ┬^Злzг╟uЮ┬oШ╝`ЙнZГз{д╚eО▓qЪ╛qЪ╛^ЗлoШ╝\Ей\Ей_ИмpЩ╜gР┤lХ╣uЮ┬xб┼`ЙнvЯ├tЭ┴YВжzг╟yв╞kФ╕XБеtЭ┴[Ди[ДиpЩ╜`Йн[ДиpЩ╜cМ░tЭ┴yв╞zг╟pЩ╜vЯ├tЭ┴tЭ┴^ЗлkФ╕hС╡hС╡gР┤qЪ╛oШ╝pЩ╜jУ╖dН▒gР┤WАдdН▒fП│]Жкyв╞sЬ└xб┼nЧ╗sЬ└jУ╖\ЕйlХ╣zг╟uЮ┬kФ╕hС╡ZГзkФ╕`Йн^Зл[ДиeО▓wа─yв╞iТ╢pЩ╜]Жк^ЗлjУ╖XБе_ИмYВжjУ╖mЦ║rЫ┐vЯ├dН▒uЮ┬dН▒_Имzг╟jУ╖ZГзfП│oШ╝WАдfП│tЭ┴dН▒nЧ╗mЦ║bЛпmЦ║bЛп]ЖкtЭ┴YВжcМ░pЩ╜sЬ└jУ╖\ЕйvЯ├mЦ║vЯ├{д╚cМ░gР┤yв╞pЩ╜^Зл\ЕйoШ╝lХ╣iТ╢mЦ║qЪ╛iТ╢lХ╣`Йн_ИмhС╡zг╟mЦ║qЪ╛iТ╢jУ╖@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@tЭ┴qЪ╛zг╟wа─hС╡bЛпpЩ╜YВжWАдfП│`Йн_ИмhС╡zг╟mЦ║qЪ╛iТ╢jУ╖ZГз@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@zг╟vЯ├oШ╝eО▓gР┤eО▓qЪ╛tЭ┴pЩ╜eО▓\ЕйuЮ┬rЫ┐eО▓WАдfП│ZГзeО▓@@@@@@@@@puppuppuppuppuppuppuppuppuppuppup]ЖкlХ╣vЯ├iТ╢lХ╣yв╞ZГзfП│lХ╣mЦ║ZГзgР┤WАдyв╞pЩ╜eО▓lХ╣@@@@@@@@@puppupАЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАpЩ╜]ЖкgР┤bЛпWАд\Ей`Йн[ДиsЬ└pЩ╜tЭ┴mЦ║qЪ╛iТ╢lХ╣ZГз@@@@@@@@@puppupАЕАРХРРХРРХРРХРРХРРХРРХРРХРРХРРХРpЩ╜cМ░vЯ├sЬ└aКоjУ╖dН▒XБе_ИмhС╡bЛпWАдfП│ZГзjУ╖@@@@@@@@@puppupАЕАРХРаеааеааеааеааеааеааеааеааеааеаmЦ║aКоfП│^ЗлkФ╕vЯ├_ИмiТ╢uЮ┬rЫ┐xб┼pЩ╜eО▓ZГз@@@@@@@@@puppupАЕАРХРаеааеааеааеааеааеааеааеааеааеааеаfП│oШ╝fП│^ЗлuЮ┬oШ╝vЯ├iТ╢gР┤WАдjУ╖lХ╣eО▓@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░bЛпpЩ╜wа─lХ╣wа─uЮ┬\ЕйaКоmЦ║qЪ╛bЛпlХ╣@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░qЪ╛\ЕйmЦ║cМ░jУ╖ZГзkФ╕uЮ┬WАдfП│ZГз@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеаxб┼gР┤eО▓]ЖкsЬ└pЩ╜eО▓YВжpЩ╜eО▓@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеааеаgР┤qЪ╛sЬ└vЯ├aКо_Имxб┼zг╟lХ╣@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРzг╟xб┼iТ╢zг╟gР┤vЯ├^ЗлqЪ╛@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕА]ЖкqЪ╛jУ╖tЭ┴jУ╖xб┼^ЗлvЯ├@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppuppuppuppuppuppuppuppupzг╟zг╟mЦ║rЫ┐`ЙнmЦ║kФ╕`Йн@@@@@@pupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@_ИмhС╡zг╟tЭ┴[ДиXБе\ЕйmЦ║@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@uЮ┬rЫ┐eО▓bЛпyв╞ZГзtЭ┴bЛп@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@@@@tЭ┴^Зл{д╚`ЙнhС╡pЩ╜WАдgР┤WАдyв╞xб┼yв╞rЫ┐rЫ┐YВж@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@wа─rЫ┐kФ╕mЦ║aКоuЮ┬wа─lХ╣mЦ║qЪ╛iТ╢jУ╖XБеxб┼xб┼rЫ┐@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@YВжxб┼uЮ┬pЩ╜hС╡{д╚zг╟nЧ╗WАдfП│ZГзbЛпZГзmЦ║_ИмvЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@nЧ╗_Им]ЖкrЫ┐lХ╣yв╞^Злwа─pЩ╜eО▓]ЖкsЬ└uЮ┬tЭ┴oШ╝uЮ┬@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@oШ╝oШ╝{д╚hС╡qЪ╛XБеdН▒oШ╝lХ╣mЦ║mЦ║]ЖкgР┤gР┤sЬ└^Зл@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@vЯ├sЬ└xб┼mЦ║ZГзWАд^ЗлmЦ║sЬ└pЩ╜YВжtЭ┴uЮ┬XБеcМ░{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@qЪ╛cМ░jУ╖cМ░wа─gР┤hС╡sЬ└kФ╕kФ╕yв╞tЭ┴wа─lХ╣mЦ║fП│@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@eО▓mЦ║XБеaКоtЭ┴_ИмfП│YВжkФ╕sЬ└lХ╣pЩ╜WАдmЦ║gР┤uЮ┬_Имzг╟]Жкzг╟gР┤xб┼qЪ╛bЛпfП│mЦ║pЩ╜pЩ╜]Жкzг╟tЭ┴gР┤vЯ├]Жкyв╞qЪ╛mЦ║aКоwа─qЪ╛kФ╕pЩ╜mЦ║eО▓fП│qЪ╛WАдrЫ┐hС╡zг╟qЪ╛xб┼qЪ╛gР┤\ЕйpЩ╜oШ╝aКоcМ░]ЖкlХ╣vЯ├qЪ╛yв╞dН▒yв╞kФ╕aКоyв╞YВж\Ейxб┼yв╞YВжmЦ║]ЖкZГзiТ╢yв╞eО▓zг╟mЦ║jУ╖iТ╢sЬ└eО▓mЦ║wа─fП│fП│vЯ├gР┤vЯ├oШ╝zг╟pЩ╜uЮ┬sЬ└XБе{д╚nЧ╗wа─wа─oШ╝tЭ┴tЭ┴]ЖкsЬ└bЛпjУ╖xб┼bЛпtЭ┴rЫ┐tЭ┴zг╟vЯ├]ЖкcМ░lХ╣^Зл^ЗлsЬ└bЛпiТ╢eО▓wа─^ЗлdН▒xб┼tЭ┴nЧ╗ZГзxб┼`ЙнtЭ┴wа─uЮ┬gР┤uЮ┬ZГзXБеyв╞yв╞[Ди`ЙнjУ╖gР┤aКоsЬ└jУ╖wа─uЮ┬kФ╕aКоWАдlХ╣gР┤hС╡\Ей_ИмnЧ╗[Диxб┼oШ╝yв╞iТ╢bЛпlХ╣XБеgР┤tЭ┴mЦ║xб┼rЫ┐ZГзXБеmЦ║xб┼vЯ├_ИмpЩ╜ZГзuЮ┬oШ╝vЯ├jУ╖\Ейyв╞eО▓bЛпoШ╝zг╟sЬ└[ДиrЫ┐hС╡fП│uЮ┬gР┤mЦ║cМ░sЬ└oШ╝_Имxб┼rЫ┐tЭ┴\ЕйkФ╕^Зл^Злxб┼eО▓kФ╕\ЕйvЯ├_ИмdН▒`ЙнZГзqЪ╛pЩ╜lХ╣jУ╖jУ╖pЩ╜uЮ┬_Им[Диyв╞qЪ╛fП│{д╚^ЗлuЮ┬vЯ├rЫ┐YВжbЛпmЦ║`ЙнvЯ├qЪ╛zг╟YВжuЮ┬aКоiТ╢iТ╢XБе[ДиfП│tЭ┴YВжiТ╢ZГз\Ей`Йн^ЗлeО▓[ДиlХ╣_Им@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lХ╣pЩ╜WАдmЦ║gР┤uЮ┬_ИмsЬ└lХ╣pЩ╜WАдmЦ║fП│lХ╣[Диzг╟tЭ┴hС╡yв╞ZГз@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@eО▓fП│qЪ╛WАдrЫ┐hС╡pЩ╜mЦ║eО▓fП│qЪ╛oШ╝zг╟pЩ╜uЮ┬sЬ└XБе{д╚nЧ╗puppuppuppuppuppuppuppuppuppuppup@@@@@@@@@ZГзbЛпjУ╖xб┼bЛпtЭ┴ZГз\Ей`ЙнiТ╢WАдuЮ┬cМ░oШ╝zг╟pЩ╜mЦ║cМ░АЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАpuppup@@@@@@@@@lХ╣lХ╣pЩ╜WАдmЦ║gР┤uЮ┬_ИмlХ╣fП│kФ╕tЭ┴`ЙнdН▒pЩ╜{д╚wа─РХРРХРРХРРХРРХРРХРРХРРХРРХРРХРАЕАpuppup@@@@@@@@@eО▓eО▓fП│qЪ╛WАдrЫ┐hС╡`ЙнtЭ┴hС╡yв╞ZГз`ЙнuЮ┬tЭ┴lХ╣аеааеааеааеааеааеааеааеааеааеаРХРАЕАpuppup@@@@@@@@@ZГзZГзiТ╢yв╞eО▓zг╟_ИмdН▒ZГзzг╟{д╚oШ╝cМ░jУ╖]ЖкаеааеааеааеааеааеааеааеааеааеааеаРХРАЕАpuppup@@@@@@@@@jУ╖lХ╣pЩ╜WАдmЦ║hС╡nЧ╗kФ╕pЩ╜eО▓iТ╢pЩ╜eО▓aКо░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@ZГзeО▓fП│qЪ╛zг╟mЦ║`ЙнvЯ├qЪ╛zг╟YВжuЮ┬aКо░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@lХ╣ZГзiТ╢mЦ║bЛп^ЗлtЭ┴qЪ╛pЩ╜cМ░zг╟nЧ╗аеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@eО▓jУ╖qЪ╛mЦ║[ДиtЭ┴^Зл_ИмWАдkФ╕_Имаеааеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@ZГзiТ╢bЛпeО▓^ЗлoШ╝mЦ║nЧ╗fП│hС╡РХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@jУ╖]Жкwа─kФ╕\ЕйqЪ╛iТ╢kФ╕WАдАЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@tЭ┴yв╞hС╡\ЕйYВжjУ╖WАдZГзpuppuppuppuppuppuppuppuppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@YВжiТ╢hС╡_ИмqЪ╛ZГз^ЗлdН▒@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpup@@@@@@cМ░pЩ╜gР┤pЩ╜bЛп]ЖкcМ░{д╚@@@@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@pЩ╜]ЖкqЪ╛gР┤sЬ└cМ░jУ╖ZГзeО▓qЪ╛vЯ├oШ╝nЧ╗YВжwа─@@@@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@sЬ└^ЗлoШ╝lХ╣yв╞aКо_ИмXБеmЦ║cМ░sЬ└oШ╝_Имxб┼rЫ┐tЭ┴@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@jУ╖jУ╖pЩ╜uЮ┬_Им[Диyв╞qЪ╛XБеjУ╖xб┼{д╚]ЖкuЮ┬kФ╕^Зл@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@\ЕйXБеjУ╖xб┼vЯ├iТ╢eО▓sЬ└aКоcМ░mЦ║hС╡rЫ┐pЩ╜mЦ║{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@vЯ├_ИмdН▒`ЙнZГзqЪ╛pЩ╜lХ╣tЭ┴wа─ZГзqЪ╛lХ╣hС╡aКо`Йн@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@mЦ║YВжgР┤vЯ├dН▒qЪ╛cМ░qЪ╛_ИмgР┤WАдXБеyв╞{д╚uЮ┬hС╡@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@vЯ├jУ╖WАдtЭ┴_ИмZГзrЫ┐[ДиfП│hС╡^ЗлdН▒^Злzг╟wа─pЩ╜@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@{д╚mЦ║dН▒YВжoШ╝]ЖкmЦ║kФ╕YВжsЬ└mЦ║oШ╝wа─nЧ╗lХ╣WАд@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@cМ░rЫ┐fП│zг╟]ЖкfП│\ЕйhС╡YВжfП│_ИмtЭ┴aКоXБеmЦ║eО▓@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@fП│mЦ║lХ╣wа─tЭ┴yв╞kФ╕kФ╕sЬ└hС╡gР┤wа─cМ░jУ╖cМ░qЪ╛@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@{д╚cМ░XБеuЮ┬tЭ┴YВжpЩ╜sЬ└mЦ║^ЗлWАдZГзmЦ║xб┼sЬ└vЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@^ЗлsЬ└gР┤gР┤]ЖкmЦ║mЦ║lХ╣oШ╝dН▒XБеqЪ╛hС╡{д╚oШ╝oШ╝@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@uЮ┬oШ╝tЭ┴uЮ┬sЬ└]ЖкeО▓pЩ╜wа─^Злyв╞lХ╣rЫ┐]Жк_ИмnЧ╗@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@vЯ├_ИмmЦ║ZГзbЛпZГзfП│WАдnЧ╗zг╟{д╚hС╡pЩ╜uЮ┬xб┼YВж@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@rЫ┐xб┼xб┼XБеjУ╖iТ╢qЪ╛mЦ║lХ╣wа─uЮ┬aКоmЦ║kФ╕rЫ┐wа─@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@YВжrЫ┐rЫ┐yв╞xб┼yв╞WАдgР┤WАдpЩ╜hС╡`Йн{д╚^ЗлtЭ┴@@@@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@bЛпtЭ┴ZГзyв╞bЛпeО▓rЫ┐uЮ┬@@@@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@mЦ║\ЕйXБе[ДиtЭ┴zг╟hС╡_Им@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpup@@@@@@`ЙнkФ╕mЦ║`ЙнrЫ┐mЦ║zг╟zг╟puppuppuppuppuppuppuppuppupАЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@vЯ├^Злxб┼jУ╖tЭ┴jУ╖qЪ╛]ЖкАЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@bЛп^ЗлvЯ├gР┤zг╟iТ╢xб┼zг╟РХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@lХ╣jУ╖xб┼_ИмaКоvЯ├sЬ└qЪ╛gР┤аеааеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@eО▓pЩ╜xб┼eО▓pЩ╜sЬ└]ЖкeО▓gР┤xб┼аеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@ZГзfП│WАдbЛпkФ╕ZГзjУ╖cМ░mЦ║\ЕйqЪ╛░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@lХ╣bЛпqЪ╛mЦ║tЭ┴yв╞kФ╕kФ╕lХ╣wа─pЩ╜bЛп░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@eО▓lХ╣jУ╖WАдgР┤ZГзYВжpЩ╜sЬ└^ЗлfП│oШ╝fП│аеааеааеааеааеааеааеааеааеааеааеаРХРАЕАpuppup@@@@@@@@@ZГзeО▓pЩ╜xб┼rЫ┐uЮ┬\ЕйmЦ║mЦ║lХ╣^ЗлfП│aКоmЦ║аеааеааеааеааеааеааеааеааеааеаРХРАЕАpuppup@@@@@@@@@jУ╖ZГзfП│WАдbЛпhС╡_Им`Йн]ЖкeО▓pЩ╜sЬ└vЯ├cМ░pЩ╜РХРРХРРХРРХРРХРРХРРХРРХРРХРРХРАЕАpuppup@@@@@@@@@ZГзlХ╣iТ╢qЪ╛mЦ║tЭ┴pЩ╜sЬ└bЛпZГзfП│WАдbЛпgР┤]ЖкpЩ╜АЕААЕААЕААЕААЕААЕААЕААЕААЕААЕАpuppup@@@@@@@@@lХ╣eО▓pЩ╜yв╞WАдgР┤ZГзmЦ║lХ╣jУ╖iТ╢qЪ╛mЦ║iТ╢vЯ├lХ╣]Жкpuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@eО▓ZГзfП│WАдeО▓rЫ┐uЮ┬\ЕйeО▓pЩ╜xб┼yв╞WАдgР┤eО▓oШ╝vЯ├zг╟@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ZГзjУ╖iТ╢qЪ╛mЦ║zг╟hС╡_Им`ЙнfП│WАдbЛпeО▓rЫ┐uЮ┬wа─zг╟qЪ╛tЭ┴@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@jУ╖iТ╢qЪ╛mЦ║zг╟hС╡_Им`ЙнlХ╣iТ╢qЪ╛mЦ║tЭ┴zг╟hС╡_Им^ЗлpЩ╜yв╞gР┤cМ░{д╚vЯ├mЦ║vЯ├\ЕйjУ╖sЬ└pЩ╜cМ░YВжtЭ┴]ЖкbЛпoШ╝tЭ┴uЮ┬sЬ└]ЖкeО▓pЩ╜yв╞WАдgР┤ZГзjУ╖zг╟_ИмdН▒uЮ┬dН▒vЯ├rЫ┐mЦ║jУ╖YВж_ИмXБеjУ╖^Зл]ЖкpЩ╜iТ╢yв╞wа─eО▓_ИмmЦ║ZГзbЛпZГзfП│WАдeО▓rЫ┐uЮ┬\ЕйjУ╖sЬ└nЧ╗xб┼sЬ└yв╞]ЖкfП│dН▒WАдgР┤dН▒jУ╖pЩ╜oШ╝qЪ╛gР┤hС╡hС╡kФ╕^Злxб┼xб┼XБеjУ╖iТ╢qЪ╛mЦ║zг╟hС╡_Им`ЙнpЩ╜[Ди[ДиtЭ┴XБеkФ╕yв╞zг╟YВжtЭ┴vЯ├`Йнxб┼uЮ┬lХ╣gР┤pЩ╜_Им\Ей\ЕйoШ╝rЫ┐rЫ┐yв╞xб┼yв╞WАдgР┤oШ╝uЮ┬zг╟^ЗлuЮ┬rЫ┐xб┼nЧ╗{д╚aКоqЪ╛]ЖкoШ╝_ИмdН▒ZГзvЯ├_Имyв╞sЬ└bЛпqЪ╛YВжqЪ╛mЦ║tЭ┴ZГзyв╞bЛпeО▓rЫ┐uЮ┬zг╟sЬ└tЭ┴eО▓_ИмhС╡oШ╝ZГзnЧ╗yв╞mЦ║fП│]ЖкZГзqЪ╛qЪ╛iТ╢[ДиaКоcМ░]ЖкZГзjУ╖iТ╢nЧ╗\ЕйXБе[ДиtЭ┴zг╟hС╡_ИмpЩ╜XБеhС╡[Ди[ДиfП│yв╞xб┼wа─YВжaКо\ЕйmЦ║rЫ┐cМ░pЩ╜eО▓yв╞_ИмjУ╖cМ░^ЗлWАдkФ╕fП│kФ╕zг╟uЮ┬eО▓jУ╖tЭ┴{д╚mЦ║{д╚yв╞lХ╣yв╞uЮ┬iТ╢`Йнwа─\Ейwа─hС╡kФ╕[ДиqЪ╛lХ╣sЬ└qЪ╛XБеZГз{д╚dН▒ZГзWАдhС╡_ИмnЧ╗aКоaКо]ЖкlХ╣wа─cМ░nЧ╗ZГз_ИмqЪ╛gР┤bЛпtЭ┴oШ╝xб┼qЪ╛hС╡\ЕйfП│]Жкzг╟fП│rЫ┐cМ░@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@WАдlХ╣nЧ╗wа─oШ╝mЦ║sЬ└YВжkФ╕mЦ║]ЖкoШ╝YВжdН▒mЦ║{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@pЩ╜wа─zг╟^ЗлdН▒^ЗлhС╡fП│[ДиrЫ┐ZГз_ИмtЭ┴WАдjУ╖vЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@hС╡uЮ┬{д╚yв╞XБеWАдgР┤_ИмqЪ╛cМ░qЪ╛dН▒vЯ├gР┤YВжmЦ║@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@`ЙнaКоhС╡lХ╣qЪ╛ZГзwа─tЭ┴lХ╣pЩ╜qЪ╛ZГз`ЙнdН▒_ИмvЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@{д╚mЦ║pЩ╜rЫ┐hС╡mЦ║cМ░aКоsЬ└eО▓iТ╢vЯ├xб┼jУ╖XБе\Ей@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@^ЗлkФ╕uЮ┬]Жк{д╚xб┼jУ╖XБеqЪ╛yв╞[Ди_ИмuЮ┬pЩ╜jУ╖jУ╖@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@tЭ┴rЫ┐xб┼_ИмoШ╝sЬ└cМ░mЦ║XБе_ИмaКоyв╞lХ╣oШ╝^Зл@@@@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@@@@wа─YВжnЧ╗oШ╝vЯ├qЪ╛eО▓@@@@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеааеа░╡░░╡░аеааеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppupАЕАРХРаеааеааеааеа░╡░░╡░аеааеааеааеаРХРАЕАpuppuppuppuppuppuppuppuppupАЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРаеааеааеааеааеа░╡░░╡░аеааеааеааеааеаРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеа░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеааеааеааеааеааеааеааеааеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРаеааеааеааеааеааеа░╡░░╡░аеааеааеааеааеааеаРХРРХРРХРРХРРХРРХРРХРРХРРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕАРХРаеааеааеааеааеа░╡░░╡░аеааеааеааеааеаРХРАЕААЕААЕААЕААЕААЕААЕААЕААЕАpuppuppuppuppuppuppuppuppupАЕАРХРаеааеааеааеа░╡░░╡░аеааеааеааеаРХРАЕАpuppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеааеа░╡░░╡░аеааеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@_ИмlХ╣[ДиeО▓^Зл`Йн\Ей@@@@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@@@@YВжrЫ┐vЯ├uЮ┬^Зл{д╚fП│qЪ╛yв╞[Ди_ИмuЮ┬pЩ╜jУ╖jУ╖@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@tЭ┴rЫ┐xб┼_ИмoШ╝sЬ└cМ░mЦ║gР┤uЮ┬fП│hС╡rЫ┐[ДиsЬ└zг╟@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@ZГзrЫ┐xб┼mЦ║tЭ┴gР┤XБеlХ╣bЛпiТ╢yв╞oШ╝xб┼[ДиnЧ╗_Им@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@yв╞yв╞XБеZГзuЮ┬gР┤uЮ┬wа─tЭ┴`Йнxб┼ZГзnЧ╗tЭ┴xб┼dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@bЛпxб┼jУ╖bЛпsЬ└]ЖкtЭ┴tЭ┴oШ╝wа─wа─nЧ╗{д╚XБеsЬ└uЮ┬@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@eО▓yв╞iТ╢ZГз]ЖкmЦ║YВжyв╞xб┼\ЕйYВжyв╞aКоkФ╕yв╞dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@rЫ┐WАдqЪ╛fП│eО▓mЦ║pЩ╜kФ╕qЪ╛wа─aКоmЦ║qЪ╛yв╞]ЖкvЯ├@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@uЮ┬gР┤mЦ║WАдpЩ╜lХ╣sЬ└kФ╕_ИмvЯ├\ЕйkФ╕eО▓xб┼^Зл^ЗлkФ╕\ЕйtЭ┴rЫ┐xб┼_ИмoШ╝sЬ└cМ░mЦ║{д╚mЦ║pЩ╜rЫ┐hС╡mЦ║cМ░aКоcМ░ZГзlХ╣WАдcМ░cМ░iТ╢dН▒uЮ┬vЯ├^Зл`ЙнkФ╕yв╞wа─[ДиpЩ╜dН▒zг╟ZГзzг╟\ЕйmЦ║YВжoШ╝wа─bЛпcМ░dН▒vЯ├wа─nЧ╗YВжlХ╣pЩ╜_Им[ДиgР┤sЬ└bЛпtЭ┴[ДиjУ╖rЫ┐[ДиrЫ┐yв╞rЫ┐vЯ├sЬ└eО▓iТ╢vЯ├xб┼XБе\ЕйqЪ╛]Жк[ДиiТ╢rЫ┐gР┤kФ╕sЬ└qЪ╛qЪ╛YВж{д╚kФ╕wа─bЛп_Им`ЙнXБеcМ░hС╡hС╡lХ╣iТ╢ vЯ├BAADCDDEEFFFFFFEEECDDAAA^Зл cМ░gР┤hС╡WАдWАдqЪ╛lХ╣rЫ┐gР┤kФ╕\ЕйcМ░WАдXБеzг╟gР┤pЩ╜ HGHJKKMMMOOONNOMMMKJJGHH pЩ╜lХ╣xб┼xб┼^Зл[ДиdН▒qЪ╛mЦ║_ИмaКоnЧ╗jУ╖cМ░cМ░ @@@@@@ STSWWVYYYYYXWVWTSS @@@@@@ iТ╢XБеXБеvЯ├eО▓wа─\Ейyв╞]Жк{д╚vЯ├gР┤qЪ╛ @@@```@@@@@@ ^^^bbbdeeedeabb^^] @@@@@@```@@@ bЛпbЛпxб┼eО▓cМ░tЭ┴tЭ┴_Им{д╚rЫ┐WАдiТ╢ @@@@@@```@@@ mmnqpqqqqmmn @@@```@@@@@@ oШ╝oШ╝YВжdН▒mЦ║{д╚wа─uЮ┬oШ╝XБе\Ей{д╚^Зл @@@@@@@@@@@@ yyz}}}}}}zyz @@@@@@@@@@@@ vЯ├uЮ┬uЮ┬YВжjУ╖sЬ└iТ╢rЫ┐oШ╝kФ╕[ДиpЩ╜aКоAABHHH @@@@@@ КЙЙЙКЙ @@@@@@ HHGAAAsЬ└sЬ└hС╡yв╞xб┼zг╟gР┤vЯ├fП│fП│wа─mЦ║DCCKJKSTT^^^ ХХХХХХ ^^^STTJKKCDDiТ╢iТ╢dН▒_ИмlХ╣[ДиuЮ┬vЯ├^ЗлpЩ╜xб┼wа─EEEMMMVVVbbammmyyz yyynnnbbbWWWMMMEEEaКоaКоeО▓XБе`ЙнlХ╣lХ╣jУ╖rЫ┐rЫ┐kФ╕rЫ┐FFFOOOYYYdedqpp}}}КЙКХФХ ХХХККЙ}}~qqpeddYYYONNFFFtЭ┴tЭ┴hС╡uЮ┬dН▒eО▓fП│qЪ╛[ДиnЧ╗WАдuЮ┬FFFNOOYYYdeeqqp~}}ККЙХХХ ХФХЙКЙ}}}qpqeddXXYNOOFFFkФ╕jУ╖]ЖкmЦ║`ЙнsЬ└`ЙнlХ╣bЛпyв╞sЬ└lХ╣EDEMMMVWVbabmmmzzy yzznnmbbbWWWMMMEEElХ╣kФ╕_Им_ИмgР┤zг╟]ЖкkФ╕`ЙнiТ╢vЯ├gР┤CCCJJKTTS^]^ ФХФХХХ ^^^SSSKKJDDCWАдlХ╣YВжtЭ┴iТ╢qЪ╛WАд\ЕйfП│eО▓uЮ┬fП│ABAGGG @@@@@@ ЙЙККЙЙ @@@@@@ GHHAABfП│WАдoШ╝bЛпhС╡]Жкyв╞cМ░\ЕйeО▓`Йнyв╞vЯ├ @@@@@@@@@@@@ zyz}}}}}}yyy @@@@@@@@@@@@ ^ЗлmЦ║fП│wа─uЮ┬zг╟xб┼jУ╖fП│gР┤yв╞qЪ╛vЯ├ @@@@@@```@@@ nmmqqqqqqnmn @@@```@@@@@@ bЛпmЦ║jУ╖nЧ╗pЩ╜iТ╢dН▒mЦ║{д╚aКоkФ╕rЫ┐ @@@```@@@@@@ ^]^abbdeedddbbb^^^ @@@@@@```@@@ oШ╝bЛпYВжpЩ╜[Ди^Зл]ЖкeО▓aКоiТ╢ZГзyв╞iТ╢ @@@@@@ TTSVWVYYYYXYVWWTSS @@@@@@ cМ░nЧ╗oШ╝aКоjУ╖kФ╕YВжrЫ┐[ДиvЯ├wа─[ДиrЫ┐lХ╣pЩ╜ HHGJJKMMMNNOONNMMMJKKGHG pЩ╜gР┤mЦ║nЧ╗qЪ╛vЯ├fП│hС╡ZГз\ЕйsЬ└aКоfП│eО▓hС╡gР┤@@@ @@@ABBCCCEEEFFFFFFEEECCCBBA@@@ @@@lХ╣hС╡oШ╝mЦ║rЫ┐`Йн{д╚sЬ└vЯ├XБеWАд\ЕйaКо[ДиsЬ└iТ╢@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@YВж{д╚iТ╢oШ╝zг╟WАдoШ╝bЛпvЯ├tЭ┴pЩ╜^ЗлaКо[ДиsЬ└iТ╢@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@YВж{д╚iТ╢rЫ┐kФ╕YВжoШ╝yв╞kФ╕\ЕйaКо^ЗлbЛпvЯ├uЮ┬`Йн@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@eО▓iТ╢bЛпsЬ└^Зл^ЗлlХ╣cМ░pЩ╜kФ╕wа─qЪ╛eО▓ZГз_ИмXБе@@@@@@@@@@@@@@@@@@@@@░╡░░╡░@@@@@@@@@@@@@@@@@@@@@qЪ╛cМ░zг╟jУ╖WАдqЪ╛fП│^ЗлbЛпhС╡]Жк\ЕйWАдeО▓mЦ║dН▒@@@@@@@@@@@@РХРаеааеа░╡░░╡░аеааеаРХР@@@@@@@@@@@@lХ╣jУ╖\ЕйmЦ║uЮ┬fП│vЯ├jУ╖lХ╣fП│pЩ╜jУ╖nЧ╗uЮ┬kФ╕{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@rЫ┐fП│vЯ├_Им^ЗлaКоvЯ├lХ╣_Им{д╚rЫ┐WАдiТ╢nЧ╗_ИмfП│@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@mЦ║]ЖкoШ╝YВжdН▒mЦ║{д╚aКоpЩ╜XБеfП│rЫ┐xб┼nЧ╗wа─dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@qЪ╛vЯ├cМ░`ЙнpЩ╜oШ╝]Жк[Ди^Зл]ЖкmЦ║^ЗлqЪ╛uЮ┬^ЗлkФ╕@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@lХ╣]ЖкcМ░aКоoШ╝pЩ╜\ЕйgР┤_ИмvЯ├\ЕйkФ╕eО▓uЮ┬^ЗлkФ╕@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@lХ╣]ЖкcМ░aКоlХ╣WАдcМ░cМ░^ЗлcМ░{д╚cМ░aКоxб┼^ЗлkФ╕@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@lХ╣aКоcМ░ZГзzг╟nЧ╗wа─eО▓^ЗлkФ╕uЮ┬]Жк{д╚]ЖкjУ╖bЛп@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@]ЖкhС╡fП│mЦ║sЬ└mЦ║hС╡uЮ┬]ЖкgР┤{д╚jУ╖uЮ┬xб┼jУ╖XБе@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@\ЕйWАдgР┤]ЖкlХ╣_ИмkФ╕uЮ┬aКоvЯ├YВжuЮ┬mЦ║\ЕйeО▓fП│@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@dН▒ZГзeО▓^ЗлhС╡sЬ└YВж]Жк`Йнzг╟[ДиsЬ└dН▒jУ╖pЩ╜wа─@@@@@@@@@@@@РХРаеааеа░╡░░╡░аеааеаРХР@@@@@@@@@@@@{д╚YВжbЛпdН▒vЯ├lХ╣WАдxб┼nЧ╗gР┤rЫ┐\ЕйeО▓ZГзeО▓^Зл@@@@@@@@@@@@@@@@@@@@@░╡░░╡░@@@@@@@@@@@@@@@@@@@@@tЭ┴jУ╖ZГзvЯ├rЫ┐\ЕйgР┤cМ░rЫ┐pЩ╜wа─pЩ╜`Йнzг╟]ЖкjУ╖@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@qЪ╛\ЕйgР┤\Ей\ЕйpЩ╜wа─kФ╕sЬ└uЮ┬xб┼hС╡hС╡qЪ╛bЛп\Ей@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@oШ╝kФ╕qЪ╛jУ╖pЩ╜ZГзeО▓tЭ┴aКоlХ╣bЛпrЫ┐fП│jУ╖aКоrЫ┐@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@aКоhС╡ZГзsЬ└zг╟_ИмuЮ┬gР┤]ЖкjУ╖pЩ╜[Диyв╞eО▓hС╡gР┤AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgР┤hС╡zг╟]Жк[Ди^Зл_ИмaКо{д╚dН▒rЫ┐{д╚`ЙнrЫ┐lХ╣pЩ╜AAAAAAAAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAAAAAAAApЩ╜lХ╣dН▒^ЗлgР┤xб┼YВжmЦ║ZГзpЩ╜vЯ├]ЖкgР┤yв╞iТ╢^ЗлAAAAAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAAAA^ЗлiТ╢vЯ├uЮ┬\Ей_ИмhС╡gР┤kФ╕lХ╣uЮ┬hС╡yв╞rЫ┐]Жк`ЙнAAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`Йн]Жкzг╟nЧ╗sЬ└`Йн_ИмkФ╕YВжtЭ┴jУ╖cМ░tЭ┴vЯ├hС╡AAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAhС╡_ИмrЫ┐lХ╣WАдaКоkФ╕^ЗлeО▓xб┼hС╡WАдyв╞pХ╡AAAGHHQQQ[\\ffgqppyyy~~~АААА~~~yyyqppffg[\\QQQGHHAAApХ╡hС╡gР┤ZГзmЦ║jУ╖^ЗлgР┤qЪ╛cМ░zг╟jУ╖fП│AAACCDLLMXWWdddppp|||ЖЖЖМННППППППМННЖЖЖ|||pppdddXWWLLMCCDAAAhС╡^ЗлfП│ZГзaКоkФ╕cМ░{д╚qЪ╛{д╚yв╞gР┤AAAFFEPPP]]\jjjxxxЖЖЖСССЪЩЪЭЭЭЭЭЭЪЩЪСССЖЖЖxxxjjj]]\PPPFFEAAA]ЖкeО▓{д╚iТ╢aКоWАдcМ░pЩ╜qЪ╛tЭ┴^ЗлlХ╣AAAHHGSRR```ono}~~НМНЪЪЩдгдиииииидгдЪЪЩНМН}~~ono```SRRHHGAAAxб┼kФ╕fП│\ЕйtЭ┴zг╟[Ди^ЗлgР┤ZГз\ЕйuЮ┬@@@IIHTSSbaapppААПППЭЭЬизи░░░░░░изиЭЭЬПППААpppbaaTSSIIH@@@aКоmЦ║bЛпrЫ┐mЦ║rЫ┐pЩ╜YВжqЪ╛hС╡aКоrЫ┐@@@IIHTSSbaapppААПППЭЭЬизи░░░░░░изиЭЭЬПППААpppbaaTSSIIH@@@WАдZГзhС╡lХ╣XБе^ЗлsЬ└sЬ└eО▓cМ░uЮ┬wа─AAAHHGSRR```ono}~~НМНЪЪЩдгдиииииидгдЪЪЩНМН}~~ono```SRRHHGAAAYВжaКо{д╚hС╡wа─ZГзnЧ╗qЪ╛aКо{д╚qЪ╛mЦ║AAAFFEPPP]]\jjjxxxЖЖЖСССЪЩЪЭЭЭЭЭЭЪЩЪСССЖЖЖxxxjjj]]\PPPFFEAAAiТ╢qЪ╛`Йнyв╞bЛпuЮ┬lХ╣mЦ║XБеpЩ╜[ДиaКоAAACCDLLMXWWdddppp|||ЖЖЖМННППППППМННЖЖЖ|||pppdddXWWLLMCCDAAA{д╚^ЗлWАдjУ╖vЯ├ZГзhС╡`ЙнXБеfП│^Зл{д╚pХ╡AAAGHHQQQ[\\ffgqppyyy~~~АААА~~~yyyqppffg[\\QQQGHHAAApХ╡_ИмlХ╣WАдXБеzг╟gР┤sЬ└{д╚]Жк_Им`ЙнiТ╢hС╡AAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAhС╡^ЗлcМ░XБе^ЗлnЧ╗jУ╖[ДиeО▓^Злxб┼lХ╣qЪ╛]Жк`ЙнAAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`Йн]ЖкiТ╢eО▓oШ╝eО▓`Йн{д╚oШ╝fП│pЩ╜dН▒XБеcМ░iТ╢^ЗлlХ╣AAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAlХ╣^ЗлiТ╢WАд\ЕйlХ╣tЭ┴XБеoШ╝_Им{д╚dН▒^Зл\Ейzг╟lХ╣pЩ╜]Жк^ЗлAAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAA^Зл]ЖкpЩ╜lХ╣mЦ║YВж]Жкxб┼vЯ├qЪ╛uЮ┬gР┤^Злxб┼yв╞hС╡hС╡gР┤cМ░]Жк]Жк[ЯAAAAAAAAA@@@@@@AAAAAAAAA[Я]Жк]ЖкcМ░gР┤hС╡_Им`ЙнlХ╣yв╞xб┼fП│^ЗлhС╡fП│bЛпYВжpЩ╜[Ди^ЗлeО▓fП│sЬ└ZГзdН▒dН▒xб┼ZГз_ИмlХ╣]ЖкnЧ╗kФ╕aКо\Ей]ЖкXБе]Жк]ЖкiТ╢jУ╖pЩ╜dН▒gР┤tЭ┴YВжvЯ├zг╟xб┼tЭ┴mЦ║_ИмaКоnЧ╗jУ╖cМ░cМ░vЯ├[ДиeО▓oШ╝jУ╖rЫ┐ZГзeО▓[ДиeО▓bЛпgР┤tЭ┴WАдaКоhС╡bЛпYВжcМ░{д╚XБеyв╞dН▒qЪ╛uЮ┬gР┤lХ╣fП│tЭ┴mЦ║YВжdН▒]Жк`ЙнgР┤ZГзkФ╕rЫ┐{д╚lХ╣dН▒wа─WАдeО▓rЫ┐hС╡gР┤rЫ┐zг╟mЦ║kФ╕hС╡wа─zг╟uЮ┬iТ╢sЬ└`ЙнeО▓dН▒aКо\ЕйaКо^Зл^ЗлqЪ╛[Диyв╞YВжvЯ├mЦ║qЪ╛^Зл\Ейwа─pЩ╜zг╟kФ╕tЭ┴sЬ└kФ╕{д╚cМ░kФ╕pЩ╜jУ╖lХ╣XБеeО▓wа─gР┤]Жкxб┼kФ╕rЫ┐jУ╖eО▓`Йн{д╚aКоpЩ╜wа─WАдYВжkФ╕lХ╣\ЕйlХ╣`Йн^Злyв╞\ЕйWАдkФ╕hС╡bЛпdН▒]ЖкZГзzг╟dН▒cМ░hС╡wа─pЩ╜]ЖкoШ╝vЯ├eО▓ZГзXБеgР┤zг╟_Имwа─cМ░{д╚hС╡jУ╖dН▒ZГзyв╞eО▓ZГзcМ░`ЙнeО▓^Злyв╞{д╚ZГзcМ░pЩ╜^Зл[ДиlХ╣uЮ┬sЬ└pЩ╜zг╟gР┤_ИмpЩ╜yв╞wа─_ИмeО▓qЪ╛tЭ┴{д╚^ЗлeО▓{д╚XБеyв╞dН▒qЪ╛uЮ┬gР┤YВжgР┤qЪ╛fП│yв╞zг╟uЮ┬ZГзpЩ╜WАдzг╟qЪ╛kФ╕eО▓iТ╢vЯ├nЧ╗kФ╕rЫ┐WАдYВжuЮ┬_ИмZГзsЬ└WАдpЩ╜nЧ╗{д╚bЛпwа─dН▒{д╚xб┼yв╞_Имwа─xб┼bЛп\ЕйWАдxб┼YВжiТ╢kФ╕dН▒_ИмfП│fП│`ЙнsЬ└oШ╝tЭ┴iТ╢^Зл]ЖкaКо{д╚mЦ║YВжqЪ╛mЦ║lХ╣hС╡xб┼kФ╕rЫ┐jУ╖eО▓`Йн{д╚aКоpЩ╜wа─WАдYВжkФ╕lХ╣\ЕйlХ╣`Йн^Злyв╞\ЕйWАдkФ╕hС╡fП│tЭ┴qЪ╛tЭ┴^ЗлXБеuЮ┬vЯ├cМ░zг╟iТ╢uЮ┬kФ╕aКоvЯ├zг╟rЫ┐lХ╣aКоqЪ╛uЮ┬pЩ╜iТ╢qЪ╛qЪ╛tЭ┴zг╟fП│rЫ┐iТ╢XБеcМ░sЬ└WАдmЦ║zг╟`Йнyв╞aКоxб┼vЯ├zг╟qЪ╛hС╡gР┤uЮ┬iТ╢bЛп^Зл[ДиqЪ╛{д╚tЭ┴rЫ┐YВжuЮ┬cМ░eО▓cМ░eО▓WАд`ЙнYВжsЬ└wа─WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║{д╚tЭ┴uЮ┬kФ╕bЛп`ЙнYВжYВжqЪ╛WАдdН▒eО▓ZГз\ЕйXБе_ИмfП│lХ╣tЭ┴]Жк_ИмaКоzг╟pЩ╜xб┼`ЙнtЭ┴nЧ╗kФ╕rЫ┐mЦ║wа─mЦ║oШ╝{д╚cМ░yв╞vЯ├zг╟{д╚cМ░eО▓fП│vЯ├hС╡_ИмkФ╕pЩ╜aКо[ДиsЬ└fП│uЮ┬_Им`ЙнnЧ╗sЬ└`ЙнsЬ└uЮ┬rЫ┐WАдdН▒eО▓vЯ├lХ╣\Ейzг╟xб┼zг╟mЦ║{д╚`ЙнiТ╢rЫ┐vЯ├mЦ║uЮ┬aКоmЦ║cМ░kФ╕fП│tЭ┴^Зл[ДиrЫ┐sЬ└hС╡wа─WАдyв╞YВжrЫ┐jУ╖eО▓qЪ╛{д╚tЭ┴rЫ┐YВжuЮ┬cМ░eО▓cМ░eО▓WАд`ЙнYВжsЬ└wа─WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║ZГзZГзZГз[Диxб┼yв╞jУ╖ZГз_ИмZГзjУ╖iТ╢[ДиZГзyв╞hС╡^ЗлlХ╣{д╚jУ╖\ЕйZГзtЭ┴ZГзfП│{д╚nЧ╗\ЕйoШ╝qЪ╛xб┼jУ╖hС╡iТ╢oШ╝xб┼iТ╢fП│bЛпxб┼sЬ└oШ╝cМ░eО▓sЬ└WАд^ЗлsЬ└\Ей_Им[ДиjУ╖qЪ╛pЩ╜wа─^Зл^ЗлpЩ╜oШ╝zг╟fП│]ЖкjУ╖ZГзXБеzг╟vЯ├iТ╢]ЖкfП│uЮ┬dН▒cМ░vЯ├iТ╢kФ╕nЧ╗fП│[ДиjУ╖{д╚fП│dН▒WАдbЛпWАдZГз\Ейzг╟eО▓sЬ└`ЙнcМ░vЯ├jУ╖`Йн_Имzг╟jУ╖]ЖкeО▓xб┼vЯ├zг╟eО▓nЧ╗eО▓nЧ╗\Ей^Зл[ДиqЪ╛fП│jУ╖bЛп\ЕйpЩ╜mЦ║jУ╖kФ╕rЫ┐lХ╣aКо\ЕйgР┤hС╡fП│xб┼pЩ╜_ИмrЫ┐eО▓cМ░kФ╕sЬ└cМ░nЧ╗tЭ┴^Зл[ДиrЫ┐sЬ└hС╡wа─WАдyв╞YВжrЫ┐jУ╖eО▓rЫ┐gР┤hС╡xб┼jУ╖bЛпgР┤bЛпzг╟uЮ┬]ЖкaКоYВж^ЗлpЩ╜aКоiТ╢`ЙнqЪ╛oШ╝eО▓qЪ╛\ЕйgР┤bЛпZГзgР┤oШ╝bЛпdН▒]ЖкZГзzг╟dН▒cМ░hС╡wа─pЩ╜]ЖкoШ╝vЯ├eО▓ZГзXБеgР┤zг╟_Имwа─cМ░{д╚hС╡zг╟kФ╕jУ╖oШ╝sЬ└_Имyв╞gР┤wа─zг╟hС╡tЭ┴mЦ║pЩ╜lХ╣qЪ╛iТ╢pЩ╜mЦ║aКоtЭ┴{д╚WАдuЮ┬bЛпkФ╕sЬ└sЬ└sЬ└bЛпfП│jУ╖kФ╕pЩ╜]ЖкtЭ┴{д╚tЭ┴_Имzг╟YВж`ЙнlХ╣[ДиqЪ╛ZГзwа─]ЖкdН▒[ДиjУ╖ZГзvЯ├tЭ┴cМ░lХ╣sЬ└gР┤\ЕйrЫ┐fП│oШ╝iТ╢_ИмuЮ┬vЯ├bЛп\ЕйgР┤eО▓tЭ┴YВжgР┤aКоzг╟mЦ║tЭ┴dН▒fП│yв╞oШ╝`Йн`ЙнlХ╣zг╟{д╚yв╞\ЕйrЫ┐YВж{д╚aКоqЪ╛zг╟XБе]ЖкfП│\ЕйpЩ╜pЩ╜pЩ╜wа─ZГзwа─hС╡cМ░rЫ┐mЦ║vЯ├bЛпaКоzг╟rЫ┐_ИмkФ╕jУ╖jУ╖mЦ║nЧ╗eО▓cМ░iТ╢ZГзyв╞xб┼tЭ┴wа─lХ╣gР┤oШ╝lХ╣aКоtЭ┴\Ей\ЕйhС╡pЩ╜]Жкzг╟uЮ┬vЯ├bЛп\ЕйgР┤eО▓tЭ┴YВжgР┤aКоzг╟mЦ║tЭ┴dН▒fП│yв╞oШ╝`Йн`ЙнlХ╣zг╟kФ╕wа─pЩ╜kФ╕pЩ╜uЮ┬yв╞cМ░zг╟fП│nЧ╗qЪ╛pЩ╜mЦ║qЪ╛{д╚`Йн_ИмpЩ╜^Зл\ЕйhС╡eО▓eО▓ZГзpЩ╜dН▒fП│]Жкwа─sЬ└oШ╝cМ░pЩ╜^Зл[ДиlХ╣uЮ┬sЬ└pЩ╜zг╟gР┤_ИмpЩ╜yв╞wа─_ИмeО▓qЪ╛tЭ┴{д╚^ЗлeО▓{д╚XБеyв╞dН▒qЪ╛uЮ┬gР┤lХ╣fП│tЭ┴mЦ║vЯ├yв╞hС╡hС╡{д╚kФ╕zг╟iТ╢uЮ┬kФ╕aКоvЯ├zг╟rЫ┐lХ╣aКоqЪ╛uЮ┬pЩ╜iТ╢qЪ╛qЪ╛tЭ┴zг╟fП│rЫ┐iТ╢XБеcМ░sЬ└WАдmЦ║ZГзpЩ╜XБеiТ╢_ИмnЧ╗vЯ├aКоkФ╕cМ░YВжqЪ╛yв╞dН▒\Ей_Им[Диzг╟jУ╖tЭ┴oШ╝wа─mЦ║oШ╝{д╚cМ░yв╞vЯ├zг╟{д╚cМ░eО▓WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║ZГзZГзZГз[Диxб┼yв╞jУ╖ZГз_ИмtЭ┴wа─pЩ╜pЩ╜eО▓bЛпrЫ┐lХ╣`ЙнbЛп^Зл_ИмiТ╢sЬ└hС╡mЦ║gР┤_ИмeО▓{д╚XБеuЮ┬vЯ├jУ╖aКоXБе]ЖкuЮ┬mЦ║gР┤rЫ┐eО▓eО▓_Им\Ейzг╟nЧ╗YВжfП│tЭ┴lХ╣nЧ╗qЪ╛]ЖкqЪ╛XБеjУ╖hС╡mЦ║cМ░cМ░xб┼`ЙнgР┤cМ░ZГзwа─gР┤sЬ└bЛпhС╡zг╟WАдtЭ┴bЛпdН▒rЫ┐aКоiТ╢oШ╝_Им[ДиtЭ┴zг╟cМ░iТ╢YВжdН▒iТ╢mЦ║zг╟lХ╣`Йнyв╞YВжvЯ├eО▓ZГзxб┼lХ╣kФ╕fП│eО▓tЭ┴{д╚fП│_ИмeО▓nЧ╗vЯ├wа─aКо]Жк^Злxб┼gР┤hС╡gР┤]Жкyв╞eО▓_ИмvЯ├\ЕйkФ╕eО▓xб┼^Зл^ЗлkФ╕\ЕйtЭ┴rЫ┐xб┼_ИмoШ╗sЬ└cМ░mЦ║{д╚mЦ║pЩ╜rЫ┐hС╡mЦ║cМ░aКоcМ░ZГзlХ╣WАдcМ░cМ░iТ╢dН▒uЮ┬vЯ├^Зл`ЙнkФ╕yв╞wа─[ДиkС│dН▒\xР>>GGGUUU999(((POPTSSSTSSTSMMMhС╡rЫ┐`ЙнiТ╢XБеXБеvЯ├eО▓wа─\Ейyв╞]Жк{д╚vЯ├gР┤qЪ╛XБеcМ░nЧ╗MMMSTS'''&&&===GGG***!!!abb^^]^^^STTSTSMMMnЧ║WАдPsС[ДиbЛпxб┼eО▓cМ░tЭ┴tЭ┴_Им{д╚rЫ┐WАдiТ╢WАдXБеMMMSTSSTT^^^///DDD:::///kklmmm^^^^^^STTEEEFFF9L\$&(CWh^ЗлYВжdН▒mЦ║{д╚wа─uЮ┬oШ╝XБе\Ей{д╚nЧ╗MMMSTSSTT^^^^^^AAA!!!777'''222zyzzzymmmVVV^^^)))*** `ЙнYВжjУ╖sЬ└iТ╢rЫ┐oШ╝kФ╕[ДиpЩ╜aКоAABHHHSTT^^^^^^mmmzzy555 ---КЙЙЖЕЕzzy<<<'''(((888GGG777cЗзhС╡yв╞xб┼zг╟gР┤vЯ├fП│fП│wа─mЦ║DCCKJKSTT^^^mmmzzyКЙЙrrr))) ]]]ХХХfeeEEE"""555888[[[RRROOONdwdН▒_ИмlХ╣[ДиuЮ┬vЯ├^ЗлpЩ╜xб┼wа─EEE@@@VVV\\[mmmyyzКЙЙХХХkkk ZZZ000333KKK@@@XXX???JJJ%%%%'*eО▓XБе`ЙнlХ╣lХ╣jУ╖rЫ┐rЫ┐[{ЧTnЕ###(((###9:9'''WWW+++kjk+++ """888%%%333///...).2hС╡uЮ┬dН▒eО▓fП│qЪ╛[ДиnЧ╗*29---***999&&&999&&& +++zyz888UUU-,-333***$$$&&&TqКPjВ]ЖкmЦ║`ЙнsЬ└`ЙнlХ╣bЛпyв╞7BL!!!DDDBBB[[[BBBIII:::%%%ggg''' RRRХХХКЙЙvwwnnmVVVWWW>>>EEElХ╣kФ╕_Им_ИмgР┤zг╟]ЖкkФ╕`ЙнiТ╢cГЯFFFYYYWWW>>>222&&&NNNVVVХХХvvv !!!```КЙЙzzymmm^^^SSSKKJDDCWАдlХ╣YВжtЭ┴iТ╢qЪ╛WАд\ЕйfП│eО▓uЮ┬000GGG222---+++444zzyДГГКЙЙ444zzymmm^^^^^^STSGHHAABfП│WАдoШ╝bЛпhС╡]Жкyв╞cМ░\ЕйeО▓`Йн%'(((("""$%%ZZZTTTmmmzzyzyzKKK###999$$$777^^^^^^STTSTSMMMnЧ╗mЦ║fП│wа─uЮ┬zг╟xб┼jУ╖fП│gР┤yв╞qЪ╛ZuН%'(@Xl@@@BCBSTT^^^^^^mmmnmm333333CCC888[[[STTSTSMMMXБеnЧ╗bЛпmЦ║jУ╖nЧ╗pЩ╜iТ╢dН▒mЦ║{д╚aКоkФ╕rЫ┐gО░[Ди@@@MMMSTSSTT^^^^]^abb)))$$$HHH???+++###QRQMMM@@@XБеWАдoШ╝bЛпYВжpЩ╜[Ди^Зл]ЖкeО▓aКоiТ╢ZГзyв╞`ЙнrЫ┐@@@@@@MMMSTSSTSTTSVWV111666LLLPPPDDD>>>@@@@@@cМ░XБеnЧ╗oШ╝aКоjУ╖kФ╕YВжrЫ┐[ДиvЯ├wа─[ДиrЫ┐^ЗлjУ╖@@@@@@@@@MMMHHGJJKMMM 000>>>ccc@@@$$$5?G@@@@@@jУ╖[ДиmЦ║nЧ╗qЪ╛vЯ├fП│hС╡ZГз\ЕйsЬ└aКоfП│eО▓hС╡[Ди@@@@@@@@@@@@ABBCCCEEE)))###EEEFFF777!!! !!@@@@@@^ЗлhС╡oШ╝mЦ║rЫ┐`Йн{д╚sЬ└vЯ├XБеWАд\ЕйaКо[ДиsЬ└iТ╢@@@@@@@@@@@@@@@@@@@@@555###"""!!!***...@@@@@@YВж{д╚iТ╢oШ╝zг╟WАдoШ╝bЛпvЯ├tЭ┴pЩ╜^ЗлaКо[ДиsЬ└iТ╢@@@@@@@@@@@@@@@@@@@@@>>>'''...+++888@@@===@@@@@@YВж{д╚iТ╢rЫ┐kФ╕YВжoШ╝yв╞kФ╕\ЕйaКо^ЗлbЛпvЯ├uЮ┬`Йн@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@eО▓iТ╢bЛпsЬ└^Зл^ЗлlХ╣cМ░pЩ╜kФ╕wа─qЪ╛eО▓ZГз_ИмXБе@@@@@@@@@@@@@@@@@@@@@░╡░░╡░@@@@@@@@@@@@@@@@@@@@@qЪ╛cМ░zг╟jУ╖WАдqЪ╛fП│^ЗлbЛпhС╡]Жк\ЕйWАдeО▓mЦ║dН▒@@@@@@@@@@@@РХРаеааеа░╡░░╡░аеааеаРХР@@@@@@@@@@@@lХ╣jУ╖\ЕйmЦ║uЮ┬fП│vЯ├jУ╖lХ╣fП│pЩ╜jУ╖nЧ╗uЮ┬kФ╕{д╚@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@rЫ┐fП│vЯ├_Им^ЗлaКоvЯ├lХ╣_Им{д╚rЫ┐WАдiТ╢nЧ╗_ИмfП│@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@mЦ║]ЖкoШ╝YВжdН▒mЦ║{д╚aКоpЩ╜XБеfП│rЫ┐xб┼nЧ╗wа─dН▒@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@qЪ╛vЯ├cМ░`ЙнpЩ╜oШ╝]Жк[Ди^Зл]ЖкmЦ║^ЗлqЪ╛uЮ┬^ЗлkФ╕@@@@@@pupАЕАРХРаеааеа░╡░░╡░аеааеаРХРАЕАpup@@@@@@lХ╣]ЖкcМ░aКоoШ╝pЩ╜\ЕйgР┤`ЙнsЬ└oШ╝tЭ┴iТ╢^Зл]ЖкaКо{д╚mЦ║YВжqЪ╛mЦ║lХ╣hС╡kФ╕ZГз\ЕйhС╡nЧ╗bЛпbЛпyв╞YВжiТ╢]ЖкoШ╝tЭ┴xб┼kФ╕`ЙнrЫ┐wа─uЮ┬WАдnЧ╗]Жкwа─hС╡dН▒iТ╢oШ╝nЧ╗aКоnЧ╗yв╞yв╞xб┼fП│uЮ┬lХ╣]ЖкYВжpЩ╜_ИмkФ╕pЩ╜jУ╖lХ╣XБеeО▓wа─gР┤]ЖкpЩ╜cМ░WАдiТ╢dН▒fП│nЧ╗WАдyв╞bЛпZГзnЧ╗rЫ┐XБеtЭ┴gР┤{д╚bЛп\ЕйlХ╣rЫ┐\ЕйbЛп\Ейwа─ZГзmЦ║oШ╝tЭ┴oШ╝^Злwа─cМ░wа─{д╚iТ╢ZГзoШ╝zг╟cМ░qЪ╛hС╡dН▒tЭ┴kФ╕`ЙнdН▒wа─gР┤yв╞{д╚wа─oШ╝lХ╣zг╟YВжtЭ┴oШ╝WАдnЧ╗vЯ├XБеzг╟vЯ├uЮ┬qЪ╛yв╞_ИмjУ╖WАдkФ╕YВжmЦ║vЯ├jУ╖dН▒nЧ╗eО▓WАдqЪ╛nЧ╗xб┼qЪ╛dН▒pЩ╜cМ░WАдiТ╢dН▒fП│nЧ╗WАдyв╞bЛпZГзnЧ╗ZГзtЭ┴^ЗлWАдhС╡^ЗлkФ╕nЧ╗lХ╣]Жк{д╚lХ╣zг╟tЭ┴yв╞cМ░{д╚`Йн`ЙнjУ╖gР┤jУ╖`ЙнkФ╕vЯ├[ДиYВжxб┼bЛпhС╡XБеqЪ╛_ИмcМ░_ИмfП│sЬ└uЮ┬jУ╖^Зл[Ди]ЖкoШ╝yв╞fП│iТ╢rЫ┐_ИмqЪ╛YВжlХ╣pЩ╜tЭ┴vЯ├hС╡nЧ╗{д╚xб┼gР┤yв╞mЦ║XБеWАдcМ░kФ╕YВжeО▓yв╞dН▒cМ░YВжqЪ╛]ЖкgР┤]ЖкZГзiТ╢bЛпqЪ╛YВжcМ░kФ╕ZГз^ЗлlХ╣sЬ└zг╟mЦ║cМ░jУ╖`Йн\Ейyв╞^ЗлoШ╝XБеyв╞^Зл_ИмhС╡yв╞iТ╢oШ╝eО▓\ЕйlХ╣^ЗлsЬ└hС╡sЬ└aКоsЬ└eО▓bЛпmЦ║dН▒nЧ╗YВжnЧ╗oШ╝`ЙнiТ╢cМ░\Ейwа─uЮ┬WАдnЧ╗zг╟rЫ┐_ИмkФ╕jУ╖jУ╖mЦ║nЧ╗eО▓cМ░iТ╢ZГзyв╞xб┼tЭ┴wа─lХ╣dН▒]Жк`ЙнWАд]Жк`ЙнdН▒eО▓wа─iТ╢oШ╝]ЖкcМ░YВжaКоYВжXБеlХ╣mЦ║^ЗлuЮ┬kФ╕sЬ└gР┤gР┤hС╡[ДиfП│iТ╢lХ╣wа─{д╚aКоeО▓hС╡zг╟xб┼cМ░fП│sЬ└XБеuЮ┬qЪ╛yв╞_ИмjУ╖WАдaКоmЦ║cМ░kФ╕fП│tЭ┴^Зл[ДиrЫ┐sЬ└hС╡wа─WАдyв╞YВжrЫ┐jУ╖eО▓rЫ┐gР┤hС╡xб┼jУ╖bЛпgР┤bЛпzг╟uЮ┬]ЖкaКоYВж^Зл]ЖкbЛпlХ╣{д╚XБе\ЕйvЯ├pЩ╜pЩ╜_Им`ЙнXБеkФ╕tЭ┴zг╟oШ╝vЯ├mЦ║gР┤_Имzг╟hС╡qЪ╛gР┤nЧ╗kФ╕YВж^ЗлoШ╝^ЗлYВжsЬ└lХ╣sЬ└kФ╕\ЕйiТ╢_Имzг╟jУ╖vЯ├wа─mЦ║wа─vЯ├wа─\Ей[ДиWАдeО▓sЬ└XБеuЮ┬ZГзdН▒qЪ╛wа─WАдzг╟WАдkФ╕fП│`Йнzг╟WАдjУ╖gР┤dН▒hС╡tЭ┴uЮ┬gР┤ZГзuЮ┬kФ╕iТ╢dН▒hС╡rЫ┐{д╚xб┼hС╡aКо_ИмkФ╕yв╞]ЖкnЧ╗tЭ┴cМ░aКоeО▓nЧ╗YВжqЪ╛{д╚`ЙнiТ╢[ДиqЪ╛aКоrЫ┐dН▒ZГзoШ╝qЪ╛nЧ╗tЭ┴ZГзnЧ╗fП│fП│tЭ┴wа─YВжuЮ┬zг╟aКоxб┼fП│hС╡hС╡gР┤]ЖкkФ╕hС╡tЭ┴hС╡_ИмWАдbЛпhС╡hС╡YВжcМ░dН▒iТ╢^Зл]ЖкnЧ╗oШ╝pЩ╜zг╟`ЙнYВжzг╟sЬ└lХ╣vЯ├bЛпnЧ╗XБеlХ╣sЬ└WАдkФ╕sЬ└ZГзzг╟bЛпnЧ╗WАдeО▓rЫ┐tЭ┴]ЖкZГзzг╟qЪ╛hС╡gР┤uЮ┬iТ╢bЛп^Зл[ДиqЪ╛{д╚tЭ┴rЫ┐YВжuЮ┬cМ░eО▓cМ░eО▓WАд`ЙнYВжsЬ└wа─WАдyв╞iТ╢[Ди^ЗлvЯ├\ЕйWАдYВжiТ╢ZГз]ЖкuЮ┬qЪ╛aКоpЩ╜bЛпXБеmЦ║uЮ┬ZГз{д╚tЭ┴nЧ╗dН▒cМ░jУ╖[ДиvЯ├xб┼aКоrЫ┐rЫ┐WАдoШ╝wа─kФ╕uЮ┬eО▓rЫ┐[ДиtЭ┴]ЖкZГзrЫ┐zг╟iТ╢zг╟oШ╝`Йн[ДиdН▒bЛпpЩ╜lХ╣jУ╖]Жк]Жкxб┼xб┼pЩ╜vЯ├oШ╝`ЙнnЧ╗uЮ┬bЛпkФ╕sЬ└sЬ└sЬ└bЛпfП│jУ╖fП│aКоgР┤iТ╢rЫ┐bЛпtЭ┴jУ╖bЛпzг╟WАдvЯ├gР┤cМ░sЬ└^ЗлcМ░YВжmЦ║eО▓]ЖкeО▓zг╟mЦ║YВжuЮ┬WАдYВжYВжbЛпbЛпnЧ╗ZГзcМ░sЬ└xб┼tЭ┴zг╟jУ╖\Ей_ИмYВжnЧ╗nЧ╗mЦ║vЯ├yв╞hС╡hС╡{д╚kФ╕zг╟iТ╢uЮ┬kФ╕[ДиYВжxб┼bЛпhС╡XБеqЪ╛mЦ║dН▒\Ей[Ди\Ейxб┼tЭ┴ZГзvЯ├kФ╕sЬ└fП│mЦ║[ДиrЫ┐^ЗлeО▓ZГзfП│xб┼bЛп[Диzг╟hС╡oШ╝iТ╢wа─iТ╢vЯ├nЧ╗cМ░pЩ╜XБеWАдcМ░kФ╕YВжeО▓yв╞dН▒cМ░YВжqЪ╛]ЖкgР┤]ЖкZГзiТ╢bЛпqЪ╛YВжcМ░kФ╕ZГз^ЗлlХ╣sЬ└dН▒xб┼^Злyв╞{д╚ZГзcМ░pЩ╜^Зл[ДиlХ╣uЮ┬sЬ└pЩ╜zг╟gР┤_ИмpЩ╜yв╞wа─_ИмeО▓qЪ╛tЭ┴{д╚^ЗлeО▓{д╚XБеyв╞dН▒qЪ╛`Йн\ЕйYВжbЛпgР┤WАдpЩ╜gР┤XБеbЛпuЮ┬dН▒]ЖкYВж^ЗлmЦ║uЮ┬aКоuЮ┬fП│oШ╝WАдZГзjУ╖iТ╢[ДиZГзyв╞hС╡^ЗлlХ╣{д╚`ЙнeО▓jУ╖_Им^Злxб┼[ДиuЮ┬nЧ╗wа─]ЖкrЫ┐ZГз`Йнzг╟vЯ├jУ╖`Йнzг╟dН▒tЭ┴]ЖкdН▒xб┼ZГзgР┤jУ╖qЪ╛`Йн_ИмiТ╢rЫ┐xб┼kФ╕rЫ┐jУ╖eО▓`Йн{д╚aКоpЩ╜wа─WАдYВжkФ╕lХ╣\ЕйlХ╣`Йн^Злyв╞\ЕйWАдkФ╕hС╡fП│tЭ┴qЪ╛tЭ┴^ЗлXБеuЮ┬vЯ├cМ░xб┼wа─hС╡WАдxб┼oШ╝pЩ╜{д╚\ЕйtЭ┴vЯ├lХ╣\Ейzг╟xб┼zг╟mЦ║{д╚`ЙнiТ╢rЫ┐vЯ├mЦ║uЮ┬aКоmЦ║cМ░kФ╕fП│tЭ┴^Зл[ДиtЭ┴nЧ╗zг╟YВжqЪ╛gР┤{д╚aКо[ДиuЮ┬XБеZГзgР┤]ЖкuЮ┬cМ░YВжgР┤fП│kФ╕iТ╢fП│bЛпbЛп{д╚{д╚iТ╢iТ╢pЩ╜nЧ╗`ЙнXБеiТ╢bЛп\ЕйnЧ╗{д╚bЛпwа─aКоcМ░nЧ╗mЦ║[ДиjУ╖uЮ┬mЦ║WАдxб┼xб┼yв╞dН▒oШ╝tЭ┴bЛпjУ╖hС╡yв╞uЮ┬]ЖкnЧ╗xб┼tЭ┴yв╞hС╡wа─zг╟uЮ┬iТ╢sЬ└`ЙнeО▓dН▒aКо\ЕйaКо^Зл^ЗлqЪ╛[Диyв╞YВжvЯ├mЦ║qЪ╛^Зл\Ейwа─pЩ╜zг╟kФ╕tЭ┴sЬ└kФ╕{д╚cМ░kФ╕pЩ╜jУ╖lХ╣XБеeО▓wа─gР┤]Жкxб┼kФ╕rЫ┐jУ╖eО▓`Йн{д╚aКоpЩ╜wа─WАдYВжkФ╕lХ╣\ЕйlХ╣`Йн^Злyв╞\ЕйWАдkФ╕hС╡bЛпdН▒]ЖкZГзzг╟dН▒cМ░hС╡wа─pЩ╜]ЖкoШ╝vЯ├eО▓ZГзXБеgР┤zг╟_Имwа─cМ░{д╚hС╡jУ╖dН▒ZГзyв╞eО▓ZГзcМ░`ЙнeО▓^Злyв╞{д╚ZГзcМ░pЩ╜^Зл[ДиlХ╣uЮ┬sЬ└pЩ╜zг╟gР┤_ИмpЩ╜yв╞wа─_ИмeО▓qЪ╛tЭ┴{д╚^ЗлeО▓{д╚XБеyв╞dН▒qЪ╛uЮ┬gР┤YВжgР┤qЪ╛fП│yв╞zг╟uЮ┬ZГзpЩ╜WАдzг╟qЪ╛kФ╕eО▓iТ╢vЯ├nЧ╗kФ╕rЫ┐WАдYВжuЮ┬_ИмZГзsЬ└WАдpЩ╜nЧ╗{д╚bЛпwа─dН▒{д╚xб┼yв╞_Имwа─xб┼bЛп\ЕйWАдxб┼YВжiТ╢kФ╕dН▒_ИмfП│fП│`ЙнsЬ└oШ╝tЭ┴iТ╢^Зл]ЖкaКо{д╚mЦ║YВжqЪ╛mЦ║lХ╣hС╡xб┼kФ╕rЫ┐jУ╖eО▓`Йн{д╚aКоpЩ╜wа─WАдYВжkФ╕lХ╣\ЕйlХ╣`Йн^Злyв╞\ЕйWАдkФ╕hС╡fП│tЭ┴qЪ╛tЭ┴^ЗлXБеuЮ┬vЯ├cМ░zг╟iТ╢uЮ┬kФ╕aКоvЯ├zг╟rЫ┐lХ╣aКоqЪ╛uЮ┬pЩ╜iТ╢qЪ╛qЪ╛tЭ┴zг╟fП│rЫ┐iТ╢XБеcМ░sЬ└WАдmЦ║zг╟`Йнyв╞aКоxб┼vЯ├zг╟qЪ╛hС╡gР┤uЮ┬iТ╢bЛп^Зл[ДиqЪ╛{д╚tЭ┴rЫ┐YВжuЮ┬cМ░eО▓cМ░eО▓WАд`ЙнYВжsЬ└wа─WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║{д╚tЭ┴uЮ┬kФ╕bЛп`ЙнYВжYВжqЪ╛WАдdН▒eО▓ZГз\ЕйXБе_ИмfП│lХ╣tЭ┴]Жк_ИмaКоzг╟pЩ╜xб┼`ЙнtЭ┴nЧ╗kФ╕rЫ┐mЦ║wа─mЦ║oШ╝{д╚cМ░yв╞vЯ├zг╟{д╚cМ░eО▓fП│vЯ├hС╡_ИмkФ╕pЩ╜aКо[ДиsЬ└fП│uЮ┬_Им`ЙнnЧ╗sЬ└`ЙнsЬ└uЮ┬rЫ┐WАдdН▒eО▓vЯ├lХ╣\Ейzг╟xб┼zг╟mЦ║{д╚`ЙнiТ╢rЫ┐vЯ├mЦ║uЮ┬aКоmЦ║cМ░kФ╕fП│tЭ┴^Зл[ДиrЫ┐sЬ└hС╡wа─WАдyв╞YВжrЫ┐jУ╖eО▓qЪ╛{д╚tЭ┴rЫ┐YВжuЮ┬cМ░eО▓cМ░eО▓WАд`ЙнYВжsЬ└wа─WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║ZГзZГзZГз[Диxб┼yв╞jУ╖ZГз_ИмZГзjУ╖iТ╢[ДиZГзyв╞hС╡^ЗлlХ╣{д╚jУ╖\ЕйZГзtЭ┴ZГзfП│{д╚nЧ╗\ЕйoШ╝qЪ╛xб┼jУ╖hС╡iТ╢oШ╝xб┼iТ╢fП│bЛпxб┼sЬ└oШ╝cМ░eО▓sЬ└WАд^ЗлsЬ└\Ей_Им[ДиjУ╖qЪ╛pЩ╜wа─^Зл^ЗлpЩ╜oШ╝zг╟fП│]ЖкjУ╖ZГзXБеzг╟vЯ├iТ╢]ЖкfП│uЮ┬dН▒cМ░vЯ├iТ╢kФ╕nЧ╗fП│[ДиjУ╖{д╚fП│dН▒WАдbЛпWАдZГз\Ейzг╟eО▓sЬ└`ЙнcМ░vЯ├jУ╖`Йн_Имzг╟jУ╖]ЖкeО▓xб┼vЯ├zг╟eО▓nЧ╗eО▓nЧ╗\Ей^Зл[ДиqЪ╛fП│jУ╖bЛп\ЕйpЩ╜mЦ║jУ╖kФ╕rЫ┐lХ╣aКо\ЕйgР┤hС╡fП│xб┼pЩ╜_ИмrЫ┐eО▓cМ░kФ╕sЬ└cМ░nЧ╗tЭ┴^Зл[ДиrЫ┐sЬ└hС╡wа─WАдyв╞YВжrЫ┐jУ╖eО▓rЫ┐gР┤hС╡xб┼jУ╖bЛпgР┤bЛпzг╟uЮ┬]ЖкaКоYВж^ЗлpЩ╜aКоiТ╢`ЙнqЪ╛oШ╝eО▓qЪ╛\ЕйgР┤bЛпZГзgР┤oШ╝bЛпdН▒]ЖкZГзzг╟dН▒cМ░hС╡wа─pЩ╜]ЖкoШ╝vЯ├eО▓ZГзXБеgР┤zг╟_Имwа─cМ░{д╚hС╡zг╟kФ╕jУ╖oШ╝sЬ└_Имyв╞gР┤wа─zг╟hС╡tЭ┴mЦ║pЩ╜lХ╣qЪ╛iТ╢pЩ╜mЦ║aКоtЭ┴{д╚WАдuЮ┬bЛпkФ╕sЬ└sЬ└sЬ└bЛпfП│jУ╖kФ╕pЩ╜]ЖкtЭ┴{д╚tЭ┴_Имzг╟YВж`ЙнlХ╣[ДиqЪ╛ZГзwа─]ЖкdН▒[ДиjУ╖ZГзvЯ├tЭ┴cМ░lХ╣sЬ└gР┤\ЕйrЫ┐fП│oШ╝iТ╢_ИмuЮ┬vЯ├bЛп\ЕйgР┤eО▓tЭ┴YВжgР┤aКоzг╟mЦ║tЭ┴dН▒fП│yв╞oШ╝`Йн`ЙнlХ╣zг╟{д╚yв╞\ЕйrЫ┐YВж{д╚aКоqЪ╛zг╟XБе]ЖкfП│\ЕйpЩ╜pЩ╜pЩ╜wа─ZГзwа─hС╡cМ░rЫ┐mЦ║vЯ├bЛпaКоzг╟rЫ┐_ИмkФ╕jУ╖jУ╖mЦ║nЧ╗eО▓cМ░iТ╢ZГзyв╞xб┼tЭ┴wа─lХ╣gР┤oШ╝lХ╣aКоtЭ┴\Ей\ЕйhС╡pЩ╜]Жкzг╟uЮ┬vЯ├bЛп\ЕйgР┤eО▓tЭ┴YВжgР┤aКоzг╟mЦ║tЭ┴dН▒fП│yв╞oШ╝`Йн`ЙнlХ╣zг╟kФ╕wа─pЩ╜kФ╕pЩ╜uЮ┬yв╞cМ░zг╟fП│nЧ╗qЪ╛pЩ╜mЦ║qЪ╛{д╚`Йн_ИмpЩ╜^Зл\ЕйhС╡eО▓eО▓ZГзpЩ╜dН▒fП│]Жкwа─sЬ└oШ╝cМ░pЩ╜^Зл[ДиlХ╣uЮ┬sЬ└pЩ╜zг╟gР┤_ИмpЩ╜yв╞wа─_ИмeО▓qЪ╛tЭ┴{д╚^ЗлeО▓{д╚XБеyв╞dН▒qЪ╛uЮ┬gР┤lХ╣fП│tЭ┴mЦ║vЯ├yв╞hС╡hС╡{д╚kФ╕zг╟iТ╢uЮ┬kФ╕aКоvЯ├zг╟rЫ┐lХ╣aКоqЪ╛uЮ┬pЩ╜iТ╢qЪ╛qЪ╛tЭ┴zг╟fП│rЫ┐iТ╢XБеcМ░sЬ└WАдmЦ║ZГзpЩ╜XБеiТ╢_ИмnЧ╗vЯ├aКоkФ╕cМ░YВжqЪ╛yв╞dН▒\Ей_Им[Диzг╟jУ╖tЭ┴oШ╝wа─mЦ║oШ╝{д╚cМ░yв╞vЯ├zг╟{д╚cМ░eО▓WАдyв╞mЦ║gР┤tЭ┴yв╞zг╟mЦ║ZГзZГзZГз[Диxб┼yв╞jУ╖ZГз_ИмtЭ┴wа─pЩ╜pЩ╜eО▓bЛпrЫ┐lХ╣`ЙнbЛп^Зл_ИмiТ╢sЬ└hС╡mЦ║gР┤_ИмeО▓{д╚XБеuЮ┬vЯ├jУ╖aКоXБе]ЖкuЮ┬mЦ║gР┤rЫ┐eО▓eО▓_Им\Ейzг╟nЧ╗YВжfП│tЭ┴lХ╣nЧ╗qЪ╛]ЖкqЪ╛XБеjУ╖hС╡mЦ║cМ░cМ░xб┼`ЙнgР┤cМ░ZГзwа─gР┤sЬ└bЛпhС╡zг╟WАдtЭ┴bЛпdН▒rЫ┐aКоiТ╢oШ╝_Им[ДиtЭ┴zг╟cМ░iТ╢YВжdН▒iТ╢mЦ║zг╟lХ╣`Йнyв╞YВжvЯ├eО▓ZГзxб┼lХ╣kФ╕fП│eО▓tЭ┴{д╚fП│_ИмeО▓nЧ╗vЯ├wа─aКо]Жк^Злxб┼gР┤hС╡gР┤]Жкyв╞eО▓ \ No newline at end of file diff --git a/programs/games/tetris/trunk/tetris.asm b/programs/games/tetris/trunk/tetris.asm index 60ff61e3df..5115784242 100644 --- a/programs/games/tetris/trunk/tetris.asm +++ b/programs/games/tetris/trunk/tetris.asm @@ -220,7 +220,7 @@ button: ; button jmp still end_program: - mov eax,-1 ; close this program + or eax,-1 ; close this program int 0x40 go_new_game: diff --git a/programs/media/ac97 mp3/trunk/PROC32.INC b/programs/media/ac97snd/trunk/PROC32.INC similarity index 100% rename from programs/media/ac97 mp3/trunk/PROC32.INC rename to programs/media/ac97snd/trunk/PROC32.INC diff --git a/programs/media/ac97 mp3/trunk/ac97.sln b/programs/media/ac97snd/trunk/ac97.sln similarity index 100% rename from programs/media/ac97 mp3/trunk/ac97.sln rename to programs/media/ac97snd/trunk/ac97.sln diff --git a/programs/media/ac97 mp3/trunk/ac97wav.c b/programs/media/ac97snd/trunk/ac97wav.c similarity index 100% rename from programs/media/ac97 mp3/trunk/ac97wav.c rename to programs/media/ac97snd/trunk/ac97wav.c diff --git a/programs/media/ac97 mp3/trunk/ac97wav.h b/programs/media/ac97snd/trunk/ac97wav.h similarity index 100% rename from programs/media/ac97 mp3/trunk/ac97wav.h rename to programs/media/ac97snd/trunk/ac97wav.h diff --git a/programs/media/ac97 mp3/trunk/crt.c b/programs/media/ac97snd/trunk/crt.c similarity index 100% rename from programs/media/ac97 mp3/trunk/crt.c rename to programs/media/ac97snd/trunk/crt.c diff --git a/programs/media/ac97 mp3/trunk/crt.h b/programs/media/ac97snd/trunk/crt.h similarity index 100% rename from programs/media/ac97 mp3/trunk/crt.h rename to programs/media/ac97snd/trunk/crt.h diff --git a/programs/media/ac97 mp3/trunk/k_lib.asm b/programs/media/ac97snd/trunk/k_lib.asm similarity index 100% rename from programs/media/ac97 mp3/trunk/k_lib.asm rename to programs/media/ac97snd/trunk/k_lib.asm diff --git a/programs/media/ac97 mp3/trunk/kolibri.h b/programs/media/ac97snd/trunk/kolibri.h similarity index 100% rename from programs/media/ac97 mp3/trunk/kolibri.h rename to programs/media/ac97snd/trunk/kolibri.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/PROC32.INC b/programs/media/ac97snd/trunk/mp3dec/PROC32.INC similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/PROC32.INC rename to programs/media/ac97snd/trunk/mp3dec/PROC32.INC diff --git a/programs/media/ac97 mp3/trunk/mp3dec/bstream.c b/programs/media/ac97snd/trunk/mp3dec/bstream.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/bstream.c rename to programs/media/ac97snd/trunk/mp3dec/bstream.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/bstream.h b/programs/media/ac97snd/trunk/mp3dec/bstream.h similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/bstream.h rename to programs/media/ac97snd/trunk/mp3dec/bstream.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/e_pow.c b/programs/media/ac97snd/trunk/mp3dec/e_pow.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/e_pow.c rename to programs/media/ac97snd/trunk/mp3dec/e_pow.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/fdct.c b/programs/media/ac97snd/trunk/mp3dec/fdct.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/fdct.c rename to programs/media/ac97snd/trunk/mp3dec/fdct.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/imdct.c b/programs/media/ac97snd/trunk/mp3dec/imdct.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/imdct.c rename to programs/media/ac97snd/trunk/mp3dec/imdct.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l1dec.c b/programs/media/ac97snd/trunk/mp3dec/l1dec.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l1dec.c rename to programs/media/ac97snd/trunk/mp3dec/l1dec.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l1init.c b/programs/media/ac97snd/trunk/mp3dec/l1init.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l1init.c rename to programs/media/ac97snd/trunk/mp3dec/l1init.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l2dec.c b/programs/media/ac97snd/trunk/mp3dec/l2dec.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l2dec.c rename to programs/media/ac97snd/trunk/mp3dec/l2dec.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l2init.c b/programs/media/ac97snd/trunk/mp3dec/l2init.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l2init.c rename to programs/media/ac97snd/trunk/mp3dec/l2init.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3alias.c b/programs/media/ac97snd/trunk/mp3dec/l3alias.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3alias.c rename to programs/media/ac97snd/trunk/mp3dec/l3alias.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3dec.c b/programs/media/ac97snd/trunk/mp3dec/l3dec.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3dec.c rename to programs/media/ac97snd/trunk/mp3dec/l3dec.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3huff.c b/programs/media/ac97snd/trunk/mp3dec/l3huff.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3huff.c rename to programs/media/ac97snd/trunk/mp3dec/l3huff.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3huff.h b/programs/media/ac97snd/trunk/mp3dec/l3huff.h similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3huff.h rename to programs/media/ac97snd/trunk/mp3dec/l3huff.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3hybrid.c b/programs/media/ac97snd/trunk/mp3dec/l3hybrid.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3hybrid.c rename to programs/media/ac97snd/trunk/mp3dec/l3hybrid.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3init.c b/programs/media/ac97snd/trunk/mp3dec/l3init.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3init.c rename to programs/media/ac97snd/trunk/mp3dec/l3init.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3msis.c b/programs/media/ac97snd/trunk/mp3dec/l3msis.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3msis.c rename to programs/media/ac97snd/trunk/mp3dec/l3msis.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3quant.c b/programs/media/ac97snd/trunk/mp3dec/l3quant.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3quant.c rename to programs/media/ac97snd/trunk/mp3dec/l3quant.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3sf.c b/programs/media/ac97snd/trunk/mp3dec/l3sf.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3sf.c rename to programs/media/ac97snd/trunk/mp3dec/l3sf.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/l3side.c b/programs/media/ac97snd/trunk/mp3dec/l3side.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/l3side.c rename to programs/media/ac97snd/trunk/mp3dec/l3side.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/layer3.h b/programs/media/ac97snd/trunk/mp3dec/layer3.h similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/layer3.h rename to programs/media/ac97snd/trunk/mp3dec/layer3.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/math_private.h b/programs/media/ac97snd/trunk/mp3dec/math_private.h similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/math_private.h rename to programs/media/ac97snd/trunk/mp3dec/math_private.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.c b/programs/media/ac97snd/trunk/mp3dec/mp3dec.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/mp3dec.c rename to programs/media/ac97snd/trunk/mp3dec/mp3dec.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.h b/programs/media/ac97snd/trunk/mp3dec/mp3dec.h similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/mp3dec.h rename to programs/media/ac97snd/trunk/mp3dec/mp3dec.h diff --git a/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.vcproj b/programs/media/ac97snd/trunk/mp3dec/mp3dec.vcproj similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/mp3dec.vcproj rename to programs/media/ac97snd/trunk/mp3dec/mp3dec.vcproj diff --git a/programs/media/ac97 mp3/trunk/mp3dec/pow.asm b/programs/media/ac97snd/trunk/mp3dec/pow.asm similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/pow.asm rename to programs/media/ac97snd/trunk/mp3dec/pow.asm diff --git a/programs/media/ac97 mp3/trunk/mp3dec/sbt.c b/programs/media/ac97snd/trunk/mp3dec/sbt.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/sbt.c rename to programs/media/ac97snd/trunk/mp3dec/sbt.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/sbtb.c b/programs/media/ac97snd/trunk/mp3dec/sbtb.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/sbtb.c rename to programs/media/ac97snd/trunk/mp3dec/sbtb.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/window.c b/programs/media/ac97snd/trunk/mp3dec/window.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/window.c rename to programs/media/ac97snd/trunk/mp3dec/window.c diff --git a/programs/media/ac97 mp3/trunk/mp3dec/windowb.c b/programs/media/ac97snd/trunk/mp3dec/windowb.c similarity index 100% rename from programs/media/ac97 mp3/trunk/mp3dec/windowb.c rename to programs/media/ac97snd/trunk/mp3dec/windowb.c diff --git a/programs/media/ac97wav/trunk/ac97.inc b/programs/media/ac97wav/trunk/ac97.inc deleted file mode 100644 index a23ea9fde5..0000000000 --- a/programs/media/ac97wav/trunk/ac97.inc +++ /dev/null @@ -1,288 +0,0 @@ -; Vendor ids -INTEL_VID = 0x8086 -SIS_VID = 0x1039 -NVIDIA_VID = 0x10DE -AMD_VID = 0x1022 - -; Device ids -ICH_DID = 0x2415 -ICH0_DID = 0x2425 -ICH2_DID = 0x2445 -ICH3_DID = 0x2485 -ICH4_DID = 0x24C5 -ICH5_DID = 0x24D5 -MX440_DID = 0x7195 -SI7012_DID = 0x7012 -NFORCE_DID = 0x01B1 -NFORCE2_DID = 0x006A -AMD8111_DID = 0x764D -AMD768_DID = 0x7445 - -NAMBAR_REG = 0x10 ; native audio mixer BAR - NAM_SIZE = 256 ; 256 bytes required. - -NABMBAR_REG = 0x14 ; native audio bus mastering BAR - NABM_SIZE = 64 ; 64 bytes - -IRQ_REG = 0x3c ; IRQ holder for PCI -INT_REG = 0x3d ; INT pin -ICH4_CFG_REG = 0x41 ; ICH4 config register - - -; BUS master registers, accessed via NABMBAR+offset - -; ICH supports 3 different types of register sets for three types of things -; it can do, thus: -; -; PCM in (for recording) aka PI -; PCM out (for playback) aka PO -; MIC in (for recording) aka MC - -PI_BDBAR_REG = 0 ; PCM in buffer descriptor BAR -PO_BDBAR_REG = 10h ; PCM out buffer descriptor BAR -MC_BDBAR_REG = 20h ; MIC in buffer descriptor BAR - -; each buffer descriptor BAR holds a pointer which has entries to the buffer -; contents of the .WAV file we're going to play. Each entry is 8 bytes long -; (more on that later) and can contain 32 entries total, so each BAR is -; 256 bytes in length, thus: - -BDL_SIZE = 32*8 ; Buffer Descriptor List size -INDEX_MASK = 31 ; indexes must be 0-31 - - - -PI_CIV_REG = 4 ; PCM in current Index value (RO) -PO_CIV_REG = 14h ; PCM out current Index value (RO) -MC_CIV_REG = 24h ; MIC in current Index value (RO) - -;8bit read only -; each current index value is simply a pointer showing us which buffer -; (0-31) the codec is currently processing. Once this counter hits 31, it -; wraps back to 0. -; this can be handy to know, as once it hits 31, we're almost out of data to -; play back or room to record! - - -PI_LVI_REG = 5 ; PCM in Last Valid Index -PO_LVI_REG = 15h ; PCM out Last Valid Index -MC_LVI_REG = 25h ; MIC in Last Valid Index -;8bit read/write -; The Last Valid Index is a number (0-31) to let the codec know what buffer -; number to stop on after processing. It could be very nasty to play audio -; from buffers that aren't filled with the audio we want to play. - - -PI_SR_REG = 6 ; PCM in Status register -PO_SR_REG = 16h ; PCM out Status register -MC_SR_REG = 26h ; MIC in Status register -;16bit read/write -; status registers. Bitfields follow: - -FIFO_ERR = BIT4 ; FIFO Over/Underrun W1TC. - -BCIS = BIT3 ; buffer completion interrupt status. - ; Set whenever the last sample in ANY - ; buffer is finished. Bit is only - ; set when the Interrupt on Complete - ; (BIT4 of control reg) is set. - -LVBCI = BIT2 ; Set whenever the codec has processed - ; the last buffer in the buffer list. - ; Will fire an interrupt if IOC bit is - ; set. Probably set after the last - ; sample in the last buffer is - ; processed. W1TC - - -CELV = BIT1 ; Current buffer == last valid. - ; Bit is RO and remains set until LVI is - ; cleared. Probably set up the start - ; of processing for the last buffer. - - -DCH = BIT0 ; DMA controller halted. - ; set whenever audio stream is stopped - ; or something else goes wrong. - - -PI_PICB_REG = 8 ; PCM in position in current buffer(RO) -PO_PICB_REG = 18h ; PCM out position in current buffer(RO) -MC_PICB_REG = 28h ; MIC in position in current buffer (RO) -;16bit read only -; position in current buffer regs show the number of dwords left to be -; processed in the current buffer. -; - - - - - -PI_PIV_REG = 0ah ; PCM in Prefected index value -PO_PIV_REG = 1ah ; PCM out Prefected index value -MC_PIV_REG = 2ah ; MIC in Prefected index value -;8bit, read only -; Prefetched index value register. -; tells which buffer number (0-31) has be prefetched. I'd imagine this -; value follows the current index value fairly closely. (CIV+1) -; - - -PI_CR_REG = 0bh ; PCM in Control Register -PO_CR_REG = 1bh ; PCM out Control Register -MC_CR_REG = 2bh ; MIC in Control Register -; 8bit -; Control register *MUST* only be accessed as an 8bit value. -; Control register. See bitfields below. -; - - -IOCE = BIT4 ; interrupt on complete enable. - ; set this bit if you want an intrtpt - ; to fire whenever LVBCI is set. -FEIFE = BIT3 ; set if you want an interrupt to fire - ; whenever there is a FIFO (over or - ; under) error. -LVBIE = BIT2 ; last valid buffer interrupt enable. - ; set if you want an interrupt to fire - ; whenever the completion of the last - ; valid buffer. -RR = BIT1 ; reset registers. Nukes all regs - ; except bits 4:2 of this register. - ; Only set this bit if BIT 0 is 0 -RPBM = BIT0 ; Run/Pause - ; set this bit to start the codec! - - -GLOB_CNT_REG = 2ch ; Global control register -SEC_RES_EN = BIT5 ; secondary codec resume event - ; interrupt enable. Not used here. -PRI_RES_EN = BIT4 ; ditto for primary. Not used here. -ACLINK_OFF = BIT3 ; Turn off the AC97 link -ACWARM_RESET = BIT2 ; Awaken the AC97 link from sleep. - ; registers preserved, bit self clears -ACCOLD_RESET = BIT1 ; Reset everything in the AC97 and - ; reset all registers. Not self clearin -;g - -GPIIE = BIT0 ; GPI Interrupt enable. - ; set if you want an interrupt to - ; fire upon ANY of the bits in the - ; GPI (general pursose inputs?) not used -;. - -GLOB_STS_REG = 30h ; Global Status register (RO) - -MD3 = BIT17 ; modem powerdown status (yawn) -AD3 = BIT16 ; Audio powerdown status (yawn) -RD_COMPLETE_STS = BIT15 ; Codec read timed out. 0=normal -BIT3SLOT12 = BIT14 ; shadowed status of bit 3 in slot 12 -BIT2SLOT12 = BIT13 ; shadowed status of bit 2 in slot 12 -BIT1SLOT12 = BIT12 ; shadowed status of bit 1 in slot 12 -SEC_RESUME_STS = BIT11 ; secondary codec has resumed (and irqed) -PRI_RESUME_STS = BIT10 ; primary codec has resumed (and irqed) -SEC_CODEC_RDY = BIT9 ; secondary codec is ready for action -PRI_CODEC_RDY = BIT8 ; Primary codec is ready for action - ; software must check these bits before - ; starting the codec! -MIC_IN_IRQ = BIT7 ; MIC in caused an interrupt -PCM_OUT_IRQ = BIT6 ; One of the PCM out channels IRQed -PCM_IN_IRQ = BIT5 ; One of the PCM in channels IRQed -MODEM_OUT_IRQ = BIT2 ; modem out channel IRQed -MODEM_IN_IRQ = BIT1 ; modem in channel IRQed -GPI_STS_CHANGE = BIT0 ; set whenever GPI's have changed. - ; BIT0 of slot 12 also reflects this. - - -ACC_SEMA_REG = 34h ; Codec write semiphore register -CODEC_BUSY = BIT0 ; codec register I/O is happening - ; self clearing - - - -; -; Buffer Descriptors List -; As stated earlier, each buffer descriptor list is a set of (up to) 32 -; descriptors, each 8 bytes in length. Bytes 0-3 of a descriptor entry point -; to a chunk of memory to either play from or record to. Bytes 4-7 of an -; entry describe various control things detailed below. -; -; Buffer pointers must always be aligned on a Dword boundry. -; -; - -IOC = BIT31 ; Fire an interrupt whenever this - ; buffer is complete. - -BUP = BIT30 ; Buffer Underrun Policy. - ; if this buffer is the last buffer - ; in a playback, fill the remaining - ; samples with 0 (silence) or not. - ; It's a good idea to set this to 1 - ; for the last buffer in playback, - ; otherwise you're likely to get a lot - ; of noise at the end of the sound. - -; -; Bits 15:0 contain the length of the buffer, in number of samples, which -; are 16 bits each, coupled in left and right pairs, or 32bits each. -; Luckily for us, that's the same format as .wav files. -; -; A value of FFFF is 65536 samples. Running at 44.1Khz, that's just about -; 1.5 seconds of sample time. FFFF * 32bits is 1FFFFh bytes or 128k of data. -; -; A value of 0 in these bits means play no samples. -; - - -;***************************************************************************** -;* AC97 Codec registers include (based on Jeff Leyda AC97 wav player SDK :-) -;***************************************************************************** - -; Not all codecs are created =al. Refer to the spec for your specific codec. -; All registers are 16bits wide. Access to codec registers over the AC97 link -; is defined by the OEM. -; Secondary codec's are accessed by ORing in BIT7 of all register accesses. - - -; each codec/mixer register is 16bits - -CODEC_RESET_REG = 00 ; reset codec -CODEC_MASTER_VOL_REG = 02 ; master volume -CODEC_HP_VOL_REG = 04 ; headphone volume -CODEC_MASTER_MONO_VOL_REG = 06 ; master mono volume -CODEC_MASTER_TONE_REG = 08 ; master tone (R+L) -CODEC_PCBEEP_VOL_REG = 0ah ; PC beep volume -CODEC_PHONE_VOL_REG = 0ch ; phone volume -CODEC_MIC_VOL_REG = 0eh ; MIC volume -CODEC_LINE_IN_VOL_REG = 10h ; line input volume -CODEC_CD_VOL_REG = 12h ; CD volume -CODEC_VID_VOL_REG = 14h ; video volume -CODEC_AUX_VOL_REG = 16h ; aux volume -CODEC_PCM_OUT_REG = 18h ; PCM output volume -CODEC_RECORD_SELECT_REG = 1ah ; record select input -CODEC_RECORD_VOL_REG = 1ch ; record volume -CODEC_RECORD_MIC_VOL_REG = 1eh ; record mic volume -CODEC_GP_REG = 20h ; general purpose -CODEC_3D_CONTROL_REG = 22h ; 3D control -; 24h is reserved -CODEC_POWER_CTRL_REG = 26h ; powerdown control -CODEC_EXT_AUDIO_REG = 28h ; extended audio -CODEC_EXT_AUDIO_CTRL_REG = 2ah ; extended audio control -CODEC_PCM_FRONT_DACRATE_REG = 2ch ; PCM out sample rate -CODEC_PCM_SURND_DACRATE_REG = 2eh ; surround sound sample rate -CODEC_PCM_LFE_DACRATE_REG = 30h ; LFE sample rate -CODEC_LR_ADCRATE_REG = 32h ; PCM in sample rate -CODEC_MIC_ADCRATE_REG = 34h ; mic in sample rate - - -; registers 36-7a are reserved on the ICH - -CODEC_VENDORID1_REG = 7ch ; codec vendor ID 1 -CODEC_VENDORID2_REG = 7eh ; codec vendor ID 2 - - -; When 2 codecs are present in the system, use BIT7 to access the 2nd -; set of registers, ie 80h-feh - -SECONDARY_CODEC = BIT7 ; 80-8f registers for 2nda \ No newline at end of file diff --git a/programs/media/ac97wav/trunk/ac97wav.asm b/programs/media/ac97wav/trunk/ac97wav.asm deleted file mode 100644 index b533bea3a7..0000000000 --- a/programs/media/ac97wav/trunk/ac97wav.asm +++ /dev/null @@ -1,1103 +0,0 @@ -;--------------------------------------------------------------------- -; -; MenuetOS AC97 WAV Player -; -; 0.03 November 10, 2004 doesn't halt if file not found -; 0.04 November 11, 2004 better positioning (with mouse) -; 0.05 November 14, 2004 internals clean up -; fixed cutting sound at the edges -; 0.06 November 17, 2004 fixed many bugs -; 0.07 Nov 20, 2004 deactivates text box when 'play' pressed -; stops playing before closing a window -; 0.08 Nov 24, 2004 added support for 8bit and mono modes -; +variable rate for some chipsets -; 0.09 August 26, 2006 modified to use function 70 -; -; Use [flat assembler 1.64] to compile. -; -;--------------------------------------------------------------------- - - use32 ; turn on 32 bit mode - org 0x0 ; the program is placed at 0 offset - - db 'MENUET01' ; 8-byte identifier of MenuetOS application - dd 0x01 ; header version (always 1) - dd START ; address of the beginning of the code - dd IMAGE_END ; size of the program's image - dd MEMORY_END ; how much memory does it need - dd STACK_P ; a pointer to the top of the stack - dd textbox_string -; dd 0x0 ; address of buffer for parameters (not used) - dd 0x0 ; reserved - -;--------------------------------------------------------------------- - -include "MACROS.INC" ; standart macros & constants -include "MEOSFUNC.INC" ; MenuetOS API functions names -include "DEBUG.INC" ; printing to debug board -include "CONSTANT.INC" ; BIT?? constants -include "AC97.INC" ; AC'97 constants -include "PCI.INC" ; PCI interface -include "CODEC.INC" ; functions for configuring codec -include "FRONTEND.INC" ; main window - -;--------------------------------------------------------------------- - -; Uncomment these strings if you don't want to receive debug messages: - -; macro dps str {} ; dps prints a string without CRLF -; macro dpd num {} ; prints unsigned decimal number -; macro pregs {} ; outputs EAX, EBX, ECX, EDX -; macro newline {} ; CRLF -; macro print str {} ; output a string with CRLF -; macro dph arg {} ; print hex number - -;--------------------------------------------------------------------- - -;macro device id, addr { dd id, addr } -macro devices [id, str] -{ - common - label supported_devices dword - forward - local string - dd id - dd string - forward - string db str - db 0 -} - - -devices \ - (ICH_DID shl 16) + INTEL_VID, "ICH" ,\ - (ICH0_DID shl 16) + INTEL_VID, "ICH0" ,\ - (ICH2_DID shl 16) + INTEL_VID, "ICH2" ,\ - (ICH3_DID shl 16) + INTEL_VID, "ICH2" ,\ - (ICH4_DID shl 16) + INTEL_VID, "ICH4" ,\ - (ICH5_DID shl 16) + INTEL_VID, "ICH5" ,\ - (MX440_DID shl 16) + INTEL_VID, "440MX" ,\ - (SI7012_DID shl 16) + SIS_VID, "SI7012" ,\ - (NFORCE_DID shl 16) + NVIDIA_VID, "NForce" ,\ - (NFORCE2_DID shl 16) + NVIDIA_VID, "NForce2",\ - (AMD8111_DID shl 16) + AMD_VID, "AMD8111",\ - (AMD768_DID shl 16) + AMD_VID, "AMD768" -dd 0 - - -;--------------------------------------------------------------------- -;--- MAIN PROGRAM -------------------------------------------------- -;--------------------------------------------------------------------- - -START: - -; Print PCI version (for example, 2.16) -; mcall MF_PCI, 0 -; mov bl, al -; movzx eax, ah -; dps "PCI version: " -; dpd eax -; movzx eax, bl -; dpd eax -; newline - -; Check PCI access mechanism (must be 1 or 2) - mcall MF_PCI, 2 - dec al - cmp al, 1 - jna @f - print "Error: cannot access PCI bus." - jmp exit -; dps "PCI returned " -; movzx eax, al -; dpd eax -; newline - @@: - - -; Get last bus & then check all buses & devices - mcall MF_PCI, 1 - mov [lastbus], al - - ; looking for a compatible device - mov [bus], -1 - .next_bus: - inc [bus] - - mov al, [lastbus] - cmp al, [bus] - jb .device_not_found - - mov [devfn], 0 - .next_devfn: - - mov cl, 0 - call pciRegRead32 - - mov edi, supported_devices - @@: - mov ebx, [edi] - test ebx, ebx - jz @f - cmp eax, ebx - jnz .skip - add edi, 4 - mov [device_id], eax - mov edx, [edi] - call debug_outstr - jmp proceed - .skip: - add edi, 8 - jmp @b - @@: - - inc [devfn] - cmp [devfn], 255 - jb .next_devfn - - jmp .next_bus - - - .device_not_found: - print "Could not find Intel AC'97 compatible codec!" - print "1) Check if it's enabled in BIOS." - print "2) Check if your device is included in the device list." - jmp exit - - - proceed: - print " integrated AC97 audio codec detected." - mov eax, [device_id] - cmp eax, (ICH4_DID shl 16) + INTEL_VID - je .newich - cmp eax, (ICH5_DID shl 16) + INTEL_VID - jne .nonewich - .newich: - mov [AC97ICH4], 1 - .nonewich: - - cmp eax, (SI7012_DID shl 16) + SIS_VID - jne @f - mov [SI7012], 1 - @@: - -;--------------------------------------------------------------------- - -; Get NAMBAR register base port address & save it - mov cl, NAMBAR_REG - call pciRegRead16 - - and eax, 0xFFFE - mov [NAMBAR], ax - test eax, eax - jnz .mixer_base_ok - - print "Error: Intel ICH based AC97 audio codec disabled in BIOS!" - jmp exit - - .mixer_base_ok: - dps "NAMBAR: " - dph eax - -; Get NABMBAR & save it - mov cl, NABMBAR_REG - call pciRegRead16 - and eax, 0xFFC0 - mov [NABMBAR], ax - test eax, eax - jnz .bm_base_ok - - print "Error: Intel ICH based AC97 audio codec disabled in BIOS!" - jmp exit - - .bm_base_ok: - dps " NABMBAR: " - dph eax - newline - -;--------------------------------------------------------------------- - -; Get IRQ (not used) - mov cl, IRQ_REG - call pciRegRead8 - mov [AC97IRQ], al - -; Get Interrupt pin (not used) - mov cl, INT_REG - call pciRegRead8 - mov [AC97INT], al - -; AC97ICH4 should work then... - cmp [AC97ICH4], 1 - jne .skip_ich4_init - - mov cl, ICH4_CFG_REG ; 0x41 - call pciRegRead8 - or al, 0x1 - mov dl, al - call pciRegWrite8 - - mov cl, 0x54 - call pciRegRead16 - and eax, 0xFFFF - dps "Power Control & Status: " - dph eax - newline - .skip_ich4_init: - -;--------------------------------------------------------------------- - - mov cl, PCI_CMD_REG - call pciRegRead16 ; read PCI command register - mov dx, ax - or dx, IO_ENA+BM_ENA+BIT10 ; enable IO and bus master + disable - ; interrupts - call pciRegWrite16 - -;--------------------------------------------------------------------- - - print "Enabling access to ports..." - - movzx ecx, [NAMBAR] - mov edx, ecx - add edx, NAM_SIZE - mcall MF_PORTS, PRT_RESERVE - test eax, eax - jz @f - print "Error: couldn't enable access to ports" - jmp exit - @@: - - movzx ecx, [NABMBAR] - mov edx, ecx - add edx, NABM_SIZE - mcall MF_PORTS, PRT_RESERVE - test eax, eax - jz @f - print "Error: couldn't enable access to ports" - jmp exit - @@: - -;--------------------------------------------------------------------- - -; setup the Codec - mov eax, 48000 - call codecConfig ; unmute codec, set rates. - test eax, eax - jnz @f - print "Error: cannot initialize AC97 device." - jmp fpexit - @@: - - print "Congrutalations! Your device has been initialized properly!" - call print_info - -;--------------------------------------------------------------------- - -; register reset the DMA engine. - mov edx, PO_CR_REG ; PCM out control register - mov al, RR ; reset - call NABMBAR_write_byte - -;start fix for MM (1) - mcall MF_INTERNAL_SERVICES,ALLOC_PHYS_MEM,120*1024 - test eax,eax - jz no_phys_buffers ;not enough memory - mov [phys_wav_buffer1],eax - add eax,60*1024 - mov [phys_wav_buffer2],eax - mcall MF_INTERNAL_SERVICES,ALLOC_PHYS_MEM,32*8 - test eax,eax - jnz @f - mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_wav_buffer1] - jmp no_phys_buffers -@@: - mov [phys_bdl_buffer],eax -;end fix for MM (1) - -; create Buffer Descriptors List - call prepare_BDL - -; open player's window - mcall MF_THREAD, THR_CREATE, thread, thread_stack - -; wait for command - .new_check: - cmp [status], ST_PLAY - jne @f - call play - @@: - cmp [status], ST_STOP - jne @f - call stop - @@: - cmp [status], ST_EXIT - je stopexit - - mcall MF_DELAY, 10 - jmp .new_check - -stopexit: - call stop - -fpexit: - -; free ports - movzx ecx, [NAMBAR] - mov edx, ecx - add edx, NAM_SIZE - mcall MF_PORTS, PRT_FREE - - movzx ecx, [NABMBAR] - mov edx, ecx - add edx, NABM_SIZE - mcall MF_PORTS, PRT_FREE - -;--------------------------------------------------------------------- -;start fix for MM (2) - mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_bdl_buffer] - mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_wav_buffer1] -;end fix for MM (2) -exit: - mcall MF_EXIT -no_phys_buffers: - print "allocation of physical buffers failed" - jmp exit - -;--------------------------------------------------------------------- -;--- FUNCTIONS ----------------------------------------------------- -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; prepare_BDL - initializes BUFFER DESCRIPTORS LIST -prepare_BDL: - mov ecx, 32 / 2 ; make 32 entries in BDL - mov edi, BDL_BUFFER -; call get_my_address - mov ebx, 30*1024 - cmp [SI7012], 1 - jne @f - add ebx, ebx -@@: - ; set buf. desc. 0 to start of data file in memory - push eax -; add eax, WAV_BUFFER1 -;start fix for MM (6) - mov eax,[phys_wav_buffer1] -;end fix for MM (6) - stosd - ; set length to 60k samples. 1 sample is 16 bit or 2 bytes. - mov eax, ebx ;60*1024 ; number of samples - or eax, BUP - stosd - - mov eax, [esp] -; add eax, WAV_BUFFER2 -;start fix for MM (7) - mov eax,[phys_wav_buffer2] -;end fix for MM (7) - stosd - mov eax, ebx ;60*1024 - or eax, BUP - stosd - - pop eax - loop @b - - - ; tell the DMA engine where to find our list of Buffer Descriptors. - ; eax = base addr! -;start fix for MM (3) - ;copy to physical memory - mcall MF_INTERNAL_SERVICES,SET_PHYS_BUFFER,[phys_bdl_buffer],BDL_BUFFER,32*8 - ;physical address of bdl - mov eax,[phys_bdl_buffer] -;end fix for MM (3) - mov edx, PO_BDBAR_REG -; add eax, BDL_BUFFER - call NABMBAR_write_dword - -ret - - -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; stop - stops current music -;; in: nothing -;; out: nothing -stop: -; print "STOP!" - push eax edx - - mcall MF_DELAY, 10 - mov edx, PO_CR_REG - mov al, 0 - call NABMBAR_write_byte - cmp [status], ST_STOP - jne .exit - mov [status], ST_DONE - .exit: - - pop edx eax -ret - -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; play - plays wav file! -;; in: nothing -;; out: nothing (but sound :) !corrupts registers! -play: - ; at first, reset file and get file size - mcall MF_SYSTREE, attrinfo - test eax, eax - jnz .notfound - mov eax, [fileattr+32] - mov [file_size], eax - mov [fileinfo.first_byte], 0 - mcall MF_SYSTREE, fileinfo ; load a block, returns error code in eax - ; and size of the file in ebx - test eax, eax ; 0 - successful - jz @f - cmp eax, 6 ; 6 = eof - successful too - jz @f -.notfound: - print "AC97: File not found!" - mov [status], ST_STOP - jmp .exit - @@: - - mov al, [LOAD_BUFFER+32] ; bytes per sample - dec al - jz @f - cmp al, 3 - je @f - sub al, [LOAD_BUFFER+22] ; channels - add al, 2 - @@: - mov [wav_mode], al - - pusha - movzx ebx,word [LOAD_BUFFER+24] - mov eax,48000 - xor edx,edx - div ebx - mov [difference_of_frequency],al -; dph eax - mov ecx,edx - imul eax,ecx,10 - xor edx,edx - div ebx - mov ecx,edx - imul ecx,10 - push eax - mov eax,ecx - xor edx,edx - div ebx -; dph eax - cmp eax,5 - jl .temp_15 - pop eax -; dph eax - - inc eax - jmp .temp_16 - .temp_15: - pop eax - .temp_16: - mov [difference_of_frequency_1],al -; dph eax - xor edx,edx - movzx ebx,[difference_of_frequency] - imul ebx,10 - add bl,[difference_of_frequency_1] - mov [difference_of_frequency_2],bl -; dph ebx - popa - - movzx eax, word [LOAD_BUFFER+24] - ;dps "Freq: " - ;dpd eax - ;newline - call set_sample_rate - - - ; change the last_valid_index to the (current_index-1) - ; the LVI register tells the DMA engine where to stop playing - call updateLVI - - ; if current index is odd, load buffer 1 then 0, jump to tuneLoop - ; if it is even, buffers 0 then 1; tuneLoop1 - call getCurrentIndex - and eax, BIT0 - - mov esi, eax - push eax - call update_next_buffer - pop eax - xor eax, 1 - call update_next_buffer - - ; start playing! - mov edx, PO_CR_REG - mov al, RPBM - call NABMBAR_write_byte - - jmp [jumpto+esi*4] - - - .tuneLoop: - ; wait while the current_index is even - @@: -; dps "a" - mcall MF_DELAY, 7 - call getCurrentIndex - test al, BIT0 - jz @b ; loop if not ready yet -; print "fa" - - call updateLVI - - mov eax, 0 - call update_next_buffer - test al, al - jnz .exit_wait - - cmp [status], ST_PLAY - jne .exit - - test [volume], 0x10000000 ; test volume_changed bit - je @f - mov al, byte [volume] - call setVolume - and [volume], 0x0FFFFFFF ; clear vloume_changed bit - @@: - - .tuneLoop1: - @@: -; dps "b" - mcall MF_DELAY, 7 - call getCurrentIndex - test al, BIT0 - jnz @b ; loop if not ready yet -; print "fb" - - cmp [status], ST_PLAY - jne .exit - - call updateLVI - - mov eax, 1 - call update_next_buffer - test al, al - jnz .exit_wait - - jmp .tuneLoop - .exit_wait: - mcall MF_DELAY, 30 ; a little pause - let the player finish - .exit: -ret -attempts db 0 - -buffers dd WAV_BUFFER1, WAV_BUFFER2 -jumpto dd play.tuneLoop, play.tuneLoop1 - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; update_first_buffer - load a chunk into the first buffer, increments offset -;; in: eax = number - 0 or 1 -;; out: error code, 0 - successful -update_next_buffer: - push esi edi - - movzx edx, byte [wav_mode] - mov ecx, [blocks + edx * 4] - mov [fileinfo.bytes], ecx - - mov esi, LOAD_BUFFER - mov edi, [buffers+eax*4] - push eax ;save buffer index - start_attempts: - mcall MF_SYSTREE, fileinfo - test eax, eax - jz @f - cmp eax, 6 - jz @f - cmp [attempts],100 - je @f - inc [attempts] - jmp start_attempts -; dpd eax -; newline -; dpd [fileinfo.first_block] -; newline - @@: -; print " loaded!" - - push eax ebx edx - mov eax,ecx - xor edx,edx - imul eax,10 - movzx ebx,[difference_of_frequency_2] - - div ebx - mov ecx,eax - -; mov ebx,10 -; mov eax,edx -; xor edx,edx -; div ebx -; cmp edx,5 -; jb temp_12_7 -; inc ecx -; temp_12_7: -; cmp edx,0 -; je temp_12_7 -; inc ecx -; temp_12_7: - - pop edx ebx - mov eax,[esp+4] ;restore buffer index - and ecx, not 511 - add [fileinfo.first_byte], ecx ; +60Kb - call [convert + edx * 4] -;start fix for MM (4) - mov eax,[esp+4] ;restore buffer index - test eax,not 1 - jz .ok - print "buffer index out of range" - dpd eax - jmp .ret - .ok: - push ebp - mov ebp,[phys_wav_buffer1+eax*4] - mov edi,[buffers+eax*4] - mcall MF_INTERNAL_SERVICES,SET_PHYS_BUFFER,ebp,edi,60*1024 - pop ebp -.ret: - pop eax - add esp,4 ;pop buffer index -;end fix for MM (4) - - pop edi esi -ret - -c8mono: - mov [type_of_conversion],1 - jmp for_all_type - -c8mono_1: - lodsb - call c8mono_2 - push ax - shl eax,16 - pop ax - push eax - mov al,[esi] - call c8mono_2 - push ax - shl eax,16 - pop ax - mov ebx,eax - pop eax - jmp for_all_type_1 - -c8mono_2: - sub al, 0x80 - cbw - imul ax, 255 - ret - -c8stereo: - mov [type_of_conversion],2 - jmp for_all_type - -c8stereo_1: - lodsb - call c8stereo_2 - shl eax,16 - lodsb - call c8stereo_2 - push eax - mov al,[esi] - call c8stereo_2 - shl eax,16 - mov al,[esi+1] - call c8stereo_2 - mov ebx,eax - pop eax - jmp for_all_type_1 - -c8stereo_2: - sub al, 0x80 - cbw - imul ax, 255 - ret - -c16mono: - mov [type_of_conversion],3 - jmp for_all_type - -c16mono_1: - lodsw - push ax - shl eax,16 - pop ax - mov bx,[esi] - shl ebx,16 - mov bx,[esi] - jmp for_all_type_1 - -c16stereo: - for_all_type: - xor edx,edx - mov eax, 15*1024*10 - movzx ebx,[difference_of_frequency_2] - xor edx,edx - div ebx - mov ecx,eax - -; mov ebx,10 -; mov eax,edx -; xor edx,edx -; div ebx -; cmp edx,5 -; jb temp_12_6 -; inc ecx -; temp_12_6: - cmp edx,0 - je temp_12_6 - inc ecx - temp_12_6: - - c16stereo_1: - mov [znak],0 - - cmp [type_of_conversion],1 - je c8mono_1 - cmp [type_of_conversion],2 - je c8stereo_1 - cmp [type_of_conversion],3 - je c16mono_1 - lodsd - - mov ebx,[esi] -for_all_type_1: - cmp eax,ebx - jne c16stereo_2 - inc [znak] - c16stereo_2: - push eax - push ecx - sub eax,ebx - push eax - shl eax,16 - movzx ebx,[difference_of_frequency] - inc ebx - xor edx,edx - div ebx - shr eax,16 - mov ecx,eax - pop eax - xor ax,ax - xor edx,edx - div ebx - shl eax,16 - mov cx,ax - mov ebx,ecx - pop ecx - pop eax - mov dl,[difference_of_frequency] - inc dl - @@: -temp_12: - cmp [difference_of_frequency_1],0 - je temp_12_3 - cmp [difference_of_frequency_1],5 - jne temp_12_4 - cmp [difference_of_frequency_4],2 - jne temp_12_3 - jmp temp_12_5 - temp_12_4: - cmp [difference_of_frequency_4],10 - jne temp_12_3 - - temp_12_5: - - cmp [znak],0 - jne temp_12_5_1 - sub eax,ebx - jmp temp_12_5_2 - temp_12_5_1: - add eax,ebx - temp_12_5_2: - - - stosd - inc [schetchik] - mov [difference_of_frequency_4],0 - temp_12_3: - cmp [znak],0 - jne temp_13 - sub eax,ebx - jmp temp_14 - temp_13: - add eax,ebx - - temp_14: - cld - dec dl - jz temp_14_1 - stosd - inc [schetchik] - inc [difference_of_frequency_4] - jmp temp_12 - temp_14_1: - dec ecx - cmp ecx,0 -; jnz c16stereo_1 - jg c16stereo_1 - newline - dph [schetchik] - temp_14_2: - cmp [schetchik],15360 - jge temp_14_3 - stosd - inc [schetchik] - jmp temp_14_2 - - temp_14_3: - newline - dph [schetchik] - cmp [schetchik],15360 - je temp_14_4 -; mov [edi-4],dword 0 - sub edi,4 -; sub esi,4 - temp_14_4: - mov [schetchik],0 - ret - - -difference_of_frequency db 0 -difference_of_frequency_1 db 0 -difference_of_frequency_2 db 0 -difference_of_frequency_4 db 0 -schetchik dd 0 -znak db 0 -type_of_conversion db 0 - -convert dd c8mono, c8stereo, c16mono, c16stereo -blocks dd 30*512, 60*512, 60*512, 120*512 - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; get_my_address - get base address of the program in physical memory -;; in: nothing -;; out: eax = address -;start fix for MM (8) -;function shouldn't used. -;get_my_address: -; pushad -; mcall MF_PROCINFO, procinfo, PN_MYSELF -; popad -; mov eax, [procinfo.memory_start] -;ret -;end fix for MM (8) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; set the last valid index to something other than we're currently playing -;; so that we never end -;; -;; this routine just sets the last valid index to 1 less than the index -;; that we're currently playing, thus keeping it in and endless loop -;; input: none -;; output: none -updateLVI: - push eax - call getCurrentIndex - ; dps "index " - ; dpd eax - ; newline - dec al - and al, INDEX_MASK - call setLastValidIndex - pop eax -ret - -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; returns AL = current index value -getCurrentIndex: - push edx - mov edx, PO_CIV_REG - call NABMBAR_read_byte - pop edx -ret - -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; input AL = index # to stop on -setLastValidIndex: - push edx - mov edx, PO_LVI_REG - call NABMBAR_write_byte - pop edx -ret - -;--------------------------------------------------------------------- - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; print_info - outputs debug information -;; in: nothing -;; out: nothing -print_info: - dps "BUS: " - movzx eax, [bus] - dph eax - - dps " DEVFN: " - movzx eax, [devfn] - dph eax - - dps " IRQ: " - movzx eax, [AC97IRQ] - dpd eax - newline - - - dps "CODEC_POWER_CTRL: " - mov edx, CODEC_POWER_CTRL_REG - call NAMBAR_read_word - dph eax - dps " (bits 0-3 should be set)" - newline - - mov edx, 0x28 - call NAMBAR_read_word - dph eax - dps " - supported features" - newline - mov edx, 0x2A - call NAMBAR_read_word - dph eax - dps " - config" - newline - mov edx, 0x2C - call NAMBAR_read_word - dph eax - dps " - PCM rate" - - newline -ret - - -;--------------------------------------------------------------------- -;--- DATA OF PROGRAM ----------------------------------------------- -;--------------------------------------------------------------------- -volume dd 15 - -attrinfo: - dd 5 - dd 0 - dd 0 - dd 0 - dd fileattr - db 0 - dd textbox_string - -fileinfo: - .mode dd 0 ; READ - .first_byte dd 0 - dd 0 - .bytes dd 60*1024 ; 60 Kb - .dest dd LOAD_BUFFER ;file_data - ; db "/HD/1/WINDOWS/MEDIA/WICEB7~1.WAV",0 -;sz textbox_string, "/hd/1/testmuz/menuet11.wav",0 -textbox_string: -;--------------------------------------------------------------------- - -IMAGE_END: ; end of program's image - rb 257 -; rb 257-textbox_string.size -; textbox_string.size - -;--------------------------------------------------------------------- - -device_id dd ? ; (device_id << 16) + vendor_id -lastbus db ? ; pci coordinates -bus db ? -devfn db ? - -AC97ICH4 db ? ; Intel ICH4 codec flag -SI7012 db ? ; SiS SI7012 codec flag -NAMBAR dw ? ; Audio Mixers Registers (base) -NABMBAR dw ? ; Bus Master Registers (base) - -AC97IRQ db ? ; Interrupt request -AC97INT db ? ; Interrupt pin - -wav_mode db ? ; bits per sample & channels - -;--------------------------------------------------------------------- - -ST_DONE = 0x0 ; for interacting with player's window -ST_PLAY = 0x1 -ST_EXIT = 0x2 -ST_STOP = 0x4 - -status db ? - -fileattr: rb 40 - -;--------------------------------------------------------------------- -phys_bdl_buffer rd 1 -phys_wav_buffer1 rd 1 -phys_wav_buffer2 rd 1 -align 32 - - -; Buffer Descriptors List -; ___________________________ -; | physical address | dword -; |_________________________| -; | attr | length | dword max. length = 65535 samples -; |_________________________| - -BDL_BUFFER: - rb 32*8 ; 32 descriptors, 8 bytes each - - -;--------------------------------------------------------------------- - -file_data: - -WAV_BUFFER1: - rb 60 * 1024 ; 60 Kb - -WAV_BUFFER2: - rb 60 * 1024 - -LOAD_BUFFER: - rb 60 * 1024 - -;--------------------------------------------------------------------- - -procinfo process_information - -work_area: - rb 0x10000 - -;--------------------------------------------------------------------- - -rb 0x800 -thread_stack: - -rb 0x1000 ; for stack -STACK_P: - -MEMORY_END: diff --git a/programs/media/ac97wav/trunk/build_en.bat b/programs/media/ac97wav/trunk/build_en.bat deleted file mode 100644 index 6f10d56325..0000000000 --- a/programs/media/ac97wav/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm ac97wav.asm ac97wav -@pause \ No newline at end of file diff --git a/programs/media/ac97wav/trunk/build_ru.bat b/programs/media/ac97wav/trunk/build_ru.bat deleted file mode 100644 index affa5a1e1c..0000000000 --- a/programs/media/ac97wav/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm ac97wav.asm ac97wav -@pause \ No newline at end of file diff --git a/programs/media/ac97wav/trunk/codec.inc b/programs/media/ac97wav/trunk/codec.inc deleted file mode 100644 index 5a8d99d7a6..0000000000 --- a/programs/media/ac97wav/trunk/codec.inc +++ /dev/null @@ -1,344 +0,0 @@ - -NAMBAR_read_byte: - add dx, [NAMBAR] - in al, dx -ret - - -NAMBAR_read_word: - add dx, [NAMBAR] - in ax, dx -ret - - -NAMBAR_read_dword: - add dx, [NAMBAR] - in eax, dx -ret - -NAMBAR_write_byte: - add dx, [NAMBAR] - out dx, al -ret - -NAMBAR_write_word: - add dx, [NAMBAR] - out dx, ax -ret - -NAMBAR_write_dword: - add dx, [NAMBAR] - out dx, eax -ret - - - -NABMBAR_read_byte: - add dx, [NABMBAR] - in al, dx -ret - -NABMBAR_read_word: - add dx, [NABMBAR] - in ax, dx -ret - -NABMBAR_read_dword: - add dx, [NABMBAR] - in eax, dx -ret - -NABMBAR_write_byte: - add dx, [NABMBAR] - out dx, al -ret - -NABMBAR_write_word: - add dx, [NABMBAR] - out dx, ax -ret - -NABMBAR_write_dword: - add dx, [NABMBAR] - out dx, eax -ret - - - -semaphore: - push ecx edx - - mov edx, GLOB_STS_REG ; 0x30 global status register - call NABMBAR_read_dword - and eax, PRI_CODEC_RDY ; 100h primary codec ready - jz .success ; exit if codec not ready !!! - -; mov ecx, 1024 ; try 1024 times - mov ecx, 0ffffh ; try 65535 times - .wait: - mov edx, ACC_SEMA_REG ; 0x34 codec write semaphore - call NABMBAR_read_byte - and al, CODEC_BUSY ; 01h codec access semaphore - jz .success ; exit if codec not busy !!! - - dec ecx - jnz .wait - - pop edx ecx - mov eax, 0 - jmp .exit - - .success: - pop edx ecx - mov eax, 1 - .exit: -ret - - - - - -codecStop: - push eax ebx edx - - mov edx, PO_CR_REG ; 0x1B control register - mov al, 0 ; stop all PCM out data - call NABMBAR_write_byte - - mcall MF_DELAY, eax ; ebx = (eax = MF_DELAY = 5); wait 50 ms - - mov edx, PO_CR_REG ; 0x1B control register - mov al, RR ; reset PCM out regs - call NABMBAR_write_byte - - mcall MF_DELAY, eax - - pop edx ebx eax -ret - - - - -; set voulme -; in ax = volume level -setVolume: - push eax edx - - push eax - call semaphore - mov edx, CODEC_RESET_REG ; 0 - xor eax, eax ; register reset the codec - call NAMBAR_write_word - - call semaphore - pop eax - imul ax, 0101h ; set volume for both chn - mov edx, CODEC_MASTER_VOL_REG ; 2 - call NAMBAR_write_word - push eax - - call semaphore - pop eax ; set volume for both chn - mov edx, CODEC_HP_VOL_REG ; 4 - call NAMBAR_write_word - push eax - - call semaphore - mov edx, CODEC_CD_VOL_REG ; 12h - pop eax ; set volume for both chn - shr eax, 2 ; adjust CD VOL - call NAMBAR_write_word - - call semaphore - mov edx, CODEC_PCM_OUT_REG ; 18h - mov ax, 0808h ; standard PCM out volume - call NAMBAR_write_word - - pop edx eax -ret - - - - -samplerate dw 0 - - - -; enable codec, unmute stuff, set output to desired rate -; in : ax = desired sample rate -; out: ax = true or false -; -codecConfig: - pushad - mov [samplerate], ax ; save sample rate - - -; mov edx, GLOB_STS_REG ; 30h global status register -; call NABMBAR_read_dword -; and eax, PRI_CODEC_RDY ; 0100h primary codec ready -; jnz skip_init ; skip init if codec ready !!! - - ; stop the codec if currently playing -;;; call codecStop - -; mov edx, GLOB_STS_REG -; call NABMBAR_read_dword -; dps "GLOB_STA = " -; dph eax -; newline - -; mov edx, GLOB_CNT_REG -; call NABMBAR_read_dword -; dps "GLOB_CNT = " -; dph eax -; newline - -; mcall 5, 10 - -;; test eax, ACCOLD_RESET -;; jnz .skip_cold_reset - -; print "cold reset" - ; do a cold reset - mov edx, GLOB_CNT_REG ; 2ch global control register - xor eax, eax - call NABMBAR_write_dword ; enable (AC Link off clear) - -; print "wait" - mcall 5, 5 -; print "alive!" - -;; .skip_cold_reset: - - mov edx, GLOB_CNT_REG ; 2ch global control register - mov eax, ACCOLD_RESET + PRI_RES_EN ; cold reset + primary resume - call NABMBAR_write_dword ; 2 channels & 16 bit samples - - mov edx, GLOB_CNT_REG ; 2ch global control register - call NABMBAR_read_dword - and eax, ACCOLD_RESET ; cold reset - jz init_error ; INIT FAILED !!! - -; print "cold reset finished" - - ; wait for primary codec ready status - mov ecx, 128 -codec_ready_loop: - mov edx, GLOB_STS_REG ; 30h global status register - call NABMBAR_read_dword - and eax, PRI_CODEC_RDY ; 0100h primary codec ready - jnz codec_ready_exit ; move on if codec ready !!! - mcall 5, 1 - dec ecx - jnz codec_ready_loop - ;dps "~" -codec_ready_exit: - - ; wait until codec init ready (*** replaces warm reset wait ***) - mcall 5, 60 - - ; test if codec ready bit is finally set - mov edx, GLOB_STS_REG ; 30h global status register - call NABMBAR_read_dword - and eax, PRI_CODEC_RDY ; 0100h primary codec ready - jnz codec_ready_bit_set ; move on if codec ready !!! - cmp [AC97ICH4], 1 - jne init_error -; je codec_ready_bit_set ; ignore codec ready for ICH4 -; jmp init_error ; codec ready bit not set !!! -codec_ready_bit_set: - - ; clear semaphore flag - mov edx, CODEC_RESET_REG ; 0h codec reset register - call NAMBAR_read_word - - - ; check if codec sections ready - call semaphore - test eax, eax - jz init_error - mov edx, CODEC_POWER_CTRL_REG ; 26h codec powerdown ctrl - call NAMBAR_read_word - and eax, 01111b - cmp eax, 01111b - jne init_error ; codec sections not ready - - - - ; disable interrupts - mov al, 0 - - mov edx, PI_CR_REG ; 0Bh PCM in control register - call NABMBAR_write_byte - - mov edx, PO_CR_REG ; 1Bh PCM out control register - call NABMBAR_write_byte - - mov edx, MC_CR_REG ; 2Bh MIC in control register - call NABMBAR_write_byte - - ; reset channels - mov al, RR ; 02h reset Bus master regs - - mov edx, PI_CR_REG ; 0Bh PCM in control register - call NABMBAR_write_byte - - mov edx, PO_CR_REG ; 1Bh PCM out control register - call NABMBAR_write_byte - - mov edx, MC_CR_REG ; 2Bh MIC in control register - call NABMBAR_write_byte - - ; set default volume - mov eax, 15 ; set average volume level - call setVolume - - ; set VRA and clear DRA (if not supported will be skipped) - call semaphore - test eax, eax - jz init_error - mov edx, CODEC_EXT_AUDIO_CTRL_REG ; register 2ah - call NAMBAR_read_word ; get ext audio ctl - - mov ebx, eax - call semaphore - test eax, eax - jz init_error - mov eax, ebx - and eax, 0FFFFh - BIT1 ; clear DRA (BIT1) - or eax, BIT0 ; set VRA (BIT0) - mov edx, CODEC_EXT_AUDIO_CTRL_REG ; register 2ah - call NAMBAR_write_word ; write ext audio ctl - - ; set desired sample rate -skip_init: - call semaphore - test eax, eax - jz init_error - - ; mov edx, CODEC_PCM_FRONT_DACRATE_REG - ; call NAMBAR_read_word - ; and eax, 0xFFFF - ; newline - ; dps "old PCM OUT RATE: " - ; dpd eax - ; newline - - mov ax, [samplerate] ; restore sample rate -; mov edx, CODEC_PCM_FRONT_DACRATE_REG ; register 2ch -; call NAMBAR_write_word - call set_sample_rate - - popad - mov eax, 1 ; exit with success - jmp exit_config -init_error: - popad - xor eax, eax ; exit with error -exit_config: - ret - -set_sample_rate: ; rate in ax - mov edx, CODEC_PCM_FRONT_DACRATE_REG ; 0x2C reg - call NAMBAR_write_word -ret diff --git a/programs/media/ac97wav/trunk/constant.inc b/programs/media/ac97wav/trunk/constant.inc deleted file mode 100644 index bc3e3a4e9f..0000000000 --- a/programs/media/ac97wav/trunk/constant.inc +++ /dev/null @@ -1,35 +0,0 @@ -;constants of stuff that seem hard to remember at times. - -BIT0 EQU 1 -BIT1 EQU 2 -BIT2 EQU 4 -BIT3 EQU 8 -BIT4 EQU 10h -BIT5 EQU 20h -BIT6 EQU 40h -BIT7 EQU 80h -BIT8 EQU 100h -BIT9 EQU 200h -BIT10 EQU 400h -BIT11 EQU 800h -BIT12 EQU 1000h -BIT13 EQU 2000h -BIT14 EQU 4000h -BIT15 EQU 8000h -BIT16 EQU 10000h -BIT17 EQU 20000h -BIT18 EQU 40000h -BIT19 EQU 80000h -BIT20 EQU 100000h -BIT21 EQU 200000h -BIT22 EQU 400000h -BIT23 EQU 800000h -BIT24 EQU 1000000h -BIT25 EQU 2000000h -BIT26 EQU 4000000h -BIT27 EQU 8000000h -BIT28 EQU 10000000h -BIT29 EQU 20000000h -BIT30 EQU 40000000h -BIT31 EQU 80000000h - diff --git a/programs/media/ac97wav/trunk/frontend.inc b/programs/media/ac97wav/trunk/frontend.inc deleted file mode 100644 index 8dbc17d607..0000000000 --- a/programs/media/ac97wav/trunk/frontend.inc +++ /dev/null @@ -1,276 +0,0 @@ -thread: - mov edi, textbox_string - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - dec ecx - mov [textbox_position], cl - call draw_window - call main_loop - mov [status], ST_EXIT - mcall MF_EXIT - -;--------------------------------------------------------------------- - -main_loop: - cmp [status], ST_PLAY - je @f - mcall MF_WAIT_EVENT - jmp .handle_event - @@: - call draw_progress_bar - mcall MF_WAIT_EVENT_TIMEOUT, 80 - .handle_event: - cmp eax, EV_REDRAW - je redraw - cmp eax, EV_BUTTON - je button - cmp eax, EV_KEY - je key - jmp main_loop - - redraw: - call draw_window - jmp main_loop - - key: - mcall MF_GETKEY - cmp [textbox_active], 1 - jne main_loop - cmp ah, 13 - je .enter - cmp ah, 8 - je .backspace - movzx ecx, [textbox_position] - cmp ecx, 255 - jae .enter - mov [textbox_string + ecx], ah - inc [textbox_position] - call textbox_draw - jmp main_loop - .enter: - mov [textbox_active], 0 - call textbox_draw - jmp main_loop - .backspace: - movzx ecx, [textbox_position] - test ecx, ecx - jz main_loop - dec [textbox_position] - mov [textbox_string + ecx - 1], byte 0 - call textbox_draw - jmp main_loop - - button: - mcall MF_GETBUTTON - cmp ah, 0x10 - je play_button - cmp ah, 0x11 - je stop_button - cmp ah, 0x12 - je decr_button - cmp ah, 0x13 - je incr_button - cmp ah, 0x14 - je volm_button - cmp ah, 0x15 - je volp_button - cmp ah, 0x20 - je activate_textbox - cmp ah, 0x30 - je progressbar_click - cmp ah, 1 - jne main_loop - -; mov [status], ST_STOP -; mcall MF_DELAY, 40 - ret - - play_button: - xor eax, eax - xchg al, [textbox_active] - cmp al, 0 - je @f - call textbox_draw - @@: - mov [status], ST_PLAY - jmp main_loop - stop_button: - mov [status], ST_STOP - jmp main_loop - - decr_button: -; mov [status], ST_STOP -; @@: -; mcall 5, 1 -; cmp [status], ST_DONE -; jne @b -; movzx esi, [textbox_position] -; add esi, textbox_string -; @@: -; cmp byte [esi], '/' -; je @f -; dec esi -; jmp @b -; @@: -; mov byte [esi+1], 0 -; mov [fileinfo.first_block], 0 -; mov [fileinfo.dest], WAV_BUFFER1 -; mcall 58, fileinfo -; add ebx, WAV_BUFFER1 -; mov esi, WAV_BUFFER1+8 -; .next_file: -; cmp ebx, esi -; jbe .fin -; cmp word [esi], "WA" -; jne .next_file -; cmp byte [esi+1], "V" -; jne .next_file -; .fin: - - ;mov eax, [fileinfo.first_block] - ;cmp eax, 1000 - ;jnl @f - ;mov [fileinfo.first_block], 0 - ;jmp main_loop - ;@@: - ;sub [fileinfo.first_block], 1000 - ;jmp main_loop - - incr_button: - ;add [fileinfo.first_block], 1000 - jmp main_loop - - volm_button: - inc byte [volume] - and byte [volume], 0x1f - jz volp_button - or [volume], 0x10000000 - jmp _print_volume -; jmp main_loop - - volp_button: - dec byte [volume] - and byte [volume], 0x1f - jz volm_button - or [volume], 0x10000000 -; jmp main_loop - - _print_volume: - movzx eax, byte [volume] - neg eax - add eax, 31 - dps "Volume: " - dpd eax - newline - jmp main_loop - - activate_textbox: - cmp [status], ST_DONE - jne main_loop - mov [textbox_active], 1 - call textbox_draw - jmp main_loop - - progressbar_click: - ;print "click on progress bar" - cmp [status], ST_DONE - je main_loop - mcall MF_GETMOUSE, MS_COORDS_WINDOW - shr eax, 16 ; get mouse.x - sub eax, 7 - jz @f - imul [file_size] - mov ebx, 286 - div ebx - @@: - ;dps "block: " - ;dpd eax - ;newline - and eax, not 511 - mov [fileinfo.first_byte], eax - call draw_progress_bar - jmp main_loop -ret - -;--------------------------------------------------------------------- - -PBAR_WIDTH = 286 - -draw_window: - mcall MF_DRAWSTATUS, DS_BEGIN - - mcall MF_WINDOW, <100,299>, <100,72>, 0x03404040 - - ; create six buttons - mov edi, 6 - mpack ebx, 7, 45 - mpack ecx, 24, 13 - mov edx, 0x10 - mov esi, 0xA0A0A0 - @@: - mcall MF_BUTTON - add ebx, 48 shl 16 - inc edx - dec edi - jnz @b - - mcall MF_TEXT, <8,8>, 0x10FFFFFF, header, header.size - - mcall ,<13,28>, 0x404040, buttons_text, buttons_text.size - sub ebx, 0x00010001 - mov ecx, 0xFFFFFF - mcall - - call draw_progress_bar - call textbox_draw - - mcall MF_DRAWSTATUS, DS_END -ret - -;--------------------------------------------------------------------- - -textbox_draw: - mcall MF_BUTTON, <7,285>, <55,10>, 0x60000020 - - mov edx, 0x808080 - cmp [textbox_active], 1 - jne @f - mov edx, 0xA0A0A0 - @@: - mcall MF_BAR, <7,286>, <55,11> - - movzx esi, [textbox_position] - mcall MF_TEXT, <10,56>, 0x404040, textbox_string -ret - -;--------------------------------------------------------------------- - -draw_progress_bar: - pushad - - mov eax, PBAR_WIDTH - mul [fileinfo.first_byte] - div [file_size] - - push eax - mcall MF_BAR, <7,286>, <41,11>, 0x808080 - mcall MF_BUTTON, , , 0x60000030 - pop eax - - mov bx, ax - mov edx, 0xA0A0A0 - mcall MF_BAR - - popad -ret - -;--------------------------------------------------------------------- - -sz header, "AC'97 WAV player - all PCM audio" -sz buttons_text, " Play Stop << >> Vol- Vol+" - -textbox_active db 0 -textbox_position db 0;textbox_string.size-1 -file_size dd 100 diff --git a/programs/media/ac97wav/trunk/includes.inc b/programs/media/ac97wav/trunk/includes.inc deleted file mode 100644 index d39bca5d72..0000000000 --- a/programs/media/ac97wav/trunk/includes.inc +++ /dev/null @@ -1,10 +0,0 @@ -include "MACROS.INC" -include "DEBUG.INC" -include "CONSTANT.INC" -include "AC97.INC" -include "PCI.INC" -include "CODEC.INC" -include "FRONTEND.INC" - - -MF_PCI = 62 diff --git a/programs/media/ac97wav/trunk/macros.inc b/programs/media/ac97wav/trunk/macros.inc deleted file mode 100644 index d290e9e09b..0000000000 --- a/programs/media/ac97wav/trunk/macros.inc +++ /dev/null @@ -1,268 +0,0 @@ -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if used name - db data - end if - common - if used name - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if (used name)&(lang eq lng) - db data - end if - common - if used name - .size = $-name - end if -} - - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,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 -} - - - -; language for programs -lang fix ru ; ru en fr ge fi - - - -; optimize the code for size -__regs fix - -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 \ No newline at end of file diff --git a/programs/media/ac97wav/trunk/meosfunc.inc b/programs/media/ac97wav/trunk/meosfunc.inc deleted file mode 100644 index c479bfb8ee..0000000000 --- a/programs/media/ac97wav/trunk/meosfunc.inc +++ /dev/null @@ -1,29 +0,0 @@ -MF_WINDOW = 0 -MF_GETKEY = 2 -MF_TEXT = 4 -MF_DELAY = 5 -MF_BUTTON = 8 -MF_PROCINFO = 9 - PN_MYSELF = -1 -MF_WAIT_EVENT = 10 -MF_DRAWSTATUS = 12 - DS_BEGIN = 1 - DS_END = 2 -MF_BAR = 13 -MF_GETBUTTON = 17 -MF_WAIT_EVENT_TIMEOUT = 23 -MF_GETMOUSE = 37 - MS_COORDS_WINDOW = 1 -MF_PORTS = 46 - PRT_RESERVE = 0 - PRT_FREE = 1 -MF_THREAD = 51 - THR_CREATE = 1 -MF_PCI = 62 -MF_EXIT = -1 -MF_INTERNAL_SERVICES = 68 - ALLOC_PHYS_MEM =5 - FREE_PHYS_MEM =6 - SET_PHYS_BUFFER =7 - GET_PHYS_BUFFER =8 -MF_SYSTREE = 70 \ No newline at end of file diff --git a/programs/media/ac97wav/trunk/pci.inc b/programs/media/ac97wav/trunk/pci.inc deleted file mode 100644 index 220d6326f7..0000000000 --- a/programs/media/ac97wav/trunk/pci.inc +++ /dev/null @@ -1,46 +0,0 @@ -PCI_CMD_REG = 04h ; reg 04, command reg - IO_ENA = 0x00000001 ; i/o decode enable - MEM_ENA = 0x00000002 ; memory decode enable - BM_ENA = 0x00000004 ; bus master enable - -pciRegRead8: ; register in CL! - mov bl, 4 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret - -pciRegRead16: - mov bl, 5 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret - -pciRegRead32: - mov bl, 6 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret - -pciRegWrite8: ; value in DL! - mov bl, 8 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret - -pciRegWrite16: - mov bl, 9 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret - -pciRegWrite32: - mov bl, 10 - mov bh, [bus] - mov ch, [devfn] - mcall MF_PCI -ret \ No newline at end of file diff --git a/programs/media/bmpview/trunk/bmpview.asm b/programs/media/bmpview/trunk/bmpview.asm deleted file mode 100644 index 267522c842..0000000000 --- a/programs/media/bmpview/trunk/bmpview.asm +++ /dev/null @@ -1,694 +0,0 @@ -; -; BMP VIEWER -; modified by Ivan Poddubny -; -; Compile with FASM for Menuet -; - - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd 0x300000 ; memory for app - dd 0xfff0 ; esp - dd I_Param , 0x0 ; I_Param , I_Icon - -include 'lang.inc' -include 'macros.inc' - - -START: ; start of execution - - cmp dword [I_Param],0 - je noparam - - cmp dword [I_Param],'BOOT' - jne noboot - call load_image - call set_as_background - mov eax,15 - mov ebx,4 - mov ecx,2 - int 0x40 - mov eax,15 - mov ebx,3 - int 0x40 - - or eax,-1 - int 0x40 - noboot: - - mov edi,name_string - mov al,0 - mov ecx,70 - rep stosb - - mov ecx,50 - mov edi,I_Param - repne scasb - sub edi,I_Param - mov ecx,edi - - mov esi,I_Param - mov edi,name_string - cld - rep movsb - call load_image - - noparam: - - call draw_window ; at first, draw the window - -still: - - mov eax,10 ; wait here for event - int 0x40 - - cmp eax,1 ; redraw request ? - je red - cmp eax,2 ; key in buffer ? - je key - cmp eax,3 ; button in buffer ? - je button - - jmp still - - red: ; redraw - call draw_window - jmp still - - key: ; key - mov eax,2 ; just read it and ignore - int 0x40 - jmp still - - button: ; button - mov eax,17 ; get id - int 0x40 - - cmp ah,1 ; button id=1 ? - jne noclose - mov eax,-1 ; close this program - int 0x40 - noclose: - - cmp ah,2 - jne no_file_name - call read_string - jmp still - no_file_name: - - cmp ah,3 - jne no_load_image - call load_image - call draw_window - jmp still - no_load_image: - - cmp ah,4 - jne no_setasbackground - call set_as_background - jmp still - no_setasbackground: - - cmp ah,5 - jne no_tiled - mov eax,15 - mov ebx,4 - mov ecx,1 - int 0x40 - mov eax,15 - mov ebx,3 - int 0x40 - jmp still - no_tiled: - - cmp ah,6 - jne no_stretch - mov eax,15 - mov ebx,4 - mov ecx,2 - int 0x40 - mov eax,15 - mov ebx,3 - int 0x40 - jmp still - no_stretch: - - - jmp still - -type dd 0x0 -i_pos dd 0x0 -x_size dd 0x1 -y_size dd 0x1 -bpp dd 0x24 - -temp dd 999 - -fileinfoblock: - - dd 0 ; 0 = read - dd 0 ; first 512 block - dd 1 ; number of blocks to read - dd 0x10000+1024 ; read to - dd 35 ; 17000 byte work area -name_string: - db '/HARDDISK/FIRST/MENUET/PICS/NEW.BMP',0 - times 100 db 0 - - -read_header: - - pusha - - mov edi,0x10000 - mov ecx,100 - mov eax,0 - cld - rep stosb - - mov [fileinfoblock+ 8],dword 1 - mov [fileinfoblock+12],dword 0x10000 - -push dword [name_string-4] -mov [name_string-4],dword 0x20000 - mov eax,58 - mov ebx,fileinfoblock - int 0x40 -pop dword [name_string-4] - - movzx eax,word [0x10000+0] - mov [type],eax - mov eax,[0x10000+10] - mov [i_pos],eax - mov eax,[0x10000+18] - mov [x_size],eax - mov eax,[0x10000+22] - mov [y_size],eax - movzx eax,word [0x10000+28] - mov [bpp],eax - - popa - ret - - -draw_picture_info: - - pusha - - mov eax,13 - mov ebx,380*65536+6*5 - mov ecx,65*65536+40 - mov edx,0xffffff - int 0x40 - - mov eax,47 - mov ebx,5*65536 - mov ecx,[x_size] - mov edx,380*65536+65 - mov esi,0x224466 - int 0x40 - - mov ecx,[y_size] - add edx,10 - int 0x40 - - mov ecx,[bpp] - add edx,20 - int 0x40 - - popa - ret - - - -load_image: - - pusha - - call read_header - - cmp word [type],'BM' - je ok_image - - cmp [bpp],24 - je ok_image - - mov eax,13 ; not found ! - mov ebx,150*65536+50 - mov ecx,100*65536+50 - mov edx,0xff0000 - int 0x40 - - mov eax,5 - mov ebx,100 - int 0x40 - - jmp retimage - - ok_image: - - call draw_picture_info - - mov [fileinfoblock+8],dword 0x100000/512 - mov eax,0x80000 - sub eax,[i_pos] - mov [fileinfoblock+12],eax -push dword [name_string-4] -mov [name_string-4],dword 0x20000 - mov eax,58 - mov ebx,fileinfoblock - int 0x40 -pop dword [name_string-4] - - mov eax,[x_size] - imul eax,3 - - mov [x_delta],eax - - mov ebx,[y_size] - dec ebx - imul eax,ebx - add eax,0x80000 - - mov esi,eax - mov edi,0x180000 - newln: - push esi - push edi - mov ecx,[x_delta] - cld - rep movsb - pop edi - pop esi - - sub esi,[x_delta];640*3 - add edi,[x_delta];640*3 - cmp esi,0x80000 - jge newln - - retimage: - - popa - - ret - -x_delta dd 0x1 - - -draw_image: - - pusha - -; mov eax,7 ; draw with putimage -; mov ebx,0x180000 -; mov ecx,200*65536+160 -; mov edx,14*65536+28 -; int 0x40 -; mov eax,5 -; mov ebx,200 -; int 0x40 - - mov ebx,0 ; show the image as 320x240 picture - mov ecx,0 - -times 6 db 0x90 - - newpix: - - push ebx - push ecx - - mov eax,[esp] - imul eax,[y_size] - - mov ebx,240 - xor edx,edx - div ebx - - imul eax,3 - imul eax,[x_size] - - mov esi,eax - - mov eax,[esp+4] - imul eax,[x_size] - - mov ebx,320 - xor edx,edx - div ebx - - imul eax,3 - - add esi,eax - mov edx,[0x180000+esi] - - - and edx,0xffffff - - pop ecx - pop ebx - - add ebx,20 - add ecx,40 - mov eax,1 - int 0x40 - add ebx,-20 - add ecx,-40 - - inc ebx - cmp ebx,320 - jb newpix - - xor ebx,ebx - - inc ecx - cmp ecx,240 - jb newpix - - popa - - ret - -set_as_background: - - pusha - - mov esi,0x180000 - new_smooth: - xor eax,eax - xor ebx,ebx - mov al,[esi] - mov bl,[esi+3] - add eax,ebx - mov bl,[esi+6] - add eax,ebx - mov bl,[esi+9] - add eax,ebx - shr eax,2 - and eax,0xff - inc esi - cmp esi,0x180000+640*480*3 - jbe new_smooth - - - mov eax,15 - mov ebx,1 - mov ecx,[x_size] - mov edx,[y_size] - int 0x40 - - mov eax,15 - mov ebx,5 - mov ecx,0x180000 - mov edx,0 - mov esi,640*480*3 - int 0x40 - - mov eax,15 - mov ebx,3 - int 0x40 - - - popa - - ret - -ya dd 300 -addr dd name_string -case_sens db 0 - - -read_string: -pusha - -mov edi,[addr] -mov eax,[addr] -mov eax,[eax-4] -mov [temp],eax - -add edi,eax - -call print_strings - -f11: -mov eax,10 -int 0x40 -cmp eax,2 -jne read_done -int 0x40 -shr eax,8 - -cmp eax,13 -je read_done - -cmp eax,192 -jne noclear - -xor eax,eax -mov [temp],eax -mov edi,[addr] -mov [edi-4],eax -mov ecx,49 -cld -rep stosb -mov edi,[addr] -call print_strings -jmp f11 - -noclear: - -cmp eax,8 -jnz nobsl -cmp [temp],0 -jz f11 -dec [temp] -mov edi,[addr] -add edi,[temp] -mov [edi],byte 0 - -mov eax,[addr] -dec dword [eax-4] - -call print_strings -jmp f11 - -nobsl: -cmp [temp],50 -jae read_done - -cmp eax,dword 31 -jbe f11 -cmp [case_sens],1 -je keyok -cmp eax,dword 95 -jb keyok -add eax,-32 -keyok: -mov edi,[addr] -add edi,[temp] -mov [edi],al - -inc [temp] - -mov eax,[addr] -inc dword [eax-4] -call print_strings -cmp [temp],50 -jbe f11 - -read_done: -mov ecx,50 -sub ecx,[temp] -mov edi,[addr] -add edi,[temp] -xor eax,eax -cld -rep stosb - -mov [temp],999 - -call print_strings - -popa -ret - -print_strings: -pusha -mov eax,13 -mov ebx,80*65536+6*45 -mov ecx,[ya] -shl ecx,16 -add ecx,12 -mov edx,0xffffff -int 0x40 - -mov edx,[addr] -mov esi,[edx-4] -mov eax,4 -mov ebx,80*65536+2 -add ebx,[ya] -mov ecx,0 -int 0x40 - -cmp [temp],50 -ja @f - -mov eax,[ya] -mov ebx,eax -shl eax,16 -add eax,ebx -add eax,10 -mov ecx,eax - -mov eax,[temp] -imul eax,eax,6 -add eax,80 -mov ebx,eax -shl eax,16 -add ebx,eax - -mov eax,38 -mov edx,0 -int 0x40 -@@: - -popa -ret - - - - -; ********************************************* -; ******* 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,20*65536+444 ; [x start] *65536 + [x size] - mov ecx,10*65536+333 ; [y start] *65536 + [y size] - mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl - mov esi,0x808899ff ; color of grab bar RRGGBB,8->color gl - mov edi,0x008899ff ; 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,0x10ddeeff ; color of text RRGGBB - mov edx,labelt ; pointer to text beginning - mov esi,labellen-labelt ; text length - int 0x40 - - mov eax,8 - mov ebx,20*65536+52 - mov ecx,295*65536+16 - mov edx,2 - mov esi,0x306090 - int 0x40 - - add ebx,336*65536+20 - add ecx,5*65536 - mov edx,3 - int 0x40 - - sub ecx,20*65536 - mov edx,4 - int 0x40 - - sub ecx,40*65536 - inc edx - int 0x40 - - add ecx,20*65536 - inc edx - int 0x40 - - mov ebx,346*65536+45 - mov edx,info+1 - mov esi,15 - newinfo: - mov ecx,[tcolor] - cmp [edx-1],byte 'w' - jne nowhite - mov ecx,[btcolor] - nowhite: - mov eax,4 - int 0x40 - add ebx,10 - add edx,16 - cmp [edx-1],byte 'x' - jne newinfo - - mov ebx,20*65536+300 ; draw info text with function 4 - mov ecx,[btcolor] - mov edx,text - mov esi,70 - newline: - mov eax,4 - int 0x40 - add ebx,10 - add edx,esi - cmp [edx],byte 'x' - jne newline - - call print_strings - - call draw_image - - call draw_picture_info - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw - int 0x40 - - ret - - -; DATA AREA - -tcolor dd 0x000000 -btcolor dd 0x224466+0x808080 - - -text: - db ' FILE: ' - db 'x' - -info: - db ' IMAGE INFO ' - db ' ' - db ' X: ' - db ' Y: ' - db ' ' - db ' BPP: ' - db ' ' - db ' ' - db ' 16M COLOURS ' - db ' 640x480 max ' -times 10 db ' ' - db 'w TILED ' - db ' ' - db 'w STRETCH ' - db ' ' - db 'w SET AS BGR ' - db ' ' - db 'w LOAD ' - db 'x' - - -labelt: db 'BMP VIEWER' -labellen: - -I_END: -I_Param: diff --git a/programs/media/bmpview/trunk/build_en.bat b/programs/media/bmpview/trunk/build_en.bat deleted file mode 100644 index 6985f4677c..0000000000 --- a/programs/media/bmpview/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm bmpview.asm bmpview -@pause \ No newline at end of file diff --git a/programs/media/bmpview/trunk/build_ru.bat b/programs/media/bmpview/trunk/build_ru.bat deleted file mode 100644 index 08fa54badf..0000000000 --- a/programs/media/bmpview/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm bmpview.asm bmpview -@pause \ No newline at end of file diff --git a/programs/media/bmpview/trunk/macros.inc b/programs/media/bmpview/trunk/macros.inc deleted file mode 100644 index d599dea0e0..0000000000 --- a/programs/media/bmpview/trunk/macros.inc +++ /dev/null @@ -1,267 +0,0 @@ -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if used name - db data - end if - common - if used name - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if (used name)&(lang eq lng) - db data - end if - common - if used name - .size = $-name - end if -} - - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,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 - -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 \ No newline at end of file diff --git a/programs/media/cdplay/trunk/build_en.bat b/programs/media/cdplay/trunk/build_en.bat deleted file mode 100644 index 7ace3f3995..0000000000 --- a/programs/media/cdplay/trunk/build_en.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix en >lang.inc -@fasm cdplay.asm cdplay -@pause \ No newline at end of file diff --git a/programs/media/cdplay/trunk/build_ru.bat b/programs/media/cdplay/trunk/build_ru.bat deleted file mode 100644 index dce6a76326..0000000000 --- a/programs/media/cdplay/trunk/build_ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@erase lang.inc -@echo lang fix ru >lang.inc -@fasm cdplay.asm cdplay -@pause \ No newline at end of file diff --git a/programs/media/cdplay/trunk/cdplay.asm b/programs/media/cdplay/trunk/cdplay.asm deleted file mode 100644 index b516cc4e55..0000000000 --- a/programs/media/cdplay/trunk/cdplay.asm +++ /dev/null @@ -1,482 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; -; CD PLAYER - Compile with fasm -; - -use32 - - org 0x0 - db 'MENUET00' ; 8 byte id - dd 38 ; required os - dd START ; program start - dd I_END ; program image size - dd 0x1000 ; reguired amount of memory - dd 0x1000 - dd 0x00000000 ; reserved=no extended header - -include 'lang.inc' -include 'macros.inc' - -START: - - call draw_window - -still: - - mov eax,10 - 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,byte 41 - jnz nostop - call stop - jmp still - nostop: - - cmp ah,byte 42 - jnz nogetinfo - call getinfo - jmp still - nogetinfo: - - pusha - - cmp ah,100 - jnz err - - jmp noerr - - err: - - xor ecx,ecx - mov cl,ah - shl ecx,3 - add ecx,cdinfo - add ecx,1 - xor ebx,ebx - mov ebx,[ecx] - and ebx,0x00ffffff - mov ecx,ebx - - mov ebx,1 - mov eax,24 - int 0x40 - - cmp eax,0 - je noerr - - error: - - mov eax,13 - mov ebx,10*65536+215 - mov ecx,115*65536+13 - mov edx,0x0088aacc - int 0x40 - - mov eax,dword 0x00000004 ; write text - mov ebx,12*65536+117 - mov ecx,[tcolor] - mov edx,infotext2 - mov esi,itl2-infotext2 - int 0x40 - - mov eax,5 - mov ebx,200 - int 0x40 - - noerr: - - popa - - shr eax,8 - and eax,255 - mov ebx,0 - mov ecx,10 - - cmp eax,100 - jnz noend - mov eax,-1 - int 0x40 - noend: - - newc: - - cmp eax,ecx - jb dri - inc ebx - sub eax,ecx - - jmp newc - - - dri: - - mov ecx,48 - add ebx,ecx - mov [infotext+0],bl - add eax,ecx - mov [infotext+1],al - call drawinfo - jmp still - - -getinfo: - - mov eax,24 ; get info - mov ebx,1 - mov ecx,0x010100 - int 0x40 - - cmp eax,0 - jnz gierror - - mov eax,13 - mov ebx,10*65536+215 - mov ecx,115*65536+13 - mov edx,0x0088aacc - int 0x40 - mov eax,dword 0x00000004 ; write text - mov ebx,12*65536+117 - mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color - mov edx,infotext3 ; pointer to text beginning - mov esi,itl3-infotext3 ; text length - int 0x40 - - mov eax,5 - mov ebx,100*10 - int 0x40 - - mov eax,24 ; get info - mov ebx,2 - mov ecx,cdinfo - mov edx,256 - int 0x40 - - cmp eax,0 - jz gi1 - - gierror: - - mov eax,13 - mov ebx,10*65536+215 - mov ecx,115*65536+13 - mov edx,0x0088aacc - int 0x40 - - mov eax,dword 0x00000004 ; write text - mov ebx,12*65536+117 - mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color - mov edx,infotext2 ; pointer to text beginning - mov esi,itl2-infotext2 ; text length - int 0x40 - - mov eax,5 - mov ebx,200 - int 0x40 - - gi1: - - call drawinfo - ret - - - -stop: - - mov eax,24 ; get info - mov ebx,3 - int 0x40 - - ret - - - -; info bar - - -drawinfo: - - - ; end - - xor eax,eax - xor ebx,ebx - mov ecx,10 - mov al,[cdinfo+3] - cld - - newco: - - cmp eax,ecx - jb noco - - add ebx,1 - sub eax,ecx - jmp newco - - noco: - - add al,48 - mov [infotext+32],al - - add bl,48 - mov [infotext+31],bl - - - ; start - - xor eax,eax - xor ebx,ebx - mov al,[cdinfo+2] - cld - - newco2: - - cmp eax,ecx - jb noco2 - - add ebx,1 - sub eax,ecx - jmp newco2 - - noco2: - - add al,48 - mov [infotext+17],al - - add bl,48 - mov [infotext+16],bl - - mov eax,13 - mov ebx,10*65536+219 - mov ecx,115*65536+13 - mov edx,[col] - sub edx,0x101010 - int 0x40 - - mov eax,4 ; write text - mov ebx,12*65536+117 - mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color - mov edx,infotext ; pointer to text beginning - mov esi,itl-infotext ; text length - int 0x40 - - ret - - -draw_window: - - pusha - - mov eax,12 ; tell os about redraw - mov ebx,1 - int 0x40 - - mov eax,0 ; define and draw window - mov ebx,170*65536+240 - mov ecx,40*65536+135 - mov edx,0x00b6aaff - mov esi,0x80b9aaff; bbee - 0x202020 - mov edi,0x00b9aaff ;bbee - mov edx,[col] - add edx,0x00000000 - mov esi,[col] - add esi,0x80000000 - mov edi,[col] - int 0x40 - - mov eax,4 ; write text - mov ebx,8*65536+8 - mov ecx,[tcolor] - mov edx,labelt - mov esi,labellen-labelt - int 0x40 - - mov eax,8 ; CLOSE BUTTON - mov ebx,(240-18)*65536+10 - mov ecx,6 *65536+10 - mov edx,100 - mov esi,[col] - sub esi,0x302010 - int 0x40 - - - ; first row - - mov eax,8 ; button - mov edx,1 ; button number - mov ebx,9*65536+21 ; button start x & size - mov ecx,30*65536+13 ; button start y & size - mov esi,[bcolor] ; button color - newbutton1: - pusha - int 0x40 - popa - - pusha - mov eax,dword 0x00000004 - and ebx,65535*65536 - shr ecx,16 - add ebx,ecx - add ebx,6*65536+3 - mov ecx,[tcolor] - shl edx,1 - add edx,nro-2 - mov esi,2 - int 0x40 - popa - - add ebx,22*65536 - inc edx - cmp edx,11 - jnz newbutton1 - - ; second row - - mov eax,8 ; button - mov edx,11 ; button number - mov ebx,9*65536+21 ; button start x & size - mov ecx,50*65536+13 ; button start y & size - mov esi,[bcolor] ; button color - newbutton2: - pusha - int 0x40 - popa - - pusha - mov eax,dword 0x00000004 - and ebx,65535*65536 - shr ecx,16 - add ebx,ecx - add ebx,6*65536+3 - mov ecx,[tcolor] - shl edx,1 - add edx,nro2-2-20 - mov esi,2 - int 0x40 - popa - - - add ebx,22*65536 - inc edx - cmp edx,21 - jnz newbutton2 - - ; third row - - mov eax,8 ; button - mov edx,21 ; button number - mov ebx,9*65536+21 ; button start x & size - mov ecx,70*65536+13 ; button start y & size - mov esi,[bcolor] ; button color - newbutton3: - pusha - int 0x40 - popa - - pusha - mov eax,dword 0x00000004 - and ebx,65535*65536 - shr ecx,16 - add ebx,ecx - add ebx,6*65536+3 - mov ecx,[tcolor] - shl edx,1 - add edx,nro3-2-40 - mov esi,2 - int 0x40 - popa - - add ebx,22*65536 - inc edx - cmp edx,31 - jnz newbutton3 - - - ; fourth row - - mov eax,8 ; button - mov edx,41 ; button number - mov ebx,9*65536+109 ; button start x & size - mov ecx,90*65536+13 ; button start y & size - mov esi,0x00aabbcc ; button color - newbutton4: - pusha - int 0x40 - popa - - pusha - mov eax,4 - and ebx,65535*65536 - shr ecx,16 - add ebx,ecx - add ebx,9*65536+3 - mov ecx,[tcolor] - sub edx,41 - shl edx,4 - add edx,text - mov esi,16 - int 0x40 - popa - - add ebx,110*65536 - inc edx - cmp edx,43 - jnz newbutton4 - - call drawinfo - - mov eax,12 ; tell os about redraw end - mov ebx,2 - int 0x40 - - popa - ret - - - - -; DATA AREA - -col dd 0x7777aa -tcolor dd 0xffffff -bcolor dd 0xaabbcc -labelt: db 'CD PLAYER' -labellen: -infotext: db '01 First Track: xx Last Track: xx ' -itl: -infotext2: db 'DEFINE CD ROM BASE WITH SETUP ' -itl2: -infotext3: db 'READING PLAYLIST - (10 secs) ' -itl3: -nro: db '01020304050607080910' -nro2: db '11121314151617181920' -nro3: db '21222324252627282930' -text: db ' STOP READ PLAYLIST ' - -cdinfo: - -I_END: - - - diff --git a/programs/media/cdplay/trunk/macros.inc b/programs/media/cdplay/trunk/macros.inc deleted file mode 100644 index 1d153e8723..0000000000 --- a/programs/media/cdplay/trunk/macros.inc +++ /dev/null @@ -1,266 +0,0 @@ -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if used name - db data - end if - common - if used name - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - end if - forward - if (used name)&(lang eq lng) - db data - end if - common - if used name - .size = $-name - end if -} - - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,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 - -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 \ No newline at end of file diff --git a/programs/media/midamp/trunk/MIDAMP.ASM b/programs/media/midamp/trunk/MIDAMP.ASM index f27246f657..2deb906683 100644 --- a/programs/media/midamp/trunk/MIDAMP.ASM +++ b/programs/media/midamp/trunk/MIDAMP.ASM @@ -58,7 +58,7 @@ use32 dd START dd I_END dd APP_MEM - dd APP_MEM ;stack size=1024 + dd APP_MEM - 1024 dd I_PARAM listsel dd 0 channel dd 0 @@ -357,7 +357,7 @@ file_info: dd 0 dd 0 dd 0 -fsize dd APP_MEM-1024-workarea ; max size +fsize dd APP_MEM-2048-workarea ; max size dd workarea I_END: ; конец программы filename: diff --git a/programs/media/midamp/trunk/macros.inc b/programs/media/midamp/trunk/macros.inc index d599dea0e0..14185dbfce 100644 --- a/programs/media/midamp/trunk/macros.inc +++ b/programs/media/midamp/trunk/macros.inc @@ -1,267 +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 - -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 +; 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 + +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 \ No newline at end of file diff --git a/programs/system/pic4/trunk/build_en.bat b/programs/media/pic4/trunk/build_en.bat similarity index 100% rename from programs/system/pic4/trunk/build_en.bat rename to programs/media/pic4/trunk/build_en.bat diff --git a/programs/system/pic4/trunk/build_ru.bat b/programs/media/pic4/trunk/build_ru.bat similarity index 100% rename from programs/system/pic4/trunk/build_ru.bat rename to programs/media/pic4/trunk/build_ru.bat diff --git a/programs/fs/rdfdel/trunk/macros.inc b/programs/media/pic4/trunk/macros.inc similarity index 86% rename from programs/fs/rdfdel/trunk/macros.inc rename to programs/media/pic4/trunk/macros.inc index 1d153e8723..14185dbfce 100644 --- a/programs/fs/rdfdel/trunk/macros.inc +++ b/programs/media/pic4/trunk/macros.inc @@ -1,266 +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 - -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 +; 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 + +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 \ No newline at end of file diff --git a/programs/system/pic4/trunk/pic4.asm b/programs/media/pic4/trunk/pic4.asm similarity index 93% rename from programs/system/pic4/trunk/pic4.asm rename to programs/media/pic4/trunk/pic4.asm index 09cb29f3f9..b8fdb61d1d 100644 --- a/programs/system/pic4/trunk/pic4.asm +++ b/programs/media/pic4/trunk/pic4.asm @@ -1,679 +1,679 @@ -; -; BACKGROUND SET - Compile with fasm -; - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; version - dd START ; program start - dd I_END ; image size - dd 0x80000 ; reguired amount of memory - dd 0x80000 ; stack pointer - dd I_Param,0 - - include 'lang.inc' - include 'macros.inc' - -START: - - call check_parameters - call draw_window - - call load_texture - call draw_image - -still: - - mov eax,10 ; wait here for event - int 0x40 - cmp eax,1 - jz red - cmp eax,2 - jz key - cmp eax,3 - jz button - jmp still - - key: - mov eax,2 - int 0x40 - jmp still - - red: - call draw_window - jmp still - - button: - mov eax,17 - int 0x40 - - shr eax,8 - and eax,255 - - cmp eax,101 ; tiled - jne no101 - mov eax,15 - mov ebx,4 - mov ecx,1 - int 0x40 - mov eax,15 - mov ebx,3 - int 0x40 - jmp still - no101: - - cmp eax,102 ; stretch - jne no102 - mov eax,15 - mov ebx,4 - mov ecx,2 - int 0x40 - mov eax,15 - mov ebx,3 - int 0x40 - jmp still - no102: - - cmp eax,1 ; end program - jnz noproend - or eax,-1 - int 0x40 - noproend: - - cmp eax,11 - jz bg - cmp eax,12 - jz bg - cmp eax,13 - jz bg - - cmp eax,121 - jb no_bg_select - cmp eax,133 - jg no_bg_select - sub eax,121 - shl eax,2 - add eax,arrays - mov eax,[eax] - mov [usearray],eax - call load_texture - call draw_image - jmp still - no_bg_select: - - cmp eax,14+20 - jge bg4 - - jmp bg2 - - -check_parameters: - - cmp [I_Param],dword 'BOOT' - je @f - ret - @@: - - call load_texture - - mov eax,15 - mov ebx,1 - mov ecx,256 - mov edx,256 - int 0x40 - - mov eax,15 - mov ebx,5 - mov ecx,0x40000 ; <<< 0x40000 for blue, 0x40000+1 for red, - ; <<< 0x40000+2 for green background at boot - mov edx,0 - mov esi,256*3*256 - int 0x40 - - mov eax,15 - mov ebx,4 - mov ecx,2 - int 0x40 - - mov eax,15 - mov ebx,3 - int 0x40 - - mov eax,-1 - int 0x40 - - - -set_picture: - - mov eax,image+99-3*16 - mov ebx,0x40000+255*3+255*3*256 - newpix: - mov ecx,[eax] - mov [ebx],cx - shr ecx,16 - mov [ebx+2],cl - add eax,3 - sub ebx,3 - cmp ebx,0x40002 - jge newpix - - ret - - -load_texture: - - call gentexture - call set_picture - - ret - - -; set background - -bg: - - mov edi,0x40000 - - cmp eax,12 - jnz bb1 - mov edi,0x40000+1 - bb1: - cmp eax,13 - jnz bb2 - mov edi,0x40000+2 - bb2: - - mov eax,15 - mov ebx,1 - mov ecx,256 - mov edx,256 - int 0x40 - - mov eax,15 - mov ebx,5 - mov ecx,edi - mov edx,0 - mov esi,256*256*3 - int 0x40 - - mov eax,15 - mov ebx,3 - int 0x40 - - jmp still - - -; colored background - -bg2: - - push eax - - mov eax,15 - mov ebx,1 - mov ecx,8 - mov edx,8 - int 0x40 - - mov eax,[esp] - - sub eax,14 - shl eax,2 - - mov edx,[colors+eax] - - mov esi,32*32*4 - mov edi,0 - mov ecx,0 - dbl2: - mov eax,15 - mov ebx,2 - int 0x40 - add ecx,3 - inc edi - cmp edi,esi - jb dbl2 - - - mov eax,15 - mov ebx,3 - int 0x40 - - jmp still - - -; shaped background - -bg4: - - sub eax,14+20 - shl eax,3 - add eax,shape - mov ecx,[eax+0] - mov edx,[eax+4] - - mov eax,15 - mov ebx,1 - int 0x40 - - mov eax,15 - mov ebx,3 - int 0x40 - - jmp still - - -; ********************************************* -; ******* CELLULAR TEXTURE GENERATION ********* -; **** by Cesare Castiglia (dixan/sk/mfx) ***** -; ********* dixan@spinningkids.org ********** -; ********************************************* -; * the algorythm is kinda simple. the color * -; * component for every pixel is evaluated * -; * according to the squared distance from * -; * the closest point in 'ptarray'. * -; ********************************************* - -gentexture: - - mov ecx,0 ; ycounter - mov edi,0 ; pixel counter - - mov ebp,[usearray] - - ylup: - mov ebx,0 - -; call precalcbar - - xlup: - push edi - mov edi, 0 - mov esi, 512000000 ; abnormous initial value :) - - pixlup: - push esi -; add edi,4 - mov eax,ebx ; evaluate first distance - sub eax, [ebp+edi] ; x-x1 - call wrappit - imul eax - mov esi, eax ; (x-x1)^2 - mov eax, ecx - add edi,4 - sub eax, [ebp+edi] ; y-y1 - call wrappit - imul eax ; (y-y1)^2 - add eax,esi ; (x-x1)^2+(y-y1)^2 - pop esi - - cmp esi,eax - jb ok ; compare and take the smaller one - mov esi,eax - - ok: - add edi,4 - cmp [ebp+edi],dword 777 - jne pixlup - - mov eax,esi ; now evaluate color... - -; cmp eax,255*24 -; jbe ok2 -; imul eax,12 -; ok2: - - mov edi,24 ; 50 = max shaded distance - idiv edi - - pop edi - mov [image+51+edi],eax - add edi,3 - - add ebx,1 ; bounce x loop - cmp ebx,256 ; xsize - jne xlup - - add ecx,1 - cmp ecx,256 ; ysize - jne ylup - - ret - -wrappit: - cmp eax,0 ; this makes the texture wrap - jg noabs - neg eax - noabs: - cmp eax,128 - jb nowrap - neg eax - add eax,256 - nowrap: - ret - -;precalcbar: -; pusha -; mov eax,1 -; mov ebx,ecx -; add ebx,18 -; mov ecx,44 -; mov edx,0x00000060 -; bar: -; add ecx,2 -; add edx,0x00020100 -; int 0x40 -; cmp ecx,298 -; jb bar -; popa -; ret - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ********* -; ********************************************* - - -draw_image: - - mov eax,7 - mov ebx,0x40000 - mov ecx,256*65536+255 - mov edx,19*65536+65;55 - int 0x40 - - ret - - -y_add equ 44 ; 30 -y_s equ 13 - -y_add2 equ 340 ;325 -set equ 0 ;15 - -button_color equ 0A0A0A0h ; 207090 306090h -wnd_color equ 3B0B0B0h ; 34090B0h - - -draw_window: - - mov eax, 12 ; tell os about draw - mov ebx, 1 - int 0x40 - - mov eax, 0 ; define and draw window - mov ebx, 220*65536+293 - mov ecx, 50*65536+408 - mov edx, wnd_color - int 0x40 - - call draw_image - - mov eax,8 ; Blue button - mov ebx,(set+195+27)*65536+17 - mov ecx,y_add*65536+y_s - mov edx,11 - mov esi,0x004444cc - int 0x40 - mov eax,8 ; Red button - mov ebx,(set+213+27)*65536+17 - mov edx,12 - mov esi,0x00cc4444 - int 0x40 - mov eax,8 ; Green button - mov ebx,(set+258)*65536+17 - mov edx,13 - mov esi,0x0044cc44 - int 0x40 - - mov eax, 8 ; tiled - mov ebx, 96*65536+63 - mov ecx, y_add*65536+y_s - mov edx, 101 - mov esi, button_color - int 0x40 - - mov eax, 8 ; stretch - mov ebx, 160*65536+61 - mov edx, 102 - int 0x40 - - mov eax, 4 ; window header - mov ebx, 8*65536+8 - mov ecx, 0x10ffffff - mov edx, header - mov esi, header.size - int 0x40 - - mov ebx, 220*65536+30 - mov ecx, 0 - mov edx, apply_text - mov esi, apply_text.size - int 0x40 - - mov ebx, 19*65536+326 - mov edx, image_buttons_text - mov esi, image_buttons_text.size - int 0x40 - - mov ebx, 19*65536+(y_add2+27) - mov edx, simple_text - mov esi, simple_text.size - int 0x40 - - mov ecx, (y_add2)*65536+20 - mov ebx, (18)*65536+25 - mov edx, 121 - mov esi, button_color - mov edi, 9 - mov eax, 8 - @@: - int 0x40 - add ebx, 29*65536 - inc edx - dec edi - jnz @b - - - mov edx, 34+4 - mov edi, 4 - mov eax, 8 - mov ebx, 18*65536+18 - mov ecx, y_add*65536+y_s - @@: - int 0x40 - inc edx - add ebx, 19*65536 - dec edi - jnz @b - - - ;----------------------- - mov edx,14 ; button number - mov ebx,(18)*65536+17 ; button start x & size - mov ecx,(y_add2+40)*65536+14 ; button start y & size - - newcb: - mov esi,[(edx-14)*4+colors] - - mov eax,8 - int 0x40 - - inc edx - add ebx,20*65536 - add esi,5*256*256 - - cmp edx,27 - jnz newcb - ;----------------------- - - mov eax, 4 - mov ebx, 8*65536+4+y_add - mov ecx, 0 - mov edx, la2 - mov esi, la2.size - int 0x40 - - mov eax,12 - mov ebx,2 - int 0x40 - - ret - - - -; DATA SECTION - -lsz header,\ - ru, "Генератор фона рабочего стола",\ - en, "BACKGROUND" - -lsz apply_text,\ - ru, "Применить:",\ - en, "Apply:" - -lsz image_buttons_text,\ - ru, "Выберите образец:",\ - en, "Select pattern:" - -lsz simple_text,\ - ru, "Одноцветный фон:",\ - en, "Single-color background:" - -lsz la2,\ - ru, " ЗАМОСТИТЬ РАСТЯНУТЬ",\ - en, " TILED STRETCH" - - -xx db 'x' - -colors: - dd 0x770000 - dd 0x007700 - dd 0x000077 - dd 0x777700 - dd 0x770077 - dd 0x007777 - dd 0x777777 - dd 0x335577 - dd 0x775533 - dd 0x773355 - dd 0x553377 - dd 0x000000 - dd 0xcccccc - - -shape: - - dd 1024,64 - dd 1024,32 - dd 2048,32 - dd 4096,32 - - dd 512,16 - dd 1024,16 - dd 2048,16 - dd 4096,16 - - dd 64,32 - dd 64,16 - dd 32,32 - dd 8,8 - dd 16,16 - dd 64,64 - -usearray dd ptarray - -arrays dd ptarray,ptarray2,ptarray3,ptarray4,ptarray5,ptarray6 - dd ptarray7,ptarray8,ptarray9 - -ptarray: - - dd 150,50 - dd 120,30 - dd 44,180 - dd 50,66 - dd 27,6 - dd 95,212 - dd 128,177 - dd 201,212 - dd 172,201 - dd 250,100 - dd 24,221 - dd 11,123 - dd 248,32 - dd 34,21 - dd 777 ; <- end of array - -ptarray2: - - dd 0,0,50,50,100,100,150,150,200,200,250,250 - dd 50,150,150,50,200,100,100,200 - dd 777 - -ptarray3: - - dd 55,150,150,55,200,105,105,200 - dd 30,30,220,220 - dd 777 - -ptarray4: - - dd 196,0,196,64,196,128,196,196 - dd 64,32,64,96,64,150,64,228 - dd 777 - -ptarray5: - - dd 196,0,196,64,196,128,196,196 - dd 64,0,64,64,64,128,64,196 - dd 777 - -ptarray6: - - dd 49,49,128,50,210,50 - dd 50,128,128,128,210,128 - dd 50,210,128,210,210,210 - - dd 777 - -ptarray7: - - dd 0,0 - dd 196,196,64,64 - dd 128,0 - dd 0,128 - dd 64,64,196,64 - dd 196,196,64,196 - dd 128,128 - - dd 777 - -ptarray8: - - dd 0, 128 - dd 0, 128 - dd 128, 0 - dd 0, 128 - dd 128, 0 - dd 0, 128 - dd 128, 0 - dd 0, 128 - dd 128, 0 - dd 128, 128 - - dd 777 - -ptarray9: - - - dd 0,248,64,128,128,64,196,48,160,160,94,224,240,96,5,5,777 - - - -I_Param: - -image: - - +; +; BACKGROUND SET - Compile with fasm +; + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; version + dd START ; program start + dd I_END ; image size + dd 0x80000 ; reguired amount of memory + dd 0x80000 ; stack pointer + dd I_Param,0 + + include 'lang.inc' + include 'macros.inc' + +START: + + call check_parameters + call draw_window + + call load_texture + call draw_image + +still: + + mov eax,10 ; wait here for event + int 0x40 + cmp eax,1 + jz red + cmp eax,2 + jz key + cmp eax,3 + jz button + jmp still + + key: + mov eax,2 + int 0x40 + jmp still + + red: + call draw_window + jmp still + + button: + mov eax,17 + int 0x40 + + shr eax,8 + and eax,255 + + cmp eax,101 ; tiled + jne no101 + mov eax,15 + mov ebx,4 + mov ecx,1 + int 0x40 + mov eax,15 + mov ebx,3 + int 0x40 + jmp still + no101: + + cmp eax,102 ; stretch + jne no102 + mov eax,15 + mov ebx,4 + mov ecx,2 + int 0x40 + mov eax,15 + mov ebx,3 + int 0x40 + jmp still + no102: + + cmp eax,1 ; end program + jnz noproend + or eax,-1 + int 0x40 + noproend: + + cmp eax,11 + jz bg + cmp eax,12 + jz bg + cmp eax,13 + jz bg + + cmp eax,121 + jb no_bg_select + cmp eax,133 + jg no_bg_select + sub eax,121 + shl eax,2 + add eax,arrays + mov eax,[eax] + mov [usearray],eax + call load_texture + call draw_image + jmp still + no_bg_select: + + cmp eax,14+20 + jge bg4 + + jmp bg2 + + +check_parameters: + + cmp [I_Param],dword 'BOOT' + je @f + ret + @@: + + call load_texture + + mov eax,15 + mov ebx,1 + mov ecx,256 + mov edx,256 + int 0x40 + + mov eax,15 + mov ebx,5 + mov ecx,0x40000 ; <<< 0x40000 for blue, 0x40000+1 for red, + ; <<< 0x40000+2 for green background at boot + mov edx,0 + mov esi,256*3*256 + int 0x40 + + mov eax,15 + mov ebx,4 + mov ecx,2 + int 0x40 + + mov eax,15 + mov ebx,3 + int 0x40 + + mov eax,-1 + int 0x40 + + + +set_picture: + + mov eax,image+99-3*16 + mov ebx,0x40000+255*3+255*3*256 + newpix: + mov ecx,[eax] + mov [ebx],cx + shr ecx,16 + mov [ebx+2],cl + add eax,3 + sub ebx,3 + cmp ebx,0x40002 + jge newpix + + ret + + +load_texture: + + call gentexture + call set_picture + + ret + + +; set background + +bg: + + mov edi,0x40000 + + cmp eax,12 + jnz bb1 + mov edi,0x40000+1 + bb1: + cmp eax,13 + jnz bb2 + mov edi,0x40000+2 + bb2: + + mov eax,15 + mov ebx,1 + mov ecx,256 + mov edx,256 + int 0x40 + + mov eax,15 + mov ebx,5 + mov ecx,edi + mov edx,0 + mov esi,256*256*3 + int 0x40 + + mov eax,15 + mov ebx,3 + int 0x40 + + jmp still + + +; colored background + +bg2: + + push eax + + mov eax,15 + mov ebx,1 + mov ecx,8 + mov edx,8 + int 0x40 + + mov eax,[esp] + + sub eax,14 + shl eax,2 + + mov edx,[colors+eax] + + mov esi,32*32*4 + mov edi,0 + mov ecx,0 + dbl2: + mov eax,15 + mov ebx,2 + int 0x40 + add ecx,3 + inc edi + cmp edi,esi + jb dbl2 + + + mov eax,15 + mov ebx,3 + int 0x40 + + jmp still + + +; shaped background + +bg4: + + sub eax,14+20 + shl eax,3 + add eax,shape + mov ecx,[eax+0] + mov edx,[eax+4] + + mov eax,15 + mov ebx,1 + int 0x40 + + mov eax,15 + mov ebx,3 + int 0x40 + + jmp still + + +; ********************************************* +; ******* CELLULAR TEXTURE GENERATION ********* +; **** by Cesare Castiglia (dixan/sk/mfx) ***** +; ********* dixan@spinningkids.org ********** +; ********************************************* +; * the algorythm is kinda simple. the color * +; * component for every pixel is evaluated * +; * according to the squared distance from * +; * the closest point in 'ptarray'. * +; ********************************************* + +gentexture: + + mov ecx,0 ; ycounter + mov edi,0 ; pixel counter + + mov ebp,[usearray] + + ylup: + mov ebx,0 + +; call precalcbar + + xlup: + push edi + mov edi, 0 + mov esi, 512000000 ; abnormous initial value :) + + pixlup: + push esi +; add edi,4 + mov eax,ebx ; evaluate first distance + sub eax, [ebp+edi] ; x-x1 + call wrappit + imul eax + mov esi, eax ; (x-x1)^2 + mov eax, ecx + add edi,4 + sub eax, [ebp+edi] ; y-y1 + call wrappit + imul eax ; (y-y1)^2 + add eax,esi ; (x-x1)^2+(y-y1)^2 + pop esi + + cmp esi,eax + jb ok ; compare and take the smaller one + mov esi,eax + + ok: + add edi,4 + cmp [ebp+edi],dword 777 + jne pixlup + + mov eax,esi ; now evaluate color... + +; cmp eax,255*24 +; jbe ok2 +; imul eax,12 +; ok2: + + mov edi,24 ; 50 = max shaded distance + idiv edi + + pop edi + mov [image+51+edi],eax + add edi,3 + + add ebx,1 ; bounce x loop + cmp ebx,256 ; xsize + jne xlup + + add ecx,1 + cmp ecx,256 ; ysize + jne ylup + + ret + +wrappit: + cmp eax,0 ; this makes the texture wrap + jg noabs + neg eax + noabs: + cmp eax,128 + jb nowrap + neg eax + add eax,256 + nowrap: + ret + +;precalcbar: +; pusha +; mov eax,1 +; mov ebx,ecx +; add ebx,18 +; mov ecx,44 +; mov edx,0x00000060 +; bar: +; add ecx,2 +; add edx,0x00020100 +; int 0x40 +; cmp ecx,298 +; jb bar +; popa +; ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ********* +; ********************************************* + + +draw_image: + + mov eax,7 + mov ebx,0x40000 + mov ecx,256*65536+255 + mov edx,19*65536+65;55 + int 0x40 + + ret + + +y_add equ 44 ; 30 +y_s equ 13 + +y_add2 equ 340 ;325 +set equ 0 ;15 + +button_color equ 0A0A0A0h ; 207090 306090h +wnd_color equ 3B0B0B0h ; 34090B0h + + +draw_window: + + mov eax, 12 ; tell os about draw + mov ebx, 1 + int 0x40 + + mov eax, 0 ; define and draw window + mov ebx, 220*65536+293 + mov ecx, 50*65536+408 + mov edx, wnd_color + int 0x40 + + call draw_image + + mov eax,8 ; Blue button + mov ebx,(set+195+27)*65536+17 + mov ecx,y_add*65536+y_s + mov edx,11 + mov esi,0x004444cc + int 0x40 + mov eax,8 ; Red button + mov ebx,(set+213+27)*65536+17 + mov edx,12 + mov esi,0x00cc4444 + int 0x40 + mov eax,8 ; Green button + mov ebx,(set+258)*65536+17 + mov edx,13 + mov esi,0x0044cc44 + int 0x40 + + mov eax, 8 ; tiled + mov ebx, 96*65536+63 + mov ecx, y_add*65536+y_s + mov edx, 101 + mov esi, button_color + int 0x40 + + mov eax, 8 ; stretch + mov ebx, 160*65536+61 + mov edx, 102 + int 0x40 + + mov eax, 4 ; window header + mov ebx, 8*65536+8 + mov ecx, 0x10ffffff + mov edx, header + mov esi, header.size + int 0x40 + + mov ebx, 220*65536+30 + mov ecx, 0 + mov edx, apply_text + mov esi, apply_text.size + int 0x40 + + mov ebx, 19*65536+326 + mov edx, image_buttons_text + mov esi, image_buttons_text.size + int 0x40 + + mov ebx, 19*65536+(y_add2+27) + mov edx, simple_text + mov esi, simple_text.size + int 0x40 + + mov ecx, (y_add2)*65536+20 + mov ebx, (18)*65536+25 + mov edx, 121 + mov esi, button_color + mov edi, 9 + mov eax, 8 + @@: + int 0x40 + add ebx, 29*65536 + inc edx + dec edi + jnz @b + + + mov edx, 34+4 + mov edi, 4 + mov eax, 8 + mov ebx, 18*65536+18 + mov ecx, y_add*65536+y_s + @@: + int 0x40 + inc edx + add ebx, 19*65536 + dec edi + jnz @b + + + ;----------------------- + mov edx,14 ; button number + mov ebx,(18)*65536+17 ; button start x & size + mov ecx,(y_add2+40)*65536+14 ; button start y & size + + newcb: + mov esi,[(edx-14)*4+colors] + + mov eax,8 + int 0x40 + + inc edx + add ebx,20*65536 + add esi,5*256*256 + + cmp edx,27 + jnz newcb + ;----------------------- + + mov eax, 4 + mov ebx, 8*65536+4+y_add + mov ecx, 0 + mov edx, la2 + mov esi, la2.size + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + ret + + + +; DATA SECTION + +lsz header,\ + ru, "Генератор фона рабочего стола",\ + en, "BACKGROUND" + +lsz apply_text,\ + ru, "Применить:",\ + en, "Apply:" + +lsz image_buttons_text,\ + ru, "Выберите образец:",\ + en, "Select pattern:" + +lsz simple_text,\ + ru, "Одноцветный фон:",\ + en, "Single-color background:" + +lsz la2,\ + ru, " ЗАМОСТИТЬ РАСТЯНУТЬ",\ + en, " TILED STRETCH" + + +xx db 'x' + +colors: + dd 0x770000 + dd 0x007700 + dd 0x000077 + dd 0x777700 + dd 0x770077 + dd 0x007777 + dd 0x777777 + dd 0x335577 + dd 0x775533 + dd 0x773355 + dd 0x553377 + dd 0x000000 + dd 0xcccccc + + +shape: + + dd 1024,64 + dd 1024,32 + dd 2048,32 + dd 4096,32 + + dd 512,16 + dd 1024,16 + dd 2048,16 + dd 4096,16 + + dd 64,32 + dd 64,16 + dd 32,32 + dd 8,8 + dd 16,16 + dd 64,64 + +usearray dd ptarray + +arrays dd ptarray,ptarray2,ptarray3,ptarray4,ptarray5,ptarray6 + dd ptarray7,ptarray8,ptarray9 + +ptarray: + + dd 150,50 + dd 120,30 + dd 44,180 + dd 50,66 + dd 27,6 + dd 95,212 + dd 128,177 + dd 201,212 + dd 172,201 + dd 250,100 + dd 24,221 + dd 11,123 + dd 248,32 + dd 34,21 + dd 777 ; <- end of array + +ptarray2: + + dd 0,0,50,50,100,100,150,150,200,200,250,250 + dd 50,150,150,50,200,100,100,200 + dd 777 + +ptarray3: + + dd 55,150,150,55,200,105,105,200 + dd 30,30,220,220 + dd 777 + +ptarray4: + + dd 196,0,196,64,196,128,196,196 + dd 64,32,64,96,64,150,64,228 + dd 777 + +ptarray5: + + dd 196,0,196,64,196,128,196,196 + dd 64,0,64,64,64,128,64,196 + dd 777 + +ptarray6: + + dd 49,49,128,50,210,50 + dd 50,128,128,128,210,128 + dd 50,210,128,210,210,210 + + dd 777 + +ptarray7: + + dd 0,0 + dd 196,196,64,64 + dd 128,0 + dd 0,128 + dd 64,64,196,64 + dd 196,196,64,196 + dd 128,128 + + dd 777 + +ptarray8: + + dd 0, 128 + dd 0, 128 + dd 128, 0 + dd 0, 128 + dd 128, 0 + dd 0, 128 + dd 128, 0 + dd 0, 128 + dd 128, 0 + dd 128, 128 + + dd 777 + +ptarray9: + + + dd 0,248,64,128,128,64,196,48,160,160,94,224,240,96,5,5,777 + + + +I_Param: + +image: + + I_END: \ No newline at end of file diff --git a/programs/media/scrshot/trunk/build_en.bat b/programs/media/scrshoot/build_en.bat similarity index 72% rename from programs/media/scrshot/trunk/build_en.bat rename to programs/media/scrshoot/build_en.bat index 73161f92fa..0202f7cadf 100644 --- a/programs/media/scrshot/trunk/build_en.bat +++ b/programs/media/scrshoot/build_en.bat @@ -1,4 +1,5 @@ @erase lang.inc @echo lang fix en >lang.inc @fasm scrshot.asm scrshot +@erase lang.inc @pause \ No newline at end of file diff --git a/programs/media/scrshoot/build_ru.bat b/programs/media/scrshoot/build_ru.bat new file mode 100644 index 0000000000..e09bdbc0e8 --- /dev/null +++ b/programs/media/scrshoot/build_ru.bat @@ -0,0 +1,5 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm scrshoot.asm scrshoot +@erase lang.inc +@pause \ No newline at end of file diff --git a/programs/media/scrshoot/check.inc b/programs/media/scrshoot/check.inc new file mode 100644 index 0000000000..a98028dba3 --- /dev/null +++ b/programs/media/scrshoot/check.inc @@ -0,0 +1,217 @@ +;Эффективное программирование в KOLIBRI +;Оптимизированный компонент CheckBox (Исходный вариант от Maxxxx32) +;Оптимизирован вывод строки надписи для CheckBox'a + теперь, при проверке не происходит подсчет кол-ва символов в строке +;Оптимизация команд - отказался от сохранения регистров в стеке. +;17.07.2006 произведена оптимизация, при установке чек бокса в положение включено последующие чек боксы в тот же промежуток времени не проверяются +; - Теплов Алексей www.test-kolibri.narod.ru + +macro use_check_box +{ +ch_text_margin=4 ;расстояние от прямоугольника чек бокса до надписи +ch_size=10 ;размер квадрата чек бокса +ch_left equ [edi] ;координата начала рисования по х +ch_top equ [edi+2] ;координата начала рисования по у +ch_color equ [edi+4] ;цвет внутри checkbox +ch_border_color equ [edi+8] ;цвет рамки checkbox +ch_text_color equ [edi+12] ;цвет текста +ch_text_ptr equ [edi+16] ;указатель на начало текстовой строки +ch_text_length equ [edi+20] ;длина надписи (2^64 такой длины может быть текст) +ch_flags equ [edi+24] ;флаги +check_box: +.draw: +pusha ;сохраним все регистры + mov eax,38 ;рисование линии + mov bx,ch_left ;положение по х + ;mov cx,bx ;сохраним в регистре cx значение bx + push bx ;3 - микрооперации используя стек можно выиграть в размере, используя регистры - в скорости + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + pop bx ;2 - микрооперации на данный момент сформирована [координата начала по оси x]*65536 + [координата начала по оси x] + ;mov bx,cx ;восстановим значение bx + mov cx,ch_top ;загрузим в cx значение y + mov si,cx ;сохраним значение регистра cx в регистр указатель si + ;push cx + shl ecx,16 ; сдвинем на 16 разрядов в лево (умножим на 65536) mov cx,si ;восстановим значение регистра cx + mov cx,si ;восстановим значение регистра cx + ;pop cx ;[координата начала по оси y]*65536 + [координата начала по оси y] + ;push cx + add cx,ch_size ;[координата начала по оси y]*65536 + [координата конца по оси y] + mov edx,ch_border_color ;Цвет линии + int 0x40 ;рисование вертикальной левой линии квадрата (прямоугольника) +; + mov bp,bx ;сохраним регистр bx в регистре указателя базы + ;push bx ;втолкнуть в bx [координата начала по оси х]*65536 + [координата начала по оси x] + add bx,ch_size ;[координата начала + длина стороны по оси х] + ror ebx,16 ;[координата начала + дина стороны по оси х]*65536 + add bx,ch_size ;[координата начала+длина стороны по оси х]*65536 + [координата начала+длина стороны по оси x] + int 0x40 + mov bx,bp ;восстановим значение регистра bx + ;pop bx + mov cx,si ;сохраним значение регистра cx в регистр указатель + ;pop cx + int 0x40 + add cx,ch_size ;добавим размер стороны + mov si,cx ;сохраним значение регистра cx в регистр указатель si + ;push cx + shl ecx,16 + mov cx,si + ;pop cx + int 0x40 ;нарисовали прямоугольник + + mov eax,13 ;закрашиваем его. Функция 13 - нарисовать полосу + mov bx,ch_left ;загрузить в bx, положение по х + add bx,1 ;сдвинем на 1 т.е. прибавим 1 иначе затрется рамка + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov bx,ch_size ;прибавим длину стороны прямоугольника + sub bx,1 ;вычтем 1 т.к. иначе затрется рамка + mov bp,bx ; сохраним регистр bx в регистре указателя базы + ;push bx + mov cx,ch_top ;загрузим координаты по y + add cx,1 ;сдвинем на 1 т.е. прибавим 1 иначе затрется рамка + shl ecx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov cx,bp ;восстановим значение регистра cx + ;pop cx + mov edx,ch_color ;загрузим цвет полосы + int 0x40 ;закрасили + bt dword ch_flags,1 ;достать значение бита из переменной и поместить в флаг CF + jnc @f ;в если CF=1, то выполним следующую процедуру иначе перейти на нижнюю @@ + call .draw_ch ;нарисовать включенный чек бокс +@@: +;---------------------------- +;расчет куда будет произведен вывод текста +;---------------------------- + mov bx,ch_left ;загрузить значение х для чек бокса + add bx,(ch_size+ch_text_margin) ;добавить размер стороны и расстояние на котором начнется вывод текста + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov bx,ch_top ;загрузим значение по y + add bx,(ch_size-9+2) ;добавим значение длины стороны -9+2 + mov ecx,ch_text_color ;загрузим цвет надписи + + mov edx,ch_text_ptr ;укажем адрес от куда нужно выводить строку + mov esi,ch_text_length ;Загрузим длину надписи в esi + xor eax,eax ;внесем в eax значение вывода надписи на канву + add eax,4 + int 0x40 ;Вывод +popa ;восстановить значения регистров из стека +ret ;выйдем из процедуры + +.clear_ch: ;очистка чек бокса + mov edx,ch_color ;цвет внутри чек бокса + jmp @f ;безусловный прыжок на нижнюю метку @@ + +.draw_ch: ;нарисовать включенный чек бокс + mov edx,ch_border_color ;загрузить цвет +@@: + mov bx,ch_left ;загрузить координату по х + add bx,(ch_size/3) ;добавить (сторона прямоугольника/3) + shl ebx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov bx,(ch_size/2) ;загрузить (сторона прямоугольника/2) + mov bp,bx ;сохраним регистр bx в регистре указателя базы + ;push bx + mov cx,ch_top ;загрузить координату по у + add cx,(ch_size/3) ;добавить (сторона прямоугольника/3) + shl ecx,16 ;сдвинем на 16 разрядов в лево (умножим на 65536) + mov cx,bp ;загрузим значения регистра указателя базы в cx + ;pop cx + mov eax,13 ;в eax - значения функции для вывода полосы т.е. по сути прямоугольника, который отображает включенный компонент чек бокс + int 0x40 ;вывод +ret ;выйти из процедуры + +.mouse: ;обработка мыши +pusha + mov eax,37 ;будем что то делать если у нас что - нить нажато + xor ebx,ebx ;обнулить регистр ebx (изменяет флаги) + add ebx,2 ;внести в регистр значение 2 + int 0x40 ;проверка не нажал ли пользователь кнопку мышки + test eax,eax ;проверка если у нас в eax=0, то установим флаг и выйдем + jnz @f ;перейти на нижнюю метку @@ + btr dword ch_flags,2 ;извлечение значения заданного бита в флаг cf и изменение его значения на нулевое. + popa ;если ничего не произошло, то восстановим значения регистров из стека + ret ;выход +@@: + bts dword ch_flags,2 ;проверка флага т.е. перенос в cf значение бита и установка бита в состояние включено + jc .mouse_end ;если CF=1 то перейти в конец т.е. это выход + mov esi,ch_text_length ;загрузить кол-во символов в текстовой строке + ;Умножение на 6 Быстрое умножение можно воспользоваться любым мз методов, но на старых Процессорах (386,486,P1)быстрее будет с инструкцией Lea + ;lea esi,[eax*2+eax] + ;shl eax,1 + imul esi,6 ; или можно и так умножить на 6 + add esi,ch_text_margin ;добавить 3 - расстояние от чек бокса до надписи + + mov eax,37 ;получим координаты мышки + xor ebx,ebx ;обнулить регистр + add ebx,1 ;добавить 1 + int 0x40 ;получить координаты курсора относительно окна + + mov bx,ch_top ;загрузить в bx значение координаты у + cmp ax,bx ;сравнить с с координатой курсора + jl .mouse_end ;SF <> OF если меньше + add bx,ch_size ;добавить размер + cmp ax,bx ;сравнить + jg .mouse_end ;ZF = 0 и SF = OF если больше + + shr eax,16 ;разделим на 65536 или просто сдвинем биты на 16 значений + mov bx,ch_left ;произведем аналогичное сравнение + cmp ax,bx ;сравнить регистры + jl .mouse_end ;если меньше + add bx,ch_size ;добавить длину стороны прямоугольника + add bx,si ;Учесть в значении по х еще и длину надписи к чекбоксу + cmp ax,bx ;стравнить регистры + jg .mouse_end ;если больше + + bts dword ch_flags,1 ;извлечение значения заданного бита в флаг cf и изменение его значения на 1. + jc @f ;CF=1 то перейти на нижнюю @@ + + call .draw_ch ;отобразить включенный чек бокс + mov dword [esp+24],1 ;дальнейшая проверка чек боксов бесмыслена, по этому в стек, где располагается ecx поместитм 0 + jmp .mouse_end ;выйти +@@: + btr dword ch_flags,1 ;извлечение значения заданного бита в флаг cf и изменение его значения на нулевое. + call .clear_ch ;выключить чек бокс т.е. на месте закрашенного прямоугольника отобразить цвет фона. +.mouse_end: +popa ;восстановить регистры из стека +ret ;выйти +} + +struc check_box left,top,color,border_color,text_color,text,text_length,flags +{ ;структура параметров для чек бокса +.left: dw left ;+0 ;положение по х +.top: dw top ;+2 ;положение по у +.color: dd color ;+4 ;цвет внутри чек бокса +.border_color: dd border_color ;+8 цвет рамки +.text_color: dd text_color ;+12 цвет текста надписи +.text: dd text ;+16 адрес в коде программы где расположен текстр +.text_length: dd text_length ; +20 длина текста +.flags: dd flags+0 ;+24 флаги +} +ch_struc_size=28 ;общая структура 28 байт +macro draw_check_boxes start,end ;рисовать чек боксы +{ + mov edi,start ;Указатель на начало данных чек боксов т.е. на начало данных первого чекбокса + mov ecx,((end-start)/ch_struc_size) ;Количество чек боксов +@@: + call check_box.draw ;Отобразить чек бокс + add edi,ch_struc_size ;Указатель на последующие чек боксы т.е. +28 + loop @b ;прыгнуть если в ecx/cx значение не 0 на верхнюю @@ +} +macro mouse_check_boxes start,end ;установка чек боксов, в зависимости от события +{ + mov edi,start ; Указатель на начало данных чек боксов т.е. на начало данных первого чекбокса + mov ecx,((end-start)/ch_struc_size) ;Количество чек боксов +@@: + call check_box.mouse ;проверка мышки и обработка событий + add edi,ch_struc_size ;Указатель на последующие чек боксы + loop @b ;прыгнуть если в ecx/cx значение не 0 на верхнюю @@ +} +macro check_boxes_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/ch_struc_size) + mov esi,color_table +@@: + push dword [esi+32] + pop dword ch_text_color + push dword [esi+36] + pop dword ch_border_color + add edi,ch_struc_size + loop @b +} \ No newline at end of file diff --git a/programs/media/scrshoot/checkbox.inc b/programs/media/scrshoot/checkbox.inc new file mode 100644 index 0000000000..216b866947 --- /dev/null +++ b/programs/media/scrshoot/checkbox.inc @@ -0,0 +1,196 @@ +macro use_check_box +{ +ch_text_margin=3 +ch_size=10 +ch_left equ [edi] +ch_top equ [edi+2] +ch_color equ [edi+4] +ch_border_color equ [edi+8] +ch_text_color equ [edi+12] +ch_text_ptr equ [edi+16] +ch_flags equ [edi+20] +check_box: +.draw: +pusha + mov eax,38 + mov bx,ch_left + push bx + shl ebx,16 + pop bx + mov cx,ch_top + push cx + shl ecx,16 + pop cx + push cx + add cx,ch_size + mov edx,ch_border_color + int 0x40 + push bx + add bx,ch_size + ror ebx,16 + add bx,ch_size + int 0x40 + pop bx + pop cx + int 0x40 + add cx,ch_size + push cx + shl ecx,16 + pop cx + int 0x40 + + mov eax,13 + mov bx,ch_left + inc bx + shl ebx,16 + mov bx,ch_size + dec bx + push bx + mov cx,ch_top + inc cx + shl ecx,16 + pop cx + mov edx,ch_color + int 0x40 + + bt dword ch_flags,1 + jnc @f + call .draw_ch +@@: + + call .get_text_n + mov bx,ch_left + add bx,(ch_size+ch_text_margin) + shl ebx,16 + mov bx,ch_top + add bx,(ch_size-9+2) + mov ecx,ch_text_color + mov eax,4 + int 0x40 +popa +ret + +.get_text_n: + push eax + xor esi,esi + mov edx,ch_text_ptr +@@: + mov ah,[edx+esi] + inc esi + test ah,ah + jnz @b + dec esi + pop eax +ret + +.clear_ch: + mov edx,ch_color + jmp @f +.draw_ch: + mov edx,ch_border_color +@@: + mov bx,ch_left + add bx,(ch_size/3) + shl ebx,16 + mov bx,(ch_size/2) + push bx + mov cx,ch_top + add cx,(ch_size/3) + shl ecx,16 + pop cx + mov eax,13 + int 0x40 +ret + +.mouse: +pusha + mov eax,37 + mov ebx,2 + int 0x40 + bt eax,0 + jc @f + btr dword ch_flags,2 + popa + ret +@@: + bts dword ch_flags,2 + jc .mouse_end + call .get_text_n + imul esi,6 + add si,ch_text_margin + mov eax,37 + xor ebx,ebx + inc ebx + int 0x40 + mov bx,ch_top + cmp ax,bx + jl .mouse_end + add bx,ch_size + cmp ax,bx + jg .mouse_end + shr eax,16 + mov bx,ch_left + cmp ax,bx + jl .mouse_end + add bx,ch_size + add bx,si + cmp ax,bx + jg .mouse_end + + bts dword ch_flags,1 + jc @f + call .draw_ch + jmp .mouse_end +@@: + btr dword ch_flags,1 + call .clear_ch +.mouse_end: +popa +ret +} + +struc check_box left,top,color,border_color,text_color,text,flags +{ +.left: dw left ;+0 +.top: dw top ;+2 +.color: dd color ;+4 +.border_color: dd border_color ;+8 +.text_color: dd text_color ;+12 +.text: dd text ;+16 +.flags: dd flags+0 ;+20 +} + +ch_struc_size=24 +macro draw_check_boxes start,end +{ + mov edi,start + mov ecx,((end-start)/ch_struc_size) +@@: + call check_box.draw + add edi,ch_struc_size + loop @b +} + +macro mouse_check_boxes start,end +{ + mov edi,start + mov ecx,((end-start)/ch_struc_size) +@@: + call check_box.mouse + add edi,ch_struc_size + loop @b +} + +macro check_boxes_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/ch_struc_size) + mov esi,color_table +@@: + push dword [esi+32] + pop dword ch_text_color + push dword [esi+36] + pop dword ch_border_color + add edi,ch_struc_size + loop @b +} \ No newline at end of file diff --git a/programs/media/scrshoot/editbox.inc b/programs/media/scrshoot/editbox.inc new file mode 100644 index 0000000000..28a7e992e8 --- /dev/null +++ b/programs/media/scrshoot/editbox.inc @@ -0,0 +1,755 @@ +; 21.07.2006 добавлена функция кнопки Del, теперь можно удалять символы при помощи данной колавиши +; Автор: Евтихов Максим (Maxxxx32) email: maxxxxm@mail.ru +; Дата последних изменений: 13.07.06 10:40 +; Напишите в исходном коде своей программы use_edit_box, +; это вставит необходимые процедуры в код вашей программы. +; Процедуры: +; edit_box.draw - полная перерисовка; +; edit_box.key - обработка клавиатуры; +; edit_box.mouse - обработка мыши; +; edit_box.focus - установка фокуса; +; edit_box.blur - его размывание; +; edit_box.get_n - получить количество прорисовываемых символов. +; При вызове любых из этих процедур в регистре edi следует +; оставить указатель на структуру. +; Пример структуры: +; some_edit edit_box 100,10,30,0x00ffffff,0,0x00aaaaaa,0,255,some_edit_text +; длина, лево, верх, цвет фона, цвет рамки, если выбран, +; цвет рамки, если не выбран, максимальное количество символов, +; указатель на буфер, где будут хранится символы. Буфер должен +; оканчиваться нулем, например если максимальное количество 255: +; some_edit_text: +; rb 256 ;255+1 + +; Пример вызова процедуры: +; mov edi,some_edit +; call edit_box.draw + +; При вызове процедуры edit_box.key код клавиши должен +; находится в ah, то есть перед вызовом этой процедуры надо вызвать +; 2-ую сисемную функцию, например: +; mov eax,2 +; int 0x40 +; mov edi,some_edit1 +; call edit_box.key +; mov edi,some_edit2 +; call edit_box.key +; Перед вызовом обработчика мыши следует проверить, является ли окно +; активным. +; Если щелчок мыши был пройзведен за пределами edit box +; фокус теряется. +macro use_edit_box +{ +edit_box: +ed_width equ [edi] +ed_left equ [edi+2] +ed_top equ [edi+4] +ed_color equ [edi+6] +ed_focus_border_color equ [edi+10] +ed_blur_border_color equ [edi+14] +ed_text_color equ [edi+18] +ed_flags equ [edi+22] +ed_max equ [edi+24] +ed_size equ [edi+26] +ed_pos equ [edi+28] +ed_offset equ [edi+30] +ed_text equ [edi+32] +ed_height=14 ; высота +;========================================================== +;=== процедура прорисовки ================================= +;========================================================== +.draw: +pusha +;--- рисуем рамку --- + call .draw_border + +.draw_bg_cursor_text: +;--- изменяем смещение, если надо --- + call .check_offset +;--- рисуем внутреннюю область --- + call .draw_bg +.draw_cursor_text: +;--- рисуем курсор --- + ;--- может его не надо рисовать ---- + bt word ed_flags,1 + jnc @f + call .draw_cursor +@@: + call .draw_text +popa +ret + +;---------------------------------------------------------- +;--- процедура прорисовки текста -------------------------- +;---------------------------------------------------------- +.draw_text: +;--- вычисляем, сколько помещается символов --- + call .get_n +;--- чтобы мусор не рисовать --- + movsx esi,word ed_size + sub si,ed_offset + cmp ax,si + ja @f + mov si,ax +@@: + +;--- рисуем текст --- + mov eax,4 + mov bx,ed_left + add bx,2 + shl ebx,16 + mov bx,ed_top + add bx,4 + mov ecx,ed_text_color + movsx edx,word ed_offset + add edx,ed_text + int 0x40 +ret + +;---------------------------------------------------------- +;--- процедура прорисовки фона ---------------------------- +;---------------------------------------------------------- +.draw_bg_eax: +pusha + movsx ebx,ax + lea ebx,[ebx*2+ebx] + shl bx,1 + shl ebx,16 + shr eax,16 + lea eax,[eax*2+eax] + shl ax,1 + add ax,ed_left + add ax,2 + mov bx,ax + ror ebx,16 + jmp @f +.draw_bg: +pusha + mov bx,ed_left + inc bx + shl ebx,16 + mov bx,ed_width + dec bx + +@@: + mov cx,ed_top + inc cx + shl ecx,16 + mov cx,ed_height + dec cx + + mov edx,ed_color + mov eax,13 + int 0x40 +popa +ret + +;---------------------------------------------------------- +;--- процедура получения количества символов -------------- +;---------------------------------------------------------- +.get_n: + xor edx,edx + movsx eax,word ed_width + sub ax,4 + mov bx,6 + div bx +ret + +;---------------------------------------------------------- +;--- процедура рисования курсора -------------------------- +;---------------------------------------------------------- +.clear_cursor: + mov edx,ed_color + jmp @f +.draw_cursor: + mov edx,ed_text_color +@@: + movsx ebx,word ed_pos + sub bx,ed_offset + ;lea ebx,[ebx*2+ebx] + ;shl ebx,1 + imul ebx,6 + add bx,ed_left + inc bx + push bx + shl ebx,16 + pop bx + mov cx,ed_top + add cx,2 + push cx + shl ecx,16 + pop cx + add cx,ed_height-4 + mov eax,38 + int 0x40 +ret + +;---------------------------------------------------------- +;--- процедура рисования рамки ---------------------------- +;---------------------------------------------------------- +.draw_border: +;--- цвет рамки --- + bt word ed_flags,1 + mov edx,ed_focus_border_color + jc @f + mov edx,ed_blur_border_color +@@: +;--- сверху --- + mov bx,ed_left + push bx + shl ebx,16 + pop bx + add bx,ed_width + mov cx,ed_top + push cx + shl ecx,16 + pop cx + mov eax,38 + int 0x40 + +;--- снизу --- + push cx + add cx,ed_height + push cx + shl ecx,16 + pop cx + int 0x40 + +;--- слева --- + pop cx + push bx + sub bx,ed_width + int 0x40 + +;--- справа --- + pop bx + push bx + shl ebx,16 + pop bx + int 0x40 +ret + +;---------------------------------------------------------- +;--- проверка, зашел ли курсор за границы и, если надо, --- +;--- изменяем смещение ------------------------------------ +;--- eax = 1, если не изменилось или eax = 0, если +; изменилось +;---------------------------------------------------------- +.check_offset: + push word ed_offset + call .get_n +;--- правее --- + mov bx,ed_offset + add bx,ax + cmp bx,ed_pos + ja @f + mov bx,ed_pos + mov cx,ax + shr cx,2 + sub bx,cx + mov cx,ax + shr cx,1 + sub bx,cx + mov ed_offset,bx +@@: +;--- левее --- + mov bx,ed_offset + cmp bx,ed_pos + jb @f + mov bx,ed_pos + mov cx,ax + shr cx,2 + sub bx,cx + jnc $+5 + xor bx,bx + mov ed_offset,bx +@@: + xor eax,eax + pop bx + cmp bx,ed_offset + jne @f + inc eax +@@: +ret + +;========================================================== +;=== обработка клавиатуры ================================= +;========================================================== +.key: +pusha + bt word ed_flags,1 ; если не в фокусе, выходим + jc @f + popa + ret +@@: + +;---------------------------------------------------------- +;--- проверяем, что нажато -------------------------------- +;---------------------------------------------------------- + cmp ah,8 + je .backspace + cmp ah,0xb6 + je .delete + cmp ah,176 + je .left + cmp ah,179 + je .right + cmp ah,180 + je .home + cmp ah,181 + je .end + +;--- нажата другая клавиша --- + bt word ed_flags,15 ; только цифры ? + jnc @f + cmp ah,'0' + jb .no_figure + cmp ah,'9' + ja .no_figure + jmp @f +.no_figure: + popa + ret +@@: + ; проверяем, находится ли курсор в конце + mov bx,ed_max + cmp bx,ed_pos + jne @f ; если да, в конец процедуры + popa + ret +@@: + ; сдвигаем символы после курсора вправо + mov edx,ed_text + dec edx + xor ecx,ecx + mov cx,ed_size + cmp cx,ed_pos + je @f +.mov_right_next: + mov bh,[edx+ecx] + mov [edx+ecx+1],bh + dec cx + cmp cx,ed_pos + jne .mov_right_next +@@: + + + ; вставляем код клавиши туда, где курсор + mov edx,ed_text + movsx ebx,word ed_pos + mov [ebx+edx],ah + + call .clear_cursor + ; увеличиваем значение размера и позиции + inc word ed_pos + mov bx,ed_size + cmp bx,ed_max + je .draw_bg_cursor_text;.key_end_draw + inc word ed_size + + ;push word ed_offset + call .check_offset + ;pop ax + ;cmp ax,ed_offset + ;jne .draw_bg_cursor_text + test eax,eax + jz .draw_bg_cursor_text + + call .get_n + sub ax,ed_pos + add ax,ed_offset + inc ax + shl eax,16 + mov ax,ed_pos + sub ax,ed_offset + dec ax + ror eax,16 + call .draw_bg_eax + + jmp .draw_cursor_text + + ;jmp .draw_cursor_text;.key_end_draw + +.delete: + mov dx,ed_size + mov cx,ed_pos + ;inc edx + ;add ecx,900 + ;sub ecx,1 + cmp dx,cx + jg @f + popa + ret + +@@: + mov edx,ed_text + ;dec edx +.mov_stop_next: + mov bh,[edx+ecx+1] + mov [edx+ecx],bh + inc cx + mov bx,ed_size + ;dec bx + ;dec bx + cmp cx,bx + jne .mov_stop_next + + ; уменьшаем значение позиции и размера + ;dec word ed_pos + dec word ed_size + ;push word ed_offset + call .check_offset + ;pop ax + ;cmp ax,ed_offset + ;jne .draw_bg_cursor_text + test eax,eax + jz .draw_bg_cursor_text + + call .get_n + sub ax,ed_pos + add ax,ed_offset + shl eax,16 + mov ax,ed_pos + sub ax,ed_offset + ror eax,16 + call .draw_bg_eax + + jmp .draw_cursor_text +popa +ret + +;--- нажата клавиша backspace --- +.backspace: + ; проверяем, курсор у левого края ? + mov bx,ed_pos + ;cmp bx,0 + ;jne @f; .key_end ; если да, в конец + test bx,bx + jnz @f + popa + ret +@@: + + ; сдвигаем символы после курсора влево + mov edx,ed_text + dec edx + movsx ecx,word ed_pos + +.mov_left_next: + mov bh,[edx+ecx+1] + mov [edx+ecx],bh + inc cx + mov bx,ed_size + inc bx + cmp cx,bx + jne .mov_left_next + + ; уменьшаем значение позиции и размера + dec word ed_pos + dec word ed_size + + ;push word ed_offset + call .check_offset + ;pop ax + ;cmp ax,ed_offset + ;jne .draw_bg_cursor_text + test eax,eax + jz .draw_bg_cursor_text + + call .get_n + sub ax,ed_pos + add ax,ed_offset + shl eax,16 + mov ax,ed_pos + sub ax,ed_offset + ror eax,16 + call .draw_bg_eax + + jmp .draw_cursor_text +popa +ret + +;--- нажата клавиша left --- +.left: + mov bx,ed_pos + ;cmp bx,0 + ;je @f + test bx,bx + jz @f + call .clear_cursor + dec word ed_pos + call .check_offset + test eax,eax + jz .draw_bg_cursor_text + call .draw_cursor +@@: +popa +ret + +;--- нажата клавиша right --- +.right: + mov bx,ed_pos + cmp bx,ed_size + je @f + call .clear_cursor + inc word ed_pos + call .check_offset + test eax,eax + jz .draw_bg_cursor_text + call .draw_cursor +@@: +popa +ret + +.home: + mov bx,ed_pos + test bx,bx + jz @f + call .clear_cursor + xor eax,eax + mov ed_pos,ax + call .check_offset + test eax,eax + jz .draw_bg_cursor_text + call .draw_cursor +@@: +popa +ret + +.end: + mov bx,ed_pos + cmp bx,ed_size + je @f + call .clear_cursor + mov ax,ed_size + mov ed_pos,ax + call .check_offset + test eax,eax + jz .draw_bg_cursor_text + call .draw_cursor +@@: +popa +ret + + +;========================================================== +;=== обработка мыши ======================================= +;========================================================== +.mouse: +pusha +;---------------------------------------------------------- +;--- получаем состояние кнопок мыши ----------------------- +;---------------------------------------------------------- + mov eax,37 + mov ebx,2 + int 0x40 +;---------------------------------------------------------- +;--- проверяем состояние ---------------------------------- +;---------------------------------------------------------- + bt eax,0 + jc .mouse_left_button + + bt eax,1 + jc @f + btr word ed_flags,2 +@@: + + popa + ret + +.mouse_left_button: +;---------------------------------------------------------- +;--- получаем координаты мыши ----------------------------- +;---------------------------------------------------------- + bts word ed_flags,2 + jc .mouse_pressed + mov eax,37 + ;mov ebx,1 + xor ebx,ebx + inc ebx + int 0x40 +;---------------------------------------------------------- +;--- проверяем, попадает ли курсор в edit box ------------- +;---------------------------------------------------------- + mov bx,ed_top + cmp ax,bx + jl ._blur;.mouse_end_no_focus + + add bx,ed_height + cmp ax,bx + jg ._blur;.mouse_end_no_focus + + shr eax,16 + + mov bx,ed_left + cmp ax,bx + jl ._blur;.mouse_end_no_focus + + add bx,ed_width + cmp ax,bx + jg ._blur;.mouse_end_no_focus + +;--- изменяем позицию курсора --- + push eax + call .clear_cursor + pop eax + xor dx,dx + sub ax,ed_left + add ax,2 + mov bx,6 + div bx + add ax,ed_offset + cmp ax,ed_size + jna @f + mov ax,ed_size +@@: + mov ed_pos,ax + call .check_offset + test eax,eax + jz .draw_bg_cursor_text + call .draw_cursor + + call .focus + +.mouse_pressed: +popa +ret + +;.mouse_end_no_focus: +; call .blur +;popa +;ret + + +;---------------------------------------------------------- +;--- процедура установки фокуса --------------------------- +;---------------------------------------------------------- +.blur: +pusha +._blur: + bt word ed_flags,14 + jc @f + btr word ed_flags,1 + jnc @f + call .clear_cursor + jmp .blur_end +.focus: +pusha + bts word ed_flags,1 + jc @f + call .draw_cursor +.blur_end: + call .draw_border +@@: +popa +ret + +;---------------------------------------------------------- +;--- процедура размывания фокуса -------------------------- +;---------------------------------------------------------- +;.blur: +;pusha +;._blur: + ;btr word ed_flags,1 + ;jnc @f + ;call .draw_border + ;call .clear_cursor +;@@: +;popa +;ret +} +ed_figure_only=1000000000000000b +ed_always_focus=100000000000000b +ed_focus=10b +ed_struc_size=36 +macro draw_edit_boxes start,end +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) +@@: + call edit_box.draw + add edi,ed_struc_size + loop @b +} + +macro mouse_edit_boxes start,end +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) +@@: + call edit_box.mouse + add edi,ed_struc_size + loop @b +} + +macro key_edit_boxes start,end +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) +@@: + call edit_box.key + add edi,ed_struc_size + loop @b +} + +struc edit_box width,left,top,color,focus_border_color,\ + blur_border_color,text_color,max,text,flags,size +{ +.width dw width +.left dw left +.top dw top +.color dd color +.focus_border_color dd focus_border_color +.blur_border_color dd blur_border_color +.text_color dd text_color +.flags dw flags+0 +.max dw max +.size dw size+0 +.pos dw 0 +.offset dw 0 +.text dd text +} + +macro edit_boxes_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) + mov esi,color_table +@@: + mov eax,[esi+36] + mov ebx,[esi+20] + mov ed_focus_border_color,eax + shr bh,1 + shr bl,1 + shr ah,1 + shr al,1 + add ah,bh + add al,bl + ror eax,16 + ror ebx,16 + shr bl,1 + shr al,1 + add al,bl + ror eax,16 + mov ed_blur_border_color,eax + add edi,ed_struc_size + loop @b +} + +macro draw_edit_box ed_ptr +{ + mov edi,ed_ptr + call edit_box.draw +} + +macro mouse_edit_box ed_ptr +{ + mov edi,ed_ptr + call edit_box.mouse +} + +macro key_edit_box ed_ptr +{ + mov edi,ed_ptr + call edit_box.key +} \ No newline at end of file diff --git a/programs/media/scrshoot/file_sys.inc b/programs/media/scrshoot/file_sys.inc new file mode 100644 index 0000000000..fa166c5e69 --- /dev/null +++ b/programs/media/scrshoot/file_sys.inc @@ -0,0 +1,41 @@ +macro file_sys struc_ptr +{ + mov eax,58 + mov ebx,struc_ptr + int 0x40 +} + +struc fs_struc function_number,block_number,size,data_ptr,mem_for_sys_ptr +{ +.function_number: dd function_number+0 ;+0 +.block_number: dd block_number+0 ;+4 +.size: dd size+0 ;+8 +.data_ptr: dd data_ptr+0 ;+12 +.mem_for_sys_ptr: dd mem_for_sys_ptr+0 ;+16 +} +fs_struc_size=20 + +fs_read_file=0 +fs_rewrite_file=1 +fs_delete_file=2 +fs_write_to_file=3 +fs_create_dir=4 +fs_rename_file=5 +fs_lba_read=9 +fs_get_file_size=12 +fs_get_file_atr=13 +fs_get_file_date_time=14 +fs_get_fs_info=15 +fs_run_app=16 + +fse_successful=0 +fse_not_def_base=1 +fse_bad_fs=2 +fse_bad_fs=3 +fse_part_not_def=4 +fse_file_not_found=5 +fse_end_of_file=6 +fse_bad_ptr=7 +fse_disk_filled=8 +fse_bad_fat_table=9 +fse_acces_denied=10 \ No newline at end of file diff --git a/programs/media/scrshoot/gp.inc b/programs/media/scrshoot/gp.inc new file mode 100644 index 0000000000..0334190263 --- /dev/null +++ b/programs/media/scrshoot/gp.inc @@ -0,0 +1,63 @@ +macro use_gp +{ +;esi - screen size +;edi - pointer to image +csi_width equ [esi+2] +csi_height equ [esi] +csi_bitspp equ [esi+4] +csi_bytesps equ [esi+6] +copy_screen_to_image: +pusha + xor edx,edx + xor ecx,ecx + xor ebx,ebx + + cmp csi_bitspp,word 24 + je .next_str_24 + +.next_str_32: + push edx ebx + xor ebx,ebx +@@: + ;push eax + mov eax,[gs:edx] + mov [edi+ecx],ax + shr eax,8 + mov [edi+ecx+2],ah + ;pop eax + add ecx,3 + add edx,4;eax + inc bx + cmp bx,csi_width + jl @b + pop ebx edx + add edx,csi_bytesps + inc bx + cmp bx,csi_height + jl .next_str_32 +popa +ret + +.next_str_24: + push edx ebx + xor ebx,ebx +@@: + ;push eax + mov eax,[gs:edx] + mov [edi+ecx],ax + shr eax,8 + mov [edi+ecx+2],ah + ;pop eax + add ecx,3 + add edx,3;eax + inc bx + cmp bx,csi_width + jl @b + pop ebx edx + add edx,csi_bytesps + inc bx + cmp bx,csi_height + jl .next_str_24 +popa +ret +} \ No newline at end of file diff --git a/programs/media/scrshoot/label.inc b/programs/media/scrshoot/label.inc new file mode 100644 index 0000000000..52a7bb3a80 --- /dev/null +++ b/programs/media/scrshoot/label.inc @@ -0,0 +1,51 @@ +macro use_label +{ +draw_label: +pusha + xor esi,esi + mov edx,[edi+8] +.check_next: + mov ah,[edx+esi] + inc esi + test ah,ah + jz @f + jmp .check_next +@@: + mov eax,4 + mov ebx,[edi] + mov ecx,[edi+4] + int 0x40 +popa +ret +} + +struc label left,top,color,text +{ +.top: dw top ; +0 +.left: dw left ; +2 +.color: dd color; +4 +.text: dd text ; +8 +} + +l_struc_size=12 +macro draw_labels start,end +{ + mov edi,start + mov ecx,((end-start)/l_struc_size) +@@: + call draw_label + add edi,l_struc_size + loop @r +} + +macro labels_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/l_struc_size) + mov esi,color_table +@@: + push dword [esi+32] + pop dword [edi+4] + add edi,l_struc_size + loop @r +} \ No newline at end of file diff --git a/programs/media/scrshoot/macros.inc b/programs/media/scrshoot/macros.inc new file mode 100644 index 0000000000..dab55d0806 --- /dev/null +++ b/programs/media/scrshoot/macros.inc @@ -0,0 +1,350 @@ +;--- другие макросы --- +include 'editbox.inc' +include 'txtbut.inc' +include 'gp.inc' +include 'label.inc' +;include 'checkbox.inc' +include 'check.inc' +include 'file_sys.inc' +include 'textwork.inc' +;include 'ini.inc' + +lang fix ru;en + +macro movr reg,val +{ +if val < 65536 + push val + pop reg +else + mov reg,val +end if +} + +;--- заголовок --- +macro meos_header par_buf,cur_dir_buf +{ + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd __app_start + dd __app_end + dd __app_end + dd __app_end +if eq <> + dd 0x0 +else + dd par_buf +end if +if eq <> + dd 0x0 +else + dd cur_dir_buf +end if +} + +;--- определить точку входа --- +macro app_start +{ +__app_start: +} + +;--- определить конец приложения и размер стека --- +macro app_end stack_size +{ +if eq <> + rb 1024 +else + rb stack_size +end if +__app_end: +} + +;--- завершить текущий поток --- +macro app_close +{ + xor eax,eax + dec eax + int 0x40 +} + +;--- получить код нажатой клавиши --- +macro get_key +{ + ;mov eax,2 + push 2 + pop eax + int 0x40 +} + +;--- получить код нажатой кнопки --- +macro get_pressed_button +{ + ;mov eax,17 + push 17 + pop eax + int 0x40 +} + +;--- сообщить системе о начале перерисовки окна --- +macro start_draw_window +{ + ;mov eax,12 + push 12 + pop eax + xor ebx,ebx + inc ebx + int 0x40 +} + +;--- сообщить системе о завершении перерисовки окна --- +macro stop_draw_window +{ + ;mov eax,12 + push 12 + pop eax + ;mov ebx,2 + push 2 + pop ebx + int 0x40 +} + +;--- установить маску ожидаемых событий --- +macro set_events_mask mask +{ + ;mov eax,40 + push 40 + pop eax + ;mov ebx,mask + push mask + pop ebx + int 0x40 +} + +;--- получить информацию о процессе --- +macro get_procinfo proc_inf_buf,slot_num +{ + ;mov eax,9 + push 9 + pop eax + ;mov ebx,proc_inf_buf + push proc_inf_buf + pop ebx +if eq <> + xor ecx,ecx + dec ecx +else + ;mov ecx,slot_num + push slot_num + pop ecx +end if + int 0x40 +} + +macro get_sys_colors col_buf +{ + ;mov eax,48 + push 48 + pop eax + ;mov ebx,3 + push 3 + pop ebx + ;mov ecx,col_buf + push col_buf + pop ecx + ;mov edx,40 + push 40 + pop edx + int 0x40 +} + +macro get_grab_area +{ + movr eax,48 + movr ebx,7 + int 0x40 +} + +macro get_scin_height +{ + movr eax,48 + movr ebx,4 + int 0x40 +} + +macro min_window +{ + movr eax,18 + movr ebx,10 + int 0x40 +} + +macro activ_window slot_n +{ + movr eax,18 + movr ebx,3 +if eq <> +else + movr ecx,slot_n +end if + int 0x40 +} + +macro get_active_window +{ + movr eax,18 + movr ebx,7 + int 0x40 +} + +macro delay time +{ + movr eax,5 +if