diff --git a/programs/demos/ScreenRuler/ScreenRuler.asm b/programs/demos/ScreenRuler/ScreenRuler.asm index b6390d904..e347055ed 100644 --- a/programs/demos/ScreenRuler/ScreenRuler.asm +++ b/programs/demos/ScreenRuler/ScreenRuler.asm @@ -1,294 +1,295 @@ -;--------------------------------------------------------------------- -; Screen Ruler v1.0 -; Version for KolibriOS 2005-2023 -;--------------------------------------------------------------------- -; last update: 11.09.2023 -; created by: Subbotin Anton aka Spaceraven -;--------------------------------------------------------------------- - use32 - org 0x0 - db 'MENUET01'; 8 byte id - dd 1 ; header version - dd START ; program start - dd I_END ; program image size - dd 0x1000 ; required amount of memory - dd 0x1000 ; esp - dd 0, 0 ; no parameters, no path -;--------------------------------------------------------------------- - include 'lang.inc' - include '..\..\macros.inc' - - delay = 20 - magnify_width = 48 - magnify_height = 30 - magnify_halfwidth = magnify_width / 2 - magnify_halfheight = magnify_height / 2 - aim0 = (magnify_halfheight - 1) * 65536 + magnify_halfwidth - 1 - aim1 = (magnify_halfheight - 1) * 65536 + magnify_halfwidth + 1 - aim2 = (magnify_halfheight + 1) * 65536 + magnify_halfwidth - 1 - aim3 = (magnify_halfheight + 1) * 65536 + magnify_halfwidth + 1 - -;------------------------- Main cycle -START: -redraw: - call draw_window -still: - call draw_magnify -wtevent: - mcall 23, delay ; wait here for event with timeout - dec eax - js still - jz redraw - dec eax - jnz button -; key in buffer - mov eax, 2 - mcall - cmp ah, 32 - jnz wtevent - mov eax, [mouse_x] - mov [pix1_x], eax - mov eax, [mouse_y] - mov [pix1_y], eax - - jmp wtevent -;--------------------------------------------------------------------- -button: -; we have only one button, close - - or eax, -1 - mcall -;------------------------- Window draw -draw_window: - mcall 12, 1 - - mov al, 48 ; function 48 : graphics parameters - mov bl, 4 ; subfunction 4 : get skin height - mcall - ; DRAW WINDOW - mov ebx, 100*65536 + 4*magnify_width + 9 - lea ecx, [eax + 100*65536 + 4*magnify_height + 128] - mov edx, 0x34000000 ; color of work area RRGGBB - mov edi, labelt ; header - xor eax, eax ; function 0 : define and draw window - mcall - mcall 71, 1, labelt - mcall 12,2 - ret -;------------------------- Magnify draw -draw_magnify: - mcall 9, procinfo, -1 - mov eax, [procinfo+70] ;status of window - test eax,100b - jne .end - - mcall 14 ; get screen size - movzx ecx, ax - inc ecx - mov [screen_size_y], ecx - shr eax, 16 - inc eax - mov [screen_size_x], eax - - xor ebx, ebx - mcall 37 ; get mouse coordinates - mov ecx, eax - shr ecx, 16 ; ecx = x - movzx edx, ax ; edx = y - mov [mouse_x], ecx - mov [mouse_y], edx - add ecx, magnify_halfwidth - add edx, magnify_halfheight - mov [magnify_area_end_x], ecx - mov [magnify_area_end_y], edx - sub ecx, magnify_width - sub edx, magnify_height - mov [magnify_area_start_x], ecx - mov [magnify_area_start_y], edx -.loop_y: -.loop_x: - xor eax, eax ; assume black color for invalid pixels - test ecx, ecx - js .nopix - cmp ecx, [screen_size_x] - jge .nopix - test edx, edx - js .nopix - cmp edx, [screen_size_y] - jge .nopix - mov ebx, edx - sub ebx, [magnify_area_start_y] - shl ebx, 16 - mov bx, cx - sub ebx, [magnify_area_start_x] - cmp ebx, aim0 - jz .nopix - cmp ebx, aim1 - jz .nopix - cmp ebx, aim2 - jz .nopix - cmp ebx, aim3 - jz .nopix - - mov ebx, edx - imul ebx, [screen_size_x] - add ebx, ecx - mcall 35 ; read pixel - -.nopix: - push ecx edx - sub ecx, [magnify_area_start_x] - sub edx, [magnify_area_start_y] - mov ebx, ecx - shl ebx, 2+16 - mov bl, 4 - mov ecx, edx - shl ecx, 2+16 - mov cl, 4 - mov edx, eax - mcall 13 ; draw rectangle 8x8 - pop edx ecx - - inc ecx - cmp ecx, [magnify_area_end_x] - jnz .loop_x - mov ecx, [magnify_area_start_x] - inc edx - cmp edx, [magnify_area_end_y] - jnz .loop_y - -;------------------------- Measure labels draw - mov eax, 4 - mov ebx, 8*65536 + 124 - mov ecx, 11110000111100001111000011110000b - mov edx, start_pix - xor edi, edi - mcall 4 - add ebx, 20 - mov edx, end_pix - mcall 4 - add ebx, 20 - mov edx, measure_x - mcall 4 - add ebx, 20 - mov edx, measure_y - mcall 4 - add ebx, 20 - mov edx, measure_d - mcall 4 - add ebx, 20 - mov edx, inf - mcall 4 - - mov ebx, 0x80040000 - mov ecx, [mouse_x] - mov edx, 12*8*65536 + 144 - mov esi, 0x50FFFFFF - xor edi, edi - mcall 47 - sub ecx, [pix1_x] - jns .sign1 - neg ecx -.sign1: - mov edx, 14*8*65536 + 164 - mov [dist_x], ecx - mcall 47 - mov ecx, [mouse_y] - mov edx, 18*8*65536 + 144 - mcall 47 - sub ecx, [pix1_y] - jns .sign2 - neg ecx -.sign2: - mov [dist_y], ecx - mov edx, 14*8*65536 + 184 - mcall 47 - mov ecx, [pix1_y] - mov edx, 18*8*65536 + 124 - mcall 47 - mov ecx, [pix1_x] - mov edx, 12*8*65536 + 124 - mcall 47 - - mov eax, [dist_x] - mov ebx, eax - mul bx - mov cx, dx - shl ecx, 16 - mov cx, ax - mov eax, [dist_y] - mov ebx, eax - mul bx - mov si, dx - shl esi, 16 - mov si, ax - add ecx, esi - mov [diag_l], ecx - finit - fild [diag_l] - fsqrt - fistp [diag_l] - - mov ebx, 0x80040000 - mov ecx, [diag_l] - mov edx, 12*8*65536 + 204 - mov esi, 0x50FFFFFF - xor edi, edi - mcall 47 - -.end: - ret - -;------------------------- Data area - if lang eq ru_RU -labelt: - db 3, 'Измеритель', 0 -start_pix: - db 'Пиксель 1 ( , )', 0 -end_pix: - db 'Пиксель 2 ( , )', 0 -measure_x: - db 'Дистанция x ( )', 0 -measure_y: - db 'Дистанция y ( )', 0 -measure_d: - db 'Диагональ ( )', 0 -inf: - db 'Нажмите пробел', 0 - - else -labelt: - db 3, 'Ruler', 0 -start_pix: - db 'Pixel 1 ( , )', 0 -end_pix: - db 'Pixel 2 ( , )', 0 -measure_x: - db 'Distance x ( )', 0 -measure_y: - db 'Distance y ( )', 0 -measure_d: - db 'Diagonal ( )', 0 -inf: - db 'Press Space', 0 - - end if -I_END: - align 4 - magnify_area_start_x dd ? - magnify_area_start_y dd ? - magnify_area_end_x dd ? - magnify_area_end_y dd ? - screen_size_x dd ? - screen_size_y dd ? - mouse_x dd ? - mouse_y dd ? - pix1_x dd 0 - pix1_y dd 0 - dist_x dd 0 - dist_y dd 0 - diag_l dd 0 -;--------------------------------------------------------------------- -procinfo: - rb 1024 -;--------------------------------------------------------------------- +;--------------------------------------------------------------------- +; Screen Ruler v1.0 +; Version for KolibriOS 2005-2023 +;--------------------------------------------------------------------- +; last update: 11.09.2023 +; created by: Subbotin Anton aka Spaceraven +;--------------------------------------------------------------------- + use32 + org 0x0 + db 'MENUET01'; 8 byte id + dd 1 ; header version + dd START ; program start + dd I_END ; program image size + dd 0x1000 ; required amount of memory + dd 0x1000 ; esp + dd 0, 0 ; no parameters, no path +;--------------------------------------------------------------------- + include 'lang.inc' ; Language support for locales: ru_RU (UTF-8), en_US. + include '..\..\macros.inc' + + delay = 20 + magnify_width = 48 + magnify_height = 30 + magnify_halfwidth = magnify_width / 2 + magnify_halfheight = magnify_height / 2 + aim0 = (magnify_halfheight - 1) * 65536 + magnify_halfwidth - 1 + aim1 = (magnify_halfheight - 1) * 65536 + magnify_halfwidth + 1 + aim2 = (magnify_halfheight + 1) * 65536 + magnify_halfwidth - 1 + aim3 = (magnify_halfheight + 1) * 65536 + magnify_halfwidth + 1 + +;------------------------- Main cycle +START: +redraw: + call draw_window +still: + call draw_magnify +wtevent: + mcall 23, delay ; wait here for event with timeout + dec eax + js still + jz redraw + dec eax + jnz button +; key in buffer + mov eax, 2 + mcall + cmp ah, 32 + jnz wtevent + mov eax, [mouse_x] + mov [pix1_x], eax + mov eax, [mouse_y] + mov [pix1_y], eax + + jmp wtevent +;--------------------------------------------------------------------- +button: +; we have only one button, close + + or eax, -1 + mcall +;------------------------- Window draw +draw_window: + mcall 12, 1 + + mov al, 48 ; function 48 : graphics parameters + mov bl, 4 ; subfunction 4 : get skin height + mcall + ; DRAW WINDOW + mov ebx, 100*65536 + 4*magnify_width + 9 + lea ecx, [eax + 100*65536 + 4*magnify_height + 128] + mov edx, 0x34000000 ; color of work area RRGGBB + mov edi, labelt ; header + xor eax, eax ; function 0 : define and draw window + mcall + mcall 71, 1, labelt + mcall 12,2 + ret +;------------------------- Magnify draw +draw_magnify: + mcall 9, procinfo, -1 + mov eax, [procinfo+70] ;status of window + test eax,100b + jne .end + + mcall 14 ; get screen size + movzx ecx, ax + inc ecx + mov [screen_size_y], ecx + shr eax, 16 + inc eax + mov [screen_size_x], eax + + xor ebx, ebx + mcall 37 ; get mouse coordinates + mov ecx, eax + shr ecx, 16 ; ecx = x + movzx edx, ax ; edx = y + mov [mouse_x], ecx + mov [mouse_y], edx + add ecx, magnify_halfwidth + add edx, magnify_halfheight + mov [magnify_area_end_x], ecx + mov [magnify_area_end_y], edx + sub ecx, magnify_width + sub edx, magnify_height + mov [magnify_area_start_x], ecx + mov [magnify_area_start_y], edx +.loop_y: +.loop_x: + xor eax, eax ; assume black color for invalid pixels + test ecx, ecx + js .nopix + cmp ecx, [screen_size_x] + jge .nopix + test edx, edx + js .nopix + cmp edx, [screen_size_y] + jge .nopix + mov ebx, edx + sub ebx, [magnify_area_start_y] + shl ebx, 16 + mov bx, cx + sub ebx, [magnify_area_start_x] + cmp ebx, aim0 + jz .nopix + cmp ebx, aim1 + jz .nopix + cmp ebx, aim2 + jz .nopix + cmp ebx, aim3 + jz .nopix + + mov ebx, edx + imul ebx, [screen_size_x] + add ebx, ecx + mcall 35 ; read pixel + +.nopix: + push ecx edx + sub ecx, [magnify_area_start_x] + sub edx, [magnify_area_start_y] + mov ebx, ecx + shl ebx, 2+16 + mov bl, 4 + mov ecx, edx + shl ecx, 2+16 + mov cl, 4 + mov edx, eax + mcall 13 ; draw rectangle 8x8 + pop edx ecx + + inc ecx + cmp ecx, [magnify_area_end_x] + jnz .loop_x + mov ecx, [magnify_area_start_x] + inc edx + cmp edx, [magnify_area_end_y] + jnz .loop_y + +;------------------------- Measure labels draw + mov eax, 4 + mov ebx, 8*65536 + 124 + mov ecx, 11110000111100001111000011110000b + mov edx, start_pix + xor edi, edi + mcall 4 + add ebx, 20 + mov edx, end_pix + mcall 4 + add ebx, 20 + mov edx, measure_x + mcall 4 + add ebx, 20 + mov edx, measure_y + mcall 4 + add ebx, 20 + mov edx, measure_d + mcall 4 + add ebx, 20 + mov edx, inf + mcall 4 + + mov ebx, 0x80040000 + mov ecx, [mouse_x] + mov edx, 12*8*65536 + 144 + mov esi, 0x50FFFFFF + xor edi, edi + mcall 47 + sub ecx, [pix1_x] + jns .sign1 + neg ecx +.sign1: + mov edx, 14*8*65536 + 164 + mov [dist_x], ecx + mcall 47 + mov ecx, [mouse_y] + mov edx, 18*8*65536 + 144 + mcall 47 + sub ecx, [pix1_y] + jns .sign2 + neg ecx +.sign2: + mov [dist_y], ecx + mov edx, 14*8*65536 + 184 + mcall 47 + mov ecx, [pix1_y] + mov edx, 18*8*65536 + 124 + mcall 47 + mov ecx, [pix1_x] + mov edx, 12*8*65536 + 124 + mcall 47 + + mov eax, [dist_x] + mov ebx, eax + mul bx + mov cx, dx + shl ecx, 16 + mov cx, ax + mov eax, [dist_y] + mov ebx, eax + mul bx + mov si, dx + shl esi, 16 + mov si, ax + add ecx, esi + mov [diag_l], ecx + finit + fild [diag_l] + fsqrt + fistp [diag_l] + + mov ebx, 0x80040000 + mov ecx, [diag_l] + mov edx, 12*8*65536 + 204 + mov esi, 0x50FFFFFF + xor edi, edi + mcall 47 + +.end: + ret + +;------------------------- Data area +if lang eq ru_RU +labelt: + db 3, 'Измеритель', 0 +start_pix: + db 'Пиксель 1 ( , )', 0 +end_pix: + db 'Пиксель 2 ( , )', 0 +measure_x: + db 'Дистанция x ( )', 0 +measure_y: + db 'Дистанция y ( )', 0 +measure_d: + db 'Диагональ ( )', 0 +inf: + db 'Нажмите пробел', 0 + +else ; Default to en_US +labelt: + db 3, 'Ruler', 0 +start_pix: + db 'Pixel 1 ( , )', 0 +end_pix: + db 'Pixel 2 ( , )', 0 +measure_x: + db 'Distance x ( )', 0 +measure_y: + db 'Distance y ( )', 0 +measure_d: + db 'Diagonal ( )', 0 +inf: + db 'Press Space', 0 + +end if + +I_END: + align 4 + magnify_area_start_x dd ? + magnify_area_start_y dd ? + magnify_area_end_x dd ? + magnify_area_end_y dd ? + screen_size_x dd ? + screen_size_y dd ? + mouse_x dd ? + mouse_y dd ? + pix1_x dd 0 + pix1_y dd 0 + dist_x dd 0 + dist_y dd 0 + diag_l dd 0 +;--------------------------------------------------------------------- +procinfo: + rb 1024 +;--------------------------------------------------------------------- diff --git a/programs/demos/magnify/trunk/magnify.asm b/programs/demos/magnify/trunk/magnify.asm index c54e94470..131720f91 100644 --- a/programs/demos/magnify/trunk/magnify.asm +++ b/programs/demos/magnify/trunk/magnify.asm @@ -19,7 +19,7 @@ dd 0x1000 ; esp dd 0, 0 ; no parameters, no path ;--------------------------------------------------------------------- -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. include '..\..\..\macros.inc' delay equ 20 @@ -52,7 +52,7 @@ button: ;--------------------------------------------------------------------- draw_window: mcall 12,1 - + mov al, 48 ; function 48 : graphics parameters mov bl, 4 ; subfunction 4 : get skin height mcall @@ -63,7 +63,7 @@ draw_window: mov edi, labelt ; header xor eax, eax ; function 0 : define and draw window mcall - + mcall 12,2 ret ;--------------------------------------------------------------------- @@ -80,7 +80,7 @@ draw_magnify: shr eax, 16 inc eax mov [size_x], eax - + xor ebx, ebx mcall 37 ; get mouse coordinates mov ecx, eax @@ -137,7 +137,7 @@ draw_magnify: if lang eq ru_RU labelt: db 'Magnifier - ࠭ 㯠', 0 -else +else ; Default to en_US labelt: db 'Magnifier', 0 end if diff --git a/programs/demos/timer/trunk/timer.asm b/programs/demos/timer/trunk/timer.asm index 1d7f8723f..137fdb342 100644 --- a/programs/demos/timer/trunk/timer.asm +++ b/programs/demos/timer/trunk/timer.asm @@ -16,7 +16,7 @@ use32 dd 0x1000 ; esp dd 0x0 , 0x0 ; I_Param , I_Icon -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. include '..\..\..\macros.inc' START: ; start of execution @@ -139,7 +139,7 @@ draw_window: if lang eq ru_RU title db '',0 -else +else ; Default to en_US title db 'TIMER',0 end if diff --git a/programs/develop/examples/template/trunk/build_fr.bat b/programs/develop/examples/template/trunk/build_fr.bat index 38f0b598a..4d5f0b2e5 100644 --- a/programs/develop/examples/template/trunk/build_fr.bat +++ b/programs/develop/examples/template/trunk/build_fr.bat @@ -1,5 +1,5 @@ @erase lang.inc -@echo lang fix fr >lang.inc +@echo lang fix fr_FR >lang.inc @fasm template.asm template @erase lang.inc -@pause \ No newline at end of file +@pause diff --git a/programs/develop/examples/template/trunk/template.asm b/programs/develop/examples/template/trunk/template.asm index 28d58ddac..5380ae9d1 100644 --- a/programs/develop/examples/template/trunk/template.asm +++ b/programs/develop/examples/template/trunk/template.asm @@ -5,10 +5,10 @@ ; last update: 1/03/2007 ; written by: Ivan Poddubny ; e-mail: ivan-yar@bk.ru -;modified by: Heavyiron, maxcodehack +; modified by: Heavyiron, maxcodehack ; <--- include all KolibriOS stuff ---> -include "lang.inc" +include "lang.inc" ; Language support for locales: ru_RU (CP866), fr_FR, en_US. include "..\..\..\..\macros.inc" @@ -62,7 +62,7 @@ CODE xor eax, eax ; create and draw the window mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx) mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy) - mov edx, [sc.work] ; work area color + mov edx, [sc.work] ; work area color or edx, 0x33000000 ; & window type 3 mov edi, title ; window title int 0x40 @@ -80,7 +80,7 @@ if lang eq ru_RU title db ' ணࠬ',0 else if lang eq fr_FR title db 'La programme poncive',0 -else +else ; Default to en_US title db 'Template program',0 end if diff --git a/programs/develop/examples/thread/trunk/thread.asm b/programs/develop/examples/thread/trunk/thread.asm index 07eb0b117..f5b7686a7 100644 --- a/programs/develop/examples/thread/trunk/thread.asm +++ b/programs/develop/examples/thread/trunk/thread.asm @@ -15,7 +15,7 @@ dd 0x2000 ; esp dd 0x0 , 0x0 ; I_Param , I_Icon -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. include '..\..\..\..\macros.inc' @@ -97,7 +97,7 @@ draw_window: mov edi,title ; WINDOW LABEL mcall - + mov eax,8 ; NEW THREAD BUTTON mov ebx,20*65536+128 mov ecx,63*65536+20 @@ -136,11 +136,11 @@ if lang eq ru_RU db ' ⮪ . ' db ' ' db ' ' - db 'x' ; <- END MARKER, DONT DELETE + db 'x' ; <- END MARKER, DO NOT DELETE title db 'ਬ ᯮ짮 ⮪',0 -else +else ; Default to en_US text: db 'THIS EXAMPLE CREATES THREADS BY RUNNING ' db 'THE SAME CODE MULTIPLE TIMES. ALL WE ' @@ -149,7 +149,7 @@ else db ' ' db ' ' db ' CREATE NEW THREAD ' - db 'x' ; <- END MARKER, DONT DELETE + db 'x' ; <- END MARKER, DO NOT DELETE title db 'THREAD EXAMPLE',0 diff --git a/programs/develop/fasm/1.73/traslations.inc b/programs/develop/fasm/1.73/traslations.inc index 3f250a683..d594abfd9 100644 --- a/programs/develop/fasm/1.73/traslations.inc +++ b/programs/develop/fasm/1.73/traslations.inc @@ -1,43 +1,42 @@ - -include 'lang.inc' - -if lang eq ru_RU - -text db ' 唠:','唠:',' :' - .line_size = ($-text)/3 - -s_compile db '.' -s_run db ' ' -s_debug db '⫠' -s_dbgdescr db ' ⫠ ଠ',0 - -sz_EPnotFound db 'Not found entry point to ',0 -sizeof.sz_EPnotFound = $-sz_EPnotFound - -sz_cantLL db 'Can not load library ',0 -sizeof.sz_cantLL = $-sz_cantLL - -sz_system_error db 'System error: ',0 -sizeof.sz_system_error = $-sz_system_error - -else - -text db ' InFile:','OutFile:',' Path:' - .line_size = ($-text)/3 - -s_compile db 'COMPILE' -s_run db ' RUN ' -s_debug db ' DEBUG ' -s_dbgdescr db 'Generate debug information',0 - -sz_EPnotFound db 'Not found entry point to ',0 -sizeof.sz_EPnotFound = $-sz_EPnotFound - -sz_cantLL db 'Can not load library ',0 -sizeof.sz_cantLL = $-sz_cantLL - -sz_system_error db 'System error: ',0 -sizeof.sz_system_error = $-sz_system_error - -end if - + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +if lang eq ru_RU + +text db ' 唠:','唠:',' :' + .line_size = ($-text)/3 + +s_compile db '.' +s_run db ' ' +s_debug db '⫠' +s_dbgdescr db ' ⫠ ଠ',0 + +sz_EPnotFound db 'Not found entry point to ',0 +sizeof.sz_EPnotFound = $-sz_EPnotFound + +sz_cantLL db 'Cannot load library ',0 +sizeof.sz_cantLL = $-sz_cantLL + +sz_system_error db 'System error: ',0 +sizeof.sz_system_error = $-sz_system_error + +else ; Default to en_US + +text db ' InFile:','OutFile:',' Path:' + .line_size = ($-text)/3 + +s_compile db 'COMPILE' +s_run db ' RUN ' +s_debug db ' DEBUG ' +s_dbgdescr db 'Generate debug information',0 + +sz_EPnotFound db 'Not found entry point to ',0 +sizeof.sz_EPnotFound = $-sz_EPnotFound + +sz_cantLL db 'Cannot load library ',0 +sizeof.sz_cantLL = $-sz_cantLL + +sz_system_error db 'System error: ',0 +sizeof.sz_system_error = $-sz_system_error + +end if diff --git a/programs/develop/h2d2b/trunk/h2d2b.asm b/programs/develop/h2d2b/trunk/h2d2b.asm index 157ddf5fe..eddd82ee2 100644 --- a/programs/develop/h2d2b/trunk/h2d2b.asm +++ b/programs/develop/h2d2b/trunk/h2d2b.asm @@ -22,7 +22,7 @@ include '../../../macros.inc' ; include '../../../KOSfuncs.inc' include '../../../load_lib.mac' include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. @use_library @@ -170,7 +170,7 @@ draw_window: ;or esi, [sys_colors.grab_text] mcall SF_CREATE_WINDOW, 200*65536+WIN_W, 200*65536+179, ,,title - + mcall SF_DEFINE_BUTTON, 15*65536+42,106*65536+ 21, 2, [sys_colors.work_button] ; shl mcall , 70*65536+42, , , ; sal mcall , (WIN_W-55)*65536+42, , 3, ; shr @@ -196,7 +196,7 @@ draw_window: mcall SF_DRAW_NUMBER, 10*65536, ,(WIN_W-92)*65536+62, ; 10- BIN_LINE_BLOCK_W = 76 - mcall SF_DRAW_NUMBER, 8*65536+512,,(WIN_W-BIN_LINE_BLOCK_W)*65536+30 ; 2- + mcall SF_DRAW_NUMBER, 8*65536+512,,(WIN_W-BIN_LINE_BLOCK_W)*65536+30 ; 2- ror ecx, 8 mov edx, (WIN_W-BIN_LINE_BLOCK_W*2)*65536+30 mcall @@ -275,7 +275,7 @@ string1_end: if lang eq ru_RU numstr db '᫮:',0 Okstr db '',0 -else +else ; Default to en_US numstr db 'Number:',0 Okstr db 'Enter',0 end if diff --git a/programs/develop/heed/trunk/heed.asm b/programs/develop/heed/trunk/heed.asm index 6621e35fe..8c3c30f06 100644 --- a/programs/develop/heed/trunk/heed.asm +++ b/programs/develop/heed/trunk/heed.asm @@ -13,7 +13,7 @@ ; Marat Zakiyanov aka Mario79, aka Mario ;-------------------------------------------------------------------- ; v.014 05.02.2010 -; +; ; PageUp, PageDown - ࠭ / ; Ctrl+UP, Ctrl+Down - ப⪠ ࠭ ப / ᬥ饭 ; Home,End - 砫/ ப @@ -59,9 +59,9 @@ use32 ;-------------------------------------------------------------------- _title equ 'HeEd 0.16', 0 -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. include '../../../KOSfuncs.inc' -include '../../../config.inc' ;for nightbuild +include '../../../config.inc' ; for nightbuild include '../../../macros.inc' include '../../libraries/box_lib/trunk/box_lib.mac' include '../../../load_lib.mac' @@ -108,25 +108,25 @@ load_libraries l_libs_start,end_l_libs ;OpenDialog initialisation push dword OpenDialog_data call [OpenDialog_Init] -;-------------------------------------------------------------------- +;-------------------------------------------------------------------- mov esi,fname_buf cmp [esi],byte 0 je .start_temp_file_name - + cld @@: lodsb test al,al jne @b - + std @@: lodsb - cmp al,'/' + cmp al,'/' jne @b add esi,2 jmp .selected_start_file_name -;-------------------------------------------------------------------- +;-------------------------------------------------------------------- .start_temp_file_name: mov esi,start_temp_file_name .selected_start_file_name: @@ -1068,7 +1068,7 @@ main_area: mov ecx,edx mov edx,frgrd_color movzx ebx,[scroll_bar_data_vertical.x_pos] - + mov ax,[scroll_bar_data_vertical.x_size] test ax,ax jnz .no_inc_ebx @@ -1091,7 +1091,7 @@ main_area: shl ebx,16 mov bx,ax mov cx,16 - + mov ax,[scroll_bar_data_vertical.x_size] test ax,ax jnz .no_inc_ebx_2 @@ -1938,13 +1938,13 @@ draw_ed_box: ; cmp al,1 jne .2 call draw_window - + mov eax,[threath_buf+70] test eax,10b jnz .2 test eax,100b jnz .2 - + call main_area bt [flags],2 jnc @f @@ -2805,7 +2805,7 @@ Ctrl_V: mov [shblock_end],eax jmp red ;-------------------------------------------------------------------- -;᫨ 뤥, ⠢塞 । ஬ +;᫨ 뤥, ⠢塞 । ஬ .past_kurs: ; bt [flags],1 ; jnc still @@ -2965,7 +2965,7 @@ menu_data_1: .x1: if lang eq ru_RU .size_x1 dw 4*2+9*6 ;+32 -else +else ; Default to en_US .size_x1 dw 40 ;+32 end if .start_x1 dw 2 ;+34 @@ -3000,7 +3000,7 @@ if lang eq ru_RU db '',0 db '࠭',0 db '室',0 -else +else ; Default to en_US db 'File',0 .1: db 'Open',0 @@ -3056,7 +3056,7 @@ menu_text_area_2: if lang eq ru_RU db '',0 .1: -else +else ; Default to en_US db 'View',0 .1: end if @@ -3074,7 +3074,7 @@ menu_data_3: .x: if lang eq ru_RU .size_x dw 4*2+7*6 ;+32 -else +else ; Default to en_US .size_x dw 40 ;+4 end if .start_x dw 84 ;+6 @@ -3089,7 +3089,7 @@ end if .x1: if lang eq ru_RU .size_x1 dw 4*2+7*6 ;+32 -else +else ; Default to en_US .size_x1 dw 40 ;+32 end if .start_x1 dw 84 ;+34 @@ -3122,7 +3122,7 @@ if lang eq ru_RU db 'ࠢ',0 .1: db 'ࠢ',0 -else +else ; Default to en_US db 'Help',0 .1: db 'Help',0 @@ -3155,7 +3155,7 @@ if lang eq ru_RU .e2: .3 db '' .e3: -else +else ; Default to en_US .1 db 'Absolutely' .e1: .2 db 'Forward' @@ -3181,7 +3181,7 @@ head_f_i: if lang eq ru_RU error_open_file_string db " !",0 error_save_file_string db " ࠭!",0 -else +else ; Default to en_US error_open_file_string db "Isn't found!",0 error_save_file_string db "Isn't saved!",0 end if @@ -3240,7 +3240,7 @@ if lang eq ru_RU db 'Ctrl+C - ஢ ' db 'Ctrl+V - ⠢ 뤥 ' db 'Ctrl+X - १ ' -else +else ; Default to en_US db 'Ctrl+O - open file ' db 'Ctrl+S - save file ' db 'PageUp, PageDown - page up/down ' @@ -3268,7 +3268,7 @@ help_end: ;align 4096 font_buffer file 'cp866-8x16' ;ASCII+cp866 (+,) cp1251 file 'cp1251-8x16' -koi8_r file 'koi8-r-8x16' +koi8_r file 'koi8-r-8x16' title db _title ;--------------------------------------------------------------------- diff --git a/programs/develop/info3ds/convert_stl_3ds.inc b/programs/develop/info3ds/convert_stl_3ds.inc index 10fdbc935..4b8e79ab0 100644 --- a/programs/develop/info3ds/convert_stl_3ds.inc +++ b/programs/develop/info3ds/convert_stl_3ds.inc @@ -1,459 +1,460 @@ -; -; 㭪樨 ८ࠧ 䠩 *.stl *.3ds -; -; ᮧ 䠩 *.3ds: -; CHUNK_MAIN (40+n+v+f) -; + CHUNK_OBJMESH (34+n+v+f) -; + CHUNK_OBJBLOCK (28+n+v+f) -; + CHUNK_TRIMESH (22+v+f) -; + CHUNK_VERTLIST (8+v) -; + CHUNK_FACELIST (8+f) -; -; ᪮ 㪠 ࠧ : -; n - ꥪ -; v - 設 -; f - ࠭ - -; ଠ ୮ *.stl: -; char[80] - -; uint32 - ᫮ ࠭ -; ࠭: -; float[3] - ଠ -; float[9] - 設 1,2,3 -; uint16 - ਡ - - -if lang eq ru_RU -txt_err_stl_open: - db '"STL',13,10 - db ' *.stl 祭 让." -tW',0 -txt_err_stl_null_v: - db '"STL',13,10 - db '設 ." -tE',0 -else -txt_err_stl_open: - db '"STL',13,10 - db 'File *.stl is very large." -tW',0 -txt_err_stl_null_v: - db '"STL',13,10 - db 'Vertexes not found." -tE',0 -end if - -;output: -; eax - 㪠⥫ ନ஢ 䠩 3ds ( 砥 㤠 0) -; ecx - ࠧ ନ஢ 䠩 3ds -align 4 -proc convert_stl_3ds uses ebx edx edi esi, f_data:dword, f_size:dword -locals - c_mem dd ? ; ८ࠧ (convert memory) - c_size dd ? ;ࠧ ८ࠧ (convert memory size) - vert_c dd ? ;᫮ 設 (vertex count) - face_c dd ? ;᫮ ࠭ (faces count) -endl - xor eax,eax - mov esi,[f_data] - cmp dword[esi],'soli' - jne .bin_stl - cmp word[esi+4],'d ' - jne .bin_stl - - jmp @f - .bin_stl: - ;஢塞 䠩 ଠ - mov ecx,[esi+80] - imul ecx,50 - add ecx,84 ; - cmp ecx,[f_size] - jne .no_stl - call convert_binary_stl - jmp .no_stl - @@: - - ; 砫 'solid ' - stdcall txt_next_line, 80 - - mov eax,[f_data] - sub eax,esi - add eax,[f_size] - stdcall get_stl_vertex_count, esi,eax - or eax,eax - jnz @f - notify_window_run txt_err_stl_null_v - jmp .no_stl - @@: - cmp eax,0xffff - jle @f - notify_window_run txt_err_stl_open - mov eax,0xffff - @@: - - mov [vert_c],eax - mov ecx,3 - xor edx,edx - div ecx - mov [face_c],eax - shl eax,3 - mov ecx,[vert_c] - imul ecx,12 - lea ecx,[ecx+eax+40] - lea edx,[esi-6] - sub edx,[f_data] - cmp edx,2 - jge @f - mov edx,2 ; ࠧ ꥪ - @@: - add ecx,edx ;for object name - mov [c_size],ecx - stdcall mem.Alloc,ecx - mov [c_mem],eax - mov ebx,eax - - mov word[ebx],CHUNK_MAIN - mov dword[ebx+2],ecx - add ebx,6 - - ;3d3d - mov word[ebx],CHUNK_OBJMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4000 - mov word[ebx],CHUNK_OBJBLOCK - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - push ecx esi - mov ecx,edx - mov edi,ebx - mov esi,[f_data] - add esi,6 ;ய᪠ 'solid ' - rep movsb ;㥬 ꥪ - mov byte[edi-1],0 - add ebx,edx - pop esi ecx - - ;4100 - mov word[ebx],CHUNK_TRIMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4110 - mov word[ebx],CHUNK_VERTLIST - mov dword[ebx+2],8 ;+ ᫮ 設 * 12 - add ebx,6 - - mov edx,ebx - mov word[edx],0 ;. 設 - add ebx,2 - finit - .cycle0: - call txt_ignore_space - cmp dword[esi],'face' - jne .end_v - stdcall txt_next_line, 80 - - call txt_ignore_space - cmp dword[esi],'oute' - jne .end_v - stdcall txt_next_line, 80 - - mov ecx,3 ;3 窨 1 ࠭ - @@: - stdcall stl_vertex_init, ebx - or eax,eax - jz .end_v - add ebx,12 - inc word[edx] - loop @b - - mov eax,[vert_c] - cmp word[edx],ax - jge .end_v - call txt_ignore_space - cmp dword[esi],'endl' - jne .end_v - stdcall txt_next_line, 80 - - call txt_ignore_space - cmp dword[esi],'endf' - jne .end_v - stdcall txt_next_line, 80 - jmp .cycle0 - .end_v: - - movzx eax,word[edx] - imul eax,12 - add [edx-4],eax ;ࠢ塞 ࠧ 4110 - - ;4120 - mov word[ebx],CHUNK_FACELIST - mov ecx,[face_c] - mov edx,ecx - shl edx,3 ;. ࠭ * 8 - add edx,8 - mov [ebx+2],edx - add ebx,6 - mov [ebx],cx ;. ࠭ - add ebx,2 - xor eax,eax - @@: - mov [ebx],ax - inc eax - mov [ebx+2],ax - inc eax - mov [ebx+4],ax - inc eax - mov word[ebx+6],0 ;ਡ - add ebx,8 - loop @b - - mov eax,[c_mem] - mov ecx,[c_size] - .no_stl: - ret -endp - -;input: -; esi - 㪠⥫ 砫 䠩 -; ecx - ࠧ 䠩 -align 4 -proc convert_binary_stl -locals - c_mem dd ? ; ८ࠧ (convert memory) - c_size dd ? ;ࠧ ८ࠧ (convert memory size) - vert_c dd ? ;᫮ 設 (vertex count) - face_c dd ? ;᫮ ࠭ (faces count) -endl - mov eax,[esi+80] - or eax,eax - jnz @f - notify_window_run txt_err_stl_null_v - jmp .no_stl - @@: - cmp eax,0xffff/3 - jle @f - notify_window_run txt_err_stl_open - mov eax,0xffff/3 - @@: - - mov [face_c],eax - mov ecx,eax - imul eax,3 - mov [vert_c],eax - shl ecx,3 - imul eax,12 - lea ecx,[ecx+eax+40+4] ;+4 ࠧ ꥪ - mov [c_size],ecx - stdcall mem.Alloc,ecx - mov [c_mem],eax - mov ebx,eax - - mov word[ebx],CHUNK_MAIN - mov dword[ebx+2],ecx - add ebx,6 - - ;3d3d - mov word[ebx],CHUNK_OBJMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4000 - mov word[ebx],CHUNK_OBJBLOCK - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - mov dword[ebx],'Stl' ; ꥪ - add ebx,4 - - ;4100 - mov word[ebx],CHUNK_TRIMESH - sub ecx,6 - mov dword[ebx+2],ecx - add ebx,6 - - ;4110 - mov word[ebx],CHUNK_VERTLIST - mov dword[ebx+2],8 ;+ ᫮ 設 * 12 - add ebx,6 - - mov edx,ebx - mov ecx,[vert_c] - mov word[edx],cx ;. 設 - add ebx,2 - - add esi,80+4+12 ;ய , ᫠ ࠭, 1- ଠ - mov edi,ebx - mov eax,[face_c] - @@: ;横 ࠭ - mov ecx,9 - rep movsd ;㥬 न 3- 設 - add esi,14 ;ய ଠ ਡ⮢ - dec eax - jnz @b - mov ebx,edi - - movzx eax,word[edx] - imul eax,12 - add [edx-4],eax ;ࠢ塞 ࠧ 4110 - - ;4120 - mov word[ebx],CHUNK_FACELIST - mov ecx,[face_c] - mov edx,ecx - shl edx,3 ;. ࠭ * 8 - add edx,8 - mov [ebx+2],edx - add ebx,6 - mov [ebx],cx ;. ࠭ - add ebx,2 - xor eax,eax - @@: - mov [ebx],ax - inc eax - mov [ebx+2],ax - inc eax - mov [ebx+4],ax - inc eax - mov word[ebx+6],0 ;ਡ - add ebx,8 - loop @b - - mov eax,[c_mem] - mov ecx,[c_size] - .no_stl: - ret -endp - -;output: -; eax - vertex count -align 4 -proc get_stl_vertex_count uses ebx ecx edi, f_data:dword, f_size:dword - mov al,'v' - xor ebx,ebx - mov ecx,[f_size] - mov edi,[f_data] - .cycle0: - repne scasb - cmp dword[edi],'erte' - jne @f - inc ebx - add edi,4 - sub ecx,4 - cmp ecx,4 - jg .cycle0 - @@: - mov eax,ebx - ret -endp - -;input: -; esi - input description text -; ppoi - pointer to vertex struct -;output: -; eax - 0 (if error init) or 1 -; esi - output description text -align 4 -proc stl_vertex_init uses ebx ecx edi, ppoi:dword - call txt_ignore_space - cmp dword[esi],'vert' - jne .err_init - cmp word[esi+4],'ex' - jne .err_init - add esi,6 - mov ebx,[ppoi] - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx] ;coord X - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx+4] ;coord X - - call txt_copy_data - call String_to_DoubleFloat - fld qword[Data_Double] - fstp dword[ebx+8] ;coord Z - - stdcall txt_next_line, 80 - jmp @f - .err_init: - xor eax,eax - jmp .end_f - @@: - xor eax,eax - inc eax - .end_f: - ret -endp - -;input: -; esi - 㪠⥫ 砫 ப ஡ -;output: -; al - destroy -; ecx - destroy -; esi - 㪠⥫ ஡ ᨬ -align 4 -txt_ignore_space: - mov ecx,64 ; 横 - @@: - lodsb - cmp al,' ' - jne @f - loop @b - @@: - dec esi - ret - -;input: -; esi - 㪠⥫ ப ᫮ (஡ 砫 ப ) -;output: -; al - destroy -; ecx - destroy -; edi - destroy -; esi - 㪠⥫ ஢ ᫠ -; Data_String - ப ᫮ esi -align 4 -txt_copy_data: - call txt_ignore_space - mov ecx,32 - mov edi,esi - @@: - lodsb - or al,al - jz @f - cmp al,' ' - je @f - cmp al,13 - je @f - loop @b - @@: - mov esi,edi - sub ecx,32 - neg ecx - mov edi,Data_String - rep movsb - mov byte[edi],0 - ret - -;input: -; esi - text pointer -align 4 -proc txt_next_line uses eax ecx edi, mlen:dword - mov al,13 - mov ecx,[mlen] - mov edi,esi - repne scasb - cmp byte[edi],10 - jne @f - inc edi - @@: - mov esi,edi - ret -endp +; +; 㭪樨 ८ࠧ 䠩 *.stl *.3ds +; +; ᮧ 䠩 *.3ds: +; CHUNK_MAIN (40+n+v+f) +; + CHUNK_OBJMESH (34+n+v+f) +; + CHUNK_OBJBLOCK (28+n+v+f) +; + CHUNK_TRIMESH (22+v+f) +; + CHUNK_VERTLIST (8+v) +; + CHUNK_FACELIST (8+f) +; +; ᪮ 㪠 ࠧ : +; n - ꥪ +; v - 設 +; f - ࠭ + +; ଠ ୮ *.stl: +; char[80] - +; uint32 - ᫮ ࠭ +; ࠭: +; float[3] - ଠ +; float[9] - 設 1,2,3 +; uint16 - ਡ + + ; Language support for locales: ru_RU (CP866), en_US. + +if lang eq ru_RU +txt_err_stl_open: + db '"STL',13,10 + db ' *.stl 祭 让." -tW',0 +txt_err_stl_null_v: + db '"STL',13,10 + db '設 ." -tE',0 +else ; Default to en_US +txt_err_stl_open: + db '"STL',13,10 + db 'File *.stl is very large." -tW',0 +txt_err_stl_null_v: + db '"STL',13,10 + db 'Vertexes not found." -tE',0 +end if + +;output: +; eax - 㪠⥫ ନ஢ 䠩 3ds ( 砥 㤠 0) +; ecx - ࠧ ନ஢ 䠩 3ds +align 4 +proc convert_stl_3ds uses ebx edx edi esi, f_data:dword, f_size:dword +locals + c_mem dd ? ; ८ࠧ (convert memory) + c_size dd ? ;ࠧ ८ࠧ (convert memory size) + vert_c dd ? ;᫮ 設 (vertex count) + face_c dd ? ;᫮ ࠭ (faces count) +endl + xor eax,eax + mov esi,[f_data] + cmp dword[esi],'soli' + jne .bin_stl + cmp word[esi+4],'d ' + jne .bin_stl + + jmp @f + .bin_stl: + ;஢塞 䠩 ଠ + mov ecx,[esi+80] + imul ecx,50 + add ecx,84 ; + cmp ecx,[f_size] + jne .no_stl + call convert_binary_stl + jmp .no_stl + @@: + + ; 砫 'solid ' + stdcall txt_next_line, 80 + + mov eax,[f_data] + sub eax,esi + add eax,[f_size] + stdcall get_stl_vertex_count, esi,eax + or eax,eax + jnz @f + notify_window_run txt_err_stl_null_v + jmp .no_stl + @@: + cmp eax,0xffff + jle @f + notify_window_run txt_err_stl_open + mov eax,0xffff + @@: + + mov [vert_c],eax + mov ecx,3 + xor edx,edx + div ecx + mov [face_c],eax + shl eax,3 + mov ecx,[vert_c] + imul ecx,12 + lea ecx,[ecx+eax+40] + lea edx,[esi-6] + sub edx,[f_data] + cmp edx,2 + jge @f + mov edx,2 ; ࠧ ꥪ + @@: + add ecx,edx ;for object name + mov [c_size],ecx + stdcall mem.Alloc,ecx + mov [c_mem],eax + mov ebx,eax + + mov word[ebx],CHUNK_MAIN + mov dword[ebx+2],ecx + add ebx,6 + + ;3d3d + mov word[ebx],CHUNK_OBJMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4000 + mov word[ebx],CHUNK_OBJBLOCK + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + push ecx esi + mov ecx,edx + mov edi,ebx + mov esi,[f_data] + add esi,6 ;ய᪠ 'solid ' + rep movsb ;㥬 ꥪ + mov byte[edi-1],0 + add ebx,edx + pop esi ecx + + ;4100 + mov word[ebx],CHUNK_TRIMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4110 + mov word[ebx],CHUNK_VERTLIST + mov dword[ebx+2],8 ;+ ᫮ 設 * 12 + add ebx,6 + + mov edx,ebx + mov word[edx],0 ;. 設 + add ebx,2 + finit + .cycle0: + call txt_ignore_space + cmp dword[esi],'face' + jne .end_v + stdcall txt_next_line, 80 + + call txt_ignore_space + cmp dword[esi],'oute' + jne .end_v + stdcall txt_next_line, 80 + + mov ecx,3 ;3 窨 1 ࠭ + @@: + stdcall stl_vertex_init, ebx + or eax,eax + jz .end_v + add ebx,12 + inc word[edx] + loop @b + + mov eax,[vert_c] + cmp word[edx],ax + jge .end_v + call txt_ignore_space + cmp dword[esi],'endl' + jne .end_v + stdcall txt_next_line, 80 + + call txt_ignore_space + cmp dword[esi],'endf' + jne .end_v + stdcall txt_next_line, 80 + jmp .cycle0 + .end_v: + + movzx eax,word[edx] + imul eax,12 + add [edx-4],eax ;ࠢ塞 ࠧ 4110 + + ;4120 + mov word[ebx],CHUNK_FACELIST + mov ecx,[face_c] + mov edx,ecx + shl edx,3 ;. ࠭ * 8 + add edx,8 + mov [ebx+2],edx + add ebx,6 + mov [ebx],cx ;. ࠭ + add ebx,2 + xor eax,eax + @@: + mov [ebx],ax + inc eax + mov [ebx+2],ax + inc eax + mov [ebx+4],ax + inc eax + mov word[ebx+6],0 ;ਡ + add ebx,8 + loop @b + + mov eax,[c_mem] + mov ecx,[c_size] + .no_stl: + ret +endp + +;input: +; esi - 㪠⥫ 砫 䠩 +; ecx - ࠧ 䠩 +align 4 +proc convert_binary_stl +locals + c_mem dd ? ; ८ࠧ (convert memory) + c_size dd ? ;ࠧ ८ࠧ (convert memory size) + vert_c dd ? ;᫮ 設 (vertex count) + face_c dd ? ;᫮ ࠭ (faces count) +endl + mov eax,[esi+80] + or eax,eax + jnz @f + notify_window_run txt_err_stl_null_v + jmp .no_stl + @@: + cmp eax,0xffff/3 + jle @f + notify_window_run txt_err_stl_open + mov eax,0xffff/3 + @@: + + mov [face_c],eax + mov ecx,eax + imul eax,3 + mov [vert_c],eax + shl ecx,3 + imul eax,12 + lea ecx,[ecx+eax+40+4] ;+4 ࠧ ꥪ + mov [c_size],ecx + stdcall mem.Alloc,ecx + mov [c_mem],eax + mov ebx,eax + + mov word[ebx],CHUNK_MAIN + mov dword[ebx+2],ecx + add ebx,6 + + ;3d3d + mov word[ebx],CHUNK_OBJMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4000 + mov word[ebx],CHUNK_OBJBLOCK + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + mov dword[ebx],'Stl' ; ꥪ + add ebx,4 + + ;4100 + mov word[ebx],CHUNK_TRIMESH + sub ecx,6 + mov dword[ebx+2],ecx + add ebx,6 + + ;4110 + mov word[ebx],CHUNK_VERTLIST + mov dword[ebx+2],8 ;+ ᫮ 設 * 12 + add ebx,6 + + mov edx,ebx + mov ecx,[vert_c] + mov word[edx],cx ;. 設 + add ebx,2 + + add esi,80+4+12 ;ய , ᫠ ࠭, 1- ଠ + mov edi,ebx + mov eax,[face_c] + @@: ;横 ࠭ + mov ecx,9 + rep movsd ;㥬 न 3- 設 + add esi,14 ;ய ଠ ਡ⮢ + dec eax + jnz @b + mov ebx,edi + + movzx eax,word[edx] + imul eax,12 + add [edx-4],eax ;ࠢ塞 ࠧ 4110 + + ;4120 + mov word[ebx],CHUNK_FACELIST + mov ecx,[face_c] + mov edx,ecx + shl edx,3 ;. ࠭ * 8 + add edx,8 + mov [ebx+2],edx + add ebx,6 + mov [ebx],cx ;. ࠭ + add ebx,2 + xor eax,eax + @@: + mov [ebx],ax + inc eax + mov [ebx+2],ax + inc eax + mov [ebx+4],ax + inc eax + mov word[ebx+6],0 ;ਡ + add ebx,8 + loop @b + + mov eax,[c_mem] + mov ecx,[c_size] + .no_stl: + ret +endp + +;output: +; eax - vertex count +align 4 +proc get_stl_vertex_count uses ebx ecx edi, f_data:dword, f_size:dword + mov al,'v' + xor ebx,ebx + mov ecx,[f_size] + mov edi,[f_data] + .cycle0: + repne scasb + cmp dword[edi],'erte' + jne @f + inc ebx + add edi,4 + sub ecx,4 + cmp ecx,4 + jg .cycle0 + @@: + mov eax,ebx + ret +endp + +;input: +; esi - input description text +; ppoi - pointer to vertex struct +;output: +; eax - 0 (if error init) or 1 +; esi - output description text +align 4 +proc stl_vertex_init uses ebx ecx edi, ppoi:dword + call txt_ignore_space + cmp dword[esi],'vert' + jne .err_init + cmp word[esi+4],'ex' + jne .err_init + add esi,6 + mov ebx,[ppoi] + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx] ;coord X + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx+4] ;coord X + + call txt_copy_data + call String_to_DoubleFloat + fld qword[Data_Double] + fstp dword[ebx+8] ;coord Z + + stdcall txt_next_line, 80 + jmp @f + .err_init: + xor eax,eax + jmp .end_f + @@: + xor eax,eax + inc eax + .end_f: + ret +endp + +;input: +; esi - 㪠⥫ 砫 ப ஡ +;output: +; al - destroy +; ecx - destroy +; esi - 㪠⥫ ஡ ᨬ +align 4 +txt_ignore_space: + mov ecx,64 ; 横 + @@: + lodsb + cmp al,' ' + jne @f + loop @b + @@: + dec esi + ret + +;input: +; esi - 㪠⥫ ப ᫮ (஡ 砫 ப ) +;output: +; al - destroy +; ecx - destroy +; edi - destroy +; esi - 㪠⥫ ஢ ᫠ +; Data_String - ப ᫮ esi +align 4 +txt_copy_data: + call txt_ignore_space + mov ecx,32 + mov edi,esi + @@: + lodsb + or al,al + jz @f + cmp al,' ' + je @f + cmp al,13 + je @f + loop @b + @@: + mov esi,edi + sub ecx,32 + neg ecx + mov edi,Data_String + rep movsb + mov byte[edi],0 + ret + +;input: +; esi - text pointer +align 4 +proc txt_next_line uses eax ecx edi, mlen:dword + mov al,13 + mov ecx,[mlen] + mov edi,esi + repne scasb + cmp byte[edi],10 + jne @f + inc edi + @@: + mov esi,edi + ret +endp diff --git a/programs/develop/info3ds/data.inc b/programs/develop/info3ds/data.inc index 9468b52b5..ce6516e93 100644 --- a/programs/develop/info3ds/data.inc +++ b/programs/develop/info3ds/data.inc @@ -1,320 +1,324 @@ -; -; ᮡ࠭ *.3ds -; - -MAX_FILE_LEVEL equ 20 ;ᨬ ஢ - -sizeof.block_3ds equ 9 -can_save db 0 ; 䠩 - -macro block_3ds id,icon,par,caption -{ - dw id ;+0 䨪 䠩 3ds - dw icon ;+2 - db par ;+4 ᮤন (0- 1-) - dd caption+0 ;+5 ᠭ -} - -CHUNK_MAIN equ 0x4D4D ; [-] 業 -CHUNK_ambient_color equ 0x2100 ; [-] ambient color - CHUNK_OBJMESH equ 0x3D3D ; [-] ꥪ⮢ - CHUNK_OBJBLOCK equ 0x4000 ; [+] ꥪ - CHUNK_TRIMESH equ 0x4100 ; [-] trimesh-ꥪ - CHUNK_VERTLIST equ 0x4110 ; [+] ᯨ᮪ 設 - CHUNK_FACELIST equ 0x4120 ; [+] ᯨ᮪ ࠭ - CHUNK_FACEMAT equ 0x4130 ; [+] ਠ ࠭ - CHUNK_MAPLIST equ 0x4140 ; [+] ⥪ न - CHUNK_TRMATRIX equ 0x4160 ; [+] ॢ - CHUNK_CAMERA equ 0x4700 ; [+] ꥪ- - CHUNK_MATERIAL equ 0xAFFF ; [-] ਠ - CHUNK_MATNAME equ 0xA000 ; [+] ਠ - CHUNK_TEXTURE equ 0xA200 ; [-] ⥪ ਠ - CHUNK_MAPFILE equ 0xA300 ; [+] 䠩 ⥪ - CHUNK_KEYFRAMER equ 0xB000 ; [-] ଠ 樨 - CHUNK_TRACKINFO equ 0xB002 ; [-] ꥪ - CHUNK_TRACKOBJNAME equ 0xB010 ; [+] ⮣ ꥪ - CHUNK_TRACKPIVOT equ 0xB013 ; [+] 業 饭 ꥪ - CHUNK_TRACKPOS equ 0xB020 ; [+] ࠥ ꥪ - CHUNK_TRACKROTATE equ 0xB021 ; [+] ࠥ 饭 ꥪ - CHUNK_TRACKCAMERA equ 0xB003 ; [-] - CHUNK_TRACKFOV equ 0xB023 ; [+] fov - CHUNK_TRACKROLL equ 0xB024 ; [+] roll - CHUNK_TRACKCAMTGT equ 0xB004 ; [-] "楫" - -; ᮤঠ , ⬥祭 ᮬ, ⠫ -; - -align 4 -type_bloks: -block_3ds 0x0002,5,1,txt_0002 -block_3ds 0x3d3e,5,1 ; [+] mesh version -block_3ds 0x0011,4,1,txt_0011 -block_3ds 0x0100,3,1,txt_0100 -block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color -block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d -block_3ds CHUNK_OBJBLOCK,11,1,txt_4000 -block_3ds CHUNK_TRIMESH, 3,0,txt_4100 -block_3ds CHUNK_VERTLIST,8,1,txt_4110 -block_3ds CHUNK_FACELIST,3,1,txt_4120 -block_3ds CHUNK_FACEMAT,10,1,txt_4130 -block_3ds CHUNK_MAPLIST, 3,1,txt_4140 -block_3ds CHUNK_TRMATRIX,3,1,txt_4160 -block_3ds 0x4600,3,1,txt_4600 -block_3ds CHUNK_CAMERA, 3,1,txt_4700 -block_3ds CHUNK_MATERIAL,10,0,txt_afff -block_3ds CHUNK_MATNAME, 3,1,txt_a000 -block_3ds 0xa010,4,0,txt_a010 -block_3ds 0xa020,4,0,txt_a020 -block_3ds 0xa030,4,0,txt_a030 -block_3ds 0xa100,5,1,txt_a100 -block_3ds CHUNK_TEXTURE, 3,0,txt_a200 -block_3ds CHUNK_MAPFILE, 6,1,txt_a300 -block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000 -block_3ds CHUNK_TRACKINFO, 3,0,txt_b002 -block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010 -block_3ds 0xb011,3,1,txt_b011 -block_3ds CHUNK_TRACKPIVOT, 3,1,txt_b013 -block_3ds 0xb014,3,1,txt_b014 -block_3ds CHUNK_TRACKPOS, 3,1,txt_b020 -block_3ds CHUNK_TRACKROTATE, 3,1,txt_b021 -block_3ds CHUNK_TRACKCAMERA, 7,0,txt_b003 -block_3ds CHUNK_TRACKFOV, 7,1,txt_b023 -block_3ds CHUNK_TRACKROLL, 7,1,txt_b024 -block_3ds CHUNK_TRACKCAMTGT, 7,0,txt_b004 - -;--- ᬮ ᠭ ᪮ 몥 -block_3ds 0x4111, 3,1,txt_4111 -block_3ds 0x4150, 3,1,txt_4150 -block_3ds 0x4165, 3,1,txt_4165 -block_3ds 0x4610, 3,1,txt_4610 -block_3ds 0x4627, 3,1,txt_4627 -block_3ds 0x4630, 3,1,txt_4630 -block_3ds 0x4641, 3,1,txt_4641 -block_3ds 0x4650, 3,1,txt_4650 -block_3ds 0x4651, 3,1,txt_4651 -block_3ds 0x4652, 3,1,txt_4652 -block_3ds 0x4653, 3,1,txt_4653 -block_3ds 0x4656, 3,1,txt_4656 -block_3ds 0x4658, 3,1,txt_4658 -block_3ds 0x4620, 3,1,txt_4620 -block_3ds 0x4625, 3,1,txt_4625 -block_3ds 0x4659, 3,1,txt_4659 -block_3ds 0x465a, 3,1,txt_465a -block_3ds 0x465b, 3,1,txt_465b -block_3ds 0xa230, 3,1,txt_a230 -block_3ds 0xa220, 3,1,txt_a220 -block_3ds 0xa351, 3,1,txt_a351 -block_3ds 0xb007, 3,1,txt_b007 -block_3ds 0xb008, 3,1,txt_b008 -block_3ds 0xb022, 3,1,txt_b022 -block_3ds 0xb030, 3,1,txt_b030 -block_3ds 0xa040, 3,1,txt_a040 -block_3ds 0xa041, 3,1,txt_a041 -block_3ds 0xa050, 3,1,txt_a050 -block_3ds 0xa052, 3,1,txt_a052 -block_3ds 0xa053, 3,1,txt_a053 -block_3ds 0xa081, 3,1,txt_a081 -block_3ds 0xa083, 3,1,txt_a083 -block_3ds 0xa084, 3,1,txt_a084 -block_3ds 0xa085, 3,1,txt_a085 -block_3ds 0xa087, 3,1,txt_a087 -block_3ds 0xa088, 3,1,txt_a088 -block_3ds 0xa08a, 3,1,txt_a08a -block_3ds 0xa08c, 3,1,txt_a08c -block_3ds 0xa08e, 3,1,txt_a08e -.end: - -if lang eq ru_RU -txt_0002 db '3ds ',0 -txt_0011 db ' rgb (⮢ ଠ)',0 -;txt_0012 db 'LIN_COLOR_24',0 -;txt_0030 db 'Percentage value (int)',0 -;txt_0031 db 'Percentage value (float)',0 -txt_0100 db 'Master scale',0 -txt_2100 db ' 㦠饩 ।',0 -txt_3d3d db ' ꥪ⮢',0 -txt_4000 db 'ꥪ ( )',0 -txt_4100 db '㣮 ⪨',0 -txt_4110 db '᮪ 設',0 -txt_4120 db '᮪ ࠭',0 -txt_4130 db 'ਠ ࠭',0 -txt_4140 db ' न',0 -txt_4160 db ' ॢ',0 -txt_4600 db '',0 -txt_4700 db '',0 -txt_a000 db ' ਠ',0 -txt_a010 db '㦠騩 梥',0 -txt_a020 db '㧭 梥',0 -txt_a030 db 'ઠ 梥',0 -txt_a100 db ' ਠ [1=flat 2=gouraud 3=phong 4=metal]',0 -txt_a200 db ' ਠ 1',0 -txt_a300 db ' 䠩 ⥪',0 -;txt_a353 db 'MAT_MAP_TEXBLUR',0 -txt_afff db 'ਠ',0 -txt_b000 db 'ଠ 樨',0 -txt_b002 db ' ꥪ',0 -;txt_b009 db 'KFCURTIME',0 -;txt_b00a db 'KFHDR',0 -txt_b010 db ' ꥪ',0 -txt_b011 db ' ',0 -txt_b013 db ' 饭 ꥪ',0 -txt_b014 db 'Bound box',0 -txt_b020 db 'ࠥ ',0 -txt_b021 db 'ࠥ 饭',0 -txt_b003 db ' ',0 -txt_b023 db ' fov ',0 -txt_b024 db ' roll ',0 -txt_b004 db ' "楫" ',0 - -;--- ᬮ ᠭ ᪮ 몥 -txt_4111 db ' 設',0 -txt_4150 db 'Smoothing group list',0 -txt_4165 db 'Object color in editor',0 -txt_4610 db 'ࠢ ᢥ',0 -txt_4627 db 'Spot raytrace',0 -txt_4630 db 'Light shadowed',0 -txt_4641 db 'Spot shadow map',0 -txt_4650 db 'Spot show cone',0 -txt_4651 db 'Spot is rectangular',0 -txt_4652 db 'Spot overshoot',0 -txt_4653 db 'Spot map',0 -txt_4656 db 'Spot roll',0 -txt_4658 db 'Spot ray trace bias',0 -txt_4620 db 'Light off',0 -txt_4625 db 'Attenuation on',0 -txt_4659 db 'Range start',0 -txt_465a db 'Range end',0 -txt_465b db 'Multiplier',0 -txt_a230 db '⪠ ५',0 -txt_a220 db '⪠ ࠦ',0 -txt_a351 db 'ࠬ ࠧ⪨',0 -txt_b007 db 'ଠ ࠢ ᢥ饭',0 -txt_b008 db ' (砫 )',0 -txt_b022 db '⠡஢',0 -txt_b030 db ' 娨',0 -txt_a040 db 'Shininess percent',0 -txt_a041 db 'Shininess strength percent',0 -txt_a050 db 'Transparency percent',0 -txt_a052 db 'Transparency falloff percent',0 -txt_a053 db 'Reflection blur percent',0 -txt_a081 db '2 sided',0 -txt_a083 db 'Add trans',0 -txt_a084 db 'Self illum',0 -txt_a085 db 'Wire frame on',0 -txt_a087 db 'Wire thickness',0 -txt_a088 db 'Face map',0 -txt_a08a db 'In tranc',0 -txt_a08c db 'Soften',0 -txt_a08e db 'Wire in units',0 - -txt_not_delete db ' 㤠 ࠭ . 饭.',0 -else - -txt_0002 db '3ds version',0 -txt_0011 db 'Color rgb (byte format)',0 -txt_0100 db 'Master scale',0 -txt_2100 db 'Ambient color',0 -txt_3d3d db 'Editor chunk',0 -txt_4000 db 'Object (with name)',0 -txt_4100 db 'Triangular mesh',0 -txt_4110 db 'Vertices list',0 -txt_4120 db 'Faces description',0 -txt_4130 db 'Faces material',0 -txt_4140 db 'Mapping coordinates list',0 -txt_4160 db 'Local coordinate system',0 -txt_4600 db 'Light',0 -txt_4700 db 'Camera',0 -txt_a000 db 'Material name',0 -txt_a010 db 'Ambient color',0 -txt_a020 db 'Diffuse color',0 -txt_a030 db 'Specular color',0 -txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',0 -txt_a200 db 'Texture map 1',0 -txt_a300 db 'Mapping filename',0 -txt_afff db 'Meterial',0 -txt_b000 db 'Keyframer',0 -txt_b002 db 'Mesh information',0 -txt_b010 db 'Object name',0 -txt_b011 db 'Instance name',0 -txt_b013 db 'Object pivot point',0 -txt_b014 db 'Bound box',0 -txt_b020 db 'Position track',0 -txt_b021 db 'Rotation track',0 -txt_b003 db 'Camera information',0 -txt_b023 db 'Fov track',0 -txt_b024 db 'Roll track',0 -txt_b004 db 'Camera target information',0 - -;--- -txt_4111 db 'Vertex flags',0 -txt_4150 db 'Smoothing group list',0 -txt_4165 db 'Object color in editor',0 -txt_4610 db 'Spotlight',0 -txt_4627 db 'Spot raytrace',0 -txt_4630 db 'Light shadowed',0 -txt_4641 db 'Spot shadow map',0 -txt_4650 db 'Spot show cone',0 -txt_4651 db 'Spot is rectangular',0 -txt_4652 db 'Spot overshoot',0 -txt_4653 db 'Spot map',0 -txt_4656 db 'Spot roll',0 -txt_4658 db 'Spot ray trace bias',0 -txt_4620 db 'Light off',0 -txt_4625 db 'Attenuation on',0 -txt_4659 db 'Range start',0 -txt_465a db 'Range end',0 -txt_465b db 'Multiplier',0 -txt_a230 db 'Bump map',0 -txt_a220 db 'Reflection map',0 -txt_a351 db 'Mapping parameters',0 -txt_b007 db 'Spot light information',0 -txt_b008 db 'Frames (Start and End)',0 -txt_b022 db 'Scale track',0 -txt_b030 db 'Hierarchy position',0 -txt_a040 db 'Shininess percent',0 -txt_a041 db 'Shininess strength percent',0 -txt_a050 db 'Transparency percent',0 -txt_a052 db 'Transparency falloff percent',0 -txt_a053 db 'Reflection blur percent',0 -txt_a081 db '2 sided',0 -txt_a083 db 'Add trans',0 -txt_a084 db 'Self illum',0 -txt_a085 db 'Wire frame on',0 -txt_a087 db 'Wire thickness',0 -txt_a088 db 'Face map',0 -txt_a08a db 'In tranc',0 -txt_a08c db 'Soften',0 -txt_a08e db 'Wire in units',0 - -txt_not_delete db 'I can not delete the selected chunk. It is protected.',0 -end if - -if lang eq ru_RU -txt_open_3ds db ' 䠩:',0 -txt_no_3ds: db ' 䠩 ଠ *.3ds ',39 - .zag: rb 8 - db 39,0 -txt_3ds_err_sizes db ' 䠩 ०',0 -txt_count db '⢮',0 -txt_3ds_offs: - db '饭: ' - .dig: rb 8 - db ' : ' - .siz: rb 8 - db 0 -txt_mat_null db 'ਠ ',0 -else -txt_open_3ds db 'Open file:',0 -txt_no_3ds: db 'Open file not in format *.3ds ',39 - .zag: rb 8 - db 39,0 -txt_3ds_err_sizes db 'File may be corrupted',0 -txt_count db 'Count',0 -txt_3ds_offs: - db 'Offset: ' - .dig: rb 8 - db ' Size: ' - .siz: rb 8 - db 0 -txt_mat_null db 'No materials found',0 -end if +; +; ᮡ࠭ *.3ds +; + +; Language support for locales: ru_RU (CP866), en_US. + +MAX_FILE_LEVEL equ 20 ;ᨬ ஢ + +sizeof.block_3ds equ 9 +can_save db 0 ; 䠩 + +macro block_3ds id,icon,par,caption +{ + dw id ;+0 䨪 䠩 3ds + dw icon ;+2 + db par ;+4 ᮤন (0- 1-) + dd caption+0 ;+5 ᠭ +} + +CHUNK_MAIN equ 0x4D4D ; [-] 業 +CHUNK_ambient_color equ 0x2100 ; [-] ambient color + CHUNK_OBJMESH equ 0x3D3D ; [-] ꥪ⮢ + CHUNK_OBJBLOCK equ 0x4000 ; [+] ꥪ + CHUNK_TRIMESH equ 0x4100 ; [-] trimesh-ꥪ + CHUNK_VERTLIST equ 0x4110 ; [+] ᯨ᮪ 設 + CHUNK_FACELIST equ 0x4120 ; [+] ᯨ᮪ ࠭ + CHUNK_FACEMAT equ 0x4130 ; [+] ਠ ࠭ + CHUNK_MAPLIST equ 0x4140 ; [+] ⥪ न + CHUNK_TRMATRIX equ 0x4160 ; [+] ॢ + CHUNK_CAMERA equ 0x4700 ; [+] ꥪ- + CHUNK_MATERIAL equ 0xAFFF ; [-] ਠ + CHUNK_MATNAME equ 0xA000 ; [+] ਠ + CHUNK_TEXTURE equ 0xA200 ; [-] ⥪ ਠ + CHUNK_MAPFILE equ 0xA300 ; [+] 䠩 ⥪ + CHUNK_KEYFRAMER equ 0xB000 ; [-] ଠ 樨 + CHUNK_TRACKINFO equ 0xB002 ; [-] ꥪ + CHUNK_TRACKOBJNAME equ 0xB010 ; [+] ⮣ ꥪ + CHUNK_TRACKPIVOT equ 0xB013 ; [+] 業 饭 ꥪ + CHUNK_TRACKPOS equ 0xB020 ; [+] ࠥ ꥪ + CHUNK_TRACKROTATE equ 0xB021 ; [+] ࠥ 饭 ꥪ + CHUNK_TRACKCAMERA equ 0xB003 ; [-] + CHUNK_TRACKFOV equ 0xB023 ; [+] fov + CHUNK_TRACKROLL equ 0xB024 ; [+] roll + CHUNK_TRACKCAMTGT equ 0xB004 ; [-] "楫" + +; ᮤঠ , ⬥祭 ᮬ, ⠫ +; + +align 4 +type_bloks: +block_3ds 0x0002,5,1,txt_0002 +block_3ds 0x3d3e,5,1 ; [+] mesh version +block_3ds 0x0011,4,1,txt_0011 +block_3ds 0x0100,3,1,txt_0100 +block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color +block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d +block_3ds CHUNK_OBJBLOCK,11,1,txt_4000 +block_3ds CHUNK_TRIMESH, 3,0,txt_4100 +block_3ds CHUNK_VERTLIST,8,1,txt_4110 +block_3ds CHUNK_FACELIST,3,1,txt_4120 +block_3ds CHUNK_FACEMAT,10,1,txt_4130 +block_3ds CHUNK_MAPLIST, 3,1,txt_4140 +block_3ds CHUNK_TRMATRIX,3,1,txt_4160 +block_3ds 0x4600,3,1,txt_4600 +block_3ds CHUNK_CAMERA, 3,1,txt_4700 +block_3ds CHUNK_MATERIAL,10,0,txt_afff +block_3ds CHUNK_MATNAME, 3,1,txt_a000 +block_3ds 0xa010,4,0,txt_a010 +block_3ds 0xa020,4,0,txt_a020 +block_3ds 0xa030,4,0,txt_a030 +block_3ds 0xa100,5,1,txt_a100 +block_3ds CHUNK_TEXTURE, 3,0,txt_a200 +block_3ds CHUNK_MAPFILE, 6,1,txt_a300 +block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000 +block_3ds CHUNK_TRACKINFO, 3,0,txt_b002 +block_3ds CHUNK_TRACKOBJNAME,3,1,txt_b010 +block_3ds 0xb011,3,1,txt_b011 +block_3ds CHUNK_TRACKPIVOT, 3,1,txt_b013 +block_3ds 0xb014,3,1,txt_b014 +block_3ds CHUNK_TRACKPOS, 3,1,txt_b020 +block_3ds CHUNK_TRACKROTATE, 3,1,txt_b021 +block_3ds CHUNK_TRACKCAMERA, 7,0,txt_b003 +block_3ds CHUNK_TRACKFOV, 7,1,txt_b023 +block_3ds CHUNK_TRACKROLL, 7,1,txt_b024 +block_3ds CHUNK_TRACKCAMTGT, 7,0,txt_b004 + +;--- ᬮ ᠭ ᪮ 몥 +block_3ds 0x4111, 3,1,txt_4111 +block_3ds 0x4150, 3,1,txt_4150 +block_3ds 0x4165, 3,1,txt_4165 +block_3ds 0x4610, 3,1,txt_4610 +block_3ds 0x4627, 3,1,txt_4627 +block_3ds 0x4630, 3,1,txt_4630 +block_3ds 0x4641, 3,1,txt_4641 +block_3ds 0x4650, 3,1,txt_4650 +block_3ds 0x4651, 3,1,txt_4651 +block_3ds 0x4652, 3,1,txt_4652 +block_3ds 0x4653, 3,1,txt_4653 +block_3ds 0x4656, 3,1,txt_4656 +block_3ds 0x4658, 3,1,txt_4658 +block_3ds 0x4620, 3,1,txt_4620 +block_3ds 0x4625, 3,1,txt_4625 +block_3ds 0x4659, 3,1,txt_4659 +block_3ds 0x465a, 3,1,txt_465a +block_3ds 0x465b, 3,1,txt_465b +block_3ds 0xa230, 3,1,txt_a230 +block_3ds 0xa220, 3,1,txt_a220 +block_3ds 0xa351, 3,1,txt_a351 +block_3ds 0xb007, 3,1,txt_b007 +block_3ds 0xb008, 3,1,txt_b008 +block_3ds 0xb022, 3,1,txt_b022 +block_3ds 0xb030, 3,1,txt_b030 +block_3ds 0xa040, 3,1,txt_a040 +block_3ds 0xa041, 3,1,txt_a041 +block_3ds 0xa050, 3,1,txt_a050 +block_3ds 0xa052, 3,1,txt_a052 +block_3ds 0xa053, 3,1,txt_a053 +block_3ds 0xa081, 3,1,txt_a081 +block_3ds 0xa083, 3,1,txt_a083 +block_3ds 0xa084, 3,1,txt_a084 +block_3ds 0xa085, 3,1,txt_a085 +block_3ds 0xa087, 3,1,txt_a087 +block_3ds 0xa088, 3,1,txt_a088 +block_3ds 0xa08a, 3,1,txt_a08a +block_3ds 0xa08c, 3,1,txt_a08c +block_3ds 0xa08e, 3,1,txt_a08e +.end: + +if lang eq ru_RU +txt_0002 db '3ds ',0 +txt_0011 db ' rgb (⮢ ଠ)',0 +;txt_0012 db 'LIN_COLOR_24',0 +;txt_0030 db 'Percentage value (int)',0 +;txt_0031 db 'Percentage value (float)',0 +txt_0100 db 'Master scale',0 +txt_2100 db ' 㦠饩 ।',0 +txt_3d3d db ' ꥪ⮢',0 +txt_4000 db 'ꥪ ( )',0 +txt_4100 db '㣮 ⪨',0 +txt_4110 db '᮪ 設',0 +txt_4120 db '᮪ ࠭',0 +txt_4130 db 'ਠ ࠭',0 +txt_4140 db ' न',0 +txt_4160 db ' ॢ',0 +txt_4600 db '',0 +txt_4700 db '',0 +txt_a000 db ' ਠ',0 +txt_a010 db '㦠騩 梥',0 +txt_a020 db '㧭 梥',0 +txt_a030 db 'ઠ 梥',0 +txt_a100 db ' ਠ [1=flat 2=gouraud 3=phong 4=metal]',0 +txt_a200 db ' ਠ 1',0 +txt_a300 db ' 䠩 ⥪',0 +;txt_a353 db 'MAT_MAP_TEXBLUR',0 +txt_afff db 'ਠ',0 +txt_b000 db 'ଠ 樨',0 +txt_b002 db ' ꥪ',0 +;txt_b009 db 'KFCURTIME',0 +;txt_b00a db 'KFHDR',0 +txt_b010 db ' ꥪ',0 +txt_b011 db ' ',0 +txt_b013 db ' 饭 ꥪ',0 +txt_b014 db 'Bound box',0 +txt_b020 db 'ࠥ ',0 +txt_b021 db 'ࠥ 饭',0 +txt_b003 db ' ',0 +txt_b023 db ' fov ',0 +txt_b024 db ' roll ',0 +txt_b004 db ' "楫" ',0 + +;--- ᬮ ᠭ ᪮ 몥 +txt_4111 db ' 設',0 +txt_4150 db 'Smoothing group list',0 +txt_4165 db 'Object color in editor',0 +txt_4610 db 'ࠢ ᢥ',0 +txt_4627 db 'Spot raytrace',0 +txt_4630 db 'Light shadowed',0 +txt_4641 db 'Spot shadow map',0 +txt_4650 db 'Spot show cone',0 +txt_4651 db 'Spot is rectangular',0 +txt_4652 db 'Spot overshoot',0 +txt_4653 db 'Spot map',0 +txt_4656 db 'Spot roll',0 +txt_4658 db 'Spot ray trace bias',0 +txt_4620 db 'Light off',0 +txt_4625 db 'Attenuation on',0 +txt_4659 db 'Range start',0 +txt_465a db 'Range end',0 +txt_465b db 'Multiplier',0 +txt_a230 db '⪠ ५',0 +txt_a220 db '⪠ ࠦ',0 +txt_a351 db 'ࠬ ࠧ⪨',0 +txt_b007 db 'ଠ ࠢ ᢥ饭',0 +txt_b008 db ' (砫 )',0 +txt_b022 db '⠡஢',0 +txt_b030 db ' 娨',0 +txt_a040 db 'Shininess percent',0 +txt_a041 db 'Shininess strength percent',0 +txt_a050 db 'Transparency percent',0 +txt_a052 db 'Transparency falloff percent',0 +txt_a053 db 'Reflection blur percent',0 +txt_a081 db '2 sided',0 +txt_a083 db 'Add trans',0 +txt_a084 db 'Self illum',0 +txt_a085 db 'Wire frame on',0 +txt_a087 db 'Wire thickness',0 +txt_a088 db 'Face map',0 +txt_a08a db 'In tranc',0 +txt_a08c db 'Soften',0 +txt_a08e db 'Wire in units',0 + +txt_not_delete db ' 㤠 ࠭ . 饭.',0 + +else ; Default to en_US + +txt_0002 db '3ds version',0 +txt_0011 db 'Color rgb (byte format)',0 +txt_0100 db 'Master scale',0 +txt_2100 db 'Ambient color',0 +txt_3d3d db 'Editor chunk',0 +txt_4000 db 'Object (with name)',0 +txt_4100 db 'Triangular mesh',0 +txt_4110 db 'Vertices list',0 +txt_4120 db 'Faces description',0 +txt_4130 db 'Faces material',0 +txt_4140 db 'Mapping coordinates list',0 +txt_4160 db 'Local coordinate system',0 +txt_4600 db 'Light',0 +txt_4700 db 'Camera',0 +txt_a000 db 'Material name',0 +txt_a010 db 'Ambient color',0 +txt_a020 db 'Diffuse color',0 +txt_a030 db 'Specular color',0 +txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',0 +txt_a200 db 'Texture map 1',0 +txt_a300 db 'Mapping filename',0 +txt_afff db 'Meterial',0 +txt_b000 db 'Keyframer',0 +txt_b002 db 'Mesh information',0 +txt_b010 db 'Object name',0 +txt_b011 db 'Instance name',0 +txt_b013 db 'Object pivot point',0 +txt_b014 db 'Bound box',0 +txt_b020 db 'Position track',0 +txt_b021 db 'Rotation track',0 +txt_b003 db 'Camera information',0 +txt_b023 db 'Fov track',0 +txt_b024 db 'Roll track',0 +txt_b004 db 'Camera target information',0 + +;--- +txt_4111 db 'Vertex flags',0 +txt_4150 db 'Smoothing group list',0 +txt_4165 db 'Object color in editor',0 +txt_4610 db 'Spotlight',0 +txt_4627 db 'Spot raytrace',0 +txt_4630 db 'Light shadowed',0 +txt_4641 db 'Spot shadow map',0 +txt_4650 db 'Spot show cone',0 +txt_4651 db 'Spot is rectangular',0 +txt_4652 db 'Spot overshoot',0 +txt_4653 db 'Spot map',0 +txt_4656 db 'Spot roll',0 +txt_4658 db 'Spot ray trace bias',0 +txt_4620 db 'Light off',0 +txt_4625 db 'Attenuation on',0 +txt_4659 db 'Range start',0 +txt_465a db 'Range end',0 +txt_465b db 'Multiplier',0 +txt_a230 db 'Bump map',0 +txt_a220 db 'Reflection map',0 +txt_a351 db 'Mapping parameters',0 +txt_b007 db 'Spot light information',0 +txt_b008 db 'Frames (Start and End)',0 +txt_b022 db 'Scale track',0 +txt_b030 db 'Hierarchy position',0 +txt_a040 db 'Shininess percent',0 +txt_a041 db 'Shininess strength percent',0 +txt_a050 db 'Transparency percent',0 +txt_a052 db 'Transparency falloff percent',0 +txt_a053 db 'Reflection blur percent',0 +txt_a081 db '2 sided',0 +txt_a083 db 'Add trans',0 +txt_a084 db 'Self illum',0 +txt_a085 db 'Wire frame on',0 +txt_a087 db 'Wire thickness',0 +txt_a088 db 'Face map',0 +txt_a08a db 'In tranc',0 +txt_a08c db 'Soften',0 +txt_a08e db 'Wire in units',0 + +txt_not_delete db 'Cannot delete the selected chunk: it is protected.',0 +end if + +if lang eq ru_RU +txt_open_3ds db ' 䠩:',0 +txt_no_3ds: db ' 䠩 ଠ *.3ds ',39 + .zag: rb 8 + db 39,0 +txt_3ds_err_sizes db ' 䠩 ०',0 +txt_count db '⢮',0 +txt_3ds_offs: + db '饭: ' + .dig: rb 8 + db ' : ' + .siz: rb 8 + db 0 +txt_mat_null db 'ਠ ',0 + +else ; Default to en_US +txt_open_3ds db 'Open file:',0 +txt_no_3ds: db 'Open file not in format *.3ds ',39 + .zag: rb 8 + db 39,0 +txt_3ds_err_sizes db 'File may be corrupted',0 +txt_count db 'Count',0 +txt_3ds_offs: + db 'Offset: ' + .dig: rb 8 + db ' Size: ' + .siz: rb 8 + db 0 +txt_mat_null db 'No materials found',0 +end if diff --git a/programs/develop/info3ds/info3ds.asm b/programs/develop/info3ds/info3ds.asm index 221225dd7..839a60de1 100644 --- a/programs/develop/info3ds/info3ds.asm +++ b/programs/develop/info3ds/info3ds.asm @@ -1,1399 +1,1399 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, file_name, sys_path - -version_edit equ 1 - -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include '../../load_img.inc' -include '../../load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include 'lang.inc' -include 'info_fun_float.inc' -include 'info_menu.inc' -include 'data.inc' -include 'convert_stl_3ds.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - -ID_ICON_CHUNK_MAIN equ 0 ; -ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ -ID_ICON_DATA equ 2 ; , । -ID_ICON_POINT equ 8 -ID_ICON_POINT_SEL equ 9 - -FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ - -include 'info_o3d.inc' - -main_wnd_height equ 460 ; ணࠬ -IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 - -align 4 -fl255 dd 255.0 -open_file_data dd 0 ;㪠⥫ 䠩 3ds -open_file_size dd 0 ;ࠧ ⮣ 䠩 -image_data_toolbar dd 0 -icon_tl_sys dd 0 ;㪠⥥ ࠭ ⥬ -icon_toolbar dd 0 ;㪠⥥ ࠭ ꥪ⮢ -fn_toolbar db 'toolbar.png',0 - -align 4 -level_stack dd 0 -offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ - -align 4 -file_3ds: ;६ ᯮ㥬 ⨨ 䠩 -.offs: dd 0 ;+0 㪠⥫ 砫 -.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) -rb 8*MAX_FILE_LEVEL - -size_one_list equ 42 -list_offs_chunk_del equ 8 ; 㤠 -list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) -list_offs_p_data equ 10 ;㪠⥫ -list_offs_text equ 14 ;ᤢ 砫 ⥪ -buffer rb size_one_list ; ᯨ᮪ tree1 - -txt_3ds_symb db 0,0 -;-------------------------------------- - -include 'info_wnd_coords.inc' - -align 4 -start: - ;--- copy cmd line --- - mov esi,file_name - mov edi,openfile_path -@@: - lodsd - or eax,eax - jz @f ;室, ᫨ 0 - stosd - jmp @b -@@: - stosd - - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - .test_lib_open: - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS ;exit not correct - @@: - add ebp,ll_struc_size - cmp ebp,l_libs_end - jl .test_lib_open - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - ;kmenu initialisation - stdcall [kmenu_init],sc - stdcall [ksubmenu_new] - mov [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 9 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 11 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 12 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 13 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 14 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 15 - stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Vertexes, [main_menu_vertexes] - stdcall [ksubmenu_add], [main_menu], eax - - mov dword[w_scr_t1.type],1 - stdcall [tl_data_init], tree1 - ;⥬ 16*16 tree_list - include_image_file 'tl_sys_16.png', icon_tl_sys - ;᫨ ࠦ 뫮, icon_tl_sys - ; 樠஢ , 訡 㤥, . . 㦭 ࠧ - mov eax,dword[icon_tl_sys] - mov dword[tree1.data_img_sys],eax - - load_image_file 'objects.png', icon_toolbar - mov eax,dword[icon_toolbar] - mov dword[tree1.data_img],eax - - stdcall [buf2d_create], buf_0 ;ᮧ - - load_image_file 'font8x9.bmp', image_data_toolbar - stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ - stdcall mem.Free,[image_data_toolbar] ;᢮ - stdcall [buf2d_conv_24_to_8], buf_1,1 ; ஧筮 8 - stdcall [buf2d_convert_text_matrix], buf_1 - - load_image_file fn_toolbar, image_data_toolbar - - ;ࠡ 䠩 ஥ - copy_path ini_name,sys_path,file_name,0 - mov dword[def_dr_mode],0 - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_vertexes - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_fill - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_light - @@: - stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_smooth - @@: - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff - mov [color_ox],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 - mov [color_oy],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 - mov [color_oz],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 - mov [color_bk],eax - shr eax,8 - mov [color_bk+4],eax - shr eax,8 - mov [color_bk+8],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff - mov [color_vert],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 - mov [color_face],eax - stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 - mov [color_select],eax - finit - fild dword[color_bk+8] - fdiv dword[fl255] - fstp dword[color_bk+8] - mov eax,[color_bk+4] - and eax,0xff - mov [color_bk+4],eax - fild dword[color_bk+4] - fdiv dword[fl255] - fstp dword[color_bk+4] - mov eax,[color_bk] - and eax,0xff - mov [color_bk],eax - fild dword[color_bk] - fdiv dword[fl255] - fstp dword[color_bk] - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 - stdcall [glShadeModel], GL_SMOOTH - call [gluNewQuadric] - mov [qObj],eax - - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov dword[buf_ogl],eax - - ;open file from cmd line - cmp dword[openfile_path],0 - je @f - call but_open_file.no_dlg - @@: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - or eax,eax - jz timer_funct - - cmp al,1 - jne @f - call draw_window - jmp still - @@: - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo+4] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - stdcall [tl_mouse], dword tree1 - ret - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;ᬠਢ 뤥 - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je @f - mov ebx,eax - mov eax,dword[ebx] - mov ecx,dword[ebx+4] ;ࠧ - stdcall hex_in_str, txt_3ds_offs.dig, eax,8 - stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 - - add eax,dword[open_file_data] ;砥 祭 ᤢ - cmp dword[offs_last_timer],eax - je @f - ;᫨ 뤥 ᮢ ᫥ - mov dword[offs_last_timer],eax - stdcall buf_draw_beg, buf_0 - stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000 - mov edx,dword[ebx+list_offs_p_data] - cmp edx,0 ;ᬮਬ ᠭ - je .no_info - stdcall [buf2d_draw_text], buf_0, buf_1,edx,5,45,0xb000 - .no_info: - add ecx,eax ;砥 ࠧ - stdcall buf_draw_hex_table,eax,ecx ; 16- - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - @@: - popad - jmp still - -align 4 -proc buf_draw_hex_table, offs:dword, size_line:dword - pushad - locals - coord_y dd 55 ;न y 砫 뢮 ⠡ - endl - mov esi,dword[offs] - mov edi,dword[open_file_data] - add edi,dword[file_3ds.size] ;edi - 㪠⥫ 䠩 - mov dword[txt_3ds_offs.dig],0 - cld - .cycle_rows: - mov ebx,5 ; ᫥ - mov edx,5+10*24 ; ᫥ ⥪ - mov ecx,10 - @@: - stdcall hex_in_str, txt_3ds_offs.dig, dword[esi],2 - stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs.dig,ebx,[coord_y],0 - - mov al,byte[esi] - mov byte[txt_3ds_symb],al - stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_symb,edx,[coord_y],0x808080 - inc esi - cmp esi,dword[size_line] - jne .end_block - stdcall draw_block_end_line, dword[coord_y] - .end_block: - cmp esi,edi - jge @f ;jg ??? - add ebx,24 - add edx,9 ;ਭ 1- ᨬ +1pix - loop @b - add dword[coord_y],10 ; 1- ᨬ ( ࢠ ப) - mov ebx,dword[buf_0.h] - cmp dword[coord_y],ebx - jl .cycle_rows - @@: - popad - ret -endp - -align 4 -proc draw_block_end_line uses eax ebx ecx, coord_y:dword - add ebx,20 ;20 = width 2.5 symbols - mov eax,[coord_y] - sub eax,2 - mov ecx,eax - add ecx,10 - stdcall [buf2d_line], buf_0, 0,ecx,ebx,ecx ,0xff - stdcall [buf2d_line], buf_0, ebx,ecx,ebx,eax ,0xff - stdcall [buf2d_line], buf_0, ebx,eax,5+10*24-4,eax ,0xff - ret -endp - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - xor eax,eax - mov edx,[sc.work] - or edx,0x33000000 - mov edi,capt - mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,dword[procinfo.box.height] - cmp eax,250 - jge @f - mov eax,250 - @@: - sub eax,65 - mov dword[tree1.box_height],eax - mov word[w_scr_t1.y_size],ax ; ࠧ ஫ - cmp eax,dword[buf_0.h] ;㢥稢 - jle @f - stdcall [buf2d_resize],buf_0,0,eax,1 - mov dword[offs_last_timer],0 ; ⠩ - @@: - - mov eax,dword[procinfo.box.width] - cmp eax,400 - jge @f - mov eax,400 - @@: - sub eax,[buf_0.w] - sub eax,41 - mov dword[tree1.box_width],eax - add ax,word[tree1.box_left] - mov word[w_scr_t1.x_pos],ax - add ax,16+5 - mov word[buf_0.l],ax - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,0x40000003 - mcall ,(30 shl 16)+20,,0x40000004 - - cmp byte[can_save],0 - je @f - mcall ,(55 shl 16)+20,,0x40000005 - @@: - mcall ,(85 shl 16)+20,,0x40000006 ; न⠬ - mcall ,(110 shl 16)+20,,0x40000007 ;㤠 - - mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+5 ;new - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(30 shl 16)+5 ;open - int 0x40 - - cmp byte[can_save],0 - je @f - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(55 shl 16)+5 ;save - int 0x40 - sub ebx,IMAGE_TOOLBAR_ICON_SIZE - @@: - - add ebx,4*IMAGE_TOOLBAR_ICON_SIZE - mov edx,(85 shl 16)+5 - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(110 shl 16)+5 - int 0x40 - - mov dword[w_scr_t1.all_redraw],1 - stdcall [tl_draw], tree1 - - stdcall [buf2d_draw], buf_0 - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -key: - mcall SF_GET_KEY - stdcall [tl_key], dword tree1 - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_wnd_coords - jmp still - @@: - cmp ah,7 - jne @f - call but_delete_chunk - jmp still - @@: - - cmp ah,1 - jne still -.exit: - mov dword[tree1.data_img],0 - mov dword[tree1.data_img_sys],0 - stdcall [tl_data_clear], tree1 - stdcall [buf2d_delete],buf_0 - stdcall [buf2d_delete],buf_1 ;㤠塞 - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_data] - stdcall [gluDeleteQuadric], [qObj] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: - mov byte[can_save],0 - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - ; 㤠筮 ⨨ - jmp .end0 -.no_dlg: ;᫨ 㥬 䠩 - pushad - mov esi,openfile_path - stdcall str_len,esi - add esi,eax - @@: ;横 ᪠ 砫 䠩 - dec esi - cmp byte[esi],'/' - je @f - cmp byte[esi],0x5c ;'\' - je @f - cmp esi,openfile_path - jg @b - @@: - inc esi - stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ - .end0: - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.ReAlloc,[open_file_data],ecx - mov [open_file_data],eax - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], ecx - m2m dword[run_file_70.Buffer], dword[open_file_data] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 ;㦠 䠩 3ds - cmp ebx,0xffffffff - je .end_open_file - - mov [open_file_size],ebx - ;mcall SF_SET_CAPTION,1,openfile_path - - mov byte[can_save],0 - call init_tree - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - stdcall obj_clear_param, o3d ;⨬ ࠬ न⠬ - cmp byte[prop_wnd_run],0 - je @f - ;⨬ न⠬ - stdcall [tl_info_clear], tree3 - @@: - - .end_open_file: - popad - ret - -align 4 -init_tree: - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - - mov esi,[open_file_data] - stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? - or eax,eax - jz @f - ;᫨ 䠩 ଠ *.stl - mov [open_file_size],ecx - mov esi,eax - stdcall mem.Free,[open_file_data] - mov [open_file_data],esi - mov byte[can_save],1 - @@: - cmp word[esi],CHUNK_MAIN - je @f - stdcall buf_draw_beg, buf_0 - stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,5,25,0xff0000 ;㥬 ப ⥪⮬ - jmp .end_open - @@: - ;--- ࠡ⪠ ⮣ *.3ds 䠩 - mov eax,file_3ds - mov dword[level_stack],0 ;塞 ஢ ⥪ - mov dword[offs_last_timer],0 - ;--- ᯨ᮪ - stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 - call block_children ;室 ୨ - - mov edi,[file_3ds.offs] - add edi,[file_3ds.size] - .cycle_main: - cmp dword[level_stack],0 - jle .end_cycle - - cmp esi,edi ;᫨ 䠩 - jge .end_cycle - - mov edx,[esi+2] ;ࠧ - call block_analiz - cmp dword[bl_found],0 - jne @f - ;ꥪ ⭮ - stdcall add_3ds_object, ID_ICON_CHUNK_NOT_FOUND,dword[level_stack],edx,0 - call block_next - jmp .cycle_main - @@: - ;ꥪ ⭮ - mov ecx,dword[bl_found] - mov bx,word[ecx+2] ; ꥪ - stdcall add_3ds_object, ebx,dword[level_stack],edx,dword[ecx+5] - cmp byte[ecx+4],1 - je .bl_data - ; ᮤন ୨ - call block_children ;室 ୨ - jmp .cycle_main - .bl_data: - ; ᮤন - call block_analiz_data - jmp .cycle_main - .end_cycle: - stdcall [tl_cur_beg], tree1 - stdcall [tl_draw], tree1 - .end_open: - ret - -; -;input: -; eax - stack pointer -; esi - memory pointer -;output: -; eax - new stack pointer -; esi - new memory pointer -align 4 -block_analiz_data: - push ebx ecx edx edi - mov dx,word[esi] - mov ecx,dword[esi+2] - sub ecx,6 ;ࠧ - add esi,6 - mov ebx,dword[level_stack] - inc ebx - ; *** ࠧ묨 묨 뤥 - cmp dx,CHUNK_OBJBLOCK ;ꥪ - jne @f - push ax - cld - xor al,al - mov edi,esi - repne scasb - pop ax - sub edi,esi ;edi - strlen - stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ - add esi,edi - ;sub ecx,edi ;㦥 ᤥ repne - jmp .next_bl - @@: - cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 - je .vertexes - cmp dx,0x4111 ;䫠 設 - je .vertexes - cmp dx,CHUNK_MAPLIST ;⥪ न - je .vertexes - jmp @f - .vertexes: ;ࠡ⪠ , ᮤঠ 設 - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ 設 - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; 設 - sub esi,8 ;⠭ esi - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ - jne @f - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ - push eax - movzx eax,word[esi] - shl eax,3 - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,eax,0 ; ࠭ - - sub ecx,eax - cmp ecx,1 - jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ -if 0 - add esi,eax - mov ecx,dword[esi+2] - stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ - sub esi,eax -else - add esi,eax - pop eax - jmp .next_bl -end if - .data_3: - - sub esi,8 ;⠭ esi - pop eax - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACEMAT ;ਠ ࠭ - jne @f - push ax - cld - xor al,al - mov edi,esi - repne scasb - pop ax - sub edi,esi ;edi - strlen - stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ - add esi,edi - ;sub ecx,edi ;㦥 ᤥ repne - stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ - add esi,2 - sub ecx,2 - stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; ࠭, ਬ ਠ - sub esi,edi ;⠭ esi (1) - sub esi,8 ;⠭ esi (2) - call block_next - jmp .end_f - @@: - ; *** 묨 㬮砭 ( 뤥 ) - stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 - sub esi,6 ;⠭ esi - call block_next - jmp .end_f - .next_bl: - ; *** ன ⠢ - mov dword[eax],esi ;㪠⥫ 砫 - mov ebx,dword[esi+2] - mov dword[eax+4],ebx ;ࠧ - inc dword[level_stack] - add eax,8 - .end_f: - pop edi edx ecx ebx - ret - -;室 1- ୨ -;input: -; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds -; esi - 砫 த⥫᪮ -;output: -; ebx - destroy -; esi - 砫 த⥫᪮ -align 4 -block_children: - push ecx - ;஢ઠ ࠢ쭮 ࠧ஢ ୥ - mov ebx,esi - add ebx,6 ;室 砫 ୥ - add ebx,dword[ebx+2] ;塞 ࠧ ୥ - mov ecx,esi - add ecx,dword[esi+2] ;塞 ࠧ த⥫᪮ - cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 - jle @f - ;஢ 訡 䠩, ୨ 室 । த⥫᪮ - mov dword[level_stack],FILE_ERROR_CHUNK_SIZE - jmp .end_f - @@: - mov [eax],esi ;㪠⥫ 砫 - mov ebx,[esi+2] - mov [eax+4],ebx ;ࠧ - add esi,6 ;室 - inc dword[level_stack] - add eax,8 - .end_f: - pop ecx - ret - -;室 ᫥饬 ⥪饣 ஢ -;input: -; eax - ६묨 -align 4 -block_next: -push ebx - add esi,dword[esi+2] ;ய᪠ - - ;஢ઠ ࠧ஢ த⥫᪮ , 室 孨 ஢ ᫨ - @@: - mov ebx,dword[eax-8] - add ebx,dword[eax-4] - cmp esi,ebx - jl @f - dec dword[level_stack] - sub eax,8 - cmp dword[level_stack],0 - jg @b - @@: -pop ebx - ret - -;㭪 ᪠ 뢠饩 -;input: -;esi - memory pointer -;output: -;dword[bl_found] - pointer to chunk struct (= 0 if not found) -align 4 -bl_found dd 0 -block_analiz: -pushad - mov dword[bl_found],0 - mov ecx,type_bloks - @@: - mov bx,word[ecx] - cmp word[esi],bx - je .found - add ecx,sizeof.block_3ds - cmp ecx,type_bloks.end - jl @b - jmp .no_found - .found: - mov dword[bl_found],ecx - .no_found: -popad - ret - -;input: -; esi - 㪠⥫ 㥬 -; icon - -; level - ஢ 㧫 -; size_bl - ࠧ -; info_bl - ப ᠭ -align 4 -proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword - pushad - mov bx,word[icon] - shl ebx,16 - mov bx,word[level] - - mov eax,esi - sub eax,dword[open_file_data] - mov dword[buffer],eax ;ᬥ饭 - mov ecx,dword[size_bl] - mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) - mov ecx,dword[bl_found] - or ecx,ecx - jz @f - ;... 㦥 㣮 㤠 - mov cl,byte[ecx+4] - @@: - mov byte[buffer+list_offs_chunk_del],cl - mov ecx,[level] - mov byte[buffer+list_offs_chunk_lev],cl - mov ecx,dword[info_bl] - mov dword[buffer+list_offs_p_data],ecx - stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 - stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ; 3ds - or ecx,ecx - jnz @f - mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ ப - jmp .no_capt - @@: - mov byte[buffer+list_offs_text+4],' ' - mov esi,ecx - mov edi,buffer+list_offs_text+5 - mov ecx,size_one_list-(list_offs_text+5) - cld - rep movsb - mov byte[buffer+size_one_list-1],0 ;0 - ᨬ ப - .no_capt: - stdcall [tl_node_add], tree1, ebx, buffer - stdcall [tl_cur_next], tree1 - popad - ret -endp - -;input: -; eax - value -; buf - string buffer -; len - buffer len -;output: -align 4 -proc convert_int_to_str, buf:dword, len:dword -pushad - mov edi,[buf] - mov esi,[len] - add esi,edi - dec esi - call .str -popad - ret -endp - -align 4 -.str: - mov ecx,10 - cmp eax,ecx - jb @f - xor edx,edx - div ecx - push edx - call .str - pop eax - @@: - cmp edi,esi - jge @f - or al,0x30 - stosb - mov byte[edi],0 - @@: - ret - -align 4 -but_save_file: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.3ds - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_save_file - ; 㤠筮 ⨨ - - mov [run_file_70.Function], SSF_CREATE_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov ebx, dword[open_file_data] - mov [run_file_70.Buffer], ebx - mov ebx,dword[ebx+2] - mov dword[run_file_70.Count], ebx ;ࠧ 䠩 - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_save_file - ;...ᮮ饭... - .end_save_file: - popad - ret - -align 4 -but_wnd_coords: - cmp byte[prop_wnd_run],0 - jne @f - pushad - mcall SF_CREATE_THREAD,1,prop_start,thread_coords - popad - @@: - ret - -;description: -; 㤠 ࠭ ⮣ 䠩 -align 4 -but_delete_chunk: - pushad - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je .end_f - cmp byte[eax+list_offs_chunk_del],0 ;᫨ 饭 㤠 - jne .notify - - ;(1) ஢ 䠩 - mov edx,dword[eax+4] ;ࠧ - sub [open_file_size],edx ; ࠧ஢ 䠩 - mov ecx,[open_file_size] - mov ebx,dword[eax] - sub ecx,ebx ;ecx - ࠧ ᤢ 䠩 - add ebx,dword[open_file_data] ;砥 祭 ᤢ - mov edi,ebx - mov esi,ebx - add esi,edx - mov bl,byte[eax+list_offs_chunk_lev] ;६ ஢ ⥪饣 㧫 - rep movsb - mov byte[can_save],1 - - ;(2) ࠧ஢ த⥫᪨ - cmp bl,0 - je .end_2 - .cycle_2: - stdcall [tl_cur_perv], tree1 - stdcall [tl_node_get_data],tree1 - cmp eax,0 - je .end_2 - cmp byte[eax+list_offs_chunk_lev],bl - jge .cycle_2 - mov bl,byte[eax+list_offs_chunk_lev] - mov ecx,[eax] - add ecx,[open_file_data] - sub dword[ecx+2],edx - cmp bl,0 ;᫨ ᠬ 孨 㧥, bl=0 - jne .cycle_2 - .end_2: - - ;(3) ᯨ᪠ tree1 - call init_tree - call draw_window - - jmp .end_f - .notify: - notify_window_run txt_not_delete - .end_f: - popad - ret - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter.1 -.1: -db '3DS',0 -db 'STL',0 -.3: -db 'PNG',0 -.end: -db 0 - - -align 4 -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'box_lib.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'buf2d.obj',0 -system_dir_4 db '/sys/lib/' -lib_name_4 db 'kmenu.obj',0 -system_dir_5 db '/sys/lib/' -lib_name_5 db 'tinygl.obj',0 -system_dir_6 db '/sys/lib/' -lib_name_6 db 'libini.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d - lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu - lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl - lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw - - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start - OpenDialog_Set_file_name dd aOpenDialog_Set_file_name - OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 - aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 - -align 4 -import_buf2d: - dd sz_init0 - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_resize dd sz_buf2d_resize - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_set_pixel dd sz_buf2d_set_pixel - dd 0,0 - sz_init0 db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_resize db 'buf2d_resize',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - -align 4 -import_box_lib: - dd sz_init1 - edit_box_draw dd sz_edit_box_draw - edit_box_key dd sz_edit_box_key - edit_box_mouse dd sz_edit_box_mouse - edit_box_set_text dd sz_edit_box_set_text - scrollbar_ver_draw dd sz_scrollbar_ver_draw - scrollbar_hor_draw dd sz_scrollbar_hor_draw - - tl_data_init dd sz_tl_data_init - tl_data_clear dd sz_tl_data_clear - tl_info_clear dd sz_tl_info_clear - tl_key dd sz_tl_key - tl_mouse dd sz_tl_mouse - tl_draw dd sz_tl_draw - tl_info_undo dd sz_tl_info_undo - tl_info_redo dd sz_tl_info_redo - tl_node_add dd sz_tl_node_add - tl_node_set_data dd sz_tl_node_set_data - tl_node_get_data dd sz_tl_node_get_data - tl_node_delete dd sz_tl_node_delete - tl_node_move_up dd sz_tl_node_move_up - tl_node_move_down dd sz_tl_node_move_down - tl_cur_beg dd sz_tl_cur_beg - tl_cur_next dd sz_tl_cur_next - tl_cur_perv dd sz_tl_cur_perv - tl_node_close_open dd sz_tl_node_close_open - tl_node_lev_inc dd sz_tl_node_lev_inc - tl_node_lev_dec dd sz_tl_node_lev_dec - tl_node_poi_get_info dd sz_tl_node_poi_get_info - tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info - tl_node_poi_get_data dd sz_tl_node_poi_get_data - - dd 0,0 - sz_init1 db 'lib_init',0 - sz_edit_box_draw db 'edit_box_draw',0 - sz_edit_box_key db 'edit_box_key',0 - sz_edit_box_mouse db 'edit_box_mouse',0 - sz_edit_box_set_text db 'edit_box_set_text',0 - sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 - sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 - - sz_tl_data_init db 'tl_data_init',0 - sz_tl_data_clear db 'tl_data_clear',0 - sz_tl_info_clear db 'tl_info_clear',0 - sz_tl_key db 'tl_key',0 - sz_tl_mouse db 'tl_mouse',0 - sz_tl_draw db 'tl_draw',0 - sz_tl_info_undo db 'tl_info_undo',0 - sz_tl_info_redo db 'tl_info_redo',0 - sz_tl_node_add db 'tl_node_add',0 - sz_tl_node_set_data db 'tl_node_set_data',0 - sz_tl_node_get_data db 'tl_node_get_data',0 - sz_tl_node_delete db 'tl_node_delete',0 - sz_tl_node_move_up db 'tl_node_move_up',0 - sz_tl_node_move_down db 'tl_node_move_down',0 - sz_tl_cur_beg db 'tl_cur_beg',0 - sz_tl_cur_next db 'tl_cur_next',0 - sz_tl_cur_perv db 'tl_cur_perv',0 - sz_tl_node_close_open db 'tl_node_close_open',0 - sz_tl_node_lev_inc db 'tl_node_lev_inc',0 - sz_tl_node_lev_dec db 'tl_node_lev_dec',0 - sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 - sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 - sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 - -align 4 -import_libkmenu: - kmenu_init dd akmenu_init - kmainmenu_draw dd akmainmenu_draw - kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent - ksubmenu_new dd aksubmenu_new - ksubmenu_delete dd aksubmenu_delete - ksubmenu_draw dd aksubmenu_draw - ksubmenu_add dd aksubmenu_add - kmenuitem_new dd akmenuitem_new - kmenuitem_delete dd akmenuitem_delete - kmenuitem_draw dd akmenuitem_draw -dd 0,0 - akmenu_init db 'kmenu_init',0 - akmainmenu_draw db 'kmainmenu_draw',0 - akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 - aksubmenu_new db 'ksubmenu_new',0 - aksubmenu_delete db 'ksubmenu_delete',0 - aksubmenu_draw db 'ksubmenu_draw',0 - aksubmenu_add db 'ksubmenu_add',0 - akmenuitem_new db 'kmenuitem_new',0 - akmenuitem_delete db 'kmenuitem_delete',0 - akmenuitem_draw db 'kmenuitem_draw',0 - -align 4 -import_lib_tinygl: -macro E_LIB n -{ - n dd sz_#n -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - -align 4 -import_libini: - dd alib_init0 - ini_get_str dd aini_get_str - ini_get_int dd aini_get_int - ini_get_color dd aini_get_color -dd 0,0 - alib_init0 db 'lib_init',0 - aini_get_str db 'ini_get_str',0 - aini_get_int db 'ini_get_int',0 - aini_get_color db 'ini_get_color',0 - -align 4 -mouse_dd dd 0 -last_time dd 0 - -align 4 -buf_0: dd 0 ;㪠⥫ ࠦ -.l: dw 205 ;+4 left -.t: dw 35 ;+6 top -.w: dd 340 ;+8 w -.h: dd main_wnd_height-65 ;+12 h -.color: dd 0xffffd0 ;+16 color - db 24 ;+20 bit in pixel - -align 4 -buf_ogl: - dd 0 ;㪠⥫ ࠦ - dw 3d_wnd_l,3d_wnd_t ;+4 left,top -.w: dd 3d_wnd_w -.h: dd 3d_wnd_h - dd 0,24 ;+16 color,bit in pixel - -align 4 -buf_1: - dd 0 ;㪠⥫ ࠦ - dw 0,0 ;+4 left,top - dd 128,144 ;+8 w,h - dd 0,24 ;+16 color,bit in pixel - -align 4 -el_focus dd tree1 -tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\ - el_focus,w_scr_t1,0 - -align 4 -w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 - -align 4 -qObj dd 0 - -light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] - ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) -light_dir dd 0.0,0.0,0.0 ;ࠢ - -mat_specular dd 0.3, 0.3, 0.3, 1.0 ; -mat_shininess dd 3.0 ; (⭠ ய) -white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 -lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 - -if lang eq ru_RU -capt db 'info 3ds 29.09.20',0 ; -else -capt db 'info 3ds version 29.09.20',0 ;window caption -end if - -align 16 -i_end: - ctx1 rb 28 ;sizeof.TinyGLContext = 28 - procinfo process_information - run_file_70 FileInfoBlock - sc system_colors - angle_x rd 1 ;㣫 業 - angle_y rd 1 - angle_z rd 1 - color_ox rd 1 - color_oy rd 1 - color_oz rd 1 - color_bk rd 3 - color_vert rd 1 - color_face rd 1 - color_select rd 1 - obj_poi_sel_c rd 1 - o3d obj_3d - rb 2048 -align 16 -thread_coords: - rb 2048 -align 16 -stacktop: - sys_path rb 2048 - file_name rb 4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, file_name, sys_path + +version_edit equ 1 + +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../load_img.inc' +include '../../load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'info_fun_float.inc' +include 'info_menu.inc' +include 'data.inc' +include 'convert_stl_3ds.inc' + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + +ID_ICON_CHUNK_MAIN equ 0 ; +ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ +ID_ICON_DATA equ 2 ; , । +ID_ICON_POINT equ 8 +ID_ICON_POINT_SEL equ 9 + +FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ + +include 'info_o3d.inc' + +main_wnd_height equ 460 ; ணࠬ +IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 + +align 4 +fl255 dd 255.0 +open_file_data dd 0 ;㪠⥫ 䠩 3ds +open_file_size dd 0 ;ࠧ ⮣ 䠩 +image_data_toolbar dd 0 +icon_tl_sys dd 0 ;㪠⥥ ࠭ ⥬ +icon_toolbar dd 0 ;㪠⥥ ࠭ ꥪ⮢ +fn_toolbar db 'toolbar.png',0 + +align 4 +level_stack dd 0 +offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ + +align 4 +file_3ds: ;६ ᯮ㥬 ⨨ 䠩 +.offs: dd 0 ;+0 㪠⥫ 砫 +.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) +rb 8*MAX_FILE_LEVEL + +size_one_list equ 42 +list_offs_chunk_del equ 8 ; 㤠 +list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) +list_offs_p_data equ 10 ;㪠⥫ +list_offs_text equ 14 ;ᤢ 砫 ⥪ +buffer rb size_one_list ; ᯨ᮪ tree1 + +txt_3ds_symb db 0,0 +;-------------------------------------- + +include 'info_wnd_coords.inc' + +align 4 +start: + ;--- copy cmd line --- + mov esi,file_name + mov edi,openfile_path +@@: + lodsd + or eax,eax + jz @f ;室, ᫨ 0 + stosd + jmp @b +@@: + stosd + + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + .test_lib_open: + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS ;exit not correct + @@: + add ebp,ll_struc_size + cmp ebp,l_libs_end + jl .test_lib_open + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + ;kmenu initialisation + stdcall [kmenu_init],sc + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 9 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 11 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 12 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 13 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 14 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 15 + stdcall [ksubmenu_add], [main_menu_vertexes], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Vertexes, [main_menu_vertexes] + stdcall [ksubmenu_add], [main_menu], eax + + mov dword[w_scr_t1.type],1 + stdcall [tl_data_init], tree1 + ;⥬ 16*16 tree_list + include_image_file 'tl_sys_16.png', icon_tl_sys + ;᫨ ࠦ 뫮, icon_tl_sys + ; 樠஢ , 訡 㤥, . . 㦭 ࠧ + mov eax,dword[icon_tl_sys] + mov dword[tree1.data_img_sys],eax + + load_image_file 'objects.png', icon_toolbar + mov eax,dword[icon_toolbar] + mov dword[tree1.data_img],eax + + stdcall [buf2d_create], buf_0 ;ᮧ + + load_image_file 'font8x9.bmp', image_data_toolbar + stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ + stdcall mem.Free,[image_data_toolbar] ;᢮ + stdcall [buf2d_conv_24_to_8], buf_1,1 ; ஧筮 8 + stdcall [buf2d_convert_text_matrix], buf_1 + + load_image_file fn_toolbar, image_data_toolbar + + ;ࠡ 䠩 ஥ + copy_path ini_name,sys_path,file_name,0 + mov dword[def_dr_mode],0 + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_vertexes + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_fill + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_light + @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff + mov [color_ox],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 + mov [color_oy],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 + mov [color_oz],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 + mov [color_bk],eax + shr eax,8 + mov [color_bk+4],eax + shr eax,8 + mov [color_bk+8],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff + mov [color_vert],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 + mov [color_face],eax + stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 + mov [color_select],eax + finit + fild dword[color_bk+8] + fdiv dword[fl255] + fstp dword[color_bk+8] + mov eax,[color_bk+4] + and eax,0xff + mov [color_bk+4],eax + fild dword[color_bk+4] + fdiv dword[fl255] + fstp dword[color_bk+4] + mov eax,[color_bk] + and eax,0xff + mov [color_bk],eax + fild dword[color_bk] + fdiv dword[fl255] + fstp dword[color_bk] + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 + stdcall [glShadeModel], GL_SMOOTH + call [gluNewQuadric] + mov [qObj],eax + + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov dword[buf_ogl],eax + + ;open file from cmd line + cmp dword[openfile_path],0 + je @f + call but_open_file.no_dlg + @@: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + or eax,eax + jz timer_funct + + cmp al,1 + jne @f + call draw_window + jmp still + @@: + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo+4] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + stdcall [tl_mouse], dword tree1 + ret + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;ᬠਢ 뤥 + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je @f + mov ebx,eax + mov eax,dword[ebx] + mov ecx,dword[ebx+4] ;ࠧ + stdcall hex_in_str, txt_3ds_offs.dig, eax,8 + stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 + + add eax,dword[open_file_data] ;砥 祭 ᤢ + cmp dword[offs_last_timer],eax + je @f + ;᫨ 뤥 ᮢ ᫥ + mov dword[offs_last_timer],eax + stdcall buf_draw_beg, buf_0 + stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000 + mov edx,dword[ebx+list_offs_p_data] + cmp edx,0 ;ᬮਬ ᠭ + je .no_info + stdcall [buf2d_draw_text], buf_0, buf_1,edx,5,45,0xb000 + .no_info: + add ecx,eax ;砥 ࠧ + stdcall buf_draw_hex_table,eax,ecx ; 16- + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + @@: + popad + jmp still + +align 4 +proc buf_draw_hex_table, offs:dword, size_line:dword + pushad + locals + coord_y dd 55 ;न y 砫 뢮 ⠡ + endl + mov esi,dword[offs] + mov edi,dword[open_file_data] + add edi,dword[file_3ds.size] ;edi - 㪠⥫ 䠩 + mov dword[txt_3ds_offs.dig],0 + cld + .cycle_rows: + mov ebx,5 ; ᫥ + mov edx,5+10*24 ; ᫥ ⥪ + mov ecx,10 + @@: + stdcall hex_in_str, txt_3ds_offs.dig, dword[esi],2 + stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs.dig,ebx,[coord_y],0 + + mov al,byte[esi] + mov byte[txt_3ds_symb],al + stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_symb,edx,[coord_y],0x808080 + inc esi + cmp esi,dword[size_line] + jne .end_block + stdcall draw_block_end_line, dword[coord_y] + .end_block: + cmp esi,edi + jge @f ;jg ??? + add ebx,24 + add edx,9 ;ਭ 1- ᨬ +1pix + loop @b + add dword[coord_y],10 ; 1- ᨬ ( ࢠ ப) + mov ebx,dword[buf_0.h] + cmp dword[coord_y],ebx + jl .cycle_rows + @@: + popad + ret +endp + +align 4 +proc draw_block_end_line uses eax ebx ecx, coord_y:dword + add ebx,20 ;20 = width 2.5 symbols + mov eax,[coord_y] + sub eax,2 + mov ecx,eax + add ecx,10 + stdcall [buf2d_line], buf_0, 0,ecx,ebx,ecx ,0xff + stdcall [buf2d_line], buf_0, ebx,ecx,ebx,eax ,0xff + stdcall [buf2d_line], buf_0, ebx,eax,5+10*24-4,eax ,0xff + ret +endp + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + xor eax,eax + mov edx,[sc.work] + or edx,0x33000000 + mov edi,capt + mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,250 + jge @f + mov eax,250 + @@: + sub eax,65 + mov dword[tree1.box_height],eax + mov word[w_scr_t1.y_size],ax ; ࠧ ஫ + cmp eax,dword[buf_0.h] ;㢥稢 + jle @f + stdcall [buf2d_resize],buf_0,0,eax,1 + mov dword[offs_last_timer],0 ; ⠩ + @@: + + mov eax,dword[procinfo.box.width] + cmp eax,400 + jge @f + mov eax,400 + @@: + sub eax,[buf_0.w] + sub eax,41 + mov dword[tree1.box_width],eax + add ax,word[tree1.box_left] + mov word[w_scr_t1.x_pos],ax + add ax,16+5 + mov word[buf_0.l],ax + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,0x40000003 + mcall ,(30 shl 16)+20,,0x40000004 + + cmp byte[can_save],0 + je @f + mcall ,(55 shl 16)+20,,0x40000005 + @@: + mcall ,(85 shl 16)+20,,0x40000006 ; न⠬ + mcall ,(110 shl 16)+20,,0x40000007 ;㤠 + + mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+5 ;new + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(30 shl 16)+5 ;open + int 0x40 + + cmp byte[can_save],0 + je @f + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(55 shl 16)+5 ;save + int 0x40 + sub ebx,IMAGE_TOOLBAR_ICON_SIZE + @@: + + add ebx,4*IMAGE_TOOLBAR_ICON_SIZE + mov edx,(85 shl 16)+5 + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(110 shl 16)+5 + int 0x40 + + mov dword[w_scr_t1.all_redraw],1 + stdcall [tl_draw], tree1 + + stdcall [buf2d_draw], buf_0 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +key: + mcall SF_GET_KEY + stdcall [tl_key], dword tree1 + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_wnd_coords + jmp still + @@: + cmp ah,7 + jne @f + call but_delete_chunk + jmp still + @@: + + cmp ah,1 + jne still +.exit: + mov dword[tree1.data_img],0 + mov dword[tree1.data_img_sys],0 + stdcall [tl_data_clear], tree1 + stdcall [buf2d_delete],buf_0 + stdcall [buf2d_delete],buf_1 ;㤠塞 + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_data] + stdcall [gluDeleteQuadric], [qObj] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: + mov byte[can_save],0 + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ; 㤠筮 ⨨ + jmp .end0 +.no_dlg: ;᫨ 㥬 䠩 + pushad + mov esi,openfile_path + stdcall str_len,esi + add esi,eax + @@: ;横 ᪠ 砫 䠩 + dec esi + cmp byte[esi],'/' + je @f + cmp byte[esi],0x5c ;'\' + je @f + cmp esi,openfile_path + jg @b + @@: + inc esi + stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ + .end0: + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], ecx + m2m dword[run_file_70.Buffer], dword[open_file_data] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 ;㦠 䠩 3ds + cmp ebx,0xffffffff + je .end_open_file + + mov [open_file_size],ebx + ;mcall SF_SET_CAPTION,1,openfile_path + + mov byte[can_save],0 + call init_tree + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + stdcall obj_clear_param, o3d ;⨬ ࠬ न⠬ + cmp byte[prop_wnd_run],0 + je @f + ;⨬ न⠬ + stdcall [tl_info_clear], tree3 + @@: + + .end_open_file: + popad + ret + +align 4 +init_tree: + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + + mov esi,[open_file_data] + stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? + or eax,eax + jz @f + ;᫨ 䠩 ଠ *.stl + mov [open_file_size],ecx + mov esi,eax + stdcall mem.Free,[open_file_data] + mov [open_file_data],esi + mov byte[can_save],1 + @@: + cmp word[esi],CHUNK_MAIN + je @f + stdcall buf_draw_beg, buf_0 + stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,5,25,0xff0000 ;㥬 ப ⥪⮬ + jmp .end_open + @@: + ;--- ࠡ⪠ ⮣ *.3ds 䠩 + mov eax,file_3ds + mov dword[level_stack],0 ;塞 ஢ ⥪ + mov dword[offs_last_timer],0 + ;--- ᯨ᮪ + stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 + call block_children ;室 ୨ + + mov edi,[file_3ds.offs] + add edi,[file_3ds.size] + .cycle_main: + cmp dword[level_stack],0 + jle .end_cycle + + cmp esi,edi ;᫨ 䠩 + jge .end_cycle + + mov edx,[esi+2] ;ࠧ + call block_analiz + cmp dword[bl_found],0 + jne @f + ;ꥪ ⭮ + stdcall add_3ds_object, ID_ICON_CHUNK_NOT_FOUND,dword[level_stack],edx,0 + call block_next + jmp .cycle_main + @@: + ;ꥪ ⭮ + mov ecx,dword[bl_found] + mov bx,word[ecx+2] ; ꥪ + stdcall add_3ds_object, ebx,dword[level_stack],edx,dword[ecx+5] + cmp byte[ecx+4],1 + je .bl_data + ; ᮤন ୨ + call block_children ;室 ୨ + jmp .cycle_main + .bl_data: + ; ᮤন + call block_analiz_data + jmp .cycle_main + .end_cycle: + stdcall [tl_cur_beg], tree1 + stdcall [tl_draw], tree1 + .end_open: + ret + +; +;input: +; eax - stack pointer +; esi - memory pointer +;output: +; eax - new stack pointer +; esi - new memory pointer +align 4 +block_analiz_data: + push ebx ecx edx edi + mov dx,word[esi] + mov ecx,dword[esi+2] + sub ecx,6 ;ࠧ + add esi,6 + mov ebx,dword[level_stack] + inc ebx + ; *** ࠧ묨 묨 뤥 + cmp dx,CHUNK_OBJBLOCK ;ꥪ + jne @f + push ax + cld + xor al,al + mov edi,esi + repne scasb + pop ax + sub edi,esi ;edi - strlen + stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ + add esi,edi + ;sub ecx,edi ;㦥 ᤥ repne + jmp .next_bl + @@: + cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 + je .vertexes + cmp dx,0x4111 ;䫠 設 + je .vertexes + cmp dx,CHUNK_MAPLIST ;⥪ न + je .vertexes + jmp @f + .vertexes: ;ࠡ⪠ , ᮤঠ 設 + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ 設 + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; 設 + sub esi,8 ;⠭ esi + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ + jne @f + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ + push eax + movzx eax,word[esi] + shl eax,3 + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,eax,0 ; ࠭ + + sub ecx,eax + cmp ecx,1 + jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ +if 0 + add esi,eax + mov ecx,dword[esi+2] + stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ + sub esi,eax +else + add esi,eax + pop eax + jmp .next_bl +end if + .data_3: + + sub esi,8 ;⠭ esi + pop eax + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACEMAT ;ਠ ࠭ + jne @f + push ax + cld + xor al,al + mov edi,esi + repne scasb + pop ax + sub edi,esi ;edi - strlen + stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ + add esi,edi + ;sub ecx,edi ;㦥 ᤥ repne + stdcall add_3ds_object, ID_ICON_DATA,ebx,2,txt_count ;᫮ ࠭ + add esi,2 + sub ecx,2 + stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ; ࠭, ਬ ਠ + sub esi,edi ;⠭ esi (1) + sub esi,8 ;⠭ esi (2) + call block_next + jmp .end_f + @@: + ; *** 묨 㬮砭 ( 뤥 ) + stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 + sub esi,6 ;⠭ esi + call block_next + jmp .end_f + .next_bl: + ; *** ன ⠢ + mov dword[eax],esi ;㪠⥫ 砫 + mov ebx,dword[esi+2] + mov dword[eax+4],ebx ;ࠧ + inc dword[level_stack] + add eax,8 + .end_f: + pop edi edx ecx ebx + ret + +;室 1- ୨ +;input: +; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds +; esi - 砫 த⥫᪮ +;output: +; ebx - destroy +; esi - 砫 த⥫᪮ +align 4 +block_children: + push ecx + ;஢ઠ ࠢ쭮 ࠧ஢ ୥ + mov ebx,esi + add ebx,6 ;室 砫 ୥ + add ebx,dword[ebx+2] ;塞 ࠧ ୥ + mov ecx,esi + add ecx,dword[esi+2] ;塞 ࠧ த⥫᪮ + cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 + jle @f + ;஢ 訡 䠩, ୨ 室 । த⥫᪮ + mov dword[level_stack],FILE_ERROR_CHUNK_SIZE + jmp .end_f + @@: + mov [eax],esi ;㪠⥫ 砫 + mov ebx,[esi+2] + mov [eax+4],ebx ;ࠧ + add esi,6 ;室 + inc dword[level_stack] + add eax,8 + .end_f: + pop ecx + ret + +;室 ᫥饬 ⥪饣 ஢ +;input: +; eax - ६묨 +align 4 +block_next: +push ebx + add esi,dword[esi+2] ;ய᪠ + + ;஢ઠ ࠧ஢ த⥫᪮ , 室 孨 ஢ ᫨ + @@: + mov ebx,dword[eax-8] + add ebx,dword[eax-4] + cmp esi,ebx + jl @f + dec dword[level_stack] + sub eax,8 + cmp dword[level_stack],0 + jg @b + @@: +pop ebx + ret + +;㭪 ᪠ 뢠饩 +;input: +;esi - memory pointer +;output: +;dword[bl_found] - pointer to chunk struct (= 0 if not found) +align 4 +bl_found dd 0 +block_analiz: +pushad + mov dword[bl_found],0 + mov ecx,type_bloks + @@: + mov bx,word[ecx] + cmp word[esi],bx + je .found + add ecx,sizeof.block_3ds + cmp ecx,type_bloks.end + jl @b + jmp .no_found + .found: + mov dword[bl_found],ecx + .no_found: +popad + ret + +;input: +; esi - 㪠⥫ 㥬 +; icon - +; level - ஢ 㧫 +; size_bl - ࠧ +; info_bl - ப ᠭ +align 4 +proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword + pushad + mov bx,word[icon] + shl ebx,16 + mov bx,word[level] + + mov eax,esi + sub eax,dword[open_file_data] + mov dword[buffer],eax ;ᬥ饭 + mov ecx,dword[size_bl] + mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) + mov ecx,dword[bl_found] + or ecx,ecx + jz @f + ;... 㦥 㣮 㤠 + mov cl,byte[ecx+4] + @@: + mov byte[buffer+list_offs_chunk_del],cl + mov ecx,[level] + mov byte[buffer+list_offs_chunk_lev],cl + mov ecx,dword[info_bl] + mov dword[buffer+list_offs_p_data],ecx + stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 + stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ; 3ds + or ecx,ecx + jnz @f + mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ ப + jmp .no_capt + @@: + mov byte[buffer+list_offs_text+4],' ' + mov esi,ecx + mov edi,buffer+list_offs_text+5 + mov ecx,size_one_list-(list_offs_text+5) + cld + rep movsb + mov byte[buffer+size_one_list-1],0 ;0 - ᨬ ப + .no_capt: + stdcall [tl_node_add], tree1, ebx, buffer + stdcall [tl_cur_next], tree1 + popad + ret +endp + +;input: +; eax - value +; buf - string buffer +; len - buffer len +;output: +align 4 +proc convert_int_to_str, buf:dword, len:dword +pushad + mov edi,[buf] + mov esi,[len] + add esi,edi + dec esi + call .str +popad + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 + @@: + ret + +align 4 +but_save_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.3ds + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ; 㤠筮 ⨨ + + mov [run_file_70.Function], SSF_CREATE_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov ebx, dword[open_file_data] + mov [run_file_70.Buffer], ebx + mov ebx,dword[ebx+2] + mov dword[run_file_70.Count], ebx ;ࠧ 䠩 + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_save_file + ;...ᮮ饭... + .end_save_file: + popad + ret + +align 4 +but_wnd_coords: + cmp byte[prop_wnd_run],0 + jne @f + pushad + mcall SF_CREATE_THREAD,1,prop_start,thread_coords + popad + @@: + ret + +;description: +; 㤠 ࠭ ⮣ 䠩 +align 4 +but_delete_chunk: + pushad + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je .end_f + cmp byte[eax+list_offs_chunk_del],0 ;᫨ 饭 㤠 + jne .notify + + ;(1) ஢ 䠩 + mov edx,dword[eax+4] ;ࠧ + sub [open_file_size],edx ; ࠧ஢ 䠩 + mov ecx,[open_file_size] + mov ebx,dword[eax] + sub ecx,ebx ;ecx - ࠧ ᤢ 䠩 + add ebx,dword[open_file_data] ;砥 祭 ᤢ + mov edi,ebx + mov esi,ebx + add esi,edx + mov bl,byte[eax+list_offs_chunk_lev] ;६ ஢ ⥪饣 㧫 + rep movsb + mov byte[can_save],1 + + ;(2) ࠧ஢ த⥫᪨ + cmp bl,0 + je .end_2 + .cycle_2: + stdcall [tl_cur_perv], tree1 + stdcall [tl_node_get_data],tree1 + cmp eax,0 + je .end_2 + cmp byte[eax+list_offs_chunk_lev],bl + jge .cycle_2 + mov bl,byte[eax+list_offs_chunk_lev] + mov ecx,[eax] + add ecx,[open_file_data] + sub dword[ecx+2],edx + cmp bl,0 ;᫨ ᠬ 孨 㧥, bl=0 + jne .cycle_2 + .end_2: + + ;(3) ᯨ᪠ tree1 + call init_tree + call draw_window + + jmp .end_f + .notify: + notify_window_run txt_not_delete + .end_f: + popad + ret + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +db '3DS',0 +db 'STL',0 +.3: +db 'PNG',0 +.end: +db 0 + + +align 4 +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'box_lib.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'buf2d.obj',0 +system_dir_4 db '/sys/lib/' +lib_name_4 db 'kmenu.obj',0 +system_dir_5 db '/sys/lib/' +lib_name_5 db 'tinygl.obj',0 +system_dir_6 db '/sys/lib/' +lib_name_6 db 'libini.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d + lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu + lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl + lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start + OpenDialog_Set_file_name dd aOpenDialog_Set_file_name + OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 + aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 + +align 4 +import_buf2d: + dd sz_init0 + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_set_pixel dd sz_buf2d_set_pixel + dd 0,0 + sz_init0 db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + +align 4 +import_box_lib: + dd sz_init1 + edit_box_draw dd sz_edit_box_draw + edit_box_key dd sz_edit_box_key + edit_box_mouse dd sz_edit_box_mouse + edit_box_set_text dd sz_edit_box_set_text + scrollbar_ver_draw dd sz_scrollbar_ver_draw + scrollbar_hor_draw dd sz_scrollbar_hor_draw + + tl_data_init dd sz_tl_data_init + tl_data_clear dd sz_tl_data_clear + tl_info_clear dd sz_tl_info_clear + tl_key dd sz_tl_key + tl_mouse dd sz_tl_mouse + tl_draw dd sz_tl_draw + tl_info_undo dd sz_tl_info_undo + tl_info_redo dd sz_tl_info_redo + tl_node_add dd sz_tl_node_add + tl_node_set_data dd sz_tl_node_set_data + tl_node_get_data dd sz_tl_node_get_data + tl_node_delete dd sz_tl_node_delete + tl_node_move_up dd sz_tl_node_move_up + tl_node_move_down dd sz_tl_node_move_down + tl_cur_beg dd sz_tl_cur_beg + tl_cur_next dd sz_tl_cur_next + tl_cur_perv dd sz_tl_cur_perv + tl_node_close_open dd sz_tl_node_close_open + tl_node_lev_inc dd sz_tl_node_lev_inc + tl_node_lev_dec dd sz_tl_node_lev_dec + tl_node_poi_get_info dd sz_tl_node_poi_get_info + tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info + tl_node_poi_get_data dd sz_tl_node_poi_get_data + + dd 0,0 + sz_init1 db 'lib_init',0 + sz_edit_box_draw db 'edit_box_draw',0 + sz_edit_box_key db 'edit_box_key',0 + sz_edit_box_mouse db 'edit_box_mouse',0 + sz_edit_box_set_text db 'edit_box_set_text',0 + sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 + sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 + + sz_tl_data_init db 'tl_data_init',0 + sz_tl_data_clear db 'tl_data_clear',0 + sz_tl_info_clear db 'tl_info_clear',0 + sz_tl_key db 'tl_key',0 + sz_tl_mouse db 'tl_mouse',0 + sz_tl_draw db 'tl_draw',0 + sz_tl_info_undo db 'tl_info_undo',0 + sz_tl_info_redo db 'tl_info_redo',0 + sz_tl_node_add db 'tl_node_add',0 + sz_tl_node_set_data db 'tl_node_set_data',0 + sz_tl_node_get_data db 'tl_node_get_data',0 + sz_tl_node_delete db 'tl_node_delete',0 + sz_tl_node_move_up db 'tl_node_move_up',0 + sz_tl_node_move_down db 'tl_node_move_down',0 + sz_tl_cur_beg db 'tl_cur_beg',0 + sz_tl_cur_next db 'tl_cur_next',0 + sz_tl_cur_perv db 'tl_cur_perv',0 + sz_tl_node_close_open db 'tl_node_close_open',0 + sz_tl_node_lev_inc db 'tl_node_lev_inc',0 + sz_tl_node_lev_dec db 'tl_node_lev_dec',0 + sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 + sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 + sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_lib_tinygl: +macro E_LIB n +{ + n dd sz_#n +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + +align 4 +import_libini: + dd alib_init0 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init0 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +align 4 +mouse_dd dd 0 +last_time dd 0 + +align 4 +buf_0: dd 0 ;㪠⥫ ࠦ +.l: dw 205 ;+4 left +.t: dw 35 ;+6 top +.w: dd 340 ;+8 w +.h: dd main_wnd_height-65 ;+12 h +.color: dd 0xffffd0 ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_ogl: + dd 0 ;㪠⥫ ࠦ + dw 3d_wnd_l,3d_wnd_t ;+4 left,top +.w: dd 3d_wnd_w +.h: dd 3d_wnd_h + dd 0,24 ;+16 color,bit in pixel + +align 4 +buf_1: + dd 0 ;㪠⥫ ࠦ + dw 0,0 ;+4 left,top + dd 128,144 ;+8 w,h + dd 0,24 ;+16 color,bit in pixel + +align 4 +el_focus dd tree1 +tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\ + el_focus,w_scr_t1,0 + +align 4 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +align 4 +qObj dd 0 + +light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] + ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) +light_dir dd 0.0,0.0,0.0 ;ࠢ + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; +mat_shininess dd 3.0 ; (⭠ ய) +white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 + +if lang eq ru_RU +capt db 'info 3ds 29.09.20',0 ; +else ; Default to en_US +capt db 'info 3ds version 29.09.20',0 ;window caption +end if + +align 16 +i_end: + ctx1 rb 28 ;sizeof.TinyGLContext = 28 + procinfo process_information + run_file_70 FileInfoBlock + sc system_colors + angle_x rd 1 ;㣫 業 + angle_y rd 1 + angle_z rd 1 + color_ox rd 1 + color_oy rd 1 + color_oz rd 1 + color_bk rd 3 + color_vert rd 1 + color_face rd 1 + color_select rd 1 + obj_poi_sel_c rd 1 + o3d obj_3d + rb 2048 +align 16 +thread_coords: + rb 2048 +align 16 +stacktop: + sys_path rb 2048 + file_name rb 4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/develop/info3ds/info3ds_u.asm b/programs/develop/info3ds/info3ds_u.asm index 241950245..a9d47f951 100644 --- a/programs/develop/info3ds/info3ds_u.asm +++ b/programs/develop/info3ds/info3ds_u.asm @@ -1,1459 +1,1459 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, file_name, sys_path - -version_edit equ 0 - -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include '../../load_img.inc' -include '../../load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include 'lang.inc' -include 'info_fun_float.inc' -include 'info_menu.inc' -include 'data.inc' -include 'convert_stl_3ds.inc' - -3d_wnd_l equ 205 ; tinygl ᫥ -3d_wnd_t equ 47 ; tinygl ᢥ -3d_wnd_w equ 344 -3d_wnd_h equ 312 - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - -ID_ICON_CHUNK_MAIN equ 0 ; -ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ -ID_ICON_DATA equ 2 ; , । -ID_ICON_POINT equ 8 -ID_ICON_POINT_SEL equ 9 - -FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ - -size_one_list equ 42+sizeof.obj_3d -list_offs_chunk_del equ 8 ; 㤠 -list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) -list_offs_p_data equ 10 ;㪠⥫ -list_offs_obj3d equ 14 ;㪠⥫ 3d ꥪ -list_offs_text equ 14+sizeof.obj_3d ;ᤢ 砫 ⥪ -include 'info_o3d.inc' - -align 4 -fl255 dd 255.0 -open_file_data dd 0 ;㪠⥫ 䠩 3ds -open_file_size dd 0 ;ࠧ ⮣ 䠩 - -; -main_wnd_height equ 460 ; ணࠬ -fn_toolbar db 'toolbar.png',0 -IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 -image_data_toolbar dd 0 -; -icon_tl_sys dd 0 ;㪠⥫ ࠭ ⥬ -icon_toolbar dd 0 ;㪠⥫ ࠭ ꥪ⮢ - -;-------------------------------------- -level_stack dd 0 -offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ - -align 4 -file_3ds: ;६ ᯮ㥬 ⨨ 䠩 -.offs: dd 0 ;+0 㪠⥫ 砫 -.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) -rb 8*MAX_FILE_LEVEL - -buffer rb size_one_list ; ᯨ᮪ tree1 - -txt_3ds_symb db 0,0 -;-------------------------------------- - - - -align 4 -start: - ;--- copy cmd line --- - mov esi,file_name - mov edi,openfile_path -@@: - lodsd - or eax,eax - jz @f ;室, ᫨ 0 - stosd - jmp @b -@@: - stosd - - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - .test_lib_open: - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS ;exit not correct - @@: - add ebp,ll_struc_size - cmp ebp,l_libs_end - jl .test_lib_open - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - ;kmenu initialisation - stdcall [kmenu_init],sc - stdcall [ksubmenu_new] - mov [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Mat, 8 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 10 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 11 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] - stdcall [ksubmenu_add], [main_menu], eax - - mov dword[w_scr_t1.type],1 - stdcall [tl_data_init], tree1 - ;⥬ 16*16 tree_list - include_image_file 'tl_sys_16.png', icon_tl_sys - ;᫨ ࠦ 뫮, icon_tl_sys - ; 樠஢ , 訡 㤥, . . 㦭 ࠧ - mov eax,dword[icon_tl_sys] - mov dword[tree1.data_img_sys],eax - - load_image_file 'objects.png', icon_toolbar - mov eax,dword[icon_toolbar] - mov dword[tree1.data_img],eax - - load_image_file 'font8x9.bmp', image_data_toolbar - stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ - stdcall mem.Free,[image_data_toolbar] ;᢮ - stdcall [buf2d_conv_24_to_8], buf_1,1 ; ஧筮 8 - stdcall [buf2d_convert_text_matrix], buf_1 - - load_image_file fn_toolbar, image_data_toolbar - - ;ࠡ 䠩 ஥ - copy_path ini_name,sys_path,file_name,0 - mov dword[def_dr_mode],0 - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_vertexes - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_fill - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dfm,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_faces_mat - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_light - @@: - stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1 - or eax,eax - jz @f - or dword[def_dr_mode], 1 shl bit_smooth - @@: - stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff - mov [color_ox],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 - mov [color_oy],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 - mov [color_oz],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 - mov [color_bk],eax - shr eax,8 - mov [color_bk+4],eax - shr eax,8 - mov [color_bk+8],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff - mov [color_vert],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 - mov [color_face],eax - stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 - mov [color_select],eax - finit - fild dword[color_bk+8] - fdiv dword[fl255] - fstp dword[color_bk+8] - mov eax,[color_bk+4] - and eax,0xff - mov [color_bk+4],eax - fild dword[color_bk+4] - fdiv dword[fl255] - fstp dword[color_bk+4] - mov eax,[color_bk] - and eax,0xff - mov [color_bk],eax - fild dword[color_bk] - fdiv dword[fl255] - fstp dword[color_bk] - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 - stdcall [glShadeModel], GL_SMOOTH - call [gluNewQuadric] - mov [qObj],eax - - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov dword[buf_ogl],eax - - ;open file from cmd line - cmp dword[openfile_path],0 - je @f - call but_open_file.no_dlg - @@: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - or eax,eax - jz timer_funct - - cmp al,1 - jne @f - call draw_window - jmp still - @@: - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo+4] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - push eax ebx - mcall SF_MOUSE_GET,SSF_BUTTON_EXT - bt eax,0 - jnc .end_m - ;mouse l. but. move - cmp dword[mouse_drag],1 - jne .end_m - - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end_d - mov ebx,[eax] - add ebx,dword[open_file_data] ;砥 祭 ᤢ - cmp word[ebx],CHUNK_OBJBLOCK - jne .end_d - - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - sar ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jg @f - mov ebx,3d_wnd_l - @@: - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jle @f - mov ebx,3d_wnd_w - @@: - movsx eax,ax ;mouse.y - cmp eax,3d_wnd_t - jg @f - mov eax,3d_wnd_t - @@: - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jle @f - mov eax,3d_wnd_h - @@: - finit - fild dword[mouse_y] - mov [mouse_y],eax - fisub dword[mouse_y] - fdiv dword[angle_dxm] ;᫨ y ( ) x - fadd dword[angle_x] - fstp dword[angle_x] - - fild dword[mouse_x] - mov [mouse_x],ebx - fisub dword[mouse_x] - fdiv dword[angle_dym] ;᫨ x ( ) y - fadd dword[angle_y] - fstp dword[angle_y] - - stdcall [tl_node_get_data],tree1 - ;cmp eax,0 - , 뫮 ᤥ - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end_d - .end_m: - bt eax,16 - jnc @f - ;mouse l. but. up - mov dword[mouse_drag],0 - jmp .end_d - @@: - bt eax,8 - jnc .end_d - ;mouse l. but. press - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - sar ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jl .end_d - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jg .end_d - movsx eax,ax ;mouse.y - cmp eax,3d_wnd_t - jl .end_d - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jg .end_d - mov dword[mouse_drag],1 - mov dword[mouse_x],ebx - mov dword[mouse_y],eax - .end_d: - - stdcall [tl_mouse], tree1 - stdcall [kmainmenu_dispatch_cursorevent], [main_menu] - pop ebx eax - ret - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;ᬠਢ 뤥 - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end_f - lea edi,[eax+list_offs_obj3d] - mov ebx,eax - mov eax,[ebx] - mov ecx,[ebx+4] ;ࠧ - stdcall hex_in_str, txt_3ds_offs.dig, eax,8 - stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 - - add eax,[open_file_data] ;砥 祭 ᤢ - cmp [offs_last_timer],eax - je .end_f - ;᫨ 뤥 ᮢ ᫥ - mov [offs_last_timer],eax - - cmp word[eax],CHUNK_OBJBLOCK - jne .end_oblo - cmp dword[edi+obj_3d.poi_count],2 - jl .ini_oblo - stdcall draw_3d,edi - jmp .end_f - .ini_oblo: - stdcall obj_init,edi ;⪠ ந ६ ꥪ - cmp dword[edi+obj_3d.poi_count],2 - jl .end_f - call mnu_reset_settings ; 㣫 ० ᮢ - jmp .end_f - .end_oblo: - - cmp word[eax],CHUNK_MATERIAL - jne .end_mblo - cmp dword[edi+material.name],0 - je .ini_mblo - stdcall draw_material,edi - jmp .end_f - .ini_mblo: - stdcall mat_init,edi,eax ;⪠ ந ਠ - cmp dword[edi+material.name],0 - je .end_f - stdcall draw_material,edi - jmp .end_f - .end_mblo: - - stdcall buf_draw_beg, buf_ogl - stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000 - mov edx,[ebx+list_offs_p_data] - or edx,edx ;ᬮਬ ᠭ - jz .no_info - stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000 - .no_info: - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - .end_f: - popad - jmp still - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - mov edx,[sc.work] - or edx,0x33000000 - mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,dword[procinfo.box.height] - cmp eax,250 - jge @f - mov eax,250 - @@: - sub eax,30 - sub eax,[tree1.box_top] - mov [tree1.box_height],eax - mov word[w_scr_t1.y_size],ax ; ࠧ ஫ - - stdcall [kmainmenu_draw], [main_menu] - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(24 shl 16)+20,0x40000003 - mcall ,(30 shl 16)+20,,0x40000004 ;open - mcall ,(3d_wnd_l shl 16)+20,,0x40000005 ;設 . - mcall ,((3d_wnd_l+25) shl 16)+20,,0x40000006 ;ઠ ࠭ . - mcall ,((3d_wnd_l+50) shl 16)+20,,0x40000007 ; ࠭ . - mcall ,((3d_wnd_l+75) shl 16)+20,,0x40000008 ;࠭ ਠ . - mcall ,((3d_wnd_l+100) shl 16)+20,,0x40000009 ;ᢥ ./몫. - mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;ᣫ - mcall ,((3d_wnd_l+150) shl 16)+20,,0x4000000b ; - mcall ,((3d_wnd_l+175) shl 16)+20,,0x4000000c ;ਭ 3d - - mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+24 ;new - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,(30 shl 16)+24 ;open - add ebx,IMAGE_TOOLBAR_ICON_SIZE*6 - mcall ,,,((3d_wnd_l) shl 16)+24 ;設 . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+25) shl 16)+24 ;ઠ ࠭ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+50) shl 16)+24 ; ࠭ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+100) shl 16)+24 ;ᢥ ./몫. - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+150) shl 16)+24 ; - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+75) shl 16)+24 ;࠭ ਠ . - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+125) shl 16)+24 ;ᣫ - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+175) shl 16)+24 ;ਭ 3d - - mov dword[w_scr_t1.all_redraw],1 - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_ogl - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -key: - mcall SF_GET_KEY - - cmp dword[el_focus], tree1 - jne @f - stdcall [tl_key], tree1 - jmp .end - @@: - - cmp ah,178 ;Up - jne @f - fld dword[angle_x] - fadd dword[delt_size] - fstp dword[angle_x] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,177 ;Down - jne @f - fld dword[angle_x] - fsub dword[delt_size] - fstp dword[angle_x] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,176 ;Left - jne @f - fld dword[angle_y] - fadd dword[delt_size] - fstp dword[angle_y] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - jmp .end - @@: - cmp ah,179 ;Right - jne @f - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - stdcall [tl_node_get_data],tree1 - or eax,eax - jz .end - add eax,list_offs_obj3d - stdcall draw_3d, eax - ;jmp .end - @@: - - .end: - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - - ;menu functions - cmp ah,5 - jne @f - call mnu_vertexes_on - jmp still - @@: - cmp ah,6 - jne @f - call mnu_edges_on - jmp still - @@: - cmp ah,7 - jne @f - call mnu_faces_on - jmp still - @@: - cmp ah,8 - jne @f - call mnu_faces_mat - jmp still - @@: - cmp ah,9 - jne @f - call mnu_light_on_off - jmp still - @@: - cmp ah,10 - jne @f - call mnu_smooth_on_off - jmp still - @@: - cmp ah,11 - jne @f - call mnu_reset_settings - jmp still - @@: - cmp ah,12 - jne @f - call mnu_make_scrshot - jmp still - @@: - - cmp ah,1 - jne still -.exit: - mov dword[tree1.data_img],0 - mov dword[tree1.data_img_sys],0 - stdcall [tl_data_clear], tree1 - stdcall [buf2d_delete],buf_1 ;㤠塞 - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_data] - stdcall [gluDeleteQuadric], [qObj] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: -push eax ebx - stdcall [tl_node_poi_get_info], tree1,0 - @@: - or eax,eax - jz @f - mov ebx,eax - stdcall [tl_node_poi_get_data], tree1,ebx - add eax,list_offs_obj3d - stdcall obj_clear_param, eax - stdcall [tl_node_poi_get_next_info], tree1,ebx - or eax,eax - jnz @b - @@: -pop ebx eax - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - stdcall [buf2d_clear], buf_ogl, [buf_ogl.color] ;⨬ - stdcall [tl_draw], tree1 - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - ret - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - ; 㤠筮 ⨨ - jmp .end0 -.no_dlg: ;᫨ 㥬 䠩 - pushad - mov esi,openfile_path - stdcall str_len,esi - add esi,eax - @@: ;横 ᪠ 砫 䠩 - dec esi - cmp byte[esi],'/' - je @f - cmp byte[esi],0x5c ;'\' - je @f - cmp esi,openfile_path - jg @b - @@: - inc esi - stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ - .end0: - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.ReAlloc,[open_file_data],ecx - mov [open_file_data],eax - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], ecx - m2m dword[run_file_70.Buffer], dword[open_file_data] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 ;㦠 䠩 3ds - cmp ebx,0xffffffff - je .end_open_file - mov [open_file_size],ebx - ;mcall SF_SET_CAPTION,1,openfile_path - - call init_tree - stdcall [buf2d_draw], buf_ogl ;塞 ࠭ - .end_open_file: - popad - ret - -align 4 -init_tree: - ;⨬ ꥪ⠬ - stdcall [tl_node_poi_get_info], tree1,0 - @@: - or eax,eax - jz @f - mov ebx,eax - stdcall [tl_node_poi_get_data], tree1,ebx - or eax,eax - jz @f - add eax,list_offs_obj3d - stdcall obj_clear_param, eax - stdcall [tl_node_poi_get_next_info], tree1,ebx - or eax,eax - jnz @b - @@: - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - - mov esi,[open_file_data] - stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? - or eax,eax - jz @f - ;᫨ 䠩 ଠ *.stl - mov [open_file_size],ecx - mov esi,eax - stdcall mem.Free,[open_file_data] - mov [open_file_data],esi - mov byte[can_save],1 - @@: - cmp word[esi],CHUNK_MAIN - je @f - mov eax,[esi] - bswap eax - stdcall hex_in_str, txt_no_3ds.zag, eax,8 - stdcall buf_draw_beg, buf_ogl - stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,5,25,0xff0000 ;㥬 ப ⥪⮬ - jmp .end_open - @@: - ;--- ࠡ⪠ ⮣ *.3ds 䠩 - mov eax,file_3ds - mov dword[level_stack],0 ;塞 ஢ ⥪ - mov dword[offs_last_timer],0 - ;--- ᯨ᮪ - stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 - call block_children ;室 ୨ - - mov edi,[file_3ds.offs] - add edi,[file_3ds.size] - .cycle_main: - cmp dword[level_stack],0 - jle .end_cycle - - cmp esi,edi ;᫨ 䠩 - jge .end_cycle - - mov edx,[esi+2] ;ࠧ - call block_analiz - cmp word[esi],CHUNK_MATERIAL - je @f - cmp word[esi],CHUNK_OBJMESH - je @f - cmp word[esi],CHUNK_OBJBLOCK - je @f - mov dword[bl_found],0 - @@: - cmp dword[bl_found],0 - jne @f - ;ꥪ ⭮ - call block_next - jmp .cycle_main - @@: - ;ꥪ ⭮ - mov ecx,dword[bl_found] - mov bx,word[ecx+2] ; ꥪ - cmp word[esi],CHUNK_OBJBLOCK - jne .pod1 - add esi,6 - push esi - sub esi,6 - jmp .pod3 - .pod1: - cmp word[esi],CHUNK_MATERIAL - jne .pod2 - cmp word[esi+6],CHUNK_MATNAME - jne .pod2 - add esi,12 - push esi - sub esi,12 - jmp .pod3 - .pod2: - push dword[ecx+5] ;⠭⭮ - .pod3: - stdcall add_3ds_object, ebx,dword[level_stack],edx - cmp byte[ecx+4],1 - je .bl_data - ; ᮤন ୨ - call block_children ;室 ୨ - jmp .cycle_main - .bl_data: - ; ᮤন - call block_analiz_data - jmp .cycle_main - .end_cycle: - stdcall [tl_cur_beg], tree1 - stdcall [tl_draw], tree1 - .end_open: - ret - -; -;input: -; eax - stack pointer -; esi - memory pointer -;output: -; eax - new stack pointer -; esi - new memory pointer -align 4 -proc block_analiz_data uses ebx ecx edx edi - mov dx,[esi] - mov ecx,[esi+2] - sub ecx,6 ;ࠧ - add esi,6 - mov ebx,dword[level_stack] - inc ebx - ; *** ࠧ묨 묨 뤥 - cmp dx,CHUNK_OBJBLOCK ;ꥪ - jne @f - push ax - cld - xor al,al - mov edi,esi - repne scasb - pop ax - sub edi,esi ;edi - strlen - add esi,edi - ;sub ecx,edi ;㦥 ᤥ repne - jmp .next_bl - @@: - cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 - je .vertexes - cmp dx,0x4111 ;䫠 設 - je .vertexes - cmp dx,CHUNK_MAPLIST ;⥪ न - je .vertexes - jmp @f - .vertexes: ;ࠡ⪠ , ᮤঠ 設 - add esi,2 - sub ecx,2 - sub esi,8 ;⠭ esi - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ - jne @f - push eax - movzx eax,word[esi] - shl eax,3 - add esi,2 - sub ecx,2 - - sub ecx,eax - cmp ecx,1 - jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ -if 1 - add esi,eax - mov ecx,dword[esi+2] - stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ - sub esi,eax -else - add esi,eax - pop eax - jmp .next_bl -end if - .data_3: - - sub esi,8 ;⠭ esi - pop eax - call block_next - jmp .end_f - @@: - cmp dx,CHUNK_FACEMAT ;ਠ ࠭ - jne @f - push ax - cld - xor al,al - mov edi,esi - repne scasb - pop ax - sub edi,esi ;edi - strlen - stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ - add esi,edi - add esi,2 - sub ecx,2 - sub esi,edi ;⠭ esi (1) - sub esi,8 ;⠭ esi (2) - call block_next - jmp .end_f - @@: - ; *** 묨 㬮砭 ( 뤥 ) - sub esi,6 ;⠭ esi - call block_next - jmp .end_f - .next_bl: - ; *** ன ⠢ - mov dword[eax],esi ;㪠⥫ 砫 - mov ebx,dword[esi+2] - mov dword[eax+4],ebx ;ࠧ - inc dword[level_stack] - add eax,8 - .end_f: - ret -endp - -;室 1- ୨ -;input: -; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds -; esi - 砫 த⥫᪮ -;output: -; ebx - destroy -; esi - 砫 த⥫᪮ -align 4 -block_children: - push ecx - ;஢ઠ ࠢ쭮 ࠧ஢ ୥ - lea ebx,[esi+6] ;室 砫 ୥ - add ebx,[ebx+2] ;塞 ࠧ ୥ - mov ecx,esi - add ecx,[esi+2] ;塞 ࠧ த⥫᪮ - cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 - jle @f - ;஢ 訡 䠩, ୨ 室 । த⥫᪮ - mov dword[level_stack],FILE_ERROR_CHUNK_SIZE - jmp .end_f - @@: - mov [eax],esi ;㪠⥫ 砫 - mov ebx,[esi+2] - mov [eax+4],ebx ;ࠧ - add esi,6 ;室 - inc dword[level_stack] - add eax,8 - .end_f: - pop ecx - ret - -;室 ᫥饬 ⥪饣 ஢ -;input: -; eax - ६묨 -align 4 -block_next: -push ebx - add esi,dword[esi+2] ;ய᪠ - - ;஢ઠ ࠧ஢ த⥫᪮ , 室 孨 ஢ ᫨ - @@: - mov ebx,dword[eax-8] - add ebx,dword[eax-4] - cmp esi,ebx - jl @f - dec dword[level_stack] - sub eax,8 - cmp dword[level_stack],0 - jg @b - @@: -pop ebx - ret - -;㭪 ᪠ 뢠饩 -;input: -;esi - memory pointer -;output: -;dword[bl_found] - pointer to chunk struct (= 0 if not found) -align 4 -bl_found dd 0 -block_analiz: -pushad - mov dword[bl_found],0 - mov ecx,type_bloks - @@: - mov bx,word[ecx] - cmp word[esi],bx - je .found - add ecx,sizeof.block_3ds - cmp ecx,type_bloks.end - jl @b - jmp .no_found - .found: - mov dword[bl_found],ecx - .no_found: -popad - ret - -;input: -; esi - 㪠⥫ 㥬 -; icon - -; level - ஢ 㧫 -; size_bl - ࠧ -; info_bl - ப ᠭ -align 4 -proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword - pushad - mov bx,word[icon] - shl ebx,16 - mov bx,word[level] - - mov eax,esi - sub eax,dword[open_file_data] - mov dword[buffer],eax ;ᬥ饭 - mov ecx,dword[size_bl] - mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) - mov ecx,dword[bl_found] - or ecx,ecx - jz @f - ;... 㦥 㣮 㤠 - mov cl,byte[ecx+4] - @@: - mov byte[buffer+list_offs_chunk_del],cl - mov ecx,[level] - mov byte[buffer+list_offs_chunk_lev],cl - mov ecx,dword[info_bl] - mov dword[buffer+list_offs_p_data],ecx - stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 - stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ; 3ds - or ecx,ecx - jnz @f - mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ ப - jmp .no_capt - @@: - mov byte[buffer+list_offs_text+4],' ' - mov esi,ecx - mov edi,buffer+list_offs_text+5 - mov ecx,size_one_list-(list_offs_text+5) - cld - rep movsb - mov byte[buffer+size_one_list-1],0 ;0 - ᨬ ப - .no_capt: - mov ecx,(sizeof.obj_3d)/4 - xor eax,eax - mov edi,buffer+list_offs_obj3d - rep stosd - stdcall [tl_node_add], tree1, ebx, buffer - stdcall [tl_cur_next], tree1 - popad - ret -endp - -;input: -; eax - value -; buf - string buffer -; len - buffer len -;output: -align 4 -proc convert_int_to_str, buf:dword, len:dword -pushad - mov edi,[buf] - mov esi,[len] - add esi,edi - dec esi - call .str -popad - ret -endp - -align 4 -.str: - mov ecx,10 - cmp eax,ecx - jb @f - xor edx,edx - div ecx - push edx - call .str - pop eax - @@: - cmp edi,esi - jge @f - or al,0x30 - stosb - mov byte[edi],0 - @@: - ret - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter.1 -.1: -db '3DS',0 -db 'STL',0 -.3: -db 'PNG',0 -.end: -db 0 - - -align 4 -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'box_lib.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'buf2d.obj',0 -system_dir_4 db '/sys/lib/' -lib_name_4 db 'kmenu.obj',0 -system_dir_5 db '/sys/lib/' -lib_name_5 db 'tinygl.obj',0 -system_dir_6 db '/sys/lib/' -lib_name_6 db 'libini.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d - lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu - lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl - lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw - - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start - OpenDialog_Set_file_name dd aOpenDialog_Set_file_name - OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 - aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 - -align 4 -import_buf2d: - dd sz_init0 - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_resize dd sz_buf2d_resize - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_set_pixel dd sz_buf2d_set_pixel - dd 0,0 - sz_init0 db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_resize db 'buf2d_resize',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - -align 4 -import_box_lib: - dd sz_init1 - edit_box_draw dd sz_edit_box_draw - edit_box_key dd sz_edit_box_key - edit_box_mouse dd sz_edit_box_mouse - edit_box_set_text dd sz_edit_box_set_text - scrollbar_ver_draw dd sz_scrollbar_ver_draw - scrollbar_hor_draw dd sz_scrollbar_hor_draw - - tl_data_init dd sz_tl_data_init - tl_data_clear dd sz_tl_data_clear - tl_info_clear dd sz_tl_info_clear - tl_key dd sz_tl_key - tl_mouse dd sz_tl_mouse - tl_draw dd sz_tl_draw - tl_info_undo dd sz_tl_info_undo - tl_info_redo dd sz_tl_info_redo - tl_node_add dd sz_tl_node_add - tl_node_set_data dd sz_tl_node_set_data - tl_node_get_data dd sz_tl_node_get_data - tl_node_delete dd sz_tl_node_delete - tl_node_move_up dd sz_tl_node_move_up - tl_node_move_down dd sz_tl_node_move_down - tl_cur_beg dd sz_tl_cur_beg - tl_cur_next dd sz_tl_cur_next - tl_cur_perv dd sz_tl_cur_perv - tl_node_close_open dd sz_tl_node_close_open - tl_node_lev_inc dd sz_tl_node_lev_inc - tl_node_lev_dec dd sz_tl_node_lev_dec - tl_node_poi_get_info dd sz_tl_node_poi_get_info - tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info - tl_node_poi_get_data dd sz_tl_node_poi_get_data - - dd 0,0 - sz_init1 db 'lib_init',0 - sz_edit_box_draw db 'edit_box_draw',0 - sz_edit_box_key db 'edit_box_key',0 - sz_edit_box_mouse db 'edit_box_mouse',0 - sz_edit_box_set_text db 'edit_box_set_text',0 - sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 - sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 - - sz_tl_data_init db 'tl_data_init',0 - sz_tl_data_clear db 'tl_data_clear',0 - sz_tl_info_clear db 'tl_info_clear',0 - sz_tl_key db 'tl_key',0 - sz_tl_mouse db 'tl_mouse',0 - sz_tl_draw db 'tl_draw',0 - sz_tl_info_undo db 'tl_info_undo',0 - sz_tl_info_redo db 'tl_info_redo',0 - sz_tl_node_add db 'tl_node_add',0 - sz_tl_node_set_data db 'tl_node_set_data',0 - sz_tl_node_get_data db 'tl_node_get_data',0 - sz_tl_node_delete db 'tl_node_delete',0 - sz_tl_node_move_up db 'tl_node_move_up',0 - sz_tl_node_move_down db 'tl_node_move_down',0 - sz_tl_cur_beg db 'tl_cur_beg',0 - sz_tl_cur_next db 'tl_cur_next',0 - sz_tl_cur_perv db 'tl_cur_perv',0 - sz_tl_node_close_open db 'tl_node_close_open',0 - sz_tl_node_lev_inc db 'tl_node_lev_inc',0 - sz_tl_node_lev_dec db 'tl_node_lev_dec',0 - sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 - sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 - sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 - -align 4 -import_libkmenu: - kmenu_init dd akmenu_init - kmainmenu_draw dd akmainmenu_draw - kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent - ksubmenu_new dd aksubmenu_new - ksubmenu_delete dd aksubmenu_delete - ksubmenu_draw dd aksubmenu_draw - ksubmenu_add dd aksubmenu_add - kmenuitem_new dd akmenuitem_new - kmenuitem_delete dd akmenuitem_delete - kmenuitem_draw dd akmenuitem_draw -dd 0,0 - akmenu_init db 'kmenu_init',0 - akmainmenu_draw db 'kmainmenu_draw',0 - akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 - aksubmenu_new db 'ksubmenu_new',0 - aksubmenu_delete db 'ksubmenu_delete',0 - aksubmenu_draw db 'ksubmenu_draw',0 - aksubmenu_add db 'ksubmenu_add',0 - akmenuitem_new db 'kmenuitem_new',0 - akmenuitem_delete db 'kmenuitem_delete',0 - akmenuitem_draw db 'kmenuitem_draw',0 - -align 4 -import_lib_tinygl: -macro E_LIB n -{ - n dd sz_#n -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../develop/libraries/TinyGL/asm_fork/export.inc' - -align 4 -import_libini: - dd alib_init0 - ini_get_str dd aini_get_str - ini_get_int dd aini_get_int - ini_get_color dd aini_get_color -dd 0,0 - alib_init0 db 'lib_init',0 - aini_get_str db 'ini_get_str',0 - aini_get_int db 'ini_get_int',0 - aini_get_color db 'ini_get_color',0 - -align 4 -mouse_dd dd 0 -last_time dd 0 -angle_dxm dd 1.9111 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 -angle_dym dd 1.7333 ;~ 3d_wnd_h/180 -ratio dd 1.1025 ;~ 3d_wnd_w/3d_wnd_h - -align 4 -buf_ogl: - dd 0 ;㪠⥫ ࠦ - dw 3d_wnd_l,3d_wnd_t ;+4 left,top -.w: dd 3d_wnd_w -.h: dd 3d_wnd_h -.color: dd 0xffffd0 - dd 24 ;+16 color,bit in pixel - -align 4 -buf_1: - dd 0 ;㪠⥫ ࠦ - dw 0,0 ;+4 left,top - dd 128,144 ;+8 w,h - dd 0,24 ;+16 color,bit in pixel - -align 4 -el_focus dd tree1 -tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\ - w_scr_t1,0 - -align 4 -w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 - -align 4 -qObj dd 0 - -light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] - ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) -light_dir dd 0.0,0.0,0.0 ;ࠢ - -mat_specular dd 0.3, 0.3, 0.3, 1.0 ; -mat_shininess dd 3.0 ; (⭠ ய) -white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 -lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 - -if lang eq ru_RU -capt db 'info 3ds [user] 29.09.20',0 ; -else -capt db 'info 3ds [user] version 29.09.20',0 ;window caption -end if - -align 16 -i_end: - ctx1 rb 28 ;sizeof.TinyGLContext = 28 - procinfo process_information - run_file_70 FileInfoBlock - sc system_colors - angle_x rd 1 ;㣫 業 - angle_y rd 1 - angle_z rd 1 - color_ox rd 1 - color_oy rd 1 - color_oz rd 1 - color_bk rd 3 - color_vert rd 1 - color_face rd 1 - color_select rd 1 -align 16 - rb 4096 -stacktop: - sys_path rb 2048 - file_name rb 4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, file_name, sys_path + +version_edit equ 0 + +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../load_img.inc' +include '../../load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'info_fun_float.inc' +include 'info_menu.inc' +include 'data.inc' +include 'convert_stl_3ds.inc' + +3d_wnd_l equ 205 ; tinygl ᫥ +3d_wnd_t equ 47 ; tinygl ᢥ +3d_wnd_w equ 344 +3d_wnd_h equ 312 + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + +ID_ICON_CHUNK_MAIN equ 0 ; +ID_ICON_CHUNK_NOT_FOUND equ 1 ; ⭮ +ID_ICON_DATA equ 2 ; , । +ID_ICON_POINT equ 8 +ID_ICON_POINT_SEL equ 9 + +FILE_ERROR_CHUNK_SIZE equ -3 ;訡 ࠧ + +size_one_list equ 42+sizeof.obj_3d +list_offs_chunk_del equ 8 ; 㤠 +list_offs_chunk_lev equ 9 ;஢ (யᠭ 㧫) +list_offs_p_data equ 10 ;㪠⥫ +list_offs_obj3d equ 14 ;㪠⥫ 3d ꥪ +list_offs_text equ 14+sizeof.obj_3d ;ᤢ 砫 ⥪ +include 'info_o3d.inc' + +align 4 +fl255 dd 255.0 +open_file_data dd 0 ;㪠⥫ 䠩 3ds +open_file_size dd 0 ;ࠧ ⮣ 䠩 + +; +main_wnd_height equ 460 ; ணࠬ +fn_toolbar db 'toolbar.png',0 +IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 +image_data_toolbar dd 0 +; +icon_tl_sys dd 0 ;㪠⥫ ࠭ ⥬ +icon_toolbar dd 0 ;㪠⥫ ࠭ ꥪ⮢ + +;-------------------------------------- +level_stack dd 0 +offs_last_timer dd 0 ;᫥ ᤢ 㭪樨 ⠩ + +align 4 +file_3ds: ;६ ᯮ㥬 ⨨ 䠩 +.offs: dd 0 ;+0 㪠⥫ 砫 +.size: dd 0 ;+4 ࠧ ( 1- ࠬ = ࠧ 䠩 3ds) +rb 8*MAX_FILE_LEVEL + +buffer rb size_one_list ; ᯨ᮪ tree1 + +txt_3ds_symb db 0,0 +;-------------------------------------- + + + +align 4 +start: + ;--- copy cmd line --- + mov esi,file_name + mov edi,openfile_path +@@: + lodsd + or eax,eax + jz @f ;室, ᫨ 0 + stosd + jmp @b +@@: + stosd + + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + .test_lib_open: + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS ;exit not correct + @@: + add ebp,ll_struc_size + cmp ebp,l_libs_end + jl .test_lib_open + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + ;kmenu initialisation + stdcall [kmenu_init],sc + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Mat, 8 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 10 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 11 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] + stdcall [ksubmenu_add], [main_menu], eax + + mov dword[w_scr_t1.type],1 + stdcall [tl_data_init], tree1 + ;⥬ 16*16 tree_list + include_image_file 'tl_sys_16.png', icon_tl_sys + ;᫨ ࠦ 뫮, icon_tl_sys + ; 樠஢ , 訡 㤥, . . 㦭 ࠧ + mov eax,dword[icon_tl_sys] + mov dword[tree1.data_img_sys],eax + + load_image_file 'objects.png', icon_toolbar + mov eax,dword[icon_toolbar] + mov dword[tree1.data_img],eax + + load_image_file 'font8x9.bmp', image_data_toolbar + stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ + stdcall mem.Free,[image_data_toolbar] ;᢮ + stdcall [buf2d_conv_24_to_8], buf_1,1 ; ஧筮 8 + stdcall [buf2d_convert_text_matrix], buf_1 + + load_image_file fn_toolbar, image_data_toolbar + + ;ࠡ 䠩 ஥ + copy_path ini_name,sys_path,file_name,0 + mov dword[def_dr_mode],0 + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_vertexes + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_fill + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dfm,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_mat + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_light + @@: + stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: + stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff + mov [color_ox],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 + mov [color_oy],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00 + mov [color_oz],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000 + mov [color_bk],eax + shr eax,8 + mov [color_bk+4],eax + shr eax,8 + mov [color_bk+8],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff + mov [color_vert],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080 + mov [color_face],eax + stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00 + mov [color_select],eax + finit + fild dword[color_bk+8] + fdiv dword[fl255] + fstp dword[color_bk+8] + mov eax,[color_bk+4] + and eax,0xff + mov [color_bk+4],eax + fild dword[color_bk+4] + fdiv dword[fl255] + fstp dword[color_bk+4] + mov eax,[color_bk] + and eax,0xff + mov [color_bk],eax + fild dword[color_bk] + fdiv dword[fl255] + fstp dword[color_bk] + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0 + stdcall [glShadeModel], GL_SMOOTH + call [gluNewQuadric] + mov [qObj],eax + + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov dword[buf_ogl],eax + + ;open file from cmd line + cmp dword[openfile_path],0 + je @f + call but_open_file.no_dlg + @@: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + or eax,eax + jz timer_funct + + cmp al,1 + jne @f + call draw_window + jmp still + @@: + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo+4] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + push eax ebx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,0 + jnc .end_m + ;mouse l. but. move + cmp dword[mouse_drag],1 + jne .end_m + + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_d + mov ebx,[eax] + add ebx,dword[open_file_data] ;砥 祭 ᤢ + cmp word[ebx],CHUNK_OBJBLOCK + jne .end_d + + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + sar ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jg @f + mov ebx,3d_wnd_l + @@: + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jle @f + mov ebx,3d_wnd_w + @@: + movsx eax,ax ;mouse.y + cmp eax,3d_wnd_t + jg @f + mov eax,3d_wnd_t + @@: + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jle @f + mov eax,3d_wnd_h + @@: + finit + fild dword[mouse_y] + mov [mouse_y],eax + fisub dword[mouse_y] + fdiv dword[angle_dxm] ;᫨ y ( ) x + fadd dword[angle_x] + fstp dword[angle_x] + + fild dword[mouse_x] + mov [mouse_x],ebx + fisub dword[mouse_x] + fdiv dword[angle_dym] ;᫨ x ( ) y + fadd dword[angle_y] + fstp dword[angle_y] + + stdcall [tl_node_get_data],tree1 + ;cmp eax,0 - , 뫮 ᤥ + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end_d + .end_m: + bt eax,16 + jnc @f + ;mouse l. but. up + mov dword[mouse_drag],0 + jmp .end_d + @@: + bt eax,8 + jnc .end_d + ;mouse l. but. press + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + sar ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jl .end_d + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jg .end_d + movsx eax,ax ;mouse.y + cmp eax,3d_wnd_t + jl .end_d + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jg .end_d + mov dword[mouse_drag],1 + mov dword[mouse_x],ebx + mov dword[mouse_y],eax + .end_d: + + stdcall [tl_mouse], tree1 + stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + pop ebx eax + ret + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;ᬠਢ 뤥 + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end_f + lea edi,[eax+list_offs_obj3d] + mov ebx,eax + mov eax,[ebx] + mov ecx,[ebx+4] ;ࠧ + stdcall hex_in_str, txt_3ds_offs.dig, eax,8 + stdcall hex_in_str, txt_3ds_offs.siz, ecx,8 + + add eax,[open_file_data] ;砥 祭 ᤢ + cmp [offs_last_timer],eax + je .end_f + ;᫨ 뤥 ᮢ ᫥ + mov [offs_last_timer],eax + + cmp word[eax],CHUNK_OBJBLOCK + jne .end_oblo + cmp dword[edi+obj_3d.poi_count],2 + jl .ini_oblo + stdcall draw_3d,edi + jmp .end_f + .ini_oblo: + stdcall obj_init,edi ;⪠ ந ६ ꥪ + cmp dword[edi+obj_3d.poi_count],2 + jl .end_f + call mnu_reset_settings ; 㣫 ० ᮢ + jmp .end_f + .end_oblo: + + cmp word[eax],CHUNK_MATERIAL + jne .end_mblo + cmp dword[edi+material.name],0 + je .ini_mblo + stdcall draw_material,edi + jmp .end_f + .ini_mblo: + stdcall mat_init,edi,eax ;⪠ ந ਠ + cmp dword[edi+material.name],0 + je .end_f + stdcall draw_material,edi + jmp .end_f + .end_mblo: + + stdcall buf_draw_beg, buf_ogl + stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000 + mov edx,[ebx+list_offs_p_data] + or edx,edx ;ᬮਬ ᠭ + jz .no_info + stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000 + .no_info: + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + .end_f: + popad + jmp still + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + mov edx,[sc.work] + or edx,0x33000000 + mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,250 + jge @f + mov eax,250 + @@: + sub eax,30 + sub eax,[tree1.box_top] + mov [tree1.box_height],eax + mov word[w_scr_t1.y_size],ax ; ࠧ ஫ + + stdcall [kmainmenu_draw], [main_menu] + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(24 shl 16)+20,0x40000003 + mcall ,(30 shl 16)+20,,0x40000004 ;open + mcall ,(3d_wnd_l shl 16)+20,,0x40000005 ;設 . + mcall ,((3d_wnd_l+25) shl 16)+20,,0x40000006 ;ઠ ࠭ . + mcall ,((3d_wnd_l+50) shl 16)+20,,0x40000007 ; ࠭ . + mcall ,((3d_wnd_l+75) shl 16)+20,,0x40000008 ;࠭ ਠ . + mcall ,((3d_wnd_l+100) shl 16)+20,,0x40000009 ;ᢥ ./몫. + mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;ᣫ + mcall ,((3d_wnd_l+150) shl 16)+20,,0x4000000b ; + mcall ,((3d_wnd_l+175) shl 16)+20,,0x4000000c ;ਭ 3d + + mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+24 ;new + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,(30 shl 16)+24 ;open + add ebx,IMAGE_TOOLBAR_ICON_SIZE*6 + mcall ,,,((3d_wnd_l) shl 16)+24 ;設 . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+25) shl 16)+24 ;ઠ ࠭ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+50) shl 16)+24 ; ࠭ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+100) shl 16)+24 ;ᢥ ./몫. + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+150) shl 16)+24 ; + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+75) shl 16)+24 ;࠭ ਠ . + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+125) shl 16)+24 ;ᣫ + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+175) shl 16)+24 ;ਭ 3d + + mov dword[w_scr_t1.all_redraw],1 + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_ogl + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +key: + mcall SF_GET_KEY + + cmp dword[el_focus], tree1 + jne @f + stdcall [tl_key], tree1 + jmp .end + @@: + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + jmp .end + @@: + cmp ah,179 ;Right + jne @f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + stdcall [tl_node_get_data],tree1 + or eax,eax + jz .end + add eax,list_offs_obj3d + stdcall draw_3d, eax + ;jmp .end + @@: + + .end: + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + + ;menu functions + cmp ah,5 + jne @f + call mnu_vertexes_on + jmp still + @@: + cmp ah,6 + jne @f + call mnu_edges_on + jmp still + @@: + cmp ah,7 + jne @f + call mnu_faces_on + jmp still + @@: + cmp ah,8 + jne @f + call mnu_faces_mat + jmp still + @@: + cmp ah,9 + jne @f + call mnu_light_on_off + jmp still + @@: + cmp ah,10 + jne @f + call mnu_smooth_on_off + jmp still + @@: + cmp ah,11 + jne @f + call mnu_reset_settings + jmp still + @@: + cmp ah,12 + jne @f + call mnu_make_scrshot + jmp still + @@: + + cmp ah,1 + jne still +.exit: + mov dword[tree1.data_img],0 + mov dword[tree1.data_img_sys],0 + stdcall [tl_data_clear], tree1 + stdcall [buf2d_delete],buf_1 ;㤠塞 + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_data] + stdcall [gluDeleteQuadric], [qObj] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: +push eax ebx + stdcall [tl_node_poi_get_info], tree1,0 + @@: + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + add eax,list_offs_obj3d + stdcall obj_clear_param, eax + stdcall [tl_node_poi_get_next_info], tree1,ebx + or eax,eax + jnz @b + @@: +pop ebx eax + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + stdcall [buf2d_clear], buf_ogl, [buf_ogl.color] ;⨬ + stdcall [tl_draw], tree1 + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + ret + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ; 㤠筮 ⨨ + jmp .end0 +.no_dlg: ;᫨ 㥬 䠩 + pushad + mov esi,openfile_path + stdcall str_len,esi + add esi,eax + @@: ;横 ᪠ 砫 䠩 + dec esi + cmp byte[esi],'/' + je @f + cmp byte[esi],0x5c ;'\' + je @f + cmp esi,openfile_path + jg @b + @@: + inc esi + stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ + .end0: + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], ecx + m2m dword[run_file_70.Buffer], dword[open_file_data] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 ;㦠 䠩 3ds + cmp ebx,0xffffffff + je .end_open_file + mov [open_file_size],ebx + ;mcall SF_SET_CAPTION,1,openfile_path + + call init_tree + stdcall [buf2d_draw], buf_ogl ;塞 ࠭ + .end_open_file: + popad + ret + +align 4 +init_tree: + ;⨬ ꥪ⠬ + stdcall [tl_node_poi_get_info], tree1,0 + @@: + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + or eax,eax + jz @f + add eax,list_offs_obj3d + stdcall obj_clear_param, eax + stdcall [tl_node_poi_get_next_info], tree1,ebx + or eax,eax + jnz @b + @@: + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + + mov esi,[open_file_data] + stdcall convert_stl_3ds, esi,[open_file_size] ;஢塞 䠩 ଠ *.stl ? + or eax,eax + jz @f + ;᫨ 䠩 ଠ *.stl + mov [open_file_size],ecx + mov esi,eax + stdcall mem.Free,[open_file_data] + mov [open_file_data],esi + mov byte[can_save],1 + @@: + cmp word[esi],CHUNK_MAIN + je @f + mov eax,[esi] + bswap eax + stdcall hex_in_str, txt_no_3ds.zag, eax,8 + stdcall buf_draw_beg, buf_ogl + stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,5,25,0xff0000 ;㥬 ப ⥪⮬ + jmp .end_open + @@: + ;--- ࠡ⪠ ⮣ *.3ds 䠩 + mov eax,file_3ds + mov dword[level_stack],0 ;塞 ஢ ⥪ + mov dword[offs_last_timer],0 + ;--- ᯨ᮪ + stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 + call block_children ;室 ୨ + + mov edi,[file_3ds.offs] + add edi,[file_3ds.size] + .cycle_main: + cmp dword[level_stack],0 + jle .end_cycle + + cmp esi,edi ;᫨ 䠩 + jge .end_cycle + + mov edx,[esi+2] ;ࠧ + call block_analiz + cmp word[esi],CHUNK_MATERIAL + je @f + cmp word[esi],CHUNK_OBJMESH + je @f + cmp word[esi],CHUNK_OBJBLOCK + je @f + mov dword[bl_found],0 + @@: + cmp dword[bl_found],0 + jne @f + ;ꥪ ⭮ + call block_next + jmp .cycle_main + @@: + ;ꥪ ⭮ + mov ecx,dword[bl_found] + mov bx,word[ecx+2] ; ꥪ + cmp word[esi],CHUNK_OBJBLOCK + jne .pod1 + add esi,6 + push esi + sub esi,6 + jmp .pod3 + .pod1: + cmp word[esi],CHUNK_MATERIAL + jne .pod2 + cmp word[esi+6],CHUNK_MATNAME + jne .pod2 + add esi,12 + push esi + sub esi,12 + jmp .pod3 + .pod2: + push dword[ecx+5] ;⠭⭮ + .pod3: + stdcall add_3ds_object, ebx,dword[level_stack],edx + cmp byte[ecx+4],1 + je .bl_data + ; ᮤন ୨ + call block_children ;室 ୨ + jmp .cycle_main + .bl_data: + ; ᮤন + call block_analiz_data + jmp .cycle_main + .end_cycle: + stdcall [tl_cur_beg], tree1 + stdcall [tl_draw], tree1 + .end_open: + ret + +; +;input: +; eax - stack pointer +; esi - memory pointer +;output: +; eax - new stack pointer +; esi - new memory pointer +align 4 +proc block_analiz_data uses ebx ecx edx edi + mov dx,[esi] + mov ecx,[esi+2] + sub ecx,6 ;ࠧ + add esi,6 + mov ebx,dword[level_stack] + inc ebx + ; *** ࠧ묨 묨 뤥 + cmp dx,CHUNK_OBJBLOCK ;ꥪ + jne @f + push ax + cld + xor al,al + mov edi,esi + repne scasb + pop ax + sub edi,esi ;edi - strlen + add esi,edi + ;sub ecx,edi ;㦥 ᤥ repne + jmp .next_bl + @@: + cmp dx,CHUNK_VERTLIST ;ᯨ᮪ 設 + je .vertexes + cmp dx,0x4111 ;䫠 設 + je .vertexes + cmp dx,CHUNK_MAPLIST ;⥪ न + je .vertexes + jmp @f + .vertexes: ;ࠡ⪠ , ᮤঠ 設 + add esi,2 + sub ecx,2 + sub esi,8 ;⠭ esi + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACELIST ;ᯨ᮪ ࠭ + jne @f + push eax + movzx eax,word[esi] + shl eax,3 + add esi,2 + sub ecx,2 + + sub ecx,eax + cmp ecx,1 + jl .data_3 ;஢塞 뢠騩 ਠ, ਬ塞 ꥪ +if 1 + add esi,eax + mov ecx,dword[esi+2] + stdcall add_3ds_object, 10,ebx,ecx,0 ; ਠ + sub esi,eax +else + add esi,eax + pop eax + jmp .next_bl +end if + .data_3: + + sub esi,8 ;⠭ esi + pop eax + call block_next + jmp .end_f + @@: + cmp dx,CHUNK_FACEMAT ;ਠ ࠭ + jne @f + push ax + cld + xor al,al + mov edi,esi + repne scasb + pop ax + sub edi,esi ;edi - strlen + stdcall add_3ds_object, ID_ICON_DATA,ebx,edi,0 ; ꥪ + add esi,edi + add esi,2 + sub ecx,2 + sub esi,edi ;⠭ esi (1) + sub esi,8 ;⠭ esi (2) + call block_next + jmp .end_f + @@: + ; *** 묨 㬮砭 ( 뤥 ) + sub esi,6 ;⠭ esi + call block_next + jmp .end_f + .next_bl: + ; *** ன ⠢ + mov dword[eax],esi ;㪠⥫ 砫 + mov ebx,dword[esi+2] + mov dword[eax+4],ebx ;ࠧ + inc dword[level_stack] + add eax,8 + .end_f: + ret +endp + +;室 1- ୨ +;input: +; eax - 㪠⥫ ६ ⥪ 䠩 file_3ds +; esi - 砫 த⥫᪮ +;output: +; ebx - destroy +; esi - 砫 த⥫᪮ +align 4 +block_children: + push ecx + ;஢ઠ ࠢ쭮 ࠧ஢ ୥ + lea ebx,[esi+6] ;室 砫 ୥ + add ebx,[ebx+2] ;塞 ࠧ ୥ + mov ecx,esi + add ecx,[esi+2] ;塞 ࠧ த⥫᪮ + cmp ebx,ecx ;뢠 㦭, . . ࠢ ⮫쪮 + jle @f + ;஢ 訡 䠩, ୨ 室 । த⥫᪮ + mov dword[level_stack],FILE_ERROR_CHUNK_SIZE + jmp .end_f + @@: + mov [eax],esi ;㪠⥫ 砫 + mov ebx,[esi+2] + mov [eax+4],ebx ;ࠧ + add esi,6 ;室 + inc dword[level_stack] + add eax,8 + .end_f: + pop ecx + ret + +;室 ᫥饬 ⥪饣 ஢ +;input: +; eax - ६묨 +align 4 +block_next: +push ebx + add esi,dword[esi+2] ;ய᪠ + + ;஢ઠ ࠧ஢ த⥫᪮ , 室 孨 ஢ ᫨ + @@: + mov ebx,dword[eax-8] + add ebx,dword[eax-4] + cmp esi,ebx + jl @f + dec dword[level_stack] + sub eax,8 + cmp dword[level_stack],0 + jg @b + @@: +pop ebx + ret + +;㭪 ᪠ 뢠饩 +;input: +;esi - memory pointer +;output: +;dword[bl_found] - pointer to chunk struct (= 0 if not found) +align 4 +bl_found dd 0 +block_analiz: +pushad + mov dword[bl_found],0 + mov ecx,type_bloks + @@: + mov bx,word[ecx] + cmp word[esi],bx + je .found + add ecx,sizeof.block_3ds + cmp ecx,type_bloks.end + jl @b + jmp .no_found + .found: + mov dword[bl_found],ecx + .no_found: +popad + ret + +;input: +; esi - 㪠⥫ 㥬 +; icon - +; level - ஢ 㧫 +; size_bl - ࠧ +; info_bl - ப ᠭ +align 4 +proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword + pushad + mov bx,word[icon] + shl ebx,16 + mov bx,word[level] + + mov eax,esi + sub eax,dword[open_file_data] + mov dword[buffer],eax ;ᬥ饭 + mov ecx,dword[size_bl] + mov dword[buffer+4],ecx ;ࠧ (ᯮ 㭪樨 buf_draw_hex_table ᮢ ) + mov ecx,dword[bl_found] + or ecx,ecx + jz @f + ;... 㦥 㣮 㤠 + mov cl,byte[ecx+4] + @@: + mov byte[buffer+list_offs_chunk_del],cl + mov ecx,[level] + mov byte[buffer+list_offs_chunk_lev],cl + mov ecx,dword[info_bl] + mov dword[buffer+list_offs_p_data],ecx + stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 + stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ; 3ds + or ecx,ecx + jnz @f + mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ ப + jmp .no_capt + @@: + mov byte[buffer+list_offs_text+4],' ' + mov esi,ecx + mov edi,buffer+list_offs_text+5 + mov ecx,size_one_list-(list_offs_text+5) + cld + rep movsb + mov byte[buffer+size_one_list-1],0 ;0 - ᨬ ப + .no_capt: + mov ecx,(sizeof.obj_3d)/4 + xor eax,eax + mov edi,buffer+list_offs_obj3d + rep stosd + stdcall [tl_node_add], tree1, ebx, buffer + stdcall [tl_cur_next], tree1 + popad + ret +endp + +;input: +; eax - value +; buf - string buffer +; len - buffer len +;output: +align 4 +proc convert_int_to_str, buf:dword, len:dword +pushad + mov edi,[buf] + mov esi,[len] + add esi,edi + dec esi + call .str +popad + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 + @@: + ret + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +db '3DS',0 +db 'STL',0 +.3: +db 'PNG',0 +.end: +db 0 + + +align 4 +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'box_lib.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'buf2d.obj',0 +system_dir_4 db '/sys/lib/' +lib_name_4 db 'kmenu.obj',0 +system_dir_5 db '/sys/lib/' +lib_name_5 db 'tinygl.obj',0 +system_dir_6 db '/sys/lib/' +lib_name_6 db 'libini.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d + lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu + lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl + lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start + OpenDialog_Set_file_name dd aOpenDialog_Set_file_name + OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 + aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 + +align 4 +import_buf2d: + dd sz_init0 + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_set_pixel dd sz_buf2d_set_pixel + dd 0,0 + sz_init0 db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + +align 4 +import_box_lib: + dd sz_init1 + edit_box_draw dd sz_edit_box_draw + edit_box_key dd sz_edit_box_key + edit_box_mouse dd sz_edit_box_mouse + edit_box_set_text dd sz_edit_box_set_text + scrollbar_ver_draw dd sz_scrollbar_ver_draw + scrollbar_hor_draw dd sz_scrollbar_hor_draw + + tl_data_init dd sz_tl_data_init + tl_data_clear dd sz_tl_data_clear + tl_info_clear dd sz_tl_info_clear + tl_key dd sz_tl_key + tl_mouse dd sz_tl_mouse + tl_draw dd sz_tl_draw + tl_info_undo dd sz_tl_info_undo + tl_info_redo dd sz_tl_info_redo + tl_node_add dd sz_tl_node_add + tl_node_set_data dd sz_tl_node_set_data + tl_node_get_data dd sz_tl_node_get_data + tl_node_delete dd sz_tl_node_delete + tl_node_move_up dd sz_tl_node_move_up + tl_node_move_down dd sz_tl_node_move_down + tl_cur_beg dd sz_tl_cur_beg + tl_cur_next dd sz_tl_cur_next + tl_cur_perv dd sz_tl_cur_perv + tl_node_close_open dd sz_tl_node_close_open + tl_node_lev_inc dd sz_tl_node_lev_inc + tl_node_lev_dec dd sz_tl_node_lev_dec + tl_node_poi_get_info dd sz_tl_node_poi_get_info + tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info + tl_node_poi_get_data dd sz_tl_node_poi_get_data + + dd 0,0 + sz_init1 db 'lib_init',0 + sz_edit_box_draw db 'edit_box_draw',0 + sz_edit_box_key db 'edit_box_key',0 + sz_edit_box_mouse db 'edit_box_mouse',0 + sz_edit_box_set_text db 'edit_box_set_text',0 + sz_scrollbar_ver_draw db 'scrollbar_v_draw',0 + sz_scrollbar_hor_draw db 'scrollbar_h_draw',0 + + sz_tl_data_init db 'tl_data_init',0 + sz_tl_data_clear db 'tl_data_clear',0 + sz_tl_info_clear db 'tl_info_clear',0 + sz_tl_key db 'tl_key',0 + sz_tl_mouse db 'tl_mouse',0 + sz_tl_draw db 'tl_draw',0 + sz_tl_info_undo db 'tl_info_undo',0 + sz_tl_info_redo db 'tl_info_redo',0 + sz_tl_node_add db 'tl_node_add',0 + sz_tl_node_set_data db 'tl_node_set_data',0 + sz_tl_node_get_data db 'tl_node_get_data',0 + sz_tl_node_delete db 'tl_node_delete',0 + sz_tl_node_move_up db 'tl_node_move_up',0 + sz_tl_node_move_down db 'tl_node_move_down',0 + sz_tl_cur_beg db 'tl_cur_beg',0 + sz_tl_cur_next db 'tl_cur_next',0 + sz_tl_cur_perv db 'tl_cur_perv',0 + sz_tl_node_close_open db 'tl_node_close_open',0 + sz_tl_node_lev_inc db 'tl_node_lev_inc',0 + sz_tl_node_lev_dec db 'tl_node_lev_dec',0 + sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 + sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 + sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_lib_tinygl: +macro E_LIB n +{ + n dd sz_#n +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + +align 4 +import_libini: + dd alib_init0 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init0 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +align 4 +mouse_dd dd 0 +last_time dd 0 +angle_dxm dd 1.9111 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 +angle_dym dd 1.7333 ;~ 3d_wnd_h/180 +ratio dd 1.1025 ;~ 3d_wnd_w/3d_wnd_h + +align 4 +buf_ogl: + dd 0 ;㪠⥫ ࠦ + dw 3d_wnd_l,3d_wnd_t ;+4 left,top +.w: dd 3d_wnd_w +.h: dd 3d_wnd_h +.color: dd 0xffffd0 + dd 24 ;+16 color,bit in pixel + +align 4 +buf_1: + dd 0 ;㪠⥫ ࠦ + dw 0,0 ;+4 left,top + dd 128,144 ;+8 w,h + dd 0,24 ;+16 color,bit in pixel + +align 4 +el_focus dd tree1 +tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\ + w_scr_t1,0 + +align 4 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +align 4 +qObj dd 0 + +light_position dd 0.0, 0.0, -2.0, 1.0 ; ᯮ 筨 [0][1][2] + ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) +light_dir dd 0.0,0.0,0.0 ;ࠢ + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; +mat_shininess dd 3.0 ; (⭠ ய) +white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 + +if lang eq ru_RU +capt db 'info 3ds [user] 29.09.20',0 ; +else ; Default to en_US +capt db 'info 3ds [user] version 29.09.20',0 ; Window caption +end if + +align 16 +i_end: + ctx1 rb 28 ;sizeof.TinyGLContext = 28 + procinfo process_information + run_file_70 FileInfoBlock + sc system_colors + angle_x rd 1 ;㣫 業 + angle_y rd 1 + angle_z rd 1 + color_ox rd 1 + color_oy rd 1 + color_oz rd 1 + color_bk rd 3 + color_vert rd 1 + color_face rd 1 + color_select rd 1 +align 16 + rb 4096 +stacktop: + sys_path rb 2048 + file_name rb 4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/develop/info3ds/info_menu.inc b/programs/develop/info3ds/info_menu.inc index 64e76e302..e9dbbea95 100644 --- a/programs/develop/info3ds/info_menu.inc +++ b/programs/develop/info3ds/info_menu.inc @@ -1 +1,55 @@ - if lang eq ru_RU sz_main_menu_View db '', 0 sz_main_menu_Veiw_Vertexes db '設 .', 0 sz_main_menu_Veiw_Faces db 'ઠ ࠭ .', 0 sz_main_menu_Veiw_Faces_Fill db ' ࠭ .', 0 sz_main_menu_Veiw_Light db ' ./몫.', 0 sz_main_menu_Veiw_Smooth db ' ./몫.', 0 sz_main_menu_Veiw_Reset db ' ஥', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db '梥 ࠭ .', 0 else sz_main_menu_Vertexes db '設', 0 sz_main_menu_Vertexes_Select db '뤥 設', 0 sz_main_menu_Vertexes_Deselect db '⬥ 뤥', 0 sz_main_menu_Average_x db '। x',0 sz_main_menu_Average_y db '। y',0 sz_main_menu_Average_z db '। z',0 end if else sz_main_menu_View db 'View', 0 sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 sz_main_menu_Veiw_Faces db 'Edges on', 0 sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 sz_main_menu_Veiw_Smooth db 'Smooth on/off', 0 sz_main_menu_Veiw_Reset db 'Reset settings', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db 'Diferent color faces on', 0 else sz_main_menu_Vertexes db 'Vertexes', 0 sz_main_menu_Vertexes_Select db 'Select vertex', 0 sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 sz_main_menu_Average_x db 'Average x',0 sz_main_menu_Average_y db 'Average y',0 sz_main_menu_Average_z db 'Average z',0 end if end if main_menu dd 0 main_menu_file dd 0 main_menu_view dd 0 main_menu_vertexes dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 KMENUITEM_SEPARATOR equ 2 + +; Language support for locales: ru_RU (CP866), en_US. + +if lang eq ru_RU + +sz_main_menu_View db '', 0 +sz_main_menu_Veiw_Vertexes db '設 .', 0 +sz_main_menu_Veiw_Faces db 'ઠ ࠭ .', 0 +sz_main_menu_Veiw_Faces_Fill db ' ࠭ .', 0 +sz_main_menu_Veiw_Light db ' ./몫.', 0 +sz_main_menu_Veiw_Smooth db ' ./몫.', 0 +sz_main_menu_Veiw_Reset db ' ஥', 0 + +if version_edit eq 0 +sz_main_menu_Veiw_Faces_Mat db '梥 ࠭ .', 0 +else +sz_main_menu_Vertexes db '設', 0 +sz_main_menu_Vertexes_Select db '뤥 設', 0 +sz_main_menu_Vertexes_Deselect db '⬥ 뤥', 0 +sz_main_menu_Average_x db '। x',0 +sz_main_menu_Average_y db '। y',0 +sz_main_menu_Average_z db '। z',0 +end if + +else ; Default to en_US + +sz_main_menu_View db 'View', 0 +sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 +sz_main_menu_Veiw_Faces db 'Edges on', 0 +sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 +sz_main_menu_Veiw_Light db 'Light on/off', 0 +sz_main_menu_Veiw_Smooth db 'Smooth on/off', 0 +sz_main_menu_Veiw_Reset db 'Reset settings', 0 + +if version_edit eq 0 +sz_main_menu_Veiw_Faces_Mat db 'Diferent color faces on', 0 +else +sz_main_menu_Vertexes db 'Vertexes', 0 +sz_main_menu_Vertexes_Select db 'Select vertex', 0 +sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 +sz_main_menu_Average_x db 'Average x',0 +sz_main_menu_Average_y db 'Average y',0 +sz_main_menu_Average_z db 'Average z',0 +end if + +end if + +main_menu dd 0 +main_menu_file dd 0 +main_menu_view dd 0 +main_menu_vertexes dd 0 + +KMENUITEM_NORMAL equ 0 +KMENUITEM_SUBMENU equ 1 +KMENUITEM_SEPARATOR equ 2 diff --git a/programs/develop/info3ds/info_wnd_coords.inc b/programs/develop/info3ds/info_wnd_coords.inc index 1aec2c894..b4af7c850 100644 --- a/programs/develop/info3ds/info_wnd_coords.inc +++ b/programs/develop/info3ds/info_wnd_coords.inc @@ -1,827 +1,827 @@ -; -; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ -; ࠡ न⠬ 設 -; - -prop_wnd_width equ 340 ;ਭ ᢮⢠ ꥪ -prop_wnd_height equ 460 ; ᢮⢠ ꥪ -3d_wnd_l equ 5 ; tinygl ᫥ -3d_wnd_t equ 23 ; tinygl ᢥ -3d_wnd_w equ 320 -3d_wnd_h equ 240 -SIZE_ONE_FLOAT equ 14 -MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) - -prop_wnd_run db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ - -txt_q db '?',0 -txt_space: - db SIZE_ONE_FLOAT dup(' ') -.end: - db 0 - -obj_point: ;塞 ꥪ - dd 0 ;㪠⥫ -.text: - rb MAX_OBJECT_SIZE - -if lang eq ru_RU -txt_select_vert: db '࠭: ' -else -txt_select_vert: db 'Select: ' -end if -.count: -dq 0,0 - -; () 뢠 㭪樥 but_wnd_coords -align 4 -prop_start: -pushad - mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ - inc byte[prop_wnd_run] - mov dword[w_scr_t3.type],1 - mov edi,o3d - stdcall obj_clear_param, edi - call mnu_reset_settings - - stdcall [tl_node_get_data],tree1 - xor edx,edx - mov dword[capt_p],txt_q - cmp eax,0 - je .no_points - mov ebx,[eax] ;砥 祭 ᤢ ࠭ - add ebx,[open_file_data] - - cmp word[ebx],CHUNK_OBJBLOCK - jne .end_oblo - mov dword[capt_p],txt_4000 - stdcall obj_init,edi - jmp .no_points - .end_oblo: - cmp word[ebx],CHUNK_TRIMESH - jne .end_trim - mov dword[capt_p],txt_4100 - stdcall obj_init,edi - jmp .no_points - .end_trim: - cmp word[ebx],CHUNK_VERTLIST - jne .end_vlist - mov dword[capt_p],txt_4110 - stdcall obj_init,edi - jmp .no_points - .end_vlist: - cmp word[ebx],CHUNK_TRACKPIVOT - jne @f - inc edx - add ebx,6 - mov dword[capt_p],txt_b013 - jmp .set_points - @@: - cmp word[ebx],0xb014 - jne @f - mov edx,2 - add ebx,6 - mov dword[capt_p],txt_b014 - ;jmp .set_points - @@: - .set_points: - mov [edi+obj_3d.poi_data],ebx - mov [edi+obj_3d.poi_count],edx - .no_points: - - ;ன ᯨ᪠ ꥪ⮢ - mov ebx,[edi+obj_3d.poi_data] - mov dword[tree3.info_max_count],2 - mov edx,[edi+obj_3d.poi_count] - add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祪 (+2 砫 ᯨ᪠) - stdcall dword[tl_data_init], tree3 - mov eax,dword[icon_tl_sys] - mov dword[tree3.data_img_sys],eax - mov eax,dword[icon_toolbar] - mov dword[tree3.data_img],eax - - cmp edx,0 - je .no_object - mov word[NumberSymbolsAD],5 - finit - mov dword[w_scr_t3.redraw],0 - .new_point: - mov dword[obj_point],ebx - mov dword[obj_point.text],0 - cld - mov ecx,3 - @@: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop @b - stdcall dword[tl_node_add], tree3,(ID_ICON_POINT shl 16),obj_point - stdcall dword[tl_cur_next], tree3 - dec edx - cmp edx,0 - jg .new_point - mov dword[w_scr_t3.redraw],1 - stdcall dword[tl_cur_beg], tree3 - .no_object: - stdcall obj_set_sizes, o3d - stdcall obj_set_normals, o3d - edit_boxes_set_sys_color edit1,editboxes_end,sc ;⠭ ⥬ 梥⮢ - stdcall [edit_box_set_text], edit1, txt_q - stdcall [edit_box_set_text], edit2, txt_q - stdcall [edit_box_set_text], edit3, txt_q - mov eax,0xc0c0c0 - mov ebx,[color_ox] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit1.color],eax - mov eax,0xc0c0c0 - mov ebx,[color_oy] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit2.color],eax - mov eax,0xc0c0c0 - mov ebx,[color_oz] - shr ebx,2 - and ebx,0x3f3f3f - add eax,ebx - mov [edit3.color],eax -popad - call prop_red_win - -; 뢠 㭪 ।饩 -align 4 -prop_still: - pushad - - mcall SF_WAIT_EVENT_TIMEOUT,10 - or eax,eax - jnz @f - call prop_timer_funct - jmp .end - @@: - - cmp al,1 ;. - jne @f - call prop_red_win - jmp .end - @@: - cmp al,2 - jne @f - call prop_key - jmp .end - @@: - cmp al,3 - jz prop_button - cmp al,6 - jne @f - call prop_mouse - @@: -.end: - popad - jmp prop_still - -align 4 -prop_red_win: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - xor eax,eax - mov edi,dword[capt_p] ;children window caption - mov bx,word[procinfo.box.left] - add bx,word[buf_0.l] - add bx,5 ;ਭ ࠬ - shl ebx,16 - mov bx,prop_wnd_width - mov cx,word[procinfo.box.top] - add cx,word[buf_0.t] - shl ecx,16 - mov cx,prop_wnd_height - mov edx,[sc.work] - or edx,0x33000000 - int 0x40 - - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003 - mcall , (30 shl 16)+20, (266 shl 16)+20, 0x40000004 - - mov ebx,[image_data_toolbar] - add ebx,3*IMAGE_TOOLBAR_ICON_SIZE - mcall SF_PUT_IMAGE, , (21 shl 16)+21, (5 shl 16)+266 ;load - - sub ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(30 shl 16)+266 ;save - int 0x40 - - mov dword[w_scr_t3.all_redraw],1 - stdcall [scrollbar_ver_draw],dword w_scr_t3 - stdcall [tl_draw], tree3 - stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 - - stdcall [kmainmenu_draw], [main_menu] - stdcall draw_3d, o3d - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -proc prop_key uses eax ebx - mcall SF_GET_KEY - - test word [edit1.flags],10b ;ed_focus - je @f - stdcall [edit_box_key], edit1 - jmp .end - @@: - test word [edit2.flags],10b - je @f - stdcall [edit_box_key], edit2 - jmp .end - @@: - test word [edit3.flags],10b - je @f - stdcall [edit_box_key], edit3 - jmp .end - @@: - cmp dword[el_focus], tree3 - jne @f - stdcall [tl_key], tree3 - jmp .end - @@: - - cmp ah,178 ;Up - jne @f - fld dword[angle_x] - fadd dword[delt_size] - fstp dword[angle_x] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,177 ;Down - jne @f - fld dword[angle_x] - fsub dword[delt_size] - fstp dword[angle_x] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,176 ;Left - jne @f - fld dword[angle_y] - fadd dword[delt_size] - fstp dword[angle_y] - stdcall draw_3d, o3d - jmp .end - @@: - cmp ah,179 ;Right - jne @f - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - stdcall draw_3d, o3d - ;jmp .end - @@: - .end: - ret -endp - -align 4 -prop_mouse: - push eax ebx - mcall SF_MOUSE_GET,SSF_BUTTON_EXT - bt eax,0 - jnc .end_m - ;mouse l. but. move - cmp dword[mouse_drag],1 - jne .end_m - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jg @f - mov ebx,3d_wnd_l - @@: - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jle @f - mov ebx,3d_wnd_w - @@: - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jg @f - mov eax,3d_wnd_t - @@: - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jle @f - mov eax,3d_wnd_h - @@: - finit - fild dword[mouse_y] - mov [mouse_y],eax - fisub dword[mouse_y] - fdiv dword[angle_dxm] ;᫨ y ( ) x - fadd dword[angle_x] - fstp dword[angle_x] - - fild dword[mouse_x] - mov [mouse_x],ebx - fisub dword[mouse_x] - fdiv dword[angle_dym] ;᫨ x ( ) y - fadd dword[angle_y] - fstp dword[angle_y] - - stdcall draw_3d, o3d - jmp .end_d - .end_m: - bt eax,16 - jnc @f - ;mouse l. but. up - mov dword[mouse_drag],0 - jmp .end_d - @@: - bt eax,8 - jnc .end_d - ;mouse l. but. press - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jl .end_d - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jg .end_d - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jl .end_d - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jg .end_d - mov dword[mouse_drag],1 - mov dword[mouse_x],ebx - mov dword[mouse_y],eax - .end_d: - - stdcall [kmainmenu_dispatch_cursorevent], [main_menu] - stdcall [tl_mouse], tree3 - stdcall [edit_box_mouse], edit1 - stdcall [edit_box_mouse], edit2 - stdcall [edit_box_mouse], edit3 - pop ebx eax - ret - -align 4 -prop_button: - mcall SF_GET_BUTTON - - cmp ah,3 - jne @f - call get_point_coords - stdcall draw_3d, o3d - jmp prop_still.end - @@: - cmp ah,4 - jne @f - push eax ebx ecx edi esi - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je .no_select_1 - mov ebx,[eax] - finit - - mov esi,string1 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx] ;࠭塞 float - - mov esi,string2 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx+4] ;࠭塞 float - - mov esi,string3 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp dword[ebx+8] ;࠭塞 float - - ; 㧫 ᯨ᪥ tree3 ( ⠩) - mov word[NumberSymbolsAD],5 - mov dword[obj_point],ebx - mov dword[obj_point.text],0 - cld - mov ecx,3 - .coord: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop .coord - mov byte[obj_point.text],'*' ;⬥砥 設 﫠 - stdcall dword[tl_node_set_data], tree3,obj_point - stdcall dword[tl_draw], tree3 - mov byte[can_save],1 ; '࠭' - mov dword[offs_last_timer],0 ; ⠩ - stdcall draw_3d, o3d - .no_select_1: - pop esi edi ecx ebx eax - jmp prop_still.end - @@: - cmp ah,5 - jne @f - call mnu_vertexes_on - jmp prop_still.end - @@: - cmp ah,6 - jne @f - call mnu_edges_on - jmp prop_still.end - @@: - cmp ah,7 - jne @f - call mnu_faces_on - jmp prop_still.end - @@: - cmp ah,8 - jne @f - call mnu_light_on_off - jmp prop_still.end - @@: - cmp ah,9 - jne @f - call mnu_smooth_on_off - jmp prop_still.end - @@: - cmp ah,10 - jne @f - call mnu_reset_settings - jmp prop_still.end - @@: - cmp ah,11 - jne @f - call mnu_vertexes_select - jmp prop_still.end - @@: - cmp ah,12 - jne @f - call mnu_vertexes_deselect - jmp prop_still.end - @@: - cmp ah,13 - jne @f - call mnu_reset_average_x - jmp prop_still.end - @@: - cmp ah,14 - jne @f - call mnu_reset_average_y - jmp prop_still.end - @@: - cmp ah,15 - jne @f - call mnu_reset_average_z - jmp prop_still.end - @@: - - cmp ah,1 - jne prop_still.end -.exit: - mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 - mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 - stdcall dword[tl_data_clear], tree3 - mov edi,o3d - stdcall mem.Free,[edi+obj_3d.normals_tri_data] - stdcall mem.Free,[edi+obj_3d.normals_poi_data] - mov dword[edi+obj_3d.normals_tri_data],0 - mov dword[edi+obj_3d.normals_poi_data],0 - mov byte[prop_wnd_run],0 ;塞 稪 - mcall SF_TERMINATE_PROCESS ;室 ணࠬ - -align 4 -get_point_coords: - ;㧪 न editbox- - push eax ebx - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je @f - mov ebx,[eax] - mov word[NumberSymbolsAD],8 - finit - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit1, Data_String - fld dword[ebx+4] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit2, Data_String - fld dword[ebx+8] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit3, Data_String - stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 - @@: - pop ebx eax - ret - -align 4 -proc prop_timer_funct uses eax - ;ᬠਢ 뤥 न - stdcall [tl_node_get_data],tree3 - cmp [cursor_last_draw],eax - je @f - mov [cursor_last_draw],eax - stdcall draw_3d, o3d - @@: - ret -endp - -align 4 -proc mnu_vertexes_select uses eax ebx - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je .no_points - stdcall found_block_data,tree3 - cmp eax,0 - je .no_points - mov bx,word[eax] - cmp bx,ID_ICON_POINT_SEL - je @f - mov word[eax],ID_ICON_POINT_SEL - inc dword[obj_poi_sel_c] - jmp .change - @@: - mov word[eax],ID_ICON_POINT - dec dword[obj_poi_sel_c] - .change: - mov eax,[obj_poi_sel_c] - stdcall convert_int_to_str, txt_select_vert.count,16 - .no_points: - ret -endp - -align 4 -proc mnu_vertexes_deselect uses eax - cmp dword[obj_poi_sel_c],0 - je .no_points - mov dword[obj_poi_sel_c],0 - stdcall [tl_node_poi_get_info], tree3,0 - cmp eax,0 - je .no_points - @@: - mov word[eax],ID_ICON_POINT - stdcall [tl_node_poi_get_next_info], tree3,eax - cmp eax,0 - jne @b - .no_points: - ret -endp - -align 4 -proc mnu_reset_average_x uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax] - mov edx,[eax] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc mnu_reset_average_y uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax+4] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax+4] - mov edx,[eax+4] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax+4],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc mnu_reset_average_z uses eax ebx ecx edx edi - cmp dword[obj_poi_sel_c],2 - jl .end_select - finit - fldz - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel0 - stdcall [tl_node_poi_get_data], tree3,ebx - mov eax,[eax] - fadd dword[eax+8] - dec ecx - jz @f - .next_sel0: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - fidiv dword[obj_poi_sel_c] - fstp dword[eax+8] - mov edx,[eax+8] - mov ecx,dword[obj_poi_sel_c] - stdcall dword[tl_node_poi_get_info], tree3,0 - @@: - cmp eax,0 - je .end_select - mov ebx,eax - cmp word[ebx],ID_ICON_POINT_SEL - jne .next_sel1 - stdcall [tl_node_poi_get_data], tree3,ebx - mov edi,eax - mov eax,[eax] - mov [eax+8],edx - stdcall update_tree, edi - dec ecx - jz @f - .next_sel1: - stdcall dword[tl_node_poi_get_next_info], tree3,ebx - jmp @b - @@: - .end_select: - ret -endp - -align 4 -proc update_tree h_mem:dword -pushad - mov edi,[h_mem] - mov ebx,[edi] - finit - - ; 㧫 ᯨ᪥ tree3 ( ⠩) - mov word[NumberSymbolsAD],5 - mov dword[obj_point.text],0 - cld - mov ecx,3 - .coord: - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - add ebx,4 - stdcall str_len, Data_String - mov esi,txt_space - add esi,eax - cmp esi,txt_space.end - jl .normal_size - mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ - .normal_size: - stdcall str_cat, obj_point.text,esi - stdcall str_cat, obj_point.text,Data_String - loop .coord - mov esi,obj_point.text - mov byte[esi],'*' ;⬥砥 設 﫠 - mov byte[can_save],1 ; '࠭' - add edi,4 - mov ecx,MAX_OBJECT_SIZE-4 - rep movsb -popad - ret -endp - -align 4 -angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 -angle_dym dd 1.3335 ;~ 3d_wnd_h/180 -ratio dd 1.3333 ;~ 3d_wnd_w/3d_wnd_h -cursor_last_draw dd 0 ; ᫥ ᮢ 3d -capt_p dd 0 - -;ॢ ꥪ⠬ 짮⥫᪮ 䠩 -tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ - 16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\ - w_scr_t3,get_point_coords - -edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0 -edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 32, string2, mouse_dd, 0 -edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 32, string3, mouse_dd, 0 -editboxes_end: - -string1 rb 34 -string2 rb 34 -string3 rb 34 - -align 4 -w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1 +; +; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ +; ࠡ न⠬ 設 +; + +prop_wnd_width equ 340 ;ਭ ᢮⢠ ꥪ +prop_wnd_height equ 460 ; ᢮⢠ ꥪ +3d_wnd_l equ 5 ; tinygl ᫥ +3d_wnd_t equ 23 ; tinygl ᢥ +3d_wnd_w equ 320 +3d_wnd_h equ 240 +SIZE_ONE_FLOAT equ 14 +MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) + +prop_wnd_run db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ + +txt_q db '?',0 +txt_space: + db SIZE_ONE_FLOAT dup(' ') +.end: + db 0 + +obj_point: ;塞 ꥪ + dd 0 ;㪠⥫ +.text: + rb MAX_OBJECT_SIZE + +if lang eq ru_RU +txt_select_vert: db '࠭: ' +else ; Default to en_US +txt_select_vert: db 'Select: ' +end if +.count: +dq 0,0 + +; () 뢠 㭪樥 but_wnd_coords +align 4 +prop_start: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ + inc byte[prop_wnd_run] + mov dword[w_scr_t3.type],1 + mov edi,o3d + stdcall obj_clear_param, edi + call mnu_reset_settings + + stdcall [tl_node_get_data],tree1 + xor edx,edx + mov dword[capt_p],txt_q + cmp eax,0 + je .no_points + mov ebx,[eax] ;砥 祭 ᤢ ࠭ + add ebx,[open_file_data] + + cmp word[ebx],CHUNK_OBJBLOCK + jne .end_oblo + mov dword[capt_p],txt_4000 + stdcall obj_init,edi + jmp .no_points + .end_oblo: + cmp word[ebx],CHUNK_TRIMESH + jne .end_trim + mov dword[capt_p],txt_4100 + stdcall obj_init,edi + jmp .no_points + .end_trim: + cmp word[ebx],CHUNK_VERTLIST + jne .end_vlist + mov dword[capt_p],txt_4110 + stdcall obj_init,edi + jmp .no_points + .end_vlist: + cmp word[ebx],CHUNK_TRACKPIVOT + jne @f + inc edx + add ebx,6 + mov dword[capt_p],txt_b013 + jmp .set_points + @@: + cmp word[ebx],0xb014 + jne @f + mov edx,2 + add ebx,6 + mov dword[capt_p],txt_b014 + ;jmp .set_points + @@: + .set_points: + mov [edi+obj_3d.poi_data],ebx + mov [edi+obj_3d.poi_count],edx + .no_points: + + ;ன ᯨ᪠ ꥪ⮢ + mov ebx,[edi+obj_3d.poi_data] + mov dword[tree3.info_max_count],2 + mov edx,[edi+obj_3d.poi_count] + add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祪 (+2 砫 ᯨ᪠) + stdcall dword[tl_data_init], tree3 + mov eax,dword[icon_tl_sys] + mov dword[tree3.data_img_sys],eax + mov eax,dword[icon_toolbar] + mov dword[tree3.data_img],eax + + cmp edx,0 + je .no_object + mov word[NumberSymbolsAD],5 + finit + mov dword[w_scr_t3.redraw],0 + .new_point: + mov dword[obj_point],ebx + mov dword[obj_point.text],0 + cld + mov ecx,3 + @@: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop @b + stdcall dword[tl_node_add], tree3,(ID_ICON_POINT shl 16),obj_point + stdcall dword[tl_cur_next], tree3 + dec edx + cmp edx,0 + jg .new_point + mov dword[w_scr_t3.redraw],1 + stdcall dword[tl_cur_beg], tree3 + .no_object: + stdcall obj_set_sizes, o3d + stdcall obj_set_normals, o3d + edit_boxes_set_sys_color edit1,editboxes_end,sc ;⠭ ⥬ 梥⮢ + stdcall [edit_box_set_text], edit1, txt_q + stdcall [edit_box_set_text], edit2, txt_q + stdcall [edit_box_set_text], edit3, txt_q + mov eax,0xc0c0c0 + mov ebx,[color_ox] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit1.color],eax + mov eax,0xc0c0c0 + mov ebx,[color_oy] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit2.color],eax + mov eax,0xc0c0c0 + mov ebx,[color_oz] + shr ebx,2 + and ebx,0x3f3f3f + add eax,ebx + mov [edit3.color],eax +popad + call prop_red_win + +; 뢠 㭪 ।饩 +align 4 +prop_still: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call prop_timer_funct + jmp .end + @@: + + cmp al,1 ;. + jne @f + call prop_red_win + jmp .end + @@: + cmp al,2 + jne @f + call prop_key + jmp .end + @@: + cmp al,3 + jz prop_button + cmp al,6 + jne @f + call prop_mouse + @@: +.end: + popad + jmp prop_still + +align 4 +prop_red_win: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + xor eax,eax + mov edi,dword[capt_p] ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ਭ ࠬ + shl ebx,16 + mov bx,prop_wnd_width + mov cx,word[procinfo.box.top] + add cx,word[buf_0.t] + shl ecx,16 + mov cx,prop_wnd_height + mov edx,[sc.work] + or edx,0x33000000 + int 0x40 + + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003 + mcall , (30 shl 16)+20, (266 shl 16)+20, 0x40000004 + + mov ebx,[image_data_toolbar] + add ebx,3*IMAGE_TOOLBAR_ICON_SIZE + mcall SF_PUT_IMAGE, , (21 shl 16)+21, (5 shl 16)+266 ;load + + sub ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(30 shl 16)+266 ;save + int 0x40 + + mov dword[w_scr_t3.all_redraw],1 + stdcall [scrollbar_ver_draw],dword w_scr_t3 + stdcall [tl_draw], tree3 + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 + + stdcall [kmainmenu_draw], [main_menu] + stdcall draw_3d, o3d + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc prop_key uses eax ebx + mcall SF_GET_KEY + + test word [edit1.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit1 + jmp .end + @@: + test word [edit2.flags],10b + je @f + stdcall [edit_box_key], edit2 + jmp .end + @@: + test word [edit3.flags],10b + je @f + stdcall [edit_box_key], edit3 + jmp .end + @@: + cmp dword[el_focus], tree3 + jne @f + stdcall [tl_key], tree3 + jmp .end + @@: + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + stdcall draw_3d, o3d + jmp .end + @@: + cmp ah,179 ;Right + jne @f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + stdcall draw_3d, o3d + ;jmp .end + @@: + .end: + ret +endp + +align 4 +prop_mouse: + push eax ebx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,0 + jnc .end_m + ;mouse l. but. move + cmp dword[mouse_drag],1 + jne .end_m + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jg @f + mov ebx,3d_wnd_l + @@: + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jle @f + mov ebx,3d_wnd_w + @@: + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jg @f + mov eax,3d_wnd_t + @@: + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jle @f + mov eax,3d_wnd_h + @@: + finit + fild dword[mouse_y] + mov [mouse_y],eax + fisub dword[mouse_y] + fdiv dword[angle_dxm] ;᫨ y ( ) x + fadd dword[angle_x] + fstp dword[angle_x] + + fild dword[mouse_x] + mov [mouse_x],ebx + fisub dword[mouse_x] + fdiv dword[angle_dym] ;᫨ x ( ) y + fadd dword[angle_y] + fstp dword[angle_y] + + stdcall draw_3d, o3d + jmp .end_d + .end_m: + bt eax,16 + jnc @f + ;mouse l. but. up + mov dword[mouse_drag],0 + jmp .end_d + @@: + bt eax,8 + jnc .end_d + ;mouse l. but. press + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jl .end_d + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jg .end_d + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jl .end_d + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jg .end_d + mov dword[mouse_drag],1 + mov dword[mouse_x],ebx + mov dword[mouse_y],eax + .end_d: + + stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + stdcall [tl_mouse], tree3 + stdcall [edit_box_mouse], edit1 + stdcall [edit_box_mouse], edit2 + stdcall [edit_box_mouse], edit3 + pop ebx eax + ret + +align 4 +prop_button: + mcall SF_GET_BUTTON + + cmp ah,3 + jne @f + call get_point_coords + stdcall draw_3d, o3d + jmp prop_still.end + @@: + cmp ah,4 + jne @f + push eax ebx ecx edi esi + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je .no_select_1 + mov ebx,[eax] + finit + + mov esi,string1 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx] ;࠭塞 float + + mov esi,string2 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx+4] ;࠭塞 float + + mov esi,string3 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp dword[ebx+8] ;࠭塞 float + + ; 㧫 ᯨ᪥ tree3 ( ⠩) + mov word[NumberSymbolsAD],5 + mov dword[obj_point],ebx + mov dword[obj_point.text],0 + cld + mov ecx,3 + .coord: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop .coord + mov byte[obj_point.text],'*' ;⬥砥 設 﫠 + stdcall dword[tl_node_set_data], tree3,obj_point + stdcall dword[tl_draw], tree3 + mov byte[can_save],1 ; '࠭' + mov dword[offs_last_timer],0 ; ⠩ + stdcall draw_3d, o3d + .no_select_1: + pop esi edi ecx ebx eax + jmp prop_still.end + @@: + cmp ah,5 + jne @f + call mnu_vertexes_on + jmp prop_still.end + @@: + cmp ah,6 + jne @f + call mnu_edges_on + jmp prop_still.end + @@: + cmp ah,7 + jne @f + call mnu_faces_on + jmp prop_still.end + @@: + cmp ah,8 + jne @f + call mnu_light_on_off + jmp prop_still.end + @@: + cmp ah,9 + jne @f + call mnu_smooth_on_off + jmp prop_still.end + @@: + cmp ah,10 + jne @f + call mnu_reset_settings + jmp prop_still.end + @@: + cmp ah,11 + jne @f + call mnu_vertexes_select + jmp prop_still.end + @@: + cmp ah,12 + jne @f + call mnu_vertexes_deselect + jmp prop_still.end + @@: + cmp ah,13 + jne @f + call mnu_reset_average_x + jmp prop_still.end + @@: + cmp ah,14 + jne @f + call mnu_reset_average_y + jmp prop_still.end + @@: + cmp ah,15 + jne @f + call mnu_reset_average_z + jmp prop_still.end + @@: + + cmp ah,1 + jne prop_still.end +.exit: + mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 + mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 + stdcall dword[tl_data_clear], tree3 + mov edi,o3d + stdcall mem.Free,[edi+obj_3d.normals_tri_data] + stdcall mem.Free,[edi+obj_3d.normals_poi_data] + mov dword[edi+obj_3d.normals_tri_data],0 + mov dword[edi+obj_3d.normals_poi_data],0 + mov byte[prop_wnd_run],0 ;塞 稪 + mcall SF_TERMINATE_PROCESS ;室 ணࠬ + +align 4 +get_point_coords: + ;㧪 न editbox- + push eax ebx + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je @f + mov ebx,[eax] + mov word[NumberSymbolsAD],8 + finit + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit1, Data_String + fld dword[ebx+4] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit2, Data_String + fld dword[ebx+8] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit3, Data_String + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 + @@: + pop ebx eax + ret + +align 4 +proc prop_timer_funct uses eax + ;ᬠਢ 뤥 न + stdcall [tl_node_get_data],tree3 + cmp [cursor_last_draw],eax + je @f + mov [cursor_last_draw],eax + stdcall draw_3d, o3d + @@: + ret +endp + +align 4 +proc mnu_vertexes_select uses eax ebx + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je .no_points + stdcall found_block_data,tree3 + cmp eax,0 + je .no_points + mov bx,word[eax] + cmp bx,ID_ICON_POINT_SEL + je @f + mov word[eax],ID_ICON_POINT_SEL + inc dword[obj_poi_sel_c] + jmp .change + @@: + mov word[eax],ID_ICON_POINT + dec dword[obj_poi_sel_c] + .change: + mov eax,[obj_poi_sel_c] + stdcall convert_int_to_str, txt_select_vert.count,16 + .no_points: + ret +endp + +align 4 +proc mnu_vertexes_deselect uses eax + cmp dword[obj_poi_sel_c],0 + je .no_points + mov dword[obj_poi_sel_c],0 + stdcall [tl_node_poi_get_info], tree3,0 + cmp eax,0 + je .no_points + @@: + mov word[eax],ID_ICON_POINT + stdcall [tl_node_poi_get_next_info], tree3,eax + cmp eax,0 + jne @b + .no_points: + ret +endp + +align 4 +proc mnu_reset_average_x uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax] + mov edx,[eax] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc mnu_reset_average_y uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax+4] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax+4] + mov edx,[eax+4] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax+4],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc mnu_reset_average_z uses eax ebx ecx edx edi + cmp dword[obj_poi_sel_c],2 + jl .end_select + finit + fldz + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel0 + stdcall [tl_node_poi_get_data], tree3,ebx + mov eax,[eax] + fadd dword[eax+8] + dec ecx + jz @f + .next_sel0: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + fidiv dword[obj_poi_sel_c] + fstp dword[eax+8] + mov edx,[eax+8] + mov ecx,dword[obj_poi_sel_c] + stdcall dword[tl_node_poi_get_info], tree3,0 + @@: + cmp eax,0 + je .end_select + mov ebx,eax + cmp word[ebx],ID_ICON_POINT_SEL + jne .next_sel1 + stdcall [tl_node_poi_get_data], tree3,ebx + mov edi,eax + mov eax,[eax] + mov [eax+8],edx + stdcall update_tree, edi + dec ecx + jz @f + .next_sel1: + stdcall dword[tl_node_poi_get_next_info], tree3,ebx + jmp @b + @@: + .end_select: + ret +endp + +align 4 +proc update_tree h_mem:dword +pushad + mov edi,[h_mem] + mov ebx,[edi] + finit + + ; 㧫 ᯨ᪥ tree3 ( ⠩) + mov word[NumberSymbolsAD],5 + mov dword[obj_point.text],0 + cld + mov ecx,3 + .coord: + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + add ebx,4 + stdcall str_len, Data_String + mov esi,txt_space + add esi,eax + cmp esi,txt_space.end + jl .normal_size + mov esi,txt_space.end-1 ; 1 ஡ 㦭 , - ᫨ + .normal_size: + stdcall str_cat, obj_point.text,esi + stdcall str_cat, obj_point.text,Data_String + loop .coord + mov esi,obj_point.text + mov byte[esi],'*' ;⬥砥 設 﫠 + mov byte[can_save],1 ; '࠭' + add edi,4 + mov ecx,MAX_OBJECT_SIZE-4 + rep movsb +popad + ret +endp + +align 4 +angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 +angle_dym dd 1.3335 ;~ 3d_wnd_h/180 +ratio dd 1.3333 ;~ 3d_wnd_w/3d_wnd_h +cursor_last_draw dd 0 ; ᫥ ᮢ 3d +capt_p dd 0 + +;ॢ ꥪ⠬ 짮⥫᪮ 䠩 +tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\ + w_scr_t3,get_point_coords + +edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0 +edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 32, string2, mouse_dd, 0 +edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 32, string3, mouse_dd, 0 +editboxes_end: + +string1 rb 34 +string2 rb 34 +string3 rb 34 + +align 4 +w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1 diff --git a/programs/develop/libraries/box_lib/trunk/t_edit.asm b/programs/develop/libraries/box_lib/trunk/t_edit.asm index e85b33bd4..534d07ce3 100644 --- a/programs/develop/libraries/box_lib/trunk/t_edit.asm +++ b/programs/develop/libraries/box_lib/trunk/t_edit.asm @@ -1,4486 +1,4482 @@ -; ⥬ ⥪ box_lib.obj -; TextEditor KolibriOS -; 䠩 ᫥ ࠧ 12.01.2021 IgorA -; ਬ GPL2 業 - -;input: -; edi = pointer to tedit struct -; reg = index -;output: -; reg = pointer to 'tex' struct -macro ConvertIndexToPointer reg { - imul reg,sizeof.symbol - add reg,ted_tex -} - -;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- -macro ColToIndexOffset ind_reg,out_reg { - mov out_reg,ind_reg - imul out_reg,sizeof.TexColViv - add out_reg,ted_key_words_data -} - -TED_LINES_IN_NEW_FILE equ 30 ;᫮ ப 䠩 -MAX_COLOR_WORD_LEN equ 40 -;------------------------------------------------------------------------------ -struct TexSelect - x0 dd ? - y0 dd ? - x1 dd ? - y1 dd ? -ends - -struct TexColViv - Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ - f1 dd 0 ; ࠢ ᫮ - flags db ? ; f1+4 䫠 ᯮ㥬 뤥 - endc db ? ; f1+5 ᨬ 뤥 (ᯮ flags&4) - escc db ? ; f1+6 ࠭騩 ᨬ (ᯮ flags&4) - color db ? ; f1+7 梥 -ends - -struct symbol - c db ? ; +0 ᨬ - col db ? ; +1 梥 - perv dd ? ; +2 - next dd ? ; +6 㪠⥫ - tc dd ? ; +10 ६. ᮧ - td dd ? ; +14 ६. 㤠 -ends -;------------------------------------------------------------------------------ - -ted_symbol_space db 32 ;ascii ஡, 뢠 㦥 -ted_symbol_tab db 26 ;ascii ५ ࠢ, ᯮ ᮢ ⠡樨 ० ᨬ - -if lang eq ru_RU - -txtRow db 'ப',0 -txtCol db '',0 -txtOtm db '⬥',0 -txtBuf db ':',0 - -else - -txtRow db 'Rows',0 -txtCol db 'Cols',0 -txtOtm db 'Undo',0 -txtBuf db 'Buffer:',0 - -end if - -;EvChar - ⠡ 䨫஢ 塞 ᨬ, - 譨 -align 16 -EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -KM_SHIFT equ 0x00010000 -KM_CTRL equ 0x00020000 -KM_ALT equ 0x00040000 -KM_NUMLOCK equ 0x00080000 - -; KEY CODES -KEY_F1 equ 0x0000003B -KEY_F2 equ 0x0000003C -KEY_F3 equ 0x0000003D - - - -align 16 -proc ted_init uses eax ecx edi, edit:dword - mov edi,[edit] - - mov ecx,sizeof.symbol - imul ecx,ted_max_chars - invoke mem.alloc,ecx ;뤥塞 - mov ted_tex,eax - mov ted_tex_1,eax - add ted_tex_1,sizeof.symbol - add eax,ecx - mov ted_tex_end,eax - - stdcall ted_clear, edi,1 - -;------------------------------------------------- - mov ecx,1024 ;1024 - ᨢ ted_arr_key_pos - add ecx,ted_syntax_file_size - invoke mem.alloc,ecx - mov ted_arr_key_pos,eax - add eax,1024 - mov ted_syntax_file,eax - - stdcall ted_init_scroll_bars,edi,3 - ret -endp - -MIN_W_SCRL_ARE equ 3 ;쭠 ⮡ࠦ . ஫ -MIN_H_SCRL_ARE equ 3 ;쭠 ⮡ࠦ ਧ. ஫ -;input: -; opt = 1 - 梥 ஫, 2 - ࠧ , -; 4 - ࠧ 㬥 -align 16 -proc ted_init_scroll_bars, edit:dword, opt:dword - pushad - mov edi,[edit] - mov esi,ted_scr_w - mov ebx,ted_scr_h - bt dword[opt],0 - jae @f - mov ecx,ted_color_wnd_work - mov dword[esi+sb_offs_bckg_col],ecx - mov dword[ebx+sb_offs_bckg_col],ecx - mov ecx,ted_color_wnd_capt - mov dword[esi+sb_offs_frnt_col],ecx - mov dword[ebx+sb_offs_frnt_col],ecx - mov ecx,ted_color_wnd_bord - mov dword[esi+sb_offs_line_col],ecx - mov dword[ebx+sb_offs_line_col],ecx - @@: - bt dword[opt],2 ; ࠧ 㬥 ? - jae .doc_resize - call ted_get_num_lines - cmp eax,TED_LINES_IN_NEW_FILE - jge @f - mov eax,TED_LINES_IN_NEW_FILE - @@: - mov dword[esi+sb_offs_max_area],eax - .doc_resize: - bt dword[opt],1 ; ࠧ ? - jae .no_size - mov edx,ted_wnd_l - add edx,ted_rec_l - mov word[ebx+sb_offs_start_x],dx ;⠢塞 ਧ. ஫ - mov eax,ted_wnd_h ;calculate lines in page - mov edx,ted_wnd_t - add edx,eax - mov word[ebx+sb_offs_start_y],dx ;⠢塞 孨 ਧ. ஫ - sub eax,ted_rec_t - xor edx,edx - mov ecx,ted_rec_h - div ecx - cmp eax,MIN_W_SCRL_ARE - jg @f - mov eax,MIN_W_SCRL_ARE - @@: - mov dword[esi+sb_offs_cur_area],eax - - mov eax,ted_wnd_w ;calculate cols in page - mov edx,ted_wnd_l ; - add edx,eax ;塞 ਭ - mov word[esi+sb_offs_start_x],dx ;⠢塞 . ஫ - mov edx,ted_wnd_t - mov word[esi+sb_offs_start_y],dx ;⠢塞 孨 . ஫ - mov edx,ted_wnd_h - mov word[esi+sb_offs_size_y],dx ;⠢塞 . ஫ - sub eax,ted_rec_l - mov word[ebx+sb_offs_size_x],ax ;⠢塞 ਭ ਧ. ஫ - xor edx,edx - mov ecx,ted_rec_w - div ecx - cmp eax,MIN_H_SCRL_ARE - jg @f - mov eax,MIN_H_SCRL_ARE - @@: - dec eax - mov dword[ebx+sb_offs_cur_area],eax ;⠭ ᫮ ᨬ, ࠭ ਧ. ஫ - .no_size: - popad - ret -endp - -align 16 -proc ted_delete uses edi, edit:dword - mov edi,[edit] - invoke mem.free,ted_tex - invoke mem.free,ted_arr_key_pos ;ted_syntax_file - ret -endp - - -;input: -; eax = key kodes -align 16 -proc ted_key, edit:dword, table:dword, control:dword - pushad - mov edi,[edit] - mov esi,ted_el_focus - cmp dword[esi],edi - jne .end_key_fun ; 䮪 室 㭪樨 - mov esi,dword[control] - - cmp ah,KEY_F1 ;[F1] - jne @f - stdcall ted_show_help_f1,edi - jmp .end_key_fun - @@: - cmp ah,KEY_F3 ;[F3] - jne @f - stdcall ted_but_find,edi,0 - jmp .end_key_fun - @@: - - test esi,KM_CTRL ;Ctrl+... - jz .key_Ctrl - ; *** 맮 譨 㭪権 ॡ /࠭/᪠/... - cmp ted_fun_on_key_ctrl_all,0 - je .end0 - xor al,al - cmp ah,24 ;Ctrl+O - jne @f - mov al,'O' - @@: - cmp ah,31 ;Ctrl+S - jne @f - mov al,'S' - @@: - cmp ah,33 ;Ctrl+F - jne @f - mov al,'F' - @@: - cmp ah,34 ;Ctrl+G - jne @f - mov al,'G' - @@: - cmp ah,35 ;Ctrl+H - jne @f - mov al,'H' - @@: - cmp ah,49 ;Ctrl+N - jne @f - mov al,'N' - @@: - or al,al - jz .end0 - and eax,0xff - test esi,KM_SHIFT - jz @f - or eax,0x100 - @@: - stdcall ted_fun_on_key_ctrl_all, eax - jmp .end_key_fun - .end0: - - ; *** 맮 ७ 㭪権 - cmp ah,30 ;Ctrl+A - jne @f - call ted_sel_all - @@: - cmp ah,44 ;Ctrl+Z - jne @f - stdcall ted_but_undo,edi - @@: - cmp ah,45 ;Ctrl+X - jne @f - stdcall ted_but_cut,edi - @@: - cmp ah,46 ;Ctrl+C - jne @f - stdcall ted_but_copy,edi - @@: - cmp ah,47 ;Ctrl+V - jne @f - stdcall ted_but_paste,edi - @@: - cmp ah,199 ;Ctrl+Home - jne @f - call ted_key_ctrl_home - @@: - cmp ah,207 ;Ctrl+End - jne @f - call ted_key_ctrl_end - @@: - jmp .end_key_fun - .key_Ctrl: - - test esi,KM_SHIFT ;Shift+... - jz .key_Shift - cmp ah,72 ;Shift+Up - jne @f - call ted_sel_key_up - @@: - cmp ah,75 ;Shift+Left - jne @f - call ted_sel_key_left - @@: - cmp ah,77 ;Shift+Right - jne @f - call ted_sel_key_right - @@: - cmp ah,80 ;Shift+Down - jne @f - call ted_sel_key_down - @@: - ;mov ted_drag_k,1 ;稭 뤥 - jmp .key_MoveCur - .key_Shift: -;------------------------------------------------- - cmp ah,72 ;178 ;Up - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_up - cmp dl,8 - jne .no_red_0 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_0: - call ted_sel_end - @@: - cmp ah,80 ;177 ;Down - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_down - cmp dl,8 - jne .no_red_1 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_1: - call ted_sel_end - @@: - cmp ah,75 ;176 ;Left - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_left - cmp dl,8 - jne .no_red_2 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_2: - call ted_sel_end - @@: - cmp ah,77 ;179 ;Right - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_right - cmp dl,8 - jne .no_red_3 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_3: - call ted_sel_end - @@: - cmp ah,71 ;180 ;Home - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_x_first_char - cmp dl,8 - jne .no_red_4 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_4: - call ted_sel_end - @@: - cmp ah,79 ;181 ;End - jne @f - call ted_draw_cursor_sumb - call ted_cur_move_x_last_char - cmp dl,8 - jne .no_red_5 - call ted_scroll_set_redraw - stdcall ted_draw,edi - jmp @f - .no_red_5: - call ted_sel_end - @@: - cmp ah,73 ;184 ;PageUp - jne @f - call ted_cur_move_page_up - cmp dl,0 - je @f - call ted_scroll_set_redraw - stdcall ted_draw,edi - mov ted_drag_k,0 ;稢 뤥 - @@: - cmp ah,81 ;183 ;PageDown - jne @f - call ted_cur_move_page_down - cmp dl,0 - je @f - call ted_scroll_set_redraw - stdcall ted_draw,edi - mov ted_drag_k,0 ;稢 뤥 - @@: -;------------------------------------------------- - .key_MoveCur: - - ; ய᪠ 㦥 , ᨬ - cmp ah,42 ;[L Shift] 㣨 - je .end_key_fun - cmp ah,54 ;[R Shift] 㣨 - je .end_key_fun - cmp ah,58 ;[Caps Lock] - je .end_key_fun - cmp ah,69 ;[Pause Break] - je .end_key_fun - cmp ah,120 ;[Fn] - je .end_key_fun - cmp ah,0x80 ;if key up - ja .end_key_fun - - cmp dword[table],0 - je @f - stdcall KeyConvertToASCII, [table] - @@: - - ;mov ted_drag_k,0 ;稢 뤥 - - lea edx,[EvChar] ;६ ⠡ ⨬묨 ᨬ - add dl,ah - jae @f - add edx,0x100 ;᫨ 뫮 ९ ᨬ - @@: - cmp byte[edx],1 - jne @f - mov ted_key_new,ah - call ted_set_undo - mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor - stdcall ted_sel_text_del,edx - cmp al,1 - jne .del - mov edx,ted_opt_ed_move_cursor - .del: - cmp ted_cur_ins,1 - je .no_ins_mod - stdcall ted_text_del,edi,ted_opt_ed_change_time - mov edx,ted_opt_ed_move_cursor - .no_ins_mod: - mov ecx,edi - add ecx,ted_offs_key_new - stdcall ted_text_add,edi,ecx,1,edx ;塞 ᨬ - cmp ted_key_new,13 - jne .dr_m_win - ;᫨ ⠢ ᨬ ப - mov ecx,ted_scr_w - inc dword[ecx+sb_offs_max_area] ;㢥稢 ࠧ ⨪쭮 ஫ - mov edx,ted_cur_y - cmp edx,[ecx+sb_offs_cur_area] - jl .no_change - dec ted_cur_y ; ⠢塞 - inc dword[ecx+sb_offs_position] ;ᤢ 㭮 - .no_change: - stdcall ted_draw,edi - jmp .dr_cur_l - .dr_m_win: - stdcall ted_draw_cur_line,edi - .dr_cur_l: - cmp ted_fun_draw_panel_buttons,0 - je @f - call ted_fun_draw_panel_buttons - @@: - - cmp ah,8 ;[<-] - jne @f - call ted_set_undo - stdcall ted_sel_text_del,ted_opt_ed_change_time - cmp al,1 - je .del_one_b - stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor - .del_one_b: - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .end_key_fun - call ted_fun_draw_panel_buttons - jmp .end_key_fun -align 4 - @@: - - cmp ah,182 ;Delete - jne @f - call ted_set_undo - stdcall ted_sel_text_del,ted_opt_ed_change_time - cmp al,1 - je .del_one_d - stdcall ted_text_del,edi,ted_opt_ed_change_time - .del_one_d: - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .end_key_fun - call ted_fun_draw_panel_buttons - jmp .end_key_fun - @@: - - cmp ah,185 ;Ins - jne @f - call ted_draw_cursor_sumb - xor ted_cur_ins,1 - call ted_draw_main_cursor - @@: - - .end_key_fun: - popad - ret -endp - -;output: -; al = 1 - can save -align 16 -proc ted_can_save uses ecx edi, edit:dword - mov edi,[edit] - - mov ecx,ted_tim_ch - sub ecx,ted_tim_undo - mov al,1 - cmp ted_tim_ls,ecx - jne @f - dec al - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -;output: -; al = 1 - selected -align 16 -proc ted_is_select uses ebx - xor al,al - cmp ted_drag_m,1 - je @f - inc al - mov ebx,ted_sel_x0 - cmp ebx,ted_sel_x1 - jne @f - mov ebx,ted_sel_y0 - cmp ebx,ted_sel_y1 - jne @f - xor al,al - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_sel_normalize uses ecx esi - push edi - mov esi,edi - add esi,ted_offs_sel - add edi,ted_offs_seln - mov ecx,sizeof.TexSelect/4 - rep movsd - pop edi - - jmp @f - .swp_f: - mov ecx,ted_seln_x0 - m2m ted_seln_x0,ted_seln_x1 - mov ted_seln_x1,ecx - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jle .end_f - m2m ted_seln_y0,ted_seln_y1 - mov ted_seln_y1,ecx - - jmp .end_f -align 4 - @@: - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jg .swp_f - - cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) - jne .end_f - mov ecx,ted_seln_x0 - cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) - jg .swp_f - - .end_f: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 砫 뤥 -align 16 -proc ted_sel_start uses eax ecx - mov eax,ted_scr_h - mov ecx,ted_cur_x - add ecx,[eax+sb_offs_position] - mov ted_sel_x0,ecx - mov ted_sel_x1,ecx - - mov eax,ted_scr_w - mov ecx,ted_cur_y - add ecx,[eax+sb_offs_position] - mov ted_sel_y0,ecx - mov ted_sel_y1,ecx - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ⨨ 뤥 -align 16 -proc ted_sel_end uses eax - mov ted_drag_k,0 ;稢 뤥 - call ted_is_select - or al,al - jz @f - xor eax,eax - mov ted_sel_x0,eax - mov ted_sel_x1,eax - mov ted_sel_y0,eax - mov ted_sel_y1,eax - stdcall ted_draw,edi - jmp .end_f - @@: - call ted_draw_main_cursor - .end_f: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ६饭 뤥 -align 16 -proc ted_sel_move - push eax ecx - mov ecx,ted_cur_x - mov eax,ted_scr_h - add ecx,[eax+sb_offs_position] - mov ted_sel_x1,ecx - - mov eax,ted_scr_w - mov ecx,ted_cur_y - add ecx,[eax+sb_offs_position] - mov ted_sel_y1,ecx - pop ecx eax - cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; edi = pointer to tedit struct -;description: -; 㭪 뢠 뤥 ᥣ 㬥 -align 16 -proc ted_sel_all - push eax - xor eax,eax - mov ted_sel_x0,eax - mov ted_sel_y0,eax - - mov ted_sel_x1,eax ;??? - call ted_get_num_lines - mov ted_sel_y1,eax - pop eax - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; cl_al_mem = 1 - clear all memory -align 16 -proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword - mov edi,[edit] - - mov ted_cur_x,0 - mov ted_cur_y,0 - mov ted_tim_ch,0 - mov ted_tim_ls,0 - mov ted_tim_co,0 - mov ted_tim_undo,0 - mov ted_help_id,-1 - mov ecx,sizeof.symbol - shl ecx,1 - add ecx,ted_tex - mov ted_ptr_free_symb,ecx - - mov ecx,ted_scr_w - mov dword[ecx+sb_offs_position],0 - mov dword[ecx+sb_offs_max_area],100 ;᫮ ப 㬥 - mov dword[ecx+sb_offs_redraw],1 - mov ecx,ted_scr_h - mov dword[ecx+sb_offs_position],0 - mov dword[ecx+sb_offs_max_area],100 ;᫮ ᨬ 㬥 - - mov ted_sel_x0,0 - mov ted_sel_y0,0 - mov ted_sel_x1,0 - mov ted_sel_y1,0 - - cmp dword[cl_al_mem],0 - je .exit - - push edx - mov ecx,sizeof.symbol - imul ecx,ted_max_chars - mov edx,ted_tex - @@: - mov byte [edx],0 - inc edx - loop @b - mov edx,ted_tex - mov dword [edx+symbol.next],1 - pop edx - - .exit: - ret -endp - - -align 16 -proc ted_init_syntax_file, edit:dword - pushad - mov edi,[edit] - - mov ecx,0x100 - mov edx,ted_arr_key_pos - @@: - mov dword[edx],-1 - add edx,4 - loop @b - - ;init: ted_colors_text_count, ted_key_words_count, ... - mov ted_colors_text_count,1 - mov ted_help_text_f1,0 - mov ted_help_id,-1 ;䨪 ᫮ ࠢ - - mov eax,edi ;࠭塞 祭 edi - mov esi,ted_syntax_file - add edi,ted_offs_count_colors ;edi = &ted_key_words_count - mov ecx,9 - rep movsd - mov edi,eax ;⠭ 祭 edi - - mov eax,ted_syntax_file - add eax,32 - mov ted_text_colors,eax - - mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) - lea eax,[4*eax+32] - add eax,ted_syntax_file - mov ted_key_words_data,eax - - mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) - or ecx,ecx - jz .no_words - xor eax,eax - @@: - ColToIndexOffset eax,edx - movzx ebx,byte[edx] - mov esi,ted_arr_key_pos - lea esi,[esi+4*ebx] - cmp dword[esi],-1 - jne .no_ch_key - mov [esi],eax - .no_ch_key: - inc eax - loop @b - .no_words: - - ;init: ted_help_text_f1 - mov ecx,ted_key_words_count ;⢮ 祢 ᫮ - imul ecx,sizeof.TexColViv ;ࠧ 1- . . - add ecx,ted_key_words_data ;砫 䠩 . . - mov ted_help_text_f1,ecx ;⪠ , 稭 ⥪ ࠢ - - stdcall ted_init_scroll_bars,edi,1 ;塞 梥 ஫ - .no_colors: - popad - ret -endp - -;input: -; ebx = file size -; edi = pointer to tedit struct -;description: -; 㭪 뢠 ⨨ 䠩 -align 16 -proc ted_on_open_file - push eax ;destination - push ecx ;for cycle - push edx ;source - push esi - - or ebx,ebx - jnz @f - ;᫨ 䠩 ⮩ - stdcall ted_clear,edi,1 ;⨬ - jmp .end_opn -align 4 - @@: - stdcall ted_clear,edi,0 ;⨬ , ⮬ 㤥 묨 묨 - - mov edx,ted_tex - mov ecx,ebx - .s_10: - cmp word[edx],0xa0d ;ய᪠ 10- ᨬ ᫨ । ⮨ 13- - jne @f - dec ecx - jz .no_10 - dec ecx - jz .no_10 - add edx,2 - @@: - cmp byte[edx],10 - jne @f - mov byte[edx],13 ;塞 10- ᨬ ப - @@: - inc edx - loop .s_10 - .no_10: - - ;ॢ 䠩 t_edit - mov ecx,ebx - lea eax,[ebx+2] - ConvertIndexToPointer eax - mov edx,ted_tex - add edx,ebx - push ebx - @@: - mov ebx,[edx] - mov byte[eax],bl - mov dword[eax+symbol.perv],ecx - inc dword[eax+symbol.perv] - mov dword[eax+symbol.next],ecx - add dword[eax+symbol.next],3 - ;mov byte[eax+1],0 ;col=0 - mov dword[eax+symbol.tc],-1 - mov dword[eax+symbol.td],0 - - or ecx,ecx - jz @f - dec ecx - dec edx - sub eax,sizeof.symbol - jmp @b -align 4 - @@: - pop ebx - mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' - - mov edx,ted_tex ; ன 砫쭮 㦥 ᨬ - ; begining sumbol 'perv=0' 'next=2' - mov dword[edx+symbol.perv],0 - mov dword[edx+symbol.next],2 - - add edx,sizeof.symbol ; ன 筮 㦥 ᨬ - mov dword[edx+symbol.next],0 ; last sumbol 'next=0' - mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' - inc dword[edx+symbol.perv] - mov dword[edx+symbol.tc],0 ; ⠢ ६ ᮧ ࠢ 0, ᨬ ࠢ쭮 ࠡ뢠 ⨨ 䠩 28 - - mov edx,ebx - inc edx ;2 = rezerv sumbols - imul edx,sizeof.symbol - add edx,ted_tex - mov dword[edx+symbol.next],1 ; last sumbol 'next=1' - - @@: ;clear memory, need if before was open big file - add edx,sizeof.symbol - cmp edx,ted_tex_end - jge .end_opn - mov dword[edx+symbol.tc],0 - mov dword[edx+symbol.td],0 - jmp @b -align 4 - .end_opn: - - call ted_get_num_lines - cmp eax,TED_LINES_IN_NEW_FILE - jge @f - mov eax,TED_LINES_IN_NEW_FILE - @@: - mov esi,ted_scr_w - mov dword[esi+sb_offs_max_area],eax - pop esi edx ecx eax - - call ted_text_colored - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je @f - call ted_fun_draw_panel_buttons - @@: - ret -endp - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'perv' visible symbol struct -align 16 -ted_iterat_perv: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - mov edx,[edx+symbol.perv] - or edx,edx - jz @f - imul edx,sizeof.symbol - add edx,ted_tex - call ted_symbol_not_vis - cmp bl,1 - je @b - cmp byte[edx],10 ;ய ᨬ 10 - je @b - pop ebx - ret - @@: - mov edx,ted_tex ;砫 䠩 - pop ebx - ret - .else: - mov edx,[edx+symbol.perv] - or edx,edx - jz @f - imul edx,sizeof.symbol - add edx,ted_tex - cmp dword[edx+symbol.td],0 - jne .else - cmp byte[edx],10 ;ய ᨬ 10 - je .else - ret - @@: - mov edx,ted_tex ;砫 䠩 - ret - - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'next' visible symbol struct -align 16 -ted_iterat_next: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - mov edx,[edx+symbol.next] - cmp edx,1 - jle @f - imul edx,sizeof.symbol - add edx,ted_tex - - call ted_symbol_not_vis - cmp bl,1 - je @b - cmp byte[edx],10 ;ய ᨬ 10 - je @b - pop ebx - ret - @@: - mov edx,ted_tex_1 ; 䠩 - pop ebx - ret - .else: - mov edx,[edx+symbol.next] - cmp edx,1 - jle @f - imul edx,sizeof.symbol - add edx,ted_tex - - cmp dword[edx+symbol.td],0 - jne .else - cmp byte[edx],10 ;ய ᨬ 10 - je .else - ret - @@: - mov edx,ted_tex_1 ; 䠩 - ret - -;input: -; bl = symbol end of select -; bh = ࠭騩 ᨬ (= 0 ᫨ ஢ન ) -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;description: -; ᫥ 㪠 ᨬ -align 16 -ted_iterat_next_pos_char: - push ax - mov al,1 ;।騩 ᨬ, 㦨 ࠢ ᨬ bh - @@: - cmp bl,byte[edx] - je .found - .no_found: - cmp edx,ted_tex_1 - jle @f - mov al,byte[edx] - call ted_iterat_next - jmp @b - .found: - cmp bh,al - je .no_found - @@: - call ted_iterat_next - pop ax - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 16 -ted_iterat_perv_color_tag: - @@: - cmp byte[edx+1],0 - jne @f - call ted_iterat_perv - cmp edx,ted_tex_1 - jle @f - jmp @b -align 4 - @@: - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 16 -ted_iterat_next_color_tag: - @@: - call ted_iterat_next - cmp byte[edx+1],0 - jne @f - cmp edx,ted_tex_1 - jle @f - jmp @b -align 4 - @@: - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; bl = 1 if sumbol not visible -; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) -align 16 -ted_symbol_not_vis: - push eax - - xor bl,bl - cmp dword[edx+symbol.td],0 - je @f - mov eax,[edx+symbol.td] ;eax=tex[i].td - add eax,ted_tim_undo - cmp eax,ted_tim_ch - jg @f - mov bl,1 - pop eax - ret - @@: - - mov eax,ted_tim_ch - sub eax,ted_tim_undo - cmp [edx+symbol.tc],eax - jle @f - or bl,1 - @@: - - pop eax - ret - -;input: -; text - pointer to text string -; add_opt - options -align 16 -proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword - locals - new_spc dd ? ;count new spaces - new_lin dd ? ;count new lines - endl -;ᯮ짮 ॣ஢ 㭪樨: -;eax - ⠢ ⥪ -;ebx - ६ 㦤, ⠢塞 ⥪ -;ecx - ६ 㦤 -;edx - 㪠⥫ ᨬ - pushad - cmp dword[t_len],1 ;஢塞 塞 ⥪ - jl .no_add ; <1 룠 㭪樨,  - - mov edi,[edit] - mov esi,[text] - - call ted_get_pos_by_cursor - call ted_get_text_perv_pos - call ted_get_text_arr_index ;eax=po_t - - mov dword[new_spc],0 - cmp ted_gp_opt,2 - je @f - push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); - mov eax,ted_scr_h - mov eax,[eax+sb_offs_position] - add eax,ted_cur_x ;eax - ᨬ - mov [new_spc],eax - - mov eax,ted_scr_w - mov eax,[eax+sb_offs_position] - add eax,ted_cur_y ;eax - ப - call ted_strlen ;ebx = line len - sub [new_spc],ebx ; 樨 ⭨ ப, 㧭 ⢮ 塞 ஡ - pop eax - @@: - - mov ebx,[t_len] - - mov dword[new_lin],0 - cmp ted_gp_opt,0 - jne @f - push eax - mov eax,ted_scr_w - mov eax,[eax+sb_offs_position] - add eax,ted_cur_y - inc eax - mov [new_lin],eax - - call ted_get_num_lines - sub [new_lin],eax - ;㢥稢 ஫ ᫮ ⥫ ப - mov ecx,ted_scr_w - add [ecx+sb_offs_max_area],eax ;㢥稢 ࠧ ⨪쭮 ஫ - pop eax - @@: - - mov edx,ted_ptr_free_symb - .beg_cycle: ;for(i=...;i ted_cur_x - mov ted_gp_opt,1 - cmp eax,ecx - jge @f ; Row >= ted_cur_y - .u1_0: - mov ted_gp_opt,0 - inc ebx - cmp byte [edx],13 - jne @b - cmp eax,ecx - jge @f ; Row >= ted_cur_y - inc eax - xor ebx,ebx - jmp @b - @@: - cmp eax,ecx - jne @f ; Row = ted_cur_y - inc ted_gp_opt - @@: - cmp ted_gp_opt,0 - jne @f - mov edx,ted_tex_1 - ;call ted_get_text_perv_pos - @@: - ret -endp - -;input: -; eax = Row -; edi = pointer to tedit struct -;output: -; ebx = str len -align 16 -ted_strlen: - push edx ecx - ;ecx = Row, from cycle - - xor ebx,ebx - xor ecx,ecx - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - inc ebx - cmp byte [edx],13 - jne @b - dec ebx ;lenght minus 1 sumbol to paragraph - cmp eax,ecx - je @f - xor ebx,ebx - inc ecx - jmp @b - @@: - - cmp eax,ecx - je @f - xor ebx,ebx - @@: - - pop ecx edx - ret - - -;input: -; edx = symbol position -; edi = pointer to tedit struct -;output: -; eax = number of line -; ebx = symbol position in line -align 16 -ted_get_text_coords: - push edx - xor eax,eax - xor ebx,ebx - @@: - call ted_iterat_perv - - or eax,eax - jnz .no_col_mov - inc ebx - .no_col_mov: - - cmp edx,ted_tex_1 - jle @f - cmp byte [edx],13 - jne @b - inc eax - jmp @b - @@: - dec ebx - pop edx - ret - -;input: -; edi = pointer to tedit struct -;output: -; eax = num lines -align 16 -ted_get_num_lines: - push edx - mov eax,1 - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - jne @b - inc eax - jmp @b - @@: -;... -;dec eax - pop edx - ret - - -;input: -; edi = pointer to tedit struct -;description: -; ⬥ ⬥ ⢨, । 㬥 -align 16 -proc ted_set_undo - mov ted_drag_k,0 ;稢 뤥 - cmp ted_tim_undo,1 - jl .no_work - - push eax ebx edx - mov edx,ted_tex - call ted_get_text_next_pos ;long i=tex[0].next; - mov eax,ted_tim_undo - sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; - mov eax,ted_tim_ch - cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) - jle @f - mov ted_tim_ls,0 - @@: - cmp edx,ted_tex_1 - jle @f - - ;if(tex[i].tc>ted_tim_ch){ // ᫨ ᮧ ᨬ 뫮 ⬥ - cmp [edx+symbol.tc],eax - jle .no_u1 - mov dword[edx+symbol.tc],0 - mov dword[edx+symbol.td],0 - - mov ebx,[edx+symbol.perv] - imul ebx,sizeof.symbol - add ebx,ted_tex ;ebx=tex[i].perv - m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; - - mov ebx,[edx+symbol.next] - imul ebx,sizeof.symbol - add ebx,ted_tex ;ebx=tex[i].next - m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; - - cmp ted_ptr_free_symb,edx - jle .no_cor_free - mov ted_ptr_free_symb,edx ;塞 㪠⥫ ᢮ ᨬ, ண ᪠ - .no_cor_free: - mov edx,ebx ;⨬㥬 ᪮ (edx ᫥ 맮 ted_get_text_next_pos 㤥 ࠢ ebx) - jmp @b - .no_u1: - - ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ᫨ 㤠 ᨬ 뫮 ⬥ - cmp [edx+symbol.td],eax - jle .no_u2 - mov dword[edx+symbol.td],0 - .no_u2: - - call ted_get_text_next_pos - jmp @b - @@: - mov ted_tim_undo,0 - mov eax,ted_tim_co - cmp ted_tim_ch,eax - jge @f - mov ted_tim_co,0 - @@: - pop edx ebx eax - .no_work: - ret -endp - -;description: -; 室 㪠 -;input: -; row = ப -; col = ᨬ -align 16 -proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword - mov edi,[edit] - ; ⮢ ப - mov edx,[row] - call ted_get_num_lines - cmp edx,eax - jle @f - mov edx,eax ;࠭祭 ப max - @@: - dec edx - cmp edx,0 - jge @f - xor edx,edx ;࠭祭 ப min - @@: - ; ⮢ ᨬ - mov ecx,[col] - dec ecx - cmp ecx,0 - jge @f - xor ecx,ecx - @@: - call ted_go_to_pos - stdcall ted_draw,edi - ret -endp - -;input: -; ecx = Col -; edx = Row -; edi = pointer to tedit struct -;output: -; ecx = cursor x -; edx = cursor y -align 16 -ted_go_to_pos: - push eax ebx - mov eax,ted_scr_h - sub ecx,[eax+sb_offs_position] - cmp ecx,0 ;ted_cur_x < 0 - jge @f - add [eax+sb_offs_position],ecx ;ப⪠ ஫ - xor ecx,ecx - @@: - mov ebx,5 ;5 - ᫥ - cmp ecx,ebx - jge .end0 - sub ebx,ecx ;ebx - ᪮쪮 ᨬ 㦭 ᤢ - cmp [eax+sb_offs_position],ebx - jge @f - add ecx,[eax+sb_offs_position] - mov dword[eax+sb_offs_position],0 - jmp .end0 - @@: - sub [eax+sb_offs_position],ebx - add ecx,ebx - .end0: - cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] - jl .end1 - mov ebx,ecx - sub ebx,[eax+sb_offs_cur_area] - inc ebx - add [eax+sb_offs_position],ebx ;ப⪠ ஫ ࠢ - sub ecx,ebx - .end1: - mov ted_cur_x,ecx - - mov eax,ted_scr_w - sub edx,[eax+sb_offs_position] - cmp edx,0 ;ted_cur_y < 0 - jge @f - add [eax+sb_offs_position],edx ;ப⪠ ஫ - xor edx,edx - jmp .end2 - @@: - cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] - jl .end2 - mov ebx,edx - sub ebx,[eax+sb_offs_cur_area] - inc ebx - add [eax+sb_offs_position],ebx ;ப⪠ ஫ - sub edx,ebx - .end2: - mov ted_cur_y,edx - pop ebx eax - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_text_colored: - push eax edx - mov eax,ted_tim_ch - sub eax,ted_tim_undo - mov ted_tim_co,eax - mov edx,ted_tex - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - mov byte[edx+1],0 - jmp @b - @@: - - cmp ted_key_words_count,1 - jl .no_colors - mov edx,ted_tex - @@: - call ted_text_find_sel_color - cmp edx,ted_tex_1 - jg @b - - xor ax,ax - mov edx,ted_tex - .cycle0: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_colors - mov al,byte[edx+1] - or al,al - jz .cycle0 - cmp ah,al - jne @f - mov byte[edx+1],0 ;᫨ﭨ 冷 ᫮ 梥 - @@: - shl ax,8 - jmp .cycle0 - .no_colors: - pop edx eax - ret - - -;input: -; edx = pointer to start symbol -; edi = pointer to tedit struct -;output: -; edx = pointer to next symbol -;description: -; 㭪 ᪠ 뤥 ᢥ祭 ᫮ -align 16 -proc ted_text_find_sel_color uses eax ebx ecx esi -locals - begPos dd ? ;砫쭠 - endPos dd ? ;筠 - find db ? ;0 - , 1 - , 2 - 䠩 - f_color db ? ; 梥 ᫮ -endl -;eax = word_n ⥪騩 () ஢塞 ᫮ ᯨ᪥ -;ebx = ࠧ 楫 -;ecx = l_pos ᫥ () 室饣 ᫮ ᯨ᪥ -;esi = ࠧ 楫, ஢塞 ᨬ ᫮ - mov dword[begPos],1 - mov dword[endPos],1 - mov byte[find],0 - mov byte[f_color],1 - .cycle0: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .cycle0end - - movzx eax,byte[edx] - shl eax,2 ;eax*=4 - add eax,ted_arr_key_pos - mov eax,[eax] - cmp eax,0 - jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ - - mov ecx,eax - ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) - @@: - cmp ecx,eax - jle @f - dec ecx - ColToIndexOffset ecx,ebx - inc ecx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je @f - dec ecx - jmp @b - @@: - - ColToIndexOffset eax,ebx - cmp byte[ebx+esi],0 - jne .if_0 ;if(Col[word_n].Text[pos]==0){ - mov [endPos],edx ;eP=i; - ColToIndexOffset eax,ebx - mov bl,[ebx+MAX_COLOR_WORD_LEN+7] - mov [f_color],bl ;f_color=Col[word_n].color; - - mov byte[find],1 - ColToIndexOffset eax,ebx ;... ebx = Col[word_n] - mov bl,[ebx+MAX_COLOR_WORD_LEN+4] - cmp bl,0 ;if(Col[word_n].wwo) - je .if_2n - push edx - mov edx,[begPos] - call ted_iterat_perv - - btr bx,0 ;1-1 - jae @f ;if(Col[word_n].wwo&1) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae @f - mov byte[find],0 - jmp .if_4e - @@: - - btr bx,3 ;4-1 - jae .if_4e ;if(Col[word_n].wwo&8) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_4e - mov byte[find],0 - .if_4e: - - mov edx,[endPos] - ;call ted_iterat_next - - btr bx,1 ;2-1 - jae @f ;if(Col[word_n].wwo&2) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae @f - mov byte[find],0 - jmp .if_6e - @@: - - btr bx,4 ;5-1 - jae .if_6e ;if(Col[word_n].wwo&16) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_6e - mov byte[find],0 - .if_6e: - - btr bx,2 ;3-1 - jae .if_7e ;if(Col[word_n].wwo&4) - ColToIndexOffset eax,ebx - mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] - call ted_iterat_next_pos_char - cmp edx,ted_tex_1 - jg @f - ;᫨ 諨 䠩 諨 ᨬ ࠧ⪨ - call ted_iterat_perv - mov byte[find],2 - @@: - mov dword[endPos],edx - .if_7e: - - pop edx - .if_2n: -;if(i!=1){ // 㬥 -; cont_s=tex[eP].c; -; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // 㪢.-. ᨬ -; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . ᨬ -; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); - - cmp eax,ecx - je .wh_2e ;if(word_n==l_pos) break; // do double - ᫨ ᫮ 筮 ᫥ - .if_0: - - cmp edx,ted_tex_1 - jle .wh_2e ;if(i==1) break; - - ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) - .wh_4b: - cmp ecx,eax - jle .wh_4e - ColToIndexOffset eax,ebx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je .wh_4e - inc eax - jmp .wh_4b - .wh_4e: - - cmp eax,ecx - je .wh_2e;if(word_n==l_pos) break; - inc esi ;pos++; - jmp .wh_2b - .wh_2e: - - cmp byte[find],0 ;if(fnd)break; - jne .cycle0end - mov edx,[begPos];i=bP; - jmp .cycle0 - .cycle0end: - - cmp byte[find],0 - je .if_1e ;if(fnd){ // 뤥 ⥪ - ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ - mov eax,[begPos] - mov bl,[f_color] - mov [eax+1],bl ;tex[bP].col=f_color; - mov eax,[endPos] - mov byte[eax+1],0xff ;tex[eP].col=255; - cmp byte[find],2 - je .if_1e - ;return ItPoPerv(eP); // 頥 宦 - mov edx,[endPos] - call ted_get_text_perv_pos - jmp @f - .if_1e: - mov edx,ted_tex - @@: - - ret -endp - -;input: -; edx = pointer to char (byte) -;output: -; cf=1 if symbol is... -align 16 -tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 -tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -;output: -; cf=1 ᫨ [edx] 㪢, '_' -align 16 -isalnum: - push eax ebx - movzx eax,byte[edx] ;al=offset - shr eax,3 - lea ebx,[tab_all_num] - add ebx,eax - movzx ax,byte[edx] ;al=bit - and ax,111b - bt word[ebx],ax - pop ebx eax - ret - -;output: -; cf=1 ᫨ [edx] 㪢 '_' -align 16 -isalpha: - push eax ebx - movzx eax,byte[edx] ;al=offset - shr eax,3 - lea ebx,[tab_alpha] - add ebx,eax - movzx ax,byte[edx] ;al=bit - and ax,111b - bt word[ebx],ax - pop ebx eax - ret - -align 16 -proc ted_show_help_f1 uses eax edx edi, edit:dword - mov edi,[edit] - - call ted_get_pos_by_cursor - push edx - call ted_iterat_next_color_tag - mov eax,edx - pop edx - call ted_iterat_perv_color_tag - - cmp eax,ted_tex - jle @f - cmp edx,ted_tex_1 - jle @f - stdcall ted_find_help_id,eax - @@: - ;call ted_draw_main_cursor - call ted_draw_help_f1 - ret -endp - -;input: -; edx = position begin 'symbol' struct -; edi = pointer to tedit struct -; end_pos = position end 'symbol' struct -align 16 -proc ted_find_help_id uses ebx ecx, end_pos:dword -; ecx = word_n -; ebx = l_pos - mov ted_help_id,-1 - - movzx ebx,byte[edx] - shl ebx,2 ;ebx*=4 - add ebx,ted_arr_key_pos - mov ecx,[ebx] - cmp ecx,0 - jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ - push esi eax - mov ebx,ecx ;l_pos=word_n; - ColToIndexOffset ecx,esi - push cx - mov cl,[esi] - @@: - cmp ebx,ted_key_words_count ;while(l_posword_n - jle .wh_0e - dec ebx - ColToIndexOffset ebx,eax - inc ebx - cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) - je .wh_0e - dec ebx ;l_pos--; - jmp .wh_0b - .wh_0e: - - .wh_1b: - cmp ebx,ecx ;while(l_pos>word_n - jle .wh_1e - ColToIndexOffset ecx,eax - cmp byte[eax+esi],dl - je .wh_1e - inc ecx ;word_n++; - jmp .wh_1b - .wh_1e: - pop dx - - cmp ecx,ebx ;if(word_n==l_pos) break; - je @f - call ted_iterat_next ;pos++; - cmp edx,[end_pos] ;for(...;i y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - shl ecx,16 - add ecx,ted_rec_h - - mov edx,ted_color_wnd_work - call ted_sel_normalize - - mov esi,ted_scr_w - mov eax,[esi+sb_offs_position] - sub ted_seln_y0,eax - sub ted_seln_y1,eax - - mov eax,ted_cur_y - cmp eax,ted_seln_y0 - jl .no_cur_sel - cmp eax,ted_seln_y1 - jg .no_cur_sel - mov edx,ted_color_select ;塞 梥 䮭 梥 뤥 - mov esi,ted_scr_h - cmp eax,ted_seln_y0 - jne @f - mov eax,ted_cur_x - add eax,[esi+sb_offs_position] - cmp eax,ted_seln_x0 - jge @f - mov edx,ted_color_wnd_work - @@: - mov eax,ted_cur_y - cmp eax,ted_seln_y1 - jne .no_cur_sel - mov eax,ted_cur_x - add eax,[esi+sb_offs_position] - cmp eax,ted_seln_x1 - jl .no_cur_sel - mov edx,ted_color_wnd_work - .no_cur_sel: - mcall SF_DRAW_RECT - - call ted_get_pos_by_cursor ;६ ᨬ - cmp ted_gp_opt,2 - jne @f - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - call ted_get_symb_color - call ted_convert_invis_symb - mcall SF_DRAW_TEXT ;ᮢ ᨬ - @@: -popad - ret -endp - -;input: -; edx -> pointer to text -; edi -> 㪠⥫ tedit -;output: -; ecx = color -; if ted_mode_color=0 then ecx=ted_color_wnd_text -align 16 -ted_get_symb_color: - mov ecx,ted_color_wnd_text ; 梥 ⥪ 㬮砭 - - push eax edx - cmp ted_mode_color,0 - je .exit - jmp .on_first - @@: - call ted_iterat_perv - cmp edx,ted_tex_1 - jle .exit - .on_first: - movzx eax,byte[edx+1] - or eax,eax ;᫨ al=0 梥 - jz @b - - cmp eax,ted_colors_text_count - jge .exit - - mov ecx,ted_text_colors ;ਡ塞 ᬥ饭 1- 梥 - lea ecx,[ecx+4*eax] - mov ecx,[ecx] ;⠭ ⥪騩 梥 ⥪ ᬥ饭 - .exit: - or ecx,ted_font_size - pop edx eax - ret - -;input: -; edx = pointer to text -; edi = pointer to tedit struct -;description: -; 㭪 ८ࠧ ᨬ ⠥ ࠭ -align 16 -ted_convert_invis_symb: - cmp ted_mode_invis,1 - jne .else - cmp byte[edx],9 - jne @f - lea edx,[ted_symbol_tab] - jmp .end_f -align 4 - @@: - cmp byte[edx],13 - jne @f - mov edx,edi - add edx,ted_offs_symbol_new_line - @@: - jmp .end_f -align 4 - .else: - cmp byte[edx],9 - je @f - cmp byte[edx],13 - jne .end_f - @@: - lea edx,[ted_symbol_space] - .end_f: - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_scroll_set_redraw: - push eax - mov eax,ted_scr_w - mov dword[eax+sb_offs_redraw],1 - mov eax,ted_scr_h - mov dword[eax+sb_offs_redraw],1 - pop eax - ret - -align 16 -proc ted_draw, edit:dword - locals - line_num dd ? - endl - pushad - mov edi,[edit] - - mov eax,SF_DRAW_TEXT - mov ecx,ted_text_colors - mov ecx,[ecx] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,ted_rec_t - add ebx,0x10001 ;塞 ࠢ 㪢 業 - - call ted_sel_normalize ;need before draw select - mov esi,ted_scr_w - mov esi,[esi+sb_offs_position] - mov [line_num],esi - - stdcall ted_clear_line_before_draw, edi,ebx,1,esi - call ted_get_first_visible_pos - or edx,edx - jz .no_draw_text - mov esi,1 ; 뢮 ⥪ 1- ᨬ - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** 梥⮢ ࠧ⪠ - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call ted_get_symb_color - .no_col_change: - - cmp byte[edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_invis - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - .no_invis: - add ebx,ted_rec_h - ;optimized output \/ - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp bx,ax - jg .no_draw_text - mov eax,SF_DRAW_TEXT - ;optimized output /\ - and ebx,0xffff - ror ebx,16 - add ebx,ted_wnd_l - add ebx,ted_rec_l - inc ebx - ror ebx,16 - inc dword[line_num] ;increment line number - stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] - call ted_opt_draw_line_left - jmp @b -align 4 - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov esi,ted_wnd_l - add esi,ted_wnd_w - cmp bx,si - jl .no_opt - call ted_opt_draw_line_right - .no_opt: - mov si,1 - ror ebx,16 - jmp @b - .no_draw_text: - - inc dword[line_num] - stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] - call ted_draw_line_numbers - call ted_draw_main_cursor - -;--------------------------------------------- -; set all_redraw flag for draw all ScrollBar -; In some cases it is necessity to draw only the area -; of moving of a "runner", for acceleration of output - -; in this case the flag needs to be reset to 0 (zero). - mov eax,ted_scr_h - mov esi,ted_scr_w - mov dword[eax+sb_offs_all_redraw],1 - mov dword[esi+sb_offs_all_redraw],1 - -; ᮢ ப⪨ - stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] - stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] -; reset all_redraw flag - mov dword[eax+sb_offs_all_redraw],0 - mov dword[esi+sb_offs_all_redraw],0 -;--------------------------------------------- - - ;left-bottom square - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,ted_wnd_h - shl ecx,16 - mov cx,word[eax+sb_offs_size_y] - inc cx - mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] - - ;right-bottom square - mov ebx,ted_wnd_l - add ebx,ted_wnd_w - shl ebx,16 - mov bx,word[esi+sb_offs_size_x] - inc bx - int 0x40 - - cmp ted_fun_draw_panels,0 - je @f - stdcall ted_fun_draw_panels, edi - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_main_cursor -pushad - mov eax,SF_DRAW_RECT ;draw cursor - mov ecx,ted_wnd_t ;calc rect -> y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - - shl ecx,16 - add ecx,ted_rec_h - - mov ebx,ted_wnd_l ;calc rect -> x0,x1 - add ebx,ted_rec_l - mov edx,ted_cur_x - imul edx,ted_rec_w - add ebx,edx - shl ebx,16 - add ebx,ted_rec_w - cmp ted_cur_ins,1 ;஢ઠ ० ࠡ ( ⠢) - jne @f - shr bx,2 ;㬥蠥 ਭ - @@: - - mov edx,ted_color_cursor - int 0x40 ;뢮 - - call ted_get_pos_by_cursor - cmp ted_gp_opt,2 - jne @f - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - mov ecx,ted_color_cur_text - or ecx,ted_font_size - call ted_convert_invis_symb - mcall SF_DRAW_TEXT - @@: - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - lea edx,[txtRow] - mcall SF_DRAW_TEXT ;뢮 'ப' - - add ebx,0x500000 - lea edx,[txtCol] - int 0x40 ;뢮 '' - - cmp ted_tim_undo,0 - je @f - add ebx,0x500000 - lea edx,[txtOtm] - int 0x40 - sub ebx,0x500000 - @@: - - call ted_draw_buffer - call ted_draw_help_f1 - - mov eax,47 ;draw cursor coords - mov esi,ted_color_wnd_bord - or esi,0x40000000 - - mov edx,ebx - ror edx,16 - sub edx,35 - ror edx,16 - ;add edx,3 - mov ebx,0x40000 ;Row=... - mov ecx,ted_scr_w - mov ecx,[ecx+sb_offs_position] - add ecx,ted_cur_y - inc ecx - -push edi - mov edi,ted_color_wnd_work - int 0x40 ;뢮 ᫠ ⥪饩 ப -pop edi - - ;mov ebx,0x40000 ;Col=... - mov ecx,ted_scr_h - mov ecx,[ecx+sb_offs_position] - add ecx,ted_cur_x - inc ecx - add edx,0x500000 -push edi - mov edi,ted_color_wnd_work - int 0x40 ;뢮 ᫠ -pop edi - - cmp ted_tim_undo,0 - je @f - mov ecx,ted_tim_undo - add edx,0x500000 - mov edi,ted_color_wnd_work ;⨬ ॣ edi, 㭪樨 㦥 - int 0x40 ;뢮 ᫠ ⬥ ⢨ - @@: - -popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_buffer - pushad - - mov eax,ted_buffer - cmp dword[eax],1 ;ᬮਬ ࠧ - jl @f - mov ebx,ted_rec_l - add bx,300 - cmp ebx,ted_wnd_w ;ࠢ न 뢮 ⥪ - jge @f ; - - add ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x40000000 - - mov edx,ted_buffer - add edx,12 - mov esi,edx - mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit - call tl_strlen - ;cmp eax,0 ; - ;je @f - cmp eax,20 - jle .crop_buf - mov eax,20 ;१ 20 ᨬ - .crop_buf: - mov esi,eax - mcall SF_DRAW_TEXT ;뢮 ᮤন - - sub ebx,50 shl 16 - lea edx,[txtBuf] - mov esi,edx - call tl_strlen - mov esi,eax - xor ecx,0x40000000 ;㡨ࠥ 梥 䮭 - mcall SF_DRAW_TEXT ;뢮 - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_help_f1 - pushad - cmp ted_rec_t,13 ;쭠 ᮢ ࠢ - jle @f - ;clear place before draw help - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w - sub ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,13 - shl ecx,16 - add ecx,9 ;9 - 0- , ⠢ ted_rec_h ࠭ - mcall SF_DRAW_RECT,,,ted_color_wnd_capt - - cmp ted_help_id,-1 - je @f - mov eax,ted_help_id - ColToIndexOffset eax,edx - - ;SetCoordinates - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,13 ;=3+10 - - ;SetTextColor - movzx eax,byte[edx+MAX_COLOR_WORD_LEN+7] - shl eax,2 - mov ecx,ted_text_colors - add ecx,eax - mov ecx,[ecx] - or ecx,0xc0000000 ;SetTextStyles - mov esi,edi - mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work - mov edi,esi - - mov esi,edx - call tl_strlen - - ;*** draw help string *** - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - mov edx,[edx+MAX_COLOR_WORD_LEN] - or edx,edx - jz @f - add edx,ted_help_text_f1 - inc eax - imul eax,6 ;ਭ ᨬ . - shl eax,16 - add ebx,eax - mcall SF_DRAW_TEXT - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 16 -proc ted_draw_line_numbers -pushad - ;top panel with caption - mov ebx,ted_wnd_l - ;add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w - ;sub ebx,ted_rec_l - mov edx,ted_color_wnd_work - mov ecx,ted_wnd_t - shl ecx,16 - add ecx,ted_rec_t - mov edx,ted_color_wnd_capt - mcall SF_DRAW_RECT - - ;line numbers - mov ebx,0x40000 ;format - mov ecx,ted_scr_w - mov ecx,[ecx+sb_offs_position] - inc ecx - mov edx,3 - add edx,ted_wnd_l - rol edx,16 - add edx,ted_wnd_t - add edx,ted_rec_t - @@: - -push ebx ecx edx - ;left panel with numbers - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_rec_h - rol ecx,16 - mov cx,dx - rol ecx,16 - mov edx,ted_color_wnd_capt - mcall SF_DRAW_RECT ;㥬 אַ㣮쭨 ஬ ப -pop edx ecx ebx - - mov esi,ted_color_wnd_bord - mcall SF_DRAW_NUMBER ;㥬 ப - inc ecx - add edx,ted_rec_h - sub edx,ted_wnd_t - mov esi,edx - and esi,0xffff - cmp esi,ted_wnd_h - jge @f - add edx,ted_wnd_t - jmp @b -align 4 - @@: -popad - ret -endp - -;output: -; ah = symbol -align 16 -proc KeyConvertToASCII uses ebx, table:dword - mov ebx,[table] ;convert scan to ascii - shr ax,8 - add bx,ax ;? ebx,eax - mov ah,byte[ebx] - ret -endp - -align 16 -proc ted_draw_cur_line, edit:dword -pushad - mov edi,[edit] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - mov eax,ted_cur_y - imul eax,ted_rec_h - mov bx,ax - add ebx,ted_wnd_t - add ebx,ted_rec_t ;ebx - न אַ㣮쭨 ⪨ - add ebx,0x10001 ;塞 ࠢ 㪢 業 - - call ted_sel_normalize ;need before draw select - mov ecx,ted_cur_y - mov eax,ted_scr_w - add ecx,[eax+sb_offs_position] - stdcall ted_clear_line_before_draw,edi,ebx,1,ecx - - mov eax,ted_scr_h - mov esi,[eax+sb_offs_position] - call ted_get_pos_by_coords - - cmp ted_gp_opt,2 - jne .no_draw_text - call ted_get_symb_color - mov esi,1 ;draw 1 symbol - @@: - ;call ted_iterat_next - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** 梥⮢ ࠧ⪠ - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call ted_get_symb_color - .no_col_change: - - mov eax,SF_DRAW_TEXT - cmp byte [edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_draw_text - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - jmp .no_draw_text -align 4 - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov eax,ted_wnd_w - add eax,ted_wnd_l ;ax = x - cmp bx,ax - jge .no_draw_text ;Opt - ror ebx,16 - call ted_iterat_next - jmp @b -align 4 - .no_draw_text: - - call ted_draw_main_cursor -popad - ret -endp - -;input: -; clear_o - ᫨ =1 ப, =0 ப -align 16 -proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword - pushad - mov edi,[edit] - mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line - mov esi,[numb_lin] ;esi - number text line - - sub ebx,0x10001 ;⭨ ࠢ 㪢 業 - cmp dword[clear_o],0 - jne @f - add ebx,ted_rec_h - ror ebx,16 - xor bx,bx - add ebx,ted_wnd_l - add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l - ror ebx,16 - @@: - - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp ax,bx - jl .no_clear - sub ax,bx - - mov cx,bx - shl ecx,16 - - xor bx,bx - add ebx,ted_wnd_w - sub ebx,ted_rec_l - xor cx,cx - add ecx,ted_rec_h - mov edx,ted_color_wnd_work - - cmp dword[clear_o],0 - je .pusto - cmp ax,cx - jge @f - .pusto: - mov cx,ax - jmp .no_select ;᫨ ⪠ , ᥣ 䮭 梥⮬ - @@: - - call ted_is_select - or al,al - jz .no_select - cmp ted_seln_y0,esi - jg .no_select - cmp ted_seln_y1,esi - jl .no_select - mov edx,ted_color_select ;draw selected line - .no_select: - - mcall SF_DRAW_RECT ;᪠ ப 梥⮬ 䮭 梥⮬ 뤥 - - call ted_is_select - or al,al - jz .no_clear - - mov al,SF_DRAW_RECT - xor cx,cx - add ecx,ted_rec_h - cmp ted_seln_y0,esi - jne @f - push bx esi - mov edx,ted_seln_x0 ; (ࠥ ᫥) - mov esi,ted_scr_h - cmp edx,[esi+sb_offs_position] - jle .in_wnd - sub edx,[esi+sb_offs_position] - imul edx,ted_rec_w - mov bx,dx - jmp .no_wnd - .in_wnd: - xor bx,bx - .no_wnd: - mov edx,ted_color_wnd_work - int 0x40 - pop esi bx - @@: - cmp ted_seln_y1,esi - jne @f - ;push esi - ;᫨ 뤥 䠩 ᤥ 室, ⮣ 㦭 jmp .no_select - mov edx,ted_seln_x1 ; (ࠥ ࠢ) - mov esi,ted_scr_h - cmp edx,[esi+sb_offs_position] - jle .in_wnd2 - sub edx,[esi+sb_offs_position] - imul edx,ted_rec_w - sub bx,dx - shl edx,16 - add ebx,edx - .in_wnd2: - mov edx,ted_color_wnd_work - int 0x40 - ;pop esi - @@: - - .no_clear: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -;output: -; ecx = 梥 ᨬ -; edx = pointer to symbol -; edx = 0 if text not in screen -align 16 -ted_get_first_visible_pos: - push eax ecx - mov eax,ted_scr_w - mov edx,ted_tex - xor ecx,ecx - @@: - cmp ecx,[eax+sb_offs_position] - je @f - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - jne @b - inc ecx - jmp @b -align 4 - @@: - - cmp ecx,[eax+sb_offs_position] - je @f - xor edx,edx - @@: - cmp ecx,[eax+sb_offs_max_area] - jle @f - mov [eax+sb_offs_max_area],ecx - @@: - pop ecx eax - call ted_opt_draw_line_left - ret - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; ecx = 梥 ᨬ -; edx = 㪠⥫ ᨬ -;description: -; 㭪 㦭 ⨬樨 뢮 ⥪ -align 16 -proc ted_opt_draw_line_left uses ebx - mov ebx,ted_scr_h - mov ebx,[ebx+sb_offs_position] - or ebx,ebx - jz .ret_f - push eax - mov eax,edx - - cmp edx,ted_tex - jne @f - call ted_iterat_next - jmp .beg_cycle - @@: - - or ebx,ebx - jz @f - - cmp byte[edx],13 - jne @f - call ted_iterat_next - .beg_cycle: - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - or ebx,ebx - jz @f -;-------------------------------------- -;eax 㤥 -movzx eax,byte[edx+1] -or eax,eax -jz .no_color -cmp eax,ted_colors_text_count -jge .no_color - movzx ecx,byte[edx+1] - shl ecx,2 - add ecx,ted_text_colors - mov ecx,[ecx] -.no_color: -;-------------------------------------- - mov eax,edx - call ted_iterat_next - dec ebx - jmp @b -align 4 - @@: - mov edx,eax - pop eax - .ret_f: - call ted_get_symb_color - ret -endp - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; ecx = symbol color -; edx = pointer to 13 symbol -;description: -; 㭪 㦭 ⨬樨 뢮 ⥪ -align 16 -proc ted_opt_draw_line_right uses eax - mov eax,edx - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - mov eax,edx - call ted_iterat_next - jmp @b - @@: - mov edx,eax ;perv sumbol - call ted_get_symb_color - ret -endp - -align 16 -proc ted_mouse, edit:dword - pushad - mov edi,[edit] - - ;ࠡ뢠 ஫ - mov edx,ted_scr_h - mov ecx,ted_scr_w - - cmp word[edx+sb_offs_delta2],0 - jne .horizontal - - mov eax,[ecx+sb_offs_max_area] - cmp eax,[ecx+sb_offs_cur_area] - jbe .horizontal - ; mouse event for Vertical ScrollBar - stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] - cmp dword[ecx+sb_offs_redraw],0 - je @f - mov dword[ecx+sb_offs_redraw],0 - stdcall ted_draw,edi - jmp .no_in_wnd - @@: - cmp word[ecx+sb_offs_delta2],0 - jne .no_in_wnd - .horizontal: - mov eax,[edx+sb_offs_max_area] - cmp eax,[edx+sb_offs_cur_area] - jbe .other - ; mouse event for Horizontal ScrollBar - stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] - cmp dword[edx+sb_offs_redraw],0 - je .other - mov dword[edx+sb_offs_redraw],0 - stdcall ted_draw,edi - jmp .no_in_wnd - .other: - cmp word[ecx+sb_offs_delta2],0 - jne .no_in_wnd - cmp word[edx+sb_offs_delta2],0 - jne .no_in_wnd - - ;ࠡ뢠 । - mcall SF_MOUSE_GET,SSF_BUTTON - cmp al,1 - jne @f - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,ted_wnd_t - add ebx,ted_rec_t - cmp ax,bx - jl @f ;y_mousey_wnd - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - mov ecx,eax - shr ecx,16 - cmp cx,bx - jl @f ;x_mousex_wnd - - call ted_draw_cursor_sumb - call ted_wnd_main_click - jmp .no_in_wnd - @@: - mov edx,ted_el_focus - cmp [edx],edi - jne @f - call ted_wnd_main_mouse_scroll ;ᬮਬ ப - @@: - cmp ted_drag_m,0 - je .no_in_wnd - mov ted_drag_m,0 - stdcall ted_draw,edi - cmp ted_fun_draw_panel_buttons,0 - je .no_in_wnd - call ted_fun_draw_panel_buttons - .no_in_wnd: - popad - ret -endp - -;input: -; eax -> (x,y) -; edi -> 㪠⥫ tedit -;description: -; 㭪 뢥 ⨨ ஬ । -align 16 -ted_wnd_main_click: - push ebx ecx edx - mov ebx,ted_el_focus - mov [ebx],edi ;⠢ 䮪 - - push eax - shr eax,16 - sub eax,ted_wnd_l - sub eax,ted_rec_l - - xor edx,edx - mov ecx,ted_rec_w - div cx - ;inc eax - mov ebx,ted_scr_h - cmp eax,[ebx+sb_offs_cur_area] - jle @f - mov eax,[ebx+sb_offs_cur_area] - @@: - ;dec eax - mov ted_cur_x,eax - pop eax - - push eax - and eax,0xffff - sub eax,ted_wnd_t - sub eax,ted_rec_t - - xor edx,edx - mov ecx,ted_rec_h - div cx - inc eax - mov ebx,ted_scr_w - cmp eax,[ebx+sb_offs_cur_area] - jle @f - mov eax,[ebx+sb_offs_cur_area] - @@: - dec eax - mov ted_cur_y,eax - pop eax - - cmp ted_drag_m,0 - je @f - call ted_sel_move - jmp .sel_move - @@: - mov ted_drag_m,1 - call ted_sel_start - .sel_move: - pop edx ecx ebx - ret - -;input: -; edi = pointer to tedit struct -align 16 -ted_wnd_main_mouse_scroll: - push eax ebx ecx - mcall SF_MOUSE_GET,SSF_SCROLL_DATA - or ax,ax - jz .no_scroll - mov ecx,ted_scr_w - movsx eax,ax - lea eax,[eax+eax*2] ;㬭 3 (᫮ ப ப⪨ ) - add eax,[ecx+sb_offs_position] - mov ebx,[ecx+sb_offs_max_area] - shl ebx,1 - sub ebx,[ecx+sb_offs_cur_area] ;⭨ - shr ebx,1 - cmp eax,ebx - jae .no_scroll - mov ebx,ted_cur_y ; - sub ebx,eax ;- ஫ - add ebx,[ecx+sb_offs_position] ;+ ஫ - bt ebx,31 - jnc @f - xor ebx,ebx ;᫨ ⠫ , ⠢ ப - @@: - inc ebx - cmp ebx,[ecx+sb_offs_cur_area] - jle @f - mov ebx,[ecx+sb_offs_cur_area] ;᫨ ⠫ , ⠢ ப - @@: - dec ebx - mov ted_cur_y,ebx - mov [ecx+sb_offs_position],eax - stdcall ted_draw,edi - .no_scroll: - pop ecx ebx eax - ret - -align 16 -proc ted_save_file, edit:dword, file:dword, f_name:dword -pushad - mov edi,[edit] - - stdcall ted_can_save,edi - ;or al,al - ;jz .no_save - - mov ecx,ted_max_chars - invoke mem.alloc,ecx - push eax ; 㪠⥫ 뤥 - - mov edx,ted_tex - xor ecx,ecx - @@: - call ted_iterat_next - cmp edx,ted_tex_1 - jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol - mov bl,[edx] - mov byte[eax],bl - inc eax - inc ecx - jmp @b -align 4 - @@: - - or ecx,ecx - jz @f - mov ebx,[file] - pop eax ;뢠 㪠⥫ 뤥 - mov [ebx+16],eax - push eax ;⭮ 㪠⥫ 뤥 - mov dword[ebx], SSF_CREATE_FILE - mov dword[ebx+4], 0 - mov dword[ebx+8], 0 - mov [ebx+12], ecx - mov byte[ebx+20], 0 - push dword[f_name] - pop dword[ebx+21] - mcall SF_FILE - - mov ted_err_save,al - - or eax,eax - jz .no_msg - cmp ax,10 - jl .zifra_0_9 - mov al,'?' - sub ax,48 - .zifra_0_9: - add ax,48 - cmp ted_fun_save_err,0 - je @f - call ted_fun_save_err - jmp @f - .no_msg: - m2m ted_tim_ls,ted_tim_ch - @@: - - pop ecx ;뢠 㪠⥫ 뤥 - invoke mem.free,ecx - .no_save: -popad - ret -endp +; ⥬ ⥪ box_lib.obj +; TextEditor KolibriOS +; 䠩 ᫥ ࠧ 12.01.2021 IgorA +; ਬ GPL2 業 + +;input: +; edi = pointer to tedit struct +; reg = index +;output: +; reg = pointer to 'tex' struct +macro ConvertIndexToPointer reg { + imul reg,sizeof.symbol + add reg,ted_tex +} + +;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- +macro ColToIndexOffset ind_reg,out_reg { + mov out_reg,ind_reg + imul out_reg,sizeof.TexColViv + add out_reg,ted_key_words_data +} + +TED_LINES_IN_NEW_FILE equ 30 ;᫮ ப 䠩 +MAX_COLOR_WORD_LEN equ 40 +;------------------------------------------------------------------------------ +struct TexSelect + x0 dd ? + y0 dd ? + x1 dd ? + y1 dd ? +ends + +struct TexColViv + Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ + f1 dd 0 ; ࠢ ᫮ + flags db ? ; f1+4 䫠 ᯮ㥬 뤥 + endc db ? ; f1+5 ᨬ 뤥 (ᯮ flags&4) + escc db ? ; f1+6 ࠭騩 ᨬ (ᯮ flags&4) + color db ? ; f1+7 梥 +ends + +struct symbol + c db ? ; +0 ᨬ + col db ? ; +1 梥 + perv dd ? ; +2 + next dd ? ; +6 㪠⥫ + tc dd ? ; +10 ६. ᮧ + td dd ? ; +14 ६. 㤠 +ends +;------------------------------------------------------------------------------ + +ted_symbol_space db 32 ;ascii ஡, 뢠 㦥 +ted_symbol_tab db 26 ;ascii ५ ࠢ, ᯮ ᮢ ⠡樨 ० ᨬ + +if lang eq ru_RU + txtRow db 'ப',0 + txtCol db '',0 + txtOtm db '⬥',0 + txtBuf db ':',0 +else ; Default to en_US + txtRow db 'Rows',0 + txtCol db 'Cols',0 + txtOtm db 'Undo',0 + txtBuf db 'Buffer:',0 +end if + +;EvChar - ⠡ 䨫஢ 塞 ᨬ, - 譨 +align 16 +EvChar db 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +KM_SHIFT equ 0x00010000 +KM_CTRL equ 0x00020000 +KM_ALT equ 0x00040000 +KM_NUMLOCK equ 0x00080000 + +; KEY CODES +KEY_F1 equ 0x0000003B +KEY_F2 equ 0x0000003C +KEY_F3 equ 0x0000003D + + + +align 16 +proc ted_init uses eax ecx edi, edit:dword + mov edi,[edit] + + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + invoke mem.alloc,ecx ;뤥塞 + mov ted_tex,eax + mov ted_tex_1,eax + add ted_tex_1,sizeof.symbol + add eax,ecx + mov ted_tex_end,eax + + stdcall ted_clear, edi,1 + +;------------------------------------------------- + mov ecx,1024 ;1024 - ᨢ ted_arr_key_pos + add ecx,ted_syntax_file_size + invoke mem.alloc,ecx + mov ted_arr_key_pos,eax + add eax,1024 + mov ted_syntax_file,eax + + stdcall ted_init_scroll_bars,edi,3 + ret +endp + +MIN_W_SCRL_ARE equ 3 ;쭠 ⮡ࠦ . ஫ +MIN_H_SCRL_ARE equ 3 ;쭠 ⮡ࠦ ਧ. ஫ +;input: +; opt = 1 - 梥 ஫, 2 - ࠧ , +; 4 - ࠧ 㬥 +align 16 +proc ted_init_scroll_bars, edit:dword, opt:dword + pushad + mov edi,[edit] + mov esi,ted_scr_w + mov ebx,ted_scr_h + bt dword[opt],0 + jae @f + mov ecx,ted_color_wnd_work + mov dword[esi+sb_offs_bckg_col],ecx + mov dword[ebx+sb_offs_bckg_col],ecx + mov ecx,ted_color_wnd_capt + mov dword[esi+sb_offs_frnt_col],ecx + mov dword[ebx+sb_offs_frnt_col],ecx + mov ecx,ted_color_wnd_bord + mov dword[esi+sb_offs_line_col],ecx + mov dword[ebx+sb_offs_line_col],ecx + @@: + bt dword[opt],2 ; ࠧ 㬥 ? + jae .doc_resize + call ted_get_num_lines + cmp eax,TED_LINES_IN_NEW_FILE + jge @f + mov eax,TED_LINES_IN_NEW_FILE + @@: + mov dword[esi+sb_offs_max_area],eax + .doc_resize: + bt dword[opt],1 ; ࠧ ? + jae .no_size + mov edx,ted_wnd_l + add edx,ted_rec_l + mov word[ebx+sb_offs_start_x],dx ;⠢塞 ਧ. ஫ + mov eax,ted_wnd_h ;calculate lines in page + mov edx,ted_wnd_t + add edx,eax + mov word[ebx+sb_offs_start_y],dx ;⠢塞 孨 ਧ. ஫ + sub eax,ted_rec_t + xor edx,edx + mov ecx,ted_rec_h + div ecx + cmp eax,MIN_W_SCRL_ARE + jg @f + mov eax,MIN_W_SCRL_ARE + @@: + mov dword[esi+sb_offs_cur_area],eax + + mov eax,ted_wnd_w ;calculate cols in page + mov edx,ted_wnd_l ; + add edx,eax ;塞 ਭ + mov word[esi+sb_offs_start_x],dx ;⠢塞 . ஫ + mov edx,ted_wnd_t + mov word[esi+sb_offs_start_y],dx ;⠢塞 孨 . ஫ + mov edx,ted_wnd_h + mov word[esi+sb_offs_size_y],dx ;⠢塞 . ஫ + sub eax,ted_rec_l + mov word[ebx+sb_offs_size_x],ax ;⠢塞 ਭ ਧ. ஫ + xor edx,edx + mov ecx,ted_rec_w + div ecx + cmp eax,MIN_H_SCRL_ARE + jg @f + mov eax,MIN_H_SCRL_ARE + @@: + dec eax + mov dword[ebx+sb_offs_cur_area],eax ;⠭ ᫮ ᨬ, ࠭ ਧ. ஫ + .no_size: + popad + ret +endp + +align 16 +proc ted_delete uses edi, edit:dword + mov edi,[edit] + invoke mem.free,ted_tex + invoke mem.free,ted_arr_key_pos ;ted_syntax_file + ret +endp + + +;input: +; eax = key kodes +align 16 +proc ted_key, edit:dword, table:dword, control:dword + pushad + mov edi,[edit] + mov esi,ted_el_focus + cmp dword[esi],edi + jne .end_key_fun ; 䮪 室 㭪樨 + mov esi,dword[control] + + cmp ah,KEY_F1 ;[F1] + jne @f + stdcall ted_show_help_f1,edi + jmp .end_key_fun + @@: + cmp ah,KEY_F3 ;[F3] + jne @f + stdcall ted_but_find,edi,0 + jmp .end_key_fun + @@: + + test esi,KM_CTRL ;Ctrl+... + jz .key_Ctrl + ; *** 맮 譨 㭪権 ॡ /࠭/᪠/... + cmp ted_fun_on_key_ctrl_all,0 + je .end0 + xor al,al + cmp ah,24 ;Ctrl+O + jne @f + mov al,'O' + @@: + cmp ah,31 ;Ctrl+S + jne @f + mov al,'S' + @@: + cmp ah,33 ;Ctrl+F + jne @f + mov al,'F' + @@: + cmp ah,34 ;Ctrl+G + jne @f + mov al,'G' + @@: + cmp ah,35 ;Ctrl+H + jne @f + mov al,'H' + @@: + cmp ah,49 ;Ctrl+N + jne @f + mov al,'N' + @@: + or al,al + jz .end0 + and eax,0xff + test esi,KM_SHIFT + jz @f + or eax,0x100 + @@: + stdcall ted_fun_on_key_ctrl_all, eax + jmp .end_key_fun + .end0: + + ; *** 맮 ७ 㭪権 + cmp ah,30 ;Ctrl+A + jne @f + call ted_sel_all + @@: + cmp ah,44 ;Ctrl+Z + jne @f + stdcall ted_but_undo,edi + @@: + cmp ah,45 ;Ctrl+X + jne @f + stdcall ted_but_cut,edi + @@: + cmp ah,46 ;Ctrl+C + jne @f + stdcall ted_but_copy,edi + @@: + cmp ah,47 ;Ctrl+V + jne @f + stdcall ted_but_paste,edi + @@: + cmp ah,199 ;Ctrl+Home + jne @f + call ted_key_ctrl_home + @@: + cmp ah,207 ;Ctrl+End + jne @f + call ted_key_ctrl_end + @@: + jmp .end_key_fun + .key_Ctrl: + + test esi,KM_SHIFT ;Shift+... + jz .key_Shift + cmp ah,72 ;Shift+Up + jne @f + call ted_sel_key_up + @@: + cmp ah,75 ;Shift+Left + jne @f + call ted_sel_key_left + @@: + cmp ah,77 ;Shift+Right + jne @f + call ted_sel_key_right + @@: + cmp ah,80 ;Shift+Down + jne @f + call ted_sel_key_down + @@: + ;mov ted_drag_k,1 ;稭 뤥 + jmp .key_MoveCur + .key_Shift: +;------------------------------------------------- + cmp ah,72 ;178 ;Up + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_up + cmp dl,8 + jne .no_red_0 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_0: + call ted_sel_end + @@: + cmp ah,80 ;177 ;Down + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_down + cmp dl,8 + jne .no_red_1 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_1: + call ted_sel_end + @@: + cmp ah,75 ;176 ;Left + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_left + cmp dl,8 + jne .no_red_2 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_2: + call ted_sel_end + @@: + cmp ah,77 ;179 ;Right + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_right + cmp dl,8 + jne .no_red_3 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_3: + call ted_sel_end + @@: + cmp ah,71 ;180 ;Home + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_first_char + cmp dl,8 + jne .no_red_4 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_4: + call ted_sel_end + @@: + cmp ah,79 ;181 ;End + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_last_char + cmp dl,8 + jne .no_red_5 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_5: + call ted_sel_end + @@: + cmp ah,73 ;184 ;PageUp + jne @f + call ted_cur_move_page_up + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,81 ;183 ;PageDown + jne @f + call ted_cur_move_page_down + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + mov ted_drag_k,0 ;稢 뤥 + @@: +;------------------------------------------------- + .key_MoveCur: + + ; ய᪠ 㦥 , ᨬ + cmp ah,42 ;[L Shift] 㣨 + je .end_key_fun + cmp ah,54 ;[R Shift] 㣨 + je .end_key_fun + cmp ah,58 ;[Caps Lock] + je .end_key_fun + cmp ah,69 ;[Pause Break] + je .end_key_fun + cmp ah,120 ;[Fn] + je .end_key_fun + cmp ah,0x80 ;if key up + ja .end_key_fun + + cmp dword[table],0 + je @f + stdcall KeyConvertToASCII, [table] + @@: + + ;mov ted_drag_k,0 ;稢 뤥 + + lea edx,[EvChar] ;६ ⠡ ⨬묨 ᨬ + add dl,ah + jae @f + add edx,0x100 ;᫨ 뫮 ९ ᨬ + @@: + cmp byte[edx],1 + jne @f + mov ted_key_new,ah + call ted_set_undo + mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor + stdcall ted_sel_text_del,edx + cmp al,1 + jne .del + mov edx,ted_opt_ed_move_cursor + .del: + cmp ted_cur_ins,1 + je .no_ins_mod + stdcall ted_text_del,edi,ted_opt_ed_change_time + mov edx,ted_opt_ed_move_cursor + .no_ins_mod: + mov ecx,edi + add ecx,ted_offs_key_new + stdcall ted_text_add,edi,ecx,1,edx ;塞 ᨬ + cmp ted_key_new,13 + jne .dr_m_win + ;᫨ ⠢ ᨬ ப + mov ecx,ted_scr_w + inc dword[ecx+sb_offs_max_area] ;㢥稢 ࠧ ⨪쭮 ஫ + mov edx,ted_cur_y + cmp edx,[ecx+sb_offs_cur_area] + jl .no_change + dec ted_cur_y ; ⠢塞 + inc dword[ecx+sb_offs_position] ;ᤢ 㭮 + .no_change: + stdcall ted_draw,edi + jmp .dr_cur_l + .dr_m_win: + stdcall ted_draw_cur_line,edi + .dr_cur_l: + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + + cmp ah,8 ;[<-] + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_b + stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor + .del_one_b: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun +align 4 + @@: + + cmp ah,182 ;Delete + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_d + stdcall ted_text_del,edi,ted_opt_ed_change_time + .del_one_d: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun + @@: + + cmp ah,185 ;Ins + jne @f + call ted_draw_cursor_sumb + xor ted_cur_ins,1 + call ted_draw_main_cursor + @@: + + .end_key_fun: + popad + ret +endp + +;output: +; al = 1 - can save +align 16 +proc ted_can_save uses ecx edi, edit:dword + mov edi,[edit] + + mov ecx,ted_tim_ch + sub ecx,ted_tim_undo + mov al,1 + cmp ted_tim_ls,ecx + jne @f + dec al + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; al = 1 - selected +align 16 +proc ted_is_select uses ebx + xor al,al + cmp ted_drag_m,1 + je @f + inc al + mov ebx,ted_sel_x0 + cmp ebx,ted_sel_x1 + jne @f + mov ebx,ted_sel_y0 + cmp ebx,ted_sel_y1 + jne @f + xor al,al + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_sel_normalize uses ecx esi + push edi + mov esi,edi + add esi,ted_offs_sel + add edi,ted_offs_seln + mov ecx,sizeof.TexSelect/4 + rep movsd + pop edi + + jmp @f + .swp_f: + mov ecx,ted_seln_x0 + m2m ted_seln_x0,ted_seln_x1 + mov ted_seln_x1,ecx + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jle .end_f + m2m ted_seln_y0,ted_seln_y1 + mov ted_seln_y1,ecx + + jmp .end_f +align 4 + @@: + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jg .swp_f + + cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) + jne .end_f + mov ecx,ted_seln_x0 + cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) + jg .swp_f + + .end_f: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 砫 뤥 +align 16 +proc ted_sel_start uses eax ecx + mov eax,ted_scr_h + mov ecx,ted_cur_x + add ecx,[eax+sb_offs_position] + mov ted_sel_x0,ecx + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,[eax+sb_offs_position] + mov ted_sel_y0,ecx + mov ted_sel_y1,ecx + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ⨨ 뤥 +align 16 +proc ted_sel_end uses eax + mov ted_drag_k,0 ;稢 뤥 + call ted_is_select + or al,al + jz @f + xor eax,eax + mov ted_sel_x0,eax + mov ted_sel_x1,eax + mov ted_sel_y0,eax + mov ted_sel_y1,eax + stdcall ted_draw,edi + jmp .end_f + @@: + call ted_draw_main_cursor + .end_f: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ६饭 뤥 +align 16 +proc ted_sel_move + push eax ecx + mov ecx,ted_cur_x + mov eax,ted_scr_h + add ecx,[eax+sb_offs_position] + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,[eax+sb_offs_position] + mov ted_sel_y1,ecx + pop ecx eax + cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 뤥 ᥣ 㬥 +align 16 +proc ted_sel_all + push eax + xor eax,eax + mov ted_sel_x0,eax + mov ted_sel_y0,eax + + mov ted_sel_x1,eax ;??? + call ted_get_num_lines + mov ted_sel_y1,eax + pop eax + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; cl_al_mem = 1 - clear all memory +align 16 +proc ted_clear uses ecx edi, edit:dword, cl_al_mem:dword + mov edi,[edit] + + mov ted_cur_x,0 + mov ted_cur_y,0 + mov ted_tim_ch,0 + mov ted_tim_ls,0 + mov ted_tim_co,0 + mov ted_tim_undo,0 + mov ted_help_id,-1 + mov ecx,sizeof.symbol + shl ecx,1 + add ecx,ted_tex + mov ted_ptr_free_symb,ecx + + mov ecx,ted_scr_w + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 ;᫮ ப 㬥 + mov dword[ecx+sb_offs_redraw],1 + mov ecx,ted_scr_h + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 ;᫮ ᨬ 㬥 + + mov ted_sel_x0,0 + mov ted_sel_y0,0 + mov ted_sel_x1,0 + mov ted_sel_y1,0 + + cmp dword[cl_al_mem],0 + je .exit + + push edx + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + mov edx,ted_tex + @@: + mov byte [edx],0 + inc edx + loop @b + mov edx,ted_tex + mov dword [edx+symbol.next],1 + pop edx + + .exit: + ret +endp + + +align 16 +proc ted_init_syntax_file, edit:dword + pushad + mov edi,[edit] + + mov ecx,0x100 + mov edx,ted_arr_key_pos + @@: + mov dword[edx],-1 + add edx,4 + loop @b + + ;init: ted_colors_text_count, ted_key_words_count, ... + mov ted_colors_text_count,1 + mov ted_help_text_f1,0 + mov ted_help_id,-1 ;䨪 ᫮ ࠢ + + mov eax,edi ;࠭塞 祭 edi + mov esi,ted_syntax_file + add edi,ted_offs_count_colors ;edi = &ted_key_words_count + mov ecx,9 + rep movsd + mov edi,eax ;⠭ 祭 edi + + mov eax,ted_syntax_file + add eax,32 + mov ted_text_colors,eax + + mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) + lea eax,[4*eax+32] + add eax,ted_syntax_file + mov ted_key_words_data,eax + + mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) + or ecx,ecx + jz .no_words + xor eax,eax + @@: + ColToIndexOffset eax,edx + movzx ebx,byte[edx] + mov esi,ted_arr_key_pos + lea esi,[esi+4*ebx] + cmp dword[esi],-1 + jne .no_ch_key + mov [esi],eax + .no_ch_key: + inc eax + loop @b + .no_words: + + ;init: ted_help_text_f1 + mov ecx,ted_key_words_count ;⢮ 祢 ᫮ + imul ecx,sizeof.TexColViv ;ࠧ 1- . . + add ecx,ted_key_words_data ;砫 䠩 . . + mov ted_help_text_f1,ecx ;⪠ , 稭 ⥪ ࠢ + + stdcall ted_init_scroll_bars,edi,1 ;塞 梥 ஫ + .no_colors: + popad + ret +endp + +;input: +; ebx = file size +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ⨨ 䠩 +align 16 +proc ted_on_open_file + push eax ;destination + push ecx ;for cycle + push edx ;source + push esi + + or ebx,ebx + jnz @f + ;᫨ 䠩 ⮩ + stdcall ted_clear,edi,1 ;⨬ + jmp .end_opn +align 4 + @@: + stdcall ted_clear,edi,0 ;⨬ , ⮬ 㤥 묨 묨 + + mov edx,ted_tex + mov ecx,ebx + .s_10: + cmp word[edx],0xa0d ;ய᪠ 10- ᨬ ᫨ । ⮨ 13- + jne @f + dec ecx + jz .no_10 + dec ecx + jz .no_10 + add edx,2 + @@: + cmp byte[edx],10 + jne @f + mov byte[edx],13 ;塞 10- ᨬ ப + @@: + inc edx + loop .s_10 + .no_10: + + ;ॢ 䠩 t_edit + mov ecx,ebx + lea eax,[ebx+2] + ConvertIndexToPointer eax + mov edx,ted_tex + add edx,ebx + push ebx + @@: + mov ebx,[edx] + mov byte[eax],bl + mov dword[eax+symbol.perv],ecx + inc dword[eax+symbol.perv] + mov dword[eax+symbol.next],ecx + add dword[eax+symbol.next],3 + ;mov byte[eax+1],0 ;col=0 + mov dword[eax+symbol.tc],-1 + mov dword[eax+symbol.td],0 + + or ecx,ecx + jz @f + dec ecx + dec edx + sub eax,sizeof.symbol + jmp @b +align 4 + @@: + pop ebx + mov dword[eax+symbol.perv],0 ; first sumbol 'perv=0' + + mov edx,ted_tex ; ன 砫쭮 㦥 ᨬ + ; begining sumbol 'perv=0' 'next=2' + mov dword[edx+symbol.perv],0 + mov dword[edx+symbol.next],2 + + add edx,sizeof.symbol ; ன 筮 㦥 ᨬ + mov dword[edx+symbol.next],0 ; last sumbol 'next=0' + mov dword[edx+symbol.perv],ebx ; last sumbol 'perv=last' + inc dword[edx+symbol.perv] + mov dword[edx+symbol.tc],0 ; ⠢ ६ ᮧ ࠢ 0, ᨬ ࠢ쭮 ࠡ뢠 ⨨ 䠩 28 + + mov edx,ebx + inc edx ;2 = rezerv sumbols + imul edx,sizeof.symbol + add edx,ted_tex + mov dword[edx+symbol.next],1 ; last sumbol 'next=1' + + @@: ;clear memory, need if before was open big file + add edx,sizeof.symbol + cmp edx,ted_tex_end + jge .end_opn + mov dword[edx+symbol.tc],0 + mov dword[edx+symbol.td],0 + jmp @b +align 4 + .end_opn: + + call ted_get_num_lines + cmp eax,TED_LINES_IN_NEW_FILE + jge @f + mov eax,TED_LINES_IN_NEW_FILE + @@: + mov esi,ted_scr_w + mov dword[esi+sb_offs_max_area],eax + pop esi edx ecx eax + + call ted_text_colored + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'perv' visible symbol struct +align 16 +ted_iterat_perv: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + mov edx,[edx+symbol.perv] + or edx,edx + jz @f + imul edx,sizeof.symbol + add edx,ted_tex + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + pop ebx + ret + @@: + mov edx,ted_tex ;砫 䠩 + pop ebx + ret + .else: + mov edx,[edx+symbol.perv] + or edx,edx + jz @f + imul edx,sizeof.symbol + add edx,ted_tex + cmp dword[edx+symbol.td],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + ret + @@: + mov edx,ted_tex ;砫 䠩 + ret + + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'next' visible symbol struct +align 16 +ted_iterat_next: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + mov edx,[edx+symbol.next] + cmp edx,1 + jle @f + imul edx,sizeof.symbol + add edx,ted_tex + + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + pop ebx + ret + @@: + mov edx,ted_tex_1 ; 䠩 + pop ebx + ret + .else: + mov edx,[edx+symbol.next] + cmp edx,1 + jle @f + imul edx,sizeof.symbol + add edx,ted_tex + + cmp dword[edx+symbol.td],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + ret + @@: + mov edx,ted_tex_1 ; 䠩 + ret + +;input: +; bl = symbol end of select +; bh = ࠭騩 ᨬ (= 0 ᫨ ஢ન ) +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;description: +; ᫥ 㪠 ᨬ +align 16 +ted_iterat_next_pos_char: + push ax + mov al,1 ;।騩 ᨬ, 㦨 ࠢ ᨬ bh + @@: + cmp bl,byte[edx] + je .found + .no_found: + cmp edx,ted_tex_1 + jle @f + mov al,byte[edx] + call ted_iterat_next + jmp @b + .found: + cmp bh,al + je .no_found + @@: + call ted_iterat_next + pop ax + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 16 +ted_iterat_perv_color_tag: + @@: + cmp byte[edx+1],0 + jne @f + call ted_iterat_perv + cmp edx,ted_tex_1 + jle @f + jmp @b +align 4 + @@: + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 16 +ted_iterat_next_color_tag: + @@: + call ted_iterat_next + cmp byte[edx+1],0 + jne @f + cmp edx,ted_tex_1 + jle @f + jmp @b +align 4 + @@: + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; bl = 1 if sumbol not visible +; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) +align 16 +ted_symbol_not_vis: + push eax + + xor bl,bl + cmp dword[edx+symbol.td],0 + je @f + mov eax,[edx+symbol.td] ;eax=tex[i].td + add eax,ted_tim_undo + cmp eax,ted_tim_ch + jg @f + mov bl,1 + pop eax + ret + @@: + + mov eax,ted_tim_ch + sub eax,ted_tim_undo + cmp [edx+symbol.tc],eax + jle @f + or bl,1 + @@: + + pop eax + ret + +;input: +; text - pointer to text string +; add_opt - options +align 16 +proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword + locals + new_spc dd ? ;count new spaces + new_lin dd ? ;count new lines + endl +;ᯮ짮 ॣ஢ 㭪樨: +;eax - ⠢ ⥪ +;ebx - ६ 㦤, ⠢塞 ⥪ +;ecx - ६ 㦤 +;edx - 㪠⥫ ᨬ + pushad + cmp dword[t_len],1 ;஢塞 塞 ⥪ + jl .no_add ; <1 룠 㭪樨,  + + mov edi,[edit] + mov esi,[text] + + call ted_get_pos_by_cursor + call ted_get_text_perv_pos + call ted_get_text_arr_index ;eax=po_t + + mov dword[new_spc],0 + cmp ted_gp_opt,2 + je @f + push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); + mov eax,ted_scr_h + mov eax,[eax+sb_offs_position] + add eax,ted_cur_x ;eax - ᨬ + mov [new_spc],eax + + mov eax,ted_scr_w + mov eax,[eax+sb_offs_position] + add eax,ted_cur_y ;eax - ப + call ted_strlen ;ebx = line len + sub [new_spc],ebx ; 樨 ⭨ ப, 㧭 ⢮ 塞 ஡ + pop eax + @@: + + mov ebx,[t_len] + + mov dword[new_lin],0 + cmp ted_gp_opt,0 + jne @f + push eax + mov eax,ted_scr_w + mov eax,[eax+sb_offs_position] + add eax,ted_cur_y + inc eax + mov [new_lin],eax + + call ted_get_num_lines + sub [new_lin],eax + ;㢥稢 ஫ ᫮ ⥫ ப + mov ecx,ted_scr_w + add [ecx+sb_offs_max_area],eax ;㢥稢 ࠧ ⨪쭮 ஫ + pop eax + @@: + + mov edx,ted_ptr_free_symb + .beg_cycle: ;for(i=...;i ted_cur_x + mov ted_gp_opt,1 + cmp eax,ecx + jge @f ; Row >= ted_cur_y + .u1_0: + mov ted_gp_opt,0 + inc ebx + cmp byte [edx],13 + jne @b + cmp eax,ecx + jge @f ; Row >= ted_cur_y + inc eax + xor ebx,ebx + jmp @b + @@: + cmp eax,ecx + jne @f ; Row = ted_cur_y + inc ted_gp_opt + @@: + cmp ted_gp_opt,0 + jne @f + mov edx,ted_tex_1 + ;call ted_get_text_perv_pos + @@: + ret +endp + +;input: +; eax = Row +; edi = pointer to tedit struct +;output: +; ebx = str len +align 16 +ted_strlen: + push edx ecx + ;ecx = Row, from cycle + + xor ebx,ebx + xor ecx,ecx + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + inc ebx + cmp byte [edx],13 + jne @b + dec ebx ;lenght minus 1 sumbol to paragraph + cmp eax,ecx + je @f + xor ebx,ebx + inc ecx + jmp @b + @@: + + cmp eax,ecx + je @f + xor ebx,ebx + @@: + + pop ecx edx + ret + + +;input: +; edx = symbol position +; edi = pointer to tedit struct +;output: +; eax = number of line +; ebx = symbol position in line +align 16 +ted_get_text_coords: + push edx + xor eax,eax + xor ebx,ebx + @@: + call ted_iterat_perv + + or eax,eax + jnz .no_col_mov + inc ebx + .no_col_mov: + + cmp edx,ted_tex_1 + jle @f + cmp byte [edx],13 + jne @b + inc eax + jmp @b + @@: + dec ebx + pop edx + ret + +;input: +; edi = pointer to tedit struct +;output: +; eax = num lines +align 16 +ted_get_num_lines: + push edx + mov eax,1 + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + jne @b + inc eax + jmp @b + @@: +;... +;dec eax + pop edx + ret + + +;input: +; edi = pointer to tedit struct +;description: +; ⬥ ⬥ ⢨, । 㬥 +align 16 +proc ted_set_undo + mov ted_drag_k,0 ;稢 뤥 + cmp ted_tim_undo,1 + jl .no_work + + push eax ebx edx + mov edx,ted_tex + call ted_get_text_next_pos ;long i=tex[0].next; + mov eax,ted_tim_undo + sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; + mov eax,ted_tim_ch + cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) + jle @f + mov ted_tim_ls,0 + @@: + cmp edx,ted_tex_1 + jle @f + + ;if(tex[i].tc>ted_tim_ch){ // ᫨ ᮧ ᨬ 뫮 ⬥ + cmp [edx+symbol.tc],eax + jle .no_u1 + mov dword[edx+symbol.tc],0 + mov dword[edx+symbol.td],0 + + mov ebx,[edx+symbol.perv] + imul ebx,sizeof.symbol + add ebx,ted_tex ;ebx=tex[i].perv + m2m dword [ebx+symbol.next],dword [edx+symbol.next] ;tex[tex[i].perv].next=tex[i].next; + + mov ebx,[edx+symbol.next] + imul ebx,sizeof.symbol + add ebx,ted_tex ;ebx=tex[i].next + m2m dword [ebx+symbol.perv],dword [edx+symbol.perv] ;tex[tex[i].next].perv=tex[i].perv; + + cmp ted_ptr_free_symb,edx + jle .no_cor_free + mov ted_ptr_free_symb,edx ;塞 㪠⥫ ᢮ ᨬ, ண ᪠ + .no_cor_free: + mov edx,ebx ;⨬㥬 ᪮ (edx ᫥ 맮 ted_get_text_next_pos 㤥 ࠢ ebx) + jmp @b + .no_u1: + + ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ᫨ 㤠 ᨬ 뫮 ⬥ + cmp [edx+symbol.td],eax + jle .no_u2 + mov dword[edx+symbol.td],0 + .no_u2: + + call ted_get_text_next_pos + jmp @b + @@: + mov ted_tim_undo,0 + mov eax,ted_tim_co + cmp ted_tim_ch,eax + jge @f + mov ted_tim_co,0 + @@: + pop edx ebx eax + .no_work: + ret +endp + +;description: +; 室 㪠 +;input: +; row = ப +; col = ᨬ +align 16 +proc ted_go_to_position uses ecx edx edi, edit:dword, row:dword, col:dword + mov edi,[edit] + ; ⮢ ப + mov edx,[row] + call ted_get_num_lines + cmp edx,eax + jle @f + mov edx,eax ;࠭祭 ப max + @@: + dec edx + cmp edx,0 + jge @f + xor edx,edx ;࠭祭 ப min + @@: + ; ⮢ ᨬ + mov ecx,[col] + dec ecx + cmp ecx,0 + jge @f + xor ecx,ecx + @@: + call ted_go_to_pos + stdcall ted_draw,edi + ret +endp + +;input: +; ecx = Col +; edx = Row +; edi = pointer to tedit struct +;output: +; ecx = cursor x +; edx = cursor y +align 16 +ted_go_to_pos: + push eax ebx + mov eax,ted_scr_h + sub ecx,[eax+sb_offs_position] + cmp ecx,0 ;ted_cur_x < 0 + jge @f + add [eax+sb_offs_position],ecx ;ப⪠ ஫ + xor ecx,ecx + @@: + mov ebx,5 ;5 - ᫥ + cmp ecx,ebx + jge .end0 + sub ebx,ecx ;ebx - ᪮쪮 ᨬ 㦭 ᤢ + cmp [eax+sb_offs_position],ebx + jge @f + add ecx,[eax+sb_offs_position] + mov dword[eax+sb_offs_position],0 + jmp .end0 + @@: + sub [eax+sb_offs_position],ebx + add ecx,ebx + .end0: + cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area] + jl .end1 + mov ebx,ecx + sub ebx,[eax+sb_offs_cur_area] + inc ebx + add [eax+sb_offs_position],ebx ;ப⪠ ஫ ࠢ + sub ecx,ebx + .end1: + mov ted_cur_x,ecx + + mov eax,ted_scr_w + sub edx,[eax+sb_offs_position] + cmp edx,0 ;ted_cur_y < 0 + jge @f + add [eax+sb_offs_position],edx ;ப⪠ ஫ + xor edx,edx + jmp .end2 + @@: + cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] + jl .end2 + mov ebx,edx + sub ebx,[eax+sb_offs_cur_area] + inc ebx + add [eax+sb_offs_position],ebx ;ப⪠ ஫ + sub edx,ebx + .end2: + mov ted_cur_y,edx + pop ebx eax + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_text_colored: + push eax edx + mov eax,ted_tim_ch + sub eax,ted_tim_undo + mov ted_tim_co,eax + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + mov byte[edx+1],0 + jmp @b + @@: + + cmp ted_key_words_count,1 + jl .no_colors + mov edx,ted_tex + @@: + call ted_text_find_sel_color + cmp edx,ted_tex_1 + jg @b + + xor ax,ax + mov edx,ted_tex + .cycle0: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_colors + mov al,byte[edx+1] + or al,al + jz .cycle0 + cmp ah,al + jne @f + mov byte[edx+1],0 ;᫨ﭨ 冷 ᫮ 梥 + @@: + shl ax,8 + jmp .cycle0 + .no_colors: + pop edx eax + ret + + +;input: +; edx = pointer to start symbol +; edi = pointer to tedit struct +;output: +; edx = pointer to next symbol +;description: +; 㭪 ᪠ 뤥 ᢥ祭 ᫮ +align 16 +proc ted_text_find_sel_color uses eax ebx ecx esi +locals + begPos dd ? ;砫쭠 + endPos dd ? ;筠 + find db ? ;0 - , 1 - , 2 - 䠩 + f_color db ? ; 梥 ᫮ +endl +;eax = word_n ⥪騩 () ஢塞 ᫮ ᯨ᪥ +;ebx = ࠧ 楫 +;ecx = l_pos ᫥ () 室饣 ᫮ ᯨ᪥ +;esi = ࠧ 楫, ஢塞 ᨬ ᫮ + mov dword[begPos],1 + mov dword[endPos],1 + mov byte[find],0 + mov byte[f_color],1 + .cycle0: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .cycle0end + + movzx eax,byte[edx] + shl eax,2 ;eax*=4 + add eax,ted_arr_key_pos + mov eax,[eax] + cmp eax,0 + jl .cycle0 ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ + + mov ecx,eax + ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) + @@: + cmp ecx,eax + jle @f + dec ecx + ColToIndexOffset ecx,ebx + inc ecx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je @f + dec ecx + jmp @b + @@: + + ColToIndexOffset eax,ebx + cmp byte[ebx+esi],0 + jne .if_0 ;if(Col[word_n].Text[pos]==0){ + mov [endPos],edx ;eP=i; + ColToIndexOffset eax,ebx + mov bl,[ebx+MAX_COLOR_WORD_LEN+7] + mov [f_color],bl ;f_color=Col[word_n].color; + + mov byte[find],1 + ColToIndexOffset eax,ebx ;... ebx = Col[word_n] + mov bl,[ebx+MAX_COLOR_WORD_LEN+4] + cmp bl,0 ;if(Col[word_n].wwo) + je .if_2n + push edx + mov edx,[begPos] + call ted_iterat_perv + + btr bx,0 ;1-1 + jae @f ;if(Col[word_n].wwo&1) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae @f + mov byte[find],0 + jmp .if_4e + @@: + + btr bx,3 ;4-1 + jae .if_4e ;if(Col[word_n].wwo&8) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_4e + mov byte[find],0 + .if_4e: + + mov edx,[endPos] + ;call ted_iterat_next + + btr bx,1 ;2-1 + jae @f ;if(Col[word_n].wwo&2) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae @f + mov byte[find],0 + jmp .if_6e + @@: + + btr bx,4 ;5-1 + jae .if_6e ;if(Col[word_n].wwo&16) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_6e + mov byte[find],0 + .if_6e: + + btr bx,2 ;3-1 + jae .if_7e ;if(Col[word_n].wwo&4) + ColToIndexOffset eax,ebx + mov bx,word[ebx+MAX_COLOR_WORD_LEN+5] + call ted_iterat_next_pos_char + cmp edx,ted_tex_1 + jg @f + ;᫨ 諨 䠩 諨 ᨬ ࠧ⪨ + call ted_iterat_perv + mov byte[find],2 + @@: + mov dword[endPos],edx + .if_7e: + + pop edx + .if_2n: +;if(i!=1){ // 㬥 +; cont_s=tex[eP].c; +; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // 㪢.-. ᨬ +; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . ᨬ +; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); + + cmp eax,ecx + je .wh_2e ;if(word_n==l_pos) break; // do double - ᫨ ᫮ 筮 ᫥ + .if_0: + + cmp edx,ted_tex_1 + jle .wh_2e ;if(i==1) break; + + ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) + .wh_4b: + cmp ecx,eax + jle .wh_4e + ColToIndexOffset eax,ebx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je .wh_4e + inc eax + jmp .wh_4b + .wh_4e: + + cmp eax,ecx + je .wh_2e;if(word_n==l_pos) break; + inc esi ;pos++; + jmp .wh_2b + .wh_2e: + + cmp byte[find],0 ;if(fnd)break; + jne .cycle0end + mov edx,[begPos];i=bP; + jmp .cycle0 + .cycle0end: + + cmp byte[find],0 + je .if_1e ;if(fnd){ // 뤥 ⥪ + ;if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ + mov eax,[begPos] + mov bl,[f_color] + mov [eax+1],bl ;tex[bP].col=f_color; + mov eax,[endPos] + mov byte[eax+1],0xff ;tex[eP].col=255; + cmp byte[find],2 + je .if_1e + ;return ItPoPerv(eP); // 頥 宦 + mov edx,[endPos] + call ted_get_text_perv_pos + jmp @f + .if_1e: + mov edx,ted_tex + @@: + + ret +endp + +;input: +; edx = pointer to char (byte) +;output: +; cf=1 if symbol is... +align 16 +tab_all_num db 0,0,0,0,0,0,0xff,11b,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 +tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,10000111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +;output: +; cf=1 ᫨ [edx] 㪢, '_' +align 16 +isalnum: + push eax ebx + movzx eax,byte[edx] ;al=offset + shr eax,3 + lea ebx,[tab_all_num] + add ebx,eax + movzx ax,byte[edx] ;al=bit + and ax,111b + bt word[ebx],ax + pop ebx eax + ret + +;output: +; cf=1 ᫨ [edx] 㪢 '_' +align 16 +isalpha: + push eax ebx + movzx eax,byte[edx] ;al=offset + shr eax,3 + lea ebx,[tab_alpha] + add ebx,eax + movzx ax,byte[edx] ;al=bit + and ax,111b + bt word[ebx],ax + pop ebx eax + ret + +align 16 +proc ted_show_help_f1 uses eax edx edi, edit:dword + mov edi,[edit] + + call ted_get_pos_by_cursor + push edx + call ted_iterat_next_color_tag + mov eax,edx + pop edx + call ted_iterat_perv_color_tag + + cmp eax,ted_tex + jle @f + cmp edx,ted_tex_1 + jle @f + stdcall ted_find_help_id,eax + @@: + ;call ted_draw_main_cursor + call ted_draw_help_f1 + ret +endp + +;input: +; edx = position begin 'symbol' struct +; edi = pointer to tedit struct +; end_pos = position end 'symbol' struct +align 16 +proc ted_find_help_id uses ebx ecx, end_pos:dword +; ecx = word_n +; ebx = l_pos + mov ted_help_id,-1 + + movzx ebx,byte[edx] + shl ebx,2 ;ebx*=4 + add ebx,ted_arr_key_pos + mov ecx,[ebx] + cmp ecx,0 + jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ + push esi eax + mov ebx,ecx ;l_pos=word_n; + ColToIndexOffset ecx,esi + push cx + mov cl,[esi] + @@: + cmp ebx,ted_key_words_count ;while(l_posword_n + jle .wh_0e + dec ebx + ColToIndexOffset ebx,eax + inc ebx + cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) + je .wh_0e + dec ebx ;l_pos--; + jmp .wh_0b + .wh_0e: + + .wh_1b: + cmp ebx,ecx ;while(l_pos>word_n + jle .wh_1e + ColToIndexOffset ecx,eax + cmp byte[eax+esi],dl + je .wh_1e + inc ecx ;word_n++; + jmp .wh_1b + .wh_1e: + pop dx + + cmp ecx,ebx ;if(word_n==l_pos) break; + je @f + call ted_iterat_next ;pos++; + cmp edx,[end_pos] ;for(...;i y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + shl ecx,16 + add ecx,ted_rec_h + + mov edx,ted_color_wnd_work + call ted_sel_normalize + + mov esi,ted_scr_w + mov eax,[esi+sb_offs_position] + sub ted_seln_y0,eax + sub ted_seln_y1,eax + + mov eax,ted_cur_y + cmp eax,ted_seln_y0 + jl .no_cur_sel + cmp eax,ted_seln_y1 + jg .no_cur_sel + mov edx,ted_color_select ;塞 梥 䮭 梥 뤥 + mov esi,ted_scr_h + cmp eax,ted_seln_y0 + jne @f + mov eax,ted_cur_x + add eax,[esi+sb_offs_position] + cmp eax,ted_seln_x0 + jge @f + mov edx,ted_color_wnd_work + @@: + mov eax,ted_cur_y + cmp eax,ted_seln_y1 + jne .no_cur_sel + mov eax,ted_cur_x + add eax,[esi+sb_offs_position] + cmp eax,ted_seln_x1 + jl .no_cur_sel + mov edx,ted_color_wnd_work + .no_cur_sel: + mcall SF_DRAW_RECT + + call ted_get_pos_by_cursor ;६ ᨬ + cmp ted_gp_opt,2 + jne @f + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + call ted_get_symb_color + call ted_convert_invis_symb + mcall SF_DRAW_TEXT ;ᮢ ᨬ + @@: +popad + ret +endp + +;input: +; edx -> pointer to text +; edi -> 㪠⥫ tedit +;output: +; ecx = color +; if ted_mode_color=0 then ecx=ted_color_wnd_text +align 16 +ted_get_symb_color: + mov ecx,ted_color_wnd_text ; 梥 ⥪ 㬮砭 + + push eax edx + cmp ted_mode_color,0 + je .exit + jmp .on_first + @@: + call ted_iterat_perv + cmp edx,ted_tex_1 + jle .exit + .on_first: + movzx eax,byte[edx+1] + or eax,eax ;᫨ al=0 梥 + jz @b + + cmp eax,ted_colors_text_count + jge .exit + + mov ecx,ted_text_colors ;ਡ塞 ᬥ饭 1- 梥 + lea ecx,[ecx+4*eax] + mov ecx,[ecx] ;⠭ ⥪騩 梥 ⥪ ᬥ饭 + .exit: + or ecx,ted_font_size + pop edx eax + ret + +;input: +; edx = pointer to text +; edi = pointer to tedit struct +;description: +; 㭪 ८ࠧ ᨬ ⠥ ࠭ +align 16 +ted_convert_invis_symb: + cmp ted_mode_invis,1 + jne .else + cmp byte[edx],9 + jne @f + lea edx,[ted_symbol_tab] + jmp .end_f +align 4 + @@: + cmp byte[edx],13 + jne @f + mov edx,edi + add edx,ted_offs_symbol_new_line + @@: + jmp .end_f +align 4 + .else: + cmp byte[edx],9 + je @f + cmp byte[edx],13 + jne .end_f + @@: + lea edx,[ted_symbol_space] + .end_f: + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_scroll_set_redraw: + push eax + mov eax,ted_scr_w + mov dword[eax+sb_offs_redraw],1 + mov eax,ted_scr_h + mov dword[eax+sb_offs_redraw],1 + pop eax + ret + +align 16 +proc ted_draw, edit:dword + locals + line_num dd ? + endl + pushad + mov edi,[edit] + + mov eax,SF_DRAW_TEXT + mov ecx,ted_text_colors + mov ecx,[ecx] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,ted_rec_t + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov esi,ted_scr_w + mov esi,[esi+sb_offs_position] + mov [line_num],esi + + stdcall ted_clear_line_before_draw, edi,ebx,1,esi + call ted_get_first_visible_pos + or edx,edx + jz .no_draw_text + mov esi,1 ; 뢮 ⥪ 1- ᨬ + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + cmp byte[edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_invis + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + .no_invis: + add ebx,ted_rec_h + ;optimized output \/ + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp bx,ax + jg .no_draw_text + mov eax,SF_DRAW_TEXT + ;optimized output /\ + and ebx,0xffff + ror ebx,16 + add ebx,ted_wnd_l + add ebx,ted_rec_l + inc ebx + ror ebx,16 + inc dword[line_num] ;increment line number + stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] + call ted_opt_draw_line_left + jmp @b +align 4 + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov esi,ted_wnd_l + add esi,ted_wnd_w + cmp bx,si + jl .no_opt + call ted_opt_draw_line_right + .no_opt: + mov si,1 + ror ebx,16 + jmp @b + .no_draw_text: + + inc dword[line_num] + stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] + call ted_draw_line_numbers + call ted_draw_main_cursor + +;--------------------------------------------- +; set all_redraw flag for draw all ScrollBar +; In some cases it is necessity to draw only the area +; of moving of a "runner", for acceleration of output - +; in this case the flag needs to be reset to 0 (zero). + mov eax,ted_scr_h + mov esi,ted_scr_w + mov dword[eax+sb_offs_all_redraw],1 + mov dword[esi+sb_offs_all_redraw],1 + +; ᮢ ப⪨ + stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] + stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] +; reset all_redraw flag + mov dword[eax+sb_offs_all_redraw],0 + mov dword[esi+sb_offs_all_redraw],0 +;--------------------------------------------- + + ;left-bottom square + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,ted_wnd_h + shl ecx,16 + mov cx,word[eax+sb_offs_size_y] + inc cx + mcall SF_DRAW_RECT,,,ted_color_wnd_capt ;[sc.work] + + ;right-bottom square + mov ebx,ted_wnd_l + add ebx,ted_wnd_w + shl ebx,16 + mov bx,word[esi+sb_offs_size_x] + inc bx + int 0x40 + + cmp ted_fun_draw_panels,0 + je @f + stdcall ted_fun_draw_panels, edi + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_main_cursor +pushad + mov eax,SF_DRAW_RECT ;draw cursor + mov ecx,ted_wnd_t ;calc rect -> y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + + shl ecx,16 + add ecx,ted_rec_h + + mov ebx,ted_wnd_l ;calc rect -> x0,x1 + add ebx,ted_rec_l + mov edx,ted_cur_x + imul edx,ted_rec_w + add ebx,edx + shl ebx,16 + add ebx,ted_rec_w + cmp ted_cur_ins,1 ;஢ઠ ० ࠡ ( ⠢) + jne @f + shr bx,2 ;㬥蠥 ਭ + @@: + + mov edx,ted_color_cursor + int 0x40 ;뢮 + + call ted_get_pos_by_cursor + cmp ted_gp_opt,2 + jne @f + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + mov ecx,ted_color_cur_text + or ecx,ted_font_size + call ted_convert_invis_symb + mcall SF_DRAW_TEXT + @@: + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + lea edx,[txtRow] + mcall SF_DRAW_TEXT ;뢮 'ப' + + add ebx,0x500000 + lea edx,[txtCol] + int 0x40 ;뢮 '' + + cmp ted_tim_undo,0 + je @f + add ebx,0x500000 + lea edx,[txtOtm] + int 0x40 + sub ebx,0x500000 + @@: + + call ted_draw_buffer + call ted_draw_help_f1 + + mov eax,47 ;draw cursor coords + mov esi,ted_color_wnd_bord + or esi,0x40000000 + + mov edx,ebx + ror edx,16 + sub edx,35 + ror edx,16 + ;add edx,3 + mov ebx,0x40000 ;Row=... + mov ecx,ted_scr_w + mov ecx,[ecx+sb_offs_position] + add ecx,ted_cur_y + inc ecx + +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ ⥪饩 ப +pop edi + + ;mov ebx,0x40000 ;Col=... + mov ecx,ted_scr_h + mov ecx,[ecx+sb_offs_position] + add ecx,ted_cur_x + inc ecx + add edx,0x500000 +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ +pop edi + + cmp ted_tim_undo,0 + je @f + mov ecx,ted_tim_undo + add edx,0x500000 + mov edi,ted_color_wnd_work ;⨬ ॣ edi, 㭪樨 㦥 + int 0x40 ;뢮 ᫠ ⬥ ⢨ + @@: + +popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_buffer + pushad + + mov eax,ted_buffer + cmp dword[eax],1 ;ᬮਬ ࠧ + jl @f + mov ebx,ted_rec_l + add bx,300 + cmp ebx,ted_wnd_w ;ࠢ न 뢮 ⥪ + jge @f ; + + add ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x40000000 + + mov edx,ted_buffer + add edx,12 + mov esi,edx + mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit + call tl_strlen + ;cmp eax,0 ; + ;je @f + cmp eax,20 + jle .crop_buf + mov eax,20 ;१ 20 ᨬ + .crop_buf: + mov esi,eax + mcall SF_DRAW_TEXT ;뢮 ᮤন + + sub ebx,50 shl 16 + lea edx,[txtBuf] + mov esi,edx + call tl_strlen + mov esi,eax + xor ecx,0x40000000 ;㡨ࠥ 梥 䮭 + mcall SF_DRAW_TEXT ;뢮 + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_help_f1 + pushad + cmp ted_rec_t,13 ;쭠 ᮢ ࠢ + jle @f + ;clear place before draw help + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w + sub ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,13 + shl ecx,16 + add ecx,9 ;9 - 0- , ⠢ ted_rec_h ࠭ + mcall SF_DRAW_RECT,,,ted_color_wnd_capt + + cmp ted_help_id,-1 + je @f + mov eax,ted_help_id + ColToIndexOffset eax,edx + + ;SetCoordinates + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,13 ;=3+10 + + ;SetTextColor + movzx eax,byte[edx+MAX_COLOR_WORD_LEN+7] + shl eax,2 + mov ecx,ted_text_colors + add ecx,eax + mov ecx,[ecx] + or ecx,0xc0000000 ;SetTextStyles + mov esi,edi + mcall SF_DRAW_TEXT,,,,,ted_color_wnd_work + mov edi,esi + + mov esi,edx + call tl_strlen + + ;*** draw help string *** + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + mov edx,[edx+MAX_COLOR_WORD_LEN] + or edx,edx + jz @f + add edx,ted_help_text_f1 + inc eax + imul eax,6 ;ਭ ᨬ . + shl eax,16 + add ebx,eax + mcall SF_DRAW_TEXT + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 16 +proc ted_draw_line_numbers +pushad + ;top panel with caption + mov ebx,ted_wnd_l + ;add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w + ;sub ebx,ted_rec_l + mov edx,ted_color_wnd_work + mov ecx,ted_wnd_t + shl ecx,16 + add ecx,ted_rec_t + mov edx,ted_color_wnd_capt + mcall SF_DRAW_RECT + + ;line numbers + mov ebx,0x40000 ;format + mov ecx,ted_scr_w + mov ecx,[ecx+sb_offs_position] + inc ecx + mov edx,3 + add edx,ted_wnd_l + rol edx,16 + add edx,ted_wnd_t + add edx,ted_rec_t + @@: + +push ebx ecx edx + ;left panel with numbers + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_rec_h + rol ecx,16 + mov cx,dx + rol ecx,16 + mov edx,ted_color_wnd_capt + mcall SF_DRAW_RECT ;㥬 אַ㣮쭨 ஬ ப +pop edx ecx ebx + + mov esi,ted_color_wnd_bord + mcall SF_DRAW_NUMBER ;㥬 ப + inc ecx + add edx,ted_rec_h + sub edx,ted_wnd_t + mov esi,edx + and esi,0xffff + cmp esi,ted_wnd_h + jge @f + add edx,ted_wnd_t + jmp @b +align 4 + @@: +popad + ret +endp + +;output: +; ah = symbol +align 16 +proc KeyConvertToASCII uses ebx, table:dword + mov ebx,[table] ;convert scan to ascii + shr ax,8 + add bx,ax ;? ebx,eax + mov ah,byte[ebx] + ret +endp + +align 16 +proc ted_draw_cur_line, edit:dword +pushad + mov edi,[edit] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + mov eax,ted_cur_y + imul eax,ted_rec_h + mov bx,ax + add ebx,ted_wnd_t + add ebx,ted_rec_t ;ebx - न אַ㣮쭨 ⪨ + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov ecx,ted_cur_y + mov eax,ted_scr_w + add ecx,[eax+sb_offs_position] + stdcall ted_clear_line_before_draw,edi,ebx,1,ecx + + mov eax,ted_scr_h + mov esi,[eax+sb_offs_position] + call ted_get_pos_by_coords + + cmp ted_gp_opt,2 + jne .no_draw_text + call ted_get_symb_color + mov esi,1 ;draw 1 symbol + @@: + ;call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + mov eax,SF_DRAW_TEXT + cmp byte [edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_draw_text + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + jmp .no_draw_text +align 4 + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov eax,ted_wnd_w + add eax,ted_wnd_l ;ax = x + cmp bx,ax + jge .no_draw_text ;Opt + ror ebx,16 + call ted_iterat_next + jmp @b +align 4 + .no_draw_text: + + call ted_draw_main_cursor +popad + ret +endp + +;input: +; clear_o - ᫨ =1 ப, =0 ப +align 16 +proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword + pushad + mov edi,[edit] + mov ebx,[coords] ;ebx = x*2^16+y coords to left up point clear line + mov esi,[numb_lin] ;esi - number text line + + sub ebx,0x10001 ;⭨ ࠢ 㪢 業 + cmp dword[clear_o],0 + jne @f + add ebx,ted_rec_h + ror ebx,16 + xor bx,bx + add ebx,ted_wnd_l + add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l + ror ebx,16 + @@: + + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp ax,bx + jl .no_clear + sub ax,bx + + mov cx,bx + shl ecx,16 + + xor bx,bx + add ebx,ted_wnd_w + sub ebx,ted_rec_l + xor cx,cx + add ecx,ted_rec_h + mov edx,ted_color_wnd_work + + cmp dword[clear_o],0 + je .pusto + cmp ax,cx + jge @f + .pusto: + mov cx,ax + jmp .no_select ;᫨ ⪠ , ᥣ 䮭 梥⮬ + @@: + + call ted_is_select + or al,al + jz .no_select + cmp ted_seln_y0,esi + jg .no_select + cmp ted_seln_y1,esi + jl .no_select + mov edx,ted_color_select ;draw selected line + .no_select: + + mcall SF_DRAW_RECT ;᪠ ப 梥⮬ 䮭 梥⮬ 뤥 + + call ted_is_select + or al,al + jz .no_clear + + mov al,SF_DRAW_RECT + xor cx,cx + add ecx,ted_rec_h + cmp ted_seln_y0,esi + jne @f + push bx esi + mov edx,ted_seln_x0 ; (ࠥ ᫥) + mov esi,ted_scr_h + cmp edx,[esi+sb_offs_position] + jle .in_wnd + sub edx,[esi+sb_offs_position] + imul edx,ted_rec_w + mov bx,dx + jmp .no_wnd + .in_wnd: + xor bx,bx + .no_wnd: + mov edx,ted_color_wnd_work + int 0x40 + pop esi bx + @@: + cmp ted_seln_y1,esi + jne @f + ;push esi + ;᫨ 뤥 䠩 ᤥ 室, ⮣ 㦭 jmp .no_select + mov edx,ted_seln_x1 ; (ࠥ ࠢ) + mov esi,ted_scr_h + cmp edx,[esi+sb_offs_position] + jle .in_wnd2 + sub edx,[esi+sb_offs_position] + imul edx,ted_rec_w + sub bx,dx + shl edx,16 + add ebx,edx + .in_wnd2: + mov edx,ted_color_wnd_work + int 0x40 + ;pop esi + @@: + + .no_clear: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = pointer to symbol +; edx = 0 if text not in screen +align 16 +ted_get_first_visible_pos: + push eax ecx + mov eax,ted_scr_w + mov edx,ted_tex + xor ecx,ecx + @@: + cmp ecx,[eax+sb_offs_position] + je @f + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + jne @b + inc ecx + jmp @b +align 4 + @@: + + cmp ecx,[eax+sb_offs_position] + je @f + xor edx,edx + @@: + cmp ecx,[eax+sb_offs_max_area] + jle @f + mov [eax+sb_offs_max_area],ecx + @@: + pop ecx eax + call ted_opt_draw_line_left + ret + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = 㪠⥫ ᨬ +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 16 +proc ted_opt_draw_line_left uses ebx + mov ebx,ted_scr_h + mov ebx,[ebx+sb_offs_position] + or ebx,ebx + jz .ret_f + push eax + mov eax,edx + + cmp edx,ted_tex + jne @f + call ted_iterat_next + jmp .beg_cycle + @@: + + or ebx,ebx + jz @f + + cmp byte[edx],13 + jne @f + call ted_iterat_next + .beg_cycle: + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + or ebx,ebx + jz @f +;-------------------------------------- +;eax 㤥 +movzx eax,byte[edx+1] +or eax,eax +jz .no_color +cmp eax,ted_colors_text_count +jge .no_color + movzx ecx,byte[edx+1] + shl ecx,2 + add ecx,ted_text_colors + mov ecx,[ecx] +.no_color: +;-------------------------------------- + mov eax,edx + call ted_iterat_next + dec ebx + jmp @b +align 4 + @@: + mov edx,eax + pop eax + .ret_f: + call ted_get_symb_color + ret +endp + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = symbol color +; edx = pointer to 13 symbol +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 16 +proc ted_opt_draw_line_right uses eax + mov eax,edx + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + mov eax,edx + call ted_iterat_next + jmp @b + @@: + mov edx,eax ;perv sumbol + call ted_get_symb_color + ret +endp + +align 16 +proc ted_mouse, edit:dword + pushad + mov edi,[edit] + + ;ࠡ뢠 ஫ + mov edx,ted_scr_h + mov ecx,ted_scr_w + + cmp word[edx+sb_offs_delta2],0 + jne .horizontal + + mov eax,[ecx+sb_offs_max_area] + cmp eax,[ecx+sb_offs_cur_area] + jbe .horizontal + ; mouse event for Vertical ScrollBar + stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] + cmp dword[ecx+sb_offs_redraw],0 + je @f + mov dword[ecx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + @@: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + .horizontal: + mov eax,[edx+sb_offs_max_area] + cmp eax,[edx+sb_offs_cur_area] + jbe .other + ; mouse event for Horizontal ScrollBar + stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] + cmp dword[edx+sb_offs_redraw],0 + je .other + mov dword[edx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + .other: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + cmp word[edx+sb_offs_delta2],0 + jne .no_in_wnd + + ;ࠡ뢠 । + mcall SF_MOUSE_GET,SSF_BUTTON + cmp al,1 + jne @f + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,ted_wnd_t + add ebx,ted_rec_t + cmp ax,bx + jl @f ;y_mousey_wnd + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + mov ecx,eax + shr ecx,16 + cmp cx,bx + jl @f ;x_mousex_wnd + + call ted_draw_cursor_sumb + call ted_wnd_main_click + jmp .no_in_wnd + @@: + mov edx,ted_el_focus + cmp [edx],edi + jne @f + call ted_wnd_main_mouse_scroll ;ᬮਬ ப + @@: + cmp ted_drag_m,0 + je .no_in_wnd + mov ted_drag_m,0 + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .no_in_wnd + call ted_fun_draw_panel_buttons + .no_in_wnd: + popad + ret +endp + +;input: +; eax -> (x,y) +; edi -> 㪠⥫ tedit +;description: +; 㭪 뢥 ⨨ ஬ । +align 16 +ted_wnd_main_click: + push ebx ecx edx + mov ebx,ted_el_focus + mov [ebx],edi ;⠢ 䮪 + + push eax + shr eax,16 + sub eax,ted_wnd_l + sub eax,ted_rec_l + + xor edx,edx + mov ecx,ted_rec_w + div cx + ;inc eax + mov ebx,ted_scr_h + cmp eax,[ebx+sb_offs_cur_area] + jle @f + mov eax,[ebx+sb_offs_cur_area] + @@: + ;dec eax + mov ted_cur_x,eax + pop eax + + push eax + and eax,0xffff + sub eax,ted_wnd_t + sub eax,ted_rec_t + + xor edx,edx + mov ecx,ted_rec_h + div cx + inc eax + mov ebx,ted_scr_w + cmp eax,[ebx+sb_offs_cur_area] + jle @f + mov eax,[ebx+sb_offs_cur_area] + @@: + dec eax + mov ted_cur_y,eax + pop eax + + cmp ted_drag_m,0 + je @f + call ted_sel_move + jmp .sel_move + @@: + mov ted_drag_m,1 + call ted_sel_start + .sel_move: + pop edx ecx ebx + ret + +;input: +; edi = pointer to tedit struct +align 16 +ted_wnd_main_mouse_scroll: + push eax ebx ecx + mcall SF_MOUSE_GET,SSF_SCROLL_DATA + or ax,ax + jz .no_scroll + mov ecx,ted_scr_w + movsx eax,ax + lea eax,[eax+eax*2] ;㬭 3 (᫮ ப ப⪨ ) + add eax,[ecx+sb_offs_position] + mov ebx,[ecx+sb_offs_max_area] + shl ebx,1 + sub ebx,[ecx+sb_offs_cur_area] ;⭨ + shr ebx,1 + cmp eax,ebx + jae .no_scroll + mov ebx,ted_cur_y ; + sub ebx,eax ;- ஫ + add ebx,[ecx+sb_offs_position] ;+ ஫ + bt ebx,31 + jnc @f + xor ebx,ebx ;᫨ ⠫ , ⠢ ப + @@: + inc ebx + cmp ebx,[ecx+sb_offs_cur_area] + jle @f + mov ebx,[ecx+sb_offs_cur_area] ;᫨ ⠫ , ⠢ ப + @@: + dec ebx + mov ted_cur_y,ebx + mov [ecx+sb_offs_position],eax + stdcall ted_draw,edi + .no_scroll: + pop ecx ebx eax + ret + +align 16 +proc ted_save_file, edit:dword, file:dword, f_name:dword +pushad + mov edi,[edit] + + stdcall ted_can_save,edi + ;or al,al + ;jz .no_save + + mov ecx,ted_max_chars + invoke mem.alloc,ecx + push eax ; 㪠⥫ 뤥 + + mov edx,ted_tex + xor ecx,ecx + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol + mov bl,[edx] + mov byte[eax],bl + inc eax + inc ecx + jmp @b +align 4 + @@: + + or ecx,ecx + jz @f + mov ebx,[file] + pop eax ;뢠 㪠⥫ 뤥 + mov [ebx+16],eax + push eax ;⭮ 㪠⥫ 뤥 + mov dword[ebx], SSF_CREATE_FILE + mov dword[ebx+4], 0 + mov dword[ebx+8], 0 + mov [ebx+12], ecx + mov byte[ebx+20], 0 + push dword[f_name] + pop dword[ebx+21] + mcall SF_FILE + + mov ted_err_save,al + + or eax,eax + jz .no_msg + cmp ax,10 + jl .zifra_0_9 + mov al,'?' + sub ax,48 + .zifra_0_9: + add ax,48 + cmp ted_fun_save_err,0 + je @f + call ted_fun_save_err + jmp @f + .no_msg: + m2m ted_tim_ls,ted_tim_ch + @@: + + pop ecx ;뢠 㪠⥫ 뤥 + invoke mem.free,ecx + .no_save: +popad + ret +endp diff --git a/programs/develop/str_double/trunk/str_double.asm b/programs/develop/str_double/trunk/str_double.asm index 7ad683ab2..170d433e1 100644 --- a/programs/develop/str_double/trunk/str_double.asm +++ b/programs/develop/str_double/trunk/str_double.asm @@ -1,318 +1,318 @@ -; ணࠬ ८ࠧ ᥫ ப -; ଠ float, double, ⠪ 10 16 筮 -; float. -; ᭮ hex2dec2bin ਬ஢ 䠩 list2_05.inc -; ( 㫠 쥢 24.05.2002), -; ChE । 16 32 ᥬ fasm. -; ணࠬ ⠪ : -; 1) ᫮ ப ॢ 4 (float) 設 -; 2) ᫮ ப ॢ 8 (double) 設 -; 3) ᫮ 設 (float) ॢ ப (5 ᫥ ⮩) - -use32 - org 0 - db 'MENUET01' - dd 1,start,i_end,e_end,e_end,0,sys_path - -include '../../../proc32.inc' -include '../../../macros.inc' -include '../../../KOSfuncs.inc' -include '../../../load_lib.mac' -include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../../develop/info3ds/info_fun_float.inc' -include 'lang.inc' - -@use_library - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - cmp dword[ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_SET_EVENTS_MASK,0xC0000027 - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors - edit_boxes_set_sys_color edit1,editboxes_end,sys_colors - option_boxes_set_sys_color sys_colors,Option_boxes1 - -align 4 -red: - call draw_window - -align 4 -still: - mcall SF_WAIT_EVENT - - cmp eax,1 ; ᮢ ? - je red ; ᫨ - red - cmp eax,2 ; ? - je key ; ᫨ - key - cmp eax,3 ; ? - je button ; ᫨ - button - cmp eax,6 - je mouse - - jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 - -align 4 -key: ; - mcall SF_GET_KEY - ;cmp ah,13 - stdcall [edit_box_key], edit1 - jmp still ; 砫 横 - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah, 1 ; ᫨ ஬ 1, - jne @f - mcall SF_TERMINATE_PROCESS - @@: - cmp ah, 5 - jne @f - cmp dword[option_group1],opt3 - jne .opt_3_end - stdcall conv_str_to_int,[edit1.text] - mov dword[Data_Double],eax - finit - fld dword[Data_Double] - fstp qword[Data_Double] - - ; Data_Double - ८ࠧ㥬 ᫮ - mov word[NumberSymbolsAD],8 ; ⢮ ᫠ ᫥ ⮩ (1-17) - call DoubleFloat_to_String - call String_crop_0 - mov dword[Data_Double],eax ;⠭ 祭 ଠ float - jmp .opt_all_end - .opt_3_end: - - mov esi,string1 - mov edi,Data_String - cld - mov ecx,32 - rep movsb - - call String_to_DoubleFloat - cmp dword[option_group1],opt1 - jne .opt_all_end ;᫨ ࠭ float, ८ࠧ㥬 ࠭ 祭 double - finit - fld qword[Data_Double] ;⠥ double - fstp dword[Data_Double] ; 頥 float - .opt_all_end: - jmp red - @@: - jmp still - -align 4 -mouse: - stdcall [edit_box_mouse], edit1 - stdcall [option_box_mouse], Option_boxes1 - jmp still - -;------------------------------------------------ -align 4 -draw_window: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors - - mcall SF_REDRAW,SSF_BEGIN_DRAW - mov edx, 0x14000000 - or edx, [sys_colors.work] - mcall SF_CREATE_WINDOW, (200 shl 16)+300, (200 shl 16)+175, ,,title - - mcall SF_DEFINE_BUTTON, ((300-53) shl 16)+38, (145 shl 16)+15, 5, [sys_colors.work_button] ; Ok - - mov ecx, 0x80000000 - or ecx, [sys_colors.work_text] - mcall SF_DRAW_TEXT, (15 shl 16) +30,, binstr, - mcall , (15 shl 16) +58,, decstr, - mcall , ((240-56*3) shl 16) +58,, Data_String, - mcall , (15 shl 16) +72,, hexstr, - mcall , (15 shl 16)+150,, numstr, - - mov ecx, 0x80000000 - or ecx, [sys_colors.work_button_text] - mcall , ((300-42) shl 16)+149, , Okstr,3 - - cmp dword[option_group1],opt1 - je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ - cmp dword[option_group1],opt3 - je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ - mov ecx, dword[Data_Double+4] - mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(185 shl 16)+72,[sys_colors.work_text] ; 16- - - mov ecx, dword[Data_Double+4] - mcall ,(8 shl 16)+512,,(240 shl 16)+30, ; 2- - ror ecx, 8 - mcall ,,,((240-56) shl 16)+30, - ror ecx, 8 - mcall ,,,((240-56*2) shl 16)+30, - ror ecx, 8 - mcall ,,,((240-56*3) shl 16)+30, - ror ecx, 8 - @@: - - mov ecx,dword[Data_Double] - mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(240 shl 16)+72,[sys_colors.work_text] ; 16- - - mov ecx,dword[Data_Double] - mcall , (8 shl 16)+512,,(240 shl 16)+44, ; 2- - ror ecx, 8 - mcall ,,,((240-56) shl 16)+44, - ror ecx, 8 - mcall ,,,((240-56*2) shl 16)+44, - ror ecx, 8 - mcall ,,,((240-56*3) shl 16)+44, - ror ecx, 8 - - mcall SF_DRAW_LINE, (15 shl 16)+300-15, (137 shl 16)+137, [sys_colors.work_graph] - stdcall [edit_box_draw], edit1 - stdcall [option_box_draw], Option_boxes1 - mcall SF_REDRAW,SSF_END_DRAW - -ret - - -string1 db 32 dup (0) -string1_end: - - -;input: -; buf - 㪠⥫ ப, ᫮ 10 16 筮 -;output: -; eax - ᫮ -align 4 -proc conv_str_to_int uses ebx ecx esi, buf:dword - xor eax,eax - xor ebx,ebx - mov esi,[buf] - ;। ⥫ ᥫ - xor ecx,ecx - inc ecx - cmp byte[esi],'-' - jne @f - dec ecx - inc esi - @@: - - cmp word[esi],'0x' - je .load_digit_16 - - .load_digit_10: ;뢠 10- - mov bl,byte[esi] - cmp bl,'0' - jl @f - cmp bl,'9' - jg @f - sub bl,'0' - imul eax,10 - add eax,ebx - inc esi - jmp .load_digit_10 - jmp @f - - .load_digit_16: ;뢠 16- - add esi,2 - .cycle_16: - mov bl,byte[esi] - cmp bl,'0' - jl @f - cmp bl,'f' - jg @f - cmp bl,'9' - jle .us1 - cmp bl,'A' - jl @f ;ᥨ ᨬ >'9' <'A' - .us1: ;⠢ ᫮ - cmp bl,'F' - jle .us2 - cmp bl,'a' - jl @f ;ᥨ ᨬ >'F' <'a' - sub bl,32 ;ॢ ᨬ 孨 ॣ, 饭 ᫥饩 ࠡ⪨ - .us2: ;⠢ ᫮ - sub bl,'0' - cmp bl,9 - jle .cor1 - sub bl,7 ;convert 'A' to '10' - .cor1: - shl eax,4 - add eax,ebx - inc esi - jmp .cycle_16 - @@: - cmp ecx,0 ;᫨ ᫮ ⥫쭮 - jne @f - sub ecx,eax - mov eax,ecx - @@: - ret -endp - -;------------------------------------------------- -title db 'string to double 03.01.21',0 -hexstr db 'hex:',0 -decstr db 'dec:',0 -binstr db 'bin:',0 - -if lang eq ru_RU - numstr db '᫮:',0 - Okstr db '',0 -else - numstr db 'Number:',0 - Okstr db 'Ok',0 -end if - -mouse_dd dd 0 -edit1 edit_box 182, 59, 146, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (string1_end-string1), string1, mouse_dd, 0 -editboxes_end: - -;option_boxes -opt1 option_box option_group1, 15, 90, 8, 12, 0xffffff, 0x80ff, 0, op_text.1, 17 -opt2 option_box option_group1, 15, 106, 8, 12, 0xffffff, 0x80ff, 0, op_text.2, 18 -opt3 option_box option_group1, 15, 122, 8, 12, 0xffffff, 0x80ff, 0, op_text.3, 21 - -op_text: ;⥪ ࠤ - .1 db 'str(dec) -> float' - .2 db 'str(dec) -> double' - .3 db 'float(dec,hex) -> str' -;㪠⥫ option_box -option_group1 dd opt1 -Option_boxes1 dd opt1, opt2, opt3, 0 - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'box_lib.obj',0 - - -l_libs_start: - lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib -l_libs_end: - -align 4 -import_box_lib: - ;dd sz_init1 - edit_box_draw dd sz_edit_box_draw - edit_box_key dd sz_edit_box_key - edit_box_mouse dd sz_edit_box_mouse - ;edit_box_set_text dd sz_edit_box_set_text - option_box_draw dd aOption_box_draw - option_box_mouse dd aOption_box_mouse - ;version_op dd aVersion_op -dd 0,0 - ;sz_init1 db 'lib_init',0 - sz_edit_box_draw db 'edit_box_draw',0 - sz_edit_box_key db 'edit_box_key',0 - sz_edit_box_mouse db 'edit_box_mouse',0 - ;sz_edit_box_set_text db 'edit_box_set_text',0 - aOption_box_draw db 'option_box_draw',0 - aOption_box_mouse db 'option_box_mouse',0 - ;aVersion_op db 'version_op',0 - -i_end: - sys_colors system_colors -align 16 - sys_path rb 4096 - library_path rb 4096 - rb 0x400 ;stack -e_end: ; ⪠ ணࠬ +; ணࠬ ८ࠧ ᥫ ப +; ଠ float, double, ⠪ 10 16 筮 +; float. +; ᭮ hex2dec2bin ਬ஢ 䠩 list2_05.inc +; ( 㫠 쥢 24.05.2002), +; ChE । 16 32 ᥬ fasm. +; ணࠬ ⠪ : +; 1) ᫮ ப ॢ 4 (float) 設 +; 2) ᫮ ப ॢ 8 (double) 設 +; 3) ᫮ 設 (float) ॢ ப (5 ᫥ ⮩) + +use32 + org 0 + db 'MENUET01' + dd 1,start,i_end,e_end,e_end,0,sys_path + +include '../../../proc32.inc' +include '../../../macros.inc' +include '../../../KOSfuncs.inc' +include '../../../load_lib.mac' +include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../../develop/info3ds/info_fun_float.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +@use_library + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + cmp dword[ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_SET_EVENTS_MASK,0xC0000027 + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors + edit_boxes_set_sys_color edit1,editboxes_end,sys_colors + option_boxes_set_sys_color sys_colors,Option_boxes1 + +align 4 +red: + call draw_window + +align 4 +still: + mcall SF_WAIT_EVENT + + cmp eax,1 ; ᮢ ? + je red ; ᫨ - red + cmp eax,2 ; ? + je key ; ᫨ - key + cmp eax,3 ; ? + je button ; ᫨ - button + cmp eax,6 + je mouse + + jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 + +align 4 +key: ; + mcall SF_GET_KEY + ;cmp ah,13 + stdcall [edit_box_key], edit1 + jmp still ; 砫 横 + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah, 1 ; ᫨ ஬ 1, + jne @f + mcall SF_TERMINATE_PROCESS + @@: + cmp ah, 5 + jne @f + cmp dword[option_group1],opt3 + jne .opt_3_end + stdcall conv_str_to_int,[edit1.text] + mov dword[Data_Double],eax + finit + fld dword[Data_Double] + fstp qword[Data_Double] + + ; Data_Double - ८ࠧ㥬 ᫮ + mov word[NumberSymbolsAD],8 ; ⢮ ᫠ ᫥ ⮩ (1-17) + call DoubleFloat_to_String + call String_crop_0 + mov dword[Data_Double],eax ;⠭ 祭 ଠ float + jmp .opt_all_end + .opt_3_end: + + mov esi,string1 + mov edi,Data_String + cld + mov ecx,32 + rep movsb + + call String_to_DoubleFloat + cmp dword[option_group1],opt1 + jne .opt_all_end ;᫨ ࠭ float, ८ࠧ㥬 ࠭ 祭 double + finit + fld qword[Data_Double] ;⠥ double + fstp dword[Data_Double] ; 頥 float + .opt_all_end: + jmp red + @@: + jmp still + +align 4 +mouse: + stdcall [edit_box_mouse], edit1 + stdcall [option_box_mouse], Option_boxes1 + jmp still + +;------------------------------------------------ +align 4 +draw_window: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS, sys_colors, sizeof.system_colors + + mcall SF_REDRAW,SSF_BEGIN_DRAW + mov edx, 0x14000000 + or edx, [sys_colors.work] + mcall SF_CREATE_WINDOW, (200 shl 16)+300, (200 shl 16)+175, ,,title + + mcall SF_DEFINE_BUTTON, ((300-53) shl 16)+38, (145 shl 16)+15, 5, [sys_colors.work_button] ; Ok + + mov ecx, 0x80000000 + or ecx, [sys_colors.work_text] + mcall SF_DRAW_TEXT, (15 shl 16) +30,, binstr, + mcall , (15 shl 16) +58,, decstr, + mcall , ((240-56*3) shl 16) +58,, Data_String, + mcall , (15 shl 16) +72,, hexstr, + mcall , (15 shl 16)+150,, numstr, + + mov ecx, 0x80000000 + or ecx, [sys_colors.work_button_text] + mcall , ((300-42) shl 16)+149, , Okstr,3 + + cmp dword[option_group1],opt1 + je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ + cmp dword[option_group1],opt3 + je @f ;᫨ ࠭ float, 訥 4 ( double) ⠥ + mov ecx, dword[Data_Double+4] + mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(185 shl 16)+72,[sys_colors.work_text] ; 16- + + mov ecx, dword[Data_Double+4] + mcall ,(8 shl 16)+512,,(240 shl 16)+30, ; 2- + ror ecx, 8 + mcall ,,,((240-56) shl 16)+30, + ror ecx, 8 + mcall ,,,((240-56*2) shl 16)+30, + ror ecx, 8 + mcall ,,,((240-56*3) shl 16)+30, + ror ecx, 8 + @@: + + mov ecx,dword[Data_Double] + mcall SF_DRAW_NUMBER, (8 shl 16)+256,,(240 shl 16)+72,[sys_colors.work_text] ; 16- + + mov ecx,dword[Data_Double] + mcall , (8 shl 16)+512,,(240 shl 16)+44, ; 2- + ror ecx, 8 + mcall ,,,((240-56) shl 16)+44, + ror ecx, 8 + mcall ,,,((240-56*2) shl 16)+44, + ror ecx, 8 + mcall ,,,((240-56*3) shl 16)+44, + ror ecx, 8 + + mcall SF_DRAW_LINE, (15 shl 16)+300-15, (137 shl 16)+137, [sys_colors.work_graph] + stdcall [edit_box_draw], edit1 + stdcall [option_box_draw], Option_boxes1 + mcall SF_REDRAW,SSF_END_DRAW + +ret + + +string1 db 32 dup (0) +string1_end: + + +;input: +; buf - 㪠⥫ ப, ᫮ 10 16 筮 +;output: +; eax - ᫮ +align 4 +proc conv_str_to_int uses ebx ecx esi, buf:dword + xor eax,eax + xor ebx,ebx + mov esi,[buf] + ;। ⥫ ᥫ + xor ecx,ecx + inc ecx + cmp byte[esi],'-' + jne @f + dec ecx + inc esi + @@: + + cmp word[esi],'0x' + je .load_digit_16 + + .load_digit_10: ;뢠 10- + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'9' + jg @f + sub bl,'0' + imul eax,10 + add eax,ebx + inc esi + jmp .load_digit_10 + jmp @f + + .load_digit_16: ;뢠 16- + add esi,2 + .cycle_16: + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'f' + jg @f + cmp bl,'9' + jle .us1 + cmp bl,'A' + jl @f ;ᥨ ᨬ >'9' <'A' + .us1: ;⠢ ᫮ + cmp bl,'F' + jle .us2 + cmp bl,'a' + jl @f ;ᥨ ᨬ >'F' <'a' + sub bl,32 ;ॢ ᨬ 孨 ॣ, 饭 ᫥饩 ࠡ⪨ + .us2: ;⠢ ᫮ + sub bl,'0' + cmp bl,9 + jle .cor1 + sub bl,7 ;convert 'A' to '10' + .cor1: + shl eax,4 + add eax,ebx + inc esi + jmp .cycle_16 + @@: + cmp ecx,0 ;᫨ ᫮ ⥫쭮 + jne @f + sub ecx,eax + mov eax,ecx + @@: + ret +endp + +;------------------------------------------------- +title db 'string to double 03.01.21',0 +hexstr db 'hex:',0 +decstr db 'dec:',0 +binstr db 'bin:',0 + +if lang eq ru_RU + numstr db '᫮:',0 + Okstr db '',0 +else ; Default to en_US + numstr db 'Number:',0 + Okstr db 'Ok',0 +end if + +mouse_dd dd 0 +edit1 edit_box 182, 59, 146, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (string1_end-string1), string1, mouse_dd, 0 +editboxes_end: + +;option_boxes +opt1 option_box option_group1, 15, 90, 8, 12, 0xffffff, 0x80ff, 0, op_text.1, 17 +opt2 option_box option_group1, 15, 106, 8, 12, 0xffffff, 0x80ff, 0, op_text.2, 18 +opt3 option_box option_group1, 15, 122, 8, 12, 0xffffff, 0x80ff, 0, op_text.3, 21 + +op_text: ;⥪ ࠤ + .1 db 'str(dec) -> float' + .2 db 'str(dec) -> double' + .3 db 'float(dec,hex) -> str' +;㪠⥫ option_box +option_group1 dd opt1 +Option_boxes1 dd opt1, opt2, opt3, 0 + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'box_lib.obj',0 + + +l_libs_start: + lib_0 l_libs lib_name_0, library_path, system_dir_0,import_box_lib +l_libs_end: + +align 4 +import_box_lib: + ;dd sz_init1 + edit_box_draw dd sz_edit_box_draw + edit_box_key dd sz_edit_box_key + edit_box_mouse dd sz_edit_box_mouse + ;edit_box_set_text dd sz_edit_box_set_text + option_box_draw dd aOption_box_draw + option_box_mouse dd aOption_box_mouse + ;version_op dd aVersion_op +dd 0,0 + ;sz_init1 db 'lib_init',0 + sz_edit_box_draw db 'edit_box_draw',0 + sz_edit_box_key db 'edit_box_key',0 + sz_edit_box_mouse db 'edit_box_mouse',0 + ;sz_edit_box_set_text db 'edit_box_set_text',0 + aOption_box_draw db 'option_box_draw',0 + aOption_box_mouse db 'option_box_mouse',0 + ;aVersion_op db 'version_op',0 + +i_end: + sys_colors system_colors +align 16 + sys_path rb 4096 + library_path rb 4096 + rb 0x400 ;stack +e_end: ; ⪠ ணࠬ diff --git a/programs/develop/tinypad/trunk/data/tp-locale.inc b/programs/develop/tinypad/trunk/data/tp-locale.inc index c8a6d5870..b9bd4f183 100644 --- a/programs/develop/tinypad/trunk/data/tp-locale.inc +++ b/programs/develop/tinypad/trunk/data/tp-locale.inc @@ -1,491 +1,501 @@ - -sz htext,'TINYPAD ',APP_VERSION - -menubar_res main_menu,\ - ru,'' ,mm.File ,onshow.file ,\ - ru,'ࠢ' ,mm.Edit ,onshow.edit ,\ - ru,'' ,mm.Search ,onshow.search ,\ - ru,'' ,mm.Run ,onshow.run ,\ - ru,'஢',mm.Encoding,onshow.recode ,\ - ru,'樨' ,mm.Options ,onshow.options,\ -\ - en,'File' ,mm.File ,onshow.file ,\ - en,'Edit' ,mm.Edit ,onshow.edit ,\ - en,'Search' ,mm.Search ,onshow.search ,\ - en,'Run' ,mm.Run ,onshow.run ,\ - en,'Encoding' ,mm.Encoding,onshow.recode ,\ - en,'Options' ,mm.Options ,onshow.options,\ -\ - it,'File' ,mm.File ,onshow.file ,\ - it,'Modificare' ,mm.Edit ,onshow.edit ,\ - it,'Ricerca' ,mm.Search ,onshow.search ,\ - it,'Correre' ,mm.Run ,onshow.run ,\ - it,'Codifica' ,mm.Encoding,onshow.recode ,\ - it,'Opzioni' ,mm.Options ,onshow.options,\ -\ - et,'Fail' ,mm.File ,onshow.file ,\ - et,'Muuda' ,mm.Edit ,onshow.edit ,\ - et,'Otsi' ,mm.Search ,onshow.search ,\ - et,'Kivita' ,mm.Run ,onshow.run ,\ - et,'Kodeering',mm.Encoding,onshow.recode ,\ - et,'Seaded' ,mm.Options ,onshow.options,\ -\ - sp,'Archivo' ,mm.File ,onshow.file ,\ - sp,'Editar' ,mm.Edit ,onshow.edit ,\ - sp,'Buscar' ,mm.Search ,onshow.search ,\ - sp,'Ejecutar' ,mm.Run ,onshow.run ,\ - sp,'Codificacin',mm.Encoding,onshow.recode,\ - sp,'Opciones' ,mm.Options ,onshow.options - -popup_res mm.File,\ - ru,'' ,'Ctrl+N' ,New ,\ - ru,'...','Ctrl+O' ,Open ,\ - ru,'࠭' ,'Ctrl+S' ,Save ,\ - ru,'࠭ ...','Ctrl+Shift+S',SaveAs,\ - ru,'-','',,\ - ru,'' ,'Ctrl+F4' ,Close ,\ - ru,'-','',,\ - ru,'室' ,'Alt+X' ,Exit ,\ -\ - en,'New' ,'Ctrl+N' ,New ,\ - en,'Open...' ,'Ctrl+O' ,Open ,\ - en,'Save' ,'Ctrl+S' ,Save ,\ - en,'Save as...','Ctrl+Shift+S',SaveAs ,\ - en,'-','',,\ - en,'Close' ,'Ctrl+F4' ,Close ,\ - en,'-','',,\ - en,'Exit' ,'Alt+X' ,Exit ,\ -\ - it,'Nuovo' ,'Ctrl+N' ,New ,\ - it,'Aperto...' ,'Ctrl+O' ,Open ,\ - it,'Salva' ,'Ctrl+S' ,Save ,\ - it,'Salva come...','Ctrl+Shift+S',SaveAs ,\ - it,'-','',,\ - it,'Chiudi' ,'Ctrl+F4' ,Close ,\ - it,'-','',,\ - it,'Uscita' ,'Alt+X' ,Exit ,\ -\ - et,'Uus' ,'Ctrl+N' ,New ,\ - et,'Ava...' ,'Ctrl+O' ,Open ,\ - et,'Salvesta' ,'Ctrl+S' ,Save ,\ - et,'Salvesta nimega...','Ctrl+Shift+S',SaveAs,\ - et,'-','',,\ - et,'Sulge' ,'Ctrl+F4' ,Close ,\ - et,'-','',,\ - et,'Vlju' ,'Alt+X' ,Exit ,\ -\ - sp,'Nuevo' ,'Ctrl+N' ,New ,\ - sp,'Abrir...' ,'Ctrl+O' ,Open ,\ - sp,'Guardar' ,'Ctrl+S' ,Save ,\ - sp,'Guardar como...','Ctrl+Shift+S',SaveAs,\ - sp,'-','',,\ - sp,'Cerrar' ,'Ctrl+F4',Close,\ - sp,'-','',,\ - sp,'Salir' ,'Alt+X' ,Exit - -popup_res mm.Edit,\ - ru,'१' ,'Ctrl+X',Cut ,\ - ru,'஢' ,'Ctrl+C',Copy ,\ - ru,'⠢' ,'Ctrl+V',Insert,\ - ru,'' ,'' ,Delete,\ - ru,'-','',,\ - ru,'뤥 ' ,'Ctrl+A',SelAll,\ -\ - en,'Cut' ,'Ctrl+X',Cut ,\ - en,'Copy' ,'Ctrl+C',Copy ,\ - en,'Paste' ,'Ctrl+V',Insert,\ - en,'Delete' ,'' ,Delete,\ - en,'-','',,\ - en,'Select all','Ctrl+A',SelAll,\ -\ - it,'Taglio' ,'Ctrl+X',Cut ,\ - it,'Copia' ,'Ctrl+C',Copy ,\ - it,'Incolla' ,'Ctrl+V',Insert,\ - it,'Elimina' ,'' ,Delete,\ - it,'-','',,\ - it,'Seleziona tutto','Ctrl+A',SelAll,\ -\ - et,'Lika' ,'Ctrl+X',Cut ,\ - et,'Kopeeri' ,'Ctrl+C',Copy ,\ - et,'Kleebi' ,'Ctrl+V',Insert,\ - et,'Kustuta' ,'' ,Delete,\ - et,'-','',,\ - et,'Vali kik','Ctrl+A',SelAll,\ -\ - sp,'Cortar' ,'Ctrl+X',Cut ,\ - sp,'Copiar' ,'Ctrl+C',Copy ,\ - sp,'Pegar' ,'Ctrl+V',Insert,\ - sp,'Eliminar' ,'' ,Delete,\ - sp,'-','',,\ - sp,'Seleccionar todo','Ctrl+A',SelAll - -popup_res mm.Search,\ - ru,'३...' ,'Ctrl+G',Position,\ - ru,'-','',,\ - ru,'...' ,'Ctrl+F',Find ,\ - ru,' ','F3' ,FindNext,\ - ru,'...','Ctrl+H',Replace ,\ -\ - en,'Position...','Ctrl+G',Position,\ - en,'-','',,\ - en,'Find...' ,'Ctrl+F',Find ,\ - en,'Find next' ,'F3' ,FindNext,\ - en,'Replace...' ,'Ctrl+H',Replace ,\ -\ - it,'Posizione...','Ctrl+G',Position,\ - it,'-','',,\ - it,'Trova...' ,'Ctrl+F',Find ,\ - it,'Trova il prossimo' ,'F3' ,FindNext,\ - it,'Sostituire...' ,'Ctrl+H',Replace ,\ -\ - et,'Positsioon...','Ctrl+G',Position,\ - et,'-','',,\ - et,'Leia...' ,'Ctrl+F',Find ,\ - et,'Leia jrgmine','F3' ,FindNext,\ - et,'Asenda...' ,'Ctrl+H',Replace ,\ -\ - sp,'Posicin...' ,'Ctrl+G',Position,\ - sp,'-','',,\ - sp,'Buscar...' ,'Ctrl+F',Find ,\ - sp,'Buscar siguiente','F3' ,FindNext,\ - sp,'Reemplazar...','Ctrl+H',Replace - -popup_res mm.Run,\ - ru,'' ,'F9' ,Run ,\ - ru,' ','F10',Debug ,\ - ru,'஢' ,'Ctrl+F9',Compile ,\ - ru,'-','',,\ - ru,'᪠ ⫠' ,'' ,DbgBoard,\ - ru,'⥬ 㭪樨','' ,SysFuncs,\ -\ - en,'Run' ,'F9' ,Run ,\ - en,'Run in debugger' ,'F10' ,Debug ,\ - en,'Compile' ,'Ctrl+F9',Compile ,\ - en,'-','',,\ - en,'Debug board' ,'' ,DbgBoard,\ - en,'System functions' ,'' ,SysFuncs,\ -\ - it,'Correre' ,'F9' ,Run ,\ - it,'Esegui nel debugger','F10',Debug ,\ - it,'Compilare','Ctrl+F9',Compile ,\ - it,'-','',,\ - it,'Scheda di debug' ,'' ,DbgBoard,\ - it,'Funzioni di sistema','' ,SysFuncs,\ -\ - et,'Kivita' ,'F9' ,Run ,\ - et,'Kivita aastal siluri','F10',Debug ,\ - et,'Kompileeri' ,'Ctrl+F9',Compile ,\ - et,'-','',,\ - et,'Silumis paneel' ,'' ,DbgBoard,\ - et,'Ssteemi funktsioonid','' ,SysFuncs,\ -\ - sp,'Ejecutar' ,'F9' ,Run ,\ - sp,'Ejecutar en el depurador','F10',Debug,\ - sp,'Compilar' ,'Ctrl+F9',Compile ,\ - sp,'-','',,\ - sp,'Depuracin' ,'' ,DbgBoard,\ - sp,'Funciones del sistema' ,'',SysFuncs - -popup_res mm.Encoding,\ - @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\ - @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\ - @!,<'-'>,'',,\ - @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\ - @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\ - @!,<'-'>,'',,\ - @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\ - @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251 - -popup_res mm.Options,\ - ru,'' ,'Ctrl +',ZoomIn ,\ - ru,'' ,'Ctrl -',ZoomOut ,\ - ru,'-','',,\ - ru,' ப' ,'',LineNumbers ,\ - ru,'᭮ 뤥' ,'',SecureSel ,\ - ru,'⮬᪨ ᪮' ,'',AutoBrackets,\ - ru,'⮬᪨ ' ,'',AutoIndents ,\ - ru,'⨬쭮 ࠭' ,'',OptimalFill ,\ - ru,'-','',,\ - ru,'譨 ...' ,'',Appearance ,\ -\ - en,'Zoom in' ,'Ctrl +',ZoomIn ,\ - en,'Zoom out' ,'Ctrl -',ZoomOut ,\ - en,'-','',,\ - en,'Line numbers' ,'',LineNumbers ,\ - en,'Secure selection' ,'',SecureSel ,\ - en,'Automatic brackets' ,'',AutoBrackets,\ - en,'Automatic indents' ,'',AutoIndents ,\ - en,'Optimal fill on saving' ,'',OptimalFill ,\ - en,'-','',,\ - en,'Appearance...' ,'',Appearance ,\ -\ - it,'Ingrandire' ,'Ctrl +',ZoomIn ,\ - it,'Rimpicciolisci' ,'Ctrl -',ZoomOut ,\ - it,'-','',,\ - it,'Numeri di riga' ,'',LineNumbers ,\ - it,'Selezione sicura' ,'',SecureSel ,\ - it,'Staffe automatiche' ,'',AutoBrackets,\ - it,'Rientri automatici' ,'',AutoIndents ,\ - it,'Combina spazi' ,'',OptimalFill ,\ - it,'-','',,\ - it,'Aspetto...' ,'',Appearance ,\ -\ - et,'Zoom in' ,'Ctrl +',ZoomIn ,\ - et,'Zoom out' ,'Ctrl -',ZoomOut ,\ - et,'-','',,\ - et,'Rea numbrid' ,'',LineNumbers ,\ - et,'Turvaline valimine' ,'',SecureSel ,\ - et,'Automaatsed sulud' ,'',AutoBrackets,\ - et,'Automaatsed taandread' ,'',AutoIndents ,\ - et,'Optimaalne titmine salvestamisel','',OptimalFill,\ - et,'-','',,\ - et,'Vlimus...' ,'',Appearance ,\ -\ - sp,'Zoom in' ,'Ctrl +',ZoomIn ,\ - sp,'Zoom out' ,'Ctrl -',ZoomOut ,\ - sp,'-','',,\ - sp,'Nmeros en lneas' ,'',LineNumbers ,\ - sp,'Seleccin segura' ,'',SecureSel ,\ - sp,'Parntesis automticos' ,'',AutoBrackets,\ - sp,'Identacin automtica' ,'',AutoIndents ,\ - sp,'Llenado ptimo al guardar','',OptimalFill ,\ - sp,'-','',,\ - sp,'Apariencia...' ,'',Appearance - -lsz s_defname,\ - ru,<'ﭭ',0>,\ - en,<'Untitled',0>,\ - it,<'Senza titolo',0>,\ - et,<'Nimetu',0>,\ - sp,<'Sin ttulo',0> - -lsz s_modified,\ - ru,'',\ - en,'Modified',\ - it,'Modificato',\ - et,'Muudetud',\ - sp,'Modificado' - -lsz s_2filename,\ - ru,' 䠩:',\ - en,'Filename:',\ - en,'Nome del file:',\ - et,'Faili nimi:',\ - sp,'Nombre de archivo:' -lsz s_2open,\ - ru,'',\ - en,'Open',\ - it,'Aperto',\ - et,'Ava',\ - sp,'Abrir' -lsz s_2save,\ - ru,'࠭',\ - en,'Save',\ - it,'Salva',\ - et,'Salvesta',\ - sp,'Guardar' -lsz s_2save_no,\ - ru,'',\ - en,'No',\ - it,'No',\ - et,'Ei',\ - sp,'No' -lsz s_2find,\ - ru,'',\ - en,'Find',\ - it,'Trova',\ - et,'Leia',\ - sp,'Buscar' -db ':' -lsz s_2replace,\ - ru,'',\ - en,'Replace',\ - it,'Sostituire',\ - et,'Asenda',\ - sp,'Reemplazar' -db ':' -lsz s_2cancel,\ - ru,'⬥',\ - en,'Cancel',\ - it,'Annulla',\ - et,'Thista',\ - sp,'Cancelar' -lsz s_color,\ - ru,': 0x',\ - en,'Color: 0x',\ - it,'Colore: 0x',\ - et,'Vrv: 0x',\ - sp,'Color: 0x' -lsz s_tabpos,\ - ru,'ᯮ ',\ - en,'Tabs placement',\ - it,'Posizionamento delle schede',\ - et,'Saki asetus',\ - sp,'Lugar de tabulador' - -lsz s_enter_filename,\ - ru,<' 䠩',0>,\ - en,<'Enter filename',0>,\ - it,<'Inserisci il nome del file',0>,\ - et,<'Sisesta faili nimi',0>,\ - sp,<'Ingresa el nombre del archivo',0> - -lsz s_ask_save,\ - ru,<' ࠭?',0>,\ - en,<'Would you like to save?',0>,\ - it,<'Vorresti salvare?',0>,\ - et,<'Kas soovite salvestada?',0>,\ ; Now correct - sp,<'Quieres guardar?',0> - -lsz s_enter_text_to_find,\ - ru,<' ⥪ ᪠',0>,\ - en,<'Enter text to find',0>,\ - it,<'Inserisci il testo per trovare',0>,\ - et,<'Sisesta otsitav tekst',0>,\ - sp,<'Ingresa el texto a buscar',0> - -lsz s_enter_text_to_replace,\ - ru,<' ⥪ ',0>,\ - en,<'Enter text to replace',0>,\ - it,<'Inserisci il testo da sostituire',0>,\ - et,<'Sisesta asendatav tekst',0>,\ - sp,<'Ingresa el texto a reemplazar',0> - -lsz s_text_not_found,\ - ru,<'⨣ 䠩, ⥪ ',0>,\ - en,<'Reached end of file, text not found',0>,\ - it,<'Raggiunta la fine del file, testo non trovato',0>,\ - et,<'Faili lpp, teksti ei leitud',0>,\ - sp,<'Se lleg al final del archivo, texto no encontrado',0> - -lszc s_fs_error,b,\ - ru,<' 襭 ᯥ譮 (0)',0>,\ - ru,<'',0>,\ - ru,<'㭪 ন 䠩 ⥬ (2)',0>,\ - ru,<'⭠ 䠩 ⥬ (3)',0>,\ - ru,<'',0>,\ - ru,<' 䠩 (5)',0>,\ - ru,<' 襭 ᯥ譮 (6)',0>,\ - ru,<' 室 ࠭栬 ணࠬ (7)',0>,\ - ru,<' ᪥ ᢮ (8)',0>,\ - ru,<' FAT 㭨⮦ (9)',0>,\ - ru,<' (10)',0>,\ - ru,<'訡 ன⢠ (11)',0>,\ -\ - en,<'Operation executed successfully (0)',0>,\ - en,<'',0>,\ - en,<'Function is not supported for the given filesystem (2)',0>,\ - en,<'Unknown filesystem (3)',0>,\ - en,<'',0>,\ - en,<'Unable to open file (5)',0>,\ - en,<'Operation executed successfully (6)',0>,\ - en,<'Pointer lies outside of application memory (7)',0>,\ - en,<'Disk is full (8)',0>,\ - en,<'FAT table is destroyed (9)',0>,\ - en,<'Access denied (10)',0>,\ - en,<'Device error (11)',0>,\ -\ - it,<'Operazione eseguita correttamente (0)',0>,\ - it,<'',0>,\ - it,<'La funzione non e supportata per il file system specificato (2)', 0>, \ - it,<'Unknown filesystem (3)',0>,\ - it,<'',0>,\ - it,<'Impossibile aprire il file (5)',0>,\ - it,<'Operazione eseguita correttamente (6)',0>,\ - it,<'Il puntatore si trova al di fuori della memoria dell',96,'applicazione (7)', 0>, \ - it,<'Il disco e pieno (8)',0>,\ - it,<'La tabella FAT e distrutta (9)',0>,\ - it,<'Accesso negato (10)',0>,\ - it,<'Errore dispositivo (11)',0>,\ -\ - et,<'Operatsioon kivitati edukalt (0)',0>,\ - et,<'',0>,\ - et,<'Failissteem ei toeta funktsiooni (2)',0>,\ - et,<'Tundmatu failissteem (3)',0>,\ - et,<'',0>,\ - et,<'Faili ei suudetud avada (5)',0>,\ - et,<'Operatsioon kivitatud edukalt (6)',0>,\ - et,<'Viit on vljaspool programmi mlu (7)',0>,\ - et,<'Ketas tis (8)',0>,\ - et,<'FAT tabel hvitatud (9)',0>,\ - et,<'Juurdeps keelatud (10)',0>,\ - et,<'Seadme viga (11)',0>,\ -\ - sp,<'Operacin ejecutada correctamente (0)',0>,\ - sp,<'',0>,\ - sp,<'La funcin no est soportada por el sistema de archivos dado (2)',0>,\ - sp,<'Sistema de archivos desconocido (3)',0>,\ - sp,<'',0>,\ - sp,<'No es posible abrir el archivo (5)',0>,\ - sp,<'Operacin ejecutada correctamente (6)',0>,\ - sp,<'El puntero est fuera de la memoria de la aplicacin (7)',0>,\ - sp,<'El disco est lleno (8)',0>,\ - sp,<'La tabla FAT est destruida (9)',0>,\ - sp,<'Acceso denegado (10)',0>,\ - sp,<'Error de dispositivo (11)',0> - -lszc s_appearance,b,\ - ru,'',\ - ru,'',\ - ru,' 뤥',\ - ru,' 뤥',\ - ru,'',\ - ru,'᫠',\ - ru,'ப',\ - ru,'ਨ',\ - ru,' ப',\ - ru,'࠭ ப',\ -\ - en,'Text',\ - en,'Background',\ - en,'Selection text',\ - en,'Selection background',\ - en,'Symbols',\ - en,'Numbers',\ - en,'Strings',\ - en,'Comments',\ - en,'Modified lines',\ - en,'Saved lines',\ -\ - it,'Testo',\ - it,'Sfondo',\ - it,'Testo di selezione',\ - it,'Sfondo di selezione',\ - it,'Simboli',\ - it,'Numeri',\ - it,'Stringhe',\ - it,'Commenti',\ - it,'Linee modificate',\ - it,'Linee salvate',\ -\ - et,'Tekst',\ - et,'Taust',\ - et,'Valitud tekst',\ - et,'Valitud taust',\ - et,'Smbolid',\ - et,'Numbrid',\ - et,'Stringid',\ - et,'Kommentaarid',\ - et,'Muudetud read',\ - et,'Salvestatud read',\ -\ - sp,'Texto',\ - sp,'Fondo',\ - sp,'Texto de seleccin',\ - sp,'Fondo de seleccin',\ - sp,'Smbolos',\ - sp,'Nmeros',\ - sp,'Cadenas',\ - sp,'Comentarios',\ - sp,'Lneas modificadas',\ - sp,'Lneas guardadas' - -lsz sysfuncs_filename,\ - ru,<'SYSFUNCR.TXT',0>,\ - en,<'SYSFUNCS.TXT',0>,\ - it,<'SYSFUNCS.TXT',0>,\ - et,<'SYSFUNCET.TXT',0>,\ - sp,<'SYSFUNCS.TXT',0> - -sz s_example,'/sys/example.asm' -sz s_still ,'still' + +sz htext,'TINYPAD ',APP_VERSION + +; Language support for locales: ru_RU (CP866), en_US, it_IT, et_EE, es_ES. + +menubar_res main_menu,\ + ru_RU,'' ,mm.File ,onshow.file ,\ + ru_RU,'ࠢ' ,mm.Edit ,onshow.edit ,\ + ru_RU,'' ,mm.Search ,onshow.search ,\ + ru_RU,'' ,mm.Run ,onshow.run ,\ + ru_RU,'஢',mm.Encoding,onshow.recode ,\ + ru_RU,'樨' ,mm.Options ,onshow.options,\ +\ + en_US,'File' ,mm.File ,onshow.file ,\ + en_US,'Edit' ,mm.Edit ,onshow.edit ,\ + en_US,'Search' ,mm.Search ,onshow.search ,\ + en_US,'Run' ,mm.Run ,onshow.run ,\ + en_US,'Encoding' ,mm.Encoding,onshow.recode ,\ + en_US,'Options' ,mm.Options ,onshow.options,\ +\ + it_IT,'File' ,mm.File ,onshow.file ,\ + it_IT,'Modificare' ,mm.Edit ,onshow.edit ,\ + it_IT,'Ricerca' ,mm.Search ,onshow.search ,\ + it_IT,'Correre' ,mm.Run ,onshow.run ,\ + it_IT,'Codifica' ,mm.Encoding,onshow.recode ,\ + it_IT,'Opzioni' ,mm.Options ,onshow.options,\ +\ + et_EE,'Fail' ,mm.File ,onshow.file ,\ + et_EE,'Muuda' ,mm.Edit ,onshow.edit ,\ + et_EE,'Otsi' ,mm.Search ,onshow.search ,\ + et_EE,'Kivita' ,mm.Run ,onshow.run ,\ + et_EE,'Kodeering',mm.Encoding,onshow.recode ,\ + et_EE,'Seaded' ,mm.Options ,onshow.options,\ +\ + es_ES,'Archivo' ,mm.File ,onshow.file ,\ + es_ES,'Editar' ,mm.Edit ,onshow.edit ,\ + es_ES,'Buscar' ,mm.Search ,onshow.search ,\ + es_ES,'Ejecutar' ,mm.Run ,onshow.run ,\ + es_ES,'Codificacin',mm.Encoding,onshow.recode,\ + es_ES,'Opciones' ,mm.Options ,onshow.options + +popup_res mm.File,\ + ru_RU,'' ,'Ctrl+N' ,New ,\ + ru_RU,'...','Ctrl+O' ,Open ,\ + ru_RU,'࠭' ,'Ctrl+S' ,Save ,\ + ru_RU,'࠭ ...','Ctrl+Shift+S',SaveAs,\ + ru_RU,'-','',,\ + ru_RU,'' ,'Ctrl+F4' ,Close ,\ + ru_RU,'-','',,\ + ru_RU,'室' ,'Alt+X' ,Exit ,\ +\ + en_US,'New' ,'Ctrl+N' ,New ,\ + en_US,'Open...' ,'Ctrl+O' ,Open ,\ + en_US,'Save' ,'Ctrl+S' ,Save ,\ + en_US,'Save as...','Ctrl+Shift+S',SaveAs ,\ + en_US,'-','',,\ + en_US,'Close' ,'Ctrl+F4' ,Close ,\ + en_US,'-','',,\ + en_US,'Exit' ,'Alt+X' ,Exit ,\ +\ + it_IT,'Nuovo' ,'Ctrl+N' ,New ,\ + it_IT,'Aperto...' ,'Ctrl+O' ,Open ,\ + it_IT,'Salva' ,'Ctrl+S' ,Save ,\ + it_IT,'Salva come...','Ctrl+Shift+S',SaveAs ,\ + it_IT,'-','',,\ + it_IT,'Chiudi' ,'Ctrl+F4' ,Close ,\ + it_IT,'-','',,\ + it_IT,'Uscita' ,'Alt+X' ,Exit ,\ +\ + et_EE,'Uus' ,'Ctrl+N' ,New ,\ + et_EE,'Ava...' ,'Ctrl+O' ,Open ,\ + et_EE,'Salvesta' ,'Ctrl+S' ,Save ,\ + et_EE,'Salvesta nimega...','Ctrl+Shift+S',SaveAs,\ + et_EE,'-','',,\ + et_EE,'Sulge' ,'Ctrl+F4' ,Close ,\ + et_EE,'-','',,\ + et_EE,'Vlju' ,'Alt+X' ,Exit ,\ +\ + es_ES,'Nuevo' ,'Ctrl+N' ,New ,\ + es_ES,'Abrir...' ,'Ctrl+O' ,Open ,\ + es_ES,'Guardar' ,'Ctrl+S' ,Save ,\ + es_ES,'Guardar como...','Ctrl+Shift+S',SaveAs,\ + es_ES,'-','',,\ + es_ES,'Cerrar' ,'Ctrl+F4',Close,\ + es_ES,'-','',,\ + es_ES,'Salir' ,'Alt+X' ,Exit + +popup_res mm.Edit,\ + ru_RU,'१' ,'Ctrl+X',Cut ,\ + ru_RU,'஢' ,'Ctrl+C',Copy ,\ + ru_RU,'⠢' ,'Ctrl+V',Insert,\ + ru_RU,'' ,'' ,Delete,\ + ru_RU,'-','',,\ + ru_RU,'뤥 ' ,'Ctrl+A',SelAll,\ +\ + en_US,'Cut' ,'Ctrl+X',Cut ,\ + en_US,'Copy' ,'Ctrl+C',Copy ,\ + en_US,'Paste' ,'Ctrl+V',Insert,\ + en_US,'Delete' ,'' ,Delete,\ + en_US,'-','',,\ + en_US,'Select all','Ctrl+A',SelAll,\ +\ + it_IT,'Taglio' ,'Ctrl+X',Cut ,\ + it_IT,'Copia' ,'Ctrl+C',Copy ,\ + it_IT,'Incolla' ,'Ctrl+V',Insert,\ + it_IT,'Elimina' ,'' ,Delete,\ + it_IT,'-','',,\ + it_IT,'Seleziona tutto','Ctrl+A',SelAll,\ +\ + et_EE,'Lika' ,'Ctrl+X',Cut ,\ + et_EE,'Kopeeri' ,'Ctrl+C',Copy ,\ + et_EE,'Kleebi' ,'Ctrl+V',Insert,\ + et_EE,'Kustuta' ,'' ,Delete,\ + et_EE,'-','',,\ + et_EE,'Vali kik','Ctrl+A',SelAll,\ +\ + es_ES,'Cortar' ,'Ctrl+X',Cut ,\ + es_ES,'Copiar' ,'Ctrl+C',Copy ,\ + es_ES,'Pegar' ,'Ctrl+V',Insert,\ + es_ES,'Eliminar' ,'' ,Delete,\ + es_ES,'-','',,\ + es_ES,'Seleccionar todo','Ctrl+A',SelAll + +popup_res mm.Search,\ + ru_RU,'३...' ,'Ctrl+G',Position,\ + ru_RU,'-','',,\ + ru_RU,'...' ,'Ctrl+F',Find ,\ + ru_RU,' ','F3' ,FindNext,\ + ru_RU,'...','Ctrl+H',Replace ,\ +\ + en_US,'Position...','Ctrl+G',Position,\ + en_US,'-','',,\ + en_US,'Find...' ,'Ctrl+F',Find ,\ + en_US,'Find next' ,'F3' ,FindNext,\ + en_US,'Replace...' ,'Ctrl+H',Replace ,\ +\ + it_IT,'Posizione...','Ctrl+G',Position,\ + it_IT,'-','',,\ + it_IT,'Trova...' ,'Ctrl+F',Find ,\ + it_IT,'Trova il prossimo' ,'F3' ,FindNext,\ + it_IT,'Sostituire...' ,'Ctrl+H',Replace ,\ +\ + et_EE,'Positsioon...','Ctrl+G',Position,\ + et_EE,'-','',,\ + et_EE,'Leia...' ,'Ctrl+F',Find ,\ + et_EE,'Leia jrgmine','F3' ,FindNext,\ + et_EE,'Asenda...' ,'Ctrl+H',Replace ,\ +\ + es_ES,'Posicin...' ,'Ctrl+G',Position,\ + es_ES,'-','',,\ + es_ES,'Buscar...' ,'Ctrl+F',Find ,\ + es_ES,'Buscar siguiente','F3' ,FindNext,\ + es_ES,'Reemplazar...','Ctrl+H',Replace + +popup_res mm.Run,\ + ru_RU,'' ,'F9' ,Run ,\ + ru_RU,' ','F10',Debug ,\ + ru_RU,'஢' ,'Ctrl+F9',Compile ,\ + ru_RU,'-','',,\ + ru_RU,'᪠ ⫠' ,'' ,DbgBoard,\ + ru_RU,'⥬ 㭪樨','' ,SysFuncs,\ +\ + en_US,'Run' ,'F9' ,Run ,\ + en_US,'Run in debugger' ,'F10' ,Debug ,\ + en_US,'Compile' ,'Ctrl+F9',Compile ,\ + en_US,'-','',,\ + en_US,'Debug board' ,'' ,DbgBoard,\ + en_US,'System functions' ,'' ,SysFuncs,\ +\ + it_IT,'Correre' ,'F9' ,Run ,\ + it_IT,'Esegui nel debugger','F10',Debug ,\ + it_IT,'Compilare','Ctrl+F9',Compile ,\ + it_IT,'-','',,\ + it_IT,'Scheda di debug' ,'' ,DbgBoard,\ + it_IT,'Funzioni di sistema','' ,SysFuncs,\ +\ + et_EE,'Kivita' ,'F9' ,Run ,\ + et_EE,'Kivita aastal siluri','F10',Debug ,\ + et_EE,'Kompileeri' ,'Ctrl+F9',Compile ,\ + et_EE,'-','',,\ + et_EE,'Silumis paneel' ,'' ,DbgBoard,\ + et_EE,'Ssteemi funktsioonid','' ,SysFuncs,\ +\ + es_ES,'Ejecutar' ,'F9' ,Run ,\ + es_ES,'Ejecutar en el depurador','F10',Debug,\ + es_ES,'Compilar' ,'Ctrl+F9',Compile ,\ + es_ES,'-','',,\ + es_ES,'Depuracin' ,'' ,DbgBoard,\ + es_ES,'Funciones del sistema' ,'',SysFuncs + +popup_res mm.Encoding,\ + @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\ + @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\ + @!,<'-'>,'',,\ + @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\ + @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\ + @!,<'-'>,'',,\ + @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\ + @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251 + +popup_res mm.Options,\ + ru_RU,'' ,'Ctrl +',ZoomIn ,\ + ru_RU,'' ,'Ctrl -',ZoomOut ,\ + ru_RU,'-','',,\ + ru_RU,' ப' ,'',LineNumbers ,\ + ru_RU,'᭮ 뤥' ,'',SecureSel ,\ + ru_RU,'⮬᪨ ᪮' ,'',AutoBrackets,\ + ru_RU,'⮬᪨ ' ,'',AutoIndents ,\ + ru_RU,'⨬쭮 ࠭' ,'',OptimalFill ,\ + ru_RU,'-','',,\ + ru_RU,'譨 ...' ,'',Appearance ,\ +\ + en_US,'Zoom in' ,'Ctrl +',ZoomIn ,\ + en_US,'Zoom out' ,'Ctrl -',ZoomOut ,\ + en_US,'-','',,\ + en_US,'Line numbers' ,'',LineNumbers ,\ + en_US,'Secure selection' ,'',SecureSel ,\ + en_US,'Automatic brackets' ,'',AutoBrackets,\ + en_US,'Automatic indents' ,'',AutoIndents ,\ + en_US,'Optimal fill on saving' ,'',OptimalFill ,\ + en_US,'-','',,\ + en_US,'Appearance...' ,'',Appearance ,\ +\ + it_IT,'Ingrandire' ,'Ctrl +',ZoomIn ,\ + it_IT,'Rimpicciolisci' ,'Ctrl -',ZoomOut ,\ + it_IT,'-','',,\ + it_IT,'Numeri di riga' ,'',LineNumbers ,\ + it_IT,'Selezione sicura' ,'',SecureSel ,\ + it_IT,'Staffe automatiche' ,'',AutoBrackets,\ + it_IT,'Rientri automatici' ,'',AutoIndents ,\ + it_IT,'Combina spazi' ,'',OptimalFill ,\ + it_IT,'-','',,\ + it_IT,'Aspetto...' ,'',Appearance ,\ +\ + et_EE,'Zoom in' ,'Ctrl +',ZoomIn ,\ + et_EE,'Zoom out' ,'Ctrl -',ZoomOut ,\ + et_EE,'-','',,\ + et_EE,'Rea numbrid' ,'',LineNumbers ,\ + et_EE,'Turvaline valimine' ,'',SecureSel ,\ + et_EE,'Automaatsed sulud' ,'',AutoBrackets,\ + et_EE,'Automaatsed taandread' ,'',AutoIndents ,\ + et_EE,'Optimaalne titmine salvestamisel','',OptimalFill,\ + et_EE,'-','',,\ + et_EE,'Vlimus...' ,'',Appearance ,\ +\ + es_ES,'Zoom in' ,'Ctrl +',ZoomIn ,\ + es_ES,'Zoom out' ,'Ctrl -',ZoomOut ,\ + es_ES,'-','',,\ + es_ES,'Nmeros en lneas' ,'',LineNumbers ,\ + es_ES,'Seleccin segura' ,'',SecureSel ,\ + es_ES,'Parntesis automticos' ,'',AutoBrackets,\ + es_ES,'Identacin automtica' ,'',AutoIndents ,\ + es_ES,'Llenado ptimo al guardar','',OptimalFill ,\ + es_ES,'-','',,\ + es_ES,'Apariencia...' ,'',Appearance + +lsz s_defname,\ + ru_RU,<'ﭭ',0>,\ + en_US,<'Untitled',0>,\ + it_IT,<'Senza titolo',0>,\ + et_EE,<'Nimetu',0>,\ + es_ES,<'Sin ttulo',0> + +lsz s_modified,\ + ru_RU,'',\ + en_US,'Modified',\ + it_IT,'Modificato',\ + et_EE,'Muudetud',\ + es_ES,'Modificado' + +lsz s_2filename,\ + ru_RU,' 䠩:',\ + en_US,'Filename:',\ + en_US,'Nome del file:',\ + et_EE,'Faili nimi:',\ + es_ES,'Nombre de archivo:' + +lsz s_2open,\ + ru_RU,'',\ + en_US,'Open',\ + it_IT,'Aperto',\ + et_EE,'Ava',\ + es_ES,'Abrir' + +lsz s_2save,\ + ru_RU,'࠭',\ + en_US,'Save',\ + it_IT,'Salva',\ + et_EE,'Salvesta',\ + es_ES,'Guardar' + +lsz s_2save_no,\ + ru_RU,'',\ + en_US,'No',\ + it_IT,'No',\ + et_EE,'Ei',\ + es_ES,'No' + +lsz s_2find,\ + ru_RU,'',\ + en_US,'Find',\ + it_IT,'Trova',\ + et_EE,'Leia',\ + es_ES,'Buscar' +db ':' + +lsz s_2replace,\ + ru_RU,'',\ + en_US,'Replace',\ + it_IT,'Sostituire',\ + et_EE,'Asenda',\ + es_ES,'Reemplazar' +db ':' + +lsz s_2cancel,\ + ru_RU,'⬥',\ + en_US,'Cancel',\ + it_IT,'Annulla',\ + et_EE,'Thista',\ + es_ES,'Cancelar' + +lsz s_color,\ + ru_RU,': 0x',\ + en_US,'Color: 0x',\ + it_IT,'Colore: 0x',\ + et_EE,'Vrv: 0x',\ + es_ES,'Color: 0x' + +lsz s_tabpos,\ + ru_RU,'ᯮ ',\ + en_US,'Tabs placement',\ + it_IT,'Posizionamento delle schede',\ + et_EE,'Saki asetus',\ + es_ES,'Lugar de tabulador' + +lsz s_enter_filename,\ + ru_RU,<' 䠩',0>,\ + en_US,<'Enter filename',0>,\ + it_IT,<'Inserisci il nome del file',0>,\ + et_EE,<'Sisesta faili nimi',0>,\ + es_ES,<'Ingresa el nombre del archivo',0> + +lsz s_ask_save,\ + ru_RU,<' ࠭?',0>,\ + en_US,<'Would you like to save?',0>,\ + it_IT,<'Vorresti salvare?',0>,\ + et_EE,<'Kas soovite salvestada?',0>,\ + es_ES,<'Quieres guardar?',0> + +lsz s_enter_text_to_find,\ + ru_RU,<' ⥪ ᪠',0>,\ + en_US,<'Enter text to find',0>,\ + it_IT,<'Inserisci il testo per trovare',0>,\ + et_EE,<'Sisesta otsitav tekst',0>,\ + es_ES,<'Ingresa el texto a buscar',0> + +lsz s_enter_text_to_replace,\ + ru_RU,<' ⥪ ',0>,\ + en_US,<'Enter text to replace',0>,\ + it_IT,<'Inserisci il testo da sostituire',0>,\ + et_EE,<'Sisesta asendatav tekst',0>,\ + es_ES,<'Ingresa el texto a reemplazar',0> + +lsz s_text_not_found,\ + ru_RU,<'⨣ 䠩, ⥪ ',0>,\ + en_US,<'Reached end of file, text not found',0>,\ + it_IT,<'Raggiunta la fine del file, testo non trovato',0>,\ + et_EE,<'Faili lpp, teksti ei leitud',0>,\ + es_ES,<'Se lleg al final del archivo, texto no encontrado',0> + +lszc s_fs_error,b,\ + ru_RU,<' 襭 ᯥ譮 (0)',0>,\ + ru_RU,<'',0>,\ + ru_RU,<'㭪 ন 䠩 ⥬ (2)',0>,\ + ru_RU,<'⭠ 䠩 ⥬ (3)',0>,\ + ru_RU,<'',0>,\ + ru_RU,<' 䠩 (5)',0>,\ + ru_RU,<' 襭 ᯥ譮 (6)',0>,\ + ru_RU,<' 室 ࠭栬 ணࠬ (7)',0>,\ + ru_RU,<' ᪥ ᢮ (8)',0>,\ + ru_RU,<' FAT 㭨⮦ (9)',0>,\ + ru_RU,<' (10)',0>,\ + ru_RU,<'訡 ன⢠ (11)',0>,\ +\ + en_US,<'Operation executed successfully (0)',0>,\ + en_US,<'',0>,\ + en_US,<'Function is not supported for the given filesystem (2)',0>,\ + en_US,<'Unknown filesystem (3)',0>,\ + en_US,<'',0>,\ + en_US,<'Unable to open file (5)',0>,\ + en_US,<'Operation executed successfully (6)',0>,\ + en_US,<'Pointer lies outside of application memory (7)',0>,\ + en_US,<'Disk is full (8)',0>,\ + en_US,<'FAT table is destroyed (9)',0>,\ + en_US,<'Access denied (10)',0>,\ + en_US,<'Device error (11)',0>,\ +\ + it_IT,<'Operazione eseguita correttamente (0)',0>,\ + it_IT,<'',0>,\ + it_IT,<'La funzione non e supportata per il file system specificato (2)', 0>, \ + it_IT,<'Unknown filesystem (3)',0>,\ + it_IT,<'',0>,\ + it_IT,<'Impossibile aprire il file (5)',0>,\ + it_IT,<'Operazione eseguita correttamente (6)',0>,\ + it_IT,<'Il puntatore si trova al di fuori della memoria dell',96,'applicazione (7)', 0>, \ + it_IT,<'Il disco e pieno (8)',0>,\ + it_IT,<'La tabella FAT e distrutta (9)',0>,\ + it_IT,<'Accesso negato (10)',0>,\ + it_IT,<'Errore dispositivo (11)',0>,\ +\ + et_EE,<'Operatsioon kivitati edukalt (0)',0>,\ + et_EE,<'',0>,\ + et_EE,<'Failissteem ei toeta funktsiooni (2)',0>,\ + et_EE,<'Tundmatu failissteem (3)',0>,\ + et_EE,<'',0>,\ + et_EE,<'Faili ei suudetud avada (5)',0>,\ + et_EE,<'Operatsioon kivitatud edukalt (6)',0>,\ + et_EE,<'Viit on vljaspool programmi mlu (7)',0>,\ + et_EE,<'Ketas tis (8)',0>,\ + et_EE,<'FAT tabel hvitatud (9)',0>,\ + et_EE,<'Juurdeps keelatud (10)',0>,\ + et_EE,<'Seadme viga (11)',0>,\ +\ + es_ES,<'Operacin ejecutada correctamente (0)',0>,\ + es_ES,<'',0>,\ + es_ES,<'La funcin no est soportada por el sistema de archivos dado (2)',0>,\ + es_ES,<'Sistema de archivos desconocido (3)',0>,\ + es_ES,<'',0>,\ + es_ES,<'No es posible abrir el archivo (5)',0>,\ + es_ES,<'Operacin ejecutada correctamente (6)',0>,\ + es_ES,<'El puntero est fuera de la memoria de la aplicacin (7)',0>,\ + es_ES,<'El disco est lleno (8)',0>,\ + es_ES,<'La tabla FAT est destruida (9)',0>,\ + es_ES,<'Acceso denegado (10)',0>,\ + es_ES,<'Error de dispositivo (11)',0> + +lszc s_appearance,b,\ + ru_RU,'',\ + ru_RU,'',\ + ru_RU,' 뤥',\ + ru_RU,' 뤥',\ + ru_RU,'',\ + ru_RU,'᫠',\ + ru_RU,'ப',\ + ru_RU,'ਨ',\ + ru_RU,' ப',\ + ru_RU,'࠭ ப',\ +\ + en_US,'Text',\ + en_US,'Background',\ + en_US,'Selection text',\ + en_US,'Selection background',\ + en_US,'Symbols',\ + en_US,'Numbers',\ + en_US,'Strings',\ + en_US,'Comments',\ + en_US,'Modified lines',\ + en_US,'Saved lines',\ +\ + it_IT,'Testo',\ + it_IT,'Sfondo',\ + it_IT,'Testo di selezione',\ + it_IT,'Sfondo di selezione',\ + it_IT,'Simboli',\ + it_IT,'Numeri',\ + it_IT,'Stringhe',\ + it_IT,'Commenti',\ + it_IT,'Linee modificate',\ + it_IT,'Linee salvate',\ +\ + et_EE,'Tekst',\ + et_EE,'Taust',\ + et_EE,'Valitud tekst',\ + et_EE,'Valitud taust',\ + et_EE,'Smbolid',\ + et_EE,'Numbrid',\ + et_EE,'Stringid',\ + et_EE,'Kommentaarid',\ + et_EE,'Muudetud read',\ + et_EE,'Salvestatud read',\ +\ + es_ES,'Texto',\ + es_ES,'Fondo',\ + es_ES,'Texto de seleccin',\ + es_ES,'Fondo de seleccin',\ + es_ES,'Smbolos',\ + es_ES,'Nmeros',\ + es_ES,'Cadenas',\ + es_ES,'Comentarios',\ + es_ES,'Lneas modificadas',\ + es_ES,'Lneas guardadas' + +lsz sysfuncs_filename,\ + ru_RU,<'SYSFUNCR.TXT',0>,\ + en_US,<'SYSFUNCS.TXT',0>,\ + it_IT,<'SYSFUNCS.TXT',0>,\ + et_EE,<'SYSFUNCET.TXT',0>,\ + es_ES,<'SYSFUNCS.TXT',0> + +sz s_example,'/sys/example.asm' +sz s_still ,'still' diff --git a/programs/fs/copyr/trunk/copyr.asm b/programs/fs/copyr/trunk/copyr.asm index eefad8d2f..065c297d6 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 ; -; ; +; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ண 筠 㦥 ࠡ⠥ @@ -23,11 +23,11 @@ dd 0x10000 ; esp dd param_area , 0x0 ; I_Param , I_Icon -include 'lang.inc' -include '..\..\..\macros.inc' ; very useful stuff for MeOS +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '..\..\..\macros.inc' ; very useful stuff for MeOS include 'ascl.inc' -START: ; start of execution +START: ; start of execution ; ࠬ: ; db n1 = 筨 @@ -187,7 +187,7 @@ draw_window: mov edi,labelt ; WINDOW LABEL mcall - + mov eax,8 mov ebx,105*65536+290 mov ecx,33*65536+12 @@ -264,12 +264,13 @@ errors: db "() ⭠ 訡 " db " 筨 ਥ 㪠!!! " db " ਥ 㪠!!! " -else + +else ; Default to en_US text: db 'SOURCE: | ' db 'DESTINATION: | ' db ' ' - db 'x' ; <- END MARKER, DONT DELETE + db 'x' ; <- END MARKER, DO NOT DELETE labelt: db 'SYSTREE FILE COPIER' labellen: @@ -292,6 +293,7 @@ errors: db "(write) unknown error " db "Path to source is not given!!! " db "Path to destination is not given!!! " + end if ;0123456789012345678901234567890123456789012 diff --git a/programs/fs/kfar/trunk/kfar.asm b/programs/fs/kfar/trunk/kfar.asm index 67f42e530..9caf0db73 100644 --- a/programs/fs/kfar/trunk/kfar.asm +++ b/programs/fs/kfar/trunk/kfar.asm @@ -1,8931 +1,8935 @@ -use32 - db 'MENUET01' - dd 1 - dd start - dd i_end -memsize dd mem - dd stacktop - dd 0, app_path - -version equ '0.65' -version_dword equ 0*10000h + 65 - -min_width = 54 -max_width = 255 -min_height = 8 -max_height = 255 - -include '../../../KOSfuncs.inc' -include '../../../macros.inc' -include 'lang.inc' -include 'font.inc' -include 'sort.inc' -include 'kglobals.inc' -include 'dialogs.inc' -include 'search.inc' -include 'viewer.inc' -include 'editor.inc' -include 'tools.inc' -include 'filetool.inc' - -struct PanelData -left dd ? -top dd ? -width dd ? -height dd ? -index dd ? -start dd ? -colsz dd ? -colst dd ? -sortmode db ? - rb 3 -nfa dd ? -numfiles dd ? -files dd ? -hPlugin dd ? -hFile dd ? -parents dd ? -parents_sz dd ? -parents_alloc dd ? -colmode dd ? -colwidths rd 16+1 -total_num dd ? -total_size dq ? -selected_num dd ? -selected_size dq ? -;plugin_info: -plugin_flags dd ? -dir rb 1024 -ends - -cursor_normal_size = (font_height*15+50)/100 -cursor_big_size = font_height - -align 4 -start: - mov eax,SF_SET_EVENTS_MASK - mov ebx,(11b shl 30) or 100111b - int 0x40 - mov edi, identical_table - mov ecx, 0x100 - xor eax, eax -@@: - stosb - inc eax - loop @b - mov cl, 'A' -@@: - stosb - inc eax - loop @b - add al, 0x20 - mov cl, 'Z'-'A'+1 -@@: - stosb - inc eax - loop @b - sub al, 0x20 - mov cl, ''-'Z'-1 -@@: - stosb - inc eax - loop @b - add al, 0x20 - mov cl, ''-'' -@@: - stosb - inc eax - loop @b - add al, 0x30 - mov cl, ''-''+1 -@@: - stosb - inc eax - loop @b - sub al, 0x50 - mov cl, 256-''-1 -@@: - stosb - inc eax - loop @b - mov byte [edi-256+''], '' - mov cl, 'A' - inc eax - rep stosb - mov cl, 'Z'-'A'+1 - dec eax - rep stosb - mov cl, 'a'-'Z'-1 - inc eax - rep stosb - mov byte [edi-'a'+'_'], 0 - mov cl, 'z'-'a'+1 - dec eax - rep stosb - mov cl, ''-'z'-1 - inc eax - rep stosb - mov cl, ''-''+1 - dec eax - rep stosb - mov cl, ''-''-1 - inc eax - rep stosb - mov cl, ''-''+1 - dec eax - rep stosb - mov cl, 256-''-1 - inc eax - rep stosb - mov edi, SearchStringEditBuf - mov eax, SearchStringEditBuf.length - stosd - xor eax, eax - stosd - stosd - stosb - push SF_SYS_MISC - pop eax - push SSF_HEAP_INIT - pop ebx - int 0x40 - call init_console - call draw_window - push SF_KEYBOARD - pop eax - push SSF_SET_INPUT_MODE - pop ebx - mov ecx, ebx - int 40h ; set keyboard mode to scancodes - mov eax, 200 - mov [panel1.nfa], eax - mov [panel2.nfa], eax - mov ecx, 200*4 + 32 + 200*304 - call pgalloc - mov [panel1.files], eax - call pgalloc - mov [panel2.files], eax - test eax, eax - jz exit - xor eax, eax - cmp [panel1.files], eax - jz exit - mov [panel1.hPlugin], eax - mov [panel1.parents], eax - mov [panel1.parents_sz], eax - mov [panel1.parents_alloc], eax - mov [panel2.hPlugin], eax - mov [panel2.parents], eax - mov [panel2.parents_sz], eax - mov [panel2.parents_alloc], eax - mov [panel1.sortmode], al ; sort by name - mov [panel2.sortmode], al - mov al, 2 ; "।" ଠ - mov [panel1.colmode], eax - mov [panel2.colmode], eax - mov [num_screens], 1 - mov ecx, 0x1000 - call pgalloc - mov [screens], eax - test eax, eax - jz exit - mov ecx, panels_vtable - mov [eax], ecx - mov [active_screen_vtable], ecx - mov [active_screen_keybar], keybar_panels -; load libini.obj and kfar.ini - mov eax, libini_name - mov esi, ini_import - push 8 - pop ebp ; we use version 8 of libini - call load_dll_and_import - test eax, eax - jnz .noini - mov edi, app_path - or ecx, -1 - repnz scasb - mov dword [edi-1], '.ini' - mov byte [edi+3], 0 - push 1 - push dword aConfirmDelete - push dword aConfirmations - push dword app_path - call [ini.get_int] - mov [bConfirmDelete], al - push 0 - push dword aConfirmDeleteIncomplete - push dword aConfirmations - push dword app_path - call [ini.get_int] - mov [bConfirmDeleteIncomplete], al - push 2 - push aLeftViewMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 1 - jb @f - cmp eax, 4 - ja @f - mov [panel1.colmode], eax -@@: - push 2 - push aRightViewMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 1 - jb @f - cmp eax, 4 - ja @f - mov [panel2.colmode], eax -@@: - push 0 - push aLeftSortMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 14 - jae @f - mov [panel1.sortmode], al -@@: - push 0 - push aRightSortMode - push aPanels - push app_path - call [ini.get_int] - cmp eax, 14 - jae @f - mov [panel2.sortmode], al -@@: - push nullstr - push 512 - push saved_file_name - push aEolStyle - push aEditor - push app_path - call [ini.get_str] - mov cl, edit.eol_dos - mov al, [saved_file_name] - or al, 20h - cmp al, 'd' - jz @f - mov cl, edit.eol_mac - cmp al, 'm' - jz @f - mov cl, edit.eol_unix -@@: - mov [EditEOLStyle], cl - mov ecx, 0x1000 - call xpgalloc - test eax, eax - jz .skip_assoc - mov [associations], eax - push enum_associations_callback - push aAssociations - push app_path - call [ini.enum_keys] -.skip_assoc: - xor ebp, ebp - xor esi, esi -.shortcut_loop: - mov edi, saved_file_name - push dword nullstr - push 512 - push edi - push dword aShortcut - push dword aFolderShortcuts - push dword app_path - call [ini.get_str] - cmp byte [edi], 0 - jz .shortcut_cont - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - cmp ecx, 2 - jz @f - cmp byte [edi-2], '/' - jnz @f - mov byte [edi-2], 0 - dec ecx -@@: - mov al, [aShortcut.d] - push esi - inc esi - mov [FolderShortcuts+(eax-'0')*4], esi - lea esi, [esi+ecx-1] - push esi - and esi, 0xFFF - cmp esi, ecx - pop esi - ja .norealloc - mov edx, ebp - mov ecx, esi - call xpgrealloc - test eax, eax - jnz @f - pop esi - mov edi, FolderShortcuts - mov ecx, 10 - rep stosd - jmp .skip_shortcuts -@@: - mov ebp, eax -.norealloc: - pop edi - add edi, ebp - mov ecx, saved_file_name -@@: - mov al, [ecx] - inc ecx - stosb - test al, al - jnz @b -.shortcut_cont: - inc [aShortcut.d] - cmp [aShortcut.d], '9' - jbe .shortcut_loop - mov esi, FolderShortcuts - mov ecx, 10 - dec ebp -.l3: - lodsd - test eax, eax - jz @f - add [esi-4], ebp -@@: - loop .l3 -.skip_shortcuts: -; load plugins - push enum_plugins_callback - push aPlugins - push app_path - call [ini.enum_keys] -; calculate info for editor - xor ebx, ebx - mov ecx, [num_plugins] - mov esi, [plugins] -@@: - dec ecx - js @f - mov [esi+PluginInfo.EditInfoOffs], ebx - add ebx, [esi+PluginInfo.EditInfoSize] - jnc @f - sbb ebx, ebx -@@: -; ᪮ ࠧ । ࠭祭, ࠧ , १ࢨ㥬 , ࠭祭 -; 512 - 㡠 業, ࠭ ࠡ ।, ॠ쭮 ॡ - cmp ebx, 512 - jb @f - or ebx, -1 - mov [EditPlugInfo], ebx ; disable plugins for editor - push ContinueBtn - push 1 - push EditConfigErr_ptr - push 2 - call SayErr -@@: - add ebx, 3 - and ebx, not 3 - mov [EditPlugInfo], ebx -.noini: - mov eax, [EditPlugInfo] - add eax, editor_line.plugdata - imul eax, max_height - add eax, editor_data.basesize + 0xFFF - shr eax, 12 - mov [EditDataSize], eax - mov esi, def_left_dir - mov edi, panel1.dir -@@: - lodsb - stosb - test al, al - jnz @b - mov esi, def_right_dir - mov edi, panel2.dir -@@: - lodsb - stosb - test al, al - jnz @b - call draw_keybar - call draw_cmdbar - mov [prev_dir], 0 - mov ebp, panel1 - call calc_colwidths - call read_folder - call draw_panel - mov [bSilentFolderMode], 1 - mov ebp, panel2 - call calc_colwidths - call read_folder - call draw_panel -event: - call get_event - dec eax - jz redraw - dec eax - jz key - sub eax,4 - jz mouse -; button - we have only one button, close -exit: -; close all screens -@@: - mov ecx, [num_screens] - mov eax, [screens] - mov ebp, [eax+ecx*8-4] - mov eax, [eax+ecx*8-8] - push ebp - call [eax+screen_vtable.OnExit] - pop ecx - call pgfree - dec [num_screens] - jnz @b -; unload all plugins - mov ecx, [num_plugins] - imul esi, ecx, PluginInfo.size - add esi, [plugins] -.unload: - dec ecx - js .unload_done - sub esi, PluginInfo.size - push ecx esi - call [esi+PluginInfo.unload] - pop esi ecx - jmp .unload -.unload_done: - cmp [ini.set_int], aIniSetInt - jz .nosave - push [panel1.colmode] - push aLeftViewMode - push aPanels - push app_path - call [ini.set_int] - push [panel2.colmode] - push aRightViewMode - push aPanels - push app_path - call [ini.set_int] - movzx eax, [panel1.sortmode] - push eax - push aLeftSortMode - push aPanels - push app_path - call [ini.set_int] - movzx eax, [panel2.sortmode] - push eax - push aRightSortMode - push aPanels - push app_path - call [ini.set_int] -.nosave: -if CHECK_FOR_LEAKS - mov ecx, [panel1.files] - call pgfree - mov ecx, [panel2.files] - call pgfree - mov ecx, [screens] - call pgfree - mov ecx, [associations] - call pgfree - mov ecx, [console_data_ptr] - call pgfree - mov ecx, [MemForImage] - call pgfree - mov esi, FolderShortcuts - push 10 - pop ecx -@@: - lodsd - test eax, eax - jnz @f - loop @b - jmp .nofreefs -@@: - mov ecx, eax - call pgfree - mov ecx, [plugins] - call pgfree - mov ecx, [panel1.parents] - call pgfree - mov ecx, [panel2.parents] - call pgfree -.nofreefs: - mov eax, [numallocatedregions] - test eax, eax - jz @f - mov edi, allocatedregions - int3 - jmp $ -@@: -end if - or eax, SF_TERMINATE_PROCESS - int 40h - -align 16 -get_event: - push ebx - mov ebx, [idle_interval] - cmp ebx, -1 - jz .infinite - push SF_WAIT_EVENT_TIMEOUT - pop eax - int 40h - pop ebx - test eax, eax - jnz .ret - mov ebp, [active_screen_data] - mov eax, [active_screen_vtable] - mov eax, [eax+screen_vtable.OnIdle] - test eax, eax - jz get_event - call eax - jmp get_event -.infinite: - pop ebx - push SF_WAIT_EVENT - pop eax - int 40h -.ret: - ret - -redraw: -; query kbd state from OS - mov al, SF_KEYBOARD - push SSF_GET_CONTROL_KEYS - pop ebx - int 0x40 - and eax, 0x3F - cmp al, [ctrlstate] - mov [ctrlstate], al - jz @f - call draw_keybar -@@: - mov al, SF_THREAD_INFO - mov ebx, procinfo - or ecx, -1 - int 40h -; test if rolled up -; height of rolled up window is [skinh]+3 - mov eax, [ebx+46] - sub eax, [skinh] - cmp eax, 5 - ja @f - mov al, SF_REDRAW - push SSF_BEGIN_DRAW - pop ebx - int 0x40 - xor eax, eax -; ebx, ecx, edi are ignored by function 0 after first redraw - mov edx, 0x53000000 - int 0x40 - mov al, SF_REDRAW - inc ebx - int 0x40 - jmp event -@@: - xor ecx, ecx - mov eax, [ebx+42] - mov [wnd_width], eax - sub eax, 5*2-1 - jae @f - xor eax, eax -@@: - cdq - mov esi, font_width - div esi - cmp eax, min_width - jae @f - mov al, min_width - mov ch, 1 -@@: - cmp eax, max_width - jbe @f - mov eax, max_width - mov ch, 1 -@@: - cmp eax, [cur_width] - mov [cur_width], eax - setnz cl - or cl, ch - test edx, edx - mov [fill_width], edx - setnz ch - mov eax, [ebx+46] - mov [wnd_height], eax - sub eax, [skinh] - sub eax, 5-1 - jns @f - xor eax, eax -@@: - cdq - mov esi, font_height - div esi - cmp eax, min_height - jae @f - mov al, min_height - mov cl, 1 -@@: - cmp eax, max_height - jbe @f - mov eax, max_height - mov cl, 1 -@@: - mov [fill_height], edx - cmp eax, [cur_height] - mov [cur_height], eax - jnz .resize - test cl, cl - jnz .resize - test edx, edx - setnz cl - or cl, ch - jz @f - test byte [ebx+70], 1 - jnz @f -.resize: - push SF_CHANGE_WINDOW - pop eax - or ebx, -1 - or ecx, -1 - mov edx, [cur_width] - imul edx, font_width - add edx, 5*2-1 - mov esi, [cur_height] - imul esi, font_height - add esi, [skinh] - add esi, 5-1 - int 40h -.resize_draw: - mov ecx, [MemForImage] - call pgfree - and [MemForImage], 0 - call init_console -; call draw_window - call draw_keybar - mov ebp, [active_screen_data] - mov eax, [active_screen_vtable] - mov [cursor_size], cursor_normal_size - call dword [eax+screen_vtable.OnRedraw] - jmp event -@@: - call draw_window - jmp event -alt_f9: - cmp [saved_width], -1 - jz @f - mov eax, [saved_width] - mov [cur_width], eax - or [saved_width], -1 - mov eax, [saved_height] - mov [cur_height], eax - or [saved_height], -1 - jmp redraw.resize -@@: - push SF_STYLE_SETTINGS - pop eax - push SSF_GET_SCREEN_AREA - pop ebx - int 0x40 - push eax - sub eax, [esp+2] - inc eax - movzx eax, ax - sub eax, 10 - xor edx, edx - mov ecx, font_width - div ecx - xchg [cur_width], eax - mov [saved_width], eax - mov eax, ebx - shr ebx, 16 - sub eax, ebx - sub eax, 5-1 - sub eax, [skinh] - xor edx, edx - mov ecx, font_height - div ecx - xchg [cur_height], eax - mov [saved_height], eax - mov ecx, ebx - pop ebx - shr ebx, 16 - mov edx, [cur_width] - imul edx, font_width - add edx, 5*2-1 - mov esi, [cur_height] - imul esi, font_height - add esi, [skinh] - add esi, 4 - push SF_CHANGE_WINDOW - pop eax - int 0x40 - jmp redraw.resize_draw -key: - mov al, SF_GET_KEY - int 40h - test al, al - jnz event - xchg al, ah - cmp al, 0xE0 - jnz @f - mov [bWasE0], 1 - jmp event -@@: - xchg ah, [bWasE0] - mov ebp, [active_screen_data] - mov edx, [active_screen_vtable] - cmp al, 0x1D - jz .ctrl_down - cmp al, 0x9D - jz .ctrl_up - cmp al, 0x2A - jz .lshift_down - cmp al, 0xAA - jz .lshift_up - cmp al, 0x36 - jz .rshift_down - cmp al, 0xB6 - jz .rshift_up - cmp al, 0x38 - jz .alt_down - cmp al, 0xB8 - jz .alt_up - call [edx+screen_vtable.OnKey] - jmp event -.ctrl_down: - test ah, ah - jnz .rctrl_down - or [ctrlstate], 4 - jmp .keybar -.rctrl_down: - or [ctrlstate], 8 - jmp .keybar -.ctrl_up: - test ah, ah - jnz .rctrl_up - and [ctrlstate], not 4 - jmp .keybar -.rctrl_up: - and [ctrlstate], not 8 -.keybar: - call draw_keybar - call draw_image -@@: jmp event -.lshift_down: -; ignore E0 2A sequence -; e.g. arrow keys with NumLock on generate sequence E0 2A E0 xx / E0 xx+80 E0 AA -; where xx is scancode, so we can safely ignore E0 2A - test ah, ah - jnz @b - or [ctrlstate], 1 - jmp .keybar -.lshift_up: -; ignore E0 AA sequence - test ah, ah - jnz @b - and [ctrlstate], not 1 - jmp .keybar -.rshift_down: - or [ctrlstate], 2 - jmp .keybar -.rshift_up: - and [ctrlstate], not 2 - jmp .keybar -.alt_down: - test ah, ah - jnz .ralt_down - or [ctrlstate], 0x10 - jmp .keybar -.ralt_down: - or [ctrlstate], 0x20 - jmp .keybar -.alt_up: - test ah, ah - jnz .ralt_up - and [ctrlstate], not 0x10 - jmp .keybar -.ralt_up: - and [ctrlstate], not 0x20 - jmp .keybar - -align 16 -mouse: - mov eax,SF_MOUSE_GET - mov ebx,SSF_BUTTON_EXT - int 0x40 - mov byte[mousestate], 1 - bt eax,24 ;left but. double click - jc @f - mov byte[mousestate], 0 - bt eax,8 ;left but. down - jc @f - jmp event -@@: - mov eax,SF_MOUSE_GET - mov ebx,SSF_WINDOW_POSITION - int 0x40 - cmp ax, word[skinh] - jl event - sub ax, word[skinh] - xor dx, dx - mov bx, font_height - div bx - movzx edx,ax - shr eax,16 - - mov ebx, [cur_height] - dec ebx - cmp edx, ebx - je .on_panel - cmp dword[active_screen],0 - jg event ;.on_edit - cmp edx, 2 - jl .no_ch_pos - dec edx ; ࠬ - dec edx ; - sub ebx, 7-1 - cmp edx, ebx - jge .no_ch_pos - - push edx eax - mov ecx, [cur_width] -if font_width & 3 - imul ecx, font_width - shr ecx, 2 -else - imul ecx, font_width/4 -end if - xor dx, dx - sub ax, 5 ;window border - div cx - bt ax, 0 - jnc @f - add [esp+4], ebx ;᫨ 2- ⮫ -@@: - pop eax ;edx in stack - jmp @f -.no_ch_pos: - push -1 ;edx = -1 - no change position -@@: - - mov ebx, [cur_width] - imul ebx, font_width/2 - add ebx, 5 ;window border - cmp eax,ebx - jg @f - cmp [active_panel], panel1 - je .move - jmp .tab -@@: - cmp [active_panel], panel2 - je .move -.tab: - xor [active_panel], panel1 xor panel2 - call draw_cmdbar - mov ebp, [active_panel] - xor ebp, panel1 xor panel2 - call draw_panel -.move: - mov ebp, [active_panel] - pop edx - mov eax, [ebp + PanelData.numfiles] - add edx, [ebp + PanelData.start] ;᫮ ப祭 䠩 - dec eax - cmp edx, eax - jle @f - mov edx, eax -@@: - cmp edx, 0 - jl @f - mov [ebp + PanelData.index], edx - cmp byte[mousestate], 0 - je @f - call panels_OnKey.enter - jmp event -@@: - call draw_panel - jmp event -align 4 -.on_panel: - call get_keybar_ind - lea eax, [mouse_panels+4*eax] - cmp [active_screen_keybar], keybar_viewer - jne @f - add eax, mouse_viewer-mouse_panels -@@: - cmp [active_screen_keybar], keybar_editor - jne @f - add eax, mouse_editor-mouse_panels -@@: - cmp dword[eax], 0 - je event - - mov ebx, [active_screen] - mov ebp, [screens] - mov ebp, [ebp+ebx*8+4] - - cmp dword[active_screen],0 - jne @f - mov ebp, [active_panel] - mov ecx, [ebp + PanelData.index] -@@: - push dword[eax] - sub eax, mouse_panels - shr eax, 2 - xor edx, edx - mov ebx, 12 - div ebx - lea eax, [edx+0x3B] ;eax - F1...F12 - pop ebx - call ebx - jmp event -if 0 ;not work insert text -align 4 -.on_edit: - cmp [active_screen_keybar], keybar_editor - jne event - cmp edx, 1 - jl event - push edx - xor edx, edx - mov ebx, font_width - div ebx - pop edx - mov ebx, [active_screen] - mov ebp, [screens] - mov ebp, [ebp+ebx*8+4] - mov [ebp + editor_data.cursor_x], eax - mov [ebp + editor_data.cursor_y], edx - call editor_OnRedraw - jmp event -end if - -;input: -; eax - coord x -;output: -; eax - key bar index (0 to 95) if press F1 index = 0 -align 16 -get_keybar_ind: - push ebx ecx edx esi edi - xor edx, edx - mov ebx, font_width - sub eax, 5 ;border - div ebx - mov edi, eax - - xor esi, esi - test [ctrlstate], 3 - jz @f - inc esi -@@: - test [ctrlstate], 0xC - jz @f - or si, 2 -@@: - test [ctrlstate], 0x30 - jz @f - or si, 4 -@@: - imul esi, 12 ;᫮ F1-F12 - xor ecx, ecx - inc ecx - mov ebx, 6 - mov eax, [cur_width] - sub eax, 11+9+3*2+6 - cmp eax, 7*11 - jl @f - cdq - mov bl, 11 - div ebx - mov ebx, eax -@@: - xor edx, edx -.l: - add edx, 7 - cmp ecx, 10 - jb @f - inc edx -@@: - cmp edx, edi - ja .ret - cmp edx, [cur_width] - ja .ret - cmp ecx, 12 - jz .ret - lea edx, [edx+ebx-6] - inc edx - cmp edx, [cur_width] - ja .ret - inc ecx - jmp .l -.ret: - lea eax, [esi+ecx-1] - pop edi esi edx ecx ebx - ret - -align 16 -process_ctrl_keys: - cmp byte [esi], 0 - jz .done - push ecx - cmp al, [esi] - jz .check -.cont: - pop ecx - add esi, 8 - jmp process_ctrl_keys -.done: - stc - ret -.check: - mov cl, 0 - call .check_ctrlkey - jc .cont - mov cl, 2 - call .check_ctrlkey - jc .cont - mov cl, 4 - call .check_ctrlkey - jc .cont - pop ecx - call dword [esi+4] - clc - ret -.check_ctrlkey: - push eax edx - movzx edx, [ctrlstate] - shr edx, cl - add cl, cl - movzx eax, word [esi+2] - shr eax, cl - and eax, 15 - cmp al, ctrlkey_tests_num - jae .fail - xchg eax, edx - and al, 3 - call [ctrlkey_tests + edx*4] - cmp al, 1 - pop edx eax - ret -.fail: - stc - pop edx eax - ret - -ctrlkey_test0: - test al, al - setz al - ret -ctrlkey_test1: - test al, al - setnp al - ret -ctrlkey_test2: - cmp al, 3 - setz al - ret -ctrlkey_test3: - cmp al, 1 - setz al - ret -ctrlkey_test4: - cmp al, 2 - setz al - ret - -enum_associations_callback: -; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); -; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value - mov esi, [esp+12] - mov edi, esi -@@: - lodsb - test al, al - jnz @b - sub esi, edi ; esi = size of key name - mov eax, [esp+16] -@@: - inc esi - inc eax - cmp byte [eax-1], 0 - jnz @b -; esi = total size of entry - push esi - add esi, [associations_size] - mov ecx, [associations_allocated] -@@: - cmp esi, ecx - jbe @f - add ecx, ecx - jmp @b -@@: - pop esi - cmp [associations_allocated], ecx - jz @f - mov [associations_allocated], ecx - mov edx, [associations] - call xpgrealloc - mov [associations], eax - test eax, eax - jz .err -@@: - mov eax, esi - mov esi, edi - mov edi, [associations] - add edi, [associations_size] - dec edi - add [associations_size], eax -@@: - lodsb - stosb - test al, al - jnz @b - mov esi, [esp+16] -@@: - lodsb - stosb - test al, al - jnz @b -.ret: - mov al, 1 - ret 16 -.err: - mov ecx, edx - call pgfree - xor eax, eax - ret 16 - -align 4 -enum_plugins_callback: -; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); -; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value - mov esi, [esp+16] - cmp byte [esi], '/' - jz .absolute -; convert path to absolute - mov edi, execdata -@@: - cmp edi, execdata+1024 - jae .overflow - lodsb - stosb - test al, al - jnz @b - mov edi, saved_file_name - mov [esp+16], edi - mov esi, app_path - push esi - xor ecx, ecx -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - mov ecx, esi - jmp @b -@@: - pop esi - sub ecx, esi - push edi - add edi, ecx - cmp edi, saved_file_name+1024 - pop edi - ja .overflow - rep movsb - mov esi, execdata -.z: - cmp word [esi], '.' - jz .ret - cmp word [esi], './' - jnz @f - add esi, 2 - jmp .z -@@: - cmp word [esi], '..' - jnz .c - cmp byte [esi+2], 0 - jz .ret - cmp byte [esi+2], '/' - jnz .c - add esi, 3 -@@: - dec edi - cmp edi, saved_file_name - jbe .ret - cmp byte [edi-1], '/' - jnz @b - jmp .z -.c: - cmp edi, saved_file_name+1024 - jae .overflow - lodsb - stosb - test al, al - jnz .c - jmp .absolute -.overflow: - mov esi, execdata - mov byte [esi+1023], 0 - call load_dll_and_import.big -.ret: - mov al, 1 - ret 16 -.absolute: -; allocate space for plugin info - mov eax, [num_plugins] - inc eax - mov [num_plugins], eax - imul ecx, eax, PluginInfo.size - cmp ecx, [alloc_plugins] - jbe .norealloc - mov edx, [plugins] - call xpgrealloc - test eax, eax - jnz @f -.dec_ret: - dec [num_plugins] - jmp .ret -@@: - mov [plugins], eax - lea eax, [ecx+0xFFF] - and eax, not 0xFFF - mov [alloc_plugins], eax -.norealloc: - mov esi, [plugins] - lea esi, [esi+ecx-PluginInfo.size] -; load plugin DLL - or ebp, -1 - mov eax, [esp+16] - call load_dll_and_import.do - test eax, eax - jnz .dec_ret -; find exported functions - mov eax, aVersion - call load_dll_and_import.find_exported_function - jnc @f - xor eax, eax -@@: -MIN_INTERFACE_VER = 3 -MAX_INTERFACE_VER = 3 - cmp eax, MIN_INTERFACE_VER - jb @f - cmp eax, MAX_INTERFACE_VER - jbe .version_ok -@@: - push aIncompatibleVersion -.cantload: - push dword [esp+4+16] - push aCannotLoadPlugin - mov eax, esp - push ContinueBtn - push 1 - push eax - push 3 - call SayErr - add esp, 12 - jmp .dec_ret -.version_ok: - mov edi, esi - mov esi, plugin_exported -.import: - lodsd - test eax, eax - jz .import_done - call load_dll_and_import.find_exported_function - jnc @f - mov eax, [esi-4+plugin_exported_default-plugin_exported] -@@: - stosd - jmp .import -.import_done: -; initialize plugin - mov eax, aPluginLoad - call load_dll_and_import.find_exported_function - jc .ok - push kfar_info - call eax - cmp eax, 1 - jb .ok - ja .dec_ret - push aInitFailed - jmp .cantload -.ok: - mov al, 1 - ret 16 - -plugin_unload_default: - ret - -OpenFilePlugin_default: - xor eax, eax - ret 28 -GetFiles_default: - xor eax, eax - ret 20 - -ClosePlugin_default: - ret 4 - -GetOpenPluginInfo_default: - ret 8 - -SetFolder_default: -open_default: - xor eax, eax - ret 12 - -new_screen: -; in: ecx=sizeof(screen data), edx->vtable -; out: ebp=pointer or NULL, eax!=0 if successful -; destroys ebx,ecx - call xpgalloc - test eax, eax - jnz @f - ret -@@: - mov ebp, eax - mov eax, [screens] - mov ecx, [num_screens] - inc ecx - shl ecx, 3 - test ecx, 0xFFF - jnz .norealloc - push edx - mov edx, eax - call xpgrealloc - pop edx - test eax, eax - jnz @f - mov ecx, ebp - call pgfree - xor eax, eax - ret -@@: - mov [screens], eax -.norealloc: - inc [num_screens] - mov [eax+ecx-8], edx - mov [eax+ecx-4], ebp - mov eax, [num_screens] - dec eax - mov [active_screen], eax - mov [active_screen_vtable], edx - mov [active_screen_data], ebp - or [idle_interval], -1 - mov edx, [edx+screen_vtable.keybar] - test edx, edx - jz @f - mov [active_screen_keybar], edx -@@: - jmp draw_keybar - -next_screen: - mov eax, [active_screen] - inc eax - cmp eax, [num_screens] - jnz @f - xor eax, eax -@@: mov [active_screen], eax - jmp change_screen - -delete_active_screen: - mov edi, [screens] - mov eax, [active_screen] - shl eax, 3 - add edi, eax - push dword [edi+4] - lea esi, [edi+8] - mov ecx, [num_screens] - sub ecx, [active_screen] - dec ecx - add ecx, ecx - rep movsd - dec [num_screens] - mov ecx, [num_screens] - shl ecx, 3 - test ecx, 0xFFF - jnz .norealloc - mov edx, [screens] - call pgrealloc ; must succeed, because we decrease size - mov [screens], eax -.norealloc: - pop ecx - call pgfree - dec [active_screen] - -change_screen: - pusha - or [idle_interval], -1 - mov eax, [active_screen] - mov esi, [screens] - mov ebp, [esi+eax*8+4] - mov eax, [esi+eax*8] - push eax ebp - mov eax, [eax+screen_vtable.OnActivate] - test eax, eax - jz @f - call eax -@@: - pop ebp eax - mov [active_screen_vtable], eax - mov [active_screen_data], ebp - mov edx, [eax+screen_vtable.keybar] - test edx, edx - jz @f - mov [active_screen_keybar], edx -@@: - call draw_keybar - mov [cursor_size], cursor_normal_size - call [eax+screen_vtable.OnRedraw] - popa - ret - -F12: - mov eax, [cur_width] - add eax, 8 - mov esi, eax - mul [num_screens] - mov ecx, eax - call xpgalloc - test eax, eax - jnz @f - ret -@@: - mov ebx, eax - mov edi, eax - xor ecx, ecx -.next: - xor eax, eax - stosd - inc ecx - cmp ecx, [num_screens] - jz @f - lea eax, [edi+esi-4] - mov dword [edi-4], eax -@@: - xor eax, eax - stosd - dec ecx - jz @f - lea eax, [edi-8] - sub eax, esi - mov dword [edi-4], eax -@@: - mov al, '&' - stosb - cmp ecx, 36 - jae .noletter - lea eax, [ecx+'0'] - cmp al, '9' - jbe @f - add al, 7 -@@: - stosb - mov al, '.' - stosb - jmp .letter_done -.noletter: - mov al, ' ' - stosb - stosb -.letter_done: - mov al, ' ' - stosb - pushad - mov eax, [screens] - mov ebp, [eax+ecx*8+4] - mov eax, [eax+ecx*8] - mov ecx, [cur_width] - sub ecx, 12 - call [eax + screen_vtable.getname] - popad - sub edi, 4 - add edi, [cur_width] - inc ecx - cmp ecx, [num_screens] - jb .next - mov eax, [active_screen] - mul esi - add eax, ebx - push 1 - push dword aScreens - push eax - call menu - cmp eax, -1 - jz @f - sub eax, ebx - div esi - mov [active_screen], eax -@@: - mov ecx, ebx - call pgfree - jmp change_screen - -panels_OnKey: -; restore screen hidden by quick search box - cmp [bDisplayQuickSearch], 0 - jz @f - mov [bDisplayQuickSearch], 0 - push 0 - push QuickSearchDlg - call HideDialogBox -@@: - mov ebp, [active_panel] - mov ecx, [ebp + PanelData.index] - mov edx, [ebp + PanelData.start] - mov ebx, [ebp + PanelData.colst] - add ebx, edx - mov esi, panels_ctrlkeys - call process_ctrl_keys - jc .nostdkey - mov [bQuickSearchMode], 0 - ret -.leaveqsmode: - mov [bQuickSearchMode], 0 - call draw_image - ret -.keepqsmode: - push QuickSearchDlg - call ShowDialogBox - mov [bDisplayQuickSearch], 1 - ret -.nostdkey: - cmp [bQuickSearchMode], 0 - jz .noqsmode - test al, al - js .keepqsmode - cmp al, 40h - jae .leaveqsmode - cmp al, 0Eh - jz .qsbackspace - cmp al, 1Ch - jz .test_enter - movzx eax, al - cmp byte [scan2ascii+eax], 0 - jz .leaveqsmode - call get_ascii_char - mov ecx, dword [quick_search_buf + 4] - cmp ecx, quicksearch_maxlen - jae .keepqsmode - mov byte [quick_search_buf + 12 + ecx], al - mov byte [quick_search_buf + 12 + ecx + 1], 0 - push ecx - call quick_find - pop ecx - jnc @f - mov byte [quick_search_buf + 12 + ecx], 0 - jmp .keepqsmode -@@: - inc dword [quick_search_buf + 4] - sub ecx, 16 - jae @f - xor ecx, ecx -@@: - mov dword [quick_search_buf + 8], ecx - jmp .keepqsmode -.qsbackspace: - mov ecx, dword [quick_search_buf + 4] - jecxz .keepqsmode2 - dec ecx - mov byte [quick_search_buf + 12 + ecx], 0 - dec dword [quick_search_buf + 4] -.keepqsmode2: - jmp .keepqsmode -.test_enter: - test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? - jz .keepqsmode2 - test [ctrlstate], 3 ; Shift pressed? - jnz @f - call quick_find_next - jmp .keepqsmode2 -@@: - call quick_find_prev - jmp .keepqsmode2 -.noqsmode: -; handle Alt+ combinations for quick search - test [ctrlstate], 30h ; LAlt or RAlt pressed? - jz .noalt ; no => skip - test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? - jnz .noalt ; yes => skip - cmp al, 40h - jae .noalt - movzx eax, al - cmp byte [scan2ascii+eax], 0 - jz .noalt - call get_ascii_char - mov edi, quick_search_buf + 12 - mov dword [edi-12], quicksearch_maxlen-1 - mov dword [edi-8], 1 - and dword [edi-4], 0 - stosb - mov byte [edi], 0 - call quick_find - jnc @f - mov byte [quick_search_buf + 12], 0 - and dword [quick_search_buf + 4], 0 -@@: - mov ebx, QuickSearchDlg - mov eax, [ebp + PanelData.left] - add eax, 10 - mov edx, [cur_width] - sub edx, 21 - cmp eax, edx - jb @f - mov eax, edx -@@: - mov [ebx + dlgtemplate.x], eax - mov eax, [ebp + PanelData.top] - add eax, [ebp + PanelData.height] - mov edx, [cur_height] - sub edx, 2 - cmp eax, edx - jb @f - mov eax, edx -@@: - mov [ebx + dlgtemplate.y], eax - push ebx - call ShowDialogBox - mov [bQuickSearchMode], 1 - mov [bDisplayQuickSearch], 1 -.find_letter_done: -.noalt: -.ret: - ret -.up: - jecxz .ret - dec ecx - mov [ebp + PanelData.index], ecx - cmp ecx, edx - jae .done_redraw - mov [ebp + PanelData.start], ecx -.done_redraw: -; call draw_panel -; ret - jmp draw_panel -.insert: - lea eax, [ecx*4] - add eax, [ebp + PanelData.files] - mov eax, [eax] - cmp word [eax+40], '..' - jnz @f - cmp byte [eax+42], 0 - jz .insert.down -@@: - xor byte [eax+303], 1 - mov edx, [eax+32] - test byte [eax+303], 1 - mov eax, [eax+36] - jnz .insert.increase - sub dword [ebp + PanelData.selected_size], edx - sbb dword [ebp + PanelData.selected_size+4], eax - dec [ebp + PanelData.selected_num] - jmp .insert.down -.insert.increase: - add dword [ebp + PanelData.selected_size], edx - adc dword [ebp + PanelData.selected_size+4], eax - inc [ebp + PanelData.selected_num] -.insert.down: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jae .done_redraw - jmp @f -.down: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jae .ret -@@: - mov [ebp + PanelData.index], ecx - cmp ecx, ebx - jb .done_redraw - sub ecx, [ebp + PanelData.colst] - inc ecx - mov [ebp + PanelData.start], ecx - jmp .done_redraw -.left: - test ecx, ecx - jnz @f - ret -@@: - mov eax, [ebp + PanelData.colsz] - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov [ebp + PanelData.index], ecx -.finalize_left: - cmp ecx, edx - jae .done_redraw - sub edx, eax - jae @f - xor edx, edx -@@: - mov [ebp + PanelData.start], edx - jmp .done_redraw -.pgup: - mov eax, [ebp + PanelData.colst] - dec eax - jnz @f - inc eax -@@: - test ecx, ecx - jnz @f - ret -@@: - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov [ebp + PanelData.index], ecx - dec ecx - jmp .finalize_left -.right: - mov eax, [ebp + PanelData.colsz] - add ecx, eax - cmp ecx, [ebp + PanelData.numfiles] - jb @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - mov [ebp + PanelData.index], ecx -.finalize_right: - cmp ecx, ebx - jb .done_redraw - add ebx, eax - cmp ebx, [ebp + PanelData.numfiles] - jbe @f - mov ebx, [ebp + PanelData.numfiles] -@@: - sub ebx, [ebp + PanelData.colst] - jae @f - xor ebx, ebx -@@: - mov [ebp + PanelData.start], ebx - jmp .done_redraw -.pgdn: - mov eax, [ebp + PanelData.colst] - dec eax - jnz @f - inc eax -@@: - add ecx, eax - cmp ecx, [ebp + PanelData.numfiles] - jb @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - mov [ebp + PanelData.index], ecx - inc ecx - jmp .finalize_right -.tab: - xor [active_panel], panel1 xor panel2 - call draw_cmdbar - call draw_panel - mov ebp, [active_panel] - jmp .done_redraw -.home: - and [ebp + PanelData.start], 0 - and [ebp + PanelData.index], 0 - jmp .done_redraw -.end: - mov eax, [ebp + PanelData.numfiles] - dec eax - mov [ebp + PanelData.index], eax - inc eax - sub eax, [ebp + PanelData.colst] - jae @f - xor eax, eax -@@: - mov [ebp + PanelData.start], eax - jmp .done_redraw -.enter: - cmp [bQuickSearchMode], 0 - jz @f - call draw_image -@@: - call get_curfile_folder_entry - test byte [ecx], 10h - jnz .enter_folder -; todo: add handling on plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jnz .ret -; generate full file name - lea esi, [ebp + PanelData.dir] - mov edi, execdata -@@: - lodsb - test al, al - jz @f - stosb - cmp edi, execdataend-1 - jae .bigfilename - jmp @b -@@: - lea esi, [ecx+40] - mov al, '/' - stosb -@@: - lodsb - stosb - cmp edi, execdataend - ja .bigfilename - test al, al - jnz @b -; try to open file and look for all plugins - push O_READ - push execdata - call open - test eax, eax - jz .noplugins ; if can't open, just try to execute - mov esi, eax ; save handle - push filedata_buffer_size - push filedata_buffer - push esi - call read - mov edi, eax ; save size of read data -; test for Kolibri executable - cmp eax, 24h - jb .enter.noexec - cmp dword [filedata_buffer], 'MENU' - jnz @f - cmp word [filedata_buffer+4], 'ET' - jnz @f -.close_run: - push esi - call close - jmp .run_app -@@: - cmp dword [filedata_buffer], 'KPCK' - jnz @f - cmp dword [filedata_buffer+12], 0x26914601 - jz .close_run -@@: -.enter.noexec: - mov ecx, [num_plugins] - mov edx, [plugins] - sub edx, PluginInfo.size -.plugloop: - add edx, PluginInfo.size - dec ecx - js .plugdone - pushad - push execdata - push [ebp+ PanelData.hFile] - push [ebp+ PanelData.hPlugin] - push edi - push filedata_buffer - call get_curfile_folder_entry - push ecx - push esi - call [edx+PluginInfo.OpenFilePlugin] - mov [esp+28], eax - popad - test eax, eax - jz .plugloop - cmp eax, -1 - jnz .pluginok - push esi - call close - ret -.pluginok: -; save current directory and set root directory of hPlugin - mov edi, eax ; save handle - mov esi, execdata -@@: - lodsb - test al, al - jnz @b - sub esi, execdata-9 -; allocate esi bytes in buffer 'parents' - mov ecx, [ebp + PanelData.parents_sz] - add ecx, esi - cmp ecx, [ebp + PanelData.parents_alloc] - jbe .enter.norealloc - push edx - mov edx, [ebp + PanelData.parents] - call xpgrealloc - pop edx - test eax, eax - jnz @f - push edi - call [edx+PluginInfo.ClosePlugin] - ret -@@: - mov [ebp + PanelData.parents], eax -.enter.norealloc: - mov [ebp + PanelData.parents_sz], ecx -; save current state to the end of buffer - sub ecx, esi - add ecx, [ebp + PanelData.parents] - xchg edx, [ebp + PanelData.hPlugin] - mov [ecx], edx - xchg edi, [ebp + PanelData.hFile] - mov [ecx+4], edi - mov byte [ecx+8], 0 - lea edi, [ecx+9] - lea ecx, [esi-9] - mov esi, execdata - rep movsb - mov word [ebp + PanelData.dir], '/' - mov eax, [ebp + PanelData.hPlugin] - lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info - and dword [ebx], 0 - push ebp - push ebx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetOpenPluginInfo] - pop ebp - call get_curfile_folder_entry - mov esi, ecx - mov edi, left_dotdot_entry - cmp ebp, panel1 - jz @f - add edi, right_dotdot_entry-left_dotdot_entry -@@: - mov ecx, 10 - rep movsd - mov byte [edi-40], 10h ; attributes: folder - mov eax, '..' - stosd - jmp .reread -.plugdone: - push esi - call close -.noplugins: -; run program or association - call get_curfile_folder_entry - call find_extension - jc .run_app -.run_association: - cmp byte [edi], 0 - jz .l1 - cmp byte [edi], ';' - jnz @f -.l1: - ret -@@: - mov esi, edi -@@: - lodsb - test al, al - jz @f - cmp al, ';' - jnz @b - dec esi - mov byte [esi], 0 - mov [restore_semicolon], esi -@@: -.run_association2: - mov [execparams], execdata - mov [execptr], edi - jmp .dorun -.run_app: - mov [execptr], execdata - and [execparams], 0 -.dorun: - lea esi, [ebp + PanelData.dir] - mov edi, execdata -@@: - lodsb - test al, al - jz @f - stosb - cmp edi, execdataend-1 - jae .bigfilename - jmp @b -@@: - lea esi, [ecx+40] - mov al, '/' - stosb -@@: - lodsb - stosb - cmp edi, execdataend - ja .bigfilename - test al, al - jnz @b -; for fasm call - special handling, because -; 1) fasm command line convention is different : fasm infile,outfile[,path] rather than tinypad infile -; 2) fasm will probably create new file in directory, so we want to reload panel data - xor edx, edx - cmp [execparams], edx - jz .nofasm - mov esi, [execptr] -@@: - lodsb - test al, al - jnz @b - mov eax, [esi-5] - or eax, 0x20202020 - cmp eax, 'fasm' - jnz .nofasm - cmp edi, execdata+(execdataend-execdata)/2 - ja .bigfilename - mov esi, execdata -@@: - lodsb - stosb - test al, al - jnz @b - mov byte [esi-1], ',' - inc edx -; output file: no extension if input file has extension, '.bin' otherwise - push edi -@@: - dec edi - cmp byte [edi], '.' - jz .ptfound - cmp byte [edi], '/' - jnz @b - pop edi - cmp edi, execdataend-4 - ja .bigfilename - mov dword [edi-1], '.bin' - mov byte [edi+3], 0 - jmp .nofasm -.ptfound: - mov byte [edi], 0 - pop edi -.nofasm: - mov ebx, execinfo -; if command line is more than 256 symbols, the kernel will truncate it -; we do not want this! -; N.B. We know that command line is either NULL or execdata, which is always ASCIIZ string, -; but can be up to 1023 symbols - mov esi, [ebx+8] - test esi, esi - jz .cmdlinelenok -@@: - lodsb - test al, al - jnz @b - sub esi, [ebx+8] - dec esi - cmp esi, 256 - ja .bigcmdline -.cmdlinelenok: - push SF_FILE - pop eax - int 40h - xor esi, esi - xchg esi, [restore_semicolon] - test esi, esi - jz @f - mov byte [esi], ';' -@@: - neg eax - js @f - call get_error_msg - push eax - push dword aRunError - mov eax, esp - push ContinueBtn - push 1 - push eax - push 2 - call SayErr - pop eax - pop eax - ret -@@: - test edx, edx - jz @f - push SF_SLEEP - pop eax - push 20 - pop ebx - int 0x40 - jmp .ctrl_r -@@: - ret -.bigfilename3: - pop esi -.bigfilename2: - pop esi -.bigfilename: - mov eax, aFileNameTooBig -.l2: - xor esi, esi - xchg esi, [restore_semicolon] - test esi, esi - jz @f - mov byte [esi], ';' -@@: - push eax - mov eax, esp - push ContinueBtn - push 1 - push eax - push 1 - call SayErr - pop eax - ret -.bigcmdline: - mov eax, aCmdLineTooBig - jmp .l2 -.bigfoldername2: - mov esi, prev_dir - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b -.bigfoldername: - mov eax, aFolderNameTooBig - jmp .l2 -.enter_folder: - lea esi, [ecx+40] - cmp word [esi], '..' - jnz @f - cmp byte [esi+2], 0 - jz .dotdot -@@: - push esi - lea esi, [ebp + PanelData.dir] - mov edi, prev_dir -@@: - lodsb - stosb - test al, al - jnz @b - lea edi, [esi-1] - lea edx, [ebp + PanelData.dir + 1024] - cmp esi, edx - pop esi - jae .bigfoldername - mov al, '/' - cmp [edi-1], al - jz @f - stosb -@@: - lodsb - cmp edi, edx - jae .bigfoldername2 - stosb - test al, al - jnz @b - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .reread - push ebp - lea esi, [ebp + PanelData.dir] - push esi - add ecx, 40 - push ecx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.SetFolder] - pop ebp - test al, al - jnz .reread - mov esi, prev_dir - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b -.retd: - ret -.reread: - call read_folder -.done_cmdbar: - call draw_cmdbar - jmp .done_redraw -.dotdot: - lea edi, [ebp + PanelData.dir] - cmp word [edi], '/' - jnz .dotdot_noroot - cmp [ebp + PanelData.hPlugin], 0 - jz .retd - call close_plugin_panel - jmp .dotdot -.dotdot_noroot: - mov edx, edi - mov al, 0 - or ecx, -1 - repnz scasb - dec edi - mov al, '/' - std - repnz scasb - cld - inc edi - cmp edi, edx - jnz @f - inc edi -@@: - push dword [edi] - mov byte [edi], 0 - push edi - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .dotdot_native - push ebp - lea esi, [ebp + PanelData.dir] - push esi - push aDotDot - push [ebp + PanelData.hFile] - call [eax+PluginInfo.SetFolder] - pop ebp - test al, al - jnz .dotdot_native - pop edi - pop dword [edi] - ret -.dotdot_native: - call read_folder - pop edi - pop dword [edi] - push edi - cmp byte [edi], '/' - jnz @f - inc edi -@@: - mov edx, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] -.scanloop: - mov esi, [edx] - add esi, 40 - push esi edi -@@: - lodsb - call match_symbol - jnz @f - inc edi - test al, al - jnz @b -@@: - pop edi esi - jz .scanfound - add edx, 4 - loop .scanloop - jmp .scandone -.scanfound: - sub edx, [ebp + PanelData.files] - shr edx, 2 - mov [ebp + PanelData.index], edx - sub edx, [ebp + PanelData.colst] - jb .scandone - inc edx - mov [ebp + PanelData.start], edx -.scandone: - pop edi - mov byte [edi], 0 - jmp .done_cmdbar -.ctrl_f3_9: - sub al, 0x3D - add al, al - mov ah, [ebp + PanelData.sortmode] - and ah, 0xFE - cmp al, ah - jnz @f - and [ebp + PanelData.sortmode], 1 - or al, [ebp + PanelData.sortmode] - xor al, 1 -@@: - mov [ebp + PanelData.sortmode], al - mov eax, [ebp + PanelData.index] - mov ecx, [ebp + PanelData.files] - push dword [ecx+eax*4] - push ecx - call sort_files - pop edi - pop eax - or ecx, -1 - repnz scasd - not ecx - dec ecx - mov [ebp + PanelData.index], ecx - sub ecx, [ebp + PanelData.start] - jb .less_start - sub ecx, [ebp + PanelData.colst] - jae .gr_end -@@: jmp .done_redraw -.less_start: - add [ebp + PanelData.start], ecx - jmp @b -.gr_end: - inc ecx - add [ebp + PanelData.start], ecx - jmp @b -.alt_f1_2: - mov ebp, panel1 - cmp al, 0x3B - jz @f - mov ebp, panel2 -@@: -; get drives list - mov ebx, dirinfo - mov [ebx+dirinfo.size-dirinfo], 1 - mov [ebx+dirinfo.dirdata-dirinfo], driveinfo - mov [ebx+dirinfo.name-dirinfo], tmpname - mov byte [tmpname], '/' - xor edx, edx - xor ecx, ecx -.drive_loop_e: - mov byte [tmpname+1], 0 - push SF_FILE - pop eax - int 40h - mov ebx, dirinfo - test eax, eax - jnz .drive_loop_e_done - mov esi, driveinfo+32+40 - mov edi, tmpname+1 -@@: - lodsb - stosb - test al, al - jnz @b - push [ebx+dirinfo.first-dirinfo] - and [ebx+dirinfo.first-dirinfo], 0 -.drive_loop_i: - push SF_FILE - pop eax - int 40h - mov ebx, dirinfo - test eax, eax - jnz .drive_loop_i_done - add ecx, 32+8 - push ecx - and ecx, 0xFFF - cmp ecx, 32+8 - pop ecx - ja @f - call xpgrealloc - mov edx, eax - test eax, eax - jnz @f - pop eax - ret -@@: - lea edi, [edx+ecx-32] - mov esi, tmpname -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov esi, driveinfo+32+40 - mov al, '/' - stosb -@@: - lodsb - stosb - test al, al - jnz @b - inc [ebx+dirinfo.first-dirinfo] - jmp .drive_loop_i -.drive_loop_i_done: - pop [ebx+dirinfo.first-dirinfo] - inc [ebx+dirinfo.first-dirinfo] - jmp .drive_loop_e -.drive_loop_e_done: - and [ebx+dirinfo.first-dirinfo], 0 - mov edi, edx - xor esi, esi - add ecx, edx -@@: - and dword [edi], 0 - mov dword [edi+4], esi - mov esi, edi - add edi, 32+8 - cmp edi, ecx - jae @f - mov [esi], edi - jmp @b -@@: - mov ecx, edx - lea edi, [ebp + PanelData.dir] - cmp [ebp + PanelData.hPlugin], 0 - jz .find_cur_drive_loop - mov edi, [ebp + PanelData.parents] - add edi, 8 -.find_cur_drive_loop: - push edi - lea esi, [ecx+8] -@@: - lodsb - test al, al - jz .cur_drive_found - call match_symbol - jnz @f - inc edi - jmp @b -@@: - cmp dword [ecx], 0 - jz @f - pop edi - mov ecx, [ecx] - jmp .find_cur_drive_loop -@@: - mov ecx, edx -.cur_drive_found: - pop edi - push 1 - push aDrive - push ecx - mov eax, [ebp + PanelData.height] - sub eax, 2 - jae @f - add eax, 2 -@@: - push eax - push [ebp + PanelData.width] - push [ebp + PanelData.top] - push [ebp + PanelData.left] - call menu_centered_in - cmp eax, -1 - jnz @f - mov ecx, edx - call pgfree - ret -@@: - push eax - push edx - call close_plugin_panels - pop edx - lea edi, [ebp + PanelData.dir] - push edi - mov esi, edi - mov edi, prev_dir - mov ecx, 1024/4 - rep movsd - pop edi - pop esi - add esi, 8 -@@: - lodsb - stosb - test al, al - jnz @b - mov ecx, edx - call pgfree - call read_folder - jmp .done_redraw -.shift_f5: -; todo: copy to plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: - mov esi, ebp - cmp [ebp + PanelData.selected_num], 0 - jnz .f5_2 - call get_curfile_folder_entry - lea esi, [ecx+40] - mov edi, CopyDestEditBuf - mov eax, CopyDestEditBuf.length - stosd - scasd - xor eax, eax - stosd - mov edx, edi -@@: - lodsb - test al, al - jz .f5_common - stosb - jmp @b -.f5: -; todo: copy to plugin panel - mov esi, ebp - xor esi, panel1 xor panel2 - cmp [esi + PanelData.hPlugin], 0 - jz .f5_2 - ret -.f5_2: - add esi, PanelData.dir - mov edi, CopyDestEditBuf - mov eax, CopyDestEditBuf.length - stosd - scasd - xor eax, eax - stosd - mov edx, edi -@@: - lodsb - test al, al - jz @f - cmp edi, CopyDestEditBuf+12+511 - jae .bigfoldername - stosb - jmp @b -@@: - mov al, '/' - stosb -.f5_common: - mov eax, [ebp + PanelData.hPlugin] - mov [source_hModule], eax - mov eax, [ebp + PanelData.hFile] - mov [source_hPlugin], eax - mov eax, left_dotdot_entry - cmp ebp, panel1 - jz @f - add eax, right_dotdot_entry-left_dotdot_entry -@@: - mov [default_attr], eax - mov byte [edi], 0 - sub edi, edx - mov [edx-8], edi - mov edi, CopySourceTextBuf - mov esi, aCopy1 -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov eax, [ebp + PanelData.selected_num] - test eax, eax - jz .f5_noselected1 - mov ebx, eax - push 10 - pop ecx - push -'0' -@@: - xor edx, edx - div ecx - push edx - test eax, eax - jnz @b -@@: - pop eax - add al, '0' - jz @f - stosb - jmp @b -@@: -if lang eq ru_RU - mov dword [edi], ' ' - mov dword [edi+4], '' - add edi, 8 - cmp ebx, 1 - jz @f - mov al, '' - stosb - cmp ebx, 4 - jbe @f - mov word [edi-1], '' - inc edi -@@: -else - mov dword [edi], ' ite' - mov byte [edi+4], 'm' - add edi, 5 - cmp ebx, 1 - jz @f - mov al, 's' - stosb -@@: -end if - jmp .f5_selected1 - -.f5_noselected1: - mov al, '"' - stosb - call get_curfile_folder_entry - lea esi, [ecx+40] - lea eax, [esi+1] -@@: - inc esi - cmp byte [esi-1], 0 - jnz @b - sub esi, eax - xchg eax, esi - dec esi - mov edx, [cur_width] - sub edx, 50 - sub eax, edx - jbe @f - add esi, eax - mov al, '.' - stosb - stosb - stosb -@@: - lodsb - test al, al - jz @f - stosb - jmp @b -@@: - mov al, '"' - stosb -.f5_selected1: - mov esi, aCopy2 -@@: - lodsb - stosb - test al, al - jnz @b - mov ebx, copy_dlgdata - mov eax, [cur_width] - sub eax, 12 - mov [ebx + dlgtemplate.width], eax - dec eax - dec eax - mov [ebx - copy_dlgdata + copy_dlgdata.lcopy.x2], eax - mov [ebx - copy_dlgdata + copy_dlgdata.ename.x2], eax - shr eax, 1 - dec eax - dec eax - mov [ebx - copy_dlgdata + copy_dlgdata.copy.x2], eax - sub eax, aCopyLength-1 - mov [ebx - copy_dlgdata + copy_dlgdata.copy.x1], eax - add eax, aCopyLength+3 - mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x1], eax - add eax, aCancelBLength - 1 - mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x2], eax - mov byte [ebx - copy_dlgdata + copy_dlgdata.ename.flags], 0xC - and byte [ebx - copy_dlgdata + copy_dlgdata.copy.flags], not 4 - and byte [ebx - copy_dlgdata + copy_dlgdata.cnl.flags], not 4 - push ebx - call DialogBox - cmp eax, copy_dlgdata.copy - jnz .ret2 -; 㥬 - mov esi, CopyDestEditBuf+12 - mov edi, esi - xor eax, eax - or ecx, -1 - repnz scasb - dec edi - dec edi - cmp edi, esi - jb .ret2 - mov [bEndSlash], 0 - cmp byte [edi], '/' - jnz @f - cmp edi, esi - jz @f - mov byte [edi], 0 - dec edi - mov [bEndSlash], 1 -@@: -; ᫨ 稭 , ⠥ ⭮⥫쭮 ⥪饩 - cmp byte [esi], '/' - jz .copy_absolute_path - push esi - push edi - lea edi, [ebp + PanelData.dir] - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - pop edi - push edi - add edi, ecx - cmp edi, CopyDestEditBuf+12+513 - pop edi - jb @f - pop esi - jmp .bigfilename -@@: - lea edx, [edi+2] - sub edx, esi - lea edi, [edi+ecx+1] - xchg ecx, edx - std - lea esi, [esi+ecx-1] - rep movsb - cld - pop edi - lea esi, [ebp + PanelData.dir] - push edi - mov ecx, edx - rep movsb - mov byte [edi-1], '/' - pop esi -.copy_absolute_path: -; 砫 ᮧ 襫騥 , -; ᫥ ⮢ 䠩, ⠪ ; -; 㥬 砥, ᫨ 筨  - xor edx, edx - cmp [ebp + PanelData.selected_num], 0 - jz .f5_noselected2 - mov ecx, [ebp + PanelData.numfiles] - mov edi, [ebp + PanelData.files] -.scanselected2: - mov eax, [edi] - add edi, 4 - test byte [eax+303], 1 - jz @f - test byte [eax], 10h - jz @f - inc edx -@@: - loop .scanselected2 - jmp .f5_selected2 -.f5_noselected2: - call get_curfile_folder_entry - test byte [ecx], 10h - setnz dl -.f5_selected2: - xor eax, eax - mov edi, esi -.countslashloop: - cmp byte [edi], '/' - jnz @f - inc eax - mov ecx, edi -@@: - inc edi - cmp byte [edi], 0 - jnz .countslashloop - mov [bNeedRestoreName], 0 -; "/file-system/partition" folders already exist, so we don't need to create them - cmp eax, 2 - jbe .createupdone -; we interpret destination as folder if edx!=0 or bEndSlash!=0 - test edx, edx - jnz @f - cmp [bEndSlash], 0 - jnz @f - mov edi, ecx - dec eax -@@: - mov [attrinfo.name], esi - mov ecx, eax -; 饬 ᫥ , -.createuploop1: - cmp eax, 2 - jbe .createupdone1 - mov dl, [edi] - mov byte [edi], 0 - push eax - push SF_FILE - pop eax - mov ebx, attrinfo - int 0x40 - test eax, eax - pop eax - mov byte [edi], dl - jnz .createupcont1 - test byte [attrinfo.attr], 10h - jnz .createupdone1 -; the item required to be a folder, but is file - push aNotFolder - push esi - mov eax, esp - push ContinueBtn - push 1 - push eax - push 2 - call SayErr - pop eax - pop eax -.ret3: - ret -.createupcont1: - dec eax -@@: - dec edi - cmp byte [edi], '/' - jnz @b - jmp .createuploop1 -.createupdone1: -; ᮧ , 㦭 - cmp eax, ecx - jae .createupdone -@@: - inc edi - cmp byte [edi], 0 - jz @f - cmp byte [edi], '/' - jnz @b -@@: - mov dl, byte [edi] - mov byte [edi], 0 - push eax - push RetryOrCancelBtn - push 2 - call makedir - mov byte [edi], dl - mov [bNeedRestoreName], 1 - pop eax - jnz .ret3 - inc eax - jmp .createupdone1 -.createupdone: - mov dl, 1 - cmp byte [edi], 1 - sbb eax, -1 - cmp eax, 2 - jbe .docopy - mov [attrinfo.attr], 0 ; assume zero attributes if error - push SF_FILE - pop eax - mov ebx, attrinfo - int 0x40 - test [attrinfo.attr], 10h - setnz dl -.docopy: - call get_curfile_folder_entry - mov eax, ecx - cmp [bNeedRestoreName], 0 - jz @f - cmp [bEndSlash], 0 - jnz @f - cmp [ebp + PanelData.selected_num], 0 - jnz @f - test byte [eax], 10h - jz @f - mov dl, 0 -@@: -; 稭 ᮡ⢥ ஢ - mov [bDestIsFolder], dl - mov [copy_bSkipAll], 0 - mov [copy_bSkipAll2], 0 - mov [copy_bSkipAll3], 0 - test [ebp + PanelData.plugin_flags], 2 - jnz .copy_GetFiles - cmp [ebp + PanelData.selected_num], 0 - jnz .f5_selected3 - call copy_file -.copydone: - push ebp - call .ctrl_r - pop ebp - xor ebp, panel1 xor panel2 - jmp .ctrl_r -.f5_selected3: - mov ecx, [ebp + PanelData.numfiles] - mov esi, [ebp + PanelData.files] -.f5_selected_copyloop: - lodsd - test byte [eax+303], 1 - jz .f5_selected_copycont - mov [bDestIsFolder], dl - call copy_file - ja .f5_multiple_cancel - and byte [eax+303], not 1 - pushad - call draw_panel - cmp [bNeedRestoreName], 0 - jz @f - mov esi, CopyDestEditBuf+12 - call delete_last_name_from_end -@@: - popad -.f5_selected_copycont: - loop .f5_selected_copyloop -.f5_multiple_cancel: - jmp .copydone -.copy_GetFiles: - mov ecx, [ebp + PanelData.selected_num] - cmp ecx, 1 - adc ecx, 0 - shl ecx, 2 - call xpgalloc - test eax, eax - jnz @f - ret -@@: - push ebp eax ; save - push copy_AddDir ; adddir - push copy_AddFile ; addfile - push eax ; items - shr ecx, 2 - push ecx ; NumItems - push [ebp + PanelData.hFile] - mov edi, eax - call get_curfile_folder_entry - mov [edi], ecx - cmp [ebp + PanelData.selected_num], 0 - jz .cgf1 - mov esi, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] -.cgf0: - lodsd - test byte [eax+303], 1 - jz @f - stosd -@@: - loop .cgf0 -.cgf1: - mov eax, [ebp + PanelData.hPlugin] - call [eax+PluginInfo.GetFiles] - pop ecx ebp - call pgfree - jmp .copydone - -.f3: - mov eax, [ebp + PanelData.files] - mov ecx, [eax+ecx*4] - test byte [ecx], 10h - jnz .ret2 - lea esi, [ebp + PanelData.dir] - xor eax, eax - call view_file -.ret2: - ret -.f4: - call edit_file - ret -.f8_has_selected: - mov edi, saved_file_name+511 - mov byte [edi], 0 - mov eax, [ebp + PanelData.selected_num] -if lang eq ru_RU - cmp eax, 1 - jz @f - dec edi - mov byte [edi], '' - cmp eax, 4 - jbe @f - dec edi - mov word [edi], '' -@@: - mov dword [edi-4], '' - mov dword [edi-8], ' ' - sub edi, 8 -else - cmp eax, 1 - jz @f - dec edi - mov byte [edi], 's' -@@: - mov dword [edi-4], 'item' - mov byte [edi-5], ' ' - sub edi, 5 -end if - xor edx, edx - push 10 - pop ecx -@@: - div ecx - add dl, '0' - dec edi - mov [edi], dl - xor edx, edx - test eax, eax - jnz @b - push edi - push aConfirmDeleteText - mov eax, esp - push DeleteOrCancelBtn - push 2 - push eax - push 2 - push aDeleteCaption - call Message - add esp, 8 - test eax, eax - jnz .ret2 - mov [del_bSkipAll], 0 - mov ecx, [ebp + PanelData.numfiles] - jecxz .ret2 - mov esi, [ebp + PanelData.files] -.f8_loop: - lodsd - test byte [eax+303], 1 - jz @f - call delete_file - ja .f8_multiple_cancel -@@: - loop .f8_loop -.f8_multiple_cancel: - jmp .copydone -.f8: -; todo: delete files from plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: - cmp [ebp + PanelData.selected_num], 0 - jnz .f8_has_selected - call get_curfile_folder_entry - cmp word [ecx+40], '..' - jnz @f - cmp byte [ecx+42], 0 - jz .f8_not_allowed -@@: - cmp [bConfirmDelete], 0 - jz .f8_allowed - lea eax, [ecx+40] - push eax - mov esi, aConfirmDeleteText - mov edi, aConfirmDeleteTextBuf - push edi -@@: - lodsb - stosb - test al, al - jnz @b - dec edi - mov esi, aDeleteFolder - test byte [ecx], 10h - jnz @f - mov esi, aDeleteFile -@@: - lodsb - stosb - test al, al - jnz @b - mov eax, esp - push DeleteOrCancelBtn - push 2 - push eax - push 2 - push aDeleteCaption - call Message - add esp, 8 - test eax, eax - jz .f8_allowed -.f8_not_allowed: - ret -.f8_allowed: - mov [del_bSkipAll], 0 - mov eax, ecx - call delete_file - jmp .copydone -.ctrl_r: -; Rescan panel -; call read_folder -; jmp .done_redraw - mov eax, [ebp + PanelData.index] - push eax - call get_curfile_name - mov esi, ecx - mov edi, saved_file_name -@@: - lodsb - stosb - test al, al - jnz @b -.ctrl_r.doread: - push [ebp + PanelData.start] - call read_folder - pop [ebp + PanelData.start] - pop [ebp + PanelData.index] - or eax, -1 -@@: - inc eax - cmp eax, [ebp + PanelData.numfiles] - jae .ctrl_r.notfound - mov ecx, [ebp + PanelData.files] - mov esi, [ecx+eax*4] - add esi, 40 - mov edi, saved_file_name - call strcmpi - jnz @b -.ctrl_r.found: - mov [ebp + PanelData.index], eax -.ctrl_r.notfound: - mov eax, [ebp + PanelData.numfiles] - dec eax - cmp [ebp + PanelData.index], eax - jbe @f - mov [ebp + PanelData.index], eax -@@: - mov eax, [ebp + PanelData.index] - cmp [ebp + PanelData.start], eax - jbe @f - mov [ebp + PanelData.start], eax -@@: - inc eax - sub eax, [ebp + PanelData.colst] - jae @f - xor eax, eax -@@: - cmp [ebp + PanelData.start], eax - jae @f - mov [ebp + PanelData.start], eax -@@: - mov eax, [ebp + PanelData.numfiles] - sub eax, [ebp + PanelData.colst] - jbe @f - cmp [ebp + PanelData.start], eax - jbe @f - mov [ebp + PanelData.start], eax -@@: - jmp .done_redraw -.menu: -; todo: context menu for plugin panel - cmp [ebp + PanelData.hPlugin], 0 - jz @f - ret -@@: -; display context menu -; ignore folders - call get_curfile_folder_entry - test byte [ecx], 10h - jz @f -.menuret: - ret -@@: - call find_extension - jc .menuret -; known extension -@@: - cmp byte [edi], 0 - jz .menuret - cmp byte [edi], ';' - jz @f - inc edi - jmp @b -@@: - inc edi -@@: - inc edi - cmp byte [edi-1], ' ' - jz @b - cmp byte [edi-1], 9 - jz @b - dec edi - cmp byte [edi], 0 - jz .menuret - mov ecx, esi -@@: - inc ecx - cmp byte [ecx-1], 0 - jnz @b - sub ecx, esi ; ecx = 䠩+1 = +1 - cmp ecx, 15 - jb @f - mov cl, 15 -@@: - xor edx, edx - xor ebp, ebp - push edx -.menucreateloop: - mov eax, edi - xor ebx, ebx -@@: - cmp byte [edi], ',' - jz @f - cmp byte [edi], bl - jz @f - inc edi - jmp @b -@@: - xchg bl, [edi] - pushad - push nullstr - push 1024 - push saved_file_name - push eax - push aMenu - push app_path - call [ini.get_str] - popad - mov [edi], bl - mov eax, saved_file_name -@@: - cmp byte [eax], 0 - jz .menucreatecont - cmp byte [eax], ',' - jz @f - inc eax - jmp @b -@@: - mov byte [eax], 0 - push eax - sub eax, saved_file_name-1 - cmp eax, ecx - ja @f - mov eax, ecx -@@: - xchg eax, [esp] - inc eax - push eax -@@: - inc eax - cmp byte [eax-1], 0 - jnz @b - sub eax, [esp] - add [esp+4], eax - pop eax eax - add eax, 8 - add ebp, eax - push ebp - and ebp, 0xFFF - cmp ebp, eax - pop ebp - ja @f - push eax - xchg edx, [esp+4] - push ecx - mov ecx, ebp - call xpgrealloc - pop ecx - pop edx - xchg edx, [esp] - test eax, eax - xchg eax, [esp] - jz .menucreated -@@: - neg eax - add eax, ebp - add eax, [esp] - and dword [eax], 0 - and dword [eax+4], 0 - test edx, edx - jz @f - sub eax, [esp] - mov [edx], eax - add eax, [esp] - sub edx, [esp] - mov [eax+4], edx -@@: - mov edx, eax - push esi edi - mov esi, saved_file_name - lea edi, [eax+8] -@@: - lodsb - stosb - test al, al - jnz @b - push esi - sub esi, saved_file_name - sub esi, ecx - jae .menunoadd - neg esi -@@: - mov byte [edi-1], ' ' - stosb - dec esi - jnz @b -.menunoadd: - pop esi -@@: - lodsb - stosb - test al, al - jnz @b - pop edi esi -.menucreatecont: - inc edi - cmp byte [edi-1], ',' - jz .menucreateloop -.menucreated: - test edx, edx - jz .menuret_free - and dword [edx], 0 - pop edx - mov ecx, edx - add [ecx], edx -@@: - mov ecx, [ecx] - cmp dword [ecx], 0 - jz @f - add [ecx], edx - add [ecx+4], edx - jmp @b -@@: - add [ecx+4], edx - push edx - push 1 - push esi - push edx - call menu - cmp eax, -1 - jz .menuret_free - lea edi, [eax+8] -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - mov ebp, [active_panel] - call get_curfile_folder_entry - call .run_association2 -.menuret_free: - pop ecx - jmp pgfree -.f7: - mov dword [CopyDestEditBuf], CopyDestEditBuf.length - and dword [CopyDestEditBuf+4], 0 - and dword [CopyDestEditBuf+8], 0 - mov byte [CopyDestEditBuf+12], 0 - mov ebx, mkdir_dlgdata - mov eax, [cur_width] - sub eax, 12 - mov [ebx + dlgtemplate.width], eax - dec eax - dec eax - mov [ebx + MkDir_Dlgdata.dnam.x2], eax - shr eax, 1 - dec eax - dec eax - mov [ebx + MkDir_Dlgdata.cont.x2], eax - sub eax, a_ContinueLength-1 - mov [ebx + MkDir_Dlgdata.cont.x1], eax - add eax, a_ContinueLength+3 - mov [ebx + MkDir_Dlgdata.cnl.x1], eax - add eax, aCancelBLength - 1 - mov [ebx + MkDir_Dlgdata.cnl.x2], eax - mov byte [ebx + MkDir_Dlgdata.dnam.flags], 0xC - and byte [ebx + MkDir_Dlgdata.cont.flags], not 4 - and byte [ebx + MkDir_Dlgdata.cnl.flags], not 4 - push ebx - call DialogBox - cmp eax, mkdir_dlgdata.cont - jnz .ret2 - mov esi, CopyDestEditBuf+12 - cmp byte [esi], 0 - jz .ret2 - cmp byte [esi], '/' - jz .mkdir_absolute_path - push esi - lea edi, [ebp + PanelData.dir] - or ecx, -1 - xor eax, eax - repnz scasb - not ecx - mov edi, esi -@@: - cmp byte [edi+1], 0 - jz @f - inc edi - jmp @b -@@: - push edi - add edi, ecx - cmp edi, CopyDestEditBuf+12+513 - pop edi - jb @f - pop esi - jmp .bigfilename -@@: - lea edx, [edi+2] - sub edx, esi - lea edi, [edi+ecx+1] - xchg ecx, edx - std - lea esi, [esi+ecx-1] - rep movsb - cld - pop edi - lea esi, [ebp + PanelData.dir] - push edi - mov ecx, edx - rep movsb - mov byte [edi-1], '/' - pop esi -.mkdir_absolute_path: - push RetryOrCancelBtn - push 2 - call makedir - jmp .copydone -.change_mode: - dec eax - mov [ebp + PanelData.colmode], eax - call calc_colwidths - jmp draw_panel -.quick_jump: - dec eax - cmp al, 10 - jnz @f - xor eax, eax -@@: - mov eax, [FolderShortcuts+eax*4] - test eax, eax - jnz @f - ret -@@: - push eax - call close_plugin_panels - lea esi, [ebp + PanelData.dir] - push esi - mov edi, prev_dir -@@: - lodsb - stosb - test al, al - jnz @b - pop edi esi -@@: - lodsb - stosb - test al, al - jnz @b - jmp .reread -.greyplus: - push 0 - mov ecx, aSelect - jmp @f -.greyminus: - push 1 - mov ecx, aDeselect -@@: - mov eax, mark_dlgdata - mov [eax+mark_dlgdata.title-mark_dlgdata], ecx - mov [eax+mark_dlgdata.edit.flags-mark_dlgdata], 0xC - mov edi, enter_string_buf+12 - mov dword [edi-12], 512 - mov dword [edi-8], 1 - and dword [edi-4], 0 - mov word [edi], '*' - push eax - call DialogBox - inc eax - jnz @f -.noselect: - pop eax - ret -@@: - xor eax, eax - mov esi, edi -@@: - lodsb - mov al, [tolower_table+eax] - mov [esi-1], al - test al, al - jnz @b -@@: - mov ecx, [ebp + PanelData.numfiles] - mov ebx, [ebp + PanelData.files] - jecxz .noselect - mov eax, [ebx] - cmp word [eax+40], '..' - jnz .selectloop - cmp byte [eax+42], 0 - jnz .selectloop - dec ecx - jz .noselect - add ebx, 4 -.selectloop: - xor eax, eax - mov esi, [ebx] - add esi, 40 - mov edx, lower_file_name-1 -@@: - lodsb - inc edx - mov al, [tolower_table+eax] - mov [edx], al - test al, al - jnz @b - mov esi, lower_file_name - call match_mask_rev_lowercase - jc @f - mov esi, [ebx] - mov eax, [esi+32] - cmp byte [esp], 0 - jz .doselect - test byte [esi+303], 1 - jz @f - and byte [esi+303], not 1 - sub dword [ebp + PanelData.selected_size], eax - mov eax, [esi+36] - sbb dword [ebp + PanelData.selected_size+4], eax - dec dword [ebp + PanelData.selected_num] - jmp @f -.doselect: - test byte [esi+303], 1 - jnz @f - or byte [esi+303], 1 - add dword [ebp + PanelData.selected_size], eax - mov eax, [esi+36] - adc dword [ebp + PanelData.selected_size+4], eax - inc dword [ebp + PanelData.selected_num] -@@: - add ebx, 4 - dec ecx - jnz .selectloop - pop eax - jmp .done_redraw -.greyasterisk: - mov ecx, [ebp + PanelData.numfiles] - mov esi, [ebp + PanelData.files] - jecxz .galoopdone -.galoop: - lodsd - cmp word [eax+40], '..' - jnz @f - cmp byte [eax+42], 0 - jz .gacont -@@: - xor byte [eax+303], 1 - mov edx, [eax+32] - test byte [eax+303], 1 - jz .gadel - add dword [ebp + PanelData.selected_size], edx - mov edx, [eax+36] - adc dword [ebp + PanelData.selected_size+4], edx - inc dword [ebp + PanelData.selected_num] - jmp .gacont -.gadel: - sub dword [ebp + PanelData.selected_size], edx - mov edx, [eax+36] - sbb dword [ebp + PanelData.selected_size+4], edx - dec dword [ebp + PanelData.selected_num] -.gacont: - loop .galoop -.galoopdone: - jmp .done_redraw - -@@: - call close_plugin_panel -close_plugin_panels: - cmp [ebp + PanelData.hPlugin], 0 - jnz @b - ret - -align 4 -close_plugin_panel: -; close plugin and restore old directory - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - push esi - lea edi, [ebp + PanelData.dir] -@@: - lodsb - stosb - test al, al - jnz @b - pop esi - sub esi, 9 - mov edx, [esi] ; hPlugin - mov ebx, [esi+4] ; hFile - sub esi, [ebp + PanelData.parents] - mov [ebp + PanelData.parents_sz], esi - xchg edx, [ebp + PanelData.hPlugin] - xchg ebx, [ebp + PanelData.hFile] - push edx ebx - lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info - and dword [ebx], 0 - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz @f - push ebp - push ebx - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetOpenPluginInfo] - pop ebp -@@: - pop ebx edx - -align 4 -close_handle_if_unused: -; edx=hPlugin, ebx=hFile - push ebp - xor ecx, ecx -@@: - mov eax, [screens] - mov ebp, [eax+ecx*8+4] - mov eax, [eax+ecx*8] - call [eax+screen_vtable.IsHandleUsed] - jz .used - inc ecx - cmp ecx, [num_screens] - jb @b - push ebx - call [edx+PluginInfo.ClosePlugin] -.used: - pop ebp - ret - -align 4 -panels_IsHandleUsed: -; edx=hPlugin, ebx=hFile - mov ebp, panel1 - call .1 - jz .ret - mov ebp, panel2 - -.1: - cmp edx, [ebp+ PanelData.hPlugin] - jnz @f - cmp ebx, [ebp+ PanelData.hFile] - jz .ret -@@: - mov esi, [ebp + PanelData.parents_sz] - test esi, esi - jnz @f - inc esi -.ret: - ret -@@: - add esi, [ebp + PanelData.parents] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - sub esi, 9 - cmp edx, [esi] ; hPlugin - jnz .no - mov ebx, [esi+4] ; hFile - jz .ret -.no: - cmp esi, [ebp + PanelData.parents] - jnz @b - inc esi - ret - -align 4 -panels_OnExit: -; close plugin panels - mov ebp, panel1 - call close_plugin_panels - mov ebp, panel2 - call close_plugin_panels - ret - -align 4 -panels_OnRedraw: - or [cursor_x], -1 - or [cursor_y], -1 - call draw_cmdbar - mov ebp, panel1 - call calc_colwidths - call draw_panel - mov ebp, panel2 - call calc_colwidths - call draw_panel - ret - -align 4 -init_console: - mov ecx, [console_data_ptr] - call pgfree - mov eax, [cur_width] - mul [cur_height] - mov ecx, eax - push ecx - shl ecx, 2 - call pgalloc - pop ecx - test eax, eax - jz exit - mov [console_data_ptr], eax - mov edi, eax - mov ax, 0720h - rep stosw - mov [panel1.left], ecx - mov [panel1.top], ecx - mov [panel2.top], ecx - mov eax, [cur_width] - inc eax - shr eax, 1 - mov [panel1.width], eax - mov [panel2.left], eax - sub eax, [cur_width] - neg eax - mov [panel2.width], eax - mov eax, [cur_height] - dec eax - dec eax - mov [panel1.height], eax - mov [panel2.height], eax - ret - -align 4 -get_curfile_folder_entry: - mov ecx, [ebp + PanelData.index] - shl ecx, 2 - add ecx, [ebp + PanelData.files] - mov ecx, [ecx] - ret - -align 4 -get_curfile_name: - call get_curfile_folder_entry - add ecx, 40 - ret - -quick_find: - cmp [ebp + PanelData.numfiles], 0 - jz .nof - mov ecx, [ebp + PanelData.index] -.scanloop: - mov edi, ecx - shl edi, 2 - add edi, [ebp + PanelData.files] - mov edi, [edi] - add edi, 40 - mov esi, quick_search_buf + 12 -@@: - lodsb - test al, al - jz .ok - call match_symbol - jnz .no - inc edi - jmp @b -.no: - inc ecx - cmp ecx, [ebp + PanelData.numfiles] - jb @f - xor ecx, ecx -@@: - cmp ecx, [ebp + PanelData.index] - jnz .scanloop -.nof: - stc - ret -.ok: - cmp ecx, [ebp + PanelData.index] - jz .ret - mov [ebp + PanelData.index], ecx - mov eax, [ebp + PanelData.height] - shr eax, 1 - sub ecx, eax - jae @f - xor ecx, ecx -@@: - mov eax, [ebp + PanelData.numfiles] - sub eax, [ebp + PanelData.colst] - jnc @f - xor eax, eax - xor ecx, ecx -@@: - cmp ecx, eax - jb @f - mov ecx, eax -@@: - mov [ebp + PanelData.start], ecx - call draw_panel -.ret: - clc - ret - -quick_find_next: - cmp [ebp + PanelData.numfiles], 0 - jz quick_find.nof - mov ecx, [ebp + PanelData.index] - jmp quick_find.no - -quick_find_prev: - cmp [ebp + PanelData.numfiles], 0 - jz quick_find.nof - mov ecx, [ebp + PanelData.index] -.scanloop: - dec ecx - jns @f - mov ecx, [ebp + PanelData.numfiles] - dec ecx -@@: - cmp ecx, [ebp + PanelData.index] - jz quick_find.nof - mov edi, ecx - shl edi, 2 - add edi, [ebp + PanelData.files] - mov edi, [edi] - add edi, 40 - mov esi, quick_search_buf + 12 -@@: - lodsb - test al, al - jz quick_find.ok - call match_symbol - jnz .scanloop - inc edi - jmp @b - -panels_getname: -if lang eq ru_RU - mov eax, '' - stosd - mov eax, ' ' - stosd - mov eax, ' ' - stosd - stosb -else - mov eax, 'Pane' - stosd - mov eax, 'ls ' - stosd - mov eax, ' ' - stosd - stosb -end if - sub ecx, 13 - mov ebp, [active_panel] - push 3 - pop edx - cmp [ebp + PanelData.hPlugin], 0 - jz .native - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jz @f - cmp byte [esi-1], '/' - jnz @b -@@: - push ecx edi - shr ecx, 1 -@@: - lodsb - test al, al - jz @f - stosb - loop @b -@@: - sub edi, [esp] - sub [esp+4], edi - add [esp], edi - pop edi ecx - lea esi, [ebp + PanelData.dir] - cmp byte [esi+1], 0 - jnz @f - inc esi -@@: - jmp .main -.native: - lea esi, [ebp + PanelData.dir] -@@: - lodsb - stosb - dec ecx - test al, al - jz @f - cmp al, '/' - jnz @b - dec edx - jnz @b -@@: - test al, al - jnz @f - dec esi - dec edi -@@: -.main: - push esi -@@: - lodsb - test al, al - jnz @b - dec esi - mov ebx, esi - sub ebx, [esp] - dec esi - push esi - mov esi, [ebp + PanelData.index] - shl esi, 2 - add esi, [ebp + PanelData.files] - mov esi, [esi] - add esi, 40 - push esi -@@: - lodsb - test al, al - jnz @b - add ebx, esi - sub ebx, [esp] - dec esi - cmp ebx, ecx - jbe @f - mov al, '.' - stosb - stosb - stosb - sub ecx, 3 - mov ebx, ecx -@@: - add edi, ebx - inc ecx - std -@@: - movsb - dec ecx - jz .nodir - cmp esi, [esp] - jae @b - mov esi, [esp+4] - mov al, '/' - stosb - dec ecx - jz .nodir -@@: - cmp esi, [esp+8] - jb .nodir - movsb - loop @b -.nodir: - cld - pop eax - pop eax - pop eax - ret - -draw_window: - push SF_REDRAW - pop eax - push SSF_BEGIN_DRAW - pop ebx - int 40h - mov al, SF_STYLE_SETTINGS - mov bl, SSF_GET_SKIN_HEIGHT - int 40h - mov [skinh], eax - mov ebx, [cur_width] - imul ebx, font_width - add ebx, 100*65536 + 5*2-1 - mov ecx, [cur_height] - imul ecx, font_height - lea ecx, [eax+ecx+5-1+100*65536] - xor eax, eax - mov edx, 0x53000000 - mov edi, header - int 40h - mov al, SF_DRAW_RECT - xor edx, edx - cmp [fill_width], 0 - jz @f - mov ebx, [wnd_width] - sub ebx, [fill_width] - sub ebx, 5-1 - shl ebx, 16 - mov bx, word [fill_width] - mov ecx, [skinh-2] - mov cx, word [wnd_height] - sub cx, word [skinh] - sub cx, 5-1 - int 0x40 -@@: - cmp [fill_height], 0 - jz @f - xor edx, edx - mov ebx, 50000h - mov bx, word [wnd_width] - sub ebx, 9 - mov ecx, [wnd_height] - sub ecx, [fill_height] - sub ecx, 5-1 - shl ecx, 16 - mov cx, word [fill_height] - int 0x40 -@@: -; xor ecx, ecx -; call draw_image - mov al, SF_PUT_IMAGE_EXT - mov ebx, [MemForImage] - test ebx, ebx - jz @f - mov ecx, [cur_width] - imul ecx, font_width*10000h - mov cx, word [cur_height] - imul cx, font_height - mov edx, [skinh] - add edx, 5*10000h - mov esi, 8 - mov edi, console_colors - xor ebp, ebp - int 0x40 -@@: - mov al, SF_REDRAW - push SSF_END_DRAW - pop ebx - int 40h - ret - -draw_image.nomem: - mov al, SF_DRAW_RECT - xor edx, edx - mov ebx, [cur_width] - imul ebx, font_width - add ebx, 5*65536 - mov ecx, [skinh-2] - mov cx, word [cur_height] - imul cx, font_height - int 40h - mov al, SF_DRAW_TEXT - mov ebx, 32*65536+32 - mov ecx, 0xFFFFFF - mov edx, nomem_draw - push nomem_draw.size - pop esi - int 40h - ret - -align 16 -draw_image: - mov [bMemForImageValidData], byte 1 - cmp [MemForImage], 0 - jnz .allocated -; allocate memory for image - mov ecx, [cur_width] - imul ecx, [cur_height] - imul ecx, font_width*font_height - call pgalloc - test eax, eax - jz draw_image.nomem - mov [MemForImage], eax - mov [bMemForImageValidData], byte 0 -.allocated: - push ebp - and [max_x], 0 - or [min_x], -1 - and [max_y], 0 - or [min_y], -1 - mov eax, [cursor_y] - mul [cur_width] - add eax, [cursor_x] - add eax, eax - add eax, [console_data_ptr] - xchg [cur_cursor_pos], eax - mov [old_cursor_pos], eax - mov edi, [MemForImage] - mov esi, [console_data_ptr] - mov ecx, [cur_height] -.lh: - push ecx - mov ecx, [cur_width] -.lw: - push ecx - mov eax, [cur_width] - imul eax, [cur_height] - mov ebx, [esi] - cmp [bMemForImageValidData], 0 - jz @f - cmp esi, [cur_cursor_pos] - jz @f - cmp esi, [old_cursor_pos] - jz @f - cmp bx, [eax*2+esi] - jnz @f - inc esi - inc esi - jmp .skip_symbol -@@: - mov [eax*2+esi], bx - cmp ecx, [min_x] - ja @f - mov [min_x], ecx -@@: - cmp ecx, [max_x] - jb @f - mov [max_x], ecx -@@: - mov eax, [esp+4] - mov [min_y], eax - cmp eax, [max_y] - jb @f - mov [max_y], eax -@@: - push edi - xor eax, eax - mov al, [esi+1] - and al, 0xF - mov ebx, eax - mov al, [esi+1] - shr al, 4 - mov ebp, eax - sub ebx, ebp - lodsb - inc esi -if font_width > 8 - lea edx, [eax+eax+font] -else - lea edx, [eax+font] -end if -.sh: - mov ecx, [edx] -repeat font_width - shr ecx, 1 - sbb eax, eax - and eax, ebx - add eax, ebp - mov [edi+%-1], al -end repeat - mov eax, [cur_width] -; imul eax, font_width -; add edi, eax -if font_width = 6 - lea eax, [eax*2+eax] - lea edi, [edi+eax*2] -else if font_width = 7 - lea edi, [edi+eax*8] - sub edi, eax -else if font_width = 8 - lea edi, [edi+eax*8] -else if font_width = 9 - lea edi, [edi+eax*8] - add edi, eax -else if font_width = 10 - lea eax, [eax*4+eax] - lea edi, [edi+eax*2] -else -Unknown font_width value! -end if -if font_width > 8 - add edx, 256*2 - cmp edx, font+256*2*font_height -else - add edx, 256 - cmp edx, font+256*font_height -end if - jb .sh - pop edi -.skip_symbol: - pop ecx - add edi, font_width - dec ecx - jnz .lw - mov eax, [cur_width] - imul eax, (font_height-1)*font_width - add edi, eax - pop ecx - dec ecx - jnz .lh -; cursor - mov eax, [cursor_y] - inc eax - jz .nocursor - mul [cur_width] - imul eax, font_height*font_width - mov edx, [cursor_x] - inc edx - imul edx, font_width - add eax, edx - add eax, [MemForImage] - mov edx, [cur_width] - imul edx, font_width - neg edx - mov ecx, [cursor_size] -.cursor_loop: - push ecx - mov ecx, font_width - add eax, edx - push eax -@@: -;; add byte [eax-1], 0x10 - xor byte [eax-1], 7 - sub eax, 1 - loop @b - pop eax - pop ecx - loop .cursor_loop -.nocursor: - cmp [min_y], -1 - jz .nodraw - mov ecx, [cur_width] - mov ebx, [cur_height] - mov eax, ebx - sub ebx, [max_y] - sub eax, [min_y] - sub eax, ebx - inc eax - imul ebp, eax, font_height - mov edx, ecx - sub edx, [max_x] - imul edx, font_width - mov eax, edx - shl edx, 16 - imul dx, bx, font_height - imul ebx, [cur_width] - mov ecx, [max_x] - sub ecx, [min_x] - inc ecx - imul ecx, font_width*10000h - add ecx, ebp - imul ebx, font_width*font_height - add ebx, [MemForImage] - add ebx, eax - add edx, [skinh] - add edx, 5*10000h - imul esi, [cur_width], font_width - mov ebp, ecx - shr ebp, 16 - sub esi, ebp - mov ebp, esi - push SF_PUT_IMAGE_EXT - pop eax - mov edi, console_colors - push 8 - pop esi - int 40h -.nodraw: - pop ebp - ret - -get_console_ptr: -; in: eax=x, edx=y -; out: edi->console data - push edx - imul edx, [cur_width] - add edx, eax - mov edi, [console_data_ptr] - lea edi, [edi + edx*2] - pop edx - ret - -;description: -; draw keys F1-F12 -align 16 -draw_keybar: - pushad - xor eax, eax - test [ctrlstate], 3 - jz @f - inc eax -@@: - test [ctrlstate], 0xC - jz @f - or al, 2 -@@: - test [ctrlstate], 0x30 - jz @f - or al, 4 -@@: - imul eax, 6*12 ; ⥪ * ᫮ F1-F12 - mov esi, [active_screen_keybar] - add esi, eax - xor ecx, ecx - inc ecx - xor eax, eax - mov edx, [cur_height] - dec edx - call get_console_ptr - push 6 - pop ebx - mov eax, [cur_width] - sub eax, 11+9+3*2+6 - cmp eax, 7*11 - jl @f - cdq - mov bl, 11 - div ebx - mov ebx, eax -@@: - xor edx, edx ; ஫ 室 । -.l: - add edx, 7 - cmp cl, 10 - jb @f - inc edx -@@: - cmp edx, [cur_width] - ja .ret - cmp cl, 10 - jae .twodig - lea eax, [ecx+'0'] - stosb - mov al, [keybar_number_color] - stosb - jmp .cmn -.twodig: - mov al, cl - cbw - div [_10] - add al, '0' - stosb - mov al, [keybar_number_color] - stosb - xchg al, ah - add al, '0' - stosw -.cmn: - mov ah, [keybar_name_color] - push ecx - mov cl, 6 -@@: - lodsb - stosw - loop @b - mov al, ' ' - lea ecx, [ebx-6] - cmp byte [esp], 12 - jz .ret_pop - add edx, ecx - rep stosw - pop ecx - inc edx - cmp edx, [cur_width] - ja .ret - mov ah, [keybar_bgr_color] - stosw - inc ecx - jmp .l -.ret_pop: - pop ecx -.ret: - cmp byte [edi-2], ' ' - jnz @f - dec edi - dec edi -@@: - push edi - xor eax, eax - mov edx, [cur_height] - call get_console_ptr - mov ecx, edi - pop edi - sub ecx, edi - shr ecx, 1 - mov al, ' ' - mov ah, [keybar_name_color] - rep stosw ;᪠ 梥 - - cmp [bDisplayQuickSearch], 0 - jz @f - push QuickSearchDlg - call DrawDialogBox -@@: - popad - ret - -align 16 -draw_cmdbar: - mov esi, [active_panel] - add esi, PanelData.dir - xor eax, eax - mov edx, [cur_height] - dec edx - dec edx - call get_console_ptr - mov ah, [cmdbar_prefix_color] - mov ecx, [cur_width] - dec ecx -@@: - lodsb - test al, al - jz @f - stosw - loop @b -@@: - mov al, '>' - stosw - mov al, ' ' - mov ah, [cmdbar_normal_color] - rep stosw - ret - -align 16 -draw_border: - push edi - mov al, 0xC9 - stosw - mov al, 0xCD - lea ecx, [ebx-2] - rep stosw - mov al, 0xBB - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - lea ecx, [edx-2] -.l: - push edi - mov al, 0xBA - stosw - mov al, 0x20 - push ecx - lea ecx, [ebx-2] - rep stosw - pop ecx - mov al, 0xBA - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - loop .l - mov al, 0xC8 - stosw - mov al, 0xCD - lea ecx, [ebx-2] - rep stosw - mov al, 0xBC - stosw - ret - -calc_colwidths: -; in: ebp->panel data - imul esi, [ebp + PanelData.colmode], PanelMode.size - add esi, colmodes - lodsd - mov ecx, eax - lea edx, [ecx-1] - xor ebx, ebx - add esi, PanelMode.ColumnWidths-4 - push ecx esi - xor eax, eax -.loop: - lodsb - add edx, eax - cmp al, 1 - adc ebx, 0 - loop .loop - pop esi ecx - lea edi, [ebp + PanelData.colwidths] - test ebx, ebx - jz .loop2 - mov eax, [ebp + PanelData.width] - dec eax - dec eax - sub eax, edx - jae @f - xor eax, eax -@@: - xor edx, edx - div ebx - test eax, eax - jnz @f - xor edx, edx - inc eax -@@: - push eax -.loop2: - movzx eax, byte [esi] - inc esi - test eax, eax - jnz @f - pop eax - push eax - dec ebx - cmp ebx, edx - jae @f - inc eax -@@: - stosd - loop .loop2 - pop eax - and dword [edi], 0 - ret - -GetPanelTitle_default: - mov edi, [esp+8] - mov ecx, 1024 - mov esi, [esp+12] - test esi, esi - jz .nohost - mov edx, esi -@@: - lodsb - test al, al - jz @f - cmp al, '/' - jnz @b - mov edx, esi - jmp @b -@@: - mov esi, edx -@@: - lodsb - stosb - test al, al - loopnz @b - dec edi - inc ecx -.nohost: - mov esi, [esp+16] - cmp word [esi], '/' - jz .nodir -@@: - lodsb - stosb - test al, al - loopnz @b - dec edi -.nodir: - mov byte [edi], 0 - ret 10h - -;input: -; ebp - pointer to panel1 or panel2 -align 16 -draw_panel: - mov eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - call get_console_ptr -; draw border - mov ah, [panel_border_color] - mov ebx, [ebp + PanelData.width] - mov edx, [ebp + PanelData.height] - call draw_border - push eax - mov eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - sub edx, 3 - call get_console_ptr - pop eax - mov al, 0xC7 - stosw - mov al, 0xC4 - lea ecx, [ebx-2] - rep stosw - mov al, 0xB6 - stosw - - imul esi, [ebp + PanelData.colmode], PanelMode.size - add esi, colmodes - lodsd - mov ecx, eax ; number of columns - lea ebx, [ebp + PanelData.colwidths] - mov eax, [ebp + PanelData.left] - inc eax - mov [column_left], eax - mov eax, [ebp + PanelData.top] - inc eax - mov [column_top], eax - mov eax, [ebp + PanelData.height] - sub eax, 4 - mov [column_height], eax - dec eax - mov [ebp + PanelData.colsz], eax - and [ebp + PanelData.colst], 0 - mov eax, [ebp + PanelData.start] - mov [column_index], eax - mov [last_column_index], eax -.columns_loop: - push ecx - mov eax, [ebx] - add ebx, 4 - mov [column_width], eax - cmp ecx, 1 - jz .skip_right_border - add eax, [column_left] - mov edx, [ebp + PanelData.top] - call get_console_ptr - mov ah, [panel_header_color] - mov al, 0xD1 - mov [edi], ax - add edi, [cur_width] - add edi, [cur_width] - mov ecx, [column_height] - mov al, 0xB3 -@@: - mov [edi], ax - add edi, [cur_width] - add edi, [cur_width] - loop @b - mov al, 0xC1 - stosw -.skip_right_border: - mov eax, [column_left] - mov edx, [column_top] - call get_console_ptr -; ⮫ - push edi - mov edx, [esi] - and edx, 0xF - mov edx, [column_headers+edx*4] - movzx ecx, byte [edx] - inc edx - cmp ecx, [column_width] - jb @f - mov ecx, [column_width] -@@: - push ecx - sub ecx, [column_width] - neg ecx - shr ecx, 1 - mov al, ' ' - mov ah, [column_header_color] - rep stosw - pop ecx - jecxz .skipcopyhdr - push ecx -@@: - mov al, [edx] - inc edx - stosw - loop @b - pop ecx -.skipcopyhdr: - sub ecx, [column_width] - neg ecx - inc ecx - shr ecx, 1 - mov al, ' ' - rep stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] -; ᠬ ⮫ - mov eax, [esi] - and eax, 0xF - push ebx esi - call dword [draw_column_proc+eax*4] - pop esi ebx - inc esi - mov eax, [column_width] - inc eax - add [column_left], eax - pop ecx - dec ecx - jnz .columns_loop -; (⥪ ) - lea esi, [ebp + PanelData.dir] - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .native - push ebp - push esi - mov esi, [ebp + PanelData.parents] - add esi, [ebp + PanelData.parents_sz] -@@: - dec esi - cmp byte [esi-1], 0 - jnz @b - push esi - push execdata - push [ebp + PanelData.hFile] - call [eax+PluginInfo.GetPanelTitle] - pop ebp - mov esi, execdata -.native: - mov edi, cur_header - mov ecx, [ebp + PanelData.width] - sub ecx, 6 - cmp byte [esi], '/' - jnz .copy_rest - dec ecx - movsb -@@: - lodsb - stosb - dec ecx - test al, al - jz .header_created - cmp al, '/' - jnz @b -.copy_rest: - mov edx, esi -@@: - lodsb - test al, al - jnz @b - sub esi, edx - dec esi - cmp esi, ecx - jbe @f - mov word [edi], '..' - mov byte [edi+2], '.' - add edi, 3 - sub ecx, 3 - add edx, esi - sub edx, ecx -@@: - mov esi, edx -@@: - lodsb - stosb - dec ecx - test al, al - jnz @b -.header_created: - mov edx, [ebp + PanelData.top] - mov eax, [ebp + PanelData.left] - shr ecx, 1 - lea eax, [eax+ecx+3] - call get_console_ptr - mov ah, [panel_active_header_color] - cmp ebp, [active_panel] - jz @f - mov ah, [panel_header_color] -@@: - mov al, ' ' - stosw - mov esi, cur_header -@@: - lodsb - test al, al - jz @f - stosw - jmp @b -@@: - mov al, ' ' - stosw - mov edx, [ebp + PanelData.top] - inc edx - mov eax, [ebp + PanelData.left] - inc eax - call get_console_ptr - movzx eax, [ebp + PanelData.sortmode] - mov al, [compare_names+eax] - stosb - mov eax, [ebp + PanelData.selected_num] - test eax, eax - jz .skip_selected_info -; ଠ 뤥 䠩 - push dword [ebp + PanelData.selected_size+4] - push dword [ebp + PanelData.selected_size] - call fill_total_info - mov eax, [ebp + PanelData.width] - sub eax, 2 - cmp ecx, eax - jbe @f - mov ecx, eax - mov edi, saved_file_name+512 - sub edi, eax - mov byte [edi], '.' - mov word [edi+1], '..' -@@: - mov esi, edi - sub eax, ecx - shr eax, 1 - inc eax - add eax, [ebp + PanelData.left] - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - sub edx, 3 - call get_console_ptr - mov ah, [panel_numselected_color] -@@: - lodsb - stosw - loop @b -.skip_selected_info: -; ଠ 饬 ᫥ ࠧ 䠩 - mov eax, [ebp + PanelData.total_num] - push dword [ebp + PanelData.total_size+4] - push dword [ebp + PanelData.total_size] - call fill_total_info - mov eax, [ebp + PanelData.width] - sub eax, 2 - cmp ecx, eax - jbe @f - mov ecx, eax - mov byte [edi+ecx-3], '.' - mov word [edi+ecx-2], '..' -@@: - sub eax, ecx - shr eax, 1 - inc eax - add eax, [ebp + PanelData.left] - add edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - dec edx - mov esi, edi - call get_console_ptr - mov ah, [panel_number_color] -@@: - lodsb - stosw - loop @b - cmp [ebp + PanelData.numfiles], 0 - jz .skip_curinfo -; ଠ ⥪饬 䠩 - mov ebx, [ebp + PanelData.index] - mov eax, [ebp + PanelData.files] - mov ebx, [eax+ebx*4] - mov eax, [ebp + PanelData.left] - add eax, [ebp + PanelData.width] - dec eax - mov edx, [ebp + PanelData.top] - add edx, [ebp + PanelData.height] - dec edx - dec edx - call get_console_ptr - mov ecx, [ebp + PanelData.width] - dec ecx - dec ecx - cmp [ebp + PanelData.colmode], 3 - jz .show_curname -; ६ 䨪樨 - sub edi, 5*2 - sub ecx, 6 - mov al, [ebx+24+2] - aam - or ax, 0x3030 - mov [edi], ah - mov [edi+2], al - mov [edi+4], byte ':' - mov al, [ebx+24+1] - aam - or ax, 0x3030 - mov [edi+6], ah - mov [edi+8], al - mov al, [panel_normal_color] - mov [edi+1], al - mov [edi+3], al - mov [edi+5], al - mov [edi+7], al - mov [edi+9], al - dec edi - mov [edi], al - dec edi - mov byte [edi], ' ' -; 䨪樨 - sub edi, 8*2 - sub ecx, 9 - mov al, [ebx+28+0] - aam - or ax, 0x3030 - mov [edi], ah - mov [edi+2], al - mov [edi+4], byte '.' - mov al, [ebx+28+1] - aam - or ax, 0x3030 - mov [edi+6], ah - mov [edi+8], al - mov [edi+10], byte '.' - mov ax, [ebx+28+2] - div [_100] - mov al, ah - aam - or ax, 0x3030 - mov [edi+12], ah - mov [edi+14], al - mov al, [panel_normal_color] - mov [edi+1], al - mov [edi+3], al - mov [edi+5], al - mov [edi+7], al - mov [edi+9], al - mov [edi+11], al - mov [edi+13], al - mov [edi+15], al - dec edi - mov [edi], al - dec edi - mov [edi], byte ' ' -; - std - mov ah, [panel_normal_color] - dec edi - dec edi - dec ecx - test byte [ebx], 0x10 - jz .size_file - push ecx - mov esi, aFolder+aFolder.size-1 - mov ecx, aFolder.size - cmp word [ebx+40], '..' - jnz @f - cmp byte [ebx+42], 0 - jnz @f - mov esi, aUp+aUp.size-1 - mov cl, aUp.size -@@: - sub [esp], ecx -@@: - lodsb - stosw - loop @b - pop ecx - jmp .size_done -.size_file: - mov edx, [ebx+36] - test edx, edx - jz .size_less_4g - cmp edx, 10*256 - jae .size_tera -; - mov al, 'G' - shl edx, 2 - jmp .size_letter -.size_tera: -; ࠡ - shr edx, 8 - mov al, 'T' - jmp .size_letter -.size_less_4g: - mov edx, [ebx+32] - cmp edx, 10*(1 shl 20) - jae .size_mega - cmp edx, 1 shl 20 - jb .size_num - shr edx, 10 - mov al, 'K' - jmp .size_letter -.size_mega: - mov al, 'M' - shr edx, 20 -.size_letter: - stosw - dec ecx - mov al, ' ' - stosw - dec ecx -.size_num: - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, [panel_normal_color] - stosw - dec ecx - test edx, edx - jnz .size_num -.size_done: - cld -.show_curname: -; - sub edi, ecx - sub edi, ecx - lea esi, [ebx+40] -@@: - lodsb - test al, al - jnz @b - sub esi, ebx - sub esi, 41 - mov ah, [panel_normal_color] - cmp esi, ecx - lea edx, [ebx+40] - jbe @f - mov al, '{' - mov [edi-2], ax - add edx, esi - sub edx, ecx -@@: - mov esi, edx -@@: - lodsb - test al, al - jz @f - stosw - loop @b -@@: - mov al, ' ' - rep stosw -.skip_curinfo: - call draw_image - ret - -fill_total_info: - mov edi, saved_file_name+511 - mov byte [edi], ' ' -if lang eq ru_RU - mov byte [edi-1], '' - dec edi - cmp eax, 1 - jz @f - mov word [edi-1], '' - dec edi -@@: - mov dword [edi-4], '䠩' - mov byte [edi-5], ' ' - sub edi, 5 -else - cmp eax, 1 - jz @f - dec edi - mov byte [edi], 's' -@@: - mov dword [edi-4], 'file' - mov byte [edi-5], ' ' - sub edi, 5 -end if - xor edx, edx - push 10 - pop ecx -@@: - div ecx - dec edi - add dl, '0' - mov [edi], dl - xor edx, edx - test eax, eax - jnz @b -if lang eq ru_RU - mov dword [edi-4], ' ' - mov dword [edi-8], ' ' - sub edi, 8 -else - mov dword [edi-4], ' in ' - mov dword [edi-8], 'ytes' - mov word [edi-10], ' b' - sub edi, 10 -end if - lea esi, [edi-3] - mov edx, [esp+8] - mov eax, [esp+4] -.selsizel: - push edx - mov ebx, edx - xor edx, edx - add ebx, ebx - adc edx, edx - push ebx - push edx - add ebx, ebx - adc edx, edx - add ebx, [esp+4] - adc edx, [esp] - add esp, 8 - add eax, ebx - adc edx, 0 - div ecx - dec edi - cmp edi, esi - jae @f - mov byte [edi], ',' - dec edi - sub esi, 4 -@@: - pop ebx - add dl, '0' - mov byte [edi], dl - xchg eax, ebx - mul [muldiv10] - add eax, ebx - adc edx, 0 - mov ebx, eax - or ebx, edx - jnz .selsizel - dec edi - mov byte [edi], ' ' - mov ecx, saved_file_name+512 - sub ecx, edi - ret 8 - -align 4 -get_file_color: - mov ah, [esi + 6] - cmp ebp, [active_panel] - jnz @f - cmp ecx, [ebp + PanelData.index] - jnz @f - mov ah, [esi + 7] -@@: - test byte [esi + 303], 1 - jnz @f - mov ah, [esi + 4] - cmp ebp, [active_panel] - jnz @f - cmp ecx, [ebp + PanelData.index] - jnz @f - mov ah, [esi + 5] -@@: - ret - -align 4 -draw_name_column: - mov eax, [column_index] - mov [last_column_index], eax - mov edx, [ebp + PanelData.numfiles] - mov ecx, [column_height] - dec ecx -.l: - cmp [column_index], edx - jae .ret - push ecx - mov ecx, [column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - mov ebx, [esi] - call get_file_color - add esi, 40 - mov ecx, [column_width] - push edi -@@: - lodsb - test al, al - jz @f - stosw - loop @b - lodsb - test al, al - jz @f - mov byte [edi], '}' - jmp .continue -@@: - test bl, 10h - jnz .noalignext - mov ebx, [ebp + PanelData.colmode] -; sizeof(PanelMode) = 40 - lea ebx, [ebx+ebx*4] - cmp [colmodes+ebx*8+PanelMode.bAlignExtensions], 0 - jz .noalignext - push ecx - sub ecx, [column_width] - neg ecx - jz .noalignext2 - dec esi -@@: - dec esi - cmp byte [esi], '.' - loopnz @b - jnz .noalignext2 - inc esi - sub ecx, [column_width] - neg ecx - sub ecx, [esp] - sub edi, ecx - sub edi, ecx - dec ecx - mov ebx, [esp+4] - cmp ecx, 3 - ja @f - mov cl, 3 -@@: - sub ecx, [column_width] - sub ebx, edi - sar ebx, 1 - sub ebx, ecx - pop ecx - inc ecx - push 0 - cmp ecx, ebx - jbe @f - sub ecx, ebx - mov [esp], ecx - mov ecx, ebx -@@: - mov al, ' ' - rep stosw -@@: - lodsb - test al, al - jz .noalignext2 - stosw - jmp @b -.noalignext2: - pop ecx -.noalignext: - mov al, ' ' - rep stosw -.continue: - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [column_index] - pop ecx - dec ecx - jnz .l -.ret: - mov eax, [ebp + PanelData.colsz] - add [ebp + PanelData.colst], eax - cmp ebp, panel1 - jnz .ret2 -; ᫮ ࠭ -; calculate number of viewer and editor screens - xor ebx, ebx - xor edx, edx - mov ecx, [num_screens] - mov esi, [screens] -.3: - lodsd - cmp eax, viewer_vtable - jnz @f - inc ebx -@@: - cmp eax, editor_vtable - jnz @f - inc edx -@@: - lodsd - loop .3 - mov eax, ebx - mov esi, edx - or eax, edx - jz .ret2 - xor eax, eax - xor edx, edx - call get_console_ptr - mov al, '[' - stosb - mov al, [panel_nscreens_color] - stosb - xchg eax, ebx -.5: - push -'0' -@@: - xor edx, edx - div [_10d] - push edx - test eax, eax - jnz @b -@@: - pop eax - add eax, '0' - jz @f - stosb - mov al, bl - stosb - jmp @b -@@: - test esi, esi - jz .4 - mov al, '+' - stosb - mov al, bl - stosb - xor eax, eax - xchg eax, esi - jmp .5 -.4: - mov al, ']' - mov ah, [panel_nscreens_color] - stosw -.ret2: -draw_empty_column: - ret - -align 4 -draw_size_column: - add edi, [column_width] - add edi, [column_width] - dec edi - dec edi - std - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov ecx, [column_width] -@@: - mov ebx, eax - cmp word [esi+40], '..' - jnz .nodotdot - cmp byte [esi+42], 0 - jnz .nodotdot -if lang eq ru_RU - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - sub ecx, 5 -else - mov al, ' ' - stosw - stosw - mov al, 'p' - stosw - mov al, 'U' - stosw - sub ecx, 4 -end if - jmp .size_written -.nodotdot: - test byte [esi], 10h - jz .nofolder -if lang eq ru_RU - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - mov al, '' - stosw - sub ecx, 5 -else - mov al, 'r' - stosw - mov al, 'e' - stosw - mov al, 'd' - stosw - mov al, 'l' - stosw - mov al, 'o' - stosw - mov al, 'F' - stosw - sub ecx, 6 -end if - jmp .size_written -.nofolder: - mov eax, [esi+32] - mov edx, [esi+36] - test edx, edx - jz .less_4G - cmp edx, 10000/4*1024 - jb .giga - mov al, 'T' - shr edx, 10 - jmp .write_letter -.giga: - mov al, 'G' - shl edx, 2 - jmp .write_letter -.less_4G: - mov edx, eax - cmp eax, 1000000 - jb .byte - cmp eax, 10000*1024 - jb .kilo - mov al, 'M' - shr edx, 20 - jmp .write_letter -.kilo: - mov al, 'K' - shr edx, 10 -.write_letter: - mov ah, bh - stosw - mov al, ' ' - stosw - dec ecx - dec ecx -.byte: - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - stosw - dec ecx - test edx, edx - jnz .byte -.size_written: - mov eax, ebx - test ecx, ecx - jle @f - mov al, ' ' - rep stosw -@@: - mov byte [edi+1], ah - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -align 4 -draw_date_column: - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov bh, ah - mov byte [edi-1], bh - mov al, [esi+28] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, '.' - stosw - mov al, [esi+29] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, '.' - stosw - movzx eax, word [esi+30] - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - mov [edi+2], ax - xchg eax, edx - xor edx, edx - div [_10d] - xchg eax, edx - add al, '0' - mov ah, bh - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -align 4 -draw_time_column: - mov ecx, [column_height] - dec ecx - push [last_column_index] -.l: - mov edx, [ebp + PanelData.numfiles] - cmp [last_column_index], edx - jae .ret - push ecx - push edi - mov ecx, [last_column_index] - mov esi, [ebp + PanelData.files] - mov esi, [esi+ecx*4] - call get_file_color - mov bh, ah - mov byte [edi-1], bh - mov al, [esi+26] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - mov al, ':' - stosw - mov al, [esi+25] - aam - add eax, '00' - push eax - mov al, ah - mov ah, bh - stosw - pop eax - mov ah, bh - stosw - pop edi - add edi, [cur_width] - add edi, [cur_width] - inc [last_column_index] - pop ecx - dec ecx - jnz .l -.ret: - pop [last_column_index] - cld - ret - -;insert_last_dot: -; push eax esi -; mov ah, 0 -;.loop: -; lodsb -; test al, al -; jz .done -; cmp al, '.' -; jnz .loop -; mov ah, 1 -; jmp .loop -;.done: -; test ah, ah -; jnz @f -; mov byte [esi-1], '.' -; mov byte [esi], 0 -;@@: -; pop esi eax -; ret - -;delete_last_dot: -; push esi -;@@: -; cmp byte [esi], 0 -; jz @f -; inc esi -; jmp @b -;@@: -; cmp byte [esi-1], '.' -; jnz @f -; mov byte [esi-1], 0 -;@@: pop esi -; ret - -align 4 -read_folder: - mov eax, [ebp + PanelData.nfa] - mov [dirinfo.size], eax - shl eax, 2 - add eax, [ebp + PanelData.files] - mov [dirinfo.dirdata], eax - lea eax, [ebp + PanelData.dir] - mov [dirinfo.name], eax - xor eax, eax - mov [ebp + PanelData.total_num], eax - mov dword [ebp + PanelData.total_size], eax - mov dword [ebp + PanelData.total_size+4], eax - mov [ebp + PanelData.selected_num], eax - mov dword [ebp + PanelData.selected_size], eax - mov dword [ebp + PanelData.selected_size+4], eax -.retry: - mov eax, [ebp + PanelData.hPlugin] - test eax, eax - jz .native - mov ecx, [dirinfo.size] - test [ebp + PanelData.plugin_flags], 1 - jz @f - dec ecx ; reserve one entry for '..' -@@: - push ebp - push [dirinfo.dirdata] - push ecx - push 0 - push [ebp + PanelData.hFile] - call [eax + PluginInfo.ReadFolder] - pop ebp - mov ebx, [dirinfo.dirdata] - mov ebx, [ebx+4] - jmp .read -.native: - push SF_FILE - pop eax - mov ebx, dirinfo - int 40h -.read: - test eax, eax - jz .ok - cmp eax, 6 - jz .ok -; Failed to read folder, notify user - cmp [bSilentFolderMode], 0 - jnz .dont_notify - push dword aContinue - push dword aRetry - mov edx, esp - call get_error_msg - push [dirinfo.name] - push dword aCannotReadFolder - push eax - mov eax, esp - push edx - push 2 - push eax - push 3 - call SayErr - add esp, 5*4 - test eax, eax - jz .retry -.dont_notify: -; If not on plugin panel, try to return to previous directory - cmp [ebp + PanelData.hPlugin], 0 - jnz @f - mov esi, prev_dir - cmp byte [esi], 0 - jz @f - lea edi, [ebp + PanelData.dir] - mov ecx, 1024/4 - rep movsd - mov byte [prev_dir], 0 - ret -@@: - mov [bSilentFolderMode], 1 ; enter silent mode -; Try to read parent folder - mov esi, [dirinfo.name] - xor edx, edx -.up1: - lodsb - test al, al - jz .up1done - cmp al, '/' - jnz .up1 - inc edx - lea edi, [esi-1] - jmp .up1 -.up1done: - cmp [ebp + PanelData.hPlugin], 0 - jz .4 - cmp edx, 1 - ja .up -; ⥭ -; ⮬ 㦥 ୥ -; , 㭪 ⥭ 㫠 0 ⮢ -; (᫨ 㦥 室 "..", 㤥 ⮬᪨) - xor ebx, ebx ; 0 items read - mov eax, [dirinfo.dirdata] - mov [eax+8], ebx ; 0 items total - jmp .ok -.4: - cmp edx, 2 - jbe .noup -.up: - stosb - jmp read_folder -.noup: -; There is no parent folder, and we are not on plugin panel -; Try to read ramdisk - mov esi, [dirinfo.name] - mov edi, esi - lodsd - or eax, 0x00202000 - cmp eax, '/rd/' - jnz @f - lodsw - cmp ax, '1' - jz .nosetrd -@@: - mov eax, '/rd/' - stosd - mov ax, '1' - stosw - jmp read_folder -.nosetrd: -; ࠬ ⠫. , 졠... - and dword [ebp + PanelData.numfiles], 0 - and dword [ebp + PanelData.index], 0 - and dword [ebp + PanelData.start], 0 - mov [bSilentFolderMode], 0 ; leave silent mode - ret -.ok: - mov eax, [dirinfo.dirdata] - cmp [eax+8], ebx - jz .readdone - push dword [eax+8] - mov ecx, [ebp + PanelData.files] - call pgfree - pop ecx - add ecx, 0xF - and ecx, not 0xF - push ecx - imul ecx, 4+304 - add ecx, 32 - call xpgalloc - test eax, eax - jnz .succ1 - pop eax - jmp .readdone -.succ1: - mov [ebp + PanelData.files], eax - pop [ebp + PanelData.nfa] - mov [prev_dir], 0 - jmp read_folder -.readdone: - xor edx, edx - mov [ebp + PanelData.start], edx - mov [ebp + PanelData.index], edx - mov [ebp + PanelData.start], edx - mov edi, [ebp + PanelData.files] - mov eax, [ebp + PanelData.nfa] - lea eax, [edi + eax*4 + 32] - mov ecx, [eax-32+4] - test ecx, ecx - jz .loopdone -; 㥬 ᯥ樠 室, ᮮ⢥騥 '.' ⪥ ⮬ -.ptrinit: - cmp word [eax+40], '.' - jz .loopcont - test byte [eax], 8 - jnz .loopcont - mov byte [eax+303], 0 - test edx, edx - jnz .nodotdot - cmp word [eax+40], '..' - jnz .nodotdot - cmp byte [eax+42], 0 - jnz .nodotdot - mov edx, eax - push edi -@@: - cmp edi, [ebp + PanelData.files] - jbe @f - push dword [edi-4] - pop dword [edi] - sub edi, 4 - jmp @b -@@: - stosd - pop edi - scasd - jmp .dotdot -.nodotdot: - stosd - xor ebx, ebx - test byte [eax], 10h - setz bl - add [ebp + PanelData.total_num], ebx - mov ebx, dword [eax+32] - add dword [ebp + PanelData.total_size], ebx - mov ebx, dword [eax+36] - adc dword [ebp + PanelData.total_size+4], ebx -.dotdot: -; ᢥ⪠ -; call insert_last_dot - call highlight_init -; call delete_last_dot -.loopcont: - add eax, 304 - dec ecx - jnz .ptrinit -.loopdone: - push edi - sub edi, [ebp + PanelData.files] - shr edi, 2 - mov [ebp + PanelData.numfiles], edi - pop edi - test edx, edx - jnz @f - test [ebp + PanelData.plugin_flags], 1 - jz @f - mov ecx, [ebp + PanelData.numfiles] - inc [ebp + PanelData.numfiles] - lea esi, [edi-4] - std - rep movsd - cld - mov eax, left_dotdot_entry - cmp ebp, panel1 - jz .zq - add eax, right_dotdot_entry-left_dotdot_entry -.zq: - stosd - call highlight_init -@@: -; ஢ -sort_files: - movzx eax, [ebp + PanelData.sortmode] - mov ebx, [compare_fns + eax*4] -.mode: - mov edx, [ebp + PanelData.files] - mov ecx, [ebp + PanelData.numfiles] - jecxz .skip - mov eax, [edx] - cmp word [eax+40], '..' - jnz .nodotdot - cmp byte [eax+42], 0 - jnz .nodotdot - dec ecx - add edx, 4 -.nodotdot: - call sort -.skip: - mov [bSilentFolderMode], 0 ; leave silent mode - ret - -align 4 -highlight_init: - pushad - mov ebp, eax - lea esi, [ebp+40] - mov edi, lower_file_name - mov edx, edi - xor eax, eax -@@: - lodsb - mov al, [tolower_table+eax] - stosb - test al, al - jnz @b - mov esi, edx - lea edx, [edi-1] - xor ecx, ecx -.highlight_test_loop: - mov ebx, [highlight_groups+ecx*4] - mov al, [ebx + highlight.IncludeAttributes] - mov ah, [ebp] - and ah, al - cmp ah, al - jnz .highlight_test_failed - lea edi, [ebx + highlight.Mask] - call match_mask_rev_lowercase - jc .highlight_test_failed - mov ah, [ebx + highlight.NormalColor] - test ah, ah - jnz @f - mov ah, [panel_normal_color] -@@: - mov [ebp+4], ah - mov ah, [ebx + highlight.CursorColor] - test ah, ah - jnz @f - mov ah, [panel_cursor_color] -@@: - mov [ebp+5], ah - mov ah, [ebx + highlight.SelectedColor] - test ah, ah - jnz @f - mov ah, [panel_selected_color] -@@: - mov [ebp+6], ah - mov ah, [ebx + highlight.SelectedCursorColor] - test ah, ah - jnz @f - mov ah, [panel_selected_cursor_color] -@@: - mov [ebp+7], ah - jmp .doname -.highlight_test_failed: - inc ecx - cmp ecx, [highlight_num_groups] - jb .highlight_test_loop -.nohighlight: - mov ah, [panel_normal_color] - mov [ebp+4], ah - mov ah, [panel_cursor_color] - mov [ebp+5], ah - mov ah, [panel_selected_color] - mov [ebp+6], ah - mov ah, [panel_selected_cursor_color] - mov [ebp+7], ah -.doname: - popad - ret - -align 4 -compare_name: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - jmp strcmpi -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -compare_name_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -strcmpi: - push eax -@@: - lodsb - call match_symbol - jnz .ret - inc edi - test al, al - jnz @b -.ret: - pop eax - ret - -align 4 -compare_ext: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - push esi edi - call seek_ext - xchg esi, edi - call seek_ext - xchg esi, edi - call strcmpi - jnz .ret - pop edi esi - jmp strcmpi -.ret: - pop edi esi - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_ext_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - add esi, 40 - add edi, 40 - push esi edi - call seek_ext - xchg esi, edi - call seek_ext - call strcmpi - jnz .ret - pop edi esi - xchg esi, edi - jmp strcmpi -.ret: - pop edi esi - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -seek_ext: - push eax - xor eax, eax -.l: - inc esi - cmp byte [esi-1], '.' - jnz @f - mov eax, esi -@@: - cmp byte [esi-1], 0 - jnz .l - test eax, eax - jnz @f - lea eax, [esi-1] -@@: - mov esi, eax - pop eax - ret - -align 4 -compare_modified: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+28] - cmp edi, [esi+28] - pop edi - jnz @f - push edi - mov edi, [edi+24] - cmp edi, [esi+24] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_modified_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+28] - cmp esi, [edi+28] - pop esi - jnz @f - push esi - mov esi, [esi+24] - cmp esi, [edi+24] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_size: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+36] - cmp edi, [esi+36] - pop edi - jnz @f - push edi - mov edi, [edi+32] - cmp edi, [esi+32] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_size_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+36] - cmp esi, [edi+36] - pop esi - jnz @f - push esi - mov esi, [esi+32] - cmp esi, [edi+32] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_unordered: - cmp esi, edi - ret -compare_unordered_rev: - cmp edi, esi - ret - -align 4 -compare_created: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+12] - cmp edi, [esi+12] - pop edi - jnz @f - push edi - mov edi, [edi+8] - cmp edi, [esi+8] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_created_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+12] - cmp esi, [edi+12] - pop esi - jnz @f - push esi - mov esi, [esi+8] - cmp esi, [edi+8] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_accessed: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push edi - mov edi, [edi+20] - cmp edi, [esi+20] - pop edi - jnz @f - push edi - mov edi, [edi+16] - cmp edi, [esi+16] - pop edi - jnz @f - add esi, 40 - add edi, 40 - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -compare_accessed_rev: - test byte [esi], 10h - jnz .1dir - test byte [edi], 10h - jnz .greater -.eq1: - push esi - mov esi, [esi+20] - cmp esi, [edi+20] - pop esi - jnz @f - push esi - mov esi, [esi+16] - cmp esi, [edi+16] - pop esi - jnz @f - add esi, 40 - add edi, 40 - xchg esi, edi - jmp strcmpi -@@: - ret -.greater: - test esi, esi - ret -.1dir: - test byte [edi], 10h - jnz .eq1 -.less: - xor edi, edi - stc - ret - -align 4 -ReadFolder_default: - mov eax, 2 - ret 10h - -if 0 -; Following subroutines work, but are slow -match_mask: -; in: esi->name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edi -.main_cycle: - push esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, '|' - jnz @b -@@: - mov [esi-1], byte 0 - xchg esi, [esp] - call match_single_mask - pop esi - mov [esi-1], al - jnc .found - cmp al, ',' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - push esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jnz @b -@@: - mov byte [esi-1], 0 - xchg esi, [esp] - call match_single_mask - pop esi - mov [esi-1], al - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask: -; in: esi->mask, edi->name -; out: CF clear <=> match - pusha -.mask_symbol: - lodsb - test al, al - jz .mask_done - cmp al, '*' - jz .asterisk - cmp al, '?' - jz .quest - cmp al, '[' - jz .list - call match_symbol - jnz .done_fail - inc edi - jmp .mask_symbol -.done_fail: - stc - popa - ret -.mask_done: - scasb - jnz .done_fail -.done_succ: - clc - popa - ret -.quest: - mov al, 0 - scasb - jz .done_fail - jmp .mask_symbol -.list: - lodsb - cmp al, ']' - jz .done_fail - cmp byte [esi+1], '-' - jz .range - call match_symbol - jnz .list -.listok: - inc edi -@@: - lodsb - cmp al, ']' - jnz @b - jmp .mask_symbol -.range: - call match_symbol - ja @f - mov al, [esi+2] - call match_symbol - jae .listok -@@: - inc esi - jmp .list -.asterisk: - cmp byte [esi], 0 - jz .done_succ - cmp byte [esi], '?' - jnz @f - mov al, 0 - scasb - jz .done_fail - inc esi - jmp .asterisk -@@: - cmp byte [esi], '[' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi] -@@: - cmp byte [edi], 0 - jz .done_fail - call match_symbol - jz @f - inc edi - jmp @b -@@: - inc edi - inc esi - call match_single_mask - jnc .done_succ - dec esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask - jnc @f - mov al, 0 - scasb - jnz @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ - -match_mask_rev: -; in: esi->name, edx->end of name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edx - xchg esi, edi -.main_cycle: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, '|' - jnz @b -@@: - dec esi - mov [esi], byte 0 - call match_single_mask_rev2 - mov [esi], al - inc esi - jnc .found - cmp al, ',' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jnz @b -@@: - dec esi - mov byte [esi], 0 - call match_single_mask_rev2 - mov [esi], al - inc esi - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask_rev2: - pusha - jmp match_single_mask_rev.mask_symbol -match_single_mask_rev: -; in: esi->mask, edi->end of name, edx->start of name -; out: CF clear <=> match - pusha - mov ecx, esi -@@: - lodsb - test al, al - jnz @b - dec esi -; esi->end of mask, ecx->start of mask -.mask_symbol: - dec esi - cmp esi, ecx - jb .mask_done - mov al, [esi] - cmp al, '*' - jz .asterisk - cmp al, '?' - jz .quest - cmp al, ']' - jz .list - dec edi - cmp edi, edx - jb .done_fail - call match_symbol - jz .mask_symbol -.done_fail: - stc - popa - ret -.mask_done: - cmp edi, edx - jnz .done_fail -.done_succ: - clc - popa - ret -.quest: - dec edi - cmp edi, edx - jb .done_fail - jmp .mask_symbol -.list: - dec edi - cmp edi, edx - jb .done_fail -.list_check: - dec esi - cmp esi, ecx - jbe .done_fail - mov al, [esi] - cmp al, '[' - jz .done_fail - cmp byte [esi-1], '-' - jz .range - call match_symbol - jnz .list_check -.listok: -@@: - dec esi - cmp esi, ecx - jb .done_fail - cmp byte [esi], '[' - jnz @b - jmp .mask_symbol -.range: - call match_symbol - jb @f - mov al, [esi-2] - call match_symbol - jbe .listok -@@: - dec esi - dec esi - jmp .list_check -.asterisk: - cmp esi, ecx - jz .done_succ - cmp byte [esi-1], '?' - jnz @f - cmp edi, edx - jz .done_fail - dec esi - jmp .asterisk -@@: - cmp byte [esi-1], ']' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi-1] -@@: - cmp edi, edx - jz .done_fail - call match_symbol - jz @f - dec edi - jmp @b -@@: - dec edi - dec esi - call match_single_mask_rev2 - jnc .done_succ - inc esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask_rev2 - jnc @f - dec edi - cmp edi, edx - jae @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ -end if - -;tolower: -; push ecx -; movzx ecx, al -; mov al, [tolower_table+ecx] -; pop ecx -; ret - -match_symbol: -; in: al,[edi]=symbols -; out: flags as 'cmp al,[edi]' - push eax ecx - movzx ecx, al - mov al, [tolower_table+ecx] - movzx ecx, byte [edi] - cmp al, [tolower_table+ecx] - pop ecx eax - ret - -match_mask_rev_lowercase: -; in: esi->name, edx->end of name, edi->mask -; out: CF clear <=> match - pusha - xchg esi, edx - xchg esi, edi -.main_cycle: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, ';' - jz @f - cmp al, '|' - jnz @b -@@: - dec esi - mov [esi], byte 0 - call match_single_mask_rev_lowercase - mov [esi], al - inc esi - jnc .found - cmp al, ',' - jz .main_cycle - cmp al, ';' - jz .main_cycle -.done_fail: - stc - popa - ret -.found: - test al, al - jz .done_succ - cmp al, '|' - jz .test_exclude - lodsb - jmp .found -.done_succ: - clc - popa - ret -.test_exclude: - mov ecx, esi -@@: - lodsb - test al, al - jz @f - cmp al, ',' - jz @f - cmp al, ';' - jnz @b -@@: - dec esi - mov byte [esi], 0 - call match_single_mask_rev_lowercase - mov [esi], al - inc esi - jnc .done_fail - test al, al - jz .done_succ - jmp .test_exclude - -match_single_mask_rev_lowercase: -; in: esi->end of mask, ecx->start of mask, edi->end of name, edx->start of name -; out: CF clear <=> match - push esi edi eax -.mask_symbol: - dec esi - cmp esi, ecx - jb .mask_done - mov al, [esi] - cmp al, '*' - jz .asterisk - dec edi - cmp edi, edx - jb .done_fail - cmp al, '?' - jz .mask_symbol - cmp al, ']' - jz .list_check - cmp al, [edi] - jz .mask_symbol -.done_fail: - stc - pop eax edi esi - ret -.mask_done: - cmp edi, edx - jnz .done_fail -.done_succ: - clc - pop eax edi esi - ret -.list_check: - dec esi - cmp esi, ecx - jbe .done_fail - mov al, [esi] - cmp al, '[' - jz .done_fail - cmp byte [esi-1], '-' - jz .range - cmp al, [edi] - jnz .list_check -.listok: -@@: - dec esi - cmp esi, ecx - jb .done_fail - cmp byte [esi], '[' - jnz @b - jmp .mask_symbol -.range: - cmp al, [edi] - jb @f - mov al, [esi-2] - cmp al, [edi] - jbe .listok -@@: - dec esi - dec esi - jmp .list_check -.asterisk: - cmp esi, ecx - jz .done_succ - cmp byte [esi-1], '?' - jnz @f - cmp edi, edx - jz .done_fail - dec esi - dec edi - jmp .asterisk -@@: - cmp byte [esi-1], ']' - jz .asterisk_common -; the mask is ...*... -.asterisk_normal: - mov al, [esi-1] -@@: - dec edi - cmp edi, edx - jb .done_fail - cmp al, [edi] - jnz @b -@@: - dec esi - call match_single_mask_rev_lowercase - jnc .done_succ - inc esi - jmp .asterisk_normal -.asterisk_common: - push edi -@@: - call match_single_mask_rev_lowercase - jnc @f - dec edi - cmp edi, edx - jae @b - pop edi - jmp .done_fail -@@: - pop edi - jmp .done_succ - -find_extension: - lea esi, [ecx+40] - push esi -@@: - lodsb - test al, al - jnz @b -@@: - dec esi - cmp byte [esi], '.' - jz .found_ext - cmp esi, [esp] - ja @b -; empty extension - pop esi - stc - ret -.found_ext: - inc esi - mov edi, [associations] - test edi, edi - jz .notfound -.find_loop: - push esi edi - call strcmpi - pop edi esi - pushf -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - popf - jz .found -@@: - inc edi - cmp byte [edi-1], 0 - jnz @b - cmp byte [edi], 0 - jnz .find_loop -.notfound: -; unknown extension - stc -.found: - pop esi - ret - -header db 'Kolibri Far ',version,0 - -nomem_draw db 'No memory for redraw.',0 -.size = $ - nomem_draw - -def_left_dir db '/sys',0 -def_right_dir db '/hd0/1',0 - -bSilentFolderMode db 1 - -bQuickSearchMode db 0 -bDisplayQuickSearch db 0 - -if lang eq ru_RU -aFolder db '' -.size = $-aFolder -aUp db '' -.size = $-aUp -aDrive db '',0 -aScreens db '࠭',0 -else -aFolder db 'Folder' -.size = $-aFolder -aUp db 'Up' -.size = $-aUp -aDrive db 'Drive',0 -aScreens db 'Screens',0 -end if - -align 4 -_10d dd 10 -_100d dd 100 -muldiv10 dd 429496729 -_10 db 10 -_100 db 100 - -fpu_cw dw 000011100111111b - -keybar_panels: -if lang eq ru_RU -; -䨪஢ - db '' - db '짌' - db ' ' - db '' - db ' ' - db '७ ' - db ' ' - db '' - db '䌭' - db '室 ' - db '㫨' - db '࠭' -; Shift - db '' - db 'ᯠ' - db '劮' - db '.' - db ' ' - db '२' - db ' ' - db '' - db '࠭' - db '᫤' - db '㯯' - db '࠭' -; Ctrl - db ' ' - db 'ࠢ' - db ' ' - db '' - db ' ' - db '' - db '' - db '' - db '' - db 'ᠭ' - db '' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db 'ࠢ' - db '.' - db ' ' - db '' - db ' ' - db '᪠' - db ' ' - db ' ' - db 'ॢ' - db ' ' - db '⏠' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䏫' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'UserMn' - db 'View ' - db 'Edit ' - db 'Copy ' - db 'RenMov' - db 'MkFold' - db 'Delete' - db 'ConfMn' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db 'Add ' - db 'Extrct' - db 'ArcCmd' - db 'Edit..' - db 'Copy ' - db 'Rename' - db ' ' - db 'Delete' - db 'Save ' - db 'Last ' - db 'Group ' - db 'SelUp ' -; Ctrl - db 'Left ' - db 'Right ' - db 'Name ' - db 'Extens' - db 'Modifn' - db 'Size ' - db 'Unsort' - db 'Creatn' - db 'Access' - db 'Descr ' - db 'Owner ' - db 'Sort ' -; Ctrl+Shift - db ' ' - db ' ' - db 'View ' - db 'Edit ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db 'Left ' - db 'Right ' - db 'View..' - db ' ' - db 'Print ' - db 'MkLink' - db 'Find ' - db 'Histry' - db 'Video ' - db 'Tree ' - db 'ViewHs' - db 'FoldHs' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'ConfPl' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - -keybar_viewer: -if lang eq ru_RU -; -䨪஢ - db '' - db '' - db '室 ' - db ' ' - db ' ' - db '' - db ' ' -keybar_cp: - db 'cp1251' - db ' ' - db '室 ' - db '㫨' - db '࠭' -; Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db '' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db '३' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䨣' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'Unwrap' - db 'Quit ' - db 'Hex ' - db ' ' - db 'Edit ' - db 'Search' -keybar_cp: - db 'cp1251' - db ' ' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db ' ' - db 'WWrap ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Next ' - db 'Table ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'GoFile' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db 'Print ' - db ' ' - db 'Prev ' - db 'Goto ' - db 'Video ' - db ' ' - db 'ViewHs' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Config' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - -keybar_editor: -if lang eq ru_RU -; -䨪஢ - db '' - db '࠭' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -keybar_cp2: - db 'cp1251' - db ' ' - db '室 ' - db '㫨' - db '࠭' -; Shift - db ' ' - db '.' - db ' ' - db '.' - db ' ' - db ' ' - db '' - db '' - db ' ' - db '' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db 'ப' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db '䨣' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -else -; No modificators - db 'Help ' - db 'Save ' - db ' ' - db ' ' - db ' ' - db 'View ' - db 'Search' -keybar_cp2: - db 'cp1251' - db ' ' - db 'Quit ' - db 'Plugin' - db 'Screen' -; Shift - db ' ' - db 'SaveAs' - db ' ' - db 'Edit..' - db ' ' - db ' ' - db 'Next ' - db 'Table ' - db ' ' - db 'SaveQ ' - db ' ' - db ' ' -; Ctrl - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Replac' - db ' ' - db ' ' - db 'GoFile' - db ' ' - db ' ' -; Ctrl+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' -; Alt - db ' ' - db ' ' - db ' ' - db ' ' - db 'Print ' - db ' ' - db ' ' - db 'Goto ' - db 'Video ' - db ' ' - db 'ViewHs' - db ' ' -; Alt+Shift - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db 'Config' - db ' ' - db ' ' - db ' ' -; Alt+Ctrl -times 12 db ' ' -; Alt+Ctrl+Shift -times 12 db ' ' -end if - - align 4 -cur_width dd 80 -cur_height dd 25 -saved_width dd -1 -saved_height dd -1 -fill_width dd 0 ;⮪ ਭ ਭ -fill_height dd 0 -max_width = 256 -max_height = 256 -console_data_ptr dd 0 - -cursor_x dd -1 -cursor_y dd -1 -cursor_size dd cursor_normal_size -cur_cursor_pos dd -1 -old_cursor_pos dd -1 - -idle_interval dd -1 - -active_panel dd panel1 - -associations dd 0 -associations_size dd 1 ; terminating zero -associations_allocated dd 0x1000 ; start with one page - -console_colors dd 0x000000, 0x000080, 0x008000, 0x008080 - dd 0x800000, 0x800080, 0x808000, 0xC0C0C0 - dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF - dd 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF - -compare_fns dd compare_name - dd compare_name_rev - dd compare_ext - dd compare_ext_rev - dd compare_modified - dd compare_modified_rev - dd compare_size - dd compare_size_rev - dd compare_unordered - dd compare_unordered_rev - dd compare_created - dd compare_created_rev - dd compare_accessed - dd compare_accessed_rev - -ctrlkey_tests dd ctrlkey_test0 - dd ctrlkey_test1 - dd ctrlkey_test2 - dd ctrlkey_test3 - dd ctrlkey_test4 -ctrlkey_tests_num = 5 - -virtual at 0 -screen_vtable: - .OnRedraw dd ? - .OnActivate dd ? - .OnIdle dd ? - .OnKey dd ? - .keybar dd ? - .getname dd ? - .OnExit dd ? - .IsHandleUsed dd ? -end virtual - -panels_vtable: - dd panels_OnRedraw - dd 0 - dd 0 - dd panels_OnKey - dd keybar_panels - dd panels_getname - dd panels_OnExit - dd panels_IsHandleUsed - -viewer_vtable: - dd viewer_OnRedraw - dd 0 - dd 0 - dd viewer_OnKey - dd keybar_viewer - dd viewer_getname - dd viewer_OnExit - dd viewer_IsHandleUsed - -editor_vtable: - dd editor_OnRedraw - dd 0 - dd 0 - dd editor_OnKey - dd keybar_editor - dd editor_getname - dd editor_OnExit - dd editor_IsHandleUsed - -filesearch_vtable: - dd filesearch_OnRedraw - dd filesearch_OnActivate - dd filesearch_OnIdle - dd filesearch_OnKey - dd 0 - dd filesearch_getname - dd filesearch_OnExit - dd filesearch_IsHandleUsed - -; additions to this table require changes in tools.inc::get_error_msg -errors1: - dd error0msg - dd error1msg - dd error2msg - dd error3msg - dd error4msg - dd error5msg - dd error6msg - dd error7msg - dd error8msg - dd error9msg - dd error10msg - dd error11msg -errors2: - dd error30msg - dd error31msg - dd error32msg - -encodings: -.cp866 = 0 -.cp1251 = 1 -.koi8r = 2 -.unicode = 3 - -.names: - db 'cp866 ' - db 'cp1251 ' - db 'koi8-r ' - db 'Unicode ' - -.tables: -; cp866 - trivial map - times 128 db %+127 -; cp1251 - db 0x3F,0x3F,0x27,0x3F,0x22,0x3A,0xC5,0xD8,0x3F,0x25,0x3F,0x3C,0x3F,0x3F,0x3F,0x3F - db 0x3F,0x27,0x27,0x22,0x22,0x07,0x2D,0x2D,0x3F,0x54,0x3F,0x3E,0x3F,0x3F,0x3F,0x3F - db 0xFF,0xF6,0xF7,0x3F,0xFD,0x3F,0xB3,0x15,0xF0,0x63,0xF2,0x3C,0xBF,0x2D,0x52,0xF4 - db 0xF8,0x2B,0x49,0x69,0x3F,0xE7,0x14,0xFA,0xF1,0xFC,0xF3,0x3E,0x3F,0x3F,0x3F,0xF5 - times 0x30 db %-1+0x80 - times 0x10 db %-1+0xE0 -; koi8-r - db 0xC4,0xB3,0xDA,0xBF,0xC0,0xD9,0xC3,0xB4,0xC2,0xC1,0xC5,0xDF,0xDC,0xDB,0xDD,0xDE - db 0xB0,0xB1,0xB2,0xF4,0xFE,0xF9,0xFB,0xF7,0xF3,0xF2,0xFF,0xF5,0xF8,0xFD,0xFA,0xF6 - db 0xCD,0xBA,0xD5,0xF1,0xD6,0xC9,0xB8,0xB7,0xBB,0xD4,0xD3,0xC8,0xBE,0xBD,0xBC,0xC6 - db 0xC7,0xCC,0xB5,0xF0,0xB6,0xB9,0xD1,0xD2,0xCB,0xCF,0xD0,0xCA,0xD8,0xD7,0xCE,0xFC - db 0xEE,0xA0,0xA1,0xE6,0xA4,0xA5,0xE4,0xA3,0xE5,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE - db 0xAF,0xEF,0xE0,0xE1,0xE2,0xE3,0xA6,0xA2,0xEC,0xEB,0xA7,0xE8,0xED,0xE9,0xE7,0xEA - db 0x9E,0x80,0x81,0x96,0x84,0x85,0x94,0x83,0x95,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E - db 0x8F,0x9F,0x90,0x91,0x92,0x93,0x86,0x82,0x9C,0x9B,0x87,0x98,0x9D,0x99,0x97,0x9A - -.menu: - db .cp866 -.menu.1: - dd .menu.2 - dd 0 -if lang eq ru_RU - db '&DOS ⥪ (cp866)',0 -else - db '&DOS text (cp866)',0 -end if - db .cp1251 -.menu.2: - dd .menu.3 - dd .menu.1 -if lang eq ru_RU - db '&Windows ⥪ (cp1251)',0 -else - db '&Windows text (cp1251)',0 -end if - db .koi8r -.menu.3: - dd .menu.4 - dd .menu.2 -if lang eq ru_RU - db '&Linux ⥪ (koi8-r)',0 -else - db '&Linux text (koi8-r)',0 -end if - db .unicode -.menu.4: - dd 0 - dd .menu.3 - db '&Unicode',0 - -active_screen dd 0 -viewer_tabsize dd 8 -editor_tabsize dd 8 - -ascii2scan: - times 32 db 0 - db 0x39,0x02,0x03,0x04,0x05,0x06,0x08,0x28,0x0A,0x0B,0x09,0x0D,0x33,0x0C,0x34,0x35 - db 0x0B,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x27,0x27,0x33,0x0D,0x34,0x35 - db 0x03,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 - db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x07,0x0C - db 0x29,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 - db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x29,0x00 - db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 - db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C - db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 - times 48 db 0 - db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C - db 0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -scan2ascii: - db 0,0,'1234567890-=',0,0 - db 'qwertyuiop[]',0,0,'as' - db 'dfghjkl;',27h,'`',0,'\zxcv' - db 'bnm,./',0,0,0,' ',0,0,0,0,0,0 - -;⠡ 㭪権: mouse_panels, mouse_viewer mouse_editor 冷 㣮 -align 4 -mouse_panels: - dd 0 ;f1 - dd 0 ;f2 - dd panels_OnKey.f3 - dd panels_OnKey.f4 - dd panels_OnKey.f5 - dd 0 ;f6 - dd panels_OnKey.f7 - dd panels_OnKey.f8 - dd 0 - dd exit ;f10 - dd 0 - dd F12 -; Shift - rd 4 - dd panels_OnKey.shift_f5 - rd 7 -.ctrl: - rd 2 -repeat 9-3+1 - dd panels_OnKey.ctrl_f3_9 -end repeat - rd 3 -; Ctrl+Shift - rd 12 -.alt: - dd panels_OnKey.alt_f1_2 - dd panels_OnKey.alt_f1_2 - rd 4 - dd panels_OnKey.alt_f7 - rd 5 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -mouse_viewer: - rd 1 - dd viewer_OnKey.f2 - dd viewer_OnKey.exit ;f3 - dd viewer_OnKey.f4 - rd 2 - dd viewer_OnKey.f7 - dd viewer_OnKey.f8 - rd 1 - dd viewer_OnKey.exit ;f10 - rd 1 - dd F12 -; Shift - rd 6 - dd viewer_OnKey.shift_f7 - rd 5 -; Ctrl - rd 12 -; Ctrl+Shift - rd 12 -; Alt - rd 12 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -mouse_editor: - rd 1 - dd editor_OnKey.f2 - rd 4 - dd editor_OnKey.f7 - rd 2 - dd editor_OnKey.exit_confirm ;f10 - rd 1 - dd F12 -; Shift - rd 6 - dd editor_OnKey.shift_f7 - rd 5 -; Ctrl - rd 12 -; Ctrl+Shift - rd 12 -; Alt - rd 12 -; Alt+Shift - rd 12 -; Alt+Ctrl - rd 12 -; Alt+Ctrl+Shift - rd 12 - -; ⠭ -; db scancode, reserved -; dw ctrlstate -; dd handler -; ctrlstate: 訥 4 - Shift, ᫥騥 - Ctrl, ᫥騥 - Alt -; 0 = -; 1 = ஢ -; 2 = -; 3 = , ࠢ -; 4 = ࠢ , -panels_ctrlkeys: - dw 0x48, 0 - dd panels_OnKey.up - dw 0x50, 0 - dd panels_OnKey.down - dw 0x4B, 0 - dd panels_OnKey.left - dw 0x4D, 0 - dd panels_OnKey.right - dw 0x51, 0 - dd panels_OnKey.pgdn - dw 0x49, 0 - dd panels_OnKey.pgup - dw 0xF, 0 - dd panels_OnKey.tab - dw 0x47, 0 - dd panels_OnKey.home - dw 0x4F, 0 - dd panels_OnKey.end - dw 0x1C, 0 - dd panels_OnKey.enter - dw 0x3D, 0 - dd panels_OnKey.f3 - dw 0x3E, 0 - dd panels_OnKey.f4 - dw 0x3F, 0 - dd panels_OnKey.f5 - dw 0x3F, 1 - dd panels_OnKey.shift_f5 - dw 0x41, 0 - dd panels_OnKey.f7 - dw 0x41, 0x100 - dd panels_OnKey.alt_f7 - dw 0x42, 0 - dd panels_OnKey.f8 - dw 0x43, 0x100 - dd alt_f9 - dw 0x44, 0 - dd exit - dw 0x5D, 0 - dd panels_OnKey.menu -repeat 9-3+1 - dw 0x3D+%-1, 0x10 - dd panels_OnKey.ctrl_f3_9 -end repeat - dw 0x3B, 0x100 - dd panels_OnKey.alt_f1_2 - dw 0x3C, 0x100 - dd panels_OnKey.alt_f1_2 - dw 0x58, 0 - dd F12 - dw 0x13, 0x10 - dd panels_OnKey.ctrl_r - dw 2, 0x30 - dd panels_OnKey.change_mode - dw 3, 0x30 - dd panels_OnKey.change_mode - dw 4, 0x30 - dd panels_OnKey.change_mode - dw 5, 0x30 - dd panels_OnKey.change_mode -repeat 10 - dw %+1, 0x40 - dd panels_OnKey.quick_jump -end repeat - dw 0x52, 0 - dd panels_OnKey.insert - dw 0x4E, 0 - dd panels_OnKey.greyplus - dw 0x4A, 0 - dd panels_OnKey.greyminus - dw 0x37, 0 - dd panels_OnKey.greyasterisk - db 0 - -viewer_ctrlkeys: - dw 1, 0 - dd viewer_OnKey.exit - dw 0x51, 0 - dd viewer_OnKey.pgdn - dw 0x49, 0 - dd viewer_OnKey.pgup - dw 0x50, 0 - dd viewer_OnKey.down - dw 0x48, 0 - dd viewer_OnKey.up - dw 0x4B, 0 - dd viewer_OnKey.left - dw 0x4B, 0x10 - dd viewer_OnKey.ctrl_left - dw 0x4B, 0x11 - dd viewer_OnKey.ctrl_shift_left - dw 0x4C, 0 - dd viewer_OnKey.exit - dw 0x4D, 0 - dd viewer_OnKey.right - dw 0x4D, 0x10 - dd viewer_OnKey.ctrl_right - dw 0x4D, 0x11 - dd viewer_OnKey.ctrl_shift_right - dw 0x3C, 0 - dd viewer_OnKey.f2 - dw 0x3D, 0 - dd viewer_OnKey.exit - dw 0x3E, 0 - dd viewer_OnKey.f4 - dw 0x41, 0 - dd viewer_OnKey.f7 - dw 0x41, 1 - dd viewer_OnKey.shift_f7 - dw 0x42, 0 - dd viewer_OnKey.f8 - dw 0x42, 1 - dd viewer_OnKey.shift_f8 - dw 0x44, 0 - dd viewer_OnKey.exit - dw 0x47, 0 - dd viewer_OnKey.home - dw 0x4F, 0 - dd viewer_OnKey.end - dw 0x58, 0 - dd F12 - dw 0x43, 0x100 - dd alt_f9 - db 0 - -editor_ctrlkeys: - dw 1, 0 - dd editor_OnKey.exit_confirm - dw 0x0E, 0 - dd editor_OnKey.backspace - dw 0x3C, 0 - dd editor_OnKey.f2 - dw 0x41, 0 - dd editor_OnKey.f7 - dw 0x41, 1 - dd editor_OnKey.shift_f7 - dw 0x43, 0x100 - dd alt_f9 - dw 0x44, 0 - dd editor_OnKey.exit_confirm - dw 0x44, 1 - dd editor_OnKey.exit_save - dw 0x47, 0 - dd editor_OnKey.home - dw 0x48, 0 - dd editor_OnKey.up - dw 0x49, 0 - dd editor_OnKey.pgup - dw 0x4B, 0 - dd editor_OnKey.left - dw 0x4D, 0 - dd editor_OnKey.right - dw 0x4F, 0 - dd editor_OnKey.end - dw 0x50, 0 - dd editor_OnKey.down - dw 0x51, 0 - dd editor_OnKey.pgdn - dw 0x52, 0 - dd editor_OnKey.ins - dw 0x53, 0 - dd editor_OnKey.del - dw 0x58, 0 - dd F12 - dw 0xF, 0x100 ; Alt+Tab - dd dummy_key - dw 0xF, 0x101 ; Shift+Alt+Tab - dd dummy_key - db 0 - -dummy_key: - ret - -dirinfo: - dd 1 -.first dd 0 - dd 0 -.size dd 300 -.dirdata dd 0 - db 0 -.name dd 0 - -readinfo: - dd 0 -.first dq 0 -.size dd 0 -.data dd 0 - db 0 -.name dd 0 - -writeinfo: -.code dd 2 -.first dq 0 -.size dd 0 -.data dd 0 - db 0 -.name dd 0 - -attrinfo: - dd 5 - dd 0 - dd 0 - dd 0 - dd .attr - db 0 -.name dd 0 - -delinfo: - dd 8 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd execdata - -mkdirinfo: - dd 9 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd CopyDestEditBuf+12 - -if lang eq ru_RU -compare_names db 'ᑤ' -else -compare_names db 'nNxXmMsSuUcCaA' -end if - -; 稭 䨣樮 - ⥪饩 ॠ樨 ୨ - -; -panel_normal_color db 1Bh -panel_selected_color db 1Eh -panel_border_color db 1Bh -panel_cursor_color db 30h -panel_selected_cursor_color db 3Eh -panel_header_color db 1Bh -panel_active_header_color db 30h -column_header_color db 1Eh -panel_number_color db 1Bh -panel_numselected_color db 3Eh -panel_nscreens_color db 0Bh -; -dialog_colors: -dialog_main_color db 70h -dialog_border_color db 70h -dialog_header_color db 70h -dialog_edit_color db 30h -dialog_unmodified_edit_color db 38h -dialog_normal_btn_color db 70h -dialog_selected_btn_color db 30h -dialog_list_color db 70h -dialog_selected_list_color db 0Fh -dialog_scroll_list_color db 70h -; ।० 訡 -warning_colors: -; !!! ⮬ 浪, !!! -warning_main_color db 4Fh -warning_border_color db 4Fh -warning_header_color db 4Fh -warning_edit_color db 30h -warning_unmodified_edit_color db 38h -warning_normal_btn_color db 4Fh -warning_selected_btn_color db 70h -warning_list_color db 3Fh -warning_selected_list_color db 70h -warning_scroll_list_color db 3Fh -; -menu_normal_color db 3Fh -menu_selected_color db 0Fh -menu_highlight_color db 3Eh -menu_selected_highlight_color db 0Eh -menu_border_color db 3Fh -menu_header_color db 3Fh -menu_scrollbar_color db 3Fh -; -keybar_number_color db 7 -keybar_name_color db 30h -keybar_bgr_color db 7 -; ப -cmdbar_normal_color db 7 -cmdbar_prefix_color db 7 -; ᬮ騪 -view_normal_color db 1Bh -view_selected_color db 30h -view_status_color db 30h -view_arrows_color db 1Eh -; -edit_normal_color db 1Bh -edit_status_color db 30h - -; ᢥ⪠ 䠩 -highlight_num_groups dd 10 -highlight_groups dd highlight_group0 - dd highlight_group1 - dd highlight_group2 - dd highlight_group3 - dd highlight_group4 - dd highlight_group5 - dd highlight_group6 - dd highlight_group7 - dd highlight_group8 - dd highlight_group9 - -; ଠ ᠭ 㯯 ᢥ⪨: -virtual at 0 -highlight: - .IncludeAttributes db ? - .NormalColor db ? - .CursorColor db ? - .SelectedColor db ? - .SelectedCursorColor db ? - .Mask: ; ASCIIZ-string -end virtual - -; all highlight masks must be in lowercase! -highlight_group0: - db 2 - db 13h, 38h, 0, 0 - db '*',0 -highlight_group1: - db 4 - db 13h, 38h, 0, 0 - db '*',0 -highlight_group2: - db 10h - db 1Fh, 3Fh, 0, 0 - db '*|..',0 -highlight_group3: - db 10h - db 0, 0, 0, 0 - db '..',0 -highlight_group4: - db 0 - db 1Ah, 3Ah, 0, 0 - db '*.exe,*.com,*.bat,*.cmd,*.kex',0 -highlight_group5: - db 0 - db 1Ah, 3Ah, 0, 0 - db '*|*.*,readme,makefile',0 -highlight_group6: - db 0 - db 1Dh, 3Dh, 0, 0 - db '*.rar,*.zip,*.[zj],*.[bg7]z,*.[bg]zip,*.tar,*.t[ag]z,*.ar[cj],*.r[0-9][0-9],' - db '*.a[0-9][0-9],*.bz2,*.cab,*.msi,*.jar,*.lha,*.lzh,*.ha,*.ac[bei],*.pa[ck],' - db '*.rk,*.cpio,*.rpm,*.zoo,*.hqx,*.sit,*.ice,*.uc2,*.ain,*.imp,*.777,*.ufa,*.boa,' - db '*.bs[2a],*.sea,*.hpk,*.ddi,*.x2,*.rkv,*.[lw]sz,*.h[ay]p,*.lim,*.sqz,*.chz',0 -highlight_group7: - db 0 - db 16h, 36h, 0, 0 - db '*.bak,*.tmp',0 -highlight_group8: - db 0 - db 17h, 37h, 0, 0 - db '*.asm,*.inc',0 -highlight_group9: - db 10h - db 1Fh, 3Fh, 0, 0 - db '*',0 - -bConfirmDelete db 1 -bConfirmDeleteIncomplete db 0 - -FolderShortcuts dd 0,0,0,0,0,0,0,0,0,0 - -; 稢 䨣樮 - -bWasE0 db 0 -ctrlstate db 0 -mousestate db 0 -align 4 -MemForImage dd 0 -restore_semicolon dd 0 -bForHex db 0 - -align 4 -; 饭 뤥 -nomem_dlgdata: - dd 2 - dd -1 - dd -1 - dd 12 - dd 2 - dd 1 - dd 1 - dd aError - rb 8 - dd 0 - dd 0 - dd 2 -; ப "No memory" - DlgLbl ,1,0,10,0,aNoMemory,1 -; "Ok" - DlgBtn ,4,1,7,1,aOk,0xD - -; ஢ -copy_dlgdata: - dd 1 -.x dd -1 -.y dd -1 -.width dd ? -.height dd 4 - dd 4 - dd 2 - dd aCopyCaption -.main_color db ? -.border_color db ? -.header_color db ? - db 0 - dd ? - dd 0 - dd 0 - dd 4 -; ப '஢ "%s" :' -.lcopy DlgLbl ,1,0,,0,CopySourceTextBuf,0 -; ।஢ 䠩/ 祭 -.ename DlgEdit ,1,1,,1,CopyDestEditBuf,0 -; "஢" -.copy DlgBtn ,,3,,3,aCopy,18h -; "⬥" -.cnl DlgBtn ,,3,,3,aCancelB,8 - -struct MkDir_Dlgdata - dd 1 - dd -1, -1 -width dd ? -height dd 4 - dd 4, 2 - dd aMkDirCaption - dd ?, ? - dd 0 - dd 0 - dd 4 -; ப " " - DlgLbl ,1,0,aMkDirLen,0,aMkDir,0 -; ।஢ ᮧ -dnam DlgEdit ,1,1,,1,CopyDestEditBuf,0xC -; "த" -cont DlgBtn ,,3,,3,a_Continue,18h -; "⬥" -cnl DlgBtn ,,3,,3,aCancelB,8 -ends - -mkdir_dlgdata MkDir_Dlgdata - -; 뤥/ -mark_dlgdata: - dd 1 - dd -1, -1 - dd 37, 1 - dd 4, 2 -.title dd ? - dd ?, ? - dd 0, 0 - dd 1 -; ।஢ -.edit DlgEdit ,1, 0, 35, 0, enter_string_buf, - -; ண ᪠ (Alt+㪢) -QuickSearchDlg: - dd 5 -.x dd ? -.y dd ? - dd 20, 1 - dd 1, 1 - dd aSearch - dd ?, ? - dd 0, 0 - dd 1 -; ।஢ - DlgEdit ,1, 0, 18, 0, quick_search_buf, 1Ch - -; ᪠ 䠩 ᬮ騪 । -struct FindInFileDlgdata - dd 1 -x dd -1 -y dd -1 -width dd ? -height dd 7 - dd 4, 2 - dd aSearch - dd ?, ? - dd 0, 0 - dd 8 -; ப "᪠" - DlgLbl ,1,0,aSearchForLen,0,aSearchFor,0 -; ।஢ ⥪⮬ ᪠ -efind DlgEdit ,1,1,,1,SearchStringEditBuf,0xC -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,2,-1,2 -; 䫠 "뢠 ॣ" -case DlgCheck,1,3,-1,3,aCaseSensitive,18h ; default: search is case sensitive -; 䫠 "쪮 楫 ᫮" -whole DlgCheck,1,4,-1,4,aWholeWords,8 ; default: do NOT search whole words only -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,5,-1,5 -; "᪠" -search DlgBtn ,,6,,6,aSearchB,18h -; "⬥" -cnl DlgBtn ,,6,,6,aCancelB,8 -ends - -find_in_file_dlgdata FindInFileDlgdata - -; ᪠ 䠩 () -struct FileSearch_QueryTemplate - dd 1 -x dd ? -y dd ? -width dd ? -height dd 9 - dd 4, 2 - dd aFileSearch - dd ? - dd 0 - dd 0, 0 - dd 10 -; ப-ਣ襭 ᪨ - DlgLbl ,1,0,aFileMasksLen,0,aFileMasks,0 -; ᪨ -edit1 DlgEdit ,1,1,,1,,0xC -; ப-ਣ襭 ⥪ ᪠ - DlgLbl ,1,2,aContainingTextLen,2,aContainingText,0 -; ⥪ ᪠ -edit2 DlgEdit ,1,3,,3,,8 -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,4,-1,4 -; 䫠 "뢠 ॣ" -case DlgCheck,1,5,-1,5,aCaseSensitive, ; will be initialized from find_in_file_dlgdata -; 䫠 "쪮 楫 ᫮" -whole DlgCheck,1,6,-1,6,aWholeWords, ; will be initialized from find_in_file_dlgdata -; ਧ⠫ ࠧ⥫ - DlgLine ,-1,7,-1,7 -; "᪠" -search DlgBtn ,,8,,8,aSearchB,18h -; "⬥" -cnl DlgBtn ,,8,,8,aCancelB,8 -ends - -filesearch_query_template FileSearch_QueryTemplate - -; ன ᪠ 䠩 (᪠஢) -struct FileSearch_SearchTemplate - dd 1 -x dd ? -y dd ? -width dd ? -height dd ? - dd 4, 2 -caption dd ? - dd ? - dd 0 - dd 0, 0 - dd 9 -; ᯨ᮪ 䠩 -list1 DlgList ,0,0,,,,0 -; ਧ⠫ ࠧ⥫ -lin1 DlgLine ,-1,,-1, -; ப " :" " 祭..." -lbl1 DlgLbl ,1 -; ப ⥪饩 -lbl2 DlgLbl -; ਧ⠫ ࠧ⥫ -lin2 DlgLine ,-1,,-1, -; -btn1 DlgBtn ,,,,,aNewSearch,8 -btn2 DlgBtn ,,,,,aGoto,1Ch -btn3 DlgBtn ,,,,,aView,8 -btn4 DlgBtn ,,,,,aCancelB2,8 -ends - -filesearch_search_template FileSearch_SearchTemplate - -RetryOrCancelBtn: - dd aRetry - dd a_Cancel -DeleteOrKeepBtn: - dd a_Delete - dd aKeep -RetryOrIgnoreBtn: - dd aRetry - dd aIgnore -DeleteOrCancelBtn: - dd a_Delete - dd a_Cancel -DeleteErrorBtn: - dd aRetry -SkipOrCancelBtn: - dd aSkip - dd aSkipAll - dd a_Cancel -ContinueBtn: - dd aContinue -EditorExitBtn: - dd aSave - dd aDontSave - dd aContinueEdit -YesOrNoBtn: - dd aYes - dd aNo - -aCannotOpenFile_ptr dd aCannotOpenFile -aCannotCreateThread_ptr dd aCannotCreateThread -ConfirmCancelMsg dd aConfirmCancel -EditConfigErr_ptr: - dd aEditConfigErr1 - dd aEditConfigErr2 -if lang eq ru_RU -aDeleteCaption db '',0 -aConfirmDeleteText db ' 㤠',0 -aDeleteFolder db ' ',0 -aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 -aDeleteFile db ' 䠩',0 -aCancelB db '[ ⬥ ]',0 -aCancelBLength = $ - aCancelB - 1 -aCancelB2 db '[ ⬥ ]',0 -aCancelB2Length = $ - aCancelB2 - 1 -aCopyCaption db '஢',0 -aCopy db '[ ஢ ]',0 -aCopyLength = $ - aCopy - 1 -a_Continue db '[ த ]',0 -a_ContinueLength = $ - a_Continue - 1 -aCopy1 db '஢ ',0 -aCopy2 db ' :',0 -aError db '訡',0 -aContinue db 'த',0 -aRetry db '',0 -a_Cancel db '⬥',0 -a_Delete db '',0 -aSkip db 'ய',0 -aSkipAll db 'ய ',0 -aYes db '',0 -aNo db '',0 -error0msg db '࠭... 訡',0 -error1msg db '࠭... । / ࠧ ⪮ ᪠',0 -error2msg db '㭪 ন 䠩 ⥬',0 -error3msg db '⭠ 䠩 ⥬',0 -error4msg db '࠭... 訡 4',0 -error5msg db ' ',0 -error6msg db ' 稫',0 -error7msg db '࠭... ⥫ ਫ',0 -error8msg db ' ',0 -error9msg db ' ࠧ襭',0 -error10msg db ' ',0 -error11msg db '訡 ன⢠',0 -error30msg db '筮 ',0 -error31msg db '  ᯮ塞',0 -error32msg db '誮 ᮢ',0 -aUnknownError db ' 訡: ',0 -aCannotReadFolder db ' ',0 -aRunError db '訡 ᪥ ணࠬ:',0 -aFileNameTooBig db ' 䠩 ᫨誮 ',0 -aFolderNameTooBig db ' ᫨誮 ',0 -aCmdLineTooBig db ' ப ॢ蠥 ࠭ OS 256 ᨬ',0 -aCannotCopyToSelf db ' ᪮஢ ᠬ ᥡ',0 -aCannotReadFile db ' 䠩',0 -aIncompleteFile db ' 祭 䠩. ?',0 -aKeep db '⠢',0 -aCannotWriteFile db ' 䠩',0 -aCannotDeleteFile db ' 㤠 䠩',0 -aCannotDeleteFolder db ' 㤠 ',0 -aNotFolder db '  ',0 -aIgnore db '஢',0 -aMkDirCaption db ' ',0 -aMkDir db ' ',0 -aMkDirLen = $ - aMkDir - 1 -aCannotMakeFolder db ' ᮧ ',0 -aName db 3,'' -aSize db 6,'' -aDate db 4,'' -aTime db 5,'६' -aCannotLoadDLL db ' 㧨 DLL',0 -aCannotLoadPlugin db ' 㧨 ',0 -aInvalidDLL db ' ଠ',0 -aMissingExport db '室 㭪 ',0 -aInitFailed db '訡 樠樨',0 -aIncompatibleVersion db 'ᮢ⨬ ',0 -aTables db '',0 -aSelect db '',0 -aDeselect db '',0 -aCannotOpenFile db '訡 ⨨ 䠩',0 -aCannotCreateThread db '訡 ᮧ ⮪',0 -aCannotSetFolder db ' ',0 -aSearch db '',0 -aSearchB db '[ ᪠ ]',0 -aSearchBLength = $ - aSearchB - 1 -aSearchFor db '᪠',0 -aSearchForLen = $ - aSearchFor - 1 -aCaseSensitive db '뢠 ॣ',0 -aWholeWords db '쪮 楫 ᫮',0 -aReverseSearch db ' ',0 -aStringNotFound db 'ப ',0 -aFileSearch db ' 䠩',0 -aFileMasks db ' ᪮쪮 ᮪ 䠩:',0 -aFileMasksLen = $ - aFileMasks - 1 -aContainingText db 'ঠ ⥪:',0 -aContainingTextLen = $ - aContainingText - 1 -aSearchingIn db ' "" :',0 -aSearchingInLen = $ - aSearchingIn - 1 -aSearchDone db ' 祭. ? 䠩()',0 -aSearchDoneLen = $ - aSearchDone - 1 -aNewSearch db '[ ]',0 -aNewSearchLen = $ - aNewSearch - 1 -aGoto db '[ ३ ]',0 -aGotoLen = $ - aGoto - 1 -aView db '[ ]',0 -aViewLen = $ - aView - 1 -aEditConfigErr1 db '訡 䨣樨 ।.',0 -aEditConfigErr2 db '஡ 譨 .',0 -aEditNoMemory db ' ᫨誮 㧪 ।.',0 -aLine db ' ப' -aCol db ' ' -aEditorTitle db '',0 -aFileModified db ' ',0 -aSave db '࠭',0 -aDontSave db ' ࠭',0 -aContinueEdit db 'த ।஢',0 -aCannotSaveToPlugin db '࠭ 䠩 ন',0 -aCannotSearchOnPlugin db ' ন',0 -aCancelled db '⢨ 뫮 ࢠ',0 -aConfirmCancel db ' ⢨⥫쭮 ⬥ ⢨?',0 -else -aDeleteCaption db 'Delete',0 -aConfirmDeleteText db 'Do you wish to delete',0 -aDeleteFolder db ' the folder',0 -aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 -aDeleteFile db ' the file',0 -aDelete db ' Delete ',0 -aDeleteLength = $ - aDelete - 1 -aCancel db ' Cancel ',0 -aCancelLength = $ - aCancel - 1 -aCancelB db '[ Cancel ]',0 -aCancelBLength = $ - aCancelB - 1 -aCancelB2 = aCancelB -aCancelB2Length = $ - aCancelB2 - 1 -aCopyCaption db 'Copy',0 -aCopy db '[ Copy ]',0 -aCopyLength = $ - aCopy - 1 -a_Continue db '[ Continue ]',0 -a_ContinueLength = $ - a_Continue - 1 -aCopy1 db 'Copy "',0 -aCopy2 db '" to:',0 -aError db 'Error',0 -aContinue db 'Continue',0 -aRetry db 'Retry',0 -a_Cancel db 'Cancel',0 -a_Delete db 'Delete',0 -aSkip db 'Skip',0 -aSkipAll db 'Skip all',0 -aYes db 'Yes',0 -aNo db 'No',0 -error0msg db 'Strange... No error',0 -error1msg db 'Strange... Hard disk base and/or partition not defined',0 -error2msg db 'The file system does not support this function',0 -error3msg db 'Unknown file system',0 -error4msg db 'Strange... Error 4',0 -error5msg db 'File not found',0 -error6msg db 'End of file',0 -error7msg db 'Strange... Pointer lies outside of application memory',0 -error8msg db 'Disk is full',0 -error9msg db 'File structure is destroyed',0 -error10msg db 'Access denied',0 -error11msg db 'Device error',0 -error30msg db 'Not enough memory',0 -error31msg db 'File is not executable',0 -error32msg db 'Too many processes',0 -aUnknownError db 'Unknown error code: ',0 -aCannotReadFolder db 'Cannot read folder',0 -aRunError db 'Cannot execute program:',0 -aFileNameTooBig db 'Full file name is too long',0 -aFolderNameTooBig db 'Full folder name is too long',0 -aCmdLineTooBig db 'Command line is too long (OS limit is 256 symbols)',0 -aCannotCopyToSelf db 'File cannot be copied onto itself',0 -aCannotReadFile db 'Cannot read file',0 -aIncompleteFile db 'Incomplete file was retrieved. Delete it?',0 -aKeep db 'Keep',0 -aCannotWriteFile db 'Cannot write to the file',0 -aCannotDeleteFile db 'Cannot delete the file',0 -aCannotDeleteFolder db 'Cannot delete the folder',0 -aNotFolder db 'is not a folder',0 -aIgnore db 'Ignore',0 -aMkDirCaption db 'Make folder',0 -aMkDir db 'Create the folder',0 -aMkDirLen = $ - aMkDir - 1 -aCannotMakeFolder db 'Cannot create folder',0 -aName db 4,'Name' -aSize db 4,'Size' -aDate db 4,'Date' -aTime db 4,'Time' -aCannotLoadDLL db 'Cannot load DLL',0 -aCannotLoadPlugin db 'Cannot load plugin',0 -aInvalidDLL db 'File is not found or invalid',0 -aMissingExport db 'Required function is not present',0 -aInitFailed db 'Initialization failed',0 -aIncompatibleVersion db 'Incompatible version',0 -aTables db 'Tables',0 -aSelect db 'Select',0 -aDeselect db 'Deselect',0 -aCannotOpenFile db 'Cannot open the file',0 -aCannotCreateThread db 'Cannot create a thread',0 -aCannotSetFolder db 'Cannot enter to the folder',0 -aSearch db 'Search',0 -aSearchB db '[ Search ]',0 -aSearchBLength = $ - aSearchB - 1 -aSearchFor db 'Search for',0 -aSearchForLen = $ - aSearch - 1 -aCaseSensitive db 'Case sensitive',0 -aWholeWords db 'Whole words',0 -aReverseSearch db 'Reverse search',0 -aStringNotFound db 'Could not find the string',0 -aFileSearch db 'Find file',0 -aFileMasks db 'A file mask or several file masks:',0 -aFileMasksLen = $ - aFileMasks - 1 -aContainingText db 'Containing text:',0 -aContainingTextLen = $ - aContainingText - 1 -aSearchingIn db 'Searching "" in:',0 -aSearchingInLen = $ - aSearchingIn - 1 -aSearchDone db 'Search done. Found ? file(s)',0 -aSearchDoneLen = $ - aSearchDone - 1 -aNewSearch db '[ New search ]',0 -aNewSearchLen = $ - aNewSearch - 1 -aGoto db '[ Go to ]',0 -aGotoLen = $ - aGoto - 1 -aView db '[ View ]',0 -aViewLen = $ - aView - 1 -aEditConfigErr1 db 'Error in configuration of plugins for the editor.',0 -aEditConfigErr2 db 'Try to remove unnecessary plugins.',0 -aEditNoMemory db 'The file is too big for the editor.',0 -aLine db ' Line' -aCol db ' Col ' -aEditorTitle db 'Editor',0 -aFileModified db 'File has been modified',0 -aSave db 'Save',0 -aDontSave db 'Do not save',0 -aContinueEdit db 'Continue editing',0 -aCannotSaveToPlugin db 'Saving is not supported for plugin panels',0 -aCannotSearchOnPlugin db 'The search on plugin panels is not supported yet',0 -aCancelled db 'Operation has been interrupted',0 -aConfirmCancel db 'Do you really want to cancel it?',0 -end if - -aOk db 'OK',0 -aNoMemory db 'No memory!' -nullstr db 0 -aUntitled db 'untitled',0 -aDotDot db '..',0,0 -standard_dll_path: -libini_name db '/sys/lib/' -standard_dll_path_size = $ - standard_dll_path - db 'libini.obj',0 -aStart db 'START',0 -aLibInit db 'lib_init',0 -aVersion db 'version',0 -aIniGetInt db 'ini_get_int',0 -aIniGetStr db 'ini_get_str',0 -aIniSetInt db 'ini_set_int',0 -aIniEnumKeys db 'ini_enum_keys',0 -aPluginLoad db 'plugin_load',0 -aPluginUnload db 'plugin_unload',0 -aGetattr db 'getattr',0 -aOpen db 'open',0 -aRead db 'read',0 -aSetpos db 'setpos',0 -aClose db 'close',0 -aOpenFilePlugin db 'OpenFilePlugin',0 -aClosePlugin db 'ClosePlugin',0 -aReadFolder db 'ReadFolder',0 -aSetFolder db 'SetFolder',0 -aGetOpenPluginInfo db 'GetOpenPluginInfo',0 -aGetPanelTitle db 'GetPanelTitle',0 -aGetFiles db 'GetFiles',0 -aEditInfoSize db 'EditInfoSize',0 - -aConfirmations db 'Confirmations',0 -aConfirmDelete db 'Delete',0 -aConfirmDeleteIncomplete db 'DeleteIncomplete',0 - -aPanels db 'Panels',0 -aLeftViewMode db 'LeftViewMode',0 -aRightViewMode db 'RightViewMode',0 -aLeftSortMode db 'LeftSortMode',0 -aRightSortMode db 'RightSortMode',0 - -aEditor db 'Editor',0 -aEolStyle db 'EOLStyle',0 - -aAssociations db 'Associations',0 -aPlugins db 'Plugins',0 -aMenu db 'Menu',0 -aFolderShortcuts db 'FolderShortcuts',0 -aShortcut db 'Shortcut' -.d db '0',0 - -align 4 -ini_import: -ini.get_int dd aIniGetInt -ini.get_str dd aIniGetStr -ini.enum_keys dd aIniEnumKeys -ini.set_int dd aIniSetInt - dd 0 - -plugin_exported: - dd aPluginUnload - dd aGetattr - dd aOpen - dd aRead - dd aSetpos - dd aClose - dd aOpenFilePlugin - dd aClosePlugin - dd aReadFolder - dd aSetFolder - dd aGetOpenPluginInfo - dd aGetPanelTitle - dd aGetFiles - dd aEditInfoSize - dd 0 -plugin_exported_default: - dd plugin_unload_default - dd getattr_default - dd open_default - dd read - dd setpos_default - dd close - dd OpenFilePlugin_default - dd ClosePlugin_default - dd ReadFolder_default - dd SetFolder_default - dd GetOpenPluginInfo_default - dd GetPanelTitle_default - dd GetFiles_default - dd 0 ; default value for EditInfoSize - -kfar_info: - dd .size - dd version_dword - dd open - dd open2 - dd read - dd -1 ; write: to be implemented - dd seek - dd tell - dd -1 ; flush: to be implemented - dd filesize - dd close - dd xpgalloc - dd xpgrealloc - dd pgfree - dd getfreemem - dd libini_alloc - dd libini_realloc - dd libini_free - dd menu - dd menu_centered_in - dd DialogBox - dd SayErr - dd Message - dd cur_width -.size = $ - kfar_info - -plugins dd 0 -num_plugins dd 0 -alloc_plugins dd 0 - -EditPlugInfo dd 0 -EditEOLStyle db edit.eol_unix - -virtual at 0 -PluginInfo: -.unload dd ? -.getattr dd ? -.open dd ? -.read dd ? -.setpos dd ? -.close dd ? -.OpenFilePlugin dd ? -.ClosePlugin dd ? -.ReadFolder dd ? -.SetFolder dd ? -.GetOpenPluginInfo dd ? -.GetPanelTitle dd ? -.GetFiles dd ? -.EditInfoSize dd ? -.EditInfoOffs dd ? -.size = $ -end virtual - -virtual at 0 -PanelMode: -; up to 16 columns on one panel -.NumColumns dd ? -; available column types: -COLUMN_TYPE_NONE = 0 -COLUMN_TYPE_NAME = 1 - COLUMN_NAME_MARK = 10h ; (reserved) - COLUMN_NAME_NOPATH = 20h ; (reserved) - COLUMN_NAME_RIGHTALIGN = 40h ; (reserved) -COLUMN_TYPE_SIZE = 2 - COLUMN_SIZE_COMMA = 10h ; (reserved) -COLUMN_TYPE_PACKED_SIZE = 3 ; (reserved) -COLUMN_TYPE_DATE = 4 -COLUMN_TYPE_TIME = 5 -COLUMN_TYPE_DATETIME = 6 ; (reserved) -COLUMN_TYPE_DATETIME_CREATION = 7 ; (reserved) -COLUMN_TYPE_DATETIME_ACCESS = 8 ; (reserved) -COLUMN_TYPE_ATTRIBUTES = 9 ; (reserved) -COLUMN_TYPE_DESCRIPTION = 10 ; (reserved) -COLUMN_TYPE_OWNER = 11 ; (reserved) -COLUMN_TYPE_NUMLINKS = 12 ; (reserved) -COLUMN_TYPE_CUSTOM = 13 ; (reserved) -.ColumnTypes rb 16 - -.ColumnWidths rb 16 -.bFullScreen db ? ; (reserved) -.bAlignExtensions db ? - rb 2 -.size = $ -end virtual - -align 4 -column_headers: - dd nullstr - dd aName - dd aSize - dd nullstr - dd aDate - dd aTime -draw_column_proc: - dd draw_empty_column - dd draw_name_column - dd draw_size_column - dd -1 - dd draw_date_column - dd draw_time_column -colmodes: -; ० 0 : NM,SC,D - dd 3 - db COLUMN_TYPE_NAME+COLUMN_NAME_MARK, COLUMN_TYPE_SIZE+COLUMN_SIZE_COMMA - db COLUMN_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - db 0, 10, 8 - times 13 db 0 - db 0, 1 - times 2 db 0 -; ० 1 : N,N,N - dd 3 - db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME, COLUMN_TYPE_NAME - times 13 db 0 - times 16 db 0 - db 0, 1 - times 2 db 0 -; ० 2 : N,N - dd 2 - db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME - times 14 db 0 - times 16 db 0 - db 0, 0 - times 2 db 0 -; ० 3 : N,S,D,T - dd 4 - db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE, COLUMN_TYPE_DATE, COLUMN_TYPE_TIME - times 12 db 0 - db 0, 6, 8, 5 - times 12 db 0 - db 0, 1 - times 2 db 0 -; ० 4 : N,S - dd 2 - db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE - times 14 db 0 - db 0, 6 - times 14 db 0 - db 0, 0 - times 2 db 0 -; ० 5 : N,S,P,DM,DC,DA,A -; ० 6 : N,Z -; ० 7 : N,S,Z -; ० 8 : N,S,O -; ० 9 : N,S,LN - -execinfo: - dd 7 - dd 0 -execparams dd 0 - dd 0 - dd 0 - db 0 -execptr dd ? - -IncludeIGlobals - -i_end: - -IncludeUGlobals - -execdata rb 1024 -execdataend: - align 4 -attrinfo.attr rb 40 - -panel1 PanelData - -panel2 PanelData - -;console_data rb max_width*max_height*2 - -nomem_dlgsavearea rb 8 + (12+4)*(3+3)*2 - -quicksearch_savearea rb 22*3*2 -quicksearch_maxlen = 64 -quick_search_buf rb 12 + quicksearch_maxlen - -cur_header rb max_width -tmp dd ? - -skinh dd ? -std_colors rd 10 - -min_y dd ? -max_y dd ? -min_x dd ? -max_x dd ? -used_width dd ? -used_height dd ? - -wnd_width dd ? -wnd_height dd ? - -column_left dd ? -column_top dd ? -column_width dd ? -column_height dd ? -column_index dd ? -last_column_index dd ? - -scrpos dq ? -viewer_right_side dq ? - -EditDataSize dd ? -EditBlockStart dd ? -EditBlockSize dd ? - -saved_file_name: -procinfo rb 1024 -lower_file_name = procinfo + 512 - -app_path rb 1100 - -error_msg rb 128 - -prev_dir rb 1024 - -driveinfo rb 32+304 -tmpname rb 32 - -screens dd ? -num_screens dd ? -active_screen_vtable dd ? -active_screen_data dd ? -active_screen_keybar dd ? - -default_attr dd ? -left_dotdot_entry rb 40+4 ; 40 bytes for attributes + '..' -right_dotdot_entry rb 40+4 - -aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1 -CopySourceTextBuf rb 512 -CopyDestEditBuf rb 12+512+1 -.length = $ - CopyDestEditBuf - 13 - -SearchStringEditBuf rb 12 -SearchString rb 253+1 -SearchStringEditBuf.length = $ - SearchString - 1 - db ? ; used for output (string -> "string") - -enter_string_buf rb 12+512+1 - -bMemForImageValidData db ? - -align 4 -identical_table rb 256 -tolower_table rb 256 -isspace_table rb 256 -composite_table rb 256 -layout rb 128 - -copy_buffer_size = 65536 -copy_buffer rb copy_buffer_size - -filedata_buffer_size = 1024 -filedata_buffer rb filedata_buffer_size - -source_hModule dd ? -source_hPlugin dd ? -source_hFile dd ? -; data for directory delete -; If directory nested level is >1024, then its full name is too big, -; so we see the overflow when creating full name (we check for this!) -del_dir_stack rd 1024 -del_dir_stack_ptr dd ? -del_dir_query_size = 32 -del_dir_query_area rb 32+304*del_dir_query_size - -label copy_dir_stack dword at del_dir_stack -label copy_dir_stack_ptr dword at del_dir_stack_ptr -copy_dir_query_size = del_dir_query_size -copy_dir_query_area = del_dir_query_area -del_bSkipAll db ? ; for directory errors -label copy_bSkipAll byte at del_bSkipAll -copy_bSkipAll2 db ? ; for file read/write errors -copy_bSkipAll3 db ? ; for SetFolder errors - -bEndSlash db ? -bDestIsFolder db ? -bNeedRestoreName db ? - -; stack - align 4 - rb 32768 -stacktop: - -mem: +use32 + db 'MENUET01' + dd 1 + dd start + dd i_end +memsize dd mem + dd stacktop + dd 0, app_path + +version equ '0.65' +version_dword equ 0*10000h + 65 + +min_width = 54 +max_width = 255 +min_height = 8 +max_height = 255 + +include '../../../KOSfuncs.inc' +include '../../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'font.inc' +include 'sort.inc' +include 'kglobals.inc' +include 'dialogs.inc' +include 'search.inc' +include 'viewer.inc' +include 'editor.inc' +include 'tools.inc' +include 'filetool.inc' + +struct PanelData +left dd ? +top dd ? +width dd ? +height dd ? +index dd ? +start dd ? +colsz dd ? +colst dd ? +sortmode db ? + rb 3 +nfa dd ? +numfiles dd ? +files dd ? +hPlugin dd ? +hFile dd ? +parents dd ? +parents_sz dd ? +parents_alloc dd ? +colmode dd ? +colwidths rd 16+1 +total_num dd ? +total_size dq ? +selected_num dd ? +selected_size dq ? +;plugin_info: +plugin_flags dd ? +dir rb 1024 +ends + +cursor_normal_size = (font_height*15+50)/100 +cursor_big_size = font_height + +align 4 +start: + mov eax,SF_SET_EVENTS_MASK + mov ebx,(11b shl 30) or 100111b + int 0x40 + mov edi, identical_table + mov ecx, 0x100 + xor eax, eax +@@: + stosb + inc eax + loop @b + mov cl, 'A' +@@: + stosb + inc eax + loop @b + add al, 0x20 + mov cl, 'Z'-'A'+1 +@@: + stosb + inc eax + loop @b + sub al, 0x20 + mov cl, ''-'Z'-1 +@@: + stosb + inc eax + loop @b + add al, 0x20 + mov cl, ''-'' +@@: + stosb + inc eax + loop @b + add al, 0x30 + mov cl, ''-''+1 +@@: + stosb + inc eax + loop @b + sub al, 0x50 + mov cl, 256-''-1 +@@: + stosb + inc eax + loop @b + mov byte [edi-256+''], '' + mov cl, 'A' + inc eax + rep stosb + mov cl, 'Z'-'A'+1 + dec eax + rep stosb + mov cl, 'a'-'Z'-1 + inc eax + rep stosb + mov byte [edi-'a'+'_'], 0 + mov cl, 'z'-'a'+1 + dec eax + rep stosb + mov cl, ''-'z'-1 + inc eax + rep stosb + mov cl, ''-''+1 + dec eax + rep stosb + mov cl, ''-''-1 + inc eax + rep stosb + mov cl, ''-''+1 + dec eax + rep stosb + mov cl, 256-''-1 + inc eax + rep stosb + mov edi, SearchStringEditBuf + mov eax, SearchStringEditBuf.length + stosd + xor eax, eax + stosd + stosd + stosb + push SF_SYS_MISC + pop eax + push SSF_HEAP_INIT + pop ebx + int 0x40 + call init_console + call draw_window + push SF_KEYBOARD + pop eax + push SSF_SET_INPUT_MODE + pop ebx + mov ecx, ebx + int 40h ; set keyboard mode to scancodes + mov eax, 200 + mov [panel1.nfa], eax + mov [panel2.nfa], eax + mov ecx, 200*4 + 32 + 200*304 + call pgalloc + mov [panel1.files], eax + call pgalloc + mov [panel2.files], eax + test eax, eax + jz exit + xor eax, eax + cmp [panel1.files], eax + jz exit + mov [panel1.hPlugin], eax + mov [panel1.parents], eax + mov [panel1.parents_sz], eax + mov [panel1.parents_alloc], eax + mov [panel2.hPlugin], eax + mov [panel2.parents], eax + mov [panel2.parents_sz], eax + mov [panel2.parents_alloc], eax + mov [panel1.sortmode], al ; sort by name + mov [panel2.sortmode], al + mov al, 2 ; "।" ଠ + mov [panel1.colmode], eax + mov [panel2.colmode], eax + mov [num_screens], 1 + mov ecx, 0x1000 + call pgalloc + mov [screens], eax + test eax, eax + jz exit + mov ecx, panels_vtable + mov [eax], ecx + mov [active_screen_vtable], ecx + mov [active_screen_keybar], keybar_panels +; load libini.obj and kfar.ini + mov eax, libini_name + mov esi, ini_import + push 8 + pop ebp ; we use version 8 of libini + call load_dll_and_import + test eax, eax + jnz .noini + mov edi, app_path + or ecx, -1 + repnz scasb + mov dword [edi-1], '.ini' + mov byte [edi+3], 0 + push 1 + push dword aConfirmDelete + push dword aConfirmations + push dword app_path + call [ini.get_int] + mov [bConfirmDelete], al + push 0 + push dword aConfirmDeleteIncomplete + push dword aConfirmations + push dword app_path + call [ini.get_int] + mov [bConfirmDeleteIncomplete], al + push 2 + push aLeftViewMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 1 + jb @f + cmp eax, 4 + ja @f + mov [panel1.colmode], eax +@@: + push 2 + push aRightViewMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 1 + jb @f + cmp eax, 4 + ja @f + mov [panel2.colmode], eax +@@: + push 0 + push aLeftSortMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 14 + jae @f + mov [panel1.sortmode], al +@@: + push 0 + push aRightSortMode + push aPanels + push app_path + call [ini.get_int] + cmp eax, 14 + jae @f + mov [panel2.sortmode], al +@@: + push nullstr + push 512 + push saved_file_name + push aEolStyle + push aEditor + push app_path + call [ini.get_str] + mov cl, edit.eol_dos + mov al, [saved_file_name] + or al, 20h + cmp al, 'd' + jz @f + mov cl, edit.eol_mac + cmp al, 'm' + jz @f + mov cl, edit.eol_unix +@@: + mov [EditEOLStyle], cl + mov ecx, 0x1000 + call xpgalloc + test eax, eax + jz .skip_assoc + mov [associations], eax + push enum_associations_callback + push aAssociations + push app_path + call [ini.enum_keys] +.skip_assoc: + xor ebp, ebp + xor esi, esi +.shortcut_loop: + mov edi, saved_file_name + push dword nullstr + push 512 + push edi + push dword aShortcut + push dword aFolderShortcuts + push dword app_path + call [ini.get_str] + cmp byte [edi], 0 + jz .shortcut_cont + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + cmp ecx, 2 + jz @f + cmp byte [edi-2], '/' + jnz @f + mov byte [edi-2], 0 + dec ecx +@@: + mov al, [aShortcut.d] + push esi + inc esi + mov [FolderShortcuts+(eax-'0')*4], esi + lea esi, [esi+ecx-1] + push esi + and esi, 0xFFF + cmp esi, ecx + pop esi + ja .norealloc + mov edx, ebp + mov ecx, esi + call xpgrealloc + test eax, eax + jnz @f + pop esi + mov edi, FolderShortcuts + mov ecx, 10 + rep stosd + jmp .skip_shortcuts +@@: + mov ebp, eax +.norealloc: + pop edi + add edi, ebp + mov ecx, saved_file_name +@@: + mov al, [ecx] + inc ecx + stosb + test al, al + jnz @b +.shortcut_cont: + inc [aShortcut.d] + cmp [aShortcut.d], '9' + jbe .shortcut_loop + mov esi, FolderShortcuts + mov ecx, 10 + dec ebp +.l3: + lodsd + test eax, eax + jz @f + add [esi-4], ebp +@@: + loop .l3 +.skip_shortcuts: +; load plugins + push enum_plugins_callback + push aPlugins + push app_path + call [ini.enum_keys] +; calculate info for editor + xor ebx, ebx + mov ecx, [num_plugins] + mov esi, [plugins] +@@: + dec ecx + js @f + mov [esi+PluginInfo.EditInfoOffs], ebx + add ebx, [esi+PluginInfo.EditInfoSize] + jnc @f + sbb ebx, ebx +@@: +; ᪮ ࠧ । ࠭祭, ࠧ , १ࢨ㥬 , ࠭祭 +; 512 - 㡠 業, ࠭ ࠡ ।, ॠ쭮 ॡ + cmp ebx, 512 + jb @f + or ebx, -1 + mov [EditPlugInfo], ebx ; disable plugins for editor + push ContinueBtn + push 1 + push EditConfigErr_ptr + push 2 + call SayErr +@@: + add ebx, 3 + and ebx, not 3 + mov [EditPlugInfo], ebx +.noini: + mov eax, [EditPlugInfo] + add eax, editor_line.plugdata + imul eax, max_height + add eax, editor_data.basesize + 0xFFF + shr eax, 12 + mov [EditDataSize], eax + mov esi, def_left_dir + mov edi, panel1.dir +@@: + lodsb + stosb + test al, al + jnz @b + mov esi, def_right_dir + mov edi, panel2.dir +@@: + lodsb + stosb + test al, al + jnz @b + call draw_keybar + call draw_cmdbar + mov [prev_dir], 0 + mov ebp, panel1 + call calc_colwidths + call read_folder + call draw_panel + mov [bSilentFolderMode], 1 + mov ebp, panel2 + call calc_colwidths + call read_folder + call draw_panel +event: + call get_event + dec eax + jz redraw + dec eax + jz key + sub eax,4 + jz mouse +; button - we have only one button, close +exit: +; close all screens +@@: + mov ecx, [num_screens] + mov eax, [screens] + mov ebp, [eax+ecx*8-4] + mov eax, [eax+ecx*8-8] + push ebp + call [eax+screen_vtable.OnExit] + pop ecx + call pgfree + dec [num_screens] + jnz @b +; unload all plugins + mov ecx, [num_plugins] + imul esi, ecx, PluginInfo.size + add esi, [plugins] +.unload: + dec ecx + js .unload_done + sub esi, PluginInfo.size + push ecx esi + call [esi+PluginInfo.unload] + pop esi ecx + jmp .unload +.unload_done: + cmp [ini.set_int], aIniSetInt + jz .nosave + push [panel1.colmode] + push aLeftViewMode + push aPanels + push app_path + call [ini.set_int] + push [panel2.colmode] + push aRightViewMode + push aPanels + push app_path + call [ini.set_int] + movzx eax, [panel1.sortmode] + push eax + push aLeftSortMode + push aPanels + push app_path + call [ini.set_int] + movzx eax, [panel2.sortmode] + push eax + push aRightSortMode + push aPanels + push app_path + call [ini.set_int] +.nosave: +if CHECK_FOR_LEAKS + mov ecx, [panel1.files] + call pgfree + mov ecx, [panel2.files] + call pgfree + mov ecx, [screens] + call pgfree + mov ecx, [associations] + call pgfree + mov ecx, [console_data_ptr] + call pgfree + mov ecx, [MemForImage] + call pgfree + mov esi, FolderShortcuts + push 10 + pop ecx +@@: + lodsd + test eax, eax + jnz @f + loop @b + jmp .nofreefs +@@: + mov ecx, eax + call pgfree + mov ecx, [plugins] + call pgfree + mov ecx, [panel1.parents] + call pgfree + mov ecx, [panel2.parents] + call pgfree +.nofreefs: + mov eax, [numallocatedregions] + test eax, eax + jz @f + mov edi, allocatedregions + int3 + jmp $ +@@: +end if + or eax, SF_TERMINATE_PROCESS + int 40h + +align 16 +get_event: + push ebx + mov ebx, [idle_interval] + cmp ebx, -1 + jz .infinite + push SF_WAIT_EVENT_TIMEOUT + pop eax + int 40h + pop ebx + test eax, eax + jnz .ret + mov ebp, [active_screen_data] + mov eax, [active_screen_vtable] + mov eax, [eax+screen_vtable.OnIdle] + test eax, eax + jz get_event + call eax + jmp get_event +.infinite: + pop ebx + push SF_WAIT_EVENT + pop eax + int 40h +.ret: + ret + +redraw: +; query kbd state from OS + mov al, SF_KEYBOARD + push SSF_GET_CONTROL_KEYS + pop ebx + int 0x40 + and eax, 0x3F + cmp al, [ctrlstate] + mov [ctrlstate], al + jz @f + call draw_keybar +@@: + mov al, SF_THREAD_INFO + mov ebx, procinfo + or ecx, -1 + int 40h +; test if rolled up +; height of rolled up window is [skinh]+3 + mov eax, [ebx+46] + sub eax, [skinh] + cmp eax, 5 + ja @f + mov al, SF_REDRAW + push SSF_BEGIN_DRAW + pop ebx + int 0x40 + xor eax, eax +; ebx, ecx, edi are ignored by function 0 after first redraw + mov edx, 0x53000000 + int 0x40 + mov al, SF_REDRAW + inc ebx + int 0x40 + jmp event +@@: + xor ecx, ecx + mov eax, [ebx+42] + mov [wnd_width], eax + sub eax, 5*2-1 + jae @f + xor eax, eax +@@: + cdq + mov esi, font_width + div esi + cmp eax, min_width + jae @f + mov al, min_width + mov ch, 1 +@@: + cmp eax, max_width + jbe @f + mov eax, max_width + mov ch, 1 +@@: + cmp eax, [cur_width] + mov [cur_width], eax + setnz cl + or cl, ch + test edx, edx + mov [fill_width], edx + setnz ch + mov eax, [ebx+46] + mov [wnd_height], eax + sub eax, [skinh] + sub eax, 5-1 + jns @f + xor eax, eax +@@: + cdq + mov esi, font_height + div esi + cmp eax, min_height + jae @f + mov al, min_height + mov cl, 1 +@@: + cmp eax, max_height + jbe @f + mov eax, max_height + mov cl, 1 +@@: + mov [fill_height], edx + cmp eax, [cur_height] + mov [cur_height], eax + jnz .resize + test cl, cl + jnz .resize + test edx, edx + setnz cl + or cl, ch + jz @f + test byte [ebx+70], 1 + jnz @f +.resize: + push SF_CHANGE_WINDOW + pop eax + or ebx, -1 + or ecx, -1 + mov edx, [cur_width] + imul edx, font_width + add edx, 5*2-1 + mov esi, [cur_height] + imul esi, font_height + add esi, [skinh] + add esi, 5-1 + int 40h +.resize_draw: + mov ecx, [MemForImage] + call pgfree + and [MemForImage], 0 + call init_console +; call draw_window + call draw_keybar + mov ebp, [active_screen_data] + mov eax, [active_screen_vtable] + mov [cursor_size], cursor_normal_size + call dword [eax+screen_vtable.OnRedraw] + jmp event +@@: + call draw_window + jmp event +alt_f9: + cmp [saved_width], -1 + jz @f + mov eax, [saved_width] + mov [cur_width], eax + or [saved_width], -1 + mov eax, [saved_height] + mov [cur_height], eax + or [saved_height], -1 + jmp redraw.resize +@@: + push SF_STYLE_SETTINGS + pop eax + push SSF_GET_SCREEN_AREA + pop ebx + int 0x40 + push eax + sub eax, [esp+2] + inc eax + movzx eax, ax + sub eax, 10 + xor edx, edx + mov ecx, font_width + div ecx + xchg [cur_width], eax + mov [saved_width], eax + mov eax, ebx + shr ebx, 16 + sub eax, ebx + sub eax, 5-1 + sub eax, [skinh] + xor edx, edx + mov ecx, font_height + div ecx + xchg [cur_height], eax + mov [saved_height], eax + mov ecx, ebx + pop ebx + shr ebx, 16 + mov edx, [cur_width] + imul edx, font_width + add edx, 5*2-1 + mov esi, [cur_height] + imul esi, font_height + add esi, [skinh] + add esi, 4 + push SF_CHANGE_WINDOW + pop eax + int 0x40 + jmp redraw.resize_draw +key: + mov al, SF_GET_KEY + int 40h + test al, al + jnz event + xchg al, ah + cmp al, 0xE0 + jnz @f + mov [bWasE0], 1 + jmp event +@@: + xchg ah, [bWasE0] + mov ebp, [active_screen_data] + mov edx, [active_screen_vtable] + cmp al, 0x1D + jz .ctrl_down + cmp al, 0x9D + jz .ctrl_up + cmp al, 0x2A + jz .lshift_down + cmp al, 0xAA + jz .lshift_up + cmp al, 0x36 + jz .rshift_down + cmp al, 0xB6 + jz .rshift_up + cmp al, 0x38 + jz .alt_down + cmp al, 0xB8 + jz .alt_up + call [edx+screen_vtable.OnKey] + jmp event +.ctrl_down: + test ah, ah + jnz .rctrl_down + or [ctrlstate], 4 + jmp .keybar +.rctrl_down: + or [ctrlstate], 8 + jmp .keybar +.ctrl_up: + test ah, ah + jnz .rctrl_up + and [ctrlstate], not 4 + jmp .keybar +.rctrl_up: + and [ctrlstate], not 8 +.keybar: + call draw_keybar + call draw_image +@@: jmp event +.lshift_down: +; ignore E0 2A sequence +; e.g. arrow keys with NumLock on generate sequence E0 2A E0 xx / E0 xx+80 E0 AA +; where xx is scancode, so we can safely ignore E0 2A + test ah, ah + jnz @b + or [ctrlstate], 1 + jmp .keybar +.lshift_up: +; ignore E0 AA sequence + test ah, ah + jnz @b + and [ctrlstate], not 1 + jmp .keybar +.rshift_down: + or [ctrlstate], 2 + jmp .keybar +.rshift_up: + and [ctrlstate], not 2 + jmp .keybar +.alt_down: + test ah, ah + jnz .ralt_down + or [ctrlstate], 0x10 + jmp .keybar +.ralt_down: + or [ctrlstate], 0x20 + jmp .keybar +.alt_up: + test ah, ah + jnz .ralt_up + and [ctrlstate], not 0x10 + jmp .keybar +.ralt_up: + and [ctrlstate], not 0x20 + jmp .keybar + +align 16 +mouse: + mov eax,SF_MOUSE_GET + mov ebx,SSF_BUTTON_EXT + int 0x40 + mov byte[mousestate], 1 + bt eax,24 ;left but. double click + jc @f + mov byte[mousestate], 0 + bt eax,8 ;left but. down + jc @f + jmp event +@@: + mov eax,SF_MOUSE_GET + mov ebx,SSF_WINDOW_POSITION + int 0x40 + cmp ax, word[skinh] + jl event + sub ax, word[skinh] + xor dx, dx + mov bx, font_height + div bx + movzx edx,ax + shr eax,16 + + mov ebx, [cur_height] + dec ebx + cmp edx, ebx + je .on_panel + cmp dword[active_screen],0 + jg event ;.on_edit + cmp edx, 2 + jl .no_ch_pos + dec edx ; ࠬ + dec edx ; + sub ebx, 7-1 + cmp edx, ebx + jge .no_ch_pos + + push edx eax + mov ecx, [cur_width] +if font_width & 3 + imul ecx, font_width + shr ecx, 2 +else + imul ecx, font_width/4 +end if + xor dx, dx + sub ax, 5 ;window border + div cx + bt ax, 0 + jnc @f + add [esp+4], ebx ;᫨ 2- ⮫ +@@: + pop eax ;edx in stack + jmp @f +.no_ch_pos: + push -1 ;edx = -1 - no change position +@@: + + mov ebx, [cur_width] + imul ebx, font_width/2 + add ebx, 5 ;window border + cmp eax,ebx + jg @f + cmp [active_panel], panel1 + je .move + jmp .tab +@@: + cmp [active_panel], panel2 + je .move +.tab: + xor [active_panel], panel1 xor panel2 + call draw_cmdbar + mov ebp, [active_panel] + xor ebp, panel1 xor panel2 + call draw_panel +.move: + mov ebp, [active_panel] + pop edx + mov eax, [ebp + PanelData.numfiles] + add edx, [ebp + PanelData.start] ;᫮ ப祭 䠩 + dec eax + cmp edx, eax + jle @f + mov edx, eax +@@: + cmp edx, 0 + jl @f + mov [ebp + PanelData.index], edx + cmp byte[mousestate], 0 + je @f + call panels_OnKey.enter + jmp event +@@: + call draw_panel + jmp event +align 4 +.on_panel: + call get_keybar_ind + lea eax, [mouse_panels+4*eax] + cmp [active_screen_keybar], keybar_viewer + jne @f + add eax, mouse_viewer-mouse_panels +@@: + cmp [active_screen_keybar], keybar_editor + jne @f + add eax, mouse_editor-mouse_panels +@@: + cmp dword[eax], 0 + je event + + mov ebx, [active_screen] + mov ebp, [screens] + mov ebp, [ebp+ebx*8+4] + + cmp dword[active_screen],0 + jne @f + mov ebp, [active_panel] + mov ecx, [ebp + PanelData.index] +@@: + push dword[eax] + sub eax, mouse_panels + shr eax, 2 + xor edx, edx + mov ebx, 12 + div ebx + lea eax, [edx+0x3B] ;eax - F1...F12 + pop ebx + call ebx + jmp event +if 0 ;not work insert text +align 4 +.on_edit: + cmp [active_screen_keybar], keybar_editor + jne event + cmp edx, 1 + jl event + push edx + xor edx, edx + mov ebx, font_width + div ebx + pop edx + mov ebx, [active_screen] + mov ebp, [screens] + mov ebp, [ebp+ebx*8+4] + mov [ebp + editor_data.cursor_x], eax + mov [ebp + editor_data.cursor_y], edx + call editor_OnRedraw + jmp event +end if + +;input: +; eax - coord x +;output: +; eax - key bar index (0 to 95) if press F1 index = 0 +align 16 +get_keybar_ind: + push ebx ecx edx esi edi + xor edx, edx + mov ebx, font_width + sub eax, 5 ;border + div ebx + mov edi, eax + + xor esi, esi + test [ctrlstate], 3 + jz @f + inc esi +@@: + test [ctrlstate], 0xC + jz @f + or si, 2 +@@: + test [ctrlstate], 0x30 + jz @f + or si, 4 +@@: + imul esi, 12 ;᫮ F1-F12 + xor ecx, ecx + inc ecx + mov ebx, 6 + mov eax, [cur_width] + sub eax, 11+9+3*2+6 + cmp eax, 7*11 + jl @f + cdq + mov bl, 11 + div ebx + mov ebx, eax +@@: + xor edx, edx +.l: + add edx, 7 + cmp ecx, 10 + jb @f + inc edx +@@: + cmp edx, edi + ja .ret + cmp edx, [cur_width] + ja .ret + cmp ecx, 12 + jz .ret + lea edx, [edx+ebx-6] + inc edx + cmp edx, [cur_width] + ja .ret + inc ecx + jmp .l +.ret: + lea eax, [esi+ecx-1] + pop edi esi edx ecx ebx + ret + +align 16 +process_ctrl_keys: + cmp byte [esi], 0 + jz .done + push ecx + cmp al, [esi] + jz .check +.cont: + pop ecx + add esi, 8 + jmp process_ctrl_keys +.done: + stc + ret +.check: + mov cl, 0 + call .check_ctrlkey + jc .cont + mov cl, 2 + call .check_ctrlkey + jc .cont + mov cl, 4 + call .check_ctrlkey + jc .cont + pop ecx + call dword [esi+4] + clc + ret +.check_ctrlkey: + push eax edx + movzx edx, [ctrlstate] + shr edx, cl + add cl, cl + movzx eax, word [esi+2] + shr eax, cl + and eax, 15 + cmp al, ctrlkey_tests_num + jae .fail + xchg eax, edx + and al, 3 + call [ctrlkey_tests + edx*4] + cmp al, 1 + pop edx eax + ret +.fail: + stc + pop edx eax + ret + +ctrlkey_test0: + test al, al + setz al + ret +ctrlkey_test1: + test al, al + setnp al + ret +ctrlkey_test2: + cmp al, 3 + setz al + ret +ctrlkey_test3: + cmp al, 1 + setz al + ret +ctrlkey_test4: + cmp al, 2 + setz al + ret + +enum_associations_callback: +; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); +; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value + mov esi, [esp+12] + mov edi, esi +@@: + lodsb + test al, al + jnz @b + sub esi, edi ; esi = size of key name + mov eax, [esp+16] +@@: + inc esi + inc eax + cmp byte [eax-1], 0 + jnz @b +; esi = total size of entry + push esi + add esi, [associations_size] + mov ecx, [associations_allocated] +@@: + cmp esi, ecx + jbe @f + add ecx, ecx + jmp @b +@@: + pop esi + cmp [associations_allocated], ecx + jz @f + mov [associations_allocated], ecx + mov edx, [associations] + call xpgrealloc + mov [associations], eax + test eax, eax + jz .err +@@: + mov eax, esi + mov esi, edi + mov edi, [associations] + add edi, [associations_size] + dec edi + add [associations_size], eax +@@: + lodsb + stosb + test al, al + jnz @b + mov esi, [esp+16] +@@: + lodsb + stosb + test al, al + jnz @b +.ret: + mov al, 1 + ret 16 +.err: + mov ecx, edx + call pgfree + xor eax, eax + ret 16 + +align 4 +enum_plugins_callback: +; LongBool __stdcall callback(f_name,sec_name,key_name,key_value); +; [esp+4] = f_name, [esp+8] = sec_name, [esp+12] = key_name, [esp+16] = key_value + mov esi, [esp+16] + cmp byte [esi], '/' + jz .absolute +; convert path to absolute + mov edi, execdata +@@: + cmp edi, execdata+1024 + jae .overflow + lodsb + stosb + test al, al + jnz @b + mov edi, saved_file_name + mov [esp+16], edi + mov esi, app_path + push esi + xor ecx, ecx +@@: + lodsb + test al, al + jz @f + cmp al, '/' + jnz @b + mov ecx, esi + jmp @b +@@: + pop esi + sub ecx, esi + push edi + add edi, ecx + cmp edi, saved_file_name+1024 + pop edi + ja .overflow + rep movsb + mov esi, execdata +.z: + cmp word [esi], '.' + jz .ret + cmp word [esi], './' + jnz @f + add esi, 2 + jmp .z +@@: + cmp word [esi], '..' + jnz .c + cmp byte [esi+2], 0 + jz .ret + cmp byte [esi+2], '/' + jnz .c + add esi, 3 +@@: + dec edi + cmp edi, saved_file_name + jbe .ret + cmp byte [edi-1], '/' + jnz @b + jmp .z +.c: + cmp edi, saved_file_name+1024 + jae .overflow + lodsb + stosb + test al, al + jnz .c + jmp .absolute +.overflow: + mov esi, execdata + mov byte [esi+1023], 0 + call load_dll_and_import.big +.ret: + mov al, 1 + ret 16 +.absolute: +; allocate space for plugin info + mov eax, [num_plugins] + inc eax + mov [num_plugins], eax + imul ecx, eax, PluginInfo.size + cmp ecx, [alloc_plugins] + jbe .norealloc + mov edx, [plugins] + call xpgrealloc + test eax, eax + jnz @f +.dec_ret: + dec [num_plugins] + jmp .ret +@@: + mov [plugins], eax + lea eax, [ecx+0xFFF] + and eax, not 0xFFF + mov [alloc_plugins], eax +.norealloc: + mov esi, [plugins] + lea esi, [esi+ecx-PluginInfo.size] +; load plugin DLL + or ebp, -1 + mov eax, [esp+16] + call load_dll_and_import.do + test eax, eax + jnz .dec_ret +; find exported functions + mov eax, aVersion + call load_dll_and_import.find_exported_function + jnc @f + xor eax, eax +@@: +MIN_INTERFACE_VER = 3 +MAX_INTERFACE_VER = 3 + cmp eax, MIN_INTERFACE_VER + jb @f + cmp eax, MAX_INTERFACE_VER + jbe .version_ok +@@: + push aIncompatibleVersion +.cantload: + push dword [esp+4+16] + push aCannotLoadPlugin + mov eax, esp + push ContinueBtn + push 1 + push eax + push 3 + call SayErr + add esp, 12 + jmp .dec_ret +.version_ok: + mov edi, esi + mov esi, plugin_exported +.import: + lodsd + test eax, eax + jz .import_done + call load_dll_and_import.find_exported_function + jnc @f + mov eax, [esi-4+plugin_exported_default-plugin_exported] +@@: + stosd + jmp .import +.import_done: +; initialize plugin + mov eax, aPluginLoad + call load_dll_and_import.find_exported_function + jc .ok + push kfar_info + call eax + cmp eax, 1 + jb .ok + ja .dec_ret + push aInitFailed + jmp .cantload +.ok: + mov al, 1 + ret 16 + +plugin_unload_default: + ret + +OpenFilePlugin_default: + xor eax, eax + ret 28 +GetFiles_default: + xor eax, eax + ret 20 + +ClosePlugin_default: + ret 4 + +GetOpenPluginInfo_default: + ret 8 + +SetFolder_default: +open_default: + xor eax, eax + ret 12 + +new_screen: +; in: ecx=sizeof(screen data), edx->vtable +; out: ebp=pointer or NULL, eax!=0 if successful +; destroys ebx,ecx + call xpgalloc + test eax, eax + jnz @f + ret +@@: + mov ebp, eax + mov eax, [screens] + mov ecx, [num_screens] + inc ecx + shl ecx, 3 + test ecx, 0xFFF + jnz .norealloc + push edx + mov edx, eax + call xpgrealloc + pop edx + test eax, eax + jnz @f + mov ecx, ebp + call pgfree + xor eax, eax + ret +@@: + mov [screens], eax +.norealloc: + inc [num_screens] + mov [eax+ecx-8], edx + mov [eax+ecx-4], ebp + mov eax, [num_screens] + dec eax + mov [active_screen], eax + mov [active_screen_vtable], edx + mov [active_screen_data], ebp + or [idle_interval], -1 + mov edx, [edx+screen_vtable.keybar] + test edx, edx + jz @f + mov [active_screen_keybar], edx +@@: + jmp draw_keybar + +next_screen: + mov eax, [active_screen] + inc eax + cmp eax, [num_screens] + jnz @f + xor eax, eax +@@: mov [active_screen], eax + jmp change_screen + +delete_active_screen: + mov edi, [screens] + mov eax, [active_screen] + shl eax, 3 + add edi, eax + push dword [edi+4] + lea esi, [edi+8] + mov ecx, [num_screens] + sub ecx, [active_screen] + dec ecx + add ecx, ecx + rep movsd + dec [num_screens] + mov ecx, [num_screens] + shl ecx, 3 + test ecx, 0xFFF + jnz .norealloc + mov edx, [screens] + call pgrealloc ; must succeed, because we decrease size + mov [screens], eax +.norealloc: + pop ecx + call pgfree + dec [active_screen] + +change_screen: + pusha + or [idle_interval], -1 + mov eax, [active_screen] + mov esi, [screens] + mov ebp, [esi+eax*8+4] + mov eax, [esi+eax*8] + push eax ebp + mov eax, [eax+screen_vtable.OnActivate] + test eax, eax + jz @f + call eax +@@: + pop ebp eax + mov [active_screen_vtable], eax + mov [active_screen_data], ebp + mov edx, [eax+screen_vtable.keybar] + test edx, edx + jz @f + mov [active_screen_keybar], edx +@@: + call draw_keybar + mov [cursor_size], cursor_normal_size + call [eax+screen_vtable.OnRedraw] + popa + ret + +F12: + mov eax, [cur_width] + add eax, 8 + mov esi, eax + mul [num_screens] + mov ecx, eax + call xpgalloc + test eax, eax + jnz @f + ret +@@: + mov ebx, eax + mov edi, eax + xor ecx, ecx +.next: + xor eax, eax + stosd + inc ecx + cmp ecx, [num_screens] + jz @f + lea eax, [edi+esi-4] + mov dword [edi-4], eax +@@: + xor eax, eax + stosd + dec ecx + jz @f + lea eax, [edi-8] + sub eax, esi + mov dword [edi-4], eax +@@: + mov al, '&' + stosb + cmp ecx, 36 + jae .noletter + lea eax, [ecx+'0'] + cmp al, '9' + jbe @f + add al, 7 +@@: + stosb + mov al, '.' + stosb + jmp .letter_done +.noletter: + mov al, ' ' + stosb + stosb +.letter_done: + mov al, ' ' + stosb + pushad + mov eax, [screens] + mov ebp, [eax+ecx*8+4] + mov eax, [eax+ecx*8] + mov ecx, [cur_width] + sub ecx, 12 + call [eax + screen_vtable.getname] + popad + sub edi, 4 + add edi, [cur_width] + inc ecx + cmp ecx, [num_screens] + jb .next + mov eax, [active_screen] + mul esi + add eax, ebx + push 1 + push dword aScreens + push eax + call menu + cmp eax, -1 + jz @f + sub eax, ebx + div esi + mov [active_screen], eax +@@: + mov ecx, ebx + call pgfree + jmp change_screen + +panels_OnKey: +; restore screen hidden by quick search box + cmp [bDisplayQuickSearch], 0 + jz @f + mov [bDisplayQuickSearch], 0 + push 0 + push QuickSearchDlg + call HideDialogBox +@@: + mov ebp, [active_panel] + mov ecx, [ebp + PanelData.index] + mov edx, [ebp + PanelData.start] + mov ebx, [ebp + PanelData.colst] + add ebx, edx + mov esi, panels_ctrlkeys + call process_ctrl_keys + jc .nostdkey + mov [bQuickSearchMode], 0 + ret +.leaveqsmode: + mov [bQuickSearchMode], 0 + call draw_image + ret +.keepqsmode: + push QuickSearchDlg + call ShowDialogBox + mov [bDisplayQuickSearch], 1 + ret +.nostdkey: + cmp [bQuickSearchMode], 0 + jz .noqsmode + test al, al + js .keepqsmode + cmp al, 40h + jae .leaveqsmode + cmp al, 0Eh + jz .qsbackspace + cmp al, 1Ch + jz .test_enter + movzx eax, al + cmp byte [scan2ascii+eax], 0 + jz .leaveqsmode + call get_ascii_char + mov ecx, dword [quick_search_buf + 4] + cmp ecx, quicksearch_maxlen + jae .keepqsmode + mov byte [quick_search_buf + 12 + ecx], al + mov byte [quick_search_buf + 12 + ecx + 1], 0 + push ecx + call quick_find + pop ecx + jnc @f + mov byte [quick_search_buf + 12 + ecx], 0 + jmp .keepqsmode +@@: + inc dword [quick_search_buf + 4] + sub ecx, 16 + jae @f + xor ecx, ecx +@@: + mov dword [quick_search_buf + 8], ecx + jmp .keepqsmode +.qsbackspace: + mov ecx, dword [quick_search_buf + 4] + jecxz .keepqsmode2 + dec ecx + mov byte [quick_search_buf + 12 + ecx], 0 + dec dword [quick_search_buf + 4] +.keepqsmode2: + jmp .keepqsmode +.test_enter: + test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? + jz .keepqsmode2 + test [ctrlstate], 3 ; Shift pressed? + jnz @f + call quick_find_next + jmp .keepqsmode2 +@@: + call quick_find_prev + jmp .keepqsmode2 +.noqsmode: +; handle Alt+ combinations for quick search + test [ctrlstate], 30h ; LAlt or RAlt pressed? + jz .noalt ; no => skip + test [ctrlstate], 0Ch ; LCtrl or RCtrl pressed? + jnz .noalt ; yes => skip + cmp al, 40h + jae .noalt + movzx eax, al + cmp byte [scan2ascii+eax], 0 + jz .noalt + call get_ascii_char + mov edi, quick_search_buf + 12 + mov dword [edi-12], quicksearch_maxlen-1 + mov dword [edi-8], 1 + and dword [edi-4], 0 + stosb + mov byte [edi], 0 + call quick_find + jnc @f + mov byte [quick_search_buf + 12], 0 + and dword [quick_search_buf + 4], 0 +@@: + mov ebx, QuickSearchDlg + mov eax, [ebp + PanelData.left] + add eax, 10 + mov edx, [cur_width] + sub edx, 21 + cmp eax, edx + jb @f + mov eax, edx +@@: + mov [ebx + dlgtemplate.x], eax + mov eax, [ebp + PanelData.top] + add eax, [ebp + PanelData.height] + mov edx, [cur_height] + sub edx, 2 + cmp eax, edx + jb @f + mov eax, edx +@@: + mov [ebx + dlgtemplate.y], eax + push ebx + call ShowDialogBox + mov [bQuickSearchMode], 1 + mov [bDisplayQuickSearch], 1 +.find_letter_done: +.noalt: +.ret: + ret +.up: + jecxz .ret + dec ecx + mov [ebp + PanelData.index], ecx + cmp ecx, edx + jae .done_redraw + mov [ebp + PanelData.start], ecx +.done_redraw: +; call draw_panel +; ret + jmp draw_panel +.insert: + lea eax, [ecx*4] + add eax, [ebp + PanelData.files] + mov eax, [eax] + cmp word [eax+40], '..' + jnz @f + cmp byte [eax+42], 0 + jz .insert.down +@@: + xor byte [eax+303], 1 + mov edx, [eax+32] + test byte [eax+303], 1 + mov eax, [eax+36] + jnz .insert.increase + sub dword [ebp + PanelData.selected_size], edx + sbb dword [ebp + PanelData.selected_size+4], eax + dec [ebp + PanelData.selected_num] + jmp .insert.down +.insert.increase: + add dword [ebp + PanelData.selected_size], edx + adc dword [ebp + PanelData.selected_size+4], eax + inc [ebp + PanelData.selected_num] +.insert.down: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jae .done_redraw + jmp @f +.down: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jae .ret +@@: + mov [ebp + PanelData.index], ecx + cmp ecx, ebx + jb .done_redraw + sub ecx, [ebp + PanelData.colst] + inc ecx + mov [ebp + PanelData.start], ecx + jmp .done_redraw +.left: + test ecx, ecx + jnz @f + ret +@@: + mov eax, [ebp + PanelData.colsz] + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov [ebp + PanelData.index], ecx +.finalize_left: + cmp ecx, edx + jae .done_redraw + sub edx, eax + jae @f + xor edx, edx +@@: + mov [ebp + PanelData.start], edx + jmp .done_redraw +.pgup: + mov eax, [ebp + PanelData.colst] + dec eax + jnz @f + inc eax +@@: + test ecx, ecx + jnz @f + ret +@@: + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov [ebp + PanelData.index], ecx + dec ecx + jmp .finalize_left +.right: + mov eax, [ebp + PanelData.colsz] + add ecx, eax + cmp ecx, [ebp + PanelData.numfiles] + jb @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + mov [ebp + PanelData.index], ecx +.finalize_right: + cmp ecx, ebx + jb .done_redraw + add ebx, eax + cmp ebx, [ebp + PanelData.numfiles] + jbe @f + mov ebx, [ebp + PanelData.numfiles] +@@: + sub ebx, [ebp + PanelData.colst] + jae @f + xor ebx, ebx +@@: + mov [ebp + PanelData.start], ebx + jmp .done_redraw +.pgdn: + mov eax, [ebp + PanelData.colst] + dec eax + jnz @f + inc eax +@@: + add ecx, eax + cmp ecx, [ebp + PanelData.numfiles] + jb @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + mov [ebp + PanelData.index], ecx + inc ecx + jmp .finalize_right +.tab: + xor [active_panel], panel1 xor panel2 + call draw_cmdbar + call draw_panel + mov ebp, [active_panel] + jmp .done_redraw +.home: + and [ebp + PanelData.start], 0 + and [ebp + PanelData.index], 0 + jmp .done_redraw +.end: + mov eax, [ebp + PanelData.numfiles] + dec eax + mov [ebp + PanelData.index], eax + inc eax + sub eax, [ebp + PanelData.colst] + jae @f + xor eax, eax +@@: + mov [ebp + PanelData.start], eax + jmp .done_redraw +.enter: + cmp [bQuickSearchMode], 0 + jz @f + call draw_image +@@: + call get_curfile_folder_entry + test byte [ecx], 10h + jnz .enter_folder +; todo: add handling on plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jnz .ret +; generate full file name + lea esi, [ebp + PanelData.dir] + mov edi, execdata +@@: + lodsb + test al, al + jz @f + stosb + cmp edi, execdataend-1 + jae .bigfilename + jmp @b +@@: + lea esi, [ecx+40] + mov al, '/' + stosb +@@: + lodsb + stosb + cmp edi, execdataend + ja .bigfilename + test al, al + jnz @b +; try to open file and look for all plugins + push O_READ + push execdata + call open + test eax, eax + jz .noplugins ; if can't open, just try to execute + mov esi, eax ; save handle + push filedata_buffer_size + push filedata_buffer + push esi + call read + mov edi, eax ; save size of read data +; test for Kolibri executable + cmp eax, 24h + jb .enter.noexec + cmp dword [filedata_buffer], 'MENU' + jnz @f + cmp word [filedata_buffer+4], 'ET' + jnz @f +.close_run: + push esi + call close + jmp .run_app +@@: + cmp dword [filedata_buffer], 'KPCK' + jnz @f + cmp dword [filedata_buffer+12], 0x26914601 + jz .close_run +@@: +.enter.noexec: + mov ecx, [num_plugins] + mov edx, [plugins] + sub edx, PluginInfo.size +.plugloop: + add edx, PluginInfo.size + dec ecx + js .plugdone + pushad + push execdata + push [ebp+ PanelData.hFile] + push [ebp+ PanelData.hPlugin] + push edi + push filedata_buffer + call get_curfile_folder_entry + push ecx + push esi + call [edx+PluginInfo.OpenFilePlugin] + mov [esp+28], eax + popad + test eax, eax + jz .plugloop + cmp eax, -1 + jnz .pluginok + push esi + call close + ret +.pluginok: +; save current directory and set root directory of hPlugin + mov edi, eax ; save handle + mov esi, execdata +@@: + lodsb + test al, al + jnz @b + sub esi, execdata-9 +; allocate esi bytes in buffer 'parents' + mov ecx, [ebp + PanelData.parents_sz] + add ecx, esi + cmp ecx, [ebp + PanelData.parents_alloc] + jbe .enter.norealloc + push edx + mov edx, [ebp + PanelData.parents] + call xpgrealloc + pop edx + test eax, eax + jnz @f + push edi + call [edx+PluginInfo.ClosePlugin] + ret +@@: + mov [ebp + PanelData.parents], eax +.enter.norealloc: + mov [ebp + PanelData.parents_sz], ecx +; save current state to the end of buffer + sub ecx, esi + add ecx, [ebp + PanelData.parents] + xchg edx, [ebp + PanelData.hPlugin] + mov [ecx], edx + xchg edi, [ebp + PanelData.hFile] + mov [ecx+4], edi + mov byte [ecx+8], 0 + lea edi, [ecx+9] + lea ecx, [esi-9] + mov esi, execdata + rep movsb + mov word [ebp + PanelData.dir], '/' + mov eax, [ebp + PanelData.hPlugin] + lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info + and dword [ebx], 0 + push ebp + push ebx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetOpenPluginInfo] + pop ebp + call get_curfile_folder_entry + mov esi, ecx + mov edi, left_dotdot_entry + cmp ebp, panel1 + jz @f + add edi, right_dotdot_entry-left_dotdot_entry +@@: + mov ecx, 10 + rep movsd + mov byte [edi-40], 10h ; attributes: folder + mov eax, '..' + stosd + jmp .reread +.plugdone: + push esi + call close +.noplugins: +; run program or association + call get_curfile_folder_entry + call find_extension + jc .run_app +.run_association: + cmp byte [edi], 0 + jz .l1 + cmp byte [edi], ';' + jnz @f +.l1: + ret +@@: + mov esi, edi +@@: + lodsb + test al, al + jz @f + cmp al, ';' + jnz @b + dec esi + mov byte [esi], 0 + mov [restore_semicolon], esi +@@: +.run_association2: + mov [execparams], execdata + mov [execptr], edi + jmp .dorun +.run_app: + mov [execptr], execdata + and [execparams], 0 +.dorun: + lea esi, [ebp + PanelData.dir] + mov edi, execdata +@@: + lodsb + test al, al + jz @f + stosb + cmp edi, execdataend-1 + jae .bigfilename + jmp @b +@@: + lea esi, [ecx+40] + mov al, '/' + stosb +@@: + lodsb + stosb + cmp edi, execdataend + ja .bigfilename + test al, al + jnz @b +; for fasm call - special handling, because +; 1) fasm command line convention is different : fasm infile,outfile[,path] rather than tinypad infile +; 2) fasm will probably create new file in directory, so we want to reload panel data + xor edx, edx + cmp [execparams], edx + jz .nofasm + mov esi, [execptr] +@@: + lodsb + test al, al + jnz @b + mov eax, [esi-5] + or eax, 0x20202020 + cmp eax, 'fasm' + jnz .nofasm + cmp edi, execdata+(execdataend-execdata)/2 + ja .bigfilename + mov esi, execdata +@@: + lodsb + stosb + test al, al + jnz @b + mov byte [esi-1], ',' + inc edx +; output file: no extension if input file has extension, '.bin' otherwise + push edi +@@: + dec edi + cmp byte [edi], '.' + jz .ptfound + cmp byte [edi], '/' + jnz @b + pop edi + cmp edi, execdataend-4 + ja .bigfilename + mov dword [edi-1], '.bin' + mov byte [edi+3], 0 + jmp .nofasm +.ptfound: + mov byte [edi], 0 + pop edi +.nofasm: + mov ebx, execinfo +; if command line is more than 256 symbols, the kernel will truncate it +; we do not want this! +; N.B. We know that command line is either NULL or execdata, which is always ASCIIZ string, +; but can be up to 1023 symbols + mov esi, [ebx+8] + test esi, esi + jz .cmdlinelenok +@@: + lodsb + test al, al + jnz @b + sub esi, [ebx+8] + dec esi + cmp esi, 256 + ja .bigcmdline +.cmdlinelenok: + push SF_FILE + pop eax + int 40h + xor esi, esi + xchg esi, [restore_semicolon] + test esi, esi + jz @f + mov byte [esi], ';' +@@: + neg eax + js @f + call get_error_msg + push eax + push dword aRunError + mov eax, esp + push ContinueBtn + push 1 + push eax + push 2 + call SayErr + pop eax + pop eax + ret +@@: + test edx, edx + jz @f + push SF_SLEEP + pop eax + push 20 + pop ebx + int 0x40 + jmp .ctrl_r +@@: + ret +.bigfilename3: + pop esi +.bigfilename2: + pop esi +.bigfilename: + mov eax, aFileNameTooBig +.l2: + xor esi, esi + xchg esi, [restore_semicolon] + test esi, esi + jz @f + mov byte [esi], ';' +@@: + push eax + mov eax, esp + push ContinueBtn + push 1 + push eax + push 1 + call SayErr + pop eax + ret +.bigcmdline: + mov eax, aCmdLineTooBig + jmp .l2 +.bigfoldername2: + mov esi, prev_dir + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b +.bigfoldername: + mov eax, aFolderNameTooBig + jmp .l2 +.enter_folder: + lea esi, [ecx+40] + cmp word [esi], '..' + jnz @f + cmp byte [esi+2], 0 + jz .dotdot +@@: + push esi + lea esi, [ebp + PanelData.dir] + mov edi, prev_dir +@@: + lodsb + stosb + test al, al + jnz @b + lea edi, [esi-1] + lea edx, [ebp + PanelData.dir + 1024] + cmp esi, edx + pop esi + jae .bigfoldername + mov al, '/' + cmp [edi-1], al + jz @f + stosb +@@: + lodsb + cmp edi, edx + jae .bigfoldername2 + stosb + test al, al + jnz @b + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .reread + push ebp + lea esi, [ebp + PanelData.dir] + push esi + add ecx, 40 + push ecx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.SetFolder] + pop ebp + test al, al + jnz .reread + mov esi, prev_dir + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b +.retd: + ret +.reread: + call read_folder +.done_cmdbar: + call draw_cmdbar + jmp .done_redraw +.dotdot: + lea edi, [ebp + PanelData.dir] + cmp word [edi], '/' + jnz .dotdot_noroot + cmp [ebp + PanelData.hPlugin], 0 + jz .retd + call close_plugin_panel + jmp .dotdot +.dotdot_noroot: + mov edx, edi + mov al, 0 + or ecx, -1 + repnz scasb + dec edi + mov al, '/' + std + repnz scasb + cld + inc edi + cmp edi, edx + jnz @f + inc edi +@@: + push dword [edi] + mov byte [edi], 0 + push edi + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .dotdot_native + push ebp + lea esi, [ebp + PanelData.dir] + push esi + push aDotDot + push [ebp + PanelData.hFile] + call [eax+PluginInfo.SetFolder] + pop ebp + test al, al + jnz .dotdot_native + pop edi + pop dword [edi] + ret +.dotdot_native: + call read_folder + pop edi + pop dword [edi] + push edi + cmp byte [edi], '/' + jnz @f + inc edi +@@: + mov edx, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] +.scanloop: + mov esi, [edx] + add esi, 40 + push esi edi +@@: + lodsb + call match_symbol + jnz @f + inc edi + test al, al + jnz @b +@@: + pop edi esi + jz .scanfound + add edx, 4 + loop .scanloop + jmp .scandone +.scanfound: + sub edx, [ebp + PanelData.files] + shr edx, 2 + mov [ebp + PanelData.index], edx + sub edx, [ebp + PanelData.colst] + jb .scandone + inc edx + mov [ebp + PanelData.start], edx +.scandone: + pop edi + mov byte [edi], 0 + jmp .done_cmdbar +.ctrl_f3_9: + sub al, 0x3D + add al, al + mov ah, [ebp + PanelData.sortmode] + and ah, 0xFE + cmp al, ah + jnz @f + and [ebp + PanelData.sortmode], 1 + or al, [ebp + PanelData.sortmode] + xor al, 1 +@@: + mov [ebp + PanelData.sortmode], al + mov eax, [ebp + PanelData.index] + mov ecx, [ebp + PanelData.files] + push dword [ecx+eax*4] + push ecx + call sort_files + pop edi + pop eax + or ecx, -1 + repnz scasd + not ecx + dec ecx + mov [ebp + PanelData.index], ecx + sub ecx, [ebp + PanelData.start] + jb .less_start + sub ecx, [ebp + PanelData.colst] + jae .gr_end +@@: jmp .done_redraw +.less_start: + add [ebp + PanelData.start], ecx + jmp @b +.gr_end: + inc ecx + add [ebp + PanelData.start], ecx + jmp @b +.alt_f1_2: + mov ebp, panel1 + cmp al, 0x3B + jz @f + mov ebp, panel2 +@@: +; get drives list + mov ebx, dirinfo + mov [ebx+dirinfo.size-dirinfo], 1 + mov [ebx+dirinfo.dirdata-dirinfo], driveinfo + mov [ebx+dirinfo.name-dirinfo], tmpname + mov byte [tmpname], '/' + xor edx, edx + xor ecx, ecx +.drive_loop_e: + mov byte [tmpname+1], 0 + push SF_FILE + pop eax + int 40h + mov ebx, dirinfo + test eax, eax + jnz .drive_loop_e_done + mov esi, driveinfo+32+40 + mov edi, tmpname+1 +@@: + lodsb + stosb + test al, al + jnz @b + push [ebx+dirinfo.first-dirinfo] + and [ebx+dirinfo.first-dirinfo], 0 +.drive_loop_i: + push SF_FILE + pop eax + int 40h + mov ebx, dirinfo + test eax, eax + jnz .drive_loop_i_done + add ecx, 32+8 + push ecx + and ecx, 0xFFF + cmp ecx, 32+8 + pop ecx + ja @f + call xpgrealloc + mov edx, eax + test eax, eax + jnz @f + pop eax + ret +@@: + lea edi, [edx+ecx-32] + mov esi, tmpname +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov esi, driveinfo+32+40 + mov al, '/' + stosb +@@: + lodsb + stosb + test al, al + jnz @b + inc [ebx+dirinfo.first-dirinfo] + jmp .drive_loop_i +.drive_loop_i_done: + pop [ebx+dirinfo.first-dirinfo] + inc [ebx+dirinfo.first-dirinfo] + jmp .drive_loop_e +.drive_loop_e_done: + and [ebx+dirinfo.first-dirinfo], 0 + mov edi, edx + xor esi, esi + add ecx, edx +@@: + and dword [edi], 0 + mov dword [edi+4], esi + mov esi, edi + add edi, 32+8 + cmp edi, ecx + jae @f + mov [esi], edi + jmp @b +@@: + mov ecx, edx + lea edi, [ebp + PanelData.dir] + cmp [ebp + PanelData.hPlugin], 0 + jz .find_cur_drive_loop + mov edi, [ebp + PanelData.parents] + add edi, 8 +.find_cur_drive_loop: + push edi + lea esi, [ecx+8] +@@: + lodsb + test al, al + jz .cur_drive_found + call match_symbol + jnz @f + inc edi + jmp @b +@@: + cmp dword [ecx], 0 + jz @f + pop edi + mov ecx, [ecx] + jmp .find_cur_drive_loop +@@: + mov ecx, edx +.cur_drive_found: + pop edi + push 1 + push aDrive + push ecx + mov eax, [ebp + PanelData.height] + sub eax, 2 + jae @f + add eax, 2 +@@: + push eax + push [ebp + PanelData.width] + push [ebp + PanelData.top] + push [ebp + PanelData.left] + call menu_centered_in + cmp eax, -1 + jnz @f + mov ecx, edx + call pgfree + ret +@@: + push eax + push edx + call close_plugin_panels + pop edx + lea edi, [ebp + PanelData.dir] + push edi + mov esi, edi + mov edi, prev_dir + mov ecx, 1024/4 + rep movsd + pop edi + pop esi + add esi, 8 +@@: + lodsb + stosb + test al, al + jnz @b + mov ecx, edx + call pgfree + call read_folder + jmp .done_redraw +.shift_f5: +; todo: copy to plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: + mov esi, ebp + cmp [ebp + PanelData.selected_num], 0 + jnz .f5_2 + call get_curfile_folder_entry + lea esi, [ecx+40] + mov edi, CopyDestEditBuf + mov eax, CopyDestEditBuf.length + stosd + scasd + xor eax, eax + stosd + mov edx, edi +@@: + lodsb + test al, al + jz .f5_common + stosb + jmp @b +.f5: +; todo: copy to plugin panel + mov esi, ebp + xor esi, panel1 xor panel2 + cmp [esi + PanelData.hPlugin], 0 + jz .f5_2 + ret +.f5_2: + add esi, PanelData.dir + mov edi, CopyDestEditBuf + mov eax, CopyDestEditBuf.length + stosd + scasd + xor eax, eax + stosd + mov edx, edi +@@: + lodsb + test al, al + jz @f + cmp edi, CopyDestEditBuf+12+511 + jae .bigfoldername + stosb + jmp @b +@@: + mov al, '/' + stosb +.f5_common: + mov eax, [ebp + PanelData.hPlugin] + mov [source_hModule], eax + mov eax, [ebp + PanelData.hFile] + mov [source_hPlugin], eax + mov eax, left_dotdot_entry + cmp ebp, panel1 + jz @f + add eax, right_dotdot_entry-left_dotdot_entry +@@: + mov [default_attr], eax + mov byte [edi], 0 + sub edi, edx + mov [edx-8], edi + mov edi, CopySourceTextBuf + mov esi, aCopy1 +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov eax, [ebp + PanelData.selected_num] + test eax, eax + jz .f5_noselected1 + mov ebx, eax + push 10 + pop ecx + push -'0' +@@: + xor edx, edx + div ecx + push edx + test eax, eax + jnz @b +@@: + pop eax + add al, '0' + jz @f + stosb + jmp @b +@@: +if lang eq ru_RU + mov dword [edi], ' ' + mov dword [edi+4], '' + add edi, 8 + cmp ebx, 1 + jz @f + mov al, '' + stosb + cmp ebx, 4 + jbe @f + mov word [edi-1], '' + inc edi +@@: +else ; Default to en_US + mov dword [edi], ' ite' + mov byte [edi+4], 'm' + add edi, 5 + cmp ebx, 1 + jz @f + mov al, 's' + stosb +@@: +end if + jmp .f5_selected1 + +.f5_noselected1: + mov al, '"' + stosb + call get_curfile_folder_entry + lea esi, [ecx+40] + lea eax, [esi+1] +@@: + inc esi + cmp byte [esi-1], 0 + jnz @b + sub esi, eax + xchg eax, esi + dec esi + mov edx, [cur_width] + sub edx, 50 + sub eax, edx + jbe @f + add esi, eax + mov al, '.' + stosb + stosb + stosb +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov al, '"' + stosb +.f5_selected1: + mov esi, aCopy2 +@@: + lodsb + stosb + test al, al + jnz @b + mov ebx, copy_dlgdata + mov eax, [cur_width] + sub eax, 12 + mov [ebx + dlgtemplate.width], eax + dec eax + dec eax + mov [ebx - copy_dlgdata + copy_dlgdata.lcopy.x2], eax + mov [ebx - copy_dlgdata + copy_dlgdata.ename.x2], eax + shr eax, 1 + dec eax + dec eax + mov [ebx - copy_dlgdata + copy_dlgdata.copy.x2], eax + sub eax, aCopyLength-1 + mov [ebx - copy_dlgdata + copy_dlgdata.copy.x1], eax + add eax, aCopyLength+3 + mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x1], eax + add eax, aCancelBLength - 1 + mov [ebx - copy_dlgdata + copy_dlgdata.cnl.x2], eax + mov byte [ebx - copy_dlgdata + copy_dlgdata.ename.flags], 0xC + and byte [ebx - copy_dlgdata + copy_dlgdata.copy.flags], not 4 + and byte [ebx - copy_dlgdata + copy_dlgdata.cnl.flags], not 4 + push ebx + call DialogBox + cmp eax, copy_dlgdata.copy + jnz .ret2 +; 㥬 + mov esi, CopyDestEditBuf+12 + mov edi, esi + xor eax, eax + or ecx, -1 + repnz scasb + dec edi + dec edi + cmp edi, esi + jb .ret2 + mov [bEndSlash], 0 + cmp byte [edi], '/' + jnz @f + cmp edi, esi + jz @f + mov byte [edi], 0 + dec edi + mov [bEndSlash], 1 +@@: +; ᫨ 稭 , ⠥ ⭮⥫쭮 ⥪饩 + cmp byte [esi], '/' + jz .copy_absolute_path + push esi + push edi + lea edi, [ebp + PanelData.dir] + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + pop edi + push edi + add edi, ecx + cmp edi, CopyDestEditBuf+12+513 + pop edi + jb @f + pop esi + jmp .bigfilename +@@: + lea edx, [edi+2] + sub edx, esi + lea edi, [edi+ecx+1] + xchg ecx, edx + std + lea esi, [esi+ecx-1] + rep movsb + cld + pop edi + lea esi, [ebp + PanelData.dir] + push edi + mov ecx, edx + rep movsb + mov byte [edi-1], '/' + pop esi +.copy_absolute_path: +; 砫 ᮧ 襫騥 , +; ᫥ ⮢ 䠩, ⠪ ; +; 㥬 砥, ᫨ 筨  + xor edx, edx + cmp [ebp + PanelData.selected_num], 0 + jz .f5_noselected2 + mov ecx, [ebp + PanelData.numfiles] + mov edi, [ebp + PanelData.files] +.scanselected2: + mov eax, [edi] + add edi, 4 + test byte [eax+303], 1 + jz @f + test byte [eax], 10h + jz @f + inc edx +@@: + loop .scanselected2 + jmp .f5_selected2 +.f5_noselected2: + call get_curfile_folder_entry + test byte [ecx], 10h + setnz dl +.f5_selected2: + xor eax, eax + mov edi, esi +.countslashloop: + cmp byte [edi], '/' + jnz @f + inc eax + mov ecx, edi +@@: + inc edi + cmp byte [edi], 0 + jnz .countslashloop + mov [bNeedRestoreName], 0 +; "/file-system/partition" folders already exist, so we don't need to create them + cmp eax, 2 + jbe .createupdone +; we interpret destination as folder if edx!=0 or bEndSlash!=0 + test edx, edx + jnz @f + cmp [bEndSlash], 0 + jnz @f + mov edi, ecx + dec eax +@@: + mov [attrinfo.name], esi + mov ecx, eax +; 饬 ᫥ , +.createuploop1: + cmp eax, 2 + jbe .createupdone1 + mov dl, [edi] + mov byte [edi], 0 + push eax + push SF_FILE + pop eax + mov ebx, attrinfo + int 0x40 + test eax, eax + pop eax + mov byte [edi], dl + jnz .createupcont1 + test byte [attrinfo.attr], 10h + jnz .createupdone1 +; the item required to be a folder, but is file + push aNotFolder + push esi + mov eax, esp + push ContinueBtn + push 1 + push eax + push 2 + call SayErr + pop eax + pop eax +.ret3: + ret +.createupcont1: + dec eax +@@: + dec edi + cmp byte [edi], '/' + jnz @b + jmp .createuploop1 +.createupdone1: +; ᮧ , 㦭 + cmp eax, ecx + jae .createupdone +@@: + inc edi + cmp byte [edi], 0 + jz @f + cmp byte [edi], '/' + jnz @b +@@: + mov dl, byte [edi] + mov byte [edi], 0 + push eax + push RetryOrCancelBtn + push 2 + call makedir + mov byte [edi], dl + mov [bNeedRestoreName], 1 + pop eax + jnz .ret3 + inc eax + jmp .createupdone1 +.createupdone: + mov dl, 1 + cmp byte [edi], 1 + sbb eax, -1 + cmp eax, 2 + jbe .docopy + mov [attrinfo.attr], 0 ; assume zero attributes if error + push SF_FILE + pop eax + mov ebx, attrinfo + int 0x40 + test [attrinfo.attr], 10h + setnz dl +.docopy: + call get_curfile_folder_entry + mov eax, ecx + cmp [bNeedRestoreName], 0 + jz @f + cmp [bEndSlash], 0 + jnz @f + cmp [ebp + PanelData.selected_num], 0 + jnz @f + test byte [eax], 10h + jz @f + mov dl, 0 +@@: +; 稭 ᮡ⢥ ஢ + mov [bDestIsFolder], dl + mov [copy_bSkipAll], 0 + mov [copy_bSkipAll2], 0 + mov [copy_bSkipAll3], 0 + test [ebp + PanelData.plugin_flags], 2 + jnz .copy_GetFiles + cmp [ebp + PanelData.selected_num], 0 + jnz .f5_selected3 + call copy_file +.copydone: + push ebp + call .ctrl_r + pop ebp + xor ebp, panel1 xor panel2 + jmp .ctrl_r +.f5_selected3: + mov ecx, [ebp + PanelData.numfiles] + mov esi, [ebp + PanelData.files] +.f5_selected_copyloop: + lodsd + test byte [eax+303], 1 + jz .f5_selected_copycont + mov [bDestIsFolder], dl + call copy_file + ja .f5_multiple_cancel + and byte [eax+303], not 1 + pushad + call draw_panel + cmp [bNeedRestoreName], 0 + jz @f + mov esi, CopyDestEditBuf+12 + call delete_last_name_from_end +@@: + popad +.f5_selected_copycont: + loop .f5_selected_copyloop +.f5_multiple_cancel: + jmp .copydone +.copy_GetFiles: + mov ecx, [ebp + PanelData.selected_num] + cmp ecx, 1 + adc ecx, 0 + shl ecx, 2 + call xpgalloc + test eax, eax + jnz @f + ret +@@: + push ebp eax ; save + push copy_AddDir ; adddir + push copy_AddFile ; addfile + push eax ; items + shr ecx, 2 + push ecx ; NumItems + push [ebp + PanelData.hFile] + mov edi, eax + call get_curfile_folder_entry + mov [edi], ecx + cmp [ebp + PanelData.selected_num], 0 + jz .cgf1 + mov esi, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] +.cgf0: + lodsd + test byte [eax+303], 1 + jz @f + stosd +@@: + loop .cgf0 +.cgf1: + mov eax, [ebp + PanelData.hPlugin] + call [eax+PluginInfo.GetFiles] + pop ecx ebp + call pgfree + jmp .copydone + +.f3: + mov eax, [ebp + PanelData.files] + mov ecx, [eax+ecx*4] + test byte [ecx], 10h + jnz .ret2 + lea esi, [ebp + PanelData.dir] + xor eax, eax + call view_file +.ret2: + ret +.f4: + call edit_file + ret +.f8_has_selected: + mov edi, saved_file_name+511 + mov byte [edi], 0 + mov eax, [ebp + PanelData.selected_num] +if lang eq ru_RU + cmp eax, 1 + jz @f + dec edi + mov byte [edi], '' + cmp eax, 4 + jbe @f + dec edi + mov word [edi], '' +@@: + mov dword [edi-4], '' + mov dword [edi-8], ' ' + sub edi, 8 +else ; Default to en_US + cmp eax, 1 + jz @f + dec edi + mov byte [edi], 's' +@@: + mov dword [edi-4], 'item' + mov byte [edi-5], ' ' + sub edi, 5 +end if + xor edx, edx + push 10 + pop ecx +@@: + div ecx + add dl, '0' + dec edi + mov [edi], dl + xor edx, edx + test eax, eax + jnz @b + push edi + push aConfirmDeleteText + mov eax, esp + push DeleteOrCancelBtn + push 2 + push eax + push 2 + push aDeleteCaption + call Message + add esp, 8 + test eax, eax + jnz .ret2 + mov [del_bSkipAll], 0 + mov ecx, [ebp + PanelData.numfiles] + jecxz .ret2 + mov esi, [ebp + PanelData.files] +.f8_loop: + lodsd + test byte [eax+303], 1 + jz @f + call delete_file + ja .f8_multiple_cancel +@@: + loop .f8_loop +.f8_multiple_cancel: + jmp .copydone +.f8: +; todo: delete files from plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: + cmp [ebp + PanelData.selected_num], 0 + jnz .f8_has_selected + call get_curfile_folder_entry + cmp word [ecx+40], '..' + jnz @f + cmp byte [ecx+42], 0 + jz .f8_not_allowed +@@: + cmp [bConfirmDelete], 0 + jz .f8_allowed + lea eax, [ecx+40] + push eax + mov esi, aConfirmDeleteText + mov edi, aConfirmDeleteTextBuf + push edi +@@: + lodsb + stosb + test al, al + jnz @b + dec edi + mov esi, aDeleteFolder + test byte [ecx], 10h + jnz @f + mov esi, aDeleteFile +@@: + lodsb + stosb + test al, al + jnz @b + mov eax, esp + push DeleteOrCancelBtn + push 2 + push eax + push 2 + push aDeleteCaption + call Message + add esp, 8 + test eax, eax + jz .f8_allowed +.f8_not_allowed: + ret +.f8_allowed: + mov [del_bSkipAll], 0 + mov eax, ecx + call delete_file + jmp .copydone +.ctrl_r: +; Rescan panel +; call read_folder +; jmp .done_redraw + mov eax, [ebp + PanelData.index] + push eax + call get_curfile_name + mov esi, ecx + mov edi, saved_file_name +@@: + lodsb + stosb + test al, al + jnz @b +.ctrl_r.doread: + push [ebp + PanelData.start] + call read_folder + pop [ebp + PanelData.start] + pop [ebp + PanelData.index] + or eax, -1 +@@: + inc eax + cmp eax, [ebp + PanelData.numfiles] + jae .ctrl_r.notfound + mov ecx, [ebp + PanelData.files] + mov esi, [ecx+eax*4] + add esi, 40 + mov edi, saved_file_name + call strcmpi + jnz @b +.ctrl_r.found: + mov [ebp + PanelData.index], eax +.ctrl_r.notfound: + mov eax, [ebp + PanelData.numfiles] + dec eax + cmp [ebp + PanelData.index], eax + jbe @f + mov [ebp + PanelData.index], eax +@@: + mov eax, [ebp + PanelData.index] + cmp [ebp + PanelData.start], eax + jbe @f + mov [ebp + PanelData.start], eax +@@: + inc eax + sub eax, [ebp + PanelData.colst] + jae @f + xor eax, eax +@@: + cmp [ebp + PanelData.start], eax + jae @f + mov [ebp + PanelData.start], eax +@@: + mov eax, [ebp + PanelData.numfiles] + sub eax, [ebp + PanelData.colst] + jbe @f + cmp [ebp + PanelData.start], eax + jbe @f + mov [ebp + PanelData.start], eax +@@: + jmp .done_redraw +.menu: +; todo: context menu for plugin panel + cmp [ebp + PanelData.hPlugin], 0 + jz @f + ret +@@: +; display context menu +; ignore folders + call get_curfile_folder_entry + test byte [ecx], 10h + jz @f +.menuret: + ret +@@: + call find_extension + jc .menuret +; known extension +@@: + cmp byte [edi], 0 + jz .menuret + cmp byte [edi], ';' + jz @f + inc edi + jmp @b +@@: + inc edi +@@: + inc edi + cmp byte [edi-1], ' ' + jz @b + cmp byte [edi-1], 9 + jz @b + dec edi + cmp byte [edi], 0 + jz .menuret + mov ecx, esi +@@: + inc ecx + cmp byte [ecx-1], 0 + jnz @b + sub ecx, esi ; ecx = 䠩+1 = +1 + cmp ecx, 15 + jb @f + mov cl, 15 +@@: + xor edx, edx + xor ebp, ebp + push edx +.menucreateloop: + mov eax, edi + xor ebx, ebx +@@: + cmp byte [edi], ',' + jz @f + cmp byte [edi], bl + jz @f + inc edi + jmp @b +@@: + xchg bl, [edi] + pushad + push nullstr + push 1024 + push saved_file_name + push eax + push aMenu + push app_path + call [ini.get_str] + popad + mov [edi], bl + mov eax, saved_file_name +@@: + cmp byte [eax], 0 + jz .menucreatecont + cmp byte [eax], ',' + jz @f + inc eax + jmp @b +@@: + mov byte [eax], 0 + push eax + sub eax, saved_file_name-1 + cmp eax, ecx + ja @f + mov eax, ecx +@@: + xchg eax, [esp] + inc eax + push eax +@@: + inc eax + cmp byte [eax-1], 0 + jnz @b + sub eax, [esp] + add [esp+4], eax + pop eax eax + add eax, 8 + add ebp, eax + push ebp + and ebp, 0xFFF + cmp ebp, eax + pop ebp + ja @f + push eax + xchg edx, [esp+4] + push ecx + mov ecx, ebp + call xpgrealloc + pop ecx + pop edx + xchg edx, [esp] + test eax, eax + xchg eax, [esp] + jz .menucreated +@@: + neg eax + add eax, ebp + add eax, [esp] + and dword [eax], 0 + and dword [eax+4], 0 + test edx, edx + jz @f + sub eax, [esp] + mov [edx], eax + add eax, [esp] + sub edx, [esp] + mov [eax+4], edx +@@: + mov edx, eax + push esi edi + mov esi, saved_file_name + lea edi, [eax+8] +@@: + lodsb + stosb + test al, al + jnz @b + push esi + sub esi, saved_file_name + sub esi, ecx + jae .menunoadd + neg esi +@@: + mov byte [edi-1], ' ' + stosb + dec esi + jnz @b +.menunoadd: + pop esi +@@: + lodsb + stosb + test al, al + jnz @b + pop edi esi +.menucreatecont: + inc edi + cmp byte [edi-1], ',' + jz .menucreateloop +.menucreated: + test edx, edx + jz .menuret_free + and dword [edx], 0 + pop edx + mov ecx, edx + add [ecx], edx +@@: + mov ecx, [ecx] + cmp dword [ecx], 0 + jz @f + add [ecx], edx + add [ecx+4], edx + jmp @b +@@: + add [ecx+4], edx + push edx + push 1 + push esi + push edx + call menu + cmp eax, -1 + jz .menuret_free + lea edi, [eax+8] +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + mov ebp, [active_panel] + call get_curfile_folder_entry + call .run_association2 +.menuret_free: + pop ecx + jmp pgfree +.f7: + mov dword [CopyDestEditBuf], CopyDestEditBuf.length + and dword [CopyDestEditBuf+4], 0 + and dword [CopyDestEditBuf+8], 0 + mov byte [CopyDestEditBuf+12], 0 + mov ebx, mkdir_dlgdata + mov eax, [cur_width] + sub eax, 12 + mov [ebx + dlgtemplate.width], eax + dec eax + dec eax + mov [ebx + MkDir_Dlgdata.dnam.x2], eax + shr eax, 1 + dec eax + dec eax + mov [ebx + MkDir_Dlgdata.cont.x2], eax + sub eax, a_ContinueLength-1 + mov [ebx + MkDir_Dlgdata.cont.x1], eax + add eax, a_ContinueLength+3 + mov [ebx + MkDir_Dlgdata.cnl.x1], eax + add eax, aCancelBLength - 1 + mov [ebx + MkDir_Dlgdata.cnl.x2], eax + mov byte [ebx + MkDir_Dlgdata.dnam.flags], 0xC + and byte [ebx + MkDir_Dlgdata.cont.flags], not 4 + and byte [ebx + MkDir_Dlgdata.cnl.flags], not 4 + push ebx + call DialogBox + cmp eax, mkdir_dlgdata.cont + jnz .ret2 + mov esi, CopyDestEditBuf+12 + cmp byte [esi], 0 + jz .ret2 + cmp byte [esi], '/' + jz .mkdir_absolute_path + push esi + lea edi, [ebp + PanelData.dir] + or ecx, -1 + xor eax, eax + repnz scasb + not ecx + mov edi, esi +@@: + cmp byte [edi+1], 0 + jz @f + inc edi + jmp @b +@@: + push edi + add edi, ecx + cmp edi, CopyDestEditBuf+12+513 + pop edi + jb @f + pop esi + jmp .bigfilename +@@: + lea edx, [edi+2] + sub edx, esi + lea edi, [edi+ecx+1] + xchg ecx, edx + std + lea esi, [esi+ecx-1] + rep movsb + cld + pop edi + lea esi, [ebp + PanelData.dir] + push edi + mov ecx, edx + rep movsb + mov byte [edi-1], '/' + pop esi +.mkdir_absolute_path: + push RetryOrCancelBtn + push 2 + call makedir + jmp .copydone +.change_mode: + dec eax + mov [ebp + PanelData.colmode], eax + call calc_colwidths + jmp draw_panel +.quick_jump: + dec eax + cmp al, 10 + jnz @f + xor eax, eax +@@: + mov eax, [FolderShortcuts+eax*4] + test eax, eax + jnz @f + ret +@@: + push eax + call close_plugin_panels + lea esi, [ebp + PanelData.dir] + push esi + mov edi, prev_dir +@@: + lodsb + stosb + test al, al + jnz @b + pop edi esi +@@: + lodsb + stosb + test al, al + jnz @b + jmp .reread +.greyplus: + push 0 + mov ecx, aSelect + jmp @f +.greyminus: + push 1 + mov ecx, aDeselect +@@: + mov eax, mark_dlgdata + mov [eax+mark_dlgdata.title-mark_dlgdata], ecx + mov [eax+mark_dlgdata.edit.flags-mark_dlgdata], 0xC + mov edi, enter_string_buf+12 + mov dword [edi-12], 512 + mov dword [edi-8], 1 + and dword [edi-4], 0 + mov word [edi], '*' + push eax + call DialogBox + inc eax + jnz @f +.noselect: + pop eax + ret +@@: + xor eax, eax + mov esi, edi +@@: + lodsb + mov al, [tolower_table+eax] + mov [esi-1], al + test al, al + jnz @b +@@: + mov ecx, [ebp + PanelData.numfiles] + mov ebx, [ebp + PanelData.files] + jecxz .noselect + mov eax, [ebx] + cmp word [eax+40], '..' + jnz .selectloop + cmp byte [eax+42], 0 + jnz .selectloop + dec ecx + jz .noselect + add ebx, 4 +.selectloop: + xor eax, eax + mov esi, [ebx] + add esi, 40 + mov edx, lower_file_name-1 +@@: + lodsb + inc edx + mov al, [tolower_table+eax] + mov [edx], al + test al, al + jnz @b + mov esi, lower_file_name + call match_mask_rev_lowercase + jc @f + mov esi, [ebx] + mov eax, [esi+32] + cmp byte [esp], 0 + jz .doselect + test byte [esi+303], 1 + jz @f + and byte [esi+303], not 1 + sub dword [ebp + PanelData.selected_size], eax + mov eax, [esi+36] + sbb dword [ebp + PanelData.selected_size+4], eax + dec dword [ebp + PanelData.selected_num] + jmp @f +.doselect: + test byte [esi+303], 1 + jnz @f + or byte [esi+303], 1 + add dword [ebp + PanelData.selected_size], eax + mov eax, [esi+36] + adc dword [ebp + PanelData.selected_size+4], eax + inc dword [ebp + PanelData.selected_num] +@@: + add ebx, 4 + dec ecx + jnz .selectloop + pop eax + jmp .done_redraw +.greyasterisk: + mov ecx, [ebp + PanelData.numfiles] + mov esi, [ebp + PanelData.files] + jecxz .galoopdone +.galoop: + lodsd + cmp word [eax+40], '..' + jnz @f + cmp byte [eax+42], 0 + jz .gacont +@@: + xor byte [eax+303], 1 + mov edx, [eax+32] + test byte [eax+303], 1 + jz .gadel + add dword [ebp + PanelData.selected_size], edx + mov edx, [eax+36] + adc dword [ebp + PanelData.selected_size+4], edx + inc dword [ebp + PanelData.selected_num] + jmp .gacont +.gadel: + sub dword [ebp + PanelData.selected_size], edx + mov edx, [eax+36] + sbb dword [ebp + PanelData.selected_size+4], edx + dec dword [ebp + PanelData.selected_num] +.gacont: + loop .galoop +.galoopdone: + jmp .done_redraw + +@@: + call close_plugin_panel +close_plugin_panels: + cmp [ebp + PanelData.hPlugin], 0 + jnz @b + ret + +align 4 +close_plugin_panel: +; close plugin and restore old directory + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + push esi + lea edi, [ebp + PanelData.dir] +@@: + lodsb + stosb + test al, al + jnz @b + pop esi + sub esi, 9 + mov edx, [esi] ; hPlugin + mov ebx, [esi+4] ; hFile + sub esi, [ebp + PanelData.parents] + mov [ebp + PanelData.parents_sz], esi + xchg edx, [ebp + PanelData.hPlugin] + xchg ebx, [ebp + PanelData.hFile] + push edx ebx + lea ebx, [ebp + PanelData.plugin_flags] ;plugin_info + and dword [ebx], 0 + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz @f + push ebp + push ebx + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetOpenPluginInfo] + pop ebp +@@: + pop ebx edx + +align 4 +close_handle_if_unused: +; edx=hPlugin, ebx=hFile + push ebp + xor ecx, ecx +@@: + mov eax, [screens] + mov ebp, [eax+ecx*8+4] + mov eax, [eax+ecx*8] + call [eax+screen_vtable.IsHandleUsed] + jz .used + inc ecx + cmp ecx, [num_screens] + jb @b + push ebx + call [edx+PluginInfo.ClosePlugin] +.used: + pop ebp + ret + +align 4 +panels_IsHandleUsed: +; edx=hPlugin, ebx=hFile + mov ebp, panel1 + call .1 + jz .ret + mov ebp, panel2 + +.1: + cmp edx, [ebp+ PanelData.hPlugin] + jnz @f + cmp ebx, [ebp+ PanelData.hFile] + jz .ret +@@: + mov esi, [ebp + PanelData.parents_sz] + test esi, esi + jnz @f + inc esi +.ret: + ret +@@: + add esi, [ebp + PanelData.parents] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + sub esi, 9 + cmp edx, [esi] ; hPlugin + jnz .no + mov ebx, [esi+4] ; hFile + jz .ret +.no: + cmp esi, [ebp + PanelData.parents] + jnz @b + inc esi + ret + +align 4 +panels_OnExit: +; close plugin panels + mov ebp, panel1 + call close_plugin_panels + mov ebp, panel2 + call close_plugin_panels + ret + +align 4 +panels_OnRedraw: + or [cursor_x], -1 + or [cursor_y], -1 + call draw_cmdbar + mov ebp, panel1 + call calc_colwidths + call draw_panel + mov ebp, panel2 + call calc_colwidths + call draw_panel + ret + +align 4 +init_console: + mov ecx, [console_data_ptr] + call pgfree + mov eax, [cur_width] + mul [cur_height] + mov ecx, eax + push ecx + shl ecx, 2 + call pgalloc + pop ecx + test eax, eax + jz exit + mov [console_data_ptr], eax + mov edi, eax + mov ax, 0720h + rep stosw + mov [panel1.left], ecx + mov [panel1.top], ecx + mov [panel2.top], ecx + mov eax, [cur_width] + inc eax + shr eax, 1 + mov [panel1.width], eax + mov [panel2.left], eax + sub eax, [cur_width] + neg eax + mov [panel2.width], eax + mov eax, [cur_height] + dec eax + dec eax + mov [panel1.height], eax + mov [panel2.height], eax + ret + +align 4 +get_curfile_folder_entry: + mov ecx, [ebp + PanelData.index] + shl ecx, 2 + add ecx, [ebp + PanelData.files] + mov ecx, [ecx] + ret + +align 4 +get_curfile_name: + call get_curfile_folder_entry + add ecx, 40 + ret + +quick_find: + cmp [ebp + PanelData.numfiles], 0 + jz .nof + mov ecx, [ebp + PanelData.index] +.scanloop: + mov edi, ecx + shl edi, 2 + add edi, [ebp + PanelData.files] + mov edi, [edi] + add edi, 40 + mov esi, quick_search_buf + 12 +@@: + lodsb + test al, al + jz .ok + call match_symbol + jnz .no + inc edi + jmp @b +.no: + inc ecx + cmp ecx, [ebp + PanelData.numfiles] + jb @f + xor ecx, ecx +@@: + cmp ecx, [ebp + PanelData.index] + jnz .scanloop +.nof: + stc + ret +.ok: + cmp ecx, [ebp + PanelData.index] + jz .ret + mov [ebp + PanelData.index], ecx + mov eax, [ebp + PanelData.height] + shr eax, 1 + sub ecx, eax + jae @f + xor ecx, ecx +@@: + mov eax, [ebp + PanelData.numfiles] + sub eax, [ebp + PanelData.colst] + jnc @f + xor eax, eax + xor ecx, ecx +@@: + cmp ecx, eax + jb @f + mov ecx, eax +@@: + mov [ebp + PanelData.start], ecx + call draw_panel +.ret: + clc + ret + +quick_find_next: + cmp [ebp + PanelData.numfiles], 0 + jz quick_find.nof + mov ecx, [ebp + PanelData.index] + jmp quick_find.no + +quick_find_prev: + cmp [ebp + PanelData.numfiles], 0 + jz quick_find.nof + mov ecx, [ebp + PanelData.index] +.scanloop: + dec ecx + jns @f + mov ecx, [ebp + PanelData.numfiles] + dec ecx +@@: + cmp ecx, [ebp + PanelData.index] + jz quick_find.nof + mov edi, ecx + shl edi, 2 + add edi, [ebp + PanelData.files] + mov edi, [edi] + add edi, 40 + mov esi, quick_search_buf + 12 +@@: + lodsb + test al, al + jz quick_find.ok + call match_symbol + jnz .scanloop + inc edi + jmp @b + +panels_getname: +if lang eq ru_RU + mov eax, '' + stosd + mov eax, ' ' + stosd + mov eax, ' ' + stosd + stosb +else ; Default to en_US + mov eax, 'Pane' + stosd + mov eax, 'ls ' + stosd + mov eax, ' ' + stosd + stosb +end if + sub ecx, 13 + mov ebp, [active_panel] + push 3 + pop edx + cmp [ebp + PanelData.hPlugin], 0 + jz .native + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jz @f + cmp byte [esi-1], '/' + jnz @b +@@: + push ecx edi + shr ecx, 1 +@@: + lodsb + test al, al + jz @f + stosb + loop @b +@@: + sub edi, [esp] + sub [esp+4], edi + add [esp], edi + pop edi ecx + lea esi, [ebp + PanelData.dir] + cmp byte [esi+1], 0 + jnz @f + inc esi +@@: + jmp .main +.native: + lea esi, [ebp + PanelData.dir] +@@: + lodsb + stosb + dec ecx + test al, al + jz @f + cmp al, '/' + jnz @b + dec edx + jnz @b +@@: + test al, al + jnz @f + dec esi + dec edi +@@: +.main: + push esi +@@: + lodsb + test al, al + jnz @b + dec esi + mov ebx, esi + sub ebx, [esp] + dec esi + push esi + mov esi, [ebp + PanelData.index] + shl esi, 2 + add esi, [ebp + PanelData.files] + mov esi, [esi] + add esi, 40 + push esi +@@: + lodsb + test al, al + jnz @b + add ebx, esi + sub ebx, [esp] + dec esi + cmp ebx, ecx + jbe @f + mov al, '.' + stosb + stosb + stosb + sub ecx, 3 + mov ebx, ecx +@@: + add edi, ebx + inc ecx + std +@@: + movsb + dec ecx + jz .nodir + cmp esi, [esp] + jae @b + mov esi, [esp+4] + mov al, '/' + stosb + dec ecx + jz .nodir +@@: + cmp esi, [esp+8] + jb .nodir + movsb + loop @b +.nodir: + cld + pop eax + pop eax + pop eax + ret + +draw_window: + push SF_REDRAW + pop eax + push SSF_BEGIN_DRAW + pop ebx + int 40h + mov al, SF_STYLE_SETTINGS + mov bl, SSF_GET_SKIN_HEIGHT + int 40h + mov [skinh], eax + mov ebx, [cur_width] + imul ebx, font_width + add ebx, 100*65536 + 5*2-1 + mov ecx, [cur_height] + imul ecx, font_height + lea ecx, [eax+ecx+5-1+100*65536] + xor eax, eax + mov edx, 0x53000000 + mov edi, header + int 40h + mov al, SF_DRAW_RECT + xor edx, edx + cmp [fill_width], 0 + jz @f + mov ebx, [wnd_width] + sub ebx, [fill_width] + sub ebx, 5-1 + shl ebx, 16 + mov bx, word [fill_width] + mov ecx, [skinh-2] + mov cx, word [wnd_height] + sub cx, word [skinh] + sub cx, 5-1 + int 0x40 +@@: + cmp [fill_height], 0 + jz @f + xor edx, edx + mov ebx, 50000h + mov bx, word [wnd_width] + sub ebx, 9 + mov ecx, [wnd_height] + sub ecx, [fill_height] + sub ecx, 5-1 + shl ecx, 16 + mov cx, word [fill_height] + int 0x40 +@@: +; xor ecx, ecx +; call draw_image + mov al, SF_PUT_IMAGE_EXT + mov ebx, [MemForImage] + test ebx, ebx + jz @f + mov ecx, [cur_width] + imul ecx, font_width*10000h + mov cx, word [cur_height] + imul cx, font_height + mov edx, [skinh] + add edx, 5*10000h + mov esi, 8 + mov edi, console_colors + xor ebp, ebp + int 0x40 +@@: + mov al, SF_REDRAW + push SSF_END_DRAW + pop ebx + int 40h + ret + +draw_image.nomem: + mov al, SF_DRAW_RECT + xor edx, edx + mov ebx, [cur_width] + imul ebx, font_width + add ebx, 5*65536 + mov ecx, [skinh-2] + mov cx, word [cur_height] + imul cx, font_height + int 40h + mov al, SF_DRAW_TEXT + mov ebx, 32*65536+32 + mov ecx, 0xFFFFFF + mov edx, nomem_draw + push nomem_draw.size + pop esi + int 40h + ret + +align 16 +draw_image: + mov [bMemForImageValidData], byte 1 + cmp [MemForImage], 0 + jnz .allocated +; allocate memory for image + mov ecx, [cur_width] + imul ecx, [cur_height] + imul ecx, font_width*font_height + call pgalloc + test eax, eax + jz draw_image.nomem + mov [MemForImage], eax + mov [bMemForImageValidData], byte 0 +.allocated: + push ebp + and [max_x], 0 + or [min_x], -1 + and [max_y], 0 + or [min_y], -1 + mov eax, [cursor_y] + mul [cur_width] + add eax, [cursor_x] + add eax, eax + add eax, [console_data_ptr] + xchg [cur_cursor_pos], eax + mov [old_cursor_pos], eax + mov edi, [MemForImage] + mov esi, [console_data_ptr] + mov ecx, [cur_height] +.lh: + push ecx + mov ecx, [cur_width] +.lw: + push ecx + mov eax, [cur_width] + imul eax, [cur_height] + mov ebx, [esi] + cmp [bMemForImageValidData], 0 + jz @f + cmp esi, [cur_cursor_pos] + jz @f + cmp esi, [old_cursor_pos] + jz @f + cmp bx, [eax*2+esi] + jnz @f + inc esi + inc esi + jmp .skip_symbol +@@: + mov [eax*2+esi], bx + cmp ecx, [min_x] + ja @f + mov [min_x], ecx +@@: + cmp ecx, [max_x] + jb @f + mov [max_x], ecx +@@: + mov eax, [esp+4] + mov [min_y], eax + cmp eax, [max_y] + jb @f + mov [max_y], eax +@@: + push edi + xor eax, eax + mov al, [esi+1] + and al, 0xF + mov ebx, eax + mov al, [esi+1] + shr al, 4 + mov ebp, eax + sub ebx, ebp + lodsb + inc esi +if font_width > 8 + lea edx, [eax+eax+font] +else + lea edx, [eax+font] +end if +.sh: + mov ecx, [edx] +repeat font_width + shr ecx, 1 + sbb eax, eax + and eax, ebx + add eax, ebp + mov [edi+%-1], al +end repeat + mov eax, [cur_width] +; imul eax, font_width +; add edi, eax +if font_width = 6 + lea eax, [eax*2+eax] + lea edi, [edi+eax*2] +else if font_width = 7 + lea edi, [edi+eax*8] + sub edi, eax +else if font_width = 8 + lea edi, [edi+eax*8] +else if font_width = 9 + lea edi, [edi+eax*8] + add edi, eax +else if font_width = 10 + lea eax, [eax*4+eax] + lea edi, [edi+eax*2] +else +Unknown font_width value! +end if +if font_width > 8 + add edx, 256*2 + cmp edx, font+256*2*font_height +else + add edx, 256 + cmp edx, font+256*font_height +end if + jb .sh + pop edi +.skip_symbol: + pop ecx + add edi, font_width + dec ecx + jnz .lw + mov eax, [cur_width] + imul eax, (font_height-1)*font_width + add edi, eax + pop ecx + dec ecx + jnz .lh +; cursor + mov eax, [cursor_y] + inc eax + jz .nocursor + mul [cur_width] + imul eax, font_height*font_width + mov edx, [cursor_x] + inc edx + imul edx, font_width + add eax, edx + add eax, [MemForImage] + mov edx, [cur_width] + imul edx, font_width + neg edx + mov ecx, [cursor_size] +.cursor_loop: + push ecx + mov ecx, font_width + add eax, edx + push eax +@@: +;; add byte [eax-1], 0x10 + xor byte [eax-1], 7 + sub eax, 1 + loop @b + pop eax + pop ecx + loop .cursor_loop +.nocursor: + cmp [min_y], -1 + jz .nodraw + mov ecx, [cur_width] + mov ebx, [cur_height] + mov eax, ebx + sub ebx, [max_y] + sub eax, [min_y] + sub eax, ebx + inc eax + imul ebp, eax, font_height + mov edx, ecx + sub edx, [max_x] + imul edx, font_width + mov eax, edx + shl edx, 16 + imul dx, bx, font_height + imul ebx, [cur_width] + mov ecx, [max_x] + sub ecx, [min_x] + inc ecx + imul ecx, font_width*10000h + add ecx, ebp + imul ebx, font_width*font_height + add ebx, [MemForImage] + add ebx, eax + add edx, [skinh] + add edx, 5*10000h + imul esi, [cur_width], font_width + mov ebp, ecx + shr ebp, 16 + sub esi, ebp + mov ebp, esi + push SF_PUT_IMAGE_EXT + pop eax + mov edi, console_colors + push 8 + pop esi + int 40h +.nodraw: + pop ebp + ret + +get_console_ptr: +; in: eax=x, edx=y +; out: edi->console data + push edx + imul edx, [cur_width] + add edx, eax + mov edi, [console_data_ptr] + lea edi, [edi + edx*2] + pop edx + ret + +;description: +; draw keys F1-F12 +align 16 +draw_keybar: + pushad + xor eax, eax + test [ctrlstate], 3 + jz @f + inc eax +@@: + test [ctrlstate], 0xC + jz @f + or al, 2 +@@: + test [ctrlstate], 0x30 + jz @f + or al, 4 +@@: + imul eax, 6*12 ; ⥪ * ᫮ F1-F12 + mov esi, [active_screen_keybar] + add esi, eax + xor ecx, ecx + inc ecx + xor eax, eax + mov edx, [cur_height] + dec edx + call get_console_ptr + push 6 + pop ebx + mov eax, [cur_width] + sub eax, 11+9+3*2+6 + cmp eax, 7*11 + jl @f + cdq + mov bl, 11 + div ebx + mov ebx, eax +@@: + xor edx, edx ; ஫ 室 । +.l: + add edx, 7 + cmp cl, 10 + jb @f + inc edx +@@: + cmp edx, [cur_width] + ja .ret + cmp cl, 10 + jae .twodig + lea eax, [ecx+'0'] + stosb + mov al, [keybar_number_color] + stosb + jmp .cmn +.twodig: + mov al, cl + cbw + div [_10] + add al, '0' + stosb + mov al, [keybar_number_color] + stosb + xchg al, ah + add al, '0' + stosw +.cmn: + mov ah, [keybar_name_color] + push ecx + mov cl, 6 +@@: + lodsb + stosw + loop @b + mov al, ' ' + lea ecx, [ebx-6] + cmp byte [esp], 12 + jz .ret_pop + add edx, ecx + rep stosw + pop ecx + inc edx + cmp edx, [cur_width] + ja .ret + mov ah, [keybar_bgr_color] + stosw + inc ecx + jmp .l +.ret_pop: + pop ecx +.ret: + cmp byte [edi-2], ' ' + jnz @f + dec edi + dec edi +@@: + push edi + xor eax, eax + mov edx, [cur_height] + call get_console_ptr + mov ecx, edi + pop edi + sub ecx, edi + shr ecx, 1 + mov al, ' ' + mov ah, [keybar_name_color] + rep stosw ;᪠ 梥 + + cmp [bDisplayQuickSearch], 0 + jz @f + push QuickSearchDlg + call DrawDialogBox +@@: + popad + ret + +align 16 +draw_cmdbar: + mov esi, [active_panel] + add esi, PanelData.dir + xor eax, eax + mov edx, [cur_height] + dec edx + dec edx + call get_console_ptr + mov ah, [cmdbar_prefix_color] + mov ecx, [cur_width] + dec ecx +@@: + lodsb + test al, al + jz @f + stosw + loop @b +@@: + mov al, '>' + stosw + mov al, ' ' + mov ah, [cmdbar_normal_color] + rep stosw + ret + +align 16 +draw_border: + push edi + mov al, 0xC9 + stosw + mov al, 0xCD + lea ecx, [ebx-2] + rep stosw + mov al, 0xBB + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + lea ecx, [edx-2] +.l: + push edi + mov al, 0xBA + stosw + mov al, 0x20 + push ecx + lea ecx, [ebx-2] + rep stosw + pop ecx + mov al, 0xBA + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + loop .l + mov al, 0xC8 + stosw + mov al, 0xCD + lea ecx, [ebx-2] + rep stosw + mov al, 0xBC + stosw + ret + +calc_colwidths: +; in: ebp->panel data + imul esi, [ebp + PanelData.colmode], PanelMode.size + add esi, colmodes + lodsd + mov ecx, eax + lea edx, [ecx-1] + xor ebx, ebx + add esi, PanelMode.ColumnWidths-4 + push ecx esi + xor eax, eax +.loop: + lodsb + add edx, eax + cmp al, 1 + adc ebx, 0 + loop .loop + pop esi ecx + lea edi, [ebp + PanelData.colwidths] + test ebx, ebx + jz .loop2 + mov eax, [ebp + PanelData.width] + dec eax + dec eax + sub eax, edx + jae @f + xor eax, eax +@@: + xor edx, edx + div ebx + test eax, eax + jnz @f + xor edx, edx + inc eax +@@: + push eax +.loop2: + movzx eax, byte [esi] + inc esi + test eax, eax + jnz @f + pop eax + push eax + dec ebx + cmp ebx, edx + jae @f + inc eax +@@: + stosd + loop .loop2 + pop eax + and dword [edi], 0 + ret + +GetPanelTitle_default: + mov edi, [esp+8] + mov ecx, 1024 + mov esi, [esp+12] + test esi, esi + jz .nohost + mov edx, esi +@@: + lodsb + test al, al + jz @f + cmp al, '/' + jnz @b + mov edx, esi + jmp @b +@@: + mov esi, edx +@@: + lodsb + stosb + test al, al + loopnz @b + dec edi + inc ecx +.nohost: + mov esi, [esp+16] + cmp word [esi], '/' + jz .nodir +@@: + lodsb + stosb + test al, al + loopnz @b + dec edi +.nodir: + mov byte [edi], 0 + ret 10h + +;input: +; ebp - pointer to panel1 or panel2 +align 16 +draw_panel: + mov eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + call get_console_ptr +; draw border + mov ah, [panel_border_color] + mov ebx, [ebp + PanelData.width] + mov edx, [ebp + PanelData.height] + call draw_border + push eax + mov eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + sub edx, 3 + call get_console_ptr + pop eax + mov al, 0xC7 + stosw + mov al, 0xC4 + lea ecx, [ebx-2] + rep stosw + mov al, 0xB6 + stosw + + imul esi, [ebp + PanelData.colmode], PanelMode.size + add esi, colmodes + lodsd + mov ecx, eax ; number of columns + lea ebx, [ebp + PanelData.colwidths] + mov eax, [ebp + PanelData.left] + inc eax + mov [column_left], eax + mov eax, [ebp + PanelData.top] + inc eax + mov [column_top], eax + mov eax, [ebp + PanelData.height] + sub eax, 4 + mov [column_height], eax + dec eax + mov [ebp + PanelData.colsz], eax + and [ebp + PanelData.colst], 0 + mov eax, [ebp + PanelData.start] + mov [column_index], eax + mov [last_column_index], eax +.columns_loop: + push ecx + mov eax, [ebx] + add ebx, 4 + mov [column_width], eax + cmp ecx, 1 + jz .skip_right_border + add eax, [column_left] + mov edx, [ebp + PanelData.top] + call get_console_ptr + mov ah, [panel_header_color] + mov al, 0xD1 + mov [edi], ax + add edi, [cur_width] + add edi, [cur_width] + mov ecx, [column_height] + mov al, 0xB3 +@@: + mov [edi], ax + add edi, [cur_width] + add edi, [cur_width] + loop @b + mov al, 0xC1 + stosw +.skip_right_border: + mov eax, [column_left] + mov edx, [column_top] + call get_console_ptr +; ⮫ + push edi + mov edx, [esi] + and edx, 0xF + mov edx, [column_headers+edx*4] + movzx ecx, byte [edx] + inc edx + cmp ecx, [column_width] + jb @f + mov ecx, [column_width] +@@: + push ecx + sub ecx, [column_width] + neg ecx + shr ecx, 1 + mov al, ' ' + mov ah, [column_header_color] + rep stosw + pop ecx + jecxz .skipcopyhdr + push ecx +@@: + mov al, [edx] + inc edx + stosw + loop @b + pop ecx +.skipcopyhdr: + sub ecx, [column_width] + neg ecx + inc ecx + shr ecx, 1 + mov al, ' ' + rep stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] +; ᠬ ⮫ + mov eax, [esi] + and eax, 0xF + push ebx esi + call dword [draw_column_proc+eax*4] + pop esi ebx + inc esi + mov eax, [column_width] + inc eax + add [column_left], eax + pop ecx + dec ecx + jnz .columns_loop +; (⥪ ) + lea esi, [ebp + PanelData.dir] + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .native + push ebp + push esi + mov esi, [ebp + PanelData.parents] + add esi, [ebp + PanelData.parents_sz] +@@: + dec esi + cmp byte [esi-1], 0 + jnz @b + push esi + push execdata + push [ebp + PanelData.hFile] + call [eax+PluginInfo.GetPanelTitle] + pop ebp + mov esi, execdata +.native: + mov edi, cur_header + mov ecx, [ebp + PanelData.width] + sub ecx, 6 + cmp byte [esi], '/' + jnz .copy_rest + dec ecx + movsb +@@: + lodsb + stosb + dec ecx + test al, al + jz .header_created + cmp al, '/' + jnz @b +.copy_rest: + mov edx, esi +@@: + lodsb + test al, al + jnz @b + sub esi, edx + dec esi + cmp esi, ecx + jbe @f + mov word [edi], '..' + mov byte [edi+2], '.' + add edi, 3 + sub ecx, 3 + add edx, esi + sub edx, ecx +@@: + mov esi, edx +@@: + lodsb + stosb + dec ecx + test al, al + jnz @b +.header_created: + mov edx, [ebp + PanelData.top] + mov eax, [ebp + PanelData.left] + shr ecx, 1 + lea eax, [eax+ecx+3] + call get_console_ptr + mov ah, [panel_active_header_color] + cmp ebp, [active_panel] + jz @f + mov ah, [panel_header_color] +@@: + mov al, ' ' + stosw + mov esi, cur_header +@@: + lodsb + test al, al + jz @f + stosw + jmp @b +@@: + mov al, ' ' + stosw + mov edx, [ebp + PanelData.top] + inc edx + mov eax, [ebp + PanelData.left] + inc eax + call get_console_ptr + movzx eax, [ebp + PanelData.sortmode] + mov al, [compare_names+eax] + stosb + mov eax, [ebp + PanelData.selected_num] + test eax, eax + jz .skip_selected_info +; ଠ 뤥 䠩 + push dword [ebp + PanelData.selected_size+4] + push dword [ebp + PanelData.selected_size] + call fill_total_info + mov eax, [ebp + PanelData.width] + sub eax, 2 + cmp ecx, eax + jbe @f + mov ecx, eax + mov edi, saved_file_name+512 + sub edi, eax + mov byte [edi], '.' + mov word [edi+1], '..' +@@: + mov esi, edi + sub eax, ecx + shr eax, 1 + inc eax + add eax, [ebp + PanelData.left] + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + sub edx, 3 + call get_console_ptr + mov ah, [panel_numselected_color] +@@: + lodsb + stosw + loop @b +.skip_selected_info: +; ଠ 饬 ᫥ ࠧ 䠩 + mov eax, [ebp + PanelData.total_num] + push dword [ebp + PanelData.total_size+4] + push dword [ebp + PanelData.total_size] + call fill_total_info + mov eax, [ebp + PanelData.width] + sub eax, 2 + cmp ecx, eax + jbe @f + mov ecx, eax + mov byte [edi+ecx-3], '.' + mov word [edi+ecx-2], '..' +@@: + sub eax, ecx + shr eax, 1 + inc eax + add eax, [ebp + PanelData.left] + add edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + dec edx + mov esi, edi + call get_console_ptr + mov ah, [panel_number_color] +@@: + lodsb + stosw + loop @b + cmp [ebp + PanelData.numfiles], 0 + jz .skip_curinfo +; ଠ ⥪饬 䠩 + mov ebx, [ebp + PanelData.index] + mov eax, [ebp + PanelData.files] + mov ebx, [eax+ebx*4] + mov eax, [ebp + PanelData.left] + add eax, [ebp + PanelData.width] + dec eax + mov edx, [ebp + PanelData.top] + add edx, [ebp + PanelData.height] + dec edx + dec edx + call get_console_ptr + mov ecx, [ebp + PanelData.width] + dec ecx + dec ecx + cmp [ebp + PanelData.colmode], 3 + jz .show_curname +; ६ 䨪樨 + sub edi, 5*2 + sub ecx, 6 + mov al, [ebx+24+2] + aam + or ax, 0x3030 + mov [edi], ah + mov [edi+2], al + mov [edi+4], byte ':' + mov al, [ebx+24+1] + aam + or ax, 0x3030 + mov [edi+6], ah + mov [edi+8], al + mov al, [panel_normal_color] + mov [edi+1], al + mov [edi+3], al + mov [edi+5], al + mov [edi+7], al + mov [edi+9], al + dec edi + mov [edi], al + dec edi + mov byte [edi], ' ' +; 䨪樨 + sub edi, 8*2 + sub ecx, 9 + mov al, [ebx+28+0] + aam + or ax, 0x3030 + mov [edi], ah + mov [edi+2], al + mov [edi+4], byte '.' + mov al, [ebx+28+1] + aam + or ax, 0x3030 + mov [edi+6], ah + mov [edi+8], al + mov [edi+10], byte '.' + mov ax, [ebx+28+2] + div [_100] + mov al, ah + aam + or ax, 0x3030 + mov [edi+12], ah + mov [edi+14], al + mov al, [panel_normal_color] + mov [edi+1], al + mov [edi+3], al + mov [edi+5], al + mov [edi+7], al + mov [edi+9], al + mov [edi+11], al + mov [edi+13], al + mov [edi+15], al + dec edi + mov [edi], al + dec edi + mov [edi], byte ' ' +; + std + mov ah, [panel_normal_color] + dec edi + dec edi + dec ecx + test byte [ebx], 0x10 + jz .size_file + push ecx + mov esi, aFolder+aFolder.size-1 + mov ecx, aFolder.size + cmp word [ebx+40], '..' + jnz @f + cmp byte [ebx+42], 0 + jnz @f + mov esi, aUp+aUp.size-1 + mov cl, aUp.size +@@: + sub [esp], ecx +@@: + lodsb + stosw + loop @b + pop ecx + jmp .size_done +.size_file: + mov edx, [ebx+36] + test edx, edx + jz .size_less_4g + cmp edx, 10*256 + jae .size_tera +; + mov al, 'G' + shl edx, 2 + jmp .size_letter +.size_tera: +; ࠡ + shr edx, 8 + mov al, 'T' + jmp .size_letter +.size_less_4g: + mov edx, [ebx+32] + cmp edx, 10*(1 shl 20) + jae .size_mega + cmp edx, 1 shl 20 + jb .size_num + shr edx, 10 + mov al, 'K' + jmp .size_letter +.size_mega: + mov al, 'M' + shr edx, 20 +.size_letter: + stosw + dec ecx + mov al, ' ' + stosw + dec ecx +.size_num: + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, [panel_normal_color] + stosw + dec ecx + test edx, edx + jnz .size_num +.size_done: + cld +.show_curname: +; + sub edi, ecx + sub edi, ecx + lea esi, [ebx+40] +@@: + lodsb + test al, al + jnz @b + sub esi, ebx + sub esi, 41 + mov ah, [panel_normal_color] + cmp esi, ecx + lea edx, [ebx+40] + jbe @f + mov al, '{' + mov [edi-2], ax + add edx, esi + sub edx, ecx +@@: + mov esi, edx +@@: + lodsb + test al, al + jz @f + stosw + loop @b +@@: + mov al, ' ' + rep stosw +.skip_curinfo: + call draw_image + ret + +fill_total_info: + mov edi, saved_file_name+511 + mov byte [edi], ' ' +if lang eq ru_RU + mov byte [edi-1], '' + dec edi + cmp eax, 1 + jz @f + mov word [edi-1], '' + dec edi +@@: + mov dword [edi-4], '䠩' + mov byte [edi-5], ' ' + sub edi, 5 +else ; Default to en_US + cmp eax, 1 + jz @f + dec edi + mov byte [edi], 's' +@@: + mov dword [edi-4], 'file' + mov byte [edi-5], ' ' + sub edi, 5 +end if + xor edx, edx + push 10 + pop ecx +@@: + div ecx + dec edi + add dl, '0' + mov [edi], dl + xor edx, edx + test eax, eax + jnz @b +if lang eq ru_RU + mov dword [edi-4], ' ' + mov dword [edi-8], ' ' + sub edi, 8 +else ; Default to en_US + mov dword [edi-4], ' in ' + mov dword [edi-8], 'ytes' + mov word [edi-10], ' b' + sub edi, 10 +end if + lea esi, [edi-3] + mov edx, [esp+8] + mov eax, [esp+4] +.selsizel: + push edx + mov ebx, edx + xor edx, edx + add ebx, ebx + adc edx, edx + push ebx + push edx + add ebx, ebx + adc edx, edx + add ebx, [esp+4] + adc edx, [esp] + add esp, 8 + add eax, ebx + adc edx, 0 + div ecx + dec edi + cmp edi, esi + jae @f + mov byte [edi], ',' + dec edi + sub esi, 4 +@@: + pop ebx + add dl, '0' + mov byte [edi], dl + xchg eax, ebx + mul [muldiv10] + add eax, ebx + adc edx, 0 + mov ebx, eax + or ebx, edx + jnz .selsizel + dec edi + mov byte [edi], ' ' + mov ecx, saved_file_name+512 + sub ecx, edi + ret 8 + +align 4 +get_file_color: + mov ah, [esi + 6] + cmp ebp, [active_panel] + jnz @f + cmp ecx, [ebp + PanelData.index] + jnz @f + mov ah, [esi + 7] +@@: + test byte [esi + 303], 1 + jnz @f + mov ah, [esi + 4] + cmp ebp, [active_panel] + jnz @f + cmp ecx, [ebp + PanelData.index] + jnz @f + mov ah, [esi + 5] +@@: + ret + +align 4 +draw_name_column: + mov eax, [column_index] + mov [last_column_index], eax + mov edx, [ebp + PanelData.numfiles] + mov ecx, [column_height] + dec ecx +.l: + cmp [column_index], edx + jae .ret + push ecx + mov ecx, [column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + mov ebx, [esi] + call get_file_color + add esi, 40 + mov ecx, [column_width] + push edi +@@: + lodsb + test al, al + jz @f + stosw + loop @b + lodsb + test al, al + jz @f + mov byte [edi], '}' + jmp .continue +@@: + test bl, 10h + jnz .noalignext + mov ebx, [ebp + PanelData.colmode] +; sizeof(PanelMode) = 40 + lea ebx, [ebx+ebx*4] + cmp [colmodes+ebx*8+PanelMode.bAlignExtensions], 0 + jz .noalignext + push ecx + sub ecx, [column_width] + neg ecx + jz .noalignext2 + dec esi +@@: + dec esi + cmp byte [esi], '.' + loopnz @b + jnz .noalignext2 + inc esi + sub ecx, [column_width] + neg ecx + sub ecx, [esp] + sub edi, ecx + sub edi, ecx + dec ecx + mov ebx, [esp+4] + cmp ecx, 3 + ja @f + mov cl, 3 +@@: + sub ecx, [column_width] + sub ebx, edi + sar ebx, 1 + sub ebx, ecx + pop ecx + inc ecx + push 0 + cmp ecx, ebx + jbe @f + sub ecx, ebx + mov [esp], ecx + mov ecx, ebx +@@: + mov al, ' ' + rep stosw +@@: + lodsb + test al, al + jz .noalignext2 + stosw + jmp @b +.noalignext2: + pop ecx +.noalignext: + mov al, ' ' + rep stosw +.continue: + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [column_index] + pop ecx + dec ecx + jnz .l +.ret: + mov eax, [ebp + PanelData.colsz] + add [ebp + PanelData.colst], eax + cmp ebp, panel1 + jnz .ret2 +; ᫮ ࠭ +; calculate number of viewer and editor screens + xor ebx, ebx + xor edx, edx + mov ecx, [num_screens] + mov esi, [screens] +.3: + lodsd + cmp eax, viewer_vtable + jnz @f + inc ebx +@@: + cmp eax, editor_vtable + jnz @f + inc edx +@@: + lodsd + loop .3 + mov eax, ebx + mov esi, edx + or eax, edx + jz .ret2 + xor eax, eax + xor edx, edx + call get_console_ptr + mov al, '[' + stosb + mov al, [panel_nscreens_color] + stosb + xchg eax, ebx +.5: + push -'0' +@@: + xor edx, edx + div [_10d] + push edx + test eax, eax + jnz @b +@@: + pop eax + add eax, '0' + jz @f + stosb + mov al, bl + stosb + jmp @b +@@: + test esi, esi + jz .4 + mov al, '+' + stosb + mov al, bl + stosb + xor eax, eax + xchg eax, esi + jmp .5 +.4: + mov al, ']' + mov ah, [panel_nscreens_color] + stosw +.ret2: +draw_empty_column: + ret + +align 4 +draw_size_column: + add edi, [column_width] + add edi, [column_width] + dec edi + dec edi + std + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov ecx, [column_width] +@@: + mov ebx, eax + cmp word [esi+40], '..' + jnz .nodotdot + cmp byte [esi+42], 0 + jnz .nodotdot +if lang eq ru_RU + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + sub ecx, 5 +else ; Default to en_US + mov al, ' ' + stosw + stosw + mov al, 'p' + stosw + mov al, 'U' + stosw + sub ecx, 4 +end if + jmp .size_written +.nodotdot: + test byte [esi], 10h + jz .nofolder +if lang eq ru_RU + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + mov al, '' + stosw + sub ecx, 5 +else ; Default to en_US + mov al, 'r' + stosw + mov al, 'e' + stosw + mov al, 'd' + stosw + mov al, 'l' + stosw + mov al, 'o' + stosw + mov al, 'F' + stosw + sub ecx, 6 +end if + jmp .size_written +.nofolder: + mov eax, [esi+32] + mov edx, [esi+36] + test edx, edx + jz .less_4G + cmp edx, 10000/4*1024 + jb .giga + mov al, 'T' + shr edx, 10 + jmp .write_letter +.giga: + mov al, 'G' + shl edx, 2 + jmp .write_letter +.less_4G: + mov edx, eax + cmp eax, 1000000 + jb .byte + cmp eax, 10000*1024 + jb .kilo + mov al, 'M' + shr edx, 20 + jmp .write_letter +.kilo: + mov al, 'K' + shr edx, 10 +.write_letter: + mov ah, bh + stosw + mov al, ' ' + stosw + dec ecx + dec ecx +.byte: + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + stosw + dec ecx + test edx, edx + jnz .byte +.size_written: + mov eax, ebx + test ecx, ecx + jle @f + mov al, ' ' + rep stosw +@@: + mov byte [edi+1], ah + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +align 4 +draw_date_column: + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov bh, ah + mov byte [edi-1], bh + mov al, [esi+28] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, '.' + stosw + mov al, [esi+29] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, '.' + stosw + movzx eax, word [esi+30] + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + mov [edi+2], ax + xchg eax, edx + xor edx, edx + div [_10d] + xchg eax, edx + add al, '0' + mov ah, bh + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +align 4 +draw_time_column: + mov ecx, [column_height] + dec ecx + push [last_column_index] +.l: + mov edx, [ebp + PanelData.numfiles] + cmp [last_column_index], edx + jae .ret + push ecx + push edi + mov ecx, [last_column_index] + mov esi, [ebp + PanelData.files] + mov esi, [esi+ecx*4] + call get_file_color + mov bh, ah + mov byte [edi-1], bh + mov al, [esi+26] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + mov al, ':' + stosw + mov al, [esi+25] + aam + add eax, '00' + push eax + mov al, ah + mov ah, bh + stosw + pop eax + mov ah, bh + stosw + pop edi + add edi, [cur_width] + add edi, [cur_width] + inc [last_column_index] + pop ecx + dec ecx + jnz .l +.ret: + pop [last_column_index] + cld + ret + +;insert_last_dot: +; push eax esi +; mov ah, 0 +;.loop: +; lodsb +; test al, al +; jz .done +; cmp al, '.' +; jnz .loop +; mov ah, 1 +; jmp .loop +;.done: +; test ah, ah +; jnz @f +; mov byte [esi-1], '.' +; mov byte [esi], 0 +;@@: +; pop esi eax +; ret + +;delete_last_dot: +; push esi +;@@: +; cmp byte [esi], 0 +; jz @f +; inc esi +; jmp @b +;@@: +; cmp byte [esi-1], '.' +; jnz @f +; mov byte [esi-1], 0 +;@@: pop esi +; ret + +align 4 +read_folder: + mov eax, [ebp + PanelData.nfa] + mov [dirinfo.size], eax + shl eax, 2 + add eax, [ebp + PanelData.files] + mov [dirinfo.dirdata], eax + lea eax, [ebp + PanelData.dir] + mov [dirinfo.name], eax + xor eax, eax + mov [ebp + PanelData.total_num], eax + mov dword [ebp + PanelData.total_size], eax + mov dword [ebp + PanelData.total_size+4], eax + mov [ebp + PanelData.selected_num], eax + mov dword [ebp + PanelData.selected_size], eax + mov dword [ebp + PanelData.selected_size+4], eax +.retry: + mov eax, [ebp + PanelData.hPlugin] + test eax, eax + jz .native + mov ecx, [dirinfo.size] + test [ebp + PanelData.plugin_flags], 1 + jz @f + dec ecx ; reserve one entry for '..' +@@: + push ebp + push [dirinfo.dirdata] + push ecx + push 0 + push [ebp + PanelData.hFile] + call [eax + PluginInfo.ReadFolder] + pop ebp + mov ebx, [dirinfo.dirdata] + mov ebx, [ebx+4] + jmp .read +.native: + push SF_FILE + pop eax + mov ebx, dirinfo + int 40h +.read: + test eax, eax + jz .ok + cmp eax, 6 + jz .ok +; Failed to read folder, notify user + cmp [bSilentFolderMode], 0 + jnz .dont_notify + push dword aContinue + push dword aRetry + mov edx, esp + call get_error_msg + push [dirinfo.name] + push dword aCannotReadFolder + push eax + mov eax, esp + push edx + push 2 + push eax + push 3 + call SayErr + add esp, 5*4 + test eax, eax + jz .retry +.dont_notify: +; If not on plugin panel, try to return to previous directory + cmp [ebp + PanelData.hPlugin], 0 + jnz @f + mov esi, prev_dir + cmp byte [esi], 0 + jz @f + lea edi, [ebp + PanelData.dir] + mov ecx, 1024/4 + rep movsd + mov byte [prev_dir], 0 + ret +@@: + mov [bSilentFolderMode], 1 ; enter silent mode +; Try to read parent folder + mov esi, [dirinfo.name] + xor edx, edx +.up1: + lodsb + test al, al + jz .up1done + cmp al, '/' + jnz .up1 + inc edx + lea edi, [esi-1] + jmp .up1 +.up1done: + cmp [ebp + PanelData.hPlugin], 0 + jz .4 + cmp edx, 1 + ja .up +; ⥭ +; ⮬ 㦥 ୥ +; , 㭪 ⥭ 㫠 0 ⮢ +; (᫨ 㦥 室 "..", 㤥 ⮬᪨) + xor ebx, ebx ; 0 items read + mov eax, [dirinfo.dirdata] + mov [eax+8], ebx ; 0 items total + jmp .ok +.4: + cmp edx, 2 + jbe .noup +.up: + stosb + jmp read_folder +.noup: +; There is no parent folder, and we are not on plugin panel +; Try to read ramdisk + mov esi, [dirinfo.name] + mov edi, esi + lodsd + or eax, 0x00202000 + cmp eax, '/rd/' + jnz @f + lodsw + cmp ax, '1' + jz .nosetrd +@@: + mov eax, '/rd/' + stosd + mov ax, '1' + stosw + jmp read_folder +.nosetrd: +; ࠬ ⠫. , 졠... + and dword [ebp + PanelData.numfiles], 0 + and dword [ebp + PanelData.index], 0 + and dword [ebp + PanelData.start], 0 + mov [bSilentFolderMode], 0 ; leave silent mode + ret +.ok: + mov eax, [dirinfo.dirdata] + cmp [eax+8], ebx + jz .readdone + push dword [eax+8] + mov ecx, [ebp + PanelData.files] + call pgfree + pop ecx + add ecx, 0xF + and ecx, not 0xF + push ecx + imul ecx, 4+304 + add ecx, 32 + call xpgalloc + test eax, eax + jnz .succ1 + pop eax + jmp .readdone +.succ1: + mov [ebp + PanelData.files], eax + pop [ebp + PanelData.nfa] + mov [prev_dir], 0 + jmp read_folder +.readdone: + xor edx, edx + mov [ebp + PanelData.start], edx + mov [ebp + PanelData.index], edx + mov [ebp + PanelData.start], edx + mov edi, [ebp + PanelData.files] + mov eax, [ebp + PanelData.nfa] + lea eax, [edi + eax*4 + 32] + mov ecx, [eax-32+4] + test ecx, ecx + jz .loopdone +; 㥬 ᯥ樠 室, ᮮ⢥騥 '.' ⪥ ⮬ +.ptrinit: + cmp word [eax+40], '.' + jz .loopcont + test byte [eax], 8 + jnz .loopcont + mov byte [eax+303], 0 + test edx, edx + jnz .nodotdot + cmp word [eax+40], '..' + jnz .nodotdot + cmp byte [eax+42], 0 + jnz .nodotdot + mov edx, eax + push edi +@@: + cmp edi, [ebp + PanelData.files] + jbe @f + push dword [edi-4] + pop dword [edi] + sub edi, 4 + jmp @b +@@: + stosd + pop edi + scasd + jmp .dotdot +.nodotdot: + stosd + xor ebx, ebx + test byte [eax], 10h + setz bl + add [ebp + PanelData.total_num], ebx + mov ebx, dword [eax+32] + add dword [ebp + PanelData.total_size], ebx + mov ebx, dword [eax+36] + adc dword [ebp + PanelData.total_size+4], ebx +.dotdot: +; ᢥ⪠ +; call insert_last_dot + call highlight_init +; call delete_last_dot +.loopcont: + add eax, 304 + dec ecx + jnz .ptrinit +.loopdone: + push edi + sub edi, [ebp + PanelData.files] + shr edi, 2 + mov [ebp + PanelData.numfiles], edi + pop edi + test edx, edx + jnz @f + test [ebp + PanelData.plugin_flags], 1 + jz @f + mov ecx, [ebp + PanelData.numfiles] + inc [ebp + PanelData.numfiles] + lea esi, [edi-4] + std + rep movsd + cld + mov eax, left_dotdot_entry + cmp ebp, panel1 + jz .zq + add eax, right_dotdot_entry-left_dotdot_entry +.zq: + stosd + call highlight_init +@@: +; ஢ +sort_files: + movzx eax, [ebp + PanelData.sortmode] + mov ebx, [compare_fns + eax*4] +.mode: + mov edx, [ebp + PanelData.files] + mov ecx, [ebp + PanelData.numfiles] + jecxz .skip + mov eax, [edx] + cmp word [eax+40], '..' + jnz .nodotdot + cmp byte [eax+42], 0 + jnz .nodotdot + dec ecx + add edx, 4 +.nodotdot: + call sort +.skip: + mov [bSilentFolderMode], 0 ; leave silent mode + ret + +align 4 +highlight_init: + pushad + mov ebp, eax + lea esi, [ebp+40] + mov edi, lower_file_name + mov edx, edi + xor eax, eax +@@: + lodsb + mov al, [tolower_table+eax] + stosb + test al, al + jnz @b + mov esi, edx + lea edx, [edi-1] + xor ecx, ecx +.highlight_test_loop: + mov ebx, [highlight_groups+ecx*4] + mov al, [ebx + highlight.IncludeAttributes] + mov ah, [ebp] + and ah, al + cmp ah, al + jnz .highlight_test_failed + lea edi, [ebx + highlight.Mask] + call match_mask_rev_lowercase + jc .highlight_test_failed + mov ah, [ebx + highlight.NormalColor] + test ah, ah + jnz @f + mov ah, [panel_normal_color] +@@: + mov [ebp+4], ah + mov ah, [ebx + highlight.CursorColor] + test ah, ah + jnz @f + mov ah, [panel_cursor_color] +@@: + mov [ebp+5], ah + mov ah, [ebx + highlight.SelectedColor] + test ah, ah + jnz @f + mov ah, [panel_selected_color] +@@: + mov [ebp+6], ah + mov ah, [ebx + highlight.SelectedCursorColor] + test ah, ah + jnz @f + mov ah, [panel_selected_cursor_color] +@@: + mov [ebp+7], ah + jmp .doname +.highlight_test_failed: + inc ecx + cmp ecx, [highlight_num_groups] + jb .highlight_test_loop +.nohighlight: + mov ah, [panel_normal_color] + mov [ebp+4], ah + mov ah, [panel_cursor_color] + mov [ebp+5], ah + mov ah, [panel_selected_color] + mov [ebp+6], ah + mov ah, [panel_selected_cursor_color] + mov [ebp+7], ah +.doname: + popad + ret + +align 4 +compare_name: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + jmp strcmpi +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +compare_name_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +strcmpi: + push eax +@@: + lodsb + call match_symbol + jnz .ret + inc edi + test al, al + jnz @b +.ret: + pop eax + ret + +align 4 +compare_ext: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + push esi edi + call seek_ext + xchg esi, edi + call seek_ext + xchg esi, edi + call strcmpi + jnz .ret + pop edi esi + jmp strcmpi +.ret: + pop edi esi + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_ext_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + add esi, 40 + add edi, 40 + push esi edi + call seek_ext + xchg esi, edi + call seek_ext + call strcmpi + jnz .ret + pop edi esi + xchg esi, edi + jmp strcmpi +.ret: + pop edi esi + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +seek_ext: + push eax + xor eax, eax +.l: + inc esi + cmp byte [esi-1], '.' + jnz @f + mov eax, esi +@@: + cmp byte [esi-1], 0 + jnz .l + test eax, eax + jnz @f + lea eax, [esi-1] +@@: + mov esi, eax + pop eax + ret + +align 4 +compare_modified: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+28] + cmp edi, [esi+28] + pop edi + jnz @f + push edi + mov edi, [edi+24] + cmp edi, [esi+24] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_modified_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+28] + cmp esi, [edi+28] + pop esi + jnz @f + push esi + mov esi, [esi+24] + cmp esi, [edi+24] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_size: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+36] + cmp edi, [esi+36] + pop edi + jnz @f + push edi + mov edi, [edi+32] + cmp edi, [esi+32] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_size_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+36] + cmp esi, [edi+36] + pop esi + jnz @f + push esi + mov esi, [esi+32] + cmp esi, [edi+32] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_unordered: + cmp esi, edi + ret +compare_unordered_rev: + cmp edi, esi + ret + +align 4 +compare_created: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+12] + cmp edi, [esi+12] + pop edi + jnz @f + push edi + mov edi, [edi+8] + cmp edi, [esi+8] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_created_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+12] + cmp esi, [edi+12] + pop esi + jnz @f + push esi + mov esi, [esi+8] + cmp esi, [edi+8] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_accessed: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push edi + mov edi, [edi+20] + cmp edi, [esi+20] + pop edi + jnz @f + push edi + mov edi, [edi+16] + cmp edi, [esi+16] + pop edi + jnz @f + add esi, 40 + add edi, 40 + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +compare_accessed_rev: + test byte [esi], 10h + jnz .1dir + test byte [edi], 10h + jnz .greater +.eq1: + push esi + mov esi, [esi+20] + cmp esi, [edi+20] + pop esi + jnz @f + push esi + mov esi, [esi+16] + cmp esi, [edi+16] + pop esi + jnz @f + add esi, 40 + add edi, 40 + xchg esi, edi + jmp strcmpi +@@: + ret +.greater: + test esi, esi + ret +.1dir: + test byte [edi], 10h + jnz .eq1 +.less: + xor edi, edi + stc + ret + +align 4 +ReadFolder_default: + mov eax, 2 + ret 10h + +if 0 +; Following subroutines work, but are slow +match_mask: +; in: esi->name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edi +.main_cycle: + push esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, '|' + jnz @b +@@: + mov [esi-1], byte 0 + xchg esi, [esp] + call match_single_mask + pop esi + mov [esi-1], al + jnc .found + cmp al, ',' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + push esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jnz @b +@@: + mov byte [esi-1], 0 + xchg esi, [esp] + call match_single_mask + pop esi + mov [esi-1], al + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask: +; in: esi->mask, edi->name +; out: CF clear <=> match + pusha +.mask_symbol: + lodsb + test al, al + jz .mask_done + cmp al, '*' + jz .asterisk + cmp al, '?' + jz .quest + cmp al, '[' + jz .list + call match_symbol + jnz .done_fail + inc edi + jmp .mask_symbol +.done_fail: + stc + popa + ret +.mask_done: + scasb + jnz .done_fail +.done_succ: + clc + popa + ret +.quest: + mov al, 0 + scasb + jz .done_fail + jmp .mask_symbol +.list: + lodsb + cmp al, ']' + jz .done_fail + cmp byte [esi+1], '-' + jz .range + call match_symbol + jnz .list +.listok: + inc edi +@@: + lodsb + cmp al, ']' + jnz @b + jmp .mask_symbol +.range: + call match_symbol + ja @f + mov al, [esi+2] + call match_symbol + jae .listok +@@: + inc esi + jmp .list +.asterisk: + cmp byte [esi], 0 + jz .done_succ + cmp byte [esi], '?' + jnz @f + mov al, 0 + scasb + jz .done_fail + inc esi + jmp .asterisk +@@: + cmp byte [esi], '[' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi] +@@: + cmp byte [edi], 0 + jz .done_fail + call match_symbol + jz @f + inc edi + jmp @b +@@: + inc edi + inc esi + call match_single_mask + jnc .done_succ + dec esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask + jnc @f + mov al, 0 + scasb + jnz @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ + +match_mask_rev: +; in: esi->name, edx->end of name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edx + xchg esi, edi +.main_cycle: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, '|' + jnz @b +@@: + dec esi + mov [esi], byte 0 + call match_single_mask_rev2 + mov [esi], al + inc esi + jnc .found + cmp al, ',' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jnz @b +@@: + dec esi + mov byte [esi], 0 + call match_single_mask_rev2 + mov [esi], al + inc esi + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask_rev2: + pusha + jmp match_single_mask_rev.mask_symbol +match_single_mask_rev: +; in: esi->mask, edi->end of name, edx->start of name +; out: CF clear <=> match + pusha + mov ecx, esi +@@: + lodsb + test al, al + jnz @b + dec esi +; esi->end of mask, ecx->start of mask +.mask_symbol: + dec esi + cmp esi, ecx + jb .mask_done + mov al, [esi] + cmp al, '*' + jz .asterisk + cmp al, '?' + jz .quest + cmp al, ']' + jz .list + dec edi + cmp edi, edx + jb .done_fail + call match_symbol + jz .mask_symbol +.done_fail: + stc + popa + ret +.mask_done: + cmp edi, edx + jnz .done_fail +.done_succ: + clc + popa + ret +.quest: + dec edi + cmp edi, edx + jb .done_fail + jmp .mask_symbol +.list: + dec edi + cmp edi, edx + jb .done_fail +.list_check: + dec esi + cmp esi, ecx + jbe .done_fail + mov al, [esi] + cmp al, '[' + jz .done_fail + cmp byte [esi-1], '-' + jz .range + call match_symbol + jnz .list_check +.listok: +@@: + dec esi + cmp esi, ecx + jb .done_fail + cmp byte [esi], '[' + jnz @b + jmp .mask_symbol +.range: + call match_symbol + jb @f + mov al, [esi-2] + call match_symbol + jbe .listok +@@: + dec esi + dec esi + jmp .list_check +.asterisk: + cmp esi, ecx + jz .done_succ + cmp byte [esi-1], '?' + jnz @f + cmp edi, edx + jz .done_fail + dec esi + jmp .asterisk +@@: + cmp byte [esi-1], ']' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi-1] +@@: + cmp edi, edx + jz .done_fail + call match_symbol + jz @f + dec edi + jmp @b +@@: + dec edi + dec esi + call match_single_mask_rev2 + jnc .done_succ + inc esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask_rev2 + jnc @f + dec edi + cmp edi, edx + jae @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ +end if + +;tolower: +; push ecx +; movzx ecx, al +; mov al, [tolower_table+ecx] +; pop ecx +; ret + +match_symbol: +; in: al,[edi]=symbols +; out: flags as 'cmp al,[edi]' + push eax ecx + movzx ecx, al + mov al, [tolower_table+ecx] + movzx ecx, byte [edi] + cmp al, [tolower_table+ecx] + pop ecx eax + ret + +match_mask_rev_lowercase: +; in: esi->name, edx->end of name, edi->mask +; out: CF clear <=> match + pusha + xchg esi, edx + xchg esi, edi +.main_cycle: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, ';' + jz @f + cmp al, '|' + jnz @b +@@: + dec esi + mov [esi], byte 0 + call match_single_mask_rev_lowercase + mov [esi], al + inc esi + jnc .found + cmp al, ',' + jz .main_cycle + cmp al, ';' + jz .main_cycle +.done_fail: + stc + popa + ret +.found: + test al, al + jz .done_succ + cmp al, '|' + jz .test_exclude + lodsb + jmp .found +.done_succ: + clc + popa + ret +.test_exclude: + mov ecx, esi +@@: + lodsb + test al, al + jz @f + cmp al, ',' + jz @f + cmp al, ';' + jnz @b +@@: + dec esi + mov byte [esi], 0 + call match_single_mask_rev_lowercase + mov [esi], al + inc esi + jnc .done_fail + test al, al + jz .done_succ + jmp .test_exclude + +match_single_mask_rev_lowercase: +; in: esi->end of mask, ecx->start of mask, edi->end of name, edx->start of name +; out: CF clear <=> match + push esi edi eax +.mask_symbol: + dec esi + cmp esi, ecx + jb .mask_done + mov al, [esi] + cmp al, '*' + jz .asterisk + dec edi + cmp edi, edx + jb .done_fail + cmp al, '?' + jz .mask_symbol + cmp al, ']' + jz .list_check + cmp al, [edi] + jz .mask_symbol +.done_fail: + stc + pop eax edi esi + ret +.mask_done: + cmp edi, edx + jnz .done_fail +.done_succ: + clc + pop eax edi esi + ret +.list_check: + dec esi + cmp esi, ecx + jbe .done_fail + mov al, [esi] + cmp al, '[' + jz .done_fail + cmp byte [esi-1], '-' + jz .range + cmp al, [edi] + jnz .list_check +.listok: +@@: + dec esi + cmp esi, ecx + jb .done_fail + cmp byte [esi], '[' + jnz @b + jmp .mask_symbol +.range: + cmp al, [edi] + jb @f + mov al, [esi-2] + cmp al, [edi] + jbe .listok +@@: + dec esi + dec esi + jmp .list_check +.asterisk: + cmp esi, ecx + jz .done_succ + cmp byte [esi-1], '?' + jnz @f + cmp edi, edx + jz .done_fail + dec esi + dec edi + jmp .asterisk +@@: + cmp byte [esi-1], ']' + jz .asterisk_common +; the mask is ...*... +.asterisk_normal: + mov al, [esi-1] +@@: + dec edi + cmp edi, edx + jb .done_fail + cmp al, [edi] + jnz @b +@@: + dec esi + call match_single_mask_rev_lowercase + jnc .done_succ + inc esi + jmp .asterisk_normal +.asterisk_common: + push edi +@@: + call match_single_mask_rev_lowercase + jnc @f + dec edi + cmp edi, edx + jae @b + pop edi + jmp .done_fail +@@: + pop edi + jmp .done_succ + +find_extension: + lea esi, [ecx+40] + push esi +@@: + lodsb + test al, al + jnz @b +@@: + dec esi + cmp byte [esi], '.' + jz .found_ext + cmp esi, [esp] + ja @b +; empty extension + pop esi + stc + ret +.found_ext: + inc esi + mov edi, [associations] + test edi, edi + jz .notfound +.find_loop: + push esi edi + call strcmpi + pop edi esi + pushf +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + popf + jz .found +@@: + inc edi + cmp byte [edi-1], 0 + jnz @b + cmp byte [edi], 0 + jnz .find_loop +.notfound: +; unknown extension + stc +.found: + pop esi + ret + +header db 'Kolibri Far ',version,0 + +nomem_draw db 'No memory for redraw.',0 +.size = $ - nomem_draw + +def_left_dir db '/sys',0 +def_right_dir db '/hd0/1',0 + +bSilentFolderMode db 1 + +bQuickSearchMode db 0 +bDisplayQuickSearch db 0 + +if lang eq ru_RU +aFolder db '' +.size = $-aFolder +aUp db '' +.size = $-aUp +aDrive db '',0 +aScreens db '࠭',0 +else ; Default to en_US +aFolder db 'Folder' +.size = $-aFolder +aUp db 'Up' +.size = $-aUp +aDrive db 'Drive',0 +aScreens db 'Screens',0 +end if + +align 4 +_10d dd 10 +_100d dd 100 +muldiv10 dd 429496729 +_10 db 10 +_100 db 100 + +fpu_cw dw 000011100111111b + +keybar_panels: +if lang eq ru_RU +; -䨪஢ + db '' + db '짌' + db ' ' + db '' + db ' ' + db '७ ' + db ' ' + db '' + db '䌭' + db '室 ' + db '㫨' + db '࠭' +; Shift + db '' + db 'ᯠ' + db '劮' + db '.' + db ' ' + db '२' + db ' ' + db '' + db '࠭' + db '᫤' + db '㯯' + db '࠭' +; Ctrl + db ' ' + db 'ࠢ' + db ' ' + db '' + db ' ' + db '' + db '' + db '' + db '' + db 'ᠭ' + db '' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db 'ࠢ' + db '.' + db ' ' + db '' + db ' ' + db '᪠' + db ' ' + db ' ' + db 'ॢ' + db ' ' + db '⏠' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䏫' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'UserMn' + db 'View ' + db 'Edit ' + db 'Copy ' + db 'RenMov' + db 'MkFold' + db 'Delete' + db 'ConfMn' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db 'Add ' + db 'Extrct' + db 'ArcCmd' + db 'Edit..' + db 'Copy ' + db 'Rename' + db ' ' + db 'Delete' + db 'Save ' + db 'Last ' + db 'Group ' + db 'SelUp ' +; Ctrl + db 'Left ' + db 'Right ' + db 'Name ' + db 'Extens' + db 'Modifn' + db 'Size ' + db 'Unsort' + db 'Creatn' + db 'Access' + db 'Descr ' + db 'Owner ' + db 'Sort ' +; Ctrl+Shift + db ' ' + db ' ' + db 'View ' + db 'Edit ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db 'Left ' + db 'Right ' + db 'View..' + db ' ' + db 'Print ' + db 'MkLink' + db 'Find ' + db 'Histry' + db 'Video ' + db 'Tree ' + db 'ViewHs' + db 'FoldHs' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'ConfPl' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + +keybar_viewer: +if lang eq ru_RU +; -䨪஢ + db '' + db '' + db '室 ' + db ' ' + db ' ' + db '' + db ' ' +keybar_cp: + db 'cp1251' + db ' ' + db '室 ' + db '㫨' + db '࠭' +; Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db '' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db '३' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䨣' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'Unwrap' + db 'Quit ' + db 'Hex ' + db ' ' + db 'Edit ' + db 'Search' +keybar_cp: + db 'cp1251' + db ' ' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db ' ' + db 'WWrap ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Next ' + db 'Table ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'GoFile' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db 'Print ' + db ' ' + db 'Prev ' + db 'Goto ' + db 'Video ' + db ' ' + db 'ViewHs' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Config' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + +keybar_editor: +if lang eq ru_RU +; -䨪஢ + db '' + db '࠭' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +keybar_cp2: + db 'cp1251' + db ' ' + db '室 ' + db '㫨' + db '࠭' +; Shift + db ' ' + db '.' + db ' ' + db '.' + db ' ' + db ' ' + db '' + db '' + db ' ' + db '' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db 'ப' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db '䨣' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' + +else ; Default to en_US +; No modificators + db 'Help ' + db 'Save ' + db ' ' + db ' ' + db ' ' + db 'View ' + db 'Search' +keybar_cp2: + db 'cp1251' + db ' ' + db 'Quit ' + db 'Plugin' + db 'Screen' +; Shift + db ' ' + db 'SaveAs' + db ' ' + db 'Edit..' + db ' ' + db ' ' + db 'Next ' + db 'Table ' + db ' ' + db 'SaveQ ' + db ' ' + db ' ' +; Ctrl + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Replac' + db ' ' + db ' ' + db 'GoFile' + db ' ' + db ' ' +; Ctrl+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' +; Alt + db ' ' + db ' ' + db ' ' + db ' ' + db 'Print ' + db ' ' + db ' ' + db 'Goto ' + db 'Video ' + db ' ' + db 'ViewHs' + db ' ' +; Alt+Shift + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db 'Config' + db ' ' + db ' ' + db ' ' +; Alt+Ctrl +times 12 db ' ' +; Alt+Ctrl+Shift +times 12 db ' ' +end if + + align 4 +cur_width dd 80 +cur_height dd 25 +saved_width dd -1 +saved_height dd -1 +fill_width dd 0 ;⮪ ਭ ਭ +fill_height dd 0 +max_width = 256 +max_height = 256 +console_data_ptr dd 0 + +cursor_x dd -1 +cursor_y dd -1 +cursor_size dd cursor_normal_size +cur_cursor_pos dd -1 +old_cursor_pos dd -1 + +idle_interval dd -1 + +active_panel dd panel1 + +associations dd 0 +associations_size dd 1 ; terminating zero +associations_allocated dd 0x1000 ; start with one page + +console_colors dd 0x000000, 0x000080, 0x008000, 0x008080 + dd 0x800000, 0x800080, 0x808000, 0xC0C0C0 + dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF + dd 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF + +compare_fns dd compare_name + dd compare_name_rev + dd compare_ext + dd compare_ext_rev + dd compare_modified + dd compare_modified_rev + dd compare_size + dd compare_size_rev + dd compare_unordered + dd compare_unordered_rev + dd compare_created + dd compare_created_rev + dd compare_accessed + dd compare_accessed_rev + +ctrlkey_tests dd ctrlkey_test0 + dd ctrlkey_test1 + dd ctrlkey_test2 + dd ctrlkey_test3 + dd ctrlkey_test4 +ctrlkey_tests_num = 5 + +virtual at 0 +screen_vtable: + .OnRedraw dd ? + .OnActivate dd ? + .OnIdle dd ? + .OnKey dd ? + .keybar dd ? + .getname dd ? + .OnExit dd ? + .IsHandleUsed dd ? +end virtual + +panels_vtable: + dd panels_OnRedraw + dd 0 + dd 0 + dd panels_OnKey + dd keybar_panels + dd panels_getname + dd panels_OnExit + dd panels_IsHandleUsed + +viewer_vtable: + dd viewer_OnRedraw + dd 0 + dd 0 + dd viewer_OnKey + dd keybar_viewer + dd viewer_getname + dd viewer_OnExit + dd viewer_IsHandleUsed + +editor_vtable: + dd editor_OnRedraw + dd 0 + dd 0 + dd editor_OnKey + dd keybar_editor + dd editor_getname + dd editor_OnExit + dd editor_IsHandleUsed + +filesearch_vtable: + dd filesearch_OnRedraw + dd filesearch_OnActivate + dd filesearch_OnIdle + dd filesearch_OnKey + dd 0 + dd filesearch_getname + dd filesearch_OnExit + dd filesearch_IsHandleUsed + +; additions to this table require changes in tools.inc::get_error_msg +errors1: + dd error0msg + dd error1msg + dd error2msg + dd error3msg + dd error4msg + dd error5msg + dd error6msg + dd error7msg + dd error8msg + dd error9msg + dd error10msg + dd error11msg +errors2: + dd error30msg + dd error31msg + dd error32msg + +encodings: +.cp866 = 0 +.cp1251 = 1 +.koi8r = 2 +.unicode = 3 + +.names: + db 'cp866 ' + db 'cp1251 ' + db 'koi8-r ' + db 'Unicode ' + +.tables: +; cp866 - trivial map + times 128 db %+127 +; cp1251 + db 0x3F,0x3F,0x27,0x3F,0x22,0x3A,0xC5,0xD8,0x3F,0x25,0x3F,0x3C,0x3F,0x3F,0x3F,0x3F + db 0x3F,0x27,0x27,0x22,0x22,0x07,0x2D,0x2D,0x3F,0x54,0x3F,0x3E,0x3F,0x3F,0x3F,0x3F + db 0xFF,0xF6,0xF7,0x3F,0xFD,0x3F,0xB3,0x15,0xF0,0x63,0xF2,0x3C,0xBF,0x2D,0x52,0xF4 + db 0xF8,0x2B,0x49,0x69,0x3F,0xE7,0x14,0xFA,0xF1,0xFC,0xF3,0x3E,0x3F,0x3F,0x3F,0xF5 + times 0x30 db %-1+0x80 + times 0x10 db %-1+0xE0 +; koi8-r + db 0xC4,0xB3,0xDA,0xBF,0xC0,0xD9,0xC3,0xB4,0xC2,0xC1,0xC5,0xDF,0xDC,0xDB,0xDD,0xDE + db 0xB0,0xB1,0xB2,0xF4,0xFE,0xF9,0xFB,0xF7,0xF3,0xF2,0xFF,0xF5,0xF8,0xFD,0xFA,0xF6 + db 0xCD,0xBA,0xD5,0xF1,0xD6,0xC9,0xB8,0xB7,0xBB,0xD4,0xD3,0xC8,0xBE,0xBD,0xBC,0xC6 + db 0xC7,0xCC,0xB5,0xF0,0xB6,0xB9,0xD1,0xD2,0xCB,0xCF,0xD0,0xCA,0xD8,0xD7,0xCE,0xFC + db 0xEE,0xA0,0xA1,0xE6,0xA4,0xA5,0xE4,0xA3,0xE5,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE + db 0xAF,0xEF,0xE0,0xE1,0xE2,0xE3,0xA6,0xA2,0xEC,0xEB,0xA7,0xE8,0xED,0xE9,0xE7,0xEA + db 0x9E,0x80,0x81,0x96,0x84,0x85,0x94,0x83,0x95,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E + db 0x8F,0x9F,0x90,0x91,0x92,0x93,0x86,0x82,0x9C,0x9B,0x87,0x98,0x9D,0x99,0x97,0x9A + +.menu: + db .cp866 +.menu.1: + dd .menu.2 + dd 0 +if lang eq ru_RU + db '&DOS ⥪ (CP866)',0 +else ; Default to en_US + db '&DOS text (CP866)',0 +end if + db .cp1251 +.menu.2: + dd .menu.3 + dd .menu.1 +if lang eq ru_RU + db '&Windows ⥪ (CP1251)',0 +else ; Default to en_US + db '&Windows text (CP1251)',0 +end if + db .koi8r +.menu.3: + dd .menu.4 + dd .menu.2 +if lang eq ru_RU + db '&Linux ⥪ (KOI8-R)',0 +else ; Default to en_US + db '&Linux text (KOI8-R)',0 +end if + db .unicode +.menu.4: + dd 0 + dd .menu.3 + db '&Unicode',0 + +active_screen dd 0 +viewer_tabsize dd 8 +editor_tabsize dd 8 + +ascii2scan: + times 32 db 0 + db 0x39,0x02,0x03,0x04,0x05,0x06,0x08,0x28,0x0A,0x0B,0x09,0x0D,0x33,0x0C,0x34,0x35 + db 0x0B,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x27,0x27,0x33,0x0D,0x34,0x35 + db 0x03,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 + db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x07,0x0C + db 0x29,0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18 + db 0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,0x1A,0x2B,0x1B,0x29,0x00 + db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 + db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C + db 0x21,0x33,0x20,0x16,0x26,0x14,0x27,0x19,0x30,0x10,0x13,0x25,0x2F,0x15,0x24,0x22 + times 48 db 0 + db 0x23,0x2E,0x31,0x12,0x1E,0x1A,0x11,0x2D,0x17,0x18,0x1B,0x1F,0x32,0x28,0x34,0x2C + db 0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +scan2ascii: + db 0,0,'1234567890-=',0,0 + db 'qwertyuiop[]',0,0,'as' + db 'dfghjkl;',27h,'`',0,'\zxcv' + db 'bnm,./',0,0,0,' ',0,0,0,0,0,0 + +;⠡ 㭪権: mouse_panels, mouse_viewer mouse_editor 冷 㣮 +align 4 +mouse_panels: + dd 0 ;f1 + dd 0 ;f2 + dd panels_OnKey.f3 + dd panels_OnKey.f4 + dd panels_OnKey.f5 + dd 0 ;f6 + dd panels_OnKey.f7 + dd panels_OnKey.f8 + dd 0 + dd exit ;f10 + dd 0 + dd F12 +; Shift + rd 4 + dd panels_OnKey.shift_f5 + rd 7 +.ctrl: + rd 2 +repeat 9-3+1 + dd panels_OnKey.ctrl_f3_9 +end repeat + rd 3 +; Ctrl+Shift + rd 12 +.alt: + dd panels_OnKey.alt_f1_2 + dd panels_OnKey.alt_f1_2 + rd 4 + dd panels_OnKey.alt_f7 + rd 5 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +mouse_viewer: + rd 1 + dd viewer_OnKey.f2 + dd viewer_OnKey.exit ;f3 + dd viewer_OnKey.f4 + rd 2 + dd viewer_OnKey.f7 + dd viewer_OnKey.f8 + rd 1 + dd viewer_OnKey.exit ;f10 + rd 1 + dd F12 +; Shift + rd 6 + dd viewer_OnKey.shift_f7 + rd 5 +; Ctrl + rd 12 +; Ctrl+Shift + rd 12 +; Alt + rd 12 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +mouse_editor: + rd 1 + dd editor_OnKey.f2 + rd 4 + dd editor_OnKey.f7 + rd 2 + dd editor_OnKey.exit_confirm ;f10 + rd 1 + dd F12 +; Shift + rd 6 + dd editor_OnKey.shift_f7 + rd 5 +; Ctrl + rd 12 +; Ctrl+Shift + rd 12 +; Alt + rd 12 +; Alt+Shift + rd 12 +; Alt+Ctrl + rd 12 +; Alt+Ctrl+Shift + rd 12 + +; ⠭ +; db scancode, reserved +; dw ctrlstate +; dd handler +; ctrlstate: 訥 4 - Shift, ᫥騥 - Ctrl, ᫥騥 - Alt +; 0 = +; 1 = ஢ +; 2 = +; 3 = , ࠢ +; 4 = ࠢ , +panels_ctrlkeys: + dw 0x48, 0 + dd panels_OnKey.up + dw 0x50, 0 + dd panels_OnKey.down + dw 0x4B, 0 + dd panels_OnKey.left + dw 0x4D, 0 + dd panels_OnKey.right + dw 0x51, 0 + dd panels_OnKey.pgdn + dw 0x49, 0 + dd panels_OnKey.pgup + dw 0xF, 0 + dd panels_OnKey.tab + dw 0x47, 0 + dd panels_OnKey.home + dw 0x4F, 0 + dd panels_OnKey.end + dw 0x1C, 0 + dd panels_OnKey.enter + dw 0x3D, 0 + dd panels_OnKey.f3 + dw 0x3E, 0 + dd panels_OnKey.f4 + dw 0x3F, 0 + dd panels_OnKey.f5 + dw 0x3F, 1 + dd panels_OnKey.shift_f5 + dw 0x41, 0 + dd panels_OnKey.f7 + dw 0x41, 0x100 + dd panels_OnKey.alt_f7 + dw 0x42, 0 + dd panels_OnKey.f8 + dw 0x43, 0x100 + dd alt_f9 + dw 0x44, 0 + dd exit + dw 0x5D, 0 + dd panels_OnKey.menu +repeat 9-3+1 + dw 0x3D+%-1, 0x10 + dd panels_OnKey.ctrl_f3_9 +end repeat + dw 0x3B, 0x100 + dd panels_OnKey.alt_f1_2 + dw 0x3C, 0x100 + dd panels_OnKey.alt_f1_2 + dw 0x58, 0 + dd F12 + dw 0x13, 0x10 + dd panels_OnKey.ctrl_r + dw 2, 0x30 + dd panels_OnKey.change_mode + dw 3, 0x30 + dd panels_OnKey.change_mode + dw 4, 0x30 + dd panels_OnKey.change_mode + dw 5, 0x30 + dd panels_OnKey.change_mode +repeat 10 + dw %+1, 0x40 + dd panels_OnKey.quick_jump +end repeat + dw 0x52, 0 + dd panels_OnKey.insert + dw 0x4E, 0 + dd panels_OnKey.greyplus + dw 0x4A, 0 + dd panels_OnKey.greyminus + dw 0x37, 0 + dd panels_OnKey.greyasterisk + db 0 + +viewer_ctrlkeys: + dw 1, 0 + dd viewer_OnKey.exit + dw 0x51, 0 + dd viewer_OnKey.pgdn + dw 0x49, 0 + dd viewer_OnKey.pgup + dw 0x50, 0 + dd viewer_OnKey.down + dw 0x48, 0 + dd viewer_OnKey.up + dw 0x4B, 0 + dd viewer_OnKey.left + dw 0x4B, 0x10 + dd viewer_OnKey.ctrl_left + dw 0x4B, 0x11 + dd viewer_OnKey.ctrl_shift_left + dw 0x4C, 0 + dd viewer_OnKey.exit + dw 0x4D, 0 + dd viewer_OnKey.right + dw 0x4D, 0x10 + dd viewer_OnKey.ctrl_right + dw 0x4D, 0x11 + dd viewer_OnKey.ctrl_shift_right + dw 0x3C, 0 + dd viewer_OnKey.f2 + dw 0x3D, 0 + dd viewer_OnKey.exit + dw 0x3E, 0 + dd viewer_OnKey.f4 + dw 0x41, 0 + dd viewer_OnKey.f7 + dw 0x41, 1 + dd viewer_OnKey.shift_f7 + dw 0x42, 0 + dd viewer_OnKey.f8 + dw 0x42, 1 + dd viewer_OnKey.shift_f8 + dw 0x44, 0 + dd viewer_OnKey.exit + dw 0x47, 0 + dd viewer_OnKey.home + dw 0x4F, 0 + dd viewer_OnKey.end + dw 0x58, 0 + dd F12 + dw 0x43, 0x100 + dd alt_f9 + db 0 + +editor_ctrlkeys: + dw 1, 0 + dd editor_OnKey.exit_confirm + dw 0x0E, 0 + dd editor_OnKey.backspace + dw 0x3C, 0 + dd editor_OnKey.f2 + dw 0x41, 0 + dd editor_OnKey.f7 + dw 0x41, 1 + dd editor_OnKey.shift_f7 + dw 0x43, 0x100 + dd alt_f9 + dw 0x44, 0 + dd editor_OnKey.exit_confirm + dw 0x44, 1 + dd editor_OnKey.exit_save + dw 0x47, 0 + dd editor_OnKey.home + dw 0x48, 0 + dd editor_OnKey.up + dw 0x49, 0 + dd editor_OnKey.pgup + dw 0x4B, 0 + dd editor_OnKey.left + dw 0x4D, 0 + dd editor_OnKey.right + dw 0x4F, 0 + dd editor_OnKey.end + dw 0x50, 0 + dd editor_OnKey.down + dw 0x51, 0 + dd editor_OnKey.pgdn + dw 0x52, 0 + dd editor_OnKey.ins + dw 0x53, 0 + dd editor_OnKey.del + dw 0x58, 0 + dd F12 + dw 0xF, 0x100 ; Alt+Tab + dd dummy_key + dw 0xF, 0x101 ; Shift+Alt+Tab + dd dummy_key + db 0 + +dummy_key: + ret + +dirinfo: + dd 1 +.first dd 0 + dd 0 +.size dd 300 +.dirdata dd 0 + db 0 +.name dd 0 + +readinfo: + dd 0 +.first dq 0 +.size dd 0 +.data dd 0 + db 0 +.name dd 0 + +writeinfo: +.code dd 2 +.first dq 0 +.size dd 0 +.data dd 0 + db 0 +.name dd 0 + +attrinfo: + dd 5 + dd 0 + dd 0 + dd 0 + dd .attr + db 0 +.name dd 0 + +delinfo: + dd 8 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd execdata + +mkdirinfo: + dd 9 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd CopyDestEditBuf+12 + +if lang eq ru_RU +compare_names db 'ᑤ' +else ; Default to en_US +compare_names db 'nNxXmMsSuUcCaA' +end if + +; 稭 䨣樮 - ⥪饩 ॠ樨 ୨ + +; +panel_normal_color db 1Bh +panel_selected_color db 1Eh +panel_border_color db 1Bh +panel_cursor_color db 30h +panel_selected_cursor_color db 3Eh +panel_header_color db 1Bh +panel_active_header_color db 30h +column_header_color db 1Eh +panel_number_color db 1Bh +panel_numselected_color db 3Eh +panel_nscreens_color db 0Bh +; +dialog_colors: +dialog_main_color db 70h +dialog_border_color db 70h +dialog_header_color db 70h +dialog_edit_color db 30h +dialog_unmodified_edit_color db 38h +dialog_normal_btn_color db 70h +dialog_selected_btn_color db 30h +dialog_list_color db 70h +dialog_selected_list_color db 0Fh +dialog_scroll_list_color db 70h +; ।० 訡 +warning_colors: +; !!! ⮬ 浪, !!! +warning_main_color db 4Fh +warning_border_color db 4Fh +warning_header_color db 4Fh +warning_edit_color db 30h +warning_unmodified_edit_color db 38h +warning_normal_btn_color db 4Fh +warning_selected_btn_color db 70h +warning_list_color db 3Fh +warning_selected_list_color db 70h +warning_scroll_list_color db 3Fh +; +menu_normal_color db 3Fh +menu_selected_color db 0Fh +menu_highlight_color db 3Eh +menu_selected_highlight_color db 0Eh +menu_border_color db 3Fh +menu_header_color db 3Fh +menu_scrollbar_color db 3Fh +; +keybar_number_color db 7 +keybar_name_color db 30h +keybar_bgr_color db 7 +; ப +cmdbar_normal_color db 7 +cmdbar_prefix_color db 7 +; ᬮ騪 +view_normal_color db 1Bh +view_selected_color db 30h +view_status_color db 30h +view_arrows_color db 1Eh +; +edit_normal_color db 1Bh +edit_status_color db 30h + +; ᢥ⪠ 䠩 +highlight_num_groups dd 10 +highlight_groups dd highlight_group0 + dd highlight_group1 + dd highlight_group2 + dd highlight_group3 + dd highlight_group4 + dd highlight_group5 + dd highlight_group6 + dd highlight_group7 + dd highlight_group8 + dd highlight_group9 + +; ଠ ᠭ 㯯 ᢥ⪨: +virtual at 0 +highlight: + .IncludeAttributes db ? + .NormalColor db ? + .CursorColor db ? + .SelectedColor db ? + .SelectedCursorColor db ? + .Mask: ; ASCIIZ-string +end virtual + +; all highlight masks must be in lowercase! +highlight_group0: + db 2 + db 13h, 38h, 0, 0 + db '*',0 +highlight_group1: + db 4 + db 13h, 38h, 0, 0 + db '*',0 +highlight_group2: + db 10h + db 1Fh, 3Fh, 0, 0 + db '*|..',0 +highlight_group3: + db 10h + db 0, 0, 0, 0 + db '..',0 +highlight_group4: + db 0 + db 1Ah, 3Ah, 0, 0 + db '*.exe,*.com,*.bat,*.cmd,*.kex',0 +highlight_group5: + db 0 + db 1Ah, 3Ah, 0, 0 + db '*|*.*,readme,makefile',0 +highlight_group6: + db 0 + db 1Dh, 3Dh, 0, 0 + db '*.rar,*.zip,*.[zj],*.[bg7]z,*.[bg]zip,*.tar,*.t[ag]z,*.ar[cj],*.r[0-9][0-9],' + db '*.a[0-9][0-9],*.bz2,*.cab,*.msi,*.jar,*.lha,*.lzh,*.ha,*.ac[bei],*.pa[ck],' + db '*.rk,*.cpio,*.rpm,*.zoo,*.hqx,*.sit,*.ice,*.uc2,*.ain,*.imp,*.777,*.ufa,*.boa,' + db '*.bs[2a],*.sea,*.hpk,*.ddi,*.x2,*.rkv,*.[lw]sz,*.h[ay]p,*.lim,*.sqz,*.chz',0 +highlight_group7: + db 0 + db 16h, 36h, 0, 0 + db '*.bak,*.tmp',0 +highlight_group8: + db 0 + db 17h, 37h, 0, 0 + db '*.asm,*.inc',0 +highlight_group9: + db 10h + db 1Fh, 3Fh, 0, 0 + db '*',0 + +bConfirmDelete db 1 +bConfirmDeleteIncomplete db 0 + +FolderShortcuts dd 0,0,0,0,0,0,0,0,0,0 + +; 稢 䨣樮 + +bWasE0 db 0 +ctrlstate db 0 +mousestate db 0 +align 4 +MemForImage dd 0 +restore_semicolon dd 0 +bForHex db 0 + +align 4 +; 饭 뤥 +nomem_dlgdata: + dd 2 + dd -1 + dd -1 + dd 12 + dd 2 + dd 1 + dd 1 + dd aError + rb 8 + dd 0 + dd 0 + dd 2 +; ப "No memory" + DlgLbl ,1,0,10,0,aNoMemory,1 +; "Ok" + DlgBtn ,4,1,7,1,aOk,0xD + +; ஢ +copy_dlgdata: + dd 1 +.x dd -1 +.y dd -1 +.width dd ? +.height dd 4 + dd 4 + dd 2 + dd aCopyCaption +.main_color db ? +.border_color db ? +.header_color db ? + db 0 + dd ? + dd 0 + dd 0 + dd 4 +; ப '஢ "%s" :' +.lcopy DlgLbl ,1,0,,0,CopySourceTextBuf,0 +; ।஢ 䠩/ 祭 +.ename DlgEdit ,1,1,,1,CopyDestEditBuf,0 +; "஢" +.copy DlgBtn ,,3,,3,aCopy,18h +; "⬥" +.cnl DlgBtn ,,3,,3,aCancelB,8 + +struct MkDir_Dlgdata + dd 1 + dd -1, -1 +width dd ? +height dd 4 + dd 4, 2 + dd aMkDirCaption + dd ?, ? + dd 0 + dd 0 + dd 4 +; ப " " + DlgLbl ,1,0,aMkDirLen,0,aMkDir,0 +; ।஢ ᮧ +dnam DlgEdit ,1,1,,1,CopyDestEditBuf,0xC +; "த" +cont DlgBtn ,,3,,3,a_Continue,18h +; "⬥" +cnl DlgBtn ,,3,,3,aCancelB,8 +ends + +mkdir_dlgdata MkDir_Dlgdata + +; 뤥/ +mark_dlgdata: + dd 1 + dd -1, -1 + dd 37, 1 + dd 4, 2 +.title dd ? + dd ?, ? + dd 0, 0 + dd 1 +; ।஢ +.edit DlgEdit ,1, 0, 35, 0, enter_string_buf, + +; ண ᪠ (Alt+㪢) +QuickSearchDlg: + dd 5 +.x dd ? +.y dd ? + dd 20, 1 + dd 1, 1 + dd aSearch + dd ?, ? + dd 0, 0 + dd 1 +; ।஢ + DlgEdit ,1, 0, 18, 0, quick_search_buf, 1Ch + +; ᪠ 䠩 ᬮ騪 । +struct FindInFileDlgdata + dd 1 +x dd -1 +y dd -1 +width dd ? +height dd 7 + dd 4, 2 + dd aSearch + dd ?, ? + dd 0, 0 + dd 8 +; ப "᪠" + DlgLbl ,1,0,aSearchForLen,0,aSearchFor,0 +; ।஢ ⥪⮬ ᪠ +efind DlgEdit ,1,1,,1,SearchStringEditBuf,0xC +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,2,-1,2 +; 䫠 "뢠 ॣ" +case DlgCheck,1,3,-1,3,aCaseSensitive,18h ; default: search is case sensitive +; 䫠 "쪮 楫 ᫮" +whole DlgCheck,1,4,-1,4,aWholeWords,8 ; default: do NOT search whole words only +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,5,-1,5 +; "᪠" +search DlgBtn ,,6,,6,aSearchB,18h +; "⬥" +cnl DlgBtn ,,6,,6,aCancelB,8 +ends + +find_in_file_dlgdata FindInFileDlgdata + +; ᪠ 䠩 () +struct FileSearch_QueryTemplate + dd 1 +x dd ? +y dd ? +width dd ? +height dd 9 + dd 4, 2 + dd aFileSearch + dd ? + dd 0 + dd 0, 0 + dd 10 +; ப-ਣ襭 ᪨ + DlgLbl ,1,0,aFileMasksLen,0,aFileMasks,0 +; ᪨ +edit1 DlgEdit ,1,1,,1,,0xC +; ப-ਣ襭 ⥪ ᪠ + DlgLbl ,1,2,aContainingTextLen,2,aContainingText,0 +; ⥪ ᪠ +edit2 DlgEdit ,1,3,,3,,8 +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,4,-1,4 +; 䫠 "뢠 ॣ" +case DlgCheck,1,5,-1,5,aCaseSensitive, ; will be initialized from find_in_file_dlgdata +; 䫠 "쪮 楫 ᫮" +whole DlgCheck,1,6,-1,6,aWholeWords, ; will be initialized from find_in_file_dlgdata +; ਧ⠫ ࠧ⥫ + DlgLine ,-1,7,-1,7 +; "᪠" +search DlgBtn ,,8,,8,aSearchB,18h +; "⬥" +cnl DlgBtn ,,8,,8,aCancelB,8 +ends + +filesearch_query_template FileSearch_QueryTemplate + +; ன ᪠ 䠩 (᪠஢) +struct FileSearch_SearchTemplate + dd 1 +x dd ? +y dd ? +width dd ? +height dd ? + dd 4, 2 +caption dd ? + dd ? + dd 0 + dd 0, 0 + dd 9 +; ᯨ᮪ 䠩 +list1 DlgList ,0,0,,,,0 +; ਧ⠫ ࠧ⥫ +lin1 DlgLine ,-1,,-1, +; ப " :" " 祭..." +lbl1 DlgLbl ,1 +; ப ⥪饩 +lbl2 DlgLbl +; ਧ⠫ ࠧ⥫ +lin2 DlgLine ,-1,,-1, +; +btn1 DlgBtn ,,,,,aNewSearch,8 +btn2 DlgBtn ,,,,,aGoto,1Ch +btn3 DlgBtn ,,,,,aView,8 +btn4 DlgBtn ,,,,,aCancelB2,8 +ends + +filesearch_search_template FileSearch_SearchTemplate + +RetryOrCancelBtn: + dd aRetry + dd a_Cancel +DeleteOrKeepBtn: + dd a_Delete + dd aKeep +RetryOrIgnoreBtn: + dd aRetry + dd aIgnore +DeleteOrCancelBtn: + dd a_Delete + dd a_Cancel +DeleteErrorBtn: + dd aRetry +SkipOrCancelBtn: + dd aSkip + dd aSkipAll + dd a_Cancel +ContinueBtn: + dd aContinue +EditorExitBtn: + dd aSave + dd aDontSave + dd aContinueEdit +YesOrNoBtn: + dd aYes + dd aNo + +aCannotOpenFile_ptr dd aCannotOpenFile +aCannotCreateThread_ptr dd aCannotCreateThread +ConfirmCancelMsg dd aConfirmCancel +EditConfigErr_ptr: + dd aEditConfigErr1 + dd aEditConfigErr2 +if lang eq ru_RU +aDeleteCaption db '',0 +aConfirmDeleteText db ' 㤠',0 +aDeleteFolder db ' ',0 +aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 +aDeleteFile db ' 䠩',0 +aCancelB db '[ ⬥ ]',0 +aCancelBLength = $ - aCancelB - 1 +aCancelB2 db '[ ⬥ ]',0 +aCancelB2Length = $ - aCancelB2 - 1 +aCopyCaption db '஢',0 +aCopy db '[ ஢ ]',0 +aCopyLength = $ - aCopy - 1 +a_Continue db '[ த ]',0 +a_ContinueLength = $ - a_Continue - 1 +aCopy1 db '஢ ',0 +aCopy2 db ' :',0 +aError db '訡',0 +aContinue db 'த',0 +aRetry db '',0 +a_Cancel db '⬥',0 +a_Delete db '',0 +aSkip db 'ய',0 +aSkipAll db 'ய ',0 +aYes db '',0 +aNo db '',0 +error0msg db '࠭... 訡',0 +error1msg db '࠭... । / ࠧ ⪮ ᪠',0 +error2msg db '㭪 ন 䠩 ⥬',0 +error3msg db '⭠ 䠩 ⥬',0 +error4msg db '࠭... 訡 4',0 +error5msg db ' ',0 +error6msg db ' 稫',0 +error7msg db '࠭... ⥫ ਫ',0 +error8msg db ' ',0 +error9msg db ' ࠧ襭',0 +error10msg db ' ',0 +error11msg db '訡 ன⢠',0 +error30msg db '筮 ',0 +error31msg db '  ᯮ塞',0 +error32msg db '誮 ᮢ',0 +aUnknownError db ' 訡: ',0 +aCannotReadFolder db ' ',0 +aRunError db '訡 ᪥ ணࠬ:',0 +aFileNameTooBig db ' 䠩 ᫨誮 ',0 +aFolderNameTooBig db ' ᫨誮 ',0 +aCmdLineTooBig db ' ப ॢ蠥 ࠭ OS 256 ᨬ',0 +aCannotCopyToSelf db ' ᪮஢ ᠬ ᥡ',0 +aCannotReadFile db ' 䠩',0 +aIncompleteFile db ' 祭 䠩. ?',0 +aKeep db '⠢',0 +aCannotWriteFile db ' 䠩',0 +aCannotDeleteFile db ' 㤠 䠩',0 +aCannotDeleteFolder db ' 㤠 ',0 +aNotFolder db '  ',0 +aIgnore db '஢',0 +aMkDirCaption db ' ',0 +aMkDir db ' ',0 +aMkDirLen = $ - aMkDir - 1 +aCannotMakeFolder db ' ᮧ ',0 +aName db 3,'' +aSize db 6,'' +aDate db 4,'' +aTime db 5,'६' +aCannotLoadDLL db ' 㧨 DLL',0 +aCannotLoadPlugin db ' 㧨 ',0 +aInvalidDLL db ' ଠ',0 +aMissingExport db '室 㭪 ',0 +aInitFailed db '訡 樠樨',0 +aIncompatibleVersion db 'ᮢ⨬ ',0 +aTables db '',0 +aSelect db '',0 +aDeselect db '',0 +aCannotOpenFile db '訡 ⨨ 䠩',0 +aCannotCreateThread db '訡 ᮧ ⮪',0 +aCannotSetFolder db ' ',0 +aSearch db '',0 +aSearchB db '[ ᪠ ]',0 +aSearchBLength = $ - aSearchB - 1 +aSearchFor db '᪠',0 +aSearchForLen = $ - aSearchFor - 1 +aCaseSensitive db '뢠 ॣ',0 +aWholeWords db '쪮 楫 ᫮',0 +aReverseSearch db ' ',0 +aStringNotFound db 'ப ',0 +aFileSearch db ' 䠩',0 +aFileMasks db ' ᪮쪮 ᮪ 䠩:',0 +aFileMasksLen = $ - aFileMasks - 1 +aContainingText db 'ঠ ⥪:',0 +aContainingTextLen = $ - aContainingText - 1 +aSearchingIn db ' "" :',0 +aSearchingInLen = $ - aSearchingIn - 1 +aSearchDone db ' 祭. ? 䠩()',0 +aSearchDoneLen = $ - aSearchDone - 1 +aNewSearch db '[ ]',0 +aNewSearchLen = $ - aNewSearch - 1 +aGoto db '[ ३ ]',0 +aGotoLen = $ - aGoto - 1 +aView db '[ ]',0 +aViewLen = $ - aView - 1 +aEditConfigErr1 db '訡 䨣樨 ।.',0 +aEditConfigErr2 db '஡ 譨 .',0 +aEditNoMemory db ' ᫨誮 㧪 ।.',0 +aLine db ' ப' +aCol db ' ' +aEditorTitle db '',0 +aFileModified db ' ',0 +aSave db '࠭',0 +aDontSave db ' ࠭',0 +aContinueEdit db 'த ।஢',0 +aCannotSaveToPlugin db '࠭ 䠩 ন',0 +aCannotSearchOnPlugin db ' ন',0 +aCancelled db '⢨ 뫮 ࢠ',0 +aConfirmCancel db ' ⢨⥫쭮 ⬥ ⢨?',0 + +else ; Default to en_US +aDeleteCaption db 'Delete',0 +aConfirmDeleteText db 'Do you wish to delete',0 +aDeleteFolder db ' the folder',0 +aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2 +aDeleteFile db ' the file',0 +aDelete db ' Delete ',0 +aDeleteLength = $ - aDelete - 1 +aCancel db ' Cancel ',0 +aCancelLength = $ - aCancel - 1 +aCancelB db '[ Cancel ]',0 +aCancelBLength = $ - aCancelB - 1 +aCancelB2 = aCancelB +aCancelB2Length = $ - aCancelB2 - 1 +aCopyCaption db 'Copy',0 +aCopy db '[ Copy ]',0 +aCopyLength = $ - aCopy - 1 +a_Continue db '[ Continue ]',0 +a_ContinueLength = $ - a_Continue - 1 +aCopy1 db 'Copy "',0 +aCopy2 db '" to:',0 +aError db 'Error',0 +aContinue db 'Continue',0 +aRetry db 'Retry',0 +a_Cancel db 'Cancel',0 +a_Delete db 'Delete',0 +aSkip db 'Skip',0 +aSkipAll db 'Skip all',0 +aYes db 'Yes',0 +aNo db 'No',0 +error0msg db 'Strange... No error',0 +error1msg db 'Strange... Hard disk base and/or partition not defined',0 +error2msg db 'The file system does not support this function',0 +error3msg db 'Unknown file system',0 +error4msg db 'Strange... Error 4',0 +error5msg db 'File not found',0 +error6msg db 'End of file',0 +error7msg db 'Strange... Pointer is outside of application memory',0 +error8msg db 'Disk is full',0 +error9msg db 'File structure is destroyed',0 +error10msg db 'Access denied',0 +error11msg db 'Device error',0 +error30msg db 'Not enough memory',0 +error31msg db 'File is not executable',0 +error32msg db 'Too many processes',0 +aUnknownError db 'Unknown error code: ',0 +aCannotReadFolder db 'Cannot read folder',0 +aRunError db 'Cannot execute program:',0 +aFileNameTooBig db 'Full file name is too long',0 +aFolderNameTooBig db 'Full folder name is too long',0 +aCmdLineTooBig db 'Command line is too long (OS limit is 256 symbols)',0 +aCannotCopyToSelf db 'File cannot be copied onto itself',0 +aCannotReadFile db 'Cannot read file',0 +aIncompleteFile db 'Incomplete file was retrieved. Delete it?',0 +aKeep db 'Keep',0 +aCannotWriteFile db 'Cannot write to the file',0 +aCannotDeleteFile db 'Cannot delete the file',0 +aCannotDeleteFolder db 'Cannot delete the folder',0 +aNotFolder db 'is not a folder',0 +aIgnore db 'Ignore',0 +aMkDirCaption db 'Make folder',0 +aMkDir db 'Create the folder',0 +aMkDirLen = $ - aMkDir - 1 +aCannotMakeFolder db 'Cannot create folder',0 +aName db 4,'Name' +aSize db 4,'Size' +aDate db 4,'Date' +aTime db 4,'Time' +aCannotLoadDLL db 'Cannot load DLL',0 +aCannotLoadPlugin db 'Cannot load plugin',0 +aInvalidDLL db 'File is not found or invalid',0 +aMissingExport db 'Required function is not present',0 +aInitFailed db 'Initialization failed',0 +aIncompatibleVersion db 'Incompatible version',0 +aTables db 'Tables',0 +aSelect db 'Select',0 +aDeselect db 'Deselect',0 +aCannotOpenFile db 'Cannot open the file',0 +aCannotCreateThread db 'Cannot create a thread',0 +aCannotSetFolder db 'Cannot enter to the folder',0 +aSearch db 'Search',0 +aSearchB db '[ Search ]',0 +aSearchBLength = $ - aSearchB - 1 +aSearchFor db 'Search for',0 +aSearchForLen = $ - aSearch - 1 +aCaseSensitive db 'Case sensitive',0 +aWholeWords db 'Whole words',0 +aReverseSearch db 'Reverse search',0 +aStringNotFound db 'Could not find the string',0 +aFileSearch db 'Find file',0 +aFileMasks db 'A file mask or several file masks:',0 +aFileMasksLen = $ - aFileMasks - 1 +aContainingText db 'Containing text:',0 +aContainingTextLen = $ - aContainingText - 1 +aSearchingIn db 'Searching "" in:',0 +aSearchingInLen = $ - aSearchingIn - 1 +aSearchDone db 'Search done. Found ? file(s)',0 +aSearchDoneLen = $ - aSearchDone - 1 +aNewSearch db '[ New search ]',0 +aNewSearchLen = $ - aNewSearch - 1 +aGoto db '[ Go to ]',0 +aGotoLen = $ - aGoto - 1 +aView db '[ View ]',0 +aViewLen = $ - aView - 1 +aEditConfigErr1 db 'Error in configuration of plugins for the editor.',0 +aEditConfigErr2 db 'Try to remove unnecessary plugins.',0 +aEditNoMemory db 'The file is too big for the editor.',0 +aLine db ' Line' +aCol db ' Col ' +aEditorTitle db 'Editor',0 +aFileModified db 'File has been modified',0 +aSave db 'Save',0 +aDontSave db 'Do not save',0 +aContinueEdit db 'Continue editing',0 +aCannotSaveToPlugin db 'Saving is not supported for plugin panels',0 +aCannotSearchOnPlugin db 'The search on plugin panels is not supported yet',0 +aCancelled db 'Operation has been interrupted',0 +aConfirmCancel db 'Do you really want to cancel it?',0 +end if + +aOk db 'OK',0 +aNoMemory db 'No memory!' +nullstr db 0 +aUntitled db 'untitled',0 +aDotDot db '..',0,0 +standard_dll_path: +libini_name db '/sys/lib/' +standard_dll_path_size = $ - standard_dll_path + db 'libini.obj',0 +aStart db 'START',0 +aLibInit db 'lib_init',0 +aVersion db 'version',0 +aIniGetInt db 'ini_get_int',0 +aIniGetStr db 'ini_get_str',0 +aIniSetInt db 'ini_set_int',0 +aIniEnumKeys db 'ini_enum_keys',0 +aPluginLoad db 'plugin_load',0 +aPluginUnload db 'plugin_unload',0 +aGetattr db 'getattr',0 +aOpen db 'open',0 +aRead db 'read',0 +aSetpos db 'setpos',0 +aClose db 'close',0 +aOpenFilePlugin db 'OpenFilePlugin',0 +aClosePlugin db 'ClosePlugin',0 +aReadFolder db 'ReadFolder',0 +aSetFolder db 'SetFolder',0 +aGetOpenPluginInfo db 'GetOpenPluginInfo',0 +aGetPanelTitle db 'GetPanelTitle',0 +aGetFiles db 'GetFiles',0 +aEditInfoSize db 'EditInfoSize',0 + +aConfirmations db 'Confirmations',0 +aConfirmDelete db 'Delete',0 +aConfirmDeleteIncomplete db 'DeleteIncomplete',0 + +aPanels db 'Panels',0 +aLeftViewMode db 'LeftViewMode',0 +aRightViewMode db 'RightViewMode',0 +aLeftSortMode db 'LeftSortMode',0 +aRightSortMode db 'RightSortMode',0 + +aEditor db 'Editor',0 +aEolStyle db 'EOLStyle',0 + +aAssociations db 'Associations',0 +aPlugins db 'Plugins',0 +aMenu db 'Menu',0 +aFolderShortcuts db 'FolderShortcuts',0 +aShortcut db 'Shortcut' +.d db '0',0 + +align 4 +ini_import: +ini.get_int dd aIniGetInt +ini.get_str dd aIniGetStr +ini.enum_keys dd aIniEnumKeys +ini.set_int dd aIniSetInt + dd 0 + +plugin_exported: + dd aPluginUnload + dd aGetattr + dd aOpen + dd aRead + dd aSetpos + dd aClose + dd aOpenFilePlugin + dd aClosePlugin + dd aReadFolder + dd aSetFolder + dd aGetOpenPluginInfo + dd aGetPanelTitle + dd aGetFiles + dd aEditInfoSize + dd 0 +plugin_exported_default: + dd plugin_unload_default + dd getattr_default + dd open_default + dd read + dd setpos_default + dd close + dd OpenFilePlugin_default + dd ClosePlugin_default + dd ReadFolder_default + dd SetFolder_default + dd GetOpenPluginInfo_default + dd GetPanelTitle_default + dd GetFiles_default + dd 0 ; default value for EditInfoSize + +kfar_info: + dd .size + dd version_dword + dd open + dd open2 + dd read + dd -1 ; write: to be implemented + dd seek + dd tell + dd -1 ; flush: to be implemented + dd filesize + dd close + dd xpgalloc + dd xpgrealloc + dd pgfree + dd getfreemem + dd libini_alloc + dd libini_realloc + dd libini_free + dd menu + dd menu_centered_in + dd DialogBox + dd SayErr + dd Message + dd cur_width +.size = $ - kfar_info + +plugins dd 0 +num_plugins dd 0 +alloc_plugins dd 0 + +EditPlugInfo dd 0 +EditEOLStyle db edit.eol_unix + +virtual at 0 +PluginInfo: +.unload dd ? +.getattr dd ? +.open dd ? +.read dd ? +.setpos dd ? +.close dd ? +.OpenFilePlugin dd ? +.ClosePlugin dd ? +.ReadFolder dd ? +.SetFolder dd ? +.GetOpenPluginInfo dd ? +.GetPanelTitle dd ? +.GetFiles dd ? +.EditInfoSize dd ? +.EditInfoOffs dd ? +.size = $ +end virtual + +virtual at 0 +PanelMode: +; up to 16 columns on one panel +.NumColumns dd ? +; available column types: +COLUMN_TYPE_NONE = 0 +COLUMN_TYPE_NAME = 1 + COLUMN_NAME_MARK = 10h ; (reserved) + COLUMN_NAME_NOPATH = 20h ; (reserved) + COLUMN_NAME_RIGHTALIGN = 40h ; (reserved) +COLUMN_TYPE_SIZE = 2 + COLUMN_SIZE_COMMA = 10h ; (reserved) +COLUMN_TYPE_PACKED_SIZE = 3 ; (reserved) +COLUMN_TYPE_DATE = 4 +COLUMN_TYPE_TIME = 5 +COLUMN_TYPE_DATETIME = 6 ; (reserved) +COLUMN_TYPE_DATETIME_CREATION = 7 ; (reserved) +COLUMN_TYPE_DATETIME_ACCESS = 8 ; (reserved) +COLUMN_TYPE_ATTRIBUTES = 9 ; (reserved) +COLUMN_TYPE_DESCRIPTION = 10 ; (reserved) +COLUMN_TYPE_OWNER = 11 ; (reserved) +COLUMN_TYPE_NUMLINKS = 12 ; (reserved) +COLUMN_TYPE_CUSTOM = 13 ; (reserved) +.ColumnTypes rb 16 + +.ColumnWidths rb 16 +.bFullScreen db ? ; (reserved) +.bAlignExtensions db ? + rb 2 +.size = $ +end virtual + +align 4 +column_headers: + dd nullstr + dd aName + dd aSize + dd nullstr + dd aDate + dd aTime +draw_column_proc: + dd draw_empty_column + dd draw_name_column + dd draw_size_column + dd -1 + dd draw_date_column + dd draw_time_column +colmodes: +; ० 0 : NM,SC,D + dd 3 + db COLUMN_TYPE_NAME+COLUMN_NAME_MARK, COLUMN_TYPE_SIZE+COLUMN_SIZE_COMMA + db COLUMN_TYPE_DATE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + db 0, 10, 8 + times 13 db 0 + db 0, 1 + times 2 db 0 +; ० 1 : N,N,N + dd 3 + db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME, COLUMN_TYPE_NAME + times 13 db 0 + times 16 db 0 + db 0, 1 + times 2 db 0 +; ० 2 : N,N + dd 2 + db COLUMN_TYPE_NAME, COLUMN_TYPE_NAME + times 14 db 0 + times 16 db 0 + db 0, 0 + times 2 db 0 +; ० 3 : N,S,D,T + dd 4 + db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE, COLUMN_TYPE_DATE, COLUMN_TYPE_TIME + times 12 db 0 + db 0, 6, 8, 5 + times 12 db 0 + db 0, 1 + times 2 db 0 +; ० 4 : N,S + dd 2 + db COLUMN_TYPE_NAME, COLUMN_TYPE_SIZE + times 14 db 0 + db 0, 6 + times 14 db 0 + db 0, 0 + times 2 db 0 +; ० 5 : N,S,P,DM,DC,DA,A +; ० 6 : N,Z +; ० 7 : N,S,Z +; ० 8 : N,S,O +; ० 9 : N,S,LN + +execinfo: + dd 7 + dd 0 +execparams dd 0 + dd 0 + dd 0 + db 0 +execptr dd ? + +IncludeIGlobals + +i_end: + +IncludeUGlobals + +execdata rb 1024 +execdataend: + align 4 +attrinfo.attr rb 40 + +panel1 PanelData + +panel2 PanelData + +;console_data rb max_width*max_height*2 + +nomem_dlgsavearea rb 8 + (12+4)*(3+3)*2 + +quicksearch_savearea rb 22*3*2 +quicksearch_maxlen = 64 +quick_search_buf rb 12 + quicksearch_maxlen + +cur_header rb max_width +tmp dd ? + +skinh dd ? +std_colors rd 10 + +min_y dd ? +max_y dd ? +min_x dd ? +max_x dd ? +used_width dd ? +used_height dd ? + +wnd_width dd ? +wnd_height dd ? + +column_left dd ? +column_top dd ? +column_width dd ? +column_height dd ? +column_index dd ? +last_column_index dd ? + +scrpos dq ? +viewer_right_side dq ? + +EditDataSize dd ? +EditBlockStart dd ? +EditBlockSize dd ? + +saved_file_name: +procinfo rb 1024 +lower_file_name = procinfo + 512 + +app_path rb 1100 + +error_msg rb 128 + +prev_dir rb 1024 + +driveinfo rb 32+304 +tmpname rb 32 + +screens dd ? +num_screens dd ? +active_screen_vtable dd ? +active_screen_data dd ? +active_screen_keybar dd ? + +default_attr dd ? +left_dotdot_entry rb 40+4 ; 40 bytes for attributes + '..' +right_dotdot_entry rb 40+4 + +aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1 +CopySourceTextBuf rb 512 +CopyDestEditBuf rb 12+512+1 +.length = $ - CopyDestEditBuf - 13 + +SearchStringEditBuf rb 12 +SearchString rb 253+1 +SearchStringEditBuf.length = $ - SearchString - 1 + db ? ; used for output (string -> "string") + +enter_string_buf rb 12+512+1 + +bMemForImageValidData db ? + +align 4 +identical_table rb 256 +tolower_table rb 256 +isspace_table rb 256 +composite_table rb 256 +layout rb 128 + +copy_buffer_size = 65536 +copy_buffer rb copy_buffer_size + +filedata_buffer_size = 1024 +filedata_buffer rb filedata_buffer_size + +source_hModule dd ? +source_hPlugin dd ? +source_hFile dd ? +; data for directory delete +; If directory nested level is >1024, then its full name is too big, +; so we see the overflow when creating full name (we check for this!) +del_dir_stack rd 1024 +del_dir_stack_ptr dd ? +del_dir_query_size = 32 +del_dir_query_area rb 32+304*del_dir_query_size + +label copy_dir_stack dword at del_dir_stack +label copy_dir_stack_ptr dword at del_dir_stack_ptr +copy_dir_query_size = del_dir_query_size +copy_dir_query_area = del_dir_query_area +del_bSkipAll db ? ; for directory errors +label copy_bSkipAll byte at del_bSkipAll +copy_bSkipAll2 db ? ; for file read/write errors +copy_bSkipAll3 db ? ; for SetFolder errors + +bEndSlash db ? +bDestIsFolder db ? +bNeedRestoreName db ? + +; stack + align 4 + rb 32768 +stacktop: + +mem: diff --git a/programs/fs/unz/unz.asm b/programs/fs/unz/unz.asm index b524cf947..7cad022aa 100644 --- a/programs/fs/unz/unz.asm +++ b/programs/fs/unz/unz.asm @@ -1,914 +1,914 @@ -;unz - ᯠ騪, ᯮ騩 archiver.obj. ন zip 7z. - -;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip -;-h - hide GUI. If params is empty - do exit. - -;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt -;or -;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt - - -; -;unz -n "namezone" "file.zip" - open packed file, write list files of main folder in namezone -;namezone: -;dd 0 - ᫨ , 1 -;dd cmd - 0 -; 1 ᯨ᮪ 䠩 -; 2 䠩 -; 3 ⠭ ⥪訩 ⠫ 娢 -; 4 ࠡ -;data - , -; 1 ᯨ᮪ 䠩 -; input -; none -; output -; dd numfiles - ⢮ 䠩 ⥪饬 ⠫ -; strz file1...fileN - ᯨ᮪ ப, ࠧ 0 -; 2 䠩 -; input -; dd num bytes -; strz filename (file1.txt of /fold1/file1.txt) -; output -; dd num bytes -; data - -use32 -org 0 -db 'MENUET01' -dd 1, start, init_end, end_mem, stack_top, params, 0 - - -include 'lang.inc' -include '../../macros.inc' -include '../../proc32.inc' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../dll.inc' -;include '../../debug.inc' -include 'debug.inc' - -version equ '0.70' -version_dword equ 0*10000h + 70 - -WIN_W = 400 -SIZE_COPY_BUF = 1024*1024*2 -MM_MAX_BLOCKS equ 1024 - - -virtual at 0 -kfar_info_struc: -.lStructSize dd ? -.kfar_ver dd ? -.open dd ? -.open2 dd ? -.read dd ? -.write dd ? -.seek dd ? -.tell dd ? -.flush dd ? -.filesize dd ? -.close dd ? -.pgalloc dd ? -.pgrealloc dd ? -.pgfree dd ? -.getfreemem dd ? -.pgalloc2 dd ? -.pgrealloc2 dd ? -.pgfree2 dd ? -.menu dd ? -.menu_centered_in dd ? -.DialogBox dd ? -.SayErr dd ? -.Message dd ? -.cur_console_size dd ? -end virtual - - - -;-- CODE ------------------------------------------------------------------- - -include 'parse.inc' -include 'fs.inc' -include 'file_tree.inc' -include 'memory_manager.inc' -include 'dialogs.inc' - - -start: -;dnl -;dpsP params -;dnl - mcall 68, 11 - mcall 40, 100111b + 0C0000000h - stdcall dll.Load, IMPORTS - test eax, eax - jnz exit - mov [pathOut],0 - -;---------------------------- - ;1. find input file, clear - ;2. find -o, copy data, clear - ;3. find -f, add pointer, copy data, clear - ;4. find -c, check variable, clear -;1. - call getLastParam - test eax, eax - je wm_redraw - dec eax - je .arbeit - jmp errorParsing - -.arbeit: -;2. - call getParamOutPath - cmp eax, 2 - je errorParsing - -;3. - - @@: - mov eax, [iFiles] - shl eax, 2 - add eax, files - m2m dword[eax], dword[endPointer] - stdcall getParam, '-f' - cmp eax, 2 - je errorParsing - inc [iFiles] - cmp eax, 1 - je @b - -;4. - mov edi, params - mov ax,'-h' -@@: cmp word [edi], ax - je .check - inc edi - cmp edi, params+1024 - je @f - cmp byte[edi],0 - je @f - jmp @b -.check: - call startUnpack - mcall -1 -@@: - - stdcall [OpenDialog_Init],OpenDialog_data - -;init edit fields -------------- - xor al,al - mov edi,fInp - mov ecx,1024 - repne scasb - inc ecx - mov eax,1024 - sub eax,ecx - mov dword[edtPack.size],eax - mov dword[edtPack.pos],eax - - xor al, al - mov edi, pathOut - mov ecx, 1024 - repne scasb - inc ecx - mov eax, 1024 - sub eax, ecx - mov dword[edtUnpPath.size], eax - mov dword[edtUnpPath.pos], eax - -;main loop -------------------- -wm_redraw: - call winRedraw - -still: - mcall 10 - cmp eax, 1 - je wm_redraw - cmp eax, 2 - je wm_key - cmp eax, 3 - je wm_button - cmp eax, 6 - je wm_mouse - - jmp still - -wm_key: - mcall 2 - cmp [bWinChild],0 - jne still - - stdcall [edit_box_key],edtPack - stdcall [edit_box_key],edtUnpPath - - jmp still - - -wm_button: - mcall 17 - cmp [bWinChild],0 - jne still - - cmp ah, 3 - jne @f - call selectInput - jmp wm_redraw - @@: - cmp ah, 4 - jne @f - call selectOutFold - jmp wm_redraw - @@: - - cmp ah, 2 - jne @f - mcall 51,1,startUnpack,stackUnpack - mov [bWinChild],1 - ;call startUnpack - jmp wm_redraw - @@: - - cmp ah, 1 - je exit - jmp still - -wm_mouse: - cmp [bWinChild],0 - jne still - stdcall [edit_box_mouse],edtPack - stdcall [edit_box_mouse],edtUnpPath - jmp still - -exit: - mcall -1 - -errorParsing: -dph edx - - dps ' errorParsing' - mcall -1 - -;--- functions ------------------------------------------------------------------ - -proc winRedraw - mcall 12, 1 - mcall 48, 3, sc, sizeof.system_colors - mov edx, [sc.work] - or edx, 0x34000000 - mcall 0, <200,WIN_W>, <200,130>, , , title - mcall 8, <100,100>,<65,25>,2,[sc.work_button] - mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button] - mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button] - - edit_boxes_set_sys_color edtPack,endEdits,sc - stdcall [edit_box_draw],edtPack - stdcall [edit_box_draw],edtUnpPath - - - cmp [redInput],0 - jne @f - mov ecx,[sc.work_text] - or ecx,90000000h - jmp .l1 - @@: - mov ecx,90FF0000h - .l1: - mcall 4, <15,16>, , strInp - mov ecx,[sc.work_text] - or ecx,90000000h - mcall 4, <15,37>, , strPath - mov ecx,[sc.work_button_text] - or ecx,90000000h -if lang eq ru_RU - mcall 4, <107,70>, , strGo -else - mcall 4, <127,70>, , strGo -end if - mcall 4, <(WIN_W-47),12>, , strDots - mcall 4, <(WIN_W-47),37>, , strDots - - mcall 12, 2 - ret -endp - -;region -selectInput: - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - mov edi,ODAreaPath - xor al,al - or ecx,-1 - repne scasb - sub edi,ODAreaPath - dec edi - mov dword[edtPack+12*4],edi - mov ecx,edi - inc ecx - mov edi,fInp - mov esi,ODAreaPath - rep movsb - mov [redInput],0 - ret -;endregion - -;region -selectOutFold: - mov [OpenDialog_data.type],2 - stdcall [OpenDialog_Start],OpenDialog_data - mov edi,ODAreaPath - xor al,al - or ecx,-1 - repne scasb - sub edi,ODAreaPath - dec edi - mov dword[edtUnpPath+12*4],edi - mov ecx,edi - inc ecx - mov edi,pathOut - mov esi,ODAreaPath - rep movsb - ret -;endregion - - -;------------------------------------------------------------------------------- - -allfiles dd 0 -succfiles dd 0 -numbytes dd 0 - -proc startUnpack -locals - paramUnp rd 1 - sizeUnpack rd 1 - hFile rd 1 - hFileZip rd 1 - hPlugin rd 1 - pathFold rb 256 -endl -;if input not corrected - cmp [fInp],byte 0 - je .errNullInp - - ; mcall 68, 24, Exception, 0FFFFFFFFh ;?? -;init plugin - push ebp - stdcall [aPluginLoad],kfar_info - pop ebp - - -;set current directory, create folder - cmp [pathOut],0 - jne @f - lea eax,[pathFold] - stdcall cpLastName, fInp, eax - lea eax,[pathFold] - mov [fsNewDir.path],eax - mcall 70, fsNewDir - mov ecx, [fsNewDir.path] - - mcall 30,4,,1 - jmp .n -@@: - mcall 30,4,pathOut,1 -.n: - -;open and read first 1KB - stdcall open, fInp, O_READ - mov [hFileZip], eax - mcall 70,fsZip - test eax,eax - jnz .errNotFound - mcall 70,fsZipRead - - -;open pack - push ebp - stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp - pop ebp - - test eax,eax - jnz @f - cmp ebx,0 ;;/ !!!! - je .errNotFound ;;祭 ebx 祭 . - cmp ebx,400h - je .errNotSupp - @@: - mov [hPlugin],eax - -;get num of all files - ; stdcall calcSizeArch,[hPlugin] - push ebp - stdcall [aSetFolder],[hPlugin], .strRoot,0 - pop ebp -;unpack -; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); - push ebp - stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir - pop ebp - -jmp @f - .str1 db '/LICENSE.txt',0 - .strRoot db '.svn',0 -@@: - -;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); -; 䠩 filename. ࠬ mode १ࢨ஢ ⥪饩 ᨨ kfar ᥣ ࠢ 1. - ; push ebp - ; stdcall [aOpen], [hPlugin], .str1, O_READ - ; pop ebp - - ; mov [hFile],eax -;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); -;⥭ size buf 䠩 hFile, ࠭ ⮣ १ open. -;size ⥭ 512 -;頥 祭: ᫮ ⠭ , -1 訡. - ; push ebp - ; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF - ; pop ebp - ; -; mcall 70, fsWrite -;void __stdcall close(HANDLE hFile); - push ebp - stdcall [aClose], [hFile] - mov [bWinChild],0 - pop ebp - - push ebp - stdcall [aClosePlugin], [hPlugin] - mov [bWinChild],0 - - mov [fsRunNotifyOK.param],strUnpackOk - mcall 70,fsRunNotifyOK - pop ebp - ret ;SUCCESS - - -.errNotFound: -; stdcall SimpleSayErr,strNotFound - mov [bWinChild],0 - mov [fsRunNotifyOK.param],strUnpackFault - mcall 70,fsRunNotifyOK - ret - -.errNotSupp: - mov eax,[fsNewDir.path] - mov [fsDelDir.path],eax - mcall 70, fsDelDir - - mov [bWinChild],0 - mov [fsRunNotifyOK.param],strUnpackFault - mcall 70,fsRunNotifyOK - ret - -.errNullInp: - mov [redInput],1 - mov [bWinChild],0 - ret -endp - - -proc Exception param1:dword - stdcall SimpleSayErr,strErrorExc - ret -endp - -proc debugInt3 - dps '!!!!!!!!!!!!!!!!!!!!!!!!!' - dnl - int3 - ret -endp - - -allnumbytes dd 0 -strBackFold db '../',0 - -proc calcSizeArch hPlugin:dword -locals - bdwk rb 560 - num rd 1 -endl -;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, -; unsigned dirinfo_size, void* dirdata); - mov [num],0 - ; int3 -.mainloop: - push ebp - lea eax, [bdwk] - stdcall [aReadFolder], [hPlugin],[num],1,eax - pop ebp - - cmp eax,6 - je .lastFile -;?????????????????????????????????????????????????????????????????????????????????????????????????? - lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ - test [ebx],dword 10h - jz @f -;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, -; const char* absolute_path); - - push ebp - lea eax,[ebx+40] -dps 'Folder: ' -dpsP eax -dnl - stdcall [aSetFolder],[hPlugin], eax,0 - - pop ebp - stdcall calcSizeArch, [hPlugin] - inc [num] - jmp .mainloop - @@: - - lea ebx,[bdwk+0x20] -lea eax,[ebx+40] -dps 'File: ' -dpsP eax -dnl - mov eax,[ebx+32] - add [allnumbytes],eax - inc [num] - jmp .mainloop - -.lastFile: -; lea ebx,[bdwk+0x20] -; test [ebx],dword 10h -; jz @f -; -; push ebp -; lea eax,[ebx+40] -; stdcall [aSetFolder],[hPlugin], eax,0 -; pop ebp -; stdcall calcSizeArch, [hPlugin] -; @@: - - - push ebp - stdcall [aSetFolder],[hPlugin], strBackFold,0 - pop ebp - ret -endp - - -proc rec_calcSize hPlugin:dword -locals - bdwk rb 560 -endl -;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, -; unsigned dirinfo_size, void* dirdata); -;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path); - push ebp - lea eax,[bdwk] - stdcall [aReadFolder], [hPlugin],1,560,eax - pop ebp - - ret -endp -;------------------------------------------------------------------------------- -;------------------------------------------------------------------------------- -;------------------------------------------------------------------------------- - -hTrPlugin dd 0 - -;eax - file struct for sys70 - -proc rdFoldforTree -locals - fi rd 0 -endl - cmp [hTrPlugin],0 - je .exit - push ebx edi esi - - mov [fi],eax - push ebp - stdcall [aSetFolder],[hTrPlugin], [eax+20],0 - mov ebp,[esp] - ;hPlug,startBlock,numBlocks,buffer - stdcall [aReadFolder], [hTrPlugin],dword[eax+4],\ - dword[eax+12],dword[eax+16] - pop ebp - - ;cmp eax,6 - ;je .lastFile - - ;lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ - - pop esi edi ebx -.exit: - ret -endp - -;-- DATA ------------------------------------------------------------------- - - - -sc system_colors - - -bWinChild db 0 ;1 - ୥ , ॠ஢ -redInput db 0 ;1 - ᢥ - -if lang eq ru_RU - title db 'uNZ v0.2 - ᯠ騪 Zip 7z',0 - strGo db 'ᯠ',0 - strInp db ' 娢',0 - strPath db ' ',0 - strError db '訡',0 - strErrorExc db ' 訡',0 - strOk db 'OK',0 - strGetPass db '஫',0 - strCancel db '⬥',0 - strUnpackOk db "'ᯥ譮 ᯠ' -O",0 - strUnpackFault db "'訡 ᯠ' -E",0 - strNotSupport db "'ন ଠ 娢' -E",0 - strNotFound db "' ' -E",0 -else if lang eq es_ES - title db 'uNZ v0.2 - Desarchivador para Zip y 7z',0 - strGo db 'Desarchivar',0 - strInp db 'Archivar',0 - strPath db 'Extraer en',0 - strError db 'Error',0 - strErrorExc db 'Error desconocido',0 - strOk db 'OK',0 - strGetPass db 'Contrasena',0 - strCancel db 'Cancelar',0 - strUnpackOk db "'Extracion exitosa' -O",0 - strUnpackFault db "'Fallo al extraer' -E",0 - strNotSupport db "'El formato del archivo no es soportado' -E",0 - strNotFound db "'Archivo no encontrado' -E",0 -else - title db 'uNZ v0.2 - Unarchiver of Zip and 7z',0 - strGo db 'Unpack',0 - strInp db 'Archive',0 - strPath db 'Extract to',0 - strError db 'Error',0 - strErrorExc db 'Unrecognized error',0 - strOk db 'OK',0 - strGetPass db 'Password',0 - strCancel db 'Cancel',0 - strUnpackOk db "'Unpacked successfuly' -O",0 - strUnpackFault db "'Unprack failed' -E",0 - strNotSupport db "'Archive format is not supported' -E",0 - strNotFound db "'File not found' -E",0 -end if - - - -strDots db '...', 0 - -;-------- -; int __stdcall SayErr(int num_strings, const char* strings[], -; int num_buttons, const char* buttons[]); -; int __stdcall DialogBox(DLGDATA* dlg); - -stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel -errmess0 dd strErrorExc - - -kfar_info: - dd .size - dd version_dword - dd open - dd open2 - dd read - dd -1 ; write: to be implemented - dd seek - dd tell - dd -1 ; flush: to be implemented - dd filesize - dd close - dd xpgalloc - dd xpgrealloc - dd pgfree - dd getfreemem - dd debugInt3;libini_alloc - dd debugInt3;libini_realloc - dd debugInt3;libini_free - dd debugInt3;menu - dd debugInt3;menu_centered_in - dd DialogBox;DialogBox - dd SayErr ;SayErr - dd debugInt3;Message - dd 0 ;cur_width -.size = $ - kfar_info -;-------- - - -iFiles dd 0 ;⢮ ᯠ뢠 䠩 -endPointer dd buffer - - -fsZip: -.cmd dd 5 - dd 0 - dd 0 -.size dd 0 -.buf dd bdvkPack - db 0 - dd fInp - -fsZipRead: -.cmd dd 0 - dd 0 - dd 0 -.size dd 1024 -.buf dd filedata_buffer - db 0 - dd fInp - - -fsWrite: -.cmd dd 2 ;2 rewrite, 3 - write -.pos dd 0 -.hpos dd 0 -.size dd SIZE_COPY_BUF -.buf dd copy_buf - db 0 -.path dd 0 - - -fsNewDir: -.cmd dd 9 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 -.path dd 0 - -fsDelDir: -.cmd dd 8 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 -.path dd 0 - - - -fsRunNotifyOK: -.cmd dd 7 - dd 0 -.param dd strUnpackOk -.size dd 0 -.buf dd 0 - db '/sys/@notify',0 - - - -edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 1024, fInp, 0,0,0,0 -edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 1024, pathOut, 0,0,0,0 -edtPassword edit_box 200, 56, 40, 0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ - 255, 0, 0, ed_focus+ed_always_focus ;+ed_pass - -endEdits: - - - -;------------------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 ;0-open, 1-save, 2-select folder -.procinfo dd RBProcInfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd winRedraw ;+28 -.status dd 0 ;+32 -.openfile_pach dd ODAreaPath; ;+36 -.filename_area dd 0; ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 100 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 100 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: - db '/sys/File managers/opendial',0 - -communication_area_default_pach: - db '/sys',0 - -Filter dd 0 - - -; int __stdcall ReadFolder(HANDLE hPlugin, -; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata); -; void __stdcall ClosePlugin(HANDLE hPlugin); -; bool __stdcall SetFolder(HANDLE hPlugin, -; const char* relative_path, const char* absolute_path); -; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info); -; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], -; void* addfile, void* adddir); -; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile); -; bool __stdcall adddir(const char* name, void* bdfe_info); -; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info); -; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); -; void __stdcall setpos(HANDLE hFile, __int64 pos); -; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); -; void __stdcall close(HANDLE hFile); -IMPORTS: -library archiver, 'archiver.obj',\ - box_lib ,'box_lib.obj',\ - proc_lib,'proc_lib.obj' - -import archiver,\ - aPluginLoad , 'plugin_load',\ - aOpenFilePlugin , 'OpenFilePlugin',\ - aClosePlugin , 'ClosePlugin',\ - aReadFolder , 'ReadFolder',\ - aSetFolder , 'SetFolder',\ - aGetFiles , 'GetFiles',\ - aGetOpenPluginInfo , 'GetOpenPluginInfo',\ - aGetattr , 'getattr',\ - aOpen , 'open',\ - aRead , 'read',\ - aSetpos , 'setpos',\ - aClose , 'close',\ - aDeflateUnpack , 'deflate_unpack',\ - aDeflateUnpack2 , 'deflate_unpack2' - -import proc_lib,\ - OpenDialog_Init ,'OpenDialog_init',\ - OpenDialog_Start ,'OpenDialog_start' -import box_lib,\ - edit_box_draw ,'edit_box_draw',\ - edit_box_key ,'edit_box_key',\ - edit_box_mouse ,'edit_box_mouse' - - -IncludeIGlobals - -params1 db '-o "/hd0/1/unz/pig" -h "/hd0/1/unz/abc1"',0 -;-- UDATA ----------------------------------------------------------------------------- -init_end: -align 16 -IncludeUGlobals - -path rb 512 - -;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 -;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 - -fInp rb 1024 -pathOut rb 1024 ;, 㤠 ᯠ -files rd 256 - -fZipInfo rb 40 - -RBProcInfo rb 1024 -temp_dir_pach rb 1024 -ODAreaPath rb 1024 - - - -;-------- - -copy_buf rb SIZE_COPY_BUF - -execdata rb 1024 -execdataend: - -filedata_buffer_size = 1024 -filedata_buffer rb filedata_buffer_size - -CopyDestEditBuf rb 12+512+1 -.length = $ - CopyDestEditBuf - 13 - -bdvkPack rb 560 - - - -;------------ memory_manager.inc -align 4 -MM_NBlocks rd 1 ;⢮ 뤥 -MM_BlocksInfo rd 2*MM_MAX_BLOCKS ;begin,size - - -;-------- - -buffer rb 4096 ;for string of file name for extract -params rb 4096 - - rb 1024 -stackUnpack: - - rb 1024 -stackDlg: - - rb 1024 -stack_top: - -end_mem: - - +;unz - ᯠ騪, ᯮ騩 archiver.obj. ন zip 7z. + +;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip +;-h - hide GUI. If params is empty - do exit. + +;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt +;or +;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt + + +; +;unz -n "namezone" "file.zip" - open packed file, write list files of main folder in namezone +;namezone: +;dd 0 - ᫨ , 1 +;dd cmd - 0 +; 1 ᯨ᮪ 䠩 +; 2 䠩 +; 3 ⠭ ⥪訩 ⠫ 娢 +; 4 ࠡ +;data - , +; 1 ᯨ᮪ 䠩 +; input +; none +; output +; dd numfiles - ⢮ 䠩 ⥪饬 ⠫ +; strz file1...fileN - ᯨ᮪ ப, ࠧ 0 +; 2 䠩 +; input +; dd num bytes +; strz filename (file1.txt of /fold1/file1.txt) +; output +; dd num bytes +; data + +use32 +org 0 +db 'MENUET01' +dd 1, start, init_end, end_mem, stack_top, params, 0 + + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), es_ES, en_US. +include '../../macros.inc' +include '../../proc32.inc' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../dll.inc' +;include '../../debug.inc' +include 'debug.inc' + +version equ '0.70' +version_dword equ 0*10000h + 70 + +WIN_W = 400 +SIZE_COPY_BUF = 1024*1024*2 +MM_MAX_BLOCKS equ 1024 + + +virtual at 0 +kfar_info_struc: +.lStructSize dd ? +.kfar_ver dd ? +.open dd ? +.open2 dd ? +.read dd ? +.write dd ? +.seek dd ? +.tell dd ? +.flush dd ? +.filesize dd ? +.close dd ? +.pgalloc dd ? +.pgrealloc dd ? +.pgfree dd ? +.getfreemem dd ? +.pgalloc2 dd ? +.pgrealloc2 dd ? +.pgfree2 dd ? +.menu dd ? +.menu_centered_in dd ? +.DialogBox dd ? +.SayErr dd ? +.Message dd ? +.cur_console_size dd ? +end virtual + + + +;-- CODE ------------------------------------------------------------------- + +include 'parse.inc' +include 'fs.inc' +include 'file_tree.inc' +include 'memory_manager.inc' +include 'dialogs.inc' + + +start: +;dnl +;dpsP params +;dnl + mcall 68, 11 + mcall 40, 100111b + 0C0000000h + stdcall dll.Load, IMPORTS + test eax, eax + jnz exit + mov [pathOut],0 + +;---------------------------- + ;1. find input file, clear + ;2. find -o, copy data, clear + ;3. find -f, add pointer, copy data, clear + ;4. find -c, check variable, clear +;1. + call getLastParam + test eax, eax + je wm_redraw + dec eax + je .arbeit + jmp errorParsing + +.arbeit: +;2. + call getParamOutPath + cmp eax, 2 + je errorParsing + +;3. + + @@: + mov eax, [iFiles] + shl eax, 2 + add eax, files + m2m dword[eax], dword[endPointer] + stdcall getParam, '-f' + cmp eax, 2 + je errorParsing + inc [iFiles] + cmp eax, 1 + je @b + +;4. + mov edi, params + mov ax,'-h' +@@: cmp word [edi], ax + je .check + inc edi + cmp edi, params+1024 + je @f + cmp byte[edi],0 + je @f + jmp @b +.check: + call startUnpack + mcall -1 +@@: + + stdcall [OpenDialog_Init],OpenDialog_data + +;init edit fields -------------- + xor al,al + mov edi,fInp + mov ecx,1024 + repne scasb + inc ecx + mov eax,1024 + sub eax,ecx + mov dword[edtPack.size],eax + mov dword[edtPack.pos],eax + + xor al, al + mov edi, pathOut + mov ecx, 1024 + repne scasb + inc ecx + mov eax, 1024 + sub eax, ecx + mov dword[edtUnpPath.size], eax + mov dword[edtUnpPath.pos], eax + +;main loop -------------------- +wm_redraw: + call winRedraw + +still: + mcall 10 + cmp eax, 1 + je wm_redraw + cmp eax, 2 + je wm_key + cmp eax, 3 + je wm_button + cmp eax, 6 + je wm_mouse + + jmp still + +wm_key: + mcall 2 + cmp [bWinChild],0 + jne still + + stdcall [edit_box_key],edtPack + stdcall [edit_box_key],edtUnpPath + + jmp still + + +wm_button: + mcall 17 + cmp [bWinChild],0 + jne still + + cmp ah, 3 + jne @f + call selectInput + jmp wm_redraw + @@: + cmp ah, 4 + jne @f + call selectOutFold + jmp wm_redraw + @@: + + cmp ah, 2 + jne @f + mcall 51,1,startUnpack,stackUnpack + mov [bWinChild],1 + ;call startUnpack + jmp wm_redraw + @@: + + cmp ah, 1 + je exit + jmp still + +wm_mouse: + cmp [bWinChild],0 + jne still + stdcall [edit_box_mouse],edtPack + stdcall [edit_box_mouse],edtUnpPath + jmp still + +exit: + mcall -1 + +errorParsing: +dph edx + + dps ' errorParsing' + mcall -1 + +;--- functions ------------------------------------------------------------------ + +proc winRedraw + mcall 12, 1 + mcall 48, 3, sc, sizeof.system_colors + mov edx, [sc.work] + or edx, 0x34000000 + mcall 0, <200,WIN_W>, <200,130>, , , title + mcall 8, <100,100>,<65,25>,2,[sc.work_button] + mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button] + mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button] + + edit_boxes_set_sys_color edtPack,endEdits,sc + stdcall [edit_box_draw],edtPack + stdcall [edit_box_draw],edtUnpPath + + + cmp [redInput],0 + jne @f + mov ecx,[sc.work_text] + or ecx,90000000h + jmp .l1 + @@: + mov ecx,90FF0000h + .l1: + mcall 4, <15,16>, , strInp + mov ecx,[sc.work_text] + or ecx,90000000h + mcall 4, <15,37>, , strPath + mov ecx,[sc.work_button_text] + or ecx,90000000h +if lang eq ru_RU + mcall 4, <107,70>, , strGo +else ; Default to en_US + mcall 4, <127,70>, , strGo +end if + mcall 4, <(WIN_W-47),12>, , strDots + mcall 4, <(WIN_W-47),37>, , strDots + + mcall 12, 2 + ret +endp + +;region +selectInput: + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + mov edi,ODAreaPath + xor al,al + or ecx,-1 + repne scasb + sub edi,ODAreaPath + dec edi + mov dword[edtPack+12*4],edi + mov ecx,edi + inc ecx + mov edi,fInp + mov esi,ODAreaPath + rep movsb + mov [redInput],0 + ret +;endregion + +;region +selectOutFold: + mov [OpenDialog_data.type],2 + stdcall [OpenDialog_Start],OpenDialog_data + mov edi,ODAreaPath + xor al,al + or ecx,-1 + repne scasb + sub edi,ODAreaPath + dec edi + mov dword[edtUnpPath+12*4],edi + mov ecx,edi + inc ecx + mov edi,pathOut + mov esi,ODAreaPath + rep movsb + ret +;endregion + + +;------------------------------------------------------------------------------- + +allfiles dd 0 +succfiles dd 0 +numbytes dd 0 + +proc startUnpack +locals + paramUnp rd 1 + sizeUnpack rd 1 + hFile rd 1 + hFileZip rd 1 + hPlugin rd 1 + pathFold rb 256 +endl +;if input not corrected + cmp [fInp],byte 0 + je .errNullInp + + ; mcall 68, 24, Exception, 0FFFFFFFFh ;?? +;init plugin + push ebp + stdcall [aPluginLoad],kfar_info + pop ebp + + +;set current directory, create folder + cmp [pathOut],0 + jne @f + lea eax,[pathFold] + stdcall cpLastName, fInp, eax + lea eax,[pathFold] + mov [fsNewDir.path],eax + mcall 70, fsNewDir + mov ecx, [fsNewDir.path] + + mcall 30,4,,1 + jmp .n +@@: + mcall 30,4,pathOut,1 +.n: + +;open and read first 1KB + stdcall open, fInp, O_READ + mov [hFileZip], eax + mcall 70,fsZip + test eax,eax + jnz .errNotFound + mcall 70,fsZipRead + + +;open pack + push ebp + stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp + pop ebp + + test eax,eax + jnz @f + cmp ebx,0 ;;/ !!!! + je .errNotFound ;;祭 ebx 祭 . + cmp ebx,400h + je .errNotSupp + @@: + mov [hPlugin],eax + +;get num of all files + ; stdcall calcSizeArch,[hPlugin] + push ebp + stdcall [aSetFolder],[hPlugin], .strRoot,0 + pop ebp +;unpack +; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); + push ebp + stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir + pop ebp + +jmp @f + .str1 db '/LICENSE.txt',0 + .strRoot db '.svn',0 +@@: + +;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); +; 䠩 filename. ࠬ mode १ࢨ஢ ⥪饩 ᨨ kfar ᥣ ࠢ 1. + ; push ebp + ; stdcall [aOpen], [hPlugin], .str1, O_READ + ; pop ebp + + ; mov [hFile],eax +;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); +;⥭ size buf 䠩 hFile, ࠭ ⮣ १ open. +;size ⥭ 512 +;頥 祭: ᫮ ⠭ , -1 訡. + ; push ebp + ; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF + ; pop ebp + ; +; mcall 70, fsWrite +;void __stdcall close(HANDLE hFile); + push ebp + stdcall [aClose], [hFile] + mov [bWinChild],0 + pop ebp + + push ebp + stdcall [aClosePlugin], [hPlugin] + mov [bWinChild],0 + + mov [fsRunNotifyOK.param],strUnpackOk + mcall 70,fsRunNotifyOK + pop ebp + ret ;SUCCESS + + +.errNotFound: +; stdcall SimpleSayErr,strNotFound + mov [bWinChild],0 + mov [fsRunNotifyOK.param],strUnpackFault + mcall 70,fsRunNotifyOK + ret + +.errNotSupp: + mov eax,[fsNewDir.path] + mov [fsDelDir.path],eax + mcall 70, fsDelDir + + mov [bWinChild],0 + mov [fsRunNotifyOK.param],strUnpackFault + mcall 70,fsRunNotifyOK + ret + +.errNullInp: + mov [redInput],1 + mov [bWinChild],0 + ret +endp + + +proc Exception param1:dword + stdcall SimpleSayErr,strErrorExc + ret +endp + +proc debugInt3 + dps '!!!!!!!!!!!!!!!!!!!!!!!!!' + dnl + int3 + ret +endp + + +allnumbytes dd 0 +strBackFold db '../',0 + +proc calcSizeArch hPlugin:dword +locals + bdwk rb 560 + num rd 1 +endl +;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, +; unsigned dirinfo_size, void* dirdata); + mov [num],0 + ; int3 +.mainloop: + push ebp + lea eax, [bdwk] + stdcall [aReadFolder], [hPlugin],[num],1,eax + pop ebp + + cmp eax,6 + je .lastFile +;?????????????????????????????????????????????????????????????????????????????????????????????????? + lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ + test [ebx],dword 10h + jz @f +;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, +; const char* absolute_path); + + push ebp + lea eax,[ebx+40] +dps 'Folder: ' +dpsP eax +dnl + stdcall [aSetFolder],[hPlugin], eax,0 + + pop ebp + stdcall calcSizeArch, [hPlugin] + inc [num] + jmp .mainloop + @@: + + lea ebx,[bdwk+0x20] +lea eax,[ebx+40] +dps 'File: ' +dpsP eax +dnl + mov eax,[ebx+32] + add [allnumbytes],eax + inc [num] + jmp .mainloop + +.lastFile: +; lea ebx,[bdwk+0x20] +; test [ebx],dword 10h +; jz @f +; +; push ebp +; lea eax,[ebx+40] +; stdcall [aSetFolder],[hPlugin], eax,0 +; pop ebp +; stdcall calcSizeArch, [hPlugin] +; @@: + + + push ebp + stdcall [aSetFolder],[hPlugin], strBackFold,0 + pop ebp + ret +endp + + +proc rec_calcSize hPlugin:dword +locals + bdwk rb 560 +endl +;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, +; unsigned dirinfo_size, void* dirdata); +;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path); + push ebp + lea eax,[bdwk] + stdcall [aReadFolder], [hPlugin],1,560,eax + pop ebp + + ret +endp +;------------------------------------------------------------------------------- +;------------------------------------------------------------------------------- +;------------------------------------------------------------------------------- + +hTrPlugin dd 0 + +;eax - file struct for sys70 + +proc rdFoldforTree +locals + fi rd 0 +endl + cmp [hTrPlugin],0 + je .exit + push ebx edi esi + + mov [fi],eax + push ebp + stdcall [aSetFolder],[hTrPlugin], [eax+20],0 + mov ebp,[esp] + ;hPlug,startBlock,numBlocks,buffer + stdcall [aReadFolder], [hTrPlugin],dword[eax+4],\ + dword[eax+12],dword[eax+16] + pop ebp + + ;cmp eax,6 + ;je .lastFile + + ;lea ebx,[bdwk+0x20] ;祬 ᬥ饭 +0x20 - ⭮ + + pop esi edi ebx +.exit: + ret +endp + +;-- DATA ------------------------------------------------------------------- + + + +sc system_colors + + +bWinChild db 0 ;1 - ୥ , ॠ஢ +redInput db 0 ;1 - ᢥ + +if lang eq ru_RU + title db 'uNZ v0.2 - ᯠ騪 Zip 7z',0 + strGo db 'ᯠ',0 + strInp db ' 娢',0 + strPath db ' ',0 + strError db '訡',0 + strErrorExc db ' 訡',0 + strOk db 'OK',0 + strGetPass db '஫',0 + strCancel db '⬥',0 + strUnpackOk db "'ᯥ譮 ᯠ' -O",0 + strUnpackFault db "'訡 ᯠ' -E",0 + strNotSupport db "'ন ଠ 娢' -E",0 + strNotFound db "' ' -E",0 +else if lang eq es_ES + title db 'uNZ v0.2 - Desarchivador para Zip y 7z',0 + strGo db 'Desarchivar',0 + strInp db 'Archivar',0 + strPath db 'Extraer en',0 + strError db 'Error',0 + strErrorExc db 'Error desconocido',0 + strOk db 'OK',0 + strGetPass db 'Contrasena',0 + strCancel db 'Cancelar',0 + strUnpackOk db "'Extracion exitosa' -O",0 + strUnpackFault db "'Fallo al extraer' -E",0 + strNotSupport db "'El formato del archivo no es soportado' -E",0 + strNotFound db "'Archivo no encontrado' -E",0 +else ; Default to en_US + title db 'uNZ v0.2 - Unarchiver of Zip and 7z',0 + strGo db 'Unpack',0 + strInp db 'Archive',0 + strPath db 'Extract to',0 + strError db 'Error',0 + strErrorExc db 'Unrecognized error',0 + strOk db 'OK',0 + strGetPass db 'Password',0 + strCancel db 'Cancel',0 + strUnpackOk db "'Unpacked successfully' -O",0 + strUnpackFault db "'Unpack failed' -E",0 + strNotSupport db "'Archive format is not supported' -E",0 + strNotFound db "'File not found' -E",0 +end if + + + +strDots db '...', 0 + +;-------- +; int __stdcall SayErr(int num_strings, const char* strings[], +; int num_buttons, const char* buttons[]); +; int __stdcall DialogBox(DLGDATA* dlg); + +stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel +errmess0 dd strErrorExc + + +kfar_info: + dd .size + dd version_dword + dd open + dd open2 + dd read + dd -1 ; write: to be implemented + dd seek + dd tell + dd -1 ; flush: to be implemented + dd filesize + dd close + dd xpgalloc + dd xpgrealloc + dd pgfree + dd getfreemem + dd debugInt3;libini_alloc + dd debugInt3;libini_realloc + dd debugInt3;libini_free + dd debugInt3;menu + dd debugInt3;menu_centered_in + dd DialogBox;DialogBox + dd SayErr ;SayErr + dd debugInt3;Message + dd 0 ;cur_width +.size = $ - kfar_info +;-------- + + +iFiles dd 0 ;⢮ ᯠ뢠 䠩 +endPointer dd buffer + + +fsZip: +.cmd dd 5 + dd 0 + dd 0 +.size dd 0 +.buf dd bdvkPack + db 0 + dd fInp + +fsZipRead: +.cmd dd 0 + dd 0 + dd 0 +.size dd 1024 +.buf dd filedata_buffer + db 0 + dd fInp + + +fsWrite: +.cmd dd 2 ;2 rewrite, 3 - write +.pos dd 0 +.hpos dd 0 +.size dd SIZE_COPY_BUF +.buf dd copy_buf + db 0 +.path dd 0 + + +fsNewDir: +.cmd dd 9 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 +.path dd 0 + +fsDelDir: +.cmd dd 8 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 +.path dd 0 + + + +fsRunNotifyOK: +.cmd dd 7 + dd 0 +.param dd strUnpackOk +.size dd 0 +.buf dd 0 + db '/sys/@notify',0 + + + +edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 1024, fInp, 0,0,0,0 +edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 1024, pathOut, 0,0,0,0 +edtPassword edit_box 200, 56, 40, 0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ + 255, 0, 0, ed_focus+ed_always_focus ;+ed_pass + +endEdits: + + + +;------------------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 ;0-open, 1-save, 2-select folder +.procinfo dd RBProcInfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd winRedraw ;+28 +.status dd 0 ;+32 +.openfile_pach dd ODAreaPath; ;+36 +.filename_area dd 0; ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 100 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 100 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: + db '/sys/File managers/opendial',0 + +communication_area_default_pach: + db '/sys',0 + +Filter dd 0 + + +; int __stdcall ReadFolder(HANDLE hPlugin, +; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata); +; void __stdcall ClosePlugin(HANDLE hPlugin); +; bool __stdcall SetFolder(HANDLE hPlugin, +; const char* relative_path, const char* absolute_path); +; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info); +; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], +; void* addfile, void* adddir); +; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile); +; bool __stdcall adddir(const char* name, void* bdfe_info); +; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info); +; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); +; void __stdcall setpos(HANDLE hFile, __int64 pos); +; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); +; void __stdcall close(HANDLE hFile); +IMPORTS: +library archiver, 'archiver.obj',\ + box_lib ,'box_lib.obj',\ + proc_lib,'proc_lib.obj' + +import archiver,\ + aPluginLoad , 'plugin_load',\ + aOpenFilePlugin , 'OpenFilePlugin',\ + aClosePlugin , 'ClosePlugin',\ + aReadFolder , 'ReadFolder',\ + aSetFolder , 'SetFolder',\ + aGetFiles , 'GetFiles',\ + aGetOpenPluginInfo , 'GetOpenPluginInfo',\ + aGetattr , 'getattr',\ + aOpen , 'open',\ + aRead , 'read',\ + aSetpos , 'setpos',\ + aClose , 'close',\ + aDeflateUnpack , 'deflate_unpack',\ + aDeflateUnpack2 , 'deflate_unpack2' + +import proc_lib,\ + OpenDialog_Init ,'OpenDialog_init',\ + OpenDialog_Start ,'OpenDialog_start' +import box_lib,\ + edit_box_draw ,'edit_box_draw',\ + edit_box_key ,'edit_box_key',\ + edit_box_mouse ,'edit_box_mouse' + + +IncludeIGlobals + +params1 db '-o "/hd0/1/unz/pig" -h "/hd0/1/unz/abc1"',0 +;-- UDATA ----------------------------------------------------------------------------- +init_end: +align 16 +IncludeUGlobals + +path rb 512 + +;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 +;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 + +fInp rb 1024 +pathOut rb 1024 ;, 㤠 ᯠ +files rd 256 + +fZipInfo rb 40 + +RBProcInfo rb 1024 +temp_dir_pach rb 1024 +ODAreaPath rb 1024 + + + +;-------- + +copy_buf rb SIZE_COPY_BUF + +execdata rb 1024 +execdataend: + +filedata_buffer_size = 1024 +filedata_buffer rb filedata_buffer_size + +CopyDestEditBuf rb 12+512+1 +.length = $ - CopyDestEditBuf - 13 + +bdvkPack rb 560 + + + +;------------ memory_manager.inc +align 4 +MM_NBlocks rd 1 ;⢮ 뤥 +MM_BlocksInfo rd 2*MM_MAX_BLOCKS ;begin,size + + +;-------- + +buffer rb 4096 ;for string of file name for extract +params rb 4096 + + rb 1024 +stackUnpack: + + rb 1024 +stackDlg: + + rb 1024 +stack_top: + +end_mem: + + diff --git a/programs/games/15/trunk/15.ASM b/programs/games/15/trunk/15.ASM index 40de75e22..0866c8789 100644 --- a/programs/games/15/trunk/15.ASM +++ b/programs/games/15/trunk/15.ASM @@ -1,490 +1,490 @@ -; -; The famous game 15 -; Author: Lloyd, coded by Ivushkin Andrey -; Compile with FASM -; - -include 'lang.inc' -include '..\..\..\macros.inc' ; decreases program size (not required) - -StatusColor equ 0x00ffffff -StatusColor2 equ 0x00dc1e14 -BgdColor equ 0x14aabbcc - -; Main window dimensions -XXwindow equ 200 shl 16+276 -YYwindow equ 200 shl 16+300 -; Status bar -XYstatus equ 35 shl 16+283 -XXbar equ 35 shl 16+136 -YYbar equ 280 shl 16+15 -; Buttons -BtnTop equ 28 -BtnLeft equ 13 -BtnSize equ 60 -BtnColor equ 0xafbb55 -BtnColor2 equ 0x0228c314 - -NumColor equ 0x10000000 -; Number shifting for nice look -NumShift equ 23 shl 16+23 -NumShift2 equ 4 shl 16 -; Shuffle button -XXSh equ 202 shl 16+60 -YYSh equ 280 shl 16+12 -XYShText equ 212 shl 16+283 - -; Conf button -XXCnf equ 13 shl 16+13 -YYCnf equ 280 shl 16+12 -XYCnfText equ 18 shl 16+283 - -; Position of the 'hole' -null equ (curconf+16) -; Amount of moves to perform shuffle -SH_CYCLES equ 400 -; (Amount of tasks)-1 -CONF_COUNT equ 2 - -use32 - - org 0x0 - - db 'MENUET01' - dd 0x01 - dd START - dd I_END - dd 0x2000 ; 8 Kb - dd 0x2000 - dd 0x0 - dd 0x0 - - -START: - mov [cptr],CONF_COUNT ; number of task - mov eax,3 - mcall - mov cl,16 - ror eax,cl - mov [generator],eax ; random generator from Tetris - init: - mov ecx,17 - movzx eax,[cptr] - inc eax - cmp eax,CONF_COUNT - jna init_ok - xor eax,eax ; cycling 0..CONF_COUNT - init_ok: - mov [cptr],al - mov esi,eax - shl esi,4 - add esi,conf - add esi,eax - add al,0x31 - mov [txtTitle+17],al ;task number to program title - mov [task],esi - mov edi,curconf - rep movsb ; initial configuration - - mov [sts],4 - jmp red -SHUF: - call shuffle ; immediate shuffle -red: ; window redraw - - call draw_window - -still: ; MAIN PROGRAM CYCLE - - mov eax,10 ; wait for event - mcall - - cmp eax,1 ; redraw? - - je red ; goto red - cmp eax,2 ; key pressed? - - je key ; goto key - cmp eax,3 ; button pressed? - - je button ; goto button - - jmp still ; no more events to process - - key: ; Key pressed - mov eax,2 - mcall - shr eax,8 - cmp eax,32 ; = Shuffle - je SHUF - cmp eax,13 ; = Choose task - je init - cmp eax,176 - jl still - sub eax,176 - cmp eax,3 - ja still - movzx eax,byte [eax+correct] ; 'delta' value from correct[] - jmp m_check - - button: ; Button pressed - mov eax,17 - mcall - shr eax,8 - sub eax,2 - - cmp eax,-1 ; id == 1 (closeme)? - jne noclose - mcall - - noclose: - jl SHUF ; Shuffle (id=0) pressed - cmp eax,18 - je init ; Conf button pressed - sub al,byte [null] - mov edi,correct - mov ecx,4 - repne scasb ; checking for valid move-part 1 - jne fail - m_check: - cmp byte[sts],4 ; puzzle completed, blocking buttons - ja still - call move_check ; checking for valid move-part 2 - jnc fail - inc [move_count] - call draw_moves -fail: - jmp still ; 頥 - -; ******************************* -; ******* WINDOW DRAWING ******* -; ******************************* - -draw_window: - - mcall 12, 1 ; begin draw - mcall 0, XXwindow, YYwindow, BgdColor,, txtTitle ; CREATING WINDOW - - - mov eax,8 ; SHUFFLE BUTTON - mov ebx,XXSh - mov ecx,YYSh - xor edx,edx - mov esi,BtnColor - mcall - - mov ebx,XXCnf ; CONF BUTTON - mov ecx,YYCnf - mov edx,20 - ;mov esi,BtnColor - mcall - - mov ebx, XYShText ; SHUFFLE TEXT - mov ecx, StatusColor - mov edx,txtSh - mov esi,lenSh-txtSh - mov eax,4 - mcall - - mov ebx, XYCnfText ; CONF TEXT - mov edx,lenVictory-1 - mov esi,1 - mcall - - mov ecx, 16 ; FIELD BUTTONS - dbut: - call draw_button - loop dbut - - call draw_moves - - mcall 12, 2 ; end of drawing - ret - - -; ********************************************* -; ******* DRAWING A FIELD BUTTON ************** -; ********************************************* -; ECX - button number - -draw_button: - pusha - dec ecx - ; calculating button dimensions - mov edi, ecx - lea edx,[ecx+2] - mov ebx,ecx - and ebx,11b - shr ecx,2 - - imul ebx,BtnSize+3 - add ebx,BtnLeft - shl ebx,16 - add ebx,BtnSize - - imul ecx,BtnSize+3 - add ecx,BtnTop - shl ecx,16 - add ecx,BtnSize - movzx eax,byte [null] - cmp eax,edi - jne no_hole - - pusha - inc ebx - inc ecx - mov edx,BgdColor - mov eax,13 ; clearing - 'hole' - mcall - popa - - or edx,0x80000000 ; and removing button under it -no_hole: - mov al,byte[edi+curconf] - mov esi,[task] - cmp al,byte[edi+esi] - je highlight - mov esi,BtnColor - jmp s_rbutton -highlight: - mov esi,BtnColor2 -s_rbutton: - mov eax,8 ; set/remove button - mcall - movzx eax,byte [null] - cmp eax,edi - je no_text ; no digits - that's hole - mov edx,ebx - shr ecx,16 - mov dx,cx - add edx,NumShift - mov ebx,0x20000 - movzx ecx,byte [edi+curconf] - cmp ecx,9 - ja two_num - add edx,NumShift2 ; shift to center digits - sub ebx,0x10000 -two_num: - mov esi,NumColor - mov eax,47 - mcall -no_text: - popa - ret - - -; ********************************************* -; ******* DRAWING STATUS LINE ***************** -; ********************************************* - -draw_moves: - mov eax, 13 ; clear area - mov ebx, XXbar - mov ecx, YYbar - mov edx, BgdColor - mcall - - mov eax, 4 - mov ebx, XYstatus - mov ecx, StatusColor - cmp ax, [sts] - jl report_victory - jne report_moves - mov edx,txtCnf ; prompt to choose configuration - mov esi,lenCnf-txtCnf - jmp e_dm - report_moves: - mov edx,txtMoves ; how many moves done - mov esi,lenMoves-txtMoves - mov eax,4 - mcall - mov esi,ecx - mov edx,ebx - add edx, 40 shl 16 - mov ebx,0x030000 - movzx ecx, byte[move_count] - mov eax,47 - jmp e_dm - report_victory: ; puzzle completed - mov ecx,StatusColor2 - mov edx,txtVictory - mov esi,lenVictory-txtVictory - e_dm: - mcall - ret - - -; ********************************************* -; ********* SHUFFLE *************************** -; ********************************************* - -shuffle: - xor eax,eax - mov [sts],ax - mov [move_count],ax ; reset moves to 0 - mov [sh_off],al - mov eax, [generator] - - mov ecx,SH_CYCLES - sh_cycle: - sub eax,0x43ab45b5 ; next random number - ror eax,1 - xor eax,0x32c4324f - ror eax,1 - mov [generator],eax - - push eax - and eax,11b ; direction 0..3 - movzx eax,byte [eax+correct] - call move_check - pop eax - jnc sh_cycle ; if fails then retry - loop sh_cycle - inc byte[sh_off] ; shuffling complete - ret - - -; ********************************************* -; ********* MOVE VALIDITY CHECK *************** -; ********************************************* -; AL - 'DELTA' DIRECTION - -move_check: - pusha - mov ah,byte [null] - mov bx,ax - cmp bh,3 - ja no_top - cmp al,-4 ; top of field - je no_move -no_top: - cmp bh,12 - jb no_bottom - cmp al,4 ; bottom of field - je no_move -no_bottom: - and bh,11b - cmp bh,0 - jnz no_left - cmp al,-1 ; left of field - je no_move -no_left: - cmp bh,11b - jnz ok - cmp al,1 ; right of field - je no_move -ok: - mov bx,ax - add bh,bl ; bh-new hole - mov byte [null],bh - movzx ecx,ah - mov al,byte[ecx+curconf] - movzx edx,bh - mov bl,byte[edx+curconf] ; swapping button & hole - mov byte[ecx+curconf],bl - mov byte[edx+curconf],al - - cmp byte[sh_off],0 ; if shuffle in progress, - jz no_win ; then no redraw - - ; drawing button & hole - inc ecx - call draw_button - movzx ecx,bh - inc ecx - call draw_button - ; testing if task completed - mov esi,[task] - mov edi,curconf - mov ecx,16 - repe cmpsb - cmp ecx,0 - jne no_win - mov word[sts],6 ; puzzle done. Victory! -no_win: - popa - stc - ret -no_move: - popa - clc - ret -; this is deprecated debug routine -;ud: -; ud2 - -; These are data used by program - -correct db 1,-4,4,-1 - -conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15 - db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 - db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9 - -txtMoves: -if lang eq ru_RU - db ':' -else if lang eq it_IT - db 'Movimenti:' -else if lang eq de_DE - db 'Bewegungen:' -else - db 'Moves:' -end if -lenMoves: - -txtSh: -if lang eq ru_RU - db 'ᮢ' -else if lang eq it_IT - db 'Mischia' -else if lang eq de_DE - db 'Mischen' -else - db 'Shuffle' -end if -lenSh: - -txtCnf: -if lang eq ru_RU - db '롥 ->' -else if lang eq it_IT - db 'Seleziona un compito, poi premi->' -else if lang eq de_DE - db 'Waehle eine Aufgabe, dann clicke au->' -else - db 'Select task, then press ->' -end if -lenCnf: - -txtTitle: ; ப -if lang eq ru_RU - db ' 15 - X', 0 -else if lang eq it_IT - db 'Gioco del quindici - partita X', 0 -else if lang eq de_DE - db '15-Puzzle - Spiel X', 0 -else - db 'Game 15 - puzzle X', 0 -end if - -txtVictory: -if lang eq ru_RU - db ' 訫 ! ->' -else if lang eq it_IT - db 'Gioco completato! Premi ->' -else if lang eq de_DE - db 'Spiel beendet! Druecken sie auf ->' -else - db 'Puzzle completed! Press->' -end if -lenVictory: - -arrow equ lenVictory-2 - -I_END: ; ணࠬ -;null db ? -move_count dw ? -cptr db ? -sts dw ? -sh_off db ? -task dd ? -generator dd ? -curconf: +; +; The famous game 15 +; Author: Lloyd, coded by Ivushkin Andrey +; Compile with FASM +; + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), it_IT, de_DE, en_US. +include '..\..\..\macros.inc' ; decreases program size (not required) + +StatusColor equ 0x00ffffff +StatusColor2 equ 0x00dc1e14 +BgdColor equ 0x14aabbcc + +; Main window dimensions +XXwindow equ 200 shl 16+276 +YYwindow equ 200 shl 16+300 +; Status bar +XYstatus equ 35 shl 16+283 +XXbar equ 35 shl 16+136 +YYbar equ 280 shl 16+15 +; Buttons +BtnTop equ 28 +BtnLeft equ 13 +BtnSize equ 60 +BtnColor equ 0xafbb55 +BtnColor2 equ 0x0228c314 + +NumColor equ 0x10000000 +; Number shifting for nice look +NumShift equ 23 shl 16+23 +NumShift2 equ 4 shl 16 +; Shuffle button +XXSh equ 202 shl 16+60 +YYSh equ 280 shl 16+12 +XYShText equ 212 shl 16+283 + +; Conf button +XXCnf equ 13 shl 16+13 +YYCnf equ 280 shl 16+12 +XYCnfText equ 18 shl 16+283 + +; Position of the 'hole' +null equ (curconf+16) +; Amount of moves to perform shuffle +SH_CYCLES equ 400 +; (Amount of tasks)-1 +CONF_COUNT equ 2 + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x2000 ; 8 Kb + dd 0x2000 + dd 0x0 + dd 0x0 + + +START: + mov [cptr],CONF_COUNT ; number of task + mov eax,3 + mcall + mov cl,16 + ror eax,cl + mov [generator],eax ; random generator from Tetris + init: + mov ecx,17 + movzx eax,[cptr] + inc eax + cmp eax,CONF_COUNT + jna init_ok + xor eax,eax ; cycling 0..CONF_COUNT + init_ok: + mov [cptr],al + mov esi,eax + shl esi,4 + add esi,conf + add esi,eax + add al,0x31 + mov [txtTitle+17],al ;task number to program title + mov [task],esi + mov edi,curconf + rep movsb ; initial configuration + + mov [sts],4 + jmp red +SHUF: + call shuffle ; immediate shuffle +red: ; window redraw + + call draw_window + +still: ; MAIN PROGRAM CYCLE + + mov eax,10 ; wait for event + mcall + + cmp eax,1 ; redraw? - + je red ; goto red + cmp eax,2 ; key pressed? - + je key ; goto key + cmp eax,3 ; button pressed? - + je button ; goto button + + jmp still ; no more events to process + + key: ; Key pressed + mov eax,2 + mcall + shr eax,8 + cmp eax,32 ; = Shuffle + je SHUF + cmp eax,13 ; = Choose task + je init + cmp eax,176 + jl still + sub eax,176 + cmp eax,3 + ja still + movzx eax,byte [eax+correct] ; 'delta' value from correct[] + jmp m_check + + button: ; Button pressed + mov eax,17 + mcall + shr eax,8 + sub eax,2 + + cmp eax,-1 ; id == 1 (closeme)? + jne noclose + mcall + + noclose: + jl SHUF ; Shuffle (id=0) pressed + cmp eax,18 + je init ; Conf button pressed + sub al,byte [null] + mov edi,correct + mov ecx,4 + repne scasb ; checking for valid move-part 1 + jne fail + m_check: + cmp byte[sts],4 ; puzzle completed, blocking buttons + ja still + call move_check ; checking for valid move-part 2 + jnc fail + inc [move_count] + call draw_moves +fail: + jmp still ; 頥 + +; ******************************* +; ******* WINDOW DRAWING ******* +; ******************************* + +draw_window: + + mcall 12, 1 ; begin draw + mcall 0, XXwindow, YYwindow, BgdColor,, txtTitle ; CREATING WINDOW + + + mov eax,8 ; SHUFFLE BUTTON + mov ebx,XXSh + mov ecx,YYSh + xor edx,edx + mov esi,BtnColor + mcall + + mov ebx,XXCnf ; CONF BUTTON + mov ecx,YYCnf + mov edx,20 + ;mov esi,BtnColor + mcall + + mov ebx, XYShText ; SHUFFLE TEXT + mov ecx, StatusColor + mov edx,txtSh + mov esi,lenSh-txtSh + mov eax,4 + mcall + + mov ebx, XYCnfText ; CONF TEXT + mov edx,lenVictory-1 + mov esi,1 + mcall + + mov ecx, 16 ; FIELD BUTTONS + dbut: + call draw_button + loop dbut + + call draw_moves + + mcall 12, 2 ; end of drawing + ret + + +; ********************************************* +; ******* DRAWING A FIELD BUTTON ************** +; ********************************************* +; ECX - button number + +draw_button: + pusha + dec ecx + ; calculating button dimensions + mov edi, ecx + lea edx,[ecx+2] + mov ebx,ecx + and ebx,11b + shr ecx,2 + + imul ebx,BtnSize+3 + add ebx,BtnLeft + shl ebx,16 + add ebx,BtnSize + + imul ecx,BtnSize+3 + add ecx,BtnTop + shl ecx,16 + add ecx,BtnSize + movzx eax,byte [null] + cmp eax,edi + jne no_hole + + pusha + inc ebx + inc ecx + mov edx,BgdColor + mov eax,13 ; clearing - 'hole' + mcall + popa + + or edx,0x80000000 ; and removing button under it +no_hole: + mov al,byte[edi+curconf] + mov esi,[task] + cmp al,byte[edi+esi] + je highlight + mov esi,BtnColor + jmp s_rbutton +highlight: + mov esi,BtnColor2 +s_rbutton: + mov eax,8 ; set/remove button + mcall + movzx eax,byte [null] + cmp eax,edi + je no_text ; no digits - that's hole + mov edx,ebx + shr ecx,16 + mov dx,cx + add edx,NumShift + mov ebx,0x20000 + movzx ecx,byte [edi+curconf] + cmp ecx,9 + ja two_num + add edx,NumShift2 ; shift to center digits + sub ebx,0x10000 +two_num: + mov esi,NumColor + mov eax,47 + mcall +no_text: + popa + ret + + +; ********************************************* +; ******* DRAWING STATUS LINE ***************** +; ********************************************* + +draw_moves: + mov eax, 13 ; clear area + mov ebx, XXbar + mov ecx, YYbar + mov edx, BgdColor + mcall + + mov eax, 4 + mov ebx, XYstatus + mov ecx, StatusColor + cmp ax, [sts] + jl report_victory + jne report_moves + mov edx,txtCnf ; prompt to choose configuration + mov esi,lenCnf-txtCnf + jmp e_dm + report_moves: + mov edx,txtMoves ; how many moves done + mov esi,lenMoves-txtMoves + mov eax,4 + mcall + mov esi,ecx + mov edx,ebx + add edx, 40 shl 16 + mov ebx,0x030000 + movzx ecx, byte[move_count] + mov eax,47 + jmp e_dm + report_victory: ; puzzle completed + mov ecx,StatusColor2 + mov edx,txtVictory + mov esi,lenVictory-txtVictory + e_dm: + mcall + ret + + +; ********************************************* +; ********* SHUFFLE *************************** +; ********************************************* + +shuffle: + xor eax,eax + mov [sts],ax + mov [move_count],ax ; reset moves to 0 + mov [sh_off],al + mov eax, [generator] + + mov ecx,SH_CYCLES + sh_cycle: + sub eax,0x43ab45b5 ; next random number + ror eax,1 + xor eax,0x32c4324f + ror eax,1 + mov [generator],eax + + push eax + and eax,11b ; direction 0..3 + movzx eax,byte [eax+correct] + call move_check + pop eax + jnc sh_cycle ; if fails then retry + loop sh_cycle + inc byte[sh_off] ; shuffling complete + ret + + +; ********************************************* +; ********* MOVE VALIDITY CHECK *************** +; ********************************************* +; AL - 'DELTA' DIRECTION + +move_check: + pusha + mov ah,byte [null] + mov bx,ax + cmp bh,3 + ja no_top + cmp al,-4 ; top of field + je no_move +no_top: + cmp bh,12 + jb no_bottom + cmp al,4 ; bottom of field + je no_move +no_bottom: + and bh,11b + cmp bh,0 + jnz no_left + cmp al,-1 ; left of field + je no_move +no_left: + cmp bh,11b + jnz ok + cmp al,1 ; right of field + je no_move +ok: + mov bx,ax + add bh,bl ; bh-new hole + mov byte [null],bh + movzx ecx,ah + mov al,byte[ecx+curconf] + movzx edx,bh + mov bl,byte[edx+curconf] ; swapping button & hole + mov byte[ecx+curconf],bl + mov byte[edx+curconf],al + + cmp byte[sh_off],0 ; if shuffle in progress, + jz no_win ; then no redraw + + ; drawing button & hole + inc ecx + call draw_button + movzx ecx,bh + inc ecx + call draw_button + ; testing if task completed + mov esi,[task] + mov edi,curconf + mov ecx,16 + repe cmpsb + cmp ecx,0 + jne no_win + mov word[sts],6 ; puzzle done. Victory! +no_win: + popa + stc + ret +no_move: + popa + clc + ret +; this is deprecated debug routine +;ud: +; ud2 + +; These are data used by program + +correct db 1,-4,4,-1 + +conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15 + db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 + db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9 + +txtMoves: +if lang eq ru_RU + db ':' +else if lang eq it_IT + db 'Movimenti:' +else if lang eq de_DE + db 'Bewegungen:' +else ; Default to en_US + db 'Moves:' +end if +lenMoves: + +txtSh: +if lang eq ru_RU + db 'ᮢ' +else if lang eq it_IT + db 'Mischia' +else if lang eq de_DE + db 'Mischen' +else ; Default to en_US + db 'Shuffle' +end if +lenSh: + +txtCnf: +if lang eq ru_RU + db '롥 ->' +else if lang eq it_IT + db 'Seleziona un compito, poi premi->' +else if lang eq de_DE + db 'Waehle eine Aufgabe, dann clicke au->' +else ; Default to en_US + db 'Select task, then press ->' +end if +lenCnf: + +txtTitle: ; ப +if lang eq ru_RU + db ' 15 - X', 0 +else if lang eq it_IT + db 'Gioco del quindici - partita X', 0 +else if lang eq de_DE + db '15-Puzzle - Spiel X', 0 +else ; Default to en_US + db 'Game 15 - puzzle X', 0 +end if + +txtVictory: +if lang eq ru_RU + db ' 訫 ! ->' +else if lang eq it_IT + db 'Gioco completato! Premi ->' +else if lang eq de_DE + db 'Spiel beendet! Druecken sie auf ->' +else ; Default to en_US + db 'Puzzle completed! Press->' +end if +lenVictory: + +arrow equ lenVictory-2 + +I_END: ; ணࠬ +;null db ? +move_count dw ? +cptr db ? +sts dw ? +sh_off db ? +task dd ? +generator dd ? +curconf: diff --git a/programs/games/Dungeons/data.inc b/programs/games/Dungeons/data.inc index 687daa997..6745d93b9 100644 --- a/programs/games/Dungeons/data.inc +++ b/programs/games/Dungeons/data.inc @@ -1,93 +1,97 @@ -include 'lang.inc' - -struc langstr [lng, data] -{ - if lang eq lng - sz ., data - end if -} - -struc langstr0 [lng, data] -{ - if lang eq lng - sz0 ., data - end if -} - -include 'AKODE/data.inc' -include 'Resources/Textures/textures.inc' -include 'Resources/Levels/levels.inc' - -FULLSCREEN = 0 -FSAA = 0 -DISABLE_SHADING = 0 - -MOVEMENT_SPEED = BLOCK_BASE_SIZE + BLOCK_BASE_SIZE / 4 - -FIELD_OF_VIEW = 60 -BLOCK_BASE_SIZE = 512 -BLOCK_HEIGHT = 512 - -INVENTORY_SIZE = 10 - -HUD_PANEL_HEIGHT = 120 - -INVENTORY_X = 570 -INVENTORY_Y = 15 -INVENTORY_PADDING_X = 10 -INVENTORY_PADDING_Y = 10 -OBJECT_IMAGE_WIDTH = 40 -OBJECT_IMAGE_HEIGHT = 40 - -GAME_MESSAGE_X = 150 + 15 -GAME_MESSAGE_Y = 15 + 15 -GAME_MESSAGE_COLOR = 0E4E2ADh - -if FULLSCREEN - ;MAIN_WINDOW_X = 0 - ;MAIN_WINDOW_Y = 0 - ;MAIN_WINDOW_WIDTH = 0FFFFh - ;MAIN_WINDOW_HEIGHT = 0FFFFh - MAIN_WINDOW_STYLE = (01000001b) shl 24 - MAIN_WINDOW_STYLE2 = 1 shl 24 -else - MAIN_WINDOW_X = 20 - MAIN_WINDOW_Y = 20 - MAIN_WINDOW_WIDTH = 960 ; client area width - MAIN_WINDOW_HEIGHT = 712 ; client area height - MAIN_WINDOW_STYLE = (01110100b) shl 24 - MAIN_WINDOW_STYLE2 = 0 -end if - -MAIN_EVENT_MASK = EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE or EVM_MOUSE_FILTER - -MAIN_WINDOW_TITLE langstr0 \ - en_US, 'Dungeons of Augastes 0.1', \ - ru_RU, ' 㣠 0.1' - -LevelLoadingImageFile db 'Resources/Textures/HUD/LevelLoading.png', 0 -HudPanelImageFile db 'Resources/Textures/HUD/Panel.png', 0 -DeathImageFile db 'Resources/Textures/HUD/Death.png', 0 -EndImageFile db 'Resources/Textures/HUD/End.png', 0 - -align 4 -LevelLoadingImagePtr dd 0 -HudPanelImagePtr dd 0 -DeathImagePtr dd 0 -EndImagePtr dd 0 - -ImageBufferPtr dd 0 - -HudPanelNeedsRedraw dd 0 - -GameMessage dd 0 -GameStatus dd 0 - -GAME_STATUS.LEVEL_LOAD_FAILED = 1 -GAME_STATUS.DEAD = 2 -GAME_STATUS.END = 3 - -ACTION.DO_SOMETHING = AKODE_ACTION.CUSTOM + 1 -ACTION.LOOK_AROUND = AKODE_ACTION.CUSTOM + 2 -ACTION.USE_OBJECT = AKODE_ACTION.CUSTOM + 3 -ACTION.LOOK_AT_OBJECT = AKODE_ACTION.CUSTOM + 4 +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +; FIXME: +; This translation mechanism should fallback to en_US if the language +; is unlisted (e.g. es_ES). Either fix the macros or use a different method. +; The problem doesn't manifest, as we only bundle Dungeons in the RU distro. +struc langstr [lng, data] +{ + if lang eq lng + sz ., data + end if +} + +struc langstr0 [lng, data] +{ + if lang eq lng + sz0 ., data + end if +} + +include 'AKODE/data.inc' +include 'Resources/Textures/textures.inc' +include 'Resources/Levels/levels.inc' + +FULLSCREEN = 0 +FSAA = 0 +DISABLE_SHADING = 0 + +MOVEMENT_SPEED = BLOCK_BASE_SIZE + BLOCK_BASE_SIZE / 4 + +FIELD_OF_VIEW = 60 +BLOCK_BASE_SIZE = 512 +BLOCK_HEIGHT = 512 + +INVENTORY_SIZE = 10 + +HUD_PANEL_HEIGHT = 120 + +INVENTORY_X = 570 +INVENTORY_Y = 15 +INVENTORY_PADDING_X = 10 +INVENTORY_PADDING_Y = 10 +OBJECT_IMAGE_WIDTH = 40 +OBJECT_IMAGE_HEIGHT = 40 + +GAME_MESSAGE_X = 150 + 15 +GAME_MESSAGE_Y = 15 + 15 +GAME_MESSAGE_COLOR = 0E4E2ADh + +if FULLSCREEN + ;MAIN_WINDOW_X = 0 + ;MAIN_WINDOW_Y = 0 + ;MAIN_WINDOW_WIDTH = 0FFFFh + ;MAIN_WINDOW_HEIGHT = 0FFFFh + MAIN_WINDOW_STYLE = (01000001b) shl 24 + MAIN_WINDOW_STYLE2 = 1 shl 24 +else + MAIN_WINDOW_X = 20 + MAIN_WINDOW_Y = 20 + MAIN_WINDOW_WIDTH = 960 ; client area width + MAIN_WINDOW_HEIGHT = 712 ; client area height + MAIN_WINDOW_STYLE = (01110100b) shl 24 + MAIN_WINDOW_STYLE2 = 0 +end if + +MAIN_EVENT_MASK = EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE or EVM_MOUSE_FILTER + +MAIN_WINDOW_TITLE langstr0 \ + en_US, 'Dungeons of Augastes 0.1', \ + ru_RU, ' 㣠 0.1' + +LevelLoadingImageFile db 'Resources/Textures/HUD/LevelLoading.png', 0 +HudPanelImageFile db 'Resources/Textures/HUD/Panel.png', 0 +DeathImageFile db 'Resources/Textures/HUD/Death.png', 0 +EndImageFile db 'Resources/Textures/HUD/End.png', 0 + +align 4 +LevelLoadingImagePtr dd 0 +HudPanelImagePtr dd 0 +DeathImagePtr dd 0 +EndImagePtr dd 0 + +ImageBufferPtr dd 0 + +HudPanelNeedsRedraw dd 0 + +GameMessage dd 0 +GameStatus dd 0 + +GAME_STATUS.LEVEL_LOAD_FAILED = 1 +GAME_STATUS.DEAD = 2 +GAME_STATUS.END = 3 + +ACTION.DO_SOMETHING = AKODE_ACTION.CUSTOM + 1 +ACTION.LOOK_AROUND = AKODE_ACTION.CUSTOM + 2 +ACTION.USE_OBJECT = AKODE_ACTION.CUSTOM + 3 +ACTION.LOOK_AT_OBJECT = AKODE_ACTION.CUSTOM + 4 diff --git a/programs/games/arcanii/trunk/arcanii.asm b/programs/games/arcanii/trunk/arcanii.asm index f142b2d03..8fb22c59f 100644 --- a/programs/games/arcanii/trunk/arcanii.asm +++ b/programs/games/arcanii/trunk/arcanii.asm @@ -4,7 +4,7 @@ ; contact: 4nic8@casiocalc.org ;---------------------------------------- -include 'lang.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. include '../../../macros.inc' include 'ascl.inc' include 'ascgl.inc' @@ -142,7 +142,7 @@ still: ; ********************************************* show_screen: ; flips the virtual screen to the window - push_abc + push_abc mcall 7, screen, , 0 pop_abc ret @@ -389,7 +389,7 @@ grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack .no_ch: pop ecx loop .lab1 - + pop_abc ret @@ -409,7 +409,7 @@ intro: ; INTRO ; jne @f ret @@: - + mcall 4,<115,150>,0x82050505,VERSION mcall ,<125,180>,0x80050505,AUTHOR mcall ,<90,210>,0x81EE0800,PRESS_SPACE @@ -468,13 +468,13 @@ fast_gfx: mov ebx,0xFFFF .g_ok: call grad_fill_screen - + ;black_bg ;mov eax,0 ;mov ebx,0 ;call fill_screen - + mov eax,37 ; get mouse position mov ebx,1 mcall @@ -805,7 +805,7 @@ draw_window: mcall 48,4 lea ecx, [100*65536+Y_SIZE+4+eax]; [y start] *65536 + [y size] + [skin_height] mcall 0,<100,X_SIZE+9>,,0x74ffffff,,0 - + mov eax, [lives] add eax, '0' mov esi, HEADER @@ -836,7 +836,7 @@ if lang eq it_IT THANKS_FOR_PLAYING db 'Grazie per aver giocato', 0 PRESS_SPACE db 'Premi spazio per iniziare',0 LEVEL db 'LIVELLO',0 -else +else ; Default to en_US THANKS_FOR_PLAYING db 'Thanks for playing', 0 PRESS_SPACE db 'press SPACE to start',0 LEVEL db 'LEVEL',0 diff --git a/programs/games/arcanoid/trunk/arcanoid.asm b/programs/games/arcanoid/trunk/arcanoid.asm index 7339c626b..784d7e4cc 100644 --- a/programs/games/arcanoid/trunk/arcanoid.asm +++ b/programs/games/arcanoid/trunk/arcanoid.asm @@ -19,7 +19,7 @@ ;****************************************************************************** -include 'lang.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. include '..\..\..\macros.inc' include 'ascl.inc' include 'ascgl.inc' @@ -285,7 +285,7 @@ end_col: cmp [delay_cnt],0 jne no_delay mov [delay_cnt],1 - delay 1 ;don't generate delay for fast speed programm + delay 1 ; don't generate delay for fast speed program no_delay: dec [delay_cnt] @@ -297,9 +297,9 @@ win_test: mov [againbut],1 call draw_window ; label 160,200,'You Win!',cl_Green+font_Big -; label 130,220,'Youre Score:',cl_Green+font_Big +; label 130,220,'Your Score:',cl_Green+font_Big ; outcount dword [scorea],230,220,cl_Green,5*65536 -; label 130,234,'Youre Lives:',cl_Green+font_Big +; label 130,234,'Your Lives:',cl_Green+font_Big ; outcount dword [scoreb],230,234,cl_Green,5*65536 ; delay 600 ;wait 2sec ; close ;exit from program @@ -310,7 +310,7 @@ lose_test: jne stl2 ; call draw_window ; label 160,200,'You Lose!',cl_Red+font_Big -; label 130,220,'Youre Score:',cl_Red+font_Big +; label 130,220,'Your Score:',cl_Red+font_Big ; outcount dword [scorea],230,220,cl_Red,5*65536 ; delay 300 ;wait 2sec ; close ;exit from program @@ -420,7 +420,7 @@ draw_window: window 0,0,400+8,480+24,window_Skinned if lang eq it_IT label 12,8,'ARCANOID: Usa le freccie Vite Punti',cl_White+font_Big - else + else ; Default to en_US label 12,8,'ARCANOID: USE ARROW KEYS LIVES SCORE',cl_White+font_Big end if @@ -433,9 +433,9 @@ draw_window: if lang eq it_IT label 160,200,'Hai perso!',cl_Red+font_Big label 130,220,'Punteggio:',cl_Red+font_Big - else + else ; Default to en_US label 160,200,'You Lose!',cl_Red+font_Big - label 130,220,'Youre Score:',cl_Red+font_Big + label 130,220,'Your Score:',cl_Red+font_Big end if outcount dword [scorea],230,220,cl_Red,5*65536 mov ebx,150*65536+80 @@ -449,7 +449,7 @@ draw_window: mcall if lang eq it_IT label 152,244,'Rigioca',cl_Red+font_Big - else + else ; Default to en_US label 152,244,'Play again?',cl_Red+font_Big end if jmp elev @@ -457,9 +457,9 @@ nlev: if lang eq it_IT label 160,200,'Hai vinto!',cl_Green+font_Big label 130,220,'Punteggio:',cl_Green+font_Big - else + else ; Default to en_US label 160,200,'You Win!',cl_Green+font_Big - label 130,220,'Youre Score:',cl_Green+font_Big + label 130,220,'Your Score:',cl_Green+font_Big end if outcount dword [scorea],230,220,cl_Green,5*65536 mov ebx,150*65536+120 ;mov ebx,150*65536+80 @@ -473,13 +473,13 @@ nlev: mcall if lang eq it_IT label 152,244,'Prossimo Livello',cl_Red+font_Big - else + else ; Default to en_US label 152,244,'Next level?',cl_Red+font_Big end if elev: if lang eq it_IT label 178,264,'Esci',cl_Red+font_Big - else + else ; Default to en_US label 178,264,'Exit?',cl_Red+font_Big end if diff --git a/programs/games/bomber/bomber.asm b/programs/games/bomber/bomber.asm index c205cd424..324d52fb2 100644 --- a/programs/games/bomber/bomber.asm +++ b/programs/games/bomber/bomber.asm @@ -1,2369 +1,2369 @@ -; - -SK_SPACE equ 0x39 -SK_CTRL equ 0x1D -SK_UP equ 0x48 -SK_DOWN equ 0x50 -SK_LEFT equ 0x4B -SK_RIGHT equ 0x4D -SK_ESC equ 0x01 - - -INIT_PLANE_X equ 20 -INIT_PLANE_Y equ 20 -BACK_COLOR equ 0x9bcdfa -GROUND_COLOR equ 0x808080 -BANG_COLOR equ 0xB0140E -ANIM_PLANE_BMP_PIXELS_COUNT equ 22*32*32 -WINDOW_WIDTH equ 800 -WINDOW_HEIGHT equ 600 -GROUNG_HEIGHT equ 100 -CITY_OFFSET equ (WINDOW_WIDTH-32*20)/2 -MAX_BOMBS equ 8 -GRAVY_ACCEL equ 1 -BOMB_DELAY equ 12 -MAX_LEVEL equ 5 -ACKACK_BULLET_SPEED equ 17 -BULLET_SIZE equ 7 -MAX_SOUNDS equ 8 - -VOLUME_BOMBFLY equ 16 -VOLUME_BOMBBANG equ 28 -VOLUME_ACKACK equ 24 -VOLUME_PLANE equ 48 -VOLUME_ARW equ 16 - - -use32 ; , 32 - org 0x0 ; , 0x0 - db 'MENUET01' ; (8 ) - dd 0x1 ; - dd start ; , - ; - dd i_end ; - dd i_end ; , 0100 - dd i_end ; , . , - dd 0x0, _s_current_dir ; . - ; , - ; - - ; , , - ; -; - -;----------------- include ------------------------------------- -include 'lang.inc' -include 'ssmix.inc' - -;--------------------------------------------------------------------------- -;----------------------------- -------------------------------- -;--------------------------------------------------------------------------- - -align 4 -start: ; - - ; : - - mov eax, 66 - mov ebx, 1 - mov ecx, 1 - int 0x40 - - ; - mov eax, 68 - mov ebx, 11 - int 0x40 - cmp eax, 1000000 ; ~1000 ( ) - ja heap_ok - mov eax, -1 - int 0x40 ; - heap_ok: - - mov eax, bmp_plane - mov ebx, 736*32*3 - call convert_bmp_backcolor - mov eax, bmp_bomb - mov ebx, 96*16*3 - call convert_bmp_backcolor - mov eax, bmp_tile - mov ebx, 20*20*3 - call convert_bmp_backcolor - mov eax, bmp_ackack - mov ebx, 40*20*3 - call convert_bmp_backcolor - - call read_sounds_file - call ssmix_init - - mov [_game_state], 0 - -redraw_window: - call draw_window - cmp [_game_state], 0 - jne still_no_intro - call draw_intro - still_no_intro: - -still: - ; - mov eax,11 - int 0x40 - cmp eax,1 - je redraw_window - cmp eax,2 - je key - cmp eax,3 - je close_button - - ; - mov eax,5 - mov ebx,1 - int 0x40 - - mov eax, 26 - mov ebx, 9 - int 0x40 - mov ebx, eax - sub eax, [_last_value_timecount] - cmp eax, [_delay] - jbe still - mov [_last_value_timecount], ebx - - call timer_x2 - call timer_x4 - - ; - cmp [_game_state], 1 - jne still_no_game - ; - mov eax, [_plane_health] - cmp eax, 0 - jle still_no_plane - call flight_control_plane - call plane_interaction - call draw_plane - still_no_plane: - call draw_plane_health - call bomb_proc - call bang_proc - call ground_draw - call city_draw - call ackack_draw - call ackack_bullet_proc - ; - call game_over_timer - still_no_game: - - jmp still - - -key: ; - mov eax,2 - int 0x40 - - push eax - key_SPACE: - cmp ah, SK_SPACE - jne key_SPACE_end - cmp [_game_state], 1 - je key_SPACE_do_a_barrel_roll - key_SPACE_start_game: ; - mov [_game_state], 1 - call init_game_state - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll: ; - mov eax, [_plane_state] - cmp eax, 0 - je key_SPACE_do_a_barrel_roll_r - cmp eax, 1 - je key_SPACE_do_a_barrel_roll_l - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll_r: - mov eax,[_X_plane] - cmp eax, WINDOW_WIDTH-130-32 - jg key_SPACE_end - mov [_plane_state], 4 - mov [_plane_state_step], 0 - jmp key_SPACE_end - key_SPACE_do_a_barrel_roll_l: - mov eax,[_X_plane] - cmp eax, 130 - jl key_SPACE_end - mov [_plane_state], 5 - mov [_plane_state_step], 0 - key_SPACE_end: - pop eax - - key_CTRL: - cmp ah, SK_CTRL - jne key_CTRL_end - call bomb_drop - key_CTRL_end: - - key_UP: - cmp ah, SK_UP - jne key_UP_end - cmp [_game_state], 0 - jne key_UP_end - mov ebx, [_level_num] - inc ebx - mov [_level_num], ebx - cmp ebx, MAX_LEVEL - jbe key_UP_no_max - mov [_level_num], MAX_LEVEL - key_UP_no_max: - call draw_level_num - key_UP_end: - - key_DOWN: - cmp ah, SK_DOWN - jne key_DOWN_end - cmp [_game_state], 0 - jne key_DOWN_end - mov ebx, [_level_num] - dec ebx - mov [_level_num], ebx - cmp ebx, 1 - jae key_DOWN_no_min - mov [_level_num], 1 - key_DOWN_no_min: - call draw_level_num - key_DOWN_end: - - - key_LEFT: - cmp ah, SK_LEFT - jne key_LEFT_end - cmp [_game_state], 0 - jne key_LEFT_end - mov ebx, [_set_volume] - dec ebx - cmp ebx, 0 - jge @f - mov ebx, 0 - @@: - mov [_set_volume], ebx - shl ebx, 4 - stdcall ssmix_setvolume, ebx, ebx - call draw_volume_num - key_LEFT_end: - - - key_RIGHT: - cmp ah, SK_RIGHT - jne key_RIGHT_end - cmp [_game_state], 0 - jne key_RIGHT_end - mov ebx, [_set_volume] - inc ebx - cmp ebx, 8 - jle @f - mov ebx, 8 - @@: - mov [_set_volume], ebx - shl ebx, 4 - stdcall ssmix_setvolume, ebx, ebx - call draw_volume_num - key_RIGHT_end: - - - key_ESC: - cmp ah, SK_ESC - jne key_ESC_end - jmp close_button - key_ESC_end: - - jmp still - - - - -close_button: ; - - call ssmix_release - call sounds_free_memory - ; - mov eax, -1 - int 0x40 - - -;--------------------------------------------------------------------------- -;----------------------------- --------------------------------- -;--------------------------------------------------------------------------- - - -convert_bmp_backcolor: ; eax - , ebx - - - push ecx - cbb_loop: - cmp ebx, 0 - jle cbb_loop_end - mov ecx, [eax] - and ecx, 0x00FFFFFF - cmp ecx, 0x00FFFFFF - jne @f - mov ecx, BACK_COLOR - mov [eax], cl - shr ecx, 8 - mov [eax+1], cl - shr ecx, 8 - mov [eax+2], cl - @@: - add eax, 3 - sub ebx, 3 - jmp cbb_loop - cbb_loop_end: - pop ecx - - ret - -; -read_sounds_file: - - mov edi, _s_current_dir - mov al, 0 - mov ecx, 4096 - repne scasb - mov dword[edi-1], 'data' - mov dword[edi+3], '.bin' - mov [_flag_bomberdatabin_ok], 1 - ; - mov [_fi_func], 0 - mov [_fi_pos], 8 - mov [_fi_size], 4 - mov [_fi_pbuff], _count_sounds - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - cmp ebx, -1 - jne @f - mov [_flag_bomberdatabin_ok], 0 - jmp .end - @@: - ; , () - mov ecx, [_count_sounds] - shl ecx, 3 - mov [_fi_func], 0 - mov [_fi_pos], 12 - mov [_fi_size], ecx - mov [_fi_pbuff], _array_sounds - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - ; - mov ecx, [_count_sounds] - mov esi, _array_sounds - .loop: - push ecx - ; - mov [_fi_func], 0 - mov eax, [esi] - mov [_fi_pos], eax - mov eax, [esi+4] - mov [_fi_size], eax - ; , , - mov ecx, [esi+4] - mov eax, 68 - mov ebx, 12 - int 0x40 - mov [esi], eax - mov ecx, [esi+4] - add ecx, eax - mov [esi+4], ecx - ; - mov [_fi_pbuff], eax - mov [_fi_pfilename], _s_current_dir - mov eax, 70 - mov ebx, file_info - int 0x40 - pop ecx - add esi, 8 - dec ecx - jnz .loop - .end: - - ret - - -sounds_free_memory: - - mov ecx, [_count_sounds] - mov esi, _array_sounds - .loop: - push ecx - ; , , - mov eax, 68 - mov ebx, 13 - mov ecx, [esi] - int 0x40 - pop ecx - add esi, 8 - dec ecx - jnz .loop - - - ret - - -init_game_state: ; - mov [_game_over_time], 0 - mov [_X_plane], INIT_PLANE_X - mov [_Y_plane], INIT_PLANE_Y - mov [_VX_plane], 4 - mov [_plane_state], 0 - mov [_anim_pos_plane], 0 - mov [_plane_health], 100 - mov [_timer_x2], 0 - mov [_timer_x4], 0 - mov [_bomb_count], 0 - mov [_bomb_delay_time], 0 - mov [_addit_VY_plane], 0 - mov [_flag_air_raid_warning], 0 - - call load_level - - ; - mov ebx, _bang_array - xor ecx, ecx - igs_bang_array_loop: - cmp ecx, MAX_BOMBS - jae igs_bang_array_loop_end - mov eax, -1 - mov [ebx], eax - add ebx, 8 - inc ecx - jmp igs_bang_array_loop - igs_bang_array_loop_end: - ; - mov ebx, _ackack_bullet - xor ecx, ecx - igs_bullet_array_loop: - cmp ecx, 32 - jae igs_bullet_array_loop_end - mov eax, 0 - mov [ebx], eax - add ebx, 4 - inc ecx - jmp igs_bullet_array_loop - igs_bullet_array_loop_end: - - ; - call draw_window - - ; - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 4 ))-1)], [_array_sounds+8*((( 4 ))-1)+4], VOLUME_PLANE, VOLUME_PLANE, SSMIX_CHANMODE_REPEAT - @@: - mov [_channel_sound_plane], eax - - mov [_channel_sound_arw], -1 - - ret - - - -game_over: - - mov [_game_over_time], 30 ; game over - ; GAME OVER - mov eax,4 - mov ebx,(WINDOW_WIDTH/2 - 50)*65536 + 30 - mov ecx,0x80000000 - mov edx,_text_game_over - int 0x40 - - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_stoptrack, [_channel_sound_plane] - @@: - - ret - - -game_over_timer: ; , - - mov ebx, [_game_over_time] - cmp ebx, 0 - je got_end - dec ebx - mov [_game_over_time], ebx - cmp ebx, 0 - jg got_end - mov [_game_state], 0 - cmp [_flag_bomberdatabin_ok], 1 - jne @f - call ssmix_stopalltracks - @@: - call draw_window - call draw_intro - got_end: - - ret - - -next_level: ; - - push eax - mov [_game_over_time], 1 ; - mov eax, [_level_num] ; - inc eax - cmp eax, MAX_LEVEL - jbe next_level_no_overmax - mov eax, MAX_LEVEL - next_level_no_overmax: - mov [_level_num], eax - pop eax - - ret - - - -check_level_complete: ; - - push eax - push ebx - push ecx - push edx - - mov edx, 0 ; : 0 - , 1 - - mov ebx, _city - xor ecx, ecx - clc_loop: - cmp ecx, 32 - jae clc_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 0 - je clc_no_buildings - mov edx, 1 - jmp clc_loop_end - clc_no_buildings: - add ebx, 2 - inc ecx - jmp clc_loop - clc_loop_end : - cmp edx, 0 - jne clc_end - ; - - ; LEVEL COMPLETE - mov eax,4 - mov ebx,(WINDOW_WIDTH/2 - 70)*65536 + 30 - mov ecx,0x80000000 - mov edx,_text_level_complete - int 0x40 - ; - mov [_addit_VY_plane], 3 ; - ; - call air_raid_warning_off - clc_end: - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -draw_plane_health: - - mov ebx, 5*0x00010000 + 100 - mov ecx, 5*0x00010000 + 10 - mov edx, 0x00000000 - mov eax, 13 - int 0x40 - - mov ebx, [_plane_health] - add ebx, 5*0x00010000 - mov edx, 0x00008000 - int 0x40 - - ret - - -air_raid_warning_on: - push eax - cmp [_flag_air_raid_warning], 1 - je .end - mov [_flag_air_raid_warning], 1 - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 5 ))-1)], [_array_sounds+8*((( 5 ))-1)+4], VOLUME_ARW, VOLUME_ARW, SSMIX_CHANMODE_REPEAT - @@: - mov [_channel_sound_arw], eax - .end: - pop eax - ret - - -air_raid_warning_off: - cmp [_flag_air_raid_warning], 0 - je .end - mov [_flag_air_raid_warning], 0 - cmp [_flag_bomberdatabin_ok], 1 - jne .end - stdcall ssmix_stoptrack, [_channel_sound_arw] - .end: - ret - - -;======================================= ====================================== - - -flight_control_plane: ; - - mov eax,[_X_plane] - add eax, [_VX_plane] - mov [_X_plane], eax - - cmp eax, WINDOW_WIDTH-60-32 - jl fcp_set_utunr_rl - mov ebx, [_plane_state] - cmp ebx, 0 - jne fcp_set_utunr_rl - mov [_plane_state],2 - mov [_plane_state_step], 0 - fcp_set_utunr_rl: - - cmp eax, 60 - jg fcp_set_utunr_lr - mov ebx, [_plane_state] - cmp ebx, 1 - jne fcp_set_utunr_lr - mov [_plane_state],3 - mov [_plane_state_step], 0 - fcp_set_utunr_lr: - - ; 2 - mov eax, [_timer_x2] - cmp eax, 0 - jne fcp_timex2_end - - mov eax, [_plane_state] - cmp eax, 2 ; - jne fcp_uturn_rl_end - mov eax, [_plane_state_step] - mov ebx, 4 - sub ebx, eax - mov [_VX_plane], ebx ; - inc eax ; - mov [_plane_state_step], eax - cmp eax, 9 ; , - jne fcp_uturn_rl_end - mov [_plane_state], 1 ; - fcp_uturn_rl_end: - - - mov eax, [_plane_state] - cmp eax, 3 ; - jne fcp_uturn_lr_end - mov eax, [_plane_state_step] - mov ebx, -4 - add ebx, eax - mov [_VX_plane], ebx ; - inc eax ; - mov [_plane_state_step], eax - cmp eax, 9 ; , - jne fcp_uturn_lr_end - mov [_plane_state], 0 ; - fcp_uturn_lr_end: - - mov eax, [_plane_state] - cmp eax, 4 ; - jne fcp_barrel_r_end - mov eax, [_plane_state_step] - inc eax ; - mov [_plane_state_step], eax - cmp eax, 8 ; , - jne fcp_barrel_r_end - mov [_plane_state], 0 ; - fcp_barrel_r_end : - - mov eax, [_plane_state] - cmp eax, 5 ; - jne fcp_barrel_l_end - mov eax, [_plane_state_step] - inc eax ; - mov [_plane_state_step], eax - cmp eax, 8 ; , - jne fcp_barrel_l_end - mov [_plane_state], 1 ; - fcp_barrel_l_end: - - call animation_plane - - fcp_timex2_end: - - ; 4 - mov eax, [_timer_x4] - cmp eax, 0 - jne fcp_timex4_end - - ; - mov eax,[_Y_plane] - add eax, 1 - mov [_Y_plane], eax - - fcp_timex4_end: - - ; - - mov eax,[_Y_plane] - mov ebx,[_addit_VY_plane] - add eax, ebx - mov [_Y_plane], eax - - ; , - mov eax,[_Y_plane] - cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 - jl fcp_end_plane_landing - mov [_addit_VY_plane], 0 ; - mov ebx, [_plane_state] - cmp ebx, 6 - je fcp_end_plane_landing - cmp ebx, 0 - jne fcp_horiz_fly - mov [_plane_state], 6 ; - ;jmp fcp_end_plane_landing - fcp_horiz_fly: - mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 - fcp_end_plane_landing: - cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 - jle fcp_no_plane_underground ; , " " - mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 - mov ebx, [_X_plane] - cmp ebx, WINDOW_WIDTH - 60-32 - jl fcp_no_end_level ; , - ; - call next_level ; - fcp_no_end_level: - fcp_no_plane_underground: - mov [_Y_plane], eax - - ret - - - -animation_plane: - - ; - - ; - mov eax, [_plane_state] - cmp eax, 0 - jne ap_state0_end - mov [_anim_pos_plane], 0 - ap_state0_end: - - ; - mov eax, [_plane_state] - cmp eax, 1 - jne ap_state1_end - mov [_anim_pos_plane], 8 - ap_state1_end: - - ; - mov eax, [_plane_state] - cmp eax, 5 - ja ap_state2345_end - cmp eax, 2 - jb ap_state2345_end - sub eax, 2 - mov ebx, eax ; eax 9 - shl eax, 3 - add eax, ebx - add eax, [_plane_state_step] ; - shl eax, 2 ; 4 - add eax, _anim_array_uturn_rl ; - mov ebx, [eax] - mov [_anim_pos_plane], ebx ; - ap_state2345_end: - - ; ( ) - mov eax, [_plane_state] - cmp eax, 6 - jne ap_state6_end - mov [_anim_pos_plane], 22 - ap_state6_end: - - ret - - - -draw_plane: - - ; - mov eax, 13 - mov ebx,[_last_XY_plane] - and ebx, 0xffff0000 - add ebx, 32 - mov ecx,[_last_XY_plane] - shl ecx, 16 - add ecx, 32 - mov edx, BACK_COLOR - int 0x40 - - ; _anim_pos_plane - mov ebx, [_anim_pos_plane] - shl ebx, 10 - mov eax, ebx - add ebx, eax - add ebx, eax - add ebx, bmp_plane - - ; - mov edx,[_X_plane] - shl edx, 16 - add edx,[_Y_plane] - mov [_last_XY_plane], edx - - ; - mov eax,7 - mov ecx,32*65536+32 - int 0x40 - - ret - - -plane_interaction: - - push eax - push ebx - push ecx - push edx - - mov eax, [_X_plane] - mov ebx, [_Y_plane] - add ebx, 16 - mov ecx, [_VX_plane] - cmp ecx, 0 - jl pi_no_positive_vx - add eax, 32 ; - pi_no_positive_vx: - ; eax ebx X,Y - mov edx, eax - sub eax, CITY_OFFSET - ; - cmp eax, 0 - jl pi_out_of_city - cmp eax, 32*20 - jg pi_out_of_city - ; - add eax, 10 ; X 20 - mov ecx, eax - shr eax, 4 - shr ecx, 6 - sub eax, ecx - shr ecx, 2 - add eax, ecx - shr ecx, 2 - sub eax, ecx - dec eax ; eax - mov esi, eax - shl esi, 1 - add esi, _city ; esi - mov eax, edx - ; Y Y - xor ecx, ecx - mov cx, [esi] - mov edx, ecx - shl ecx, 4 - shl edx, 2 - add ecx, edx - mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT - sub edx, ecx ; edx Y - cmp ebx, edx - jl pi_no_crash - ; - mov [_plane_health], 0 - call bang_add ; - call game_over ; - pi_no_crash: - - pi_out_of_city: - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -; ================================== =========================================== - -bomb_drop: ; " ". , . - ; - mov eax, [_plane_health] - cmp eax, 0 - jle bomb_drop_end - ; ( ) - mov eax, [_plane_state] - cmp eax, 3 - ja bomb_drop_end - ; - mov eax, [_bomb_delay_time] - cmp eax, 0 - jne bomb_drop_end - mov [_bomb_delay_time], BOMB_DELAY - ; , - mov eax, [_bomb_count] - cmp eax, MAX_BOMBS-1 - jae bomb_drop_end - inc eax - mov [_bomb_count], eax - dec eax - shl eax, 4 - add eax, _bomb_array ; - - mov ebx, [_X_plane] - mov [eax], ebx ; X - add eax, 4 - mov ebx, [_Y_plane] - add ebx, 30 - mov [eax], ebx ; Y - - add eax, 4 - mov ebx, [_VX_plane] - cmp ebx, 0 - jge bomb_drop_pos_dir_vx - bomb_drop_neg_dir_vx: - neg ebx - shr ebx, 1 - neg ebx - jmp bomb_drop_dir_vx_end - bomb_drop_pos_dir_vx: - shr ebx, 1 - bomb_drop_dir_vx_end: - mov [eax], ebx ; X - - add eax, 4 - mov ebx, 0 - mov [eax], ebx ; Y - - push ecx - mov ecx, [_bomb_count] - dec ecx - call bombfly_sound_start - pop ecx - - bomb_drop_end: - - ret - - -bomb_proc: - ; - mov eax, [_bomb_delay_time] - cmp eax, 0 - je bomb_proc_delay_timer_end - dec eax - mov [_bomb_delay_time], eax - bomb_proc_delay_timer_end: - ; - mov eax, [_bomb_count] - cmp eax, 0 - je bomb_proc_end - xor ecx, ecx - bomb_proc_loop: ; - cmp ecx, [_bomb_count] - jae bomb_proc_end - mov ebx, ecx - shl ebx, 4 - add ebx, _bomb_array ; - - call bomb_hide ; - - ; - - ; VY - - add ebx, 4*3 - mov eax, [_timer_x2] - cmp eax, 0 - jne bomb_proc_gravity_accel_end - mov eax, [ebx] - add eax, GRAVY_ACCEL - mov [ebx], eax - bomb_proc_gravity_accel_end: - ; X - sub ebx, 4*3 - mov eax, [ebx] - add ebx, 4*2 - mov edx, [ebx] - add eax, edx - sub ebx, 4*2 - mov [ebx], eax - push eax - ; Y - add ebx, 4 - mov eax, [ebx] - add ebx, 4*2 - mov edx, [ebx] - add eax, edx - sub ebx, 4*2 - mov [ebx], eax - push eax - - ; - sub ebx, 4 - pop edx ; Y - pop eax ; X - ; , - cmp eax, 10 - jle bomb_proc_delete_bomb - cmp eax, WINDOW_WIDTH - 36 - jge bomb_proc_delete_bomb - ; - push eax - push ebx - mov ebx, edx - call bomb_check_detonation - cmp eax, 1 - pop ebx - pop eax - je bomb_proc_interaction_with_world - cmp edx, WINDOW_HEIGHT - GROUNG_HEIGHT - jae bomb_proc_interaction_with_world - jmp bomb_proc_interaction_end - bomb_proc_interaction_with_world: - push eax - push ebx - mov ebx, edx - call bang_add - call air_raid_warning_on ; - pop ebx - pop eax - bomb_proc_delete_bomb: - call bomb_delete ; - dec ecx ; .. - - mov eax, [_bomb_count] - dec eax - mov [_bomb_count], eax ; - jmp bomb_proc_draw_end ; - bomb_proc_interaction_end: - call bomb_draw - bomb_proc_draw_end: - - inc ecx - jmp bomb_proc_loop - bomb_proc_end: - - ret - - -bomb_delete: ; , - push eax - push ebx - push ecx - push edx - call bombfly_sound_stop - inc ecx - bomb_delete_loop: - cmp ecx, [_bomb_count] - jae bomb_delete_loop_end - mov ebx, ecx - shl ebx, 4 - add ebx, _bomb_array ; - dec ecx - mov edx, ecx - shl edx, 4 - add edx, _bomb_array ; - inc ecx - ; - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - add ebx,4 - add edx,4 - mov eax, [ebx] - mov [edx], eax - ; - inc ecx - jmp bomb_delete_loop - bomb_delete_loop_end: - pop edx - pop ecx - pop ebx - pop eax - - ret - -bomb_hide: ; , ebx - - - push eax - push ebx - push ecx - push edx - mov eax, 13 - mov edx, ebx - mov ebx, [edx] - shl ebx, 16 - add ebx, 16 - add edx, 4 - mov ecx, [edx] - shl ecx, 16 - add ecx, 16 - mov edx, BACK_COLOR - int 0x40 - pop edx - pop ecx - pop ebx - pop eax - - ret - - -bomb_draw: ; , ebx - - - push eax - push ebx - push ecx - push edx - - ; edx - mov edx, [ebx] - shl edx, 16 - add ebx, 4 - mov eax, [ebx] - add edx, eax - - ; ebx ( ) - add ebx, 4 - mov eax, [ebx] ; eax - - add ebx, 4 - mov ecx, [ebx] ; ecx - - xor ebx, ebx - cmp ecx, 3 - jl bomb_draw_midspeed_end - inc ebx - bomb_draw_midspeed_end: - cmp ecx, 9 - jl bomb_draw_highspeed_end - inc ebx - bomb_draw_highspeed_end: - cmp eax, 0 - jge bomb_draw_left_dir_end - add ebx, 3 - bomb_draw_left_dir_end: - ; ebx - shl ebx, 8 - mov eax, ebx - add ebx, eax - add ebx, eax - add ebx, bmp_bomb ; ebx - - ; - mov eax,7 - mov ecx,16*65536+16 - int 0x40 - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -; - -bomb_check_detonation: ; : eax - X, eab - Y - ; ( ) - ; eax : 0 - , 1 - - ; ( ) - - push ecx - push edx - - add eax, 8 - add ebx, 8 - - sub eax, CITY_OFFSET - ; - cmp eax, 0 - jl bcd_out_of_city - cmp eax, 32*20 - jg bcd_out_of_city - ; - add eax, 10 ; X 20 - mov ecx, eax - shr eax, 4 - shr ecx, 6 - sub eax, ecx - shr ecx, 2 - add eax, ecx - shr ecx, 2 - sub eax, ecx - dec eax ; eax - mov esi, eax - shl esi, 1 - add esi, _city ; esi - - mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT - sub edx, ebx - mov ebx, edx - cmp ebx, 0 - jg bcd_no_neg_value_Y - xor ecx, ecx - mov cx, [esi] - xor ebx, ebx - jmp bcd_damage ; - bcd_no_neg_value_Y: - add ebx, 10 ; Y 20 - mov ecx, ebx - shr ebx, 4 - shr ecx, 6 - sub ebx, ecx - shr ecx, 2 - add ebx, ecx - shr ecx, 2 - sub ebx, ecx ; ebx " " - - xor ecx, ecx - mov cx, [esi] - cmp ebx, ecx ; - jg bcd_no_detonation - bcd_damage: ; - ; - mov edx, ecx - mov ecx, ebx - sub ecx, 2 - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_H - xor ecx, ecx - bcd_no_neg_value_H: - mov [esi], cx ; - ; - call clear_tiles - ; - call ackack_check_bombing - ; - ; : eax - ( - ) , - ; ebx - , ecx - , edx - , - ; esi - - dec eax - cmp eax, 0 - jl bcd_damage_left_end - sub esi, 2 - xor ecx, ecx - mov cx, [esi] ; ecx - mov edx, ecx - push ecx - sub ecx, ebx - inc ecx - cmp ecx, 2 - pop ecx - ja bcd_damage_left_end ; |ecx-ebx|<=1 - dec ecx - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_HL - xor ecx, ecx - bcd_no_neg_value_HL: - mov [esi], cx - call clear_tiles - ; - call ackack_check_bombing - bcd_damage_left_end: - - ; - ; : eax - , - ; ebx - , ecx - , edx - , - ; esi - - inc eax - inc eax - cmp eax, 32 - jge bcd_damage_right_end - add esi, 4 - xor ecx, ecx - mov cx, [esi] ; ecx - mov edx, ecx - push ecx - sub ecx, ebx - inc ecx - cmp ecx, 2 - pop ecx - ja bcd_damage_right_end ; |ecx-ebx|<=1 - dec ecx - cmp ecx, 0 ; 0, - jge bcd_no_neg_value_HR - xor ecx, ecx - bcd_no_neg_value_HR: - mov [esi], cx - call clear_tiles - ; - call ackack_check_bombing - bcd_damage_right_end: - call check_level_complete - bcd_detonation: - mov eax, 1 - jmp bcd_end - bcd_no_detonation: - mov eax, 0 - jmp bcd_end - bcd_out_of_city: - mov eax, 1 - cmp ebx, WINDOW_HEIGHT - GROUNG_HEIGHT - jge bcd_end - mov eax, 0 - bcd_end: - pop edx - pop ecx - - ret - - -bombfly_sound_start: ; ecx - - - push eax ebx ecx - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 1 ))-1)], [_array_sounds+8*((( 1 ))-1)+4], VOLUME_BOMBFLY, VOLUME_BOMBFLY, SSMIX_CHANMODE_SINGLE_WITHOUT_RESET - @@: - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov [ebx], eax - pop ecx ebx eax - - ret - - -bombfly_sound_stop: ; ecx - - - push eax ebx ecx - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov eax, [ebx] - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_stoptrack, eax - @@: - inc ecx - .delete_loop: - cmp ecx, MAX_BOMBS - jae .delete_loop_end - mov ebx, ecx - shl ebx, 2 - add ebx, _array_bombsoundchannels - mov eax, [ebx] - mov [ebx-4], eax - inc ecx - jmp .delete_loop - .delete_loop_end: - pop ecx ebx eax - - ret - -; ==================================== ======================================= - - -fill_circle: - ; ( ) - ; : - ; eax - X - ; ebx - Y - ; ecx - - ; edx - - mov edi, eax - mov esi, ebx - push edx ; - - mov eax, ecx - shl eax, 1 - mov edx, 3 - sub edx, eax ; D:=3-2*R - xor ebx, ebx ; ebx X, ecx Y, edx D, eax - - - fc_loop: - cmp ebx, ecx - jg fc_loop_end - ; - pop eax ; - push edx ; D - mov edx, eax ; edx - - push ebx - push ecx - ; - mov eax, edi - sub eax, ebx - shl eax, 16 - add ebx, edi - add ebx, eax ; - add ecx, esi - mov eax, ecx - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - push ecx - ; - mov eax, esi - sub eax, ecx - mov ecx, eax - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - pop ebx - push ecx - push ebx ; ! ! - ; - mov eax, edi - sub eax, ecx - shl eax, 16 - add ecx, edi - add ecx, eax - mov eax, ebx - mov ebx, ecx ; - mov ecx, eax ; ! ecx - x - add ecx, esi - mov eax, ecx - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ecx - push ecx - ; - mov eax, esi - sub eax, ecx - mov ecx, eax - shl eax, 16 - add ecx, eax ; y - mov eax, 38 - int 0x40 - pop ebx - pop ecx - - mov eax, edx ; eax - - pop edx ; D - push eax ; - ; - cmp edx, 0 - jge fc_loop_D_more_0 ; D<0 - fc_loop_D_low_0: ; - mov eax, ebx - shl eax, 2 - add edx, eax - add edx, 4 ; D:=D+4*X+6 - jmp fc_loop_cmpD_end - fc_loop_D_more_0: ; - mov eax, ebx - sub eax, ecx - shl eax, 2 - add edx, eax - add edx, 10 ; D:=D+4*(X-Y)+10 - dec ecx - fc_loop_cmpD_end: ; - inc ebx - jmp fc_loop - fc_loop_end: - - pop edx ; - - ret - - - - -bang_add: ; , eax - X, eab - Y - - push eax - push ebx - push ecx - push edx - - shl eax, 16 - add eax, ebx - mov ebx, _bang_array - xor ecx, ecx - bang_add_loop: - cmp ecx, MAX_BOMBS - jae bang_add_loop_end - mov edx, [ebx] - cmp edx, -1 - jne bang_add_loop_freecheck_end - mov edx, 5*65536 + 3 - mov [ebx], edx - add ebx, 4 - mov [ebx], eax - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 2 ))-1)], [_array_sounds+8*((( 2 ))-1)+4], VOLUME_BOMBBANG, VOLUME_BOMBBANG, SSMIX_CHANMODE_SINGLE - @@: - jmp bang_add_loop_end - bang_add_loop_freecheck_end: - add ebx, 8 - inc ecx - jmp bang_add_loop - bang_add_loop_end: - - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -bang_proc: - - mov ebx, _bang_array - xor ecx, ecx - bang_proc_loop: - cmp ecx, MAX_BOMBS - jae bang_proc_loop_end - ; - mov edx, [ebx] - cmp edx, -1 - je bang_proc_loop_freecheck_end - ; - and edx, 0x0000FFFF - cmp edx, 0 - jne bang_proc_loop_endcheck_end - ; - push ebx - push ecx - mov ecx, [ebx] - shr ecx, 16 - add ebx, 4 - mov eax, [ebx] - mov ebx, eax - shr eax, 16 - and ebx, 0x0000FFFF - mov edx, BACK_COLOR - call fill_circle - pop ecx - pop ebx - mov eax, -1 - mov [ebx], eax - jmp bang_proc_loop_continue - bang_proc_loop_endcheck_end: - ; - push ebx - push ecx - ; - mov eax, [ebx] - mov edx, eax - shr eax, 16 - mov ecx, eax - and edx, 0x0000FFFF - mov eax, edx - shl eax, 3 - add eax, ecx - shl eax, 16 - dec edx - add eax, edx - mov [ebx], eax - ; - add ebx, 4 - mov eax, [ebx] - mov ebx, eax - shr eax, 16 - and ebx, 0x0000FFFF - ; - mov edx, BANG_COLOR - call fill_circle - pop ecx - pop ebx - bang_proc_loop_freecheck_end: - bang_proc_loop_continue: - add ebx, 8 - inc ecx - jmp bang_proc_loop - bang_proc_loop_end: - - ret - -; ===================================== ========================================= -; , , , - - -ackack_draw: ; - - mov ebx, _ackack - xor ecx, ecx - xor esi, esi ; ( ) - ackack_draw_loop: - cmp ecx, 32 - jae ackack_draw_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 1 - jne ackack_draw_continue ; 1 - push ebx - push ecx - ; ebx - mov ebx, ecx - shl ebx, 1 - add ebx, _city ; - xor eax, eax - mov ax, [ebx] ; - cmp eax, 0 - jle ackack_draw_continue2 ; - mov esi, 1 - call ackack_bullet_start - ; - mov ebx, bmp_ackack ; - cmp edx, 0 - je ackack_draw_no_start_bullet - add ebx, 20*20*3 ; - ackack_draw_no_start_bullet: - ; edx - mov edx, ecx - shl edx, 4 - shl ecx, 2 - add edx, ecx - add edx, CITY_OFFSET - shl edx, 16 - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - sub ecx, 20 ; - add edx, ecx ; - mov ecx, 20*0x00010000 + 20 ; - mov eax, 7 - int 0x40 ; - ackack_draw_continue2: - pop ecx - pop ebx - ackack_draw_continue: - add ebx, 2 - inc ecx - jmp ackack_draw_loop - ackack_draw_loop_end: - - cmp esi, 0 - jne @f - ; - call air_raid_warning_off - @@: - - ret - - -ackack_check_bombing: ; : eax - - - push eax - push ebx - push ecx - push edx - ; - mov ebx, eax - shl ebx, 1 - push ebx - add ebx, _ackack - mov edx, ebx ; edx - xor eax, eax - mov ax, [ebx] ; eax - cmp eax, 1 - jne acb_no_bombing ; - xor eax, eax - mov [ebx], ax ; - call ackack_next_wave - acb_no_bombing: - ; - pop ebx - add ebx, _city - xor eax, eax - mov ax, [ebx] ; eax - cmp eax, 0 - jg acb_no_destroy_building ; - xor eax, eax - mov [ebx], ax ; - acb_no_destroy_building: - pop edx - pop ecx - pop ebx - pop eax - - ret - - - -ackack_next_wave: ; - - push eax - push ebx - push ecx - push edx - - anw_begin: - mov ebx, _ackack - xor ecx, ecx - xor edx, edx ; - anw_loop: - cmp ecx, 32 - jae anw_loop_end - xor eax, eax - mov ax, [ebx] - cmp eax, 1 - jle anw_continue ; <=1 - dec eax - mov [ebx], ax - cmp eax, 1 - jg anw_no_active_ackack ; >1 - mov edx, 1 ; - jmp anw_continue - anw_no_active_ackack: - cmp edx, 1 - je anw_continue ; 1 - mov edx, 2 - anw_continue: - add ebx, 2 - inc ecx - jmp anw_loop - anw_loop_end: - cmp edx, 2 - je anw_begin - - pop edx - pop ecx - pop ebx - pop eax - ret - - - - - -ackack_bullet_start: ; (: eax - , ecx - ; - ; : edx - (0-, 1 -) - - push eax - push ebx - push ecx - - cmp [_flag_air_raid_warning], 1 - jne abs_no_start_bullet - - ; ebx - mov edx, eax - mov ebx, ecx - shl ebx, 2 - add ebx, _ackack_bullet ; - mov eax, [ebx] ; - cmp eax, 0 - jne abs_no_start_bullet ; 0, - ; - mov eax, edx ; eax - ; - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - sub ecx, 20+BULLET_SIZE ; + ( ecx - ) - mov [ebx], ecx ; - - cmp [_flag_bomberdatabin_ok], 1 - jne @f - stdcall ssmix_playtrack, [_array_sounds+8*((( 3 ))-1)], [_array_sounds+8*((( 3 ))-1)+4], VOLUME_ACKACK,VOLUME_ACKACK , SSMIX_CHANMODE_SINGLE - @@: - - mov edx, 1 - jmp abs_end_start_bullet - abs_no_start_bullet: - mov edx, 0 - abs_end_start_bullet: - - pop ecx - pop ebx - pop eax - - ret - - -ackack_bullet_proc: ; - - mov ebx, _ackack_bullet - xor ecx, ecx - abp_loop: - cmp ecx, 32 - jae abp_loop_end - mov eax, [ebx] - cmp eax, 0 - je abp_continue - jl abp_low_zero - push ebx - push ecx - ; - mov ebx, ecx - shl ebx, 4 - shl ecx, 2 - add ebx, ecx - add ebx, CITY_OFFSET - add ebx, 7 ; - mov edx, ebx - shl ebx, 16 - add ebx, edx ; ebx X - mov ecx, eax - mov edx, ecx - add edx, BULLET_SIZE ; - shl ecx, 16 - add ecx, edx ; ebx Y - mov edx, BACK_COLOR - mov eax, 38 - int 0x40 - add ebx, 0x00050005 - int 0x40 - - pop ecx - pop ebx - push ebx - push ecx - - mov eax, [ebx] - sub eax, ACKACK_BULLET_SPEED - mov [ebx], eax - cmp eax, 0 - jle abp_end_draw_bullet - - call ackack_bullet_interaction_check - cmp edx, 0 - je abp_no_bullet_interaction ; - xor eax, eax - mov [ebx], eax - jmp abp_end_draw_bullet - abp_no_bullet_interaction: - - ; - mov ebx, ecx - shl ebx, 4 - shl ecx, 2 - add ebx, ecx - add ebx, CITY_OFFSET - add ebx, 7 ; - mov edx, ebx - shl ebx, 16 - add ebx, edx ; ebx X - mov ecx, eax - mov edx, ecx - add edx, BULLET_SIZE ; - shl ecx, 16 - add ecx, edx ; ebx Y - mov edx, 0x00000000 - mov eax, 38 - int 0x40 - add ebx, 0x00050005 - int 0x40 - abp_end_draw_bullet: - - pop ecx - pop ebx - jmp abp_continue - abp_low_zero: - xor eax, eax - mov [ebx], eax - abp_continue: - add ebx, 4 - inc ecx - jmp abp_loop - abp_loop_end: - - ret - - -ackack_bullet_interaction_check: ; - ; (: eax - Y, ecx - ; - ; : edx - (0-, 1 -)) - - - push eax - push ebx - push ecx - - ; - mov ebx, [_plane_health] - cmp ebx, 0 - jle abic_with_plane_no - mov ebx, [_plane_state] - cmp ebx, 4 - je abic_with_plane_no - cmp ebx, 5 - je abic_with_plane_no - ; - mov ebx, [_Y_plane] - cmp eax, ebx - jl abic_with_plane_no ; - add ebx, 20 ; ebx - - cmp eax, ebx - jg abic_with_plane_no ; - ; X - mov edx, ecx - shl edx, 4 - shl ecx, 2 - add ecx, edx - add ecx, CITY_OFFSET - add ecx, 7 ; ecx - X - mov ebx, [_X_plane] - add ebx, 32 - cmp ecx, ebx - jg abic_with_plane_no - mov ebx, [_X_plane] - add ecx, 5 - cmp ecx, ebx - jl abic_with_plane_no - ; !!! - mov ebx, [_plane_health] - sub ebx, 20 - mov [_plane_health], ebx - cmp ebx, 0 ; game over - jg abic_no_plane_crash - mov [_plane_health], 0 - mov eax, [_X_plane] - mov ebx, [_Y_plane] - call bang_add ; - call game_over ; - abic_no_plane_crash: - mov edx, 1 - jmp abic_with_plane_end - abic_with_plane_no: - mov edx, 0 - abic_with_plane_end: - - pop ecx - pop ebx - pop eax - ret - -; ===================================== ========================================= - -ground_draw: - - mov eax, 13 - mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) - mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (GROUNG_HEIGHT-5-20) - mov edx, GROUND_COLOR - int 0x40 - - mov eax, 38 - mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) - mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (WINDOW_HEIGHT-GROUNG_HEIGHT) - mov edx, 0x000000 - int 0x40 - - ret - - -city_draw: ; - - mov ebx, _city - xor edx, edx - city_draw_loop: - cmp edx, 32 - jae city_draw_loop_end - xor eax, eax - mov ax, [ebx] - push ebx - push edx - mov ebx, bmp_tile - city_draw_loop2: - cmp eax, 0 - jle city_draw_loop2_end - push eax - push edx - ; edx - mov ecx, edx - shl edx, 4 - shl ecx, 2 - add edx, ecx - add edx, CITY_OFFSET - shl edx, 16 - mov ecx, eax - shl eax, 4 - shl ecx, 2 - add eax, ecx - mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ecx, eax - add edx, ecx ; - mov ecx, 20*0x00010000 + 20 ; - mov eax, 7 - int 0x40 ; - pop edx - pop eax - dec eax - jmp city_draw_loop2 - city_draw_loop2_end: - - pop edx - pop ebx - add ebx, 2 - inc edx - jmp city_draw_loop - city_draw_loop_end: - - ret - - -clear_tiles: ; : eax - , ecx - , edx - - - push eax - push ebx - push ecx - push edx - ; X - mov ebx, eax - shl eax, 4 - shl ebx, 2 - add eax, ebx - add eax, CITY_OFFSET - ; Y1 - mov ebx, ecx - shl ecx, 4 - shl ebx, 2 - add ecx, ebx - mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ebx, ecx - mov ecx, ebx - add ecx, 20 - ; Y2 - mov ebx, edx - shl edx, 4 - shl ebx, 2 - add edx, ebx - mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT - sub ebx, edx - mov edx, ebx - sub edx, 20 ; , - ; Y=Y2 H=Y1-Y2 - sub ecx, edx - shl edx, 16 - add ecx, edx - ; X 20 - shl eax, 16 - add eax, 20 - mov ebx, eax - ; - mov eax, 13 - mov edx, BACK_COLOR - int 0x40 - - pop edx - pop ecx - pop ebx - pop eax - - ret - - -load_level: ; , eax - - mov eax, [_level_num] - dec eax - shl eax, 7 ; (128 ) - mov ebx, levels - add ebx, eax ; ebx - mov edx, cur_level - mov ecx, 0 - load_level_loop: - cmp ecx, 128/4 - jae load_level_loop_end - mov eax, [ebx] - mov [edx], eax - add ebx, 4 - add edx, 4 - inc ecx - jmp load_level_loop - load_level_loop_end: - - load_level_end: - - ret - -; =================================== ======================================== - -timer_x4: - mov eax, [_timer_x4] - inc eax - mov [_timer_x4],eax - cmp eax, 4 - ja timer_x4_do - jmp timer_x4_end - timer_x4_do: - mov [_timer_x4],0 - timer_x4_end: - ret - - -timer_x2: - mov eax, [_timer_x2] - inc eax - mov [_timer_x2],eax - cmp eax, 2 - ja timer_x2_do - jmp timer_x2_end - timer_x2_do: - mov [_timer_x2],0 - timer_x2_end: - ret - -draw_window: ; - - mov eax,12 - mov ebx,1 - int 0x40 - - mov eax,0 - mov ebx,100*65536+WINDOW_WIDTH - mov ecx,100*65536+WINDOW_HEIGHT - mov edx,0x34000000+BACK_COLOR - mov edi,_window_caption - int 0x40 - - mov eax,12 - mov ebx,2 - int 0x40 - - ret - - - -draw_intro: - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-80)*65536 + 60 - mov ecx,0x80000000 - mov edx,_text_intro_title - int 0x40 - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-200)*65536 + 120 - mov ecx,0x80000000 - mov edx,_text_intro_description1 - int 0x40 - - - ; - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-60)*65536 + 200 - mov ecx,0x80000000 - mov edx,_text_intro_key_controls - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-70)*65536 + 230 - mov ecx,0x80000000 - mov edx,_text_intro_key_ctrl - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-70)*65536 + 245 - mov ecx,0x80000000 - mov edx,_text_intro_key_space - int 0x40 - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-175)*65536 + 300 - mov ecx,0x80000000 - mov edx,_text_intro_select_level - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-25)*65536 + 320 - mov ecx,0x80000000 - mov edx,_text_intro_level_num - int 0x40 - - call draw_level_num - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-175)*65536 + 350 - mov ecx,0x80000000 - mov edx,_text_intro_set_volume - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-25)*65536 + 370 - mov ecx,0x80000000 - mov edx,_text_intro_volume_num - int 0x40 - call draw_volume_num - - ; - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-80)*65536 + 400 - mov ecx,0x80FF0000 - mov edx,_text_intro_start_space - int 0x40 - - mov eax,4 - mov ebx,(WINDOW_WIDTH/2-30)*65536 + 460 - mov ecx,0x80000000 - mov edx,_text_intro_exit_key - int 0x40 - - - ret - - -draw_level_num: - - mov eax, 13 - mov ebx, (WINDOW_WIDTH/2+25)*0x00010000 + 30 - mov ecx, 320*0x00010000 + 15 - mov edx, BACK_COLOR - int 0x40 - - mov eax, 47 - mov ebx, 0x80020000 - mov ecx, [_level_num] - mov edx, (WINDOW_WIDTH/2+25)*65536 + 320 - mov esi,0x00000000 - int 0x40 - - ret - -draw_volume_num: - - mov eax, 13 - mov ebx, (WINDOW_WIDTH/2+35)*0x00010000 + 30 - mov ecx, 370*0x00010000 + 15 - mov edx, BACK_COLOR - int 0x40 - - mov eax, 47 - mov ebx, 0x80020000 - mov ecx, [_set_volume] - mov edx, (WINDOW_WIDTH/2+35)*65536 + 370 - mov esi,0x00000000 - int 0x40 - - ret - -;--------------------------------------------------------------------------- -;-------------------------------- ----------------------------------- -;--------------------------------------------------------------------------- - -_game_state dd ? -_delay dd 6 -_timer_x2 dd ? -_timer_x4 dd ? -_game_over_time dd ? -_flag_air_raid_warning dd ? -_flag_bomberdatabin_ok dd ? -_last_value_timecount dd ? - -_X_plane dd ? -_Y_plane dd ? -_last_XY_plane dd ? -_VX_plane dd ? -_addit_VY_plane dd ? -_plane_state dd ? ; 0 - , 1- , 2- -, 3- -, 4 - , 5 - -_plane_state_step dd ? ; ( ) -_plane_health dd ? ; - -_bomb_count dd ? -_bomb_array rd 4*MAX_BOMBS -_bomb_delay_time dd ? ; - -_bang_array rd 2*MAX_BOMBS - -_anim_pos_plane dd ? -; -_anim_array_uturn_rl dd 0,1,2,3,4,5,6,7,8 -_anim_array_uturn_lr dd 8,7,6,9,10,11,2,1,0 -_anim_array_barrel_r dd 0,1,2,12,13,14,15,16,0 -_anim_array_barrel_l dd 8,17,18,19,20,21,6,7,8 - - -cur_level: -; , . -_city rw 32 -; , . -_ackack rw 32 -; , -_ackack_bullet rd 32 - -; -_level_num dd 1 -; : 32 ( " ") _level?_city -; _level?_ackack -levels: -_level1_city dw 0, 0, 0, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 6, 7, 8, 8, 7, 6, 3, 3, 3, 3, 3, 6, 5, 6, 5, 6, 0, 0, 0 -_level1_ackack dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - -_level2_city dw 0, 0, 0, 5, 5, 2, 5, 7, 7, 2, 7, 9, 9, 9, 2, 9, 9, 2, 9, 9, 9, 7, 2, 7, 7, 5, 2, 5, 5, 0, 0, 0 -_level2_ackack dw 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0 - -_level3_city dw 0, 0, 0,12,12,12, 9, 9, 9,12,12,12, 9, 7, 5, 3, 3, 5, 7, 9,12,12,12, 9, 9, 9,12,12,12, 0, 0, 0 -_level3_ackack dw 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 4, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 - -_level4_city dw 0, 0, 0,12,12,12, 3,12,12,12, 3, 1, 1, 6,12,18, 18,12, 6, 1, 1, 3,12,12,12, 3,12,12,12, 0, 0, 0 -_level4_ackack dw 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 2, 6, 0, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0 - -_level5_city dw 0, 5,10,10,10,10,15,15,15,15,17,17,17,17, 1,15, 15, 1,17,17,17,17,15,15,15,15,10,10,10,10, 5, 0 -_level5_ackack dw 0, 8, 0, 9, 9, 0, 3, 3, 3, 3, 0, 0, 0, 0, 5, 1, 2, 5, 0, 0, 0, 0, 4, 4, 4, 4, 0,10,10, 0, 7, 0 - -; -_count_sounds dd ? -_array_sounds rd 2*MAX_SOUNDS - -_channel_sound_plane dd ? ; -_channel_sound_arw dd ? ; -_array_bombsoundchannels rd MAX_BOMBS ; - -_set_volume dd 8 ; 0..8 - -; - -_s_current_dir rb 4096 ; - -file_info: ; - _fi_func dd ? - _fi_pos dd ? - dd 0 - _fi_size dd ? - _fi_pbuff dd ? - db 0 - _fi_pfilename dd ? - -if lang eq ru_RU - include 'ruslang.inc' -else - include 'englang.inc' -end if - -bmp_plane: -file "plane.bmp":54 - -bmp_bomb: -file "bomb.bmp":54 - -bmp_tile: -file "tile.bmp":54 - -bmp_ackack: -file "ackack.bmp":54 - - -align 16 -rb 0x100 ; . - -i_end: - +; + +SK_SPACE equ 0x39 +SK_CTRL equ 0x1D +SK_UP equ 0x48 +SK_DOWN equ 0x50 +SK_LEFT equ 0x4B +SK_RIGHT equ 0x4D +SK_ESC equ 0x01 + + +INIT_PLANE_X equ 20 +INIT_PLANE_Y equ 20 +BACK_COLOR equ 0x9bcdfa +GROUND_COLOR equ 0x808080 +BANG_COLOR equ 0xB0140E +ANIM_PLANE_BMP_PIXELS_COUNT equ 22*32*32 +WINDOW_WIDTH equ 800 +WINDOW_HEIGHT equ 600 +GROUNG_HEIGHT equ 100 +CITY_OFFSET equ (WINDOW_WIDTH-32*20)/2 +MAX_BOMBS equ 8 +GRAVY_ACCEL equ 1 +BOMB_DELAY equ 12 +MAX_LEVEL equ 5 +ACKACK_BULLET_SPEED equ 17 +BULLET_SIZE equ 7 +MAX_SOUNDS equ 8 + +VOLUME_BOMBFLY equ 16 +VOLUME_BOMBBANG equ 28 +VOLUME_ACKACK equ 24 +VOLUME_PLANE equ 48 +VOLUME_ARW equ 16 + + +use32 ; , 32 + org 0x0 ; , 0x0 + db 'MENUET01' ; (8 ) + dd 0x1 ; + dd start ; , + ; + dd i_end ; + dd i_end ; , 0100 + dd i_end ; , . , + dd 0x0, _s_current_dir ; . + ; , + ; + + ; , , + ; +; + +;----------------- include ------------------------------------- +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'ssmix.inc' + +;--------------------------------------------------------------------------- +;----------------------------- -------------------------------- +;--------------------------------------------------------------------------- + +align 4 +start: ; + + ; : - + mov eax, 66 + mov ebx, 1 + mov ecx, 1 + int 0x40 + + ; + mov eax, 68 + mov ebx, 11 + int 0x40 + cmp eax, 1000000 ; ~1000 ( ) + ja heap_ok + mov eax, -1 + int 0x40 ; + heap_ok: + + mov eax, bmp_plane + mov ebx, 736*32*3 + call convert_bmp_backcolor + mov eax, bmp_bomb + mov ebx, 96*16*3 + call convert_bmp_backcolor + mov eax, bmp_tile + mov ebx, 20*20*3 + call convert_bmp_backcolor + mov eax, bmp_ackack + mov ebx, 40*20*3 + call convert_bmp_backcolor + + call read_sounds_file + call ssmix_init + + mov [_game_state], 0 + +redraw_window: + call draw_window + cmp [_game_state], 0 + jne still_no_intro + call draw_intro + still_no_intro: + +still: + ; + mov eax,11 + int 0x40 + cmp eax,1 + je redraw_window + cmp eax,2 + je key + cmp eax,3 + je close_button + + ; + mov eax,5 + mov ebx,1 + int 0x40 + + mov eax, 26 + mov ebx, 9 + int 0x40 + mov ebx, eax + sub eax, [_last_value_timecount] + cmp eax, [_delay] + jbe still + mov [_last_value_timecount], ebx + + call timer_x2 + call timer_x4 + + ; + cmp [_game_state], 1 + jne still_no_game + ; + mov eax, [_plane_health] + cmp eax, 0 + jle still_no_plane + call flight_control_plane + call plane_interaction + call draw_plane + still_no_plane: + call draw_plane_health + call bomb_proc + call bang_proc + call ground_draw + call city_draw + call ackack_draw + call ackack_bullet_proc + ; + call game_over_timer + still_no_game: + + jmp still + + +key: ; + mov eax,2 + int 0x40 + + push eax + key_SPACE: + cmp ah, SK_SPACE + jne key_SPACE_end + cmp [_game_state], 1 + je key_SPACE_do_a_barrel_roll + key_SPACE_start_game: ; + mov [_game_state], 1 + call init_game_state + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll: ; + mov eax, [_plane_state] + cmp eax, 0 + je key_SPACE_do_a_barrel_roll_r + cmp eax, 1 + je key_SPACE_do_a_barrel_roll_l + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll_r: + mov eax,[_X_plane] + cmp eax, WINDOW_WIDTH-130-32 + jg key_SPACE_end + mov [_plane_state], 4 + mov [_plane_state_step], 0 + jmp key_SPACE_end + key_SPACE_do_a_barrel_roll_l: + mov eax,[_X_plane] + cmp eax, 130 + jl key_SPACE_end + mov [_plane_state], 5 + mov [_plane_state_step], 0 + key_SPACE_end: + pop eax + + key_CTRL: + cmp ah, SK_CTRL + jne key_CTRL_end + call bomb_drop + key_CTRL_end: + + key_UP: + cmp ah, SK_UP + jne key_UP_end + cmp [_game_state], 0 + jne key_UP_end + mov ebx, [_level_num] + inc ebx + mov [_level_num], ebx + cmp ebx, MAX_LEVEL + jbe key_UP_no_max + mov [_level_num], MAX_LEVEL + key_UP_no_max: + call draw_level_num + key_UP_end: + + key_DOWN: + cmp ah, SK_DOWN + jne key_DOWN_end + cmp [_game_state], 0 + jne key_DOWN_end + mov ebx, [_level_num] + dec ebx + mov [_level_num], ebx + cmp ebx, 1 + jae key_DOWN_no_min + mov [_level_num], 1 + key_DOWN_no_min: + call draw_level_num + key_DOWN_end: + + + key_LEFT: + cmp ah, SK_LEFT + jne key_LEFT_end + cmp [_game_state], 0 + jne key_LEFT_end + mov ebx, [_set_volume] + dec ebx + cmp ebx, 0 + jge @f + mov ebx, 0 + @@: + mov [_set_volume], ebx + shl ebx, 4 + stdcall ssmix_setvolume, ebx, ebx + call draw_volume_num + key_LEFT_end: + + + key_RIGHT: + cmp ah, SK_RIGHT + jne key_RIGHT_end + cmp [_game_state], 0 + jne key_RIGHT_end + mov ebx, [_set_volume] + inc ebx + cmp ebx, 8 + jle @f + mov ebx, 8 + @@: + mov [_set_volume], ebx + shl ebx, 4 + stdcall ssmix_setvolume, ebx, ebx + call draw_volume_num + key_RIGHT_end: + + + key_ESC: + cmp ah, SK_ESC + jne key_ESC_end + jmp close_button + key_ESC_end: + + jmp still + + + + +close_button: ; + + call ssmix_release + call sounds_free_memory + ; + mov eax, -1 + int 0x40 + + +;--------------------------------------------------------------------------- +;----------------------------- --------------------------------- +;--------------------------------------------------------------------------- + + +convert_bmp_backcolor: ; eax - , ebx - + + push ecx + cbb_loop: + cmp ebx, 0 + jle cbb_loop_end + mov ecx, [eax] + and ecx, 0x00FFFFFF + cmp ecx, 0x00FFFFFF + jne @f + mov ecx, BACK_COLOR + mov [eax], cl + shr ecx, 8 + mov [eax+1], cl + shr ecx, 8 + mov [eax+2], cl + @@: + add eax, 3 + sub ebx, 3 + jmp cbb_loop + cbb_loop_end: + pop ecx + + ret + +; +read_sounds_file: + + mov edi, _s_current_dir + mov al, 0 + mov ecx, 4096 + repne scasb + mov dword[edi-1], 'data' + mov dword[edi+3], '.bin' + mov [_flag_bomberdatabin_ok], 1 + ; + mov [_fi_func], 0 + mov [_fi_pos], 8 + mov [_fi_size], 4 + mov [_fi_pbuff], _count_sounds + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + cmp ebx, -1 + jne @f + mov [_flag_bomberdatabin_ok], 0 + jmp .end + @@: + ; , () + mov ecx, [_count_sounds] + shl ecx, 3 + mov [_fi_func], 0 + mov [_fi_pos], 12 + mov [_fi_size], ecx + mov [_fi_pbuff], _array_sounds + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + ; + mov ecx, [_count_sounds] + mov esi, _array_sounds + .loop: + push ecx + ; + mov [_fi_func], 0 + mov eax, [esi] + mov [_fi_pos], eax + mov eax, [esi+4] + mov [_fi_size], eax + ; , , + mov ecx, [esi+4] + mov eax, 68 + mov ebx, 12 + int 0x40 + mov [esi], eax + mov ecx, [esi+4] + add ecx, eax + mov [esi+4], ecx + ; + mov [_fi_pbuff], eax + mov [_fi_pfilename], _s_current_dir + mov eax, 70 + mov ebx, file_info + int 0x40 + pop ecx + add esi, 8 + dec ecx + jnz .loop + .end: + + ret + + +sounds_free_memory: + + mov ecx, [_count_sounds] + mov esi, _array_sounds + .loop: + push ecx + ; , , + mov eax, 68 + mov ebx, 13 + mov ecx, [esi] + int 0x40 + pop ecx + add esi, 8 + dec ecx + jnz .loop + + + ret + + +init_game_state: ; + mov [_game_over_time], 0 + mov [_X_plane], INIT_PLANE_X + mov [_Y_plane], INIT_PLANE_Y + mov [_VX_plane], 4 + mov [_plane_state], 0 + mov [_anim_pos_plane], 0 + mov [_plane_health], 100 + mov [_timer_x2], 0 + mov [_timer_x4], 0 + mov [_bomb_count], 0 + mov [_bomb_delay_time], 0 + mov [_addit_VY_plane], 0 + mov [_flag_air_raid_warning], 0 + + call load_level + + ; + mov ebx, _bang_array + xor ecx, ecx + igs_bang_array_loop: + cmp ecx, MAX_BOMBS + jae igs_bang_array_loop_end + mov eax, -1 + mov [ebx], eax + add ebx, 8 + inc ecx + jmp igs_bang_array_loop + igs_bang_array_loop_end: + ; + mov ebx, _ackack_bullet + xor ecx, ecx + igs_bullet_array_loop: + cmp ecx, 32 + jae igs_bullet_array_loop_end + mov eax, 0 + mov [ebx], eax + add ebx, 4 + inc ecx + jmp igs_bullet_array_loop + igs_bullet_array_loop_end: + + ; + call draw_window + + ; + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 4 ))-1)], [_array_sounds+8*((( 4 ))-1)+4], VOLUME_PLANE, VOLUME_PLANE, SSMIX_CHANMODE_REPEAT + @@: + mov [_channel_sound_plane], eax + + mov [_channel_sound_arw], -1 + + ret + + + +game_over: + + mov [_game_over_time], 30 ; game over + ; GAME OVER + mov eax,4 + mov ebx,(WINDOW_WIDTH/2 - 50)*65536 + 30 + mov ecx,0x80000000 + mov edx,_text_game_over + int 0x40 + + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_stoptrack, [_channel_sound_plane] + @@: + + ret + + +game_over_timer: ; , + + mov ebx, [_game_over_time] + cmp ebx, 0 + je got_end + dec ebx + mov [_game_over_time], ebx + cmp ebx, 0 + jg got_end + mov [_game_state], 0 + cmp [_flag_bomberdatabin_ok], 1 + jne @f + call ssmix_stopalltracks + @@: + call draw_window + call draw_intro + got_end: + + ret + + +next_level: ; + + push eax + mov [_game_over_time], 1 ; + mov eax, [_level_num] ; + inc eax + cmp eax, MAX_LEVEL + jbe next_level_no_overmax + mov eax, MAX_LEVEL + next_level_no_overmax: + mov [_level_num], eax + pop eax + + ret + + + +check_level_complete: ; + + push eax + push ebx + push ecx + push edx + + mov edx, 0 ; : 0 - , 1 - + mov ebx, _city + xor ecx, ecx + clc_loop: + cmp ecx, 32 + jae clc_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 0 + je clc_no_buildings + mov edx, 1 + jmp clc_loop_end + clc_no_buildings: + add ebx, 2 + inc ecx + jmp clc_loop + clc_loop_end : + cmp edx, 0 + jne clc_end + ; - + ; LEVEL COMPLETE + mov eax,4 + mov ebx,(WINDOW_WIDTH/2 - 70)*65536 + 30 + mov ecx,0x80000000 + mov edx,_text_level_complete + int 0x40 + ; + mov [_addit_VY_plane], 3 ; + ; + call air_raid_warning_off + clc_end: + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +draw_plane_health: + + mov ebx, 5*0x00010000 + 100 + mov ecx, 5*0x00010000 + 10 + mov edx, 0x00000000 + mov eax, 13 + int 0x40 + + mov ebx, [_plane_health] + add ebx, 5*0x00010000 + mov edx, 0x00008000 + int 0x40 + + ret + + +air_raid_warning_on: + push eax + cmp [_flag_air_raid_warning], 1 + je .end + mov [_flag_air_raid_warning], 1 + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 5 ))-1)], [_array_sounds+8*((( 5 ))-1)+4], VOLUME_ARW, VOLUME_ARW, SSMIX_CHANMODE_REPEAT + @@: + mov [_channel_sound_arw], eax + .end: + pop eax + ret + + +air_raid_warning_off: + cmp [_flag_air_raid_warning], 0 + je .end + mov [_flag_air_raid_warning], 0 + cmp [_flag_bomberdatabin_ok], 1 + jne .end + stdcall ssmix_stoptrack, [_channel_sound_arw] + .end: + ret + + +;======================================= ====================================== + + +flight_control_plane: ; + + mov eax,[_X_plane] + add eax, [_VX_plane] + mov [_X_plane], eax + + cmp eax, WINDOW_WIDTH-60-32 + jl fcp_set_utunr_rl + mov ebx, [_plane_state] + cmp ebx, 0 + jne fcp_set_utunr_rl + mov [_plane_state],2 + mov [_plane_state_step], 0 + fcp_set_utunr_rl: + + cmp eax, 60 + jg fcp_set_utunr_lr + mov ebx, [_plane_state] + cmp ebx, 1 + jne fcp_set_utunr_lr + mov [_plane_state],3 + mov [_plane_state_step], 0 + fcp_set_utunr_lr: + + ; 2 + mov eax, [_timer_x2] + cmp eax, 0 + jne fcp_timex2_end + + mov eax, [_plane_state] + cmp eax, 2 ; + jne fcp_uturn_rl_end + mov eax, [_plane_state_step] + mov ebx, 4 + sub ebx, eax + mov [_VX_plane], ebx ; + inc eax ; + mov [_plane_state_step], eax + cmp eax, 9 ; , + jne fcp_uturn_rl_end + mov [_plane_state], 1 ; + fcp_uturn_rl_end: + + + mov eax, [_plane_state] + cmp eax, 3 ; + jne fcp_uturn_lr_end + mov eax, [_plane_state_step] + mov ebx, -4 + add ebx, eax + mov [_VX_plane], ebx ; + inc eax ; + mov [_plane_state_step], eax + cmp eax, 9 ; , + jne fcp_uturn_lr_end + mov [_plane_state], 0 ; + fcp_uturn_lr_end: + + mov eax, [_plane_state] + cmp eax, 4 ; + jne fcp_barrel_r_end + mov eax, [_plane_state_step] + inc eax ; + mov [_plane_state_step], eax + cmp eax, 8 ; , + jne fcp_barrel_r_end + mov [_plane_state], 0 ; + fcp_barrel_r_end : + + mov eax, [_plane_state] + cmp eax, 5 ; + jne fcp_barrel_l_end + mov eax, [_plane_state_step] + inc eax ; + mov [_plane_state_step], eax + cmp eax, 8 ; , + jne fcp_barrel_l_end + mov [_plane_state], 1 ; + fcp_barrel_l_end: + + call animation_plane + + fcp_timex2_end: + + ; 4 + mov eax, [_timer_x4] + cmp eax, 0 + jne fcp_timex4_end + + ; + mov eax,[_Y_plane] + add eax, 1 + mov [_Y_plane], eax + + fcp_timex4_end: + + ; + + mov eax,[_Y_plane] + mov ebx,[_addit_VY_plane] + add eax, ebx + mov [_Y_plane], eax + + ; , + mov eax,[_Y_plane] + cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + jl fcp_end_plane_landing + mov [_addit_VY_plane], 0 ; + mov ebx, [_plane_state] + cmp ebx, 6 + je fcp_end_plane_landing + cmp ebx, 0 + jne fcp_horiz_fly + mov [_plane_state], 6 ; + ;jmp fcp_end_plane_landing + fcp_horiz_fly: + mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + fcp_end_plane_landing: + cmp eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 + jle fcp_no_plane_underground ; , " " + mov eax, WINDOW_HEIGHT - GROUNG_HEIGHT - 32 + 6 + mov ebx, [_X_plane] + cmp ebx, WINDOW_WIDTH - 60-32 + jl fcp_no_end_level ; , + ; + call next_level ; + fcp_no_end_level: + fcp_no_plane_underground: + mov [_Y_plane], eax + + ret + + + +animation_plane: + + ; + + ; + mov eax, [_plane_state] + cmp eax, 0 + jne ap_state0_end + mov [_anim_pos_plane], 0 + ap_state0_end: + + ; + mov eax, [_plane_state] + cmp eax, 1 + jne ap_state1_end + mov [_anim_pos_plane], 8 + ap_state1_end: + + ; + mov eax, [_plane_state] + cmp eax, 5 + ja ap_state2345_end + cmp eax, 2 + jb ap_state2345_end + sub eax, 2 + mov ebx, eax ; eax 9 + shl eax, 3 + add eax, ebx + add eax, [_plane_state_step] ; + shl eax, 2 ; 4 + add eax, _anim_array_uturn_rl ; + mov ebx, [eax] + mov [_anim_pos_plane], ebx ; + ap_state2345_end: + + ; ( ) + mov eax, [_plane_state] + cmp eax, 6 + jne ap_state6_end + mov [_anim_pos_plane], 22 + ap_state6_end: + + ret + + + +draw_plane: + + ; + mov eax, 13 + mov ebx,[_last_XY_plane] + and ebx, 0xffff0000 + add ebx, 32 + mov ecx,[_last_XY_plane] + shl ecx, 16 + add ecx, 32 + mov edx, BACK_COLOR + int 0x40 + + ; _anim_pos_plane + mov ebx, [_anim_pos_plane] + shl ebx, 10 + mov eax, ebx + add ebx, eax + add ebx, eax + add ebx, bmp_plane + + ; + mov edx,[_X_plane] + shl edx, 16 + add edx,[_Y_plane] + mov [_last_XY_plane], edx + + ; + mov eax,7 + mov ecx,32*65536+32 + int 0x40 + + ret + + +plane_interaction: + + push eax + push ebx + push ecx + push edx + + mov eax, [_X_plane] + mov ebx, [_Y_plane] + add ebx, 16 + mov ecx, [_VX_plane] + cmp ecx, 0 + jl pi_no_positive_vx + add eax, 32 ; + pi_no_positive_vx: + ; eax ebx X,Y + mov edx, eax + sub eax, CITY_OFFSET + ; + cmp eax, 0 + jl pi_out_of_city + cmp eax, 32*20 + jg pi_out_of_city + ; + add eax, 10 ; X 20 + mov ecx, eax + shr eax, 4 + shr ecx, 6 + sub eax, ecx + shr ecx, 2 + add eax, ecx + shr ecx, 2 + sub eax, ecx + dec eax ; eax + mov esi, eax + shl esi, 1 + add esi, _city ; esi + mov eax, edx + ; Y Y + xor ecx, ecx + mov cx, [esi] + mov edx, ecx + shl ecx, 4 + shl edx, 2 + add ecx, edx + mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT + sub edx, ecx ; edx Y + cmp ebx, edx + jl pi_no_crash + ; + mov [_plane_health], 0 + call bang_add ; + call game_over ; + pi_no_crash: + + pi_out_of_city: + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +; ================================== =========================================== + +bomb_drop: ; " ". , . + ; + mov eax, [_plane_health] + cmp eax, 0 + jle bomb_drop_end + ; ( ) + mov eax, [_plane_state] + cmp eax, 3 + ja bomb_drop_end + ; + mov eax, [_bomb_delay_time] + cmp eax, 0 + jne bomb_drop_end + mov [_bomb_delay_time], BOMB_DELAY + ; , + mov eax, [_bomb_count] + cmp eax, MAX_BOMBS-1 + jae bomb_drop_end + inc eax + mov [_bomb_count], eax + dec eax + shl eax, 4 + add eax, _bomb_array ; + + mov ebx, [_X_plane] + mov [eax], ebx ; X + add eax, 4 + mov ebx, [_Y_plane] + add ebx, 30 + mov [eax], ebx ; Y + + add eax, 4 + mov ebx, [_VX_plane] + cmp ebx, 0 + jge bomb_drop_pos_dir_vx + bomb_drop_neg_dir_vx: + neg ebx + shr ebx, 1 + neg ebx + jmp bomb_drop_dir_vx_end + bomb_drop_pos_dir_vx: + shr ebx, 1 + bomb_drop_dir_vx_end: + mov [eax], ebx ; X + + add eax, 4 + mov ebx, 0 + mov [eax], ebx ; Y + + push ecx + mov ecx, [_bomb_count] + dec ecx + call bombfly_sound_start + pop ecx + + bomb_drop_end: + + ret + + +bomb_proc: + ; + mov eax, [_bomb_delay_time] + cmp eax, 0 + je bomb_proc_delay_timer_end + dec eax + mov [_bomb_delay_time], eax + bomb_proc_delay_timer_end: + ; + mov eax, [_bomb_count] + cmp eax, 0 + je bomb_proc_end + xor ecx, ecx + bomb_proc_loop: ; + cmp ecx, [_bomb_count] + jae bomb_proc_end + mov ebx, ecx + shl ebx, 4 + add ebx, _bomb_array ; + + call bomb_hide ; + + ; + + ; VY + + add ebx, 4*3 + mov eax, [_timer_x2] + cmp eax, 0 + jne bomb_proc_gravity_accel_end + mov eax, [ebx] + add eax, GRAVY_ACCEL + mov [ebx], eax + bomb_proc_gravity_accel_end: + ; X + sub ebx, 4*3 + mov eax, [ebx] + add ebx, 4*2 + mov edx, [ebx] + add eax, edx + sub ebx, 4*2 + mov [ebx], eax + push eax + ; Y + add ebx, 4 + mov eax, [ebx] + add ebx, 4*2 + mov edx, [ebx] + add eax, edx + sub ebx, 4*2 + mov [ebx], eax + push eax + + ; + sub ebx, 4 + pop edx ; Y + pop eax ; X + ; , + cmp eax, 10 + jle bomb_proc_delete_bomb + cmp eax, WINDOW_WIDTH - 36 + jge bomb_proc_delete_bomb + ; + push eax + push ebx + mov ebx, edx + call bomb_check_detonation + cmp eax, 1 + pop ebx + pop eax + je bomb_proc_interaction_with_world + cmp edx, WINDOW_HEIGHT - GROUNG_HEIGHT + jae bomb_proc_interaction_with_world + jmp bomb_proc_interaction_end + bomb_proc_interaction_with_world: + push eax + push ebx + mov ebx, edx + call bang_add + call air_raid_warning_on ; + pop ebx + pop eax + bomb_proc_delete_bomb: + call bomb_delete ; + dec ecx ; .. - + mov eax, [_bomb_count] + dec eax + mov [_bomb_count], eax ; + jmp bomb_proc_draw_end ; + bomb_proc_interaction_end: + call bomb_draw + bomb_proc_draw_end: + + inc ecx + jmp bomb_proc_loop + bomb_proc_end: + + ret + + +bomb_delete: ; , + push eax + push ebx + push ecx + push edx + call bombfly_sound_stop + inc ecx + bomb_delete_loop: + cmp ecx, [_bomb_count] + jae bomb_delete_loop_end + mov ebx, ecx + shl ebx, 4 + add ebx, _bomb_array ; + dec ecx + mov edx, ecx + shl edx, 4 + add edx, _bomb_array ; + inc ecx + ; + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + add ebx,4 + add edx,4 + mov eax, [ebx] + mov [edx], eax + ; + inc ecx + jmp bomb_delete_loop + bomb_delete_loop_end: + pop edx + pop ecx + pop ebx + pop eax + + ret + +bomb_hide: ; , ebx - + + push eax + push ebx + push ecx + push edx + mov eax, 13 + mov edx, ebx + mov ebx, [edx] + shl ebx, 16 + add ebx, 16 + add edx, 4 + mov ecx, [edx] + shl ecx, 16 + add ecx, 16 + mov edx, BACK_COLOR + int 0x40 + pop edx + pop ecx + pop ebx + pop eax + + ret + + +bomb_draw: ; , ebx - + + push eax + push ebx + push ecx + push edx + + ; edx + mov edx, [ebx] + shl edx, 16 + add ebx, 4 + mov eax, [ebx] + add edx, eax + + ; ebx ( ) + add ebx, 4 + mov eax, [ebx] ; eax - + add ebx, 4 + mov ecx, [ebx] ; ecx - + xor ebx, ebx + cmp ecx, 3 + jl bomb_draw_midspeed_end + inc ebx + bomb_draw_midspeed_end: + cmp ecx, 9 + jl bomb_draw_highspeed_end + inc ebx + bomb_draw_highspeed_end: + cmp eax, 0 + jge bomb_draw_left_dir_end + add ebx, 3 + bomb_draw_left_dir_end: + ; ebx + shl ebx, 8 + mov eax, ebx + add ebx, eax + add ebx, eax + add ebx, bmp_bomb ; ebx + + ; + mov eax,7 + mov ecx,16*65536+16 + int 0x40 + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +; + +bomb_check_detonation: ; : eax - X, eab - Y + ; ( ) + ; eax : 0 - , 1 - + ; ( ) + + push ecx + push edx + + add eax, 8 + add ebx, 8 + + sub eax, CITY_OFFSET + ; + cmp eax, 0 + jl bcd_out_of_city + cmp eax, 32*20 + jg bcd_out_of_city + ; + add eax, 10 ; X 20 + mov ecx, eax + shr eax, 4 + shr ecx, 6 + sub eax, ecx + shr ecx, 2 + add eax, ecx + shr ecx, 2 + sub eax, ecx + dec eax ; eax + mov esi, eax + shl esi, 1 + add esi, _city ; esi + + mov edx, WINDOW_HEIGHT - GROUNG_HEIGHT + sub edx, ebx + mov ebx, edx + cmp ebx, 0 + jg bcd_no_neg_value_Y + xor ecx, ecx + mov cx, [esi] + xor ebx, ebx + jmp bcd_damage ; + bcd_no_neg_value_Y: + add ebx, 10 ; Y 20 + mov ecx, ebx + shr ebx, 4 + shr ecx, 6 + sub ebx, ecx + shr ecx, 2 + add ebx, ecx + shr ecx, 2 + sub ebx, ecx ; ebx " " + + xor ecx, ecx + mov cx, [esi] + cmp ebx, ecx ; + jg bcd_no_detonation + bcd_damage: ; + ; + mov edx, ecx + mov ecx, ebx + sub ecx, 2 + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_H + xor ecx, ecx + bcd_no_neg_value_H: + mov [esi], cx ; + ; + call clear_tiles + ; + call ackack_check_bombing + ; + ; : eax - ( - ) , + ; ebx - , ecx - , edx - , + ; esi - + dec eax + cmp eax, 0 + jl bcd_damage_left_end + sub esi, 2 + xor ecx, ecx + mov cx, [esi] ; ecx + mov edx, ecx + push ecx + sub ecx, ebx + inc ecx + cmp ecx, 2 + pop ecx + ja bcd_damage_left_end ; |ecx-ebx|<=1 + dec ecx + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_HL + xor ecx, ecx + bcd_no_neg_value_HL: + mov [esi], cx + call clear_tiles + ; + call ackack_check_bombing + bcd_damage_left_end: + + ; + ; : eax - , + ; ebx - , ecx - , edx - , + ; esi - + inc eax + inc eax + cmp eax, 32 + jge bcd_damage_right_end + add esi, 4 + xor ecx, ecx + mov cx, [esi] ; ecx + mov edx, ecx + push ecx + sub ecx, ebx + inc ecx + cmp ecx, 2 + pop ecx + ja bcd_damage_right_end ; |ecx-ebx|<=1 + dec ecx + cmp ecx, 0 ; 0, + jge bcd_no_neg_value_HR + xor ecx, ecx + bcd_no_neg_value_HR: + mov [esi], cx + call clear_tiles + ; + call ackack_check_bombing + bcd_damage_right_end: + call check_level_complete + bcd_detonation: + mov eax, 1 + jmp bcd_end + bcd_no_detonation: + mov eax, 0 + jmp bcd_end + bcd_out_of_city: + mov eax, 1 + cmp ebx, WINDOW_HEIGHT - GROUNG_HEIGHT + jge bcd_end + mov eax, 0 + bcd_end: + pop edx + pop ecx + + ret + + +bombfly_sound_start: ; ecx - + + push eax ebx ecx + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 1 ))-1)], [_array_sounds+8*((( 1 ))-1)+4], VOLUME_BOMBFLY, VOLUME_BOMBFLY, SSMIX_CHANMODE_SINGLE_WITHOUT_RESET + @@: + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov [ebx], eax + pop ecx ebx eax + + ret + + +bombfly_sound_stop: ; ecx - + + push eax ebx ecx + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov eax, [ebx] + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_stoptrack, eax + @@: + inc ecx + .delete_loop: + cmp ecx, MAX_BOMBS + jae .delete_loop_end + mov ebx, ecx + shl ebx, 2 + add ebx, _array_bombsoundchannels + mov eax, [ebx] + mov [ebx-4], eax + inc ecx + jmp .delete_loop + .delete_loop_end: + pop ecx ebx eax + + ret + +; ==================================== ======================================= + + +fill_circle: + ; ( ) + ; : + ; eax - X + ; ebx - Y + ; ecx - + ; edx - + mov edi, eax + mov esi, ebx + push edx ; + + mov eax, ecx + shl eax, 1 + mov edx, 3 + sub edx, eax ; D:=3-2*R + xor ebx, ebx ; ebx X, ecx Y, edx D, eax - + + fc_loop: + cmp ebx, ecx + jg fc_loop_end + ; + pop eax ; + push edx ; D + mov edx, eax ; edx - + push ebx + push ecx + ; + mov eax, edi + sub eax, ebx + shl eax, 16 + add ebx, edi + add ebx, eax ; + add ecx, esi + mov eax, ecx + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + push ecx + ; + mov eax, esi + sub eax, ecx + mov ecx, eax + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + pop ebx + push ecx + push ebx ; ! ! + ; + mov eax, edi + sub eax, ecx + shl eax, 16 + add ecx, edi + add ecx, eax + mov eax, ebx + mov ebx, ecx ; + mov ecx, eax ; ! ecx - x + add ecx, esi + mov eax, ecx + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ecx + push ecx + ; + mov eax, esi + sub eax, ecx + mov ecx, eax + shl eax, 16 + add ecx, eax ; y + mov eax, 38 + int 0x40 + pop ebx + pop ecx + + mov eax, edx ; eax - + pop edx ; D + push eax ; + ; + cmp edx, 0 + jge fc_loop_D_more_0 ; D<0 + fc_loop_D_low_0: ; + mov eax, ebx + shl eax, 2 + add edx, eax + add edx, 4 ; D:=D+4*X+6 + jmp fc_loop_cmpD_end + fc_loop_D_more_0: ; + mov eax, ebx + sub eax, ecx + shl eax, 2 + add edx, eax + add edx, 10 ; D:=D+4*(X-Y)+10 + dec ecx + fc_loop_cmpD_end: ; + inc ebx + jmp fc_loop + fc_loop_end: + + pop edx ; + + ret + + + + +bang_add: ; , eax - X, eab - Y + + push eax + push ebx + push ecx + push edx + + shl eax, 16 + add eax, ebx + mov ebx, _bang_array + xor ecx, ecx + bang_add_loop: + cmp ecx, MAX_BOMBS + jae bang_add_loop_end + mov edx, [ebx] + cmp edx, -1 + jne bang_add_loop_freecheck_end + mov edx, 5*65536 + 3 + mov [ebx], edx + add ebx, 4 + mov [ebx], eax + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 2 ))-1)], [_array_sounds+8*((( 2 ))-1)+4], VOLUME_BOMBBANG, VOLUME_BOMBBANG, SSMIX_CHANMODE_SINGLE + @@: + jmp bang_add_loop_end + bang_add_loop_freecheck_end: + add ebx, 8 + inc ecx + jmp bang_add_loop + bang_add_loop_end: + + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +bang_proc: + + mov ebx, _bang_array + xor ecx, ecx + bang_proc_loop: + cmp ecx, MAX_BOMBS + jae bang_proc_loop_end + ; + mov edx, [ebx] + cmp edx, -1 + je bang_proc_loop_freecheck_end + ; + and edx, 0x0000FFFF + cmp edx, 0 + jne bang_proc_loop_endcheck_end + ; + push ebx + push ecx + mov ecx, [ebx] + shr ecx, 16 + add ebx, 4 + mov eax, [ebx] + mov ebx, eax + shr eax, 16 + and ebx, 0x0000FFFF + mov edx, BACK_COLOR + call fill_circle + pop ecx + pop ebx + mov eax, -1 + mov [ebx], eax + jmp bang_proc_loop_continue + bang_proc_loop_endcheck_end: + ; + push ebx + push ecx + ; + mov eax, [ebx] + mov edx, eax + shr eax, 16 + mov ecx, eax + and edx, 0x0000FFFF + mov eax, edx + shl eax, 3 + add eax, ecx + shl eax, 16 + dec edx + add eax, edx + mov [ebx], eax + ; + add ebx, 4 + mov eax, [ebx] + mov ebx, eax + shr eax, 16 + and ebx, 0x0000FFFF + ; + mov edx, BANG_COLOR + call fill_circle + pop ecx + pop ebx + bang_proc_loop_freecheck_end: + bang_proc_loop_continue: + add ebx, 8 + inc ecx + jmp bang_proc_loop + bang_proc_loop_end: + + ret + +; ===================================== ========================================= +; , , , + + +ackack_draw: ; + + mov ebx, _ackack + xor ecx, ecx + xor esi, esi ; ( ) + ackack_draw_loop: + cmp ecx, 32 + jae ackack_draw_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 1 + jne ackack_draw_continue ; 1 + push ebx + push ecx + ; ebx + mov ebx, ecx + shl ebx, 1 + add ebx, _city ; + xor eax, eax + mov ax, [ebx] ; + cmp eax, 0 + jle ackack_draw_continue2 ; + mov esi, 1 + call ackack_bullet_start + ; + mov ebx, bmp_ackack ; + cmp edx, 0 + je ackack_draw_no_start_bullet + add ebx, 20*20*3 ; + ackack_draw_no_start_bullet: + ; edx + mov edx, ecx + shl edx, 4 + shl ecx, 2 + add edx, ecx + add edx, CITY_OFFSET + shl edx, 16 + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + sub ecx, 20 ; + add edx, ecx ; + mov ecx, 20*0x00010000 + 20 ; + mov eax, 7 + int 0x40 ; + ackack_draw_continue2: + pop ecx + pop ebx + ackack_draw_continue: + add ebx, 2 + inc ecx + jmp ackack_draw_loop + ackack_draw_loop_end: + + cmp esi, 0 + jne @f + ; + call air_raid_warning_off + @@: + + ret + + +ackack_check_bombing: ; : eax - + + push eax + push ebx + push ecx + push edx + ; + mov ebx, eax + shl ebx, 1 + push ebx + add ebx, _ackack + mov edx, ebx ; edx + xor eax, eax + mov ax, [ebx] ; eax + cmp eax, 1 + jne acb_no_bombing ; + xor eax, eax + mov [ebx], ax ; + call ackack_next_wave + acb_no_bombing: + ; + pop ebx + add ebx, _city + xor eax, eax + mov ax, [ebx] ; eax + cmp eax, 0 + jg acb_no_destroy_building ; + xor eax, eax + mov [ebx], ax ; + acb_no_destroy_building: + pop edx + pop ecx + pop ebx + pop eax + + ret + + + +ackack_next_wave: ; + + push eax + push ebx + push ecx + push edx + + anw_begin: + mov ebx, _ackack + xor ecx, ecx + xor edx, edx ; + anw_loop: + cmp ecx, 32 + jae anw_loop_end + xor eax, eax + mov ax, [ebx] + cmp eax, 1 + jle anw_continue ; <=1 + dec eax + mov [ebx], ax + cmp eax, 1 + jg anw_no_active_ackack ; >1 + mov edx, 1 ; + jmp anw_continue + anw_no_active_ackack: + cmp edx, 1 + je anw_continue ; 1 + mov edx, 2 + anw_continue: + add ebx, 2 + inc ecx + jmp anw_loop + anw_loop_end: + cmp edx, 2 + je anw_begin + + pop edx + pop ecx + pop ebx + pop eax + ret + + + + + +ackack_bullet_start: ; (: eax - , ecx - ; + ; : edx - (0-, 1 -) + + push eax + push ebx + push ecx + + cmp [_flag_air_raid_warning], 1 + jne abs_no_start_bullet + + ; ebx + mov edx, eax + mov ebx, ecx + shl ebx, 2 + add ebx, _ackack_bullet ; + mov eax, [ebx] ; + cmp eax, 0 + jne abs_no_start_bullet ; 0, + ; + mov eax, edx ; eax + ; + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + sub ecx, 20+BULLET_SIZE ; + ( ecx - ) + mov [ebx], ecx ; + + cmp [_flag_bomberdatabin_ok], 1 + jne @f + stdcall ssmix_playtrack, [_array_sounds+8*((( 3 ))-1)], [_array_sounds+8*((( 3 ))-1)+4], VOLUME_ACKACK,VOLUME_ACKACK , SSMIX_CHANMODE_SINGLE + @@: + + mov edx, 1 + jmp abs_end_start_bullet + abs_no_start_bullet: + mov edx, 0 + abs_end_start_bullet: + + pop ecx + pop ebx + pop eax + + ret + + +ackack_bullet_proc: ; + + mov ebx, _ackack_bullet + xor ecx, ecx + abp_loop: + cmp ecx, 32 + jae abp_loop_end + mov eax, [ebx] + cmp eax, 0 + je abp_continue + jl abp_low_zero + push ebx + push ecx + ; + mov ebx, ecx + shl ebx, 4 + shl ecx, 2 + add ebx, ecx + add ebx, CITY_OFFSET + add ebx, 7 ; + mov edx, ebx + shl ebx, 16 + add ebx, edx ; ebx X + mov ecx, eax + mov edx, ecx + add edx, BULLET_SIZE ; + shl ecx, 16 + add ecx, edx ; ebx Y + mov edx, BACK_COLOR + mov eax, 38 + int 0x40 + add ebx, 0x00050005 + int 0x40 + + pop ecx + pop ebx + push ebx + push ecx + + mov eax, [ebx] + sub eax, ACKACK_BULLET_SPEED + mov [ebx], eax + cmp eax, 0 + jle abp_end_draw_bullet + + call ackack_bullet_interaction_check + cmp edx, 0 + je abp_no_bullet_interaction ; + xor eax, eax + mov [ebx], eax + jmp abp_end_draw_bullet + abp_no_bullet_interaction: + + ; + mov ebx, ecx + shl ebx, 4 + shl ecx, 2 + add ebx, ecx + add ebx, CITY_OFFSET + add ebx, 7 ; + mov edx, ebx + shl ebx, 16 + add ebx, edx ; ebx X + mov ecx, eax + mov edx, ecx + add edx, BULLET_SIZE ; + shl ecx, 16 + add ecx, edx ; ebx Y + mov edx, 0x00000000 + mov eax, 38 + int 0x40 + add ebx, 0x00050005 + int 0x40 + abp_end_draw_bullet: + + pop ecx + pop ebx + jmp abp_continue + abp_low_zero: + xor eax, eax + mov [ebx], eax + abp_continue: + add ebx, 4 + inc ecx + jmp abp_loop + abp_loop_end: + + ret + + +ackack_bullet_interaction_check: ; + ; (: eax - Y, ecx - ; + ; : edx - (0-, 1 -)) + + + push eax + push ebx + push ecx + + ; + mov ebx, [_plane_health] + cmp ebx, 0 + jle abic_with_plane_no + mov ebx, [_plane_state] + cmp ebx, 4 + je abic_with_plane_no + cmp ebx, 5 + je abic_with_plane_no + ; + mov ebx, [_Y_plane] + cmp eax, ebx + jl abic_with_plane_no ; + add ebx, 20 ; ebx - + cmp eax, ebx + jg abic_with_plane_no ; + ; X + mov edx, ecx + shl edx, 4 + shl ecx, 2 + add ecx, edx + add ecx, CITY_OFFSET + add ecx, 7 ; ecx - X + mov ebx, [_X_plane] + add ebx, 32 + cmp ecx, ebx + jg abic_with_plane_no + mov ebx, [_X_plane] + add ecx, 5 + cmp ecx, ebx + jl abic_with_plane_no + ; !!! + mov ebx, [_plane_health] + sub ebx, 20 + mov [_plane_health], ebx + cmp ebx, 0 ; game over + jg abic_no_plane_crash + mov [_plane_health], 0 + mov eax, [_X_plane] + mov ebx, [_Y_plane] + call bang_add ; + call game_over ; + abic_no_plane_crash: + mov edx, 1 + jmp abic_with_plane_end + abic_with_plane_no: + mov edx, 0 + abic_with_plane_end: + + pop ecx + pop ebx + pop eax + ret + +; ===================================== ========================================= + +ground_draw: + + mov eax, 13 + mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) + mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (GROUNG_HEIGHT-5-20) + mov edx, GROUND_COLOR + int 0x40 + + mov eax, 38 + mov ebx, 0*0x00010000 + (WINDOW_WIDTH-10) + mov ecx, (WINDOW_HEIGHT-GROUNG_HEIGHT)*0x00010000 + (WINDOW_HEIGHT-GROUNG_HEIGHT) + mov edx, 0x000000 + int 0x40 + + ret + + +city_draw: ; + + mov ebx, _city + xor edx, edx + city_draw_loop: + cmp edx, 32 + jae city_draw_loop_end + xor eax, eax + mov ax, [ebx] + push ebx + push edx + mov ebx, bmp_tile + city_draw_loop2: + cmp eax, 0 + jle city_draw_loop2_end + push eax + push edx + ; edx + mov ecx, edx + shl edx, 4 + shl ecx, 2 + add edx, ecx + add edx, CITY_OFFSET + shl edx, 16 + mov ecx, eax + shl eax, 4 + shl ecx, 2 + add eax, ecx + mov ecx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ecx, eax + add edx, ecx ; + mov ecx, 20*0x00010000 + 20 ; + mov eax, 7 + int 0x40 ; + pop edx + pop eax + dec eax + jmp city_draw_loop2 + city_draw_loop2_end: + + pop edx + pop ebx + add ebx, 2 + inc edx + jmp city_draw_loop + city_draw_loop_end: + + ret + + +clear_tiles: ; : eax - , ecx - , edx - + + push eax + push ebx + push ecx + push edx + ; X + mov ebx, eax + shl eax, 4 + shl ebx, 2 + add eax, ebx + add eax, CITY_OFFSET + ; Y1 + mov ebx, ecx + shl ecx, 4 + shl ebx, 2 + add ecx, ebx + mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ebx, ecx + mov ecx, ebx + add ecx, 20 + ; Y2 + mov ebx, edx + shl edx, 4 + shl ebx, 2 + add edx, ebx + mov ebx, WINDOW_HEIGHT-GROUNG_HEIGHT + sub ebx, edx + mov edx, ebx + sub edx, 20 ; , + ; Y=Y2 H=Y1-Y2 + sub ecx, edx + shl edx, 16 + add ecx, edx + ; X 20 + shl eax, 16 + add eax, 20 + mov ebx, eax + ; + mov eax, 13 + mov edx, BACK_COLOR + int 0x40 + + pop edx + pop ecx + pop ebx + pop eax + + ret + + +load_level: ; , eax + + mov eax, [_level_num] + dec eax + shl eax, 7 ; (128 ) + mov ebx, levels + add ebx, eax ; ebx + mov edx, cur_level + mov ecx, 0 + load_level_loop: + cmp ecx, 128/4 + jae load_level_loop_end + mov eax, [ebx] + mov [edx], eax + add ebx, 4 + add edx, 4 + inc ecx + jmp load_level_loop + load_level_loop_end: + + load_level_end: + + ret + +; =================================== ======================================== + +timer_x4: + mov eax, [_timer_x4] + inc eax + mov [_timer_x4],eax + cmp eax, 4 + ja timer_x4_do + jmp timer_x4_end + timer_x4_do: + mov [_timer_x4],0 + timer_x4_end: + ret + + +timer_x2: + mov eax, [_timer_x2] + inc eax + mov [_timer_x2],eax + cmp eax, 2 + ja timer_x2_do + jmp timer_x2_end + timer_x2_do: + mov [_timer_x2],0 + timer_x2_end: + ret + +draw_window: ; + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,100*65536+WINDOW_WIDTH + mov ecx,100*65536+WINDOW_HEIGHT + mov edx,0x34000000+BACK_COLOR + mov edi,_window_caption + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + ret + + + +draw_intro: + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-80)*65536 + 60 + mov ecx,0x80000000 + mov edx,_text_intro_title + int 0x40 + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-200)*65536 + 120 + mov ecx,0x80000000 + mov edx,_text_intro_description1 + int 0x40 + + + ; + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-60)*65536 + 200 + mov ecx,0x80000000 + mov edx,_text_intro_key_controls + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-70)*65536 + 230 + mov ecx,0x80000000 + mov edx,_text_intro_key_ctrl + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-70)*65536 + 245 + mov ecx,0x80000000 + mov edx,_text_intro_key_space + int 0x40 + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-175)*65536 + 300 + mov ecx,0x80000000 + mov edx,_text_intro_select_level + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-25)*65536 + 320 + mov ecx,0x80000000 + mov edx,_text_intro_level_num + int 0x40 + + call draw_level_num + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-175)*65536 + 350 + mov ecx,0x80000000 + mov edx,_text_intro_set_volume + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-25)*65536 + 370 + mov ecx,0x80000000 + mov edx,_text_intro_volume_num + int 0x40 + call draw_volume_num + + ; + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-80)*65536 + 400 + mov ecx,0x80FF0000 + mov edx,_text_intro_start_space + int 0x40 + + mov eax,4 + mov ebx,(WINDOW_WIDTH/2-30)*65536 + 460 + mov ecx,0x80000000 + mov edx,_text_intro_exit_key + int 0x40 + + + ret + + +draw_level_num: + + mov eax, 13 + mov ebx, (WINDOW_WIDTH/2+25)*0x00010000 + 30 + mov ecx, 320*0x00010000 + 15 + mov edx, BACK_COLOR + int 0x40 + + mov eax, 47 + mov ebx, 0x80020000 + mov ecx, [_level_num] + mov edx, (WINDOW_WIDTH/2+25)*65536 + 320 + mov esi,0x00000000 + int 0x40 + + ret + +draw_volume_num: + + mov eax, 13 + mov ebx, (WINDOW_WIDTH/2+35)*0x00010000 + 30 + mov ecx, 370*0x00010000 + 15 + mov edx, BACK_COLOR + int 0x40 + + mov eax, 47 + mov ebx, 0x80020000 + mov ecx, [_set_volume] + mov edx, (WINDOW_WIDTH/2+35)*65536 + 370 + mov esi,0x00000000 + int 0x40 + + ret + +;--------------------------------------------------------------------------- +;-------------------------------- ----------------------------------- +;--------------------------------------------------------------------------- + +_game_state dd ? +_delay dd 6 +_timer_x2 dd ? +_timer_x4 dd ? +_game_over_time dd ? +_flag_air_raid_warning dd ? +_flag_bomberdatabin_ok dd ? +_last_value_timecount dd ? + +_X_plane dd ? +_Y_plane dd ? +_last_XY_plane dd ? +_VX_plane dd ? +_addit_VY_plane dd ? +_plane_state dd ? ; 0 - , 1- , 2- -, 3- -, 4 - , 5 - +_plane_state_step dd ? ; ( ) +_plane_health dd ? ; + +_bomb_count dd ? +_bomb_array rd 4*MAX_BOMBS +_bomb_delay_time dd ? ; + +_bang_array rd 2*MAX_BOMBS + +_anim_pos_plane dd ? +; +_anim_array_uturn_rl dd 0,1,2,3,4,5,6,7,8 +_anim_array_uturn_lr dd 8,7,6,9,10,11,2,1,0 +_anim_array_barrel_r dd 0,1,2,12,13,14,15,16,0 +_anim_array_barrel_l dd 8,17,18,19,20,21,6,7,8 + + +cur_level: +; , . +_city rw 32 +; , . +_ackack rw 32 +; , +_ackack_bullet rd 32 + +; +_level_num dd 1 +; : 32 ( " ") _level?_city +; _level?_ackack +levels: +_level1_city dw 0, 0, 0, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 6, 7, 8, 8, 7, 6, 3, 3, 3, 3, 3, 6, 5, 6, 5, 6, 0, 0, 0 +_level1_ackack dw 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +_level2_city dw 0, 0, 0, 5, 5, 2, 5, 7, 7, 2, 7, 9, 9, 9, 2, 9, 9, 2, 9, 9, 9, 7, 2, 7, 7, 5, 2, 5, 5, 0, 0, 0 +_level2_ackack dw 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0 + +_level3_city dw 0, 0, 0,12,12,12, 9, 9, 9,12,12,12, 9, 7, 5, 3, 3, 5, 7, 9,12,12,12, 9, 9, 9,12,12,12, 0, 0, 0 +_level3_ackack dw 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 4, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 + +_level4_city dw 0, 0, 0,12,12,12, 3,12,12,12, 3, 1, 1, 6,12,18, 18,12, 6, 1, 1, 3,12,12,12, 3,12,12,12, 0, 0, 0 +_level4_ackack dw 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 2, 6, 0, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0 + +_level5_city dw 0, 5,10,10,10,10,15,15,15,15,17,17,17,17, 1,15, 15, 1,17,17,17,17,15,15,15,15,10,10,10,10, 5, 0 +_level5_ackack dw 0, 8, 0, 9, 9, 0, 3, 3, 3, 3, 0, 0, 0, 0, 5, 1, 2, 5, 0, 0, 0, 0, 4, 4, 4, 4, 0,10,10, 0, 7, 0 + +; +_count_sounds dd ? +_array_sounds rd 2*MAX_SOUNDS + +_channel_sound_plane dd ? ; +_channel_sound_arw dd ? ; +_array_bombsoundchannels rd MAX_BOMBS ; + +_set_volume dd 8 ; 0..8 + +; + +_s_current_dir rb 4096 ; + +file_info: ; + _fi_func dd ? + _fi_pos dd ? + dd 0 + _fi_size dd ? + _fi_pbuff dd ? + db 0 + _fi_pfilename dd ? + +if lang eq ru_RU + include 'lang-ru_RU.inc' ; Encoded as CP866 +else ; Default to en_US + include 'lang-en_US.inc' +end if + +bmp_plane: +file "plane.bmp":54 + +bmp_bomb: +file "bomb.bmp":54 + +bmp_tile: +file "tile.bmp":54 + +bmp_ackack: +file "ackack.bmp":54 + + +align 16 +rb 0x100 ; . + +i_end: + diff --git a/programs/games/bomber/englang.inc b/programs/games/bomber/lang-en_US.inc similarity index 75% rename from programs/games/bomber/englang.inc rename to programs/games/bomber/lang-en_US.inc index 391958751..16e176e92 100644 --- a/programs/games/bomber/englang.inc +++ b/programs/games/bomber/lang-en_US.inc @@ -1,17 +1,17 @@ -_window_caption db 'Soft landing',0 ; - -_text_game_over db 'G A M E O V E R', 0 -_text_level_complete db 'L E V E L C O M P L E T E', 0 -_text_intro_title db ' S O F T L A N D I N G', 0 -_text_intro_description1 db 'Provide a soft landing, clearing the runway from the city buildings', 0 - -_text_intro_key_controls db ' Control keys:', 0 -_text_intro_key_ctrl db ' CTRL - drop a bomb', 0 -_text_intro_key_space db 'SPACE - do a barrel roll', 0 -_text_intro_select_level db ' Use UP and DOWN arrow keys for select game level:', 0 -_text_intro_level_num db ' LEVEL', 0 -_text_intro_set_volume db ' Use LEFT and RIGHT arrow keys for setting volume:', 0 -_text_intro_volume_num db 'VOLUME', 0 - -_text_intro_start_space db 'Press SPACE for start game', 0 -_text_intro_exit_key db 'Esc - exit', 0 \ No newline at end of file +_window_caption db 'Soft landing',0 ; Application title + +_text_game_over db 'G A M E O V E R', 0 +_text_level_complete db 'L E V E L C O M P L E T E', 0 +_text_intro_title db ' S O F T L A N D I N G', 0 +_text_intro_description1 db 'Provide a soft landing, clearing the runway from the city buildings', 0 + +_text_intro_key_controls db ' Control keys:', 0 +_text_intro_key_ctrl db ' CTRL - drop a bomb', 0 +_text_intro_key_space db 'SPACE - do a barrel roll', 0 +_text_intro_select_level db ' Use UP and DOWN arrow keys to select the game level:', 0 +_text_intro_level_num db ' LEVEL', 0 +_text_intro_set_volume db ' Use LEFT and RIGHT arrow keys for setting volume:', 0 +_text_intro_volume_num db 'VOLUME', 0 + +_text_intro_start_space db 'Press SPACE for start game', 0 +_text_intro_exit_key db 'Esc - exit', 0 diff --git a/programs/games/bomber/ruslang.inc b/programs/games/bomber/lang-ru_RU.inc similarity index 100% rename from programs/games/bomber/ruslang.inc rename to programs/games/bomber/lang-ru_RU.inc diff --git a/programs/games/gomoku/trunk/gomoku.asm b/programs/games/gomoku/trunk/gomoku.asm index f443cbd50..d97c62480 100644 --- a/programs/games/gomoku/trunk/gomoku.asm +++ b/programs/games/gomoku/trunk/gomoku.asm @@ -1,756 +1,756 @@ -;http://sources.ru/pascal/gamestxt/go-moku.zip - -N = 19 ; Size of the board - -use32 - org 0x0 - db 'MENUET01' - dd 0x1 - dd START - dd I_END - dd E_END - dd E_END - dd 0x0,0x0 - -include '../../../macros.inc' -include 'lang.inc' - -AttackFactor dw 1 ; Importance of attack (1..16) - -START: - - mcall 40,0x80000027 - mcall 3 - mov [rsx1],ax - shr eax,16 - mov [rsx2],ax - -redraw_all: - mcall 9,proc_info,-1 - test [proc_info.wnd_state], 0x04 ; is rolled_up? - jz @f - mcall 0,100*65536+(16*N+12),,0x34FFFFFF,,title - jmp still - @@: - mcall 12,1 - mcall 48,4 - xchg eax,ecx - add ecx,100*65536+(16*N+26) - mcall 0,<100,16*N+12>,,0x34FFFFFF,,title - mcall 38,<2,16*N>,<20,20>,0x00a0a0a0;000000 - mov edi,N - @@: add ecx,16*65536+16 - mcall - dec edi - jnz @b - push cx - mov ecx,20*65536 - pop cx - mcall ,1*65536+1 - mov edi,N - @@: add ebx,16*65536+16 - mcall - dec edi - jnz @b - - mcall 8,3*65536+40,3*65536+12,2,0xFFFFFF - mcall ,50*65536+40,,3, - mcall 4,7*65536+5,0x80000000,txt_buttons - mcall 12,2 - - -draw_pole: -; mcall 48,4 -; xchg eax,ecx -; add ecx,100*65536+(16*N+26) -; mcall 0,100*65536+(16*N+12),,0x74FFFFFF,,title - - mov esi,Board - mov edi,N*N-N - mov ebp,N - mov ebx,(1+5)*65536+(21+5-1) - call print_board - bt [flags],0 - jnc @f - mcall 4,100*65536+6,0x800000ff,txt_go -@@: bt [flags],3 - jnc @f - mcall 4,100*65536+6,0x800000ff,txt_tie - jmp still -@@: - bt [flags],2 - jnc still - ret -still: - mcall 10 - - dec al - jz redraw_all - dec al - jz key - dec al - jz button - sub al,3 - jz mouse - jmp still - -key: - mcall 2 - btr [flags],2 - cmp ah,97 - jne @f -.auto: bts [flags],2 - jmp mouse.auto -@@: cmp ah,110 - je button.new_game - jmp still - -button: - mcall 17 - cmp ah,1 - jne @f - mcall -1 -@@: cmp ah,2 - jne key.auto -.new_game: - mov [TotalLines],2 * 2 * (N * (N - 4) + (N - 4) * (N - 4)) - mov [WinningLine],0x0 - mov [X],(N + 1)/2 - mov [Y],(N + 1)/2 - mov [flags],0 - mov edi,Board - mov ecx,(13*N*N/4)+1 - xor eax,eax - cld -@@: stosd - loop @b - jmp redraw_all - -print_board: - cmp byte [esi],0 ; - je .null - cmp byte [esi],1 ;X - je .one - cmp byte [esi],2 ;O - je .two - bts [flags],4 - cmp byte [esi],3 ; - je .one - jmp .two ;0 - -.end: - inc esi - dec ebp - jnz print_board - test edi,edi - jz @f - sub edi,N - mov ebp,N - add ebx,-N*16*65536+16 - jmp print_board -@@: ret - -.one: - mov [pic_plt+4],0x4ba010 - btr [flags],4 - jnc @f - mov [pic_plt+4],0xff0000 -@@: pushad - mov edx, ebx - mcall 65,pic_x,<7,7>,,1,pic_plt, 0 - popad -.null: - add ebx,16*65536;+16 - jmp .end -.two: - mov [pic_plt+4],0x00459a - btr [flags],4 - jnc @f - mov [pic_plt+4],0xff0000 -@@: pushad - mov edx, ebx - mcall 65,pic_o,<7,7>,,1,pic_plt, 0 - popad - jmp .null - - -draw_one_symbol: - movzx eax,[X] - mov ebx,16 - mul ebx - shl eax,16 - add eax,(1+5)*65536; - mov ax,[Y] - mov ecx,16 - mul cx - add ax,(21+5-1) - xchg eax,ebx - - movzx eax,[Y] - push ebx - mov ebx,N - mul bx - mov bx,[X] - add ax,bx - pop ebx - mov esi,Board - add esi,eax - mov edi,0 - mov ebp,1 - call print_board -ret - - -mouse: - bt [flags],5 - jc still - mcall 37,2 - test eax,eax - jz still - mcall 37,1 - mov dx,ax - shr eax,16 - cmp dx,20 - jbe still - cmp dx,(16*N+20) - jge still - cmp ax,1 - jbe still - cmp ax,(16*N) - jge still - - bt [flags],0 - jc still - bt [flags],3 - jc still - sub ax,1 - push dx - xor edx,edx - mov cx,16 - div cx - pop dx - mov [X],ax - push ax - sub dx,20 - mov ax,dx - xor dx,dx - div cx - mov [Y],ax - xor dx,dx - mov cx,N - mul cx - pop dx - add ax,dx - cmp ax,N*N - jge still - mov esi,Board - - cmp byte [esi+eax],0 - jne still - -.auto: bt [flags],0 - jc .end - bt [flags],3 - jc .end - - btr [flags],1 ;0 - 室 ப - bt [flags],2 - jnc @f - call FindMove -@@: call MakeMove - call draw_one_symbol - bt [flags],0 - jc .end - - bts [flags],1 ;1 - 室 cpu - call FindMove - call MakeMove - call draw_one_symbol -.end: bt [flags],0 - jnc @f - call BlinkRow - btr [flags],2 -@@:; mcall 12,1 - bt [flags],3 - jc @f - bt [flags],2 - jnc @f - call draw_pole - jmp .auto -@@: jmp draw_pole - - - - -winline: dw 1,0, 1,1, 1,-1, 0,1 ;X,Y -BlinkRow: - movzx ecx,[WinningLine] - mov eax,[winline+(ecx-1)*4] - push ax ;Dx - shr eax,16 - push ax ;Dy - movzx eax,[Y] - mov si,N - mul si - add ax,[X] - mov cl,[Board+eax] -@@: movzx eax,[Y] - add ax,[esp] - mov [Y],ax - test eax,eax - jz .ret - cmp eax,N-1 - jg .ret - movzx ebx,[X] - add bx,[esp+2] - mov [X],bx - test ebx,ebx - jz .ret - cmp ebx,N-1 - jg .ret - mov si,N - mul si - add ax,bx - cmp byte [Board+eax],cl - je @b - -.ret: mov edi,5 - mov esi,N -@@: movzx eax,[Y] - sub ax,[esp] - mov [Y],ax - mul si - movzx ebx,[X] - sub bx,[esp+2] - mov [X],bx - add ax,bx - cmp byte [Board+eax],cl - jne .1 - add byte [Board+eax],2 -.1: dec edi - jnz @b - add esp,4 -ret - - - -Max dw ? - -FindMove: - mov [Max],0 - mov [X],((N+1) / 2) - mov [Y],((N+1) / 2) - movzx eax,[Y] - mov ah,N - mul ah - add ax,[X] - cmp byte [Board+eax],0 - jne @f - mov [Max],4 -@@: xor ecx,ecx -.loop: - cmp byte [Board+ecx],0 - jne .check_loop - movzx eax, word [Value+ecx*2] - bt [flags],1 - jc @f - movzx eax, word [Value+(N*N+ecx)*2] - @@: - mov ebx,16 - add bx,[AttackFactor] - mul bx - shr eax,4 ;div 16 - mov bx,[Value+2*(N*N+ecx)] - bt [flags],1 - jc @f - mov bx,[Value+2*(ecx)] - @@: - add bx,ax - mov eax,4 - call random - add bx,ax - cmp bx,[Max] - jbe .check_loop - mov [Max],bx - xor edx,edx - mov eax,ecx - mov ebx,N - div ebx - mov [X],dx - mov [Y],ax -.check_loop: - inc ecx - cmp ecx,N*N - jb .loop -ret - - -MakeMove: - xor eax,eax - mov esi,N - -.1: movzx ecx,[X] ;ecx=X1, eax=K, edx=Y1 - inc cl - movzx edx,[Y] - inc dl - sub cl,al - xor edi,edi - test ecx,ecx - jz .1_ - cmp ecx,N-4 - jg .1_ - dec cl - dec dl - push eax edx - mov eax,edx - mul esi - add eax,ecx - call .Add - bt [flags],0 - jnc .11 - cmp [WinningLine],0x0 - jne .11 - mov [WinningLine],1 - .11: mov eax,[esp];edx - mul esi - add eax,ecx - push eax - mov eax,[esp+4];edx - mul esi - add eax,edi - add eax,ecx - mov ebx,eax - pop eax - call .Update - inc edi - cmp edi,4 - jbe .11 - pop edx eax -.1_: inc eax - cmp eax,4 - jbe .1 - - xor eax,eax - -.2: movzx ecx,[X] - inc cl - movzx edx,[Y] - inc dl - xor edi,edi - sub cl,al - sub dl,al - test ecx,ecx - jz .2_ - cmp ecx,N-4 - jg .2_ - test edx,edx - jz .2_ - cmp edx,N-4 - jg .2_ - dec cl - dec dl - push eax edx - mov eax,edx - mul esi - add eax,ecx - add eax,1*N*N - call .Add - bt [flags],0 - jnc .21 - cmp [WinningLine],0x0 - jne .21 - mov [WinningLine],2 - .21: mov eax,[esp];edx - mul esi - add eax,ecx - add eax,1*N*N - push eax - mov eax,[esp+4];edx - add eax,edi - mul esi - add eax,edi - add eax,ecx - mov ebx,eax - pop eax - call .Update - inc edi - cmp edi,4 - jbe .21 - pop edx eax -.2_: inc eax - cmp eax,4 - jbe .2 - - xor eax,eax - -.3: movzx ecx,[X] - inc cl - movzx edx,[Y] - inc dl - xor edi,edi - add cl,al - sub dl,al - cmp ecx,5 - jb .3_ - cmp ecx,N - jg .3_ - test edx,edx - jz .3_ - cmp edx,N-4 - jg .3_ - dec cl - dec dl - push eax edx - mov eax,edx - mul esi - add eax,ecx - add eax,3*N*N - call .Add - bt [flags],0 - jnc .31 - cmp [WinningLine],0 - jne .31 - mov [WinningLine],3 - .31: mov eax,[esp];edx - mul esi - add eax,ecx - add eax,3*N*N - push eax - mov eax,[esp+4];edx - add eax,edi - mul esi - add eax,ecx - sub eax,edi - mov ebx,eax - pop eax - call .Update - inc edi - cmp edi,4 - jbe .31 - pop edx eax -.3_: inc eax - cmp eax,4 - jbe .3 - - xor eax,eax - -.4: movzx ecx,[X] - inc cl - movzx edx,[Y] - inc dl - xor edi,edi - sub dl,al - test edx,edx - jz .4_ - cmp edx,N-4 - jg .4_ - dec cl - dec dl - push eax edx - mov eax,edx - mul esi - add eax,ecx - add eax,2*N*N - call .Add - bt [flags],0 - jnc .41 - cmp [WinningLine],0 - jne .41 - mov [WinningLine],4 - .41: mov eax,[esp];edx - mul esi - add eax,ecx - add eax,2*N*N - push eax - mov eax,[esp+4];edx - add eax,edi - mul esi - add eax,ecx - mov ebx,eax - pop eax - call .Update - inc edi - cmp edi,4 - jbe .41 - pop edx eax -.4_: inc eax - cmp eax,4 - jbe .4 - - movzx eax,[Y] - mul esi - add ax,[X] - bt [flags],1 - jc @f - mov byte [Board+eax],1 - jmp .end -@@: - mov byte [Board+eax],2 -.end: cmp [TotalLines],0 - jne @f - bts [flags],3 -@@: -ret - -.Add: - bt [flags],1 - jnc .Add_player - inc byte [Line+eax] - cmp byte [Line+eax],1 - jne @f - dec [TotalLines] -@@: cmp byte [Line+eax],5 - jb @f - bts [flags],0 ; 祭 -@@: -ret -.Add_player: - inc byte [Line+eax+4*N*N] - cmp byte [Line+eax+4*N*N],1 - jne @f - dec [TotalLines] -@@: cmp byte [Line+eax+4*N*N],5 - jb @f - bts [flags],0 ; 祭 -@@: -ret - -.Update: -;eax ࠬ, ebx ன - push edi - bt [flags],1 - jnc .Update_player - cmp byte [Line+eax+4*N*N],0 - jne .else_cpu - push eax - movzx edi, byte [Line+eax] - mov ax, word [edi*2+2+Weight] - sub ax, word [edi*2+Weight] - add [Value+ebx*2],ax - pop eax - jmp .Update_end - .else_cpu: - cmp byte [Line+eax],1 - jne .Update_end - push eax - movzx edi, byte [Line+eax+4*N*N] - mov ax, word [edi*2+2+Weight] - sub [Value+ebx*2+N*N*2],ax - pop eax - jmp .Update_end -.Update_player: - cmp byte [Line+eax],0 - jne .else_player - push eax - movzx edi, byte [Line+eax+4*N*N] - mov ax, word [edi*2+2+Weight] - mov di, word [edi*2+Weight] - sub ax,di - add [Value+ebx*2+2*N*N],ax - pop eax - jmp .Update_end - .else_player: - cmp byte [Line+eax+4*N*N],1 - jne .Update_end - push eax - movzx edi, byte [Line+eax] - mov ax, word [edi*2+2+Weight] - sub [Value+ebx*2],ax - pop eax -.Update_end: - pop edi -ret - - -align 4 -rsx1 dw ?;0x4321 -rsx2 dw ?;0x1234 -random: ; ASCL - push ecx ebx edi edx - mov cx,ax - mov ax,[rsx1] - mov bx,[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 [rsx1],bx - mov [rsx2],ax - xor dx,dx - cmp ax,0 - je nodiv - cmp cx,0 - je nodiv - div cx -nodiv: - mov ax,dx - pop edx edi ebx ecx - and eax,0000ffffh -ret - - - -pic_x db 10000010b, \ - 01000100b, \ - 00101000b, \ - 00010000b, \ - 00101000b, \ - 01000100b, \ - 10000010b - -pic_o db 01111100b, \ - 10000010b, \ - 10000010b, \ - 10000010b, \ - 10000010b, \ - 10000010b, \ - 01111100b - -pic_plt dd 0xffffff, 0x000000 -if lang eq ru_RU -title db '',0 -txt_buttons db ' ',0 -txt_go db ' 祭',0 -txt_tie db ' 室',0 -else -title db 'Gomoku',0 -txt_go db 'Game over',0 -txt_tie db 'Tie game',0 -txt_buttons db 'New Auto',0 -endf - - -Weight dw 0,0,4,20,100,500,0 - - -WinningLine db 0 -TotalLines dw 0 - -X dw 0 -Y dw 0 - -flags rw 1 -; 0: 祭 -;1: 0-室 ப, 1- -;2: autoplay -;3: 室 ௠ -;4: print_board - 뤥 梥⮬ 5- ⮪ - -I_END: -align 16 -Board rb N*N -Value rw N*N*2 ;ࢠ - , - ப -Line rb 4*N*N*2 -proc_info process_information - rb 0x100 ; stack -E_END: +;http://sources.ru/pascal/gamestxt/go-moku.zip + +N = 19 ; Size of the board + +use32 + org 0x0 + db 'MENUET01' + dd 0x1 + dd START + dd I_END + dd E_END + dd E_END + dd 0x0,0x0 + +include '../../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +AttackFactor dw 1 ; Importance of attack (1..16) + +START: + + mcall 40,0x80000027 + mcall 3 + mov [rsx1],ax + shr eax,16 + mov [rsx2],ax + +redraw_all: + mcall 9,proc_info,-1 + test [proc_info.wnd_state], 0x04 ; is rolled_up? + jz @f + mcall 0,100*65536+(16*N+12),,0x34FFFFFF,,title + jmp still + @@: + mcall 12,1 + mcall 48,4 + xchg eax,ecx + add ecx,100*65536+(16*N+26) + mcall 0,<100,16*N+12>,,0x34FFFFFF,,title + mcall 38,<2,16*N>,<20,20>,0x00a0a0a0;000000 + mov edi,N + @@: add ecx,16*65536+16 + mcall + dec edi + jnz @b + push cx + mov ecx,20*65536 + pop cx + mcall ,1*65536+1 + mov edi,N + @@: add ebx,16*65536+16 + mcall + dec edi + jnz @b + + mcall 8,3*65536+40,3*65536+12,2,0xFFFFFF + mcall ,50*65536+40,,3, + mcall 4,7*65536+5,0x80000000,txt_buttons + mcall 12,2 + + +draw_pole: +; mcall 48,4 +; xchg eax,ecx +; add ecx,100*65536+(16*N+26) +; mcall 0,100*65536+(16*N+12),,0x74FFFFFF,,title + + mov esi,Board + mov edi,N*N-N + mov ebp,N + mov ebx,(1+5)*65536+(21+5-1) + call print_board + bt [flags],0 + jnc @f + mcall 4,100*65536+6,0x800000ff,txt_go +@@: bt [flags],3 + jnc @f + mcall 4,100*65536+6,0x800000ff,txt_tie + jmp still +@@: + bt [flags],2 + jnc still + ret +still: + mcall 10 + + dec al + jz redraw_all + dec al + jz key + dec al + jz button + sub al,3 + jz mouse + jmp still + +key: + mcall 2 + btr [flags],2 + cmp ah,97 + jne @f +.auto: bts [flags],2 + jmp mouse.auto +@@: cmp ah,110 + je button.new_game + jmp still + +button: + mcall 17 + cmp ah,1 + jne @f + mcall -1 +@@: cmp ah,2 + jne key.auto +.new_game: + mov [TotalLines],2 * 2 * (N * (N - 4) + (N - 4) * (N - 4)) + mov [WinningLine],0x0 + mov [X],(N + 1)/2 + mov [Y],(N + 1)/2 + mov [flags],0 + mov edi,Board + mov ecx,(13*N*N/4)+1 + xor eax,eax + cld +@@: stosd + loop @b + jmp redraw_all + +print_board: + cmp byte [esi],0 ; + je .null + cmp byte [esi],1 ;X + je .one + cmp byte [esi],2 ;O + je .two + bts [flags],4 + cmp byte [esi],3 ; + je .one + jmp .two ;0 + +.end: + inc esi + dec ebp + jnz print_board + test edi,edi + jz @f + sub edi,N + mov ebp,N + add ebx,-N*16*65536+16 + jmp print_board +@@: ret + +.one: + mov [pic_plt+4],0x4ba010 + btr [flags],4 + jnc @f + mov [pic_plt+4],0xff0000 +@@: pushad + mov edx, ebx + mcall 65,pic_x,<7,7>,,1,pic_plt, 0 + popad +.null: + add ebx,16*65536;+16 + jmp .end +.two: + mov [pic_plt+4],0x00459a + btr [flags],4 + jnc @f + mov [pic_plt+4],0xff0000 +@@: pushad + mov edx, ebx + mcall 65,pic_o,<7,7>,,1,pic_plt, 0 + popad + jmp .null + + +draw_one_symbol: + movzx eax,[X] + mov ebx,16 + mul ebx + shl eax,16 + add eax,(1+5)*65536; + mov ax,[Y] + mov ecx,16 + mul cx + add ax,(21+5-1) + xchg eax,ebx + + movzx eax,[Y] + push ebx + mov ebx,N + mul bx + mov bx,[X] + add ax,bx + pop ebx + mov esi,Board + add esi,eax + mov edi,0 + mov ebp,1 + call print_board +ret + + +mouse: + bt [flags],5 + jc still + mcall 37,2 + test eax,eax + jz still + mcall 37,1 + mov dx,ax + shr eax,16 + cmp dx,20 + jbe still + cmp dx,(16*N+20) + jge still + cmp ax,1 + jbe still + cmp ax,(16*N) + jge still + + bt [flags],0 + jc still + bt [flags],3 + jc still + sub ax,1 + push dx + xor edx,edx + mov cx,16 + div cx + pop dx + mov [X],ax + push ax + sub dx,20 + mov ax,dx + xor dx,dx + div cx + mov [Y],ax + xor dx,dx + mov cx,N + mul cx + pop dx + add ax,dx + cmp ax,N*N + jge still + mov esi,Board + + cmp byte [esi+eax],0 + jne still + +.auto: bt [flags],0 + jc .end + bt [flags],3 + jc .end + + btr [flags],1 ;0 - 室 ப + bt [flags],2 + jnc @f + call FindMove +@@: call MakeMove + call draw_one_symbol + bt [flags],0 + jc .end + + bts [flags],1 ;1 - 室 cpu + call FindMove + call MakeMove + call draw_one_symbol +.end: bt [flags],0 + jnc @f + call BlinkRow + btr [flags],2 +@@:; mcall 12,1 + bt [flags],3 + jc @f + bt [flags],2 + jnc @f + call draw_pole + jmp .auto +@@: jmp draw_pole + + + + +winline: dw 1,0, 1,1, 1,-1, 0,1 ;X,Y +BlinkRow: + movzx ecx,[WinningLine] + mov eax,[winline+(ecx-1)*4] + push ax ;Dx + shr eax,16 + push ax ;Dy + movzx eax,[Y] + mov si,N + mul si + add ax,[X] + mov cl,[Board+eax] +@@: movzx eax,[Y] + add ax,[esp] + mov [Y],ax + test eax,eax + jz .ret + cmp eax,N-1 + jg .ret + movzx ebx,[X] + add bx,[esp+2] + mov [X],bx + test ebx,ebx + jz .ret + cmp ebx,N-1 + jg .ret + mov si,N + mul si + add ax,bx + cmp byte [Board+eax],cl + je @b + +.ret: mov edi,5 + mov esi,N +@@: movzx eax,[Y] + sub ax,[esp] + mov [Y],ax + mul si + movzx ebx,[X] + sub bx,[esp+2] + mov [X],bx + add ax,bx + cmp byte [Board+eax],cl + jne .1 + add byte [Board+eax],2 +.1: dec edi + jnz @b + add esp,4 +ret + + + +Max dw ? + +FindMove: + mov [Max],0 + mov [X],((N+1) / 2) + mov [Y],((N+1) / 2) + movzx eax,[Y] + mov ah,N + mul ah + add ax,[X] + cmp byte [Board+eax],0 + jne @f + mov [Max],4 +@@: xor ecx,ecx +.loop: + cmp byte [Board+ecx],0 + jne .check_loop + movzx eax, word [Value+ecx*2] + bt [flags],1 + jc @f + movzx eax, word [Value+(N*N+ecx)*2] + @@: + mov ebx,16 + add bx,[AttackFactor] + mul bx + shr eax,4 ;div 16 + mov bx,[Value+2*(N*N+ecx)] + bt [flags],1 + jc @f + mov bx,[Value+2*(ecx)] + @@: + add bx,ax + mov eax,4 + call random + add bx,ax + cmp bx,[Max] + jbe .check_loop + mov [Max],bx + xor edx,edx + mov eax,ecx + mov ebx,N + div ebx + mov [X],dx + mov [Y],ax +.check_loop: + inc ecx + cmp ecx,N*N + jb .loop +ret + + +MakeMove: + xor eax,eax + mov esi,N + +.1: movzx ecx,[X] ;ecx=X1, eax=K, edx=Y1 + inc cl + movzx edx,[Y] + inc dl + sub cl,al + xor edi,edi + test ecx,ecx + jz .1_ + cmp ecx,N-4 + jg .1_ + dec cl + dec dl + push eax edx + mov eax,edx + mul esi + add eax,ecx + call .Add + bt [flags],0 + jnc .11 + cmp [WinningLine],0x0 + jne .11 + mov [WinningLine],1 + .11: mov eax,[esp];edx + mul esi + add eax,ecx + push eax + mov eax,[esp+4];edx + mul esi + add eax,edi + add eax,ecx + mov ebx,eax + pop eax + call .Update + inc edi + cmp edi,4 + jbe .11 + pop edx eax +.1_: inc eax + cmp eax,4 + jbe .1 + + xor eax,eax + +.2: movzx ecx,[X] + inc cl + movzx edx,[Y] + inc dl + xor edi,edi + sub cl,al + sub dl,al + test ecx,ecx + jz .2_ + cmp ecx,N-4 + jg .2_ + test edx,edx + jz .2_ + cmp edx,N-4 + jg .2_ + dec cl + dec dl + push eax edx + mov eax,edx + mul esi + add eax,ecx + add eax,1*N*N + call .Add + bt [flags],0 + jnc .21 + cmp [WinningLine],0x0 + jne .21 + mov [WinningLine],2 + .21: mov eax,[esp];edx + mul esi + add eax,ecx + add eax,1*N*N + push eax + mov eax,[esp+4];edx + add eax,edi + mul esi + add eax,edi + add eax,ecx + mov ebx,eax + pop eax + call .Update + inc edi + cmp edi,4 + jbe .21 + pop edx eax +.2_: inc eax + cmp eax,4 + jbe .2 + + xor eax,eax + +.3: movzx ecx,[X] + inc cl + movzx edx,[Y] + inc dl + xor edi,edi + add cl,al + sub dl,al + cmp ecx,5 + jb .3_ + cmp ecx,N + jg .3_ + test edx,edx + jz .3_ + cmp edx,N-4 + jg .3_ + dec cl + dec dl + push eax edx + mov eax,edx + mul esi + add eax,ecx + add eax,3*N*N + call .Add + bt [flags],0 + jnc .31 + cmp [WinningLine],0 + jne .31 + mov [WinningLine],3 + .31: mov eax,[esp];edx + mul esi + add eax,ecx + add eax,3*N*N + push eax + mov eax,[esp+4];edx + add eax,edi + mul esi + add eax,ecx + sub eax,edi + mov ebx,eax + pop eax + call .Update + inc edi + cmp edi,4 + jbe .31 + pop edx eax +.3_: inc eax + cmp eax,4 + jbe .3 + + xor eax,eax + +.4: movzx ecx,[X] + inc cl + movzx edx,[Y] + inc dl + xor edi,edi + sub dl,al + test edx,edx + jz .4_ + cmp edx,N-4 + jg .4_ + dec cl + dec dl + push eax edx + mov eax,edx + mul esi + add eax,ecx + add eax,2*N*N + call .Add + bt [flags],0 + jnc .41 + cmp [WinningLine],0 + jne .41 + mov [WinningLine],4 + .41: mov eax,[esp];edx + mul esi + add eax,ecx + add eax,2*N*N + push eax + mov eax,[esp+4];edx + add eax,edi + mul esi + add eax,ecx + mov ebx,eax + pop eax + call .Update + inc edi + cmp edi,4 + jbe .41 + pop edx eax +.4_: inc eax + cmp eax,4 + jbe .4 + + movzx eax,[Y] + mul esi + add ax,[X] + bt [flags],1 + jc @f + mov byte [Board+eax],1 + jmp .end +@@: + mov byte [Board+eax],2 +.end: cmp [TotalLines],0 + jne @f + bts [flags],3 +@@: +ret + +.Add: + bt [flags],1 + jnc .Add_player + inc byte [Line+eax] + cmp byte [Line+eax],1 + jne @f + dec [TotalLines] +@@: cmp byte [Line+eax],5 + jb @f + bts [flags],0 ; 祭 +@@: +ret +.Add_player: + inc byte [Line+eax+4*N*N] + cmp byte [Line+eax+4*N*N],1 + jne @f + dec [TotalLines] +@@: cmp byte [Line+eax+4*N*N],5 + jb @f + bts [flags],0 ; 祭 +@@: +ret + +.Update: +;eax ࠬ, ebx ன + push edi + bt [flags],1 + jnc .Update_player + cmp byte [Line+eax+4*N*N],0 + jne .else_cpu + push eax + movzx edi, byte [Line+eax] + mov ax, word [edi*2+2+Weight] + sub ax, word [edi*2+Weight] + add [Value+ebx*2],ax + pop eax + jmp .Update_end + .else_cpu: + cmp byte [Line+eax],1 + jne .Update_end + push eax + movzx edi, byte [Line+eax+4*N*N] + mov ax, word [edi*2+2+Weight] + sub [Value+ebx*2+N*N*2],ax + pop eax + jmp .Update_end +.Update_player: + cmp byte [Line+eax],0 + jne .else_player + push eax + movzx edi, byte [Line+eax+4*N*N] + mov ax, word [edi*2+2+Weight] + mov di, word [edi*2+Weight] + sub ax,di + add [Value+ebx*2+2*N*N],ax + pop eax + jmp .Update_end + .else_player: + cmp byte [Line+eax+4*N*N],1 + jne .Update_end + push eax + movzx edi, byte [Line+eax] + mov ax, word [edi*2+2+Weight] + sub [Value+ebx*2],ax + pop eax +.Update_end: + pop edi +ret + + +align 4 +rsx1 dw ?;0x4321 +rsx2 dw ?;0x1234 +random: ; ASCL + push ecx ebx edi edx + mov cx,ax + mov ax,[rsx1] + mov bx,[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 [rsx1],bx + mov [rsx2],ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop edx edi ebx ecx + and eax,0000ffffh +ret + + + +pic_x db 10000010b, \ + 01000100b, \ + 00101000b, \ + 00010000b, \ + 00101000b, \ + 01000100b, \ + 10000010b + +pic_o db 01111100b, \ + 10000010b, \ + 10000010b, \ + 10000010b, \ + 10000010b, \ + 10000010b, \ + 01111100b + +pic_plt dd 0xffffff, 0x000000 +if lang eq ru_RU +title db '',0 +txt_buttons db ' ',0 +txt_go db ' 祭',0 +txt_tie db ' 室',0 +else ; Default to en_US +title db 'Gomoku',0 +txt_go db 'Game over',0 +txt_tie db 'Tie game',0 ; FIXME: Should text be 'Draw'? +txt_buttons db 'New Auto',0 +endf + + +Weight dw 0,0,4,20,100,500,0 + + +WinningLine db 0 +TotalLines dw 0 + +X dw 0 +Y dw 0 + +flags rw 1 +; 0: 祭 +;1: 0-室 ப, 1- +;2: autoplay +;3: 室 ௠ +;4: print_board - 뤥 梥⮬ 5- ⮪ + +I_END: +align 16 +Board rb N*N +Value rw N*N*2 ;ࢠ - , - ப +Line rb 4*N*N*2 +proc_info process_information + rb 0x100 ; stack +E_END: diff --git a/programs/games/life3/trunk/life3.asm b/programs/games/life3/trunk/life3.asm index 530ecc3fe..fecdc7982 100644 --- a/programs/games/life3/trunk/life3.asm +++ b/programs/games/life3/trunk/life3.asm @@ -1,1732 +1,1732 @@ -use32 - org 0 - db 'MENUET01' - dd 1,start,i_end,mem,stacktop,0,sys_path - -include '../../../macros.inc' -include '../../../proc32.inc' -include '../../../KOSfuncs.inc' -include '../../../load_img.inc' -include '../../../load_lib.mac' - -;include 'lang.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -hed db 'Life 18.11.20',0 ; - -run_file_70 FileInfoBlock -image_data dd 0 ;㪠⥫ ६ . 㦥 ८ࠧ ࠦ - -ICONSIZE = 21 -TBTNSIZE = ICONSIZE-2 - -IMAGE_TOOLBAR_ICON_SIZE equ ICONSIZE*ICONSIZE*3 -image_data_toolbar dd 0 - - -;-------------------------------------- -struct Cell - x dd ? ;+0 - y dd ? ;+4 - tc dd ? ;+8 ஬ த ᮡ - liv db ? ;+12 祩 - so db ? ;+13 ᫮ ᥤ -ends - -MAX_CELL equ 90000 ; ⭮ 4 -COL_MEM equ 64 ;᫮ 梥⮢ ⫨ - -cell dd 0 ;㪠⥫ ࠬ 祥 -memCell dd 0 -CellColors dd 0 - -macro get_cell_offset reg,ind -{ - mov reg,ind - imul reg,sizeof.Cell - add reg,dword[cell] -} - -er_oom db 0 ; 砩 ௠ -tim_ch db 0 ;⮬᪨ 뢠 -poc_stop dd 1 ; ᫮ -Cor_x dd 0 -Cor_y dd 0 -tim dd 0 ;६ () -b_sort dd 0 ;࠭ ஢ 祥 -osob dd 0 ;᫮ ᮡ -zoom db 3 ;⠡ - -if lang eq ru_RU -txt_zoom db ' ⠡:',0 -txt_gen db ' :',0 -txt_osob db ' ᮡ:',0 -else -txt_zoom db ' Zoom:',0 -txt_gen db 'Generation:',0 -txt_osob db 'Population:',0 -end if - -;ன ᨢ 梥⠬ -; col_pole - 梥 -; col_cell_n - 梥 祩 -; col_cell_o - 梥 ன 祩 -align 4 -proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword - mov esi,[CellColors] - mov ebx,[col_pole] - mov [esi],ebx - - lea edi,[esi+4*COL_MEM] - add esi,4 - ; esi - 㪠⥫ 1- ࠤ 梥 - ; edi - 㪠⥫ ᫥ ࠤ 梥 - mov eax,[col_cell_n] - mov ebx,[col_cell_o] - - mov [esi],eax - mov [edi],ebx - ;need save ecx edx - stdcall middle_colors, esi,edi - - ret -endp - -;ᯮ⥫쭠 㭪 室 । 梥 ᨢ -;input: -; eax - 梥 砫 -; ebx - 梥 -;: ecx, edx -align 4 -proc middle_colors uses edi esi, i0:dword, i1:dword - mov esi,[i0] - mov edi,[i1] - ;। 맮 㭪樨 - ;dword[esi]=eax - ;dword[edi]=ebx - sub edi,esi - shr edi,1 - btr edi,1 ;㣫塞 4-, . . 㦭 (㣫 ஥ - 㡨ࠥ । 2-) - add edi,esi - cmp edi,esi - je @f - push eax ebx - - mov ecx,eax - mov edx,ebx - - ;室 । 梥 eax ebx - and ebx,111111101111111011111110b ;㡨ࠥ ᫥ 梥 r, g, b - and eax,111111101111111011111110b - add eax,ebx ;㬨㥬 梥 r, g, b - shr eax,1 ; 2 - mov dword[edi],eax - - ;४ᨢ 맮 ஡ 孥 - mov ebx,eax - mov eax,ecx - stdcall middle_colors, [i0],edi - - ;४ᨢ 맮 ஡ - mov eax,ebx - mov ebx,edx - stdcall middle_colors, edi,[i1] - - pop ebx eax - @@: - ret -endp - -align 4 -proc pole_clear uses eax ecx edi - xor eax,eax - mov dword[tim],eax - mov dword[osob],eax - mov byte[tim_ch],al - mov dword[Cor_x],eax - mov dword[Cor_y],eax - mov dword[b_sort],eax - mov byte[er_oom],al - cld - mov ecx,(MAX_CELL*sizeof.Cell)/4 - mov edi,[cell] - rep stosd ;memset(cell,0,sizeof(Cell)*MAX_CELL); - mov edi,[memCell] - mov ecx,MAX_CELL - @@: - stosd ;for(i=0;i memCell[firstC] - get_cell_offset ebx,[eax] - - mov ecx,[x] - mov dword[ebx],ecx ;+0 = .x - mov edx,[y] - mov dword[ebx+Cell.y],edx - mov eax,[tim] - mov dword[ebx+Cell.tc],eax - mov byte[ebx+Cell.liv],0 - - cmp dword[li],0 - jne @f - mov byte[ebx+Cell.so],1 - jmp .fun_e - @@: - mov byte[ebx+Cell.so],0 - - .creat_border_cells: - inc dword[osob] - or byte[ebx+Cell.liv],1 - mov ecx,[x] - dec ecx - mov edx,[y] - dec edx - stdcall pole_cell_creat,ecx,edx,0 - inc edx - stdcall pole_cell_creat,ecx,edx,0 - inc edx - stdcall pole_cell_creat,ecx,edx,0 - inc ecx - stdcall pole_cell_creat,ecx,edx,0 - sub edx,2 - stdcall pole_cell_creat,ecx,edx,0 - inc ecx - stdcall pole_cell_creat,ecx,edx,0 - inc edx - stdcall pole_cell_creat,ecx,edx,0 - inc edx - stdcall pole_cell_creat,ecx,edx,0 - .fun_e: - popad ;edi edx ecx ebx eax - ret -endp - -;output: -; eax - index -align 4 -proc pole_cell_find, x:dword, y:dword - mov eax,[memCell] - cmp dword[eax],0 - jne @f - xor eax,eax ;if(!fristC) return 0; - jmp .fun_e - @@: - - xor eax,eax ;fnd=0; - cmp dword[b_sort],0 - je @f - stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort); - cmp eax,0 - je @f - shl eax,2 - add eax,[memCell] - mov eax,[eax] ;if(i) fnd=memCell[i]; - jmp .fun_e - @@: - - cmp eax,0 - jne @f ;if(!fnd){ // 祩 ॢ - push ebx ecx edx edi esi - ;ebx -> i - ;ecx -> firstC - ;edx -> &memCell[i] - ;edi -> cell[memCell[i]] - mov ecx,[memCell] - mov ebx,[b_sort] - lea edx,[ebx*4] - add edx,ecx - mov ecx,[ecx] - .cycle_b: ;for(i=b_sort+1;i<=fristC;i++) - inc ebx - cmp ebx,ecx - jg .cycle_e - add edx,4 - get_cell_offset edi,[edx] - mov esi,[x] - cmp dword[edi],esi ;+0 = .x - jne .if_e - mov esi,[y] - cmp dword[edi+Cell.y],esi - jne .if_e - ;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){ - mov eax,[edx] ;fnd=memCell[i]; - jmp .cycle_e ;break; - .if_e: - jmp .cycle_b - .cycle_e: - pop esi edi edx ecx ebx - @@: - .fun_e: - ret -endp - -;output: -; eax - index -align 4 -proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword - push ebx ecx edx edi - xor eax,eax - mov ebx,1 ;ebx - ᨬ 冷 ॢ - @@: - cmp dword[k],ebx - jle @f ;while(k>por) - shl ebx,1 ;por<<=1; - jmp @b - @@: - cmp dword[k],ebx - jge @f ;if(k>=1; - @@: - mov ecx,ebx ;i=por; - - ;ecx -> i - ;edi -> mas[i] - .cycle_b: ;do{ - shr ebx,1 ;por>>=1; - - lea edi,[ecx*4] - add edi,[mas] - ;if(compare_cells_mb(mas[i],fx,fy)){ - stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy] - cmp dl,0 - je .if_u0_e - @@: ;while(i+por>k) - mov edx,ecx - add edx,ebx - cmp edx,[k] ;i+por>k - jle @f - shr ebx,1 ;por>>=1; - jmp @b - @@: - add ecx,ebx ;i+=por; - jmp .if_e - .if_u0_e: - ;else if(compare_cells_bm(mas[i],fx,fy))i-=por; - stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy] - cmp dl,0 - je .if_u1_e - sub ecx,ebx - jmp .if_e - .if_u1_e: - ;else { m=i; por=0; } - mov eax,ecx - xor ebx,ebx - .if_e: - cmp ebx,0 - jne .cycle_b ;}while(por); - - pop edi edx ecx ebx - ret -endp - -;description: -; ᯮ⥫쭠 㭪 ஢ 祥 न⠬ -;output: -; dl -align 4 -proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword - push eax ebx ecx - get_cell_offset eax,[i0] - ;eax -> cell[i0] - mov ebx,[fx] - cmp dword[eax],ebx - jle @f - mov dl,1 - jmp .fun_e - @@: - mov ecx,[fy] - cmp dword[eax+Cell.y],ecx - jle @f - cmp dword[eax],ebx - jne @f - mov dl,1 - jmp .fun_e - @@: - xor dl,dl - .fun_e: - pop ecx ebx eax - ret -endp - -;description: -; ᯮ⥫쭠 㭪 ஢ 祥 न⠬ -;output: -; dl -align 4 -proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword - push eax ebx ecx - get_cell_offset eax,[i0] - ;eax -> cell[i0] - mov ebx,[fx] - cmp dword[eax],ebx - jge @f - mov dl,1 - jmp .fun_e - @@: - mov ecx,[fy] - cmp dword[eax+Cell.y],ecx - jge @f - cmp dword[eax],ebx - jne @f - mov dl,1 - jmp .fun_e - @@: - xor dl,dl - .fun_e: - pop ecx ebx eax - ret -endp - -;output: -; dl -align 4 -proc pole_compare_cells_bm, i0:dword, i1:dword - push eax ebx ecx - get_cell_offset eax,[i0] ;eax -> cell[i0] - get_cell_offset ebx,[i1] ;ebx -> cell[i1] - mov ecx,[ebx] ;+0 = .x - cmp dword[eax],ecx - jle @f ;x0>x1 - mov dl,1 - jmp .fun_e - @@: - jne @f ;x0==x1 - mov ecx,[ebx+Cell.y] - cmp dword[eax+Cell.y],ecx - jle @f ;y0>y1 - mov dl,1 - jmp .fun_e - @@: - xor dl,dl - .fun_e: - pop ecx ebx eax - ret -endp - -align 4 -pole_paint: - pushad - ;eax -> firstC - ;ebx -> i - ;ecx -> cell[memCell[i]] - ;edx -> color - ;edi -> coord_x - ;esi -> coord_y - mov eax,[memCell] - cmp dword[eax],0 - je .no_draw - - mov eax,[eax] - mov ebx,1 - -;--- - @@: ;while(i firstC - ;ebx -> i - ;ecx -> &memCell[i] - ;edx -> cell[memCell[i]] - - mov eax,[memCell] - mov ecx,eax - mov eax,[eax] - cmp eax,1 - jl .fun_e - inc dword[tim] - mov ebx,1 - @@: ;for(i=1;i<=firstC;i++) - add ecx,4 - get_cell_offset edx,[ecx] - bt word[edx+Cell.liv],0 - jae .if_0_e - ; ࠭ 祩 (ᥤ 2 3) - cmp byte[edx+Cell.so],2 - je .if_2_e - cmp byte[edx+Cell.so],3 - je .if_2_e - jmp .change - .if_0_e: - ; ᮧ 祩 (ᥤ 3) - cmp byte[edx+Cell.so],3 - jne .if_1_e - .change: - or byte[edx+Cell.liv],2 - jmp .if_2_e - .if_1_e: - ; 㤠 ⮩ 祩 ᢮ - cmp byte[edx+Cell.so],0 - jne .if_2_e - mov edi,[edx+Cell.tc] - add edi,5 ; 5 - ६ ࠭ ⮩ 祩, 㤠 - cmp edi,[tim] - jge .if_2_e - lea edi,[eax*4] - add edi,[memCell] ;edi -> &memCell[fristC] - mov esi,[edi] ;swp=memCell[fristC]; - mov edx,[ecx] ;edx - 㦥 ᯮ㥬, ⮬ - mov [edi],edx ;memCell[fristC]=memCell[i]; - mov [ecx],esi ;memCell[i]=swp; - dec eax - dec ebx - sub ecx,4 - .if_2_e: - - inc ebx - cmp ebx,eax - jle @b - mov ebx,[memCell] - mov [ebx],eax ;firstC <- eax - - mov [b_sort],eax - stdcall pole_fl_sort, [memCell],eax - - mov ecx,[memCell] - mov ebx,1 - @@: ;for(i=1;i<=firstC;i++) - add ecx,4 - get_cell_offset edx,[ecx] - bt word[edx+Cell.liv],1 - jae .no_change - xor byte[edx+Cell.liv],3 - mov edi,[tim] - mov [edx+Cell.tc],edi - bt word[edx+Cell.liv],0 - jc .new_cell - push eax - mov edi,[edx] - dec edi - mov esi,[edx+Cell.y] - dec esi - dec dword[osob] - ; 祭 edx - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc esi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc esi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc edi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - sub esi,2 - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc edi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc esi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - inc esi - stdcall pole_cell_find,edi,esi - get_cell_offset edx,eax - dec byte[edx+Cell.so] - pop eax - jmp .no_change - .new_cell: ;  祩 - inc dword[osob] - mov edi,[edx] - dec edi - mov esi,[edx+Cell.y] - dec esi - stdcall pole_cell_creat,edi,esi,0 - inc esi - stdcall pole_cell_creat,edi,esi,0 - inc esi - stdcall pole_cell_creat,edi,esi,0 - inc edi - stdcall pole_cell_creat,edi,esi,0 - sub esi,2 - stdcall pole_cell_creat,edi,esi,0 - inc edi - stdcall pole_cell_creat,edi,esi,0 - inc esi - stdcall pole_cell_creat,edi,esi,0 - inc esi - stdcall pole_cell_creat,edi,esi,0 - .no_change: - inc ebx - cmp ebx,eax - jle @b - .fun_e: - popad - ret - -;஢ a[1..n] ⮤ -align 4 -proc pole_fl_sort, a:dword, n:dword - pushad - mov ecx,[a] - ;ନ஢ 室 筮 㯮冷祭 ॢ - mov eax,[n] - shr eax,1 - @@: ;for(i=n>>1; i>=2; i--) - stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n) - dec eax - cmp eax,2 - jge @b - ;믮 楤 ᯫ ॢ - mov eax,[n] - @@: ;for(i=n; i>=2; i--){ - stdcall pole_fl_surface, ecx,1,eax ;(a,1,i) - ; ᨬ ᯨ᪠ - lea edi,[eax*4] - add edi,ecx ;edi -> &a[i] - mov esi,[edi] ;w=a[i]; - mov edx,[ecx+4] - mov [edi],edx ;a[i]=a[1]; - mov [ecx+4],esi ;a[1]=w; - - dec eax - cmp eax,2 - jge @b - popad - ret -endp - -;楤 ᯫ ॢ a[1..k] -align 4 -proc pole_fl_surface, a:dword, i:dword, k:dword -locals - copy dd ? -endl - pushad - ;edx -> ... - ;edi -> m - ;esi -> j - mov eax,[a] - mov ebx,[i] - mov ecx,[k] - - lea edx,[ebx*4] - add edx,eax - mov edx,[edx] - mov [copy],edx ;copy=a[i]; - mov edi,ebx - shl edi,1 ;m=i<<1; - .cycle_b: ;while (m<=k) { - cmp edi,ecx - jg .cycle_e - jne @f ;if (m==k) j=m; - mov esi,edi - jmp .else_e - @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m; - lea edx,[edi*4] - add edx,eax - stdcall pole_compare_cells_bm, dword[edx],dword[edx+4] - cmp dl,0 - je @f - mov esi,edi - jmp .else_e - @@: ;else j=m+1; - mov esi,edi - inc esi - .else_e: - - ;if (pole_compare_cells_bm(a[j],copy)) { - lea edx,[esi*4] - add edx,eax - stdcall pole_compare_cells_bm, dword[edx],[copy] - cmp dl,0 - je .cycle_e ;} else break; //室 横 - - lea edx,[esi*4] - add edx,eax - push dword[edx] ;push a[j]; - lea edx,[ebx*4] - add edx,eax - pop dword[edx] ;a[i]=a[j]; - mov ebx,esi ;i=j; - mov edi,ebx - shl edi,1 ;m=i<<1; - - jmp .cycle_b - .cycle_e: - - ;祭 ॣ஢ 㦥 . . 㭪樨 - shl ebx,2 - add eax,ebx - mov edx,[copy] - mov [eax],edx ;a[i]=copy; - - popad - ret -endp -;-------------------------------------- - - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 - mov ebp,lib2 - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS ;exit not correct - @@: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0x27 - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - stdcall [buf2d_create], buf_0 ;ᮧ - - stdcall mem.Alloc,MAX_CELL*sizeof.Cell - mov [cell],eax - stdcall mem.Alloc,MAX_CELL*4 - mov [memCell],eax - stdcall mem.Alloc,(COL_MEM+1)*4 - mov [CellColors],eax - include_image_file 'life3tb.png', image_data_toolbar - - ;ன 梥⮢ 祥 - stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff - call pole_clear - call pole_paint ;ᮢ ( ࠭) - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - -align 4 -red_win: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - cmp eax,0 - je timer_funct - - cmp al,1 - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo.window_stack_position] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - push eax ebx ecx - mcall SF_MOUSE_GET,SSF_BUTTON_EXT - bt eax,8 - jnc @f - ;mouse l. but. press - ;call mouse_left_d - ;jmp .end_l - @@: - bt eax,16 - jnc .end_l - ;mouse l. but. up - ;call mouse_left_u - ;jmp .end_l - .end_l: - - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - shl eax,1 - sub eax,[buf_0.w] - sar eax,1 - ;mov [mouse_prop_x],eax - shl ebx,1 - sub ebx,[buf_0.h] - sar ebx,1 - ;mov [mouse_prop_y],ebx - - mcall SF_MOUSE_GET,SSF_SCROLL_DATA - test ax,ax - jz .end0 - - test ax,0x8000 - jnz .decr - ;㢥祭 ⠡ - call but_zoom_p - jmp .end0 - .decr: - ;㬥襭 ⠡ - call but_zoom_m - .end0: - - pop ecx ebx eax - ret - -;output: -; eax - buffer coord X (᫨ ஬ -1) -; ebx - buffer coord Y (᫨ ஬ -1) -align 4 -proc buf_get_mouse_coord - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - cmp ax,word[buf_0.t] - jl .no_buf ; y - mov ebx,eax - shr ebx,16 - cmp bx,word[buf_0.l] - jl .no_buf ; x - - and eax,0xffff ;⠢塞 न y - sub ax,word[buf_0.t] - cmp eax,[buf_0.h] - jg .no_buf - sub bx,word[buf_0.l] - cmp ebx,[buf_0.w] - jg .no_buf - xchg eax,ebx - jmp .end_f - .no_buf: - xor eax,eax - not eax - xor ebx,ebx - not ebx - .end_f: - ret -endp - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - cmp byte[tim_ch],0 - je @f - ;call but_next_gen - cld - mov ecx,[poc_stop] - cmp ecx,1 - jg .clear - mov ecx,1 ;ࠢ ecx 砩 ᥫ 1 - jmp .cycle - .clear: ;⨬ ᫨ ᪮쪮 1 ⠪ ⠩ - stdcall [buf2d_clear], buf_0, [buf_0.color] - .cycle: - call pole_next_gen - loop .cycle - call pole_paint - stdcall [buf2d_draw], buf_0 - call draw_pok - @@: - popad - jmp still - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - mcall SF_CREATE_WINDOW,(50 shl 16)+485,(50 shl 16)+415,0x73000000,0,hed - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,[procinfo.box.height] - cmp eax,120 - jge @f - mov eax,120 ;min size - @@: - sub eax,63 - mov ebx,[procinfo.box.width] - cmp ebx,270 - jge @f - mov ebx,270 - @@: - sub ebx,9 - cmp eax,[buf_0.h] ;ᬮਬ ࠧ - jne @f - cmp ebx,[buf_0.w] - jne @f - jmp .end0 - @@: - stdcall [buf2d_resize], buf_0, ebx,eax,1 - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - .end0: - - mov edx,[sc.work] - mov ebx, 0 shl 16 - add ebx, [buf_0.w] - mcall SF_DRAW_RECT,,<0,35> - - mcall SF_DEFINE_BUTTON,(6 shl 16)+TBTNSIZE,(6 shl 16)+TBTNSIZE,4+0x40000000, [sc.work_button] - - mov ebx,(36 shl 16)+TBTNSIZE - mov edx,6+0x40000000 - int 0x40 - - mov ebx,(61 shl 16)+TBTNSIZE - mov edx,7+0x40000000 - int 0x40 - - mov ebx,(86 shl 16)+TBTNSIZE - mov edx,8+0x40000000 - int 0x40 - - mov ebx,(116 shl 16)+TBTNSIZE - mov edx,9+0x40000000 - int 0x40 - - mov ebx,(141 shl 16)+TBTNSIZE - mov edx,10+0x40000000 - int 0x40 - - mov ebx,(171 shl 16)+TBTNSIZE - mov edx,11+0x40000000 - int 0x40 - - mov ebx,(196 shl 16)+TBTNSIZE - mov edx,12+0x40000000 - int 0x40 - - mov ebx,(221 shl 16)+TBTNSIZE - mov edx,13+0x40000000 - int 0x40 - - mov ebx,(246 shl 16)+TBTNSIZE - mov edx,14+0x40000000 - int 0x40 - - mcall SF_PUT_IMAGE,[image_data_toolbar],(ICONSIZE shl 16)+ICONSIZE,(5 shl 16)+5 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(35 shl 16)+5 ;run once - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(60 shl 16)+5 ;run auto - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(85 shl 16)+5 ;stop - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(115 shl 16)+5 ;- - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(140 shl 16)+5 ;+ - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(170 shl 16)+5 ;move up - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(195 shl 16)+5 ;move doun - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(220 shl 16)+5 ;move left - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(245 shl 16)+5 ;move right - int 0x40 - - ; add ebx,IMAGE_TOOLBAR_ICON_SIZE - ; mov edx,(270 shl 16)+5 - ; int 0x40 - ; add ebx,IMAGE_TOOLBAR_ICON_SIZE - ; mov edx,(295 shl 16)+5 - ; int 0x40 - - mov eax,SF_DRAW_TEXT - mov ebx,295*65536+5 - mov ecx,[sc.work_text] - or ecx,0x80000000 ;or (1 shl 30) - mov edx,txt_zoom - ;mov edi,[sc.work] - int 0x40 - add bx,9 - mov edx,txt_gen - int 0x40 - add bx,9 - mov edx,txt_osob - int 0x40 - - call draw_pok - - stdcall [buf2d_draw], buf_0 - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -draw_pok: - mov eax,SF_DRAW_NUMBER - movzx ecx,byte[zoom] - mov ebx,(2 shl 16) - mov edx,(295+8*9)*65536+5 - mov esi,[sc.work_text] - or esi,(1 shl 30) - mov edi,[sc.work] - int 0x40 ;⠡ - mov ebx,(5 shl 16) - mov ecx,[tim] - add edx,9 - int 0x40 ;६ - mov ebx,(5 shl 16) - mov ecx,[osob] - add edx,9 - int 0x40 ; - ret - -align 4 -key: - mcall SF_GET_KEY - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_next_gen - jmp still - @@: - cmp ah,7 - jne @f - call but_run - jmp still - @@: - cmp ah,8 - jne @f - call but_stop - jmp still - @@: - cmp ah,9 - jne @f - call but_zoom_p - jmp still - @@: - cmp ah,10 - jne @f - call but_zoom_m - jmp still - @@: - cmp ah,11 - jne @f - call but_pole_up - jmp still - @@: - cmp ah,12 - jne @f - call but_pole_dn - jmp still - @@: - cmp ah,13 - jne @f - call but_pole_left - jmp still - @@: - cmp ah,14 - jne @f - call but_pole_right - jmp still - @@: - cmp ah,1 - jne still -.exit: - stdcall [buf2d_delete],buf_0 - stdcall mem.Free,[open_file_lif] - stdcall mem.Free,[cell] - stdcall mem.Free,[memCell] - stdcall mem.Free,[CellColors] - stdcall mem.Free,[image_data_toolbar] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: - ret - -align 4 -open_file_lif dd 0 ;㪠⥫ 䠩 -open_file_size dd 0 ;ࠧ ⮣ 䠩 - -align 4 -but_open_file: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - ; 㤠筮 ⨨ - - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - inc ecx ;for text files - stdcall mem.ReAlloc,[open_file_lif],ecx - mov [open_file_lif],eax - dec ecx ;for text files - mov byte[eax+ecx],0 ;for text files - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov [run_file_70.Count], ecx - m2m dword[run_file_70.Buffer], dword[open_file_lif] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 ;㦠 䠩 ࠦ - test eax,eax - jnz .end_open_file - cmp ebx,0xffffffff - je .end_open_file - - mov [open_file_size],ebx - mcall SF_SET_CAPTION,1,openfile_path - - call pole_clear - mov eax,[buf_0.w] - shr eax,1 - xor ecx,ecx - mov cl,byte[zoom] - cmp cx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - add [Cor_x],eax - mov eax,[buf_0.h] - shr eax,1 - cmp cx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - add [Cor_y],eax - - ;eax - first x position - ;ebx - x position - ;ecx - y position - ;edx - 䠩 - mov edi,[open_file_lif] - xor ebx,ebx - xor ecx,ecx - mov eax,ebx - mov edx,edi - add edx,[open_file_size] - @@: - cmp byte[edi],'*' - jne .no_cell - stdcall pole_cell_creat, ebx,ecx,1 - inc ebx - .no_cell: - cmp byte[edi],'.' - jne .cell_move - inc ebx - .cell_move: - cmp byte[edi],13 - jne .cell_nl - mov ebx,eax - inc ecx - .cell_nl: - cmp word[edi],'#P' ;ᬥ 樨 - jne .pos - inc edi ;ய '#' - .space: - inc edi ;ய 'P' ' ' - cmp byte[edi],' ' - je .space - stdcall conv_str_to_int,edi - mov ebx,eax - cmp byte[edi],'-' - jne .digit - inc edi - .digit: - cmp byte[edi],'0' - jl .digit_no - cmp byte[edi],'9' - jg .digit_no - inc edi - jmp .digit - .digit_no: - ;.space_1: - inc edi ;ய 'P' ' ' - cmp byte[edi],' ' - je .digit_no ;.space_1 - stdcall conv_str_to_int,edi - mov ecx,eax - mov eax,ebx ;⠭ 㯠 eax - .pos: - inc edi - cmp edi,edx - jl @b - ;--- - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - call pole_paint ;㥬 ( 砩 ᫨ ⪠ ⥪⮢ ) - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - .end_open_file: - popad - ret - -align 4 -but_save_file: - ret - -align 4 -but_next_gen: - call pole_next_gen - call pole_paint - stdcall [buf2d_draw], buf_0 - pushad - call draw_pok - popad - ret - -align 4 -but_run: - mov byte[tim_ch],1 - ret - -align 4 -but_stop: - mov byte[tim_ch],0 - ;cld - ;mov ecx,100 - ;@@: - ; call pole_next_gen - ;loop @b - ;stdcall [buf2d_clear], buf_0, [buf_0.color] - ;call pole_paint - ;stdcall [buf2d_draw], buf_0 - ret - -align 4 -but_zoom_p: - cmp byte[zoom],16 - jge @f - pushad - ;᫥ ᤢ , ᯥ 業஢ 㢥祭 ⠡ - xor ecx,ecx - mov cl,byte[zoom] - xor edx,edx - mov eax,[buf_0.w] - shr eax,1 ; eax ਭ - mov ebx,eax ; १ࢭ eax - div ecx ; eax ⥪騩 ⠡ - xchg eax,ebx - xor edx,edx - inc ecx - div ecx ; eax ⠡ - sub ebx,eax ; ᤢ ᯥ 業஢ - sub dword[Cor_x],ebx ;ᤢ ७ x - xor ecx,ecx - mov cl,byte[zoom] - xor edx,edx - mov eax,[buf_0.h] - shr eax,1 - mov ebx,eax - div ecx - xchg eax,ebx - xor edx,edx - inc ecx - div ecx - sub ebx,eax - sub dword[Cor_y],ebx ;ᤢ ७ y - - inc byte[zoom] - call draw_pok - popad - - cmp dword[poc_stop],1 - jle .buf_clear - cmp byte[tim_ch],0 - jne @f - .buf_clear: - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - @@: - ret - -align 4 -but_zoom_m: - cmp byte[zoom],1 - jle @f - pushad - ;᫥ ᤢ , ᯥ 業஢ 㬥襭 ⠡ - xor ecx,ecx - mov cl,byte[zoom] - xor edx,edx - mov eax,[buf_0.w] - shr eax,1 ; eax ਭ - mov ebx,eax ; १ࢭ eax - div ecx ; eax ⥪騩 ⠡ - xchg eax,ebx - xor edx,edx - dec ecx - div ecx ; eax ⠡ - sub ebx,eax ; ᤢ ᯥ 業஢ - sub dword[Cor_x],ebx ;ᤢ ७ x - xor ecx,ecx - mov cl,byte[zoom] - xor edx,edx - mov eax,[buf_0.h] - shr eax,1 - mov ebx,eax - div ecx - xchg eax,ebx - xor edx,edx - dec ecx - div ecx - sub ebx,eax - sub dword[Cor_y],ebx ;ᤢ ७ y - - dec byte[zoom] - call draw_pok - popad - - cmp dword[poc_stop],1 - jle .buf_clear - cmp byte[tim_ch],0 - jne @f - .buf_clear: - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - @@: - ret - -align 4 -but_pole_up: - push eax ecx edx - mov eax,[buf_0.h] - shr eax,2 - xor ecx,ecx - mov cl,byte[zoom] - cmp cx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - add [Cor_y],eax - pop edx ecx eax - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - ret - -align 4 -but_pole_dn: - push eax ecx edx - mov eax,[buf_0.h] - shr eax,2 - xor ecx,ecx - mov cl,byte[zoom] - cmp cx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - sub [Cor_y],eax - pop edx ecx eax - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - ret - -align 4 -but_pole_left: - push eax ecx edx - mov eax,[buf_0.w] - shr eax,2 - movzx ecx,byte[zoom] - cmp ecx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - add [Cor_x],eax - pop edx ecx eax - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - ret - -align 4 -but_pole_right: - push eax ecx edx - mov eax,[buf_0.w] - shr eax,2 - xor ecx,ecx - mov cl,byte[zoom] - cmp cx,2 - jl @f ; 稭 zoom - xor edx,edx - div ecx - @@: - sub [Cor_x],eax - pop edx ecx eax - stdcall [buf2d_clear], buf_0, [buf_0.color] - call pole_paint - stdcall [buf2d_draw], buf_0 - ret - -;input: -; buf - 㪠⥫ ப, ᫮ 10 16 筮 -;output: -; eax - ᫮ -align 4 -proc conv_str_to_int uses ebx ecx esi, buf:dword - xor eax,eax - xor ebx,ebx - mov esi,[buf] - ;। ⥫ ᥫ - xor ecx,ecx - inc ecx - cmp byte[esi],'-' - jne @f - dec ecx - inc esi - @@: - - cmp word[esi],'0x' - je .load_digit_16 - - .load_digit_10: ;뢠 10- - mov bl,byte[esi] - cmp bl,'0' - jl @f - cmp bl,'9' - jg @f - sub bl,'0' - imul eax,10 - add eax,ebx - inc esi - jmp .load_digit_10 - jmp @f - - .load_digit_16: ;뢠 16- - add esi,2 - .cycle_16: - mov bl,byte[esi] - cmp bl,'0' - jl @f - cmp bl,'f' - jg @f - cmp bl,'9' - jle .us1 - cmp bl,'A' - jl @f ;ᥨ ᨬ >'9' <'A' - .us1: ;⠢ ᫮ - cmp bl,'F' - jle .us2 - cmp bl,'a' - jl @f ;ᥨ ᨬ >'F' <'a' - sub bl,32 ;ॢ ᨬ 孨 ॣ, 饭 ᫥饩 ࠡ⪨ - .us2: ;⠢ ᫮ - sub bl,'0' - cmp bl,9 - jle .cor1 - sub bl,7 ;convert 'A' to '10' - .cor1: - shl eax,4 - add eax,ebx - inc esi - jmp .cycle_16 - @@: - cmp ecx,0 ;᫨ ᫮ ⥫쭮 - jne @f - sub ecx,eax - mov eax,ecx - @@: - ret -endp - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter ;.1 -.1: -db 'LIF',0 -db 'RLE',0 -.end: -db 0 - - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'buf2d.obj',0 - -l_libs_start: - lib0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_destroy dd aimg_destroy - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_destroy db 'img_destroy',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - -align 4 -import_buf2d: - init dd sz_init - buf2d_create dd sz_buf2d_create - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_resize dd sz_buf2d_resize - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_set_pixel dd sz_buf2d_set_pixel - dd 0,0 - sz_init db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_resize db 'buf2d_resize',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - -align 4 -buf_0: dd 0 -.l: dw 0 ;+4 left -.t: dw 35 ;+6 top -.w: dd 476 ;+8 w -.h: dd 352 ;+12 h -.color: dd 0xffffd0 ;+16 color - db 24 ;+20 bit in pixel - -align 16 -i_end: - mouse_dd rd 1 - last_time rd 1 - sc system_colors - procinfo process_information - sys_path rb 1024 - file_name rb 2048 ;4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 - rb 1024 -stacktop: -mem: +use32 + org 0 + db 'MENUET01' + dd 1,start,i_end,mem,stacktop,0,sys_path + +include '../../../macros.inc' +include '../../../proc32.inc' +include '../../../KOSfuncs.inc' +include '../../../load_img.inc' +include '../../../load_lib.mac' + +;include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load +hed db 'Life 18.11.20',0 ; + +run_file_70 FileInfoBlock +image_data dd 0 ;㪠⥫ ६ . 㦥 ८ࠧ ࠦ + +ICONSIZE = 21 +TBTNSIZE = ICONSIZE-2 + +IMAGE_TOOLBAR_ICON_SIZE equ ICONSIZE*ICONSIZE*3 +image_data_toolbar dd 0 + + +;-------------------------------------- +struct Cell + x dd ? ;+0 + y dd ? ;+4 + tc dd ? ;+8 ஬ த ᮡ + liv db ? ;+12 祩 + so db ? ;+13 ᫮ ᥤ +ends + +MAX_CELL equ 90000 ; ⭮ 4 +COL_MEM equ 64 ;᫮ 梥⮢ ⫨ + +cell dd 0 ;㪠⥫ ࠬ 祥 +memCell dd 0 +CellColors dd 0 + +macro get_cell_offset reg,ind +{ + mov reg,ind + imul reg,sizeof.Cell + add reg,dword[cell] +} + +er_oom db 0 ; 砩 ௠ +tim_ch db 0 ;⮬᪨ 뢠 +poc_stop dd 1 ; ᫮ +Cor_x dd 0 +Cor_y dd 0 +tim dd 0 ;६ () +b_sort dd 0 ;࠭ ஢ 祥 +osob dd 0 ;᫮ ᮡ +zoom db 3 ;⠡ + +if lang eq ru_RU +txt_zoom db ' ⠡:',0 +txt_gen db ' :',0 +txt_osob db ' ᮡ:',0 +else ; Default to en_US +txt_zoom db ' Zoom:',0 +txt_gen db 'Generation:',0 +txt_osob db 'Population:',0 +end if + +;ன ᨢ 梥⠬ +; col_pole - 梥 +; col_cell_n - 梥 祩 +; col_cell_o - 梥 ன 祩 +align 4 +proc pole_init_colors uses eax ebx ecx edx esi edi, col_pole:dword, col_cell_n:dword, col_cell_o:dword + mov esi,[CellColors] + mov ebx,[col_pole] + mov [esi],ebx + + lea edi,[esi+4*COL_MEM] + add esi,4 + ; esi - 㪠⥫ 1- ࠤ 梥 + ; edi - 㪠⥫ ᫥ ࠤ 梥 + mov eax,[col_cell_n] + mov ebx,[col_cell_o] + + mov [esi],eax + mov [edi],ebx + ;need save ecx edx + stdcall middle_colors, esi,edi + + ret +endp + +;ᯮ⥫쭠 㭪 室 । 梥 ᨢ +;input: +; eax - 梥 砫 +; ebx - 梥 +;: ecx, edx +align 4 +proc middle_colors uses edi esi, i0:dword, i1:dword + mov esi,[i0] + mov edi,[i1] + ;। 맮 㭪樨 + ;dword[esi]=eax + ;dword[edi]=ebx + sub edi,esi + shr edi,1 + btr edi,1 ;㣫塞 4-, . . 㦭 (㣫 ஥ - 㡨ࠥ । 2-) + add edi,esi + cmp edi,esi + je @f + push eax ebx + + mov ecx,eax + mov edx,ebx + + ;室 । 梥 eax ebx + and ebx,111111101111111011111110b ;㡨ࠥ ᫥ 梥 r, g, b + and eax,111111101111111011111110b + add eax,ebx ;㬨㥬 梥 r, g, b + shr eax,1 ; 2 + mov dword[edi],eax + + ;४ᨢ 맮 ஡ 孥 + mov ebx,eax + mov eax,ecx + stdcall middle_colors, [i0],edi + + ;४ᨢ 맮 ஡ + mov eax,ebx + mov ebx,edx + stdcall middle_colors, edi,[i1] + + pop ebx eax + @@: + ret +endp + +align 4 +proc pole_clear uses eax ecx edi + xor eax,eax + mov dword[tim],eax + mov dword[osob],eax + mov byte[tim_ch],al + mov dword[Cor_x],eax + mov dword[Cor_y],eax + mov dword[b_sort],eax + mov byte[er_oom],al + cld + mov ecx,(MAX_CELL*sizeof.Cell)/4 + mov edi,[cell] + rep stosd ;memset(cell,0,sizeof(Cell)*MAX_CELL); + mov edi,[memCell] + mov ecx,MAX_CELL + @@: + stosd ;for(i=0;i memCell[firstC] + get_cell_offset ebx,[eax] + + mov ecx,[x] + mov dword[ebx],ecx ;+0 = .x + mov edx,[y] + mov dword[ebx+Cell.y],edx + mov eax,[tim] + mov dword[ebx+Cell.tc],eax + mov byte[ebx+Cell.liv],0 + + cmp dword[li],0 + jne @f + mov byte[ebx+Cell.so],1 + jmp .fun_e + @@: + mov byte[ebx+Cell.so],0 + + .creat_border_cells: + inc dword[osob] + or byte[ebx+Cell.liv],1 + mov ecx,[x] + dec ecx + mov edx,[y] + dec edx + stdcall pole_cell_creat,ecx,edx,0 + inc edx + stdcall pole_cell_creat,ecx,edx,0 + inc edx + stdcall pole_cell_creat,ecx,edx,0 + inc ecx + stdcall pole_cell_creat,ecx,edx,0 + sub edx,2 + stdcall pole_cell_creat,ecx,edx,0 + inc ecx + stdcall pole_cell_creat,ecx,edx,0 + inc edx + stdcall pole_cell_creat,ecx,edx,0 + inc edx + stdcall pole_cell_creat,ecx,edx,0 + .fun_e: + popad ;edi edx ecx ebx eax + ret +endp + +;output: +; eax - index +align 4 +proc pole_cell_find, x:dword, y:dword + mov eax,[memCell] + cmp dword[eax],0 + jne @f + xor eax,eax ;if(!fristC) return 0; + jmp .fun_e + @@: + + xor eax,eax ;fnd=0; + cmp dword[b_sort],0 + je @f + stdcall pole_bin_find, [memCell], [x],[y], [b_sort] ;i=BinFind(memCell, x,y, b_sort); + cmp eax,0 + je @f + shl eax,2 + add eax,[memCell] + mov eax,[eax] ;if(i) fnd=memCell[i]; + jmp .fun_e + @@: + + cmp eax,0 + jne @f ;if(!fnd){ // 祩 ॢ + push ebx ecx edx edi esi + ;ebx -> i + ;ecx -> firstC + ;edx -> &memCell[i] + ;edi -> cell[memCell[i]] + mov ecx,[memCell] + mov ebx,[b_sort] + lea edx,[ebx*4] + add edx,ecx + mov ecx,[ecx] + .cycle_b: ;for(i=b_sort+1;i<=fristC;i++) + inc ebx + cmp ebx,ecx + jg .cycle_e + add edx,4 + get_cell_offset edi,[edx] + mov esi,[x] + cmp dword[edi],esi ;+0 = .x + jne .if_e + mov esi,[y] + cmp dword[edi+Cell.y],esi + jne .if_e + ;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){ + mov eax,[edx] ;fnd=memCell[i]; + jmp .cycle_e ;break; + .if_e: + jmp .cycle_b + .cycle_e: + pop esi edi edx ecx ebx + @@: + .fun_e: + ret +endp + +;output: +; eax - index +align 4 +proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword + push ebx ecx edx edi + xor eax,eax + mov ebx,1 ;ebx - ᨬ 冷 ॢ + @@: + cmp dword[k],ebx + jle @f ;while(k>por) + shl ebx,1 ;por<<=1; + jmp @b + @@: + cmp dword[k],ebx + jge @f ;if(k>=1; + @@: + mov ecx,ebx ;i=por; + + ;ecx -> i + ;edi -> mas[i] + .cycle_b: ;do{ + shr ebx,1 ;por>>=1; + + lea edi,[ecx*4] + add edi,[mas] + ;if(compare_cells_mb(mas[i],fx,fy)){ + stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy] + cmp dl,0 + je .if_u0_e + @@: ;while(i+por>k) + mov edx,ecx + add edx,ebx + cmp edx,[k] ;i+por>k + jle @f + shr ebx,1 ;por>>=1; + jmp @b + @@: + add ecx,ebx ;i+=por; + jmp .if_e + .if_u0_e: + ;else if(compare_cells_bm(mas[i],fx,fy))i-=por; + stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy] + cmp dl,0 + je .if_u1_e + sub ecx,ebx + jmp .if_e + .if_u1_e: + ;else { m=i; por=0; } + mov eax,ecx + xor ebx,ebx + .if_e: + cmp ebx,0 + jne .cycle_b ;}while(por); + + pop edi edx ecx ebx + ret +endp + +;description: +; ᯮ⥫쭠 㭪 ஢ 祥 न⠬ +;output: +; dl +align 4 +proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword + push eax ebx ecx + get_cell_offset eax,[i0] + ;eax -> cell[i0] + mov ebx,[fx] + cmp dword[eax],ebx + jle @f + mov dl,1 + jmp .fun_e + @@: + mov ecx,[fy] + cmp dword[eax+Cell.y],ecx + jle @f + cmp dword[eax],ebx + jne @f + mov dl,1 + jmp .fun_e + @@: + xor dl,dl + .fun_e: + pop ecx ebx eax + ret +endp + +;description: +; ᯮ⥫쭠 㭪 ஢ 祥 न⠬ +;output: +; dl +align 4 +proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword + push eax ebx ecx + get_cell_offset eax,[i0] + ;eax -> cell[i0] + mov ebx,[fx] + cmp dword[eax],ebx + jge @f + mov dl,1 + jmp .fun_e + @@: + mov ecx,[fy] + cmp dword[eax+Cell.y],ecx + jge @f + cmp dword[eax],ebx + jne @f + mov dl,1 + jmp .fun_e + @@: + xor dl,dl + .fun_e: + pop ecx ebx eax + ret +endp + +;output: +; dl +align 4 +proc pole_compare_cells_bm, i0:dword, i1:dword + push eax ebx ecx + get_cell_offset eax,[i0] ;eax -> cell[i0] + get_cell_offset ebx,[i1] ;ebx -> cell[i1] + mov ecx,[ebx] ;+0 = .x + cmp dword[eax],ecx + jle @f ;x0>x1 + mov dl,1 + jmp .fun_e + @@: + jne @f ;x0==x1 + mov ecx,[ebx+Cell.y] + cmp dword[eax+Cell.y],ecx + jle @f ;y0>y1 + mov dl,1 + jmp .fun_e + @@: + xor dl,dl + .fun_e: + pop ecx ebx eax + ret +endp + +align 4 +pole_paint: + pushad + ;eax -> firstC + ;ebx -> i + ;ecx -> cell[memCell[i]] + ;edx -> color + ;edi -> coord_x + ;esi -> coord_y + mov eax,[memCell] + cmp dword[eax],0 + je .no_draw + + mov eax,[eax] + mov ebx,1 + +;--- + @@: ;while(i firstC + ;ebx -> i + ;ecx -> &memCell[i] + ;edx -> cell[memCell[i]] + + mov eax,[memCell] + mov ecx,eax + mov eax,[eax] + cmp eax,1 + jl .fun_e + inc dword[tim] + mov ebx,1 + @@: ;for(i=1;i<=firstC;i++) + add ecx,4 + get_cell_offset edx,[ecx] + bt word[edx+Cell.liv],0 + jae .if_0_e + ; ࠭ 祩 (ᥤ 2 3) + cmp byte[edx+Cell.so],2 + je .if_2_e + cmp byte[edx+Cell.so],3 + je .if_2_e + jmp .change + .if_0_e: + ; ᮧ 祩 (ᥤ 3) + cmp byte[edx+Cell.so],3 + jne .if_1_e + .change: + or byte[edx+Cell.liv],2 + jmp .if_2_e + .if_1_e: + ; 㤠 ⮩ 祩 ᢮ + cmp byte[edx+Cell.so],0 + jne .if_2_e + mov edi,[edx+Cell.tc] + add edi,5 ; 5 - ६ ࠭ ⮩ 祩, 㤠 + cmp edi,[tim] + jge .if_2_e + lea edi,[eax*4] + add edi,[memCell] ;edi -> &memCell[fristC] + mov esi,[edi] ;swp=memCell[fristC]; + mov edx,[ecx] ;edx - 㦥 ᯮ㥬, ⮬ + mov [edi],edx ;memCell[fristC]=memCell[i]; + mov [ecx],esi ;memCell[i]=swp; + dec eax + dec ebx + sub ecx,4 + .if_2_e: + + inc ebx + cmp ebx,eax + jle @b + mov ebx,[memCell] + mov [ebx],eax ;firstC <- eax + + mov [b_sort],eax + stdcall pole_fl_sort, [memCell],eax + + mov ecx,[memCell] + mov ebx,1 + @@: ;for(i=1;i<=firstC;i++) + add ecx,4 + get_cell_offset edx,[ecx] + bt word[edx+Cell.liv],1 + jae .no_change + xor byte[edx+Cell.liv],3 + mov edi,[tim] + mov [edx+Cell.tc],edi + bt word[edx+Cell.liv],0 + jc .new_cell + push eax + mov edi,[edx] + dec edi + mov esi,[edx+Cell.y] + dec esi + dec dword[osob] + ; 祭 edx + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc esi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc esi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc edi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + sub esi,2 + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc edi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc esi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + inc esi + stdcall pole_cell_find,edi,esi + get_cell_offset edx,eax + dec byte[edx+Cell.so] + pop eax + jmp .no_change + .new_cell: ;  祩 + inc dword[osob] + mov edi,[edx] + dec edi + mov esi,[edx+Cell.y] + dec esi + stdcall pole_cell_creat,edi,esi,0 + inc esi + stdcall pole_cell_creat,edi,esi,0 + inc esi + stdcall pole_cell_creat,edi,esi,0 + inc edi + stdcall pole_cell_creat,edi,esi,0 + sub esi,2 + stdcall pole_cell_creat,edi,esi,0 + inc edi + stdcall pole_cell_creat,edi,esi,0 + inc esi + stdcall pole_cell_creat,edi,esi,0 + inc esi + stdcall pole_cell_creat,edi,esi,0 + .no_change: + inc ebx + cmp ebx,eax + jle @b + .fun_e: + popad + ret + +;஢ a[1..n] ⮤ +align 4 +proc pole_fl_sort, a:dword, n:dword + pushad + mov ecx,[a] + ;ନ஢ 室 筮 㯮冷祭 ॢ + mov eax,[n] + shr eax,1 + @@: ;for(i=n>>1; i>=2; i--) + stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n) + dec eax + cmp eax,2 + jge @b + ;믮 楤 ᯫ ॢ + mov eax,[n] + @@: ;for(i=n; i>=2; i--){ + stdcall pole_fl_surface, ecx,1,eax ;(a,1,i) + ; ᨬ ᯨ᪠ + lea edi,[eax*4] + add edi,ecx ;edi -> &a[i] + mov esi,[edi] ;w=a[i]; + mov edx,[ecx+4] + mov [edi],edx ;a[i]=a[1]; + mov [ecx+4],esi ;a[1]=w; + + dec eax + cmp eax,2 + jge @b + popad + ret +endp + +;楤 ᯫ ॢ a[1..k] +align 4 +proc pole_fl_surface, a:dword, i:dword, k:dword +locals + copy dd ? +endl + pushad + ;edx -> ... + ;edi -> m + ;esi -> j + mov eax,[a] + mov ebx,[i] + mov ecx,[k] + + lea edx,[ebx*4] + add edx,eax + mov edx,[edx] + mov [copy],edx ;copy=a[i]; + mov edi,ebx + shl edi,1 ;m=i<<1; + .cycle_b: ;while (m<=k) { + cmp edi,ecx + jg .cycle_e + jne @f ;if (m==k) j=m; + mov esi,edi + jmp .else_e + @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m; + lea edx,[edi*4] + add edx,eax + stdcall pole_compare_cells_bm, dword[edx],dword[edx+4] + cmp dl,0 + je @f + mov esi,edi + jmp .else_e + @@: ;else j=m+1; + mov esi,edi + inc esi + .else_e: + + ;if (pole_compare_cells_bm(a[j],copy)) { + lea edx,[esi*4] + add edx,eax + stdcall pole_compare_cells_bm, dword[edx],[copy] + cmp dl,0 + je .cycle_e ;} else break; //室 横 + + lea edx,[esi*4] + add edx,eax + push dword[edx] ;push a[j]; + lea edx,[ebx*4] + add edx,eax + pop dword[edx] ;a[i]=a[j]; + mov ebx,esi ;i=j; + mov edi,ebx + shl edi,1 ;m=i<<1; + + jmp .cycle_b + .cycle_e: + + ;祭 ॣ஢ 㦥 . . 㭪樨 + shl ebx,2 + add eax,ebx + mov edx,[copy] + mov [eax],edx ;a[i]=copy; + + popad + ret +endp +;-------------------------------------- + + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 + mov ebp,lib2 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS ;exit not correct + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0x27 + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + stdcall [buf2d_create], buf_0 ;ᮧ + + stdcall mem.Alloc,MAX_CELL*sizeof.Cell + mov [cell],eax + stdcall mem.Alloc,MAX_CELL*4 + mov [memCell],eax + stdcall mem.Alloc,(COL_MEM+1)*4 + mov [CellColors],eax + include_image_file 'life3tb.png', image_data_toolbar + + ;ன 梥⮢ 祥 + stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff + call pole_clear + call pole_paint ;ᮢ ( ࠭) + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + +align 4 +red_win: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + cmp eax,0 + je timer_funct + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo.window_stack_position] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + push eax ebx ecx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,8 + jnc @f + ;mouse l. but. press + ;call mouse_left_d + ;jmp .end_l + @@: + bt eax,16 + jnc .end_l + ;mouse l. but. up + ;call mouse_left_u + ;jmp .end_l + .end_l: + + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + shl eax,1 + sub eax,[buf_0.w] + sar eax,1 + ;mov [mouse_prop_x],eax + shl ebx,1 + sub ebx,[buf_0.h] + sar ebx,1 + ;mov [mouse_prop_y],ebx + + mcall SF_MOUSE_GET,SSF_SCROLL_DATA + test ax,ax + jz .end0 + + test ax,0x8000 + jnz .decr + ;㢥祭 ⠡ + call but_zoom_p + jmp .end0 + .decr: + ;㬥襭 ⠡ + call but_zoom_m + .end0: + + pop ecx ebx eax + ret + +;output: +; eax - buffer coord X (᫨ ஬ -1) +; ebx - buffer coord Y (᫨ ஬ -1) +align 4 +proc buf_get_mouse_coord + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + cmp ax,word[buf_0.t] + jl .no_buf ; y + mov ebx,eax + shr ebx,16 + cmp bx,word[buf_0.l] + jl .no_buf ; x + + and eax,0xffff ;⠢塞 न y + sub ax,word[buf_0.t] + cmp eax,[buf_0.h] + jg .no_buf + sub bx,word[buf_0.l] + cmp ebx,[buf_0.w] + jg .no_buf + xchg eax,ebx + jmp .end_f + .no_buf: + xor eax,eax + not eax + xor ebx,ebx + not ebx + .end_f: + ret +endp + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + cmp byte[tim_ch],0 + je @f + ;call but_next_gen + cld + mov ecx,[poc_stop] + cmp ecx,1 + jg .clear + mov ecx,1 ;ࠢ ecx 砩 ᥫ 1 + jmp .cycle + .clear: ;⨬ ᫨ ᪮쪮 1 ⠪ ⠩ + stdcall [buf2d_clear], buf_0, [buf_0.color] + .cycle: + call pole_next_gen + loop .cycle + call pole_paint + stdcall [buf2d_draw], buf_0 + call draw_pok + @@: + popad + jmp still + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + mcall SF_CREATE_WINDOW,(50 shl 16)+485,(50 shl 16)+415,0x73000000,0,hed + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,[procinfo.box.height] + cmp eax,120 + jge @f + mov eax,120 ;min size + @@: + sub eax,63 + mov ebx,[procinfo.box.width] + cmp ebx,270 + jge @f + mov ebx,270 + @@: + sub ebx,9 + cmp eax,[buf_0.h] ;ᬮਬ ࠧ + jne @f + cmp ebx,[buf_0.w] + jne @f + jmp .end0 + @@: + stdcall [buf2d_resize], buf_0, ebx,eax,1 + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + .end0: + + mov edx,[sc.work] + mov ebx, 0 shl 16 + add ebx, [buf_0.w] + mcall SF_DRAW_RECT,,<0,35> + + mcall SF_DEFINE_BUTTON,(6 shl 16)+TBTNSIZE,(6 shl 16)+TBTNSIZE,4+0x40000000, [sc.work_button] + + mov ebx,(36 shl 16)+TBTNSIZE + mov edx,6+0x40000000 + int 0x40 + + mov ebx,(61 shl 16)+TBTNSIZE + mov edx,7+0x40000000 + int 0x40 + + mov ebx,(86 shl 16)+TBTNSIZE + mov edx,8+0x40000000 + int 0x40 + + mov ebx,(116 shl 16)+TBTNSIZE + mov edx,9+0x40000000 + int 0x40 + + mov ebx,(141 shl 16)+TBTNSIZE + mov edx,10+0x40000000 + int 0x40 + + mov ebx,(171 shl 16)+TBTNSIZE + mov edx,11+0x40000000 + int 0x40 + + mov ebx,(196 shl 16)+TBTNSIZE + mov edx,12+0x40000000 + int 0x40 + + mov ebx,(221 shl 16)+TBTNSIZE + mov edx,13+0x40000000 + int 0x40 + + mov ebx,(246 shl 16)+TBTNSIZE + mov edx,14+0x40000000 + int 0x40 + + mcall SF_PUT_IMAGE,[image_data_toolbar],(ICONSIZE shl 16)+ICONSIZE,(5 shl 16)+5 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(35 shl 16)+5 ;run once + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(60 shl 16)+5 ;run auto + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(85 shl 16)+5 ;stop + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(115 shl 16)+5 ;- + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(140 shl 16)+5 ;+ + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(170 shl 16)+5 ;move up + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(195 shl 16)+5 ;move doun + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(220 shl 16)+5 ;move left + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mov edx,(245 shl 16)+5 ;move right + int 0x40 + + ; add ebx,IMAGE_TOOLBAR_ICON_SIZE + ; mov edx,(270 shl 16)+5 + ; int 0x40 + ; add ebx,IMAGE_TOOLBAR_ICON_SIZE + ; mov edx,(295 shl 16)+5 + ; int 0x40 + + mov eax,SF_DRAW_TEXT + mov ebx,295*65536+5 + mov ecx,[sc.work_text] + or ecx,0x80000000 ;or (1 shl 30) + mov edx,txt_zoom + ;mov edi,[sc.work] + int 0x40 + add bx,9 + mov edx,txt_gen + int 0x40 + add bx,9 + mov edx,txt_osob + int 0x40 + + call draw_pok + + stdcall [buf2d_draw], buf_0 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +draw_pok: + mov eax,SF_DRAW_NUMBER + movzx ecx,byte[zoom] + mov ebx,(2 shl 16) + mov edx,(295+8*9)*65536+5 + mov esi,[sc.work_text] + or esi,(1 shl 30) + mov edi,[sc.work] + int 0x40 ;⠡ + mov ebx,(5 shl 16) + mov ecx,[tim] + add edx,9 + int 0x40 ;६ + mov ebx,(5 shl 16) + mov ecx,[osob] + add edx,9 + int 0x40 ; + ret + +align 4 +key: + mcall SF_GET_KEY + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_next_gen + jmp still + @@: + cmp ah,7 + jne @f + call but_run + jmp still + @@: + cmp ah,8 + jne @f + call but_stop + jmp still + @@: + cmp ah,9 + jne @f + call but_zoom_p + jmp still + @@: + cmp ah,10 + jne @f + call but_zoom_m + jmp still + @@: + cmp ah,11 + jne @f + call but_pole_up + jmp still + @@: + cmp ah,12 + jne @f + call but_pole_dn + jmp still + @@: + cmp ah,13 + jne @f + call but_pole_left + jmp still + @@: + cmp ah,14 + jne @f + call but_pole_right + jmp still + @@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall mem.Free,[open_file_lif] + stdcall mem.Free,[cell] + stdcall mem.Free,[memCell] + stdcall mem.Free,[CellColors] + stdcall mem.Free,[image_data_toolbar] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: + ret + +align 4 +open_file_lif dd 0 ;㪠⥫ 䠩 +open_file_size dd 0 ;ࠧ ⮣ 䠩 + +align 4 +but_open_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + ; 㤠筮 ⨨ + + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + inc ecx ;for text files + stdcall mem.ReAlloc,[open_file_lif],ecx + mov [open_file_lif],eax + dec ecx ;for text files + mov byte[eax+ecx],0 ;for text files + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov [run_file_70.Count], ecx + m2m dword[run_file_70.Buffer], dword[open_file_lif] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 ;㦠 䠩 ࠦ + test eax,eax + jnz .end_open_file + cmp ebx,0xffffffff + je .end_open_file + + mov [open_file_size],ebx + mcall SF_SET_CAPTION,1,openfile_path + + call pole_clear + mov eax,[buf_0.w] + shr eax,1 + xor ecx,ecx + mov cl,byte[zoom] + cmp cx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + add [Cor_x],eax + mov eax,[buf_0.h] + shr eax,1 + cmp cx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + add [Cor_y],eax + + ;eax - first x position + ;ebx - x position + ;ecx - y position + ;edx - 䠩 + mov edi,[open_file_lif] + xor ebx,ebx + xor ecx,ecx + mov eax,ebx + mov edx,edi + add edx,[open_file_size] + @@: + cmp byte[edi],'*' + jne .no_cell + stdcall pole_cell_creat, ebx,ecx,1 + inc ebx + .no_cell: + cmp byte[edi],'.' + jne .cell_move + inc ebx + .cell_move: + cmp byte[edi],13 + jne .cell_nl + mov ebx,eax + inc ecx + .cell_nl: + cmp word[edi],'#P' ;ᬥ 樨 + jne .pos + inc edi ;ய '#' + .space: + inc edi ;ய 'P' ' ' + cmp byte[edi],' ' + je .space + stdcall conv_str_to_int,edi + mov ebx,eax + cmp byte[edi],'-' + jne .digit + inc edi + .digit: + cmp byte[edi],'0' + jl .digit_no + cmp byte[edi],'9' + jg .digit_no + inc edi + jmp .digit + .digit_no: + ;.space_1: + inc edi ;ய 'P' ' ' + cmp byte[edi],' ' + je .digit_no ;.space_1 + stdcall conv_str_to_int,edi + mov ecx,eax + mov eax,ebx ;⠭ 㯠 eax + .pos: + inc edi + cmp edi,edx + jl @b + ;--- + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + call pole_paint ;㥬 ( 砩 ᫨ ⪠ ⥪⮢ ) + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + .end_open_file: + popad + ret + +align 4 +but_save_file: + ret + +align 4 +but_next_gen: + call pole_next_gen + call pole_paint + stdcall [buf2d_draw], buf_0 + pushad + call draw_pok + popad + ret + +align 4 +but_run: + mov byte[tim_ch],1 + ret + +align 4 +but_stop: + mov byte[tim_ch],0 + ;cld + ;mov ecx,100 + ;@@: + ; call pole_next_gen + ;loop @b + ;stdcall [buf2d_clear], buf_0, [buf_0.color] + ;call pole_paint + ;stdcall [buf2d_draw], buf_0 + ret + +align 4 +but_zoom_p: + cmp byte[zoom],16 + jge @f + pushad + ;᫥ ᤢ , ᯥ 業஢ 㢥祭 ⠡ + xor ecx,ecx + mov cl,byte[zoom] + xor edx,edx + mov eax,[buf_0.w] + shr eax,1 ; eax ਭ + mov ebx,eax ; १ࢭ eax + div ecx ; eax ⥪騩 ⠡ + xchg eax,ebx + xor edx,edx + inc ecx + div ecx ; eax ⠡ + sub ebx,eax ; ᤢ ᯥ 業஢ + sub dword[Cor_x],ebx ;ᤢ ७ x + xor ecx,ecx + mov cl,byte[zoom] + xor edx,edx + mov eax,[buf_0.h] + shr eax,1 + mov ebx,eax + div ecx + xchg eax,ebx + xor edx,edx + inc ecx + div ecx + sub ebx,eax + sub dword[Cor_y],ebx ;ᤢ ७ y + + inc byte[zoom] + call draw_pok + popad + + cmp dword[poc_stop],1 + jle .buf_clear + cmp byte[tim_ch],0 + jne @f + .buf_clear: + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + @@: + ret + +align 4 +but_zoom_m: + cmp byte[zoom],1 + jle @f + pushad + ;᫥ ᤢ , ᯥ 業஢ 㬥襭 ⠡ + xor ecx,ecx + mov cl,byte[zoom] + xor edx,edx + mov eax,[buf_0.w] + shr eax,1 ; eax ਭ + mov ebx,eax ; १ࢭ eax + div ecx ; eax ⥪騩 ⠡ + xchg eax,ebx + xor edx,edx + dec ecx + div ecx ; eax ⠡ + sub ebx,eax ; ᤢ ᯥ 業஢ + sub dword[Cor_x],ebx ;ᤢ ७ x + xor ecx,ecx + mov cl,byte[zoom] + xor edx,edx + mov eax,[buf_0.h] + shr eax,1 + mov ebx,eax + div ecx + xchg eax,ebx + xor edx,edx + dec ecx + div ecx + sub ebx,eax + sub dword[Cor_y],ebx ;ᤢ ७ y + + dec byte[zoom] + call draw_pok + popad + + cmp dword[poc_stop],1 + jle .buf_clear + cmp byte[tim_ch],0 + jne @f + .buf_clear: + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + @@: + ret + +align 4 +but_pole_up: + push eax ecx edx + mov eax,[buf_0.h] + shr eax,2 + xor ecx,ecx + mov cl,byte[zoom] + cmp cx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + add [Cor_y],eax + pop edx ecx eax + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + ret + +align 4 +but_pole_dn: + push eax ecx edx + mov eax,[buf_0.h] + shr eax,2 + xor ecx,ecx + mov cl,byte[zoom] + cmp cx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + sub [Cor_y],eax + pop edx ecx eax + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + ret + +align 4 +but_pole_left: + push eax ecx edx + mov eax,[buf_0.w] + shr eax,2 + movzx ecx,byte[zoom] + cmp ecx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + add [Cor_x],eax + pop edx ecx eax + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + ret + +align 4 +but_pole_right: + push eax ecx edx + mov eax,[buf_0.w] + shr eax,2 + xor ecx,ecx + mov cl,byte[zoom] + cmp cx,2 + jl @f ; 稭 zoom + xor edx,edx + div ecx + @@: + sub [Cor_x],eax + pop edx ecx eax + stdcall [buf2d_clear], buf_0, [buf_0.color] + call pole_paint + stdcall [buf2d_draw], buf_0 + ret + +;input: +; buf - 㪠⥫ ப, ᫮ 10 16 筮 +;output: +; eax - ᫮ +align 4 +proc conv_str_to_int uses ebx ecx esi, buf:dword + xor eax,eax + xor ebx,ebx + mov esi,[buf] + ;। ⥫ ᥫ + xor ecx,ecx + inc ecx + cmp byte[esi],'-' + jne @f + dec ecx + inc esi + @@: + + cmp word[esi],'0x' + je .load_digit_16 + + .load_digit_10: ;뢠 10- + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'9' + jg @f + sub bl,'0' + imul eax,10 + add eax,ebx + inc esi + jmp .load_digit_10 + jmp @f + + .load_digit_16: ;뢠 16- + add esi,2 + .cycle_16: + mov bl,byte[esi] + cmp bl,'0' + jl @f + cmp bl,'f' + jg @f + cmp bl,'9' + jle .us1 + cmp bl,'A' + jl @f ;ᥨ ᨬ >'9' <'A' + .us1: ;⠢ ᫮ + cmp bl,'F' + jle .us2 + cmp bl,'a' + jl @f ;ᥨ ᨬ >'F' <'a' + sub bl,32 ;ॢ ᨬ 孨 ॣ, 饭 ᫥饩 ࠡ⪨ + .us2: ;⠢ ᫮ + sub bl,'0' + cmp bl,9 + jle .cor1 + sub bl,7 ;convert 'A' to '10' + .cor1: + shl eax,4 + add eax,ebx + inc esi + jmp .cycle_16 + @@: + cmp ecx,0 ;᫨ ᫮ ⥫쭮 + jne @f + sub ecx,eax + mov eax,ecx + @@: + ret +endp + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'LIF',0 +db 'RLE',0 +.end: +db 0 + + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 + +l_libs_start: + lib0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_destroy dd aimg_destroy + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_destroy db 'img_destroy',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_set_pixel dd sz_buf2d_set_pixel + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + +align 4 +buf_0: dd 0 +.l: dw 0 ;+4 left +.t: dw 35 ;+6 top +.w: dd 476 ;+8 w +.h: dd 352 ;+12 h +.color: dd 0xffffd0 ;+16 color + db 24 ;+20 bit in pixel + +align 16 +i_end: + mouse_dd rd 1 + last_time rd 1 + sc system_colors + procinfo process_information + sys_path rb 1024 + file_name rb 2048 ;4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 + rb 1024 +stacktop: +mem: diff --git a/programs/games/lines/lines.asm b/programs/games/lines/lines.asm index 63515b3d4..9cfc7bf5e 100644 --- a/programs/games/lines/lines.asm +++ b/programs/games/lines/lines.asm @@ -1,275 +1,275 @@ -use32 - org 0x0 - db 'MENUET01' - dd 0x01 - dd _preSTART - dd I_END - dd 0x4000 - dd 0x4000 - dd 0x0,0x0 - -include '../../macros.inc' -include 'lang.inc' -include 'draw_window.inc' -include 'ball_operations.inc' -include 'basic_alg.inc' - -_preSTART: - mcall 66, 1, 1 ;ਭ ᪠- - mcall 3 ;randomize - ror eax, 16 - mov [TC_U_SYSTEM_RANDSEED], eax ;from PPro "system.inc" - -new_game: - ;㫥 - mov eax, 0 - mov ecx, 81 / 4 - mov edi, lineBall - rep stosd - stosb - - mov [score], 0 - mov [countAllBall], 0 - mov [current], 0 - @@: - mov ebx, 7 - call random - inc dl - call add_new_ball - call test_new_ball - cmp [countAllBall], 5 - jb @b - call generate_new___new_color - -START: - draw_window - still: - mcall 10 - - dec eax - jz START ; ᮢ - dec eax - jnz button ;᫨ - - - key: ; ⨥ - mcall 2 ; 砥 - cmp ah, 60 - je new_game - jmp still - - button: ; ⨥ - mcall 17 - shr eax, 8 - cmp ax, 1 ; ᫨ 室? - je .exit - - ;஢ਬ, ⪠ - mov edx, [current] - test byte [eax + lineBall - 2], 0x7 - jz .blank - - ;஢ਬ 뫠 ⪠ 㦥 ࠭ - cmp eax, edx - je .double_choice - - mov [current], eax - call choice_ball - call paint_ball ;᭠砫 㥬 ࠭ ਪ - - test edx, edx ;cmp [current], 0 - jz still - mov eax, edx - - @@: - call redraw_cell ; 㦥 ⮬ 㡥६ ࠬ ண - call paint_ball - jmp still - - .double_choice: - mov [current], 0 - jmp @B - - .blank: ; - - test edx, edx ;cmp [current], 0 - jz still - mov [dest], eax ; 祭 -> [dest] - mov eax, edx ;ࠬ eax - call test_path ;뢠 ४ test_path - call zero_cheked - jnc still - -;^^^^^^^^^^^^^^^^^ move_ball proc - mov eax, [current] - mov cl, byte [eax + lineBall - 2] - mov byte [eax + lineBall - 2], 0 - mov eax, [dest] - mov byte [eax + lineBall - 2], cl - - mov eax, [current] - call redraw_cell - mov eax, [dest] - call paint_ball - mov [current], 0 -;^^^^^^^^^^^^^^^^^ move_ball endp - - call find_line - call vanish_balls - call zero_cheked - - cmp [countVanishBall], 0 - je new_3_balls - movzx eax, [countVanishBall] - inc eax - add [score], eax - sub [countAllBall], al - call redraw_score - jmp still - - .exit: - mcall -1 ;室 - -new_3_balls: - - rept 3 num - { - mov dl, [newColor#num] - call add_new_ball - call test_new_ball - cmp [countAllBall],81 - je .record_li - } - - call generate_new___new_color - call paint_new_color - jmp still - - .record_li: - mov eax, [score] - cmp eax, [record] - jbe still - mov [record], eax - jmp START - -zero_cheked: ;㫥 cheked - pushfd - mov eax, lineBall - mov ecx, 81 - @@: - and byte [eax], 0x7 - inc eax - loop @B - popfd - ret - -random: ; edx := random [0..(ebx-1)] - mov eax, 134775813 - mul [TC_U_SYSTEM_RANDSEED] - inc eax - mov [ TC_U_SYSTEM_RANDSEED], eax - xor edx, edx - div ebx - ret - -generate_new___new_color: - rept 3 num - { - mov ebx, 7 - call random - inc dl - mov [newColor#num], dl - } - ret - -add_new_ball: ; dl - 梥 ਪ - mov ebp, edx - mov ebx, 81 - sub bl, [countAllBall] - call random - mov ecx, edx - mov eax, lineBall-1 - inc ecx - @@: - inc eax - test byte [eax], 0x7 - jnz @B - loop @B - - ;⥯ eax - 襣 ਪ - mov edx, ebp - or byte [eax], dl - inc [countAllBall] - ;稬 ID - sub eax, lineBall-2 - mov [dest], eax - ret - -test_new_ball: - call paint_ball - - call find_line - call vanish_balls - call zero_cheked - - cmp [countVanishBall], 0 - je @F - movzx eax, [countVanishBall] - inc eax - add [score], eax - sub [countAllBall], al - call redraw_score - @@: - ret - -if lang eq ru_RU - szTitle db ' v 0.3',0 - szNewGame db 'F2 - ',0 - szRecord db '',0 - szScore db '窨',0 -else - szTitle db 'Color lines v 0.3',0 - szNewGame db 'F2 - new game',0 - szRecord db 'Record',0 - szScore db 'Score',0 -end if - - -blank = 0xB8C2D3 -brown = 0x804000 -red = 0xff0000 -yellow = 0xffff00 -green = 0x008000 -cyan = 0x00ffff -blue = 0x0000ff -purple = 0x800080 - -tableColor dd blank,brown,red,yellow,green,cyan,blue,purple - -lineCoord: - rept 9 coory:0 - { - rept 9 coorx:0 - \{ - dw coorx*256+coory - - \} - } - -record dd 25 - -lineBall db 81 dup ? -score dd ? -baseAddr dd ? -current dd ? -dest dd ? - -newColor1 db ? -newColor2 db ? -newColor3 db ? - -countVanishBall db ? -countAllBall db ? - -TC_U_SYSTEM_RANDSEED dd ? -bitID dd ? - -I_END: +use32 + org 0x0 + db 'MENUET01' + dd 0x01 + dd _preSTART + dd I_END + dd 0x4000 + dd 0x4000 + dd 0x0,0x0 + +include '../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'draw_window.inc' +include 'ball_operations.inc' +include 'basic_alg.inc' + +_preSTART: + mcall 66, 1, 1 ;ਭ ᪠- + mcall 3 ;randomize + ror eax, 16 + mov [TC_U_SYSTEM_RANDSEED], eax ;from PPro "system.inc" + +new_game: + ;㫥 + mov eax, 0 + mov ecx, 81 / 4 + mov edi, lineBall + rep stosd + stosb + + mov [score], 0 + mov [countAllBall], 0 + mov [current], 0 + @@: + mov ebx, 7 + call random + inc dl + call add_new_ball + call test_new_ball + cmp [countAllBall], 5 + jb @b + call generate_new___new_color + +START: + draw_window + still: + mcall 10 + + dec eax + jz START ; ᮢ + dec eax + jnz button ;᫨ - + + key: ; ⨥ + mcall 2 ; 砥 + cmp ah, 60 + je new_game + jmp still + + button: ; ⨥ + mcall 17 + shr eax, 8 + cmp ax, 1 ; ᫨ 室? + je .exit + + ;஢ਬ, ⪠ + mov edx, [current] + test byte [eax + lineBall - 2], 0x7 + jz .blank + + ;஢ਬ 뫠 ⪠ 㦥 ࠭ + cmp eax, edx + je .double_choice + + mov [current], eax + call choice_ball + call paint_ball ;᭠砫 㥬 ࠭ ਪ + + test edx, edx ;cmp [current], 0 + jz still + mov eax, edx + + @@: + call redraw_cell ; 㦥 ⮬ 㡥६ ࠬ ண + call paint_ball + jmp still + + .double_choice: + mov [current], 0 + jmp @B + + .blank: ; - + test edx, edx ;cmp [current], 0 + jz still + mov [dest], eax ; 祭 -> [dest] + mov eax, edx ;ࠬ eax + call test_path ;뢠 ४ test_path + call zero_cheked + jnc still + +;^^^^^^^^^^^^^^^^^ move_ball proc + mov eax, [current] + mov cl, byte [eax + lineBall - 2] + mov byte [eax + lineBall - 2], 0 + mov eax, [dest] + mov byte [eax + lineBall - 2], cl + + mov eax, [current] + call redraw_cell + mov eax, [dest] + call paint_ball + mov [current], 0 +;^^^^^^^^^^^^^^^^^ move_ball endp + + call find_line + call vanish_balls + call zero_cheked + + cmp [countVanishBall], 0 + je new_3_balls + movzx eax, [countVanishBall] + inc eax + add [score], eax + sub [countAllBall], al + call redraw_score + jmp still + + .exit: + mcall -1 ;室 + +new_3_balls: + + rept 3 num + { + mov dl, [newColor#num] + call add_new_ball + call test_new_ball + cmp [countAllBall],81 + je .record_li + } + + call generate_new___new_color + call paint_new_color + jmp still + + .record_li: + mov eax, [score] + cmp eax, [record] + jbe still + mov [record], eax + jmp START + +zero_cheked: ;㫥 cheked + pushfd + mov eax, lineBall + mov ecx, 81 + @@: + and byte [eax], 0x7 + inc eax + loop @B + popfd + ret + +random: ; edx := random [0..(ebx-1)] + mov eax, 134775813 + mul [TC_U_SYSTEM_RANDSEED] + inc eax + mov [ TC_U_SYSTEM_RANDSEED], eax + xor edx, edx + div ebx + ret + +generate_new___new_color: + rept 3 num + { + mov ebx, 7 + call random + inc dl + mov [newColor#num], dl + } + ret + +add_new_ball: ; dl - 梥 ਪ + mov ebp, edx + mov ebx, 81 + sub bl, [countAllBall] + call random + mov ecx, edx + mov eax, lineBall-1 + inc ecx + @@: + inc eax + test byte [eax], 0x7 + jnz @B + loop @B + + ;⥯ eax - 襣 ਪ + mov edx, ebp + or byte [eax], dl + inc [countAllBall] + ;稬 ID + sub eax, lineBall-2 + mov [dest], eax + ret + +test_new_ball: + call paint_ball + + call find_line + call vanish_balls + call zero_cheked + + cmp [countVanishBall], 0 + je @F + movzx eax, [countVanishBall] + inc eax + add [score], eax + sub [countAllBall], al + call redraw_score + @@: + ret + +if lang eq ru_RU + szTitle db ' v 0.3',0 + szNewGame db 'F2 - ',0 + szRecord db '',0 + szScore db '窨',0 +else ; Default to en_US + szTitle db 'Color lines v 0.3',0 + szNewGame db 'F2 - new game',0 + szRecord db 'Record',0 + szScore db 'Score',0 +end if + + +blank = 0xB8C2D3 +brown = 0x804000 +red = 0xff0000 +yellow = 0xffff00 +green = 0x008000 +cyan = 0x00ffff +blue = 0x0000ff +purple = 0x800080 + +tableColor dd blank,brown,red,yellow,green,cyan,blue,purple + +lineCoord: + rept 9 coory:0 + { + rept 9 coorx:0 + \{ + dw coorx*256+coory + + \} + } + +record dd 25 + +lineBall db 81 dup ? +score dd ? +baseAddr dd ? +current dd ? +dest dd ? + +newColor1 db ? +newColor2 db ? +newColor3 db ? + +countVanishBall db ? +countAllBall db ? + +TC_U_SYSTEM_RANDSEED dd ? +bitID dd ? + +I_END: diff --git a/programs/games/megamaze/trunk/colzone.inc b/programs/games/megamaze/trunk/colzone.inc index dd7667059..8381d9d46 100644 --- a/programs/games/megamaze/trunk/colzone.inc +++ b/programs/games/megamaze/trunk/colzone.inc @@ -1,140 +1,142 @@ -; level format -; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] - -; internal format -; [stepptr]= worms # -; area: [worm_len][start_cell #][end_cell #]..[dirs].. -; [cur_step]: dragged worm pointer -; [finish]: 0 - if head dragged, 1- if tail -CZ_levelp: - call get_xy_sf - call LP_levelp.bit2 - mov dword[area],5;0 - ret - -CZ_key: - mov [jump],still - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov ecx,dword[area] - lea ebx,[eax-176] - mov eax,[player] - call check_bounds - je .ex - cmp ecx,5 - jne .novert - .vert: - add eax,[dirs+ebx*4] - call check_bounds - je .ex - mov ecx,eax - add ecx,[dirs+ebx*4] - mov cl,[field+ecx] - cmp cl,[field+eax] - jne .ex - mov dword[area],ebx - .ok: - mov [player],eax - cmp eax,[finish] - jne .jm - cmp dword[area],5 - jne .jm - mov [win_flag],1 - .jm: - mov [jump],drw - .ex: - ret - .novert: - mov edx,ebx - cmp edx,ecx ; the same dir - jne .nosame - add eax,[dirs+ebx*4] - call check_bounds - je .ex - .set5: - mov dword[area],5 - add eax,[dirs+ebx*4] - jmp .ok - .nosame: - xor edx,11b - cmp edx,ecx ; the opposite dir - je .set5 - add eax,[dirs+ebx*4] - mov ebx,ecx - xor ecx,11b - add eax,[dirs+ecx*4] - jmp .vert - -CZ_drawm: - mov ecx,[cell_count] - mov esi,field - mov [sq_size],3 - .lp: - push ecx - movzx ebx,byte[field+ecx-1] - shr ebx,6 - lea eax,[ecx-1] - call get_xy - add [lx],5-2 shl 16 - add [ly],5-2 shl 16 - mov edx,[f_colors+ebx*4] - mcall 13,[lx],[ly] - .no: - pop ecx - loop .lp - - inc [sq_size] - mov eax,[player] - call get_xy - xor edx,edx - cmp dword[area],5 - je .vert - push [lx] - push [ly] - mov edx,dword[area] - add eax,[dirs+edx*4] - call get_xy - mcall 13,[lx],[ly] - pop [ly] - pop [lx] - .vert: - mcall 13,[lx],[ly] - add [sq_size],5 - mov eax,[finish] - call get_xy - mcall 13,[lx],[ly],0xffffff - - ret - - -CZ_level: -file 'colzone.bin' - -if lang eq ru_RU - CZ_help mstr \ - ' 2 㡨 ⮨ 襭',\ - '⮩ ᪥. - ४ ',\ - ' ⨪. 稭 ',\ - ' ⮦ ⨪쭮 .',\ - ' 몠뢠 । ⪨ ᢥ',\ - '⮣ - 㡨 ᥣ ',\ - '⪨ 梥. ⮡ࠦ 3D,',\ - '⮬ ஥.','',\ - 'http://www.clickmazes.com' -else - CZ_help mstr \ - 'A black block, made of two black cubes stuck',\ - 'together, sits on a coloured grid. Your challenge',\ - 'is to roll the black block to its target',\ - 'position, which is marked with a small white',\ - 'square. The block starts on one end (vertical)',\ - 'and must also finish in this position. The block',\ - 'is not permitted to roll off the grid and, in',\ - 'addition, the block must always lie entirely',\ - 'within one colour-zone. Note the block is not',\ - 'displayed in 3D, in effect you see only its',\ - 'shadow.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +; level format +; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] + +; internal format +; [stepptr]= worms # +; area: [worm_len][start_cell #][end_cell #]..[dirs].. +; [cur_step]: dragged worm pointer +; [finish]: 0 - if head dragged, 1- if tail +CZ_levelp: + call get_xy_sf + call LP_levelp.bit2 + mov dword[area],5;0 + ret + +CZ_key: + mov [jump],still + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov ecx,dword[area] + lea ebx,[eax-176] + mov eax,[player] + call check_bounds + je .ex + cmp ecx,5 + jne .novert + .vert: + add eax,[dirs+ebx*4] + call check_bounds + je .ex + mov ecx,eax + add ecx,[dirs+ebx*4] + mov cl,[field+ecx] + cmp cl,[field+eax] + jne .ex + mov dword[area],ebx + .ok: + mov [player],eax + cmp eax,[finish] + jne .jm + cmp dword[area],5 + jne .jm + mov [win_flag],1 + .jm: + mov [jump],drw + .ex: + ret + .novert: + mov edx,ebx + cmp edx,ecx ; the same dir + jne .nosame + add eax,[dirs+ebx*4] + call check_bounds + je .ex + .set5: + mov dword[area],5 + add eax,[dirs+ebx*4] + jmp .ok + .nosame: + xor edx,11b + cmp edx,ecx ; the opposite dir + je .set5 + add eax,[dirs+ebx*4] + mov ebx,ecx + xor ecx,11b + add eax,[dirs+ecx*4] + jmp .vert + +CZ_drawm: + mov ecx,[cell_count] + mov esi,field + mov [sq_size],3 + .lp: + push ecx + movzx ebx,byte[field+ecx-1] + shr ebx,6 + lea eax,[ecx-1] + call get_xy + add [lx],5-2 shl 16 + add [ly],5-2 shl 16 + mov edx,[f_colors+ebx*4] + mcall 13,[lx],[ly] + .no: + pop ecx + loop .lp + + inc [sq_size] + mov eax,[player] + call get_xy + xor edx,edx + cmp dword[area],5 + je .vert + push [lx] + push [ly] + mov edx,dword[area] + add eax,[dirs+edx*4] + call get_xy + mcall 13,[lx],[ly] + pop [ly] + pop [lx] + .vert: + mcall 13,[lx],[ly] + add [sq_size],5 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xffffff + + ret + + +CZ_level: +file 'colzone.bin' + +if lang eq ru_RU + CZ_help mstr \ + ' 2 㡨 ⮨ 襭',\ + '⮩ ᪥. - ४ ',\ + ' ⨪. 稭 ',\ + ' ⮦ ⨪쭮 .',\ + ' 몠뢠 । ⪨ ᢥ',\ + '⮣ - 㡨 ᥣ ',\ + '⪨ 梥. ⮡ࠦ 3D,',\ + '⮬ ஥.','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + CZ_help mstr \ + 'A black block, made of two black cubes stuck',\ + 'together, sits on a coloured grid. Your challenge',\ + 'is to roll the black block to its target',\ + 'position, which is marked with a small white',\ + 'square. The block starts on one end (vertical)',\ + 'and must also finish in this position. The block',\ + 'is not permitted to roll off the grid and, in',\ + 'addition, the block must always lie entirely',\ + 'within one colour-zone. Note the block is not',\ + 'displayed in 3D, in effect you see only its',\ + 'shadow.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/cstep.inc b/programs/games/megamaze/trunk/cstep.inc index a058a3b77..c9c769549 100644 --- a/programs/games/megamaze/trunk/cstep.inc +++ b/programs/games/megamaze/trunk/cstep.inc @@ -1,66 +1,68 @@ -; level format -; [fx|fy][blue xy][red xy]..[maze walls] - -; internal format -; [player]= blue -; [finish]= red - - -CSTEP_key: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov esi,area - inc esi - lea ebx,[eax-176] - mov [jump],still - mov eax,[player] - call check_move - jc .ex - add eax,[dirs+ebx*4] - mov edx,eax - .nom1: - mov eax,[finish] - xor ebx,11b - call check_move - jc .ex - add eax,[dirs+ebx*4] - mov [finish],eax - mov [player],edx - mov [jump],drw - cmp eax,edx - jnz .ex - mov [win_flag],1 - .ex: - ret - -CSTEP_drawm: - mov eax,[player] - call get_xy - mcall 13,[lx],[ly],0xff0000 - mov eax,[finish] - call get_xy - mcall 13,[lx],[ly],0xff - ret - -CSTEP_level: -file 'cstep.bin' - -if lang eq ru_RU - CSTEP_help mstr \ - ' ᨭ ⥬ ࠢ',\ - ' . ᫥ ',\ - ', אַ ⨢',\ - 'ࠢ. ࠧ襭 ⮫쪮 砥',\ - '⢨ ९⢨ .','',\ - 'http://www.clickmazes.com' -else - CSTEP_help mstr \ - 'Unite the red and blue dots by moving just the',\ - 'red dot. The blue dot follows the red dot, but',\ - 'moves in exactly in the opposite direction. A',\ - 'move is only permitted if the path is clear for',\ - 'both dots.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +; level format +; [fx|fy][blue xy][red xy]..[maze walls] + +; internal format +; [player]= blue +; [finish]= red + + +CSTEP_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + mov [jump],still + mov eax,[player] + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov edx,eax + .nom1: + mov eax,[finish] + xor ebx,11b + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov [finish],eax + mov [player],edx + mov [jump],drw + cmp eax,edx + jnz .ex + mov [win_flag],1 + .ex: + ret + +CSTEP_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff0000 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff + ret + +CSTEP_level: +file 'cstep.bin' + +if lang eq ru_RU + CSTEP_help mstr \ + ' ᨭ ⥬ ࠢ',\ + ' . ᫥ ',\ + ', אַ ⨢',\ + 'ࠢ. ࠧ襭 ⮫쪮 砥',\ + '⢨ ९⢨ .','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + CSTEP_help mstr \ + 'Unite the red and blue dots by moving just the',\ + 'red dot. The blue dot follows the red dot, but',\ + 'moves in exactly in the opposite direction. A',\ + 'move is only permitted if the path is clear for',\ + 'both dots.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/fhouse.inc b/programs/games/megamaze/trunk/fhouse.inc index 62dd1c2f9..4cd4fe28f 100644 --- a/programs/games/megamaze/trunk/fhouse.inc +++ b/programs/games/megamaze/trunk/fhouse.inc @@ -1,197 +1,199 @@ -FH_levelp: - mcall 40,100111b - call get_xy_sf - call erase_field - sub esi,2 - mov [levptr],esi - movzx ecx,byte[esi-2] - sub ecx,2 - xor eax,eax - .lp: - lodsb - mov byte[field+eax],-1 - loop .lp - mov dword[player],-1 - mov [win_flag],3 - ret - -FH_key: - cmp eax,-1 - je FH_mouse - cmp eax,8 - jne .nobsp - cmp [stepptr],0 - jne .no1st - mov [jump],run.game - ret - .no1st: - mov [win_flag],0 - sub [cur_step],2 - mov esi,[cur_step] - mov edi,[finish] - mov eax,3 - movzx ebx,byte[esi] - sub eax,ebx - movzx ecx,byte[esi+1] - .lp0: - and byte[field+edi],0 - add edi,[dirs+eax*4] - loop .lp0 - mov [finish],edi - dec [stepptr] - ret - .nobsp: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - sub eax,176 - jmp FH_mouse.fromkey - .ex: - ret - -FH_drawm: - mov ecx,[cell_count] - .lp: - push ecx - movzx ebx,byte[field+ecx-1] - test ebx,ebx - jz .no - lea eax,[ecx-1] - call get_xy - mov edx,0 - cmp ebx,0xf - jne .stable - mov edx,0x909090 - .stable: - mcall 13,[lx],[ly] - .no: - pop ecx - loop .lp - - mov eax,[player] - cmp eax,-1 - je .ex - call get_xy - mcall 13,[lx],[ly],0xff00 - mov eax,[finish] - call get_xy - mcall 13,[lx],[ly],0xff0000 - - mov ecx,[stepptr] - jecxz .ex - mov ebx,area - mov edi,[player] - mov edx,0xffffff - .lp3: - push ecx - mov esi,edi - movzx eax,byte[ebx] - movzx ecx,byte[ebx+1] - add ebx,2 - .lp2: - add edi,[dirs+eax*4] - loop .lp2 - call getline - pop ecx - loop .lp3 - .ex: - ret - -FH_mouse: - mov [jump],drw;red - call get_last_mclick - cmp byte[field+ebx],0 - jne .ex - cmp dword[player],-1 - jne .nostart - mov dword[player],ebx - mov byte[field+ebx],0xf - mov [finish],ebx - and [win_flag],0 - mov [cur_step],area - and [stepptr],0 - ret - .nostart: - mov eax,[finish] - call get_offset - cmp eax,-1 - je .ex - .fromkey: - xor ecx,ecx - mov edx,eax - mov esi,[finish] - .lp: - add esi,[dirs+edx*4] - cmp byte[field+esi],0 - jnz .exlp - mov eax,[finish] - mov ebx,esi - call get_offset - cmp eax,edx - jne .exlp - mov byte[field+esi],0xf - inc ecx - mov [finish],esi - jmp .lp - - .exlp: - jecxz .ex - mov eax,edx - mov edi,[cur_step] - stosb - mov [edi],cl - inc edi - mov [cur_step],edi - inc [stepptr] - mov edi,field - mov ecx,[cell_count] - xor eax,eax - repne scasb - je .ch_deadend - mov [win_flag],1 - .ex: - ret - .ch_deadend: - mov ecx,4 - mov edx,dirs - .lpp: - mov eax,[finish] - mov ebx,[edx] - add ebx,eax - push ebx - call get_offset - pop ebx - cmp eax,-1 - je .nxtlp - cmp byte[field+ebx],0 - jz .ex - .nxtlp: - add edx,4 - loop .lpp - mov [win_flag],4 - ret - -FH_level: -file 'fhouse.bin' - -if lang eq ru_RU - FH_help mstr \ - ' 砫 ஢',\ - ', 室 १ ⪨ ',\ - ' ࠧ.',\ - ' ࠧ אַ,',\ - '⠭ ⮫쪮 , । 묨',\ - '⠬ 㦥 饭묨 ⪠.','',\ - 'http://www.clickmazes.com' -else - FH_help mstr \ - 'For each puzzle find the starting square and draw',\ - 'a path moving horizontally and vertically that',\ - 'passes through each open square exactly once.','',\ - 'At each move the red runner will always run',\ - 'straight, as far as possible, stopping only when',\ - "blocked by the grid's edge, a black square, or a",\ - 'square already visited.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +FH_levelp: + mcall 40,100111b + call get_xy_sf + call erase_field + sub esi,2 + mov [levptr],esi + movzx ecx,byte[esi-2] + sub ecx,2 + xor eax,eax + .lp: + lodsb + mov byte[field+eax],-1 + loop .lp + mov dword[player],-1 + mov [win_flag],3 + ret + +FH_key: + cmp eax,-1 + je FH_mouse + cmp eax,8 + jne .nobsp + cmp [stepptr],0 + jne .no1st + mov [jump],run.game + ret + .no1st: + mov [win_flag],0 + sub [cur_step],2 + mov esi,[cur_step] + mov edi,[finish] + mov eax,3 + movzx ebx,byte[esi] + sub eax,ebx + movzx ecx,byte[esi+1] + .lp0: + and byte[field+edi],0 + add edi,[dirs+eax*4] + loop .lp0 + mov [finish],edi + dec [stepptr] + ret + .nobsp: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + sub eax,176 + jmp FH_mouse.fromkey + .ex: + ret + +FH_drawm: + mov ecx,[cell_count] + .lp: + push ecx + movzx ebx,byte[field+ecx-1] + test ebx,ebx + jz .no + lea eax,[ecx-1] + call get_xy + mov edx,0 + cmp ebx,0xf + jne .stable + mov edx,0x909090 + .stable: + mcall 13,[lx],[ly] + .no: + pop ecx + loop .lp + + mov eax,[player] + cmp eax,-1 + je .ex + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + + mov ecx,[stepptr] + jecxz .ex + mov ebx,area + mov edi,[player] + mov edx,0xffffff + .lp3: + push ecx + mov esi,edi + movzx eax,byte[ebx] + movzx ecx,byte[ebx+1] + add ebx,2 + .lp2: + add edi,[dirs+eax*4] + loop .lp2 + call getline + pop ecx + loop .lp3 + .ex: + ret + +FH_mouse: + mov [jump],drw;red + call get_last_mclick + cmp byte[field+ebx],0 + jne .ex + cmp dword[player],-1 + jne .nostart + mov dword[player],ebx + mov byte[field+ebx],0xf + mov [finish],ebx + and [win_flag],0 + mov [cur_step],area + and [stepptr],0 + ret + .nostart: + mov eax,[finish] + call get_offset + cmp eax,-1 + je .ex + .fromkey: + xor ecx,ecx + mov edx,eax + mov esi,[finish] + .lp: + add esi,[dirs+edx*4] + cmp byte[field+esi],0 + jnz .exlp + mov eax,[finish] + mov ebx,esi + call get_offset + cmp eax,edx + jne .exlp + mov byte[field+esi],0xf + inc ecx + mov [finish],esi + jmp .lp + + .exlp: + jecxz .ex + mov eax,edx + mov edi,[cur_step] + stosb + mov [edi],cl + inc edi + mov [cur_step],edi + inc [stepptr] + mov edi,field + mov ecx,[cell_count] + xor eax,eax + repne scasb + je .ch_deadend + mov [win_flag],1 + .ex: + ret + .ch_deadend: + mov ecx,4 + mov edx,dirs + .lpp: + mov eax,[finish] + mov ebx,[edx] + add ebx,eax + push ebx + call get_offset + pop ebx + cmp eax,-1 + je .nxtlp + cmp byte[field+ebx],0 + jz .ex + .nxtlp: + add edx,4 + loop .lpp + mov [win_flag],4 + ret + +FH_level: +file 'fhouse.bin' + +if lang eq ru_RU + FH_help mstr \ + ' 砫 ஢',\ + ', 室 १ ⪨ ',\ + ' ࠧ.',\ + ' ࠧ אַ,',\ + '⠭ ⮫쪮 , । 묨',\ + '⠬ 㦥 饭묨 ⪠.','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + FH_help mstr \ + 'For each puzzle find the starting square and draw',\ + 'a path moving horizontally and vertically that',\ + 'passes through each open square exactly once.','',\ + 'At each move the red runner will always run',\ + 'straight, as far as possible, stopping only when',\ + "blocked by the grid's edge, a black square, or a",\ + 'square already visited.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/loops.inc b/programs/games/megamaze/trunk/loops.inc index 7a723635e..f22a24c7e 100644 --- a/programs/games/megamaze/trunk/loops.inc +++ b/programs/games/megamaze/trunk/loops.inc @@ -1,245 +1,247 @@ -LP_levelp: - mcall 40,100111b - inc [drag_flag] - lodsb - lodsw - mov byte[fx],al - mov byte[fy],ah - and dword[player],0 - and dword[finish],0 - call get_xy_sf.count - call erase_field -; mov [levptr],esi - .bit2: - mov edx,8/2 - mov edi,field - lodsb - mov ecx,[cell_count] - .lp: - mov bl,al - rol al,2 - and bl,11000000b - mov [edi],bl - inc edi - dec edx - test edx,edx - jnz .nxt - mov edx,8/2 - lodsb - .nxt: - loop .lp - ret - -LP_key: - cmp eax,0 - jl LP_mouse - cmp eax,8 - jne .nobsp - cmp [stepptr],0 - jne .no1st - mov [jump],run.game - ret - .no1st: - mov [win_flag],0 - sub [cur_step],2 - mov esi,[cur_step] - mov edi,[finish] - mov eax,3 - movzx ebx,byte[esi] - sub eax,ebx - movzx ecx,byte[esi+1] - .lp0: - and byte[field+edi],0 - add edi,[dirs+eax*4] - loop .lp0 - mov [finish],edi - dec [stepptr] - ret - .nobsp: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - sub eax,176 - .ex: - ret - -LP_drawm: - and [pause_time],0 - mov ecx,[cell_count] - .lp: - push ecx - mov bl,byte[field+ecx-1] - push ebx - lea eax,[ecx-1] - mov ecx,eax - call get_xy - - mov al,bl - and al,0xf - test bl,11000000b - jnz .noempty - mov esi,LP_aw - mov ecx,11 - call LP_draw_alert - jmp .no - .noempty: - mov edx,0 - test bl,10000000b - je .stable - mov edx,0xffffff - mov esi,LP_aw - mov ecx,7 - jmp .d13 - .stable: - mov esi,LP_em - mov ecx,9 - .d13: - call LP_draw_alert - mcall 13,[lx],[ly] - .no: - mov esi,[esp+4] - dec esi - mov edi,esi - mov edx,0x0000FF - ; ecx - cell # - test byte[esp],10b - je .no_dn - add edi,[dirs+4*1] - call getline - .no_dn: - test byte[esp],1000b - je .no_right - mov edi,esi - add edi,[dirs+4*3] - call getline - .no_right: - pop ebx - pop ecx - .valid: - loop .lp2 - jmp .exlp - .lp2: - jmp .lp - .exlp: - - mov esi,[player] - mov edi,[finish] - cmp esi,edi - je .ex - mov edx,0x7777FF - call getline - .ex: - cmp [pause_time],0 - jne .ex2 - xor ecx,ecx - xor ebx,ebx - mov edx,5 -; eax - cur cell content, ebx - cell #, ecx - cell counter, edx - dir - .chwin: - movzx eax,byte[field+ebx] - and eax,0xf - btr eax,edx - bsf edx,eax - je .ex3 - inc ecx - add ebx,[dirs+edx*4] - jz .ex3 - xor edx,11b - jmp .chwin - .ex3: - cmp ecx,[cell_count] - jne .ex2 - mov [win_flag],1 - .ex2: - ret - -LP_mouse: - cmp [win_flag],1 - je .ex - mov [jump],still - mov edx,eax - call get_last_mclick - cmp edx,-2 - jne .no1st - test eax,eax - jnz .noempty - mov eax,[player] - mov ebx,[finish] - call get_offset - mov ecx,eax - mov edx,0x101 - shl dl,cl - xor ecx,11b - shl dh,cl - mov ecx,ebx - jecxz LP_drawm.ex2 - mov esi,[player] - .lp: - xor [field+esi],dl - add esi,[dirs+eax*4] - xor [field+esi],dh - loop .lp - xor ebx,ebx - .noempty: - mov [player],ebx - jmp .exx - .no1st: - test eax,eax - jz .ex - mov eax,[player] - push ebx - call get_offset - pop ebx - cmp eax,-1 - je .ex - .exx: - mov [finish],ebx - mov [jump],drw -; ud2 - .ex: - ret - - -LP_aw db 1001b,0110b -LP_em db 0000b,0001b,0010b,0100b,1000b -LP_ab db 0011b,0101b,1100b,1010b,1001b,0110b - -LP_draw_alert: -; al-cell, esi - ptr,ecx - len - .lp: - cmp al,[esi] - je .ex - inc esi - loop .lp - pusha - mov ebx,[lx] - mov ecx,[ly] - add ebx,4-2 shl 16 - add ecx,4-2 shl 16 - mcall 13,,,0xFFAAAA - mov [pause_time],eax - popa - .ex: - ret - -LP_level: -file 'loops.bin' - -if lang eq ru_RU - LP_help mstr \ - '१ ⪨ אַ㣮쭨 室',\ - '஢ . 室 १ ',\ - '㦮, 易 , 室',\ - '१ 㦮, 稢 ',\ - '. ⪠ ᥡ ',\ - '.','',\ - 'http://puzzleprograms.narod.ru' -else - LP_help mstr \ - 'You have to draw closed line over every grid',\ - 'cell. On black square line must turn, and it must',\ - 'go straight when over white square. The line may',\ - 'behave anyhow elsewhere.','',\ - 'http://puzzleprograms.narod.ru' -end if +; Language support for locales: ru_RU (CP866), en_US. + +LP_levelp: + mcall 40,100111b + inc [drag_flag] + lodsb + lodsw + mov byte[fx],al + mov byte[fy],ah + and dword[player],0 + and dword[finish],0 + call get_xy_sf.count + call erase_field +; mov [levptr],esi + .bit2: + mov edx,8/2 + mov edi,field + lodsb + mov ecx,[cell_count] + .lp: + mov bl,al + rol al,2 + and bl,11000000b + mov [edi],bl + inc edi + dec edx + test edx,edx + jnz .nxt + mov edx,8/2 + lodsb + .nxt: + loop .lp + ret + +LP_key: + cmp eax,0 + jl LP_mouse + cmp eax,8 + jne .nobsp + cmp [stepptr],0 + jne .no1st + mov [jump],run.game + ret + .no1st: + mov [win_flag],0 + sub [cur_step],2 + mov esi,[cur_step] + mov edi,[finish] + mov eax,3 + movzx ebx,byte[esi] + sub eax,ebx + movzx ecx,byte[esi+1] + .lp0: + and byte[field+edi],0 + add edi,[dirs+eax*4] + loop .lp0 + mov [finish],edi + dec [stepptr] + ret + .nobsp: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + sub eax,176 + .ex: + ret + +LP_drawm: + and [pause_time],0 + mov ecx,[cell_count] + .lp: + push ecx + mov bl,byte[field+ecx-1] + push ebx + lea eax,[ecx-1] + mov ecx,eax + call get_xy + + mov al,bl + and al,0xf + test bl,11000000b + jnz .noempty + mov esi,LP_aw + mov ecx,11 + call LP_draw_alert + jmp .no + .noempty: + mov edx,0 + test bl,10000000b + je .stable + mov edx,0xffffff + mov esi,LP_aw + mov ecx,7 + jmp .d13 + .stable: + mov esi,LP_em + mov ecx,9 + .d13: + call LP_draw_alert + mcall 13,[lx],[ly] + .no: + mov esi,[esp+4] + dec esi + mov edi,esi + mov edx,0x0000FF + ; ecx - cell # + test byte[esp],10b + je .no_dn + add edi,[dirs+4*1] + call getline + .no_dn: + test byte[esp],1000b + je .no_right + mov edi,esi + add edi,[dirs+4*3] + call getline + .no_right: + pop ebx + pop ecx + .valid: + loop .lp2 + jmp .exlp + .lp2: + jmp .lp + .exlp: + + mov esi,[player] + mov edi,[finish] + cmp esi,edi + je .ex + mov edx,0x7777FF + call getline + .ex: + cmp [pause_time],0 + jne .ex2 + xor ecx,ecx + xor ebx,ebx + mov edx,5 +; eax - cur cell content, ebx - cell #, ecx - cell counter, edx - dir + .chwin: + movzx eax,byte[field+ebx] + and eax,0xf + btr eax,edx + bsf edx,eax + je .ex3 + inc ecx + add ebx,[dirs+edx*4] + jz .ex3 + xor edx,11b + jmp .chwin + .ex3: + cmp ecx,[cell_count] + jne .ex2 + mov [win_flag],1 + .ex2: + ret + +LP_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + cmp edx,-2 + jne .no1st + test eax,eax + jnz .noempty + mov eax,[player] + mov ebx,[finish] + call get_offset + mov ecx,eax + mov edx,0x101 + shl dl,cl + xor ecx,11b + shl dh,cl + mov ecx,ebx + jecxz LP_drawm.ex2 + mov esi,[player] + .lp: + xor [field+esi],dl + add esi,[dirs+eax*4] + xor [field+esi],dh + loop .lp + xor ebx,ebx + .noempty: + mov [player],ebx + jmp .exx + .no1st: + test eax,eax + jz .ex + mov eax,[player] + push ebx + call get_offset + pop ebx + cmp eax,-1 + je .ex + .exx: + mov [finish],ebx + mov [jump],drw +; ud2 + .ex: + ret + + +LP_aw db 1001b,0110b +LP_em db 0000b,0001b,0010b,0100b,1000b +LP_ab db 0011b,0101b,1100b,1010b,1001b,0110b + +LP_draw_alert: +; al-cell, esi - ptr,ecx - len + .lp: + cmp al,[esi] + je .ex + inc esi + loop .lp + pusha + mov ebx,[lx] + mov ecx,[ly] + add ebx,4-2 shl 16 + add ecx,4-2 shl 16 + mcall 13,,,0xFFAAAA + mov [pause_time],eax + popa + .ex: + ret + +LP_level: +file 'loops.bin' + +if lang eq ru_RU + LP_help mstr \ + '१ ⪨ אַ㣮쭨 室',\ + '஢ . 室 १ ',\ + '㦮, 易 , 室',\ + '१ 㦮, 稢 ',\ + '. ⪠ ᥡ ',\ + '.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +else ; Default to en_US + LP_help mstr \ + 'You have to draw a closed line over every grid',\ + 'cell. On black square line must turn, and it must',\ + 'go straight when over white square. The line may',\ + 'behave anyhow elsewhere.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +end if diff --git a/programs/games/megamaze/trunk/marble.inc b/programs/games/megamaze/trunk/marble.inc index d8d61e614..df3c1ae30 100644 --- a/programs/games/megamaze/trunk/marble.inc +++ b/programs/games/megamaze/trunk/marble.inc @@ -1,138 +1,140 @@ -; level format -; [fx|fy][hole xy][balls #]..[1-red,0-black xy]..[maze walls] - -; internal format -; [stepptr]= balls # -; [finish]= hole cell -; area: ..[1-red,0-black xy].. ( -1 if empty) - -MAR_levelp: - call get_xy_sf - movzx eax,byte[esi-2] - mov [finish],eax - movzx ecx,byte[esi-1] - mov [stepptr],ecx - mov edi,area - rep movsb - mov [pause_time],10 - call unpack_level - ret - -MAR_key: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov esi,area-1 - lea ebx,[eax-176] - .again: - and [cur_step],0 - mov ecx,[stepptr] - .lp: - movzx eax,byte[esi+ecx] - cmp al,-1 - je .ex1 - mov byte[player],al - and byte[player],0x80 - and eax,0x7f - call check_move - jc .ex1 - add eax,[dirs+ebx*4] - cmp eax,[finish] - jne .nohole - mov byte[esi+ecx],-1 - jmp .ex2 - .nohole: - push ecx - mov ecx,[stepptr] - mov edi,area - .lp2: - mov dl,[edi] - and dl,0x7f - cmp al,dl - je .exlp2 - inc edi - loop .lp2 - .exlp2: - pop ecx - je .ex1 - or al,byte[player] - mov [esi+ecx],al - .ex2: - inc [cur_step] - .ex1: - loop .lp - cmp [cur_step],0 - je .exx - call delay - call drwfld - jmp .again - .exx: - mov ecx,[stepptr] - inc esi - .lp3: - lodsb - cmp al,-1 - je .nxt - test al,0x80 - jne .ex - .nxt: - loop .lp3 - mov [win_flag],1 - .ex: - ret - -MAR_drawm: - shl [sq_size],1 - mov eax,[finish] - call get_xy - shr [sq_size],1 - mcall 13,[lx],[ly],0xa0a0a0 - movzx ecx,byte[stepptr] - mov edi,area - .lp: - push ecx - movzx eax,byte[edi] - mov edx,0x0 - cmp al,-1 - je .exlp - test eax,0x80 - je .no - mov edx,0xff00000 - .no: - and eax,0x7f - call get_xy - mcall 13,[lx],[ly] - .exlp: - pop ecx - inc edi - loop .lp - .ex: - ret - -MAR_level: -file 'marble.bin' - -if lang eq ru_RU - MAR_help mstr \ - '᪮쪮 襪 ᪥,',\ - 'ઠ 祭 ன ⪮. 誠',\ - '室 મ, 㤠 祧.',\ - 'ᯮ ५ ᪨.',\ - ' - 誨.',\ - '⢮ 㯠 襪 ஫ ࠥ.','',\ - 'http://www.clickmazes.com' -else - MAR_help mstr \ - 'Several red and black marbles sit on a flat tray,',\ - 'a grey square indicate a hole in the tray. If a',\ - 'marble rolls onto or over the hole it drops',\ - 'through and disappears. Use the cursor keys to',\ - 'tilt the tray and start the marbles rolling, the',\ - 'marbles roll in a straight line until they come',\ - 'to rest, you can then roll again. Your challenge',\ - 'is to drop all the red marbles, it does not',\ - 'matter how many black marbles you lose in the',\ - 'process.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +; level format +; [fx|fy][hole xy][balls #]..[1-red,0-black xy]..[maze walls] + +; internal format +; [stepptr]= balls # +; [finish]= hole cell +; area: ..[1-red,0-black xy].. ( -1 if empty) + +MAR_levelp: + call get_xy_sf + movzx eax,byte[esi-2] + mov [finish],eax + movzx ecx,byte[esi-1] + mov [stepptr],ecx + mov edi,area + rep movsb + mov [pause_time],10 + call unpack_level + ret + +MAR_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area-1 + lea ebx,[eax-176] + .again: + and [cur_step],0 + mov ecx,[stepptr] + .lp: + movzx eax,byte[esi+ecx] + cmp al,-1 + je .ex1 + mov byte[player],al + and byte[player],0x80 + and eax,0x7f + call check_move + jc .ex1 + add eax,[dirs+ebx*4] + cmp eax,[finish] + jne .nohole + mov byte[esi+ecx],-1 + jmp .ex2 + .nohole: + push ecx + mov ecx,[stepptr] + mov edi,area + .lp2: + mov dl,[edi] + and dl,0x7f + cmp al,dl + je .exlp2 + inc edi + loop .lp2 + .exlp2: + pop ecx + je .ex1 + or al,byte[player] + mov [esi+ecx],al + .ex2: + inc [cur_step] + .ex1: + loop .lp + cmp [cur_step],0 + je .exx + call delay + call drwfld + jmp .again + .exx: + mov ecx,[stepptr] + inc esi + .lp3: + lodsb + cmp al,-1 + je .nxt + test al,0x80 + jne .ex + .nxt: + loop .lp3 + mov [win_flag],1 + .ex: + ret + +MAR_drawm: + shl [sq_size],1 + mov eax,[finish] + call get_xy + shr [sq_size],1 + mcall 13,[lx],[ly],0xa0a0a0 + movzx ecx,byte[stepptr] + mov edi,area + .lp: + push ecx + movzx eax,byte[edi] + mov edx,0x0 + cmp al,-1 + je .exlp + test eax,0x80 + je .no + mov edx,0xff00000 + .no: + and eax,0x7f + call get_xy + mcall 13,[lx],[ly] + .exlp: + pop ecx + inc edi + loop .lp + .ex: + ret + +MAR_level: +file 'marble.bin' + +if lang eq ru_RU + MAR_help mstr \ + '᪮쪮 襪 ᪥,',\ + 'ઠ 祭 ன ⪮. 誠',\ + '室 મ, 㤠 祧.',\ + 'ᯮ ५ ᪨.',\ + ' - 誨.',\ + '⢮ 㯠 襪 ஫ ࠥ.','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + MAR_help mstr \ + 'Several red and black marbles sit on a flat tray,',\ + 'a grey square indicate a hole in the tray. If a',\ + 'marble rolls onto or over the hole it drops',\ + 'through and disappears. Use the cursor keys to',\ + 'tilt the tray and start the marbles rolling, the',\ + 'marbles roll in a straight line until they come',\ + 'to rest, you can then roll again. Your challenge',\ + 'is to drop all the red marbles, it does not',\ + 'matter how many black marbles you lose in the',\ + 'process.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/megamaze.asm b/programs/games/megamaze/trunk/megamaze.asm index 7b3a1aa61..0fc696781 100644 --- a/programs/games/megamaze/trunk/megamaze.asm +++ b/programs/games/megamaze/trunk/megamaze.asm @@ -1,857 +1,867 @@ -IDA equ 1 ; We're running debugida.exe - -STRIP equ 40 -LEVNUM equ 500 - XFOFS equ 10 - YFOFS equ 55 - MSGXO equ 32 -GAMES_ALL equ 12 -WNDCOLOR equ 0x13c0c0c0;0x13f6f6f6; -MINCS equ 40 -MAXCS equ 80 -macro icall lbl -{ - call [lbl+ebp*4] -} - - use32 - org 0x0 - - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd run ; start of code - dd I_END ; size of image - dd end_mem ; memory for app - dd stack_end ; esp - dd 0x0 , 0x0 ; I_Param , I_Icon -lang fix ru_RU -include "macros.inc" -purge mov -;include "../../../debug.inc" -COLOR_ORDER equ MENUETOS - -include 'gif_lite.inc' - -include 'tam.inc' -include 'smz.inc' -include 'tilt.inc' -include 'tilt2.inc' -include 'fhouse.inc' -include 'loops.inc' -include 'wriggle.inc' -include 'blackbox.inc' -include 'marble.inc' -include 'cstep.inc' -include 'orient.inc' -include 'nolt.inc' -include 'colzone.inc' - -run: - mov [Ces],STRIP;20 - mcall 3 - mov cl,16 - ror eax,cl - mov [generator],eax ; random generator from Tetris - - and [mpress_flag],0 - and [gif_unp],0 - xor ebp,ebp ; game_t -; mov ebp,10 - mcall 64,1,end_mem - mov [pause_time],40 - call resize - .game1: - mov [levnum],LEVNUM - .game: - and [win_flag],0 - and [drag_flag],0 - mov ecx,[levnum] - mov esi,[levels+ebp*4] - jecxz .skip - .nxt: - movzx eax,byte[esi] - add esi,eax - xor eax,eax - cmp al,byte[esi] - jne .noz - mov esi,LEVNUM;500 - sub esi,ecx - mov [levcount],esi - and [levnum],0 - jmp .game - .noz: - loop .nxt - .skip: - mcall 40,111b - mov [mouse_processed],1 - xor eax,eax - icall prepare_level -wnd_size: - mov eax,[Ces] - shr eax,2 - sub eax,2 - mov [sq_size],eax - if ~ IDA eq 1 - mov edx,[fx] - imul edx,[Ces] - add edx,XFOFS*2+20 - mov esi,[fy] - imul esi,[Ces] - add esi,YFOFS+30 - mov ecx,-1 - mcall 67,ecx - end if -red: - call draw_window - -drw: - call drwfld - -still: - mcall 2 - test al,al - jz still - mcall 10 - cmp eax,2 - je key - cmp eax,1 ; redraw request ? - je red - cmp eax,3 ; button in buffer ? - je button - cmp eax,6 ; mouse event ? - je mouse -key: - mcall 2 -; movzx ebx,ah -; dpd ebx - cmp ebp,10 - je .noplus - mov ebx,5 - cmp ah,184 - jne .nomin - cmp [Ces],MINCS - je still - .ces: - sub [Ces],ebx - call resize - jmp wnd_size - .nomin: - cmp ah,183 - jne .noplus - cmp [Ces],MAXCS - je still - neg ebx - jmp .ces - .noplus: - cmp ah,'h' - jne .nohlp -; if IDA eq 1 -; cmp [child],0 -; jne still -; else - call kill_help -; end if - mov [pack],ebp - mcall 51,1,show_help,chs_end -; dpd eax - mov [child],eax - jmp still - .nohlp: - cmp [win_flag],10 - je .levover - cmp [win_flag],2 - je .no_win - cmp [win_flag],1 - jne .now - .levover: - call lev_next - .no_win: - and [win_flag],al - jmp run.game - .now: - shr eax,8 - mov [jump],drw;red - cmp eax,13 - je run.game - icall key_handler - jmp [jump] - -button: - mcall 17 - cmp ah,1 - je close - cmp ah,2 - je .game_type - cmp ah,4 - je .inclev - cmp ah,3 - je .declev - jmp still - .declev: - dec [levnum] - cmp [levnum],0 - jge run.game - push [levcount] - pop [levnum] - jmp run.game - .inclev: - call lev_next - jmp run.game - .game_type: - inc ebp - cmp ebp,GAMES_ALL - jbe run.game1 - xor ebp,ebp - jmp run.game1 - close: - if ~ IDA eq 1 - call kill_help - end if - mcall -1 - -;if ~ IDA eq 1 - -kill_help: - mcall 9,prc_info2,-1 - mov edx,[child] - mov ecx,eax - .lp: - mcall 9 - cmp edx,[ebx+30] - jne .nochild - mcall 18,2 - and [child],0 - ret - .nochild: - loop .lp - ret - -;end if - -mouse: - cmp [mouse_processed],1 - jne .ex - mcall 37,1 - sub eax,XFOFS shl 16+YFOFS - xor edx,edx - mov ebx,[Ces] - mov ecx,eax - and eax,0xffff - div ebx - xor edx,edx - mov [mouse_y],eax - cmp eax,[fy] - jae .ex - mov eax,ecx - shr eax,16 - div ebx - mov [mouse_x],eax - cmp eax,[fx] - jae .ex - mcall 37,2 ; get buttons - cmp [drag_flag],0 - je .nodrag - mov ebx,eax - cmp eax,[mpress_flag] - mov eax,-1 - je .nochg - dec eax - .nochg: - mov [mpress_flag],ebx - jmp .call_hnd - .nodrag: - test eax,eax - jz .ex1 - cmp eax,[mpress_flag] - je .ex - mov [mpress_flag],eax - mov eax,-1 - .call_hnd: - mov [mouse_processed],0 - icall key_handler - jmp [jump] - .ex1: - mov [mpress_flag],0 - .ex: - jmp still - -lev_next: - push eax - inc [levnum] - mov eax,[levnum] - cmp eax,[levcount] - jbe .ex - and [levnum],0 - .ex: - pop eax - ret -;--------------------------------------------------------------------- -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* -draw_window: - pusha - mcall 12,1 - mov ebx,[fx] - imul ebx,[Ces] - push ebx - add ebx,50 shl 16+XFOFS*2+20 - mov ecx,[fy] - imul ecx,[Ces] - add ecx,10 shl 16+YFOFS+30 - mov edx, WNDCOLOR - mov edi, header - mcall 0 - - mov esi, edx - and esi,0xffffff - mcall 9,prc_info,-1 - pop ebx - - mov eax,[prc_info+70] ;status of window - test eax,100b - jne .end - - add ebx,XFOFS shl 16 - - mcall 8,,<25,12>,2 - - mcall 8,,<40,12>,3 - add ebx,13 shl 16 - inc edx - mcall - - mov ecx,ebp - mov edx,game_names+4 - call get_mstr - mcall 4,,0x8000 - imul esi,6 - add esi,3 - shl esi,16 - lea edx,[ebx+esi] - mcall 47,0x020001,levnum,,0x8000 - - mcall 4,,0x108000,next_msg,3 -.end: - mcall 12,2 - popa - ret -;--------------------------------------------------------------------- -unpack_level: - mov ecx,[cell_count] - mov edi,field - .lp: - movzx eax,byte[esi] - inc esi - shl ax,4 - shr al,4 - stosw - loop .lp - ret -;--------------------------------------------------------------------- -get_xy: -; eax-coord -; out: [lx]-[x+2][CS-4],[ly]-[y+2][CS-4] - pusha - xor edx,edx - mov esi,[sq_size] - lea edi,[esi*2] - neg edi - add edi,[Ces] - mov [lx],edi - mov [ly],edi - mov ebx,[fx] - div bx - imul eax,[Ces] - imul edx,[Ces] - lea edx,[edx+XFOFS+esi] - lea eax,[eax+YFOFS+esi] - mov word[ly+2],ax - mov word[lx+2],dx - popa - ret - -check_move: -; eax-coord, ebx-direction -; CF=0 if move is valid - bt dword[field+eax],ebx - ret - -delay: - pusha - mcall 5,[pause_time] - popa - ret - -get_mstr: -; in: edx,ecx -; out: edx,esi - mov esi,[edx-4] - jecxz .ex - lea edx,[edx+esi+4] - dec ecx - jmp get_mstr - .ex: - ret - -maze_field: - mov edi,field - mov [ly],YFOFS shl 16+YFOFS - mov eax,38 - mov ecx,[fy] - .lp1: - push ecx - mov [lx],XFOFS shl 16+XFOFS - mov ecx,[fx] - .lp2: - push ecx - xor esi,esi - .lp3: - mov edx,0xd0d0d0 - bt dword[edi],esi - jnc .gray - mov edx,0 - .gray: - mov ebx,[lx] - add ebx,[dir_ofs+esi*4] - mov ecx,[ly] - add ecx,[dir_ofs+esi*4+8] - mcall - inc esi - cmp esi,4 - jb .lp3 - inc edi - mov ecx,[Ces] - add word[lx],cx - add word[lx+2],cx - pop ecx - loop .lp2 - mov ecx,[Ces] - add word[ly],cx - add word[ly+2],cx - pop ecx - loop .lp1 - ret - -grid_field: - mov edx,0xa0a0a0 - mov eax,38 - - mov ecx,[fy] - mov ebx,[fx] - imul ebx,[Ces] - add ebx,XFOFS shl 16+XFOFS - mov esi,YFOFS shl 16+YFOFS - inc ecx - .lp1: - push ecx - mov ecx,esi - mcall - mov ecx,[Ces] - add esi,ecx - shl ecx,16 - add esi,ecx - pop ecx - loop .lp1 - - mov ecx,[fx] - mov esi,[fy] - imul esi,[Ces] - add esi,YFOFS shl 16+YFOFS - mov ebx,XFOFS shl 16+XFOFS - inc ecx - .lp2: - push ecx - mov ecx,esi - mcall - mov ecx,[Ces] - add ebx,ecx - shl ecx,16 - add ebx,ecx - pop ecx - loop .lp2 - ret - -get_xy_sf: - xor eax,eax - and [player],eax - mov [fx],eax - mov [fy],eax - lodsb - lodsb - mov ah,al - shr ah,4 - and al,0xf - mov byte[fx],ah - mov byte[fy],al - lodsb - mov byte[player],al - lodsb - mov byte[finish],al - .count: - mov eax,[fx] - mov [dirs+4],eax - neg eax - mov [dirs+8],eax - mov eax,[fx] - imul eax,[fy] - mov [cell_count],eax - - ret - -get_last_mclick: -; out - eax=0 no click or outside field -; eax>0 button pressed, ebx=[xy] - mov [mouse_processed],1 - mov eax,[mpress_flag] - mov ebx,[mouse_y] - imul ebx,[fx] - add ebx,[mouse_x] - ret - -erase_field: - pusha - mov ecx,[cell_count] - xor eax,eax - mov edi,field - rep stosb - popa - ret - -get_pxy: -; in: [pack] - cell#, out: word[pack] - packed [xy] - pusha - mov eax,[pack] - cdq - mov ebx,[fx] - div ebx - shl edx,8 - add eax,edx - mov [pack],eax - popa - ret - -check_bounds: -; in: eax - cell, ebx - dir -; out: ebx=-1 if bounds crossed - push eax ecx - mov ecx,eax - add ecx,[dirs+ebx*4] - mov ebx,ecx - call get_offset - mov ebx,eax - pop ecx eax - cmp ebx,-1 - ret - -get_offset: -; in: eax - start, ebx-end -; out: eax - dir or -1 if not straight -; ebx - distance - push ecx edx - mov ecx,-1 - mov edx,[cell_count] - cmp eax,edx - jae .ex - cmp ebx,edx - jae .ex - mov [pack],eax - call get_pxy - mov eax,[pack] - mov [pack],ebx - call get_pxy - mov ebx,[pack] - cmp ah,bh ; compare X - jne .noX - mov ecx,1 - sub bl,al - ja .ok - inc ecx - .ok2: - neg bl - jmp .ok - .noX: - cmp al,bl ; compare Y - jne .ex - inc ecx - sub bh,ah - mov bl,bh - jb .ok2 - add ecx,3 - .ok: - movzx ebx,bl - .ex: - mov eax,ecx - pop edx ecx - ret - -show_help: - mov ebp,[pack] - .red: - mcall 12,1 - mov ebx,[prc_info.box.left] - add ebx,[prc_info.box.width] - shl ebx,16 - add ebx,310 - mov ecx,[prc_info.box.top] - shl ecx,16 - add ecx,220 - mcall 0,,,0x03c0c0c0 - mcall 4,<8,8>,0x00ffffff,help_hdr,help_hdr.size - mov ecx,ebp - mov edx,game_names+4 - call get_mstr - sub esi,2 - mcall 4,<6*help_hdr.size+15,8>,0x00ffffff - - mov edx,[help_msg+ebp*4] - add edx,4 - xor ecx,ecx - mov ebx,10 shl 16+30 - .nxt: - mov esi,[edx-4] - jecxz .drw - dec ecx - lea edx,[edx+esi+4] - jmp .nxt - .drw: - cmp esi,-1 - je .edraw - mcall ,,0x000000ff - mov ecx,1 - add ebx,12 - jmp .nxt - .edraw: - mcall 12,2 - .still: - mcall 10 - cmp eax,2 - jne .nokey - mcall - jmp .close - .nokey: - cmp eax,1 ; redraw request ? - je .red - cmp eax,3 ; button in buffer ? - jne .still - mcall 17 - cmp ah,1 - jne .still - .close: - and [child],0 - mcall -1 - -getline: -; in: esi,edi - pusha - mov eax,esi - call get_xy - mov ebx,[lx] - mov ecx,[ly] - mov eax,edi - call get_xy - mov bx,word[lx+2] - mov cx,word[ly+2] - mov eax,[Ces] - shr eax,1 - sub eax,[sq_size] - add ebx,eax - add ecx,eax - shl eax,16 - add ebx,eax - add ecx,eax - mov [lx],ebx - mov [ly],ecx - mcall 38 - popa - ret - -bold_line: - WGSPC equ 1 - pusha - mov edi,WGSPC shl 16+WGSPC - add [lx],edi - add [ly],edi - mcall 38,[lx],[ly] - shl edi,1 - sub ebx,edi - sub ecx,edi - mcall - popa - ret - -get_rnd: - mov eax, [generator] - sub eax,0x43ab45b5 ; next random number - ror eax,1 - xor eax,0x32c4324f - ror eax,1 - mov [generator],eax - ret - -drwfld: - pusha - mov ebx,[fx] - imul ebx,[Ces] - add ebx,XFOFS shl 16 - mov ecx,[fy] - imul ecx,[Ces] - add ecx,YFOFS shl 16 - mcall 13,,,WNDCOLOR - add ebx,26 shl 16-26 - sub ecx,16 shl 16 - mov cx,16 - mcall - icall draw_field - icall draw_more - cmp [win_flag],0 - jz .edraw - movzx ecx,[win_flag] - mov edx,msgs+4 - call get_mstr - mcall 4,,0x100000ff - .edraw: - popa - ret - -resize: - mov eax,[Ces] - mov edi,dir_ofs+4 - stosd - stosd - stosw - stosw - mov [edi+4],eax - ret - -need_image: -; in: eax - gif pointer - cmp [gif_unp],0 - jne .skip - push esi edi - mov esi,eax - mov eax,field - mov edi,raw_area - call ReadGIF - mov [gif_unp],1 - pop edi esi - .skip: - ret - -out_image: -; in: eax - coord, ebx - image # - -STRIP2 = STRIP-2 - pusha - call get_xy - mov edx,[lx] - mov dx,word[ly+2] - add edx,1 shl 16+1 - imul ebx,STRIP2*STRIP2*3 - add ebx,raw_area+12 - mcall 7,,STRIP2 shl 16+STRIP2 - popa - ret - -OR_strip: -file 'orientg2.gif' - rd 2 - gif_unp dd 0 - -; DATA AREA -help_hdr db 'MegaMaze Help -' - .size=$-help_hdr - -dirs dd -1,0,0,1 -dir_ofs dd 0, 1, 1, 1 shl 16+1, 0, 1 - -dir_rotate db 2,0,3,1,1,3,0,2 - -w_colors dd 0x0404CA,0xCC0404,0x00CC00 -f_colors dd 0x9494FC,0xFC9494,0x99FF99,0xFFFF00 - -levnum dd LEVNUM - -prepare_level dd TM_levelp,SMZ_levelp,TILT_levelp,TILT2_levelp,FH_levelp,\ - LP_levelp,WG_levelp,BB_levelp,MAR_levelp,TM_levelp,OR_levelp,NLT_levelp,\ - CZ_levelp -key_handler dd TM_key,SMZ_key,TILT_key,TILT2_key,FH_key,LP_key,WG_key,BB_key,\ - MAR_key,CSTEP_key,OR_key,NLT_key,CZ_key -draw_more dd TM_drawm,SMZ_drawm,TILT_drawm,TILT2_drawm,FH_drawm,LP_drawm,\ - WG_drawm,BB_drawm,MAR_drawm,CSTEP_drawm,OR_drawm,NLT_drawm,CZ_drawm -draw_field dd maze_field,maze_field,maze_field,maze_field,grid_field,\ - grid_field,grid_field,grid_field,maze_field,maze_field,OR_drawf,maze_field,\ - grid_field -levels dd TM_level,SMZ_level,TILT_level,TILT2_level,FH_level,LP_level,\ - WG_level,BB_level,MAR_level,CSTEP_level,OR_level,NLT_level,CZ_level -help_msg dd TM_help,SMZ_help,TILT_help,TILT2_help,FH_help,LP_help,WG_help,\ - BB_help,MAR_help,CSTEP_help,OR_help,NLT_help,CZ_help - -header db 'Mega Maze', 0 - -next_msg db '< >' - -game_names mstr \ - 'Teseus & Minotaur #',\ - '1-2-3 Maze #',\ - 'Tilt Maze #',\ - 'Double Tilt #',\ - 'Full-house #',\ - 'Loops #',\ - 'Wriggle #',\ - 'BlackBox #',\ - 'Marble #',\ - 'Counter Step #',\ - 'Orientation #',\ - 'No left turn #',\ - 'Colour-zone #' - -msgs mstr ' ','You win!!!','Game over.','Start cell?','Dead end!',\ - " atoms hidden.",'Ray emerged.','Ray absorbed.','Ray reflected.',\ - 'Mark exactly guesses','Your score is','Guess mark toggled' - -I_END: -main_pid dd ? -child_stack rb 256 - chs_end: -drag_flag db ? -sq_size dd ? -mouse_processed dd ? -mpress_flag dd ? -mouse_x dd ? -mouse_y dd ? - -Ces dd ? -pack dd ? -fy dd ? -fx dd ? -lx dd ? -ly dd ? -generator dd ? -cell_count dd ? -levptr dd ? -levcount dd ? - -score dd ? -player: -teseus dd ? -finish: -minotaur dd ? - -stepptr dd ? -cur_step dd ? - -win_flag db ? -jump dd ? -pause_time dd ? -child dd ? -area rb 1024 -stak rb 1024 -stack_end: -prc_info process_information -prc_info2 process_information -field: - rb 128*128 -raw_area: - rb STRIP*STRIP*12*3+16 -end_mem: +IDA equ 1 ; We're running debugida.exe + +STRIP equ 40 +LEVNUM equ 500 + XFOFS equ 10 + YFOFS equ 55 + MSGXO equ 32 +GAMES_ALL equ 12 +WNDCOLOR equ 0x13c0c0c0;0x13f6f6f6; +MINCS equ 40 +MAXCS equ 80 +macro icall lbl +{ + call [lbl+ebp*4] +} + + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd run ; start of code + dd I_END ; size of image + dd end_mem ; memory for app + dd stack_end ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon +lang fix ru_RU ; TODO: Include lang.inc here? Currently in game text (below) is en_US. +include "macros.inc" +purge mov +;include "../../../debug.inc" +COLOR_ORDER equ MENUETOS + +include 'gif_lite.inc' + +include 'tam.inc' +include 'smz.inc' +include 'tilt.inc' +include 'tilt2.inc' +include 'fhouse.inc' +include 'loops.inc' +include 'wriggle.inc' +include 'blackbox.inc' +include 'marble.inc' +include 'cstep.inc' +include 'orient.inc' +include 'nolt.inc' +include 'colzone.inc' + +run: + mov [Ces],STRIP;20 + mcall 3 + mov cl,16 + ror eax,cl + mov [generator],eax ; random generator from Tetris + + and [mpress_flag],0 + and [gif_unp],0 + xor ebp,ebp ; game_t +; mov ebp,10 + mcall 64,1,end_mem + mov [pause_time],40 + call resize + .game1: + mov [levnum],LEVNUM + .game: + and [win_flag],0 + and [drag_flag],0 + mov ecx,[levnum] + mov esi,[levels+ebp*4] + jecxz .skip + .nxt: + movzx eax,byte[esi] + add esi,eax + xor eax,eax + cmp al,byte[esi] + jne .noz + mov esi,LEVNUM;500 + sub esi,ecx + mov [levcount],esi + and [levnum],0 + jmp .game + .noz: + loop .nxt + .skip: + mcall 40,111b + mov [mouse_processed],1 + xor eax,eax + icall prepare_level +wnd_size: + mov eax,[Ces] + shr eax,2 + sub eax,2 + mov [sq_size],eax + if ~ IDA eq 1 + mov edx,[fx] + imul edx,[Ces] + add edx,XFOFS*2+20 + mov esi,[fy] + imul esi,[Ces] + add esi,YFOFS+30 + mov ecx,-1 + mcall 67,ecx + end if +red: + call draw_window + +drw: + call drwfld + +still: + mcall 2 + test al,al + jz still + mcall 10 + cmp eax,2 + je key + cmp eax,1 ; redraw request ? + je red + cmp eax,3 ; button in buffer ? + je button + cmp eax,6 ; mouse event ? + je mouse +key: + mcall 2 +; movzx ebx,ah +; dpd ebx + cmp ebp,10 + je .noplus + mov ebx,5 + cmp ah,184 + jne .nomin + cmp [Ces],MINCS + je still + .ces: + sub [Ces],ebx + call resize + jmp wnd_size + .nomin: + cmp ah,183 + jne .noplus + cmp [Ces],MAXCS + je still + neg ebx + jmp .ces + .noplus: + cmp ah,'h' + jne .nohlp +; if IDA eq 1 +; cmp [child],0 +; jne still +; else + call kill_help +; end if + mov [pack],ebp + mcall 51,1,show_help,chs_end +; dpd eax + mov [child],eax + jmp still + .nohlp: + cmp [win_flag],10 + je .levover + cmp [win_flag],2 + je .no_win + cmp [win_flag],1 + jne .now + .levover: + call lev_next + .no_win: + and [win_flag],al + jmp run.game + .now: + shr eax,8 + mov [jump],drw;red + cmp eax,13 + je run.game + icall key_handler + jmp [jump] + +button: + mcall 17 + cmp ah,1 + je close + cmp ah,2 + je .game_type + cmp ah,4 + je .inclev + cmp ah,3 + je .declev + jmp still + .declev: + dec [levnum] + cmp [levnum],0 + jge run.game + push [levcount] + pop [levnum] + jmp run.game + .inclev: + call lev_next + jmp run.game + .game_type: + inc ebp + cmp ebp,GAMES_ALL + jbe run.game1 + xor ebp,ebp + jmp run.game1 + close: + if ~ IDA eq 1 + call kill_help + end if + mcall -1 + +;if ~ IDA eq 1 + +kill_help: + mcall 9,prc_info2,-1 + mov edx,[child] + mov ecx,eax + .lp: + mcall 9 + cmp edx,[ebx+30] + jne .nochild + mcall 18,2 + and [child],0 + ret + .nochild: + loop .lp + ret + +;end if + +mouse: + cmp [mouse_processed],1 + jne .ex + mcall 37,1 + sub eax,XFOFS shl 16+YFOFS + xor edx,edx + mov ebx,[Ces] + mov ecx,eax + and eax,0xffff + div ebx + xor edx,edx + mov [mouse_y],eax + cmp eax,[fy] + jae .ex + mov eax,ecx + shr eax,16 + div ebx + mov [mouse_x],eax + cmp eax,[fx] + jae .ex + mcall 37,2 ; get buttons + cmp [drag_flag],0 + je .nodrag + mov ebx,eax + cmp eax,[mpress_flag] + mov eax,-1 + je .nochg + dec eax + .nochg: + mov [mpress_flag],ebx + jmp .call_hnd + .nodrag: + test eax,eax + jz .ex1 + cmp eax,[mpress_flag] + je .ex + mov [mpress_flag],eax + mov eax,-1 + .call_hnd: + mov [mouse_processed],0 + icall key_handler + jmp [jump] + .ex1: + mov [mpress_flag],0 + .ex: + jmp still + +lev_next: + push eax + inc [levnum] + mov eax,[levnum] + cmp eax,[levcount] + jbe .ex + and [levnum],0 + .ex: + pop eax + ret +;--------------------------------------------------------------------- +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* +draw_window: + pusha + mcall 12,1 + mov ebx,[fx] + imul ebx,[Ces] + push ebx + add ebx,50 shl 16+XFOFS*2+20 + mov ecx,[fy] + imul ecx,[Ces] + add ecx,10 shl 16+YFOFS+30 + mov edx, WNDCOLOR + mov edi, header + mcall 0 + + mov esi, edx + and esi,0xffffff + mcall 9,prc_info,-1 + pop ebx + + mov eax,[prc_info+70] ;status of window + test eax,100b + jne .end + + add ebx,XFOFS shl 16 + + mcall 8,,<25,12>,2 + + mcall 8,,<40,12>,3 + add ebx,13 shl 16 + inc edx + mcall + + mov ecx,ebp + mov edx,game_names+4 + call get_mstr + mcall 4,,0x8000 + imul esi,6 + add esi,3 + shl esi,16 + lea edx,[ebx+esi] + mcall 47,0x020001,levnum,,0x8000 + + mcall 4,,0x108000,next_msg,3 +.end: + mcall 12,2 + popa + ret +;--------------------------------------------------------------------- +unpack_level: + mov ecx,[cell_count] + mov edi,field + .lp: + movzx eax,byte[esi] + inc esi + shl ax,4 + shr al,4 + stosw + loop .lp + ret +;--------------------------------------------------------------------- +get_xy: +; eax-coord +; out: [lx]-[x+2][CS-4],[ly]-[y+2][CS-4] + pusha + xor edx,edx + mov esi,[sq_size] + lea edi,[esi*2] + neg edi + add edi,[Ces] + mov [lx],edi + mov [ly],edi + mov ebx,[fx] + div bx + imul eax,[Ces] + imul edx,[Ces] + lea edx,[edx+XFOFS+esi] + lea eax,[eax+YFOFS+esi] + mov word[ly+2],ax + mov word[lx+2],dx + popa + ret + +check_move: +; eax-coord, ebx-direction +; CF=0 if move is valid + bt dword[field+eax],ebx + ret + +delay: + pusha + mcall 5,[pause_time] + popa + ret + +get_mstr: +; in: edx,ecx +; out: edx,esi + mov esi,[edx-4] + jecxz .ex + lea edx,[edx+esi+4] + dec ecx + jmp get_mstr + .ex: + ret + +maze_field: + mov edi,field + mov [ly],YFOFS shl 16+YFOFS + mov eax,38 + mov ecx,[fy] + .lp1: + push ecx + mov [lx],XFOFS shl 16+XFOFS + mov ecx,[fx] + .lp2: + push ecx + xor esi,esi + .lp3: + mov edx,0xd0d0d0 + bt dword[edi],esi + jnc .gray + mov edx,0 + .gray: + mov ebx,[lx] + add ebx,[dir_ofs+esi*4] + mov ecx,[ly] + add ecx,[dir_ofs+esi*4+8] + mcall + inc esi + cmp esi,4 + jb .lp3 + inc edi + mov ecx,[Ces] + add word[lx],cx + add word[lx+2],cx + pop ecx + loop .lp2 + mov ecx,[Ces] + add word[ly],cx + add word[ly+2],cx + pop ecx + loop .lp1 + ret + +grid_field: + mov edx,0xa0a0a0 + mov eax,38 + + mov ecx,[fy] + mov ebx,[fx] + imul ebx,[Ces] + add ebx,XFOFS shl 16+XFOFS + mov esi,YFOFS shl 16+YFOFS + inc ecx + .lp1: + push ecx + mov ecx,esi + mcall + mov ecx,[Ces] + add esi,ecx + shl ecx,16 + add esi,ecx + pop ecx + loop .lp1 + + mov ecx,[fx] + mov esi,[fy] + imul esi,[Ces] + add esi,YFOFS shl 16+YFOFS + mov ebx,XFOFS shl 16+XFOFS + inc ecx + .lp2: + push ecx + mov ecx,esi + mcall + mov ecx,[Ces] + add ebx,ecx + shl ecx,16 + add ebx,ecx + pop ecx + loop .lp2 + ret + +get_xy_sf: + xor eax,eax + and [player],eax + mov [fx],eax + mov [fy],eax + lodsb + lodsb + mov ah,al + shr ah,4 + and al,0xf + mov byte[fx],ah + mov byte[fy],al + lodsb + mov byte[player],al + lodsb + mov byte[finish],al + .count: + mov eax,[fx] + mov [dirs+4],eax + neg eax + mov [dirs+8],eax + mov eax,[fx] + imul eax,[fy] + mov [cell_count],eax + + ret + +get_last_mclick: +; out - eax=0 no click or outside field +; eax>0 button pressed, ebx=[xy] + mov [mouse_processed],1 + mov eax,[mpress_flag] + mov ebx,[mouse_y] + imul ebx,[fx] + add ebx,[mouse_x] + ret + +erase_field: + pusha + mov ecx,[cell_count] + xor eax,eax + mov edi,field + rep stosb + popa + ret + +get_pxy: +; in: [pack] - cell#, out: word[pack] - packed [xy] + pusha + mov eax,[pack] + cdq + mov ebx,[fx] + div ebx + shl edx,8 + add eax,edx + mov [pack],eax + popa + ret + +check_bounds: +; in: eax - cell, ebx - dir +; out: ebx=-1 if bounds crossed + push eax ecx + mov ecx,eax + add ecx,[dirs+ebx*4] + mov ebx,ecx + call get_offset + mov ebx,eax + pop ecx eax + cmp ebx,-1 + ret + +get_offset: +; in: eax - start, ebx-end +; out: eax - dir or -1 if not straight +; ebx - distance + push ecx edx + mov ecx,-1 + mov edx,[cell_count] + cmp eax,edx + jae .ex + cmp ebx,edx + jae .ex + mov [pack],eax + call get_pxy + mov eax,[pack] + mov [pack],ebx + call get_pxy + mov ebx,[pack] + cmp ah,bh ; compare X + jne .noX + mov ecx,1 + sub bl,al + ja .ok + inc ecx + .ok2: + neg bl + jmp .ok + .noX: + cmp al,bl ; compare Y + jne .ex + inc ecx + sub bh,ah + mov bl,bh + jb .ok2 + add ecx,3 + .ok: + movzx ebx,bl + .ex: + mov eax,ecx + pop edx ecx + ret + +show_help: + mov ebp,[pack] + .red: + mcall 12,1 + mov ebx,[prc_info.box.left] + add ebx,[prc_info.box.width] + shl ebx,16 + add ebx,310 + mov ecx,[prc_info.box.top] + shl ecx,16 + add ecx,220 + mcall 0,,,0x03c0c0c0 + mcall 4,<8,8>,0x00ffffff,help_hdr,help_hdr.size + mov ecx,ebp + mov edx,game_names+4 + call get_mstr + sub esi,2 + mcall 4,<6*help_hdr.size+15,8>,0x00ffffff + + mov edx,[help_msg+ebp*4] + add edx,4 + xor ecx,ecx + mov ebx,10 shl 16+30 + .nxt: + mov esi,[edx-4] + jecxz .drw + dec ecx + lea edx,[edx+esi+4] + jmp .nxt + .drw: + cmp esi,-1 + je .edraw + mcall ,,0x000000ff + mov ecx,1 + add ebx,12 + jmp .nxt + .edraw: + mcall 12,2 + .still: + mcall 10 + cmp eax,2 + jne .nokey + mcall + jmp .close + .nokey: + cmp eax,1 ; redraw request ? + je .red + cmp eax,3 ; button in buffer ? + jne .still + mcall 17 + cmp ah,1 + jne .still + .close: + and [child],0 + mcall -1 + +getline: +; in: esi,edi + pusha + mov eax,esi + call get_xy + mov ebx,[lx] + mov ecx,[ly] + mov eax,edi + call get_xy + mov bx,word[lx+2] + mov cx,word[ly+2] + mov eax,[Ces] + shr eax,1 + sub eax,[sq_size] + add ebx,eax + add ecx,eax + shl eax,16 + add ebx,eax + add ecx,eax + mov [lx],ebx + mov [ly],ecx + mcall 38 + popa + ret + +bold_line: + WGSPC equ 1 + pusha + mov edi,WGSPC shl 16+WGSPC + add [lx],edi + add [ly],edi + mcall 38,[lx],[ly] + shl edi,1 + sub ebx,edi + sub ecx,edi + mcall + popa + ret + +get_rnd: + mov eax, [generator] + sub eax,0x43ab45b5 ; next random number + ror eax,1 + xor eax,0x32c4324f + ror eax,1 + mov [generator],eax + ret + +drwfld: + pusha + mov ebx,[fx] + imul ebx,[Ces] + add ebx,XFOFS shl 16 + mov ecx,[fy] + imul ecx,[Ces] + add ecx,YFOFS shl 16 + mcall 13,,,WNDCOLOR + add ebx,26 shl 16-26 + sub ecx,16 shl 16 + mov cx,16 + mcall + icall draw_field + icall draw_more + cmp [win_flag],0 + jz .edraw + movzx ecx,[win_flag] + mov edx,msgs+4 + call get_mstr + mcall 4,,0x100000ff + .edraw: + popa + ret + +resize: + mov eax,[Ces] + mov edi,dir_ofs+4 + stosd + stosd + stosw + stosw + mov [edi+4],eax + ret + +need_image: +; in: eax - gif pointer + cmp [gif_unp],0 + jne .skip + push esi edi + mov esi,eax + mov eax,field + mov edi,raw_area + call ReadGIF + mov [gif_unp],1 + pop edi esi + .skip: + ret + +out_image: +; in: eax - coord, ebx - image # + +STRIP2 = STRIP-2 + pusha + call get_xy + mov edx,[lx] + mov dx,word[ly+2] + add edx,1 shl 16+1 + imul ebx,STRIP2*STRIP2*3 + add ebx,raw_area+12 + mcall 7,,STRIP2 shl 16+STRIP2 + popa + ret + +OR_strip: +file 'orientg2.gif' + rd 2 + gif_unp dd 0 + +; DATA AREA +help_hdr db 'MegaMaze Help -' + .size=$-help_hdr + +dirs dd -1,0,0,1 +dir_ofs dd 0, 1, 1, 1 shl 16+1, 0, 1 + +dir_rotate db 2,0,3,1,1,3,0,2 + +w_colors dd 0x0404CA,0xCC0404,0x00CC00 +f_colors dd 0x9494FC,0xFC9494,0x99FF99,0xFFFF00 + +levnum dd LEVNUM + +prepare_level dd TM_levelp,SMZ_levelp,TILT_levelp,TILT2_levelp,FH_levelp,\ + LP_levelp,WG_levelp,BB_levelp,MAR_levelp,TM_levelp,OR_levelp,NLT_levelp,\ + CZ_levelp +key_handler dd TM_key,SMZ_key,TILT_key,TILT2_key,FH_key,LP_key,WG_key,BB_key,\ + MAR_key,CSTEP_key,OR_key,NLT_key,CZ_key +draw_more dd TM_drawm,SMZ_drawm,TILT_drawm,TILT2_drawm,FH_drawm,LP_drawm,\ + WG_drawm,BB_drawm,MAR_drawm,CSTEP_drawm,OR_drawm,NLT_drawm,CZ_drawm +draw_field dd maze_field,maze_field,maze_field,maze_field,grid_field,\ + grid_field,grid_field,grid_field,maze_field,maze_field,OR_drawf,maze_field,\ + grid_field +levels dd TM_level,SMZ_level,TILT_level,TILT2_level,FH_level,LP_level,\ + WG_level,BB_level,MAR_level,CSTEP_level,OR_level,NLT_level,CZ_level +help_msg dd TM_help,SMZ_help,TILT_help,TILT2_help,FH_help,LP_help,WG_help,\ + BB_help,MAR_help,CSTEP_help,OR_help,NLT_help,CZ_help + +header db 'Mega Maze', 0 + +next_msg db '< >' + +; TODO: Translate in game text and support 'lang.inc'. Defaults to en_US. +game_names mstr \ + 'Teseus & Minotaur #',\ + '1-2-3 Maze #',\ + 'Tilt Maze #',\ + 'Double Tilt #',\ + 'Full-house #',\ + 'Loops #',\ + 'Wriggle #',\ + 'BlackBox #',\ + 'Marble #',\ + 'Counter Step #',\ + 'Orientation #',\ + 'No left turn #',\ + 'Colour-zone #' + +msgs mstr ' ',\ + 'You win!!!',\ + 'Game over.',\ + 'Start cell?',\ + 'Dead end!',\ + " atoms hidden.",\ + 'Ray emerged.',\ + 'Ray absorbed.',\ + 'Ray reflected.',\ + 'Mark exactly guesses',\ + 'Your score is',\ + 'Guess mark toggled' + +I_END: +main_pid dd ? +child_stack rb 256 + chs_end: +drag_flag db ? +sq_size dd ? +mouse_processed dd ? +mpress_flag dd ? +mouse_x dd ? +mouse_y dd ? + +Ces dd ? +pack dd ? +fy dd ? +fx dd ? +lx dd ? +ly dd ? +generator dd ? +cell_count dd ? +levptr dd ? +levcount dd ? + +score dd ? +player: +teseus dd ? +finish: +minotaur dd ? + +stepptr dd ? +cur_step dd ? + +win_flag db ? +jump dd ? +pause_time dd ? +child dd ? +area rb 1024 +stak rb 1024 +stack_end: +prc_info process_information +prc_info2 process_information +field: + rb 128*128 +raw_area: + rb STRIP*STRIP*12*3+16 +end_mem: diff --git a/programs/games/megamaze/trunk/nolt.inc b/programs/games/megamaze/trunk/nolt.inc index fe04cd131..332ff1ad7 100644 --- a/programs/games/megamaze/trunk/nolt.inc +++ b/programs/games/megamaze/trunk/nolt.inc @@ -1,92 +1,94 @@ -NLT_levelp: - mov eax,OR_strip - call need_image - xor eax,eax - lodsb - lodsb - mov [fx],eax - lodsb - mov [fy],eax - lodsw - mov [player],eax - mov dword[area],5 - lodsw - mov [finish],eax - call get_xy_sf.count - mov [levptr],esi - call unpack_level - ret - -NLT_key: - mov [jump],still - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - lea ebx,[eax-176] - mov eax,[player] - call check_move - jc .ex - mov ecx,ebx - mov edx,ebx - movzx ecx,byte[dir_rotate+ecx] - cmp ecx,dword[area] - je .ex - xor edx,11b - cmp edx,dword[area] - je .ex - add eax,[dirs+ebx*4] - mov dword[area],ebx - mov [player],eax - cmp eax,[finish] - jne .nowin - mov [win_flag],1 - .nowin: - mov [jump],drw - .ex: - ret - -NLT_drawm: - push [sq_size] - mov [sq_size],0 - mov eax,[finish] - mov ebx,6 - call out_image -; mcall 13,[lx],[ly],0xff0000 - mov ebx,dword[area] - cmp ebx,5 - jne .skip - mov eax,[player] - mov edi,eax - pop [sq_size] - call get_xy - mcall 13,[lx],[ly],0x8000 - jmp .ex - .skip: - add ebx,8 - mov eax,[player] - call out_image - pop [sq_size] - .ex: - ret - -NLT_level: -file 'nolt.bin' - -if lang eq ru_RU - NLT_help mstr \ - ' - ஢ ᭮',\ - ' . 㤭',\ - '祬 . : ᫨ ਬ 宥',\ - '襭, 㯨 㤥',\ - '㦤 ᭠砫.','',\ - 'http://puzzleprograms.narod.ru' -else - NLT_help mstr \ - 'Your challenge is to manouvre the green dot to',\ - 'the red square without ever turning left, or',\ - 'making a U-turn. Harder than it looks. Beware, if',\ - 'you make a bad decision in this maze you may get',\ - 'completely stuck and have to restart.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +NLT_levelp: + mov eax,OR_strip + call need_image + xor eax,eax + lodsb + lodsb + mov [fx],eax + lodsb + mov [fy],eax + lodsw + mov [player],eax + mov dword[area],5 + lodsw + mov [finish],eax + call get_xy_sf.count + mov [levptr],esi + call unpack_level + ret + +NLT_key: + mov [jump],still + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + lea ebx,[eax-176] + mov eax,[player] + call check_move + jc .ex + mov ecx,ebx + mov edx,ebx + movzx ecx,byte[dir_rotate+ecx] + cmp ecx,dword[area] + je .ex + xor edx,11b + cmp edx,dword[area] + je .ex + add eax,[dirs+ebx*4] + mov dword[area],ebx + mov [player],eax + cmp eax,[finish] + jne .nowin + mov [win_flag],1 + .nowin: + mov [jump],drw + .ex: + ret + +NLT_drawm: + push [sq_size] + mov [sq_size],0 + mov eax,[finish] + mov ebx,6 + call out_image +; mcall 13,[lx],[ly],0xff0000 + mov ebx,dword[area] + cmp ebx,5 + jne .skip + mov eax,[player] + mov edi,eax + pop [sq_size] + call get_xy + mcall 13,[lx],[ly],0x8000 + jmp .ex + .skip: + add ebx,8 + mov eax,[player] + call out_image + pop [sq_size] + .ex: + ret + +NLT_level: +file 'nolt.bin' + +if lang eq ru_RU + NLT_help mstr \ + ' - ஢ ᭮',\ + ' . 㤭',\ + '祬 . : ᫨ ਬ 宥',\ + '襭, 㯨 㤥',\ + '㦤 ᭠砫.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +else ; Default to en_US + NLT_help mstr \ + 'Your challenge is to manouvre the green dot to',\ + 'the red square without ever turning left, or',\ + 'making a U-turn. Harder than it looks. Beware, if',\ + 'you make a bad decision in this maze you may get',\ + 'completely stuck and have to restart.','',\ + 'http://www.clickmazes.com' ; FIXME: Why are links different? +end if diff --git a/programs/games/megamaze/trunk/orient.inc b/programs/games/megamaze/trunk/orient.inc index dae1fe631..dbaf2b0de 100644 --- a/programs/games/megamaze/trunk/orient.inc +++ b/programs/games/megamaze/trunk/orient.inc @@ -1,227 +1,229 @@ -; level format -; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] - -; internal format -; [stepptr]= worms # -; area: [worm_len][start_cell #][end_cell #]..[dirs].. -; [cur_step]: dragged worm pointer -; [finish]: 0 - if head dragged, 1- if tail - -OR_levelp: - mov [Ces],40 - mcall 40,100111b - inc [drag_flag] - mov eax,OR_strip - call need_image - inc esi - movzx ecx,byte[esi] - inc esi - push esi - mov esi,OR_maze - jecxz .sk - .nxtmz: - movzx eax,byte[esi] - add esi,eax - loop .nxtmz - .sk: - call get_xy_sf - call unpack_level - pop esi - movzx ecx,byte[esi] - inc esi - mov [cur_step],ecx - jecxz .sk2 - mov edi,area - rep movsb - .sk2: - mov ecx,[cell_count] - mov edi,area+16 - rep movsb - mov [stepptr],2 -; call erase_field -; ud2 - ret - -OR_key: - cmp eax,0 - jl OR_mouse - ret - -OR_drawf: - mov ecx,[cell_count] - push [sq_size] - mov [sq_size],0 - .lp: - push ecx - movzx ebx,byte[area+16+ecx-1] - cmp bl,0xf - je .no - lea eax,[ecx-1] - call out_image - .no: - pop ecx - loop .lp - pop [sq_size] - ret - -OR_drawm: - push [sq_size] - mov [sq_size],0 - mov eax,[player] - mov ebx,[stepptr] - add ebx,8 - call out_image - mov ecx,[cur_step] - jecxz .skipb - mov ebx,7 - mov esi,area - xor eax,eax - .nxtb: - lodsb - call out_image - loop .nxtb - .skipb: - mov eax,[player] - .again: - mov ebx,[stepptr] - call check_move - jc .ex - add eax,[dirs+ebx*4] - cmp byte[area+16+eax],6 - je .ex - mov ecx,[cur_step] - jecxz .skbchk - mov edi,area - repne scasb - je .again - .skbchk: - mov [sq_size],1 - push eax - call get_xy - mov ebx,[lx] - sub bx,2 - mov ecx,[ly] - mov cx,3 - mcall 13,,,0xFFC633 - xchg bx,cx - mcall - mov esi,[Ces] - sub esi,3+2 - shl esi,16 - push ebx - add ebx,esi - mcall - pop ebx - add ecx,esi - xchg bx,cx - add bx,2 - mcall - pop eax - jmp .again - .ex: - pop [sq_size] - ret - -OR_mouse: - cmp [win_flag],1 - je .ex - mov [jump],still - mov edx,eax - call get_last_mclick - cmp edx,-2 - jne .ex - test eax,eax - jnz .noempty - .drw: - mov [jump],drw - ret - .noempty: - -; First Click at ebx cell - mov eax,[player] - cmp eax,ebx - je OR_drawf - mov ecx,[cur_step] - jecxz .skbchk - mov edi,area - xchg eax,ebx - repne scasb - xchg eax,ebx - je OR_drawf - .skbchk: - cmp byte[area+16+ebx],0xf - je .ex - cmp byte[area+16+ebx],6 - je .ex - push eax - mov edx,ebx - call get_offset - mov ebx,eax - pop eax - cmp ebx,[stepptr] - jne .ex - - call check_move - jc .ex - movzx ecx,byte[area+16+edx] - cmp ecx,4 - jae .noarr - mov ebx,ecx - call check_move - jc .ex - mov edx,eax - add eax,[dirs+ebx*4] - mov [player],eax - mov ecx,[cur_step] - jecxz .skbchk2 - mov edi,area - repne scasb - jne .skbchk2 - mov [edi-1],dl - .skbchk2: - cmp eax,[finish] - jne .drw - mov [win_flag],1 - jmp .drw - .noarr: - mov edx,[stepptr] - cmp ecx,4 - jne .nocw - movzx edx,byte[dir_rotate+edx] - jmp .ex2 - .nocw: - cmp ecx,5 - jne .ex - movzx edx,byte[dir_rotate+4+edx] - .ex2: - mov [stepptr],edx - jmp .drw - .ex: - ret - -OR_maze: -file 'omaze.bin' - -OR_level: -file 'or2.bin' - -if lang eq ru_RU - OR_help mstr \ - '箪 뤥 ⪥ । ',\ - '頥 ५. ',\ - ' ९⢨, 뢠 . ',\ - '室 ५ ᨭ ',\ - ' ⠬. - ஢ ',\ - '५ ⪨ .','',\ - 'http://www.clickmazes.com' -else - OR_help mstr \ - 'Click on a highlighted square to move or rotate',\ - 'the red pointer. The blue switcher acts as an',\ - 'obstacle, hiding one square. The red pointer and',\ - 'blue switcher will swap places if the red pointer',\ - 'is pushed onto a square occupied by a blue',\ - 'switcher. Your challenge is to negotiate the red',\ - 'arrow from the bottom to the top square.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +; level format +; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] + +; internal format +; [stepptr]= worms # +; area: [worm_len][start_cell #][end_cell #]..[dirs].. +; [cur_step]: dragged worm pointer +; [finish]: 0 - if head dragged, 1- if tail + +OR_levelp: + mov [Ces],40 + mcall 40,100111b + inc [drag_flag] + mov eax,OR_strip + call need_image + inc esi + movzx ecx,byte[esi] + inc esi + push esi + mov esi,OR_maze + jecxz .sk + .nxtmz: + movzx eax,byte[esi] + add esi,eax + loop .nxtmz + .sk: + call get_xy_sf + call unpack_level + pop esi + movzx ecx,byte[esi] + inc esi + mov [cur_step],ecx + jecxz .sk2 + mov edi,area + rep movsb + .sk2: + mov ecx,[cell_count] + mov edi,area+16 + rep movsb + mov [stepptr],2 +; call erase_field +; ud2 + ret + +OR_key: + cmp eax,0 + jl OR_mouse + ret + +OR_drawf: + mov ecx,[cell_count] + push [sq_size] + mov [sq_size],0 + .lp: + push ecx + movzx ebx,byte[area+16+ecx-1] + cmp bl,0xf + je .no + lea eax,[ecx-1] + call out_image + .no: + pop ecx + loop .lp + pop [sq_size] + ret + +OR_drawm: + push [sq_size] + mov [sq_size],0 + mov eax,[player] + mov ebx,[stepptr] + add ebx,8 + call out_image + mov ecx,[cur_step] + jecxz .skipb + mov ebx,7 + mov esi,area + xor eax,eax + .nxtb: + lodsb + call out_image + loop .nxtb + .skipb: + mov eax,[player] + .again: + mov ebx,[stepptr] + call check_move + jc .ex + add eax,[dirs+ebx*4] + cmp byte[area+16+eax],6 + je .ex + mov ecx,[cur_step] + jecxz .skbchk + mov edi,area + repne scasb + je .again + .skbchk: + mov [sq_size],1 + push eax + call get_xy + mov ebx,[lx] + sub bx,2 + mov ecx,[ly] + mov cx,3 + mcall 13,,,0xFFC633 + xchg bx,cx + mcall + mov esi,[Ces] + sub esi,3+2 + shl esi,16 + push ebx + add ebx,esi + mcall + pop ebx + add ecx,esi + xchg bx,cx + add bx,2 + mcall + pop eax + jmp .again + .ex: + pop [sq_size] + ret + +OR_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + cmp edx,-2 + jne .ex + test eax,eax + jnz .noempty + .drw: + mov [jump],drw + ret + .noempty: + +; First Click at ebx cell + mov eax,[player] + cmp eax,ebx + je OR_drawf + mov ecx,[cur_step] + jecxz .skbchk + mov edi,area + xchg eax,ebx + repne scasb + xchg eax,ebx + je OR_drawf + .skbchk: + cmp byte[area+16+ebx],0xf + je .ex + cmp byte[area+16+ebx],6 + je .ex + push eax + mov edx,ebx + call get_offset + mov ebx,eax + pop eax + cmp ebx,[stepptr] + jne .ex + + call check_move + jc .ex + movzx ecx,byte[area+16+edx] + cmp ecx,4 + jae .noarr + mov ebx,ecx + call check_move + jc .ex + mov edx,eax + add eax,[dirs+ebx*4] + mov [player],eax + mov ecx,[cur_step] + jecxz .skbchk2 + mov edi,area + repne scasb + jne .skbchk2 + mov [edi-1],dl + .skbchk2: + cmp eax,[finish] + jne .drw + mov [win_flag],1 + jmp .drw + .noarr: + mov edx,[stepptr] + cmp ecx,4 + jne .nocw + movzx edx,byte[dir_rotate+edx] + jmp .ex2 + .nocw: + cmp ecx,5 + jne .ex + movzx edx,byte[dir_rotate+4+edx] + .ex2: + mov [stepptr],edx + jmp .drw + .ex: + ret + +OR_maze: +file 'omaze.bin' + +OR_level: +file 'or2.bin' + +if lang eq ru_RU + OR_help mstr \ + '箪 뤥 ⪥ । ',\ + '頥 ५. ',\ + ' ९⢨, 뢠 . ',\ + '室 ५ ᨭ ',\ + ' ⠬. - ஢ ',\ + '५ ⪨ .','',\ + 'http://www.clickmazes.com' ; FIXME: Check link works +else ; Default to en_US + OR_help mstr \ + 'Click on a highlighted square to move or rotate',\ + 'the red pointer. The blue switcher acts as an',\ + 'obstacle, hiding one square. The red pointer and',\ + 'blue switcher will swap places if the red pointer',\ + 'is pushed onto a square occupied by a blue',\ + 'switcher. Your challenge is to negotiate the red',\ + 'arrow from the bottom to the top square.','',\ + 'http://www.clickmazes.com' ; FIXME: Check link works +end if diff --git a/programs/games/megamaze/trunk/smz.inc b/programs/games/megamaze/trunk/smz.inc index 0dc0951ba..9c416fcf0 100644 --- a/programs/games/megamaze/trunk/smz.inc +++ b/programs/games/megamaze/trunk/smz.inc @@ -1,94 +1,96 @@ -SMZ_levelp: - call get_xy_sf - xor eax,eax - mov [stepptr],esi - lodsb - mov [cur_step],esi - add esi,eax - mov [levptr],esi - call unpack_level - ret - -SMZ_key: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov ecx,[cur_step] - movzx ecx,byte[ecx] - lea ebx,[eax-176] - mov eax,[player] - .lp: - call check_move - jc .exl - add eax,[dirs+ebx*4] - loop .lp - .exl: - test ecx,ecx - jne .ex - mov [player],eax - cmp eax,[finish] - jne .nowin - mov [win_flag],1 - .nowin: - mov esi,[stepptr] - movzx eax,byte[esi] - inc esi - lea ebx,[esi+eax] - inc [cur_step] - cmp [cur_step],ebx - jb .ex - mov [cur_step],esi - .ex: - ret - -SMZ_drawm: - mov eax,[player] - call get_xy - mcall 13,[lx],[ly],0xff00 - mov eax,[finish] - call get_xy - mcall 13,[lx],[ly],0xff0000 - cmp [win_flag],1 - je .ex - mov edi,[stepptr] - movzx ecx,byte[edi] - inc edi - mov edx,(XFOFS+MSGXO) shl 16+42 - mov ebx,0x010000 - mov eax,47 - .lp: - push ecx - mov esi,0x10000000 - movzx ecx,byte[edi] - cmp edi,[cur_step] - jne .nocur - mov esi,0x100000ff - mcall - add edx,1 shl 16 - .nocur: - mcall - pop ecx - add edx,10 shl 16 - inc edi - loop .lp - .ex: - ret - -SMZ_level: -file 'smz.bin' - -if lang eq ru_RU - SMZ_help mstr \ - ' ᫥⥫쭮 室, ',\ - ' ᢥ祭 ⢮ ⮪',\ - ' אַ, ⨣ ᭮ .','',\ - 'http://puzzleprograms.narod.ru' -else - SMZ_help mstr \ - 'Repeat sequence shown above the field moving the',\ - 'green square by highlighted count of spaces as',\ - 'many times as you like, until you finish at the',\ - 'red square.','',\ - 'http://puzzleprograms.narod.ru' -end if +; Language support for locales: ru_RU (CP866), en_US. + +SMZ_levelp: + call get_xy_sf + xor eax,eax + mov [stepptr],esi + lodsb + mov [cur_step],esi + add esi,eax + mov [levptr],esi + call unpack_level + ret + +SMZ_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov ecx,[cur_step] + movzx ecx,byte[ecx] + lea ebx,[eax-176] + mov eax,[player] + .lp: + call check_move + jc .exl + add eax,[dirs+ebx*4] + loop .lp + .exl: + test ecx,ecx + jne .ex + mov [player],eax + cmp eax,[finish] + jne .nowin + mov [win_flag],1 + .nowin: + mov esi,[stepptr] + movzx eax,byte[esi] + inc esi + lea ebx,[esi+eax] + inc [cur_step] + cmp [cur_step],ebx + jb .ex + mov [cur_step],esi + .ex: + ret + +SMZ_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + cmp [win_flag],1 + je .ex + mov edi,[stepptr] + movzx ecx,byte[edi] + inc edi + mov edx,(XFOFS+MSGXO) shl 16+42 + mov ebx,0x010000 + mov eax,47 + .lp: + push ecx + mov esi,0x10000000 + movzx ecx,byte[edi] + cmp edi,[cur_step] + jne .nocur + mov esi,0x100000ff + mcall + add edx,1 shl 16 + .nocur: + mcall + pop ecx + add edx,10 shl 16 + inc edi + loop .lp + .ex: + ret + +SMZ_level: +file 'smz.bin' + +if lang eq ru_RU + SMZ_help mstr \ + ' ᫥⥫쭮 室, ',\ + ' ᢥ祭 ⢮ ⮪',\ + ' אַ, ⨣ ᭮ .','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +else ; Default to en_US + SMZ_help mstr \ + 'Repeat sequence shown above the field moving the',\ + 'green square by highlighted count of spaces as',\ + 'many times as you like, until you finish at the',\ + 'red square.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +end if diff --git a/programs/games/megamaze/trunk/tam.inc b/programs/games/megamaze/trunk/tam.inc index 3d985b9b1..00db46c7a 100644 --- a/programs/games/megamaze/trunk/tam.inc +++ b/programs/games/megamaze/trunk/tam.inc @@ -1,164 +1,166 @@ -TM_levelp: - call get_xy_sf - mov [levptr],esi - call unpack_level - ret - -TM_key: - cmp eax,' ' - je .mm - cmp eax,176 - jb .still - cmp eax,179 - ja .still - lea ebx,[eax-176] - mov eax,[teseus] - call check_move - jc .still - call move_teseus - cmp [win_flag],0 - jne .ex - .nowin: - call drwfld - .mm: - call move_minotaur - cmp eax,[teseus] - jne .still - mov [win_flag],2 - jmp .ex - .still: - mov [jump],still - .ex: - ret - -move_minotaur: - xor esi,esi - mov eax,[teseus] - mov ebx,[fx] - div bl - mov ecx,eax ;teseus: ch-x, cl-y - mov eax,[minotaur] - .again: - call mino_xy - xor ebx,ebx - cmp dh,ch - je .stand2 - ja .ok1 - add ebx,3 - .ok1: - call check_move - jc .stand2 - add eax,[dirs+ebx*4] - mov [minotaur],eax - inc esi - call delay - call drwfld - cmp esi,2 - jb .again - jmp .ex - .stand1: - call mino_xy - .stand2: - mov ebx,2 - cmp dl,cl - je .ex - ja .ok2 - dec ebx - .ok2: - call check_move - jc .ex - add eax,[dirs+ebx*4] - mov [minotaur],eax - inc esi - call delay - call drwfld - cmp esi,2 - jb .again - .ex: - ret - -mino_xy: - push eax - div byte[fx] - mov edx,eax ;minotaur: dh-x, dl-y - pop eax - ret - -move_teseus: - pusha - cdq - mov ecx,[fx] - div cl - add ax,1 shl 8+1 - test ebx,ebx - jne .no0 - cmp ah,1 - jne .move - .win: - inc [win_flag] - jmp .ex - .no0: - cmp ebx,1 - jne .no1 - cmp al,byte[fy] - je .win - jmp .move - .no1: - cmp ebx,2 - jne .no2 - cmp al,1 - je .win - jmp .move - .no2: - cmp ebx,3 - jne .move - cmp ah,byte[fx] - je .win - .move: - mov eax,[esp+28] - add eax,[dirs+ebx*4] - mov [teseus],eax - .ex: - popa - ret - -TM_drawm: - mov eax,[teseus] - call get_xy - mcall 13,[lx],[ly],0xff00 - mov eax,[minotaur] - call get_xy - mcall 13,[lx],[ly],0xff0000 - ret - -TM_level: -file 'tam.bin' - -if lang eq ru_RU - TM_help mstr \ - ' ᥩ ( ) 㡥 ',\ - 'ਭ. 堭᪨ ⠢',\ - '( ). 室 ᥩ ⠢',\ - ' 2 室 ⠪ 奬:',\ - ' 砫 ⠥ ਡ ',\ - 'ਧ⠫ 1 . ᫨ ,',\ - ' ⠥ ⨪ 1 .',\ - '᫨ ᤥ ⮣, 㣮,',\ - '⠢ ய᪠ 室.','',\ - 'http://puzzleprograms.narod.ru' -else - TM_help mstr \ - ' Theseus (the green dot) must escape from a maze.',\ - 'There is also a mechanical Minotaur (the red',\ - 'dot) in each maze. For every turn that Theseus',\ - 'takes, the Minotaur takes two turns.',\ - ' Each turn he decides following:',\ - 'First he tests if he can move horizontally and',\ - 'get closer to Theseus. If he can, he will move',\ - "one square horizontally. If he can't, he will",\ - 'test if he could move vertically and get closer',\ - 'to Theseus. If he can, he will move one square',\ - "vertically. If he can't move either horizontally",\ - 'or vertically, then he just skips that turn.','',\ - 'http://puzzleprograms.narod.ru' -end if +; Language support for locales: ru_RU (CP866), en_US. + +TM_levelp: + call get_xy_sf + mov [levptr],esi + call unpack_level + ret + +TM_key: + cmp eax,' ' + je .mm + cmp eax,176 + jb .still + cmp eax,179 + ja .still + lea ebx,[eax-176] + mov eax,[teseus] + call check_move + jc .still + call move_teseus + cmp [win_flag],0 + jne .ex + .nowin: + call drwfld + .mm: + call move_minotaur + cmp eax,[teseus] + jne .still + mov [win_flag],2 + jmp .ex + .still: + mov [jump],still + .ex: + ret + +move_minotaur: + xor esi,esi + mov eax,[teseus] + mov ebx,[fx] + div bl + mov ecx,eax ;teseus: ch-x, cl-y + mov eax,[minotaur] + .again: + call mino_xy + xor ebx,ebx + cmp dh,ch + je .stand2 + ja .ok1 + add ebx,3 + .ok1: + call check_move + jc .stand2 + add eax,[dirs+ebx*4] + mov [minotaur],eax + inc esi + call delay + call drwfld + cmp esi,2 + jb .again + jmp .ex + .stand1: + call mino_xy + .stand2: + mov ebx,2 + cmp dl,cl + je .ex + ja .ok2 + dec ebx + .ok2: + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov [minotaur],eax + inc esi + call delay + call drwfld + cmp esi,2 + jb .again + .ex: + ret + +mino_xy: + push eax + div byte[fx] + mov edx,eax ;minotaur: dh-x, dl-y + pop eax + ret + +move_teseus: + pusha + cdq + mov ecx,[fx] + div cl + add ax,1 shl 8+1 + test ebx,ebx + jne .no0 + cmp ah,1 + jne .move + .win: + inc [win_flag] + jmp .ex + .no0: + cmp ebx,1 + jne .no1 + cmp al,byte[fy] + je .win + jmp .move + .no1: + cmp ebx,2 + jne .no2 + cmp al,1 + je .win + jmp .move + .no2: + cmp ebx,3 + jne .move + cmp ah,byte[fx] + je .win + .move: + mov eax,[esp+28] + add eax,[dirs+ebx*4] + mov [teseus],eax + .ex: + popa + ret + +TM_drawm: + mov eax,[teseus] + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[minotaur] + call get_xy + mcall 13,[lx],[ly],0xff0000 + ret + +TM_level: +file 'tam.bin' + +if lang eq ru_RU + TM_help mstr \ + ' ᥩ ( ) 㡥 ',\ + 'ਭ. 堭᪨ ⠢',\ + '( ). 室 ᥩ ⠢',\ + ' 2 室 ⠪ 奬:',\ + ' 砫 ⠥ ਡ ',\ + 'ਧ⠫ 1 . ᫨ ,',\ + ' ⠥ ⨪ 1 .',\ + '᫨ ᤥ ⮣, 㣮,',\ + '⠢ ய᪠ 室.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +else ; Default to en_US + TM_help mstr \ + ' Theseus (the green dot) must escape from a maze.',\ + 'There is also a mechanical Minotaur (the red',\ + 'dot) in each maze. For every turn that Theseus',\ + 'takes, the Minotaur takes two turns.',\ + ' Each turn he decides following:',\ + 'First he tests if he can move horizontally and',\ + 'get closer to Theseus. If he can, he will move',\ + "one square horizontally. If he can't, he will",\ + 'test if he could move vertically and get closer',\ + 'to Theseus. If he can, he will move one square',\ + "vertically. If he can't move either horizontally",\ + 'or vertically, then he just skips that turn.','',\ + 'http://puzzleprograms.narod.ru' ; FIXME: Check link works +end if diff --git a/programs/games/megamaze/trunk/tilt.inc b/programs/games/megamaze/trunk/tilt.inc index f4c9a90b1..a9e0fd559 100644 --- a/programs/games/megamaze/trunk/tilt.inc +++ b/programs/games/megamaze/trunk/tilt.inc @@ -1,93 +1,95 @@ -TILT_levelp: - call SMZ_levelp - mov esi,[stepptr] - movzx ecx,byte[esi] - mov [finish],ecx - inc ecx - mov edi,area - rep movsb - mov [pause_time],10 - ret - -TILT_key: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov esi,area - inc esi - lea ebx,[eax-176] - mov eax,[player] - .lp: - call check_move - jc .ex1 - add eax,[dirs+ebx*4] - movzx ecx,byte[esi-1] - mov edi,esi - repne scasb - jne .notfound - mov byte[edi-1],0xff - dec dword[finish] - .notfound: - mov [player],eax - call delay - call drwfld - jmp .lp - .ex1: - cmp dword[finish],0 - jnz .ex - mov [win_flag],1 - .ex: - ret - -TILT_drawm: - mov eax,[player] - call get_xy - mcall 13,[lx],[ly],0xff00 - cmp [win_flag],1 - je .ex - mov edi,area - movzx ecx,byte[edi] - jecxz .ex - inc edi - .lp: - push ecx - movzx eax,byte[edi] - cmp eax,0xff - je .no - call get_xy - mcall 13,[lx],[ly],0xff0000 - .no: - pop ecx - inc edi - loop .lp - .ex: - ret - -TILT_level: -file 'tilt.bin' - -if lang eq ru_RU - TILT_help mstr \ - '誠 ( ) ᪥, ',\ - ' ਧ⠫ ⨪',\ - ' ᫥ 誠 ᪮짨, ⪭',\ - ' ⥭. ⠭ ।',\ - '.',\ - ' - ⠢ ⪨',\ - ' 묨 ⠬.','',\ - 'http://www.clickmazes.com' -else - TILT_help mstr \ - 'You are to imagine that a marble (shown here as a',\ - 'green square) is on a board that you can tilt',\ - 'only to the north, south, east, or west. (You',\ - "can't do anything tricky like tilt it southeast.)",\ - ' Once you tilt the board, the marble will roll',\ - '(horizontally or vertically) until it hits a',\ - "barrier. There's no way you can stop the marble",\ - 'in the middle of its roll.',\ - ' The object is to roll the marble onto or over',\ - 'every red square in the maze.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +TILT_levelp: + call SMZ_levelp + mov esi,[stepptr] + movzx ecx,byte[esi] + mov [finish],ecx + inc ecx + mov edi,area + rep movsb + mov [pause_time],10 + ret + +TILT_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + mov eax,[player] + .lp: + call check_move + jc .ex1 + add eax,[dirs+ebx*4] + movzx ecx,byte[esi-1] + mov edi,esi + repne scasb + jne .notfound + mov byte[edi-1],0xff + dec dword[finish] + .notfound: + mov [player],eax + call delay + call drwfld + jmp .lp + .ex1: + cmp dword[finish],0 + jnz .ex + mov [win_flag],1 + .ex: + ret + +TILT_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff00 + cmp [win_flag],1 + je .ex + mov edi,area + movzx ecx,byte[edi] + jecxz .ex + inc edi + .lp: + push ecx + movzx eax,byte[edi] + cmp eax,0xff + je .no + call get_xy + mcall 13,[lx],[ly],0xff0000 + .no: + pop ecx + inc edi + loop .lp + .ex: + ret + +TILT_level: +file 'tilt.bin' + +if lang eq ru_RU + TILT_help mstr \ + '誠 ( ) ᪥, ',\ + ' ਧ⠫ ⨪',\ + ' ᫥ 誠 ᪮짨, ⪭',\ + ' ⥭. ⠭ ।',\ + '.',\ + ' - ⠢ ⪨',\ + ' 묨 ⠬.','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + TILT_help mstr \ + 'You are to imagine that a marble (shown here as a',\ + 'green square) is on a board that you can tilt',\ + 'only to the north, south, east, or west. (You',\ + "can't do anything tricky like tilt it southeast.)",\ + ' Once you tilt the board, the marble will roll',\ + '(horizontally or vertically) until it hits a',\ + "barrier. There's no way you can stop the marble",\ + 'in the middle of its roll.',\ + ' The object is to roll the marble onto or over',\ + 'every red square in the maze.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/tilt2.inc b/programs/games/megamaze/trunk/tilt2.inc index e7da4dbef..4e8206b9a 100644 --- a/programs/games/megamaze/trunk/tilt2.inc +++ b/programs/games/megamaze/trunk/tilt2.inc @@ -1,105 +1,107 @@ -; level format -; [fx|fy][blue xy][red xy][blue point xy][red point xy]..[maze walls] - -; internal format -; points db=[stepptr] -; [player]= blue -; [finish]= red -; area: ..[1-red,0-black xy].. ( -1 if empty) - -TILT2_levelp: - call get_xy_sf - mov [stepptr],esi - add esi,2 - call unpack_level - mov [pause_time],10 - ret - -TILT2_key: - cmp eax,176 - jb .ex - cmp eax,179 - ja .ex - mov esi,area - inc esi - lea ebx,[eax-176] - .lp: - xor edx,edx - mov eax,[player] - call check_move - jc .nom1 - inc edx - add eax,[dirs+ebx*4] - mov [player],eax - .nom1: - mov eax,[finish] - call check_move - jc .nom2 - inc edx - add eax,[dirs+ebx*4] - mov [finish],eax - .nom2: - test edx,edx - jz .ex1 - call delay - call drwfld - jmp .lp - .ex1: - mov eax,[finish] - cmp eax,[player] - jnz .ex2 - mov [win_flag],2 - jmp TILT2_drawm.skip - .ex2: - mov esi,[stepptr] - cmp al,[esi+1] - jne .ex - mov eax,[player] - cmp al,[esi] - jne .ex - mov [win_flag],1 - .ex: - ret - -TILT2_drawm: - cmp [win_flag],2 - je .skip -; mov [sq_size],3 - mov eax,[player] - call get_xy - mcall 13,[lx],[ly],0xff - mov eax,[finish] - call get_xy - mcall 13,[lx],[ly],0xff0000 - .skip: - shl [sq_size],1 - mov esi,[stepptr] - lodsb - call get_xy - mcall 13,[lx],[ly],0xff - lodsb - call get_xy - shr [sq_size],1 - mcall 13,[lx],[ly],0xff0000 - ret - -TILT2_level: -file 'tilt2.bin' - -if lang eq ru_RU - TILT2_help mstr \ - ' ᨭ ⮪',\ - 'ᮮ⢥饣 梥. ! ᤥ',\ - ' ᨢ ਠ, ⮫',\ - ' ᯠ. ⮬ 砥 ਤ',\ - ' ஢ ᭠砫.','',\ - 'http://www.clickmazes.com' -else - TILT2_help mstr \ - 'The red block must reach the red target and the',\ - 'blue block the blue target. Beware! The two',\ - 'blocks are made of highly reactive material and,',\ - 'if they collide, will instantly evaporate. At',\ - 'this point you must start all over again.','',\ - 'http://www.clickmazes.com' -end if +; Language support for locales: ru_RU (CP866), en_US. + +; level format +; [fx|fy][blue xy][red xy][blue point xy][red point xy]..[maze walls] + +; internal format +; points db=[stepptr] +; [player]= blue +; [finish]= red +; area: ..[1-red,0-black xy].. ( -1 if empty) + +TILT2_levelp: + call get_xy_sf + mov [stepptr],esi + add esi,2 + call unpack_level + mov [pause_time],10 + ret + +TILT2_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + .lp: + xor edx,edx + mov eax,[player] + call check_move + jc .nom1 + inc edx + add eax,[dirs+ebx*4] + mov [player],eax + .nom1: + mov eax,[finish] + call check_move + jc .nom2 + inc edx + add eax,[dirs+ebx*4] + mov [finish],eax + .nom2: + test edx,edx + jz .ex1 + call delay + call drwfld + jmp .lp + .ex1: + mov eax,[finish] + cmp eax,[player] + jnz .ex2 + mov [win_flag],2 + jmp TILT2_drawm.skip + .ex2: + mov esi,[stepptr] + cmp al,[esi+1] + jne .ex + mov eax,[player] + cmp al,[esi] + jne .ex + mov [win_flag],1 + .ex: + ret + +TILT2_drawm: + cmp [win_flag],2 + je .skip +; mov [sq_size],3 + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + .skip: + shl [sq_size],1 + mov esi,[stepptr] + lodsb + call get_xy + mcall 13,[lx],[ly],0xff + lodsb + call get_xy + shr [sq_size],1 + mcall 13,[lx],[ly],0xff0000 + ret + +TILT2_level: +file 'tilt2.bin' + +if lang eq ru_RU + TILT2_help mstr \ + ' ᨭ ⮪',\ + 'ᮮ⢥饣 梥. ! ᤥ',\ + ' ᨢ ਠ, ⮫',\ + ' ᯠ. ⮬ 砥 ਤ',\ + ' ஢ ᭠砫.','',\ + 'http://www.clickmazes.com' +else ; Default to en_US + TILT2_help mstr \ + 'The red block must reach the red target and the',\ + 'blue block the blue target. Beware! The two',\ + 'blocks are made of highly reactive material and,',\ + 'if they collide, will instantly evaporate. At',\ + 'this point you must start all over again.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/wriggle.inc b/programs/games/megamaze/trunk/wriggle.inc index 12a6b73da..9c699c739 100644 --- a/programs/games/megamaze/trunk/wriggle.inc +++ b/programs/games/megamaze/trunk/wriggle.inc @@ -1,3 +1,5 @@ +; Language support for locales: ru_RU (CP866), en_US. + ; level format ; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] @@ -241,7 +243,7 @@ if lang eq ru_RU '直 ४뢠 ᥪ ',\ '㣠.','',\ 'http://www.clickmazes.com' -else +else ; Default to en_US WG_help mstr \ 'Your aim is to drag the wriggley worms by head or',\ 'tail until each worm covers the squares of its',\ diff --git a/programs/games/pipes/pipes.asm b/programs/games/pipes/pipes.asm index 275731e88..f7684a3e2 100644 --- a/programs/games/pipes/pipes.asm +++ b/programs/games/pipes/pipes.asm @@ -1,609 +1,612 @@ -; -; pipes kolibri -; v1.42 -; 2006 by Mario Birkner -; -; l.mod. 29.01.19 -; -; Compile with FASM -; -format binary as "" - -bgcolor equ 0x0074744A ;thx -fgcolor equ 0x00E7C750 ;to -fg2color equ 0x00E0B0A0 ;colorref -fg3color equ 0x007F7F55 -btcolor equ 0x005B6200 - -include '..\..\macros.inc' -include 'lang.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 0x100000 ; memory for app - dd 0x7fff0 ; esp - dd 0x0 , 0x0 ; I_Param , I_Icon - -START: ; start of execution - jmp red - -still: - mcall 10 ; wait here for event - 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 - mcall 2 ; just read it and ignore - jmp still - button: ; button - call get_input - jmp still - - - -get_input: -pusha - mcall 17 ; get id - - cmp ah,1 ; button id=1 ? - jne .noclose - mcall -1 ; close this program - .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 -mcall -mov eax,11 -mcall -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: - mcall 5, 2 - mcall 11 - 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 - mcall 5, 500 - 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 esi,fg2color -mov edi,bgcolor -or esi,0x50000000 -mcall 47, 0x20000, [time], <60,395> -mov ebx,0x50000 -mov ecx,[score] -if lang eq et_EE -add edx,88 shl 16 -else -add edx,80 shl 16 -end if -mcall -mov ebx,0x20000 -mov ecx,[level] -add edx,104 shl 16 -mcall - -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,0x00B0B4B0 - jne .nog1 - jmp .wcolor - .nog1: - cmp ebx,0x00A0A4A0 - jne .nog2 - jmp .wcolor - .nog2: - cmp ebx,0x00909490 - jne .nog3 - jmp .wcolor - .nog3: - cmp ebx,0x00808480 - jne .nog4 - jmp .wcolor - .nog4: - cmp ebx,0x00707470 - 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 - mcall 13,<146,200>,<190,40>,0 - add ebx,2 shl 16 - 4 - add ecx,2 shl 16 - 4 - mov edx,fgcolor - mcall - - cmp [stat],3 - jne .stat1 - - mov ecx,btcolor - or ecx,0xB0000000 - mcall 4, <159,202>,,lbl_new_game - jmp .nomessage - - .stat1: - cmp [stat],1 - je .winmessage - mov ecx,btcolor OR 0xB0000000 - mcall 4, <170,196>, , lbl_gameover - add ebx,8 shl 16 +17 - mov edx,lbl_yscore - mcall - mov esi,ecx ;color - mov edx,ebx ;pos - add edx,90 shl 16 - mov ebx,0x50000 ;type - mov ecx,[score] ;inp - mov eax,47 - mcall - jmp .nomessage - .winmessage: - mov ecx,btcolor - or ecx,0xB0000000 - mcall 4, <124,194>, , lbl_win - add ebx,17 - add edx,lbl_win2-lbl_win - mcall - .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,0x80000000 ;first delete previous button - mcall - sub edx,0x30000000 ;first delete previous button - mcall - pop edx - push ebx - push ecx - mcall 7, 0x10000, <32,32> - 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 - - mcall 12,1 - - mov edx,bgcolor - or edx,0x14000000 - mcall 0,<100,492>,<100,422>,,,lbl_title - - mcall 8,<100,72>,<28,16>,2,btcolor - add ebx,80 shl 16 - inc edx - mcall - add ebx,80 shl 16 - inc edx - mcall - - mov eax,4 - mov ebx,20 shl 16 +29 - mov ecx,fgcolor - or ecx,0xB0000000 - mov edx,lbl_toolbar - mcall - or ecx,0x00000000 - mov ebx,18 shl 16 +395 - mov edx,lbl_score - mcall - mov ebx,360 shl 16 +405 - mov ecx,fg3color - mov edx,lbl_copy - mcall - - mcall 12,2 - - popa - ret - -;================================================= -; DATA - LABELS -;================================================= -if lang eq et_EE -lbl_title db 'Torud',0 -lbl_gameover db 'M ä n g L ä b i !',0 -lbl_new_game db 'Alusta enne uut mängu',0 -lbl_win db ' T u b l i ! ',0 -lbl_win2 db ' Lähme edasi! ',0 -lbl_yscore db 'Sinu tulemus:',0 -lbl_toolbar db 'Uus mäng: Lihtne Keskmine Raske',0 -lbl_score db ' Aeg: Tulemus: Tase:',0 -else -lbl_title db 'Pipes',0 -lbl_gameover db 'G a m e O v e r !',0 -lbl_new_game db 'Start a new game first',0 -lbl_win db ' G r e a t ! ',0 -lbl_win2 db " Let's keep going! ",0 -lbl_yscore db 'Your Score:',0 -lbl_toolbar db 'New Game: Easy Normal Hard',0 -lbl_score db 'Time: Score: Level:',0 -end if - -lbl_copy db '2006, Mario Birkner',0 - -;================================================= -; DATA - VARS -;================================================= -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 - -;================================================= -; DATA - RES -;================================================= -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: +; +; pipes kolibri +; v1.42 +; 2006 by Mario Birkner +; +; l.mod. 29.01.19 +; +; Compile with FASM +; +format binary as "" + +bgcolor equ 0x0074744A ;thx +fgcolor equ 0x00E7C750 ;to +fg2color equ 0x00E0B0A0 ;colorref +fg3color equ 0x007F7F55 +btcolor equ 0x005B6200 + +include '..\..\macros.inc' +include 'lang.inc' ; Language support for locales: et_EE, en_US. + +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 + jmp red + +still: + mcall 10 ; wait here for event + 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 + mcall 2 ; just read it and ignore + jmp still + button: ; button + call get_input + jmp still + + + +get_input: +pusha + mcall 17 ; get id + + cmp ah,1 ; button id=1 ? + jne .noclose + mcall -1 ; close this program + .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 +mcall +mov eax,11 +mcall +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: + mcall 5, 2 + mcall 11 + 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 + mcall 5, 500 + 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 esi,fg2color +mov edi,bgcolor +or esi,0x50000000 +mcall 47, 0x20000, [time], <60,395> +mov ebx,0x50000 +mov ecx,[score] + +if lang eq et_EE +add edx,88 shl 16 +else ; Default to en_US +add edx,80 shl 16 +end if + +mcall +mov ebx,0x20000 +mov ecx,[level] +add edx,104 shl 16 +mcall + +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,0x00B0B4B0 + jne .nog1 + jmp .wcolor + .nog1: + cmp ebx,0x00A0A4A0 + jne .nog2 + jmp .wcolor + .nog2: + cmp ebx,0x00909490 + jne .nog3 + jmp .wcolor + .nog3: + cmp ebx,0x00808480 + jne .nog4 + jmp .wcolor + .nog4: + cmp ebx,0x00707470 + 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 + mcall 13,<146,200>,<190,40>,0 + add ebx,2 shl 16 - 4 + add ecx,2 shl 16 - 4 + mov edx,fgcolor + mcall + + cmp [stat],3 + jne .stat1 + + mov ecx,btcolor + or ecx,0xB0000000 + mcall 4, <159,202>,,lbl_new_game + jmp .nomessage + + .stat1: + cmp [stat],1 + je .winmessage + mov ecx,btcolor OR 0xB0000000 + mcall 4, <170,196>, , lbl_gameover + add ebx,8 shl 16 +17 + mov edx,lbl_yscore + mcall + mov esi,ecx ;color + mov edx,ebx ;pos + add edx,90 shl 16 + mov ebx,0x50000 ;type + mov ecx,[score] ;inp + mov eax,47 + mcall + jmp .nomessage + .winmessage: + mov ecx,btcolor + or ecx,0xB0000000 + mcall 4, <124,194>, , lbl_win + add ebx,17 + add edx,lbl_win2-lbl_win + mcall + .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,0x80000000 ;first delete previous button + mcall + sub edx,0x30000000 ;first delete previous button + mcall + pop edx + push ebx + push ecx + mcall 7, 0x10000, <32,32> + 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 + + mcall 12,1 + + mov edx,bgcolor + or edx,0x14000000 + mcall 0,<100,492>,<100,422>,,,lbl_title + + mcall 8,<100,72>,<28,16>,2,btcolor + add ebx,80 shl 16 + inc edx + mcall + add ebx,80 shl 16 + inc edx + mcall + + mov eax,4 + mov ebx,20 shl 16 +29 + mov ecx,fgcolor + or ecx,0xB0000000 + mov edx,lbl_toolbar + mcall + or ecx,0x00000000 + mov ebx,18 shl 16 +395 + mov edx,lbl_score + mcall + mov ebx,360 shl 16 +405 + mov ecx,fg3color + mov edx,lbl_copy + mcall + + mcall 12,2 + + popa + ret + +;================================================= +; DATA - LABELS +;================================================= +if lang eq et_EE +lbl_title db 'Torud',0 +lbl_gameover db 'M ä n g L ä b i !',0 +lbl_new_game db 'Alusta enne uut mängu',0 +lbl_win db ' T u b l i ! ',0 +lbl_win2 db ' Lähme edasi! ',0 +lbl_yscore db 'Sinu tulemus:',0 +lbl_toolbar db 'Uus mäng: Lihtne Keskmine Raske',0 +lbl_score db ' Aeg: Tulemus: Tase:',0 + +else ; Default to en_US +lbl_title db 'Pipes',0 +lbl_gameover db 'G a m e O v e r !',0 +lbl_new_game db 'Start a new game first',0 +lbl_win db ' G r e a t ! ',0 +lbl_win2 db " Let's keep going! ",0 +lbl_yscore db 'Your Score:',0 +lbl_toolbar db 'New Game: Easy Normal Hard',0 +lbl_score db 'Time: Score: Level:',0 +end if + +lbl_copy db '2006, Mario Birkner',0 + +;================================================= +; DATA - VARS +;================================================= +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 + +;================================================= +; DATA - RES +;================================================= +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/pong/trunk/pong.asm b/programs/games/pong/trunk/pong.asm index e931af9ec..e22163326 100644 --- a/programs/games/pong/trunk/pong.asm +++ b/programs/games/pong/trunk/pong.asm @@ -456,10 +456,10 @@ is_dn1 dd 0x0 ; | is_up2 dd 0x0 ; | is_dn2 dd 0x0 ; / -include "lang.inc" +include "lang.inc" ; Language support for locales: ru_RU (CP866), en_US. if lang eq ru_RU include "russian.inc" -else +else ; Default to en_US include "english.inc" end if diff --git a/programs/games/soko/trunk/SOKO.ASM b/programs/games/soko/trunk/SOKO.ASM index df14a18f7..3bba5842c 100644 --- a/programs/games/soko/trunk/SOKO.ASM +++ b/programs/games/soko/trunk/SOKO.ASM @@ -1,1144 +1,1144 @@ -; SOKOBAN FOR MENUET v0.1 -; Written in pure assembler by Ivushkin Andrey aka Willow -; -; Last changed: July 2, 2004 -; -; Main idea, art & graphics -; Sokofun for Windows 95 by Games 4 Brains -; and Sokoban 2.3 by Bjrn Kllmark -; -; Level designers: -; -; Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, -; David W Skinner, Erim Sever, Evgeniy Grigoriev, Franois Marques, -; Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, -; John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, -; Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, -; Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, -; Yoshio Murase, ZICO (Zbigniew Kornas) -; -; Special thanks to Hirohiko Nakamiya -; -; More credits: -; Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens -; -; Game uses its own format of levelset files *.LEV -; with simple run-length compression - -; COMPILE WITH FASM - -format binary as "" - -include 'macros.inc' ; decrease code size (optional) -include 'CELLTYPE.INC' ; object identifiers -;include 'debug.inc' - -SKIN_SIZE = 11520 ; size of skin file (16x240) - -; field dimensions -FLD_LEFT = 43 -FLD_LEFT2 = FLD_LEFT shl 16 -FLD_TOP = 40 -FLD_TOP2 = FLD_TOP shl 16 -IMG_SIZE = 16 shl 16+16 -SHIFT = (16 shl 16) -WND_COLOR = 0x00aabbcc - -; level list dimensions -LEVLIST_XY = FLD_TOP shl 16+45 -LEVLIST_SPACING = 10 -LEVWND_X = 320 -LEVWND_Y = 200 - -; input line dimensions -INP_X = 10 shl 16+300 -INP_Y = 160 shl 16+16 -INP_XY = 15 shl 16+164 - -; load button dimensions -LOAD_X = 130 shl 16+65 -LOAD_Y = 180 shl 16+14 -LOAD_XY = 135 shl 16+184 -CHOOSE_XY = 40 shl 16+148 - - -WIN_XY = 135 shl 16+25 - -; workmode constants, more defs in CELLTYPE.INC -WM_WINNER = 0x10 -WM_READSET = 0 -WM_LOSE = 0x20 - -use32 - org 0x0 - db 'MENUET01' - dd 0x01 - dd START - dd I_END - dd 0x100000 - dd 0x7fff0 - dd 0x0 - dd 0x0 - -START: - mov eax,70 ; load skin image-it is in RAW 16x240 BGR - mov ebx,file_info ; IrfanView recommended - int 0x40 - test ebx,ebx -; jmp load_level -; jz close - load_fail: ; clear input line, also if levelset load failed - mov [inp_pos],0 - load_std: - mov esi,stdlev - mov edi,file_name - mov ecx,stdlev_len-stdlev - rep movsb - mov ecx,10 - reset_fi: - mov dword[cnf_level],level_start - xor eax,eax - mov [levpage],eax - mov word[ll_num],'00' ; reset some counters - read_cnf: - mov eax,70 - mov ebx,file_info - int 0x40 - test ebx,ebx ; load standard levels SOKO-?.LEV instead of custom - jz nxt_cnf - add dword[cnf_level],ebx - nxt_cnf: - test ecx,ecx ; this check is for loading a custom levelset - jz no_increase - inc byte[file_num] ; next standard levelset - loop read_cnf - no_increase: - cmp dword[cnf_level],level_start - jne go_on - test ecx,ecx - jz load_fail - jmp close ; missing standard levels & exiting - go_on: - mov eax,[cnf_level] - mov byte[eax],0xf0 ; end-of-levels mark - - call read_levelset - backto_set: - mov byte[workmode],WM_READSET - mov byte[winmode],0 - jmp red -restart_level: - call decode_field ; uncompress level - -red: - call draw_window - -still: - - mov eax,10 - int 0x40 - cmp byte[winmode],WM_WINNER - je backto_set - cmp byte[winmode],WM_LOSE - je backto_set - cmp eax,1 - je red - cmp eax,2 - je key - cmp eax,3 - je button - - jmp still - - key: - mov eax,2 - int 0x40 - - cmp byte[workmode],WM_READSET - jne key_move - cmp ah,32 ; Space moves focus to input line - je is_input - cmp ah,184 - jne no_prev - cmp [levpage],0 ; PgUp - jz still - sub [levpage],10 - cmp byte[ll_num+1],'0' - jnz _pu - dec byte[ll_num] - mov byte[ll_num+1],'9'+1 - _pu: - dec byte[ll_num+1] - jmp red - no_prev: - cmp ah,183 ; PgDn - jne no_next - mov eax,[levpage] - add eax,10 - cmp eax,[levelcount] - jae still - mov [levpage],eax - cmp byte[ll_num+1],'9' - jnz _pd - inc byte[ll_num] - mov byte[ll_num+1],'0'-1 - _pd: - inc byte[ll_num+1] - jmp red - no_next: - sub ah,48 - cmp ah,9 - ja still - movzx eax,ah ; user selects a level - add eax,[levpage] - cmp eax,[levelcount] - jae still - mov eax,[levelmap+eax*4] - mov [levptr],eax ; current level pointer - mov al,byte[eax] - mov byte[workmode],al - jmp restart_level - - ; we're already in game - key_move: - cmp ah,180 ; Home - je backto_set - cmp ah,176 - jb no_arrows - sub ah,176 - cmp ah,3 - ja no_arrows - movzx ecx,ah - movzx edx,[player] - inc ch - call valid_move - cmp byte[winmode],WM_WINNER - jne no_winner - mov ecx,0x00ac0000 - mov edx,win_msg - mov esi,win_msg_end-win_msg ; print victory congratulations - print_msg: - mov ebx,WIN_XY - mov eax,4 - int 0x40 - jmp d_f - no_winner: - cmp byte[winmode],WM_LOSE - jne d_f - no_loser: - test al,al ; no move accepted - jnz still - d_f: - call draw_field ; move performed-redraw - jmp still - no_arrows: - cmp ah,27 - je restart_level - - jmp still - - button: - mov eax,17 - int 0x40 - - cmp ah,1 - jne noclose - close: - xor eax,eax - dec eax - int 0x40 ; shutdown. - - noclose: - cmp ah,2 - jne no_input - is_input: ; simple input line with backspace feature - mov ebx,[entered] ; sorry - no cursor - test ebx,ebx - jnz wait_input - mov [inp_pos],ebx - inc [entered] - wait_input: - call draw_input - mov eax,10 - int 0x40 - cmp eax,2 - jne still - mov edi,[inp_pos] - mov eax,2 - int 0x40 - shr eax,8 - cmp eax,27 - je still - cmp eax,13 - je load_level - cmp eax,8 - je backsp - mov [fn_input+edi],al - inc [inp_pos] - jmp wait_input - backsp: - test edi,edi - jz wait_input - dec [inp_pos] - jmp wait_input - no_input: - cmp ah,3 - jne no_load - load_level: - mov ecx,[inp_pos] - test ecx,ecx - je load_std - mov esi,fn_input - mov byte[esi+ecx],0 - inc ecx - mov edi,file_name - rep movsb - jmp reset_fi - no_load: - jmp still - - -; ********************************************* -; ** FILLS LEVEL POINTER MAP ****************** -; ********************************************* -read_levelset: - - mov dword[wnd_width],LEVWND_X - mov dword[wnd_height],LEVWND_Y - mov [levelcount],0 - mov edi,level_start - mov esi,levelmap - mov al,0xff - rls_cycle: - cmp byte[edi],EOF - je end_of_levelset - mov [esi],edi - add esi,4 - mov ecx,1024 - inc [levelcount] - repne scasb - jecxz eol ;end_of_levelset - jmp rls_cycle - end_of_levelset: - mov eax,[levelcount] -; debug_print_dec eax - ret - eol: -; debug_print '*** ' - jmp end_of_levelset - -; ********************************************* -; ******* DEFINE & DRAW WINDOW & OTHER STUFF * -; ********************************************* - -draw_window: - - mov eax,12 - mov ebx,1 - int 0x40 - - mov eax,0 - mov ebx,150*65536 - add ebx,[wnd_width] - mov ecx,50*65536 - add ecx,[wnd_height] - mov edx,0x13000000 + WND_COLOR - mov esi,0x005080d0 - mov edi,zagolovok - int 0x40 - - cmp byte[workmode],WM_READSET - je list_levels - - mov edi,[levptr] ; print custom level filename - add ebx,170*65536 - lea edx,[edi+4] - movzx esi,byte[edi+3] - int 0x40 - - call draw_field - cmp [entered],0 - jz end_of_draw - mov edx,fn_input ; print input line text - mov esi,[inp_pos] - mov ebx,FLD_LEFT2+FLD_TOP-15 - jmp draw_level_file - - list_levels: - - call draw_input - - mov eax,8 ; draw load button - mov ebx,LOAD_X - mov ecx,LOAD_Y - mov edx,3 - mov esi,WND_COLOR - int 0x40 - - mov eax,4 - mov ecx,0x00107a30 - mov ebx,LOAD_XY - mov edx,load_char - mov esi,loadlen-load_char - int 0x40 - - mov ebx,LEVLIST_XY - mov edi,0x004e00e7 - xor esi,esi - mov ecx,10 - ll_cycle: - push ecx esi ebx esi - lea ecx,[esi+'0'] - mov [ll_num+2],cl - mov ecx,edi - mov edx,ll_num - mov esi,4 - int 0x40 - add ebx,25 shl 16 - pop esi - add esi,[levpage] - mov edx,[levelmap+esi*4] - add edx,4 - movzx esi,byte[edx-1] - int 0x40 - pop ebx esi ecx - inc esi - mov edx,[levelcount] - sub edx,[levpage] - cmp edx,esi - jbe choose_print - add ebx,LEVLIST_SPACING - loop ll_cycle - choose_print: - mov edx,ll_msg - mov esi,ll_msg_end-ll_msg - mov ebx,CHOOSE_XY - draw_level_file: - mov eax,4 - int 0x40 - - end_of_draw: - mov eax,12 - mov ebx,2 - int 0x40 - - ret - -; ********************************************* -; ******* DRAW CELL IMAGES WITHIN FIELD ******* -; ********************************************* - -draw_field: - cmp byte[workmode],sSokonex - jne no_chl - call check_lasers ; Sokonex game - no_chl: - mov eax,13 ; clear field area - mov edx,WND_COLOR - mov edi,[levptr] - movzx ebx,byte[edi+1] - shl ebx,4 - lea ebx, [FLD_LEFT2+ebx] - movzx ecx,byte[edi+2] - shl ecx,4 - lea ecx, [FLD_TOP shl 16+ecx] - int 0x40 - - mov edx, FLD_LEFT2+FLD_TOP - movzx edi,byte[edi+1] - shl edi,20 - add edi, FLD_LEFT2 - - xor eax,eax - mov ecx,[fld_size] - mov esi,field - fld_cycle: - lodsb - call draw_img - add edx,SHIFT - cmp edx,edi - jl no_nl - add edx,16 - and edx,0xffff - add edx,FLD_LEFT2 - no_nl: - loop fld_cycle - cmp byte[workmode],sSokonex - jne end_of_df - call draw_lasers - end_of_df: - ret - -; ********************************************* -; *********** DRAW CELL IMAGE ***************** -; ********************************************* - -draw_img: ; in: eax-object index, edx-coordinates - pusha - cmp eax,tWall - jbe no_adjust - cmp [workmode],sSokolor - jne no_di_color - add eax,pm_col-pm_nex - jmp no_adjust - no_di_color: - cmp [workmode],sSokonex - jne no_adjust - inc eax - no_adjust: - movzx ebx,byte [pic_map+eax] - cmp ebx,0xf - je no_img - bl_place: - mov ecx, IMG_SIZE - imul ebx, 256*3 - add ebx,strip - mov eax,7 ; draw_image sysfunc - int 0x40 - no_img: - popa - ret - -;**************************************** -;******* DRAW CONTENTS OF INPUT LINE **** -;**************************************** -draw_input: - push edi - cmp eax,4 - jne highlight - mov esi,WND_COLOR - jmp di_draw - highlight: - mov esi,0xe0e0e0 - di_draw: - mov eax,8 - mov ebx,INP_X - mov ecx,INP_Y - mov edx,2 - int 0x40 - mov eax,4 - mov ecx,0x00107a30 ; 1 梥 ( 0xF0RRGGBB ) - mov ebx,INP_XY - mov edx,fn_input - mov esi,[inp_pos] - int 0x40 - pop edi - ret - -; ******************************************************** -; * DECOMPRESS LEVEL & FILL SOME TABLES TO CHECK VICTORY * -; ******************************************************** - -decode_field: -; debug_print <13,10> - xor eax,eax - mov dword[checkpoint],eax - mov dword[checkpoint+4],eax - mov byte[checkcount],al - mov edi,[levptr] - mov dl,[edi] - mov [workmode],dl - movzx edx,byte[edi+1] - mov esi,edx - shl esi,4 - add esi,FLD_LEFT*2-25 - mov [wnd_width],esi - neg edx - mov [move_map+8],edx - neg edx - mov [move_map+4],edx - movzx eax,byte[edi+2] - mov esi,eax - shl esi,4 - add esi,FLD_TOP*2-18 - mov [wnd_height],esi - imul edx,eax - mov [fld_size],edx - lea esi,[edi+4] - movzx ecx,byte[edi+3] - add esi,ecx - cmp byte[esi],0xff - je backto_set - xor edi,edi - cld - dec_cycle: - lodsb - movzx ecx,al - and ecx,0xf ; ecx-count of objects - shr al,4 ; eax-index of object - inc ecx - sub edx,ecx - dc_cycle: - mov [field+edi],al - call chk_win_obj - jne no_register - push eax ecx esi - movzx ecx,al - shl eax,12 - or eax,edi - inc byte[checkcount] - cmp [workmode],sSokolor - jne chk_sokoban -; debug_print ':' -; debug_print_dec ecx - sub ecx,tRedB - shl ecx,1 - cmp word[checkpoint+ecx],0 - jnz no_new_check - mov [checkpoint+ecx],ax - and eax,0xfff -; debug_print_dec eax - jmp no_new_check - chk_sokoban: - cmp [workmode],sSokonex - jne no_nex - cmp byte[checkcount],1 - ja no_new_check - no_nex: - movzx ecx,byte[checkcount] - mov word[checkpoint-2+ecx*2],ax - no_new_check: - pop esi ecx eax - no_register: - inc edi - loop dc_cycle - cmp edx,0 - jg dec_cycle - mov ecx,[fld_size] - xor edx,edx - fp_cycle: - mov al,[field+edx] - and al,0xfe - cmp al,tPlayer - je pl_found - inc edx - loop fp_cycle - pl_found: - mov [player],dx - movzx eax,byte[checkcount] -; debug_print_dec eax - ret - -; ********************************************* -; * WHETHER OBJECT IS VICTORY DEPENDENT ******* -; ********************************************* - -chk_win_obj: ; al-object in a cell - push ecx eax - and al,0xf - mov cl,[workmode] - cmp cl,sSokoban - jne nota_sokoban - cmp al,tBlock - jmp cwo_exit - nota_sokoban: - cmp cl,sSokonex - jne nota_sokonex - cmp al,tConnect - je cwo_exit - cmp al,tStConnect - jmp cwo_exit - nota_sokonex: - push eax - and eax,tRedB - cmp eax,tRedB - pop eax - cwo_exit: - pop eax ecx - ret - -; ********************************************* -; ***** GET CELL AT CERTAIN DIRECTION ********* -; ********************************************* - -get_cell_at: ; in: dx - current cell, cl - direction - mov ebx,edx ; out: al - object at direction, bx - new position - movzx eax,cl - and eax,11b - mov eax, [move_map+eax*4] - add ebx,eax - mov al,[field+ebx] - ret - -; ********************************************* -; *** WHETHER A MOVE CAN BE DONE, & DO IT ***** -; ********************************************* - -valid_move: ; in: dx - current cell, cl - direction - push edx esi - call get_cell_at ; if ch>0 perform all moves - cmp al,tWall - jb result_ok - je vm_exit - cmp [workmode],sSokonex - jne n_vm_nex - cmp al,tStConnect - je vm_exit - cmp al,tHole - je vm_exit - n_vm_nex: - push edx ebx - mov edx,ebx - movzx esi,al - call get_cell_at - cmp al,tPlace - jbe push_it - cmp [workmode],sSokonex - jne no_plate - cmp al,tHole - jne no_plate - cmp esi,tBroken - jae vm_sink - cmp esi,tPlate - jne no_plate - and byte[field+ebx],0 - vm_sink: - and byte[field+edx],0 - jmp vm_hole - no_plate: - pop ebx edx esi edx - ret - push_it: - call do_move - vm_hole: - pop ebx edx - result_ok: - call do_move - xor al,al - vm_exit: - pop esi edx - ret - -; ********************************************* -; ******* ACTUALLY PERFORM MOVES ************** -; ********************************************* - -do_move: ; in: dx - source cell - test ch,ch ; bx - target cell - jz dm_exit ; ch = 0 don't perform moves - mov al,byte[field+edx] - cmp byte[workmode],sSokoban - jne no_dm_ban - and al,0xfe - no_dm_ban: - xor byte[field+edx],al - or byte[field+ebx],al - call chk_win_obj - jne no_check_win - pusha - movzx ecx,byte[checkcount] - xor edi,edi - dm_cycle: - movzx esi,word[checkpoint+edi*2] - and esi,0xfff - and edx,0xfff - cmp esi,edx - jnz not_an_obj - movzx eax,dl - movzx eax,byte[field+ebx] - shl eax,12 - or eax,ebx - mov word[checkpoint+edi*2],ax - jmp dm_ex - not_an_obj: - inc edi - loop dm_cycle - dm_ex: - popa - call check_win - jne no_check_win - mov byte[winmode],WM_WINNER - no_check_win: - cmp al,tPlayer - jne dm_exit - mov [player],bx - dm_exit: - ret - -; ********************************************* -; ******* CHECK VICTORY CONDITIONS ************ -; ********************************************* - -check_win: -; debug_print <13,10> - push eax ebx ecx esi - xor eax,eax - movzx ecx,byte[checkcount] - mov esi,checkpoint - mov bl,byte[workmode] - xor bh,bh - mov [colcount],bh - cld - cw_cycle: - lodsw - cmp bl,sSokoban - jne nocw_sokoban - test ax,1 shl 12 - jz cw_not_inplace - inc bh - cw_not_inplace: - loop cw_cycle -; movzx eax,bh - cmp [checkcount],bh - jmp cw_exit - nocw_sokoban: - cmp bl,sSokonex - jne nocw_sokonex - mov dx,ax - call scan_root - cmp al,[checkcount] - jmp cw_exit - - nocw_sokonex: - cmp esi,checkpoint+8 - ja cwlor_exit -; debug_print '*' - test ax,ax - jz cw_cycle - mov dx,ax - call scan_root - add [colcount],al -; debug_print '*->' -; debug_print_dec eax - jmp cw_cycle - cwlor_exit: - mov al,[colcount] - cmp al,[checkcount] - cw_exit: -; debug_print <13,10> - pop esi ecx ebx eax - ret - -; ********************************************* -; **** WHETHER LASERS DESTROY SOMETHING ******* -; ********************************************* - -check_lasers: - pusha - xor edx,edx - mov ecx,[fld_size] - cl_loop: - push ecx edx - mov cl,[field+edx] - sub cl,tLaserW - jl cl_exit - cl_begin: - call get_cell_at - cmp al,tLaserW - jae cl_destroy - cmp al,tBroken - je cl_destroy - cmp al,tEmpty - je no_cl_destroy - cmp al,tHole - je no_cl_destroy - cmp al,tPlayer - jne cl_exit - mov ecx,0x00ac0000 - mov edx,lose_msg - mov esi,lose_msg_end-lose_msg ; print loose message - mov byte[winmode],WM_LOSE - mov ebx,WIN_XY - mov eax,4 - int 0x40 - jmp cl_exit - cl_destroy: - mov byte[field+ebx],0 - no_cl_destroy: - mov edx,ebx - jmp cl_begin - cl_exit: - pop edx ecx - inc edx - loop cl_loop - popa - ret - -; ********************************************* -; *** USED BY CHECK_WIN IN SOKONEX & SOKOLOR ** -; ********************************************* - -scan_root: ; input: dx-beginning cell, ebx-what to search - push esi - mov edi,srch ; output: eax-number of win_obj found - mov eax,0xfff - movzx ecx,[checkcount] - inc ecx - cld - rep stosw ; clearing area for scan - movzx ebx,dx - and edx,eax ; dx-cell number to compare with - shr ebx,12 ; bl-obj id - mov [color],bl - mov esi,srch - mov edi,eax ; mask to extract cell - mov word[srch],dx - sr_loop: - lodsw - push esi ; saving scan pointer - movzx edx,ax ; edx-[dirs*4][cell*12] - and edx,edi -; debug_print ' >' - mov ecx,4 - sr_dir_loop1: -; debug_print '.' - push ecx ; saving dir counter - lea ebx,[ecx+11] - bts word[esi-2],bx - jc sr_endloop ; this entry is already processed -; debug_print '^' - dec ecx ; cl-direction - call get_cell_at ; bx-new position, al-object -; cmp [workmode],sSokonex -; jne no_sr_nex - call chk_win_obj - jne sr_endloop ; not a win_obj there -; debug_print '@' - cmp [workmode],sSokolor - jne no_sr_lor - cmp al,[color] - jne sr_endloop - no_sr_lor: - push esi - mov esi,srch ; let us search for existing entries - sr_loop1: - lodsw - and eax,edi ; eax-cell w/o dirs - cmp eax,ebx - je sr_foundentry ; this is the entry we're seeking for - cmp word[esi],0xfff - jnz sr_loop1 ; next entry - ; we reached empty area - mov [esi],bx - add esi,2 - sr_foundentry: - mov eax,15 - sub eax,ecx - bts [esi-2],ax ; mark entry as used - pop esi -; inc [e_fnd] ; one more obj found - sr_endloop: - pop ecx - loop sr_dir_loop1 -; jmp tttt -; sr_dir_loop: -; jmp sr_dir_loop1 -; tttt: - pop esi - cmp word[esi],0xfff - jne sr_loop - mov eax,esi - sub eax,srch - shr eax,1 - pop esi -; debug_print_dec eax - ret - -; ********************************************* -; *** SPECIAL ROUTINE TO DRAW LASERS ********** -; ********************************************* - -draw_lasers: - xor edx,edx - mov ecx,[fld_size] - dl_loop: - push ecx edx - mov cl,[field+edx] - sub cl,tLaserW - jl dl_eloop - inc ch - dl_gca: - call get_cell_at - cmp al,tEmpty - je dl_draw - cmp al,tHole - jne dl_eloop - dl_draw: - call draw_beams - mov edx,ebx - jmp dl_gca - dl_eloop: - pop edx - inc edx - pop ecx - loop dl_loop - ret - -; ********************************************* -; *** DRAWS LASER BEAMS IN CERTAIN DIRECTION ** -; ********************************************* - -draw_beams: - pusha - mov esi,[levptr] - movzx esi,byte[esi+1] - mov eax,ebx - xor edx,edx - div esi - movzx esi,cl - dec esi - shr esi,1 - and esi,1 - shl edx,20 - mov ebx,edx - shl eax,20 - mov ecx,eax - add ebx,dword[beam_xy+esi*8] - add ecx,dword[beam_xy+esi*8+4] - mov edx,0xe9e25c - mov eax,13 - int 0x40 - popa - ret - -ud: - ud2 ; debugging purposes only - - -; ********************************************* -; *** COMPRESS LEVEL - NOT READY YET ********** -; ********************************************* - -; push esi ebx ;ecx -; xchg ebx,edi -; mov esi,edi ; esi,edi - beginning -;; ebx - end of unpacked field -; first_enc: -; lodsb ; al - first byte -; shl ax,8 ; ah - this byte, al=0 -; next_enc: -; cmp esi,ebx -; jae exit_enc -;; movzx ecx,byte[esi] -;; debug_print_dec ecx -; cmp ah,byte[esi] -; jne newchar -; inc esi -; inc al -; cmp al,15 -; jb next_enc -; newchar: -; shl al,4 -; shr ax,4 -; stosb -; jmp first_enc -; exit_enc: -; shl al,4 -; shr ax,4 -; stosb -; mov al,0xff -; stosb -; pop ebx esi ecx -; -; dec ecx -; jcxz outcycle -; jmp next_lev -; outcycle: - - -; 室 ணࠬ: - -; 䥩 ணࠬ - macros.inc -load_char: -if lang eq ru_RU - db '㧨' -else - db 'Open file' -end if -loadlen: - -ll_msg: -if lang eq ru_RU - db '롥 ஢' -else - db 'Choose a level' -end if - db ' (0-9, PgUp, PgDn)' -ll_msg_end: - -fn_input: -; db 'cnf' -; db 'soko-4.lev' -if lang eq ru_RU - db ' 䠩' -else - db 'or enter a filename' -end if -inp_end: - rb 256-(inp_end-fn_input) - -win_msg: -if lang eq ru_RU - db '!!! 諨 ஢!' -else - db "You've completed the level!" -end if -win_msg_end: - -lose_msg: -if lang eq ru_RU - db ' ࠫ! ந...' -else - db "You're paralized! Game over..." -end if -lose_msg_end: - -zagolovok: - db 'Sokoban', 0 - - -pic_map: - db 0xf,9,0,0,1,1,5,6 -pm_nex: - db 2,7,8,3,4,0xa,0xa,0xa,0xa -pm_col: - db 0xb,0xc,0xd,0xe - -beam_xy: - dd (FLD_LEFT+7) shl 16+2, FLD_TOP2+16 - dd FLD_LEFT2+16, (FLD_TOP+7) shl 16+2 - -ll_num db '00x.' - -move_map dd -1,+0,-0,1 ; 0 - W, 1 - S, 2 - N, 3 - E - -stdlev db 'SOKO-0.LEV',0 -stdlev_len: - -inp_pos dd inp_end-fn_input -entered dd 0 - -file_info: - dd 0 ; subfunction - read - dd 0, 0 ; file offset - dd 0x20000 ; number of bytes to read -cnf_level dd strip ; data buffer -file_name db 'SKIN.' -file_num db 'RAW',0 - - rb 256-($-file_name) - -I_END: ; ணࠬ - -winmode db ? -scanptr dd ? -levpage dd ? -workmode db ? -player dw ? -fld_size dd ? -levptr dd ? -wnd_height dd ? -wnd_width dd ? -color db ? -colcount db ? -levelcount dd ? -checkcount db ? -checkpoint rw 256 -levelmap rd 1024 -strip rb SKIN_SIZE - -workarea: - srch rb 0x10000-($-workarea) - -level_start rb 0x20000 -field: +; SOKOBAN FOR MENUET v0.1 +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Last changed: July 2, 2004 +; +; Main idea, art & graphics +; Sokofun for Windows 95 by Games 4 Brains +; and Sokoban 2.3 by Bjrn Kllmark +; +; Level designers: +; +; Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, +; David W Skinner, Erim Sever, Evgeniy Grigoriev, Franois Marques, +; Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, +; John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, +; Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, +; Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, +; Yoshio Murase, ZICO (Zbigniew Kornas) +; +; Special thanks to Hirohiko Nakamiya +; +; More credits: +; Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens +; +; Game uses its own format of levelset files *.LEV +; with simple run-length compression + +; COMPILE WITH FASM + +format binary as "" + +include 'macros.inc' ; decrease code size (optional) +include 'CELLTYPE.INC' ; object identifiers +;include 'debug.inc' + +SKIN_SIZE = 11520 ; size of skin file (16x240) + +; field dimensions +FLD_LEFT = 43 +FLD_LEFT2 = FLD_LEFT shl 16 +FLD_TOP = 40 +FLD_TOP2 = FLD_TOP shl 16 +IMG_SIZE = 16 shl 16+16 +SHIFT = (16 shl 16) +WND_COLOR = 0x00aabbcc + +; level list dimensions +LEVLIST_XY = FLD_TOP shl 16+45 +LEVLIST_SPACING = 10 +LEVWND_X = 320 +LEVWND_Y = 200 + +; input line dimensions +INP_X = 10 shl 16+300 +INP_Y = 160 shl 16+16 +INP_XY = 15 shl 16+164 + +; load button dimensions +LOAD_X = 130 shl 16+65 +LOAD_Y = 180 shl 16+14 +LOAD_XY = 135 shl 16+184 +CHOOSE_XY = 40 shl 16+148 + + +WIN_XY = 135 shl 16+25 + +; workmode constants, more defs in CELLTYPE.INC +WM_WINNER = 0x10 +WM_READSET = 0 +WM_LOSE = 0x20 + +use32 + org 0x0 + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x7fff0 + dd 0x0 + dd 0x0 + +START: + mov eax,70 ; load skin image-it is in RAW 16x240 BGR + mov ebx,file_info ; IrfanView recommended + int 0x40 + test ebx,ebx +; jmp load_level +; jz close + load_fail: ; clear input line, also if levelset load failed + mov [inp_pos],0 + load_std: + mov esi,stdlev + mov edi,file_name + mov ecx,stdlev_len-stdlev + rep movsb + mov ecx,10 + reset_fi: + mov dword[cnf_level],level_start + xor eax,eax + mov [levpage],eax + mov word[ll_num],'00' ; reset some counters + read_cnf: + mov eax,70 + mov ebx,file_info + int 0x40 + test ebx,ebx ; load standard levels SOKO-?.LEV instead of custom + jz nxt_cnf + add dword[cnf_level],ebx + nxt_cnf: + test ecx,ecx ; this check is for loading a custom levelset + jz no_increase + inc byte[file_num] ; next standard levelset + loop read_cnf + no_increase: + cmp dword[cnf_level],level_start + jne go_on + test ecx,ecx + jz load_fail + jmp close ; missing standard levels & exiting + go_on: + mov eax,[cnf_level] + mov byte[eax],0xf0 ; end-of-levels mark + + call read_levelset + backto_set: + mov byte[workmode],WM_READSET + mov byte[winmode],0 + jmp red +restart_level: + call decode_field ; uncompress level + +red: + call draw_window + +still: + + mov eax,10 + int 0x40 + cmp byte[winmode],WM_WINNER + je backto_set + cmp byte[winmode],WM_LOSE + je backto_set + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + + jmp still + + key: + mov eax,2 + int 0x40 + + cmp byte[workmode],WM_READSET + jne key_move + cmp ah,32 ; Space moves focus to input line + je is_input + cmp ah,184 + jne no_prev + cmp [levpage],0 ; PgUp + jz still + sub [levpage],10 + cmp byte[ll_num+1],'0' + jnz _pu + dec byte[ll_num] + mov byte[ll_num+1],'9'+1 + _pu: + dec byte[ll_num+1] + jmp red + no_prev: + cmp ah,183 ; PgDn + jne no_next + mov eax,[levpage] + add eax,10 + cmp eax,[levelcount] + jae still + mov [levpage],eax + cmp byte[ll_num+1],'9' + jnz _pd + inc byte[ll_num] + mov byte[ll_num+1],'0'-1 + _pd: + inc byte[ll_num+1] + jmp red + no_next: + sub ah,48 + cmp ah,9 + ja still + movzx eax,ah ; user selects a level + add eax,[levpage] + cmp eax,[levelcount] + jae still + mov eax,[levelmap+eax*4] + mov [levptr],eax ; current level pointer + mov al,byte[eax] + mov byte[workmode],al + jmp restart_level + + ; we're already in game + key_move: + cmp ah,180 ; Home + je backto_set + cmp ah,176 + jb no_arrows + sub ah,176 + cmp ah,3 + ja no_arrows + movzx ecx,ah + movzx edx,[player] + inc ch + call valid_move + cmp byte[winmode],WM_WINNER + jne no_winner + mov ecx,0x00ac0000 + mov edx,win_msg + mov esi,win_msg_end-win_msg ; print victory congratulations + print_msg: + mov ebx,WIN_XY + mov eax,4 + int 0x40 + jmp d_f + no_winner: + cmp byte[winmode],WM_LOSE + jne d_f + no_loser: + test al,al ; no move accepted + jnz still + d_f: + call draw_field ; move performed-redraw + jmp still + no_arrows: + cmp ah,27 + je restart_level + + jmp still + + button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne noclose + close: + xor eax,eax + dec eax + int 0x40 ; shutdown. + + noclose: + cmp ah,2 + jne no_input + is_input: ; simple input line with backspace feature + mov ebx,[entered] ; sorry - no cursor + test ebx,ebx + jnz wait_input + mov [inp_pos],ebx + inc [entered] + wait_input: + call draw_input + mov eax,10 + int 0x40 + cmp eax,2 + jne still + mov edi,[inp_pos] + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,27 + je still + cmp eax,13 + je load_level + cmp eax,8 + je backsp + mov [fn_input+edi],al + inc [inp_pos] + jmp wait_input + backsp: + test edi,edi + jz wait_input + dec [inp_pos] + jmp wait_input + no_input: + cmp ah,3 + jne no_load + load_level: + mov ecx,[inp_pos] + test ecx,ecx + je load_std + mov esi,fn_input + mov byte[esi+ecx],0 + inc ecx + mov edi,file_name + rep movsb + jmp reset_fi + no_load: + jmp still + + +; ********************************************* +; ** FILLS LEVEL POINTER MAP ****************** +; ********************************************* +read_levelset: + + mov dword[wnd_width],LEVWND_X + mov dword[wnd_height],LEVWND_Y + mov [levelcount],0 + mov edi,level_start + mov esi,levelmap + mov al,0xff + rls_cycle: + cmp byte[edi],EOF + je end_of_levelset + mov [esi],edi + add esi,4 + mov ecx,1024 + inc [levelcount] + repne scasb + jecxz eol ;end_of_levelset + jmp rls_cycle + end_of_levelset: + mov eax,[levelcount] +; debug_print_dec eax + ret + eol: +; debug_print '*** ' + jmp end_of_levelset + +; ********************************************* +; ******* DEFINE & DRAW WINDOW & OTHER STUFF * +; ********************************************* + +draw_window: + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,150*65536 + add ebx,[wnd_width] + mov ecx,50*65536 + add ecx,[wnd_height] + mov edx,0x13000000 + WND_COLOR + mov esi,0x005080d0 + mov edi,zagolovok + int 0x40 + + cmp byte[workmode],WM_READSET + je list_levels + + mov edi,[levptr] ; print custom level filename + add ebx,170*65536 + lea edx,[edi+4] + movzx esi,byte[edi+3] + int 0x40 + + call draw_field + cmp [entered],0 + jz end_of_draw + mov edx,fn_input ; print input line text + mov esi,[inp_pos] + mov ebx,FLD_LEFT2+FLD_TOP-15 + jmp draw_level_file + + list_levels: + + call draw_input + + mov eax,8 ; draw load button + mov ebx,LOAD_X + mov ecx,LOAD_Y + mov edx,3 + mov esi,WND_COLOR + int 0x40 + + mov eax,4 + mov ecx,0x00107a30 + mov ebx,LOAD_XY + mov edx,load_char + mov esi,loadlen-load_char + int 0x40 + + mov ebx,LEVLIST_XY + mov edi,0x004e00e7 + xor esi,esi + mov ecx,10 + ll_cycle: + push ecx esi ebx esi + lea ecx,[esi+'0'] + mov [ll_num+2],cl + mov ecx,edi + mov edx,ll_num + mov esi,4 + int 0x40 + add ebx,25 shl 16 + pop esi + add esi,[levpage] + mov edx,[levelmap+esi*4] + add edx,4 + movzx esi,byte[edx-1] + int 0x40 + pop ebx esi ecx + inc esi + mov edx,[levelcount] + sub edx,[levpage] + cmp edx,esi + jbe choose_print + add ebx,LEVLIST_SPACING + loop ll_cycle + choose_print: + mov edx,ll_msg + mov esi,ll_msg_end-ll_msg + mov ebx,CHOOSE_XY + draw_level_file: + mov eax,4 + int 0x40 + + end_of_draw: + mov eax,12 + mov ebx,2 + int 0x40 + + ret + +; ********************************************* +; ******* DRAW CELL IMAGES WITHIN FIELD ******* +; ********************************************* + +draw_field: + cmp byte[workmode],sSokonex + jne no_chl + call check_lasers ; Sokonex game + no_chl: + mov eax,13 ; clear field area + mov edx,WND_COLOR + mov edi,[levptr] + movzx ebx,byte[edi+1] + shl ebx,4 + lea ebx, [FLD_LEFT2+ebx] + movzx ecx,byte[edi+2] + shl ecx,4 + lea ecx, [FLD_TOP shl 16+ecx] + int 0x40 + + mov edx, FLD_LEFT2+FLD_TOP + movzx edi,byte[edi+1] + shl edi,20 + add edi, FLD_LEFT2 + + xor eax,eax + mov ecx,[fld_size] + mov esi,field + fld_cycle: + lodsb + call draw_img + add edx,SHIFT + cmp edx,edi + jl no_nl + add edx,16 + and edx,0xffff + add edx,FLD_LEFT2 + no_nl: + loop fld_cycle + cmp byte[workmode],sSokonex + jne end_of_df + call draw_lasers + end_of_df: + ret + +; ********************************************* +; *********** DRAW CELL IMAGE ***************** +; ********************************************* + +draw_img: ; in: eax-object index, edx-coordinates + pusha + cmp eax,tWall + jbe no_adjust + cmp [workmode],sSokolor + jne no_di_color + add eax,pm_col-pm_nex + jmp no_adjust + no_di_color: + cmp [workmode],sSokonex + jne no_adjust + inc eax + no_adjust: + movzx ebx,byte [pic_map+eax] + cmp ebx,0xf + je no_img + bl_place: + mov ecx, IMG_SIZE + imul ebx, 256*3 + add ebx,strip + mov eax,7 ; draw_image sysfunc + int 0x40 + no_img: + popa + ret + +;**************************************** +;******* DRAW CONTENTS OF INPUT LINE **** +;**************************************** +draw_input: + push edi + cmp eax,4 + jne highlight + mov esi,WND_COLOR + jmp di_draw + highlight: + mov esi,0xe0e0e0 + di_draw: + mov eax,8 + mov ebx,INP_X + mov ecx,INP_Y + mov edx,2 + int 0x40 + mov eax,4 + mov ecx,0x00107a30 ; 1 梥 ( 0xF0RRGGBB ) + mov ebx,INP_XY + mov edx,fn_input + mov esi,[inp_pos] + int 0x40 + pop edi + ret + +; ******************************************************** +; * DECOMPRESS LEVEL & FILL SOME TABLES TO CHECK VICTORY * +; ******************************************************** + +decode_field: +; debug_print <13,10> + xor eax,eax + mov dword[checkpoint],eax + mov dword[checkpoint+4],eax + mov byte[checkcount],al + mov edi,[levptr] + mov dl,[edi] + mov [workmode],dl + movzx edx,byte[edi+1] + mov esi,edx + shl esi,4 + add esi,FLD_LEFT*2-25 + mov [wnd_width],esi + neg edx + mov [move_map+8],edx + neg edx + mov [move_map+4],edx + movzx eax,byte[edi+2] + mov esi,eax + shl esi,4 + add esi,FLD_TOP*2-18 + mov [wnd_height],esi + imul edx,eax + mov [fld_size],edx + lea esi,[edi+4] + movzx ecx,byte[edi+3] + add esi,ecx + cmp byte[esi],0xff + je backto_set + xor edi,edi + cld + dec_cycle: + lodsb + movzx ecx,al + and ecx,0xf ; ecx-count of objects + shr al,4 ; eax-index of object + inc ecx + sub edx,ecx + dc_cycle: + mov [field+edi],al + call chk_win_obj + jne no_register + push eax ecx esi + movzx ecx,al + shl eax,12 + or eax,edi + inc byte[checkcount] + cmp [workmode],sSokolor + jne chk_sokoban +; debug_print ':' +; debug_print_dec ecx + sub ecx,tRedB + shl ecx,1 + cmp word[checkpoint+ecx],0 + jnz no_new_check + mov [checkpoint+ecx],ax + and eax,0xfff +; debug_print_dec eax + jmp no_new_check + chk_sokoban: + cmp [workmode],sSokonex + jne no_nex + cmp byte[checkcount],1 + ja no_new_check + no_nex: + movzx ecx,byte[checkcount] + mov word[checkpoint-2+ecx*2],ax + no_new_check: + pop esi ecx eax + no_register: + inc edi + loop dc_cycle + cmp edx,0 + jg dec_cycle + mov ecx,[fld_size] + xor edx,edx + fp_cycle: + mov al,[field+edx] + and al,0xfe + cmp al,tPlayer + je pl_found + inc edx + loop fp_cycle + pl_found: + mov [player],dx + movzx eax,byte[checkcount] +; debug_print_dec eax + ret + +; ********************************************* +; * WHETHER OBJECT IS VICTORY DEPENDENT ******* +; ********************************************* + +chk_win_obj: ; al-object in a cell + push ecx eax + and al,0xf + mov cl,[workmode] + cmp cl,sSokoban + jne nota_sokoban + cmp al,tBlock + jmp cwo_exit + nota_sokoban: + cmp cl,sSokonex + jne nota_sokonex + cmp al,tConnect + je cwo_exit + cmp al,tStConnect + jmp cwo_exit + nota_sokonex: + push eax + and eax,tRedB + cmp eax,tRedB + pop eax + cwo_exit: + pop eax ecx + ret + +; ********************************************* +; ***** GET CELL AT CERTAIN DIRECTION ********* +; ********************************************* + +get_cell_at: ; in: dx - current cell, cl - direction + mov ebx,edx ; out: al - object at direction, bx - new position + movzx eax,cl + and eax,11b + mov eax, [move_map+eax*4] + add ebx,eax + mov al,[field+ebx] + ret + +; ********************************************* +; *** WHETHER A MOVE CAN BE DONE, & DO IT ***** +; ********************************************* + +valid_move: ; in: dx - current cell, cl - direction + push edx esi + call get_cell_at ; if ch>0 perform all moves + cmp al,tWall + jb result_ok + je vm_exit + cmp [workmode],sSokonex + jne n_vm_nex + cmp al,tStConnect + je vm_exit + cmp al,tHole + je vm_exit + n_vm_nex: + push edx ebx + mov edx,ebx + movzx esi,al + call get_cell_at + cmp al,tPlace + jbe push_it + cmp [workmode],sSokonex + jne no_plate + cmp al,tHole + jne no_plate + cmp esi,tBroken + jae vm_sink + cmp esi,tPlate + jne no_plate + and byte[field+ebx],0 + vm_sink: + and byte[field+edx],0 + jmp vm_hole + no_plate: + pop ebx edx esi edx + ret + push_it: + call do_move + vm_hole: + pop ebx edx + result_ok: + call do_move + xor al,al + vm_exit: + pop esi edx + ret + +; ********************************************* +; ******* ACTUALLY PERFORM MOVES ************** +; ********************************************* + +do_move: ; in: dx - source cell + test ch,ch ; bx - target cell + jz dm_exit ; ch = 0 don't perform moves + mov al,byte[field+edx] + cmp byte[workmode],sSokoban + jne no_dm_ban + and al,0xfe + no_dm_ban: + xor byte[field+edx],al + or byte[field+ebx],al + call chk_win_obj + jne no_check_win + pusha + movzx ecx,byte[checkcount] + xor edi,edi + dm_cycle: + movzx esi,word[checkpoint+edi*2] + and esi,0xfff + and edx,0xfff + cmp esi,edx + jnz not_an_obj + movzx eax,dl + movzx eax,byte[field+ebx] + shl eax,12 + or eax,ebx + mov word[checkpoint+edi*2],ax + jmp dm_ex + not_an_obj: + inc edi + loop dm_cycle + dm_ex: + popa + call check_win + jne no_check_win + mov byte[winmode],WM_WINNER + no_check_win: + cmp al,tPlayer + jne dm_exit + mov [player],bx + dm_exit: + ret + +; ********************************************* +; ******* CHECK VICTORY CONDITIONS ************ +; ********************************************* + +check_win: +; debug_print <13,10> + push eax ebx ecx esi + xor eax,eax + movzx ecx,byte[checkcount] + mov esi,checkpoint + mov bl,byte[workmode] + xor bh,bh + mov [colcount],bh + cld + cw_cycle: + lodsw + cmp bl,sSokoban + jne nocw_sokoban + test ax,1 shl 12 + jz cw_not_inplace + inc bh + cw_not_inplace: + loop cw_cycle +; movzx eax,bh + cmp [checkcount],bh + jmp cw_exit + nocw_sokoban: + cmp bl,sSokonex + jne nocw_sokonex + mov dx,ax + call scan_root + cmp al,[checkcount] + jmp cw_exit + + nocw_sokonex: + cmp esi,checkpoint+8 + ja cwlor_exit +; debug_print '*' + test ax,ax + jz cw_cycle + mov dx,ax + call scan_root + add [colcount],al +; debug_print '*->' +; debug_print_dec eax + jmp cw_cycle + cwlor_exit: + mov al,[colcount] + cmp al,[checkcount] + cw_exit: +; debug_print <13,10> + pop esi ecx ebx eax + ret + +; ********************************************* +; **** WHETHER LASERS DESTROY SOMETHING ******* +; ********************************************* + +check_lasers: + pusha + xor edx,edx + mov ecx,[fld_size] + cl_loop: + push ecx edx + mov cl,[field+edx] + sub cl,tLaserW + jl cl_exit + cl_begin: + call get_cell_at + cmp al,tLaserW + jae cl_destroy + cmp al,tBroken + je cl_destroy + cmp al,tEmpty + je no_cl_destroy + cmp al,tHole + je no_cl_destroy + cmp al,tPlayer + jne cl_exit + mov ecx,0x00ac0000 + mov edx,lose_msg + mov esi,lose_msg_end-lose_msg ; print loose message + mov byte[winmode],WM_LOSE + mov ebx,WIN_XY + mov eax,4 + int 0x40 + jmp cl_exit + cl_destroy: + mov byte[field+ebx],0 + no_cl_destroy: + mov edx,ebx + jmp cl_begin + cl_exit: + pop edx ecx + inc edx + loop cl_loop + popa + ret + +; ********************************************* +; *** USED BY CHECK_WIN IN SOKONEX & SOKOLOR ** +; ********************************************* + +scan_root: ; input: dx-beginning cell, ebx-what to search + push esi + mov edi,srch ; output: eax-number of win_obj found + mov eax,0xfff + movzx ecx,[checkcount] + inc ecx + cld + rep stosw ; clearing area for scan + movzx ebx,dx + and edx,eax ; dx-cell number to compare with + shr ebx,12 ; bl-obj id + mov [color],bl + mov esi,srch + mov edi,eax ; mask to extract cell + mov word[srch],dx + sr_loop: + lodsw + push esi ; saving scan pointer + movzx edx,ax ; edx-[dirs*4][cell*12] + and edx,edi +; debug_print ' >' + mov ecx,4 + sr_dir_loop1: +; debug_print '.' + push ecx ; saving dir counter + lea ebx,[ecx+11] + bts word[esi-2],bx + jc sr_endloop ; this entry is already processed +; debug_print '^' + dec ecx ; cl-direction + call get_cell_at ; bx-new position, al-object +; cmp [workmode],sSokonex +; jne no_sr_nex + call chk_win_obj + jne sr_endloop ; not a win_obj there +; debug_print '@' + cmp [workmode],sSokolor + jne no_sr_lor + cmp al,[color] + jne sr_endloop + no_sr_lor: + push esi + mov esi,srch ; let us search for existing entries + sr_loop1: + lodsw + and eax,edi ; eax-cell w/o dirs + cmp eax,ebx + je sr_foundentry ; this is the entry we're seeking for + cmp word[esi],0xfff + jnz sr_loop1 ; next entry + ; we reached empty area + mov [esi],bx + add esi,2 + sr_foundentry: + mov eax,15 + sub eax,ecx + bts [esi-2],ax ; mark entry as used + pop esi +; inc [e_fnd] ; one more obj found + sr_endloop: + pop ecx + loop sr_dir_loop1 +; jmp tttt +; sr_dir_loop: +; jmp sr_dir_loop1 +; tttt: + pop esi + cmp word[esi],0xfff + jne sr_loop + mov eax,esi + sub eax,srch + shr eax,1 + pop esi +; debug_print_dec eax + ret + +; ********************************************* +; *** SPECIAL ROUTINE TO DRAW LASERS ********** +; ********************************************* + +draw_lasers: + xor edx,edx + mov ecx,[fld_size] + dl_loop: + push ecx edx + mov cl,[field+edx] + sub cl,tLaserW + jl dl_eloop + inc ch + dl_gca: + call get_cell_at + cmp al,tEmpty + je dl_draw + cmp al,tHole + jne dl_eloop + dl_draw: + call draw_beams + mov edx,ebx + jmp dl_gca + dl_eloop: + pop edx + inc edx + pop ecx + loop dl_loop + ret + +; ********************************************* +; *** DRAWS LASER BEAMS IN CERTAIN DIRECTION ** +; ********************************************* + +draw_beams: + pusha + mov esi,[levptr] + movzx esi,byte[esi+1] + mov eax,ebx + xor edx,edx + div esi + movzx esi,cl + dec esi + shr esi,1 + and esi,1 + shl edx,20 + mov ebx,edx + shl eax,20 + mov ecx,eax + add ebx,dword[beam_xy+esi*8] + add ecx,dword[beam_xy+esi*8+4] + mov edx,0xe9e25c + mov eax,13 + int 0x40 + popa + ret + +ud: + ud2 ; debugging purposes only + + +; ********************************************* +; *** COMPRESS LEVEL - NOT READY YET ********** +; ********************************************* + +; push esi ebx ;ecx +; xchg ebx,edi +; mov esi,edi ; esi,edi - beginning +;; ebx - end of unpacked field +; first_enc: +; lodsb ; al - first byte +; shl ax,8 ; ah - this byte, al=0 +; next_enc: +; cmp esi,ebx +; jae exit_enc +;; movzx ecx,byte[esi] +;; debug_print_dec ecx +; cmp ah,byte[esi] +; jne newchar +; inc esi +; inc al +; cmp al,15 +; jb next_enc +; newchar: +; shl al,4 +; shr ax,4 +; stosb +; jmp first_enc +; exit_enc: +; shl al,4 +; shr ax,4 +; stosb +; mov al,0xff +; stosb +; pop ebx esi ecx +; +; dec ecx +; jcxz outcycle +; jmp next_lev +; outcycle: + + +; 室 ணࠬ: + +; Set the locale in 'macros.inc'. Language support for locales: ru_RU (CP866), en_US. +load_char: +if lang eq ru_RU + db '㧨' +else ; Default to en_US + db 'Open file' +end if +loadlen: + +ll_msg: +if lang eq ru_RU + db '롥 ஢' +else ; Default to en_US + db 'Choose a level' +end if + db ' (0-9, PgUp, PgDn)' +ll_msg_end: + +fn_input: +; db 'cnf' +; db 'soko-4.lev' +if lang eq ru_RU + db ' 䠩' +else ; Default to en_US + db 'or enter a filename' +end if +inp_end: + rb 256-(inp_end-fn_input) + +win_msg: +if lang eq ru_RU + db '!!! 諨 ஢!' +else ; Default to en_US + db "You've completed the level!" +end if +win_msg_end: + +lose_msg: +if lang eq ru_RU + db ' ࠫ! ந...' +else ; Default to en_US + db "You can't move! Game over..." +end if +lose_msg_end: + +zagolovok: + db 'Sokoban', 0 + + +pic_map: + db 0xf,9,0,0,1,1,5,6 +pm_nex: + db 2,7,8,3,4,0xa,0xa,0xa,0xa +pm_col: + db 0xb,0xc,0xd,0xe + +beam_xy: + dd (FLD_LEFT+7) shl 16+2, FLD_TOP2+16 + dd FLD_LEFT2+16, (FLD_TOP+7) shl 16+2 + +ll_num db '00x.' + +move_map dd -1,+0,-0,1 ; 0 - W, 1 - S, 2 - N, 3 - E + +stdlev db 'SOKO-0.LEV',0 +stdlev_len: + +inp_pos dd inp_end-fn_input +entered dd 0 + +file_info: + dd 0 ; subfunction - read + dd 0, 0 ; file offset + dd 0x20000 ; number of bytes to read +cnf_level dd strip ; data buffer +file_name db 'SKIN.' +file_num db 'RAW',0 + + rb 256-($-file_name) + +I_END: ; ணࠬ + +winmode db ? +scanptr dd ? +levpage dd ? +workmode db ? +player dw ? +fld_size dd ? +levptr dd ? +wnd_height dd ? +wnd_width dd ? +color db ? +colcount db ? +levelcount dd ? +checkcount db ? +checkpoint rw 256 +levelmap rd 1024 +strip rb SKIN_SIZE + +workarea: + srch rb 0x10000-($-workarea) + +level_start rb 0x20000 +field: diff --git a/programs/games/sq_game/trunk/SQ_GAME.ASM b/programs/games/sq_game/trunk/SQ_GAME.ASM index 17106482a..ea697fe24 100644 --- a/programs/games/sq_game/trunk/SQ_GAME.ASM +++ b/programs/games/sq_game/trunk/SQ_GAME.ASM @@ -1,241 +1,242 @@ -; SQ_game for MenuetOS -; Author: Alexei Ershov aka ealex -; E-mail: e-al[at]yandex[dot]ru -; Fidonet: 2:469/335.38 -; slightly updated by leency and renamed to Lights -; https://en.wikipedia.org/wiki/Lights_Out_(game) -; slightly optimized by diamond -; english translation by diamond (two strings in end of source) - - - BtnSize equ 36 ; ࠧ - BtnSpace equ 0 ; ஬⮪ - NofBtn equ 4 ; ࠧ (3-15) - Color1 equ 0xcc0000 - Color2 equ 0x00cc00 - - FieldSize = (BtnSize+BtnSpace)*NofBtn + BtnSpace*3 - center = FieldSize / 2 - margin = 20 - - - use32 ; 32- ० ᥬ - org 0x0 ; - - db 'MENUET01' ; 8- 䨪 MenuetOS - dd 0x01 ; (ᥣ 1) - dd START ; ࢮ - dd I_END ; ࠧ ணࠬ - dd 0x1000 ; ⢮ - dd 0x1000 ; 設 - dd 0x0 ; ࠬ஢ ( ᯮ) - dd 0x0 ; १ࢨ஢ - -include '../../../macros.inc' ; ᥬ騪! - - -START: - call Game_Init -red: - call Draw_Window - -still: - mcall 10 ; 㭪 10 - ᮡ - dec eax - jz red - dec eax - jnz button - - key: ; - mov al, 2 - int 0x40 - jmp still -;--------------------------------------------------------------------- - -button: - mov al, 17 ; 17 - 䨪 ⮩ - int 0x40 - cmp ah, 1 ; ᫨ ஬ 1, 室 - je .exit - - cmp ah, 2 ; ᫨ 2, 稭 - je START - - ; - inc dword [moves] ; 㢥稢 ᫮ 室 - - shr eax, 8 ; eax 䨪 ⮩ - - mov dh, NofBtn - div dh ; al = ax( ) / NofBtn - ; ah = ⮪ (. 㭮) - mov ebx, eax ; ࠭ ⭮ ⮪ ebx - - ; al\ah 0 1 2 3 - ; +-+ +-+ +-+ +-+ - ; 1 |4| |5| |6| |7| - ; +-+ +-+ +-+ +-+ - - ; +-+ +-+ +-+ +-+ - ; 2 |8| |9| |10 |11 - ; +-+ +-+ +-+ +-+ - - ; +-+ +-+ +-+ +-+ - ; 3 |12 |13 |14 |15 - ; +-+ +-+ +-+ +-+ - - ; +-+ +-+ +-+ +-+ - ; 4 |16 |17 |18 |19 - ; +-+ +-+ +-+ +-+ - -; 塞 梥 ⮫ - shr eax, 8 ; eax = ah - mov edi, field - add edi, eax ; edi 㪠 ᪮ ⫡ - mov ecx, NofBtn -@@: - not byte[edi] ; 塞 梥 ᥬ ⮫ - dec ecx - add edi, NofBtn - test ecx, ecx - jnz @r - -; 塞 梥 ப - mov eax, ebx ; ⠭ eax - dec eax - mov dl, NofBtn - mul dl ; ax = al * NofBtn - mov edi, field - add edi, eax ; edi 㪠 ᪮ ப - mov ecx, NofBtn -@@: - not byte [edi] ; 塞 梥 ᥩ ப - dec ecx - inc edi - test ecx, ecx - jnz @r -; ⮩ 2 ࠧ ( ࠡ뢠 ப ⮫), -; .. ⠫ ࢮ砫 -; 塞 梥 ⮩ - shr ebx, 8 ; ebx = ⮪ (ah 㭪) - not byte [field+eax+ebx] - jmp red - - - - .exit: - mcall -1 ; ணࠬ - - -;---------------------------------------------------------------------------- -; Draw_Window -;---------------------------------------------------------------------------- -Draw_Window: - - mcall 12, 1 - mcall 0, 200*65536+FieldSize+margin*2,\ - 200*65536+FieldSize+28+margin*3,\ - 0x14DDD7CF, 0x805080D0, header - - mcall 8, (BtnSpace*2+margin)*65536 + 83,\ - (FieldSize+BtnSpace+margin*2+10)*65536+ 22, 2 - mcall 4, (BtnSpace*2+3+margin)*65536+(FieldSize+BtnSpace+margin*2)+14,\ - 0x90DDEEFF, strNew - mcall 4, (center - 25+margin) * 65536 + 30, 0x80000000, strMovs - mcall 47, 4*65536+1, moves, (center + 2+margin ) * 65536 + 30, 0 - - - - mov ecx, (20+20+BtnSpace-BtnSize)*65536+BtnSize - mov edx, NofBtn ; 䨪 ࢮ - ; 㭮 - -buttons: ; 㥬 窨 - mov eax, edx - mov dh, NofBtn - div dh ; al = ax / dh, ah - ⮪ - mov dh, 0 - test ah, ah ; ᫨ ah = 0, 稭 - jnz @f - add ecx, (BtnSize+BtnSpace)*65536 - mov ebx, (BtnSpace*2+margin)*65536+BtnSize+1 -@@: - mov esi, Color1 ; - cmp byte [field-NofBtn+edx], 0 ; field-NofBtn+_ - jz @f ; 梥 - mov esi, Color2 -@@: - mcall 8, - add ebx, (BtnSize+BtnSpace)*65536 - inc edx ; 室 ᫥饩 - cmp edx, NofBtn*(NofBtn+1) - jb buttons - - mcall 12, 2 ; 㭪 12: ᮮ ᮢ - -ret - -;---------------------------------------------------------------------------- -; Game_Init -;---------------------------------------------------------------------------- -Game_Init: - and [moves], 0 ; 㫨 ⢮ 室 - - call random ; eax 砩 ᫮ - mov ecx, NofBtn * NofBtn ; ecx - - mov bh, 0 ; 㤥 - ; 1 eax, bh - ᪮쪮 -button_init: ; 㦥 ᯮ짮 - shr eax, 1 ; 訩 䫠 CF - ; ᨬ 祭 - ; bl 뢠 -1 0 - sbb bl, bl - mov [field + ecx - 1], bl - - inc bh - cmp bh, 32 ; ᫨ ᯮ짮 32 eax - jb @f ; 砩 ᫮ - call random - mov bh, 0 -@@: - loop button_init - -ret - -;---------------------------------------------------------------------------- -; random - -;---------------------------------------------------------------------------- -random: mov eax,[generator] - add eax,-43ab45b5h - ror eax,1 - xor eax,32c4324fh - ror eax,1 - mov [generator],eax - ; --- IVAN --- - mov eax,26 - mov ebx,9 - int 0x40 - xor eax,0xdeadbeef - add eax,[generator] - ; --- IVAN --- - ret - -;============================================================================ - -field db NofBtn * NofBtn dup(0) -moves dd 0 -generator dd 0 - -header db 'Lights',0 - -if lang eq ru_RU -strMovs db '',0 -strNew db ' ',0 -else -strMovs db 'MOVE',0 -strNew db ' New game',0 -end if - - - -I_END: ; ⪠ ணࠬ +; SQ_game for MenuetOS +; Author: Alexei Ershov aka ealex +; E-mail: e-al[at]yandex[dot]ru +; Fidonet: 2:469/335.38 +; slightly updated by leency and renamed to Lights +; https://en.wikipedia.org/wiki/Lights_Out_(game) +; slightly optimized by diamond +; English translation by diamond (two strings in end of source) + + + BtnSize equ 36 ; ࠧ + BtnSpace equ 0 ; ஬⮪ + NofBtn equ 4 ; ࠧ (3-15) + Color1 equ 0xcc0000 + Color2 equ 0x00cc00 + + FieldSize = (BtnSize+BtnSpace)*NofBtn + BtnSpace*3 + center = FieldSize / 2 + margin = 20 + + + use32 ; 32- ० ᥬ + org 0x0 ; + + db 'MENUET01' ; 8- 䨪 MenuetOS + dd 0x01 ; (ᥣ 1) + dd START ; ࢮ + dd I_END ; ࠧ ணࠬ + dd 0x1000 ; ⢮ + dd 0x1000 ; 設 + dd 0x0 ; ࠬ஢ ( ᯮ) + dd 0x0 ; १ࢨ஢ + +include '../../../macros.inc' ; ᥬ騪! + +; Language support for locales: ru_RU (CP866), en_US. + +START: + call Game_Init +red: + call Draw_Window + +still: + mcall 10 ; 㭪 10 - ᮡ + dec eax + jz red + dec eax + jnz button + + key: ; + mov al, 2 + int 0x40 + jmp still +;--------------------------------------------------------------------- + +button: + mov al, 17 ; 17 - 䨪 ⮩ + int 0x40 + cmp ah, 1 ; ᫨ ஬ 1, 室 + je .exit + + cmp ah, 2 ; ᫨ 2, 稭 + je START + + ; + inc dword [moves] ; 㢥稢 ᫮ 室 + + shr eax, 8 ; eax 䨪 ⮩ + + mov dh, NofBtn + div dh ; al = ax( ) / NofBtn + ; ah = ⮪ (. 㭮) + mov ebx, eax ; ࠭ ⭮ ⮪ ebx + + ; al\ah 0 1 2 3 + ; +-+ +-+ +-+ +-+ + ; 1 |4| |5| |6| |7| + ; +-+ +-+ +-+ +-+ + + ; +-+ +-+ +-+ +-+ + ; 2 |8| |9| |10 |11 + ; +-+ +-+ +-+ +-+ + + ; +-+ +-+ +-+ +-+ + ; 3 |12 |13 |14 |15 + ; +-+ +-+ +-+ +-+ + + ; +-+ +-+ +-+ +-+ + ; 4 |16 |17 |18 |19 + ; +-+ +-+ +-+ +-+ + +; 塞 梥 ⮫ + shr eax, 8 ; eax = ah + mov edi, field + add edi, eax ; edi 㪠 ᪮ ⫡ + mov ecx, NofBtn +@@: + not byte[edi] ; 塞 梥 ᥬ ⮫ + dec ecx + add edi, NofBtn + test ecx, ecx + jnz @r + +; 塞 梥 ப + mov eax, ebx ; ⠭ eax + dec eax + mov dl, NofBtn + mul dl ; ax = al * NofBtn + mov edi, field + add edi, eax ; edi 㪠 ᪮ ப + mov ecx, NofBtn +@@: + not byte [edi] ; 塞 梥 ᥩ ப + dec ecx + inc edi + test ecx, ecx + jnz @r +; ⮩ 2 ࠧ ( ࠡ뢠 ப ⮫), +; .. ⠫ ࢮ砫 +; 塞 梥 ⮩ + shr ebx, 8 ; ebx = ⮪ (ah 㭪) + not byte [field+eax+ebx] + jmp red + + + + .exit: + mcall -1 ; ணࠬ + + +;---------------------------------------------------------------------------- +; Draw_Window +;---------------------------------------------------------------------------- +Draw_Window: + + mcall 12, 1 + mcall 0, 200*65536+FieldSize+margin*2,\ + 200*65536+FieldSize+28+margin*3,\ + 0x14DDD7CF, 0x805080D0, header + + mcall 8, (BtnSpace*2+margin)*65536 + 83,\ + (FieldSize+BtnSpace+margin*2+10)*65536+ 22, 2 + mcall 4, (BtnSpace*2+3+margin)*65536+(FieldSize+BtnSpace+margin*2)+14,\ + 0x90DDEEFF, strNew + mcall 4, (center - 25+margin) * 65536 + 30, 0x80000000, strMovs + mcall 47, 4*65536+1, moves, (center + 2+margin ) * 65536 + 30, 0 + + + + mov ecx, (20+20+BtnSpace-BtnSize)*65536+BtnSize + mov edx, NofBtn ; 䨪 ࢮ + ; 㭮 + +buttons: ; 㥬 窨 + mov eax, edx + mov dh, NofBtn + div dh ; al = ax / dh, ah - ⮪ + mov dh, 0 + test ah, ah ; ᫨ ah = 0, 稭 + jnz @f + add ecx, (BtnSize+BtnSpace)*65536 + mov ebx, (BtnSpace*2+margin)*65536+BtnSize+1 +@@: + mov esi, Color1 ; + cmp byte [field-NofBtn+edx], 0 ; field-NofBtn+_ + jz @f ; 梥 + mov esi, Color2 +@@: + mcall 8, + add ebx, (BtnSize+BtnSpace)*65536 + inc edx ; 室 ᫥饩 + cmp edx, NofBtn*(NofBtn+1) + jb buttons + + mcall 12, 2 ; 㭪 12: ᮮ ᮢ + +ret + +;---------------------------------------------------------------------------- +; Game_Init +;---------------------------------------------------------------------------- +Game_Init: + and [moves], 0 ; 㫨 ⢮ 室 + + call random ; eax 砩 ᫮ + mov ecx, NofBtn * NofBtn ; ecx - + mov bh, 0 ; 㤥 + ; 1 eax, bh - ᪮쪮 +button_init: ; 㦥 ᯮ짮 + shr eax, 1 ; 訩 䫠 CF + ; ᨬ 祭 + ; bl 뢠 -1 0 + sbb bl, bl + mov [field + ecx - 1], bl + + inc bh + cmp bh, 32 ; ᫨ ᯮ짮 32 eax + jb @f ; 砩 ᫮ + call random + mov bh, 0 +@@: + loop button_init + +ret + +;---------------------------------------------------------------------------- +; random - +;---------------------------------------------------------------------------- +random: mov eax,[generator] + add eax,-43ab45b5h + ror eax,1 + xor eax,32c4324fh + ror eax,1 + mov [generator],eax + ; --- IVAN --- + mov eax,26 + mov ebx,9 + int 0x40 + xor eax,0xdeadbeef + add eax,[generator] + ; --- IVAN --- + ret + +;============================================================================ + +field db NofBtn * NofBtn dup(0) +moves dd 0 +generator dd 0 + +header db 'Lights',0 + +if lang eq ru_RU +strMovs db '',0 +strNew db ' ',0 +else ; Default to en_US +strMovs db 'MOVE',0 +strNew db ' New game',0 +end if + + + +I_END: ; ⪠ ணࠬ diff --git a/programs/games/sudoku/trunk/sudoku.asm b/programs/games/sudoku/trunk/sudoku.asm index 9bed8afd4..e4efcc9cb 100644 --- a/programs/games/sudoku/trunk/sudoku.asm +++ b/programs/games/sudoku/trunk/sudoku.asm @@ -1,1162 +1,1162 @@ -; 4.11.2009 staper@inbox.ru - -; 2.06.2010 fixed a little bug in check - -;based on http://sources.codenet.ru/download/1599/Sudoku.html - -; ࠢ 㣫 ᯮ , -; 㢥稢 ࠧ. - -; ணࠬ ஢ ப ࠬ஢; । -; 䠩 祩. - -; ⠭ : -; n - ᣥ஢ ⠡ -; c - ஢ 襭 -; ஡ - 襭 -; +- - ஢ ᫮ -; t - ਮ⠭/ ᥪ㭤 -; i - ᢮ ਬ -; r - -; l - 㧨 䠩 -; s - ࠭ 䠩 -; a - ࠭ 襭 䠩 - -use32 -org 0x0 - db 'MENUET01' - dd 0x1, START, I_END, (D_END+10000) and not 3, (D_END+10000) and not 3, buf_cmd_lin, cur_dir_path - -Difficult db 0 ;᫮ [0..9] -Difficult_array db 80,75,68,59,50,45,40,36,32,25 - -;: -Bckgrd_clr equ 0xffffff ;䮭 -Brdr_line_clr equ 0x780000 ; ࠭栬 -Inter_line_clr equ 0xb0b0b0 ;७ -Square_clr equ 0xdddddd ;梥 -Fix_nmb_clr equ 0x335533;0 ;筮 祭 -Chg_nmb_clr equ 0;x008d8d ;६ 祭 -Text_clr equ 0x000000 ;⥪ -Message_clr equ 0x0000ff ;ᮮ饭 - -DEBUG equ 0 - -macro dbg_dec num -{pushad -newline -debug_print_dec num -popad -} - -include '../../../macros.inc' -;include 'debug.inc' -include 'editbox_ex.mac' -include 'lang.inc' -include 'SudokuSolve.pas' - - -START: - mcall 40,7 - mcall 3 - mov [rsx1],ax - ror eax,16 - mov [rsx2],ax - rol eax,7 - mov [rsx3],ax - rol eax,7 - mov [rsx4],ax - -; call LOAD_LIB ;loading Box_Lib library - -; This is the part of the macros for load any library/libraries by -LOAD_LIB: - mcall 68,19,system_path ; load of sys directory - test eax,eax - jnz .end_steep - - bts [flags],7 -; ret - jmp .end - -.end_steep: - -; initialize import - mov edx, eax - mov esi,myimport -.import_loop: - lodsd - test eax, eax - jz .import_done - push edx -.import_find: - mov ebx, [ds:edx] - test ebx, ebx - jz .exit ;import_not_found - push eax -.lp: - mov cl, [ds:eax] - cmp cl, [ds:ebx] - jnz .import_find_next - test cl, cl - jz .import_found - inc eax - inc ebx - jmp .lp -.import_find_next: - pop eax - add edx, 8 - jmp .import_find -.import_found: - pop eax - mov eax, [ds:edx+4] - mov [esi-4], eax - pop edx - jmp .import_loop -.exit: - add esp,4 - - bts [flags],7 -;ret - jmp .end - -.import_done: - btr [flags],7 - -;।塞 ப ࠬࠬ - mov esi,buf_cmd_lin - xor eax,eax -@@: cmp byte [esi+eax],0 - je @f - inc eax - jmp @b -@@: mov dword [edit1.size],eax - mov dword [edit1.pos],eax -;ret -.end: - - bt [flags],7 - jc @f - mcall 68,11 - cmp dword [edit1.pos],0 - je @f - call load_sudoku - jnc redraw_all -@@: jmp key.new_game - - -redraw_all: - mcall 12,1 - mcall 48,4 - add eax,100*65536+(24*9+67) - mov ecx,eax - mcall 0,100*65536+(24*9+12),,(0x34000000+Bckgrd_clr),,title - mcall 38,1*65536+(24*9+1),21*65536+21,Brdr_line_clr - mov edx,Inter_line_clr - mov edi,3 - mov esi,3 - @@: add ecx,24*65536+24 - mcall - dec esi - jnz @b - mov esi,3 - push edx - mcall ,,,Brdr_line_clr - pop edx - dec edi - jnz @b - mcall ,1*65536+1,22*65536+236,Inter_line_clr;0xe7e6a0 - mov edx,Inter_line_clr - mov edi,3 - mov esi,3 - push edx - mcall ,,,Brdr_line_clr - pop edx - - @@: add ebx,24*65536+24 - mcall - dec esi - jnz @b - mov esi,3 - push edx - mcall ,,,Brdr_line_clr - pop edx - dec edi - jnz @b - - mcall 8,<208,8>,<257,8>,2,0xbbbbbb - mcall 4,<5,5>,(0x80000000+Text_clr),txt.new - mcall ,<105,5>,,txt.dif - mcall ,<5,258>,,txt.space - mcall ,<5,246>,,txt.check - mcall ,<129,246>,,txt.time - mcall ,<5,285>,,txt.own_map - mcall ,<5,296>,,txt.solve - mcall ,<90,296>,,txt.load - mcall ,<5,306>,,txt.save - mcall ,<90,306>,,txt.save_solve - - bts [flags],5 - call Timer.0 - call show_level - - push dword Map;esi; mov esi,Map - mcall 12,2 -draw_pole: - if DEBUG - call SysMsgBoardNum ;show esp - endf - - movzx eax,[Y] - dec al - mov ebx,9 - mul bl - mov bl,[X] - add al,bl - pop esi ; mov esi,Map - push eax ;稪 - mov edi,81-9 - mov ebp,9 - mov ebx,1*65536+21 - mov ecx,21*65536+41 - call out_numbers - pop eax - bt [flags],2 - jc key.0 - -still: - mcall 23,10 - test eax,eax - jz Timer - - dec al - jz redraw_all - dec al - jz key - dec al - jnz still -;button: - mcall 17 - cmp ah,1 - jne @f - mcall -1 -@@: cmp ah,2 - jne still - btc [flags],9 - mcall 48,4 - add eax,(24*9+67) - mov esi,eax - bt [flags],9 - jnc @f - add esi,40 -@@: mcall 67,-1,-1,(24*9+12), - jmp still -key: - mcall 2 - cmp ah,32 ;஡ -jne @f - btc [flags],3 - jc .todraw - push dword SolveMap - jmp draw_pole - .todraw: - push dword Map - jmp draw_pole -@@: - bt [flags],3 - jnc @f - bts [flags],2 - push eax - push dword Map - jmp draw_pole -.0: pop eax - btr [flags],2 - btr [flags],3 -@@: cmp ah,108 ;l - jne @f - bt [flags],7 - jc still - bt [flags],6 - jc still - bts [flags],8 - call window_load_save - jmp still -@@: cmp ah,115 ;s - jne @f - btr [flags],10 -.sresh: bt [flags],7 - jc still - bt [flags],6 - jc still - btr [flags],8 - call window_load_save - jmp still -@@: cmp ah,97 ;a - jne @f - bts [flags],10 - jmp .sresh -@@: cmp ah,116 ;t - jne @f - btc [flags],1 - jnc still - mcall 26,9 - sub eax,[Ticks_new] - push eax - mov eax,[Ticks] - mov ebx,100 - mul ebx - pop ecx - sub ecx,eax - add [Ticks_new],ecx - jmp still - -@@: cmp ah,105 ;i - jne @f - xor ecx,ecx - .105_0: - mov byte [SolveMap+ecx],0 - mov byte [Map+ecx],0 - inc ecx - cmp ecx,9*9 - jb .105_0 - jmp .todraw - -@@: cmp ah,114 ;r - jne .43 - xor ecx,ecx - .114_0: - mov al,[Map+ecx] - cmp al,9 - jbe @f - sub al,10 - @@: - mov [SolveMap+ecx],al - inc ecx - cmp ecx,9*9 - jb .114_0 - mov esi,SolveMap - call Solve - cmp [_iRet],1 - jne @f - mov edx,txt.check_yes - call Show_message - jmp still - @@: ; 襭 - xor ecx,ecx - @@: - mov byte [SolveMap+ecx],0 - inc ecx - cmp ecx,9*9 - jb @b - mov edx,txt.nosolve - call Show_message - jmp still - -.43: cmp ah,43 ;+ - jne .45 - cmp [Difficult],9 - je still - inc [Difficult] - call show_level - jmp still -.45: ;- - cmp ah,45 - jne .99 - cmp [Difficult],0 - je still - dec [Difficult] - call show_level - jmp still - -.99: ;Check - cmp ah,99 - jne .39 - bts [flags],15 - xor ecx,ecx - mov edx,txt.check_no -; @@: mov al,byte [Map+ecx] -; cmp byte [SolveMap+ecx],al -; jne @f -; inc ecx -; cmp ecx,9*9 -; jb @b - @@: mov al,byte [Map+ecx] ;७ᨬ 祭 ६ ᨢ - cmp al,9 - jbe .991 - sub al,10 - .991: - mov [TempMap+ecx],al - inc ecx - cmp ecx,9*9 - jb @b - mov esi,TempMap - call CheckSudoku - jc @f - mov edx,txt.check_yes - @@: btr [flags],15 - call Show_message - jmp .todraw - -.39: cmp ah,0x39 - ja .110 - cmp ah,0x30 - jb still - sub ah,0x30 - mov cl,ah - - movzx eax,[Y] - dec al - mov ebx,9 - mul bl - mov bl,[X] - dec bl - add al,bl - mov esi,Map - cmp byte [esi+eax],9 - jg still - mov [esi+eax],cl - jmp .onedraw - -.110: cmp ah,110 ;n - jne .176 -.new_game: - call GeneratePlayBoard - mov [Ticks],0 - mcall 26,9 - mov [Ticks_new],eax - jmp redraw_all - -.176: cmp ah,176 ; - jne .177 - call draw_one_symbol - dec [X] - cmp [X],1 - jge @f - mov [X],9 -@@: jmp .onedraw -.177: cmp ah,177 - jne .178 - call draw_one_symbol - inc [Y] - cmp [Y],9 - jbe @f - mov [Y],1 -@@: jmp .onedraw -.178: cmp ah,178 - jne .179 - call draw_one_symbol - dec [Y] - cmp [Y],1 - jge @f - mov [Y],9 -@@: jmp .onedraw -.179: cmp ah,179 - jne still - call draw_one_symbol - inc [X] - cmp [X],9 - jbe @f - mov [X],1 -@@: -.onedraw: - bts [flags],4 - call draw_one_symbol - jmp still ;.todraw - -show_level: - movzx ecx,[Difficult] - mcall 47,0x10000,,<205,5>,(0x50000000+Text_clr),Bckgrd_clr -ret - -Show_message: - mcall 4,<5,269>,(0xd0000000+Message_clr),,,Bckgrd_clr -ret - -Timer: - bt [flags],1 - jc still - mcall 26,9 - sub eax,[Ticks_new] - mov ebx,100 - xor edx,edx - div ebx - cmp eax,[Ticks] - je still - mov [Ticks],eax -.1: mov ebx,60 - xor edx,edx - div ebx - push eax - mov ecx,edx - mcall 47,0x00020000,,<206,246>,(0x40000000+Text_clr),Bckgrd_clr - pop ecx - mov edx,189*65536+246 - mcall - bt [flags],5 - jnc @f - btr [flags],5 - ret -@@: jmp still -.0: mov eax,[Ticks] - jmp .1 - -draw_one_symbol: - movzx eax,[X] - mov ebx,24*65536+24 - mul ebx - xchg eax,ebx - add ebx,(1*65536+21-24*65536+24) - movzx eax,[Y] - mov ecx,24*65536+24 - mul ecx - xchg eax,ecx - add ecx,(21*65536+41-24*65536+24) - movzx eax,[Y] - dec al - push ebx - mov ebx,9 - mul bl - mov bl,[X] - add al,bl - dec al - pop ebx - mov esi,Map - add esi,eax - push dword 0 ; - bt [flags],4 - jnc @f - mov dword [esp],1 ; - btr [flags],4 -@@: mov edi,0 - mov ebp,1 - call out_numbers - pop eax -ret - - -out_numbers: - push ebx ecx esi - shr ebx,16 - inc bx - shl ebx,16 - add ebx,23 - shr ecx,16 - inc cx - shl ecx,16 - add ecx,23 - mov edx,Bckgrd_clr - push ebp - dec dword [esp+4*5] - jnz @f - mov edx,Square_clr -@@: mcall 13 - pop ebp - pop esi - - cmp byte [esi],0 - je .null - cmp byte [esi],9 - jbe .changeable_number - cmp byte [esi],19 - jbe .fixed_number - jmp .null -.end: - inc esi - dec ebp - jnz out_numbers - test edi,edi - jz @f - sub edi,9 - mov ebp,9 - add ebx,-9*24*65536-9*24 - add ecx,24*65536+24 - jmp out_numbers - @@: -ret - -.fixed_number: - push esi - shr ebx,16 - shr ecx,16 - mov dx,bx - shl edx,16 - mov dx,cx - add edx,8*65536+4 - movzx ebx,byte [esi] - sub ebx,10 - dec ebx - shl ebx,4 - add ebx,FONT - mov ecx,8*65536+16 - push esi ebp edi - mov edi,Pltr.fx - cmp dword [esp+4*7],0 - jne @f - mov edi,Pltr.fxk -@@: mov esi,1 - mov ebp,0 - mcall 65 - pop edi ebp esi -.1: pop esi ecx ebx - add ebx,24*65536+24 - jmp .end - -.null: - pop ecx ebx - add ebx,24*65536+24 - jmp .end -.changeable_number: - push esi - shr ebx,16 - shr ecx,16 - mov dx,bx - shl edx,16 - mov dx,cx - add edx,8*65536+4 - movzx ebx,byte [esi] - dec ebx - shl ebx,4 - add ebx,FONT - mov ecx,8*65536+16 - push esi ebp edi - mov edi,Pltr.ch - cmp dword [esp+4*7],0 - jne @f - mov edi,Pltr.chk -@@: mov esi,1 - mov ebp,0 - mcall 65 - pop edi ebp esi - jmp .1 - - - -GeneratePlayBoard: -;i db 0 -;j db 0 -;RandI db 0 -;RandJ db 0 -;iRet db 0 -;//㥬 襭 -;m: -;for i:=0 to 8 do -; for j:=0 to 8 do -; begin -; Map[i,j]:=0; -; SolveMap[i,j]:=0; -; RealMap[i,j]:=0; -; end; - mov edi,Map - mov esi,SolveMap - mov edx,RealMap - xor ecx,ecx - @@: - mov byte [edi+ecx],0 - mov byte [esi+ecx],0 - mov byte [edx+ecx],0 - inc ecx - cmp ecx,9*9 - jb @b - -;//⠢ ࠭ ᪮쪮 ᥫ -;for i:=1 to 21 do -; begin -; RandI:=random(9); -; RandJ:=random(9); -; if SolveMap[RandI,RandJ]=0 then -; begin -; SolveMap[RandI,RandJ]:=random(9)+1; -; if not CheckSudoku(SolveMap) then -; begin -; SolveMap[RandI,RandJ]:=0; -; Continue; -; end; -; end else Continue; -; end; - - mov ecx,21 -.1: mov eax,9 - call random - mov ebx,eax - mov eax,9 - call random - mov ah,9 - mul ah - add eax,ebx ;RandI,RandJ - cmp byte [esi+eax],0 - jne .loop - mov ebx,eax - mov eax,9 - call random - mov byte [esi+ebx],al - call CheckSudoku - jnc .loop - mov byte [esi+ebx],0 - .loop: - loop .1 - - -;//蠥 㤮 -;iRet:=Solve(SolveMap); -;if iRet<>1 then goto m; -;i:=1; - - mov esi,SolveMap - call Solve - cmp [_iRet],1 - jne GeneratePlayBoard - - movzx ecx,[Difficult] - movzx ecx,byte [Difficult_array+ecx] - -;case Difficult of -;1: -; while i<=42 do -; begin -; RandI:=random(9); -; RandJ:=random(9); -; if RealMap[RandI,RandJ]<>0 then Continue else -; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; -; inc(i); -; end; -;2: -; while i<=32 do -; begin -; RandI:=random(9); -; RandJ:=random(9); -; if RealMap[RandI,RandJ]<>0 then Continue else -; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; -; inc(i); -; end; -;3: -; while i<=25 do -; begin -; RandI:=random(9); -; RandJ:=random(9); -; if RealMap[RandI,RandJ]<>0 then Continue else -; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; -; inc(i); -; end; -;end; - -.2: - mov eax,9 - call random - mov ebx,eax - mov eax,9 - call random - mov ah,9 - mul ah - cmp al,81 - jb @f - dec al - @@: - add eax,ebx ;RandI,RandJ - cmp byte [RealMap+eax],0 - jne .loop2 - add byte [SolveMap+eax],10 - mov bl,[SolveMap+eax] - mov byte [RealMap+eax],bl - .loop2: - loop .2 - -;for i:=0 to 8 do -; for j:=0 to 8 do -; Map[i,j]:=RealMap[i,j]; -;end; - - xor ecx,ecx -@@: mov al,[RealMap+ecx] - mov [Map+ecx],al - inc ecx - cmp ecx,9*9 - jb @b -ret - - - - -align 4 -rsx1 dw ?;0x4321 -rsx2 dw ?;0x1234 -rsx3 dw ?;0x62e9 -rsx4 dw ?;0x3619 -random: ; ASCL - push ecx ebx esi edx - mov cx,ax - mov ax,[rsx1] - mov bx,[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,[rsx3] - adc ax,[rsx4] - sub [rsx3],di - adc [rsx4],si - mov [rsx1],bx - mov [rsx2],ax - xor dx,dx - cmp ax,0 - je nodiv - cmp cx,0 - je nodiv - div cx -nodiv: - mov ax,dx - pop edx esi ebx ecx - and eax,0000ffffh -ret - - - -if DEBUG -SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi - mov ebx,esp - mov ecx,8 - mov esi,(number_to_out+1) -.1: - mov eax,ebx - and eax,0xF - add al,'0' - cmp al,(10+'0') - jb @f - add al,('A'-'0'-10) -@@: - mov [esi+ecx],al - shr ebx,4 - loop .1 - dec esi - mcall 71,1,number_to_out -ret - -number_to_out db '0x00000000',13,10,0 -endf - - - -window_load_save: - popad - mcall 51,1,.thread,(threat_stack+32*4) - pushad - ret -.thread: - bts [flags],6 -.red: - mcall 12,1 - mov edi,txt.load - bt [flags],8 - jc @f - mov edi,txt.save - bt [flags],10 - jnc @f - mov edi,txt.save_solve -@@: mcall 0,50*65536+300,0x70*65536+60,(0x34000000+Bckgrd_clr),, - mcall 8,<245,43>,<2,14>,100,0xaaaaaa - mcall 4,<252,5>,(0x80000000+Text_clr),txt.enter - push dword edit1 - call [edit_box_draw] - mcall 12,2 -.still: - mcall 10 - dec al - jz .red - dec al - jz .key - dec al - jz .button - jmp .still -.button: - mcall 17,1 - cmp ah,1 - jne @f - .end: btr [flags],6 - mcall -1 - @@: cmp ah,100 - jne .still - bt [flags],8 - jc .ld - .sv: call save_sudoku - jnc .end - jmp .err - .ld: call load_sudoku - jnc .end - .err: mcall 4,<5,19>,(0x80000000+Text_clr),txt.error - jmp .still - - -.key: - mcall 2 - cmp ah,13 - jne @f - bt [flags],8 - jc .ld - jmp .sv - @@: cmp ah,27 - je .end - push dword edit1 - call [edit_box_key] - jmp .still - - -save_sudoku: - mov [_size],9*(9+2) - mcall 68,12,[_size] - test eax,eax - jnz @f - stc - ret - -@@: mov [_buffer],eax - mov edx,Map - bt [flags],10 - jnc @f - mov edx,SolveMap -@@: mov esi,eax;[_buffer] - mov ecx,[_size] - xor edi,edi - dec edi - mov ebx,9 -.1: test ecx,ecx - jz .end - test ebx,ebx - jz .2 - inc edi - dec ebx - mov al,[edx+edi] - test al,al - jnz @f - mov byte [esi+edi],0x23 - loop .1 - jmp .end -@@: cmp al,9 - jbe @f - sub al,10 -@@: add al,48 - mov byte [esi+edi],al - loop .1 - jmp .end -.2: mov ebx,9 - mov byte [esi+edi+1],13 - mov byte [esi+edi+2],10 - add esi,2 - sub ecx,2 - jmp .1 - - -.end: mov [func_70.func_n],2 - push [_size] - pop [func_70.param3] - push [_buffer] - pop [func_70.param4] - mov [func_70.name],buf_cmd_lin - mcall 70,func_70 - cmp al,0 ;࠭ 㤠筮? - je @f - mcall 68,13,[_buffer] - stc - ret -@@: mcall 68,13,[_buffer] - clc -ret - -load_sudoku: - mov [func_70.func_n],5 - mov [func_70.param3],0 - mov [func_70.param4],bufferfinfo - mov [func_70.name],buf_cmd_lin - mcall 70,func_70 - test al,al ;䠩 ? - jz @f - stc - ret - @@: mov eax, dword [bufferfinfo+32] ;㥬 ࠧ 䠩 - cmp eax,81 - jge @f - stc - ret -@@: cmp eax,100 - jb @f - stc - ret - -_size dd 0 -_buffer dd 0 - -@@: mov [_size],eax - mcall 68,12,[_size] - test eax,eax - jnz @f - stc - ret ;訡 뤥 - @@: - mov [_buffer],eax - mov [func_70.func_n],0 - mov [func_70.name],buf_cmd_lin - push dword [_size] - pop dword [func_70.param3] - push dword [_buffer] - pop dword [func_70.param4] - mcall 70,func_70 - test eax,eax - jz @f - stc - ret ;訡 ⥭ -@@: - - mov edx,Map - mov esi,[_buffer] - mov ecx,[_size] - xor edi,edi - dec edi -.1: test ecx,ecx - jz .end - inc edi - mov al,[esi+edi] - cmp al,0x23 - jne @f - mov byte [edx+edi],0 - loop .1 - jmp .end -@@: cmp al,13 - jne @f - add esi,2 - dec edi - sub ecx,2 - jmp .1 -@@: sub al,48 - mov byte [edx+edi],al - loop .1 -.end: mcall 68,13,[_buffer] - - xor ecx,ecx -@@: mov byte [SolveMap+ecx],0 - inc ecx - cmp ecx,9*9 - jb @b - - mov [Ticks],0 - mcall 26,9 - mov [Ticks_new],eax - - clc -ret - - - - -align 4 -myimport: -edit_box_draw dd aEdit_box_draw -edit_box_key dd aEdit_box_key -edit_box_mouse dd aEdit_box_mouse -version_ed dd aVersion_ed - dd 0 - dd 0 -aEdit_box_draw db 'edit_box_draw',0 -aEdit_box_key db 'edit_box_key',0 -aEdit_box_mouse db 'edit_box_mouse',0 -aVersion_ed db 'version_ed',0 - -edit1 edit_box 240,2,2,Bckgrd_clr,0x6a9480,0,0xAABBCC,0,4096,buf_cmd_lin,ed_focus,2,0,0 - -func_70: - .func_n dd ? - .param1 dd 0 - .param2 dd 0 - .param3 dd ? - .param4 dd ? - .rezerv db 0 - .name dd ? - -if lang eq ru_RU -title db '㤮',0 -txt: -.dif db " (+/-):",0 -.new db ' (N)',0 -.space db '襭 (஡)',0 -.check db '஢ (C)',0 -.check_yes db '襭 ',0 -.check_no = .nosolve -.time db "६ (T) :",0 -.own_map db ' ᢮ 㤮 襭 (I)',0 -.nosolve db ' 襭 ',0 -.solve db ' (R)',0 -.save db '࠭ (S)',0 -.save_solve db '࠭ 襭 (A)',0 -.error db '訡',0 -.load db '㧨 (L)',0 -.enter db 'Enter',0 -else -title db 'Sudoku',0 -txt: -.dif db "Difficult (+/-)",0 -.new db 'New (N)',0 -.space db 'Solution (Space)',0 -.check db 'Check (C)',0 -.check_yes db 'Right ',0 -.check_no db 'Not right ',0 -.time db " Time (T) :",0 -.own_map db 'Input your own Sudoku (I)',0 -.nosolve db 'It is not solved',0 -.solve db 'Solve (R)',0 -.save db 'Save (S)',0 -.save_solve db 'Save solution (A)',0 -.error db 'Error';,0 -.load db 'Load (L)',0 -.enter db 'Enter',0 -endf - -system_path db '/sys/lib/' -boxlib_name db 'box_lib.obj',0 - -X db 1 -Y db 1 - -Pltr: -.ch dd Bckgrd_clr,Chg_nmb_clr -.chk dd Square_clr,Chg_nmb_clr -.fx dd Bckgrd_clr,Fix_nmb_clr -.fxk dd Square_clr,Fix_nmb_clr - -align 4 -FONT file "sudoku.fnt" -;: - - -I_END: -align 16 -Map rb 9*9 -SolveMap rb 9*9 -RealMap rb 9*9 -TempMap rb 9*9 - -cur_dir_path rb 4096 -buf_cmd_lin rb 4096 -bufferfinfo rb 40 -Ticks_new rd 1 ;dd 0 -Ticks rd 1 ;dd 0 -flags rw 1 -threat_stack rd 32 ;: times 32 dd 0 - -D_END: -; 0: . । draw_pole -;1: 1-⠩ -;2: draw_pole key -;3: 1- -;4: in draw_one_symbol -;5: in Timer -;6: 1 ࠭ ࠭/㧪 -;7: box_lib is not loaded -;8: 0 - ࠭ 1 - 㧨 -;9: 1 - 㢥 -;10: 1 - ࠭ 襭 -;15 1 - ஢ઠ ⨨ ( CheckSudoku) +; 4.11.2009 staper@inbox.ru + +; 2.06.2010 fixed a little bug in check + +;based on http://sources.codenet.ru/download/1599/Sudoku.html + +; ࠢ 㣫 ᯮ , +; 㢥稢 ࠧ. + +; ணࠬ ஢ ப ࠬ஢; । +; 䠩 祩. + +; ⠭ : +; n - ᣥ஢ ⠡ +; c - ஢ 襭 +; ஡ - 襭 +; +- - ஢ ᫮ +; t - ਮ⠭/ ᥪ㭤 +; i - ᢮ ਬ +; r - +; l - 㧨 䠩 +; s - ࠭ 䠩 +; a - ࠭ 襭 䠩 + +use32 +org 0x0 + db 'MENUET01' + dd 0x1, START, I_END, (D_END+10000) and not 3, (D_END+10000) and not 3, buf_cmd_lin, cur_dir_path + +Difficult db 0 ;᫮ [0..9] +Difficult_array db 80,75,68,59,50,45,40,36,32,25 + +;: +Bckgrd_clr equ 0xffffff ;䮭 +Brdr_line_clr equ 0x780000 ; ࠭栬 +Inter_line_clr equ 0xb0b0b0 ;७ +Square_clr equ 0xdddddd ;梥 +Fix_nmb_clr equ 0x335533;0 ;筮 祭 +Chg_nmb_clr equ 0;x008d8d ;६ 祭 +Text_clr equ 0x000000 ;⥪ +Message_clr equ 0x0000ff ;ᮮ饭 + +DEBUG equ 0 + +macro dbg_dec num +{pushad +newline +debug_print_dec num +popad +} + +include '../../../macros.inc' +;include 'debug.inc' +include 'editbox_ex.mac' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include 'SudokuSolve.pas' + + +START: + mcall 40,7 + mcall 3 + mov [rsx1],ax + ror eax,16 + mov [rsx2],ax + rol eax,7 + mov [rsx3],ax + rol eax,7 + mov [rsx4],ax + +; call LOAD_LIB ;loading Box_Lib library + +; This is the part of the macros for load any library/libraries by +LOAD_LIB: + mcall 68,19,system_path ; load of sys directory + test eax,eax + jnz .end_steep + + bts [flags],7 +; ret + jmp .end + +.end_steep: + +; initialize import + mov edx, eax + mov esi,myimport +.import_loop: + lodsd + test eax, eax + jz .import_done + push edx +.import_find: + mov ebx, [ds:edx] + test ebx, ebx + jz .exit ;import_not_found + push eax +.lp: + mov cl, [ds:eax] + cmp cl, [ds:ebx] + jnz .import_find_next + test cl, cl + jz .import_found + inc eax + inc ebx + jmp .lp +.import_find_next: + pop eax + add edx, 8 + jmp .import_find +.import_found: + pop eax + mov eax, [ds:edx+4] + mov [esi-4], eax + pop edx + jmp .import_loop +.exit: + add esp,4 + + bts [flags],7 +;ret + jmp .end + +.import_done: + btr [flags],7 + +;।塞 ப ࠬࠬ + mov esi,buf_cmd_lin + xor eax,eax +@@: cmp byte [esi+eax],0 + je @f + inc eax + jmp @b +@@: mov dword [edit1.size],eax + mov dword [edit1.pos],eax +;ret +.end: + + bt [flags],7 + jc @f + mcall 68,11 + cmp dword [edit1.pos],0 + je @f + call load_sudoku + jnc redraw_all +@@: jmp key.new_game + + +redraw_all: + mcall 12,1 + mcall 48,4 + add eax,100*65536+(24*9+67) + mov ecx,eax + mcall 0,100*65536+(24*9+12),,(0x34000000+Bckgrd_clr),,title + mcall 38,1*65536+(24*9+1),21*65536+21,Brdr_line_clr + mov edx,Inter_line_clr + mov edi,3 + mov esi,3 + @@: add ecx,24*65536+24 + mcall + dec esi + jnz @b + mov esi,3 + push edx + mcall ,,,Brdr_line_clr + pop edx + dec edi + jnz @b + mcall ,1*65536+1,22*65536+236,Inter_line_clr;0xe7e6a0 + mov edx,Inter_line_clr + mov edi,3 + mov esi,3 + push edx + mcall ,,,Brdr_line_clr + pop edx + + @@: add ebx,24*65536+24 + mcall + dec esi + jnz @b + mov esi,3 + push edx + mcall ,,,Brdr_line_clr + pop edx + dec edi + jnz @b + + mcall 8,<208,8>,<257,8>,2,0xbbbbbb + mcall 4,<5,5>,(0x80000000+Text_clr),txt.new + mcall ,<105,5>,,txt.dif + mcall ,<5,258>,,txt.space + mcall ,<5,246>,,txt.check + mcall ,<129,246>,,txt.time + mcall ,<5,285>,,txt.own_map + mcall ,<5,296>,,txt.solve + mcall ,<90,296>,,txt.load + mcall ,<5,306>,,txt.save + mcall ,<90,306>,,txt.save_solve + + bts [flags],5 + call Timer.0 + call show_level + + push dword Map;esi; mov esi,Map + mcall 12,2 +draw_pole: + if DEBUG + call SysMsgBoardNum ;show esp + endf + + movzx eax,[Y] + dec al + mov ebx,9 + mul bl + mov bl,[X] + add al,bl + pop esi ; mov esi,Map + push eax ;稪 + mov edi,81-9 + mov ebp,9 + mov ebx,1*65536+21 + mov ecx,21*65536+41 + call out_numbers + pop eax + bt [flags],2 + jc key.0 + +still: + mcall 23,10 + test eax,eax + jz Timer + + dec al + jz redraw_all + dec al + jz key + dec al + jnz still +;button: + mcall 17 + cmp ah,1 + jne @f + mcall -1 +@@: cmp ah,2 + jne still + btc [flags],9 + mcall 48,4 + add eax,(24*9+67) + mov esi,eax + bt [flags],9 + jnc @f + add esi,40 +@@: mcall 67,-1,-1,(24*9+12), + jmp still +key: + mcall 2 + cmp ah,32 ;஡ +jne @f + btc [flags],3 + jc .todraw + push dword SolveMap + jmp draw_pole + .todraw: + push dword Map + jmp draw_pole +@@: + bt [flags],3 + jnc @f + bts [flags],2 + push eax + push dword Map + jmp draw_pole +.0: pop eax + btr [flags],2 + btr [flags],3 +@@: cmp ah,108 ;l + jne @f + bt [flags],7 + jc still + bt [flags],6 + jc still + bts [flags],8 + call window_load_save + jmp still +@@: cmp ah,115 ;s + jne @f + btr [flags],10 +.sresh: bt [flags],7 + jc still + bt [flags],6 + jc still + btr [flags],8 + call window_load_save + jmp still +@@: cmp ah,97 ;a + jne @f + bts [flags],10 + jmp .sresh +@@: cmp ah,116 ;t + jne @f + btc [flags],1 + jnc still + mcall 26,9 + sub eax,[Ticks_new] + push eax + mov eax,[Ticks] + mov ebx,100 + mul ebx + pop ecx + sub ecx,eax + add [Ticks_new],ecx + jmp still + +@@: cmp ah,105 ;i + jne @f + xor ecx,ecx + .105_0: + mov byte [SolveMap+ecx],0 + mov byte [Map+ecx],0 + inc ecx + cmp ecx,9*9 + jb .105_0 + jmp .todraw + +@@: cmp ah,114 ;r + jne .43 + xor ecx,ecx + .114_0: + mov al,[Map+ecx] + cmp al,9 + jbe @f + sub al,10 + @@: + mov [SolveMap+ecx],al + inc ecx + cmp ecx,9*9 + jb .114_0 + mov esi,SolveMap + call Solve + cmp [_iRet],1 + jne @f + mov edx,txt.check_yes + call Show_message + jmp still + @@: ; 襭 + xor ecx,ecx + @@: + mov byte [SolveMap+ecx],0 + inc ecx + cmp ecx,9*9 + jb @b + mov edx,txt.nosolve + call Show_message + jmp still + +.43: cmp ah,43 ;+ + jne .45 + cmp [Difficult],9 + je still + inc [Difficult] + call show_level + jmp still +.45: ;- + cmp ah,45 + jne .99 + cmp [Difficult],0 + je still + dec [Difficult] + call show_level + jmp still + +.99: ;Check + cmp ah,99 + jne .39 + bts [flags],15 + xor ecx,ecx + mov edx,txt.check_no +; @@: mov al,byte [Map+ecx] +; cmp byte [SolveMap+ecx],al +; jne @f +; inc ecx +; cmp ecx,9*9 +; jb @b + @@: mov al,byte [Map+ecx] ;७ᨬ 祭 ६ ᨢ + cmp al,9 + jbe .991 + sub al,10 + .991: + mov [TempMap+ecx],al + inc ecx + cmp ecx,9*9 + jb @b + mov esi,TempMap + call CheckSudoku + jc @f + mov edx,txt.check_yes + @@: btr [flags],15 + call Show_message + jmp .todraw + +.39: cmp ah,0x39 + ja .110 + cmp ah,0x30 + jb still + sub ah,0x30 + mov cl,ah + + movzx eax,[Y] + dec al + mov ebx,9 + mul bl + mov bl,[X] + dec bl + add al,bl + mov esi,Map + cmp byte [esi+eax],9 + jg still + mov [esi+eax],cl + jmp .onedraw + +.110: cmp ah,110 ;n + jne .176 +.new_game: + call GeneratePlayBoard + mov [Ticks],0 + mcall 26,9 + mov [Ticks_new],eax + jmp redraw_all + +.176: cmp ah,176 ; + jne .177 + call draw_one_symbol + dec [X] + cmp [X],1 + jge @f + mov [X],9 +@@: jmp .onedraw +.177: cmp ah,177 + jne .178 + call draw_one_symbol + inc [Y] + cmp [Y],9 + jbe @f + mov [Y],1 +@@: jmp .onedraw +.178: cmp ah,178 + jne .179 + call draw_one_symbol + dec [Y] + cmp [Y],1 + jge @f + mov [Y],9 +@@: jmp .onedraw +.179: cmp ah,179 + jne still + call draw_one_symbol + inc [X] + cmp [X],9 + jbe @f + mov [X],1 +@@: +.onedraw: + bts [flags],4 + call draw_one_symbol + jmp still ;.todraw + +show_level: + movzx ecx,[Difficult] + mcall 47,0x10000,,<205,5>,(0x50000000+Text_clr),Bckgrd_clr +ret + +Show_message: + mcall 4,<5,269>,(0xd0000000+Message_clr),,,Bckgrd_clr +ret + +Timer: + bt [flags],1 + jc still + mcall 26,9 + sub eax,[Ticks_new] + mov ebx,100 + xor edx,edx + div ebx + cmp eax,[Ticks] + je still + mov [Ticks],eax +.1: mov ebx,60 + xor edx,edx + div ebx + push eax + mov ecx,edx + mcall 47,0x00020000,,<206,246>,(0x40000000+Text_clr),Bckgrd_clr + pop ecx + mov edx,189*65536+246 + mcall + bt [flags],5 + jnc @f + btr [flags],5 + ret +@@: jmp still +.0: mov eax,[Ticks] + jmp .1 + +draw_one_symbol: + movzx eax,[X] + mov ebx,24*65536+24 + mul ebx + xchg eax,ebx + add ebx,(1*65536+21-24*65536+24) + movzx eax,[Y] + mov ecx,24*65536+24 + mul ecx + xchg eax,ecx + add ecx,(21*65536+41-24*65536+24) + movzx eax,[Y] + dec al + push ebx + mov ebx,9 + mul bl + mov bl,[X] + add al,bl + dec al + pop ebx + mov esi,Map + add esi,eax + push dword 0 ; + bt [flags],4 + jnc @f + mov dword [esp],1 ; + btr [flags],4 +@@: mov edi,0 + mov ebp,1 + call out_numbers + pop eax +ret + + +out_numbers: + push ebx ecx esi + shr ebx,16 + inc bx + shl ebx,16 + add ebx,23 + shr ecx,16 + inc cx + shl ecx,16 + add ecx,23 + mov edx,Bckgrd_clr + push ebp + dec dword [esp+4*5] + jnz @f + mov edx,Square_clr +@@: mcall 13 + pop ebp + pop esi + + cmp byte [esi],0 + je .null + cmp byte [esi],9 + jbe .changeable_number + cmp byte [esi],19 + jbe .fixed_number + jmp .null +.end: + inc esi + dec ebp + jnz out_numbers + test edi,edi + jz @f + sub edi,9 + mov ebp,9 + add ebx,-9*24*65536-9*24 + add ecx,24*65536+24 + jmp out_numbers + @@: +ret + +.fixed_number: + push esi + shr ebx,16 + shr ecx,16 + mov dx,bx + shl edx,16 + mov dx,cx + add edx,8*65536+4 + movzx ebx,byte [esi] + sub ebx,10 + dec ebx + shl ebx,4 + add ebx,FONT + mov ecx,8*65536+16 + push esi ebp edi + mov edi,Pltr.fx + cmp dword [esp+4*7],0 + jne @f + mov edi,Pltr.fxk +@@: mov esi,1 + mov ebp,0 + mcall 65 + pop edi ebp esi +.1: pop esi ecx ebx + add ebx,24*65536+24 + jmp .end + +.null: + pop ecx ebx + add ebx,24*65536+24 + jmp .end +.changeable_number: + push esi + shr ebx,16 + shr ecx,16 + mov dx,bx + shl edx,16 + mov dx,cx + add edx,8*65536+4 + movzx ebx,byte [esi] + dec ebx + shl ebx,4 + add ebx,FONT + mov ecx,8*65536+16 + push esi ebp edi + mov edi,Pltr.ch + cmp dword [esp+4*7],0 + jne @f + mov edi,Pltr.chk +@@: mov esi,1 + mov ebp,0 + mcall 65 + pop edi ebp esi + jmp .1 + + + +GeneratePlayBoard: +;i db 0 +;j db 0 +;RandI db 0 +;RandJ db 0 +;iRet db 0 +;//㥬 襭 +;m: +;for i:=0 to 8 do +; for j:=0 to 8 do +; begin +; Map[i,j]:=0; +; SolveMap[i,j]:=0; +; RealMap[i,j]:=0; +; end; + mov edi,Map + mov esi,SolveMap + mov edx,RealMap + xor ecx,ecx + @@: + mov byte [edi+ecx],0 + mov byte [esi+ecx],0 + mov byte [edx+ecx],0 + inc ecx + cmp ecx,9*9 + jb @b + +;//⠢ ࠭ ᪮쪮 ᥫ +;for i:=1 to 21 do +; begin +; RandI:=random(9); +; RandJ:=random(9); +; if SolveMap[RandI,RandJ]=0 then +; begin +; SolveMap[RandI,RandJ]:=random(9)+1; +; if not CheckSudoku(SolveMap) then +; begin +; SolveMap[RandI,RandJ]:=0; +; Continue; +; end; +; end else Continue; +; end; + + mov ecx,21 +.1: mov eax,9 + call random + mov ebx,eax + mov eax,9 + call random + mov ah,9 + mul ah + add eax,ebx ;RandI,RandJ + cmp byte [esi+eax],0 + jne .loop + mov ebx,eax + mov eax,9 + call random + mov byte [esi+ebx],al + call CheckSudoku + jnc .loop + mov byte [esi+ebx],0 + .loop: + loop .1 + + +;//蠥 㤮 +;iRet:=Solve(SolveMap); +;if iRet<>1 then goto m; +;i:=1; + + mov esi,SolveMap + call Solve + cmp [_iRet],1 + jne GeneratePlayBoard + + movzx ecx,[Difficult] + movzx ecx,byte [Difficult_array+ecx] + +;case Difficult of +;1: +; while i<=42 do +; begin +; RandI:=random(9); +; RandJ:=random(9); +; if RealMap[RandI,RandJ]<>0 then Continue else +; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; +; inc(i); +; end; +;2: +; while i<=32 do +; begin +; RandI:=random(9); +; RandJ:=random(9); +; if RealMap[RandI,RandJ]<>0 then Continue else +; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; +; inc(i); +; end; +;3: +; while i<=25 do +; begin +; RandI:=random(9); +; RandJ:=random(9); +; if RealMap[RandI,RandJ]<>0 then Continue else +; RealMap[RandI,RandJ]:=SolveMap[RandI,RandJ]; +; inc(i); +; end; +;end; + +.2: + mov eax,9 + call random + mov ebx,eax + mov eax,9 + call random + mov ah,9 + mul ah + cmp al,81 + jb @f + dec al + @@: + add eax,ebx ;RandI,RandJ + cmp byte [RealMap+eax],0 + jne .loop2 + add byte [SolveMap+eax],10 + mov bl,[SolveMap+eax] + mov byte [RealMap+eax],bl + .loop2: + loop .2 + +;for i:=0 to 8 do +; for j:=0 to 8 do +; Map[i,j]:=RealMap[i,j]; +;end; + + xor ecx,ecx +@@: mov al,[RealMap+ecx] + mov [Map+ecx],al + inc ecx + cmp ecx,9*9 + jb @b +ret + + + + +align 4 +rsx1 dw ?;0x4321 +rsx2 dw ?;0x1234 +rsx3 dw ?;0x62e9 +rsx4 dw ?;0x3619 +random: ; ASCL + push ecx ebx esi edx + mov cx,ax + mov ax,[rsx1] + mov bx,[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,[rsx3] + adc ax,[rsx4] + sub [rsx3],di + adc [rsx4],si + mov [rsx1],bx + mov [rsx2],ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop edx esi ebx ecx + and eax,0000ffffh +ret + + + +if DEBUG +SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi + mov ebx,esp + mov ecx,8 + mov esi,(number_to_out+1) +.1: + mov eax,ebx + and eax,0xF + add al,'0' + cmp al,(10+'0') + jb @f + add al,('A'-'0'-10) +@@: + mov [esi+ecx],al + shr ebx,4 + loop .1 + dec esi + mcall 71,1,number_to_out +ret + +number_to_out db '0x00000000',13,10,0 +endf + + + +window_load_save: + popad + mcall 51,1,.thread,(threat_stack+32*4) + pushad + ret +.thread: + bts [flags],6 +.red: + mcall 12,1 + mov edi,txt.load + bt [flags],8 + jc @f + mov edi,txt.save + bt [flags],10 + jnc @f + mov edi,txt.save_solve +@@: mcall 0,50*65536+300,0x70*65536+60,(0x34000000+Bckgrd_clr),, + mcall 8,<245,43>,<2,14>,100,0xaaaaaa + mcall 4,<252,5>,(0x80000000+Text_clr),txt.enter + push dword edit1 + call [edit_box_draw] + mcall 12,2 +.still: + mcall 10 + dec al + jz .red + dec al + jz .key + dec al + jz .button + jmp .still +.button: + mcall 17,1 + cmp ah,1 + jne @f + .end: btr [flags],6 + mcall -1 + @@: cmp ah,100 + jne .still + bt [flags],8 + jc .ld + .sv: call save_sudoku + jnc .end + jmp .err + .ld: call load_sudoku + jnc .end + .err: mcall 4,<5,19>,(0x80000000+Text_clr),txt.error + jmp .still + + +.key: + mcall 2 + cmp ah,13 + jne @f + bt [flags],8 + jc .ld + jmp .sv + @@: cmp ah,27 + je .end + push dword edit1 + call [edit_box_key] + jmp .still + + +save_sudoku: + mov [_size],9*(9+2) + mcall 68,12,[_size] + test eax,eax + jnz @f + stc + ret + +@@: mov [_buffer],eax + mov edx,Map + bt [flags],10 + jnc @f + mov edx,SolveMap +@@: mov esi,eax;[_buffer] + mov ecx,[_size] + xor edi,edi + dec edi + mov ebx,9 +.1: test ecx,ecx + jz .end + test ebx,ebx + jz .2 + inc edi + dec ebx + mov al,[edx+edi] + test al,al + jnz @f + mov byte [esi+edi],0x23 + loop .1 + jmp .end +@@: cmp al,9 + jbe @f + sub al,10 +@@: add al,48 + mov byte [esi+edi],al + loop .1 + jmp .end +.2: mov ebx,9 + mov byte [esi+edi+1],13 + mov byte [esi+edi+2],10 + add esi,2 + sub ecx,2 + jmp .1 + + +.end: mov [func_70.func_n],2 + push [_size] + pop [func_70.param3] + push [_buffer] + pop [func_70.param4] + mov [func_70.name],buf_cmd_lin + mcall 70,func_70 + cmp al,0 ;࠭ 㤠筮? + je @f + mcall 68,13,[_buffer] + stc + ret +@@: mcall 68,13,[_buffer] + clc +ret + +load_sudoku: + mov [func_70.func_n],5 + mov [func_70.param3],0 + mov [func_70.param4],bufferfinfo + mov [func_70.name],buf_cmd_lin + mcall 70,func_70 + test al,al ;䠩 ? + jz @f + stc + ret + @@: mov eax, dword [bufferfinfo+32] ;㥬 ࠧ 䠩 + cmp eax,81 + jge @f + stc + ret +@@: cmp eax,100 + jb @f + stc + ret + +_size dd 0 +_buffer dd 0 + +@@: mov [_size],eax + mcall 68,12,[_size] + test eax,eax + jnz @f + stc + ret ;訡 뤥 + @@: + mov [_buffer],eax + mov [func_70.func_n],0 + mov [func_70.name],buf_cmd_lin + push dword [_size] + pop dword [func_70.param3] + push dword [_buffer] + pop dword [func_70.param4] + mcall 70,func_70 + test eax,eax + jz @f + stc + ret ;訡 ⥭ +@@: + + mov edx,Map + mov esi,[_buffer] + mov ecx,[_size] + xor edi,edi + dec edi +.1: test ecx,ecx + jz .end + inc edi + mov al,[esi+edi] + cmp al,0x23 + jne @f + mov byte [edx+edi],0 + loop .1 + jmp .end +@@: cmp al,13 + jne @f + add esi,2 + dec edi + sub ecx,2 + jmp .1 +@@: sub al,48 + mov byte [edx+edi],al + loop .1 +.end: mcall 68,13,[_buffer] + + xor ecx,ecx +@@: mov byte [SolveMap+ecx],0 + inc ecx + cmp ecx,9*9 + jb @b + + mov [Ticks],0 + mcall 26,9 + mov [Ticks_new],eax + + clc +ret + + + + +align 4 +myimport: +edit_box_draw dd aEdit_box_draw +edit_box_key dd aEdit_box_key +edit_box_mouse dd aEdit_box_mouse +version_ed dd aVersion_ed + dd 0 + dd 0 +aEdit_box_draw db 'edit_box_draw',0 +aEdit_box_key db 'edit_box_key',0 +aEdit_box_mouse db 'edit_box_mouse',0 +aVersion_ed db 'version_ed',0 + +edit1 edit_box 240,2,2,Bckgrd_clr,0x6a9480,0,0xAABBCC,0,4096,buf_cmd_lin,ed_focus,2,0,0 + +func_70: + .func_n dd ? + .param1 dd 0 + .param2 dd 0 + .param3 dd ? + .param4 dd ? + .rezerv db 0 + .name dd ? + +if lang eq ru_RU +title db '㤮',0 +txt: +.dif db " (+/-):",0 +.new db ' (N)',0 +.space db '襭 (஡)',0 +.check db '஢ (C)',0 +.check_yes db '襭 ',0 +.check_no = .nosolve +.time db "६ (T) :",0 +.own_map db ' ᢮ 㤮 襭 (I)',0 +.nosolve db ' 襭 ',0 +.solve db ' (R)',0 +.save db '࠭ (S)',0 +.save_solve db '࠭ 襭 (A)',0 +.error db '訡',0 +.load db '㧨 (L)',0 +.enter db 'Enter',0 +else ; Default to en_US +title db 'Sudoku',0 +txt: +.dif db "Difficult (+/-)",0 +.new db 'New (N)',0 +.space db 'Solution (Space)',0 +.check db 'Check (C)',0 +.check_yes db 'Right ',0 +.check_no db 'Not right ',0 +.time db " Time (T) :",0 +.own_map db 'Input your own Sudoku (I)',0 +.nosolve db 'It is not solved',0 +.solve db 'Solve (R)',0 +.save db 'Save (S)',0 +.save_solve db 'Save solution (A)',0 +.error db 'Error';,0 +.load db 'Load (L)',0 +.enter db 'Enter',0 +endf + +system_path db '/sys/lib/' +boxlib_name db 'box_lib.obj',0 + +X db 1 +Y db 1 + +Pltr: +.ch dd Bckgrd_clr,Chg_nmb_clr +.chk dd Square_clr,Chg_nmb_clr +.fx dd Bckgrd_clr,Fix_nmb_clr +.fxk dd Square_clr,Fix_nmb_clr + +align 4 +FONT file "sudoku.fnt" +;: + + +I_END: +align 16 +Map rb 9*9 +SolveMap rb 9*9 +RealMap rb 9*9 +TempMap rb 9*9 + +cur_dir_path rb 4096 +buf_cmd_lin rb 4096 +bufferfinfo rb 40 +Ticks_new rd 1 ;dd 0 +Ticks rd 1 ;dd 0 +flags rw 1 +threat_stack rd 32 ;: times 32 dd 0 + +D_END: +; 0: . । draw_pole +;1: 1-⠩ +;2: draw_pole key +;3: 1- +;4: in draw_one_symbol +;5: in Timer +;6: 1 ࠭ ࠭/㧪 +;7: box_lib is not loaded +;8: 0 - ࠭ 1 - 㧨 +;9: 1 - 㢥 +;10: 1 - ࠭ 襭 +;15 1 - ஢ઠ ⨨ ( CheckSudoku) diff --git a/programs/games/sw/trunk/sw.asm b/programs/games/sw/trunk/sw.asm index 4985a1958..1341c399c 100644 --- a/programs/games/sw/trunk/sw.asm +++ b/programs/games/sw/trunk/sw.asm @@ -1,1372 +1,1372 @@ -;v. 0.4: 20.10.2009 staper@inbox.ru - -use32 - org 0x0 - db 'MENUET01' - dd 0x1 - dd START - dd I_END - dd (I_END+600) and not 3 - dd (I_END+600) and not 3 - dd 0x0,0x0 - -DEBUG equ 0 - -use_new_logic equ 1 ; "", -use_ext_logic equ 1 ; use_new_logic, - -include '../../../macros.inc' -include 'lang.inc' - -;include 'debug.inc' - -macro dbg_dec num -{pushad -newline -debug_print_dec num -popad} - - -START: - - mcall 40,100111b - mcall 3 - mov [rsx1],ax - shr eax,16 - mov [rsx2],ax - jmp new_game - -redraw_all: - mcall 12,1 - mcall 0,100*65536+432,100*65536+260,0x34FFFFFF,,title - mcall 38,1*65536+421,27*65536+27,0x00b0b0b0 - mov edi,10 - @@: add ecx,20*65536+20 - mcall - dec edi - jnz @b - mcall ,1*65536+1,27*65536+226,;000000 - mov edi,21 - @@: add ebx,20*65536+20 - mcall - dec edi - jnz @b - mcall 13,202*65536+19,27*65536+202,0xFFFFFF - mcall 4,40*65536+12,0x80000000,text_user - mcall ,350*65536+12,,text_cpu - mcall 8,120*65536+70,7*65536+15,2,0xFFFFFF - mcall ,230*65536+70,,3, - mcall 4,135*65536+12,0x80000000,but_new - mcall ,240*65536+12,,but_auto - mcall 12,2 -ret - -draw_pole: -; mcall 0,100*65536+432,100*65536+260,0x74FFFFFF,,title - if DEBUG - call SysMsgBoardNum ;show esp - mcall 8,200*65536+10,7*65536+15,4,0xFFFFFF - endf - - - - mov esi,table1 - mov edi,90 - mov ebp,10 - mov ebx,1*65536+21 - mov ecx,27*65536+47 - call draw_bots - - mov esi,table5 - mov edi,90 - mov ebp,10 - mov ebx,221*65536+241 - mov ecx,27*65536+47 - call draw_bots - cmp [u_kill],10 - jne @f - mcall 4,69*65536+12,0x80ff0000,text_win - bts [flags],5 - @@: cmp [c_kill],10 - jne @f - mcall 4,372*65536+12,0x80ff0000,text_win - bts [flags],5 - @@: mcall 12,2 - cmp [number_bots],10 - jne still - bts [flags],0 -still: - mcall 10 - - cmp eax,6 - je mouse - dec eax - jnz @f - call redraw_all - jmp draw_pole -@@: dec eax - jz key - dec eax - jz button - jmp still - -key: - mcall 2 - jmp still - -button: - mcall 17 - dec ah - jnz @f - mcall -1 - - @@: mov ecx,(344)/4 - mov esi,table1 - .3: mov dword [esi],0 - add esi,4 - loop .3 - - dec ah - jz @f - - mov [flags],1001b ;auto fill - mov [number_bots],0 - - call set_bots - mov [number_bots],0 - bts [flags],2 - call set_bots - call redraw_all - btc [flags2],0 - jc second_pole.comp - jmp draw_pole - - @@: ;new game - mov [number_bots],0 -new_game: - mov [flags],1100b - call set_bots - btr [flags],0 - btr [flags],3 - btr [flags],2 - mov [number_bots],0 - call redraw_all - jmp draw_pole - -draw_bots: - cmp byte [esi],1 - je .one - cmp byte [esi],2 - je .two - cmp byte [esi],3 - je .three - cmp byte [esi],4 - jne .null - bts [flags],4 - jmp .three - -.end: - inc esi - dec ebp - jnz draw_bots - test edi,edi - jz @f - sub edi,10 - mov ebp,10 - add ebx,-200*65536-200 - add ecx,20*65536+20 - jmp draw_bots - @@: -ret - -.one: - push ebx ecx - call .0 - mov edx,0x00aa66 - mcall 13 - pop ecx ebx -.null: - add ebx,20*65536+20 - jmp .end -.two: - push ebx ecx - add ebx,8*65536-6 - add ecx,12*65536-12 - mcall 38,,,0x508cec - add ecx,-6*65536+6 - mcall - pop ecx ebx - jmp .null -.three: - push ebx ecx - call .0 - mov edx,0x00FF0000 - bt [flags],4 - jnc @f - mov edx,0x00555555 - btr [flags],4 - @@: mcall 13 - pop ecx ebx - xor edx,edx - mcall 38 - add ecx,20*65536-20 - mcall - add ecx,-20*65536+20 - jmp .null - -.0: - shr ebx,16 - inc bx - shl ebx,16 - add ebx,19 - shr ecx,16 - inc cx - shl ecx,16 - add ecx,19 -ret - -mouse: - bt [flags],5 - jc still - mcall 37,2 - test eax,eax - jz still - cmp al,2 - jg still - ;1 - , 2 - ࠢ - dec al - jnz .mouse_1 - btr [flags],1 - jmp @f - .mouse_1: - bts [flags],1 - @@: - mcall 37,1 - mov dx,ax - shr eax,16 - cmp dx,27 - jbe still - cmp dx,227 - jge still - cmp ax,1 - jbe still - cmp ax,201 - jge second_pole - ;ࢮ - bt [flags],0 - jc still - sub ax,1 - push dx - xor edx,edx - mov cx,20 - div cx - pop dx - mov [oX],al - push ax - sub dx,27 - mov ax,dx - xor dx,dx - div cx - mov [oY],al - xor dx,dx - mov cx,10 - mul cx - pop dx - add ax,dx - cmp ax,100 - jg still - -set_bot: - mov esi,table1 - bt [flags],2 - jnc @f - mov esi,table2 - @@: mov edi,esi - add edi,100 - cmp [number_bots],6 - jnb .1paluba - cmp [number_bots],3 - jnb .2paluba - cmp [number_bots],0 - je .4paluba - jmp .3paluba - -.4paluba: - bt [flags],1 ;寠㡭 - jnc @f - cmp [oX],6 - jg _still - jmp .41 - @@: cmp [oY],6 - jg _still - .41: inc [number_bots] - mov [edi],al - bt [flags],1 - jc @f - add al,10 - mov [edi+1],al - add al,10 - mov [edi+2],al - add al,10 - mov [edi+3],al - jmp init_table - @@: inc al - mov [edi+1],al - inc al - mov [edi+2],al - inc al - mov [edi+3],al - jmp init_table - - -.3paluba: ;寠㡭 - bt [flags],1 - jnc @f - cmp [oX],7 - jg _still - jmp .31 - @@: cmp [oY],7 - jg _still - .31: - call find_near - - bt [flags],1 - jc @f - add al,10 - call find_near - add al,10 - call find_near - sub al,20 - jmp .32 - @@: inc al - call find_near - inc al - call find_near - sub al,2 - .32: - inc [number_bots] - mov ecx,4 - mov dl,[number_bots] - sub dl,2 - jz @f - add ecx,3 - @@: - mov [edi+ecx],al - bt [flags],1 - jc @f - add al,10 - mov [edi+ecx+1],al - add al,10 - mov [edi+ecx+2],al -jmp init_table - @@: inc al - mov [edi+ecx+1],al - inc al - mov [edi+ecx+2],al -jmp init_table - - - -.2paluba: ;寠㡭 - bt [flags],1 - jnc @f - cmp [oX],8 - jg _still - jmp .21 - @@: cmp [oY],8 - jg _still - .21: - call find_near - bt [flags],1 - jc @f - add al,10 - call find_near - sub al,10 - jmp .22 - @@: inc al - call find_near - dec al - .22: - inc [number_bots] - mov ecx,8 - mov dl,[number_bots] - sub dl,4 - jz @f - add ecx,2 - dec dl - jz @f - add ecx,2 - @@: add ecx,2 - mov [edi+ecx],al - bt [flags],1 - jc @f - add al,10 - mov [edi+ecx+1],al -jmp init_table - @@: inc al - mov [edi+ecx+1],al -jmp init_table - - -.1paluba: ;㡭 - call find_near - inc [number_bots] - xor edx,edx - movzx ecx,[number_bots] - add ecx,9 - mov [edi+ecx],al -jmp init_table - -find_near: - push ax - call f_near ;0 - - cmp al,10 - jb @f - sub al,10 ;-10 - call f_near - -@@: cmp al,11 - jb @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,0 - je @f - - sub al,11 ;-11 - call f_near - -@@: cmp al,9 - jb @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,9 - je @f - - sub al,9 ;-9 - call f_near - -@@: cmp al,1 - jb @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,0 - je @f - - dec al ;-1 - call f_near - -@@: cmp al,99 - jg @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,9 - je @f - - inc al ;+1 - call f_near - -@@: cmp al,90 - jge @f - add al,10 ;+10 - call f_near - -@@: cmp al,91 - jge @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,0 - je @f - - add al,9 ;+9 - call f_near - -@@: cmp al,89 - jge @f - - xor edx,edx - mov ecx,10 - div cx - mov ax,[esp] - cmp dx,9 - je @f - add al,11 ;+11 - call f_near - -@@: pop ax -; xor bl,bl -; bt [flags],6 -; jnc @f -; bt [flags],9 -; jnc @f -; inc [p_pov] -; cmp [p_pov],20 -; jb @f -; bts [flags],9 -; @@: - btr [flags],6 - clc -ret - -f_near: - bt [flags],6 - jnc .2 -; bt [flags],9 -; jc @f -; cmp byte [esi+eax],2 -; jge @f -; @@: - cmp byte [esi+eax],4 - je @f - mov ax,[esp+4] - ret - @@:; add esp,4 -; jmp second_pole.cpu - mov ax,[esp+4] - mov cx,ax - add esp,6 - btr [flags],6 - stc -; mov bl,1 - ret - - .2: movzx edx, byte [smeshenie] - @@: cmp al,[edi+edx] - je .end - dec dl - jnz @b - cmp al,[edi] - je .end - mov ax,[esp+4] - ret - .end: add esp,10 - jmp _still - - - -init_table: -; xor eax,eax - movzx ecx, byte [number_bots] - mov edx,3 - dec cl - jz .i_t - - mov al,2 -.2: add dl,3 - dec cl - jz .i_t - dec al - jnz .2 - - mov al,3 -.3: add dl,2 - dec cl - jz .i_t - dec al - jnz .3 - - mov al,4 -.4: inc dl - dec cl - jz .i_t - dec al - jnz .4 - -.i_t: mov [smeshenie],dl -@@: movzx eax, byte [edi+edx] - mov byte [esi+eax],1 - dec dl - jnz @b - movzx eax, byte [edi] - mov byte [esi+eax],1 - bt [flags],3 - jc set_bots -; mcall 12,1 - jmp draw_pole - - -second_pole: - cmp ax,221 - jbe still - cmp ax,421 - jge still - ;஥ - bt [flags],0 - jnc still - sub ax,221 - push dx - xor edx,edx - mov cx,20 - div cx - pop dx - push ax - sub dx,27 - mov ax,dx - xor dx,dx - div cx - xor dx,dx - mov cx,10 - mul cx - pop dx - add ax,dx - cmp ax,100 - jg still - - mov edi,table2 - mov esi,table5 - cmp byte [esi+eax],2 - jge still - mov bl, byte [edi+eax] - add bl,2 - mov ecx,table5 - call if_bot_killed - mov [esi+eax],bl - cmp bl,3 - jge .m_end -.comp: mov esi,table1 - - - - .cpu: -; jmp .rndm - xor eax,eax -; mov edi,4 - btr [flags],8 - xor ecx,ecx - mov edx,tbl_ranen - mov dword [edx],0 - @@: mov al,[esi+ecx] ; "࠭ ࠡ" - cmp al,3 - je .0 - cmp cl,99 - jge .1 - inc cl - jmp @b - .0: mov [edx],cl -if DEBUG -dbg_dec ecx -endf - inc edx - inc cl - jmp @b - - .1: - dec edx - mov cl,[edx] - cmp edx,tbl_ranen - jb .rndm - je @f - sub cl,[edx-1] - cmp cl,1 - jne .2 - add cl,[edx-1] - jmp .12 - .2: - add cl,[edx-1] - jmp .13 - - @@: bts [flags],8 - mov eax,4 - call random - dec al - jz .11 - dec al - jz .12 - dec al - jz .13 - jmp .14 - .11: -if DEBUG -dbg_dec 100 -endf - cmp cl,10 - jge @f - bts [flags],8 - jmp .12 - @@: sub cl,10 - cmp byte [esi+ecx],2 - jge @f - mov eax,ecx - bts [flags],6 - call find_near -; test bl,bl -; jz .20 - jnc .20 - @@: bts [flags],8 - add cl,10 - bts [flags],8 - .12: -if DEBUG -dbg_dec 200 -endf - movzx eax,cl - push cx - mov ch,10 - div ch - pop cx - cmp ah,9 - jb @f - .121: - bt [flags],8 - jc .13 - bts [flags],8 - mov edx,tbl_ranen - mov cl,[edx] - jmp .14 - @@: inc cl - cmp byte [esi+ecx],2 - jge @f - mov eax,ecx - bts [flags],6 - call find_near -; test bl,bl -; jz .20 - jnc .20 - @@: dec cl - jmp .121 - - .13: -if DEBUG -dbg_dec 300 -endf - cmp cl,90 - jb @f - .131: - bt [flags],8 - jc .14 - bts [flags],8 - mov edx,tbl_ranen - mov cl,[edx] - jmp .11 - @@: add cl,10 - cmp byte [esi+ecx],2 - jge @f - mov eax,ecx - bts [flags],6 - call find_near -; test bl,bl -; jz .20 - jnc .20 - @@: sub cl,10 - jmp .131 - - .14: -if DEBUG -dbg_dec 400 -endf - movzx eax,cl - push cx - mov ch,10 - div ch - pop cx - cmp ah,0 - jne @f - .141: - bts [flags],8 - jmp .11;cpu;rndm - @@: dec cl - cmp byte [esi+ecx],2 - jge @f - mov eax,ecx - bts [flags],6 - call find_near -; test bl,bl -; jz .20 - jnc .20 - @@: inc cl - jmp .141 - -.rndm: - - mov eax,100 - call random - cmp eax,100 - jb @f - shr eax,1 -@@: - -if use_new_logic - btc [flags],10 - jnc @f - btc [flags],9 - jnc @f - call check_freedom -endf - -@@: cmp byte [esi+eax],2 - jb @f; .rndm - ; ᢮ 窨 ।/᫥ ࠭, - ; random 室 ᪮ 横 - bt ax,0 - jnc .r_1 - .r_0: - cmp al,0 - je .r_1 - dec al - - cmp byte [esi+eax],2 - jb @f - jmp .r_0 - .r_1: - cmp al,99 - je .r_0 - inc al - - cmp byte [esi+eax],2 - jb @f - jmp .r_1 -@@: - bts [flags],6 - call find_near -; test bl,bl -; jnz .cpu - jc .cpu;20 - -.20: - mov bl,[esi+eax] - add bl,2 - mov ecx,esi - mov edi,esi - call if_bot_killed - mov [esi+eax],bl -; cmp [u_kill],10 -; je .m_end - cmp [c_kill],10 - je .m_end - cmp bl,3 - jge .cpu - -.m_end:; mcall 12,1 -jmp draw_pole - -if_bot_killed: - push ebx - add edi,100 - mov ebx,19 - @@: cmp al,[edi+ebx] - je @f - dec ebx - jnz @b - cmp al,[edi+ebx] - jne .end - @@: - cmp ebx,16 - jnb .end_i - - @@: cmp bl,10 - jb .2 - btc bx,0 - mov bl, [edi+ebx] - cmp byte [ecx+ebx],3 - jne .end - inc byte [ecx+ebx] - jmp .end_i - - .2: cmp bl,4 - jb .3 - add edi,4 - cmp bl,7 - jb .3 - add edi,3 - .3: movzx edx, byte [edi] - cmp dl,al - je @f - cmp byte [ecx+edx],3 - jne .end - @@: mov dl,[edi+1] - cmp dl,al - je @f - cmp byte [ecx+edx],3 - jne .end - @@: mov dl,[edi+2] - cmp dl,al - je @f - cmp byte [ecx+edx],3 - jne .end - - @@: cmp bl,4 - jnb @f - mov dl,[edi+3] - cmp dl,al - je @f - cmp byte [ecx+edx],3 - jne .end - - - @@: mov dl,[edi] - cmp dl,al - je @f - inc byte [ecx+edx] - @@: mov dl,[edi+1] - cmp dl,al - je @f - inc byte [ecx+edx] - @@: mov dl,[edi+2] - - cmp bl,4 - jnb .9;@f - -; cmp dl,al -; je .end_i -; inc byte [ecx+edx] -; jmp .end_i - - - @@: cmp dl,al - je @f - inc byte [ecx+edx] - @@: mov dl,[edi+3] -.9: cmp dl,al - je .end_i - inc byte [ecx+edx] - .end_i: - pop ebx - inc ebx - cmp ecx,table5 - jne @f - inc [u_kill] - ret - @@: inc [c_kill] - ret - .end: pop ebx -ret - - - - -_still: - bt [flags],3 - jnc still - -set_bots: - cmp [number_bots],10 - jne @f - ret - @@: xor edx,edx - mov ecx,10 - cmp [number_bots],6 - jb @f - push dword 10 - jmp .1 - @@: cmp [number_bots],3 - jb @f - push dword 9 - jmp .1 - @@: cmp [number_bots],2 - jb @f - push dword 8 - jmp .1 - @@: push dword 7 - .1: - mov eax,[esp] - call random - mov [oX],al - mul cl - mov cl,al - mov eax,[esp] - call random - mov [oY],al - add cl,al - - cmp cl,100 - jge .1 - - add esp,4 - mov eax,2 - call random - cmp al,1 - jne @f - bts [flags],1 - mov al,cl - jmp set_bot - @@: btr [flags],1 - mov al,cl - jmp set_bot - - - - - - -;楤 ⫠ " ᢮" ⮪ ⠪ - -if use_new_logic -check_freedom: -; mov esi,table1 - push ax - push word 100 - xor eax,eax - mov ebx,0x900 - -.1: bts [flags],6 - call find_near - jc .11 - cmp byte [esi+eax],2 ;0 - jb @f -.11: inc bl - -@@: cmp al,10 ;-10 - jb @f - push ax - - sub al,10 - if use_ext_logic - bts [flags],6 - call find_near - jc .21 - endf - cmp byte [esi+eax],2 - jb .22 -.21: inc bl -.22: pop ax - -@@: cmp al,11 - jb @f - push ax - - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - - cmp dx,0 - je .32 - - sub al,11 - if use_ext_logic - bts [flags],6 - call find_near - jc .31 - endf - cmp byte [esi+eax],2 ;-11 - jb .32 -.31: inc bl -.32: pop ax - -@@: cmp al,9 - jb @f - push ax - - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - cmp dx,9 - je .42 - - sub eax,9 - if use_ext_logic - bts [flags],6 - call find_near - jc .41 - endf - cmp byte [esi+eax],2 ;-9 - jb .42 -.41: inc bl -.42: pop ax - -@@: cmp al,1 - jb @f - push ax - - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - cmp dx,0 - je .52 - - dec al - if use_ext_logic - bts [flags],6 - call find_near - jc .51 - endf - cmp byte [esi+eax],2 ;-1 - jb .52 -.51: inc bl -.52: pop ax - -@@: cmp al,99 - jg @f - push ax - - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - cmp dx,9 - je .62 - - inc al - if use_ext_logic - bts [flags],6 - call find_near - jc .61 - endf - cmp byte [esi+eax],2 ;+1 - jb .62 -.61: inc bl -.62: pop ax - -@@: cmp al,90 - jge @f - push ax - add al,10 - if use_ext_logic - bts [flags],6 - call find_near - jc .71 - endf - cmp byte [esi+eax],2 ;+10 - jb .72 -.71: inc bl -.72: pop ax - -@@: cmp al,91 - jge @f - push ax - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - cmp dx,0 - je .82 - - add al,9 - if use_ext_logic - bts [flags],6 - call find_near - jc .81 - endf - cmp byte [esi+eax],2 ;+9 - jb .82 -.81: inc bl -.82: pop ax - -@@: cmp al,89 - jge @f - push ax - - xor edx,edx - mov ecx,10 - push ax - div cx - pop ax - - cmp dx,9 - je .92 - - add al,11 - if use_ext_logic - bts [flags],6 - call find_near - jc .91 - endf - cmp byte [esi+eax],2 ;+11 - jb .92 -.91: inc bl -.92: pop ax - -@@: bt [flags],7 - jc .ret - cmp byte [esi+eax],1 - jg @f - cmp bl,bh - jg @f - -; shl ebx,8 - bts [flags],6 - call find_near -; xchg cl,bl -; shr ebx,8 -; test cl,cl -; jnz @f - jc @f - - shl bx,8 - pop dx ;dh - ᫥ ᢮ ⪠, dl - ࠢ - pop cx ;cl - ࠭ ࠭ ⪠ -; cmp al,dl -; jg .5 -; cmp al,cl -; jb .4 -; mov dl,al -; jmp .5 -;.4: cmp al,dh -; jb .5 -; mov dh,al - cmp al,dh - jb .5 - cmp al,cl - jg .4 - mov dh,al - jmp .5 -.4: cmp al,dl - jg .5 - mov dl,al -.5: push cx dx -@@: xor bl,bl - inc al - cmp al,100 - jb .1 - pop dx ax - -if DEBUG -dbg_dec eax -dbg_dec edx -endf - cmp dl,100 - jb @f - mov al,dh - ret -@@: mov al,dh - push dx - bts [flags],7 - call .1 - shl bx,8 - mov al,[esp] - call .1 - pop dx - btr [flags],7 - mov al,dl - test bl,bh - jbe .ret - mov al,dh -.ret: -ret - -endf - - - - - - - -align 4 -rsx1 dw ?;0x4321 -rsx2 dw ?;0x1234 -random: ; ASCL - push ecx edx esi - mov cx,ax - mov ax,[rsx1] - mov bx,[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 [rsx1],bx - mov [rsx2],ax - xor dx,dx - cmp ax,0 - je nodiv - cmp cx,0 - je nodiv - div cx -nodiv: - mov ax,dx - pop esi edx ecx - and eax,0000ffffh -ret - - -if DEBUG -SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi - mov ebx,esp - mov ecx,8 - mov esi,(number_to_out+1) -.1: - mov eax,ebx - and eax,0xF - cmp al,10 - sbb al,69h - das - mov [esi+ecx],al - shr ebx,4 - loop .1 - dec esi - mcall 71,1,number_to_out -ret - -number_to_out db '0x00000000',13,10,0 -endf - - - - -text_cpu db 'CPU',0 -text_user db 'USER',0 -if lang eq ru_RU -title db '᪮ 0.4',0 -but_auto db '⠢',0 -but_new db '',0 -text_win db '먣ࠫ!',0 -else -title db 'Sea war 0.4',0 -but_auto db 'Auto fill',0 -but_new db 'New',0 -text_win db 'Won!',0 -endf - -I_END: -; t1,t3,t5: 0-祭 窠, 1-, 2-"஬", 3-"", 4-"⮯" -; t2,t4: ⠡ ᯮ ⮢, 1 4 ⪨, 2x3, 3x2, 4x1 -align 16 -table1 rb 100 ; -table3 rb 20 -table2 rb 100 ;ࠢ -table4 rb 20 -table5 rb 100 -u_kill rb 1 -c_kill rb 1 -p_pov rb 1 -smeshenie rb 1 -number_bots rb 1 -oX rb 1 -oY rb 1 -tbl_ranen rb 4 - -flags rw 1 -flags2 rw 1 -; 0: 0/1 - ⠡ / -;1: (⨪) /ࠢ (ਧ⠫) -;2: /ࠢ -;3: 筮 /⮧ -;4: .three - ⮯ ࠡ -;5: 祭 -;6: second_pole - 맮 find_near -;7: check_freedom -;8: १ࢨ஢ -;9: १ࢨ஢ -;10: १ࢨ஢ +;v. 0.4: 20.10.2009 staper@inbox.ru + +use32 + org 0x0 + db 'MENUET01' + dd 0x1 + dd START + dd I_END + dd (I_END+600) and not 3 + dd (I_END+600) and not 3 + dd 0x0,0x0 + +DEBUG equ 0 + +use_new_logic equ 1 ; "", +use_ext_logic equ 1 ; use_new_logic, + +include '../../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +;include 'debug.inc' + +macro dbg_dec num +{pushad +newline +debug_print_dec num +popad} + + +START: + + mcall 40,100111b + mcall 3 + mov [rsx1],ax + shr eax,16 + mov [rsx2],ax + jmp new_game + +redraw_all: + mcall 12,1 + mcall 0,100*65536+432,100*65536+260,0x34FFFFFF,,title + mcall 38,1*65536+421,27*65536+27,0x00b0b0b0 + mov edi,10 + @@: add ecx,20*65536+20 + mcall + dec edi + jnz @b + mcall ,1*65536+1,27*65536+226,;000000 + mov edi,21 + @@: add ebx,20*65536+20 + mcall + dec edi + jnz @b + mcall 13,202*65536+19,27*65536+202,0xFFFFFF + mcall 4,40*65536+12,0x80000000,text_user + mcall ,350*65536+12,,text_cpu + mcall 8,120*65536+70,7*65536+15,2,0xFFFFFF + mcall ,230*65536+70,,3, + mcall 4,135*65536+12,0x80000000,but_new + mcall ,240*65536+12,,but_auto + mcall 12,2 +ret + +draw_pole: +; mcall 0,100*65536+432,100*65536+260,0x74FFFFFF,,title + if DEBUG + call SysMsgBoardNum ;show esp + mcall 8,200*65536+10,7*65536+15,4,0xFFFFFF + endf + + + + mov esi,table1 + mov edi,90 + mov ebp,10 + mov ebx,1*65536+21 + mov ecx,27*65536+47 + call draw_bots + + mov esi,table5 + mov edi,90 + mov ebp,10 + mov ebx,221*65536+241 + mov ecx,27*65536+47 + call draw_bots + cmp [u_kill],10 + jne @f + mcall 4,69*65536+12,0x80ff0000,text_win + bts [flags],5 + @@: cmp [c_kill],10 + jne @f + mcall 4,372*65536+12,0x80ff0000,text_win + bts [flags],5 + @@: mcall 12,2 + cmp [number_bots],10 + jne still + bts [flags],0 +still: + mcall 10 + + cmp eax,6 + je mouse + dec eax + jnz @f + call redraw_all + jmp draw_pole +@@: dec eax + jz key + dec eax + jz button + jmp still + +key: + mcall 2 + jmp still + +button: + mcall 17 + dec ah + jnz @f + mcall -1 + + @@: mov ecx,(344)/4 + mov esi,table1 + .3: mov dword [esi],0 + add esi,4 + loop .3 + + dec ah + jz @f + + mov [flags],1001b ;auto fill + mov [number_bots],0 + + call set_bots + mov [number_bots],0 + bts [flags],2 + call set_bots + call redraw_all + btc [flags2],0 + jc second_pole.comp + jmp draw_pole + + @@: ;new game + mov [number_bots],0 +new_game: + mov [flags],1100b + call set_bots + btr [flags],0 + btr [flags],3 + btr [flags],2 + mov [number_bots],0 + call redraw_all + jmp draw_pole + +draw_bots: + cmp byte [esi],1 + je .one + cmp byte [esi],2 + je .two + cmp byte [esi],3 + je .three + cmp byte [esi],4 + jne .null + bts [flags],4 + jmp .three + +.end: + inc esi + dec ebp + jnz draw_bots + test edi,edi + jz @f + sub edi,10 + mov ebp,10 + add ebx,-200*65536-200 + add ecx,20*65536+20 + jmp draw_bots + @@: +ret + +.one: + push ebx ecx + call .0 + mov edx,0x00aa66 + mcall 13 + pop ecx ebx +.null: + add ebx,20*65536+20 + jmp .end +.two: + push ebx ecx + add ebx,8*65536-6 + add ecx,12*65536-12 + mcall 38,,,0x508cec + add ecx,-6*65536+6 + mcall + pop ecx ebx + jmp .null +.three: + push ebx ecx + call .0 + mov edx,0x00FF0000 + bt [flags],4 + jnc @f + mov edx,0x00555555 + btr [flags],4 + @@: mcall 13 + pop ecx ebx + xor edx,edx + mcall 38 + add ecx,20*65536-20 + mcall + add ecx,-20*65536+20 + jmp .null + +.0: + shr ebx,16 + inc bx + shl ebx,16 + add ebx,19 + shr ecx,16 + inc cx + shl ecx,16 + add ecx,19 +ret + +mouse: + bt [flags],5 + jc still + mcall 37,2 + test eax,eax + jz still + cmp al,2 + jg still + ;1 - , 2 - ࠢ + dec al + jnz .mouse_1 + btr [flags],1 + jmp @f + .mouse_1: + bts [flags],1 + @@: + mcall 37,1 + mov dx,ax + shr eax,16 + cmp dx,27 + jbe still + cmp dx,227 + jge still + cmp ax,1 + jbe still + cmp ax,201 + jge second_pole + ;ࢮ + bt [flags],0 + jc still + sub ax,1 + push dx + xor edx,edx + mov cx,20 + div cx + pop dx + mov [oX],al + push ax + sub dx,27 + mov ax,dx + xor dx,dx + div cx + mov [oY],al + xor dx,dx + mov cx,10 + mul cx + pop dx + add ax,dx + cmp ax,100 + jg still + +set_bot: + mov esi,table1 + bt [flags],2 + jnc @f + mov esi,table2 + @@: mov edi,esi + add edi,100 + cmp [number_bots],6 + jnb .1paluba + cmp [number_bots],3 + jnb .2paluba + cmp [number_bots],0 + je .4paluba + jmp .3paluba + +.4paluba: + bt [flags],1 ;寠㡭 + jnc @f + cmp [oX],6 + jg _still + jmp .41 + @@: cmp [oY],6 + jg _still + .41: inc [number_bots] + mov [edi],al + bt [flags],1 + jc @f + add al,10 + mov [edi+1],al + add al,10 + mov [edi+2],al + add al,10 + mov [edi+3],al + jmp init_table + @@: inc al + mov [edi+1],al + inc al + mov [edi+2],al + inc al + mov [edi+3],al + jmp init_table + + +.3paluba: ;寠㡭 + bt [flags],1 + jnc @f + cmp [oX],7 + jg _still + jmp .31 + @@: cmp [oY],7 + jg _still + .31: + call find_near + + bt [flags],1 + jc @f + add al,10 + call find_near + add al,10 + call find_near + sub al,20 + jmp .32 + @@: inc al + call find_near + inc al + call find_near + sub al,2 + .32: + inc [number_bots] + mov ecx,4 + mov dl,[number_bots] + sub dl,2 + jz @f + add ecx,3 + @@: + mov [edi+ecx],al + bt [flags],1 + jc @f + add al,10 + mov [edi+ecx+1],al + add al,10 + mov [edi+ecx+2],al +jmp init_table + @@: inc al + mov [edi+ecx+1],al + inc al + mov [edi+ecx+2],al +jmp init_table + + + +.2paluba: ;寠㡭 + bt [flags],1 + jnc @f + cmp [oX],8 + jg _still + jmp .21 + @@: cmp [oY],8 + jg _still + .21: + call find_near + bt [flags],1 + jc @f + add al,10 + call find_near + sub al,10 + jmp .22 + @@: inc al + call find_near + dec al + .22: + inc [number_bots] + mov ecx,8 + mov dl,[number_bots] + sub dl,4 + jz @f + add ecx,2 + dec dl + jz @f + add ecx,2 + @@: add ecx,2 + mov [edi+ecx],al + bt [flags],1 + jc @f + add al,10 + mov [edi+ecx+1],al +jmp init_table + @@: inc al + mov [edi+ecx+1],al +jmp init_table + + +.1paluba: ;㡭 + call find_near + inc [number_bots] + xor edx,edx + movzx ecx,[number_bots] + add ecx,9 + mov [edi+ecx],al +jmp init_table + +find_near: + push ax + call f_near ;0 + + cmp al,10 + jb @f + sub al,10 ;-10 + call f_near + +@@: cmp al,11 + jb @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,0 + je @f + + sub al,11 ;-11 + call f_near + +@@: cmp al,9 + jb @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,9 + je @f + + sub al,9 ;-9 + call f_near + +@@: cmp al,1 + jb @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,0 + je @f + + dec al ;-1 + call f_near + +@@: cmp al,99 + jg @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,9 + je @f + + inc al ;+1 + call f_near + +@@: cmp al,90 + jge @f + add al,10 ;+10 + call f_near + +@@: cmp al,91 + jge @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,0 + je @f + + add al,9 ;+9 + call f_near + +@@: cmp al,89 + jge @f + + xor edx,edx + mov ecx,10 + div cx + mov ax,[esp] + cmp dx,9 + je @f + add al,11 ;+11 + call f_near + +@@: pop ax +; xor bl,bl +; bt [flags],6 +; jnc @f +; bt [flags],9 +; jnc @f +; inc [p_pov] +; cmp [p_pov],20 +; jb @f +; bts [flags],9 +; @@: + btr [flags],6 + clc +ret + +f_near: + bt [flags],6 + jnc .2 +; bt [flags],9 +; jc @f +; cmp byte [esi+eax],2 +; jge @f +; @@: + cmp byte [esi+eax],4 + je @f + mov ax,[esp+4] + ret + @@:; add esp,4 +; jmp second_pole.cpu + mov ax,[esp+4] + mov cx,ax + add esp,6 + btr [flags],6 + stc +; mov bl,1 + ret + + .2: movzx edx, byte [smeshenie] + @@: cmp al,[edi+edx] + je .end + dec dl + jnz @b + cmp al,[edi] + je .end + mov ax,[esp+4] + ret + .end: add esp,10 + jmp _still + + + +init_table: +; xor eax,eax + movzx ecx, byte [number_bots] + mov edx,3 + dec cl + jz .i_t + + mov al,2 +.2: add dl,3 + dec cl + jz .i_t + dec al + jnz .2 + + mov al,3 +.3: add dl,2 + dec cl + jz .i_t + dec al + jnz .3 + + mov al,4 +.4: inc dl + dec cl + jz .i_t + dec al + jnz .4 + +.i_t: mov [smeshenie],dl +@@: movzx eax, byte [edi+edx] + mov byte [esi+eax],1 + dec dl + jnz @b + movzx eax, byte [edi] + mov byte [esi+eax],1 + bt [flags],3 + jc set_bots +; mcall 12,1 + jmp draw_pole + + +second_pole: + cmp ax,221 + jbe still + cmp ax,421 + jge still + ;஥ + bt [flags],0 + jnc still + sub ax,221 + push dx + xor edx,edx + mov cx,20 + div cx + pop dx + push ax + sub dx,27 + mov ax,dx + xor dx,dx + div cx + xor dx,dx + mov cx,10 + mul cx + pop dx + add ax,dx + cmp ax,100 + jg still + + mov edi,table2 + mov esi,table5 + cmp byte [esi+eax],2 + jge still + mov bl, byte [edi+eax] + add bl,2 + mov ecx,table5 + call if_bot_killed + mov [esi+eax],bl + cmp bl,3 + jge .m_end +.comp: mov esi,table1 + + + + .cpu: +; jmp .rndm + xor eax,eax +; mov edi,4 + btr [flags],8 + xor ecx,ecx + mov edx,tbl_ranen + mov dword [edx],0 + @@: mov al,[esi+ecx] ; "࠭ ࠡ" + cmp al,3 + je .0 + cmp cl,99 + jge .1 + inc cl + jmp @b + .0: mov [edx],cl +if DEBUG +dbg_dec ecx +endf + inc edx + inc cl + jmp @b + + .1: + dec edx + mov cl,[edx] + cmp edx,tbl_ranen + jb .rndm + je @f + sub cl,[edx-1] + cmp cl,1 + jne .2 + add cl,[edx-1] + jmp .12 + .2: + add cl,[edx-1] + jmp .13 + + @@: bts [flags],8 + mov eax,4 + call random + dec al + jz .11 + dec al + jz .12 + dec al + jz .13 + jmp .14 + .11: +if DEBUG +dbg_dec 100 +endf + cmp cl,10 + jge @f + bts [flags],8 + jmp .12 + @@: sub cl,10 + cmp byte [esi+ecx],2 + jge @f + mov eax,ecx + bts [flags],6 + call find_near +; test bl,bl +; jz .20 + jnc .20 + @@: bts [flags],8 + add cl,10 + bts [flags],8 + .12: +if DEBUG +dbg_dec 200 +endf + movzx eax,cl + push cx + mov ch,10 + div ch + pop cx + cmp ah,9 + jb @f + .121: + bt [flags],8 + jc .13 + bts [flags],8 + mov edx,tbl_ranen + mov cl,[edx] + jmp .14 + @@: inc cl + cmp byte [esi+ecx],2 + jge @f + mov eax,ecx + bts [flags],6 + call find_near +; test bl,bl +; jz .20 + jnc .20 + @@: dec cl + jmp .121 + + .13: +if DEBUG +dbg_dec 300 +endf + cmp cl,90 + jb @f + .131: + bt [flags],8 + jc .14 + bts [flags],8 + mov edx,tbl_ranen + mov cl,[edx] + jmp .11 + @@: add cl,10 + cmp byte [esi+ecx],2 + jge @f + mov eax,ecx + bts [flags],6 + call find_near +; test bl,bl +; jz .20 + jnc .20 + @@: sub cl,10 + jmp .131 + + .14: +if DEBUG +dbg_dec 400 +endf + movzx eax,cl + push cx + mov ch,10 + div ch + pop cx + cmp ah,0 + jne @f + .141: + bts [flags],8 + jmp .11;cpu;rndm + @@: dec cl + cmp byte [esi+ecx],2 + jge @f + mov eax,ecx + bts [flags],6 + call find_near +; test bl,bl +; jz .20 + jnc .20 + @@: inc cl + jmp .141 + +.rndm: + + mov eax,100 + call random + cmp eax,100 + jb @f + shr eax,1 +@@: + +if use_new_logic + btc [flags],10 + jnc @f + btc [flags],9 + jnc @f + call check_freedom +endf + +@@: cmp byte [esi+eax],2 + jb @f; .rndm + ; ᢮ 窨 ।/᫥ ࠭, + ; random 室 ᪮ 横 + bt ax,0 + jnc .r_1 + .r_0: + cmp al,0 + je .r_1 + dec al + + cmp byte [esi+eax],2 + jb @f + jmp .r_0 + .r_1: + cmp al,99 + je .r_0 + inc al + + cmp byte [esi+eax],2 + jb @f + jmp .r_1 +@@: + bts [flags],6 + call find_near +; test bl,bl +; jnz .cpu + jc .cpu;20 + +.20: + mov bl,[esi+eax] + add bl,2 + mov ecx,esi + mov edi,esi + call if_bot_killed + mov [esi+eax],bl +; cmp [u_kill],10 +; je .m_end + cmp [c_kill],10 + je .m_end + cmp bl,3 + jge .cpu + +.m_end:; mcall 12,1 +jmp draw_pole + +if_bot_killed: + push ebx + add edi,100 + mov ebx,19 + @@: cmp al,[edi+ebx] + je @f + dec ebx + jnz @b + cmp al,[edi+ebx] + jne .end + @@: + cmp ebx,16 + jnb .end_i + + @@: cmp bl,10 + jb .2 + btc bx,0 + mov bl, [edi+ebx] + cmp byte [ecx+ebx],3 + jne .end + inc byte [ecx+ebx] + jmp .end_i + + .2: cmp bl,4 + jb .3 + add edi,4 + cmp bl,7 + jb .3 + add edi,3 + .3: movzx edx, byte [edi] + cmp dl,al + je @f + cmp byte [ecx+edx],3 + jne .end + @@: mov dl,[edi+1] + cmp dl,al + je @f + cmp byte [ecx+edx],3 + jne .end + @@: mov dl,[edi+2] + cmp dl,al + je @f + cmp byte [ecx+edx],3 + jne .end + + @@: cmp bl,4 + jnb @f + mov dl,[edi+3] + cmp dl,al + je @f + cmp byte [ecx+edx],3 + jne .end + + + @@: mov dl,[edi] + cmp dl,al + je @f + inc byte [ecx+edx] + @@: mov dl,[edi+1] + cmp dl,al + je @f + inc byte [ecx+edx] + @@: mov dl,[edi+2] + + cmp bl,4 + jnb .9;@f + +; cmp dl,al +; je .end_i +; inc byte [ecx+edx] +; jmp .end_i + + + @@: cmp dl,al + je @f + inc byte [ecx+edx] + @@: mov dl,[edi+3] +.9: cmp dl,al + je .end_i + inc byte [ecx+edx] + .end_i: + pop ebx + inc ebx + cmp ecx,table5 + jne @f + inc [u_kill] + ret + @@: inc [c_kill] + ret + .end: pop ebx +ret + + + + +_still: + bt [flags],3 + jnc still + +set_bots: + cmp [number_bots],10 + jne @f + ret + @@: xor edx,edx + mov ecx,10 + cmp [number_bots],6 + jb @f + push dword 10 + jmp .1 + @@: cmp [number_bots],3 + jb @f + push dword 9 + jmp .1 + @@: cmp [number_bots],2 + jb @f + push dword 8 + jmp .1 + @@: push dword 7 + .1: + mov eax,[esp] + call random + mov [oX],al + mul cl + mov cl,al + mov eax,[esp] + call random + mov [oY],al + add cl,al + + cmp cl,100 + jge .1 + + add esp,4 + mov eax,2 + call random + cmp al,1 + jne @f + bts [flags],1 + mov al,cl + jmp set_bot + @@: btr [flags],1 + mov al,cl + jmp set_bot + + + + + + +;楤 ⫠ " ᢮" ⮪ ⠪ + +if use_new_logic +check_freedom: +; mov esi,table1 + push ax + push word 100 + xor eax,eax + mov ebx,0x900 + +.1: bts [flags],6 + call find_near + jc .11 + cmp byte [esi+eax],2 ;0 + jb @f +.11: inc bl + +@@: cmp al,10 ;-10 + jb @f + push ax + + sub al,10 + if use_ext_logic + bts [flags],6 + call find_near + jc .21 + endf + cmp byte [esi+eax],2 + jb .22 +.21: inc bl +.22: pop ax + +@@: cmp al,11 + jb @f + push ax + + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + + cmp dx,0 + je .32 + + sub al,11 + if use_ext_logic + bts [flags],6 + call find_near + jc .31 + endf + cmp byte [esi+eax],2 ;-11 + jb .32 +.31: inc bl +.32: pop ax + +@@: cmp al,9 + jb @f + push ax + + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + cmp dx,9 + je .42 + + sub eax,9 + if use_ext_logic + bts [flags],6 + call find_near + jc .41 + endf + cmp byte [esi+eax],2 ;-9 + jb .42 +.41: inc bl +.42: pop ax + +@@: cmp al,1 + jb @f + push ax + + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + cmp dx,0 + je .52 + + dec al + if use_ext_logic + bts [flags],6 + call find_near + jc .51 + endf + cmp byte [esi+eax],2 ;-1 + jb .52 +.51: inc bl +.52: pop ax + +@@: cmp al,99 + jg @f + push ax + + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + cmp dx,9 + je .62 + + inc al + if use_ext_logic + bts [flags],6 + call find_near + jc .61 + endf + cmp byte [esi+eax],2 ;+1 + jb .62 +.61: inc bl +.62: pop ax + +@@: cmp al,90 + jge @f + push ax + add al,10 + if use_ext_logic + bts [flags],6 + call find_near + jc .71 + endf + cmp byte [esi+eax],2 ;+10 + jb .72 +.71: inc bl +.72: pop ax + +@@: cmp al,91 + jge @f + push ax + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + cmp dx,0 + je .82 + + add al,9 + if use_ext_logic + bts [flags],6 + call find_near + jc .81 + endf + cmp byte [esi+eax],2 ;+9 + jb .82 +.81: inc bl +.82: pop ax + +@@: cmp al,89 + jge @f + push ax + + xor edx,edx + mov ecx,10 + push ax + div cx + pop ax + + cmp dx,9 + je .92 + + add al,11 + if use_ext_logic + bts [flags],6 + call find_near + jc .91 + endf + cmp byte [esi+eax],2 ;+11 + jb .92 +.91: inc bl +.92: pop ax + +@@: bt [flags],7 + jc .ret + cmp byte [esi+eax],1 + jg @f + cmp bl,bh + jg @f + +; shl ebx,8 + bts [flags],6 + call find_near +; xchg cl,bl +; shr ebx,8 +; test cl,cl +; jnz @f + jc @f + + shl bx,8 + pop dx ;dh - ᫥ ᢮ ⪠, dl - ࠢ + pop cx ;cl - ࠭ ࠭ ⪠ +; cmp al,dl +; jg .5 +; cmp al,cl +; jb .4 +; mov dl,al +; jmp .5 +;.4: cmp al,dh +; jb .5 +; mov dh,al + cmp al,dh + jb .5 + cmp al,cl + jg .4 + mov dh,al + jmp .5 +.4: cmp al,dl + jg .5 + mov dl,al +.5: push cx dx +@@: xor bl,bl + inc al + cmp al,100 + jb .1 + pop dx ax + +if DEBUG +dbg_dec eax +dbg_dec edx +endf + cmp dl,100 + jb @f + mov al,dh + ret +@@: mov al,dh + push dx + bts [flags],7 + call .1 + shl bx,8 + mov al,[esp] + call .1 + pop dx + btr [flags],7 + mov al,dl + test bl,bh + jbe .ret + mov al,dh +.ret: +ret + +endf + + + + + + + +align 4 +rsx1 dw ?;0x4321 +rsx2 dw ?;0x1234 +random: ; ASCL + push ecx edx esi + mov cx,ax + mov ax,[rsx1] + mov bx,[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 [rsx1],bx + mov [rsx2],ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop esi edx ecx + and eax,0000ffffh +ret + + +if DEBUG +SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi + mov ebx,esp + mov ecx,8 + mov esi,(number_to_out+1) +.1: + mov eax,ebx + and eax,0xF + cmp al,10 + sbb al,69h + das + mov [esi+ecx],al + shr ebx,4 + loop .1 + dec esi + mcall 71,1,number_to_out +ret + +number_to_out db '0x00000000',13,10,0 +endf + + + + +text_cpu db 'CPU',0 +text_user db 'USER',0 +if lang eq ru_RU +title db '᪮ 0.4',0 +but_auto db '⠢',0 +but_new db '',0 +text_win db '먣ࠫ!',0 +else ; Default to en_US +title db 'Sea war 0.4',0 +but_auto db 'Auto fill',0 +but_new db 'New',0 +text_win db 'Won!',0 +endf + +I_END: +; t1,t3,t5: 0-祭 窠, 1-, 2-"஬", 3-"", 4-"⮯" +; t2,t4: ⠡ ᯮ ⮢, 1 4 ⪨, 2x3, 3x2, 4x1 +align 16 +table1 rb 100 ; +table3 rb 20 +table2 rb 100 ;ࠢ +table4 rb 20 +table5 rb 100 +u_kill rb 1 +c_kill rb 1 +p_pov rb 1 +smeshenie rb 1 +number_bots rb 1 +oX rb 1 +oY rb 1 +tbl_ranen rb 4 + +flags rw 1 +flags2 rw 1 +; 0: 0/1 - ⠡ / +;1: (⨪) /ࠢ (ਧ⠫) +;2: /ࠢ +;3: 筮 /⮧ +;4: .three - ⮯ ࠡ +;5: 祭 +;6: second_pole - 맮 find_near +;7: check_freedom +;8: १ࢨ஢ +;9: १ࢨ஢ +;10: १ࢨ஢ diff --git a/programs/load_img.inc b/programs/load_img.inc index 150951f49..3614984f3 100644 --- a/programs/load_img.inc +++ b/programs/load_img.inc @@ -1,184 +1,185 @@ -; -; ஢ ࠦ १ 㭪樨 ⥪ libimg. -; -; (1) load_image_file: -; -; ஢ ࠧ 祭 䠩 ࠦ. -; 뤥 㦠 㤠 䠩. -; । ࠧ 室 ᯠ ࠦ. -; ॢ뤥 , ᯠ뢠 ࠦ ଠ⮢ jpg, png, ... -; ଠ rgb 뢮 ࠭ १ . 㭪. -; 室 ⠪ ࠧ 뢠 ࠦ -; 쭥襣 ᯮ짮 ணࠬ. -; -; ᯮ饩 ணࠬ 祭 ⥪ libimg, -;  ६ file_name ࠧ஬ 4096 , -; ⠪ run_file_70 ⨯ FileInfoBlock. -; -; (2) include_image_file: -; -; ࠦ 䠩 ணࠬ. -; । ࠧ 室 ᯠ ࠦ. -; 뤥 , ᯠ뢠 ࠦ ଠ⮢ jpg, png, ... -; ଠ rgb 뢮 ࠭ १ . 㭪. -; 室 ⠪ ࠧ ७ ࠦ -; 쭥襣 ᯮ짮 ணࠬ. - -; 祭 室 䠩: -include 'dll.inc' -;include 'load_lib.mac' -include 'develop/libraries/libs-dev/libio/libio.inc' - -align 4 -open_b rb 560 - -txt_err_img_file: -if lang eq ru_RU - db '訡 N' -.n: db '* ⨨ 䠩 ' -else - db 'Error N' -.n: db '*. Can',39,'t open file ' -end if -.f: dd 0,0 - -; path - ६ ப ࠬ஬ -; buf - ६ 㤠 㤥 ᠭ 㪠⥫ ࠦ ଠ rgb, -; 砥 ᫨ 䠩 ஥ 㤥 ᠭ 0 -; img_w, img_h - ६ 㤠 ᠭ ࠧ 뢠 -; ࠦ, 易⥫ ࠬ -; bytes_p_p - ᪮쪮 ᥫ, 易⥫ ࠬ -; ᫨ 㪠 3. 쭮 祭 3. -macro load_image_file path, buf, img_w, img_h, bytes_p_p -{ -local .err_open -local .end_open - -if path eqtype '' ;஢塞 ப ࠬ path - local .path_str - jmp @f - .path_str db path ;ନ㥬 ६ - db 0 - @@: - ;32 - ⠭ ஬ ⥬ ⥬ - copy_path .path_str,[32],file_name,0 -else - copy_path path,[32],file_name,0 ;ନ㥬 䠩 ࠦ, ࠧ㬥 ணࠬ -end if - mov dword[buf],0 - - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], file_name - mcall SF_FILE,run_file_70 - or eax,eax - jnz .err_open - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.Alloc,ecx ;뤥塞 ࠦ - mov [buf],eax - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov [run_file_70.Count], ecx - mov [run_file_70.Buffer], eax - mov byte[run_file_70+20], 0 - mov [run_file_70.FileName], file_name - mcall SF_FILE,run_file_70 ;㦠 䠩 ࠦ - test eax,eax - jnz .err_open - cmp ebx,0xffffffff - je .end_open - ;।塞 ࠦ 襬 ࠬ - stdcall [img_decode], [buf],ebx,0 - mov ebx,eax - ;।塞 ࠧ ஢ ࠦ - mov ecx,[eax+4] ;+4 = image width -if img_w eq -else - mov dword[img_w],ecx -end if -if img_h eq - imul ecx,[eax+8] ;+8 = image height -else - mov eax,[eax+8] ;+8 = image height - mov dword[img_h],eax - imul ecx,eax -end if -if bytes_p_p eq - imul ecx,3 ;need for r,g,b -else - imul ecx,bytes_p_p -end if - stdcall mem.ReAlloc,[buf],ecx ;塞 ࠧ - mov [buf],eax - stdcall [img_to_rgb2], ebx,[buf] ;८ࠧ㥬 ࠦ ଠ rgb - stdcall [img_destroy], ebx ;㤠塞 ६ ࠬࠬ ࠦ - jmp .end_open - .err_open: - add al,'0' - mov byte[txt_err_img_file.n],al -if path eqtype '' - mov eax,dword[.path_str] - mov dword[txt_err_img_file.f],eax - mov eax,dword[.path_str+4] -else - mov eax,dword[path] - mov dword[txt_err_img_file.f],eax - mov eax,dword[path+4] -end if - mov dword[txt_err_img_file.f+4],eax - mov byte[txt_err_img_file.f+7],0 - notify_window_run txt_err_img_file - .end_open: -} - - - -; path - 砥 䠩 -; buf - ६ 㤠 㤥 ᠭ 㪠⥫ ࠦ ଠ rgb -; img_w, img_h - ६ 㤠 ᠭ ࠧ ࠦ, -; 易⥫ ࠬ -; bytes_p_p - ᪮쪮 ᥫ, 易⥫ ࠬ -; ᫨ 㪠 3. 쭮 祭 3. -macro include_image_file path, buf, img_w, img_h, bytes_p_p -{ -local .beg_file -local .end_file - -jmp .end_file -align 4 -.beg_file: - file path -.end_file: - - ;।塞 ࠦ 襬 ࠬ - stdcall [img_decode], .beg_file,.end_file-.beg_file,0 - mov ebx,eax - ;।塞 ࠧ ஢ ࠦ - mov ecx,[eax+4] ;+4 = image width -if img_w eq -else - mov dword[img_w],ecx -end if -if img_h eq - imul ecx,[eax+8] ;+8 = image height -else - mov eax,[eax+8] ;+8 = image height - mov dword[img_h],eax - imul ecx,eax -end if -if bytes_p_p eq - imul ecx,3 ;need for r,g,b -else - imul ecx,bytes_p_p -end if - stdcall mem.Alloc,ecx ;塞 ࠧ - mov [buf],eax - stdcall [img_to_rgb2], ebx,[buf] ;८ࠧ㥬 ࠦ ଠ rgb - stdcall [img_destroy], ebx ;㤠塞 ६ ࠬࠬ ࠦ -} +; +; ஢ ࠦ १ 㭪樨 ⥪ libimg. +; +; (1) load_image_file: +; +; ஢ ࠧ 祭 䠩 ࠦ. +; 뤥 㦠 㤠 䠩. +; । ࠧ 室 ᯠ ࠦ. +; ॢ뤥 , ᯠ뢠 ࠦ ଠ⮢ jpg, png, ... +; ଠ rgb 뢮 ࠭ १ . 㭪. +; 室 ⠪ ࠧ 뢠 ࠦ +; 쭥襣 ᯮ짮 ணࠬ. +; +; ᯮ饩 ணࠬ 祭 ⥪ libimg, +;  ६ file_name ࠧ஬ 4096 , +; ⠪ run_file_70 ⨯ FileInfoBlock. +; +; (2) include_image_file: +; +; ࠦ 䠩 ணࠬ. +; । ࠧ 室 ᯠ ࠦ. +; 뤥 , ᯠ뢠 ࠦ ଠ⮢ jpg, png, ... +; ଠ rgb 뢮 ࠭ १ . 㭪. +; 室 ⠪ ࠧ ७ ࠦ +; 쭥襣 ᯮ짮 ணࠬ. + +; 祭 室 䠩: +include 'dll.inc' +;include 'load_lib.mac' +include 'develop/libraries/libs-dev/libio/libio.inc' + +align 4 +open_b rb 560 + +; Language support for locales: ru_RU (CP866), en_US. +txt_err_img_file: +if lang eq ru_RU + db '訡 N' +.n: db '* ⨨ 䠩 ' +else ; Default to en_US + db 'Error N' +.n: db '*. Can',39,'t open file ' +end if +.f: dd 0,0 + +; path - ६ ப ࠬ஬ +; buf - ६ 㤠 㤥 ᠭ 㪠⥫ ࠦ ଠ rgb, +; 砥 ᫨ 䠩 ஥ 㤥 ᠭ 0 +; img_w, img_h - ६ 㤠 ᠭ ࠧ 뢠 +; ࠦ, 易⥫ ࠬ +; bytes_p_p - ᪮쪮 ᥫ, 易⥫ ࠬ +; ᫨ 㪠 3. 쭮 祭 3. +macro load_image_file path, buf, img_w, img_h, bytes_p_p +{ +local .err_open +local .end_open + +if path eqtype '' ;஢塞 ப ࠬ path + local .path_str + jmp @f + .path_str db path ;ନ㥬 ६ + db 0 + @@: + ;32 - ⠭ ஬ ⥬ ⥬ + copy_path .path_str,[32],file_name,0 +else + copy_path path,[32],file_name,0 ;ନ㥬 䠩 ࠦ, ࠧ㬥 ணࠬ +end if + mov dword[buf],0 + + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], file_name + mcall SF_FILE,run_file_70 + or eax,eax + jnz .err_open + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.Alloc,ecx ;뤥塞 ࠦ + mov [buf],eax + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov [run_file_70.Count], ecx + mov [run_file_70.Buffer], eax + mov byte[run_file_70+20], 0 + mov [run_file_70.FileName], file_name + mcall SF_FILE,run_file_70 ;㦠 䠩 ࠦ + test eax,eax + jnz .err_open + cmp ebx,0xffffffff + je .end_open + ;।塞 ࠦ 襬 ࠬ + stdcall [img_decode], [buf],ebx,0 + mov ebx,eax + ;।塞 ࠧ ஢ ࠦ + mov ecx,[eax+4] ;+4 = image width +if img_w eq +else + mov dword[img_w],ecx +end if +if img_h eq + imul ecx,[eax+8] ;+8 = image height +else + mov eax,[eax+8] ;+8 = image height + mov dword[img_h],eax + imul ecx,eax +end if +if bytes_p_p eq + imul ecx,3 ;need for r,g,b +else + imul ecx,bytes_p_p +end if + stdcall mem.ReAlloc,[buf],ecx ;塞 ࠧ + mov [buf],eax + stdcall [img_to_rgb2], ebx,[buf] ;८ࠧ㥬 ࠦ ଠ rgb + stdcall [img_destroy], ebx ;㤠塞 ६ ࠬࠬ ࠦ + jmp .end_open + .err_open: + add al,'0' + mov byte[txt_err_img_file.n],al +if path eqtype '' + mov eax,dword[.path_str] + mov dword[txt_err_img_file.f],eax + mov eax,dword[.path_str+4] +else + mov eax,dword[path] + mov dword[txt_err_img_file.f],eax + mov eax,dword[path+4] +end if + mov dword[txt_err_img_file.f+4],eax + mov byte[txt_err_img_file.f+7],0 + notify_window_run txt_err_img_file + .end_open: +} + + + +; path - 砥 䠩 +; buf - ६ 㤠 㤥 ᠭ 㪠⥫ ࠦ ଠ rgb +; img_w, img_h - ६ 㤠 ᠭ ࠧ ࠦ, +; 易⥫ ࠬ +; bytes_p_p - ᪮쪮 ᥫ, 易⥫ ࠬ +; ᫨ 㪠 3. 쭮 祭 3. +macro include_image_file path, buf, img_w, img_h, bytes_p_p +{ +local .beg_file +local .end_file + +jmp .end_file +align 4 +.beg_file: + file path +.end_file: + + ;।塞 ࠦ 襬 ࠬ + stdcall [img_decode], .beg_file,.end_file-.beg_file,0 + mov ebx,eax + ;।塞 ࠧ ஢ ࠦ + mov ecx,[eax+4] ;+4 = image width +if img_w eq +else + mov dword[img_w],ecx +end if +if img_h eq + imul ecx,[eax+8] ;+8 = image height +else + mov eax,[eax+8] ;+8 = image height + mov dword[img_h],eax + imul ecx,eax +end if +if bytes_p_p eq + imul ecx,3 ;need for r,g,b +else + imul ecx,bytes_p_p +end if + stdcall mem.Alloc,ecx ;塞 ࠧ + mov [buf],eax + stdcall [img_to_rgb2], ebx,[buf] ;८ࠧ㥬 ࠦ ଠ rgb + stdcall [img_destroy], ebx ;㤠塞 ६ ࠬࠬ ࠦ +} diff --git a/programs/media/img_transform/img_transform.asm b/programs/media/img_transform/img_transform.asm index 2321ffc08..65b79af9e 100644 --- a/programs/media/img_transform/img_transform.asm +++ b/programs/media/img_transform/img_transform.asm @@ -1,1637 +1,1637 @@ -use32 - org 0 - db 'MENUET01' - dd 1,start,i_end,mem,stacktop,openfile_path,sys_path - -include 'lang.inc' -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../load_img.inc' -include '../../load_lib.mac' -include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include '../../develop/libraries/TinyGL/asm_fork/zbuffer.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include '../../develop/info3ds/info_fun_float.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -caption db 'Image transform 08.12.20',0 ; - -BUF_STRUCT_SIZE equ 21 -buf2d_data equ dword[edi] ; ࠦ -buf2d_w equ dword[edi+8] ;ਭ -buf2d_h equ dword[edi+12] ; -buf2d_l equ word[edi+4] -buf2d_t equ word[edi+6] ; ᢥ -buf2d_size_lt equ dword[edi+4] ; ᫥ ࠢ -buf2d_color equ dword[edi+16] ;梥 䮭 -buf2d_bits equ byte[edi+20] ;⢮ 1- 窥 ࠦ - -NAV_WND_L equ 145 -NAV_WND_T equ 1 - -include 'select_points.inc' - -IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 -image_data_toolbar dd 0 - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - stdcall [buf2d_create], buf_0 ;ᮧ - - include_image_file '../../../programs/fs/kfar/trunk/font6x9.bmp', image_data_toolbar, buf_font.w,buf_font.h - stdcall [buf2d_create_f_img], buf_font,[image_data_toolbar] ;ᮧ - stdcall mem.Free,[image_data_toolbar] ;᢮ - stdcall [buf2d_conv_24_to_8], buf_font,1 ; ஧筮 8 - stdcall [buf2d_convert_text_matrix], buf_font - - include_image_file 'toolbar.png', image_data_toolbar - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;ன 祪 - call points_init - - ;open file from cmd line - cmp dword[openfile_path],0 - je @f - call but_open_file.no_dlg - @@: - -align 4 -red_win: - call draw_window - -align 16 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - cmp eax,0 - je timer_funct - - cmp al,1 - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo.window_stack_position] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -timer_funct: - push eax ebx - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - pop ebx eax - cmp byte[calc],0 - je still - call draw_nav_wnd - call draw_buffers - jmp still - -align 16 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - ; *** ᮢ (믮 1 ࠧ ᪥) *** - mov edx,[sc.work] - or edx,(3 shl 24)+0x30000000 - mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,dword[procinfo.box.height] - cmp eax,120 - jge @f - mov eax,120 ;min size - @@: - sub eax,65 - mov ebx,dword[procinfo.box.width] - cmp ebx,270 - jge @f - mov ebx,270 - @@: - sub ebx,19 - cmp eax,dword[buf_0.h] ;ᬮਬ ࠧ - jne @f - cmp ebx,dword[buf_0.w] - jne @f - jmp .end0 - @@: - stdcall [buf2d_resize],buf_0,ebx,eax,1 - call calc_nav_params - mov eax,[nav_x] - call nav_x_corect - mov [nav_x],eax - mov eax,[nav_y] - call nav_y_corect - mov [nav_y],eax - mov byte[calc],1 - .end0: - - ; *** ᮧ *** - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button] - - add ebx,25 shl 16 - mcall ,,,4 - add ebx,30 shl 16 - mcall ,,,5 - add ebx,25 shl 16 - mcall ,,,6 - add ebx,25 shl 16 - mcall ,,,7 - - ; *** ᮢ *** - mov edx,(7 shl 16)+7 ;icon open - mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon save - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(30 shl 16) ;icon view - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon mode - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - - call draw_nav_wnd - call draw_buffers - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -;ᮢ 樮 -align 4 -proc draw_nav_wnd - cmp dword[buf_i0],0 - je .end0 - bt dword[nav_x_min],31 - jnc .end0 - bt dword[nav_y_min],31 - jnc .end0 -pushad - mov ebx,(NAV_WND_L shl 16) - add ebx,[nav_wnd_w] - mov ecx,(NAV_WND_T shl 16) - add ecx,[nav_wnd_h] - mcall SF_DRAW_RECT,,,0 ;ࠦ - mov ecx,[nav_wnd_zoom] - mov ebx,[nav_x] - neg ebx - sar ebx,cl - add ebx,NAV_WND_L - shl ebx,16 - add ebx,[buf_0.w] - shr bx,cl - mov edx,[nav_y] - neg edx - sar edx,cl - add edx,NAV_WND_T - shl edx,16 - add edx,[buf_0.h] - shr dx,cl - mov ecx,edx - mcall ,,,0x404080 ; ࠦ - - mov edi,sel_pt - @@: - mov ecx,[nav_wnd_zoom] - mov ebx,[edi+point2d.x] - shr ebx,cl - add ebx,NAV_WND_L - mov edx,[edi+point2d.y] - shr edx,cl - add edx,NAV_WND_T - mov ecx,edx - mcall SF_PUT_PIXEL,,,0xffff00 - add edi,sizeof.point2d - cmp edi,sel_pt+4*sizeof.point2d - jl @b -popad - .end0: - ret -endp - -align 4 -proc draw_buffers -pushad - cmp byte[calc],0 - je .end0 - ; *** *** - bt dword[nav_x_min],31 - jnc .beg0 - bt dword[nav_y_min],31 - jc @f - .beg0: - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - @@: - cmp byte[view_b],1 - je .end1 - push buf_i0 - jmp .end2 - .end1: - push buf_ogl - .end2: - stdcall [buf2d_bit_blt], buf_0, [nav_x],[nav_y] ;,... - - call points_draw - xor eax,eax - cmp [u_line_v],eax - je @f - mov eax,[u_line_v] - add eax,[nav_x] - stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0xffffff - inc eax - stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0 - @@: - xor eax,eax - cmp [u_line_h],eax - je @f - mov eax,[u_line_h] - add eax,[nav_y] - stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0xffffff - inc eax - stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0 - @@: - - ; *** ࠧ 䠩 *** - mov edi,txt_f_size.size - mov eax,[open_file_size] - mov ebx,txt_pref - .cycle: - cmp eax,1024 - jl @f - shr eax,10 - add ebx,4 - jmp .cycle - @@: - stdcall convert_int_to_str, 16 - stdcall str_cat, edi,ebx - stdcall str_cat, edi,txt_space ;騩 ஡ - ;ਭ ࠦ - mov eax,[buf_i0.w] - mov edi,txt_img_w.size - stdcall convert_int_to_str, 16 - mov eax,[buf_i0.h] - mov edi,txt_img_h.size - stdcall convert_int_to_str, 16 - mov byte[calc],0 - .end0: - ; *** ᮢ *** - stdcall [buf2d_draw], buf_0 - ; *** ᮢ ࠧ 䠩 *** - mov ecx,[sc.work_text] - or ecx,0x80000000 or (1 shl 30) - mov edi,[sc.work] ;梥 䮭 - mcall SF_DRAW_TEXT,(275 shl 16)+4,,txt_f_size - add ebx,9 - mcall ,,,txt_img_w - add ebx,9 - mcall ,,,txt_img_h -popad - ret -endp - -align 16 -key: - push eax ebx ecx - mcall SF_GET_KEY - cmp byte[view_b],1 - je .end1 - cmp ah,49 ;1 - jne @f - mov edi,sel_pt - call set_point_coords - jmp .end0 - @@: - cmp ah,50 ;2 - jne @f - mov edi,sel_pt+sizeof.point2d - call set_point_coords - jmp .end0 - @@: - cmp ah,51 ;3 - jne @f - mov edi,sel_pt+sizeof.point2d*2 - call set_point_coords - jmp .end0 - @@: - cmp ah,52 ;4 - jne @f - mov edi,sel_pt+sizeof.point2d*3 - call set_point_coords - jmp .end0 - @@: - .end1: - - cmp ah,178 ;Up - jne @f - call but_img_move_up - jmp .end0 - @@: - cmp ah,177 ;Down - jne @f - call but_img_move_down - jmp .end0 - @@: - cmp ah,176 ;Left - jne @f - call but_img_move_left - jmp .end0 - @@: - cmp ah,179 ;Right - jne @f - call but_img_move_right - jmp .end0 - @@: - cmp ah,104 ;H - jne @f - call set_user_line_h - mov byte[calc],1 - jmp .end0 - @@: - cmp ah,118 ;V - jne @f - call set_user_line_w - mov byte[calc],1 - jmp .end0 - @@: - - mov ecx,eax - mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS - bt eax,2 ;left Ctrl - jc .key_Ctrl - bt eax,3 ;right Ctrl - jc .key_Ctrl - jmp .end0 - .key_Ctrl: - cmp ch,15 ;Ctrl+O - jne @f - call but_open_file - @@: - cmp ch,19 ;Ctrl+S - jne @f - call but_save_file - @@: - - .end0: - pop ecx ebx eax - jmp still - -;input: -; edi - 㪠⥫ point2d -align 4 -set_point_coords: - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - sub eax,[nav_x] - cmp eax,0 - jge @f - xor eax,eax - @@: - cmp eax,[buf_i0.w] - jle @f - mov eax,[buf_i0.w] - @@: - mov [edi+point2d.x],eax - sub ebx,[nav_y] - cmp ebx,0 - jge @f - xor ebx,ebx - @@: - cmp ebx,[buf_i0.h] - jle @f - mov ebx,[buf_i0.h] - @@: - mov [edi+point2d.y],ebx - call points_update_prop - mov byte[calc],1 - .end0: - ret - -align 16 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_open_file - jmp still - @@: - cmp ah,4 - jne @f - call but_save_file - jmp still - @@: - cmp ah,5 - jne @f - call but_2 - jmp still - @@: - cmp ah,6 - jne @f - call but_3 - jmp still - @@: - cmp ah,7 - jne @f - call but_about - jmp still - @@: - cmp ah,1 - jne still -.exit: - stdcall [buf2d_delete],buf_0 - stdcall [buf2d_delete],buf_i0 - ;stdcall [buf2d_delete],buf_ogl - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_img] - mcall SF_TERMINATE_PROCESS - -align 4 -mouse: - push eax ebx ecx - mcall SF_MOUSE_GET,SSF_BUTTON_EXT - bt eax,8 - jnc @f - ;mouse l. but. press - call mouse_left_d - jmp .end_l - @@: - ;bt eax,0 - ;jnc @f - ;mouse l. but. move - ;call mouse_left_m - ;jmp .end_l - ;@@: - bt eax,16 - jnc .end_l - ;mouse l. but. up - call mouse_left_u - ;jmp .end_l - .end_l: - ;bt eax,9 - ;jnc @f - ;mouse r. but. press - ;call mouse_right_d - ;jmp .end_r - ;@@: - ;bt eax,1 - ;jnc @f - ;mouse r. but. move - ;call mouse_right_m - ;jmp .end_r - ;@@: - ;.end_r: - - pop ecx ebx eax - ret - -;output: -; eax - buffer coord X (᫨ ஬ -1) -; ebx - buffer coord Y (᫨ ஬ -1) -align 4 -proc buf_get_mouse_coord - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - cmp ax,word[buf_0.t] - jl .no_buf ; y - mov ebx,eax - shr ebx,16 - cmp bx,word[buf_0.l] - jl .no_buf ; x - - and eax,0xffff ;⠢塞 न y - sub ax,word[buf_0.t] - cmp eax,[buf_0.h] - jg .no_buf - sub bx,word[buf_0.l] - cmp ebx,[buf_0.w] - jg .no_buf - xchg eax,ebx - jmp .end_f - .no_buf: - xor eax,eax - not eax - xor ebx,ebx - not ebx - .end_f: - ret -endp - -;output: -; eax - buffer coord X (᫨ ஬ -1) -; ebx - buffer coord Y (᫨ ஬ -1) -align 4 -proc nav_wnd_get_mouse_coord - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - cmp ax,NAV_WND_T - jl .no_buf ; y - cmp eax,NAV_WND_L shl 16 - jl .no_buf ; x - mov ebx,eax - shr ebx,16 - - and eax,0xffff ;⠢塞 न y - sub ax,NAV_WND_T - cmp eax,[nav_wnd_h] - jg .no_buf - sub bx,NAV_WND_L - cmp ebx,[nav_wnd_w] - jg .no_buf - xchg eax,ebx - jmp .end_f - .no_buf: - xor eax,eax - not eax - xor ebx,ebx - not ebx - .end_f: - ret -endp - -align 4 -mouse_left_d: -pushad - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - mov [mouse_down_x],eax - mov [mouse_down_y],ebx - sub eax,[nav_x] - sub ebx,[nav_y] - - mov edi,sel_pt - xor ecx,ecx - .cycle0: - mov edx,[edi+point2d.x] - sub edx,eax - bt edx,31 - jnc @f - neg edx - @@: - cmp edx,5 ;ࠧ 뤥 窨 x - jg .end1 - mov edx,[edi+point2d.y] - sub edx,ebx - bt edx,31 - jnc @f - neg edx - @@: - cmp edx,5 ;ࠧ 뤥 窨 y - jg .end1 - mov [sel_act],ecx - jmp .end0 - .end1: - add edi,sizeof.point2d - inc ecx - cmp ecx,4 - jl .cycle0 - mov dword[sel_act],-1 - jmp .end2 - .end0: - call nav_wnd_get_mouse_coord - cmp eax,-1 - je .end2 - mov ecx,[nav_wnd_zoom] - shl eax,cl - shl ebx,cl - stdcall nav_to_point, eax,ebx - mov byte[calc],1 - .end2: -popad - ret - -align 4 -proc mouse_left_u uses eax ebx - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - sub [mouse_down_x],eax - sub [mouse_down_y],ebx - - cmp dword[sel_act],-1 - je .end1 - ; 窨 - mov eax,[sel_act] - imul eax,sizeof.point2d - add eax,sel_pt - ;coord x - mov ebx,dword[eax+point2d.x] - sub ebx,[mouse_down_x] - cmp ebx,0 - jge @f - xor ebx,ebx - @@: - cmp ebx,[buf_i0.w] - jle @f - mov ebx,[buf_i0.w] - @@: - mov dword[eax+point2d.x],ebx - ;coord y - mov ebx,dword[eax+point2d.y] - sub ebx,[mouse_down_y] - cmp ebx,0 - jge @f - xor ebx,ebx - @@: - cmp ebx,[buf_i0.h] - jle @f - mov ebx,[buf_i0.h] - @@: - mov dword[eax+point2d.y],ebx - call points_update_prop - jmp .end2 - .end1: - - ; ࠦ - mov eax,[nav_y] - sub eax,[mouse_down_y] - call nav_y_corect - mov [nav_y],eax - - mov eax,[nav_x] - sub eax,[mouse_down_x] - call nav_x_corect - mov [nav_x],eax - .end2: - mov byte[calc],1 - .end0: - ret -endp - -align 4 -set_user_line_h: -pushad - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - mov [mouse_down_y],ebx - sub ebx,[nav_y] - cmp eax,[buf_i0.h] - jle @f - mov eax,[buf_i0.h] - @@: - cmp [u_line_h],ebx - jne @f - xor ebx,ebx ;line on/off - @@: - mov [u_line_h],ebx - .end0: -popad - ret - -align 4 -set_user_line_w: -pushad - call buf_get_mouse_coord - cmp eax,-1 - je .end0 - mov [mouse_down_x],eax - sub eax,[nav_x] - cmp eax,[buf_i0.w] - jle @f - mov eax,[buf_i0.w] - @@: - cmp [u_line_v],eax - jne @f - xor eax,eax ;line on/off - @@: - mov [u_line_v],eax - .end0: -popad - ret - -align 4 -proc but_new_file uses eax edi esi - xor eax,eax - mov [open_file_size],eax - mov edi,[open_file_img] - stosd - ret -endp - -align 4 -open_file_img dd 0 ;㪠⥫ ⥪ -open_file_size dd 0 ;ࠧ - -;᫥ ࠬ஢ 樨 ࠦ -align 4 -proc calc_nav_params uses eax ecx edi - mov dword[nav_x_max],0 - mov edi,buf_0 - mov eax,buf2d_w - mov [nav_sx],eax - mov edi,buf_i0 - sub eax,buf2d_w - bt eax,31 - jc @f - mov [nav_x_max],eax - xor eax,eax - @@: - mov [nav_x_min],eax - mov edi,buf2d_w - cmp [nav_sx],edi - jle @f - mov [nav_sx],edi - @@: - shr dword[nav_sx],1 - - mov dword[nav_y_max],0 - mov edi,buf_0 - mov eax,buf2d_h - mov [nav_sy],eax - mov edi,buf_i0 - sub eax,buf2d_h - bt eax,31 - jc @f - mov [nav_y_max],eax - xor eax,eax - @@: - mov [nav_y_min],eax - mov edi,buf2d_h - cmp [nav_sy],edi - jle @f - mov [nav_sy],edi - @@: - shr dword[nav_sy],1 - - xor ecx,ecx - mov [u_line_v],ecx - mov eax,[buf_i0.w] - @@: - inc ecx - shr eax,1 - cmp eax,100 - jg @b - mov [nav_wnd_zoom],ecx - xor ecx,ecx - mov [u_line_h],ecx - mov eax,[buf_i0.h] - @@: - inc ecx - shr eax,1 - cmp eax,32 - jg @b - cmp [nav_wnd_zoom],ecx - jg @f - mov [nav_wnd_zoom],ecx - @@: - mov ecx,[nav_wnd_zoom] - mov eax,[buf_i0.w] - shr eax,cl - mov [nav_wnd_w],eax - mov eax,[buf_i0.h] - shr eax,cl - mov [nav_wnd_h],eax - ret -endp - -align 4 -proc but_open_file - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - jmp .end0 -.no_dlg: ;᫨ 㥬 䠩 - pushad - mov esi,openfile_path - stdcall str_len,esi - add esi,eax - @@: ;横 ᪠ 砫 䠩 - dec esi - cmp byte[esi],'/' - je @f - cmp byte[esi],0x5c ;'\' - je @f - cmp esi,openfile_path - jg @b - @@: - inc esi - stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ - .end0: - - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - mov [open_file_size],ecx - stdcall mem.ReAlloc,[open_file_img],ecx ;뤥塞 ࠦ - mov [open_file_img],eax - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - m2m [run_file_70.Count], dword[open_file_size] - m2m [run_file_70.Buffer],dword[open_file_img] - mov byte[run_file_70+20], 0 - mov [run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_0 - ;।塞 ࠦ - stdcall [img_decode], [open_file_img],ebx,0 - or eax,eax - jz .end_0 ;᫨ 襭 ଠ 䠩 - mov ebx,eax - - mov ecx,[ebx+4] ;+4 = image width - mov dword[buf_cop.w],ecx - imul ecx,[ebx+8] ;+8 = image height - lea ecx,[ecx+ecx*2] - mov [open_file_size],ecx - stdcall mem.ReAlloc,[open_file_img],ecx - mov [open_file_img],eax - mov dword[buf_cop],eax - mov dword[buf_cop.l],0 ;left = 0, top = 0 - m2m dword[buf_cop.h],dword[ebx+8] - - ;८ࠧ㥬 ࠦ ଠ rgb - stdcall [img_to_rgb2], ebx,[open_file_img] - mov edi,buf_i0 - cmp buf2d_data,0 - jne .end3 - stdcall getNextPowerOfTwo,[ebx+8] - mov buf2d_h,eax - mov edx,eax - stdcall getNextPowerOfTwo,[ebx+4] - mov buf2d_w,eax - cmp edx,[ebx+8] - jne @f - cmp eax,[ebx+4] - jne @f - ;ᮧ ࠦ 室 ࠧࠬ - stdcall [buf2d_create_f_img], edi,[open_file_img] - jmp .end_1 - @@: - ;ᮧ ࠦ ८ࠧ ࠧࠬ - cmp eax,[ebx+4] - jge @f - mov eax,[ebx+4] - mov buf2d_w,eax - @@: - sub eax,[ebx+4] - shr eax,1 - mov esi,eax - cmp edx,[ebx+8] - jge @f - mov edx,[ebx+8] - mov buf2d_h,edx - @@: - sub edx,[ebx+8] - shr edx,1 - stdcall [buf2d_create], edi - mov [buf_cop.l],si - mov [buf_cop.t],dx - stdcall [buf2d_bit_blt], edi, esi,edx, buf_cop - jmp .end_1 - .end3: - ;८ࠧ ᮧ ࠦ - stdcall getNextPowerOfTwo,[ebx+4] - cmp eax,[ebx+4] - jg @f - mov eax,[ebx+4] - @@: - mov ecx,eax ;ࠧ x - stdcall getNextPowerOfTwo,[ebx+8] - cmp eax,[ebx+8] - jg @f - mov eax,[ebx+8] - @@: - mov edx,eax ;ࠧ y - stdcall [buf2d_resize], edi, ecx,edx,1 ;塞 ࠧ - stdcall [buf2d_clear], edi, buf2d_color - sub ecx,[ebx+4] - shr ecx,1 - mov [buf_cop.l],cx - sub edx,[ebx+8] - shr edx,1 - mov [buf_cop.t],dx - stdcall [buf2d_bit_blt], edi, ecx,edx, buf_cop - .end_1: - - ;ᮧ ८ࠧ ࠦ - mov edi,buf_ogl - mov eax,[buf_i0.w] - mov buf2d_w,eax - mov eax,[buf_i0.h] - mov buf2d_h,eax - cmp buf2d_data,0 - jne @f - stdcall [kosglMakeCurrent], 0,35,buf2d_w,buf2d_h,ctx1 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glShadeModel], GL_SMOOTH - stdcall [glScalef], 2.0, -2.0, 1.0 - stdcall [glTranslatef], -0.5, -0.5, 0.0 - jmp .end_2 - @@: - stdcall reshape, buf2d_w,buf2d_h ;塞 ࠧ buf_ogl - .end_2: - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov buf2d_data,eax - - stdcall [buf2d_bit_blt], edi, 0,0, buf_i0 ;㥬 ࠦ ⠭ - - ;* Setup texturing * - stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL - - ;* generate texture object IDs * - stdcall [glGenTextures], 1, TexObj - stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] - stdcall [glTexImage2D], GL_TEXTURE_2D, 0, 3, [buf_i0.w], [buf_i0.h],\ - 0, GL_RGB, GL_UNSIGNED_BYTE, [buf_i0] ; ⥪ ᭮ , ᠬ ࠦ ᯮ ࠧ஢ ⥪ - - stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST - stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST - stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT - stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT - stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] - stdcall [glEnable], GL_TEXTURE_2D - - stdcall [buf2d_bit_blt], buf_i0, 0,0, edi ;⠭ ࠦ ᯮ祭 ⠭ ⥪ - - ;㤠塞 ६ ebx - stdcall [img_destroy], ebx - - movzx eax,word[buf_cop.l] - movzx ebx,word[buf_cop.t] - stdcall points_init_2,eax,ebx - - call calc_nav_params - stdcall nav_to_point, dword[sel_pt+point2d.x],dword[sel_pt+point2d.y] - mov byte[view_b],0 - mov dword[sel_act],-1 ;᭨ 뤥 祪 - mov byte[calc],1 - .end_0: - - .end_open_file: - popad - ret -endp - -align 4 -proc nav_to_point, coord_x:dword, coord_y:dword - ;coord x - mov eax,[nav_x_max] - cmp eax,0 - jle @f - ;᫨ 쪮 ࠦ ⠢ 業 - shr eax,1 - jmp .end0 - @@: - mov eax,[buf_0.w] - shr eax,1 - sub eax,[coord_x] - call nav_x_corect - .end0: - mov [nav_x],eax - ;coord y - mov eax,[nav_y_max] - cmp eax,0 - jle @f - ;᫨ 쪮 ࠦ ⠢ 業 - shr eax,1 - jmp .end1 - @@: - mov eax,[buf_0.h] - shr eax,1 - sub eax,[coord_y] - call nav_y_corect - .end1: - mov [nav_y],eax - ret -endp - -;input: -; eax - navigation coord x -;output: -; eax - valid coord x -align 4 -nav_x_corect: - cmp eax,[nav_x_min] - jge @f - mov eax,[nav_x_min] - @@: - cmp eax,[nav_x_max] - jle @f - mov eax,[nav_x_max] - @@: - ret - -;input: -; eax - navigation coord y -;output: -; eax - valid coord y -align 4 -nav_y_corect: - cmp eax,[nav_y_min] - jge @f - mov eax,[nav_y_min] - @@: - cmp eax,[nav_y_max] - jle @f - mov eax,[nav_y_max] - @@: - ret - -align 4 -proc getNextPowerOfTwo uses ebx, n:dword - mov ebx,[n] - mov eax,8 ;min size - cmp ebx,eax - jle .set - @@: - shl eax,1 - cmp ebx,eax - jg @b - cmp eax,4096 ;max size - jle .set - mov eax,4096 - .set: - ret -endp - -; new window size or exposure -align 4 -proc reshape uses ebx ecx, width:dword, height:dword - stdcall [glViewport], 0, 0, [width], [height] - stdcall [glMatrixMode], GL_MODELVIEW - stdcall [glLoadIdentity] - stdcall [glScalef], 2.0, -2.0, 1.0 - stdcall [glTranslatef], -0.5, -0.5, 0.0 - ret -endp - -align 4 -proc but_save_file -locals - png_data dd 0 - png_size dd 0 -endl - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.png - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],1 - jne .end_save_file - ; 㤠筮 ⨨ - mov dword[png_data],0 - - ;create image struct - stdcall [img_create], [buf_ogl.w], [buf_ogl.h], Image.bpp24 - mov ebx,eax - test eax,eax - jz @f - ;copy foto to image buffer - mov edi,[eax+Image.Data] - mov esi,[buf_ogl] - mov ecx,[buf_ogl.w] - mov edx,[buf_ogl.h] - imul ecx,edx - imul ecx,3 - shr ecx,2 ;OpenGL buffer align to 4 - rep movsd - - ;encode image - stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 - test eax,eax - jz @f - mov [png_data],eax - mov [png_size],ecx - @@: - stdcall [img_destroy],ebx - - ; 塞 ࠭ 䠩 - mov ebx,run_file_70 - mov dword[ebx],SSF_CREATE_FILE - mov eax,[png_size] - mov [ebx+12],eax ;file size - mov eax,[png_data] - mov [ebx+16],eax - mov dword[ebx+FileInfoBlock.FileName], openfile_path - - mcall SF_FILE,run_file_70 - test eax,eax - jnz .save_error - ;notify_window_run openfile_path - jmp @f - .save_error: - ;ᮮ饭 㤠筮 ࠭ - notify_window_run txt_err_save_img_file - @@: - mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data] - .end_save_file: - popad - ret -endp - -align 4 -but_2: - xor byte[view_b],1 - mov byte[calc],1 - ret - -align 4 -but_3: - xor byte[trans_a],1 - call points_update_prop - mov byte[calc],1 - ret - -align 4 -but_about: - notify_window_run txt_about - ret - -align 4 -calc db 0 ;0 - 뢠 , 1 - -view_b db 0 ;0 - 室 , 1 - ᬮ १ -trans_a db 0 ;0 - ८ࠧ ࠧ, 1 - ८ࠧ - -align 4 -proc but_img_move_up uses eax - cmp dword[sel_act],-1 - je .end0 - mov eax,[sel_act] - imul eax,sizeof.point2d - add eax,sel_pt - cmp dword[eax+point2d.y],0 - je .end2 - dec dword[eax+point2d.y] - call points_update_prop - jmp .end1 - .end0: - mov eax,[nav_y] - sub eax,[nav_sy] - cmp eax,[nav_y_min] - jge @f - mov eax,[nav_y_min] - @@: - mov [nav_y],eax - .end1: - mov byte[calc],1 - .end2: - ret -endp - -align 4 -proc but_img_move_down uses eax edi - cmp dword[sel_act],-1 - je .end0 - mov eax,[sel_act] - imul eax,sizeof.point2d - add eax,sel_pt - mov edi,buf_ogl - mov edi,buf2d_h - cmp dword[eax+point2d.y],edi - jge .end2 - inc dword[eax+point2d.y] - call points_update_prop - jmp .end1 - .end0: - mov eax,[nav_y] - add eax,[nav_sy] - cmp eax,[nav_y_max] - jle @f - mov eax,[nav_y_max] - @@: - mov [nav_y],eax - .end1: - mov byte[calc],1 - .end2: - ret -endp - -align 4 -proc but_img_move_left uses eax - cmp dword[sel_act],-1 - je .end0 - mov eax,[sel_act] - imul eax,sizeof.point2d - add eax,sel_pt - cmp dword[eax+point2d.x],0 - je .end2 - dec dword[eax+point2d.x] - call points_update_prop - jmp .end1 - .end0: - mov eax,[nav_x] - sub eax,[nav_sx] - cmp eax,[nav_x_min] - jge @f - mov eax,[nav_x_min] - @@: - mov [nav_x],eax - .end1: - mov byte[calc],1 - .end2: - ret -endp - -align 4 -proc but_img_move_right uses eax edi - cmp dword[sel_act],-1 - je .end0 - mov eax,[sel_act] - imul eax,sizeof.point2d - add eax,sel_pt - mov edi,buf_ogl - mov edi,buf2d_w - cmp dword[eax+point2d.x],edi - jge .end2 - inc dword[eax+point2d.x] - call points_update_prop - jmp .end1 - .end0: - mov eax,[nav_x] - add eax,[nav_sx] - cmp eax,[nav_x_max] - jle @f - mov eax,[nav_x_max] - @@: - mov [nav_x],eax - .end1: - mov byte[calc],1 - .end2: - ret -endp - -;input: -; eax - ᫮ -; edi - ப -; len - -;output: -align 4 -proc convert_int_to_str, len:dword -pushad - mov esi,[len] - add esi,edi - dec esi - bt eax,31 - jae @f - ;᫨ ᫮ ⥫쭮 - neg eax - mov byte[edi],'-' - inc edi - @@: - call .str -popad - ret -endp - -align 4 -.str: - mov ecx,10 - cmp eax,ecx - jb @f - xor edx,edx - div ecx - push edx - ;dec edi ;ᬥ饭 室 ப - call .str - pop eax - @@: - cmp edi,esi - jge @f - or al,0x30 - stosb - mov byte[edi],0 ; ப ⠢ 0, - 뫠 - @@: - ret - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter ;.1 -.1: -db 'PNG',0 -db 'JPG',0 -db 'JPEG',0 -db 'BMP',0 -db 'GIF',0 -.end: -db 0 - -txt_space db ' ',0 - -if lang eq ru_RU - txt_err_save_img_file db ' ࠭ *.png 䠩.',0 - txt_about db '" ணࠬ',13,10,\ - ' ணࠬ ᤥ ८ࠧ ࠦ.',13,10,\ - '᫥ 䠩 ࠦ 㦭 㪠 4 窨,',13,10,\ - ' ⠭ 㣫 ८ࠧ ࠦ." -tI',0 - txt_pref db ' ',0,' ',0,' ',0,' ',0 ;⠢: , , - txt_f_size db ': ' -.size: rb 16 - txt_img_w db 'ਭ: ' -.size: rb 16 - txt_img_h db ': ' -else - txt_err_save_img_file db 'Can',39,'t save *.png file.',0 - txt_about db '"About',13,10,\ - 'This program is designed to convert images.',13,10,\ - 'After opening the image file, you need to specify 4 points',13,10,\ - 'that will become the corners of the converted image." -tI',0 - txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ;⠢: , , - txt_f_size db 'Size: ' -.size: rb 16 - txt_img_w db 'Width: ' -.size: rb 16 - txt_img_h db 'Height: ' -end if -.size: rb 16 - - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'buf2d.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'tinygl.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, library_path, system_dir_2, import_buf2d - lib_3 l_libs lib_name_3, library_path, system_dir_3, import_lib_tinygl -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw - - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start - OpenDialog_Set_file_name dd aOpenDialog_Set_file_name - OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 - aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 - -align 4 -import_buf2d: - init dd sz_init - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_resize dd sz_buf2d_resize - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_curve_bezier dd sz_buf2d_curve_bezier - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_flood_fill dd sz_buf2d_flood_fill - buf2d_set_pixel dd sz_buf2d_set_pixel - buf2d_get_pixel dd sz_buf2d_get_pixel - dd 0,0 - sz_init db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_resize db 'buf2d_resize',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_flood_fill db 'buf2d_flood_fill',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - sz_buf2d_get_pixel db 'buf2d_get_pixel',0 - -align 4 -import_lib_tinygl: - -macro E_LIB n -{ - n dd sz_#n -} -include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' - -align 4 -buf_0: dd 0 -.l: dw 5 ;+4 left -.t: dw 35 ;+6 top -.w: dd 6*64 ;+8 w -.h: dd 7*64 ;+12 h -.color: dd 0x808080 ;+16 color - db 24 ;+20 bit in pixel - -align 4 -buf_font: - dd 0 ;㪠⥫ ࠦ - dd 0 ;+4 left,top -.w: dd 0 -.h: dd 0,0,24 - -align 4 -buf_cop: ; ஢ ⥪ - dd 0 -.l: dw 0 ;+4 left -.t: dw 0 ;+6 top -.w: dd 0 -.h: dd 0,0,24 - -;室 ࠦ -align 4 -buf_i0: dd 0,0 -.w: dd 0 -.h: dd 0 -.color: dd 0,24 - -;८ࠧ ࠦ -align 4 -buf_ogl: dd 0,0 -.w: dd 0 -.h: dd 0 -.color: dd 0,24 - -align 16 -i_end: -ctx1 rb 28 ;sizeof.TinyGLContext = 28 -TexObj dd 0 ;ᨢ 㪠⥫ ⥪ ( 砥 1 .) -nav_x_min dd 0 ;. . x 樨 -nav_y_min dd 0 ;. . y 樨 -nav_x_max dd 0 ;. . x -nav_y_max dd 0 ;. . y -nav_x dd 0 ;⥪. . x 樨 -nav_y dd 0 ;⥪. . y 樨 -nav_sx dd 0 ;஫ x -nav_sy dd 0 ;஫ y -nav_wnd_w dd 0 ;ਭ 樨 -nav_wnd_h dd 0 ;ᮠ 樨 -nav_wnd_zoom dd 0 -mouse_down_x dd ? -mouse_down_y dd ? -sel_act dd ? ;窠 ࠭ ।஢ -sel_pt rb 8*sizeof.point2d ;窨 롮 4- 㣫 -last_time dd 0 -u_line_v dd 0 ;⨪쭠 -u_line_h dd 0 ;ਧ⠫쭠 -txt_buf rb 8 -procinfo process_information -sc system_colors -run_file_70 FileInfoBlock - rb 4096 -align 16 -stacktop: - sys_path rb 1024 - file_name rb 1024 ;4096 - library_path rb 1024 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' + dd 1,start,i_end,mem,stacktop,openfile_path,sys_path + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../load_img.inc' +include '../../load_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include '../../develop/libraries/TinyGL/asm_fork/zbuffer.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../develop/info3ds/info_fun_float.inc' + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load +caption db 'Image transform 08.12.20',0 ; + +BUF_STRUCT_SIZE equ 21 +buf2d_data equ dword[edi] ; ࠦ +buf2d_w equ dword[edi+8] ;ਭ +buf2d_h equ dword[edi+12] ; +buf2d_l equ word[edi+4] +buf2d_t equ word[edi+6] ; ᢥ +buf2d_size_lt equ dword[edi+4] ; ᫥ ࠢ +buf2d_color equ dword[edi+16] ;梥 䮭 +buf2d_bits equ byte[edi+20] ;⢮ 1- 窥 ࠦ + +NAV_WND_L equ 145 +NAV_WND_T equ 1 + +include 'select_points.inc' + +IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 +image_data_toolbar dd 0 + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + stdcall [buf2d_create], buf_0 ;ᮧ + + include_image_file '../../../programs/fs/kfar/trunk/font6x9.bmp', image_data_toolbar, buf_font.w,buf_font.h + stdcall [buf2d_create_f_img], buf_font,[image_data_toolbar] ;ᮧ + stdcall mem.Free,[image_data_toolbar] ;᢮ + stdcall [buf2d_conv_24_to_8], buf_font,1 ; ஧筮 8 + stdcall [buf2d_convert_text_matrix], buf_font + + include_image_file 'toolbar.png', image_data_toolbar + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;ன 祪 + call points_init + + ;open file from cmd line + cmp dword[openfile_path],0 + je @f + call but_open_file.no_dlg + @@: + +align 4 +red_win: + call draw_window + +align 16 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + cmp eax,0 + je timer_funct + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo.window_stack_position] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +timer_funct: + push eax ebx + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + pop ebx eax + cmp byte[calc],0 + je still + call draw_nav_wnd + call draw_buffers + jmp still + +align 16 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + ; *** ᮢ (믮 1 ࠧ ᪥) *** + mov edx,[sc.work] + or edx,(3 shl 24)+0x30000000 + mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,dword[procinfo.box.height] + cmp eax,120 + jge @f + mov eax,120 ;min size + @@: + sub eax,65 + mov ebx,dword[procinfo.box.width] + cmp ebx,270 + jge @f + mov ebx,270 + @@: + sub ebx,19 + cmp eax,dword[buf_0.h] ;ᬮਬ ࠧ + jne @f + cmp ebx,dword[buf_0.w] + jne @f + jmp .end0 + @@: + stdcall [buf2d_resize],buf_0,ebx,eax,1 + call calc_nav_params + mov eax,[nav_x] + call nav_x_corect + mov [nav_x],eax + mov eax,[nav_y] + call nav_y_corect + mov [nav_y],eax + mov byte[calc],1 + .end0: + + ; *** ᮧ *** + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button] + + add ebx,25 shl 16 + mcall ,,,4 + add ebx,30 shl 16 + mcall ,,,5 + add ebx,25 shl 16 + mcall ,,,6 + add ebx,25 shl 16 + mcall ,,,7 + + ; *** ᮢ *** + mov edx,(7 shl 16)+7 ;icon open + mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon save + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;icon view + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon mode + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + + call draw_nav_wnd + call draw_buffers + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +;ᮢ 樮 +align 4 +proc draw_nav_wnd + cmp dword[buf_i0],0 + je .end0 + bt dword[nav_x_min],31 + jnc .end0 + bt dword[nav_y_min],31 + jnc .end0 +pushad + mov ebx,(NAV_WND_L shl 16) + add ebx,[nav_wnd_w] + mov ecx,(NAV_WND_T shl 16) + add ecx,[nav_wnd_h] + mcall SF_DRAW_RECT,,,0 ;ࠦ + mov ecx,[nav_wnd_zoom] + mov ebx,[nav_x] + neg ebx + sar ebx,cl + add ebx,NAV_WND_L + shl ebx,16 + add ebx,[buf_0.w] + shr bx,cl + mov edx,[nav_y] + neg edx + sar edx,cl + add edx,NAV_WND_T + shl edx,16 + add edx,[buf_0.h] + shr dx,cl + mov ecx,edx + mcall ,,,0x404080 ; ࠦ + + mov edi,sel_pt + @@: + mov ecx,[nav_wnd_zoom] + mov ebx,[edi+point2d.x] + shr ebx,cl + add ebx,NAV_WND_L + mov edx,[edi+point2d.y] + shr edx,cl + add edx,NAV_WND_T + mov ecx,edx + mcall SF_PUT_PIXEL,,,0xffff00 + add edi,sizeof.point2d + cmp edi,sel_pt+4*sizeof.point2d + jl @b +popad + .end0: + ret +endp + +align 4 +proc draw_buffers +pushad + cmp byte[calc],0 + je .end0 + ; *** *** + bt dword[nav_x_min],31 + jnc .beg0 + bt dword[nav_y_min],31 + jc @f + .beg0: + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + @@: + cmp byte[view_b],1 + je .end1 + push buf_i0 + jmp .end2 + .end1: + push buf_ogl + .end2: + stdcall [buf2d_bit_blt], buf_0, [nav_x],[nav_y] ;,... + + call points_draw + xor eax,eax + cmp [u_line_v],eax + je @f + mov eax,[u_line_v] + add eax,[nav_x] + stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0xffffff + inc eax + stdcall [buf2d_line], buf_0, eax,0, eax,[buf_0.h], 0 + @@: + xor eax,eax + cmp [u_line_h],eax + je @f + mov eax,[u_line_h] + add eax,[nav_y] + stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0xffffff + inc eax + stdcall [buf2d_line], buf_0, 0,eax, [buf_0.w],eax, 0 + @@: + + ; *** ࠧ 䠩 *** + mov edi,txt_f_size.size + mov eax,[open_file_size] + mov ebx,txt_pref + .cycle: + cmp eax,1024 + jl @f + shr eax,10 + add ebx,4 + jmp .cycle + @@: + stdcall convert_int_to_str, 16 + stdcall str_cat, edi,ebx + stdcall str_cat, edi,txt_space ;騩 ஡ + ;ਭ ࠦ + mov eax,[buf_i0.w] + mov edi,txt_img_w.size + stdcall convert_int_to_str, 16 + mov eax,[buf_i0.h] + mov edi,txt_img_h.size + stdcall convert_int_to_str, 16 + mov byte[calc],0 + .end0: + ; *** ᮢ *** + stdcall [buf2d_draw], buf_0 + ; *** ᮢ ࠧ 䠩 *** + mov ecx,[sc.work_text] + or ecx,0x80000000 or (1 shl 30) + mov edi,[sc.work] ;梥 䮭 + mcall SF_DRAW_TEXT,(275 shl 16)+4,,txt_f_size + add ebx,9 + mcall ,,,txt_img_w + add ebx,9 + mcall ,,,txt_img_h +popad + ret +endp + +align 16 +key: + push eax ebx ecx + mcall SF_GET_KEY + cmp byte[view_b],1 + je .end1 + cmp ah,49 ;1 + jne @f + mov edi,sel_pt + call set_point_coords + jmp .end0 + @@: + cmp ah,50 ;2 + jne @f + mov edi,sel_pt+sizeof.point2d + call set_point_coords + jmp .end0 + @@: + cmp ah,51 ;3 + jne @f + mov edi,sel_pt+sizeof.point2d*2 + call set_point_coords + jmp .end0 + @@: + cmp ah,52 ;4 + jne @f + mov edi,sel_pt+sizeof.point2d*3 + call set_point_coords + jmp .end0 + @@: + .end1: + + cmp ah,178 ;Up + jne @f + call but_img_move_up + jmp .end0 + @@: + cmp ah,177 ;Down + jne @f + call but_img_move_down + jmp .end0 + @@: + cmp ah,176 ;Left + jne @f + call but_img_move_left + jmp .end0 + @@: + cmp ah,179 ;Right + jne @f + call but_img_move_right + jmp .end0 + @@: + cmp ah,104 ;H + jne @f + call set_user_line_h + mov byte[calc],1 + jmp .end0 + @@: + cmp ah,118 ;V + jne @f + call set_user_line_w + mov byte[calc],1 + jmp .end0 + @@: + + mov ecx,eax + mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS + bt eax,2 ;left Ctrl + jc .key_Ctrl + bt eax,3 ;right Ctrl + jc .key_Ctrl + jmp .end0 + .key_Ctrl: + cmp ch,15 ;Ctrl+O + jne @f + call but_open_file + @@: + cmp ch,19 ;Ctrl+S + jne @f + call but_save_file + @@: + + .end0: + pop ecx ebx eax + jmp still + +;input: +; edi - 㪠⥫ point2d +align 4 +set_point_coords: + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + sub eax,[nav_x] + cmp eax,0 + jge @f + xor eax,eax + @@: + cmp eax,[buf_i0.w] + jle @f + mov eax,[buf_i0.w] + @@: + mov [edi+point2d.x],eax + sub ebx,[nav_y] + cmp ebx,0 + jge @f + xor ebx,ebx + @@: + cmp ebx,[buf_i0.h] + jle @f + mov ebx,[buf_i0.h] + @@: + mov [edi+point2d.y],ebx + call points_update_prop + mov byte[calc],1 + .end0: + ret + +align 16 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_open_file + jmp still + @@: + cmp ah,4 + jne @f + call but_save_file + jmp still + @@: + cmp ah,5 + jne @f + call but_2 + jmp still + @@: + cmp ah,6 + jne @f + call but_3 + jmp still + @@: + cmp ah,7 + jne @f + call but_about + jmp still + @@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall [buf2d_delete],buf_i0 + ;stdcall [buf2d_delete],buf_ogl + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_img] + mcall SF_TERMINATE_PROCESS + +align 4 +mouse: + push eax ebx ecx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,8 + jnc @f + ;mouse l. but. press + call mouse_left_d + jmp .end_l + @@: + ;bt eax,0 + ;jnc @f + ;mouse l. but. move + ;call mouse_left_m + ;jmp .end_l + ;@@: + bt eax,16 + jnc .end_l + ;mouse l. but. up + call mouse_left_u + ;jmp .end_l + .end_l: + ;bt eax,9 + ;jnc @f + ;mouse r. but. press + ;call mouse_right_d + ;jmp .end_r + ;@@: + ;bt eax,1 + ;jnc @f + ;mouse r. but. move + ;call mouse_right_m + ;jmp .end_r + ;@@: + ;.end_r: + + pop ecx ebx eax + ret + +;output: +; eax - buffer coord X (᫨ ஬ -1) +; ebx - buffer coord Y (᫨ ஬ -1) +align 4 +proc buf_get_mouse_coord + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + cmp ax,word[buf_0.t] + jl .no_buf ; y + mov ebx,eax + shr ebx,16 + cmp bx,word[buf_0.l] + jl .no_buf ; x + + and eax,0xffff ;⠢塞 न y + sub ax,word[buf_0.t] + cmp eax,[buf_0.h] + jg .no_buf + sub bx,word[buf_0.l] + cmp ebx,[buf_0.w] + jg .no_buf + xchg eax,ebx + jmp .end_f + .no_buf: + xor eax,eax + not eax + xor ebx,ebx + not ebx + .end_f: + ret +endp + +;output: +; eax - buffer coord X (᫨ ஬ -1) +; ebx - buffer coord Y (᫨ ஬ -1) +align 4 +proc nav_wnd_get_mouse_coord + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + cmp ax,NAV_WND_T + jl .no_buf ; y + cmp eax,NAV_WND_L shl 16 + jl .no_buf ; x + mov ebx,eax + shr ebx,16 + + and eax,0xffff ;⠢塞 न y + sub ax,NAV_WND_T + cmp eax,[nav_wnd_h] + jg .no_buf + sub bx,NAV_WND_L + cmp ebx,[nav_wnd_w] + jg .no_buf + xchg eax,ebx + jmp .end_f + .no_buf: + xor eax,eax + not eax + xor ebx,ebx + not ebx + .end_f: + ret +endp + +align 4 +mouse_left_d: +pushad + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + mov [mouse_down_x],eax + mov [mouse_down_y],ebx + sub eax,[nav_x] + sub ebx,[nav_y] + + mov edi,sel_pt + xor ecx,ecx + .cycle0: + mov edx,[edi+point2d.x] + sub edx,eax + bt edx,31 + jnc @f + neg edx + @@: + cmp edx,5 ;ࠧ 뤥 窨 x + jg .end1 + mov edx,[edi+point2d.y] + sub edx,ebx + bt edx,31 + jnc @f + neg edx + @@: + cmp edx,5 ;ࠧ 뤥 窨 y + jg .end1 + mov [sel_act],ecx + jmp .end0 + .end1: + add edi,sizeof.point2d + inc ecx + cmp ecx,4 + jl .cycle0 + mov dword[sel_act],-1 + jmp .end2 + .end0: + call nav_wnd_get_mouse_coord + cmp eax,-1 + je .end2 + mov ecx,[nav_wnd_zoom] + shl eax,cl + shl ebx,cl + stdcall nav_to_point, eax,ebx + mov byte[calc],1 + .end2: +popad + ret + +align 4 +proc mouse_left_u uses eax ebx + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + sub [mouse_down_x],eax + sub [mouse_down_y],ebx + + cmp dword[sel_act],-1 + je .end1 + ; 窨 + mov eax,[sel_act] + imul eax,sizeof.point2d + add eax,sel_pt + ;coord x + mov ebx,dword[eax+point2d.x] + sub ebx,[mouse_down_x] + cmp ebx,0 + jge @f + xor ebx,ebx + @@: + cmp ebx,[buf_i0.w] + jle @f + mov ebx,[buf_i0.w] + @@: + mov dword[eax+point2d.x],ebx + ;coord y + mov ebx,dword[eax+point2d.y] + sub ebx,[mouse_down_y] + cmp ebx,0 + jge @f + xor ebx,ebx + @@: + cmp ebx,[buf_i0.h] + jle @f + mov ebx,[buf_i0.h] + @@: + mov dword[eax+point2d.y],ebx + call points_update_prop + jmp .end2 + .end1: + + ; ࠦ + mov eax,[nav_y] + sub eax,[mouse_down_y] + call nav_y_corect + mov [nav_y],eax + + mov eax,[nav_x] + sub eax,[mouse_down_x] + call nav_x_corect + mov [nav_x],eax + .end2: + mov byte[calc],1 + .end0: + ret +endp + +align 4 +set_user_line_h: +pushad + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + mov [mouse_down_y],ebx + sub ebx,[nav_y] + cmp eax,[buf_i0.h] + jle @f + mov eax,[buf_i0.h] + @@: + cmp [u_line_h],ebx + jne @f + xor ebx,ebx ;line on/off + @@: + mov [u_line_h],ebx + .end0: +popad + ret + +align 4 +set_user_line_w: +pushad + call buf_get_mouse_coord + cmp eax,-1 + je .end0 + mov [mouse_down_x],eax + sub eax,[nav_x] + cmp eax,[buf_i0.w] + jle @f + mov eax,[buf_i0.w] + @@: + cmp [u_line_v],eax + jne @f + xor eax,eax ;line on/off + @@: + mov [u_line_v],eax + .end0: +popad + ret + +align 4 +proc but_new_file uses eax edi esi + xor eax,eax + mov [open_file_size],eax + mov edi,[open_file_img] + stosd + ret +endp + +align 4 +open_file_img dd 0 ;㪠⥫ ⥪ +open_file_size dd 0 ;ࠧ + +;᫥ ࠬ஢ 樨 ࠦ +align 4 +proc calc_nav_params uses eax ecx edi + mov dword[nav_x_max],0 + mov edi,buf_0 + mov eax,buf2d_w + mov [nav_sx],eax + mov edi,buf_i0 + sub eax,buf2d_w + bt eax,31 + jc @f + mov [nav_x_max],eax + xor eax,eax + @@: + mov [nav_x_min],eax + mov edi,buf2d_w + cmp [nav_sx],edi + jle @f + mov [nav_sx],edi + @@: + shr dword[nav_sx],1 + + mov dword[nav_y_max],0 + mov edi,buf_0 + mov eax,buf2d_h + mov [nav_sy],eax + mov edi,buf_i0 + sub eax,buf2d_h + bt eax,31 + jc @f + mov [nav_y_max],eax + xor eax,eax + @@: + mov [nav_y_min],eax + mov edi,buf2d_h + cmp [nav_sy],edi + jle @f + mov [nav_sy],edi + @@: + shr dword[nav_sy],1 + + xor ecx,ecx + mov [u_line_v],ecx + mov eax,[buf_i0.w] + @@: + inc ecx + shr eax,1 + cmp eax,100 + jg @b + mov [nav_wnd_zoom],ecx + xor ecx,ecx + mov [u_line_h],ecx + mov eax,[buf_i0.h] + @@: + inc ecx + shr eax,1 + cmp eax,32 + jg @b + cmp [nav_wnd_zoom],ecx + jg @f + mov [nav_wnd_zoom],ecx + @@: + mov ecx,[nav_wnd_zoom] + mov eax,[buf_i0.w] + shr eax,cl + mov [nav_wnd_w],eax + mov eax,[buf_i0.h] + shr eax,cl + mov [nav_wnd_h],eax + ret +endp + +align 4 +proc but_open_file + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + jmp .end0 +.no_dlg: ;᫨ 㥬 䠩 + pushad + mov esi,openfile_path + stdcall str_len,esi + add esi,eax + @@: ;横 ᪠ 砫 䠩 + dec esi + cmp byte[esi],'/' + je @f + cmp byte[esi],0x5c ;'\' + je @f + cmp esi,openfile_path + jg @b + @@: + inc esi + stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;㥬 䠩 ࠭ + .end0: + + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + mov [open_file_size],ecx + stdcall mem.ReAlloc,[open_file_img],ecx ;뤥塞 ࠦ + mov [open_file_img],eax + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + m2m [run_file_70.Count], dword[open_file_size] + m2m [run_file_70.Buffer],dword[open_file_img] + mov byte[run_file_70+20], 0 + mov [run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_0 + ;।塞 ࠦ + stdcall [img_decode], [open_file_img],ebx,0 + or eax,eax + jz .end_0 ;᫨ 襭 ଠ 䠩 + mov ebx,eax + + mov ecx,[ebx+4] ;+4 = image width + mov dword[buf_cop.w],ecx + imul ecx,[ebx+8] ;+8 = image height + lea ecx,[ecx+ecx*2] + mov [open_file_size],ecx + stdcall mem.ReAlloc,[open_file_img],ecx + mov [open_file_img],eax + mov dword[buf_cop],eax + mov dword[buf_cop.l],0 ;left = 0, top = 0 + m2m dword[buf_cop.h],dword[ebx+8] + + ;८ࠧ㥬 ࠦ ଠ rgb + stdcall [img_to_rgb2], ebx,[open_file_img] + mov edi,buf_i0 + cmp buf2d_data,0 + jne .end3 + stdcall getNextPowerOfTwo,[ebx+8] + mov buf2d_h,eax + mov edx,eax + stdcall getNextPowerOfTwo,[ebx+4] + mov buf2d_w,eax + cmp edx,[ebx+8] + jne @f + cmp eax,[ebx+4] + jne @f + ;ᮧ ࠦ 室 ࠧࠬ + stdcall [buf2d_create_f_img], edi,[open_file_img] + jmp .end_1 + @@: + ;ᮧ ࠦ ८ࠧ ࠧࠬ + cmp eax,[ebx+4] + jge @f + mov eax,[ebx+4] + mov buf2d_w,eax + @@: + sub eax,[ebx+4] + shr eax,1 + mov esi,eax + cmp edx,[ebx+8] + jge @f + mov edx,[ebx+8] + mov buf2d_h,edx + @@: + sub edx,[ebx+8] + shr edx,1 + stdcall [buf2d_create], edi + mov [buf_cop.l],si + mov [buf_cop.t],dx + stdcall [buf2d_bit_blt], edi, esi,edx, buf_cop + jmp .end_1 + .end3: + ;८ࠧ ᮧ ࠦ + stdcall getNextPowerOfTwo,[ebx+4] + cmp eax,[ebx+4] + jg @f + mov eax,[ebx+4] + @@: + mov ecx,eax ;ࠧ x + stdcall getNextPowerOfTwo,[ebx+8] + cmp eax,[ebx+8] + jg @f + mov eax,[ebx+8] + @@: + mov edx,eax ;ࠧ y + stdcall [buf2d_resize], edi, ecx,edx,1 ;塞 ࠧ + stdcall [buf2d_clear], edi, buf2d_color + sub ecx,[ebx+4] + shr ecx,1 + mov [buf_cop.l],cx + sub edx,[ebx+8] + shr edx,1 + mov [buf_cop.t],dx + stdcall [buf2d_bit_blt], edi, ecx,edx, buf_cop + .end_1: + + ;ᮧ ८ࠧ ࠦ + mov edi,buf_ogl + mov eax,[buf_i0.w] + mov buf2d_w,eax + mov eax,[buf_i0.h] + mov buf2d_h,eax + cmp buf2d_data,0 + jne @f + stdcall [kosglMakeCurrent], 0,35,buf2d_w,buf2d_h,ctx1 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glShadeModel], GL_SMOOTH + stdcall [glScalef], 2.0, -2.0, 1.0 + stdcall [glTranslatef], -0.5, -0.5, 0.0 + jmp .end_2 + @@: + stdcall reshape, buf2d_w,buf2d_h ;塞 ࠧ buf_ogl + .end_2: + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov buf2d_data,eax + + stdcall [buf2d_bit_blt], edi, 0,0, buf_i0 ;㥬 ࠦ ⠭ + + ;* Setup texturing * + stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL + + ;* generate texture object IDs * + stdcall [glGenTextures], 1, TexObj + stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] + stdcall [glTexImage2D], GL_TEXTURE_2D, 0, 3, [buf_i0.w], [buf_i0.h],\ + 0, GL_RGB, GL_UNSIGNED_BYTE, [buf_i0] ; ⥪ ᭮ , ᠬ ࠦ ᯮ ࠧ஢ ⥪ + + stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST + stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST + stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT + stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT + stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] + stdcall [glEnable], GL_TEXTURE_2D + + stdcall [buf2d_bit_blt], buf_i0, 0,0, edi ;⠭ ࠦ ᯮ祭 ⠭ ⥪ + + ;㤠塞 ६ ebx + stdcall [img_destroy], ebx + + movzx eax,word[buf_cop.l] + movzx ebx,word[buf_cop.t] + stdcall points_init_2,eax,ebx + + call calc_nav_params + stdcall nav_to_point, dword[sel_pt+point2d.x],dword[sel_pt+point2d.y] + mov byte[view_b],0 + mov dword[sel_act],-1 ;᭨ 뤥 祪 + mov byte[calc],1 + .end_0: + + .end_open_file: + popad + ret +endp + +align 4 +proc nav_to_point, coord_x:dword, coord_y:dword + ;coord x + mov eax,[nav_x_max] + cmp eax,0 + jle @f + ;᫨ 쪮 ࠦ ⠢ 業 + shr eax,1 + jmp .end0 + @@: + mov eax,[buf_0.w] + shr eax,1 + sub eax,[coord_x] + call nav_x_corect + .end0: + mov [nav_x],eax + ;coord y + mov eax,[nav_y_max] + cmp eax,0 + jle @f + ;᫨ 쪮 ࠦ ⠢ 業 + shr eax,1 + jmp .end1 + @@: + mov eax,[buf_0.h] + shr eax,1 + sub eax,[coord_y] + call nav_y_corect + .end1: + mov [nav_y],eax + ret +endp + +;input: +; eax - navigation coord x +;output: +; eax - valid coord x +align 4 +nav_x_corect: + cmp eax,[nav_x_min] + jge @f + mov eax,[nav_x_min] + @@: + cmp eax,[nav_x_max] + jle @f + mov eax,[nav_x_max] + @@: + ret + +;input: +; eax - navigation coord y +;output: +; eax - valid coord y +align 4 +nav_y_corect: + cmp eax,[nav_y_min] + jge @f + mov eax,[nav_y_min] + @@: + cmp eax,[nav_y_max] + jle @f + mov eax,[nav_y_max] + @@: + ret + +align 4 +proc getNextPowerOfTwo uses ebx, n:dword + mov ebx,[n] + mov eax,8 ;min size + cmp ebx,eax + jle .set + @@: + shl eax,1 + cmp ebx,eax + jg @b + cmp eax,4096 ;max size + jle .set + mov eax,4096 + .set: + ret +endp + +; new window size or exposure +align 4 +proc reshape uses ebx ecx, width:dword, height:dword + stdcall [glViewport], 0, 0, [width], [height] + stdcall [glMatrixMode], GL_MODELVIEW + stdcall [glLoadIdentity] + stdcall [glScalef], 2.0, -2.0, 1.0 + stdcall [glTranslatef], -0.5, -0.5, 0.0 + ret +endp + +align 4 +proc but_save_file +locals + png_data dd 0 + png_size dd 0 +endl + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Set_file_ext],OpenDialog_data,Filter.1 ;.png + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],1 + jne .end_save_file + ; 㤠筮 ⨨ + mov dword[png_data],0 + + ;create image struct + stdcall [img_create], [buf_ogl.w], [buf_ogl.h], Image.bpp24 + mov ebx,eax + test eax,eax + jz @f + ;copy foto to image buffer + mov edi,[eax+Image.Data] + mov esi,[buf_ogl] + mov ecx,[buf_ogl.w] + mov edx,[buf_ogl.h] + imul ecx,edx + imul ecx,3 + shr ecx,2 ;OpenGL buffer align to 4 + rep movsd + + ;encode image + stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0 + test eax,eax + jz @f + mov [png_data],eax + mov [png_size],ecx + @@: + stdcall [img_destroy],ebx + + ; 塞 ࠭ 䠩 + mov ebx,run_file_70 + mov dword[ebx],SSF_CREATE_FILE + mov eax,[png_size] + mov [ebx+12],eax ;file size + mov eax,[png_data] + mov [ebx+16],eax + mov dword[ebx+FileInfoBlock.FileName], openfile_path + + mcall SF_FILE,run_file_70 + test eax,eax + jnz .save_error + ;notify_window_run openfile_path + jmp @f + .save_error: + ;ᮮ饭 㤠筮 ࠭ + notify_window_run txt_err_save_img_file + @@: + mcall SF_SYS_MISC, SSF_MEM_FREE, [png_data] + .end_save_file: + popad + ret +endp + +align 4 +but_2: + xor byte[view_b],1 + mov byte[calc],1 + ret + +align 4 +but_3: + xor byte[trans_a],1 + call points_update_prop + mov byte[calc],1 + ret + +align 4 +but_about: + notify_window_run txt_about + ret + +align 4 +calc db 0 ;0 - 뢠 , 1 - +view_b db 0 ;0 - 室 , 1 - ᬮ १ +trans_a db 0 ;0 - ८ࠧ ࠧ, 1 - ८ࠧ + +align 4 +proc but_img_move_up uses eax + cmp dword[sel_act],-1 + je .end0 + mov eax,[sel_act] + imul eax,sizeof.point2d + add eax,sel_pt + cmp dword[eax+point2d.y],0 + je .end2 + dec dword[eax+point2d.y] + call points_update_prop + jmp .end1 + .end0: + mov eax,[nav_y] + sub eax,[nav_sy] + cmp eax,[nav_y_min] + jge @f + mov eax,[nav_y_min] + @@: + mov [nav_y],eax + .end1: + mov byte[calc],1 + .end2: + ret +endp + +align 4 +proc but_img_move_down uses eax edi + cmp dword[sel_act],-1 + je .end0 + mov eax,[sel_act] + imul eax,sizeof.point2d + add eax,sel_pt + mov edi,buf_ogl + mov edi,buf2d_h + cmp dword[eax+point2d.y],edi + jge .end2 + inc dword[eax+point2d.y] + call points_update_prop + jmp .end1 + .end0: + mov eax,[nav_y] + add eax,[nav_sy] + cmp eax,[nav_y_max] + jle @f + mov eax,[nav_y_max] + @@: + mov [nav_y],eax + .end1: + mov byte[calc],1 + .end2: + ret +endp + +align 4 +proc but_img_move_left uses eax + cmp dword[sel_act],-1 + je .end0 + mov eax,[sel_act] + imul eax,sizeof.point2d + add eax,sel_pt + cmp dword[eax+point2d.x],0 + je .end2 + dec dword[eax+point2d.x] + call points_update_prop + jmp .end1 + .end0: + mov eax,[nav_x] + sub eax,[nav_sx] + cmp eax,[nav_x_min] + jge @f + mov eax,[nav_x_min] + @@: + mov [nav_x],eax + .end1: + mov byte[calc],1 + .end2: + ret +endp + +align 4 +proc but_img_move_right uses eax edi + cmp dword[sel_act],-1 + je .end0 + mov eax,[sel_act] + imul eax,sizeof.point2d + add eax,sel_pt + mov edi,buf_ogl + mov edi,buf2d_w + cmp dword[eax+point2d.x],edi + jge .end2 + inc dword[eax+point2d.x] + call points_update_prop + jmp .end1 + .end0: + mov eax,[nav_x] + add eax,[nav_sx] + cmp eax,[nav_x_max] + jle @f + mov eax,[nav_x_max] + @@: + mov [nav_x],eax + .end1: + mov byte[calc],1 + .end2: + ret +endp + +;input: +; eax - ᫮ +; edi - ப +; len - +;output: +align 4 +proc convert_int_to_str, len:dword +pushad + mov esi,[len] + add esi,edi + dec esi + bt eax,31 + jae @f + ;᫨ ᫮ ⥫쭮 + neg eax + mov byte[edi],'-' + inc edi + @@: + call .str +popad + ret +endp + +align 4 +.str: + mov ecx,10 + cmp eax,ecx + jb @f + xor edx,edx + div ecx + push edx + ;dec edi ;ᬥ饭 室 ப + call .str + pop eax + @@: + cmp edi,esi + jge @f + or al,0x30 + stosb + mov byte[edi],0 ; ப ⠢ 0, - 뫠 + @@: + ret + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'PNG',0 +db 'JPG',0 +db 'JPEG',0 +db 'BMP',0 +db 'GIF',0 +.end: +db 0 + +txt_space db ' ',0 + +if lang eq ru_RU + txt_err_save_img_file db ' ࠭ *.png 䠩.',0 + txt_about db '" ணࠬ',13,10,\ + ' ணࠬ ᤥ ८ࠧ ࠦ.',13,10,\ + '᫥ 䠩 ࠦ 㦭 㪠 4 窨,',13,10,\ + ' ⠭ 㣫 ८ࠧ ࠦ." -tI',0 + txt_pref db ' ',0,' ',0,' ',0,' ',0 ;⠢: , , + txt_f_size db ': ' +.size: rb 16 + txt_img_w db 'ਭ: ' +.size: rb 16 + txt_img_h db ': ' +else ; Default to en_US + txt_err_save_img_file db 'Can',39,'t save *.png file.',0 + txt_about db '"About',13,10,\ + 'This program is designed to convert images.',13,10,\ + 'After opening the image file, you need to specify 4 points',13,10,\ + 'that will become the corners of the converted image." -tI',0 + txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ; Prefixes: Kilo, Mega, Giga + txt_f_size db 'Size: ' +.size: rb 16 + txt_img_w db 'Width: ' +.size: rb 16 + txt_img_h db 'Height: ' +end if +.size: rb 16 + + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'tinygl.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, library_path, system_dir_2, import_buf2d + lib_3 l_libs lib_name_3, library_path, system_dir_3, import_lib_tinygl +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start + OpenDialog_Set_file_name dd aOpenDialog_Set_file_name + OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0 + aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_curve_bezier dd sz_buf2d_curve_bezier + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_flood_fill dd sz_buf2d_flood_fill + buf2d_set_pixel dd sz_buf2d_set_pixel + buf2d_get_pixel dd sz_buf2d_get_pixel + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_flood_fill db 'buf2d_flood_fill',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + sz_buf2d_get_pixel db 'buf2d_get_pixel',0 + +align 4 +import_lib_tinygl: + +macro E_LIB n +{ + n dd sz_#n +} +include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' + +align 4 +buf_0: dd 0 +.l: dw 5 ;+4 left +.t: dw 35 ;+6 top +.w: dd 6*64 ;+8 w +.h: dd 7*64 ;+12 h +.color: dd 0x808080 ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_font: + dd 0 ;㪠⥫ ࠦ + dd 0 ;+4 left,top +.w: dd 0 +.h: dd 0,0,24 + +align 4 +buf_cop: ; ஢ ⥪ + dd 0 +.l: dw 0 ;+4 left +.t: dw 0 ;+6 top +.w: dd 0 +.h: dd 0,0,24 + +;室 ࠦ +align 4 +buf_i0: dd 0,0 +.w: dd 0 +.h: dd 0 +.color: dd 0,24 + +;८ࠧ ࠦ +align 4 +buf_ogl: dd 0,0 +.w: dd 0 +.h: dd 0 +.color: dd 0,24 + +align 16 +i_end: +ctx1 rb 28 ;sizeof.TinyGLContext = 28 +TexObj dd 0 ;ᨢ 㪠⥫ ⥪ ( 砥 1 .) +nav_x_min dd 0 ;. . x 樨 +nav_y_min dd 0 ;. . y 樨 +nav_x_max dd 0 ;. . x +nav_y_max dd 0 ;. . y +nav_x dd 0 ;⥪. . x 樨 +nav_y dd 0 ;⥪. . y 樨 +nav_sx dd 0 ;஫ x +nav_sy dd 0 ;஫ y +nav_wnd_w dd 0 ;ਭ 樨 +nav_wnd_h dd 0 ;ᮠ 樨 +nav_wnd_zoom dd 0 +mouse_down_x dd ? +mouse_down_y dd ? +sel_act dd ? ;窠 ࠭ ।஢ +sel_pt rb 8*sizeof.point2d ;窨 롮 4- 㣫 +last_time dd 0 +u_line_v dd 0 ;⨪쭠 +u_line_h dd 0 ;ਧ⠫쭠 +txt_buf rb 8 +procinfo process_information +sc system_colors +run_file_70 FileInfoBlock + rb 4096 +align 16 +stacktop: + sys_path rb 1024 + file_name rb 1024 ;4096 + library_path rb 1024 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/media/piano/piano.asm b/programs/media/piano/piano.asm index ae6059494..cdfadbfde 100644 --- a/programs/media/piano/piano.asm +++ b/programs/media/piano/piano.asm @@ -1,913 +1,913 @@ -; ⮩ ਬ ணࠬ KolibriOS -; 稢 ⮩ -; -;--------------------------------------------------------------------- - - use32 - org 0 - - db 'MENUET01' - dd 1 - dd START - dd I_END - dd MEM - dd STACKTOP - dd 0 - dd 0 - -include "lang.inc" -include "../../macros.inc" -include "../../KOSfuncs.inc" - - -START: - -red: ; ᮢ - - call draw_window ; 뢠 楤 ᮢ - - -still: - mcall SF_WAIT_EVENT - - cmp eax,2 ; ? - je key ; ᫨ - key - cmp eax,3 ; ? - je button ; ᫨ - button - cmp eax,1 ; ᮢ ? - je red ; ᫨ - red - - jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 - - - -;--------------------------------------------------------------------- - - - key: ; - mcall SF_GET_KEY ; ᨬ ( ah) - - - cmp ah, 0x41 ; A - if Caps Lock ON - jnz @f - jmp _07 - @@: - cmp ah, 0x5a ; Z - jnz @f - jmp _08 - @@: - cmp ah, 0x53 ; S - jnz @f - jmp _09 - @@: - cmp ah, 0x58 ; X - jnz @f - jmp _0a - @@: - cmp ah, 0x44 ; D - jnz @f - jmp _0b - @@: - cmp ah, 0x43 ; C - jnz @f - jmp _0c - @@: - cmp ah, 0x56 ; V - jnz @f - _01: - mov ah, 0x01 - jmp p - @@: - cmp ah, 0x47 ; G - jnz @f - _02: - mov ah, 0x02 - jmp p - @@: - cmp ah, 0x42 ; B - jnz @f - _03: - mov ah, 0x03 - jmp p - @@: - cmp ah, 0x48 ; H - jnz @f - _04: - mov ah, 0x04 - jmp p - @@: - cmp ah, 0x4e ; N - jnz @f - _05: - mov ah, 0x05 - jmp p - @@: - cmp ah, 0x4d ; M - jnz @f - _06: - mov ah, 0x06 - jmp p - @@: - cmp ah, 0x4b ; K - jnz @f - _07: - mov ah, 0x07 - jmp p - @@: - cmp ah, 0x3c ; < - jnz @f - _08: - mov ah, 0x08 - jmp p - @@: - cmp ah, 0x4c ; L - jnz @f - _09: - mov ah, 0x09 - jmp p - @@: - cmp ah, 0x3e ; > - jnz @f - _0a: - mov ah, 0x0a - jmp p - @@: - cmp ah, 0x3a ; : - jnz @f - _0b: - mov ah, 0x0b - jmp p - @@: - cmp ah, 0x3f ; ? - jnz @f - _0c: - mov ah, 0x0c - jmp p - @@: - cmp ah, 0x22 ; " - jnz @f - jmp _11 - @@: - cmp ah, 0x21 ; key !------- - jnz @f - jmp _0c - @@: - cmp ah, 0x51 ; key Q - jnz @f - _11: - mov ah, 0x11 - jmp p - @@: - cmp ah, 0x40 ; key @ - jnz @f - _12: - mov ah, 0x12 - jmp p - @@: - cmp ah, 0x57 ; key W - jnz @f - _13: - mov ah, 0x13 - jmp p - @@: - cmp ah, 0x23 ; key # - jnz @f - _14: - mov ah, 0x14 - jmp p - @@: - cmp ah, 0x45 ; key E - jnz @f - _15: - mov ah, 0x15 - jmp p - @@: - cmp ah, 0x52 ; key R - jnz @f - _16: - mov ah, 0x16 - jmp p - @@: - cmp ah, 0x25 ; key % - jnz @f - jmp _17 - @@: - cmp ah, 0x54 ; key T - jnz @f - jmp _18 - @@: - cmp ah, 0x5e ; key ^ - jnz @f - jmp _19 - @@: - cmp ah, 0x59 ; key Y - jnz @f - jmp _1a - @@: - cmp ah, 0x26 ; key & - jnz @f - jmp _1b - @@: - cmp ah, 0x55 ; key U - jnz @f - jmp _1c - @@: - cmp ah, 0x49 ; key I - jnz @f - jmp _21 - @@: - cmp ah, 0x28 ; key ( - jnz @f - jmp _22 - @@: - cmp ah, 0x4f ; key O - jnz @f - jmp _23 - @@: - cmp ah, 0x29 ; key ) - jnz @f - jmp _24 - @@: - cmp ah, 0x50 ; key P - jnz @f - jmp _25 - @@: - cmp ah, 0x7b ; key { - jnz @f - jmp _26 - @@: - cmp ah, 0x2b ; key + - jnz @f - jmp _27 - @@: - cmp ah, 0x7d ; key } - jnz @f - jmp _28 - @@: - cmp ah, 0x7c ; key | - jnz @f - jmp _29 - @@: - cmp ah, 0x61 ; a - if Caps Lock OFF - jnz @f - _17: - mov ah, 0x17 - jmp p - @@: - cmp ah, 0x7a ; z - jnz @f - _18: - mov ah, 0x18 - jmp p - @@: - cmp ah, 0x73 ; s - jnz @f - _19: - mov ah, 0x19 - jmp p - @@: - cmp ah, 0x78 ; x - jnz @f - _1a: - mov ah, 0x1a - jmp p - @@: - cmp ah, 0x64 ; d - jnz @f - _1b: - mov ah, 0x1b - jmp p - @@: - cmp ah, 0x63 ; c - jnz @f - _1c: - mov ah, 0x1c - jmp p - @@: - cmp ah, 0x76 ; v - jnz @f - _21: - mov ah, 0x21 - jmp p - @@: - cmp ah, 0x67 ; g - jnz @f - _22: - mov ah, 0x22 - jmp p - @@: - cmp ah, 0x62 ; b - jnz @f - _23: - mov ah, 0x23 - jmp p - @@: - cmp ah, 0x68 ; h - jnz @f - _24: - mov ah, 0x24 - jmp p - @@: - cmp ah, 0x6e ; n - jnz @f - _25: - mov ah, 0x25 - jmp p - @@: - cmp ah, 0x6d ; m - jnz @f - _26: - mov ah, 0x26 - jmp p - @@: - cmp ah, 0x6b ; k - jnz @f - _27: - mov ah, 0x27 - jmp p - @@: - cmp ah, 0x2c ; , - jnz @f - _28: - mov ah, 0x28 - jmp p - @@: - cmp ah, 0x6c ; l - jnz @f - _29: - mov ah, 0x29 - jmp p - @@: - cmp ah, 0x2e ; . - jnz @f - _2a: - mov ah, 0x2a - jmp p - @@: - cmp ah, 0x3b ; ; - jnz @f - _2b: - mov ah, 0x2b - jmp p - @@: - cmp ah, 0x2f ; / - jnz @f - _2c: - mov ah, 0x2c - jmp p - @@: - cmp ah, 0x27 ; ' - jnz @f - _31: - mov ah, 0x31 - jmp p - @@: - cmp ah, 0x60 ; key ` - jnz @f - jmp _2c - @@: - cmp ah, 0x09 ; key tab - jnz @f - jmp _31 - @@: - cmp ah, 0x31 ; key 1 - jnz @f - _32: - mov ah, 0x32 - jmp p - @@: - cmp ah, 0x71 ; key q - jnz @f - _33: - mov ah, 0x33 - jmp p - @@: - cmp ah, 0x32 ; key 2 - jnz @f - _34: - mov ah, 0x34 - jmp p - @@: - cmp ah, 0x77 ; key w - jnz @f - _35: - mov ah, 0x35 - jmp p - @@: - cmp ah, 0x65 ; key e - jnz @f - _36: - mov ah, 0x36 - jmp p - @@: - cmp ah, 0x34 ; key 4 - jnz @f - _37: - mov ah, 0x37 - jmp p - @@: - cmp ah, 0x72 ; key r - jnz @f - _38: - mov ah, 0x38 - jmp p - @@: - cmp ah, 0x35 ; key 5 - jnz @f - _39: - mov ah, 0x39 - jmp p - @@: - cmp ah, 0x74 ; key t - jnz @f - _3a: - mov ah, 0x3a - jmp p - @@: - cmp ah, 0x36 ; key 6 - jnz @f - _3b: - mov ah, 0x3b - jmp p - @@: - cmp ah, 0x79 ; key y - jnz @f - _3c: - mov ah, 0x3c - jmp p - @@: - cmp ah, 0x75 ; key u - jnz @f - _41: - mov ah, 0x41 - jmp p - @@: - cmp ah, 0x38 ; key 8 - jnz @f - mov ah, 0x42 - jmp p - @@: - cmp ah, 0x69 ; key i - jnz @f - mov ah, 0x43 - jmp p - @@: - cmp ah, 0x39 ; key 9 - jnz @f - mov ah, 0x44 - jmp p - @@: - cmp ah, 0x6f ; key o - jnz @f - mov ah, 0x45 - jmp p - @@: - cmp ah, 0x70 ; key p - jnz @f - mov ah, 0x46 - jmp p - @@: - cmp ah, 0x2d ; key - - jnz @f - mov ah, 0x47 - jmp p - @@: - cmp ah, 0x5b ; key [ - jnz @f - mov ah, 0x48 - jmp p - @@: - cmp ah, 0x3d ; key = - jnz @f - mov ah, 0x49 - jmp p - @@: - cmp ah, 0x5d ; key ] - jnz @f - mov ah, 0x4a - jmp p - @@: - cmp ah, 0x5c ; key \ - jnz @f - mov ah, 0x4b - jmp p - @@: - cmp ah, 0x08 ; key backspace - jnz @f - mov ah, 0x4c - jmp p - @@: - cmp ah, 0x0d ; key enter - jnz @f - mov ah, 0x51 - jmp p - @@: - cmp ah, 0x66 ; key f - jnz @f - mov ah, 0x01 - jmp p - @@: - cmp ah, 0x6a ; key j - jnz @f - mov ah, 0x05 - jmp p - @@: - cmp ah, 0x33 ; key 3 - jnz @f - mov ah, 0x08 - jmp p - @@: - cmp ah, 0x37 ; key 7 - jnz @f - jmp _11 - @@: - cmp ah, 0x30 ; key 0 - jnz @f - jmp _15 - @@: - cmp ah, 0xb4 ; key home - jnz @f - mov ah, 0x10 - jmp p - @@: - cmp ah, 0xb5 ; key end - jnz @f - _70: - mov ah, 0xfc - jmp p - @@: - cmp ah, 0xb8 ; key Page Up - jnz @f - mov ah, 0x20 - jmp p - @@: - cmp ah, 0xb7 ; key Page Down - jnz @f - jmp _70 - @@: - cmp ah, 0xff ; key F12 - jnz @f - mov ah, 0x00 - jmp p - @@: - cmp ah, 0xb6 ; key Del - jnz @f - jmp _70 - @@: - - p: - mov [M+1], ah ; ᨬ - - ; 㭪 55-55: ⥬ ("PlayNote") - ; esi - - - mov eax,SF_SPEAKER_PLAY - mov ebx,eax - mov esi,M - int 0x40 - - ; ⪮: - ;mcall SF_SPEAKER_PLAY, , , , Music - - jmp still ; 砫 横 - - -;--------------------------------------------------------------------- - - button: - mcall SF_GET_BUTTON - - cmp ah, 0xa1 ; button 1 - jnz @f - jmp _01 - @@: - cmp ah, 0x02 ; button 2 - jnz @f - jmp _02 - @@: - cmp ah, 0x03 ; button 3 - jnz @f - jmp _03 - @@: - cmp ah, 0x04 - jnz @f - jmp _04 - @@: - cmp ah, 0x05 - jnz @f - jmp _05 - @@: - cmp ah, 0x06 - jnz @f - jmp _06 - @@: - cmp ah, 0x07 - jnz @f - jmp _07 - @@: - cmp ah, 0x08 ; button 8 - jnz @f - jmp _08 - @@: - cmp ah, 0x09 - jnz @f - jmp _09 - @@: - cmp ah, 0x0a ; button 10 - jnz @f - jmp _0a - @@: - cmp ah, 0x0b - jnz @f - jmp _0b - @@: - cmp ah, 0x0c ; button 12 - jnz @f - jmp _0c - @@: - - cmp ah, 0x11 - jnz @f - jmp _11 - @@: - cmp ah, 0x12 - jnz @f - jmp _12 - @@: - cmp ah, 0x13 - jnz @f - jmp _13 - @@: - cmp ah, 0x14 - jnz @f - jmp _14 - @@: - cmp ah, 0x15 - jnz @f - jmp _15 - @@: - cmp ah, 0x16 - jnz @f - jmp _16 - @@: - cmp ah, 0x17 - jnz @f - jmp _17 - @@: - cmp ah, 0x18 - jnz @f - jmp _18 - @@: - cmp ah, 0x19 - jnz @f - jmp _19 - @@: - cmp ah, 0x1a - jnz @f - jmp _1a - @@: - cmp ah, 0x1b - jnz @f - jmp _1b - @@: - cmp ah, 0x1c - jnz @f - jmp _1c - @@: - - cmp ah, 0x21 ; button 1 - jnz @f - jmp _21 - @@: - cmp ah, 0x22 - jnz @f - jmp _22 - @@: - cmp ah, 0x23 ; button 3 - jnz @f - jmp _23 - @@: - cmp ah, 0x24 - jnz @f - jmp _24 - @@: - cmp ah, 0x25 ; button 5 - jnz @f - jmp _25 - @@: - cmp ah, 0x26 - jnz @f - jmp _26 - @@: - cmp ah, 0x27 ; button 7 - jnz @f - jmp _27 - @@: - cmp ah, 0x28 - jnz @f - jmp _28 - @@: - cmp ah, 0x29 ; button 9 - jnz @f - jmp _29 - @@: - cmp ah, 0x2a - jnz @f - jmp _2a - @@: - cmp ah, 0x2b ; button 11 - jnz @f - jmp _2b - @@: - cmp ah, 0x2c - jnz @f - jmp _2c - @@: - cmp ah, 0x31 - jnz @f - jmp _31 - - @@: - cmp ah, 0x32 - jnz @f - jmp _32 - @@: - cmp ah, 0x33 - jnz @f - jmp _33 - @@: - cmp ah, 0x34 - jnz @f - jmp _34 - @@: - cmp ah, 0x35 - jnz @f - jmp _35 - @@: - cmp ah, 0x36 - jnz @f - jmp _36 - @@: - cmp ah, 0x37 - jnz @f - jmp _37 - @@: - cmp ah, 0x38 - jnz @f - jmp _38 - @@: - cmp ah, 0x39 - jnz @f - jmp _39 - @@: - cmp ah, 0x3a - jnz @f - jmp _3a - @@: - cmp ah, 0x3b - jnz @f - jmp _3b - @@: - cmp ah, 0x3c - jnz @f - jmp _3c - @@: - cmp ah, 0x41 - jnz @f - jmp _41 - @@: - - cmp ah, 1 ; ᫨ ஬ 1, - jne still ; - - .exit: - mcall SF_TERMINATE_PROCESS ; ணࠬ - - -;--------------------------------------------------------------------- -;--- ---------------------------------- -;--------------------------------------------------------------------- - -WHITE_W=48 ; While key width -BLACK_W=30 ; Black key width -BLACK_X=34 ; Black key X offset - -draw_window: - - mcall SF_REDRAW, SSF_BEGIN_DRAW ; ᮮ 砫 ᮢ - - mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc,sizeof.system_colors - - - mov edx, [sc.work] ; 梥 䮭 - or edx, 0x33000000 ; ⨯ 3 - mcall SF_CREATE_WINDOW, <20,WHITE_W*15+9>, <200,250>, , ,caption - - mcall SF_DEFINE_BUTTON, , <0,100>, 0x21, 0xff7a74 - mcall , , <0,100>, 0x23, 0x907040 - mcall , , , 0x25, 0xa08050 - mcall , , , 0x26, 0xb09060 - mcall , , , 0x28, 0xc0a070 - mcall , , , 0x2a, 0xd0b080 - mcall , , , 0x2c, 0xe0c090 - mcall , , , 0x31, 0xffa97c - mcall , , , 0x33, 0xaf8d8d - mcall , , , 0x35, 0xbf9d9d - mcall , , , 0x36, 0xcfadad - mcall , , , 0x38, 0xdfbdbd - mcall , , , 0x3a, 0xefcdcd - mcall , , , 0x3c, 0xffdddd - mcall , , , 0x41, 0xffe558 - - mcall , , <0,50>, 0x22, 0x221100 - mcall , , , 0x24, - mcall , , , 0x27, - mcall , , , 0x29, - mcall , , , 0x2b, - mcall , , , 0x32, - mcall , , , 0x34, - mcall , , , 0x37, - mcall , , , 0x39, - mcall , , , 0x3b, - - mcall , , <100,100>, 0xa1, 0x702050 - mcall , , , 0x03, 0x683638 - mcall , , , 0x05, 0x784648 - mcall , , , 0x06, 0x885658 - mcall , , , 0x08, 0x986668 - mcall , , , 0x0a, 0xa87678 - mcall , , , 0x0c, 0xb88688 - mcall , , , 0x11, 0x880040 - mcall , , , 0x13, 0x90622b - mcall , , , 0x15, 0xa0723b - mcall , , , 0x16, 0xb0824b - mcall , , , 0x18, 0xc0925b - mcall , , , 0x1a, 0xd0a26b - mcall , , , 0x1c, 0xe0b27b - mcall , , , 0x21, 0xff7a74 - - mcall , , <100,50>, 0x02, 0x221100 - mcall , , , 0x04, - mcall , , , 0x07, - mcall , , , 0x09, - mcall , , , 0x0b, - mcall , , , 0x12, - mcall , , , 0x14, - mcall , , , 0x17, - mcall , , , 0x19, - mcall , , , 0x1b, - - - ; 뢮 ⥪⮢ ப - mov ecx, [sc.work_text] ; 梥 䮭 - or ecx, 0x90000000 ; ⨯ ப - mcall SF_DRAW_TEXT, <50, 205>, , message - mcall , <10, 235>, , message1 - mcall , <10, 260>, , message2 - mcall , <10, 285>, , message3 - mcall , <10, 310>, , message4 - mcall , <16, 185>, , t_notes - - mcall SF_REDRAW, SSF_END_DRAW ; 稫 ᮢ - - ret - - -;--------------------------------------------------------------------- -;--- ---------------------------------------------- -;--------------------------------------------------------------------- - - -; ன M (Music) ⨥ - -M: - db 0x90, 0x30, 0 - - -sc system_colors - -if lang eq ru_RU - message db 'ࠢ: 񫪭 2 ࠧ .',0 - message1 db ' ᪮ ᪫ - ',0 - message2 db ' ஥ ( !)',0 - message3 db ' "" - V,Tab,U,Enter',0 - message4 db ' 祭 Caps Lock - V,Q,I.',0 - t_notes db ' ',0 - caption db '᪮ ',0 -else - message db 'Click twice on the window header to see help.',0 - message1 db 'Press any key in English keyboard layout - ',0 - message2 db 'so you will hear the sound from the PC-speaker (Beeper)',0 - message3 db 'Note "C" is the key V,Tab,U,Enter',0 - message4 db 'and when Caps Lock is on then the keys V,Q,I.',0 - t_notes db 'C D E F G A B C ',0 - caption db 'Toy piano',0 -end if - -;--------------------------------------------------------------------- - -I_END: - rb 4096 -align 16 -STACKTOP: -MEM: +; ⮩ ਬ ணࠬ KolibriOS +; 稢 ⮩ +; +;--------------------------------------------------------------------- + + use32 + org 0 + + db 'MENUET01' + dd 1 + dd START + dd I_END + dd MEM + dd STACKTOP + dd 0 + dd 0 + +include "lang.inc" ; Language support for locales: ru_RU (CP866), en_US. +include "../../macros.inc" +include "../../KOSfuncs.inc" + + +START: + +red: ; ᮢ + + call draw_window ; 뢠 楤 ᮢ + + +still: + mcall SF_WAIT_EVENT + + cmp eax,2 ; ? + je key ; ᫨ - key + cmp eax,3 ; ? + je button ; ᫨ - button + cmp eax,1 ; ᮢ ? + je red ; ᫨ - red + + jmp still ; ᫨ 㣮 ᮡ⨥ - 砫 横 + + + +;--------------------------------------------------------------------- + + + key: ; + mcall SF_GET_KEY ; ᨬ ( ah) + + + cmp ah, 0x41 ; A - if Caps Lock ON + jnz @f + jmp _07 + @@: + cmp ah, 0x5a ; Z + jnz @f + jmp _08 + @@: + cmp ah, 0x53 ; S + jnz @f + jmp _09 + @@: + cmp ah, 0x58 ; X + jnz @f + jmp _0a + @@: + cmp ah, 0x44 ; D + jnz @f + jmp _0b + @@: + cmp ah, 0x43 ; C + jnz @f + jmp _0c + @@: + cmp ah, 0x56 ; V + jnz @f + _01: + mov ah, 0x01 + jmp p + @@: + cmp ah, 0x47 ; G + jnz @f + _02: + mov ah, 0x02 + jmp p + @@: + cmp ah, 0x42 ; B + jnz @f + _03: + mov ah, 0x03 + jmp p + @@: + cmp ah, 0x48 ; H + jnz @f + _04: + mov ah, 0x04 + jmp p + @@: + cmp ah, 0x4e ; N + jnz @f + _05: + mov ah, 0x05 + jmp p + @@: + cmp ah, 0x4d ; M + jnz @f + _06: + mov ah, 0x06 + jmp p + @@: + cmp ah, 0x4b ; K + jnz @f + _07: + mov ah, 0x07 + jmp p + @@: + cmp ah, 0x3c ; < + jnz @f + _08: + mov ah, 0x08 + jmp p + @@: + cmp ah, 0x4c ; L + jnz @f + _09: + mov ah, 0x09 + jmp p + @@: + cmp ah, 0x3e ; > + jnz @f + _0a: + mov ah, 0x0a + jmp p + @@: + cmp ah, 0x3a ; : + jnz @f + _0b: + mov ah, 0x0b + jmp p + @@: + cmp ah, 0x3f ; ? + jnz @f + _0c: + mov ah, 0x0c + jmp p + @@: + cmp ah, 0x22 ; " + jnz @f + jmp _11 + @@: + cmp ah, 0x21 ; key !------- + jnz @f + jmp _0c + @@: + cmp ah, 0x51 ; key Q + jnz @f + _11: + mov ah, 0x11 + jmp p + @@: + cmp ah, 0x40 ; key @ + jnz @f + _12: + mov ah, 0x12 + jmp p + @@: + cmp ah, 0x57 ; key W + jnz @f + _13: + mov ah, 0x13 + jmp p + @@: + cmp ah, 0x23 ; key # + jnz @f + _14: + mov ah, 0x14 + jmp p + @@: + cmp ah, 0x45 ; key E + jnz @f + _15: + mov ah, 0x15 + jmp p + @@: + cmp ah, 0x52 ; key R + jnz @f + _16: + mov ah, 0x16 + jmp p + @@: + cmp ah, 0x25 ; key % + jnz @f + jmp _17 + @@: + cmp ah, 0x54 ; key T + jnz @f + jmp _18 + @@: + cmp ah, 0x5e ; key ^ + jnz @f + jmp _19 + @@: + cmp ah, 0x59 ; key Y + jnz @f + jmp _1a + @@: + cmp ah, 0x26 ; key & + jnz @f + jmp _1b + @@: + cmp ah, 0x55 ; key U + jnz @f + jmp _1c + @@: + cmp ah, 0x49 ; key I + jnz @f + jmp _21 + @@: + cmp ah, 0x28 ; key ( + jnz @f + jmp _22 + @@: + cmp ah, 0x4f ; key O + jnz @f + jmp _23 + @@: + cmp ah, 0x29 ; key ) + jnz @f + jmp _24 + @@: + cmp ah, 0x50 ; key P + jnz @f + jmp _25 + @@: + cmp ah, 0x7b ; key { + jnz @f + jmp _26 + @@: + cmp ah, 0x2b ; key + + jnz @f + jmp _27 + @@: + cmp ah, 0x7d ; key } + jnz @f + jmp _28 + @@: + cmp ah, 0x7c ; key | + jnz @f + jmp _29 + @@: + cmp ah, 0x61 ; a - if Caps Lock OFF + jnz @f + _17: + mov ah, 0x17 + jmp p + @@: + cmp ah, 0x7a ; z + jnz @f + _18: + mov ah, 0x18 + jmp p + @@: + cmp ah, 0x73 ; s + jnz @f + _19: + mov ah, 0x19 + jmp p + @@: + cmp ah, 0x78 ; x + jnz @f + _1a: + mov ah, 0x1a + jmp p + @@: + cmp ah, 0x64 ; d + jnz @f + _1b: + mov ah, 0x1b + jmp p + @@: + cmp ah, 0x63 ; c + jnz @f + _1c: + mov ah, 0x1c + jmp p + @@: + cmp ah, 0x76 ; v + jnz @f + _21: + mov ah, 0x21 + jmp p + @@: + cmp ah, 0x67 ; g + jnz @f + _22: + mov ah, 0x22 + jmp p + @@: + cmp ah, 0x62 ; b + jnz @f + _23: + mov ah, 0x23 + jmp p + @@: + cmp ah, 0x68 ; h + jnz @f + _24: + mov ah, 0x24 + jmp p + @@: + cmp ah, 0x6e ; n + jnz @f + _25: + mov ah, 0x25 + jmp p + @@: + cmp ah, 0x6d ; m + jnz @f + _26: + mov ah, 0x26 + jmp p + @@: + cmp ah, 0x6b ; k + jnz @f + _27: + mov ah, 0x27 + jmp p + @@: + cmp ah, 0x2c ; , + jnz @f + _28: + mov ah, 0x28 + jmp p + @@: + cmp ah, 0x6c ; l + jnz @f + _29: + mov ah, 0x29 + jmp p + @@: + cmp ah, 0x2e ; . + jnz @f + _2a: + mov ah, 0x2a + jmp p + @@: + cmp ah, 0x3b ; ; + jnz @f + _2b: + mov ah, 0x2b + jmp p + @@: + cmp ah, 0x2f ; / + jnz @f + _2c: + mov ah, 0x2c + jmp p + @@: + cmp ah, 0x27 ; ' + jnz @f + _31: + mov ah, 0x31 + jmp p + @@: + cmp ah, 0x60 ; key ` + jnz @f + jmp _2c + @@: + cmp ah, 0x09 ; key tab + jnz @f + jmp _31 + @@: + cmp ah, 0x31 ; key 1 + jnz @f + _32: + mov ah, 0x32 + jmp p + @@: + cmp ah, 0x71 ; key q + jnz @f + _33: + mov ah, 0x33 + jmp p + @@: + cmp ah, 0x32 ; key 2 + jnz @f + _34: + mov ah, 0x34 + jmp p + @@: + cmp ah, 0x77 ; key w + jnz @f + _35: + mov ah, 0x35 + jmp p + @@: + cmp ah, 0x65 ; key e + jnz @f + _36: + mov ah, 0x36 + jmp p + @@: + cmp ah, 0x34 ; key 4 + jnz @f + _37: + mov ah, 0x37 + jmp p + @@: + cmp ah, 0x72 ; key r + jnz @f + _38: + mov ah, 0x38 + jmp p + @@: + cmp ah, 0x35 ; key 5 + jnz @f + _39: + mov ah, 0x39 + jmp p + @@: + cmp ah, 0x74 ; key t + jnz @f + _3a: + mov ah, 0x3a + jmp p + @@: + cmp ah, 0x36 ; key 6 + jnz @f + _3b: + mov ah, 0x3b + jmp p + @@: + cmp ah, 0x79 ; key y + jnz @f + _3c: + mov ah, 0x3c + jmp p + @@: + cmp ah, 0x75 ; key u + jnz @f + _41: + mov ah, 0x41 + jmp p + @@: + cmp ah, 0x38 ; key 8 + jnz @f + mov ah, 0x42 + jmp p + @@: + cmp ah, 0x69 ; key i + jnz @f + mov ah, 0x43 + jmp p + @@: + cmp ah, 0x39 ; key 9 + jnz @f + mov ah, 0x44 + jmp p + @@: + cmp ah, 0x6f ; key o + jnz @f + mov ah, 0x45 + jmp p + @@: + cmp ah, 0x70 ; key p + jnz @f + mov ah, 0x46 + jmp p + @@: + cmp ah, 0x2d ; key - + jnz @f + mov ah, 0x47 + jmp p + @@: + cmp ah, 0x5b ; key [ + jnz @f + mov ah, 0x48 + jmp p + @@: + cmp ah, 0x3d ; key = + jnz @f + mov ah, 0x49 + jmp p + @@: + cmp ah, 0x5d ; key ] + jnz @f + mov ah, 0x4a + jmp p + @@: + cmp ah, 0x5c ; key \ + jnz @f + mov ah, 0x4b + jmp p + @@: + cmp ah, 0x08 ; key backspace + jnz @f + mov ah, 0x4c + jmp p + @@: + cmp ah, 0x0d ; key enter + jnz @f + mov ah, 0x51 + jmp p + @@: + cmp ah, 0x66 ; key f + jnz @f + mov ah, 0x01 + jmp p + @@: + cmp ah, 0x6a ; key j + jnz @f + mov ah, 0x05 + jmp p + @@: + cmp ah, 0x33 ; key 3 + jnz @f + mov ah, 0x08 + jmp p + @@: + cmp ah, 0x37 ; key 7 + jnz @f + jmp _11 + @@: + cmp ah, 0x30 ; key 0 + jnz @f + jmp _15 + @@: + cmp ah, 0xb4 ; key home + jnz @f + mov ah, 0x10 + jmp p + @@: + cmp ah, 0xb5 ; key end + jnz @f + _70: + mov ah, 0xfc + jmp p + @@: + cmp ah, 0xb8 ; key Page Up + jnz @f + mov ah, 0x20 + jmp p + @@: + cmp ah, 0xb7 ; key Page Down + jnz @f + jmp _70 + @@: + cmp ah, 0xff ; key F12 + jnz @f + mov ah, 0x00 + jmp p + @@: + cmp ah, 0xb6 ; key Del + jnz @f + jmp _70 + @@: + + p: + mov [M+1], ah ; ᨬ + + ; 㭪 55-55: ⥬ ("PlayNote") + ; esi - + + mov eax,SF_SPEAKER_PLAY + mov ebx,eax + mov esi,M + int 0x40 + + ; ⪮: + ;mcall SF_SPEAKER_PLAY, , , , Music + + jmp still ; 砫 横 + + +;--------------------------------------------------------------------- + + button: + mcall SF_GET_BUTTON + + cmp ah, 0xa1 ; button 1 + jnz @f + jmp _01 + @@: + cmp ah, 0x02 ; button 2 + jnz @f + jmp _02 + @@: + cmp ah, 0x03 ; button 3 + jnz @f + jmp _03 + @@: + cmp ah, 0x04 + jnz @f + jmp _04 + @@: + cmp ah, 0x05 + jnz @f + jmp _05 + @@: + cmp ah, 0x06 + jnz @f + jmp _06 + @@: + cmp ah, 0x07 + jnz @f + jmp _07 + @@: + cmp ah, 0x08 ; button 8 + jnz @f + jmp _08 + @@: + cmp ah, 0x09 + jnz @f + jmp _09 + @@: + cmp ah, 0x0a ; button 10 + jnz @f + jmp _0a + @@: + cmp ah, 0x0b + jnz @f + jmp _0b + @@: + cmp ah, 0x0c ; button 12 + jnz @f + jmp _0c + @@: + + cmp ah, 0x11 + jnz @f + jmp _11 + @@: + cmp ah, 0x12 + jnz @f + jmp _12 + @@: + cmp ah, 0x13 + jnz @f + jmp _13 + @@: + cmp ah, 0x14 + jnz @f + jmp _14 + @@: + cmp ah, 0x15 + jnz @f + jmp _15 + @@: + cmp ah, 0x16 + jnz @f + jmp _16 + @@: + cmp ah, 0x17 + jnz @f + jmp _17 + @@: + cmp ah, 0x18 + jnz @f + jmp _18 + @@: + cmp ah, 0x19 + jnz @f + jmp _19 + @@: + cmp ah, 0x1a + jnz @f + jmp _1a + @@: + cmp ah, 0x1b + jnz @f + jmp _1b + @@: + cmp ah, 0x1c + jnz @f + jmp _1c + @@: + + cmp ah, 0x21 ; button 1 + jnz @f + jmp _21 + @@: + cmp ah, 0x22 + jnz @f + jmp _22 + @@: + cmp ah, 0x23 ; button 3 + jnz @f + jmp _23 + @@: + cmp ah, 0x24 + jnz @f + jmp _24 + @@: + cmp ah, 0x25 ; button 5 + jnz @f + jmp _25 + @@: + cmp ah, 0x26 + jnz @f + jmp _26 + @@: + cmp ah, 0x27 ; button 7 + jnz @f + jmp _27 + @@: + cmp ah, 0x28 + jnz @f + jmp _28 + @@: + cmp ah, 0x29 ; button 9 + jnz @f + jmp _29 + @@: + cmp ah, 0x2a + jnz @f + jmp _2a + @@: + cmp ah, 0x2b ; button 11 + jnz @f + jmp _2b + @@: + cmp ah, 0x2c + jnz @f + jmp _2c + @@: + cmp ah, 0x31 + jnz @f + jmp _31 + + @@: + cmp ah, 0x32 + jnz @f + jmp _32 + @@: + cmp ah, 0x33 + jnz @f + jmp _33 + @@: + cmp ah, 0x34 + jnz @f + jmp _34 + @@: + cmp ah, 0x35 + jnz @f + jmp _35 + @@: + cmp ah, 0x36 + jnz @f + jmp _36 + @@: + cmp ah, 0x37 + jnz @f + jmp _37 + @@: + cmp ah, 0x38 + jnz @f + jmp _38 + @@: + cmp ah, 0x39 + jnz @f + jmp _39 + @@: + cmp ah, 0x3a + jnz @f + jmp _3a + @@: + cmp ah, 0x3b + jnz @f + jmp _3b + @@: + cmp ah, 0x3c + jnz @f + jmp _3c + @@: + cmp ah, 0x41 + jnz @f + jmp _41 + @@: + + cmp ah, 1 ; ᫨ ஬ 1, + jne still ; + + .exit: + mcall SF_TERMINATE_PROCESS ; ணࠬ + + +;--------------------------------------------------------------------- +;--- ---------------------------------- +;--------------------------------------------------------------------- + +WHITE_W=48 ; While key width +BLACK_W=30 ; Black key width +BLACK_X=34 ; Black key X offset + +draw_window: + + mcall SF_REDRAW, SSF_BEGIN_DRAW ; ᮮ 砫 ᮢ + + mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc,sizeof.system_colors + + + mov edx, [sc.work] ; 梥 䮭 + or edx, 0x33000000 ; ⨯ 3 + mcall SF_CREATE_WINDOW, <20,WHITE_W*15+9>, <200,250>, , ,caption + + mcall SF_DEFINE_BUTTON, , <0,100>, 0x21, 0xff7a74 + mcall , , <0,100>, 0x23, 0x907040 + mcall , , , 0x25, 0xa08050 + mcall , , , 0x26, 0xb09060 + mcall , , , 0x28, 0xc0a070 + mcall , , , 0x2a, 0xd0b080 + mcall , , , 0x2c, 0xe0c090 + mcall , , , 0x31, 0xffa97c + mcall , , , 0x33, 0xaf8d8d + mcall , , , 0x35, 0xbf9d9d + mcall , , , 0x36, 0xcfadad + mcall , , , 0x38, 0xdfbdbd + mcall , , , 0x3a, 0xefcdcd + mcall , , , 0x3c, 0xffdddd + mcall , , , 0x41, 0xffe558 + + mcall , , <0,50>, 0x22, 0x221100 + mcall , , , 0x24, + mcall , , , 0x27, + mcall , , , 0x29, + mcall , , , 0x2b, + mcall , , , 0x32, + mcall , , , 0x34, + mcall , , , 0x37, + mcall , , , 0x39, + mcall , , , 0x3b, + + mcall , , <100,100>, 0xa1, 0x702050 + mcall , , , 0x03, 0x683638 + mcall , , , 0x05, 0x784648 + mcall , , , 0x06, 0x885658 + mcall , , , 0x08, 0x986668 + mcall , , , 0x0a, 0xa87678 + mcall , , , 0x0c, 0xb88688 + mcall , , , 0x11, 0x880040 + mcall , , , 0x13, 0x90622b + mcall , , , 0x15, 0xa0723b + mcall , , , 0x16, 0xb0824b + mcall , , , 0x18, 0xc0925b + mcall , , , 0x1a, 0xd0a26b + mcall , , , 0x1c, 0xe0b27b + mcall , , , 0x21, 0xff7a74 + + mcall , , <100,50>, 0x02, 0x221100 + mcall , , , 0x04, + mcall , , , 0x07, + mcall , , , 0x09, + mcall , , , 0x0b, + mcall , , , 0x12, + mcall , , , 0x14, + mcall , , , 0x17, + mcall , , , 0x19, + mcall , , , 0x1b, + + + ; 뢮 ⥪⮢ ப + mov ecx, [sc.work_text] ; 梥 䮭 + or ecx, 0x90000000 ; ⨯ ப + mcall SF_DRAW_TEXT, <50, 205>, , message + mcall , <10, 235>, , message1 + mcall , <10, 260>, , message2 + mcall , <10, 285>, , message3 + mcall , <10, 310>, , message4 + mcall , <16, 185>, , t_notes + + mcall SF_REDRAW, SSF_END_DRAW ; 稫 ᮢ + + ret + + +;--------------------------------------------------------------------- +;--- ---------------------------------------------- +;--------------------------------------------------------------------- + + +; ன M (Music) ⨥ + +M: + db 0x90, 0x30, 0 + + +sc system_colors + +if lang eq ru_RU + message db 'ࠢ: 񫪭 2 ࠧ .',0 + message1 db ' ᪮ ᪫ - ',0 + message2 db ' ஥ ( !)',0 + message3 db ' "" - V,Tab,U,Enter',0 + message4 db ' 祭 Caps Lock - V,Q,I.',0 + t_notes db ' ',0 + caption db '᪮ ',0 +else ; Default to en_US + message db 'Click twice on the window header to see help.',0 + message1 db 'Press any key in English keyboard layout - ',0 + message2 db 'so you will hear the sound from the PC-speaker (Beeper)',0 + message3 db 'Note "C" is the key V,Tab,U,Enter',0 + message4 db 'and when Caps Lock is on then the keys V,Q,I.',0 + t_notes db 'C D E F G A B C ',0 + caption db 'Toy piano',0 +end if + +;--------------------------------------------------------------------- + +I_END: + rb 4096 +align 16 +STACKTOP: +MEM: diff --git a/programs/media/scrshoot/scrshoot.asm b/programs/media/scrshoot/scrshoot.asm index 6630196c9..4e3771172 100644 --- a/programs/media/scrshoot/scrshoot.asm +++ b/programs/media/scrshoot/scrshoot.asm @@ -1,889 +1,892 @@ -; -; Screenshooter for Kolibri -; -;--------------------------------------------------------------------- -; ணࠬ 客 ᨬ (Maxxxx32) -; -; 26.11.16 - IgorA ᭨ ࠭ ଠ *.png -; 02.11.10 - ᯮ checkbox ᨨ 2 -; -; version: 1.2 -; last update: 08/09/2010 -; written by: Marat Zakiyanov aka Mario79, aka Mario -; changes: select path for save with OpenDialog, -; bag fix for threads stacks -; 01.06.09 - ⥬ ⥪ -; 24.07.08 - editbox -; 01.02.07 - editbox -; 31.01.07 - ⥯ ⭮⥫쭮 ᪮ - - -format binary as "" - -title equ 'Screenshooter v1.21' ; -include '../../load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../config.inc' ;for nightbuild -include '../../proc32.inc' -include '../../macros.inc' -include '../../KOSfuncs.inc' -include '../../develop/libraries/libs-dev/libimg/libimg.inc' -include 'txtbut.inc' -include 'label.inc' -include 'textwork.inc' -include 'scrshoot.mac' - -use32 - org 0 - db 'MENUET01' - dd 1, start, IM_END, i_end, stacktop, cmdstr, cur_dir_path - -include 'lang.inc' -include '../../dll.inc' - -align 4 - @use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - use_txt_button ; | - use_label ; |-- GUI 楤 - use_text_work ; / - -include 'scrwin.inc' ; ⠢塞 यᬮ -include 'scrsavef.inc'; ⠢塞 楤 ࠭ 䠩 -include 'gp.inc' -include 'srectwin.inc' - -macro get_sys_colors col_buf -{ - mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, col_buf, 40 -} - -;--- 砫 ணࠬ --- -align 4 -start: - -load_libraries l_libs_start,end_l_libs - -;if return code =-1 then exit, else nornary work -; cmp eax,-1 - inc eax - test eax,eax - jz close -;;;;;;;;;;;;;;;; init memory 68/11 - mcall SF_SYS_MISC, SSF_HEAP_INIT - test eax,eax - jz close - -;--------------------------------------------------------------------- - mov edi,filename_area - mov esi,start_temp_file_name - xor eax,eax - cld -@@: - lodsb - stosb - test eax,eax - jnz @b - - - mov edi,fname_buf - mov esi,ed_buffer.1 - xor eax,eax - cld -@@: - lodsb - stosb - test eax,eax - jnz @b - -;OpenDialog initialisation - stdcall [OpenDialog_Init], OpenDialog_data - -; prepare for PathShow - stdcall [PathShow_prepare], PathShow_data_1 -;--------------------------------------------------------------------- - ;mov al,[gs:1280*4*1024] - ; ⠭ ipc - xor ebx,ebx - inc ebx - mcall SF_IPC,, app_ipc, 32 - - ; ⠭ - mov cl,55 ; 55 - PrintScrn - xor edx,edx - mcall SF_KEYBOARD, SSF_SET_SYS_HOTKEY - - mov ebx,app - call get_slot_n - mov [slot_n],ecx - - ; ⠭ ᮡ⨩ - set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc) -;樠 checkboxes - init_checkboxes2 check_boxes,check_boxes_end - -;  룠 ᮢ -red: - get_procinfo app ; 砥 ଠ - get_sys_colors sc ; 砥 ⥬ 梥 - - ; ⠭ ⥬ 梥 GUI ⮢ - txt_but_set_sys_color buttons,buttons_end,sc ; \ - labels_set_sys_color labels,labels_end,sc ; | - check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc; | - edit_boxes_set_sys_color editboxes,editboxes_end,sc ; / - - get_screen_prop scr ; 砥 ଠ ࠭ -;------------------------------------------------------------------------------ -; Boot with "DIRECT" parameter - get screen and save - mov eax,cmdstr - cmp [eax],byte 0 - je no_boot - - cmp [eax],dword 'DIRE' - jne no_boot - - cmp [eax+4],word 'CT' - jne no_boot - - and [ch2.flags],dword 0 - or [ch5.flags],dword 1 - mov [OpenDialog_data.draw_window],dword draw_window_direct - - call shoot - jmp close -;------------------------------------------------------------------------------ -draw_window_direct: - mcall SF_REDRAW, SSF_BEGIN_DRAW - mcall SF_GET_SCREEN_SIZE -; eax = [xsize]*65536 + [ysize] - mov ebx,eax - shr ebx,17 - sub ebx,100 - shl ebx,16 - mov bx,200 - mov ecx,eax - and ecx,0xffff - shr ecx,1 - sub ecx,50 - shl ecx,16 - mov cx,100 - xor esi,esi - mcall SF_CREATE_WINDOW,,,0x34ffffff,,grab_text - - mcall SF_DRAW_TEXT, <10,30>,0x90000000,saving - - mcall SF_REDRAW, SSF_END_DRAW - ret -;------------------------------------------------------------------------------ -no_boot: - call draw_window ; ᮢ뢠 -still: - wait_event red,key,button,mouse,ipc,still ; ᮡ⨩ - -key: - get_key - cmp al,2 - jne @f - cmp ah,55 - jne still - mov [PrintScreen],1 - call shoot - mov [PrintScreen],0 - jmp still -@@: -; stdcall [edit_box_key], edit1 - stdcall [edit_box_key], edit2 - stdcall [edit_box_key], edit3 - - jmp still -button: - get_pressed_button - cmp ah,1 - je p_close - txt_but_ev buttons,buttons_end - jmp still -mouse: - get_active_window - cmp eax,[slot_n] - jne still -;---------------------------------- -; stdcall [edit_box_mouse], edit1 - stdcall [edit_box_mouse], edit2 - stdcall [edit_box_mouse], edit3 -;---------------------------------- - checkboxes_mouse2 check_boxes,check_boxes_end -;----------------------------------- - jmp still -ipc: - cmp word [app_ipc+8],2 - jne @f - min_window - jmp .clear_ipc -@@: - cmp word [app_ipc+8],3 - jne @f - mov ecx,[slot_n] - activ_window - jmp .clear_ipc -@@: - call draw_number - call dr_st - -.clear_ipc: - cld - xor eax,eax - mov ecx,32/4 - mov edi,app_ipc - rep stosd - jmp still - -p_close: - btr dword [flags],1 - - bt dword [flags],3 - jnc @f - mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] -@@: - -close: - app_close - -;--------------------------------------------------------------------- -draw_PathShow: - pusha - mcall SF_DRAW_RECT, <4,302>, <35,15>, 0xffffff -; draw for PathShow - push dword PathShow_data_1 - call [PathShow_draw] - popa - ret -;-------------------------------------------------------------------- -;--- ம楤 ᮢ --------------------------- -;-------------------------------------------------------------------- -draw_window: -start_draw_window ; 砫 ᮢ - ; ।塞 - get_skin_height - mov ecx,100*65536+220 - add cx,ax - mov edx,[sc.work] - or edx,0x34000000;0x33000000 - xor esi,esi - ;xor edi,edi - mov edi,grab_text - mcall SF_CREATE_WINDOW, 100*65536+320 - - ; 뢮 ᫠ - movsx ecx,word [scr.width] ; ਭ ࠭ - mcall SF_DRAW_NUMBER, <4,0>, , <188,[label1.top]>, [sc.work_text] - movsx ecx,word [scr.height] ; ࠭ - add edx, 37 shl 16 - mcall - add edx, 36 shl 16 - mov ebx,2 shl 16 - movsx ecx,word [scr.bitspp] ; ᥫ - mcall - - call draw_number ; ᮢ뢠 ᭨ - call dr_st - - draw_labels labels,labels_end ; ⪨ -;------ show check editbox ----------- -; stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 -;------ end check all editbox ------- - - call draw_PathShow - - draw_txt_buttons buttons,buttons_end ; -;------ check all checkbox --------- - - checkboxes_draw2 check_boxes,check_boxes_end - -;------ end check all checkbox ------ - -stop_draw_window ; ᮢ -ret - -shoot: - bt dword [ch4.flags],1 ; 祭 প ? - jnc @f - draw_status delay_now - mov edi,ed_buffer.2 - call zstr_to_int - mov ebx,eax - delay -@@: - call get_mem_for_shoot; 砥 ᭨ - - - bts dword [flags],0 ; 㫥 䫠 - ᭨ - - ; ᭨ - draw_status shooting - mov esi,scr - mov edi,[scr_buf.ptr] - call copy_screen_to_image - - bt dword [use_rect.flags],1 - jc .use_rect - push dword [scr] - jmp @f -.use_rect: - push dword [rect.height] -@@: - pop dword [scr_buf.size] - - cmp [autoshoot_flag],1 - jne .2 - - bt dword [ch5.flags],1 ; 祭 ࠭ ? - jnc @f - call save_file -@@: - draw_status shooted_ok -.2: - bt dword [flags],1 - jnc @f - ret -@@: - bt dword [ch2.flags],1 ; ।ᬮ ? - jnc @f - cmp [PrintScreen],0 - jne @f - call show_scr_window - ret -@@: - bt dword [ch5.flags],1 ; 祭 ࠭ ? - jnc @f - - call [OpenDialog_data.draw_window] -; invoke OpenDialog - stdcall [OpenDialog_Start], OpenDialog_data - cmp [OpenDialog_data.status],1 - je .1 - ret -.1: -; prepare for PathShow - stdcall [PathShow_prepare], PathShow_data_1 - call [OpenDialog_data.draw_window] - call save_file -@@: - ret - -;--- ᭨ --- -get_mem_for_shoot: -;clean memory - mcall SF_SYS_MISC, SSF_MEM_FREE, [scr_buf.ptr] - - bt dword [use_rect.flags],1 ; ⪠ ࠭ - jc .use_area - movzx ecx, word [scr.width] - movzx ebx, word [scr.height] - jmp @f -.use_area: - call read_rect - movzx ecx, word [rect.width] - movzx ebx, word [rect.height] -@@: - imul ecx,ebx - lea ecx,[ecx*3] -; add ecx,i_end - mcall SF_SYS_MISC, SSF_MEM_ALLOC - mov [scr_buf.ptr],eax - add eax,ecx - mov [scr_buf.end_ptr],ecx -ret - -;--- ᮤ ।ᬮ --- -show_scr_window: -pusha - bt dword [flags],0 - jnc @f - xor ebx,ebx - inc ebx - mcall SF_CREATE_THREAD,, scr_window, i_end_tread-512 -@@: -popa -ret - -;--- ᮢ ⥪騩 --- -apply_number: - mov edi,ed_buffer.3 - call zstr_to_int - mov [cur_number],eax - call draw_number -ret - -;--- 楤 ᮢ ⥪饣 --- -draw_number: - mov [sign_n],4 - mov cx,[label9.top] - shl ecx,16 - mov cx,10 - mov edx,[sc.work] - mcall SF_DRAW_RECT, 150*65536+96 - movsx bx,byte [sign_n] - shl ebx,16 - mov edx,150 shl 16 - mov dx,[label9.top] - mov esi,[sc.work_text] - mcall SF_DRAW_NUMBER,, [cur_number] -ret - -;--- 楤, ᪠ ⮪ ꥬ --- -start_autoshoot: - bts dword [flags],1 - jc @f - xor ebx,ebx - inc ebx - mcall SF_CREATE_THREAD,, autoshoot, i_end_tread -@@: -ret - -;--- ⠭ ⮪ --- -stop_autoshoot: - btr dword [flags],1 -ret - -;--- 横 ⮪ ꥬ --- -autoshoot: - mov [autoshoot_flag],1 - mov ecx,[slot_n] - activ_window -.next: - bt dword [flags],1 - jnc close - mov esi,2 - mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_number - call shoot - jmp autoshoot.next -.close: - mov [autoshoot_flag],0 - jmp close -;--- 楤 ᮢ ப ﭨ --- -; ( 뢠 ⮪ ) -dr_st: - mcall SF_DRAW_LINE, 0*65536+310, 198*65536+198, [sc.work_graph] - - mov bx,310 - mov ecx,199*65536+15 - mov edx,[sc.work] - mcall SF_DRAW_RECT ; ᪠ - - mov edi,status - call draw_label -ret - -;--- 楤 祭 ᫮ ⮪ --- -; 室 ebx - 1024 -; 室 ecx - ᫮ -get_slot_n: - xor ecx,ecx - dec ecx - mcall SF_THREAD_INFO - - mov edx,[ebx+30] - xor ecx,ecx -@@: - inc ecx - mcall SF_THREAD_INFO - cmp [ebx+30],edx - je @f - jmp @b -@@: -ret - -;--- 楤, ᪠ ⮪, 騩 1 ᭨ --- -one_shoot: - mov ecx,one_shoot_thread - mov edx,shoot_esp - jmp @f -;--- 楤, ᪠ ⮪, ࠭騩 ᭨ --- -save_shoot: -; invoke OpenDialog - stdcall [OpenDialog_Start], OpenDialog_data - cmp [OpenDialog_data.status],1 - je .1 - ret -.1: -; prepare for PathShow - stdcall [PathShow_prepare], PathShow_data_1 - - call draw_PathShow - - mov ecx,save_shoot_thread - mov edx,shoot_esp -@@: - bts dword [flags],2 - jc .running - bt dword [flags],1 - jc .running - - xor ebx,ebx - inc ebx - mcall SF_CREATE_THREAD -.running: -ret - -;--- ⮪, 騩 1 ᭨ --- -one_shoot_thread: - mov ecx,[slot_n] - activ_window - bt dword [ch1.flags],1 ; ஢ ? - jnc @f - mov esi,2 - mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.min_window -@@: - call shoot - btr dword [flags],2 - jmp close - -;--- 楤, ࠢ ᮮ饭 ᮢ -; ப ﭨ --- -send_draw_status: - mov esi,2 - mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_status -ret - -;--- ⮪, ࠭ 䠩 --- -save_shoot_thread: - mov ecx,[slot_n] - activ_window - call save_file - btr dword [flags],2 - jmp close - -;--- 楤, ᪠ ⮪ ⠭ ꥬ --- -show_set_rect_window: - bts dword [flags],3 - jc @f - xor ebx,ebx - inc ebx - mcall SF_CREATE_THREAD,, set_rect_window, set_rect_window_esp - - mov [set_rect_window_pid],eax -ret - -@@: - mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] - btr dword [flags],3 -ret - -;--- 祭 ଠ樨 ⨢ --- -get_active_window_info: - mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW - - mov ecx,eax - mcall SF_THREAD_INFO, active_app -ret - -;==================================================================== -;=== ணࠬ =============================================== -;==================================================================== -messages: -.draw_number dw 0 -.draw_status dw 1 -.min_window dw 2 -.act_window dw 3 - -grab_text: - db title,0 - -labels: -label1 label 5,8,0,text.1 ; screen size and color depth -label3 label 5,25,0,text.3 ; 䠩 -label9 label 5,52,0,text.9 ; ⥪饣 ᨬ -status label 5,201,0,no_shoot -labels_end: - -;--------------------------------------------------------------------- -l_libs_start: - -library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ - Box_lib_import - -library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ - ProcLib_import - -library03 l_libs system_dir_LibImg+9, library_path, system_dir_LibImg, \ - import_libimg - -end_l_libs: -;--------------------------------------------------------------------- -editboxes: -;edit1 edit_box 300,5,35,cl_white,0,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10 ; 䠩 -edit2 edit_box 35,170,134,cl_white,0,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3 ; প -edit3 edit_box 35,165,164,cl_white,0,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only ; ⮭㬥 -editboxes_end: -;--------------------------------------------------------------------- -buttons: -but1 txt_button 150,5,15,65,2,0,0,but_text.1,one_shoot ; ᤥ ᭨ -but2 txt_button 34,274,15,34,3,0,0,but_text.2,save_shoot ; "..." - ࠭ -but3 txt_button 145,160,15,65,3,0,0,but_text.3,show_scr_window ; ᭨ -but4 txt_button 80,205,15,163,5,0,0,but_text.4,apply_number ; ਬ -but5 txt_button 150,5,15,85,6,0,0,but_text.5,start_autoshoot ; -but6 txt_button 145,160,15,85,7,0,0,but_text.6,stop_autoshoot ; ⠭ -but7 txt_button 40,70,10,180,8,0,0,but_text.7,show_set_rect_window ; -buttons_end: -;--------------------------------------------------------------------- -check_boxes: -ch1 check_box2 (5 shl 16+11),(105 shl 16 +11),5,cl_white,0,0x80000000,ch_text.1,ch_flag_en+ch_flag_middle ; ᢥ -ch2 check_box2 (5 shl 16+11),(120 shl 16 +11),5,cl_white,0,0x80000000,ch_text.2,ch_flag_en+ch_flag_middle ; show screenshot -ch4 check_box2 (5 shl 16+11),(135 shl 16 +11),5,cl_white,0,0x80000000,ch_text.4,ch_flag_en+ch_flag_middle ; প -ch5 check_box2 (5 shl 16+11),(150 shl 16 +11),5,cl_white,0,0x80000000,ch_text.5,ch_flag_en+ch_flag_middle -ch6 check_box2 (5 shl 16+11),(165 shl 16 +11),5,cl_white,0,0x80000000,ch_text.6,ch_flag_en+ch_flag_middle -use_rect check_box2 (5 shl 16+11),(180 shl 16 +11),5,cl_white,0,0x80000000,ch_text.7,ch_flag_middle ; . -; ⮭㬥 -check_boxes_end: -;--------------------------------------------------------------------- -if lang eq ru_RU -text: -.1 db ' ࠭ 㡨 梥: bit',0 -.3 db ' ࠭ ᭨:',0 -.9 db ' ⥪饣 ᭨:',0 - -but_text: -.1 db ' ᭨ ࠭',0 -.2 db '...',0 -.3 db ' ᭨ ᥩ',0 -.4 db 'ਬ',0 -.5 db ' ꥬ',0 -.6 db '⠭ ꥬ',0 -.7 db '',0 - -ch_text: -.1 db ' ',0 -.2 db ' ᭨',0 -.4 db 'প ᥪ㭤:',0 -.5 db '࠭',0 -.6 db '⮭㬥, 稭 ',0 -.7 db '',0 - -no_shoot db ' ᤥ',0 -shooting db '⮣஢...',0 -shooted_ok db ' ᤥ',0 -saving db '࠭...',0 -saved_ok db ' ࠭',0 -delay_now db 'প...',0 -bad_file_name db ' 䠩 ୮',0 -disk_filled db ' ',0 -bad_fat_table db ' FAT ࠧ襭',0 -ac_den db ' 饭',0 -device_er db '訡 ன⢠',0 -not_shooted db '訡: 砫 ᤥ ᭨',0 -no_file_name db '訡: ᫥ 䠩',0 -invalid_rect db '⨬ ࠧ ',0 -keyforexit db ' ᭨. 室 -  .',0 - - -else -text: -.1 db 'Screen size and color depth: bit',0 -.3 db 'Screenshot save path:',0 -.9 db 'Current photo number:',0 - -but_text: -.1 db 'Make screen photo',0 -.2 db 'Save screen photo',0 -.3 db 'Show photo now',0 -.4 db 'Apply',0 -.5 db 'Start autoshooting',0 -.6 db 'Stop autoshooting',0 -.7 db 'Set',0 - -ch_text: -.1 db 'Minimize window',0 -.2 db 'Show photo',0 -.4 db 'Delay in milliseconds:',0 -.5 db 'Autosave',0 -.6 db 'Start numeration from',0 -.7 db 'Area',0 - -no_shoot db 'There is no photo',0 -shooting db 'Photographing...',0 -shooted_ok db 'Photo created',0 -saving db 'Saving...',0 -saved_ok db 'Photo saved',0 -delay_now db 'Delay...',0 -bad_file_name db 'File name is wrong',0 -disk_filled db 'Disk is full',0 -bad_fat_table db 'FAT table destroyed',0 -ac_den db 'Access denied',0 -device_er db 'Device error',0 -not_shooted db 'Error: you need to make a photo first',0 -no_file_name db 'Please, enter file name.',0 -invalid_rect db 'Wrong area size',0 -keyforexit db 'This is your screenshot. Press any key.',0 - -end if - - - - -;--------------------------------------------------------------------- -PathShow_data_1: -.type dd 0 ;+0 -.start_y dw 38 ;+4 -.start_x dw 6 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 -.area_size_x dw 300 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable -.background_flag dd 0 ;+16 -.font_color dd 0x0 ;+20 -.background_color dd 0x0 ;+24 -.text_pointer dd fname_buf ;+28 -.work_area_pointer dd text_work_area ;+32 -.temp_text_length dd 0 ;+36 -;--------------------------------------------------------------------- -OpenDialog_data: -.type dd 1 ; Save -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd fname_buf ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: -if __nightbuild eq yes - db '/sys/MANAGERS/opendial',0 -else - db '/sys/File Managers/opendial',0 -end if -communication_area_default_pach: - db '/sys',0 - -Filter: -dd Filter.end - Filter -.1: -db 'PNG',0 -.end: -db 0 - -start_temp_file_name: db '1.png',0 - -;--------------------------------------------------------------------- - -PrintScreen db 0 -autoshoot_flag db 0 - -app_ipc ipc_buffer 32 -align 4 - -mouse_flag: dd 0x0 -;--------------------------------------------------------------------- -align 4 - -ed_buffer: -.1: db '/sys/1.png',0 -;rb 287 -.2: - db '100',0 - rb 6 -.3: - rb 10 -;--------------------------------------------------------------------- -IM_END: -;--------------------------------------------------------------------- -structure_of_potock: -rb 100 -;--------------------------------------------------------------------- -align 4 - -cur_number dd ? - -sign_n db ? - -slot_n dd ? - -flags dd ? - -scr_buf: -.ptr dd ? -.end_ptr dd ? -.size: -.height dw ? -.width dw ? - -fs_struc: -.funk_n dd ? - dd ? - dd ? -.bytes_to_write dd ? -.data_ptr dd ?,? -.fn_ptr dd ? - -sf_buf: -.bmp_header dd ? -.bmp_area dd ? -.end dd ? - -set_rect_window_pid dd ? -set_rect_window_slot dd ? -;--------------------------------------------------------------------- -align 4 -rect_input_buffer: -.left rb 8 -.top rb 8 -.width rb 8 -.height rb 8 - -cmdstr rb 257 -;--------------------------------------------------------------------- -align 4 - -file_name: - rb 1058 - -scr screen_prop -rect: -.left dw ? -.top dw ? -.height dw ? -.width dw ? - -sc sys_color_table -app procinfo ; ଠ -active_app procinfo ; ଠ ⨢ -set_rect_window_procinfo procinfo ; ଠ -;--------------------------------------------------------------------- - rb 512 ; ⥪ ⮪ ⪠ -shoot_esp: -;--------------------------------------------------------------------- - rb 512 ; ⥪ -set_rect_window_esp: -;--------------------------------------------------------------------- -; app_end ; ணࠬ -mouse_dd rd 1 -;--------------------------------------------------------------------- -align 4 -cur_dir_path rb 4096 -library_path rb 4096 -temp_dir_pach rb 4096 -text_work_area rb 1024 -fname_buf rb 4096 -procinfo rb 1024 -filename_area rb 256 -;--------------------------------------------------------------------- - rb 1024 -i_end_tread: -;--------------------------------------------------------------------- - rb 1024 -stacktop: -;--------------------------------------------------------------------- -i_end: +; +; Screenshooter for Kolibri +; +;--------------------------------------------------------------------- +; ணࠬ 客 ᨬ (Maxxxx32) +; +; 26.11.16 - IgorA ᭨ ࠭ ଠ *.png +; 02.11.10 - ᯮ checkbox ᨨ 2 +; +; version: 1.2 +; last update: 08/09/2010 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: select path for save with OpenDialog, +; bag fix for threads stacks +; 01.06.09 - ⥬ ⥪ +; 24.07.08 - editbox +; 01.02.07 - editbox +; 31.01.07 - ⥯ ⭮⥫쭮 ᪮ + + +format binary as "" + +title equ 'Screenshooter v1.21' ; +include '../../load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../config.inc' ;for nightbuild +include '../../proc32.inc' +include '../../macros.inc' +include '../../KOSfuncs.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +include 'txtbut.inc' +include 'label.inc' +include 'textwork.inc' +include 'scrshoot.mac' + +use32 + org 0 + db 'MENUET01' + dd 1, start, IM_END, i_end, stacktop, cmdstr, cur_dir_path + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '../../dll.inc' + +align 4 + @use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + use_txt_button ; | + use_label ; |-- GUI 楤 + use_text_work ; / + +include 'scrwin.inc' ; ⠢塞 यᬮ +include 'scrsavef.inc'; ⠢塞 楤 ࠭ 䠩 +include 'gp.inc' +include 'srectwin.inc' + +macro get_sys_colors col_buf +{ + mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, col_buf, 40 +} + +;--- 砫 ணࠬ --- +align 4 +start: + +load_libraries l_libs_start,end_l_libs + +;if return code =-1 then exit, else nornary work +; cmp eax,-1 + inc eax + test eax,eax + jz close +;;;;;;;;;;;;;;;; init memory 68/11 + mcall SF_SYS_MISC, SSF_HEAP_INIT + test eax,eax + jz close + +;--------------------------------------------------------------------- + mov edi,filename_area + mov esi,start_temp_file_name + xor eax,eax + cld +@@: + lodsb + stosb + test eax,eax + jnz @b + + + mov edi,fname_buf + mov esi,ed_buffer.1 + xor eax,eax + cld +@@: + lodsb + stosb + test eax,eax + jnz @b + +;OpenDialog initialisation + stdcall [OpenDialog_Init], OpenDialog_data + +; prepare for PathShow + stdcall [PathShow_prepare], PathShow_data_1 +;--------------------------------------------------------------------- + ;mov al,[gs:1280*4*1024] + ; ⠭ ipc + xor ebx,ebx + inc ebx + mcall SF_IPC,, app_ipc, 32 + + ; ⠭ + mov cl,55 ; 55 - PrintScrn + xor edx,edx + mcall SF_KEYBOARD, SSF_SET_SYS_HOTKEY + + mov ebx,app + call get_slot_n + mov [slot_n],ecx + + ; ⠭ ᮡ⨩ + set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc) +;樠 checkboxes + init_checkboxes2 check_boxes,check_boxes_end + +;  룠 ᮢ +red: + get_procinfo app ; 砥 ଠ + get_sys_colors sc ; 砥 ⥬ 梥 + + ; ⠭ ⥬ 梥 GUI ⮢ + txt_but_set_sys_color buttons,buttons_end,sc ; \ + labels_set_sys_color labels,labels_end,sc ; | + check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc; | + edit_boxes_set_sys_color editboxes,editboxes_end,sc ; / + + get_screen_prop scr ; 砥 ଠ ࠭ +;------------------------------------------------------------------------------ +; Boot with "DIRECT" parameter - get screen and save + mov eax,cmdstr + cmp [eax],byte 0 + je no_boot + + cmp [eax],dword 'DIRE' + jne no_boot + + cmp [eax+4],word 'CT' + jne no_boot + + and [ch2.flags],dword 0 + or [ch5.flags],dword 1 + mov [OpenDialog_data.draw_window],dword draw_window_direct + + call shoot + jmp close +;------------------------------------------------------------------------------ +draw_window_direct: + mcall SF_REDRAW, SSF_BEGIN_DRAW + mcall SF_GET_SCREEN_SIZE +; eax = [xsize]*65536 + [ysize] + mov ebx,eax + shr ebx,17 + sub ebx,100 + shl ebx,16 + mov bx,200 + mov ecx,eax + and ecx,0xffff + shr ecx,1 + sub ecx,50 + shl ecx,16 + mov cx,100 + xor esi,esi + mcall SF_CREATE_WINDOW,,,0x34ffffff,,grab_text + + mcall SF_DRAW_TEXT, <10,30>,0x90000000,saving + + mcall SF_REDRAW, SSF_END_DRAW + ret +;------------------------------------------------------------------------------ +no_boot: + call draw_window ; ᮢ뢠 +still: + wait_event red,key,button,mouse,ipc,still ; ᮡ⨩ + +key: + get_key + cmp al,2 + jne @f + cmp ah,55 + jne still + mov [PrintScreen],1 + call shoot + mov [PrintScreen],0 + jmp still +@@: +; stdcall [edit_box_key], edit1 + stdcall [edit_box_key], edit2 + stdcall [edit_box_key], edit3 + + jmp still +button: + get_pressed_button + cmp ah,1 + je p_close + txt_but_ev buttons,buttons_end + jmp still +mouse: + get_active_window + cmp eax,[slot_n] + jne still +;---------------------------------- +; stdcall [edit_box_mouse], edit1 + stdcall [edit_box_mouse], edit2 + stdcall [edit_box_mouse], edit3 +;---------------------------------- + checkboxes_mouse2 check_boxes,check_boxes_end +;----------------------------------- + jmp still +ipc: + cmp word [app_ipc+8],2 + jne @f + min_window + jmp .clear_ipc +@@: + cmp word [app_ipc+8],3 + jne @f + mov ecx,[slot_n] + activ_window + jmp .clear_ipc +@@: + call draw_number + call dr_st + +.clear_ipc: + cld + xor eax,eax + mov ecx,32/4 + mov edi,app_ipc + rep stosd + jmp still + +p_close: + btr dword [flags],1 + + bt dword [flags],3 + jnc @f + mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] +@@: + +close: + app_close + +;--------------------------------------------------------------------- +draw_PathShow: + pusha + mcall SF_DRAW_RECT, <4,302>, <35,15>, 0xffffff +; draw for PathShow + push dword PathShow_data_1 + call [PathShow_draw] + popa + ret +;-------------------------------------------------------------------- +;--- ம楤 ᮢ --------------------------- +;-------------------------------------------------------------------- +draw_window: +start_draw_window ; 砫 ᮢ + ; ।塞 + get_skin_height + mov ecx,100*65536+220 + add cx,ax + mov edx,[sc.work] + or edx,0x34000000;0x33000000 + xor esi,esi + ;xor edi,edi + mov edi,grab_text + mcall SF_CREATE_WINDOW, 100*65536+320 + + ; 뢮 ᫠ + movsx ecx,word [scr.width] ; ਭ ࠭ + mcall SF_DRAW_NUMBER, <4,0>, , <188,[label1.top]>, [sc.work_text] + movsx ecx,word [scr.height] ; ࠭ + add edx, 37 shl 16 + mcall + add edx, 36 shl 16 + mov ebx,2 shl 16 + movsx ecx,word [scr.bitspp] ; ᥫ + mcall + + call draw_number ; ᮢ뢠 ᭨ + call dr_st + + draw_labels labels,labels_end ; ⪨ +;------ show check editbox ----------- +; stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 +;------ end check all editbox ------- + + call draw_PathShow + + draw_txt_buttons buttons,buttons_end ; +;------ check all checkbox --------- + + checkboxes_draw2 check_boxes,check_boxes_end + +;------ end check all checkbox ------ + +stop_draw_window ; ᮢ +ret + +shoot: + bt dword [ch4.flags],1 ; 祭 প ? + jnc @f + draw_status delay_now + mov edi,ed_buffer.2 + call zstr_to_int + mov ebx,eax + delay +@@: + call get_mem_for_shoot; 砥 ᭨ + + + bts dword [flags],0 ; 㫥 䫠 - ᭨ + + ; ᭨ + draw_status shooting + mov esi,scr + mov edi,[scr_buf.ptr] + call copy_screen_to_image + + bt dword [use_rect.flags],1 + jc .use_rect + push dword [scr] + jmp @f +.use_rect: + push dword [rect.height] +@@: + pop dword [scr_buf.size] + + cmp [autoshoot_flag],1 + jne .2 + + bt dword [ch5.flags],1 ; 祭 ࠭ ? + jnc @f + call save_file +@@: + draw_status shooted_ok +.2: + bt dword [flags],1 + jnc @f + ret +@@: + bt dword [ch2.flags],1 ; ।ᬮ ? + jnc @f + cmp [PrintScreen],0 + jne @f + call show_scr_window + ret +@@: + bt dword [ch5.flags],1 ; 祭 ࠭ ? + jnc @f + + call [OpenDialog_data.draw_window] +; invoke OpenDialog + stdcall [OpenDialog_Start], OpenDialog_data + cmp [OpenDialog_data.status],1 + je .1 + ret +.1: +; prepare for PathShow + stdcall [PathShow_prepare], PathShow_data_1 + call [OpenDialog_data.draw_window] + call save_file +@@: + ret + +;--- ᭨ --- +get_mem_for_shoot: +;clean memory + mcall SF_SYS_MISC, SSF_MEM_FREE, [scr_buf.ptr] + + bt dword [use_rect.flags],1 ; ⪠ ࠭ + jc .use_area + movzx ecx, word [scr.width] + movzx ebx, word [scr.height] + jmp @f +.use_area: + call read_rect + movzx ecx, word [rect.width] + movzx ebx, word [rect.height] +@@: + imul ecx,ebx + lea ecx,[ecx*3] +; add ecx,i_end + mcall SF_SYS_MISC, SSF_MEM_ALLOC + mov [scr_buf.ptr],eax + add eax,ecx + mov [scr_buf.end_ptr],ecx +ret + +;--- ᮤ ।ᬮ --- +show_scr_window: +pusha + bt dword [flags],0 + jnc @f + xor ebx,ebx + inc ebx + mcall SF_CREATE_THREAD,, scr_window, i_end_tread-512 +@@: +popa +ret + +;--- ᮢ ⥪騩 --- +apply_number: + mov edi,ed_buffer.3 + call zstr_to_int + mov [cur_number],eax + call draw_number +ret + +;--- 楤 ᮢ ⥪饣 --- +draw_number: + mov [sign_n],4 + mov cx,[label9.top] + shl ecx,16 + mov cx,10 + mov edx,[sc.work] + mcall SF_DRAW_RECT, 150*65536+96 + movsx bx,byte [sign_n] + shl ebx,16 + mov edx,150 shl 16 + mov dx,[label9.top] + mov esi,[sc.work_text] + mcall SF_DRAW_NUMBER,, [cur_number] +ret + +;--- 楤, ᪠ ⮪ ꥬ --- +start_autoshoot: + bts dword [flags],1 + jc @f + xor ebx,ebx + inc ebx + mcall SF_CREATE_THREAD,, autoshoot, i_end_tread +@@: +ret + +;--- ⠭ ⮪ --- +stop_autoshoot: + btr dword [flags],1 +ret + +;--- 横 ⮪ ꥬ --- +autoshoot: + mov [autoshoot_flag],1 + mov ecx,[slot_n] + activ_window +.next: + bt dword [flags],1 + jnc close + mov esi,2 + mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_number + call shoot + jmp autoshoot.next +.close: + mov [autoshoot_flag],0 + jmp close +;--- 楤 ᮢ ப ﭨ --- +; ( 뢠 ⮪ ) +dr_st: + mcall SF_DRAW_LINE, 0*65536+310, 198*65536+198, [sc.work_graph] + + mov bx,310 + mov ecx,199*65536+15 + mov edx,[sc.work] + mcall SF_DRAW_RECT ; ᪠ + + mov edi,status + call draw_label +ret + +;--- 楤 祭 ᫮ ⮪ --- +; 室 ebx - 1024 +; 室 ecx - ᫮ +get_slot_n: + xor ecx,ecx + dec ecx + mcall SF_THREAD_INFO + + mov edx,[ebx+30] + xor ecx,ecx +@@: + inc ecx + mcall SF_THREAD_INFO + cmp [ebx+30],edx + je @f + jmp @b +@@: +ret + +;--- 楤, ᪠ ⮪, 騩 1 ᭨ --- +one_shoot: + mov ecx,one_shoot_thread + mov edx,shoot_esp + jmp @f +;--- 楤, ᪠ ⮪, ࠭騩 ᭨ --- +save_shoot: +; invoke OpenDialog + stdcall [OpenDialog_Start], OpenDialog_data + cmp [OpenDialog_data.status],1 + je .1 + ret +.1: +; prepare for PathShow + stdcall [PathShow_prepare], PathShow_data_1 + + call draw_PathShow + + mov ecx,save_shoot_thread + mov edx,shoot_esp +@@: + bts dword [flags],2 + jc .running + bt dword [flags],1 + jc .running + + xor ebx,ebx + inc ebx + mcall SF_CREATE_THREAD +.running: +ret + +;--- ⮪, 騩 1 ᭨ --- +one_shoot_thread: + mov ecx,[slot_n] + activ_window + bt dword [ch1.flags],1 ; ஢ ? + jnc @f + mov esi,2 + mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.min_window +@@: + call shoot + btr dword [flags],2 + jmp close + +;--- 楤, ࠢ ᮮ饭 ᮢ +; ப ﭨ --- +send_draw_status: + mov esi,2 + mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_status +ret + +;--- ⮪, ࠭ 䠩 --- +save_shoot_thread: + mov ecx,[slot_n] + activ_window + call save_file + btr dword [flags],2 + jmp close + +;--- 楤, ᪠ ⮪ ⠭ ꥬ --- +show_set_rect_window: + bts dword [flags],3 + jc @f + xor ebx,ebx + inc ebx + mcall SF_CREATE_THREAD,, set_rect_window, set_rect_window_esp + + mov [set_rect_window_pid],eax +ret + +@@: + mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] + btr dword [flags],3 +ret + +;--- 祭 ଠ樨 ⨢ --- +get_active_window_info: + mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW + + mov ecx,eax + mcall SF_THREAD_INFO, active_app +ret + +;==================================================================== +;=== ணࠬ =============================================== +;==================================================================== +messages: +.draw_number dw 0 +.draw_status dw 1 +.min_window dw 2 +.act_window dw 3 + +grab_text: + db title,0 + +labels: +label1 label 5,8,0,text.1 ; screen size and color depth +label3 label 5,25,0,text.3 ; 䠩 +label9 label 5,52,0,text.9 ; ⥪饣 ᨬ +status label 5,201,0,no_shoot +labels_end: + +;--------------------------------------------------------------------- +l_libs_start: + +library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ + Box_lib_import + +library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ + ProcLib_import + +library03 l_libs system_dir_LibImg+9, library_path, system_dir_LibImg, \ + import_libimg + +end_l_libs: +;--------------------------------------------------------------------- +editboxes: +;edit1 edit_box 300,5,35,cl_white,0,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10 ; 䠩 +edit2 edit_box 35,170,134,cl_white,0,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3 ; প +edit3 edit_box 35,165,164,cl_white,0,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only ; ⮭㬥 +editboxes_end: +;--------------------------------------------------------------------- +buttons: +but1 txt_button 150,5,15,65,2,0,0,but_text.1,one_shoot ; ᤥ ᭨ +but2 txt_button 34,274,15,34,3,0,0,but_text.2,save_shoot ; "..." - ࠭ +but3 txt_button 145,160,15,65,3,0,0,but_text.3,show_scr_window ; ᭨ +but4 txt_button 80,205,15,163,5,0,0,but_text.4,apply_number ; ਬ +but5 txt_button 150,5,15,85,6,0,0,but_text.5,start_autoshoot ; +but6 txt_button 145,160,15,85,7,0,0,but_text.6,stop_autoshoot ; ⠭ +but7 txt_button 40,70,10,180,8,0,0,but_text.7,show_set_rect_window ; +buttons_end: +;--------------------------------------------------------------------- +check_boxes: +ch1 check_box2 (5 shl 16+11),(105 shl 16 +11),5,cl_white,0,0x80000000,ch_text.1,ch_flag_en+ch_flag_middle ; ᢥ +ch2 check_box2 (5 shl 16+11),(120 shl 16 +11),5,cl_white,0,0x80000000,ch_text.2,ch_flag_en+ch_flag_middle ; show screenshot +ch4 check_box2 (5 shl 16+11),(135 shl 16 +11),5,cl_white,0,0x80000000,ch_text.4,ch_flag_en+ch_flag_middle ; প +ch5 check_box2 (5 shl 16+11),(150 shl 16 +11),5,cl_white,0,0x80000000,ch_text.5,ch_flag_en+ch_flag_middle +ch6 check_box2 (5 shl 16+11),(165 shl 16 +11),5,cl_white,0,0x80000000,ch_text.6,ch_flag_en+ch_flag_middle +use_rect check_box2 (5 shl 16+11),(180 shl 16 +11),5,cl_white,0,0x80000000,ch_text.7,ch_flag_middle ; . +; ⮭㬥 +check_boxes_end: +;--------------------------------------------------------------------- + +if lang eq ru_RU + +text: +.1 db ' ࠭ 㡨 梥: bit',0 +.3 db ' ࠭ ᭨:',0 +.9 db ' ⥪饣 ᭨:',0 + +but_text: +.1 db ' ᭨ ࠭',0 +.2 db '...',0 +.3 db ' ᭨ ᥩ',0 +.4 db 'ਬ',0 +.5 db ' ꥬ',0 +.6 db '⠭ ꥬ',0 +.7 db '',0 + +ch_text: +.1 db ' ',0 +.2 db ' ᭨',0 +.4 db 'প ᥪ㭤:',0 +.5 db '࠭',0 +.6 db '⮭㬥, 稭 ',0 +.7 db '',0 + +no_shoot db ' ᤥ',0 +shooting db '⮣஢...',0 +shooted_ok db ' ᤥ',0 +saving db '࠭...',0 +saved_ok db ' ࠭',0 +delay_now db 'প...',0 +bad_file_name db ' 䠩 ୮',0 +disk_filled db ' ',0 +bad_fat_table db ' FAT ࠧ襭',0 +ac_den db ' 饭',0 +device_er db '訡 ன⢠',0 +not_shooted db '訡: 砫 ᤥ ᭨',0 +no_file_name db '訡: ᫥ 䠩',0 +invalid_rect db '⨬ ࠧ ',0 +keyforexit db ' ᭨. 室 -  .',0 + + +else ; Default to en_US + +text: +.1 db 'Screen size and color depth: bit',0 +.3 db 'Screenshot save path:',0 +.9 db 'Current photo number:',0 + +but_text: +.1 db 'Make screen photo',0 +.2 db 'Save screen photo',0 +.3 db 'Show photo now',0 +.4 db 'Apply',0 +.5 db 'Start autoshooting',0 +.6 db 'Stop autoshooting',0 +.7 db 'Set',0 + +ch_text: +.1 db 'Minimize window',0 +.2 db 'Show photo',0 +.4 db 'Delay in milliseconds:',0 +.5 db 'Autosave',0 +.6 db 'Start numeration from',0 +.7 db 'Area',0 + +no_shoot db 'There is no photo',0 +shooting db 'Photographing...',0 +shooted_ok db 'Photo created',0 +saving db 'Saving...',0 +saved_ok db 'Photo saved',0 +delay_now db 'Delay...',0 +bad_file_name db 'File name is wrong',0 +disk_filled db 'Disk is full',0 +bad_fat_table db 'FAT table destroyed',0 +ac_den db 'Access denied',0 +device_er db 'Device error',0 +not_shooted db 'Error: you need to make a photo first',0 +no_file_name db 'Please enter file name.',0 +invalid_rect db 'Wrong area size',0 +keyforexit db 'This is your screenshot. Press any key.',0 + +end if + + + + +;--------------------------------------------------------------------- +PathShow_data_1: +.type dd 0 ;+0 +.start_y dw 38 ;+4 +.start_x dw 6 ;+6 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.area_size_x dw 300 ;+10 +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.background_flag dd 0 ;+16 +.font_color dd 0x0 ;+20 +.background_color dd 0x0 ;+24 +.text_pointer dd fname_buf ;+28 +.work_area_pointer dd text_work_area ;+32 +.temp_text_length dd 0 ;+36 +;--------------------------------------------------------------------- +OpenDialog_data: +.type dd 1 ; Save +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd fname_buf ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: +if __nightbuild eq yes + db '/sys/MANAGERS/opendial',0 +else + db '/sys/File Managers/opendial',0 +end if +communication_area_default_pach: + db '/sys',0 + +Filter: +dd Filter.end - Filter +.1: +db 'PNG',0 +.end: +db 0 + +start_temp_file_name: db '1.png',0 + +;--------------------------------------------------------------------- + +PrintScreen db 0 +autoshoot_flag db 0 + +app_ipc ipc_buffer 32 +align 4 + +mouse_flag: dd 0x0 +;--------------------------------------------------------------------- +align 4 + +ed_buffer: +.1: db '/sys/1.png',0 +;rb 287 +.2: + db '100',0 + rb 6 +.3: + rb 10 +;--------------------------------------------------------------------- +IM_END: +;--------------------------------------------------------------------- +structure_of_potock: +rb 100 +;--------------------------------------------------------------------- +align 4 + +cur_number dd ? + +sign_n db ? + +slot_n dd ? + +flags dd ? + +scr_buf: +.ptr dd ? +.end_ptr dd ? +.size: +.height dw ? +.width dw ? + +fs_struc: +.funk_n dd ? + dd ? + dd ? +.bytes_to_write dd ? +.data_ptr dd ?,? +.fn_ptr dd ? + +sf_buf: +.bmp_header dd ? +.bmp_area dd ? +.end dd ? + +set_rect_window_pid dd ? +set_rect_window_slot dd ? +;--------------------------------------------------------------------- +align 4 +rect_input_buffer: +.left rb 8 +.top rb 8 +.width rb 8 +.height rb 8 + +cmdstr rb 257 +;--------------------------------------------------------------------- +align 4 + +file_name: + rb 1058 + +scr screen_prop +rect: +.left dw ? +.top dw ? +.height dw ? +.width dw ? + +sc sys_color_table +app procinfo ; ଠ +active_app procinfo ; ଠ ⨢ +set_rect_window_procinfo procinfo ; ଠ +;--------------------------------------------------------------------- + rb 512 ; ⥪ ⮪ ⪠ +shoot_esp: +;--------------------------------------------------------------------- + rb 512 ; ⥪ +set_rect_window_esp: +;--------------------------------------------------------------------- +; app_end ; ணࠬ +mouse_dd rd 1 +;--------------------------------------------------------------------- +align 4 +cur_dir_path rb 4096 +library_path rb 4096 +temp_dir_pach rb 4096 +text_work_area rb 1024 +fname_buf rb 4096 +procinfo rb 1024 +filename_area rb 256 +;--------------------------------------------------------------------- + rb 1024 +i_end_tread: +;--------------------------------------------------------------------- + rb 1024 +stacktop: +;--------------------------------------------------------------------- +i_end: diff --git a/programs/media/scrshoot/srectwin.inc b/programs/media/scrshoot/srectwin.inc index 84c75dfbb..fb1ac8ad7 100644 --- a/programs/media/scrshoot/srectwin.inc +++ b/programs/media/scrshoot/srectwin.inc @@ -1,395 +1,397 @@ -align 4 -set_rect_window: - mov ebx,set_rect_window_procinfo - call get_slot_n - - mov [set_rect_window_slot],ecx - - set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse) - call init_rect - edit_boxes_set_sys_color rect_input,rect_input_end,sc -.red: - labels_set_sys_color rect_input_labels,rect_input_labels_end,sc - check_boxes_set_sys_color2 riw_check_boxes,riw_check_boxes_end,sc - call .draw_window -align 4 -.still: - wait_event .red,.key,.button,.mouse - -.key: - get_key - - stdcall [edit_box_key], rect_input.left - stdcall [edit_box_key], rect_input.top - stdcall [edit_box_key], rect_input.width - stdcall [edit_box_key], rect_input.height - - call read_rect - call draw_rect_on_screen - - jmp .still - -.button: - get_pressed_button - - cmp ah,1 - jne @f - btr dword [flags],3 - jmp close -@@: - - jmp .still - -.mouse: - get_active_window - cmp eax,[set_rect_window_slot] - jne .still - - stdcall [edit_box_mouse], rect_input.left - stdcall [edit_box_mouse], rect_input.top - stdcall [edit_box_mouse], rect_input.width - stdcall [edit_box_mouse], rect_input.height - -;;;;;;;;;;;;;;;;;;;;;; - stdcall [check_box_mouse], use_rect_active_window - - jmp .still - -align 4 -.draw_window: - start_draw_window - - mov edx,[sc.work] - add edx,0x33000000 - mov edi,riw_grab_text - xor esi,esi - mcall SF_CREATE_WINDOW, 100*65536+250, 100*65536+130 - - draw_labels rect_input_labels,rect_input_labels_end - - stdcall [edit_box_draw], rect_input.left - stdcall [edit_box_draw], rect_input.top - stdcall [edit_box_draw], rect_input.width - stdcall [edit_box_draw], rect_input.height -;;;;;;;;;;;;;;;;;;;;;; - stdcall [check_box_draw], use_rect_active_window - - call read_rect - call draw_rect_on_screen - - stop_draw_window -ret - -align 4 -init_rect: - bt dword [use_rect_active_window.flags],1 - jc init_rect_from_active_window -pushad - mov edi,rect_input_buffer.left - movsx eax,word[rect.left] - mov ecx,rect_input.left - call init_editbox - mov edi,rect_input_buffer.top - movsx eax,word[rect.top] - mov ecx,rect_input.top - call init_editbox - mov edi,rect_input_buffer.width - movsx eax,word[rect.width] - mov ecx,rect_input.width - call init_editbox - mov edi,rect_input_buffer.height - movsx eax,word[rect.height] - mov ecx,rect_input.height - call init_editbox -popad -ret - -align 4 -init_rect_from_active_window: - -ret - -align 4 -init_editbox: - push edi - push ecx - xor ebx,ebx - inc ebx - cmp eax,10 - jl @f - inc ebx - @@: - cmp eax,100 - jl @f - inc ebx - @@: - cmp eax,1000 - jl @f - inc ebx - @@: - call int_to_str - call [edit_box_set_text] ;ecx,edi -ret -;-------------------------------------------------------------------- -;--- 뢠 --------------------------------------------- -;-------------------------------------------------------------------- -align 4 -read_rect: - bt dword [use_rect_active_window.flags],1 - jc read_rect_from_active_window - - mov edi,rect_input_buffer.left - call zstr_to_int - cmp ax,[scr.width] - jb @f - mov ax,[scr.width] -@@: - mov [rect.left],ax - - mov edi,rect_input_buffer.top - call zstr_to_int - cmp ax,[scr.height] - jb @f - mov ax,[scr.height] -@@: - mov [rect.top],ax - - mov edi,rect_input_buffer.width - call zstr_to_int - mov bx,[scr.width] - sub bx,[rect.left] - cmp ax,bx - jb @f - mov ax,bx -@@: - mov [rect.width],ax - - mov edi,rect_input_buffer.height - call zstr_to_int - mov bx,[scr.height] - sub bx,[rect.top] - cmp ax,bx - jb @f - mov ax,bx -@@: - mov [rect.height],ax -ret - -align 4 -read_rect_from_active_window: - call get_active_window_info - - mov eax,[active_app.left] - mov [rect.left],ax - mov eax,[active_app.top] - mov [rect.top],ax - mov eax,[active_app.width] - inc eax - mov [rect.width],ax - mov eax,[active_app.height] - inc eax - mov [rect.height],ax -ret - -align 4 -draw_rect_on_screen: - - xor edx,edx - mcall SF_DRAW_RECT, 150*65536+80, 5*65536+60 - - ;movzx eax,word [rect.left] - ;mul word [scr.width] - xor edx,edx - movzx eax,word [scr.width] - mov ebx,80 - div ebx - mov ebx,eax - - xor edx,edx - movzx eax,word [rect.height] - div ebx - push ax - - xor edx,edx - movzx eax,word [rect.width] - div ebx - push ax - - xor edx,edx - movzx eax,word [rect.top] - div ebx - push ax - - xor edx,edx - movzx eax,word [rect.left] - div ebx - push ax - - pop bx - add bx,150 - shl ebx,16 - - pop cx - add cx,5 - shl ecx,16 - - pop bx - pop cx - - mcall SF_DRAW_RECT,,,0xffffff -ret - -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -;DATA - -system_dir_Boxlib db '/sys/lib/box_lib.obj',0 -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 -system_dir_LibImg db '/sys/lib/libimg.obj',0 - -;--------------------------------------------------------------------- -align 4 -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start -;OpenDialog__Version dd aOpenDialog_Version - dd 0,0 -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 -;aOpenDialog_Version db 'Version_OpenDialog',0 -;--------------------------------------------------------------------- -align 4 -Box_lib_import: -;init_lib dd a_init -;version_lib dd a_version - -edit_box_draw dd aEdit_box_draw -edit_box_key dd aEdit_box_key -edit_box_mouse dd aEdit_box_mouse -edit_box_set_text dd aEdit_box_set_text -;version_ed dd aVersion_ed - -init_checkbox dd aInit_checkbox -check_box_draw dd aCheck_box_draw -check_box_mouse dd aCheck_box_mouse -;version_ch dd aVersion_ch - -option_box_draw dd aOption_box_draw -option_box_mouse dd aOption_box_mouse -;version_op dd aVersion_op - -PathShow_prepare dd sz_PathShow_prepare -PathShow_draw dd sz_PathShow_draw -;Version_path_show dd szVersion_path_show - dd 0,0 - -;a_init db 'lib_init',0 -;a_version db 'version',0 - -aEdit_box_draw db 'edit_box_draw',0 -aEdit_box_key db 'edit_box_key',0 -aEdit_box_mouse db 'edit_box_mouse',0 -aEdit_box_set_text db 'edit_box_set_text',0 -;aVersion_ed db 'version_ed',0 - - -aInit_checkbox db 'init_checkbox2',0 -aCheck_box_draw db 'check_box_draw2',0 -aCheck_box_mouse db 'check_box_mouse2',0 -;aVersion_ch db 'version_ch2',0 - -aOption_box_draw db 'option_box_draw',0 -aOption_box_mouse db 'option_box_mouse',0 -;aVersion_op db 'version_op',0 - -sz_PathShow_prepare db 'PathShow_prepare',0 -sz_PathShow_draw db 'PathShow_draw',0 -;szVersion_path_show db 'version_PathShow',0 -;--------------------------------------------------------------------- -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw -dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 -;--------------------------------------------------------------------- -;width,left,top,color,shift_color,focus_border_color,\ -; blur_border_color,text_color,max,text,mouse_variable,flags,size,pos - -rect_input: -.left edit_box 35,95,5, cl_white,0,0,0,0,5,rect_input_buffer.left, mouse_dd1,ed_figure_only ;+ed_focus -.top edit_box 35,95,25,cl_white,0,0,0,0,5,rect_input_buffer.top, mouse_dd1,ed_figure_only -.width edit_box 35,95,45,cl_white,0,0,0,0,5,rect_input_buffer.width, mouse_dd1,ed_figure_only -.height edit_box 35,95,65,cl_white,0,0,0,0,5,rect_input_buffer.height,mouse_dd1,ed_figure_only -rect_input_end: -mouse_dd1 rd 1 -rect_input_labels: -.left label 10,10,0,rect_input_labels_text.left -.top label 10,30,0,rect_input_labels_text.top -.width label 10,50,0,rect_input_labels_text.width -.height label 10,70,0,rect_input_labels_text.height -rect_input_labels_end: - -rect_input_labels_text: -if lang eq ru_RU -.left db ' ᫥:',0 -.top db ' ᢥ:',0 -.width db 'ਭ:',0 -.height db ':',0 -else -.left db 'Left:',0 -.top db 'Top:',0 -.width db 'Width:',0 -.height db 'Height:',0 -end if - -riw_check_boxes: -use_rect_active_window check_box2 (10 shl 16)+10,(85 shl 16) +10,5,cl_white,0,0,\ -riw_check_boxes_text, ch_flag_bottom -riw_check_boxes_end: - -if lang eq ru_RU -riw_check_boxes_text db 'ᯮ짮 ⨢ ',0 -riw_grab_text db 'न ࠧ :',0 -else -riw_check_boxes_text db 'Use area of the active window',0 -riw_grab_text db 'Coordinates and size of the field:',0 -end if +; Language support for locales: ru_RU (CP866), en_US. + +align 4 +set_rect_window: + mov ebx,set_rect_window_procinfo + call get_slot_n + + mov [set_rect_window_slot],ecx + + set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse) + call init_rect + edit_boxes_set_sys_color rect_input,rect_input_end,sc +.red: + labels_set_sys_color rect_input_labels,rect_input_labels_end,sc + check_boxes_set_sys_color2 riw_check_boxes,riw_check_boxes_end,sc + call .draw_window +align 4 +.still: + wait_event .red,.key,.button,.mouse + +.key: + get_key + + stdcall [edit_box_key], rect_input.left + stdcall [edit_box_key], rect_input.top + stdcall [edit_box_key], rect_input.width + stdcall [edit_box_key], rect_input.height + + call read_rect + call draw_rect_on_screen + + jmp .still + +.button: + get_pressed_button + + cmp ah,1 + jne @f + btr dword [flags],3 + jmp close +@@: + + jmp .still + +.mouse: + get_active_window + cmp eax,[set_rect_window_slot] + jne .still + + stdcall [edit_box_mouse], rect_input.left + stdcall [edit_box_mouse], rect_input.top + stdcall [edit_box_mouse], rect_input.width + stdcall [edit_box_mouse], rect_input.height + +;;;;;;;;;;;;;;;;;;;;;; + stdcall [check_box_mouse], use_rect_active_window + + jmp .still + +align 4 +.draw_window: + start_draw_window + + mov edx,[sc.work] + add edx,0x33000000 + mov edi,riw_grab_text + xor esi,esi + mcall SF_CREATE_WINDOW, 100*65536+250, 100*65536+130 + + draw_labels rect_input_labels,rect_input_labels_end + + stdcall [edit_box_draw], rect_input.left + stdcall [edit_box_draw], rect_input.top + stdcall [edit_box_draw], rect_input.width + stdcall [edit_box_draw], rect_input.height +;;;;;;;;;;;;;;;;;;;;;; + stdcall [check_box_draw], use_rect_active_window + + call read_rect + call draw_rect_on_screen + + stop_draw_window +ret + +align 4 +init_rect: + bt dword [use_rect_active_window.flags],1 + jc init_rect_from_active_window +pushad + mov edi,rect_input_buffer.left + movsx eax,word[rect.left] + mov ecx,rect_input.left + call init_editbox + mov edi,rect_input_buffer.top + movsx eax,word[rect.top] + mov ecx,rect_input.top + call init_editbox + mov edi,rect_input_buffer.width + movsx eax,word[rect.width] + mov ecx,rect_input.width + call init_editbox + mov edi,rect_input_buffer.height + movsx eax,word[rect.height] + mov ecx,rect_input.height + call init_editbox +popad +ret + +align 4 +init_rect_from_active_window: + +ret + +align 4 +init_editbox: + push edi + push ecx + xor ebx,ebx + inc ebx + cmp eax,10 + jl @f + inc ebx + @@: + cmp eax,100 + jl @f + inc ebx + @@: + cmp eax,1000 + jl @f + inc ebx + @@: + call int_to_str + call [edit_box_set_text] ;ecx,edi +ret +;-------------------------------------------------------------------- +;--- 뢠 --------------------------------------------- +;-------------------------------------------------------------------- +align 4 +read_rect: + bt dword [use_rect_active_window.flags],1 + jc read_rect_from_active_window + + mov edi,rect_input_buffer.left + call zstr_to_int + cmp ax,[scr.width] + jb @f + mov ax,[scr.width] +@@: + mov [rect.left],ax + + mov edi,rect_input_buffer.top + call zstr_to_int + cmp ax,[scr.height] + jb @f + mov ax,[scr.height] +@@: + mov [rect.top],ax + + mov edi,rect_input_buffer.width + call zstr_to_int + mov bx,[scr.width] + sub bx,[rect.left] + cmp ax,bx + jb @f + mov ax,bx +@@: + mov [rect.width],ax + + mov edi,rect_input_buffer.height + call zstr_to_int + mov bx,[scr.height] + sub bx,[rect.top] + cmp ax,bx + jb @f + mov ax,bx +@@: + mov [rect.height],ax +ret + +align 4 +read_rect_from_active_window: + call get_active_window_info + + mov eax,[active_app.left] + mov [rect.left],ax + mov eax,[active_app.top] + mov [rect.top],ax + mov eax,[active_app.width] + inc eax + mov [rect.width],ax + mov eax,[active_app.height] + inc eax + mov [rect.height],ax +ret + +align 4 +draw_rect_on_screen: + + xor edx,edx + mcall SF_DRAW_RECT, 150*65536+80, 5*65536+60 + + ;movzx eax,word [rect.left] + ;mul word [scr.width] + xor edx,edx + movzx eax,word [scr.width] + mov ebx,80 + div ebx + mov ebx,eax + + xor edx,edx + movzx eax,word [rect.height] + div ebx + push ax + + xor edx,edx + movzx eax,word [rect.width] + div ebx + push ax + + xor edx,edx + movzx eax,word [rect.top] + div ebx + push ax + + xor edx,edx + movzx eax,word [rect.left] + div ebx + push ax + + pop bx + add bx,150 + shl ebx,16 + + pop cx + add cx,5 + shl ecx,16 + + pop bx + pop cx + + mcall SF_DRAW_RECT,,,0xffffff +ret + +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +;DATA + +system_dir_Boxlib db '/sys/lib/box_lib.obj',0 +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 +system_dir_LibImg db '/sys/lib/libimg.obj',0 + +;--------------------------------------------------------------------- +align 4 +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start +;OpenDialog__Version dd aOpenDialog_Version + dd 0,0 +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 +;aOpenDialog_Version db 'Version_OpenDialog',0 +;--------------------------------------------------------------------- +align 4 +Box_lib_import: +;init_lib dd a_init +;version_lib dd a_version + +edit_box_draw dd aEdit_box_draw +edit_box_key dd aEdit_box_key +edit_box_mouse dd aEdit_box_mouse +edit_box_set_text dd aEdit_box_set_text +;version_ed dd aVersion_ed + +init_checkbox dd aInit_checkbox +check_box_draw dd aCheck_box_draw +check_box_mouse dd aCheck_box_mouse +;version_ch dd aVersion_ch + +option_box_draw dd aOption_box_draw +option_box_mouse dd aOption_box_mouse +;version_op dd aVersion_op + +PathShow_prepare dd sz_PathShow_prepare +PathShow_draw dd sz_PathShow_draw +;Version_path_show dd szVersion_path_show + dd 0,0 + +;a_init db 'lib_init',0 +;a_version db 'version',0 + +aEdit_box_draw db 'edit_box_draw',0 +aEdit_box_key db 'edit_box_key',0 +aEdit_box_mouse db 'edit_box_mouse',0 +aEdit_box_set_text db 'edit_box_set_text',0 +;aVersion_ed db 'version_ed',0 + + +aInit_checkbox db 'init_checkbox2',0 +aCheck_box_draw db 'check_box_draw2',0 +aCheck_box_mouse db 'check_box_mouse2',0 +;aVersion_ch db 'version_ch2',0 + +aOption_box_draw db 'option_box_draw',0 +aOption_box_mouse db 'option_box_mouse',0 +;aVersion_op db 'version_op',0 + +sz_PathShow_prepare db 'PathShow_prepare',0 +sz_PathShow_draw db 'PathShow_draw',0 +;szVersion_path_show db 'version_PathShow',0 +;--------------------------------------------------------------------- +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw +dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 +;--------------------------------------------------------------------- +;width,left,top,color,shift_color,focus_border_color,\ +; blur_border_color,text_color,max,text,mouse_variable,flags,size,pos + +rect_input: +.left edit_box 35,95,5, cl_white,0,0,0,0,5,rect_input_buffer.left, mouse_dd1,ed_figure_only ;+ed_focus +.top edit_box 35,95,25,cl_white,0,0,0,0,5,rect_input_buffer.top, mouse_dd1,ed_figure_only +.width edit_box 35,95,45,cl_white,0,0,0,0,5,rect_input_buffer.width, mouse_dd1,ed_figure_only +.height edit_box 35,95,65,cl_white,0,0,0,0,5,rect_input_buffer.height,mouse_dd1,ed_figure_only +rect_input_end: +mouse_dd1 rd 1 +rect_input_labels: +.left label 10,10,0,rect_input_labels_text.left +.top label 10,30,0,rect_input_labels_text.top +.width label 10,50,0,rect_input_labels_text.width +.height label 10,70,0,rect_input_labels_text.height +rect_input_labels_end: + +rect_input_labels_text: +if lang eq ru_RU +.left db ' ᫥:',0 +.top db ' ᢥ:',0 +.width db 'ਭ:',0 +.height db ':',0 +else ; Default to en_US +.left db 'Left:',0 +.top db 'Top:',0 +.width db 'Width:',0 +.height db 'Height:',0 +end if + +riw_check_boxes: +use_rect_active_window check_box2 (10 shl 16)+10,(85 shl 16) +10,5,cl_white,0,0,\ +riw_check_boxes_text, ch_flag_bottom +riw_check_boxes_end: + +if lang eq ru_RU +riw_check_boxes_text db 'ᯮ짮 ⨢ ',0 +riw_grab_text db 'न ࠧ :',0 +else ; Default to en_US +riw_check_boxes_text db 'Use area of the active window',0 +riw_grab_text db 'Coordinates and size of the field:',0 +end if diff --git a/programs/media/voxel_editor/utilites/vox_creator.asm b/programs/media/voxel_editor/utilites/vox_creator.asm index 43f384207..328fc100e 100644 --- a/programs/media/voxel_editor/utilites/vox_creator.asm +++ b/programs/media/voxel_editor/utilites/vox_creator.asm @@ -1,1544 +1,1544 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1,start,i_end,mem,stacktop,openfile_path,sys_path - -include '../../../macros.inc' -include '../../../proc32.inc' -include '../../../KOSfuncs.inc' -include '../../../load_img.inc' -include '../../../load_lib.mac' -include '../trunk/str.inc' -include 'lang.inc' - -vox_offs_tree_table equ 4 -vox_offs_data equ 12 -txt_buf rb 8 -include '../trunk/vox_rotate.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -if lang eq ru_RU -caption db '⥫ ᥫ 04.05.20',0 ; -else -caption db 'Voxel creator 04.05.20',0 -end if - -BUF_STRUCT_SIZE equ 21 -buf2d_data equ dword[edi] ; ࠦ -buf2d_w equ dword[edi+8] ;ਭ -buf2d_h equ dword[edi+12] ; -buf2d_l equ word[edi+4] -buf2d_t equ word[edi+6] ; ᢥ -buf2d_size_lt equ dword[edi+4] ; ᫥ ࠢ -buf2d_color equ dword[edi+16] ;梥 䮭 -buf2d_bits equ byte[edi+20] ;⢮ 1- 窥 ࠦ - -vox_obj_size dd 0 ;ࠧ ᥫ쭮 ꥪ ( ᪮७ ⠢) -txt_space db ' ',0 -if lang eq ru_RU -txt_pref db ' ',0,' ',0,' ',0,' ',0 ;⠢: , , -txt_f_size: db ': ' -else -txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ;⠢: , , -txt_f_size: db 'Size: ' -end if -.size: rb 16 - -IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 -image_data_toolbar dd 0 - -max_open_file_size equ 1024*1024 ;1 Mb - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0x27 - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - stdcall [buf2d_create], buf_0 ;ᮧ - stdcall [buf2d_create], buf_0z - stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z - - include_image_file 'toolbar.png', image_data_toolbar - - stdcall mem.Alloc,max_open_file_size - mov dword[open_file_vox],eax - stdcall mem.Alloc,max_open_file_size - mov dword[open_file_img],eax - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - ;஢ઠ ப - cmp dword[openfile_path],0 - je @f - call but_open_file_cmd_lin - @@: - -align 4 -red_win: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,10 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - cmp eax,0 - je timer_funct - - cmp al,1 - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - - jmp still - -align 4 -timer_funct: - cmp byte[calc],0 - je still - - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ; ᪨뢠 㪠⥫ ஢ buf_npl_p, buf_npl, buf_npl_n - mov edi,buf_npl_p - mov eax,buf2d_data - mov edi,buf_npl - mov ebx,buf2d_data - mov edi,buf_npl_n - mov ecx,buf2d_data - ; change buffer data pointers - mov buf2d_data,eax - mov edi,buf_npl_p - mov buf2d_data,ebx - mov edi,buf_npl - mov buf2d_data,ecx - - mov eax,[n_plane] - mov ebx,buf2d_w - dec ebx - - cmp ebx,eax - jg @f - stdcall create_obj_from_plane,buf_npl,eax ;ᮧ 饥 祭 - ;뢮 筮 १ - call draw_object - mov byte[calc],0 - jmp .end_f - @@: - - inc eax - stdcall create_plane, buf_npl_n,eax - - ; ᮧ ᪥쭮 祭 ᭮ buf_npl - mov edi,buf_npl - mov edx,[bby_min] ;0 - .cycle_0: - mov ecx,[btx_min] ;0 - .cycle_1: - stdcall [buf2d_get_pixel], edi,ecx,edx - cmp eax,buf2d_color - je @f - mov esi,eax - call need_node - cmp eax,buf2d_color - jne @f ;ᥨ ७ ᥫ, ⨬樨 - mov eax,ebx - sub eax,edx - stdcall buf2d_vox_obj_create_node, [open_file_vox],ecx,[n_plane],\ - eax,[k_scale],esi - @@: - inc ecx - cmp ecx,ebx - jle .cycle_1 - inc edx - cmp edx,ebx - jle .cycle_0 - - stdcall [buf2d_draw], buf_npl - inc dword[n_plane] ;६頥 ᪮ 祭 - call draw_pok - .end_f: - popad - jmp still - -align 4 -proc create_plane, buf_img:dword, n_plane:dword - pushad - ; 㥬 楢 ࠦ buf_img - ; bby_min - ᯮ㥬 ⨬樨 (᫨ ᢥ ࠦ ⮥) - mov eax,[bby_min] - mov esi,buf_i2 - mov esi,[esi] ;buf2d_data - mov edi,[buf_img] - mov ecx,buf2d_w - imul eax,ecx - mov ebx,ecx - imul ecx,ebx - sub ecx,eax - lea ecx,[ecx+ecx*2] - mov edi,buf2d_data - lea eax,[eax+eax*2] - add edi,eax - add esi,eax - cld - rep movsb - - mov ecx,ebx - dec ebx - mov edi,buf_i0 - .cycle_0: - mov eax,ebx - sub eax,[n_plane] ;eax - ॢ न n_plane - stdcall [buf2d_get_pixel], edi,ecx,eax ;[n_plane] - cmp eax,buf2d_color - jne @f - ;ન ⨪쭮 祭 buf_img - stdcall [buf2d_line], [buf_img],ecx,[bby_min],ecx,ebx, buf2d_color - jmp .end_1 - @@: - mov edx,[bby_min] ;xor edx,edx - mov esi,eax - .cycle_1: ;横 孥 ⥪ - stdcall [buf2d_get_pixel], [buf_img],ecx,edx - cmp eax, buf2d_color - je .end_0 - stdcall [buf2d_set_pixel], [buf_img],ecx,edx, esi ; 孥 ⥪ - jmp .end_1 - .end_0: - inc edx - cmp edx,ebx - jle .cycle_1 - .end_1: - loop .cycle_0 - - ;ਧ⠫ ᭮ ࠭ - mov ecx,[bby_min] - mov edi,buf_i1 - .cycle_2: - stdcall [buf2d_get_pixel], edi,[n_plane],ecx - cmp eax,buf2d_color - jne @f - ;ન ਧ⠫쭮 祭 buf_img - stdcall [buf2d_line], [buf_img],[btx_min],ecx,[btx_max],ecx, buf2d_color - jmp .end_3 - @@: - mov edx,[btx_max] ;ebx - mov esi,eax - .cycle_3: ;横 ⥪ - stdcall [buf2d_get_pixel], [buf_img],edx,ecx - cmp eax, buf2d_color - je .end_2 - stdcall [buf2d_set_pixel], [buf_img],edx,ecx, esi ; ⥪ - jmp .end_3 - .end_2: - dec edx - cmp edx,[btx_min] - jge .cycle_3 - .end_3: - inc ecx - cmp ecx,ebx - jle .cycle_2 - popad - ret -endp - -align 4 -proc create_obj_from_plane, buf_img:dword, n_plane:dword -pushad - ; ᮧ ᪥쭮 祭 ᭮ buf_img - mov edi,[buf_img] - mov ebx,buf2d_w - dec ebx - mov edx,[bby_min] ;0 - .cycle_0: - mov ecx,[btx_min] ;0 - .cycle_1: - stdcall [buf2d_get_pixel], edi,ecx,edx - cmp eax,buf2d_color - je @f - mov esi,eax - ;call need_node - ;cmp eax,buf2d_color - ;jne @f ;ᥨ ७ ᥫ, ⨬樨 - mov eax,ebx - sub eax,edx - stdcall buf2d_vox_obj_create_node, [open_file_vox],ecx,[n_plane],\ - eax,[k_scale],esi - @@: - inc ecx - cmp ecx,ebx - jle .cycle_1 - inc edx - cmp edx,ebx - jle .cycle_0 - ret -popad -endp - -;description: -; 㭪 ஢ 㦭 ᥨ ᥫ न⠬ [n_plane],ecx,edx -;input: -; ebx = max size y - 1 -;output: -; eax = buf2d_color if node need -align 4 -need_node: - mov eax,buf2d_color - cmp ecx,[btx_min] ;0 - jle .end_f - cmp ecx,[btx_max] ;0 - jge .end_f - cmp edx,[bby_min] ;0 - jle .end_f - cmp edx,ebx ;max-1 - jge .end_f - push ecx edx - stdcall [buf2d_get_pixel], buf_npl_p,ecx,edx ;஢ઠ ।饣 祭 - cmp eax,buf2d_color - je @f - stdcall [buf2d_get_pixel], buf_npl_n,ecx,edx ;஢ઠ ᫥饣 祭 - cmp eax,buf2d_color - je @f - dec ecx - stdcall [buf2d_get_pixel], edi,ecx,edx - cmp eax,buf2d_color - je @f - add ecx,2 - stdcall [buf2d_get_pixel], edi,ecx,edx - cmp eax,buf2d_color - je @f - dec ecx - dec edx - stdcall [buf2d_get_pixel], edi,ecx,edx - cmp eax,buf2d_color - je @f - add edx,2 - stdcall [buf2d_get_pixel], edi,ecx,edx - ;cmp eax,buf2d_color - ;je @f - @@: - pop edx ecx - .end_f: - ret - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - ; *** ᮢ (믮 1 ࠧ ᪥) *** - mov edx,[sc.work] - or edx,(3 shl 24)+0x30000000 - mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption - - ; *** ᮧ *** - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3 - - mov ebx,(30 shl 16)+20 - mov edx,4 - int 0x40 - - mov ebx,(55 shl 16)+20 - mov edx,5 - int 0x40 - - mov ebx,(85 shl 16)+20 - mov edx,6 - int 0x40 - - add ebx,25 shl 16 - mov edx,7 - int 0x40 - - add ebx,25 shl 16 - mov edx,8 - int 0x40 - - add ebx,25 shl 16 - mov edx,9 - int 0x40 - - add ebx,25 shl 16 - mov edx,10 - int 0x40 - - add ebx,25 shl 16 - mov edx,11 - int 0x40 - - add ebx,25 shl 16 - mov edx,12 - int 0x40 - - ; *** ᮢ *** - mov edx,(7 shl 16)+7 ;icon new - mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon open - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon save - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(30 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - - call draw_buffers - call draw_pok - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -draw_buffers: - ; *** ᮢ *** - stdcall [buf2d_draw], buf_0 - stdcall [buf2d_draw], buf_i0 - stdcall [buf2d_draw], buf_i1 - stdcall [buf2d_draw], buf_i2 - ret - -align 4 -draw_pok: - ; ࠧ 䠩 - mov edi,txt_f_size.size - mov eax,dword[vox_obj_size] - mov ebx,txt_pref - .cycle: - cmp eax,1024 - jl @f - shr eax,10 - add ebx,4 - jmp .cycle - @@: - - stdcall convert_int_to_str, 16 - stdcall str_cat, edi,ebx - stdcall str_cat, edi,txt_space ;騩 ஡ - - ;ᮢ ⥪ - mov ecx,[sc.work_text] - or ecx,0x80000000 or (1 shl 30) - mov edi,[sc.work] ;梥 䮭 - mcall SF_DRAW_TEXT,(275 shl 16)+7,,txt_f_size - - ret - -align 4 -key: - mcall SF_GET_KEY - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file ;⨥ ᥫ쭮 䠩 - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_1 - jmp still - @@: - cmp ah,7 - jne @f - call but_2 - jmp still - @@: - cmp ah,8 - jne @f - call but_3 - jmp still - @@: - cmp ah,9 - jne @f - stdcall but_run, 0 - jmp still - @@: - cmp ah,10 - jne @f - stdcall but_run, 1 - jmp still - @@: - cmp ah,11 - jne @f - call but_stop - jmp still - @@: - cmp ah,12 - jne @f - call but_rot_z - jmp still - @@: - cmp ah,1 - jne still -.exit: - stdcall [buf2d_delete],buf_0 - stdcall [buf2d_delete],buf_0z - stdcall [buf2d_vox_brush_delete],buf_vox - stdcall [buf2d_delete],buf_i0 - stdcall [buf2d_delete],buf_i1 - stdcall [buf2d_delete],buf_i2 - stdcall [buf2d_delete],buf_npl_p - stdcall [buf2d_delete],buf_npl - stdcall [buf2d_delete],buf_npl_n - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_vox] - stdcall mem.Free,[open_file_img] - mcall SF_TERMINATE_PROCESS - - -align 4 -vox_new_data: - db 2,0,0,0 - db 000b,001b,010b,011b, 100b,101b,110b,111b ;default table - dd 0 ;null node - -align 4 -proc but_new_file uses ecx edi esi - mov ecx,vox_offs_data+4 - mov [vox_obj_size],ecx - mov esi,vox_new_data - mov edi,[open_file_vox] - cld - rep movsb - ret -endp - -align 4 -open_file_vox dd 0 ;㪠⥫ 䠩 -open_file_img dd 0 ;㪠⥫ ⥪ - -align 4 -but_open_file: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je @f - ; 㤠筮 ⨨ - call but_open_file_cmd_lin - @@: -popad - ret - -align 4 -but_open_file_cmd_lin: -pushad - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov [run_file_70.Count], dword max_open_file_size - m2m [run_file_70.Buffer],dword[open_file_vox] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_open_file - ; ஢ઠ ࠢ쭮 ᥫ쭮 ଠ - mov edi,[open_file_vox] - add edi,vox_offs_tree_table - xor bx,bx - mov ecx,8 - cld - @@: - movzx ax,byte[edi] - add bx,ax - inc edi - loop @b - cmp bx,28 ;28=0+1+2+...+7 - jne .err_open - - mcall SF_SET_CAPTION,1,openfile_path - stdcall buf2d_vox_obj_get_size,[open_file_vox] - mov [vox_obj_size],eax - call draw_object - - jmp .end_open_file - .err_open: - call but_new_file - stdcall [mb_create],msgbox_4,thread - .end_open_file: - popad - ret - -align 4 -but_save_file: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_save_file - ; 㤠筮 ⨨ - - mov eax,6 ;dword[v_zoom] ; ⠡ 㬮砭 - mov ebx,[open_file_vox] - mov byte[ebx],al - - stdcall buf2d_vox_obj_get_size, ebx - mov dword[run_file_70.Count], eax ;ࠧ 䠩 - mov [run_file_70.Function], SSF_CREATE_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov ebx, dword[open_file_vox] - mov [run_file_70.Buffer], ebx - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_save_file - - .end_save_file: - popad - ret - -align 4 -but_1: - stdcall open_image_in_buf, buf_i0 - ret - -align 4 -but_2: - stdcall open_image_in_buf, buf_i1 - call set_buf_tabs - ret - -align 4 -but_3: - stdcall open_image_in_buf, buf_i2 - call set_buf_tabs - ret - -;description: -; ᨬ ਭ 1- ⠭ 2- 3- ஢ -align 4 -set_buf_tabs: -push eax ebx edi - mov edi,buf_i0 - cmp buf2d_data,0 - je @f - movzx eax,buf2d_l - mov ebx,buf2d_w - cmp ebx,128 - jle .end_0 - mov ebx,128 - .end_0: - mov edi,buf_i1 - mov buf2d_l,ax - add buf2d_l,bx - add buf2d_l,2 - shl ebx,1 - mov edi,buf_i2 - mov buf2d_l,ax - add buf2d_l,bx - add buf2d_l,4 - @@: -pop edi ebx eax - ret - -align 4 -get_scale: -push eax edi - mov edi,buf_i0 - mov eax,buf2d_w - - mov dword[k_scale],-1 - .cycle_s: - cmp eax,0 - je @f - shr eax,1 - inc dword[k_scale] - jmp .cycle_s - @@: -pop edi eax - ret - -align 4 -proc set_borders uses eax ebx ecx edx edi - mov ecx,dword[k_scale] - mov edx,1 - shl edx,cl - - ;।塞 न y 楢 ࠭ - mov edi,buf_i2 - mov dword[bby_min],0 - xor ecx,ecx - .cycle_0: - xor ebx,ebx - .cycle_1: - stdcall [buf2d_get_pixel],edi,ebx,ecx - cmp eax,buf2d_color - jne @f - inc ebx - cmp ebx,edx - jl .cycle_1 - inc dword[bby_min] - inc ecx - cmp ecx,edx - jl .cycle_0 - @@: - - ;।塞 न x 楢 ࠭ - mov dword[btx_min],0 - xor ebx,ebx - .cycle_2: - mov ecx,[bby_min] - .cycle_3: - stdcall [buf2d_get_pixel],edi,ebx,ecx - cmp eax,buf2d_color - jne @f - inc ecx - cmp ecx,edx - jl .cycle_3 - inc dword[btx_min] - inc ebx - cmp ebx,edx - jl .cycle_2 - @@: - - ;।塞 ᨬ न x 楢 ࠭ - mov [btx_max],edx - dec dword[btx_max] - mov ebx,[btx_max] - .cycle_4: - mov ecx,[bby_min] - .cycle_5: - stdcall [buf2d_get_pixel],edi,ebx,ecx - cmp eax,buf2d_color - jne @f - inc ecx - cmp ecx,edx - jl .cycle_5 - dec dword[btx_max] - dec ebx - cmp ebx,[btx_min] - jg .cycle_4 - @@: - - ;stdcall [buf2d_line], edi, 0,[bby_min],50,[bby_min],255 - ret -endp - -align 4 -btx_min dd 0 ; 孨 . x -btx_max dd 0 -bty_min dd 0 ; 孨 . y -bty_max dd 0 -;bbx_min dd 0 -;bbx_max dd 0 -bby_min dd 0 ; . y -bby_max dd 0 -k_scale dd 0 -n_plane dd 0 - -calc db 0 ;᫨ =1, ᮧ ꥪ - -; ᮧ ᥫ 3 ⠯: -; 1) 饬 ॢ, 㤠 ⠢ (᫨ , 2- ⠯ ய᪠) -; 2) ⠢塞 ᥫ (3- ⠯ 㦥 ) -; 3) 塞 梥 ᥫ -align 4 -proc buf2d_vox_obj_create_node, v_obj:dword,coord_x:dword,coord_y:dword,\ -coord_z:dword,k_scale:dword,color:dword -pushad -locals - p_node dd 0 ;த⥫᪨ 㧥 -endl - - mov edi,[v_obj] - add edi,vox_offs_data - mov esi,[k_scale] - cmp esi,1 - jl .change - ; *** (1) *** - .found: - stdcall vox_obj_get_node_position, [v_obj],[coord_x],[coord_y],[coord_z],esi - movzx bx,byte[edi+3] - mov [p_node],edi - add edi,4 - - cmp eax,0 - je .end_1 - mov ecx,eax - cld - @@: ;横 ய᪠ । ॢ쥢 㧫 - bt bx,0 ;஢塞 ୨ 㧫 - jnc .end_0 - xor eax,eax - stdcall vox_obj_rec0 ; eax ᫮ ୨ 㧫, ⢨ - .end_0: - shr bx,1 - loop @b - .end_1: - bt bx,0 - jnc .creat ;᫨ ॢ , 室 ᮧ - dec esi - cmp esi,0 - jg .found - jmp .change - - ; *** (2) *** - .creat: - mov edx,[color] ;塞 梥 - and edx,0xffffff ; 䨫⨪ - mov ecx,esi - stdcall vox_obj_add_nodes_mem, [v_obj],edi,ecx ;塞 ꥪ⮬, 㧫 - mov ebx,[p_node] - cld - @@: - mov dword[edi],edx - stdcall vox_obj_get_node_bit_mask, [v_obj],[coord_x],[coord_y],[coord_z],esi - or byte[ebx+3],al - - mov ebx,edi - add edi,4 - dec esi - loop @b - jmp .end_2 - - ; *** (3) *** - .change: - mov eax,[color] ;塞 梥 - mov word[edi],ax - shr eax,16 - mov byte[edi+2],al - - .end_2: -popad - ret -endp - -; ᤢ 㧫 㧫 -;input: -; p_insert - ⠢ -; count - ⢮ ⠢塞 㧫 -align 4 -proc vox_obj_add_nodes_mem uses eax ecx edi esi, v_obj:dword,p_insert:dword,count:dword - mov esi,[v_obj] - ;stdcall buf2d_vox_obj_get_size,esi - add esi,[vox_obj_size] ;esi - 㪠⥫ 䠩 - mov edi,[count] - shl edi,2 - add [vox_obj_size],edi - add edi,esi ;edi - 㪠⥫ 騩 䠩 - mov ecx,esi - sub ecx,[p_insert] - shr ecx,2 ;ecx - ᫮ 横 ஢ - sub esi,4 ;esi - 㪠⥫ ᫥ 㧥 - sub edi,4 ;edi - 㪠⥫ 騩 ᫥ 㧥 - std - rep movsd ;ᤢ - ret -endp - -;??? -; । 樨 㧫 ॢ ( 0 7) -align 4 -proc vox_obj_get_node_position uses ebx ecx edi, v_obj:dword,\ -coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword - mov ecx,[k_scale] - dec ecx - mov eax,[coord_x] - mov ebx,[coord_y] - mov edi,[coord_z] - cmp ecx,1 - jl .end_0 - shr eax,cl - shr ebx,cl - shr edi,cl - .end_0: - and eax,1 - bt ebx,0 - jnc @f - bts eax,1 - @@: - bt edi,0 - jnc @f - bts eax,2 - @@: - - mov edi,[v_obj] - add edi,vox_offs_tree_table - @@: - cmp al,byte[edi] - je @f - inc edi - jmp @b - @@: - sub edi,[v_obj] - sub edi,vox_offs_tree_table - mov eax,edi - - ret -endp - -;??? -;input: -; edi - 㪠⥫ ᥫ쭮 ꥪ -;output: -; eax - eax + ᫮ 㧫 . ꥪ -; edi - 㪠⥫ ᬥ饭 . ꥪ -align 4 -proc vox_obj_rec0 - inc eax - cmp byte[edi+3],0 ;ᬮਬ ॢ - je .sub_trees - - ;४ᨢ ॡ ॢ쥢 - push ebx ecx - mov bh,byte[edi+3] - add edi,4 - mov bl,8 - .cycle: - bt bx,8 ;㥬 ⮫쪮 bh - jnc .c_next - stdcall vox_obj_rec0 - .c_next: - shr bh,1 - dec bl - jnz .cycle - pop ecx ebx - - jmp .end_f - .sub_trees: - add edi,4 - .end_f: - ret -endp - -;output: -; eax - 1,2,4,8,16, ... ,128 -align 4 -proc vox_obj_get_node_bit_mask uses ebx ecx edi, v_obj:dword,\ -coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword - mov ecx,[k_scale] - dec ecx - mov eax,[coord_x] - mov ebx,[coord_y] - mov edi,[coord_z] - cmp ecx,1 - jl .end_0 - shr eax,cl - shr ebx,cl - shr edi,cl - .end_0: - and eax,1 - bt ebx,0 - jnc @f - bts eax,1 - @@: - bt edi,0 - jnc @f - bts eax,2 - @@: - - mov ecx,[v_obj] - add ecx,vox_offs_tree_table - @@: - cmp al,byte[ecx] - je @f - inc ecx - jmp @b - @@: - mov eax,1 ;⠭ ࢮ砫쭮 祭 - sub ecx,[v_obj] - sub ecx,vox_offs_tree_table - jz @f - shl eax,cl ;ᤢ - @@: - - ret -endp - -;output: -; eax - ࠧ ꥪ⮬ v_obj -align 4 -proc buf2d_vox_obj_get_size uses edi, v_obj:dword - mov edi,[v_obj] - add edi,vox_offs_data - xor eax,eax - stdcall vox_obj_rec0 ;eax - ᫮ 㧫 ꥪ v_obj - shl eax,2 - add eax,vox_offs_data - ret -endp - -;input: -; mode_add - ᫨ ࠢ 0 ⮣ ᮧ ० ᥫ -align 4 -proc but_run uses eax ebx edi, mode_add:dword - ; ஢ઠ ࠧ஢ ࠦ (⥪) - mov edi,buf_i0 - mov ebx,buf2d_h - cmp ebx,2 - jle .err_size_t - cmp buf2d_w,ebx - jne .err_size_t - ; - mov edi,buf_i1 - cmp ebx,buf2d_h - jne .err_size_tb - mov ebx,buf2d_h - cmp ebx,2 - jle .err_size_b - cmp buf2d_w,ebx - jne .err_size_b - - cmp dword[vox_obj_size],vox_offs_data - jl .n_file ;᫨ ࠭ 뫮 䠩 - cmp dword[mode_add],0 - jne @f - .n_file: - call but_new_file - @@: - - mov edi,buf_i0 - mov eax,buf2d_w - mov edi,buf_npl - cmp buf2d_data,0 - jne @f - ; *** ᮧ - m2m buf2d_w,eax - m2m buf2d_h,eax - stdcall [buf2d_create],edi - mov edi,buf_npl_p - m2m buf2d_w,eax - m2m buf2d_h,eax - stdcall [buf2d_create],edi - mov edi,buf_npl_n - m2m buf2d_w,eax - m2m buf2d_h,eax - stdcall [buf2d_create],edi - jmp .end_0 - @@: - ; *** 塞 ࠧ ஢ - stdcall [buf2d_resize], edi, eax,eax,1 - mov edi,buf_npl_p - stdcall [buf2d_resize], edi, eax,eax,1 - mov edi,buf_npl_n - stdcall [buf2d_resize], edi, eax,eax,1 - .end_0: - mov dword[n_plane],1 - mov byte[calc],1 - call get_scale - call set_borders - - stdcall create_plane,buf_npl,0 - stdcall create_plane,buf_npl_n,1 - stdcall create_obj_from_plane,buf_npl,0 ;ᮧ 砫쭮 祭 - - jmp @f - .err_size_t: - stdcall [mb_create],msgbox_0,thread - jmp @f - .err_size_b: - stdcall [mb_create],msgbox_1,thread - jmp @f - .err_size_tb: - stdcall [mb_create],msgbox_3,thread - ;jmp @f - @@: - ret -endp - -;४ ᮧ ꥪ -align 4 -but_stop: - cmp byte[calc],0 - je @f - call draw_object - mov byte[calc],0 - @@: - ret - -align 4 -but_rot_z: - stdcall vox_obj_rot_z, [open_file_vox] - call draw_object - ret - -align 4 -draw_object: - ;뢮 १ ࠭ - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - stdcall [buf2d_clear], buf_0z, 0 ;⨬ - stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox,\ - [open_file_vox], 0,0, 0, 6 ;[k_scale] - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -align 4 -proc open_image_in_buf, buf:dword - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_open_file - - ;stdcall mem.Alloc, dword size ;뤥塞 ࠦ - ;mov [buf],eax - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov [run_file_70.Count], dword max_open_file_size - m2m [run_file_70.Buffer],dword[open_file_img] - mov byte[run_file_70+20], 0 - mov [run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_0 - ;।塞 ࠦ - stdcall dword[img_decode], dword[open_file_img],ebx,0 - or eax,eax - jz .end_0 ;᫨ 襭 ଠ 䠩 - mov ebx,[eax+4] ;+4 = image width - cmp ebx,[eax+8] ;+8 = image height - jne .err_s0 - mov ebx,eax - ;८ࠧ㥬 ࠦ ଠ rgb - stdcall dword[img_to_rgb2], ebx,dword[open_file_img] - - mov edi,[buf] - cmp buf2d_data,0 - jne @f - m2m buf2d_w,dword[ebx+4] ;+4 = image width - m2m buf2d_h,dword[ebx+8] ;+8 = image height - stdcall [buf2d_create_f_img], edi,[open_file_img] - jmp .end_1 - @@: - mov ecx,[ebx+8] - stdcall [buf2d_resize], edi, [ebx+4],ecx,1 ;塞 ࠧ - imul ecx,[ebx+4] - lea ecx,[ecx+ecx*2] - mov edi,buf2d_data - mov esi,[open_file_img] - cld - rep movsb ;copy image - jmp .end_1 - .err_s0: ;訡, ࠦ ८ࠧ 室 ( ⭮) - mov ebx,eax - notify_window_run txt_img_not_square - .end_1: - ;㤠塞 ६ ebx - stdcall dword[img_destroy], ebx - .end_0: - - call draw_buffers - .end_open_file: - popad - ret -endp - -msgbox_0: - db 1,0 - db '',0 - db ' 孥 ࠦ ४',0 - db '',0 - db 0 - -msgbox_1: - db 1,0 - db '',0 - db ' ࠦ ४',0 - db '',0 - db 0 - -msgbox_2: - db 1,0 - db '',0 - db ' । ࠦ ४',0 - db '',0 - db 0 - -msgbox_3: - db 1,0 - db '',0 - db ' 孥 ࠦ ᮢ',13,\ - 'ன ࠦ ࠧ஢',0 - db '',0 - db 0 - -msgbox_4: - db 1,0 - db '',0 - db '뢠 䠩 ᮤন ᥫ ଠ',0 - db '',0 - db 0 - -txt_img_not_square db '"',13,10,'뢠 ࠦ ⭮" -tW',0 - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter ;.1 -.1: -db 'PNG',0 -db 'JPG',0 -db 'JPEG',0 -db 'BMP',0 -db 'GIF',0 -db 'VOX',0 -.end: -db 0 - - - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'buf2d.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'msgbox.obj',0 - -align 4 -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_msgbox_lib -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw - - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - -align 4 -import_buf2d: - init dd sz_init - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_resize dd sz_buf2d_resize - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_curve_bezier dd sz_buf2d_curve_bezier - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_flood_fill dd sz_buf2d_flood_fill - buf2d_set_pixel dd sz_buf2d_set_pixel - buf2d_get_pixel dd sz_buf2d_get_pixel - buf2d_vox_brush_create dd sz_buf2d_vox_brush_create - buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete - buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g - buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g - buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g - buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g - buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled - buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows - buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl - buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled - dd 0,0 - sz_init db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_resize db 'buf2d_resize',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_flood_fill db 'buf2d_flood_fill',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - sz_buf2d_get_pixel db 'buf2d_get_pixel',0 - sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 - sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 - sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 - sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 - sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 - sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 - sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 - sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 - sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 - sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 - -align 4 -import_msgbox_lib: - mb_create dd amb_create -; mb_reinit dd amb_reinit -; mb_setfunctions dd amb_setfunctions -dd 0,0 - amb_create db 'mb_create',0 -; amb_reinit db 'mb_reinit',0 -; amb_setfunctions db 'mb_setfunctions',0 - -align 4 -buf_0: dd 0 - dw 5 ;+4 left - dw 35 ;+6 top -.w: dd 6*64 ;+8 w -.h: dd 7*64 ;+12 h -.color: dd 0xffffff ;+16 color - db 24 ;+20 bit in pixel - -align 4 -buf_0z: dd 0 - dw 5 ;+4 left - dw 35 ;+6 top -.w: dd 6*64 ;+8 w -.h: dd 7*64 ;+12 h -.color: dd 0 ;+16 color - db 32 ;+20 bit in pixel - -;⥪ 1 () -align 4 -buf_i0: dd 0 - dw 5 ;+4 left - dw 35 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -;⥪ 2 -align 4 -buf_i1: dd 0 - dw 105 ;+4 left - dw 35 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -;⥪ 3 -align 4 -buf_i2: dd 0 - dw 205 ;+4 left - dw 35 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -; ᮧ ᯮ 3 祭: -; ।饥, ⥪饥, ᫥饥 ( 室 ᥨ ᥫ ꥪ) - -;।饥 祭 -align 4 -buf_npl_p: dd 0 - dw 0 ;+4 left - dw 0 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -;⥪饥 祭 -align 4 -buf_npl: dd 0 - dw 5 ;+4 left - dw 35 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -;᫥饥 祭 -align 4 -buf_npl_n: dd 0 - dw 0 ;+4 left - dw 0 ;+6 top -.w: dd 0 ;+8 w -.h: dd 0 ;+12 h -.color: dd 0 ;+16 color - db 24 ;+20 bit in pixel - -; ᮧ 쭮 筮 ᥫ -align 4 -vox_6_7_z: -dd 0,0,1,1,0,0,\ - 0,2,2,2,2,0,\ - 2,2,2,2,2,2,\ - 2,3,2,2,3,2,\ - 2,3,3,3,3,2,\ - 0,3,3,3,3,0,\ - 0,0,3,3,0,0 - -align 4 -buf_vox: - db 6,7,4,3 ;w,h,h_osn,n - rb BUF_STRUCT_SIZE*(2+1) - - -align 16 -i_end: - procinfo process_information - sc system_colors - run_file_70 FileInfoBlock - mouse_dd dd ? - last_time dd ? - rb 2048 - thread: - rb 2048 -stacktop: - sys_path rb 1024 - file_name rb 2048 ;4096 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1,start,i_end,mem,stacktop,openfile_path,sys_path + +include '../../../macros.inc' +include '../../../proc32.inc' +include '../../../KOSfuncs.inc' +include '../../../load_img.inc' +include '../../../load_lib.mac' +include '../trunk/str.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +vox_offs_tree_table equ 4 +vox_offs_data equ 12 +txt_buf rb 8 +include '../trunk/vox_rotate.inc' + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load +if lang eq ru_RU +caption db '⥫ ᥫ 04.05.20',0 ; +else ; Default to en_US +caption db 'Voxel creator 04.05.20',0 +end if + +BUF_STRUCT_SIZE equ 21 +buf2d_data equ dword[edi] ; ࠦ +buf2d_w equ dword[edi+8] ;ਭ +buf2d_h equ dword[edi+12] ; +buf2d_l equ word[edi+4] +buf2d_t equ word[edi+6] ; ᢥ +buf2d_size_lt equ dword[edi+4] ; ᫥ ࠢ +buf2d_color equ dword[edi+16] ;梥 䮭 +buf2d_bits equ byte[edi+20] ;⢮ 1- 窥 ࠦ + +vox_obj_size dd 0 ;ࠧ ᥫ쭮 ꥪ ( ᪮७ ⠢) +txt_space db ' ',0 +if lang eq ru_RU +txt_pref db ' ',0,' ',0,' ',0,' ',0 ;⠢: , , +txt_f_size: db ': ' +else ; Default to en_US +txt_pref db ' b ',0,' Kb',0,' Mb',0,' Gb',0 ;⠢: , , +txt_f_size: db 'Size: ' +end if +.size: rb 16 + +IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 +image_data_toolbar dd 0 + +max_open_file_size equ 1024*1024 ;1 Mb + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0x27 + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + stdcall [buf2d_create], buf_0 ;ᮧ + stdcall [buf2d_create], buf_0z + stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z + + include_image_file 'toolbar.png', image_data_toolbar + + stdcall mem.Alloc,max_open_file_size + mov dword[open_file_vox],eax + stdcall mem.Alloc,max_open_file_size + mov dword[open_file_img],eax + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + ;஢ઠ ப + cmp dword[openfile_path],0 + je @f + call but_open_file_cmd_lin + @@: + +align 4 +red_win: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,10 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + cmp eax,0 + je timer_funct + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + + jmp still + +align 4 +timer_funct: + cmp byte[calc],0 + je still + + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ; ᪨뢠 㪠⥫ ஢ buf_npl_p, buf_npl, buf_npl_n + mov edi,buf_npl_p + mov eax,buf2d_data + mov edi,buf_npl + mov ebx,buf2d_data + mov edi,buf_npl_n + mov ecx,buf2d_data + ; change buffer data pointers + mov buf2d_data,eax + mov edi,buf_npl_p + mov buf2d_data,ebx + mov edi,buf_npl + mov buf2d_data,ecx + + mov eax,[n_plane] + mov ebx,buf2d_w + dec ebx + + cmp ebx,eax + jg @f + stdcall create_obj_from_plane,buf_npl,eax ;ᮧ 饥 祭 + ;뢮 筮 १ + call draw_object + mov byte[calc],0 + jmp .end_f + @@: + + inc eax + stdcall create_plane, buf_npl_n,eax + + ; ᮧ ᪥쭮 祭 ᭮ buf_npl + mov edi,buf_npl + mov edx,[bby_min] ;0 + .cycle_0: + mov ecx,[btx_min] ;0 + .cycle_1: + stdcall [buf2d_get_pixel], edi,ecx,edx + cmp eax,buf2d_color + je @f + mov esi,eax + call need_node + cmp eax,buf2d_color + jne @f ;ᥨ ७ ᥫ, ⨬樨 + mov eax,ebx + sub eax,edx + stdcall buf2d_vox_obj_create_node, [open_file_vox],ecx,[n_plane],\ + eax,[k_scale],esi + @@: + inc ecx + cmp ecx,ebx + jle .cycle_1 + inc edx + cmp edx,ebx + jle .cycle_0 + + stdcall [buf2d_draw], buf_npl + inc dword[n_plane] ;६頥 ᪮ 祭 + call draw_pok + .end_f: + popad + jmp still + +align 4 +proc create_plane, buf_img:dword, n_plane:dword + pushad + ; 㥬 楢 ࠦ buf_img + ; bby_min - ᯮ㥬 ⨬樨 (᫨ ᢥ ࠦ ⮥) + mov eax,[bby_min] + mov esi,buf_i2 + mov esi,[esi] ;buf2d_data + mov edi,[buf_img] + mov ecx,buf2d_w + imul eax,ecx + mov ebx,ecx + imul ecx,ebx + sub ecx,eax + lea ecx,[ecx+ecx*2] + mov edi,buf2d_data + lea eax,[eax+eax*2] + add edi,eax + add esi,eax + cld + rep movsb + + mov ecx,ebx + dec ebx + mov edi,buf_i0 + .cycle_0: + mov eax,ebx + sub eax,[n_plane] ;eax - ॢ न n_plane + stdcall [buf2d_get_pixel], edi,ecx,eax ;[n_plane] + cmp eax,buf2d_color + jne @f + ;ન ⨪쭮 祭 buf_img + stdcall [buf2d_line], [buf_img],ecx,[bby_min],ecx,ebx, buf2d_color + jmp .end_1 + @@: + mov edx,[bby_min] ;xor edx,edx + mov esi,eax + .cycle_1: ;横 孥 ⥪ + stdcall [buf2d_get_pixel], [buf_img],ecx,edx + cmp eax, buf2d_color + je .end_0 + stdcall [buf2d_set_pixel], [buf_img],ecx,edx, esi ; 孥 ⥪ + jmp .end_1 + .end_0: + inc edx + cmp edx,ebx + jle .cycle_1 + .end_1: + loop .cycle_0 + + ;ਧ⠫ ᭮ ࠭ + mov ecx,[bby_min] + mov edi,buf_i1 + .cycle_2: + stdcall [buf2d_get_pixel], edi,[n_plane],ecx + cmp eax,buf2d_color + jne @f + ;ન ਧ⠫쭮 祭 buf_img + stdcall [buf2d_line], [buf_img],[btx_min],ecx,[btx_max],ecx, buf2d_color + jmp .end_3 + @@: + mov edx,[btx_max] ;ebx + mov esi,eax + .cycle_3: ;横 ⥪ + stdcall [buf2d_get_pixel], [buf_img],edx,ecx + cmp eax, buf2d_color + je .end_2 + stdcall [buf2d_set_pixel], [buf_img],edx,ecx, esi ; ⥪ + jmp .end_3 + .end_2: + dec edx + cmp edx,[btx_min] + jge .cycle_3 + .end_3: + inc ecx + cmp ecx,ebx + jle .cycle_2 + popad + ret +endp + +align 4 +proc create_obj_from_plane, buf_img:dword, n_plane:dword +pushad + ; ᮧ ᪥쭮 祭 ᭮ buf_img + mov edi,[buf_img] + mov ebx,buf2d_w + dec ebx + mov edx,[bby_min] ;0 + .cycle_0: + mov ecx,[btx_min] ;0 + .cycle_1: + stdcall [buf2d_get_pixel], edi,ecx,edx + cmp eax,buf2d_color + je @f + mov esi,eax + ;call need_node + ;cmp eax,buf2d_color + ;jne @f ;ᥨ ७ ᥫ, ⨬樨 + mov eax,ebx + sub eax,edx + stdcall buf2d_vox_obj_create_node, [open_file_vox],ecx,[n_plane],\ + eax,[k_scale],esi + @@: + inc ecx + cmp ecx,ebx + jle .cycle_1 + inc edx + cmp edx,ebx + jle .cycle_0 + ret +popad +endp + +;description: +; 㭪 ஢ 㦭 ᥨ ᥫ न⠬ [n_plane],ecx,edx +;input: +; ebx = max size y - 1 +;output: +; eax = buf2d_color if node need +align 4 +need_node: + mov eax,buf2d_color + cmp ecx,[btx_min] ;0 + jle .end_f + cmp ecx,[btx_max] ;0 + jge .end_f + cmp edx,[bby_min] ;0 + jle .end_f + cmp edx,ebx ;max-1 + jge .end_f + push ecx edx + stdcall [buf2d_get_pixel], buf_npl_p,ecx,edx ;஢ઠ ।饣 祭 + cmp eax,buf2d_color + je @f + stdcall [buf2d_get_pixel], buf_npl_n,ecx,edx ;஢ઠ ᫥饣 祭 + cmp eax,buf2d_color + je @f + dec ecx + stdcall [buf2d_get_pixel], edi,ecx,edx + cmp eax,buf2d_color + je @f + add ecx,2 + stdcall [buf2d_get_pixel], edi,ecx,edx + cmp eax,buf2d_color + je @f + dec ecx + dec edx + stdcall [buf2d_get_pixel], edi,ecx,edx + cmp eax,buf2d_color + je @f + add edx,2 + stdcall [buf2d_get_pixel], edi,ecx,edx + ;cmp eax,buf2d_color + ;je @f + @@: + pop edx ecx + .end_f: + ret + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + ; *** ᮢ (믮 1 ࠧ ᪥) *** + mov edx,[sc.work] + or edx,(3 shl 24)+0x30000000 + mcall SF_CREATE_WINDOW,(20 shl 16)+410,(20 shl 16)+520,,,caption + + ; *** ᮧ *** + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3 + + mov ebx,(30 shl 16)+20 + mov edx,4 + int 0x40 + + mov ebx,(55 shl 16)+20 + mov edx,5 + int 0x40 + + mov ebx,(85 shl 16)+20 + mov edx,6 + int 0x40 + + add ebx,25 shl 16 + mov edx,7 + int 0x40 + + add ebx,25 shl 16 + mov edx,8 + int 0x40 + + add ebx,25 shl 16 + mov edx,9 + int 0x40 + + add ebx,25 shl 16 + mov edx,10 + int 0x40 + + add ebx,25 shl 16 + mov edx,11 + int 0x40 + + add ebx,25 shl 16 + mov edx,12 + int 0x40 + + ; *** ᮢ *** + mov edx,(7 shl 16)+7 ;icon new + mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon open + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon save + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + + call draw_buffers + call draw_pok + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +draw_buffers: + ; *** ᮢ *** + stdcall [buf2d_draw], buf_0 + stdcall [buf2d_draw], buf_i0 + stdcall [buf2d_draw], buf_i1 + stdcall [buf2d_draw], buf_i2 + ret + +align 4 +draw_pok: + ; ࠧ 䠩 + mov edi,txt_f_size.size + mov eax,dword[vox_obj_size] + mov ebx,txt_pref + .cycle: + cmp eax,1024 + jl @f + shr eax,10 + add ebx,4 + jmp .cycle + @@: + + stdcall convert_int_to_str, 16 + stdcall str_cat, edi,ebx + stdcall str_cat, edi,txt_space ;騩 ஡ + + ;ᮢ ⥪ + mov ecx,[sc.work_text] + or ecx,0x80000000 or (1 shl 30) + mov edi,[sc.work] ;梥 䮭 + mcall SF_DRAW_TEXT,(275 shl 16)+7,,txt_f_size + + ret + +align 4 +key: + mcall SF_GET_KEY + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file ;⨥ ᥫ쭮 䠩 + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_1 + jmp still + @@: + cmp ah,7 + jne @f + call but_2 + jmp still + @@: + cmp ah,8 + jne @f + call but_3 + jmp still + @@: + cmp ah,9 + jne @f + stdcall but_run, 0 + jmp still + @@: + cmp ah,10 + jne @f + stdcall but_run, 1 + jmp still + @@: + cmp ah,11 + jne @f + call but_stop + jmp still + @@: + cmp ah,12 + jne @f + call but_rot_z + jmp still + @@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall [buf2d_delete],buf_0z + stdcall [buf2d_vox_brush_delete],buf_vox + stdcall [buf2d_delete],buf_i0 + stdcall [buf2d_delete],buf_i1 + stdcall [buf2d_delete],buf_i2 + stdcall [buf2d_delete],buf_npl_p + stdcall [buf2d_delete],buf_npl + stdcall [buf2d_delete],buf_npl_n + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_vox] + stdcall mem.Free,[open_file_img] + mcall SF_TERMINATE_PROCESS + + +align 4 +vox_new_data: + db 2,0,0,0 + db 000b,001b,010b,011b, 100b,101b,110b,111b ;default table + dd 0 ;null node + +align 4 +proc but_new_file uses ecx edi esi + mov ecx,vox_offs_data+4 + mov [vox_obj_size],ecx + mov esi,vox_new_data + mov edi,[open_file_vox] + cld + rep movsb + ret +endp + +align 4 +open_file_vox dd 0 ;㪠⥫ 䠩 +open_file_img dd 0 ;㪠⥫ ⥪ + +align 4 +but_open_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je @f + ; 㤠筮 ⨨ + call but_open_file_cmd_lin + @@: +popad + ret + +align 4 +but_open_file_cmd_lin: +pushad + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov [run_file_70.Count], dword max_open_file_size + m2m [run_file_70.Buffer],dword[open_file_vox] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_open_file + ; ஢ઠ ࠢ쭮 ᥫ쭮 ଠ + mov edi,[open_file_vox] + add edi,vox_offs_tree_table + xor bx,bx + mov ecx,8 + cld + @@: + movzx ax,byte[edi] + add bx,ax + inc edi + loop @b + cmp bx,28 ;28=0+1+2+...+7 + jne .err_open + + mcall SF_SET_CAPTION,1,openfile_path + stdcall buf2d_vox_obj_get_size,[open_file_vox] + mov [vox_obj_size],eax + call draw_object + + jmp .end_open_file + .err_open: + call but_new_file + stdcall [mb_create],msgbox_4,thread + .end_open_file: + popad + ret + +align 4 +but_save_file: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ; 㤠筮 ⨨ + + mov eax,6 ;dword[v_zoom] ; ⠡ 㬮砭 + mov ebx,[open_file_vox] + mov byte[ebx],al + + stdcall buf2d_vox_obj_get_size, ebx + mov dword[run_file_70.Count], eax ;ࠧ 䠩 + mov [run_file_70.Function], SSF_CREATE_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov ebx, dword[open_file_vox] + mov [run_file_70.Buffer], ebx + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_save_file + + .end_save_file: + popad + ret + +align 4 +but_1: + stdcall open_image_in_buf, buf_i0 + ret + +align 4 +but_2: + stdcall open_image_in_buf, buf_i1 + call set_buf_tabs + ret + +align 4 +but_3: + stdcall open_image_in_buf, buf_i2 + call set_buf_tabs + ret + +;description: +; ᨬ ਭ 1- ⠭ 2- 3- ஢ +align 4 +set_buf_tabs: +push eax ebx edi + mov edi,buf_i0 + cmp buf2d_data,0 + je @f + movzx eax,buf2d_l + mov ebx,buf2d_w + cmp ebx,128 + jle .end_0 + mov ebx,128 + .end_0: + mov edi,buf_i1 + mov buf2d_l,ax + add buf2d_l,bx + add buf2d_l,2 + shl ebx,1 + mov edi,buf_i2 + mov buf2d_l,ax + add buf2d_l,bx + add buf2d_l,4 + @@: +pop edi ebx eax + ret + +align 4 +get_scale: +push eax edi + mov edi,buf_i0 + mov eax,buf2d_w + + mov dword[k_scale],-1 + .cycle_s: + cmp eax,0 + je @f + shr eax,1 + inc dword[k_scale] + jmp .cycle_s + @@: +pop edi eax + ret + +align 4 +proc set_borders uses eax ebx ecx edx edi + mov ecx,dword[k_scale] + mov edx,1 + shl edx,cl + + ;।塞 न y 楢 ࠭ + mov edi,buf_i2 + mov dword[bby_min],0 + xor ecx,ecx + .cycle_0: + xor ebx,ebx + .cycle_1: + stdcall [buf2d_get_pixel],edi,ebx,ecx + cmp eax,buf2d_color + jne @f + inc ebx + cmp ebx,edx + jl .cycle_1 + inc dword[bby_min] + inc ecx + cmp ecx,edx + jl .cycle_0 + @@: + + ;।塞 न x 楢 ࠭ + mov dword[btx_min],0 + xor ebx,ebx + .cycle_2: + mov ecx,[bby_min] + .cycle_3: + stdcall [buf2d_get_pixel],edi,ebx,ecx + cmp eax,buf2d_color + jne @f + inc ecx + cmp ecx,edx + jl .cycle_3 + inc dword[btx_min] + inc ebx + cmp ebx,edx + jl .cycle_2 + @@: + + ;।塞 ᨬ न x 楢 ࠭ + mov [btx_max],edx + dec dword[btx_max] + mov ebx,[btx_max] + .cycle_4: + mov ecx,[bby_min] + .cycle_5: + stdcall [buf2d_get_pixel],edi,ebx,ecx + cmp eax,buf2d_color + jne @f + inc ecx + cmp ecx,edx + jl .cycle_5 + dec dword[btx_max] + dec ebx + cmp ebx,[btx_min] + jg .cycle_4 + @@: + + ;stdcall [buf2d_line], edi, 0,[bby_min],50,[bby_min],255 + ret +endp + +align 4 +btx_min dd 0 ; 孨 . x +btx_max dd 0 +bty_min dd 0 ; 孨 . y +bty_max dd 0 +;bbx_min dd 0 +;bbx_max dd 0 +bby_min dd 0 ; . y +bby_max dd 0 +k_scale dd 0 +n_plane dd 0 + +calc db 0 ;᫨ =1, ᮧ ꥪ + +; ᮧ ᥫ 3 ⠯: +; 1) 饬 ॢ, 㤠 ⠢ (᫨ , 2- ⠯ ய᪠) +; 2) ⠢塞 ᥫ (3- ⠯ 㦥 ) +; 3) 塞 梥 ᥫ +align 4 +proc buf2d_vox_obj_create_node, v_obj:dword,coord_x:dword,coord_y:dword,\ +coord_z:dword,k_scale:dword,color:dword +pushad +locals + p_node dd 0 ;த⥫᪨ 㧥 +endl + + mov edi,[v_obj] + add edi,vox_offs_data + mov esi,[k_scale] + cmp esi,1 + jl .change + ; *** (1) *** + .found: + stdcall vox_obj_get_node_position, [v_obj],[coord_x],[coord_y],[coord_z],esi + movzx bx,byte[edi+3] + mov [p_node],edi + add edi,4 + + cmp eax,0 + je .end_1 + mov ecx,eax + cld + @@: ;横 ய᪠ । ॢ쥢 㧫 + bt bx,0 ;஢塞 ୨ 㧫 + jnc .end_0 + xor eax,eax + stdcall vox_obj_rec0 ; eax ᫮ ୨ 㧫, ⢨ + .end_0: + shr bx,1 + loop @b + .end_1: + bt bx,0 + jnc .creat ;᫨ ॢ , 室 ᮧ + dec esi + cmp esi,0 + jg .found + jmp .change + + ; *** (2) *** + .creat: + mov edx,[color] ;塞 梥 + and edx,0xffffff ; 䨫⨪ + mov ecx,esi + stdcall vox_obj_add_nodes_mem, [v_obj],edi,ecx ;塞 ꥪ⮬, 㧫 + mov ebx,[p_node] + cld + @@: + mov dword[edi],edx + stdcall vox_obj_get_node_bit_mask, [v_obj],[coord_x],[coord_y],[coord_z],esi + or byte[ebx+3],al + + mov ebx,edi + add edi,4 + dec esi + loop @b + jmp .end_2 + + ; *** (3) *** + .change: + mov eax,[color] ;塞 梥 + mov word[edi],ax + shr eax,16 + mov byte[edi+2],al + + .end_2: +popad + ret +endp + +; ᤢ 㧫 㧫 +;input: +; p_insert - ⠢ +; count - ⢮ ⠢塞 㧫 +align 4 +proc vox_obj_add_nodes_mem uses eax ecx edi esi, v_obj:dword,p_insert:dword,count:dword + mov esi,[v_obj] + ;stdcall buf2d_vox_obj_get_size,esi + add esi,[vox_obj_size] ;esi - 㪠⥫ 䠩 + mov edi,[count] + shl edi,2 + add [vox_obj_size],edi + add edi,esi ;edi - 㪠⥫ 騩 䠩 + mov ecx,esi + sub ecx,[p_insert] + shr ecx,2 ;ecx - ᫮ 横 ஢ + sub esi,4 ;esi - 㪠⥫ ᫥ 㧥 + sub edi,4 ;edi - 㪠⥫ 騩 ᫥ 㧥 + std + rep movsd ;ᤢ + ret +endp + +;??? +; । 樨 㧫 ॢ ( 0 7) +align 4 +proc vox_obj_get_node_position uses ebx ecx edi, v_obj:dword,\ +coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword + mov ecx,[k_scale] + dec ecx + mov eax,[coord_x] + mov ebx,[coord_y] + mov edi,[coord_z] + cmp ecx,1 + jl .end_0 + shr eax,cl + shr ebx,cl + shr edi,cl + .end_0: + and eax,1 + bt ebx,0 + jnc @f + bts eax,1 + @@: + bt edi,0 + jnc @f + bts eax,2 + @@: + + mov edi,[v_obj] + add edi,vox_offs_tree_table + @@: + cmp al,byte[edi] + je @f + inc edi + jmp @b + @@: + sub edi,[v_obj] + sub edi,vox_offs_tree_table + mov eax,edi + + ret +endp + +;??? +;input: +; edi - 㪠⥫ ᥫ쭮 ꥪ +;output: +; eax - eax + ᫮ 㧫 . ꥪ +; edi - 㪠⥫ ᬥ饭 . ꥪ +align 4 +proc vox_obj_rec0 + inc eax + cmp byte[edi+3],0 ;ᬮਬ ॢ + je .sub_trees + + ;४ᨢ ॡ ॢ쥢 + push ebx ecx + mov bh,byte[edi+3] + add edi,4 + mov bl,8 + .cycle: + bt bx,8 ;㥬 ⮫쪮 bh + jnc .c_next + stdcall vox_obj_rec0 + .c_next: + shr bh,1 + dec bl + jnz .cycle + pop ecx ebx + + jmp .end_f + .sub_trees: + add edi,4 + .end_f: + ret +endp + +;output: +; eax - 1,2,4,8,16, ... ,128 +align 4 +proc vox_obj_get_node_bit_mask uses ebx ecx edi, v_obj:dword,\ +coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword + mov ecx,[k_scale] + dec ecx + mov eax,[coord_x] + mov ebx,[coord_y] + mov edi,[coord_z] + cmp ecx,1 + jl .end_0 + shr eax,cl + shr ebx,cl + shr edi,cl + .end_0: + and eax,1 + bt ebx,0 + jnc @f + bts eax,1 + @@: + bt edi,0 + jnc @f + bts eax,2 + @@: + + mov ecx,[v_obj] + add ecx,vox_offs_tree_table + @@: + cmp al,byte[ecx] + je @f + inc ecx + jmp @b + @@: + mov eax,1 ;⠭ ࢮ砫쭮 祭 + sub ecx,[v_obj] + sub ecx,vox_offs_tree_table + jz @f + shl eax,cl ;ᤢ + @@: + + ret +endp + +;output: +; eax - ࠧ ꥪ⮬ v_obj +align 4 +proc buf2d_vox_obj_get_size uses edi, v_obj:dword + mov edi,[v_obj] + add edi,vox_offs_data + xor eax,eax + stdcall vox_obj_rec0 ;eax - ᫮ 㧫 ꥪ v_obj + shl eax,2 + add eax,vox_offs_data + ret +endp + +;input: +; mode_add - ᫨ ࠢ 0 ⮣ ᮧ ० ᥫ +align 4 +proc but_run uses eax ebx edi, mode_add:dword + ; ஢ઠ ࠧ஢ ࠦ (⥪) + mov edi,buf_i0 + mov ebx,buf2d_h + cmp ebx,2 + jle .err_size_t + cmp buf2d_w,ebx + jne .err_size_t + ; + mov edi,buf_i1 + cmp ebx,buf2d_h + jne .err_size_tb + mov ebx,buf2d_h + cmp ebx,2 + jle .err_size_b + cmp buf2d_w,ebx + jne .err_size_b + + cmp dword[vox_obj_size],vox_offs_data + jl .n_file ;᫨ ࠭ 뫮 䠩 + cmp dword[mode_add],0 + jne @f + .n_file: + call but_new_file + @@: + + mov edi,buf_i0 + mov eax,buf2d_w + mov edi,buf_npl + cmp buf2d_data,0 + jne @f + ; *** ᮧ + m2m buf2d_w,eax + m2m buf2d_h,eax + stdcall [buf2d_create],edi + mov edi,buf_npl_p + m2m buf2d_w,eax + m2m buf2d_h,eax + stdcall [buf2d_create],edi + mov edi,buf_npl_n + m2m buf2d_w,eax + m2m buf2d_h,eax + stdcall [buf2d_create],edi + jmp .end_0 + @@: + ; *** 塞 ࠧ ஢ + stdcall [buf2d_resize], edi, eax,eax,1 + mov edi,buf_npl_p + stdcall [buf2d_resize], edi, eax,eax,1 + mov edi,buf_npl_n + stdcall [buf2d_resize], edi, eax,eax,1 + .end_0: + mov dword[n_plane],1 + mov byte[calc],1 + call get_scale + call set_borders + + stdcall create_plane,buf_npl,0 + stdcall create_plane,buf_npl_n,1 + stdcall create_obj_from_plane,buf_npl,0 ;ᮧ 砫쭮 祭 + + jmp @f + .err_size_t: + stdcall [mb_create],msgbox_0,thread + jmp @f + .err_size_b: + stdcall [mb_create],msgbox_1,thread + jmp @f + .err_size_tb: + stdcall [mb_create],msgbox_3,thread + ;jmp @f + @@: + ret +endp + +;४ ᮧ ꥪ +align 4 +but_stop: + cmp byte[calc],0 + je @f + call draw_object + mov byte[calc],0 + @@: + ret + +align 4 +but_rot_z: + stdcall vox_obj_rot_z, [open_file_vox] + call draw_object + ret + +align 4 +draw_object: + ;뢮 १ ࠭ + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + stdcall [buf2d_clear], buf_0z, 0 ;⨬ + stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox,\ + [open_file_vox], 0,0, 0, 6 ;[k_scale] + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +align 4 +proc open_image_in_buf, buf:dword + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_open_file + + ;stdcall mem.Alloc, dword size ;뤥塞 ࠦ + ;mov [buf],eax + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov [run_file_70.Count], dword max_open_file_size + m2m [run_file_70.Buffer],dword[open_file_img] + mov byte[run_file_70+20], 0 + mov [run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_0 + ;।塞 ࠦ + stdcall dword[img_decode], dword[open_file_img],ebx,0 + or eax,eax + jz .end_0 ;᫨ 襭 ଠ 䠩 + mov ebx,[eax+4] ;+4 = image width + cmp ebx,[eax+8] ;+8 = image height + jne .err_s0 + mov ebx,eax + ;८ࠧ㥬 ࠦ ଠ rgb + stdcall dword[img_to_rgb2], ebx,dword[open_file_img] + + mov edi,[buf] + cmp buf2d_data,0 + jne @f + m2m buf2d_w,dword[ebx+4] ;+4 = image width + m2m buf2d_h,dword[ebx+8] ;+8 = image height + stdcall [buf2d_create_f_img], edi,[open_file_img] + jmp .end_1 + @@: + mov ecx,[ebx+8] + stdcall [buf2d_resize], edi, [ebx+4],ecx,1 ;塞 ࠧ + imul ecx,[ebx+4] + lea ecx,[ecx+ecx*2] + mov edi,buf2d_data + mov esi,[open_file_img] + cld + rep movsb ;copy image + jmp .end_1 + .err_s0: ;訡, ࠦ ८ࠧ 室 ( ⭮) + mov ebx,eax + notify_window_run txt_img_not_square + .end_1: + ;㤠塞 ६ ebx + stdcall dword[img_destroy], ebx + .end_0: + + call draw_buffers + .end_open_file: + popad + ret +endp + +msgbox_0: + db 1,0 + db '',0 + db ' 孥 ࠦ ४',0 + db '',0 + db 0 + +msgbox_1: + db 1,0 + db '',0 + db ' ࠦ ४',0 + db '',0 + db 0 + +msgbox_2: + db 1,0 + db '',0 + db ' । ࠦ ४',0 + db '',0 + db 0 + +msgbox_3: + db 1,0 + db '',0 + db ' 孥 ࠦ ᮢ',13,\ + 'ன ࠦ ࠧ஢',0 + db '',0 + db 0 + +msgbox_4: + db 1,0 + db '',0 + db '뢠 䠩 ᮤন ᥫ ଠ',0 + db '',0 + db 0 + +txt_img_not_square db '"',13,10,'뢠 ࠦ ⭮" -tW',0 + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'PNG',0 +db 'JPG',0 +db 'JPEG',0 +db 'BMP',0 +db 'GIF',0 +db 'VOX',0 +.end: +db 0 + + + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'msgbox.obj',0 + +align 4 +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_msgbox_lib +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_resize dd sz_buf2d_resize + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_curve_bezier dd sz_buf2d_curve_bezier + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_flood_fill dd sz_buf2d_flood_fill + buf2d_set_pixel dd sz_buf2d_set_pixel + buf2d_get_pixel dd sz_buf2d_get_pixel + buf2d_vox_brush_create dd sz_buf2d_vox_brush_create + buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete + buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g + buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g + buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g + buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g + buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled + buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows + buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl + buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_resize db 'buf2d_resize',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_flood_fill db 'buf2d_flood_fill',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + sz_buf2d_get_pixel db 'buf2d_get_pixel',0 + sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 + sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 + sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 + sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 + sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 + sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 + sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 + sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 + sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 + sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 + +align 4 +import_msgbox_lib: + mb_create dd amb_create +; mb_reinit dd amb_reinit +; mb_setfunctions dd amb_setfunctions +dd 0,0 + amb_create db 'mb_create',0 +; amb_reinit db 'mb_reinit',0 +; amb_setfunctions db 'mb_setfunctions',0 + +align 4 +buf_0: dd 0 + dw 5 ;+4 left + dw 35 ;+6 top +.w: dd 6*64 ;+8 w +.h: dd 7*64 ;+12 h +.color: dd 0xffffff ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_0z: dd 0 + dw 5 ;+4 left + dw 35 ;+6 top +.w: dd 6*64 ;+8 w +.h: dd 7*64 ;+12 h +.color: dd 0 ;+16 color + db 32 ;+20 bit in pixel + +;⥪ 1 () +align 4 +buf_i0: dd 0 + dw 5 ;+4 left + dw 35 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +;⥪ 2 +align 4 +buf_i1: dd 0 + dw 105 ;+4 left + dw 35 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +;⥪ 3 +align 4 +buf_i2: dd 0 + dw 205 ;+4 left + dw 35 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +; ᮧ ᯮ 3 祭: +; ।饥, ⥪饥, ᫥饥 ( 室 ᥨ ᥫ ꥪ) + +;।饥 祭 +align 4 +buf_npl_p: dd 0 + dw 0 ;+4 left + dw 0 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +;⥪饥 祭 +align 4 +buf_npl: dd 0 + dw 5 ;+4 left + dw 35 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +;᫥饥 祭 +align 4 +buf_npl_n: dd 0 + dw 0 ;+4 left + dw 0 ;+6 top +.w: dd 0 ;+8 w +.h: dd 0 ;+12 h +.color: dd 0 ;+16 color + db 24 ;+20 bit in pixel + +; ᮧ 쭮 筮 ᥫ +align 4 +vox_6_7_z: +dd 0,0,1,1,0,0,\ + 0,2,2,2,2,0,\ + 2,2,2,2,2,2,\ + 2,3,2,2,3,2,\ + 2,3,3,3,3,2,\ + 0,3,3,3,3,0,\ + 0,0,3,3,0,0 + +align 4 +buf_vox: + db 6,7,4,3 ;w,h,h_osn,n + rb BUF_STRUCT_SIZE*(2+1) + + +align 16 +i_end: + procinfo process_information + sc system_colors + run_file_70 FileInfoBlock + mouse_dd dd ? + last_time dd ? + rb 2048 + thread: + rb 2048 +stacktop: + sys_path rb 1024 + file_name rb 2048 ;4096 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 +mem: diff --git a/programs/media/voxel_editor/utilites/vox_mover.asm b/programs/media/voxel_editor/utilites/vox_mover.asm index 7ffbcb2a2..b80283491 100644 --- a/programs/media/voxel_editor/utilites/vox_mover.asm +++ b/programs/media/voxel_editor/utilites/vox_mover.asm @@ -1,1557 +1,1559 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, openfile_path, sys_path - -include '../../../macros.inc' -include '../../../proc32.inc' -include '../../../KOSfuncs.inc' -include '../../../load_img.inc' -include '../../../load_lib.mac' -include '../trunk/vox_draw.inc' -include '../trunk/vox_rotate.inc' -include '../trunk/str.inc' -include 'lang.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -if lang eq ru_RU -caption db '६饭 ᥫ 04.05.20',0 ; -else -caption db 'Voxel mover 04.05.20',0 -end if - -IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 -image_data_toolbar dd 0 - -;祭 㬮砭, ini 䠩 -ini_def_window_t equ 10 -ini_def_window_l equ 10 -ini_def_window_w equ 550 -ini_def_window_h equ 415 -ini_def_buf_w equ 198 ;=192+6 -ini_def_buf_h equ 231 ;=224+7 -ini_def_s_zoom equ 5 -ini_def_t_size equ 10 -ini_def_color_b equ 0xffffff -;ᠭ ࠬ஢ ini 䠩 -ini_name db 'vox_mover.ini',0 -ini_sec_window db 'Window',0 -key_window_t db 't',0 -key_window_l db 'l',0 -key_window_w db 'w',0 -key_window_h db 'h',0 -key_buf_w db 'buf_w',0 -key_buf_h db 'buf_h',0 -ini_sec_options db 'Options',0 -key_s_zoom db 's_zoom',0 -key_t_size db 'tile_size',0 -key_f_size db 'file_size',0 -key_col_b db 'c_background',0 - -OT_MAP_X equ 0 -OT_MAP_Y equ 0 -OT_CAPT_X_COLOR equ 5 ; 梥 -OT_CAPT_Y_COLOR equ 30 -PEN_MODE_NONE equ -1 -PEN_MODE_CLEAR equ 0 ;० ࠭ -PEN_MODE_SELECT_COLOR equ 2 ;० 롮 梥 - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib0 - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - -;--- load ini file --- - copy_path ini_name,sys_path,file_name,0 - ;window startup pozition - stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l - mov word[wnd_s_pos+2],ax - stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w - mov word[wnd_s_pos],ax - stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t - mov word[wnd_s_pos+6],ax - stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h - mov word[wnd_s_pos+4],ax - ;image buffer size - stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_w,ini_def_buf_w - mov [buf_0.w],eax - mov [buf_0z.w],eax - add ax,15 - mov [buf_pl.l],ax ; ࠢ - stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_h,ini_def_buf_h - mov [buf_0.h],eax - mov [buf_0z.h],eax - ;梥 䮭 - stdcall dword[ini_get_color],file_name,ini_sec_window,key_col_b,ini_def_color_b - mov [buf_0.color],eax - mov [buf_pl.color],eax - - ;⠡, ᫥ ண 㤥 㢥祭 - stdcall dword[ini_get_int],file_name,ini_sec_options,key_s_zoom,ini_def_s_zoom - mov [scaled_zoom],eax - ;ࠧ ⨪ ᪮ 祭 - stdcall dword[ini_get_int],file_name,ini_sec_options,key_t_size,ini_def_t_size - mov [tile_size],eax - - stdcall dword[ini_get_int],file_name,ini_sec_options,key_f_size,64 - shl eax,10 - mov [max_open_file_size],eax - - mov ecx,[scaled_zoom] - xor eax,eax - inc eax - shl eax,cl - imul eax,[tile_size] - mov [buf_pl.w],eax - add eax,[tile_size] - mov [buf_pl.h],eax - - - stdcall [buf2d_create], buf_0 ;ᮧ ࠦ - stdcall [buf2d_create], buf_0z ;ᮧ 㡨 - stdcall [buf2d_create], buf_pl ;ᮧ 祭 - - stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z - - include_image_file 'toolbar_m.png', image_data_toolbar - - stdcall mem.Alloc,[max_open_file_size] - mov dword[open_file_vox],eax - stdcall mem.Alloc,[max_open_file_size] - mov dword[moved_file_vox],eax - - stdcall but_new_file, [open_file_vox] - stdcall but_new_file, [moved_file_vox] - ;஢ઠ ப - cmp dword[openfile_path],0 - je @f - call but_open_file_cmd_lin - @@: - -align 4 -red_win: - call draw_window - -align 4 -still: - mcall SF_WAIT_EVENT - - cmp al,1 - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - mcall SF_THREAD_INFO,procinfo,-1 - cmp ax,word[procinfo+4] - jne @f ; ⨢ - call mouse - @@: - jmp still - -align 4 -mouse: - pushad - mcall SF_MOUSE_GET,SSF_BUTTON - bt eax,1 ;right button - jnc @f - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - shr ebx,16 - and eax,0xffff - stdcall get_buf_color, buf_0 - stdcall get_buf_color, buf_pl - jmp .end_f - @@: - bt eax,0 ;left button - jnc .end_f - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - shr ebx,16 - and eax,0xffff - - push eax ebx - mov edx,[v_zoom] - cmp edx,[scaled_zoom] - jle @f - ;० ⠡஢ ࠦ - sub edx,[scaled_zoom] - sub ax,word[buf_0.t] - sub bx,word[buf_0.l] - stdcall get_mouse_ev_scale, buf_vox, ebx, eax, [scaled_zoom],edx - cmp eax,0 - je @f - mov ebx,eax - and eax,0x3fffffff - rol ebx,2 - and ebx,3 - dec ebx - - shl ebx,2 - add ebx,cam_x - mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z] - call draw_objects - - pop ebx eax - jmp .end_f - @@: - pop ebx eax - - - ;eax - mouse coord y - ;ebx - mouse coord x - movzx edx,word[buf_pl.t] - add edx,OT_MAP_Y - cmp eax,edx - jl .end_f - sub eax,edx - xor edx,edx - mov ecx,[tile_size] ;H - div ecx - movzx edx,word[buf_pl.l] - add edx,OT_MAP_X - cmp ebx,edx - jl .end_f - call convert_y ;८ࠧ न y - cmp eax,0 - jge .end_0 ;࠭祭 न y - cmp eax,-1 - jne .end_f - ;塞 祭, ⨪ - sub ebx,edx - mov eax,ebx - xor edx,edx - mov ecx,[tile_size] ;W - div ecx - mov [n_plane],eax - jmp .end_1 - .end_0: - mov [v_cur_y],eax ;Y-coord - sub ebx,edx - mov eax,ebx - xor edx,edx - mov ecx,[tile_size] ;W - div ecx - mov [v_cur_x],eax ;X-coord - - .end_1: - call draw_objects - call draw_pok - .end_f: - popad - ret - -;input: -; eax - coord y -; ebx - coord x -align 4 -proc get_buf_color, buf:dword -pushad - mov edi,[buf] - cmp ax,buf2d_t - jl .end_f - sub ax,buf2d_t - cmp eax,buf2d_h - jg .end_f - cmp bx,buf2d_l - jl .end_f - sub bx,buf2d_l - cmp ebx,buf2d_w - jg .end_f - stdcall [buf2d_get_pixel], edi,ebx,eax - mov [v_color],eax - call on_change_color ;⮡ࠦ 梥 - .end_f: -popad - ret -endp - -;८ࠧ뢠 न y (祭 㢥稢 ) -align 4 -convert_y: - push ecx edx - mov ecx,[v_zoom] - cmp ecx,[scaled_zoom] - jle @f - mov ecx,[scaled_zoom] - @@: - mov edx,1 - cmp ecx,1 - jl @f - shl edx,cl - @@: - sub edx,eax - dec edx - mov eax,edx - pop edx ecx - ret - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - ; *** ᮢ (믮 1 ࠧ ᪥) *** - mov edx,[sc.work] - or edx,(3 shl 24)+0x30000000 - mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,caption - - ; *** ᮧ *** - mov esi,[sc.work_button] - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3 - - mov ebx,(30 shl 16)+20 - mov edx,4 - int 0x40 - add ebx,25 shl 16 - mov edx,5 - int 0x40 - add ebx,30 shl 16 - mov edx,6 - int 0x40 - add ebx,25 shl 16 - mov edx,7 - int 0x40 - add ebx,25 shl 16 - mov edx,8 - int 0x40 - add ebx,25 shl 16 - mov edx,9 - int 0x40 - add ebx,25 shl 16 - mov edx,10 - int 0x40 - add ebx,25 shl 16 - mov edx,11 - int 0x40 - add ebx,25 shl 16 - mov edx,12 - int 0x40 - add ebx,25 shl 16 - mov edx,13 - int 0x40 - add ebx,25 shl 16 - mov edx,14 - int 0x40 - add ebx,25 shl 16 - mov edx,15 - int 0x40 - add ebx,25 shl 16 - mov edx,16 - int 0x40 - add ebx,25 shl 16 - mov edx,17 - int 0x40 - add ebx,25 shl 16 - mov edx,18 - int 0x40 - add ebx,25 shl 16 - mov edx,19 - int 0x40 - add ebx,25 shl 16 - mov edx,20 - int 0x40 - - ; *** ᮢ *** - mov edx,(7 shl 16)+7 ;icon new - mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon open - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon save - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(30 shl 16) ;㢥. ⠡ - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;㬥. ⠡ - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; 1 - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; 2 - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;ᤢ ᪮ + - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;ᤢ ᪮ - - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;ᢥ饭 - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;७ 2*2 - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ; - int 0x40 - - ; *** ᮢ ஢ *** - call draw_objects - call draw_pok - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -draw_pok: - mov esi,[sc.work_button_text] - or esi,(1 shl 30) - mov edi,[sc.work_button] - mcall SF_DRAW_NUMBER, (3 shl 16)+(1 shl 31), [v_zoom], ((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 ;⠡ - mov ecx,[n_plane] - add edx,115 shl 16 ;9 - int 0x40 ; 祭 - - ; ࠬ஢ - mov dword[txt_curor.size],0 - mov eax,dword[v_cur_x] - mov edi,txt_curor.size - stdcall convert_int_to_str,10 - stdcall str_cat, edi,txt_mull - mov eax,dword[v_cur_y] - mov edi,txt_buf - stdcall convert_int_to_str,16 - stdcall str_cat, txt_curor.size,edi - stdcall str_cat, txt_curor.size,txt_space ;騩 ஡ - - ; ࠬ஢ - mov dword[txt_mov_offs.size],0 - mov eax,dword[mov_x] - mov edi,txt_mov_offs.size - stdcall convert_int_to_str,30 - stdcall str_cat, edi,txt_space - mov eax,dword[mov_y] - mov edi,txt_buf - stdcall convert_int_to_str,16 - stdcall str_cat, txt_mov_offs.size,edi - stdcall str_cat, txt_mov_offs.size,txt_space - mov eax,dword[mov_z] - mov edi,txt_buf - stdcall convert_int_to_str,16 - stdcall str_cat, txt_mov_offs.size,edi - stdcall str_cat, txt_mov_offs.size,txt_space ;騩 ஡ - - ;ᮢ ⥪ - mov ecx,[sc.work_text] - or ecx,0x80000000 ;or (1 shl 30) - mcall SF_DRAW_TEXT, (OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2,,txt_color - - mov edx,txt_curor - add ebx,115 shl 16 - or ecx,(1 shl 30) - mov edi,[sc.work] - int 0x40 - - mov edx,txt_mov_offs - add ebx,115 shl 16 - int 0x40 - - mov edx,txt_zoom - add ebx,115 shl 16 - int 0x40 - - mov edx,txt_n_plane - add ebx,115 shl 16 - int 0x40 - - call on_change_color - ret - -align 4 -on_change_color: -pushad - mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ; x - mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ; y - mcall SF_DRAW_RECT,,,[v_color] - - mov ecx,edx - mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2 - mov esi,[sc.work_text] - add esi,(1 shl 30) - mov edi,[sc.work] - mcall SF_DRAW_NUMBER,(1 shl 8)+(6 shl 16) -popad - ret - -align 4 -key: - mcall SF_GET_KEY - jmp still - - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - stdcall but_new_file, [open_file_vox] - call draw_objects - call draw_pok - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_zoom_p - jmp still - @@: - cmp ah,7 - jne @f - call but_zoom_m - jmp still - @@: - cmp ah,8 - jne @f - call but_3 - jmp still - @@: - cmp ah,9 - jne @f - call but_4 - jmp still - @@: - cmp ah,10 - jne @f - call but_plane_inc - jmp still - @@: - cmp ah,11 - jne @f - call but_plane_dec - jmp still - @@: - cmp ah,12 - jne @f - call but_light - jmp still - @@: - cmp ah,13 - jne @f - call but_rend_2_2 - jmp still - @@: - cmp ah,14 - jne @f - call but_move - jmp still - @@: - cmp ah,15 - jne @f - dec dword[mov_x] - call draw_pok - jmp still - @@: - cmp ah,16 - jne @f - inc dword[mov_x] - call draw_pok - jmp still - @@: - cmp ah,17 - jne @f - dec dword[mov_y] - call draw_pok - jmp still - @@: - cmp ah,18 - jne @f - inc dword[mov_y] - call draw_pok - jmp still - @@: - cmp ah,19 - jne @f - dec dword[mov_z] - call draw_pok - jmp still - @@: - cmp ah,20 - jne @f - inc dword[mov_z] - call draw_pok - jmp still - @@: - cmp ah,1 - jne still -.exit: - stdcall [buf2d_delete],buf_0 - stdcall [buf2d_delete],buf_0z - cmp dword[buf_r_img],0 - je @f - stdcall [buf2d_delete],buf_r_img - stdcall [buf2d_delete],buf_r_z - @@: - stdcall [buf2d_vox_brush_delete], buf_vox - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_vox] - stdcall mem.Free,[moved_file_vox] - mcall SF_TERMINATE_PROCESS - -; 樠樨 ᥫ쭮 ꥪ -align 4 -vox_new_data: - db 2,0,0,0 - db 0,1,2,3, 4,5,6,7 ;default table - dd 0 ;null node - -;樠 ᥫ쭮 ꥪ -align 4 -proc but_new_file uses ecx edi esi, file_data:dword - mov ecx,vox_offs_data+4 - mov esi,vox_new_data - mov edi,[file_data] - cld - rep movsb - ret -endp - -align 4 -open_file_vox dd 0 ;㪠⥫ 䠩 -moved_file_vox dd 0 - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 -pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je @f - ; 㤠筮 ⨨ - call but_open_file_cmd_lin - @@: -popad - ret - -align 4 -but_open_file_cmd_lin: -pushad - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - m2m dword[run_file_70.Count], dword[max_open_file_size] - m2m [run_file_70.Buffer], [open_file_vox] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_open_file - - mcall SF_SET_CAPTION,1,openfile_path - - ;--- - mov eax,[open_file_vox] - movzx eax,byte[eax] - and eax,0xff ;६ ⠡ 㬮砭 - mov dword[v_zoom],eax ;६ ⠡ 㬮砭 - mov dword[cam_x],0 - mov dword[cam_y],0 - mov dword[cam_z],0 - call draw_objects - .end_open_file: -popad - ret - -align 4 -but_save_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_save_file - ; 㤠筮 ⨨ - - mov eax,dword[v_zoom] ; ⠡ 㬮砭 - mov ebx,[moved_file_vox] - mov byte[ebx],al - - stdcall buf2d_vox_obj_get_size, ebx - mov dword[run_file_70.Count], eax ;ࠧ 䠩 - mov [run_file_70.Function], SSF_CREATE_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov ebx, dword[moved_file_vox] - mov [run_file_70.Buffer], ebx - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_save_file - - .end_save_file: - popad - ret - -;㢥祭 ⠡ -align 4 -but_zoom_p: - cmp dword[v_zoom],10 ;ᨬ ࠧ, ண 㢥 2^10=1024 - jge @f - inc dword[v_zoom] - shl dword[n_plane],1 - push eax - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jl .end_0 - push ecx - mov ecx,[scaled_zoom] - xor eax,eax - inc eax - shl eax,cl - shl dword[cam_x],1 - shl dword[cam_y],1 - shl dword[cam_z],1 - cmp eax,[n_plane] - jg .end_1 - ;४஢ 㭪 - sub [n_plane],eax - inc dword[cam_y] - .end_1: - pop ecx - .end_0: - pop eax - call draw_objects - call draw_pok - @@: - ret - -;㬥襭 ⠡ -align 4 -but_zoom_m: - cmp dword[v_zoom],1 - jl @f - dec dword[v_zoom] - shr dword[n_plane],1 - push eax - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jl .end_0 - shr dword[cam_x],1 - shr dword[cam_y],1 - jnc .end_1 - ;४஢ 㭪 - push ecx - mov ecx,[scaled_zoom] - dec ecx - xor eax,eax - inc eax - shl eax,cl - add [n_plane],eax - pop ecx - .end_1: - shr dword[cam_z],1 - .end_0: - pop eax - call draw_objects - call draw_pok - @@: - ret - -align 4 -but_3: - stdcall vox_obj_rot_z, [open_file_vox] - call draw_objects - ret - -align 4 -but_4: - stdcall vox_obj_rot_x, [open_file_vox] - call draw_objects - ret - -;ᤢ ᪮ १ -align 4 -but_plane_inc: -push eax ecx - inc dword[n_plane] - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jle .end_0 - ;ந室 ⠡஢ - mov ecx,[scaled_zoom] - xor eax,eax - inc eax - shl eax,cl - cmp eax,[n_plane] - jg @f - mov dword[n_plane],0 - inc dword[cam_y] ;室 ᥤ - neg ecx - ;inc ecx - add ecx,[v_zoom] - xor eax,eax - inc eax - shl eax,cl - cmp eax,[cam_y] - jg @f - mov dword[cam_y],0 ;横 ᫨ 뫥 । ᫥ 㡠 - @@: - jmp .end_1 - .end_0: - ;⠡஢ ந室 - mov ecx,eax - xor eax,eax - inc eax - shl eax,cl - cmp eax,[n_plane] - jg .end_1 - mov dword[n_plane],0 - .end_1: - call draw_objects - call draw_pok -pop ecx eax - ret - -;ᤢ ᪮ १ -align 4 -but_plane_dec: - dec dword[n_plane] - cmp dword[n_plane],0 - jge .end_f -push eax ecx - mov ecx,[scaled_zoom] - xor eax,eax - inc eax - shl eax,cl - dec eax - mov dword[n_plane],eax - - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jle .end_0 - ;ந室 ⠡஢ - dec dword[cam_y] ;室 ᥤ - cmp dword[cam_y],0 - jge .end_0 - - mov ecx,eax - sub ecx,[scaled_zoom] - xor eax,eax - inc eax - shl eax,cl - dec eax - mov dword[cam_y],eax ;᫨ 㡠 0 ࠢ塞 ᨬ쭮 祭 - .end_0: -pop ecx eax - .end_f: - call draw_objects - call draw_pok - ret - -align 4 -but_light: - xor dword[mode_light],1 - call draw_objects - ret - -align 4 -but_rend_2_2: -push edi - cmp dword[buf_r_img],0 - jne @f - ;ᮧ ७ - push ecx esi - mov edi,buf_r_img - mov esi,buf_0 - mov ecx,BUF_STRUCT_SIZE - cld - rep movsb ;㥬 ࠬ ᭮ - mov edi,buf_r_img - mov buf2d_data,0 - shl buf2d_w,1 ;㢥稢 ࠧ - shl buf2d_h,1 - stdcall [buf2d_create],buf_r_img - - mov edi,buf_r_z - mov esi,buf_0z - mov ecx,BUF_STRUCT_SIZE - cld - rep movsb ;㥬 ࠬ ᭮ - mov edi,buf_r_z - mov buf2d_data,0 - shl buf2d_w,1 ;㢥稢 ࠧ - shl buf2d_h,1 - stdcall [buf2d_create],buf_r_z - pop esi ecx - @@: - stdcall [buf2d_clear], buf_r_img, [buf_0.color] ;⨬ - stdcall [buf2d_clear], buf_r_z, 0 ;⨬ - - push eax ebx ecx - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jle .end_scaled - ;७ 㢥祭 ꥪ - mov ebx,[scaled_zoom] - sub eax,ebx - inc ebx - stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, buf_vox,\ - [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] - bt dword[mode_light],0 - jnc @f - stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, ebx, 3 - @@: - xor ebx,ebx - xor ecx,ecx - mov edi,buf_r_img - stdcall [buf2d_img_hdiv2], edi - shr buf2d_h,1 - stdcall [buf2d_img_wdiv2], edi - shr buf2d_w,1 - jmp .show - .end_scaled: - - inc eax - stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, eax - stdcall [buf2d_vox_obj_draw_1g], buf_r_img, buf_r_z, [open_file_vox], 0,0, eax - bt dword[mode_light],0 - jnc @f - stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, eax, 3 - @@: - - mov edi,buf_r_img - stdcall [buf2d_img_hdiv2], edi - shr buf2d_h,1 - stdcall [buf2d_img_wdiv2], edi - shr buf2d_w,1 - - stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom] - mov ebx,[buf_0.w] - sub ebx,eax - shr ebx,1 ;ebx - 業஢ 쪨 ࠦ ਧ⠫ - stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom] - cmp eax,[buf_0.h] - jg @f - mov ecx,[buf_0.h] - sub ecx,eax - shr ecx,1 ;ecx - 業஢ 쪨 ࠦ ⨪ - @@: - .show: - stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi - shl buf2d_h,1 - shl buf2d_w,1 - pop ecx ebx eax -pop edi - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -align 4 -but_move: -push eax - stdcall but_new_file, [moved_file_vox] - mov eax,[v_zoom] - stdcall buf_vox_obj_recreat, [open_file_vox], [moved_file_vox],\ - [mov_x],[mov_y],[mov_z], eax - - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - stdcall [buf2d_clear], buf_0z, 0 ;⨬ - cmp eax,[scaled_zoom] - jle @f - mov eax,[scaled_zoom] - @@: - stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox, [moved_file_vox], 0,0,0, eax -pop eax - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -;description: -; 㭪 ᥫ ꥪ ( 3 ࠭) -;input: -; v_obj - ᥫ ꥪ -; k_scale - . ⠡஢ ࠦ -align 4 -proc buf_vox_obj_recreat, v_obj:dword, obj_n:dword,\ -coord_x:dword, coord_y:dword, coord_z:dword, k_scale:dword -pushad - mov edi,[v_obj] - mov ecx,[k_scale] - mov ebx,[coord_x] - mov edx,[coord_y] - add edi,vox_offs_data - mov esi,[coord_z] - stdcall vox_go_in_node, [v_obj], [obj_n] -popad - ret -endp - -;input: -; ebx - coord_x -; edx - coord_y -; esi - coord_z -; ecx - ஢ ⥪襣 㧫 -; edi - 㪠⥫ ᥫ쭮 ꥪ -align 4 -proc vox_go_in_node, v_obj:dword, obj_n:dword - cmp byte[edi+3],0 ;ᬮਬ ॢ - je .sub_trees - ;४ᨢ ॡ ॢ쥢 - push eax edx - - ;ᮢ ࠬ ᫨ ࠧ 㧫 = 1 - cmp ecx,0 - jne @f - stdcall buf2d_vox_obj_create_node, [obj_n], ebx,edx,esi, [v_zoom], [edi] - @@: - - ;室 㧫 - dec ecx - mov ah,byte[edi+3] - add edi,4 - mov al,8 - .cycle: - bt ax,8 ;㥬 ⮫쪮 ah - jnc .c_next - push ebx edx esi - stdcall vox_corect_coords, [v_obj] - stdcall vox_go_in_node, [v_obj], [obj_n] - pop esi edx ebx - .c_next: - shr ah,1 - dec al - jnz .cycle - - ;室 㧫 - inc ecx - pop edx eax - - jmp .end_f - .sub_trees: - ;㥬 㧥 - cmp ecx,0 - jne @f - stdcall buf2d_vox_obj_create_node, [obj_n], ebx,edx,esi, [v_zoom], [edi] - @@: - - add edi,4 - .end_f: - ret -endp - -;description: -;㭪 ४஢ न -;ࠢ ᥩ न ᥫ: -;*z -;| -;+ -; * y -; / -;+ -; \ -; * x -;input: -; al - 㧫 ॢ ( 1 8) -; ebx - न x -; edx - न y -; esi - न z -; ecx - ஢ ⥪襣 㧫 -;output: -; ebx - न x -; edx - न y -; esi - न z -align 4 -proc vox_corect_coords, v_obj:dword - cmp ecx,0 - jl .end_f ; ᪮७ ᮢ - - push eax edi - and eax,15 ;뤥塞 㧫 ॢ - mov edi,[v_obj] - add edi,vox_offs_tree_table - add edi,8 - sub edi,eax - - xor eax,eax - inc eax - cmp ecx,1 - jl .no_scale ; 横 - shl eax,cl - .no_scale: - - bt word[edi],0 ;test voxel coord x - jnc @f - add ebx,eax - @@: - bt word[edi],1 ;test voxel coord y - jnc @f - add edx,eax - @@: - bt word[edi],2 ;test voxel coord z - jnc @f - add esi,eax - @@: - pop edi eax - .end_f: - ret -endp - -align 4 -v_zoom dd 3 ;⥪騩 ⠡ -v_cur_x dd 0 ;न x -v_cur_y dd 0 ;न y ( ꥪ z) -n_plane dd 0 ;᪮ 祭 -v_color dd 0xff ;梥 ࠭ -mode_light dd 1 ;० ᢥ饭 -cam_x dd 0 -cam_y dd 0 -cam_z dd 0 -;ᤢ ꥪ ᮧ (।) -mov_x dd 0 -mov_y dd 0 -mov_z dd 0 -scaled_zoom dd 5 ;⠡ ᫥ ண 稭 ᮢ ࠦ -tile_size dd ? ;ࠧ ⨪ ᪮ 祭 -max_open_file_size dd ? -brush_w dd 5 ;ਭ -brush_h dd 5 ; -brush_data dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 -dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 -dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 -dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 -dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 -rd 999 ;32*32-25 - -if lang eq ru_RU -txt_zoom db '⠡:',0 -txt_curor: db ': ' -.size: rb 10 -txt_n_plane db '祭:',0 -txt_color db ':',0 -txt_mov_offs: db '饭: ' -else -txt_zoom db 'Scale:',0 -txt_curor: db 'Cursor: ' -.size: rb 10 -txt_n_plane db 'Section:',0 -txt_color db 'Color:',0 -txt_mov_offs: db 'Offset: ' -end if -.size: rb 30 -txt_mull db '*',0 -txt_space db ' ',0 -txt_buf rb 16 - -align 4 -draw_objects: - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - stdcall [buf2d_clear], buf_0z, 0 ;⨬ - stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;⨬ - - push eax ebx ecx - stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom] - mov ebx,[buf_0.w] - sub ebx,eax - shr ebx,1 ;ebx - 業஢ 쪨 ࠦ ਧ⠫ - - xor ecx,ecx - stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom] - cmp eax,[buf_0.h] - jg @f - mov ecx,[buf_0.h] - sub ecx,eax - shr ecx,1 ;ecx - 業஢ 쪨 ࠦ - @@: - - mov eax,[v_zoom] - cmp eax,[scaled_zoom] - jg @f - ; ० ࠦ - stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox,\ - [open_file_vox], ebx,ecx, 0, eax - stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox],\ - OT_MAP_X,OT_MAP_Y,[tile_size], eax, [n_plane], [sc.work_graph] - stdcall [buf2d_vox_obj_draw_1g], buf_0, buf_0z,\ - [open_file_vox], 0,0, eax - bt dword[mode_light],0 - jnc .end_1 - stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3 - .end_1: - jmp .end_0 - @@: - ;० ⠡஢ ࠦ - sub eax,[scaled_zoom] - stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, buf_vox,\ - [open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax - stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\ - OT_MAP_X,OT_MAP_Y,[tile_size], [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax - bt dword[mode_light],0 - jnc .end_2 - stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, 0,0, 0, [scaled_zoom], 3 - .end_2: - .end_0: - pop ecx ebx eax - - call draw_vox_cursor - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - stdcall [buf2d_draw], buf_pl ;塞 ࠭ - .end_f: - ret - -;ᮢ -align 4 -draw_vox_cursor: -pushad - mov ecx,[v_zoom] - cmp ecx,[scaled_zoom] - jle @f - mov ecx,[scaled_zoom] - @@: - xor edx,edx - inc edx - shl edx,cl - - mov eax,[v_cur_x] - cmp eax,edx - jge .end_f ; । - mov edi,[tile_size] - imul eax,edi - add eax,OT_MAP_X - mov ebx,edx - dec ebx - sub ebx,[v_cur_y] - imul ebx,edi - add ebx,OT_MAP_Y - inc eax - inc ebx - sub edi,2 - stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,edi,[sc.work_graph] - dec ebx - add edi,2 - - ;ਧ⠫ - sub eax,2 - mov ecx,edi - imul edi,edx - shr ecx,1 - add ebx,ecx ;業஢ । ⪨ - mov ecx,OT_MAP_X - add edi,ecx - stdcall [buf2d_line], buf_pl, ecx,ebx, eax,ebx,[sc.work_graph] - add eax,[tile_size] - inc eax - cmp eax,edi - jge @f ;᫨ - dec edi - stdcall [buf2d_line], buf_pl, eax,ebx, edi,ebx,[sc.work_graph] - @@: - - .end_f: -popad - ret - - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter ;.1 -.1: -db 'VOX',0 -.end: -db 0 - - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'buf2d.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'libini.obj',0 - -l_libs_start: - lib0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d - lib3 l_libs lib_name_3, file_name, system_dir_3, import_libini -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 - img_is_img dd aimg_is_img - img_info dd aimg_info - img_from_file dd aimg_from_file - img_to_file dd aimg_to_file - img_from_rgb dd aimg_from_rgb - img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode - img_encode dd aimg_encode - img_create dd aimg_create - img_destroy dd aimg_destroy - img_destroy_layer dd aimg_destroy_layer - img_count dd aimg_count - img_lock_bits dd aimg_lock_bits - img_unlock_bits dd aimg_unlock_bits - img_flip dd aimg_flip - img_flip_layer dd aimg_flip_layer - img_rotate dd aimg_rotate - img_rotate_layer dd aimg_rotate_layer - img_draw dd aimg_draw - - dd 0,0 - alib_init1 db 'lib_init',0 - aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ - aimg_info db 'img_info',0 - aimg_from_file db 'img_from_file',0 - aimg_to_file db 'img_to_file',0 - aimg_from_rgb db 'img_from_rgb',0 - aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ - aimg_encode db 'img_encode',0 - aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 - aimg_destroy_layer db 'img_destroy_layer',0 - aimg_count db 'img_count',0 - aimg_lock_bits db 'img_lock_bits',0 - aimg_unlock_bits db 'img_unlock_bits',0 - aimg_flip db 'img_flip',0 - aimg_flip_layer db 'img_flip_layer',0 - aimg_rotate db 'img_rotate',0 - aimg_rotate_layer db 'img_rotate_layer',0 - aimg_draw db 'img_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - -align 4 -import_buf2d: - init dd sz_init - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_curve_bezier dd sz_buf2d_curve_bezier - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_flood_fill dd sz_buf2d_flood_fill - buf2d_set_pixel dd sz_buf2d_set_pixel - buf2d_get_pixel dd sz_buf2d_get_pixel - buf2d_vox_brush_create dd sz_buf2d_vox_brush_create - buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete - buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g - buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g - buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g - buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g - buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled - buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows - buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl - buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled - - dd 0,0 - sz_init db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_flood_fill db 'buf2d_flood_fill',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - sz_buf2d_get_pixel db 'buf2d_get_pixel',0 - sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 - sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 - sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 - sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 - sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 - sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 - sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 - sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 - sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 - sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 - -align 4 -import_libini: - dd alib_init2 - ini_get_str dd aini_get_str - ini_get_int dd aini_get_int - ini_get_color dd aini_get_color -dd 0,0 - alib_init2 db 'lib_init',0 - aini_get_str db 'ini_get_str',0 - aini_get_int db 'ini_get_int',0 - aini_get_color db 'ini_get_color',0 - -; ᭮ ࠦ -align 4 -buf_0: dd 0 ;㪠⥫ a ࠦ -.l: dw 5 ;+4 left -.t: dw 45 ;+6 top -.w: dd 192+6 ;+8 w -.h: dd 224+7 ;+12 h -.color: dd 0xffffff ;+16 color - db 24 ;+20 bit in pixel - -; 㡨 ᭮ ࠦ -align 4 -buf_0z: dd 0 - dw 0 ;+4 left - dw 0 ;+6 top -.w: dd 192+6 ;+8 w -.h: dd 224+7 ;+12 h -.color: dd 0 ;+16 color - db 32 ;+20 bit in pixel - -; ᮢ १ ꥪ -align 4 -buf_pl: dd 0 -.l: dw 15+192+6 ;+4 left -.t: dw 45 ;+6 top -.w: dd 320 ;+8 w -.h: dd 330 ;+12 h -.color: dd 0xffffff ;+16 color - db 24 ;+20 bit in pixel - -; 襭 ७ -align 4 -buf_r_img: - rb BUF_STRUCT_SIZE -align 4 -buf_r_z: - rb BUF_STRUCT_SIZE - -align 4 -cursor_pointer dd 0 ;㪠⥫ - - -; ᮧ 쭮 筮 ᥫ -align 4 -vox_6_7_z: -dd 0,0,1,1,0,0,\ - 0,2,2,2,2,0,\ - 2,2,2,2,2,2,\ - 2,3,2,2,3,2,\ - 2,3,3,3,3,2,\ - 0,3,3,3,3,0,\ - 0,0,3,3,0,0 - -align 4 -buf_vox: - db 6,7,4,3 ;w,h,h_osn,n - rb BUF_STRUCT_SIZE*(3+1) - -align 16 -i_end: - procinfo process_information - sc system_colors - run_file_70 FileInfoBlock - mouse_dd dd ? - wnd_s_pos: ; ஥ ⮢ 樨 - rq 0 - rb 4096 ;2048 -stacktop: - sys_path rb 1024 - file_name rb 2048 ;4096 - plugin_path rb 1024 ;4096 - openfile_path rb 1024 ;4096 - filename_area rb 256 -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, openfile_path, sys_path + +include '../../../macros.inc' +include '../../../proc32.inc' +include '../../../KOSfuncs.inc' +include '../../../load_img.inc' +include '../../../load_lib.mac' +include '../trunk/vox_draw.inc' +include '../trunk/vox_rotate.inc' +include '../trunk/str.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load +if lang eq ru_RU +caption db '६饭 ᥫ 04.05.20',0 ; +else ; Default to en_US +caption db 'Voxel mover 04.05.20',0 +end if + +IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 +image_data_toolbar dd 0 + +;祭 㬮砭, ini 䠩 +ini_def_window_t equ 10 +ini_def_window_l equ 10 +ini_def_window_w equ 550 +ini_def_window_h equ 415 +ini_def_buf_w equ 198 ;=192+6 +ini_def_buf_h equ 231 ;=224+7 +ini_def_s_zoom equ 5 +ini_def_t_size equ 10 +ini_def_color_b equ 0xffffff +;ᠭ ࠬ஢ ini 䠩 +ini_name db 'vox_mover.ini',0 +ini_sec_window db 'Window',0 +key_window_t db 't',0 +key_window_l db 'l',0 +key_window_w db 'w',0 +key_window_h db 'h',0 +key_buf_w db 'buf_w',0 +key_buf_h db 'buf_h',0 +ini_sec_options db 'Options',0 +key_s_zoom db 's_zoom',0 +key_t_size db 'tile_size',0 +key_f_size db 'file_size',0 +key_col_b db 'c_background',0 + +OT_MAP_X equ 0 +OT_MAP_Y equ 0 +OT_CAPT_X_COLOR equ 5 ; 梥 +OT_CAPT_Y_COLOR equ 30 +PEN_MODE_NONE equ -1 +PEN_MODE_CLEAR equ 0 ;० ࠭ +PEN_MODE_SELECT_COLOR equ 2 ;० 롮 梥 + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib0 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + +;--- load ini file --- + copy_path ini_name,sys_path,file_name,0 + ;window startup pozition + stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l + mov word[wnd_s_pos+2],ax + stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w + mov word[wnd_s_pos],ax + stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t + mov word[wnd_s_pos+6],ax + stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h + mov word[wnd_s_pos+4],ax + ;image buffer size + stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_w,ini_def_buf_w + mov [buf_0.w],eax + mov [buf_0z.w],eax + add ax,15 + mov [buf_pl.l],ax ; ࠢ + stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_h,ini_def_buf_h + mov [buf_0.h],eax + mov [buf_0z.h],eax + ;梥 䮭 + stdcall dword[ini_get_color],file_name,ini_sec_window,key_col_b,ini_def_color_b + mov [buf_0.color],eax + mov [buf_pl.color],eax + + ;⠡, ᫥ ண 㤥 㢥祭 + stdcall dword[ini_get_int],file_name,ini_sec_options,key_s_zoom,ini_def_s_zoom + mov [scaled_zoom],eax + ;ࠧ ⨪ ᪮ 祭 + stdcall dword[ini_get_int],file_name,ini_sec_options,key_t_size,ini_def_t_size + mov [tile_size],eax + + stdcall dword[ini_get_int],file_name,ini_sec_options,key_f_size,64 + shl eax,10 + mov [max_open_file_size],eax + + mov ecx,[scaled_zoom] + xor eax,eax + inc eax + shl eax,cl + imul eax,[tile_size] + mov [buf_pl.w],eax + add eax,[tile_size] + mov [buf_pl.h],eax + + + stdcall [buf2d_create], buf_0 ;ᮧ ࠦ + stdcall [buf2d_create], buf_0z ;ᮧ 㡨 + stdcall [buf2d_create], buf_pl ;ᮧ 祭 + + stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z + + include_image_file 'toolbar_m.png', image_data_toolbar + + stdcall mem.Alloc,[max_open_file_size] + mov dword[open_file_vox],eax + stdcall mem.Alloc,[max_open_file_size] + mov dword[moved_file_vox],eax + + stdcall but_new_file, [open_file_vox] + stdcall but_new_file, [moved_file_vox] + ;஢ઠ ப + cmp dword[openfile_path],0 + je @f + call but_open_file_cmd_lin + @@: + +align 4 +red_win: + call draw_window + +align 4 +still: + mcall SF_WAIT_EVENT + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + mcall SF_THREAD_INFO,procinfo,-1 + cmp ax,word[procinfo+4] + jne @f ; ⨢ + call mouse + @@: + jmp still + +align 4 +mouse: + pushad + mcall SF_MOUSE_GET,SSF_BUTTON + bt eax,1 ;right button + jnc @f + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + shr ebx,16 + and eax,0xffff + stdcall get_buf_color, buf_0 + stdcall get_buf_color, buf_pl + jmp .end_f + @@: + bt eax,0 ;left button + jnc .end_f + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + shr ebx,16 + and eax,0xffff + + push eax ebx + mov edx,[v_zoom] + cmp edx,[scaled_zoom] + jle @f + ;० ⠡஢ ࠦ + sub edx,[scaled_zoom] + sub ax,word[buf_0.t] + sub bx,word[buf_0.l] + stdcall get_mouse_ev_scale, buf_vox, ebx, eax, [scaled_zoom],edx + cmp eax,0 + je @f + mov ebx,eax + and eax,0x3fffffff + rol ebx,2 + and ebx,3 + dec ebx + + shl ebx,2 + add ebx,cam_x + mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z] + call draw_objects + + pop ebx eax + jmp .end_f + @@: + pop ebx eax + + + ;eax - mouse coord y + ;ebx - mouse coord x + movzx edx,word[buf_pl.t] + add edx,OT_MAP_Y + cmp eax,edx + jl .end_f + sub eax,edx + xor edx,edx + mov ecx,[tile_size] ;H + div ecx + movzx edx,word[buf_pl.l] + add edx,OT_MAP_X + cmp ebx,edx + jl .end_f + call convert_y ;८ࠧ न y + cmp eax,0 + jge .end_0 ;࠭祭 न y + cmp eax,-1 + jne .end_f + ;塞 祭, ⨪ + sub ebx,edx + mov eax,ebx + xor edx,edx + mov ecx,[tile_size] ;W + div ecx + mov [n_plane],eax + jmp .end_1 + .end_0: + mov [v_cur_y],eax ;Y-coord + sub ebx,edx + mov eax,ebx + xor edx,edx + mov ecx,[tile_size] ;W + div ecx + mov [v_cur_x],eax ;X-coord + + .end_1: + call draw_objects + call draw_pok + .end_f: + popad + ret + +;input: +; eax - coord y +; ebx - coord x +align 4 +proc get_buf_color, buf:dword +pushad + mov edi,[buf] + cmp ax,buf2d_t + jl .end_f + sub ax,buf2d_t + cmp eax,buf2d_h + jg .end_f + cmp bx,buf2d_l + jl .end_f + sub bx,buf2d_l + cmp ebx,buf2d_w + jg .end_f + stdcall [buf2d_get_pixel], edi,ebx,eax + mov [v_color],eax + call on_change_color ;⮡ࠦ 梥 + .end_f: +popad + ret +endp + +;८ࠧ뢠 न y (祭 㢥稢 ) +align 4 +convert_y: + push ecx edx + mov ecx,[v_zoom] + cmp ecx,[scaled_zoom] + jle @f + mov ecx,[scaled_zoom] + @@: + mov edx,1 + cmp ecx,1 + jl @f + shl edx,cl + @@: + sub edx,eax + dec edx + mov eax,edx + pop edx ecx + ret + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + ; *** ᮢ (믮 1 ࠧ ᪥) *** + mov edx,[sc.work] + or edx,(3 shl 24)+0x30000000 + mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,caption + + ; *** ᮧ *** + mov esi,[sc.work_button] + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3 + + mov ebx,(30 shl 16)+20 + mov edx,4 + int 0x40 + add ebx,25 shl 16 + mov edx,5 + int 0x40 + add ebx,30 shl 16 + mov edx,6 + int 0x40 + add ebx,25 shl 16 + mov edx,7 + int 0x40 + add ebx,25 shl 16 + mov edx,8 + int 0x40 + add ebx,25 shl 16 + mov edx,9 + int 0x40 + add ebx,25 shl 16 + mov edx,10 + int 0x40 + add ebx,25 shl 16 + mov edx,11 + int 0x40 + add ebx,25 shl 16 + mov edx,12 + int 0x40 + add ebx,25 shl 16 + mov edx,13 + int 0x40 + add ebx,25 shl 16 + mov edx,14 + int 0x40 + add ebx,25 shl 16 + mov edx,15 + int 0x40 + add ebx,25 shl 16 + mov edx,16 + int 0x40 + add ebx,25 shl 16 + mov edx,17 + int 0x40 + add ebx,25 shl 16 + mov edx,18 + int 0x40 + add ebx,25 shl 16 + mov edx,19 + int 0x40 + add ebx,25 shl 16 + mov edx,20 + int 0x40 + + ; *** ᮢ *** + mov edx,(7 shl 16)+7 ;icon new + mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon open + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon save + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;㢥. ⠡ + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;㬥. ⠡ + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; 1 + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; 2 + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;ᤢ ᪮ + + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;ᤢ ᪮ - + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;ᢥ饭 + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;७ 2*2 + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ; + int 0x40 + + ; *** ᮢ ஢ *** + call draw_objects + call draw_pok + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +draw_pok: + mov esi,[sc.work_button_text] + or esi,(1 shl 30) + mov edi,[sc.work_button] + mcall SF_DRAW_NUMBER, (3 shl 16)+(1 shl 31), [v_zoom], ((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 ;⠡ + mov ecx,[n_plane] + add edx,115 shl 16 ;9 + int 0x40 ; 祭 + + ; ࠬ஢ + mov dword[txt_curor.size],0 + mov eax,dword[v_cur_x] + mov edi,txt_curor.size + stdcall convert_int_to_str,10 + stdcall str_cat, edi,txt_mull + mov eax,dword[v_cur_y] + mov edi,txt_buf + stdcall convert_int_to_str,16 + stdcall str_cat, txt_curor.size,edi + stdcall str_cat, txt_curor.size,txt_space ;騩 ஡ + + ; ࠬ஢ + mov dword[txt_mov_offs.size],0 + mov eax,dword[mov_x] + mov edi,txt_mov_offs.size + stdcall convert_int_to_str,30 + stdcall str_cat, edi,txt_space + mov eax,dword[mov_y] + mov edi,txt_buf + stdcall convert_int_to_str,16 + stdcall str_cat, txt_mov_offs.size,edi + stdcall str_cat, txt_mov_offs.size,txt_space + mov eax,dword[mov_z] + mov edi,txt_buf + stdcall convert_int_to_str,16 + stdcall str_cat, txt_mov_offs.size,edi + stdcall str_cat, txt_mov_offs.size,txt_space ;騩 ஡ + + ;ᮢ ⥪ + mov ecx,[sc.work_text] + or ecx,0x80000000 ;or (1 shl 30) + mcall SF_DRAW_TEXT, (OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2,,txt_color + + mov edx,txt_curor + add ebx,115 shl 16 + or ecx,(1 shl 30) + mov edi,[sc.work] + int 0x40 + + mov edx,txt_mov_offs + add ebx,115 shl 16 + int 0x40 + + mov edx,txt_zoom + add ebx,115 shl 16 + int 0x40 + + mov edx,txt_n_plane + add ebx,115 shl 16 + int 0x40 + + call on_change_color + ret + +align 4 +on_change_color: +pushad + mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ; x + mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ; y + mcall SF_DRAW_RECT,,,[v_color] + + mov ecx,edx + mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2 + mov esi,[sc.work_text] + add esi,(1 shl 30) + mov edi,[sc.work] + mcall SF_DRAW_NUMBER,(1 shl 8)+(6 shl 16) +popad + ret + +align 4 +key: + mcall SF_GET_KEY + jmp still + + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + stdcall but_new_file, [open_file_vox] + call draw_objects + call draw_pok + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_zoom_p + jmp still + @@: + cmp ah,7 + jne @f + call but_zoom_m + jmp still + @@: + cmp ah,8 + jne @f + call but_3 + jmp still + @@: + cmp ah,9 + jne @f + call but_4 + jmp still + @@: + cmp ah,10 + jne @f + call but_plane_inc + jmp still + @@: + cmp ah,11 + jne @f + call but_plane_dec + jmp still + @@: + cmp ah,12 + jne @f + call but_light + jmp still + @@: + cmp ah,13 + jne @f + call but_rend_2_2 + jmp still + @@: + cmp ah,14 + jne @f + call but_move + jmp still + @@: + cmp ah,15 + jne @f + dec dword[mov_x] + call draw_pok + jmp still + @@: + cmp ah,16 + jne @f + inc dword[mov_x] + call draw_pok + jmp still + @@: + cmp ah,17 + jne @f + dec dword[mov_y] + call draw_pok + jmp still + @@: + cmp ah,18 + jne @f + inc dword[mov_y] + call draw_pok + jmp still + @@: + cmp ah,19 + jne @f + dec dword[mov_z] + call draw_pok + jmp still + @@: + cmp ah,20 + jne @f + inc dword[mov_z] + call draw_pok + jmp still + @@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall [buf2d_delete],buf_0z + cmp dword[buf_r_img],0 + je @f + stdcall [buf2d_delete],buf_r_img + stdcall [buf2d_delete],buf_r_z + @@: + stdcall [buf2d_vox_brush_delete], buf_vox + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_vox] + stdcall mem.Free,[moved_file_vox] + mcall SF_TERMINATE_PROCESS + +; 樠樨 ᥫ쭮 ꥪ +align 4 +vox_new_data: + db 2,0,0,0 + db 0,1,2,3, 4,5,6,7 ;default table + dd 0 ;null node + +;樠 ᥫ쭮 ꥪ +align 4 +proc but_new_file uses ecx edi esi, file_data:dword + mov ecx,vox_offs_data+4 + mov esi,vox_new_data + mov edi,[file_data] + cld + rep movsb + ret +endp + +align 4 +open_file_vox dd 0 ;㪠⥫ 䠩 +moved_file_vox dd 0 + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 +pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je @f + ; 㤠筮 ⨨ + call but_open_file_cmd_lin + @@: +popad + ret + +align 4 +but_open_file_cmd_lin: +pushad + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + m2m dword[run_file_70.Count], dword[max_open_file_size] + m2m [run_file_70.Buffer], [open_file_vox] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_open_file + + mcall SF_SET_CAPTION,1,openfile_path + + ;--- + mov eax,[open_file_vox] + movzx eax,byte[eax] + and eax,0xff ;६ ⠡ 㬮砭 + mov dword[v_zoom],eax ;६ ⠡ 㬮砭 + mov dword[cam_x],0 + mov dword[cam_y],0 + mov dword[cam_z],0 + call draw_objects + .end_open_file: +popad + ret + +align 4 +but_save_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ; 㤠筮 ⨨ + + mov eax,dword[v_zoom] ; ⠡ 㬮砭 + mov ebx,[moved_file_vox] + mov byte[ebx],al + + stdcall buf2d_vox_obj_get_size, ebx + mov dword[run_file_70.Count], eax ;ࠧ 䠩 + mov [run_file_70.Function], SSF_CREATE_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov ebx, dword[moved_file_vox] + mov [run_file_70.Buffer], ebx + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_save_file + + .end_save_file: + popad + ret + +;㢥祭 ⠡ +align 4 +but_zoom_p: + cmp dword[v_zoom],10 ;ᨬ ࠧ, ண 㢥 2^10=1024 + jge @f + inc dword[v_zoom] + shl dword[n_plane],1 + push eax + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jl .end_0 + push ecx + mov ecx,[scaled_zoom] + xor eax,eax + inc eax + shl eax,cl + shl dword[cam_x],1 + shl dword[cam_y],1 + shl dword[cam_z],1 + cmp eax,[n_plane] + jg .end_1 + ;४஢ 㭪 + sub [n_plane],eax + inc dword[cam_y] + .end_1: + pop ecx + .end_0: + pop eax + call draw_objects + call draw_pok + @@: + ret + +;㬥襭 ⠡ +align 4 +but_zoom_m: + cmp dword[v_zoom],1 + jl @f + dec dword[v_zoom] + shr dword[n_plane],1 + push eax + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jl .end_0 + shr dword[cam_x],1 + shr dword[cam_y],1 + jnc .end_1 + ;४஢ 㭪 + push ecx + mov ecx,[scaled_zoom] + dec ecx + xor eax,eax + inc eax + shl eax,cl + add [n_plane],eax + pop ecx + .end_1: + shr dword[cam_z],1 + .end_0: + pop eax + call draw_objects + call draw_pok + @@: + ret + +align 4 +but_3: + stdcall vox_obj_rot_z, [open_file_vox] + call draw_objects + ret + +align 4 +but_4: + stdcall vox_obj_rot_x, [open_file_vox] + call draw_objects + ret + +;ᤢ ᪮ १ +align 4 +but_plane_inc: +push eax ecx + inc dword[n_plane] + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jle .end_0 + ;ந室 ⠡஢ + mov ecx,[scaled_zoom] + xor eax,eax + inc eax + shl eax,cl + cmp eax,[n_plane] + jg @f + mov dword[n_plane],0 + inc dword[cam_y] ;室 ᥤ + neg ecx + ;inc ecx + add ecx,[v_zoom] + xor eax,eax + inc eax + shl eax,cl + cmp eax,[cam_y] + jg @f + mov dword[cam_y],0 ;横 ᫨ 뫥 । ᫥ 㡠 + @@: + jmp .end_1 + .end_0: + ;⠡஢ ந室 + mov ecx,eax + xor eax,eax + inc eax + shl eax,cl + cmp eax,[n_plane] + jg .end_1 + mov dword[n_plane],0 + .end_1: + call draw_objects + call draw_pok +pop ecx eax + ret + +;ᤢ ᪮ १ +align 4 +but_plane_dec: + dec dword[n_plane] + cmp dword[n_plane],0 + jge .end_f +push eax ecx + mov ecx,[scaled_zoom] + xor eax,eax + inc eax + shl eax,cl + dec eax + mov dword[n_plane],eax + + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jle .end_0 + ;ந室 ⠡஢ + dec dword[cam_y] ;室 ᥤ + cmp dword[cam_y],0 + jge .end_0 + + mov ecx,eax + sub ecx,[scaled_zoom] + xor eax,eax + inc eax + shl eax,cl + dec eax + mov dword[cam_y],eax ;᫨ 㡠 0 ࠢ塞 ᨬ쭮 祭 + .end_0: +pop ecx eax + .end_f: + call draw_objects + call draw_pok + ret + +align 4 +but_light: + xor dword[mode_light],1 + call draw_objects + ret + +align 4 +but_rend_2_2: +push edi + cmp dword[buf_r_img],0 + jne @f + ;ᮧ ७ + push ecx esi + mov edi,buf_r_img + mov esi,buf_0 + mov ecx,BUF_STRUCT_SIZE + cld + rep movsb ;㥬 ࠬ ᭮ + mov edi,buf_r_img + mov buf2d_data,0 + shl buf2d_w,1 ;㢥稢 ࠧ + shl buf2d_h,1 + stdcall [buf2d_create],buf_r_img + + mov edi,buf_r_z + mov esi,buf_0z + mov ecx,BUF_STRUCT_SIZE + cld + rep movsb ;㥬 ࠬ ᭮ + mov edi,buf_r_z + mov buf2d_data,0 + shl buf2d_w,1 ;㢥稢 ࠧ + shl buf2d_h,1 + stdcall [buf2d_create],buf_r_z + pop esi ecx + @@: + stdcall [buf2d_clear], buf_r_img, [buf_0.color] ;⨬ + stdcall [buf2d_clear], buf_r_z, 0 ;⨬ + + push eax ebx ecx + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jle .end_scaled + ;७ 㢥祭 ꥪ + mov ebx,[scaled_zoom] + sub eax,ebx + inc ebx + stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, buf_vox,\ + [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] + bt dword[mode_light],0 + jnc @f + stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, ebx, 3 + @@: + xor ebx,ebx + xor ecx,ecx + mov edi,buf_r_img + stdcall [buf2d_img_hdiv2], edi + shr buf2d_h,1 + stdcall [buf2d_img_wdiv2], edi + shr buf2d_w,1 + jmp .show + .end_scaled: + + inc eax + stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, eax + stdcall [buf2d_vox_obj_draw_1g], buf_r_img, buf_r_z, [open_file_vox], 0,0, eax + bt dword[mode_light],0 + jnc @f + stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, eax, 3 + @@: + + mov edi,buf_r_img + stdcall [buf2d_img_hdiv2], edi + shr buf2d_h,1 + stdcall [buf2d_img_wdiv2], edi + shr buf2d_w,1 + + stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom] + mov ebx,[buf_0.w] + sub ebx,eax + shr ebx,1 ;ebx - 業஢ 쪨 ࠦ ਧ⠫ + stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom] + cmp eax,[buf_0.h] + jg @f + mov ecx,[buf_0.h] + sub ecx,eax + shr ecx,1 ;ecx - 業஢ 쪨 ࠦ ⨪ + @@: + .show: + stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi + shl buf2d_h,1 + shl buf2d_w,1 + pop ecx ebx eax +pop edi + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +align 4 +but_move: +push eax + stdcall but_new_file, [moved_file_vox] + mov eax,[v_zoom] + stdcall buf_vox_obj_recreat, [open_file_vox], [moved_file_vox],\ + [mov_x],[mov_y],[mov_z], eax + + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + stdcall [buf2d_clear], buf_0z, 0 ;⨬ + cmp eax,[scaled_zoom] + jle @f + mov eax,[scaled_zoom] + @@: + stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox, [moved_file_vox], 0,0,0, eax +pop eax + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +;description: +; 㭪 ᥫ ꥪ ( 3 ࠭) +;input: +; v_obj - ᥫ ꥪ +; k_scale - . ⠡஢ ࠦ +align 4 +proc buf_vox_obj_recreat, v_obj:dword, obj_n:dword,\ +coord_x:dword, coord_y:dword, coord_z:dword, k_scale:dword +pushad + mov edi,[v_obj] + mov ecx,[k_scale] + mov ebx,[coord_x] + mov edx,[coord_y] + add edi,vox_offs_data + mov esi,[coord_z] + stdcall vox_go_in_node, [v_obj], [obj_n] +popad + ret +endp + +;input: +; ebx - coord_x +; edx - coord_y +; esi - coord_z +; ecx - ஢ ⥪襣 㧫 +; edi - 㪠⥫ ᥫ쭮 ꥪ +align 4 +proc vox_go_in_node, v_obj:dword, obj_n:dword + cmp byte[edi+3],0 ;ᬮਬ ॢ + je .sub_trees + ;४ᨢ ॡ ॢ쥢 + push eax edx + + ;ᮢ ࠬ ᫨ ࠧ 㧫 = 1 + cmp ecx,0 + jne @f + stdcall buf2d_vox_obj_create_node, [obj_n], ebx,edx,esi, [v_zoom], [edi] + @@: + + ;室 㧫 + dec ecx + mov ah,byte[edi+3] + add edi,4 + mov al,8 + .cycle: + bt ax,8 ;㥬 ⮫쪮 ah + jnc .c_next + push ebx edx esi + stdcall vox_corect_coords, [v_obj] + stdcall vox_go_in_node, [v_obj], [obj_n] + pop esi edx ebx + .c_next: + shr ah,1 + dec al + jnz .cycle + + ;室 㧫 + inc ecx + pop edx eax + + jmp .end_f + .sub_trees: + ;㥬 㧥 + cmp ecx,0 + jne @f + stdcall buf2d_vox_obj_create_node, [obj_n], ebx,edx,esi, [v_zoom], [edi] + @@: + + add edi,4 + .end_f: + ret +endp + +;description: +;㭪 ४஢ न +;ࠢ ᥩ न ᥫ: +;*z +;| +;+ +; * y +; / +;+ +; \ +; * x +;input: +; al - 㧫 ॢ ( 1 8) +; ebx - न x +; edx - न y +; esi - न z +; ecx - ஢ ⥪襣 㧫 +;output: +; ebx - न x +; edx - न y +; esi - न z +align 4 +proc vox_corect_coords, v_obj:dword + cmp ecx,0 + jl .end_f ; ᪮७ ᮢ + + push eax edi + and eax,15 ;뤥塞 㧫 ॢ + mov edi,[v_obj] + add edi,vox_offs_tree_table + add edi,8 + sub edi,eax + + xor eax,eax + inc eax + cmp ecx,1 + jl .no_scale ; 横 + shl eax,cl + .no_scale: + + bt word[edi],0 ;test voxel coord x + jnc @f + add ebx,eax + @@: + bt word[edi],1 ;test voxel coord y + jnc @f + add edx,eax + @@: + bt word[edi],2 ;test voxel coord z + jnc @f + add esi,eax + @@: + pop edi eax + .end_f: + ret +endp + +align 4 +v_zoom dd 3 ;⥪騩 ⠡ +v_cur_x dd 0 ;न x +v_cur_y dd 0 ;न y ( ꥪ z) +n_plane dd 0 ;᪮ 祭 +v_color dd 0xff ;梥 ࠭ +mode_light dd 1 ;० ᢥ饭 +cam_x dd 0 +cam_y dd 0 +cam_z dd 0 +;ᤢ ꥪ ᮧ (।) +mov_x dd 0 +mov_y dd 0 +mov_z dd 0 +scaled_zoom dd 5 ;⠡ ᫥ ண 稭 ᮢ ࠦ +tile_size dd ? ;ࠧ ⨪ ᪮ 祭 +max_open_file_size dd ? +brush_w dd 5 ;ਭ +brush_h dd 5 ; +brush_data dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 +dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 +dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 +dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 +dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 +rd 999 ;32*32-25 + +if lang eq ru_RU +txt_zoom db '⠡:',0 +txt_curor: db ': ' +.size: rb 10 +txt_n_plane db '祭:',0 +txt_color db ':',0 +txt_mov_offs: db '饭: ' + +else ; Default to en_US +txt_zoom db 'Scale:',0 +txt_curor: db 'Cursor: ' +.size: rb 10 +txt_n_plane db 'Section:',0 +txt_color db 'Color:',0 +txt_mov_offs: db 'Offset: ' +end if + +.size: rb 30 +txt_mull db '*',0 +txt_space db ' ',0 +txt_buf rb 16 + +align 4 +draw_objects: + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + stdcall [buf2d_clear], buf_0z, 0 ;⨬ + stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;⨬ + + push eax ebx ecx + stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom] + mov ebx,[buf_0.w] + sub ebx,eax + shr ebx,1 ;ebx - 業஢ 쪨 ࠦ ਧ⠫ + + xor ecx,ecx + stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom] + cmp eax,[buf_0.h] + jg @f + mov ecx,[buf_0.h] + sub ecx,eax + shr ecx,1 ;ecx - 業஢ 쪨 ࠦ + @@: + + mov eax,[v_zoom] + cmp eax,[scaled_zoom] + jg @f + ; ० ࠦ + stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox,\ + [open_file_vox], ebx,ecx, 0, eax + stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox],\ + OT_MAP_X,OT_MAP_Y,[tile_size], eax, [n_plane], [sc.work_graph] + stdcall [buf2d_vox_obj_draw_1g], buf_0, buf_0z,\ + [open_file_vox], 0,0, eax + bt dword[mode_light],0 + jnc .end_1 + stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3 + .end_1: + jmp .end_0 + @@: + ;० ⠡஢ ࠦ + sub eax,[scaled_zoom] + stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, buf_vox,\ + [open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax + stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\ + OT_MAP_X,OT_MAP_Y,[tile_size], [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax + bt dword[mode_light],0 + jnc .end_2 + stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, 0,0, 0, [scaled_zoom], 3 + .end_2: + .end_0: + pop ecx ebx eax + + call draw_vox_cursor + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + stdcall [buf2d_draw], buf_pl ;塞 ࠭ + .end_f: + ret + +;ᮢ +align 4 +draw_vox_cursor: +pushad + mov ecx,[v_zoom] + cmp ecx,[scaled_zoom] + jle @f + mov ecx,[scaled_zoom] + @@: + xor edx,edx + inc edx + shl edx,cl + + mov eax,[v_cur_x] + cmp eax,edx + jge .end_f ; । + mov edi,[tile_size] + imul eax,edi + add eax,OT_MAP_X + mov ebx,edx + dec ebx + sub ebx,[v_cur_y] + imul ebx,edi + add ebx,OT_MAP_Y + inc eax + inc ebx + sub edi,2 + stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,edi,[sc.work_graph] + dec ebx + add edi,2 + + ;ਧ⠫ + sub eax,2 + mov ecx,edi + imul edi,edx + shr ecx,1 + add ebx,ecx ;業஢ । ⪨ + mov ecx,OT_MAP_X + add edi,ecx + stdcall [buf2d_line], buf_pl, ecx,ebx, eax,ebx,[sc.work_graph] + add eax,[tile_size] + inc eax + cmp eax,edi + jge @f ;᫨ + dec edi + stdcall [buf2d_line], buf_pl, eax,ebx, edi,ebx,[sc.work_graph] + @@: + + .end_f: +popad + ret + + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'VOX',0 +.end: +db 0 + + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'libini.obj',0 + +l_libs_start: + lib0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d + lib3 l_libs lib_name_3, file_name, system_dir_3, import_libini +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 + img_is_img dd aimg_is_img + img_info dd aimg_info + img_from_file dd aimg_from_file + img_to_file dd aimg_to_file + img_from_rgb dd aimg_from_rgb + img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_encode dd aimg_encode + img_create dd aimg_create + img_destroy dd aimg_destroy + img_destroy_layer dd aimg_destroy_layer + img_count dd aimg_count + img_lock_bits dd aimg_lock_bits + img_unlock_bits dd aimg_unlock_bits + img_flip dd aimg_flip + img_flip_layer dd aimg_flip_layer + img_rotate dd aimg_rotate + img_rotate_layer dd aimg_rotate_layer + img_draw dd aimg_draw + + dd 0,0 + alib_init1 db 'lib_init',0 + aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ + aimg_info db 'img_info',0 + aimg_from_file db 'img_from_file',0 + aimg_to_file db 'img_to_file',0 + aimg_from_rgb db 'img_from_rgb',0 + aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_encode db 'img_encode',0 + aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 + aimg_destroy_layer db 'img_destroy_layer',0 + aimg_count db 'img_count',0 + aimg_lock_bits db 'img_lock_bits',0 + aimg_unlock_bits db 'img_unlock_bits',0 + aimg_flip db 'img_flip',0 + aimg_flip_layer db 'img_flip_layer',0 + aimg_rotate db 'img_rotate',0 + aimg_rotate_layer db 'img_rotate_layer',0 + aimg_draw db 'img_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_curve_bezier dd sz_buf2d_curve_bezier + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_flood_fill dd sz_buf2d_flood_fill + buf2d_set_pixel dd sz_buf2d_set_pixel + buf2d_get_pixel dd sz_buf2d_get_pixel + buf2d_vox_brush_create dd sz_buf2d_vox_brush_create + buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete + buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g + buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g + buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g + buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g + buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled + buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows + buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl + buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled + + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_flood_fill db 'buf2d_flood_fill',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + sz_buf2d_get_pixel db 'buf2d_get_pixel',0 + sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 + sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 + sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 + sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 + sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 + sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 + sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 + sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 + sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 + sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 + +align 4 +import_libini: + dd alib_init2 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init2 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +; ᭮ ࠦ +align 4 +buf_0: dd 0 ;㪠⥫ a ࠦ +.l: dw 5 ;+4 left +.t: dw 45 ;+6 top +.w: dd 192+6 ;+8 w +.h: dd 224+7 ;+12 h +.color: dd 0xffffff ;+16 color + db 24 ;+20 bit in pixel + +; 㡨 ᭮ ࠦ +align 4 +buf_0z: dd 0 + dw 0 ;+4 left + dw 0 ;+6 top +.w: dd 192+6 ;+8 w +.h: dd 224+7 ;+12 h +.color: dd 0 ;+16 color + db 32 ;+20 bit in pixel + +; ᮢ १ ꥪ +align 4 +buf_pl: dd 0 +.l: dw 15+192+6 ;+4 left +.t: dw 45 ;+6 top +.w: dd 320 ;+8 w +.h: dd 330 ;+12 h +.color: dd 0xffffff ;+16 color + db 24 ;+20 bit in pixel + +; 襭 ७ +align 4 +buf_r_img: + rb BUF_STRUCT_SIZE +align 4 +buf_r_z: + rb BUF_STRUCT_SIZE + +align 4 +cursor_pointer dd 0 ;㪠⥫ + + +; ᮧ 쭮 筮 ᥫ +align 4 +vox_6_7_z: +dd 0,0,1,1,0,0,\ + 0,2,2,2,2,0,\ + 2,2,2,2,2,2,\ + 2,3,2,2,3,2,\ + 2,3,3,3,3,2,\ + 0,3,3,3,3,0,\ + 0,0,3,3,0,0 + +align 4 +buf_vox: + db 6,7,4,3 ;w,h,h_osn,n + rb BUF_STRUCT_SIZE*(3+1) + +align 16 +i_end: + procinfo process_information + sc system_colors + run_file_70 FileInfoBlock + mouse_dd dd ? + wnd_s_pos: ; ஥ ⮢ 樨 + rq 0 + rb 4096 ;2048 +stacktop: + sys_path rb 1024 + file_name rb 2048 ;4096 + plugin_path rb 1024 ;4096 + openfile_path rb 1024 ;4096 + filename_area rb 256 +mem: diff --git a/programs/media/voxel_editor/utilites/vox_tgl.asm b/programs/media/voxel_editor/utilites/vox_tgl.asm index 9d3d15ee5..e5608bdad 100644 --- a/programs/media/voxel_editor/utilites/vox_tgl.asm +++ b/programs/media/voxel_editor/utilites/vox_tgl.asm @@ -1,1053 +1,1055 @@ -use32 - org 0 - db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 - dd 1, start, i_end, mem, stacktop, openfile_path, sys_path - -include '../../../macros.inc' -include '../../../proc32.inc' -include '../../../KOSfuncs.inc' -include '../../../load_img.inc' -include '../../../load_lib.mac' -include '../../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' -include '../../../develop/libraries/TinyGL/asm_fork/zbuffer.inc' -include 'vox_3d.inc' -include '../trunk/str.inc' -include 'lang.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load -if lang eq ru_RU -caption db 'ᬮ ᥫ 11.11.20',0 ; -else -caption db 'Voxel viewer 11.11.20',0 -end if - -3d_wnd_l equ 5 ; tinygl ᫥ -3d_wnd_t equ 30 ; tinygl ᢥ -3d_wnd_w equ 512 -3d_wnd_h equ 512 - -IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 -IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10 - -align 4 -start: - load_libraries l_libs_start,l_libs_end - ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ - mov ebp,lib_0 - cmp dword [ebp+ll_struc_size-4],0 - jz @f - mcall SF_TERMINATE_PROCESS - @@: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors - mcall SF_SET_EVENTS_MASK,0xC0000027 - stdcall [OpenDialog_Init],OpenDialog_data ;⮢ - - stdcall [buf2d_create], buf_0 ;ᮧ - - include_image_file 'toolbar_t.png', image_data_toolbar,,,6 ;6 - for gray icons - mov eax,[image_data_toolbar] - add eax,IMAGE_TOOLBAR_SIZE - stdcall img_to_gray, [image_data_toolbar],eax,(IMAGE_TOOLBAR_SIZE)/3 - - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 - stdcall [glEnable], GL_DEPTH_TEST - stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ - stdcall [glClearColor], 0.0,0.0,0.0,0.0 - stdcall [glShadeModel], GL_SMOOTH - - call but_new_file - ;஢ઠ ப - cmp dword[openfile_path],0 - je @f - call but_open_file_cmd_lin - @@: - -align 4 -red_win: - call draw_window - -align 4 -still: - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov ebx,[last_time] - add ebx,50 ;প - cmp ebx,eax - jge @f - mov ebx,eax - @@: - sub ebx,eax - mcall SF_WAIT_EVENT_TIMEOUT - bt word[opt_auto_rotate],0 - jnc @f - or eax,eax - jz timer_funct - @@: - - cmp al,1 - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - cmp al,6 - jne @f - call mouse - @@: - - jmp still - -align 4 -timer_funct: - pushad - mcall SF_SYSTEM_GET,SSF_TIME_COUNT - mov [last_time],eax - - ;⮬᪮ 㣫 - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - call draw_3d - call [kosglSwapBuffers] - - popad - jmp still - -align 4 -draw_window: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - ; *** ᮢ (믮 1 ࠧ ᪥) *** - mov edx,[sc.work] - or edx,(3 shl 24)+0x30000000 - mcall SF_CREATE_WINDOW,(20 shl 16)+800,(20 shl 16)+570,,,caption - - ; *** ᮧ *** - mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button] - - mov ebx,(30 shl 16)+20 - mcall ,,,4 - add ebx,25 shl 16 - mcall ,,,5 - add ebx,30 shl 16 - mcall ,,,6 - add ebx,25 shl 16 - mcall ,,,7 - add ebx,25 shl 16 - mcall ,,,8 - add ebx,25 shl 16 - mcall ,,,9 - add ebx,25 shl 16 - mcall ,,,10 - add ebx,25 shl 16 - mcall ,,,11 - add ebx,25 shl 16 - mcall ,,,12 - - call draw_toolbar_i - - stdcall [buf2d_draw], buf_0 - call [kosglSwapBuffers] - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - - -align 4 -draw_toolbar_i: - ; *** ᮢ *** - mov edx,(7 shl 16)+7 ;icon new - mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon open - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;icon save - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(30 shl 16) ;zoom + - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;zoom - - int 0x40 - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - cmp word[opt_light],0 - jne @f - add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon - @@: - add edx,(25 shl 16) ;light on/off - int 0x40 - cmp word[opt_light],0 - jne @f - sub ebx,IMAGE_TOOLBAR_SIZE - @@: - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - cmp word[opt_cube_box],0 - jne @f - add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon - @@: - add edx,(25 shl 16) ;box on/off - int 0x40 - cmp word[opt_cube_box],0 - jne @f - sub ebx,IMAGE_TOOLBAR_SIZE - @@: - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - cmp word[opt_auto_rotate],0 - jne @f - add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon - @@: - add edx,(25 shl 16) ;auto rotate on/off - int 0x40 - cmp word[opt_auto_rotate],0 - jne @f - sub ebx,IMAGE_TOOLBAR_SIZE - @@: - - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;info voxels - int 0x40 - add ebx,IMAGE_TOOLBAR_ICON_SIZE - add edx,(25 shl 16) ;refresh - int 0x40 - ret - - -align 4 -key: - mcall SF_GET_KEY - - cmp ah,178 ;Up - jne @f - fld dword[angle_x] - fadd dword[delt_size] - fstp dword[angle_x] - jmp .end0 - @@: - cmp ah,177 ;Down - jne @f - fld dword[angle_x] - fsub dword[delt_size] - fstp dword[angle_x] - jmp .end0 - @@: - cmp ah,176 ;Left - jne @f - fld dword[angle_y] - fadd dword[delt_size] - fstp dword[angle_y] - jmp .end0 - @@: - cmp ah,179 ;Right - jne still ;@f - fld dword[angle_y] - fsub dword[delt_size] - fstp dword[angle_y] - .end0: - call draw_3d - call [kosglSwapBuffers] - ;@@: - jmp still - - -align 4 -mouse: - push eax ebx - mcall SF_MOUSE_GET,SSF_BUTTON_EXT - bt eax,0 - jnc .end_m - ;mouse l. but. move - cmp dword[mouse_drag],1 - jne .end_m - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jg @f - mov ebx,3d_wnd_l - @@: - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jle @f - mov ebx,3d_wnd_w - @@: - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jg @f - mov eax,3d_wnd_t - @@: - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jle @f - mov eax,3d_wnd_h - @@: - finit - fild dword[mouse_y] - mov [mouse_y],eax - fisub dword[mouse_y] - fdiv dword[angle_dxm] ;᫨ y ( ) x - fadd dword[angle_x] - fstp dword[angle_x] - - fild dword[mouse_x] - mov [mouse_x],ebx - fisub dword[mouse_x] - fdiv dword[angle_dym] ;᫨ x ( ) y - fadd dword[angle_y] - fstp dword[angle_y] - - call draw_3d - call [kosglSwapBuffers] - jmp .end_d - .end_m: - bt eax,16 - jnc @f - ;mouse l. but. up - mov dword[mouse_drag],0 - jmp .end_d - @@: - bt eax,8 - jnc .end_d - ;mouse l. but. press - mcall SF_MOUSE_GET,SSF_WINDOW_POSITION - mov ebx,eax - shr ebx,16 ;mouse.x - cmp ebx,3d_wnd_l - jl .end_d - sub ebx,3d_wnd_l - cmp ebx,3d_wnd_w - jg .end_d - and eax,0xffff ;mouse.y - cmp eax,3d_wnd_t - jl .end_d - sub eax,3d_wnd_t - cmp eax,3d_wnd_h - jg .end_d - mov dword[mouse_drag],1 - mov dword[mouse_x],ebx - mov dword[mouse_y],eax - .end_d: - - ;stdcall [kmainmenu_dispatch_cursorevent], [main_menu] - pop ebx eax - ret - -align 4 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call but_open_file - jmp still - @@: - cmp ah,5 - jne @f - call but_save_file - jmp still - @@: - cmp ah,6 - jne @f - call but_zoom_p - jmp still - @@: - cmp ah,7 - jne @f - call but_zoom_m - jmp still - @@: - cmp ah,8 - jne @f - call but_light - jmp still - @@: - cmp ah,9 - jne @f - call but_4 - jmp still - @@: - cmp ah,10 - jne @f - call but_5 - jmp still - @@: - cmp ah,11 - jne @f - call but_info - jmp still - @@: - cmp ah,12 - jne @f - call but_draw_cadr - jmp still - @@: - cmp ah,1 - jne still -.exit: - stdcall [buf2d_delete],buf_0 - stdcall mem.Free,[image_data_toolbar] - stdcall mem.Free,[open_file_data] - stdcall mem.Free,[open_file_ogl] - mcall SF_TERMINATE_PROCESS - - -align 4 -but_new_file: - mov dword[angle_x], -30.0 - mov dword[angle_y], 180.0 - mov dword[angle_z], 180.0 - ret - -align 4 -open_file_data dd 0 ;㪠⥫ 䠩 -open_file_size dd 0 ;ࠧ ⮣ 䠩 -open_file_ogl dd 0 ; न ࠭ ᥫ opengl -v_zoom dd 0 - -align 4 -but_open_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 -pushad - mov [OpenDialog_data.type],0 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je @f - ; 㤠筮 ⨨ - call but_open_file_cmd_lin - @@: -popad - ret - -align 4 -but_open_file_cmd_lin: -pushad - mov [run_file_70.Function], SSF_GET_INFO - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], 0 - mov dword[run_file_70.Buffer], open_b - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - - mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 - stdcall mem.ReAlloc,[open_file_data],ecx - mov [open_file_data],eax - - mov [run_file_70.Function], SSF_READ_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov dword[run_file_70.Count], ecx - m2m dword[run_file_70.Buffer], dword[open_file_data] - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - cmp ebx,0xffffffff - je .end_open_file - - mov [open_file_size],ebx - mcall SF_SET_CAPTION,1,openfile_path - - mov eax,[open_file_data] - movzx eax,byte[eax] - mov dword[v_zoom],eax ;६ ⠡ 㬮砭 - mov ecx,[open_file_size] - sub ecx,vox_offs_data - shr ecx,2 - imul ecx,vox_ogl_size - add ecx,4 ;ecx = ࠧ 室 ᯠ न - stdcall mem.ReAlloc,[open_file_ogl],ecx - or eax,eax - jz .end_open_file - mov [open_file_ogl],eax - stdcall buf_vox_obj_create_3d,[open_file_data],eax,0,0,[v_zoom] - call draw_cadr_8 - .end_open_file: -popad - ret - -;description: -; ᮢ 8- ஢ ࠧ묨 㣫 -align 4 -draw_cadr_8: - call but_new_file ;⠭ 㣫 㬮砭 - stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ - - ;ᮢ 8- ஢ - fild dword[rot_angles+4] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 128, 0, buf_1 - - fild dword[rot_angles+8] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 0, 128, buf_1 - - fild dword[rot_angles+12] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 128, 128, buf_1 - - fild dword[rot_angles+16] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 0, 256, buf_1 - - fild dword[rot_angles+20] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 128, 256, buf_1 - - fild dword[rot_angles+24] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 0, 384, buf_1 - - fild dword[rot_angles+28] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 128, 384, buf_1 - - ; *** ᫥ *** - fild dword[rot_angles] - fstp dword[angle_y] - call draw_3d - call draw_cadr - stdcall [buf2d_bit_blt], buf_0, 0, 0, buf_1 - - call draw_3d - ; *** - - stdcall [buf2d_draw], buf_0 ;塞 ࠭ - ret - -align 4 -rot_angles dd 180,225,270,315,0,45,90,135 - -align 4 -draw_cadr: - mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext - mov eax,[eax] ;eax -> ZBuffer - mov eax,[eax+ZBuffer.pbuf] - mov dword[buf_1],eax - - mov dword[buf_1.w],512 - mov dword[buf_1.h],512 - stdcall [buf2d_img_hdiv2],buf_1 - mov dword[buf_1.h],256 - stdcall [buf2d_img_hdiv2],buf_1 - mov dword[buf_1.h],128 - stdcall [buf2d_img_wdiv2],buf_1 - mov dword[buf_1.w],256 - stdcall [buf2d_img_wdiv2],buf_1 - mov dword[buf_1.w],128 - ret - -align 4 -but_save_file: - copy_path open_dialog_name,communication_area_default_path,file_name,0 - pushad - mov [OpenDialog_data.type],1 - stdcall [OpenDialog_Start],OpenDialog_data - cmp [OpenDialog_data.status],2 - je .end_save_file - ; 㤠筮 ⨨ - - mov [run_file_70.Function], SSF_CREATE_FILE - mov [run_file_70.Position], 0 - mov [run_file_70.Flags], 0 - mov ebx, dword[open_file_data] - ;襬 䠩 ⠡ - mov edx,dword[v_zoom] - mov byte[ebx],dl - mov [run_file_70.Buffer], ebx - mov ebx,[open_file_size] - mov dword[run_file_70.Count], ebx ;ࠧ 䠩 - mov byte[run_file_70+20], 0 - mov dword[run_file_70.FileName], openfile_path - mcall SF_FILE,run_file_70 - ;cmp ebx,0xffffffff - ;je .end_save_file - ; ... ᮮ饭 㤠筮 ࠭ ... - - .end_save_file: - popad - ret - -align 4 -proc but_zoom_p uses eax - cmp dword[v_zoom],11 ;max=2^11=2048 - jge @f - inc dword[v_zoom] - stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] - call draw_3d - call [kosglSwapBuffers] - @@: - ret -endp - -align 4 -proc but_zoom_m uses eax - cmp dword[v_zoom],1 - jle @f - dec dword[v_zoom] - stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] - call draw_3d - call [kosglSwapBuffers] - @@: - ret -endp - -align 4 -proc but_light uses eax ebx ecx edx - xor word[opt_light],1 - cmp word[opt_light],0 - je @f - stdcall [glEnable], GL_LIGHTING - stdcall [glEnable], GL_LIGHT0 - jmp .end_light - @@: - stdcall [glDisable], GL_LIGHTING - stdcall [glDisable], GL_LIGHT0 - .end_light: - call draw_toolbar_i - call draw_3d - call [kosglSwapBuffers] - ret -endp - -align 4 -proc but_4 uses eax ebx ecx edx - xor word[opt_cube_box],1 - call draw_toolbar_i - call draw_3d - call [kosglSwapBuffers] - ret -endp - -align 4 -proc but_5 uses eax ebx ecx edx - xor word[opt_auto_rotate],1 - call draw_toolbar_i - ret -endp - -align 4 -proc but_info uses eax ebx ecx edx edi - ;᫥ ⨪ ᥫ - mov eax,[open_file_ogl] - or eax,eax - jz .end_stat - mov ebx,[eax] - mov ecx,ebx - mov edx,ebx - imul ebx,6 - add eax,4 -align 4 - .cycle_0: - bt word[eax+vox_ogl_planes],vox_ogl_gran_z0 - jc @f - dec ebx - @@: - bt word[eax+vox_ogl_planes],vox_ogl_gran_z1 - jc @f - dec ebx - @@: - bt word[eax+vox_ogl_planes],vox_ogl_gran_y0 - jc @f - dec ebx - @@: - bt word[eax+vox_ogl_planes],vox_ogl_gran_y1 - jc @f - dec ebx - @@: - bt word[eax+vox_ogl_planes],vox_ogl_gran_x0 - jc @f - dec ebx - @@: - bt word[eax+vox_ogl_planes],vox_ogl_gran_x1 - jc @f - dec ebx - @@: - add eax,vox_ogl_size - loop .cycle_0 - - mov eax,edx - mov edi,txt_stat_m1.v - stdcall convert_int_to_str,20 - - mov eax,ebx - mov edi,txt_stat_m2.v - stdcall convert_int_to_str,20 - - stdcall str_n_cat,txt_stat_m1.v,txt_stat_m2,50 - notify_window_run txt_stat_m1 - .end_stat: - ret -endp - -align 4 -txt_stat_m1: -if lang eq ru_RU - db '⨪',13,10,'ᥫ: ' -.v: rb 70 -txt_stat_m2: - db 13,10,'⮡ࠦ ࠭: ' -else - db 'Statistics',13,10,'Voxels: ' -.v: rb 70 -txt_stat_m2: - db 13,10,'Facets displayed: ' -end if -.v: rb 20 - -align 4 -proc but_draw_cadr uses eax ebx ecx edx - mov ebx,[angle_x] - mov ecx,[angle_y] - mov edx,[angle_z] - call draw_cadr_8 - mov [angle_x],ebx - mov [angle_y],ecx - mov [angle_z],edx - cmp word[opt_auto_rotate],0 - jne @f - call draw_3d - ;call [kosglSwapBuffers] - @@: - ret -endp - -align 4 -draw_3d: - stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;⨬ 梥 㡨 - stdcall [glPushMatrix] - - cmp word[opt_light],0 - je @f - call SetLight - @@: - stdcall [glTranslatef], 0.0,0.0,0.5 ;न z । 0.0 1.0, ࠦ 㤥 ᥪ - ;ᥫ ꥪ न -0.5 0.5, ⮬ +0.5 - ; ᥪ , 뫥 । ᪮⥩ 祭 - ; ᨨ opengl Win न -1.0 1.0 ⮬ ⠬ ⮣ 㦭 - stdcall [glScalef], [scale], [scale], [scale] ;㢥稢 ᥫ ꥪ, - 祭 쪨 - stdcall [glScalef], 1.0, 1.0, 0.25 ;- ꥪ 뫠 ࠭ 祭 - stdcall [glRotatef], [angle_x],1.0,0.0,0.0 - stdcall [glRotatef], [angle_y],0.0,1.0,0.0 - stdcall [glRotatef], [angle_z],0.0,0.0,1.0 - stdcall draw_voxels_3d,[open_file_ogl] - - call [glPopMatrix] -ret - -align 4 -proc SetLight - stdcall [glLightfv], GL_LIGHT0, GL_POSITION, light_position - stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, light_dir - - stdcall [glLightfv], GL_LIGHT0, GL_DIFFUSE, white_light - stdcall [glLightfv], GL_LIGHT0, GL_SPECULAR, white_light - - stdcall [glEnable], GL_COLOR_MATERIAL - stdcall [glColorMaterial], GL_FRONT, GL_AMBIENT_AND_DIFFUSE - stdcall [glMaterialfv], GL_FRONT, GL_SPECULAR, mat_specular - stdcall [glMaterialf], GL_FRONT, GL_SHININESS, mat_shininess - stdcall [glLightModelfv], GL_LIGHT_MODEL_AMBIENT, lmodel_ambient - - stdcall [glEnable], GL_LIGHTING - stdcall [glEnable], GL_LIGHT0 - - ;;;stdcall [glLightModeli], GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE - ret -endp - -align 4 -proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword -pushad - mov esi,[buf_rgb] - mov edi,[buf_g24] - mov ecx,[pixels] - mov ebx,3 -align 4 - @@: - movzx eax,byte[esi] - movzx edx,byte[esi+1] - add eax,edx - movzx edx,byte[esi+2] - add eax,edx - xor edx,edx - div ebx ;shr eax,2 - mov ah,al - mov word[edi],ax - mov byte[edi+2],al - add esi,3 - add edi,3 - loop @b -popad - ret -endp - - -; 䠩 -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - ࠭, 2 - ४ -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 䠩 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 뢠 䠩 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_path: - db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter ;.1 -.1: -db 'VOX',0 -db 'TXT',0 -.end: -db 0 - - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'proc_lib.obj',0 -system_dir_1 db '/sys/lib/' -lib_name_1 db 'libimg.obj',0 -system_dir_2 db '/sys/lib/' -lib_name_2 db 'buf2d.obj',0 -system_dir_3 db '/sys/lib/' -lib_name_3 db 'tinygl.obj',0 - -l_libs_start: - lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib - lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg - lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d - lib_3 l_libs lib_name_3, file_name, system_dir_3, import_tinygl -l_libs_end: - -align 4 -import_libimg: - dd alib_init1 -; img_is_img dd aimg_is_img -; img_info dd aimg_info -; img_from_file dd aimg_from_file -; img_to_file dd aimg_to_file -; img_from_rgb dd aimg_from_rgb -; img_to_rgb dd aimg_to_rgb - img_to_rgb2 dd aimg_to_rgb2 - img_decode dd aimg_decode -; img_encode dd aimg_encode -; img_create dd aimg_create - img_destroy dd aimg_destroy -; img_destroy_layer dd aimg_destroy_layer -; img_count dd aimg_count -; img_lock_bits dd aimg_lock_bits -; img_unlock_bits dd aimg_unlock_bits -; img_flip dd aimg_flip -; img_flip_layer dd aimg_flip_layer -; img_rotate dd aimg_rotate -; img_rotate_layer dd aimg_rotate_layer -; img_draw dd aimg_draw -; img_convert dd aimg_convert - - dd 0,0 - alib_init1 db 'lib_init',0 -; aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ -; aimg_info db 'img_info',0 -; aimg_from_file db 'img_from_file',0 -; aimg_to_file db 'img_to_file',0 -; aimg_from_rgb db 'img_from_rgb',0 -; aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB - aimg_to_rgb2 db 'img_to_rgb2',0 - aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ -; aimg_encode db 'img_encode',0 -; aimg_create db 'img_create',0 - aimg_destroy db 'img_destroy',0 -; aimg_destroy_layer db 'img_destroy_layer',0 -; aimg_count db 'img_count',0 -; aimg_lock_bits db 'img_lock_bits',0 -; aimg_unlock_bits db 'img_unlock_bits',0 -; aimg_flip db 'img_flip',0 -; aimg_flip_layer db 'img_flip_layer',0 -; aimg_rotate db 'img_rotate',0 -; aimg_rotate_layer db 'img_rotate_layer',0 -; aimg_draw db 'img_draw',0 -; aimg_convert db 'img_convert',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - -align 4 -import_buf2d: - init dd sz_init - buf2d_create dd sz_buf2d_create - buf2d_create_f_img dd sz_buf2d_create_f_img - buf2d_clear dd sz_buf2d_clear - buf2d_draw dd sz_buf2d_draw - buf2d_delete dd sz_buf2d_delete - buf2d_line dd sz_buf2d_line - buf2d_rect_by_size dd sz_buf2d_rect_by_size - buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size - buf2d_circle dd sz_buf2d_circle - buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 - buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 - buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 - buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 - buf2d_bit_blt dd sz_buf2d_bit_blt - buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp - buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha - buf2d_curve_bezier dd sz_buf2d_curve_bezier - buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix - buf2d_draw_text dd sz_buf2d_draw_text - buf2d_crop_color dd sz_buf2d_crop_color - buf2d_offset_h dd sz_buf2d_offset_h - buf2d_flood_fill dd sz_buf2d_flood_fill - buf2d_set_pixel dd sz_buf2d_set_pixel - dd 0,0 - sz_init db 'lib_init',0 - sz_buf2d_create db 'buf2d_create',0 - sz_buf2d_create_f_img db 'buf2d_create_f_img',0 - sz_buf2d_clear db 'buf2d_clear',0 - sz_buf2d_draw db 'buf2d_draw',0 - sz_buf2d_delete db 'buf2d_delete',0 - sz_buf2d_line db 'buf2d_line',0 - sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 - sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 - sz_buf2d_circle db 'buf2d_circle',0 - sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 - sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 - sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 - sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 - sz_buf2d_bit_blt db 'buf2d_bit_blt',0 - sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 - sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 - sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 - sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 - sz_buf2d_draw_text db 'buf2d_draw_text',0 - sz_buf2d_crop_color db 'buf2d_crop_color',0 - sz_buf2d_offset_h db 'buf2d_offset_h',0 - sz_buf2d_flood_fill db 'buf2d_flood_fill',0 - sz_buf2d_set_pixel db 'buf2d_set_pixel',0 - -;-------------------------------------------------- -align 4 -import_tinygl: - -macro E_LIB n -{ - n dd sz_#n -} -include '../../../develop/libraries/TinyGL/asm_fork/export.inc' - dd 0,0 -macro E_LIB n -{ - sz_#n db `n,0 -} -include '../../../develop/libraries/TinyGL/asm_fork/export.inc' - -last_time dd 0 - -align 4 -buf_0: dd 0 ;㪠⥫ ࠦ - dw 530 ;+4 left - dw 30 ;+6 top -.w: dd 256 ;+8 w -.h: dd 512 ;+12 h -.color: dd 0xffffd0 ;+16 color - db 24 ;+20 bit in pixel - -align 4 -buf_1: dd 0 ;㪠⥫ ࠦ - dw 0 ;+4 left - dw 0 ;+6 top -.w: dd 512 ;+8 w -.h: dd 512 ;+12 h -.color: dd 0xffffff ;+16 color - db 24 ;+20 bit in pixel - -scale dd 1.414213562 -angle_x dd 0.0 -angle_y dd 0.0 -angle_z dd 0.0 -delt_size dd 3.0 -angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 -angle_dym dd 2.8444 ;~ 3d_wnd_h/180 - -opt_light dw 0 ; 祭/몫祭 ᢥ -opt_cube_box dw 1 ; ᮢ ࠬ ꥪ -opt_auto_rotate dw 0 ; ⮬᪮ ꥪ - -light_position dd 0.0, 0.0, 2.0, 1.0 ; ᯮ 筨 [0][1][2] - ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) -light_dir dd 0.0,0.0,0.0 ;ࠢ - -mat_specular dd 0.3, 0.3, 0.3, 1.0 ; -mat_shininess dd 3.0 ; (⭠ ய) -white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 -lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 - - -align 16 -i_end: - ctx1 rb 28 ;sizeof.TinyGLContext = 28 - image_data_toolbar dd ? - mouse_drag dd ? ;० 業 ६饭 - mouse_x dd ? - mouse_y dd ? - rb 4096 -stacktop: - sys_path rb 1024 - file_name rb 2048 - plugin_path rb 4096 - openfile_path rb 4096 - filename_area rb 256 - sc system_colors - procinfo process_information - run_file_70 FileInfoBlock -mem: +use32 + org 0 + db 'MENUET01' ;. ᯮ塞 䠩 ᥣ 8 + dd 1, start, i_end, mem, stacktop, openfile_path, sys_path + +include '../../../macros.inc' +include '../../../proc32.inc' +include '../../../KOSfuncs.inc' +include '../../../load_img.inc' +include '../../../load_lib.mac' +include '../../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' +include '../../../develop/libraries/TinyGL/asm_fork/zbuffer.inc' +include 'vox_3d.inc' +include '../trunk/str.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load +if lang eq ru_RU +caption db 'ᬮ ᥫ 11.11.20',0 ; +else ; Default to en_US +caption db 'Voxel viewer 11.11.20',0 +end if + +3d_wnd_l equ 5 ; tinygl ᫥ +3d_wnd_t equ 30 ; tinygl ᢥ +3d_wnd_w equ 512 +3d_wnd_h equ 512 + +IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 +IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10 + +align 4 +start: + load_libraries l_libs_start,l_libs_end + ;஢ઠ ᪮쪮 㤠筮 㧨 ⥪ + mov ebp,lib_0 + cmp dword [ebp+ll_struc_size-4],0 + jz @f + mcall SF_TERMINATE_PROCESS + @@: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors + mcall SF_SET_EVENTS_MASK,0xC0000027 + stdcall [OpenDialog_Init],OpenDialog_data ;⮢ + + stdcall [buf2d_create], buf_0 ;ᮧ + + include_image_file 'toolbar_t.png', image_data_toolbar,,,6 ;6 - for gray icons + mov eax,[image_data_toolbar] + add eax,IMAGE_TOOLBAR_SIZE + stdcall img_to_gray, [image_data_toolbar],eax,(IMAGE_TOOLBAR_SIZE)/3 + + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ; ଠ 稭 䠪⮢ + stdcall [glClearColor], 0.0,0.0,0.0,0.0 + stdcall [glShadeModel], GL_SMOOTH + + call but_new_file + ;஢ઠ ப + cmp dword[openfile_path],0 + je @f + call but_open_file_cmd_lin + @@: + +align 4 +red_win: + call draw_window + +align 4 +still: + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov ebx,[last_time] + add ebx,50 ;প + cmp ebx,eax + jge @f + mov ebx,eax + @@: + sub ebx,eax + mcall SF_WAIT_EVENT_TIMEOUT + bt word[opt_auto_rotate],0 + jnc @f + or eax,eax + jz timer_funct + @@: + + cmp al,1 + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + cmp al,6 + jne @f + call mouse + @@: + + jmp still + +align 4 +timer_funct: + pushad + mcall SF_SYSTEM_GET,SSF_TIME_COUNT + mov [last_time],eax + + ;⮬᪮ 㣫 + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + call draw_3d + call [kosglSwapBuffers] + + popad + jmp still + +align 4 +draw_window: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + ; *** ᮢ (믮 1 ࠧ ᪥) *** + mov edx,[sc.work] + or edx,(3 shl 24)+0x30000000 + mcall SF_CREATE_WINDOW,(20 shl 16)+800,(20 shl 16)+570,,,caption + + ; *** ᮧ *** + mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button] + + mov ebx,(30 shl 16)+20 + mcall ,,,4 + add ebx,25 shl 16 + mcall ,,,5 + add ebx,30 shl 16 + mcall ,,,6 + add ebx,25 shl 16 + mcall ,,,7 + add ebx,25 shl 16 + mcall ,,,8 + add ebx,25 shl 16 + mcall ,,,9 + add ebx,25 shl 16 + mcall ,,,10 + add ebx,25 shl 16 + mcall ,,,11 + add ebx,25 shl 16 + mcall ,,,12 + + call draw_toolbar_i + + stdcall [buf2d_draw], buf_0 + call [kosglSwapBuffers] + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + + +align 4 +draw_toolbar_i: + ; *** ᮢ *** + mov edx,(7 shl 16)+7 ;icon new + mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon open + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;icon save + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(30 shl 16) ;zoom + + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;zoom - + int 0x40 + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + cmp word[opt_light],0 + jne @f + add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon + @@: + add edx,(25 shl 16) ;light on/off + int 0x40 + cmp word[opt_light],0 + jne @f + sub ebx,IMAGE_TOOLBAR_SIZE + @@: + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + cmp word[opt_cube_box],0 + jne @f + add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon + @@: + add edx,(25 shl 16) ;box on/off + int 0x40 + cmp word[opt_cube_box],0 + jne @f + sub ebx,IMAGE_TOOLBAR_SIZE + @@: + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + cmp word[opt_auto_rotate],0 + jne @f + add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon + @@: + add edx,(25 shl 16) ;auto rotate on/off + int 0x40 + cmp word[opt_auto_rotate],0 + jne @f + sub ebx,IMAGE_TOOLBAR_SIZE + @@: + + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;info voxels + int 0x40 + add ebx,IMAGE_TOOLBAR_ICON_SIZE + add edx,(25 shl 16) ;refresh + int 0x40 + ret + + +align 4 +key: + mcall SF_GET_KEY + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + jmp .end0 + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + jmp .end0 + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + jmp .end0 + @@: + cmp ah,179 ;Right + jne still ;@f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + .end0: + call draw_3d + call [kosglSwapBuffers] + ;@@: + jmp still + + +align 4 +mouse: + push eax ebx + mcall SF_MOUSE_GET,SSF_BUTTON_EXT + bt eax,0 + jnc .end_m + ;mouse l. but. move + cmp dword[mouse_drag],1 + jne .end_m + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jg @f + mov ebx,3d_wnd_l + @@: + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jle @f + mov ebx,3d_wnd_w + @@: + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jg @f + mov eax,3d_wnd_t + @@: + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jle @f + mov eax,3d_wnd_h + @@: + finit + fild dword[mouse_y] + mov [mouse_y],eax + fisub dword[mouse_y] + fdiv dword[angle_dxm] ;᫨ y ( ) x + fadd dword[angle_x] + fstp dword[angle_x] + + fild dword[mouse_x] + mov [mouse_x],ebx + fisub dword[mouse_x] + fdiv dword[angle_dym] ;᫨ x ( ) y + fadd dword[angle_y] + fstp dword[angle_y] + + call draw_3d + call [kosglSwapBuffers] + jmp .end_d + .end_m: + bt eax,16 + jnc @f + ;mouse l. but. up + mov dword[mouse_drag],0 + jmp .end_d + @@: + bt eax,8 + jnc .end_d + ;mouse l. but. press + mcall SF_MOUSE_GET,SSF_WINDOW_POSITION + mov ebx,eax + shr ebx,16 ;mouse.x + cmp ebx,3d_wnd_l + jl .end_d + sub ebx,3d_wnd_l + cmp ebx,3d_wnd_w + jg .end_d + and eax,0xffff ;mouse.y + cmp eax,3d_wnd_t + jl .end_d + sub eax,3d_wnd_t + cmp eax,3d_wnd_h + jg .end_d + mov dword[mouse_drag],1 + mov dword[mouse_x],ebx + mov dword[mouse_y],eax + .end_d: + + ;stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + pop ebx eax + ret + +align 4 +button: + mcall SF_GET_BUTTON + cmp ah,3 + jne @f + call but_new_file + jmp still + @@: + cmp ah,4 + jne @f + call but_open_file + jmp still + @@: + cmp ah,5 + jne @f + call but_save_file + jmp still + @@: + cmp ah,6 + jne @f + call but_zoom_p + jmp still + @@: + cmp ah,7 + jne @f + call but_zoom_m + jmp still + @@: + cmp ah,8 + jne @f + call but_light + jmp still + @@: + cmp ah,9 + jne @f + call but_4 + jmp still + @@: + cmp ah,10 + jne @f + call but_5 + jmp still + @@: + cmp ah,11 + jne @f + call but_info + jmp still + @@: + cmp ah,12 + jne @f + call but_draw_cadr + jmp still + @@: + cmp ah,1 + jne still +.exit: + stdcall [buf2d_delete],buf_0 + stdcall mem.Free,[image_data_toolbar] + stdcall mem.Free,[open_file_data] + stdcall mem.Free,[open_file_ogl] + mcall SF_TERMINATE_PROCESS + + +align 4 +but_new_file: + mov dword[angle_x], -30.0 + mov dword[angle_y], 180.0 + mov dword[angle_z], 180.0 + ret + +align 4 +open_file_data dd 0 ;㪠⥫ 䠩 +open_file_size dd 0 ;ࠧ ⮣ 䠩 +open_file_ogl dd 0 ; न ࠭ ᥫ opengl +v_zoom dd 0 + +align 4 +but_open_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 +pushad + mov [OpenDialog_data.type],0 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je @f + ; 㤠筮 ⨨ + call but_open_file_cmd_lin + @@: +popad + ret + +align 4 +but_open_file_cmd_lin: +pushad + mov [run_file_70.Function], SSF_GET_INFO + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], 0 + mov dword[run_file_70.Buffer], open_b + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + + mov ecx,dword[open_b+32] ;+32 qword: ࠧ 䠩 + stdcall mem.ReAlloc,[open_file_data],ecx + mov [open_file_data],eax + + mov [run_file_70.Function], SSF_READ_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov dword[run_file_70.Count], ecx + m2m dword[run_file_70.Buffer], dword[open_file_data] + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + cmp ebx,0xffffffff + je .end_open_file + + mov [open_file_size],ebx + mcall SF_SET_CAPTION,1,openfile_path + + mov eax,[open_file_data] + movzx eax,byte[eax] + mov dword[v_zoom],eax ;६ ⠡ 㬮砭 + mov ecx,[open_file_size] + sub ecx,vox_offs_data + shr ecx,2 + imul ecx,vox_ogl_size + add ecx,4 ;ecx = ࠧ 室 ᯠ न + stdcall mem.ReAlloc,[open_file_ogl],ecx + or eax,eax + jz .end_open_file + mov [open_file_ogl],eax + stdcall buf_vox_obj_create_3d,[open_file_data],eax,0,0,[v_zoom] + call draw_cadr_8 + .end_open_file: +popad + ret + +;description: +; ᮢ 8- ஢ ࠧ묨 㣫 +align 4 +draw_cadr_8: + call but_new_file ;⠭ 㣫 㬮砭 + stdcall [buf2d_clear], buf_0, [buf_0.color] ;⨬ + + ;ᮢ 8- ஢ + fild dword[rot_angles+4] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 128, 0, buf_1 + + fild dword[rot_angles+8] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 0, 128, buf_1 + + fild dword[rot_angles+12] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 128, 128, buf_1 + + fild dword[rot_angles+16] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 0, 256, buf_1 + + fild dword[rot_angles+20] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 128, 256, buf_1 + + fild dword[rot_angles+24] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 0, 384, buf_1 + + fild dword[rot_angles+28] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 128, 384, buf_1 + + ; *** ᫥ *** + fild dword[rot_angles] + fstp dword[angle_y] + call draw_3d + call draw_cadr + stdcall [buf2d_bit_blt], buf_0, 0, 0, buf_1 + + call draw_3d + ; *** + + stdcall [buf2d_draw], buf_0 ;塞 ࠭ + ret + +align 4 +rot_angles dd 180,225,270,315,0,45,90,135 + +align 4 +draw_cadr: + mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext + mov eax,[eax] ;eax -> ZBuffer + mov eax,[eax+ZBuffer.pbuf] + mov dword[buf_1],eax + + mov dword[buf_1.w],512 + mov dword[buf_1.h],512 + stdcall [buf2d_img_hdiv2],buf_1 + mov dword[buf_1.h],256 + stdcall [buf2d_img_hdiv2],buf_1 + mov dword[buf_1.h],128 + stdcall [buf2d_img_wdiv2],buf_1 + mov dword[buf_1.w],256 + stdcall [buf2d_img_wdiv2],buf_1 + mov dword[buf_1.w],128 + ret + +align 4 +but_save_file: + copy_path open_dialog_name,communication_area_default_path,file_name,0 + pushad + mov [OpenDialog_data.type],1 + stdcall [OpenDialog_Start],OpenDialog_data + cmp [OpenDialog_data.status],2 + je .end_save_file + ; 㤠筮 ⨨ + + mov [run_file_70.Function], SSF_CREATE_FILE + mov [run_file_70.Position], 0 + mov [run_file_70.Flags], 0 + mov ebx, dword[open_file_data] + ;襬 䠩 ⠡ + mov edx,dword[v_zoom] + mov byte[ebx],dl + mov [run_file_70.Buffer], ebx + mov ebx,[open_file_size] + mov dword[run_file_70.Count], ebx ;ࠧ 䠩 + mov byte[run_file_70+20], 0 + mov dword[run_file_70.FileName], openfile_path + mcall SF_FILE,run_file_70 + ;cmp ebx,0xffffffff + ;je .end_save_file + ; ... ᮮ饭 㤠筮 ࠭ ... + + .end_save_file: + popad + ret + +align 4 +proc but_zoom_p uses eax + cmp dword[v_zoom],11 ;max=2^11=2048 + jge @f + inc dword[v_zoom] + stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] + call draw_3d + call [kosglSwapBuffers] + @@: + ret +endp + +align 4 +proc but_zoom_m uses eax + cmp dword[v_zoom],1 + jle @f + dec dword[v_zoom] + stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] + call draw_3d + call [kosglSwapBuffers] + @@: + ret +endp + +align 4 +proc but_light uses eax ebx ecx edx + xor word[opt_light],1 + cmp word[opt_light],0 + je @f + stdcall [glEnable], GL_LIGHTING + stdcall [glEnable], GL_LIGHT0 + jmp .end_light + @@: + stdcall [glDisable], GL_LIGHTING + stdcall [glDisable], GL_LIGHT0 + .end_light: + call draw_toolbar_i + call draw_3d + call [kosglSwapBuffers] + ret +endp + +align 4 +proc but_4 uses eax ebx ecx edx + xor word[opt_cube_box],1 + call draw_toolbar_i + call draw_3d + call [kosglSwapBuffers] + ret +endp + +align 4 +proc but_5 uses eax ebx ecx edx + xor word[opt_auto_rotate],1 + call draw_toolbar_i + ret +endp + +align 4 +proc but_info uses eax ebx ecx edx edi + ;᫥ ⨪ ᥫ + mov eax,[open_file_ogl] + or eax,eax + jz .end_stat + mov ebx,[eax] + mov ecx,ebx + mov edx,ebx + imul ebx,6 + add eax,4 +align 4 + .cycle_0: + bt word[eax+vox_ogl_planes],vox_ogl_gran_z0 + jc @f + dec ebx + @@: + bt word[eax+vox_ogl_planes],vox_ogl_gran_z1 + jc @f + dec ebx + @@: + bt word[eax+vox_ogl_planes],vox_ogl_gran_y0 + jc @f + dec ebx + @@: + bt word[eax+vox_ogl_planes],vox_ogl_gran_y1 + jc @f + dec ebx + @@: + bt word[eax+vox_ogl_planes],vox_ogl_gran_x0 + jc @f + dec ebx + @@: + bt word[eax+vox_ogl_planes],vox_ogl_gran_x1 + jc @f + dec ebx + @@: + add eax,vox_ogl_size + loop .cycle_0 + + mov eax,edx + mov edi,txt_stat_m1.v + stdcall convert_int_to_str,20 + + mov eax,ebx + mov edi,txt_stat_m2.v + stdcall convert_int_to_str,20 + + stdcall str_n_cat,txt_stat_m1.v,txt_stat_m2,50 + notify_window_run txt_stat_m1 + .end_stat: + ret +endp + +align 4 +txt_stat_m1: +if lang eq ru_RU + db '⨪',13,10,'ᥫ: ' +.v: rb 70 +txt_stat_m2: + db 13,10,'⮡ࠦ ࠭: ' + +else ; Default to en_US + db 'Statistics',13,10,'Voxels: ' +.v: rb 70 +txt_stat_m2: + db 13,10,'Facets displayed: ' + +end if +.v: rb 20 + +align 4 +proc but_draw_cadr uses eax ebx ecx edx + mov ebx,[angle_x] + mov ecx,[angle_y] + mov edx,[angle_z] + call draw_cadr_8 + mov [angle_x],ebx + mov [angle_y],ecx + mov [angle_z],edx + cmp word[opt_auto_rotate],0 + jne @f + call draw_3d + ;call [kosglSwapBuffers] + @@: + ret +endp + +align 4 +draw_3d: + stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;⨬ 梥 㡨 + stdcall [glPushMatrix] + + cmp word[opt_light],0 + je @f + call SetLight + @@: + stdcall [glTranslatef], 0.0,0.0,0.5 ;न z । 0.0 1.0, ࠦ 㤥 ᥪ + ;ᥫ ꥪ न -0.5 0.5, ⮬ +0.5 + ; ᥪ , 뫥 । ᪮⥩ 祭 + ; ᨨ opengl Win न -1.0 1.0 ⮬ ⠬ ⮣ 㦭 + stdcall [glScalef], [scale], [scale], [scale] ;㢥稢 ᥫ ꥪ, - 祭 쪨 + stdcall [glScalef], 1.0, 1.0, 0.25 ;- ꥪ 뫠 ࠭ 祭 + stdcall [glRotatef], [angle_x],1.0,0.0,0.0 + stdcall [glRotatef], [angle_y],0.0,1.0,0.0 + stdcall [glRotatef], [angle_z],0.0,0.0,1.0 + stdcall draw_voxels_3d,[open_file_ogl] + + call [glPopMatrix] +ret + +align 4 +proc SetLight + stdcall [glLightfv], GL_LIGHT0, GL_POSITION, light_position + stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, light_dir + + stdcall [glLightfv], GL_LIGHT0, GL_DIFFUSE, white_light + stdcall [glLightfv], GL_LIGHT0, GL_SPECULAR, white_light + + stdcall [glEnable], GL_COLOR_MATERIAL + stdcall [glColorMaterial], GL_FRONT, GL_AMBIENT_AND_DIFFUSE + stdcall [glMaterialfv], GL_FRONT, GL_SPECULAR, mat_specular + stdcall [glMaterialf], GL_FRONT, GL_SHININESS, mat_shininess + stdcall [glLightModelfv], GL_LIGHT_MODEL_AMBIENT, lmodel_ambient + + stdcall [glEnable], GL_LIGHTING + stdcall [glEnable], GL_LIGHT0 + + ;;;stdcall [glLightModeli], GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE + ret +endp + +align 4 +proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword +pushad + mov esi,[buf_rgb] + mov edi,[buf_g24] + mov ecx,[pixels] + mov ebx,3 +align 4 + @@: + movzx eax,byte[esi] + movzx edx,byte[esi+1] + add eax,edx + movzx edx,byte[esi+2] + add eax,edx + xor edx,edx + div ebx ;shr eax,2 + mov ah,al + mov word[edi],ax + mov byte[edi+2],al + add esi,3 + add edi,3 + loop @b +popad + ret +endp + + +; 䠩 +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - ࠭, 2 - ४ +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter ;.1 +.1: +db 'VOX',0 +db 'TXT',0 +.end: +db 0 + + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'proc_lib.obj',0 +system_dir_1 db '/sys/lib/' +lib_name_1 db 'libimg.obj',0 +system_dir_2 db '/sys/lib/' +lib_name_2 db 'buf2d.obj',0 +system_dir_3 db '/sys/lib/' +lib_name_3 db 'tinygl.obj',0 + +l_libs_start: + lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib + lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg + lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d + lib_3 l_libs lib_name_3, file_name, system_dir_3, import_tinygl +l_libs_end: + +align 4 +import_libimg: + dd alib_init1 +; img_is_img dd aimg_is_img +; img_info dd aimg_info +; img_from_file dd aimg_from_file +; img_to_file dd aimg_to_file +; img_from_rgb dd aimg_from_rgb +; img_to_rgb dd aimg_to_rgb + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode +; img_encode dd aimg_encode +; img_create dd aimg_create + img_destroy dd aimg_destroy +; img_destroy_layer dd aimg_destroy_layer +; img_count dd aimg_count +; img_lock_bits dd aimg_lock_bits +; img_unlock_bits dd aimg_unlock_bits +; img_flip dd aimg_flip +; img_flip_layer dd aimg_flip_layer +; img_rotate dd aimg_rotate +; img_rotate_layer dd aimg_rotate_layer +; img_draw dd aimg_draw +; img_convert dd aimg_convert + + dd 0,0 + alib_init1 db 'lib_init',0 +; aimg_is_img db 'img_is_img',0 ;। , ⥪ ᤥ ࠦ +; aimg_info db 'img_info',0 +; aimg_from_file db 'img_from_file',0 +; aimg_to_file db 'img_to_file',0 +; aimg_from_rgb db 'img_from_rgb',0 +; aimg_to_rgb db 'img_to_rgb',0 ;८ࠧ ࠦ RGB + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ +; aimg_encode db 'img_encode',0 +; aimg_create db 'img_create',0 + aimg_destroy db 'img_destroy',0 +; aimg_destroy_layer db 'img_destroy_layer',0 +; aimg_count db 'img_count',0 +; aimg_lock_bits db 'img_lock_bits',0 +; aimg_unlock_bits db 'img_unlock_bits',0 +; aimg_flip db 'img_flip',0 +; aimg_flip_layer db 'img_flip_layer',0 +; aimg_rotate db 'img_rotate',0 +; aimg_rotate_layer db 'img_rotate_layer',0 +; aimg_draw db 'img_draw',0 +; aimg_convert db 'img_convert',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_buf2d: + init dd sz_init + buf2d_create dd sz_buf2d_create + buf2d_create_f_img dd sz_buf2d_create_f_img + buf2d_clear dd sz_buf2d_clear + buf2d_draw dd sz_buf2d_draw + buf2d_delete dd sz_buf2d_delete + buf2d_line dd sz_buf2d_line + buf2d_rect_by_size dd sz_buf2d_rect_by_size + buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size + buf2d_circle dd sz_buf2d_circle + buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 + buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 + buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 + buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 + buf2d_bit_blt dd sz_buf2d_bit_blt + buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp + buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha + buf2d_curve_bezier dd sz_buf2d_curve_bezier + buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix + buf2d_draw_text dd sz_buf2d_draw_text + buf2d_crop_color dd sz_buf2d_crop_color + buf2d_offset_h dd sz_buf2d_offset_h + buf2d_flood_fill dd sz_buf2d_flood_fill + buf2d_set_pixel dd sz_buf2d_set_pixel + dd 0,0 + sz_init db 'lib_init',0 + sz_buf2d_create db 'buf2d_create',0 + sz_buf2d_create_f_img db 'buf2d_create_f_img',0 + sz_buf2d_clear db 'buf2d_clear',0 + sz_buf2d_draw db 'buf2d_draw',0 + sz_buf2d_delete db 'buf2d_delete',0 + sz_buf2d_line db 'buf2d_line',0 + sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 + sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 + sz_buf2d_circle db 'buf2d_circle',0 + sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 + sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 + sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 + sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 + sz_buf2d_bit_blt db 'buf2d_bit_blt',0 + sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 + sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 + sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 + sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 + sz_buf2d_draw_text db 'buf2d_draw_text',0 + sz_buf2d_crop_color db 'buf2d_crop_color',0 + sz_buf2d_offset_h db 'buf2d_offset_h',0 + sz_buf2d_flood_fill db 'buf2d_flood_fill',0 + sz_buf2d_set_pixel db 'buf2d_set_pixel',0 + +;-------------------------------------------------- +align 4 +import_tinygl: + +macro E_LIB n +{ + n dd sz_#n +} +include '../../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../../develop/libraries/TinyGL/asm_fork/export.inc' + +last_time dd 0 + +align 4 +buf_0: dd 0 ;㪠⥫ ࠦ + dw 530 ;+4 left + dw 30 ;+6 top +.w: dd 256 ;+8 w +.h: dd 512 ;+12 h +.color: dd 0xffffd0 ;+16 color + db 24 ;+20 bit in pixel + +align 4 +buf_1: dd 0 ;㪠⥫ ࠦ + dw 0 ;+4 left + dw 0 ;+6 top +.w: dd 512 ;+8 w +.h: dd 512 ;+12 h +.color: dd 0xffffff ;+16 color + db 24 ;+20 bit in pixel + +scale dd 1.414213562 +angle_x dd 0.0 +angle_y dd 0.0 +angle_z dd 0.0 +delt_size dd 3.0 +angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ਡ 㣫 業 饭 襩 +angle_dym dd 2.8444 ;~ 3d_wnd_h/180 + +opt_light dw 0 ; 祭/몫祭 ᢥ +opt_cube_box dw 1 ; ᮢ ࠬ ꥪ +opt_auto_rotate dw 0 ; ⮬᪮ ꥪ + +light_position dd 0.0, 0.0, 2.0, 1.0 ; ᯮ 筨 [0][1][2] + ;[3] = (0.0 - ᪮筮 㤠 筨, 1.0 - 筨 ᢥ । ﭨ) +light_dir dd 0.0,0.0,0.0 ;ࠢ + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; +mat_shininess dd 3.0 ; (⭠ ய) +white_light dd 0.8, 0.8, 0.8, 1.0 ; ⥭ᨢ ᢥ饭, 㥬 筨 +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; ࠬ 䮭 ᢥ饭 + + +align 16 +i_end: + ctx1 rb 28 ;sizeof.TinyGLContext = 28 + image_data_toolbar dd ? + mouse_drag dd ? ;० 業 ६饭 + mouse_x dd ? + mouse_y dd ? + rb 4096 +stacktop: + sys_path rb 1024 + file_name rb 2048 + plugin_path rb 4096 + openfile_path rb 4096 + filename_area rb 256 + sc system_colors + procinfo process_information + run_file_70 FileInfoBlock +mem: diff --git a/programs/media/zsea/data.inc b/programs/media/zsea/data.inc index fdbdbe6ba..24e8f545a 100644 --- a/programs/media/zsea/data.inc +++ b/programs/media/zsea/data.inc @@ -1,1785 +1,1787 @@ -;--------------------------------------------------------------------- -; DATA AREA -;--------------------------------------------------------------------- -lsz labelt1,\ - en_US, 'File',\ - ru_RU, '',\ - de_DE, 'Datei' - db 0 - -;--------------------------------------------------------------------- -lsz labelt2,\ - en_US, 'File info',\ - ru_RU, 'ଠ 䠩',\ - de_DE, 'Dateiinfo' - db 0 - -lsz fitext,\ - en_US, 'File name ',\ - en_US, 'File size ',\ - en_US, 'X size ',\ - en_US, 'Y size ',\ - en_US, 'Resolution ',\ - en_US, 'Frames total ',\ - \ - ru_RU, ' 䠩 ',\ - ru_RU, ' 䠩 ',\ - ru_RU, 'ਭ ',\ - ru_RU, ' ',\ - ru_RU, ' ᥫ ',\ - ru_RU, 'ᥣ ஢ ',\ - \ - de_DE, 'Datei Namen ',\ - de_DE, 'Fateigroesse ',\ - de_DE, 'X groesse ',\ - de_DE, 'Y groesse ',\ - de_DE, 'Die Tiefe ',\ - de_DE, 'Zahl Frames ' - db 0 -;--------------------------------------------------------------------- -Authors_text: -.1: db 'zSea version: 1.00 RC5-1 Date: 03/12/2021',0 -.2: db 'Authors:',0 -.3: db 'Marat Zakiyanov aka Mario(Mario79)',0 -.4: db 'zSea program, modules: cnv_bmp.obj,',0 -.5: db 'cnv_png.obj, convert.obj, rotate.obj ',0 -.6: db 'scaling.obj, box_lib.obj, OpenDialog',0 -.7: db 'proc_lib.obj',0 - -.8: db 'Evgeny Grechnikov aka Diamond',0 -.9: db 'modules: cnv_jpeg.obj, cnv_gif.obj,',0 -.10: db 'archiver.obj, sort.obj ',0 - -.11: db 'Alexey Teplov aka ',0 -.12: db 'modules: box_lib.obj, load_lib.mac',0 - -.13: db 'Mihail Semenyako aka Mike.dld',0 -.14: db 'modules: libini.obj, libio.obj',0 -;--------------------------------------------------------------------- -status dd 0 ;bit0=1 if file thread is created -;process dd 0 - -bWasDraw db 0 -vflag: db 'x' -bgrmode: dd 1 - -wnd_width dd 210 -wnd_height dd 53 -;--------------------------------- -lsz labelt3,\ - en_US, 'About program',\ - ru_RU, ' ணࠬ',\ - de_DE, 'Uber das programm' - db 0 -;--------------------------------- -lsz labelt4,\ - en_US, 'Set wallpaper',\ - ru_RU, '⠭ 䮭',\ - de_DE, 'Installation hintergrund' - db 0 -;--------------------------------- -lsz labelt5,\ - en_US, 'Select sorting mode',\ - ru_RU, '஢ ४ਨ',\ - de_DE, 'Regimes der Sortierung' - db 0 -;--------------------------------- -lsz bgrdtext,\ - en_US, 'Set as background:',\ - ru_RU, ' :',\ - de_DE, 'Als hintergrund' - db 0 -;--------------------------------- -lsz scc_text,\ - en_US, 'Position:',\ - ru_RU, ':',\ - de_DE, 'Position:' - db 0 -;--------------------------------- -lsz sorttext,\ - en_US, 'Directory sorting mode:',\ - ru_RU, ' ஢ ४ਨ:',\ - de_DE, 'Regime der Sortierung des Verzeichnisses:' - db 0 -;--------------------------------- -lsz errortext,\ - en_US, 'File system error:',\ - ru_RU, '訡 䠩 ⥬:',\ - de_DE, 'Fehler files systemes:' - db 0 -;--------------------------------- -lsz optiontext,\ - en_US, 'Options:',\ - ru_RU, 'ன:',\ - de_DE, 'Optionen:' - db 0 -;--------------------------------- -;lsz tiled,\ -; en_US, 'Tiled',\ -; ru_RU, '',\ -; de_DE, 'Gekachelt' - -;lsz stretch,\ -; en_US, 'Stretch',\ -; ru_RU, '',\ -; de_DE, 'Gestreckt' -;--------------------------------- -lsz color_btn,\ - en_US, 'Background color:',\ - ru_RU, ' 䮭:',\ - de_DE, 'Hintergrundfarbe:' - db 0 -;--------------------------------- -lsz ok_btn,\ - en_US, 'Ok',\ - ru_RU, 'Ok',\ - de_DE, 'Ok' - db 0 -;--------------------------------- -lsz slide_show_delay_title,\ - en_US, 'Slide show delay:',\ - ru_RU, 'প ᫠:',\ - de_DE, 'Verzug der schau:' - db 0 -;--------------------------------- -lsz arrows_offset_title,\ - en_US, 'Arrows offset:',\ - ru_RU, '饭 ५:',\ - de_DE, 'Bewegung von den zeigern:' - db 0 -;--------------------------------- -slide_show_delay_text: - db '+ -',0 -;--------------------------------------------------------------------- -zoom_auto_factor: - dd 0 -zoom_auto_text: - db 'auto',0 -zoom_factors: - dd zoom_factors.100 -.1: dd 0 -.min: - dd 1 - dd 2 - dd 3 - dd 4 - dd 5 - dd 7 - dd 10 - dd 17 - dd 25 - dd 37 - dd 50 - dd 62 - dd 75 - dd 87 -.100: - dd 100 - dd 125 - dd 150 - dd 175 - dd 200 - dd 225 - dd 250 - dd 275 - dd 300 - dd 350 - dd 400 - dd 450 - dd 500 - dd 600 - dd 700 - dd 800 - dd 900 - dd 1000 - dd 1100 - dd 1200 - dd 1300 - dd 1400 - dd 1500 - dd 1750 - dd 2000 - dd 2250 - dd 2500 - dd 2750 - dd 3000 - dd 3500 - dd 4000 - dd 4500 -.max: - dd 5000 - -zoom_factors_old dd 0 - -;--------------------------------------------------------------------- -; not change this section!!! -; start section -;--------------------------------------------------------------------- -align 4 -crop_image_file dd 0 ;+0 -crop_raw_pointer dd 0 ;+4 -crop_return_code dd 0 ;+8 -crop_img_size dd 0 ;+12 -crop_deflate_unpack dd 0 ;+16 -crop_raw_pointer_2 dd 0 ;+20 -;--------------------------------------------------------------------- -; end section -;--------------------------------------------------------------------- - -;--------------------------------------------------------------------- -; not change this section!!! -; start section -;--------------------------------------------------------------------- -align 4 -image_file dd 0 ;+0 -raw_pointer dd 0 ;+4 -return_code dd 0 ;+8 -img_size dd 0 ;+12 -deflate_unpack dd 0 ;+16 -raw_pointer_2 dd 0 ;+20 -;--------------------------------------------------------------------- -; end section -;--------------------------------------------------------------------- -test1 dd 0 ;+24 -test2 dd 0 ;+28 -test3 dd 0 ;+32 -test4 dd 0 ;+36 -test5 dd 0 ;+40 -test6 dd 0 ;+44 -test7 dd 0 ;+48 -;--------------------------------------------------------------------- -align 4 -soi dd 0 -img_width dd 0 -img_width_2 dd 0 -img_high dd 0 -img_high_2 dd 0 -img_resolution dd 0 -img_resolution_2 dd 0 -img_palette dd 0 - -background_color dd 0xffffff - -skin_height dd 0 - -screen_high dd 0 -screen_width dd 0 - -stretch_start_coordinates: -.y dw 0 -.x dw 0 - -screen_relation dd 0 -picture_relation dd 0 - -stretch_img_high dd 0 -stretch_img_width dd 0 - -RAW1_pointer dd 0 -RAW1_size_x dd 0 -RAW1_size dd 0 -Repeat_N dd 0 -Total_Repeat_N dd 1 -previous_frame_pointer dd 0 -Animation_timer dd 0 -Frame_delay dw 0 -Transp_flag db 0 -Transp_index db 0 -Disposal_Method db 0 -RAW1_flag db 0 -no_fill db 0 -redraw_wallpaper_flag db 0 - -calc_next_value_plus db 0 -calc_next_value_minus db 0 -;--------------------------------------------------------------------- -align 4 -;plugin dd 0 -;plugin_1 dd 0 -;plugin_2 dd 0 -;plugin_3 dd 0 - -;plugin_validate dd 0 -;plugin_validate_1 dd 0 -;plugin_validate_2 dd 0 -;plugin_validate_3 dd 0 - -;plugin_format dd 0 -;plugin_format_1 dd 0 -;plugin_format_2 dd 0 -;plugin_format_3 dd 0 - -;plugin_convert dd 0 -;plugin_convert_background dd 0 -;plugin_sort dd 0 -;plugin_rotate dd 0 -;plugin_scaling dd 0 - -slide_show_delay dd 500 ; cost of 0,01 sec. -slide_show_delay_old dd 0 - -sort_type dd 2 -sort_type_old dd 0 -;--------------------------------------------------------------------- -expansion_length dd 0 -expansion_start dd 0 - -timer dd 0 -;--------------------------------------------------------------------- -mouse_scroll_data: - .vertical dw 0 - .horizontal dw 0 - -mouse_position: - .y dw 0 - .x dw 0 - -mouse_position_old: - .y dw 0 - .x dw 0 - -mouse_keys dd 0 -mouse_keys_old dd 0 - -arrows_offset dd 10 -arrows_offset_old dd 10 - -option_pointer dd 0 -plus_pointer dd 0 -minus_pointer dd 0 -space_pointer dd 0 - -;--------------------------------------------------------------------- -pos: dd 6 - -work_area_LR_old dd 0 -work_area_TB_old dd 0 - -scaling_mode dd 100 -scaling_mode_old dd 100 - -window_start_x_old dd 0 -window_start_y_old dd 0 -window_high_old dd 0 -window_width_old dd 0 - -window_start_x dd 0 -window_start_y dd 0 -window_high dd 0 -window_width dd 0 -;skin_high dd 0 -window_status dd 0 -draw_SB db 0 -draw_SB1 db 0 -correct_w db 0 -correct_h db 0 -wa_width dw 0 -wa_high dw 0 - -wa_width_1 dw 0 -wa_width_2 dw 0 - -wa_high_1 dw 0 -wa_high_2 dw 0 - -image_start_coordinates dd 0 -image_draw_size: -.y: dw 0 -.x: dw 0 - -vertical_position_coorect dd 0 -horizontal_position_coorect dd 0 - -fill_color dd 0xffffff -fill_color_old dd 0xffffff - -position_coorect db 0 - -open_file_flag db 0 -sort_directory_flag db 0 -redraw_flag db 0 - -press_Enter_flag db 0 - -capture_image_area_flag db 0 - -correct_scrollbar_100_flag db 0 -;--------------------------------------------------------------------- -;test_area: -;dd test_area.end - test_area -;db 'BMP',0 -;.end: -;db 0,0,0,0,0,0,0,0,0,0,0,0,0 -;--------------------------------------------------------------------- -aApplicationsPaths db 'ApplicationsPaths',0 -aOther db 'Other',0 - -aHelp db 'Help',0 -aEditor db 'Editor',0 -aOpenDialog db 'OpenDialog',0 -akey_help db 'HelpFile',0 - -aConvertPlugins db 'ConvertPlugins',0 - -ConvertPlugins_no_key db 'NoKey',0 - -aCP0 db 'CP0',0 -aCP1 db 'CP1',0 -aCP2 db 'CP2',0 -aCP3 db 'CP3',0 -aCP4 db 'CP4',0 -aCP5 db 'CP5',0 -aCP6 db 'CP6',0 -aCP7 db 'CP7',0 -aCP8 db 'CP8',0 -aCP9 db 'CP9',0 -;--------------------------------------------------------------------- -plugin_BMP_name db 'cnv_bmp.obj',0 -plugin_PNG_name db 'cnv_png.obj',0 -plugin_JPEG_name db 'cnv_jpeg.obj',0 -plugin_GIF_name db 'cnv_gif.obj',0 - -;plugin_convert_name db 'convert.obj',0 -;plugin_sort_name db 'sort.obj',0 -;plugin_rotate_name db 'rotate.obj',0 -;plugin_scaling_name db 'scaling.obj',0 -;plugin_UNPACK_name db 'archiver.obj',0 -;boxlib_name db 'box_lib.obj',0 -;Libini_name db 'libini.obj',0 -plugins_directory db 'plugins/',0 -ini_file_name db 'zsea.ini',0 - -button_name db 'buttons.png',0 -;buttons_passive_name db '1.png',0 -;buttons_active_name db '2.png',0 -;buttons_click_name db '3.png',0 - -buttons_directory db 'buttons/',0 -;UNPACK_function_name db 'deflate_unpack',0 -;UNPACK_function_name_end: -;UNPACK_function_name db 'deflate_unpack2',0 -;UNPACK_function_name_end: - -system_dir_Boxlib db '/sys/lib/box_lib.obj',0 -system_dir_Libini db '/sys/lib/libini.obj',0 -system_dir_Sort db '/sys/lib/sort.obj',0 -system_dir_UNPACK db '/sys/lib/archiver.obj',0 -system_dir_Convert db '/sys/lib/convert.obj',0 -system_dir_Rotate db '/sys/lib/rotate.obj',0 -system_dir_Scaling db '/sys/lib/scaling.obj',0 -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 - -;--------------------------------------------------------------------- -l_libs_start: -library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ -Box_lib_import, plugins_directory - -library02 l_libs system_dir_Libini+9, library_path, system_dir_Libini, \ -Libini_import, plugins_directory - -library03 l_libs system_dir_Sort+9, library_path, system_dir_Sort, \ -Sort_import, plugins_directory - -library04 l_libs system_dir_UNPACK+9, library_path, system_dir_UNPACK, \ -UNPACK_import, plugins_directory - -library05 l_libs system_dir_Convert+9, library_path, system_dir_Convert, \ -Convert_import, plugins_directory - -library06 l_libs system_dir_Rotate+9, library_path, system_dir_Rotate, \ -Rotate_import, plugins_directory - -library07 l_libs system_dir_Scaling+9, library_path, system_dir_Scaling, \ -Scaling_import, plugins_directory - -library08 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ -ProcLib_import, plugins_directory - -end_l_libs: -;--------------------------------------------------------------------- -align 4 -cnv_plugin_name_pointer dd plugin_0_name -cnv_plugin_import_pointer dd Convert_plugin_0 - -system_path db '/sys/lib/' -.1: rb 128 -;--------------------------------------------------------------------- -Convert_plugin_0: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_1: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_2: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_3: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_4: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_5: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_6: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_7: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_8: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -Convert_plugin_9: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -aCP_Start db 'START',0 -aCP_Version db 'version',0 -aCP_Check db 'Check_Header',0 -aCP_Assoc db 'Associations',0 -;--------------------------------------------------------------------- - -file_mount: db 'File N: Amount: Zoom:',0 -.end: - -current_key_code db 0 -old_key_code db 0 -;--------------------------------------------------------------------- -; Tokens -;--------------------------------------------------------------------- -aSortMode db 'SortMode',0 -aSlideShowDelay db 'SlideShowDelay',0 -aArrowsOffset db 'ArrowsOffset',0 -aShowFileName db 'ShowFileName',0 -aFilteringFlag db 'FilteringFlag',0 -;--------------------------------------------------------------------- -;Sections -;--------------------------------------------------------------------- -aVariables db 'Variables',0 -;aVar db 'Var',0 -;aTemp db 'Temp',0 -;--------------------------------------------------------------------- -align 4 -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start - -ColorDialog_Init dd aColorDialog_Init -ColorDialog_Start dd aColorDialog_Start -;OpenDialog__Version dd aOpenDialog_Version - dd 0 - dd 0 - -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 - -aColorDialog_Init db 'ColorDialog_init',0 -aColorDialog_Start db 'ColorDialog_start',0 -;aOpenDialog_Version db 'Version_OpenDialog',0 -;--------------------------------------------------------------------- -align 4 -Scaling_import: -Scaling_Start dd aScaling_Start -Scaling_Version dd aScaling_Version - dd 0 - dd 0 -aScaling_Start db 'START',0 -aScaling_Version db 'version',0 -;--------------------------------------------------------------------- -align 4 -Rotate_import: -rotate_Start dd aRotate_Start -rotate_Version dd aRotate_Version - dd 0 - dd 0 -aRotate_Start db 'START',0 -aRotate_Version db 'version',0 -;--------------------------------------------------------------------- -align 4 -Convert_import: -convert_Start dd aConvert_Start -convert_Version dd aConvert_Version -convert_Conv_24b dd aConvert_Conv_24b - dd 0 - dd 0 -aConvert_Start db 'START',0 -aConvert_Version db 'version',0 -aConvert_Conv_24b db 'Convert24b',0 -;--------------------------------------------------------------------- -align 4 -UNPACK_import: -;unpack_Version dd aUnpack_Version -;unpack_PluginLoad dd aUnpack_PluginLoad -;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin -;unpack_ClosePlugin dd aUnpack_ClosePlugin -;unpack_ReadFolder dd aUnpack_ReadFolder -;unpack_SetFolder dd aUnpack_SetFolder -;unpack_GetFiles dd aUnpack_GetFiles -;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo -;unpack_Getattr dd aUnpack_Getattr -;unpack_Open dd aUnpack_Open -;unpack_Read dd aUnpack_Read -;unpack_Setpos dd aUnpack_Setpos -;unpack_Close dd aUnpack_Close -;unpack_DeflateUnpack dd aUnpack_DeflateUnpack -unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2 - dd 0 - dd 0 - -;aUnpack_Version db 'version',0 -;aUnpack_PluginLoad db 'plugin_load',0 -;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0 -;aUnpack_ClosePlugin db 'ClosePlugin',0 -;aUnpack_ReadFolder db 'ReadFolder',0 -;aUnpack_SetFolder db 'SetFolder',0 -;aUnpack_GetFiles db 'GetFiles',0 -;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0 -;aUnpack_Getattr db 'getattr',0 -;aUnpack_Open db 'open',0 -;aUnpack_Read db 'read',0 -;aUnpack_Setpos db 'setpos',0 -;aUnpack_Close db 'close',0 -;aUnpack_DeflateUnpack db 'deflate_unpack',0 -aUnpack_DeflateUnpack2 db 'deflate_unpack2',0 - -;--------------------------------------------------------------------- -align 4 -Sort_import: -sort_init dd aSort_init -sort_version dd aSort_version -sort_dir dd aSort_SortDir -sort_strcmpi dd aSort_strcmpi - dd 0 - dd 0 - -aSort_init db 'START',0 -aSort_version db 'version',0 -aSort_SortDir db 'SortDir',0 -aSort_strcmpi db 'strcmpi',0 - -;--------------------------------------------------------------------- -align 4 -Libini_import: -lib_init dd aLib_init -version_lib_ini dd aVersion_lib_ini -ini_enum_sections dd aIni_enum_sections -ini_enum_keys dd aIni_enum_keys -ini_get_str dd aIni_get_str -ini_get_int dd aIni_get_int -ini_get_color dd aIni_get_color -ini_set_str dd aIni_set_str -ini_set_int dd aIni_set_int -ini_set_color dd aIni_set_color - dd 0 - dd 0 - -aLib_init db 'lib_init',0 -aVersion_lib_ini db 'version',0 -aIni_enum_sections db 'ini_enum_sections',0 -aIni_enum_keys db 'ini_enum_keys',0 -aIni_get_str db 'ini_get_str',0 -aIni_get_int db 'ini_get_int',0 -aIni_get_color db 'ini_get_color',0 -aIni_set_str db 'ini_set_str',0 -aIni_set_int db 'ini_set_int',0 -aIni_set_color db 'ini_set_color',0 - -;--------------------------------------------------------------------- -align 4 -Box_lib_import: -;init_lib dd a_init -;version_lib dd a_version - -edit_box_draw dd aEdit_box_draw -edit_box_key dd aEdit_box_key -edit_box_mouse dd aEdit_box_mouse -;version_ed dd aVersion_ed - -init_checkbox dd aInit_checkbox -check_box_draw dd aCheck_box_draw -check_box_mouse dd aCheck_box_mouse -;version_ch dd aVersion_ch - -option_box_draw dd aOption_box_draw -option_box_mouse dd aOption_box_mouse -;version_op dd aVersion_op - -scrollbar_ver_draw dd aScrollbar_ver_draw -scrollbar_ver_mouse dd aScrollbar_ver_mouse -scrollbar_hor_draw dd aScrollbar_hor_draw -scrollbar_hor_mouse dd aScrollbar_hor_mouse -;version_scrollbar dd aVersion_scrollbar - -dinamic_button_draw dd aDbutton_draw -dinamic_button_mouse dd aDbutton_mouse -;version_dbutton dd aVersion_dbutton - -menu_bar_draw dd aMenu_bar_draw -menu_bar_mouse dd aMenu_bar_mouse -menu_bar_activate dd aMenu_bar_activate -;version_menu_bar dd aVersion_menu_bar - -;FileBrowser_draw dd aFileBrowser_draw -;FileBrowser_mouse dd aFileBrowser_mouse -;FileBrowser_key dd aFileBrowser_key -;Version_FileBrowser dd aVersion_FileBrowser - dd 0 - dd 0 - -;a_init db 'lib_init',0 -;a_version db 'version',0 - -aEdit_box_draw db 'edit_box_draw',0 -aEdit_box_key db 'edit_box_key',0 -aEdit_box_mouse db 'edit_box_mouse',0 -;aVersion_ed db 'version_ed',0 - -aInit_checkbox db 'init_checkbox2',0 -aCheck_box_draw db 'check_box_draw2',0 -aCheck_box_mouse db 'check_box_mouse2',0 -;aVersion_ch db 'version_ch2',0 - -aOption_box_draw db 'option_box_draw',0 -aOption_box_mouse db 'option_box_mouse',0 -;aVersion_op db 'version_op',0 - -aScrollbar_ver_draw db 'scrollbar_v_draw',0 -aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 -aScrollbar_hor_draw db 'scrollbar_h_draw',0 -aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 -;aVersion_scrollbar db 'version_scrollbar',0 - -aDbutton_draw db 'dbutton_draw',0 -aDbutton_mouse db 'dbutton_mouse',0 -;aVersion_dbutton db 'version_dbutton',0 - -aMenu_bar_draw db 'menu_bar_draw',0 -aMenu_bar_mouse db 'menu_bar_mouse',0 -aMenu_bar_activate db 'menu_bar_activate',0 -;aVersion_menu_bar db 'version_menu_bar',0 - -;aFileBrowser_draw db 'FileBrowser_draw',0 -;aFileBrowser_mouse db 'FileBrowser_mouse',0 -;aFileBrowser_key db 'FileBrowser_key',0 -;aVersion_FileBrowser db 'version_FileBrowser',0 -;--------------------------------------------------------------------- -align 4 -load_directory_pointer dd 0 -file_name_length dd 0 -load_file_number dd 0 -error_fs dd 0 -error_pointer dd 0 -;error_locate dd 0 -error_window_x: dd 100 shl 16 + 300 -error_window_y: dd 100 shl 16 + 100 - -PID dd 0 -PID1 dd 0 -PID2 dd 0 -PID3 dd 0 -PID4 dd 0 -PID5 dd 0 -PID6 dd 0 -PID7 dd 0 -active_process dd 0 -timer_counter dd 0 -draw_scrollbar_counter dd 0 -;--------------------------------------------------------------------- -align 4 -error_fs_text_pointers: - dd error_fs_text_0 - dd error_fs_text_1 - dd error_fs_text_2 - dd error_fs_text_3 - dd error_fs_text_4 - dd error_fs_text_5 - dd error_fs_text_6 - dd error_fs_text_7 - dd error_fs_text_8 - dd error_fs_text_9 - dd error_fs_text_10 - dd error_fs_text_11 - -error_fs_text_0: db 'Success full',0 -error_fs_text_1: db 'Base and/or partition of a hard disk is not defined',0 -error_fs_text_2: db 'Function is not supported for the given file system',0 -error_fs_text_3: db 'Unknown file system',0 -error_fs_text_4: db 'Reserved, is never returned in the current implementation',0 -error_fs_text_5: db 'File not found',0 -error_fs_text_6: db 'End of file, EOF',0 -error_fs_text_7: db 'Pointer lies outside of application memory',0 -error_fs_text_8: db 'Disk is full',0 -error_fs_text_9: db 'FAT table is destroyed',0 -error_fs_text_10: db 'Access denied',0 -error_fs_text_11: db 'Device error',0 -;--------------------------------------------------------------------- -error_type: - db 'File system error',0 -;--------------------------------------------------------------------- -error_not_supported_file: - db 'Unsupported file or corrupt data',0 -;--------------------------------------------------------------------- -error_not_enough_memory: - db 'Not_enough_memory',0 -;--------------------------------------------------------------------- -error_unknown: - db 'Unknown error',0 -;--------------------------------------------------------------------- -extended_key db 0 -no_draw_window db 0 - -shift_flag db 0 -ctrl_flag db 0 -alt_flag db 0 -;--------------------------------------------------------------------- -; for EDITBOX -align 4 -name_editboxes: -edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,mouse_dd,ed_focus+ed_always_focus,0 -name_editboxes_end: - -;mouse_flag: dd 0x0 - -mouse_dd rd 1 -;--------------------------------------------------------------------- -align 4 -; option_boxes_bcgr: -op1 option_box option_group1,60,45,6,12,0xFFFFFF,0,0xffffff,op_text.1,op_text.e1-op_text.1 -op2 option_box option_group1,60,60,6,12,0xFFFFFF,0,0xffffff,op_text.2,op_text.e2-op_text.2 -op3 option_box option_group1,60,75,6,12,0xFFFFFF,0,0xffffff,op_text.3,op_text.e3-op_text.3 -op4 option_box option_group1,60,90,6,12,0xFFFFFF,0,0xffffff,op_text.4,op_text.e4-op_text.4 -;option_boxes_bcgr_end: - -op_text: -.1 db 'Tiled' -.e1: -.2 db 'Stretch' -.e2: -.3 db 'Stretch + Crop' -.e3: -.4 db 'Stretch + Inscribe' -.e4: - -option_group1 dd op1 - -option_boxes_bcgr: dd op1,op2,op3,op4,0 - -;--------------------------------------------------------------------- -align 4 -op_UL option_box option_group3,200,40,20,20,0xFFFFFF,0,0xffffff,0,0 -op_UC option_box option_group3,223,40,20,20,0xFFFFFF,0,0xffffff,0,0 -op_UR option_box option_group3,246,40,20,20,0xFFFFFF,0,0xffffff,0,0 -op_CL option_box option_group3,200,63,20,20,0xFFFFFF,0,0xffffff,0,0 -op_CC option_box option_group3,223,63,20,20,0xFFFFFF,0,0xffffff,0,0 -op_CR option_box option_group3,246,63,20,20,0xFFFFFF,0,0xffffff,0,0 -op_DL option_box option_group3,200,86,20,20,0xFFFFFF,0,0xffffff,0,0 -op_DC option_box option_group3,223,86,20,20,0xFFFFFF,0,0xffffff,0,0 -op_DR option_box option_group3,246,86,20,20,0xFFFFFF,0,0xffffff,0,0 -;option_boxes_bcgr_end: - -option_group3 dd op_CC - -Stretch_Crop_Corner dd 1 shl 16+1 -option_boxes_SCC: dd op_UL,op_UC,op_UR,op_CL,op_CC,op_CR,op_DL,op_DC,op_DR,0 - -bcgr_group_pointer db 0 -;--------------------------------------------------------------------- -align 4 -;option_boxes_sort: -sort0 option_box option_group2,60,40,6,12,0xFFFFFF,0,0xffffff,op_text_1.1,op_text_1.e1-op_text_1.1 -sort2 option_box option_group2,60,55,6,12,0xFFFFFF,0,0xffffff,op_text_1.2,op_text_1.e2-op_text_1.2 -sort4 option_box option_group2,60,70,6,12,0xFFFFFF,0,0xffffff,op_text_1.3,op_text_1.e3-op_text_1.3 -sort6 option_box option_group2,60,85,6,12,0xFFFFFF,0,0xffffff,op_text_1.4,op_text_1.e4-op_text_1.4 -option_boxes_sort_end: - -op_text_1: -.1 db 'Name' -.e1: -.2 db 'Type' -.e2: -.3 db 'Date' -.e3: -.4 db 'Size' -.e4: - -option_group2 dd sort2 -option_group2_old dd 0 - -option_boxes_sort dd sort0, sort2, sort4, sort6,0 -;--------------------------------------------------------------------- -check1 check_box2 (140 shl 16)+12,(50 shl 16)+12,6,0xFFFFFF,0,0xffffff,check_text1,ch_flag_middle ;ch_flag_en - -check_text1 db 'Show file name',0 - -show_file_name_old dd 0 -;--------------------------------------------------------------------- -check2 check_box2 (140 shl 16)+12,(70 shl 16)+12,6,0xFFFFFF,0,0xffffff,check_text2,ch_flag_middle ;ch_flag_en - -check_text2 db 'Bilinear filtering',0 - -filtering_flag dd 0 -filtering_flag_old dd 0 -;--------------------------------------------------------------------- -align 4 -scroll_bar_data_vertical: -.x: -.size_x dw 15 ;+0 -.start_x dw 500 ;+2 -.y: -.size_y dw 300 ;+4 -.start_y dw 30 ;+6 -.btn_high dd 15 ;+8 -.type dd 2 ;+12 -.max_area dd 10 ;+16 -.cur_area dd 2 ;+20 -.position dd 0 ;+24 -.bckg_col dd 0xeeeeee ;+28 -.frnt_col dd 0x8aeaa0 ;0xbbddff ;+32 -.line_col dd 0 ;+36 -.redraw dd 0 ;+40 -.delta dw 0 ;+44 -.delta2 dw 0 ;+46 -.run_x: -.r_size_x dw 0 ;+48 -.r_start_x dw 0 ;+50 -.run_y: -.r_size_y dw 0 ;+52 -.r_start_y dw 0 ;+54 -.m_pos dd 0 ;+56 -.m_pos_2 dd 0 ;+60 -.m_keys dd 0 ;+64 -.run_size dd 0 ;+68 -.position2 dd 0 ;+72 -.work_size dd 0 ;+76 -.all_redraw dd 0 ;+80 -.ar_offset dd 10 ;+84 -;--------------------------------------------------------------------- -align 4 -scroll_bar_data_horizontal: -.x: -.size_x dw 300 ;0 ;+0 -.start_x dw 10 ;0 ;+2 -.y: -.size_y dw 15 ;0 ;+4 -.start_y dw 300 ;0 ;+6 -.btn_high dd 15 ;+8 -.type dd 2 ;+12 -.max_area dd 10 ;+16 -.cur_area dd 2 ;+20 -.position dd 0 ;+24 -.bckg_col dd 0xeeeeee ;+28 -.frnt_col dd 0x8aeaa0 ;0xbbddff ;+32 -.line_col dd 0 ;+36 -.redraw dd 0 ;+40 -.delta dw 0 ;+44 -.delta2 dw 0 ;+46 -.run_x: -.r_size_x dw 0 ;+48 -.r_start_x dw 0 ;+50 -.run_y: -.r_size_y dw 0 ;+52 -.r_start_y dw 0 ;+54 -.m_pos dd 0 ;+56 -.m_pos_2 dd 0 ;+60 -.m_keys dd 0 ;+64 -.run_size dd 0 ;+68 -.position2 dd 0 ;+72 -.work_size dd 0 ;+76 -.all_redraw dd 0 ;+80 -.ar_offset dd 10 ;+84 -;--------------------------------------------------------------------- -align 4 -menu_data_1: -.type: dd 0 ;+0 -.x: -.size_x dw 35 ;+4 -.start_x dw 5 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_1 ;0 ;+12 -.pos_pointer: dd menu_text_area_1.1 ;0 ;+16 -.text_end dd menu_text_area_1.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 70 ;+32 -.start_x1 dw 5 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_1: -db 'File',0 -.1: -db 'Open',0 -db 'Properties',0 -db 'Exit',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -menu_data_2: -.type: dd 0 ;+0 -.x: -.size_x dw 35 ;+4 -.start_x dw 40 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_2 ;0 ;+12 -.pos_pointer: dd menu_text_area_2.1 ;0 ;+16 -.text_end dd menu_text_area_2.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 90 ;+32 -.start_x1 dw 40 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_2: -db 'Edit',0 -.1: -db 'Rotate Clock.',0 -db 'Rotate CClock.',0 -db 'Invert L to R',0 -db 'Invert U to D',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -menu_data_3: -.type: dd 0 ;+0 -.x: -.size_x dw 35 ;+4 -.start_x dw 75 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_3 ;0 ;+12 -.pos_pointer: dd menu_text_area_3.1 ;0 ;+16 -.text_end dd menu_text_area_3.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 90 ;+32 -.start_x1 dw 75 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_3: -db 'View',0 -.1: -db 'Sort Directory',0 -db 'Full Screen',0 -db 'Reload',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -menu_data_4: -.type: dd 0 ;+0 -.x: -.size_x dw 35 ;+4 -.start_x dw 110 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_4 ;0 ;+12 -.pos_pointer: dd menu_text_area_4.1 ;0 ;+16 -.text_end dd menu_text_area_4.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 40 ;+32 -.start_x1 dw 110 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_4: -db 'Zoom',0 -.1: -db 'Normal',0 -db 'More',0 -db 'Less',0 -db 'Auto',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -menu_data_5: -.type: dd 0 ;+0 -.x: -.size_x dw 40 ;+4 -.start_x dw 145 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_5 ;0 ;+12 -.pos_pointer: dd menu_text_area_5.1 ;0 ;+16 -.text_end dd menu_text_area_5.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 80 ;+32 -.start_x1 dw 145 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_5: -db 'Tools',0 -.1: -db 'Image Editor',0 -db 'Wallpaper',0 -db 'Slide Show',0 -db 'Options',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -menu_data_6: -.type: dd 0 ;+0 -.x: -.size_x dw 35 ;+4 -.start_x dw 185 ;+6 -.y: -.size_y dw 15 ;+8 -.start_y dw 6 ;+10 -.text_pointer: dd menu_text_area_6 ;0 ;+12 -.pos_pointer: dd menu_text_area_6.1 ;0 ;+16 -.text_end dd menu_text_area_6.end ;0 ;+20 -.ret_key dd 0 ;+24 -.mouse_keys dd 0 ;+28 -.x1: -.size_x1 dw 50 ;+32 -.start_x1 dw 185 ;+34 -.y1: -.size_y1 dw 100 ;+36 -.start_y1 dw 21 ;+38 -.bckg_col dd 0xe5e5e5 ;+40 -.frnt_col dd 0xff ;+44 -.menu_col dd 0xeef0ff ;0xffffff ;+48 -.select dd 0 ;+52 -.out_select dd 0 ;+56 -.buf_adress dd 0 ;+60 -.procinfo dd 0 ;+64 -.click dd 0 ;+68 -.cursor dd 0 ;+72 -.cursor_old dd 0 ;+76 -.interval dd 16 ;+80 -.cursor_max dd 0 ;+84 -.extended_key dd 0 ;+88 -.menu_sel_col dd 0x00cc00 ;+92 -.bckg_text_col dd 0 ; +96 -.frnt_text_col dd 0xffffff ;+100 -.mouse_keys_old dd 0 ;+104 -.font_height dd 8 ;+108 -.cursor_out dd 0 ;+112 -.get_mouse_flag dd 0 ;+116 -;--------------------------------------------------------------------- -menu_text_area_6: -db 'Help',0 -.1: -db 'Help',0 -db 'About',0 -.end: -db 0 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_1: ; open file -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 230 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_2: ; reload file -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 255 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_3: ; left limit -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 285 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_4: ; left arrow -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 310 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_5: ; slide show -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 335 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_6: ; right arrow -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 360 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_7: ; right limit -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 385 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_8: ; zoom + -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 415 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_9: ; zoom - -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 440 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_10: ; zoom 100% -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 465 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_11: ; rotate clockwise -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 495 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_12: ; rotate counter-clockwise -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 520 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_13: ; file information -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 550 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_14: ; wallpaper -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 575 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dinamic_button_data_15: ; settings -.type dd 0 ;+0 -.x: -.size_x dw 20 ;+4 -.start_x dw 600 ;+6 -.y: -.size_y dw 20 ;+8 -.start_y dw 3 ;+10 -.mouse_pos dd 0 ;+12 -.mouse_keys dd 0 ;+16 -.mouse_keys_old dd 0 ;+20 -.active_raw dd 0 ;+24 -.passive_raw dd 0 ;+28 -.click_raw dd 0 ;+32 -.resolution_raw dd 0 ;+36 -.palette_raw dd 0 ;+40 -.offset_raw dd 0 ;+44 -.select dd 0 ;+48 -.click dd 0 ;+52 -;--------------------------------------------------------------------- -align 4 -dirinfo: -.subfunction dd 1 -.start dd 0 -.flags dd 0 -.size dd 0 -.return dd procinfo - db 0 -.name: dd plugin_pach -;--------------------------------------------------------------------- -align 4 -fileinfo: -.subfunction dd 5 -.Offset dd 0 -.Offset_1 dd 0 -.size dd 0 -.return dd process_info - db 0 -.name: dd string -;--------------------------------------------------------------------- -align 4 -start_appl: -.subfunction dd 7 -.flags dd 0 -.parameter dd library_path -.reserved1 dd 0 -.reserved2 dd 0 - db 0 -.name: dd Help_path -;--------------------------------------------------------------------- -align 4 -dir_header: -.version dd 0 ;+0 -.curn_blocks dd 0 ;+4 -.totl_blocks dd 0 ;+8 -.other rb 20 -;--------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd plugin_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd library_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd string ;+36 -.filename_area dd 0 ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_name: - db 'opendial',0 -communication_area_default_pach: - db '/sys',0 -;communication_area dd 0 -;--------------------------------------------------------------------- -ColorDialog_data: -.type dd 0 -.procinfo dd procinfo ;+4 -.com_area_name dd cd_communication_area_name ;+8 -.com_area dd 0 ;+12 -.start_path dd colordialog_path ;+16 -.draw_window dd thread4.draw_window ;+20 -.status dd 0 ;+24 -.x: -.x_size dw 510 ;+28 ; Window X size -.x_start dw 10 ;+30 ; Window X position -.y: -.y_size dw 310 ;+32 ; Window y size -.y_start dw 10 ;+34 ; Window Y position -.color_type dd 0 ;+36 ; 0- RGB, 1 or other - reserved -.color dd 0 ;+40 ; Selected color - -cd_communication_area_name: - db 'FFFFFFFF_color_dialog',0 -colordialog_path: - db '/sys/colrdial',0 -;--------------------------------------------------------------------- -; clear bacground thread -clear_thread_stack: - dd 0 -;---------------------- -; window option -thread_stack_7: - dd 0 -;---------------------- -; window error message -thread_stack_6: - dd 0 -;---------------------- -; window set sort mode -thread_stack_5: - dd 0 -;---------------------- -; window background -thread_stack_4: - dd 0 -;---------------------- -; window about -thread_stack_3: - dd 0 -;---------------------- -; file info -thread_stack_2: - dd 0 -;---------------------- -; file open -thread_stack: - dd 0 -;--------------------------------------------------------------------- -;size_before_open_dir: -; dd 0 -;size_before_open_file: -; dd 0 -;size_after_open_file: -; dd 0 -;size_after_convert: -; dd 0 -;size_after_convert_2: -; dd 0 -;size_before_draw_image: -; dd 0 -;size_after_draw_image: -; dd 0 -;size_before_scaling: -; dd 0 -;size_after_scaling: -; dd 0 \ No newline at end of file +; Language support for locales: en_US, ru_RU (CP866), de_DE. + +;--------------------------------------------------------------------- +; DATA AREA +;--------------------------------------------------------------------- +lsz labelt1,\ + en_US, 'File',\ + ru_RU, '',\ + de_DE, 'Datei' + db 0 + +;--------------------------------------------------------------------- +lsz labelt2,\ + en_US, 'File info',\ + ru_RU, 'ଠ 䠩',\ + de_DE, 'Dateiinfo' + db 0 + +lsz fitext,\ + en_US, 'File name ',\ + en_US, 'File size ',\ + en_US, 'X size ',\ + en_US, 'Y size ',\ + en_US, 'Resolution ',\ + en_US, 'Frames total ',\ + \ + ru_RU, ' 䠩 ',\ + ru_RU, ' 䠩 ',\ + ru_RU, 'ਭ ',\ + ru_RU, ' ',\ + ru_RU, ' ᥫ ',\ + ru_RU, 'ᥣ ஢ ',\ + \ + de_DE, 'Datei Namen ',\ + de_DE, 'Fateigroesse ',\ + de_DE, 'X groesse ',\ + de_DE, 'Y groesse ',\ + de_DE, 'Die Tiefe ',\ + de_DE, 'Zahl Frames ' + db 0 +;--------------------------------------------------------------------- +Authors_text: +.1: db 'zSea version: 1.00 RC5-1 Date: 03/12/2021',0 +.2: db 'Authors:',0 +.3: db 'Marat Zakiyanov aka Mario(Mario79)',0 +.4: db 'zSea program, modules: cnv_bmp.obj,',0 +.5: db 'cnv_png.obj, convert.obj, rotate.obj ',0 +.6: db 'scaling.obj, box_lib.obj, OpenDialog',0 +.7: db 'proc_lib.obj',0 + +.8: db 'Evgeny Grechnikov aka Diamond',0 +.9: db 'modules: cnv_jpeg.obj, cnv_gif.obj,',0 +.10: db 'archiver.obj, sort.obj ',0 + +.11: db 'Alexey Teplov aka ',0 +.12: db 'modules: box_lib.obj, load_lib.mac',0 + +.13: db 'Mihail Semenyako aka Mike.dld',0 +.14: db 'modules: libini.obj, libio.obj',0 +;--------------------------------------------------------------------- +status dd 0 ;bit0=1 if file thread is created +;process dd 0 + +bWasDraw db 0 +vflag: db 'x' +bgrmode: dd 1 + +wnd_width dd 210 +wnd_height dd 53 +;--------------------------------- +lsz labelt3,\ + en_US, 'About program',\ + ru_RU, ' ணࠬ',\ + de_DE, 'Uber das programm' + db 0 +;--------------------------------- +lsz labelt4,\ + en_US, 'Set wallpaper',\ + ru_RU, '⠭ 䮭',\ + de_DE, 'Installation hintergrund' + db 0 +;--------------------------------- +lsz labelt5,\ + en_US, 'Select sorting mode',\ + ru_RU, '஢ ४ਨ',\ + de_DE, 'Regimes der Sortierung' + db 0 +;--------------------------------- +lsz bgrdtext,\ + en_US, 'Set as background:',\ + ru_RU, ' :',\ + de_DE, 'Als hintergrund' + db 0 +;--------------------------------- +lsz scc_text,\ + en_US, 'Position:',\ + ru_RU, ':',\ + de_DE, 'Position:' + db 0 +;--------------------------------- +lsz sorttext,\ + en_US, 'Directory sorting mode:',\ + ru_RU, ' ஢ ४ਨ:',\ + de_DE, 'Regime der Sortierung des Verzeichnisses:' + db 0 +;--------------------------------- +lsz errortext,\ + en_US, 'File system error:',\ + ru_RU, '訡 䠩 ⥬:',\ + de_DE, 'Fehler files systemes:' + db 0 +;--------------------------------- +lsz optiontext,\ + en_US, 'Options:',\ + ru_RU, 'ன:',\ + de_DE, 'Optionen:' + db 0 +;--------------------------------- +;lsz tiled,\ +; en_US, 'Tiled',\ +; ru_RU, '',\ +; de_DE, 'Gekachelt' + +;lsz stretch,\ +; en_US, 'Stretch',\ +; ru_RU, '',\ +; de_DE, 'Gestreckt' +;--------------------------------- +lsz color_btn,\ + en_US, 'Background color:',\ + ru_RU, ' 䮭:',\ + de_DE, 'Hintergrundfarbe:' + db 0 +;--------------------------------- +lsz ok_btn,\ + en_US, 'Ok',\ + ru_RU, 'Ok',\ + de_DE, 'Ok' + db 0 +;--------------------------------- +lsz slide_show_delay_title,\ + en_US, 'Slide show delay:',\ + ru_RU, 'প ᫠:',\ + de_DE, 'Verzug der schau:' + db 0 +;--------------------------------- +lsz arrows_offset_title,\ + en_US, 'Arrows offset:',\ + ru_RU, '饭 ५:',\ + de_DE, 'Bewegung von den zeigern:' + db 0 +;--------------------------------- +slide_show_delay_text: + db '+ -',0 +;--------------------------------------------------------------------- +zoom_auto_factor: + dd 0 +zoom_auto_text: + db 'auto',0 +zoom_factors: + dd zoom_factors.100 +.1: dd 0 +.min: + dd 1 + dd 2 + dd 3 + dd 4 + dd 5 + dd 7 + dd 10 + dd 17 + dd 25 + dd 37 + dd 50 + dd 62 + dd 75 + dd 87 +.100: + dd 100 + dd 125 + dd 150 + dd 175 + dd 200 + dd 225 + dd 250 + dd 275 + dd 300 + dd 350 + dd 400 + dd 450 + dd 500 + dd 600 + dd 700 + dd 800 + dd 900 + dd 1000 + dd 1100 + dd 1200 + dd 1300 + dd 1400 + dd 1500 + dd 1750 + dd 2000 + dd 2250 + dd 2500 + dd 2750 + dd 3000 + dd 3500 + dd 4000 + dd 4500 +.max: + dd 5000 + +zoom_factors_old dd 0 + +;--------------------------------------------------------------------- +; not change this section!!! +; start section +;--------------------------------------------------------------------- +align 4 +crop_image_file dd 0 ;+0 +crop_raw_pointer dd 0 ;+4 +crop_return_code dd 0 ;+8 +crop_img_size dd 0 ;+12 +crop_deflate_unpack dd 0 ;+16 +crop_raw_pointer_2 dd 0 ;+20 +;--------------------------------------------------------------------- +; end section +;--------------------------------------------------------------------- + +;--------------------------------------------------------------------- +; not change this section!!! +; start section +;--------------------------------------------------------------------- +align 4 +image_file dd 0 ;+0 +raw_pointer dd 0 ;+4 +return_code dd 0 ;+8 +img_size dd 0 ;+12 +deflate_unpack dd 0 ;+16 +raw_pointer_2 dd 0 ;+20 +;--------------------------------------------------------------------- +; end section +;--------------------------------------------------------------------- +test1 dd 0 ;+24 +test2 dd 0 ;+28 +test3 dd 0 ;+32 +test4 dd 0 ;+36 +test5 dd 0 ;+40 +test6 dd 0 ;+44 +test7 dd 0 ;+48 +;--------------------------------------------------------------------- +align 4 +soi dd 0 +img_width dd 0 +img_width_2 dd 0 +img_high dd 0 +img_high_2 dd 0 +img_resolution dd 0 +img_resolution_2 dd 0 +img_palette dd 0 + +background_color dd 0xffffff + +skin_height dd 0 + +screen_high dd 0 +screen_width dd 0 + +stretch_start_coordinates: +.y dw 0 +.x dw 0 + +screen_relation dd 0 +picture_relation dd 0 + +stretch_img_high dd 0 +stretch_img_width dd 0 + +RAW1_pointer dd 0 +RAW1_size_x dd 0 +RAW1_size dd 0 +Repeat_N dd 0 +Total_Repeat_N dd 1 +previous_frame_pointer dd 0 +Animation_timer dd 0 +Frame_delay dw 0 +Transp_flag db 0 +Transp_index db 0 +Disposal_Method db 0 +RAW1_flag db 0 +no_fill db 0 +redraw_wallpaper_flag db 0 + +calc_next_value_plus db 0 +calc_next_value_minus db 0 +;--------------------------------------------------------------------- +align 4 +;plugin dd 0 +;plugin_1 dd 0 +;plugin_2 dd 0 +;plugin_3 dd 0 + +;plugin_validate dd 0 +;plugin_validate_1 dd 0 +;plugin_validate_2 dd 0 +;plugin_validate_3 dd 0 + +;plugin_format dd 0 +;plugin_format_1 dd 0 +;plugin_format_2 dd 0 +;plugin_format_3 dd 0 + +;plugin_convert dd 0 +;plugin_convert_background dd 0 +;plugin_sort dd 0 +;plugin_rotate dd 0 +;plugin_scaling dd 0 + +slide_show_delay dd 500 ; cost of 0,01 sec. +slide_show_delay_old dd 0 + +sort_type dd 2 +sort_type_old dd 0 +;--------------------------------------------------------------------- +expansion_length dd 0 +expansion_start dd 0 + +timer dd 0 +;--------------------------------------------------------------------- +mouse_scroll_data: + .vertical dw 0 + .horizontal dw 0 + +mouse_position: + .y dw 0 + .x dw 0 + +mouse_position_old: + .y dw 0 + .x dw 0 + +mouse_keys dd 0 +mouse_keys_old dd 0 + +arrows_offset dd 10 +arrows_offset_old dd 10 + +option_pointer dd 0 +plus_pointer dd 0 +minus_pointer dd 0 +space_pointer dd 0 + +;--------------------------------------------------------------------- +pos: dd 6 + +work_area_LR_old dd 0 +work_area_TB_old dd 0 + +scaling_mode dd 100 +scaling_mode_old dd 100 + +window_start_x_old dd 0 +window_start_y_old dd 0 +window_high_old dd 0 +window_width_old dd 0 + +window_start_x dd 0 +window_start_y dd 0 +window_high dd 0 +window_width dd 0 +;skin_high dd 0 +window_status dd 0 +draw_SB db 0 +draw_SB1 db 0 +correct_w db 0 +correct_h db 0 +wa_width dw 0 +wa_high dw 0 + +wa_width_1 dw 0 +wa_width_2 dw 0 + +wa_high_1 dw 0 +wa_high_2 dw 0 + +image_start_coordinates dd 0 +image_draw_size: +.y: dw 0 +.x: dw 0 + +vertical_position_coorect dd 0 +horizontal_position_coorect dd 0 + +fill_color dd 0xffffff +fill_color_old dd 0xffffff + +position_coorect db 0 + +open_file_flag db 0 +sort_directory_flag db 0 +redraw_flag db 0 + +press_Enter_flag db 0 + +capture_image_area_flag db 0 + +correct_scrollbar_100_flag db 0 +;--------------------------------------------------------------------- +;test_area: +;dd test_area.end - test_area +;db 'BMP',0 +;.end: +;db 0,0,0,0,0,0,0,0,0,0,0,0,0 +;--------------------------------------------------------------------- +aApplicationsPaths db 'ApplicationsPaths',0 +aOther db 'Other',0 + +aHelp db 'Help',0 +aEditor db 'Editor',0 +aOpenDialog db 'OpenDialog',0 +akey_help db 'HelpFile',0 + +aConvertPlugins db 'ConvertPlugins',0 + +ConvertPlugins_no_key db 'NoKey',0 + +aCP0 db 'CP0',0 +aCP1 db 'CP1',0 +aCP2 db 'CP2',0 +aCP3 db 'CP3',0 +aCP4 db 'CP4',0 +aCP5 db 'CP5',0 +aCP6 db 'CP6',0 +aCP7 db 'CP7',0 +aCP8 db 'CP8',0 +aCP9 db 'CP9',0 +;--------------------------------------------------------------------- +plugin_BMP_name db 'cnv_bmp.obj',0 +plugin_PNG_name db 'cnv_png.obj',0 +plugin_JPEG_name db 'cnv_jpeg.obj',0 +plugin_GIF_name db 'cnv_gif.obj',0 + +;plugin_convert_name db 'convert.obj',0 +;plugin_sort_name db 'sort.obj',0 +;plugin_rotate_name db 'rotate.obj',0 +;plugin_scaling_name db 'scaling.obj',0 +;plugin_UNPACK_name db 'archiver.obj',0 +;boxlib_name db 'box_lib.obj',0 +;Libini_name db 'libini.obj',0 +plugins_directory db 'plugins/',0 +ini_file_name db 'zsea.ini',0 + +button_name db 'buttons.png',0 +;buttons_passive_name db '1.png',0 +;buttons_active_name db '2.png',0 +;buttons_click_name db '3.png',0 + +buttons_directory db 'buttons/',0 +;UNPACK_function_name db 'deflate_unpack',0 +;UNPACK_function_name_end: +;UNPACK_function_name db 'deflate_unpack2',0 +;UNPACK_function_name_end: + +system_dir_Boxlib db '/sys/lib/box_lib.obj',0 +system_dir_Libini db '/sys/lib/libini.obj',0 +system_dir_Sort db '/sys/lib/sort.obj',0 +system_dir_UNPACK db '/sys/lib/archiver.obj',0 +system_dir_Convert db '/sys/lib/convert.obj',0 +system_dir_Rotate db '/sys/lib/rotate.obj',0 +system_dir_Scaling db '/sys/lib/scaling.obj',0 +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 + +;--------------------------------------------------------------------- +l_libs_start: +library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ +Box_lib_import, plugins_directory + +library02 l_libs system_dir_Libini+9, library_path, system_dir_Libini, \ +Libini_import, plugins_directory + +library03 l_libs system_dir_Sort+9, library_path, system_dir_Sort, \ +Sort_import, plugins_directory + +library04 l_libs system_dir_UNPACK+9, library_path, system_dir_UNPACK, \ +UNPACK_import, plugins_directory + +library05 l_libs system_dir_Convert+9, library_path, system_dir_Convert, \ +Convert_import, plugins_directory + +library06 l_libs system_dir_Rotate+9, library_path, system_dir_Rotate, \ +Rotate_import, plugins_directory + +library07 l_libs system_dir_Scaling+9, library_path, system_dir_Scaling, \ +Scaling_import, plugins_directory + +library08 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ +ProcLib_import, plugins_directory + +end_l_libs: +;--------------------------------------------------------------------- +align 4 +cnv_plugin_name_pointer dd plugin_0_name +cnv_plugin_import_pointer dd Convert_plugin_0 + +system_path db '/sys/lib/' +.1: rb 128 +;--------------------------------------------------------------------- +Convert_plugin_0: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_1: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_2: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_3: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_4: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_5: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_6: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_7: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_8: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +Convert_plugin_9: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +aCP_Start db 'START',0 +aCP_Version db 'version',0 +aCP_Check db 'Check_Header',0 +aCP_Assoc db 'Associations',0 +;--------------------------------------------------------------------- + +file_mount: db 'File N: Amount: Zoom:',0 +.end: + +current_key_code db 0 +old_key_code db 0 +;--------------------------------------------------------------------- +; Tokens +;--------------------------------------------------------------------- +aSortMode db 'SortMode',0 +aSlideShowDelay db 'SlideShowDelay',0 +aArrowsOffset db 'ArrowsOffset',0 +aShowFileName db 'ShowFileName',0 +aFilteringFlag db 'FilteringFlag',0 +;--------------------------------------------------------------------- +;Sections +;--------------------------------------------------------------------- +aVariables db 'Variables',0 +;aVar db 'Var',0 +;aTemp db 'Temp',0 +;--------------------------------------------------------------------- +align 4 +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start + +ColorDialog_Init dd aColorDialog_Init +ColorDialog_Start dd aColorDialog_Start +;OpenDialog__Version dd aOpenDialog_Version + dd 0 + dd 0 + +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 + +aColorDialog_Init db 'ColorDialog_init',0 +aColorDialog_Start db 'ColorDialog_start',0 +;aOpenDialog_Version db 'Version_OpenDialog',0 +;--------------------------------------------------------------------- +align 4 +Scaling_import: +Scaling_Start dd aScaling_Start +Scaling_Version dd aScaling_Version + dd 0 + dd 0 +aScaling_Start db 'START',0 +aScaling_Version db 'version',0 +;--------------------------------------------------------------------- +align 4 +Rotate_import: +rotate_Start dd aRotate_Start +rotate_Version dd aRotate_Version + dd 0 + dd 0 +aRotate_Start db 'START',0 +aRotate_Version db 'version',0 +;--------------------------------------------------------------------- +align 4 +Convert_import: +convert_Start dd aConvert_Start +convert_Version dd aConvert_Version +convert_Conv_24b dd aConvert_Conv_24b + dd 0 + dd 0 +aConvert_Start db 'START',0 +aConvert_Version db 'version',0 +aConvert_Conv_24b db 'Convert24b',0 +;--------------------------------------------------------------------- +align 4 +UNPACK_import: +;unpack_Version dd aUnpack_Version +;unpack_PluginLoad dd aUnpack_PluginLoad +;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin +;unpack_ClosePlugin dd aUnpack_ClosePlugin +;unpack_ReadFolder dd aUnpack_ReadFolder +;unpack_SetFolder dd aUnpack_SetFolder +;unpack_GetFiles dd aUnpack_GetFiles +;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo +;unpack_Getattr dd aUnpack_Getattr +;unpack_Open dd aUnpack_Open +;unpack_Read dd aUnpack_Read +;unpack_Setpos dd aUnpack_Setpos +;unpack_Close dd aUnpack_Close +;unpack_DeflateUnpack dd aUnpack_DeflateUnpack +unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2 + dd 0 + dd 0 + +;aUnpack_Version db 'version',0 +;aUnpack_PluginLoad db 'plugin_load',0 +;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0 +;aUnpack_ClosePlugin db 'ClosePlugin',0 +;aUnpack_ReadFolder db 'ReadFolder',0 +;aUnpack_SetFolder db 'SetFolder',0 +;aUnpack_GetFiles db 'GetFiles',0 +;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0 +;aUnpack_Getattr db 'getattr',0 +;aUnpack_Open db 'open',0 +;aUnpack_Read db 'read',0 +;aUnpack_Setpos db 'setpos',0 +;aUnpack_Close db 'close',0 +;aUnpack_DeflateUnpack db 'deflate_unpack',0 +aUnpack_DeflateUnpack2 db 'deflate_unpack2',0 + +;--------------------------------------------------------------------- +align 4 +Sort_import: +sort_init dd aSort_init +sort_version dd aSort_version +sort_dir dd aSort_SortDir +sort_strcmpi dd aSort_strcmpi + dd 0 + dd 0 + +aSort_init db 'START',0 +aSort_version db 'version',0 +aSort_SortDir db 'SortDir',0 +aSort_strcmpi db 'strcmpi',0 + +;--------------------------------------------------------------------- +align 4 +Libini_import: +lib_init dd aLib_init +version_lib_ini dd aVersion_lib_ini +ini_enum_sections dd aIni_enum_sections +ini_enum_keys dd aIni_enum_keys +ini_get_str dd aIni_get_str +ini_get_int dd aIni_get_int +ini_get_color dd aIni_get_color +ini_set_str dd aIni_set_str +ini_set_int dd aIni_set_int +ini_set_color dd aIni_set_color + dd 0 + dd 0 + +aLib_init db 'lib_init',0 +aVersion_lib_ini db 'version',0 +aIni_enum_sections db 'ini_enum_sections',0 +aIni_enum_keys db 'ini_enum_keys',0 +aIni_get_str db 'ini_get_str',0 +aIni_get_int db 'ini_get_int',0 +aIni_get_color db 'ini_get_color',0 +aIni_set_str db 'ini_set_str',0 +aIni_set_int db 'ini_set_int',0 +aIni_set_color db 'ini_set_color',0 + +;--------------------------------------------------------------------- +align 4 +Box_lib_import: +;init_lib dd a_init +;version_lib dd a_version + +edit_box_draw dd aEdit_box_draw +edit_box_key dd aEdit_box_key +edit_box_mouse dd aEdit_box_mouse +;version_ed dd aVersion_ed + +init_checkbox dd aInit_checkbox +check_box_draw dd aCheck_box_draw +check_box_mouse dd aCheck_box_mouse +;version_ch dd aVersion_ch + +option_box_draw dd aOption_box_draw +option_box_mouse dd aOption_box_mouse +;version_op dd aVersion_op + +scrollbar_ver_draw dd aScrollbar_ver_draw +scrollbar_ver_mouse dd aScrollbar_ver_mouse +scrollbar_hor_draw dd aScrollbar_hor_draw +scrollbar_hor_mouse dd aScrollbar_hor_mouse +;version_scrollbar dd aVersion_scrollbar + +dinamic_button_draw dd aDbutton_draw +dinamic_button_mouse dd aDbutton_mouse +;version_dbutton dd aVersion_dbutton + +menu_bar_draw dd aMenu_bar_draw +menu_bar_mouse dd aMenu_bar_mouse +menu_bar_activate dd aMenu_bar_activate +;version_menu_bar dd aVersion_menu_bar + +;FileBrowser_draw dd aFileBrowser_draw +;FileBrowser_mouse dd aFileBrowser_mouse +;FileBrowser_key dd aFileBrowser_key +;Version_FileBrowser dd aVersion_FileBrowser + dd 0 + dd 0 + +;a_init db 'lib_init',0 +;a_version db 'version',0 + +aEdit_box_draw db 'edit_box_draw',0 +aEdit_box_key db 'edit_box_key',0 +aEdit_box_mouse db 'edit_box_mouse',0 +;aVersion_ed db 'version_ed',0 + +aInit_checkbox db 'init_checkbox2',0 +aCheck_box_draw db 'check_box_draw2',0 +aCheck_box_mouse db 'check_box_mouse2',0 +;aVersion_ch db 'version_ch2',0 + +aOption_box_draw db 'option_box_draw',0 +aOption_box_mouse db 'option_box_mouse',0 +;aVersion_op db 'version_op',0 + +aScrollbar_ver_draw db 'scrollbar_v_draw',0 +aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 +aScrollbar_hor_draw db 'scrollbar_h_draw',0 +aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 +;aVersion_scrollbar db 'version_scrollbar',0 + +aDbutton_draw db 'dbutton_draw',0 +aDbutton_mouse db 'dbutton_mouse',0 +;aVersion_dbutton db 'version_dbutton',0 + +aMenu_bar_draw db 'menu_bar_draw',0 +aMenu_bar_mouse db 'menu_bar_mouse',0 +aMenu_bar_activate db 'menu_bar_activate',0 +;aVersion_menu_bar db 'version_menu_bar',0 + +;aFileBrowser_draw db 'FileBrowser_draw',0 +;aFileBrowser_mouse db 'FileBrowser_mouse',0 +;aFileBrowser_key db 'FileBrowser_key',0 +;aVersion_FileBrowser db 'version_FileBrowser',0 +;--------------------------------------------------------------------- +align 4 +load_directory_pointer dd 0 +file_name_length dd 0 +load_file_number dd 0 +error_fs dd 0 +error_pointer dd 0 +;error_locate dd 0 +error_window_x: dd 100 shl 16 + 300 +error_window_y: dd 100 shl 16 + 100 + +PID dd 0 +PID1 dd 0 +PID2 dd 0 +PID3 dd 0 +PID4 dd 0 +PID5 dd 0 +PID6 dd 0 +PID7 dd 0 +active_process dd 0 +timer_counter dd 0 +draw_scrollbar_counter dd 0 +;--------------------------------------------------------------------- +align 4 +error_fs_text_pointers: + dd error_fs_text_0 + dd error_fs_text_1 + dd error_fs_text_2 + dd error_fs_text_3 + dd error_fs_text_4 + dd error_fs_text_5 + dd error_fs_text_6 + dd error_fs_text_7 + dd error_fs_text_8 + dd error_fs_text_9 + dd error_fs_text_10 + dd error_fs_text_11 + +error_fs_text_0: db 'Success full',0 +error_fs_text_1: db 'Base and/or partition of a hard disk is not defined',0 +error_fs_text_2: db 'Function is not supported for the given file system',0 +error_fs_text_3: db 'Unknown file system',0 +error_fs_text_4: db 'Reserved, is never returned in the current implementation',0 +error_fs_text_5: db 'File not found',0 +error_fs_text_6: db 'End of file, EOF',0 +error_fs_text_7: db 'Pointer lies outside of application memory',0 +error_fs_text_8: db 'Disk is full',0 +error_fs_text_9: db 'FAT table is destroyed',0 +error_fs_text_10: db 'Access denied',0 +error_fs_text_11: db 'Device error',0 +;--------------------------------------------------------------------- +error_type: + db 'File system error',0 +;--------------------------------------------------------------------- +error_not_supported_file: + db 'Unsupported file or corrupt data',0 +;--------------------------------------------------------------------- +error_not_enough_memory: + db 'Not_enough_memory',0 +;--------------------------------------------------------------------- +error_unknown: + db 'Unknown error',0 +;--------------------------------------------------------------------- +extended_key db 0 +no_draw_window db 0 + +shift_flag db 0 +ctrl_flag db 0 +alt_flag db 0 +;--------------------------------------------------------------------- +; for EDITBOX +align 4 +name_editboxes: +edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,mouse_dd,ed_focus+ed_always_focus,0 +name_editboxes_end: + +;mouse_flag: dd 0x0 + +mouse_dd rd 1 +;--------------------------------------------------------------------- +align 4 +; option_boxes_bcgr: +op1 option_box option_group1,60,45,6,12,0xFFFFFF,0,0xffffff,op_text.1,op_text.e1-op_text.1 +op2 option_box option_group1,60,60,6,12,0xFFFFFF,0,0xffffff,op_text.2,op_text.e2-op_text.2 +op3 option_box option_group1,60,75,6,12,0xFFFFFF,0,0xffffff,op_text.3,op_text.e3-op_text.3 +op4 option_box option_group1,60,90,6,12,0xFFFFFF,0,0xffffff,op_text.4,op_text.e4-op_text.4 +;option_boxes_bcgr_end: + +op_text: +.1 db 'Tiled' +.e1: +.2 db 'Stretch' +.e2: +.3 db 'Stretch + Crop' +.e3: +.4 db 'Stretch + Inscribe' +.e4: + +option_group1 dd op1 + +option_boxes_bcgr: dd op1,op2,op3,op4,0 + +;--------------------------------------------------------------------- +align 4 +op_UL option_box option_group3,200,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_UC option_box option_group3,223,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_UR option_box option_group3,246,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CL option_box option_group3,200,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CC option_box option_group3,223,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CR option_box option_group3,246,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DL option_box option_group3,200,86,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DC option_box option_group3,223,86,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DR option_box option_group3,246,86,20,20,0xFFFFFF,0,0xffffff,0,0 +;option_boxes_bcgr_end: + +option_group3 dd op_CC + +Stretch_Crop_Corner dd 1 shl 16+1 +option_boxes_SCC: dd op_UL,op_UC,op_UR,op_CL,op_CC,op_CR,op_DL,op_DC,op_DR,0 + +bcgr_group_pointer db 0 +;--------------------------------------------------------------------- +align 4 +;option_boxes_sort: +sort0 option_box option_group2,60,40,6,12,0xFFFFFF,0,0xffffff,op_text_1.1,op_text_1.e1-op_text_1.1 +sort2 option_box option_group2,60,55,6,12,0xFFFFFF,0,0xffffff,op_text_1.2,op_text_1.e2-op_text_1.2 +sort4 option_box option_group2,60,70,6,12,0xFFFFFF,0,0xffffff,op_text_1.3,op_text_1.e3-op_text_1.3 +sort6 option_box option_group2,60,85,6,12,0xFFFFFF,0,0xffffff,op_text_1.4,op_text_1.e4-op_text_1.4 +option_boxes_sort_end: + +op_text_1: +.1 db 'Name' +.e1: +.2 db 'Type' +.e2: +.3 db 'Date' +.e3: +.4 db 'Size' +.e4: + +option_group2 dd sort2 +option_group2_old dd 0 + +option_boxes_sort dd sort0, sort2, sort4, sort6,0 +;--------------------------------------------------------------------- +check1 check_box2 (140 shl 16)+12,(50 shl 16)+12,6,0xFFFFFF,0,0xffffff,check_text1,ch_flag_middle ;ch_flag_en + +check_text1 db 'Show file name',0 + +show_file_name_old dd 0 +;--------------------------------------------------------------------- +check2 check_box2 (140 shl 16)+12,(70 shl 16)+12,6,0xFFFFFF,0,0xffffff,check_text2,ch_flag_middle ;ch_flag_en + +check_text2 db 'Bilinear filtering',0 + +filtering_flag dd 0 +filtering_flag_old dd 0 +;--------------------------------------------------------------------- +align 4 +scroll_bar_data_vertical: +.x: +.size_x dw 15 ;+0 +.start_x dw 500 ;+2 +.y: +.size_y dw 300 ;+4 +.start_y dw 30 ;+6 +.btn_high dd 15 ;+8 +.type dd 2 ;+12 +.max_area dd 10 ;+16 +.cur_area dd 2 ;+20 +.position dd 0 ;+24 +.bckg_col dd 0xeeeeee ;+28 +.frnt_col dd 0x8aeaa0 ;0xbbddff ;+32 +.line_col dd 0 ;+36 +.redraw dd 0 ;+40 +.delta dw 0 ;+44 +.delta2 dw 0 ;+46 +.run_x: +.r_size_x dw 0 ;+48 +.r_start_x dw 0 ;+50 +.run_y: +.r_size_y dw 0 ;+52 +.r_start_y dw 0 ;+54 +.m_pos dd 0 ;+56 +.m_pos_2 dd 0 ;+60 +.m_keys dd 0 ;+64 +.run_size dd 0 ;+68 +.position2 dd 0 ;+72 +.work_size dd 0 ;+76 +.all_redraw dd 0 ;+80 +.ar_offset dd 10 ;+84 +;--------------------------------------------------------------------- +align 4 +scroll_bar_data_horizontal: +.x: +.size_x dw 300 ;0 ;+0 +.start_x dw 10 ;0 ;+2 +.y: +.size_y dw 15 ;0 ;+4 +.start_y dw 300 ;0 ;+6 +.btn_high dd 15 ;+8 +.type dd 2 ;+12 +.max_area dd 10 ;+16 +.cur_area dd 2 ;+20 +.position dd 0 ;+24 +.bckg_col dd 0xeeeeee ;+28 +.frnt_col dd 0x8aeaa0 ;0xbbddff ;+32 +.line_col dd 0 ;+36 +.redraw dd 0 ;+40 +.delta dw 0 ;+44 +.delta2 dw 0 ;+46 +.run_x: +.r_size_x dw 0 ;+48 +.r_start_x dw 0 ;+50 +.run_y: +.r_size_y dw 0 ;+52 +.r_start_y dw 0 ;+54 +.m_pos dd 0 ;+56 +.m_pos_2 dd 0 ;+60 +.m_keys dd 0 ;+64 +.run_size dd 0 ;+68 +.position2 dd 0 ;+72 +.work_size dd 0 ;+76 +.all_redraw dd 0 ;+80 +.ar_offset dd 10 ;+84 +;--------------------------------------------------------------------- +align 4 +menu_data_1: +.type: dd 0 ;+0 +.x: +.size_x dw 35 ;+4 +.start_x dw 5 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_1 ;0 ;+12 +.pos_pointer: dd menu_text_area_1.1 ;0 ;+16 +.text_end dd menu_text_area_1.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 70 ;+32 +.start_x1 dw 5 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_1: +db 'File',0 +.1: +db 'Open',0 +db 'Properties',0 +db 'Exit',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +menu_data_2: +.type: dd 0 ;+0 +.x: +.size_x dw 35 ;+4 +.start_x dw 40 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_2 ;0 ;+12 +.pos_pointer: dd menu_text_area_2.1 ;0 ;+16 +.text_end dd menu_text_area_2.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 90 ;+32 +.start_x1 dw 40 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_2: +db 'Edit',0 +.1: +db 'Rotate Clock.',0 +db 'Rotate CClock.',0 +db 'Invert L to R',0 +db 'Invert U to D',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +menu_data_3: +.type: dd 0 ;+0 +.x: +.size_x dw 35 ;+4 +.start_x dw 75 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_3 ;0 ;+12 +.pos_pointer: dd menu_text_area_3.1 ;0 ;+16 +.text_end dd menu_text_area_3.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 90 ;+32 +.start_x1 dw 75 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_3: +db 'View',0 +.1: +db 'Sort Directory',0 +db 'Full Screen',0 +db 'Reload',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +menu_data_4: +.type: dd 0 ;+0 +.x: +.size_x dw 35 ;+4 +.start_x dw 110 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_4 ;0 ;+12 +.pos_pointer: dd menu_text_area_4.1 ;0 ;+16 +.text_end dd menu_text_area_4.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 40 ;+32 +.start_x1 dw 110 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_4: +db 'Zoom',0 +.1: +db 'Normal',0 +db 'More',0 +db 'Less',0 +db 'Auto',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +menu_data_5: +.type: dd 0 ;+0 +.x: +.size_x dw 40 ;+4 +.start_x dw 145 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_5 ;0 ;+12 +.pos_pointer: dd menu_text_area_5.1 ;0 ;+16 +.text_end dd menu_text_area_5.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 80 ;+32 +.start_x1 dw 145 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_5: +db 'Tools',0 +.1: +db 'Image Editor',0 +db 'Wallpaper',0 +db 'Slide Show',0 +db 'Options',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +menu_data_6: +.type: dd 0 ;+0 +.x: +.size_x dw 35 ;+4 +.start_x dw 185 ;+6 +.y: +.size_y dw 15 ;+8 +.start_y dw 6 ;+10 +.text_pointer: dd menu_text_area_6 ;0 ;+12 +.pos_pointer: dd menu_text_area_6.1 ;0 ;+16 +.text_end dd menu_text_area_6.end ;0 ;+20 +.ret_key dd 0 ;+24 +.mouse_keys dd 0 ;+28 +.x1: +.size_x1 dw 50 ;+32 +.start_x1 dw 185 ;+34 +.y1: +.size_y1 dw 100 ;+36 +.start_y1 dw 21 ;+38 +.bckg_col dd 0xe5e5e5 ;+40 +.frnt_col dd 0xff ;+44 +.menu_col dd 0xeef0ff ;0xffffff ;+48 +.select dd 0 ;+52 +.out_select dd 0 ;+56 +.buf_adress dd 0 ;+60 +.procinfo dd 0 ;+64 +.click dd 0 ;+68 +.cursor dd 0 ;+72 +.cursor_old dd 0 ;+76 +.interval dd 16 ;+80 +.cursor_max dd 0 ;+84 +.extended_key dd 0 ;+88 +.menu_sel_col dd 0x00cc00 ;+92 +.bckg_text_col dd 0 ; +96 +.frnt_text_col dd 0xffffff ;+100 +.mouse_keys_old dd 0 ;+104 +.font_height dd 8 ;+108 +.cursor_out dd 0 ;+112 +.get_mouse_flag dd 0 ;+116 +;--------------------------------------------------------------------- +menu_text_area_6: +db 'Help',0 +.1: +db 'Help',0 +db 'About',0 +.end: +db 0 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_1: ; open file +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 230 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_2: ; reload file +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 255 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_3: ; left limit +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 285 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_4: ; left arrow +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 310 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_5: ; slide show +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 335 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_6: ; right arrow +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 360 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_7: ; right limit +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 385 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_8: ; zoom + +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 415 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_9: ; zoom - +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 440 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_10: ; zoom 100% +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 465 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_11: ; rotate clockwise +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 495 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_12: ; rotate counter-clockwise +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 520 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_13: ; file information +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 550 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_14: ; wallpaper +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 575 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dinamic_button_data_15: ; settings +.type dd 0 ;+0 +.x: +.size_x dw 20 ;+4 +.start_x dw 600 ;+6 +.y: +.size_y dw 20 ;+8 +.start_y dw 3 ;+10 +.mouse_pos dd 0 ;+12 +.mouse_keys dd 0 ;+16 +.mouse_keys_old dd 0 ;+20 +.active_raw dd 0 ;+24 +.passive_raw dd 0 ;+28 +.click_raw dd 0 ;+32 +.resolution_raw dd 0 ;+36 +.palette_raw dd 0 ;+40 +.offset_raw dd 0 ;+44 +.select dd 0 ;+48 +.click dd 0 ;+52 +;--------------------------------------------------------------------- +align 4 +dirinfo: +.subfunction dd 1 +.start dd 0 +.flags dd 0 +.size dd 0 +.return dd procinfo + db 0 +.name: dd plugin_pach +;--------------------------------------------------------------------- +align 4 +fileinfo: +.subfunction dd 5 +.Offset dd 0 +.Offset_1 dd 0 +.size dd 0 +.return dd process_info + db 0 +.name: dd string +;--------------------------------------------------------------------- +align 4 +start_appl: +.subfunction dd 7 +.flags dd 0 +.parameter dd library_path +.reserved1 dd 0 +.reserved2 dd 0 + db 0 +.name: dd Help_path +;--------------------------------------------------------------------- +align 4 +dir_header: +.version dd 0 ;+0 +.curn_blocks dd 0 ;+4 +.totl_blocks dd 0 ;+8 +.other rb 20 +;--------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd plugin_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd library_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd string ;+36 +.filename_area dd 0 ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_pach: + db '/sys',0 +;communication_area dd 0 +;--------------------------------------------------------------------- +ColorDialog_data: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd cd_communication_area_name ;+8 +.com_area dd 0 ;+12 +.start_path dd colordialog_path ;+16 +.draw_window dd thread4.draw_window ;+20 +.status dd 0 ;+24 +.x: +.x_size dw 510 ;+28 ; Window X size +.x_start dw 10 ;+30 ; Window X position +.y: +.y_size dw 310 ;+32 ; Window y size +.y_start dw 10 ;+34 ; Window Y position +.color_type dd 0 ;+36 ; 0- RGB, 1 or other - reserved +.color dd 0 ;+40 ; Selected color + +cd_communication_area_name: + db 'FFFFFFFF_color_dialog',0 +colordialog_path: + db '/sys/colrdial',0 +;--------------------------------------------------------------------- +; clear bacground thread +clear_thread_stack: + dd 0 +;---------------------- +; window option +thread_stack_7: + dd 0 +;---------------------- +; window error message +thread_stack_6: + dd 0 +;---------------------- +; window set sort mode +thread_stack_5: + dd 0 +;---------------------- +; window background +thread_stack_4: + dd 0 +;---------------------- +; window about +thread_stack_3: + dd 0 +;---------------------- +; file info +thread_stack_2: + dd 0 +;---------------------- +; file open +thread_stack: + dd 0 +;--------------------------------------------------------------------- +;size_before_open_dir: +; dd 0 +;size_before_open_file: +; dd 0 +;size_after_open_file: +; dd 0 +;size_after_convert: +; dd 0 +;size_after_convert_2: +; dd 0 +;size_before_draw_image: +; dd 0 +;size_after_draw_image: +; dd 0 +;size_before_scaling: +; dd 0 +;size_after_scaling: +; dd 0 diff --git a/programs/other/cnc_editor/wnd_new_file.inc b/programs/other/cnc_editor/wnd_new_file.inc index 7e2ffa776..dc870b498 100644 --- a/programs/other/cnc_editor/wnd_new_file.inc +++ b/programs/other/cnc_editor/wnd_new_file.inc @@ -1,589 +1,589 @@ -; -; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ -; ࠡ ᮧ 䠩 -; - -wnd_n_file_width equ 300 ;ਭ ᮧ 䠩 -wnd_n_file_height equ 200 ; ᮧ 䠩 - -align 4 -wnd_n_file db 0 ;६ ᫥ ⥬ - ᪠ 1- ᮧ 䠩 - -align 4 -NOptCoordX0 dq 35.0 -NOptCoordY0 dq 25.0 -NOptCoordX1 dq 20.0 ;for circle Radius -NOptCoordY1 dq 16.0 ;S -NOptCoordZ0 dq 1.0 -NOptCoordZ1 dq 5.0 - -; () 뢠 㭪樥 but_wnd_coords -align 4 -start_n_file: -pushad - mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ - inc byte[wnd_n_file] - - edit_boxes_set_sys_color edit4,editboxes_end_nf,sc ;⠭ ⥬ 梥⮢ - option_boxes_set_sys_color sc,opt_grlist1 - - call get_n_file_opt -popad - call red_win_n_file - -; 뢠 㭪 ।饩 -align 4 -still_n_file: - pushad - - mcall SF_WAIT_EVENT_TIMEOUT,10 - or eax,eax - jnz @f - call timer_funct_n_file - jmp .end - @@: - - cmp al,1 ;. - jne @f - call red_win_n_file - jmp .end - @@: - cmp al,2 - jne @f - call key_n_file - jmp .end - @@: - cmp al,3 - jz button_n_file - cmp al,6 - jne @f - call mouse_n_file - @@: -.end: - popad - jmp still_n_file - -align 4 -red_win_n_file: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT - mov edi,capt_n_file ;children window caption - mov bx,word[procinfo.box.left] - add bx,word[buf_0.l] - add bx,5 ;ਭ ࠬ - shl ebx,16 - mov bx,wnd_n_file_width - mov cx,word[procinfo.box.top] - add cx,ax ;add skin height - add cx,word[buf_0.t] - shl ecx,16 - mov cx,wnd_n_file_height - mov edx,[sc.work] - or edx,0x33000000 - xor eax,eax - int 0x40 - - mov esi,[sc.work_button] - ;ebx = (l<:)+w, ecx = (t<:)+h - mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (145 shl 16)+20, 3 - mcall , (75 shl 16)+59, (145 shl 16)+20, 4 - - mov ecx,[sc.work_text] - bts ecx,31 ;㥬 ப 稢 - mcall SF_DRAW_TEXT, (5 shl 16)+5,, capt_sel_fig - - mcall , (5 shl 16)+32,, capt_coord_x0 - mcall , (5 shl 16)+50,, capt_coord_y0 - cmp [opt_gr1],opt1 - jne @f - ;circle - mcall , (5 shl 16)+68,, capt_coord_r - mcall , (5 shl 16)+86,, capt_coord_s - jmp .end0 - @@: - ;rect - mcall , (5 shl 16)+68,, capt_coord_x1 - mcall , (5 shl 16)+86,, capt_coord_y1 - .end0: - mcall , (5 shl 16)+104,,capt_coord_z0 - mcall , (5 shl 16)+122,,capt_coord_z1 - - mov ecx,[sc.work_button_text] - bts ecx,31 - mcall , (9 shl 16)+151,, txt_but_cancel - mcall ,(79 shl 16)+151,, txt_but_create - - stdcall [option_box_draw], opt_grlist1 - - stdcall [edit_box_draw], edit4 - stdcall [edit_box_draw], edit5 - stdcall [edit_box_draw], edit6 - stdcall [edit_box_draw], edit7 - stdcall [edit_box_draw], edit8 - stdcall [edit_box_draw], edit9 - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -proc key_n_file uses eax ebx - mcall SF_GET_KEY - - test word [edit4.flags],10b ;ed_focus - je @f - stdcall [edit_box_key], edit4 - jmp .end - @@: - test word [edit5.flags],10b - je @f - stdcall [edit_box_key], edit5 - jmp .end - @@: - test word [edit6.flags],10b - je @f - stdcall [edit_box_key], edit6 - jmp .end - @@: - test word [edit7.flags],10b - je @f - stdcall [edit_box_key], edit7 - jmp .end - @@: - test word [edit8.flags],10b - je @f - stdcall [edit_box_key], edit8 - jmp .end - @@: - test word [edit9.flags],10b - je @f - stdcall [edit_box_key], edit9 - ;jmp .end - @@: - .end: - ret -endp - -align 4 -mouse_n_file: - stdcall [option_box_mouse], opt_grlist1 - - stdcall [edit_box_mouse], edit4 - stdcall [edit_box_mouse], edit5 - stdcall [edit_box_mouse], edit6 - stdcall [edit_box_mouse], edit7 - stdcall [edit_box_mouse], edit8 - stdcall [edit_box_mouse], edit9 - ret - -align 4 -button_n_file: - mcall SF_GET_BUTTON - - cmp ah,3 - je .exit - cmp ah,4 - jne .end_save - push eax ecx edi esi - finit - - mov esi,string4 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp qword[NOptCoordX0] ;࠭塞 double - - mov esi,string5 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] - fstp qword[NOptCoordY0] - - mov esi,string6 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] - fstp qword[NOptCoordX1] - - mov esi,string7 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] - fstp qword[NOptCoordY1] - - mov esi,string8 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] - fstp qword[NOptCoordZ0] - - mov esi,string9 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] - fstp qword[NOptCoordZ1] - - mov word[NumberSymbolsAD],3 - ;fld qword[NOptCoordZ1] - ;fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - mov dword[txt_01.z],0 - mov dword[txt_05.z],0 - mov dword[txt_06.z],0 - stdcall str_cat, txt_01.z, Data_String - stdcall str_cat, txt_01.z, txt_nl - stdcall str_cat, txt_01.z, txt_nl - stdcall str_cat, txt_05.z, Data_String - stdcall str_cat, txt_05.z, txt_nl - stdcall str_cat, txt_05.z, txt_nl - stdcall str_cat, txt_06.z, Data_String - - fld qword[NOptCoordZ0] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - mov dword[txt_03.z],0 - stdcall str_cat, txt_03.z, Data_String - - fld qword[NOptCoordX0] - cmp [opt_gr1],opt1 - jne @f - ;circle - fadd qword[NOptCoordX1] - @@: - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - mov dword[txt_04.x],0 - stdcall str_cat, txt_04.x, Data_String - stdcall str_cat, txt_04.x, txt_s_poi_Y - fld qword[NOptCoordY0] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall str_cat, txt_04.x, Data_String - mov dword[txt_02.x],0 - stdcall str_cat, txt_02.x, txt_04.x - stdcall str_cat, txt_02.x, txt_s_poi_Z - fld qword[NOptCoordZ1] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall str_cat, txt_02.x, Data_String - - ;clear old file - stdcall [tl_node_poi_get_info], tree1,0 - or eax,eax - jz @f - mov ebx,eax - stdcall [tl_node_poi_get_data], tree1,ebx - stdcall clear_object_in_list, eax - @@: - stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ - and dword[tree1.style],not tl_cursor_pos_limited - mov dword[offs_last_timer],0 - - stdcall ObjectCreate,ObjData - or dword[tree1.style], tl_cursor_pos_limited - stdcall [tl_cur_beg], tree1 - - mov dword[offs_last_timer],0 ; ⠩ - pop esi edi ecx eax - jmp .exit - .end_save: - - cmp ah,1 - jne still_n_file.end -.exit: - mov byte[wnd_n_file],0 ;塞 稪 - mcall SF_TERMINATE_PROCESS ;室 ணࠬ - -align 4 -proc ObjectCreate, pobj:dword -pushad - mov ebx,[pobj] - mov [ebx+Object.OType],'Obj' - mov edi,ebx - add edi,Object.Caption - mov dword[edi],'CNC' - - mov eax,7 ;max lines - mov [ebx+Object.FigCount],eax - mov ecx,eax - - shl eax,2 - stdcall mem.Alloc,eax - mov [ebx+Object.FigData],eax - push ecx - mov edi,eax - xor eax,eax - rep stosd ;clear memory - pop ecx - - stdcall add_object_in_list,0,0,ebx,0 - ;eax -> pointer to object node - mov edi,[ebx+Object.FigData] - - mov esi,txt_00 - stdcall FigureInit,FigData,edi - add edi,4 - mov esi,txt_01 - stdcall FigureInit,FigData,edi - add edi,4 - mov esi,txt_02 - stdcall FigureInit,FigData,edi - add edi,4 - mov esi,txt_03 - stdcall FigureInit,FigData,edi - add edi,4 - mov esi,txt_04 ;X__ Y__ - stdcall FigureInit,FigData,edi - ; *** create new points *** - mov edx,[edi] - cmp [opt_gr1],opt1 - jne .rect - ;circle - fld qword[NOptCoordY1] - fistp dword[edx+Figure.PoiCount] - inc dword[edx+Figure.PoiCount] - mov eax,[edx+Figure.PoiCount] - imul eax,sizeof.Point - stdcall mem.ReAlloc,[edx+Figure.PoiData],eax - mov [edx+Figure.PoiData],eax - - ;init points - fldpi - fadd st0,st0 - fdiv qword[NOptCoordY1] - fldz - ;st0 - angle (=0) - ;st1 - delta angle (=pi/slices) - - mov ecx,[edx+Figure.PoiCount] - cmp ecx,3 - jge @f - mov ecx,3 - @@: - mov edx,[edx+Figure.PoiData] - add edx,Point.CoordX - .cycle0: - add edx,sizeof.Point - fadd st0,st1 ;angle += delta angle - - fld st0 - fcos - fmul qword[NOptCoordX1] ;st0 = cos(angle) * radius - fadd qword[NOptCoordX0] - fstp qword[edx] - fld st0 - fsin - fmul qword[NOptCoordX1] ;st0 = sin(angle) * radius - fadd qword[NOptCoordY0] - fstp qword[edx+8] - loop .cycle0 - ffree st0 - fincstp - ffree st0 - fincstp - jmp .end0 - .rect: - ;rect - mov eax,5 - mov dword[edx+Figure.PoiCount],eax - imul eax,sizeof.Point - stdcall mem.ReAlloc,[edx+Figure.PoiData],eax - mov [edx+Figure.PoiData],eax - ;init points - push edi - mov ecx,[edx+Figure.PoiData] - ;p1 - add ecx,sizeof.Point - lea edi,[ecx+Point.CoordX] - mov esi,NOptCoordX1 - movsd - movsd - mov esi,NOptCoordY0 - movsd - movsd - ;p2 - add ecx,sizeof.Point - lea edi,[ecx+Point.CoordX] - mov esi,NOptCoordX1 - movsd - movsd - mov esi,NOptCoordY1 - movsd - movsd - ;p3 - add ecx,sizeof.Point - lea edi,[ecx+Point.CoordX] - mov esi,NOptCoordX0 - movsd - movsd - mov esi,NOptCoordY1 - movsd - movsd - ;p4 - add ecx,sizeof.Point - lea edi,[ecx+Point.CoordX] - mov esi,NOptCoordX0 - movsd - movsd - mov esi,NOptCoordY0 - movsd - movsd - pop edi - .end0: - stdcall found_parent_obj,[edi] ;get figure number in ecx - stdcall figure_update_coords,ObjData,ecx - - add edi,4 - mov esi,txt_05 - stdcall FigureInit,FigData,edi - add edi,4 - mov esi,txt_06 - stdcall FigureInit,FigData,edi - - stdcall ObjCalculateScale,ebx -popad - ret -endp - -align 4 -proc get_n_file_opt uses eax - ;㧪 न editbox- - mov word[NumberSymbolsAD],3 - finit - fld qword[NOptCoordX0] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit4, Data_String - fld qword[NOptCoordY0] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit5, Data_String - fld qword[NOptCoordX1] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit6, Data_String - fld qword[NOptCoordY1] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit7, Data_String - fld qword[NOptCoordZ0] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit8, Data_String - fld qword[NOptCoordZ1] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit9, Data_String - ; - ;stdcall [edit_box_draw], edit4 - ;stdcall [edit_box_draw], edit5 - ret -endp - -align 4 -proc timer_funct_n_file uses eax - ;ᬠਢ 뤥 न - mov eax,[opt_gr1] - cmp eax,[last_opt] - je @f - mov eax,[opt_gr1] - mov [last_opt],eax - call red_win_n_file - @@: - ret -endp - -capt_coord_x0 db 'X0:',0 -capt_coord_y0 db 'Y0:',0 -capt_coord_z0 db 'Z0:',0 -capt_coord_x1 db 'X1:',0 -capt_coord_y1 db 'Y1:',0 -capt_coord_z1 db 'Z1:',0 -capt_coord_r db 'R:',0 -capt_coord_s db 'S:',0 - -edit4 edit_box 80, 24, 28, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string4, mouse_dd, 0 -edit5 edit_box 80, 24, 46, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string5, mouse_dd, 0 -edit6 edit_box 80, 24, 64, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string6, mouse_dd, 0 -edit7 edit_box 80, 24, 82, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string7, mouse_dd, 0 -edit8 edit_box 80, 24, 100, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string8, mouse_dd, 0 -edit9 edit_box 80, 24, 118, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string9, mouse_dd, 0 -editboxes_end_nf: - -string4 rb 34 -string5 rb 34 -string6 rb 34 -string7 rb 34 -string8 rb 34 -string9 rb 34 - -align 4 -last_opt dd opt1 ;for timer -opt_gr1 dd opt1 - -opt1 option_box opt_gr1, 115,28,6,12,0xd0d0ff, 0xff, 0x80ff,txt_circle,txt_circle.end-txt_circle -opt2 option_box opt_gr1, 115,46,6,12,0xd0d0ff, 0xff, 0x80ff,txt_rect,txt_rect.end-txt_rect - -align 4 -opt_grlist1 dd opt1,opt2,0 ;end option group - -txt_00 db ';PCB graving',0 -txt_01: db 'G0 M3 X0 Y0 Z' -.z: rb 12 -txt_02: db 'G0 X' -.x: rb 50 ;X__ Y__ Z__ -txt_03: db 'G1 F100 Z' -.z: rb 12 -txt_04: db 'X' -.x: rb 30 ;X__ Y__ -txt_05: db 'G0 Z' -.z: rb 12 -txt_06: db 'G0 M5 X0 Y0 Z' -.z: rb 12 - -if lang eq ru_RU -capt_n_file db ' 䠩',0 -capt_sel_fig db '롥 䨣:',0 -txt_circle: db '㦭' -.end: db 0 -txt_rect: db 'אַ㣮쭨' -.end: db 0 -else -capt_n_file db 'Create new file',0 -capt_sel_fig db 'Select figure:',0 -txt_circle: db 'Circle' -.end: db 0 -txt_rect: db 'Rectangle' -.end: db 0 -end if +; +; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ +; ࠡ ᮧ 䠩 +; + +wnd_n_file_width equ 300 ;ਭ ᮧ 䠩 +wnd_n_file_height equ 200 ; ᮧ 䠩 + +align 4 +wnd_n_file db 0 ;६ ᫥ ⥬ - ᪠ 1- ᮧ 䠩 + +align 4 +NOptCoordX0 dq 35.0 +NOptCoordY0 dq 25.0 +NOptCoordX1 dq 20.0 ;for circle Radius +NOptCoordY1 dq 16.0 ;S +NOptCoordZ0 dq 1.0 +NOptCoordZ1 dq 5.0 + +; () 뢠 㭪樥 but_wnd_coords +align 4 +start_n_file: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ + inc byte[wnd_n_file] + + edit_boxes_set_sys_color edit4,editboxes_end_nf,sc ;⠭ ⥬ 梥⮢ + option_boxes_set_sys_color sc,opt_grlist1 + + call get_n_file_opt +popad + call red_win_n_file + +; 뢠 㭪 ।饩 +align 4 +still_n_file: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call timer_funct_n_file + jmp .end + @@: + + cmp al,1 ;. + jne @f + call red_win_n_file + jmp .end + @@: + cmp al,2 + jne @f + call key_n_file + jmp .end + @@: + cmp al,3 + jz button_n_file + cmp al,6 + jne @f + call mouse_n_file + @@: +.end: + popad + jmp still_n_file + +align 4 +red_win_n_file: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT + mov edi,capt_n_file ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ਭ ࠬ + shl ebx,16 + mov bx,wnd_n_file_width + mov cx,word[procinfo.box.top] + add cx,ax ;add skin height + add cx,word[buf_0.t] + shl ecx,16 + mov cx,wnd_n_file_height + mov edx,[sc.work] + or edx,0x33000000 + xor eax,eax + int 0x40 + + mov esi,[sc.work_button] + ;ebx = (l<:)+w, ecx = (t<:)+h + mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (145 shl 16)+20, 3 + mcall , (75 shl 16)+59, (145 shl 16)+20, 4 + + mov ecx,[sc.work_text] + bts ecx,31 ;㥬 ப 稢 + mcall SF_DRAW_TEXT, (5 shl 16)+5,, capt_sel_fig + + mcall , (5 shl 16)+32,, capt_coord_x0 + mcall , (5 shl 16)+50,, capt_coord_y0 + cmp [opt_gr1],opt1 + jne @f + ;circle + mcall , (5 shl 16)+68,, capt_coord_r + mcall , (5 shl 16)+86,, capt_coord_s + jmp .end0 + @@: + ;rect + mcall , (5 shl 16)+68,, capt_coord_x1 + mcall , (5 shl 16)+86,, capt_coord_y1 + .end0: + mcall , (5 shl 16)+104,,capt_coord_z0 + mcall , (5 shl 16)+122,,capt_coord_z1 + + mov ecx,[sc.work_button_text] + bts ecx,31 + mcall , (9 shl 16)+151,, txt_but_cancel + mcall ,(79 shl 16)+151,, txt_but_create + + stdcall [option_box_draw], opt_grlist1 + + stdcall [edit_box_draw], edit4 + stdcall [edit_box_draw], edit5 + stdcall [edit_box_draw], edit6 + stdcall [edit_box_draw], edit7 + stdcall [edit_box_draw], edit8 + stdcall [edit_box_draw], edit9 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc key_n_file uses eax ebx + mcall SF_GET_KEY + + test word [edit4.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit4 + jmp .end + @@: + test word [edit5.flags],10b + je @f + stdcall [edit_box_key], edit5 + jmp .end + @@: + test word [edit6.flags],10b + je @f + stdcall [edit_box_key], edit6 + jmp .end + @@: + test word [edit7.flags],10b + je @f + stdcall [edit_box_key], edit7 + jmp .end + @@: + test word [edit8.flags],10b + je @f + stdcall [edit_box_key], edit8 + jmp .end + @@: + test word [edit9.flags],10b + je @f + stdcall [edit_box_key], edit9 + ;jmp .end + @@: + .end: + ret +endp + +align 4 +mouse_n_file: + stdcall [option_box_mouse], opt_grlist1 + + stdcall [edit_box_mouse], edit4 + stdcall [edit_box_mouse], edit5 + stdcall [edit_box_mouse], edit6 + stdcall [edit_box_mouse], edit7 + stdcall [edit_box_mouse], edit8 + stdcall [edit_box_mouse], edit9 + ret + +align 4 +button_n_file: + mcall SF_GET_BUTTON + + cmp ah,3 + je .exit + cmp ah,4 + jne .end_save + push eax ecx edi esi + finit + + mov esi,string4 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp qword[NOptCoordX0] ;࠭塞 double + + mov esi,string5 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordY0] + + mov esi,string6 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordX1] + + mov esi,string7 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordY1] + + mov esi,string8 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordZ0] + + mov esi,string9 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] + fstp qword[NOptCoordZ1] + + mov word[NumberSymbolsAD],3 + ;fld qword[NOptCoordZ1] + ;fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_01.z],0 + mov dword[txt_05.z],0 + mov dword[txt_06.z],0 + stdcall str_cat, txt_01.z, Data_String + stdcall str_cat, txt_01.z, txt_nl + stdcall str_cat, txt_01.z, txt_nl + stdcall str_cat, txt_05.z, Data_String + stdcall str_cat, txt_05.z, txt_nl + stdcall str_cat, txt_05.z, txt_nl + stdcall str_cat, txt_06.z, Data_String + + fld qword[NOptCoordZ0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_03.z],0 + stdcall str_cat, txt_03.z, Data_String + + fld qword[NOptCoordX0] + cmp [opt_gr1],opt1 + jne @f + ;circle + fadd qword[NOptCoordX1] + @@: + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + mov dword[txt_04.x],0 + stdcall str_cat, txt_04.x, Data_String + stdcall str_cat, txt_04.x, txt_s_poi_Y + fld qword[NOptCoordY0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat, txt_04.x, Data_String + mov dword[txt_02.x],0 + stdcall str_cat, txt_02.x, txt_04.x + stdcall str_cat, txt_02.x, txt_s_poi_Z + fld qword[NOptCoordZ1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall str_cat, txt_02.x, Data_String + + ;clear old file + stdcall [tl_node_poi_get_info], tree1,0 + or eax,eax + jz @f + mov ebx,eax + stdcall [tl_node_poi_get_data], tree1,ebx + stdcall clear_object_in_list, eax + @@: + stdcall [tl_info_clear], tree1 ;⪠ ᯨ᪠ ꥪ⮢ + and dword[tree1.style],not tl_cursor_pos_limited + mov dword[offs_last_timer],0 + + stdcall ObjectCreate,ObjData + or dword[tree1.style], tl_cursor_pos_limited + stdcall [tl_cur_beg], tree1 + + mov dword[offs_last_timer],0 ; ⠩ + pop esi edi ecx eax + jmp .exit + .end_save: + + cmp ah,1 + jne still_n_file.end +.exit: + mov byte[wnd_n_file],0 ;塞 稪 + mcall SF_TERMINATE_PROCESS ;室 ணࠬ + +align 4 +proc ObjectCreate, pobj:dword +pushad + mov ebx,[pobj] + mov [ebx+Object.OType],'Obj' + mov edi,ebx + add edi,Object.Caption + mov dword[edi],'CNC' + + mov eax,7 ;max lines + mov [ebx+Object.FigCount],eax + mov ecx,eax + + shl eax,2 + stdcall mem.Alloc,eax + mov [ebx+Object.FigData],eax + push ecx + mov edi,eax + xor eax,eax + rep stosd ;clear memory + pop ecx + + stdcall add_object_in_list,0,0,ebx,0 + ;eax -> pointer to object node + mov edi,[ebx+Object.FigData] + + mov esi,txt_00 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_01 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_02 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_03 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_04 ;X__ Y__ + stdcall FigureInit,FigData,edi + ; *** create new points *** + mov edx,[edi] + cmp [opt_gr1],opt1 + jne .rect + ;circle + fld qword[NOptCoordY1] + fistp dword[edx+Figure.PoiCount] + inc dword[edx+Figure.PoiCount] + mov eax,[edx+Figure.PoiCount] + imul eax,sizeof.Point + stdcall mem.ReAlloc,[edx+Figure.PoiData],eax + mov [edx+Figure.PoiData],eax + + ;init points + fldpi + fadd st0,st0 + fdiv qword[NOptCoordY1] + fldz + ;st0 - angle (=0) + ;st1 - delta angle (=pi/slices) + + mov ecx,[edx+Figure.PoiCount] + cmp ecx,3 + jge @f + mov ecx,3 + @@: + mov edx,[edx+Figure.PoiData] + add edx,Point.CoordX + .cycle0: + add edx,sizeof.Point + fadd st0,st1 ;angle += delta angle + + fld st0 + fcos + fmul qword[NOptCoordX1] ;st0 = cos(angle) * radius + fadd qword[NOptCoordX0] + fstp qword[edx] + fld st0 + fsin + fmul qword[NOptCoordX1] ;st0 = sin(angle) * radius + fadd qword[NOptCoordY0] + fstp qword[edx+8] + loop .cycle0 + ffree st0 + fincstp + ffree st0 + fincstp + jmp .end0 + .rect: + ;rect + mov eax,5 + mov dword[edx+Figure.PoiCount],eax + imul eax,sizeof.Point + stdcall mem.ReAlloc,[edx+Figure.PoiData],eax + mov [edx+Figure.PoiData],eax + ;init points + push edi + mov ecx,[edx+Figure.PoiData] + ;p1 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX1 + movsd + movsd + mov esi,NOptCoordY0 + movsd + movsd + ;p2 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX1 + movsd + movsd + mov esi,NOptCoordY1 + movsd + movsd + ;p3 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX0 + movsd + movsd + mov esi,NOptCoordY1 + movsd + movsd + ;p4 + add ecx,sizeof.Point + lea edi,[ecx+Point.CoordX] + mov esi,NOptCoordX0 + movsd + movsd + mov esi,NOptCoordY0 + movsd + movsd + pop edi + .end0: + stdcall found_parent_obj,[edi] ;get figure number in ecx + stdcall figure_update_coords,ObjData,ecx + + add edi,4 + mov esi,txt_05 + stdcall FigureInit,FigData,edi + add edi,4 + mov esi,txt_06 + stdcall FigureInit,FigData,edi + + stdcall ObjCalculateScale,ebx +popad + ret +endp + +align 4 +proc get_n_file_opt uses eax + ;㧪 न editbox- + mov word[NumberSymbolsAD],3 + finit + fld qword[NOptCoordX0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit4, Data_String + fld qword[NOptCoordY0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit5, Data_String + fld qword[NOptCoordX1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit6, Data_String + fld qword[NOptCoordY1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit7, Data_String + fld qword[NOptCoordZ0] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit8, Data_String + fld qword[NOptCoordZ1] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit9, Data_String + ; + ;stdcall [edit_box_draw], edit4 + ;stdcall [edit_box_draw], edit5 + ret +endp + +align 4 +proc timer_funct_n_file uses eax + ;ᬠਢ 뤥 न + mov eax,[opt_gr1] + cmp eax,[last_opt] + je @f + mov eax,[opt_gr1] + mov [last_opt],eax + call red_win_n_file + @@: + ret +endp + +capt_coord_x0 db 'X0:',0 +capt_coord_y0 db 'Y0:',0 +capt_coord_z0 db 'Z0:',0 +capt_coord_x1 db 'X1:',0 +capt_coord_y1 db 'Y1:',0 +capt_coord_z1 db 'Z1:',0 +capt_coord_r db 'R:',0 +capt_coord_s db 'S:',0 + +edit4 edit_box 80, 24, 28, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string4, mouse_dd, 0 +edit5 edit_box 80, 24, 46, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string5, mouse_dd, 0 +edit6 edit_box 80, 24, 64, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string6, mouse_dd, 0 +edit7 edit_box 80, 24, 82, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string7, mouse_dd, 0 +edit8 edit_box 80, 24, 100, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string8, mouse_dd, 0 +edit9 edit_box 80, 24, 118, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string9, mouse_dd, 0 +editboxes_end_nf: + +string4 rb 34 +string5 rb 34 +string6 rb 34 +string7 rb 34 +string8 rb 34 +string9 rb 34 + +align 4 +last_opt dd opt1 ;for timer +opt_gr1 dd opt1 + +opt1 option_box opt_gr1, 115,28,6,12,0xd0d0ff, 0xff, 0x80ff,txt_circle,txt_circle.end-txt_circle +opt2 option_box opt_gr1, 115,46,6,12,0xd0d0ff, 0xff, 0x80ff,txt_rect,txt_rect.end-txt_rect + +align 4 +opt_grlist1 dd opt1,opt2,0 ;end option group + +txt_00 db ';PCB graving',0 +txt_01: db 'G0 M3 X0 Y0 Z' +.z: rb 12 +txt_02: db 'G0 X' +.x: rb 50 ;X__ Y__ Z__ +txt_03: db 'G1 F100 Z' +.z: rb 12 +txt_04: db 'X' +.x: rb 30 ;X__ Y__ +txt_05: db 'G0 Z' +.z: rb 12 +txt_06: db 'G0 M5 X0 Y0 Z' +.z: rb 12 + +if lang eq ru_RU +capt_n_file db ' 䠩',0 +capt_sel_fig db '롥 䨣:',0 +txt_circle: db '㦭' +.end: db 0 +txt_rect: db 'אַ㣮쭨' +.end: db 0 +else ; Default to en_US +capt_n_file db 'Create new file',0 +capt_sel_fig db 'Select figure:',0 +txt_circle: db 'Circle' +.end: db 0 +txt_rect: db 'Rectangle' +.end: db 0 +end if diff --git a/programs/other/cnc_editor/wnd_scale.inc b/programs/other/cnc_editor/wnd_scale.inc index 3430770ab..904ec2329 100644 --- a/programs/other/cnc_editor/wnd_scale.inc +++ b/programs/other/cnc_editor/wnd_scale.inc @@ -1,181 +1,183 @@ -; -; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ -; ࠡ ன -; - -wnd_scale_width equ 320 ;ਭ ன -wnd_scale_height equ 150 ; ன - -align 4 -wnd_run_scale db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ - -; () 뢠 㭪樥 but_wnd_coords -align 4 -start_scale: -pushad - mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ - inc byte[wnd_run_scale] - - edit_boxes_set_sys_color edit3,editboxes_end_sc,sc ;⠭ ⥬ 梥⮢ - call get_scale -popad - call red_win_scale - -; 뢠 㭪 ।饩 -align 4 -still_scale: - pushad - - mcall SF_WAIT_EVENT_TIMEOUT,10 - or eax,eax - jnz @f - call timer_funct_scale - jmp .end - @@: - - cmp al,1 ;. - jne @f - call red_win_scale - jmp .end - @@: - cmp al,2 - jne @f - call key_scale - jmp .end - @@: - cmp al,3 - jz button_scale - cmp al,6 - jne @f - call mouse_scale - @@: -.end: - popad - jmp still_scale - -align 4 -red_win_scale: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT - mov edi,capt_opt ;children window caption - mov bx,word[procinfo.box.left] - add bx,word[buf_0.l] - add bx,5 ;ਭ ࠬ - shl ebx,16 - mov bx,wnd_scale_width - mov cx,word[procinfo.box.top] - add cx,ax ;add skin height - add cx,word[buf_0.t] - shl ecx,16 - mov cx,wnd_scale_height - mov edx,[sc.work] - or edx,0x33000000 - xor eax,eax - int 0x40 - - mov esi,[sc.work_button] - ;ebx = (l<:)+w, ecx = (t<:)+h - mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (95 shl 16)+20, 3 - mcall , (75 shl 16)+59, (95 shl 16)+20, 4 - - mov ecx,[sc.work_text] - bts ecx,31 ;㥬 ப 稢 - mcall SF_DRAW_TEXT, (5 shl 16)+15,, capt_sc - - mov ecx,[sc.work_button_text] - bts ecx,31 - mcall , (9 shl 16)+101,, txt_but_cancel - mov edx,txt_but_apply - mcall ,(79 shl 16)+101 - - stdcall [edit_box_draw], edit3 - - mcall SF_REDRAW,SSF_END_DRAW -popad - ret - -align 4 -proc key_scale uses eax ebx - mcall SF_GET_KEY - - test word [edit3.flags],10b ;ed_focus - je @f - stdcall [edit_box_key], edit3 - ;jmp .end - @@: - - .end: - ret -endp - -align 4 -mouse_scale: - stdcall [edit_box_mouse], edit3 - ret - -align 4 -button_scale: - mcall SF_GET_BUTTON - - cmp ah,3 - je .exit - cmp ah,4 - jne .end_save - push eax ecx edi esi - finit - - mov esi,string3 - mov edi,Data_String - cld - mov ecx,8 - rep movsd - call String_to_DoubleFloat - fld qword[Data_Double] ;뢠 double - fstp qword[Scale1mm] ;࠭塞 double - - pop esi edi ecx eax - jmp .exit - .end_save: - - cmp ah,1 - jne still_scale.end -.exit: - mov byte[wnd_run_scale],0 ;塞 稪 - mcall SF_TERMINATE_PROCESS ;室 ணࠬ - -align 4 -get_scale: - ;㧪 न editbox- - push eax - mov word[NumberSymbolsAD],8 - finit - fld qword[Scale1mm] - fstp qword[Data_Double] - call DoubleFloat_to_String - call String_crop_0 - stdcall [edit_box_set_text], edit3, Data_String - ;stdcall [edit_box_draw], edit3 - pop eax - ret - -align 4 -proc timer_funct_scale - ;ᬠਢ 뤥 न - ret -endp - -align 4 -if lang eq ru_RU -capt_opt db 'ன',0 -capt_sc db '⠡:',0 -else -capt_opt db 'Options',0 -capt_sc db 'Scale:',0 -end if - -edit3 edit_box 80, 54, 11, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 -editboxes_end_sc: - -string3 rb 34 +; +; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ +; ࠡ ன +; + +; Language support for locales: ru_RU (CP866), en_US. + +wnd_scale_width equ 320 ;ਭ ன +wnd_scale_height equ 150 ; ன + +align 4 +wnd_run_scale db 0 ;६ ᫥ ⥬ - ᪠ 1- ᢮⢠ ६ + +; () 뢠 㭪樥 but_wnd_coords +align 4 +start_scale: +pushad + mcall SF_SET_EVENTS_MASK,0x27 ;᪠ ᮡ⨩ + inc byte[wnd_run_scale] + + edit_boxes_set_sys_color edit3,editboxes_end_sc,sc ;⠭ ⥬ 梥⮢ + call get_scale +popad + call red_win_scale + +; 뢠 㭪 ।饩 +align 4 +still_scale: + pushad + + mcall SF_WAIT_EVENT_TIMEOUT,10 + or eax,eax + jnz @f + call timer_funct_scale + jmp .end + @@: + + cmp al,1 ;. + jne @f + call red_win_scale + jmp .end + @@: + cmp al,2 + jne @f + call key_scale + jmp .end + @@: + cmp al,3 + jz button_scale + cmp al,6 + jne @f + call mouse_scale + @@: +.end: + popad + jmp still_scale + +align 4 +red_win_scale: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT + mov edi,capt_opt ;children window caption + mov bx,word[procinfo.box.left] + add bx,word[buf_0.l] + add bx,5 ;ਭ ࠬ + shl ebx,16 + mov bx,wnd_scale_width + mov cx,word[procinfo.box.top] + add cx,ax ;add skin height + add cx,word[buf_0.t] + shl ecx,16 + mov cx,wnd_scale_height + mov edx,[sc.work] + or edx,0x33000000 + xor eax,eax + int 0x40 + + mov esi,[sc.work_button] + ;ebx = (l<:)+w, ecx = (t<:)+h + mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (95 shl 16)+20, 3 + mcall , (75 shl 16)+59, (95 shl 16)+20, 4 + + mov ecx,[sc.work_text] + bts ecx,31 ;㥬 ப 稢 + mcall SF_DRAW_TEXT, (5 shl 16)+15,, capt_sc + + mov ecx,[sc.work_button_text] + bts ecx,31 + mcall , (9 shl 16)+101,, txt_but_cancel + mov edx,txt_but_apply + mcall ,(79 shl 16)+101 + + stdcall [edit_box_draw], edit3 + + mcall SF_REDRAW,SSF_END_DRAW +popad + ret + +align 4 +proc key_scale uses eax ebx + mcall SF_GET_KEY + + test word [edit3.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit3 + ;jmp .end + @@: + + .end: + ret +endp + +align 4 +mouse_scale: + stdcall [edit_box_mouse], edit3 + ret + +align 4 +button_scale: + mcall SF_GET_BUTTON + + cmp ah,3 + je .exit + cmp ah,4 + jne .end_save + push eax ecx edi esi + finit + + mov esi,string3 + mov edi,Data_String + cld + mov ecx,8 + rep movsd + call String_to_DoubleFloat + fld qword[Data_Double] ;뢠 double + fstp qword[Scale1mm] ;࠭塞 double + + pop esi edi ecx eax + jmp .exit + .end_save: + + cmp ah,1 + jne still_scale.end +.exit: + mov byte[wnd_run_scale],0 ;塞 稪 + mcall SF_TERMINATE_PROCESS ;室 ணࠬ + +align 4 +get_scale: + ;㧪 न editbox- + push eax + mov word[NumberSymbolsAD],8 + finit + fld qword[Scale1mm] + fstp qword[Data_Double] + call DoubleFloat_to_String + call String_crop_0 + stdcall [edit_box_set_text], edit3, Data_String + ;stdcall [edit_box_draw], edit3 + pop eax + ret + +align 4 +proc timer_funct_scale + ;ᬠਢ 뤥 न + ret +endp + +align 4 +if lang eq ru_RU +capt_opt db 'ன',0 +capt_sc db '⠡:',0 +else ; Default to en_US +capt_opt db 'Options',0 +capt_sc db 'Scale:',0 +end if + +edit3 edit_box 80, 54, 11, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 +editboxes_end_sc: + +string3 rb 34 diff --git a/programs/other/outdated/cmd/trunk/cmd.asm b/programs/other/outdated/cmd/trunk/cmd.asm index bf8bf25e5..55feaf806 100644 --- a/programs/other/outdated/cmd/trunk/cmd.asm +++ b/programs/other/outdated/cmd/trunk/cmd.asm @@ -19,7 +19,7 @@ use32 dd 0x0 include "..\..\..\..\macros.inc" -include "lang.inc" +include "lang.inc" ; Language support for locales: de_DE, en_US. START: call cmdexist @@ -2780,6 +2780,7 @@ title db 'CMD - Command line interpreter',0 smb_cursor db '|' prompt db 'CMD>>' + if lang eq de_DE h1 db ' CMD - Command line interpreter version 0.26 ' h2 db ' copyleft Chemist - dmitry_gt@tut.by ' @@ -2823,7 +2824,9 @@ mess14 db 'Datei erfolgreich umbenannt ' mess15 db 'ERROR: Kann Datei nicht umbenennen! ' mess16 db 'Scriptname erwartet! ' mess17 db 'Dieses Kommando ist nur in Scripts zulaessig! ' -else + +else ; Default to en_US + h1 db ' CMD - Command line interpreter version 0.26 ' h2 db ' copyleft Chemist - dmitry_gt@tut.by ' h3 db ' Available commands: ' @@ -2831,7 +2834,7 @@ h4 db ' HELP - Display this text LS - List files ' h5 db ' EXIT - Exit Programm CP - Copy file ' h6 db ' CLS - Clear Screen PS - Process info ' h7 db ' KILL - Kill Process RN - Rename File ' -h8 db ' VER - Display programm version ' +h8 db ' VER - Display program version ' h9 db ' DEL - Delete file from ramdisk ' h10 db ' SHUTDOWN - Quit Menuet ' h11 db ' PAUSE - Wait for keypress ' @@ -2849,7 +2852,7 @@ proc_head db ' PID Name Start Length Proc_NUMB ' proc_hd11 db '-------------------------------------------- ' mess1 db 'Press any key to continue (ESC - Cancel)... ' -mess2 db 'Plz specify a 4 byte process number (not PID) ' +mess2 db 'Specify a 4 byte process number (not PID) ' mess3 db 'Process with number you specified has been ' mess4 db 'terminated. ' mess5 db 'Usage: del [filename] ' diff --git a/programs/other/outdated/mfar/trunk/mf-lang.inc b/programs/other/outdated/mfar/trunk/mf-lang.inc index b81e01ba0..c0faadaca 100644 --- a/programs/other/outdated/mfar/trunk/mf-lang.inc +++ b/programs/other/outdated/mfar/trunk/mf-lang.inc @@ -2,38 +2,40 @@ ;///// LOCALIZED STRINGS ////////////////////////////////////////////////////// ;------------------------------------------------------------------------------ +; Language support for locales: ru_RU (CP866), en_US, fr_FR, de_DE. + lsz lname,\ - ru,'',\ - en,'Name',\ - fr,'Nom',\ - ge,'Name' + ru_RU,'',\ + en_US,'Name',\ + fr_FR,'Nom',\ + de_DE,'Name' lsz sort_kind,\ - ru,'',\ - en,'nx',\ - fr,'ne',\ - ge,'ne' + ru_RU,'',\ + en_US,'nx',\ + fr_FR,'ne',\ + de_DE,'ne' lsz btmkeys,\ - ru,' 짌 ',\ - ru,'७ 䌭 室',\ - en,'Help UserMn View Edit Copy ',\ - en,'RenMov MkFold Delete ConfMn Quit',\ - fr,'Aide UserMn Vue Editer Copier ',\ - fr,'RenDep CreRp Efface ConfMn Quitter',\ - ge,'Hilfe Men Anzeig Bearb. Kopie ',\ - ge,'UmbBew MkDir Lsche Funkt. Ende' + ru_RU,' 짌 ',\ + ru_RU,'७ 䌭 室',\ + en_US,'Help UserMn View Edit Copy ',\ + en_US,'RenMov MkFold Delete ConfMn Quit',\ + fr_FR,'Aide UserMn Vue Editer Copier ',\ + fr_FR,'RenDep CreRp Efface ConfMn Quitter',\ + de_DE,'Hilfe Men Anzeig Bearb. Kopie ',\ + de_DE,'UmbBew MkDir Lsche Funkt. Ende' lsz sz_cancel,\ - ru,'⬥',\ - en,'Cancel',\ - fr,'Annuler',\ - ge,'Beenden' + ru_RU,'⬥',\ + en_US,'Cancel',\ + fr_FR,'Annuler',\ + de_DE,'Beenden' ;---------- COPY DIALOG ---------- lsz sz_copy,\ - ru,'஢ "',\ - en,'Copy "',\ - fr,'Copier "',\ - ge,'Kopiere "' + ru_RU,'஢ "',\ + en_US,'Copy "',\ + fr_FR,'Copier "',\ + de_DE,'Kopiere "' lsz sz_copyto,\ - ru,'" :',\ - en,'" to:',\ - fr,'" vers:',\ - ge,'" nach:' + ru_RU,'" :',\ + en_US,'" to:',\ + fr_FR,'" vers:',\ + de_DE,'" nach:' diff --git a/programs/other/outdated/mhc/trunk/mhc.asm b/programs/other/outdated/mhc/trunk/mhc.asm index f59fbdcf7..c8b396580 100644 --- a/programs/other/outdated/mhc/trunk/mhc.asm +++ b/programs/other/outdated/mhc/trunk/mhc.asm @@ -1,1001 +1,1003 @@ -; -; MHC archiver for MenuetOS - very fast compression tool -; -; version 0.09 -; -; Written by Nikita Lesnikov (nlo_one@mail.ru, Republic of Belarus, Sluck) -; - -;============================================================================== - -; -; Brief file format description: -; -; +-----------+------------------------+ -; File structure: | Method ID | Compressed data | -; +-----------+------------------------+ -; -; Methods list: -; -; 0. LZP (order-2 specified specially for *.ASM,*.RAW and MeOS executables) -; -; New methods can be easily added without loss of compatibility -; with older versions -; - -;============================================================================== - -; SYSTEM HEADER - -use32 - - org 0x0 - db "MENUET01" - dd 0x01 - dd ENTRANCE - dd MHC_END - dd 0x300000 ; 3 megs of memory needed - dd 0x2FF000 - dd 0x0 - dd 0x0 - -include 'lang.inc' -include '..\..\..\macros.inc' -; CODE AREA - -ENTRANCE: - -; ======== user interface ========= - - - call draw_window ; draw the window - - still: - - mov eax,10 ; wait for event - mcall - - cmp eax,1 ; redraw? - jnz no_redraw - call draw_window - no_redraw: - - cmp eax,2 ; key pressed? - jz key - - cmp eax,3 ; button pressed? - jz button - - jmp still - - ; Key handler - - key: - mov eax,2 ; read it - mcall - shr eax,8 - - cmp byte [editstate],0 - jz still - - cmp al,8 ; backspace - jnz no_bksp - cmp byte [editpos],0 - jz no_del_last - dec byte [editpos] - xor ebx,ebx - mov bl,byte [editpos] - add ebx,cmfile - cmp byte [editstate],2 - jnz no_add_base_1 - add ebx,12 - no_add_base_1: - mov byte [ebx],32 - no_del_last: - call draw_info - jmp still - no_bksp: - - cmp al,13 ; enter - jnz no_enter - mov byte [editstate],0 - call draw_info - jmp still - no_enter: - - cmp eax,dword 31 - jbe no_lit - cmp eax,dword 95 - jb capital - sub eax,32 - capital: - xor ebx,ebx - mov bl,byte [editpos] - add ebx,cmfile - cmp byte [editstate],2 - jnz no_add_base_2 - add ebx,12 - no_add_base_2: - mov byte [ebx],al - inc byte [editpos] - cmp byte [editpos],12 - jnz no_null_state - mov byte [editstate],0 - no_null_state: - call draw_info - no_lit: - - jmp still - - ; Button handler - - button: - - mov eax,17 - mcall - - cmp ah,1 - jnz no_quit - mov eax,-1 - mcall - no_quit: - - cmp ah,4 - jnz nofirst - cld - mov byte [editstate],1 - mov edi,cmfile - mov eax,0x20202020 - mov ecx,3 - rep stosd - mov byte [editpos],0 - mov byte [msgid],0 - call draw_info - nofirst: - - cmp ah,5 - jnz nosecond - cld - mov byte [editstate],2 - mov edi,iofile - mov eax,0x20202020 - mov ecx,3 - rep stosd - mov byte [editpos],0 - mov byte [msgid],0 - call draw_info - nosecond: - - cmp ah,2 - jnz no_compress - call compress - no_compress: - - cmp ah,3 - jnz no_decompress - call decompress - no_decompress: - - cmp ah,6 - jnz no_delete_io - pusha - mov eax,32 - mov ebx,iofile - mcall - popa - no_delete_io: - - cmp ah,7 - jnz no_delete_archive - pusha - mov eax,32 - mov ebx,cmfile - mcall - popa - no_delete_archive: - - jmp still - - ; WINDOW DRAW - - draw_window: - - mov eax,12 ; Start redrawing - mov ebx,1 - mcall - - xor eax,eax ; Define window - mov ebx,100*65536+240 - mov ecx,100*65536+130 - mov edx,0x04AAAAAA - mov esi,0x80777777 - mov edi,0x00777777 - mcall - - mov eax,4 ; Draw all needed texts - mov ebx,8*65536+8 - mov ecx,0x00FFFFFF - mov edx,title - mov esi,arclab-title - mcall - - xor ecx,ecx - mov edx,arclab - mov esi,unplab-arclab - add ebx,10*65536+28 - mcall - - mov edx,unplab - mov esi,fin_text-unplab - add ebx,18 - mcall - - pusha - -; mov eax,8 ; Buttons -; mov ebx,222*65536+10 -; mov ecx,6*65536+10 -; mov edx,1 -; mov esi,0x555555 -; mcall - - mov eax,8 - mov ebx,15*65536+100 - mov ecx,70*65536+13 - mov edx,2 - mcall - - inc edx - add ebx,110*65536 - mcall - - inc edx - mov ebx,214*65536+11 - mov ecx,33*65536+11 - mcall - - inc edx - add ecx,18*65536 - mcall - - inc edx - mov ebx,15*65536+100 - mov ecx,86*65536+13 - mcall - - inc edx - add ebx,110*65536 - mcall - - popa - - mov ecx,0x00FFFFFF - mov edx,keylab - mov esi,dellab-keylab - add ebx,19 - mcall - - mov edx,dellab - mov esi,title-dellab - add ebx,16 - mcall - - call draw_info - - mov eax,12 ; Finish redrawing - mov ebx,2 - mcall - - ret - - draw_info: ; Draw filenames and compressor state - - activecolor equ 0x00112299 - - pusha ; Save registers - - mov eax,13 ; Clean draw area - mov ebx,127*65536+85 - mov ecx,33*65536+33 - mov edx,0x00AAAAAA - mcall - - mov eax,4 ; Draw filenames - mov ebx,134*65536+36 - mov edx,cmfile - xor ecx,ecx - mov esi,12 - cmp byte [editstate],1 - jnz no_active_1 - mov ecx,activecolor - no_active_1: - mcall - xor ecx,ecx - cmp byte [editstate],2 - jnz no_active_2 - mov ecx,activecolor - no_active_2: - add ebx,18 - add edx,12 - mcall - - mov eax,13 ; Clean info area - mov ebx,14*65536+210 - mov ecx,107*65536+14 - mov edx,0x00AAAAAA - mcall - - cmp byte [msgid],0 ; Draw info string - jz notype - mov ebx,16*65536+110 - xor ecx,ecx - mov esi,16 - mov al, byte [msgid] - dec al - shl al,4 - xor ah,ah - xor edx,edx - mov dx,ax - add edx,msgtable - mov eax,4 - mcall - notype: - - popa ; Restore registers - - ret - - ; interface data - - if lang eq de_DE - keylab db " PACKEN ENTPACKEN" - dellab db " LOESCHE I/O LOESCHE *.MHC" - title db "MHC 0.09" - arclab db "GEOACJTE DATEI:" - unplab db "EIN/AUSGABE DATEI:" - fin_text: - - cmfile db "FILENAME.MHC" - iofile db "FILENAME.XYZ" - - msgtable: - db "PACKE... " - db "ENTPACKE... " - db "KEIN I/O! " - db "KEINE *.MHC! " - db "FALSCHE METHODe!" - - else - keylab db " COMPRESS DECOMPRESS" - dellab db " DELETE I/O DELETE *.MHC" - title db "MHC 0.09" - arclab db "COMPRESSED FILE:" - unplab db "INPUT/OUTPUT FILE:" - fin_text: - - cmfile db "FILENAME.MHC" - iofile db "FILENAME.XYZ" - - msgtable: - db "COMPRESSING... " - db "DECOMPRESSING..." - db "I/O NOT FOUND! " - db "*.MHC NOT FOUND!" - db "INVALID METHOD! " - - end if - - - editstate db 0 - editpos db 0 - msgid db 0 - - -; ======== compression/decompression engine ======== - -; Adresses declaration - - hashtable equ MHC_END - ifile equ hashtable+65536*4 - ofile equ ifile+1000000 - - compress: ; File compression - - call fill_filebufs - - mov eax,6 - mov ebx,iofile - xor ecx,ecx - mov edx,ecx - not edx - mov esi,ifile - mcall - - cmp eax,0xFFFFFFFF - jnz compress_filefound ; i/o file not found - mov byte [msgid],3 - call draw_info - ret - - compress_filefound: - - mov byte [msgid],1 - call draw_info - - jmp lzp_compress ; compress with order-2 LZP - compress_dumpdata: - - push edx - - mov eax,32 - mov ebx,cmfile - mcall - - mov eax,33 - pop edx - mov ebx,cmfile - mov ecx,ofile - xor esi,esi - mcall - - mov byte [msgid],0 - call draw_info - - ret - - - decompress: ; File decompression - - call fill_filebufs - - mov eax,6 - mov ebx,cmfile - xor ecx,ecx - mov edx,ecx - not edx - mov esi,ofile - mcall - - cmp eax,0xFFFFFFFF - jnz decompress_filefound ; *.mhc file not found - mov byte [msgid],4 - call draw_info - ret - - decompress_filefound: - - cmp byte [ofile],0 ; Invalid method! - jz right_method - mov byte [msgid],5 - call draw_info - ret - - right_method: - mov byte [msgid],2 - call draw_info - - jmp lzp_decompress - decompress_dumpdata: - - push edx - - mov eax,32 - mov ebx,iofile - mcall - - mov eax,33 - pop edx - mov ebx,iofile - mov ecx,ifile - xor esi,esi - mcall - - mov byte [msgid],0 - call draw_info - - ret - - fill_filebufs: ; Fill filebufs with garbage to simplify matching - pusha - cld - mov eax,0xF7D9A03F ; <- "magic number" :) just garbage... - mov ecx,2000000/4 - mov edi,ifile - rep stosd - popa - ret - -; ==== algorithms section ==== - -; Method 0: LZP compression algorithm - - lzp_compress: ; EDX - how much bytes to dump - - cld ; clear direction flag - - mov esi,ifile ; init pointers - mov edi,ofile - - push eax ; write header: ID0+4bfilesize => total 5 bytes - xor eax,eax - stosb - pop eax - stosd - - pusha ; fill hash table - mov eax,ifile - mov edi,hashtable - mov ecx,65536 - rep stosd - popa - - add eax,esi ; calculate endpointer - mov dword [endpointer],eax - - movsw ; copy three bytes - movsb - - mov dword [controlp],edi - inc edi - - mov byte [controld],0 - mov byte [controlb],0 - - c_loop: - cmp dword [endpointer],esi ; check end of file - ja c_loop_ok - jmp finish_c_loop - c_loop_ok: - - call chash - call compare - jz two_match_c - - lodsb - mov byte [literal],al - call chash - call compare - jz lit_match_c - - mov al,0 - call putbit - mov al,byte [literal] - stosb - movsb - jmp end_c_loop - - lit_match_c: - mov al,1 - call putbit - mov al,0 - call putbit - mov al,byte [literal] - stosb - jmp encode_match - - two_match_c: - mov al,1 - call putbit - call putbit - - encode_match: - call incpos - call compare - jz one_c - mov al,0 - call putbit - jmp end_c_loop - one_c: - - call incpos - mov al,1 - call putbit - - call compare - jnz ec1 - call incpos - call compare - jnz ec2 - call incpos - call compare - jnz ec3 - call incpos - mov al,1 - call putbit - call putbit - call compare - jnz ec4 - call incpos - call compare - jnz ec5 - call incpos - call compare - jnz ec6 - call incpos - call compare - jnz ec7 - call incpos - call compare - jnz ec8 - call incpos - call compare - jnz ec9 - call incpos - call compare - jnz ec10 - call incpos - - mov al,1 - call putbit - call putbit - call putbit - xor ecx,ecx - - match_loop_c: - cmp esi,dword [endpointer] - jae out_match_loop_c - call compare - jnz out_match_loop_c - inc ecx - call incpos - jmp match_loop_c - out_match_loop_c: - - mov al,0xFF - out_lg: - cmp ecx,255 - jb out_lg_out - stosb - sub ecx,255 - jmp out_lg - out_lg_out: - mov al,cl - stosb - jmp end_c_loop - - ec10: - mov al,1 - call putbit - call putbit - mov al,0 - call putbit - jmp end_c_loop - - ec9: - mov al,1 - call putbit - mov al,0 - call putbit - mov al,1 - call putbit - jmp end_c_loop - - ec8: - mov al,1 - call putbit - mov al,0 - call putbit - call putbit - jmp end_c_loop - - ec7: - mov al,0 - call putbit - mov al,1 - call putbit - call putbit - jmp end_c_loop - - ec6: - mov al,0 - call putbit - mov al,1 - call putbit - mov al,0 - call putbit - jmp end_c_loop - - ec5: - mov al,0 - call putbit - call putbit - mov al,1 - call putbit - jmp end_c_loop - - ec4: - mov al,0 - call putbit - call putbit - call putbit - jmp end_c_loop - - ec3: - mov al,1 - call putbit - mov al,0 - call putbit - jmp end_c_loop - - ec2: - mov al,0 - call putbit - mov al,1 - call putbit - jmp end_c_loop - - ec1: - mov al,0 - call putbit - call putbit - - end_c_loop: - jmp c_loop - - finish_c_loop: - - mov eax,dword [controlp] ; store last tagbyte - mov bl,byte [controld] - mov [eax], byte bl - - sub edi,ofile ; calculate dump size - mov edx,edi - - jmp compress_dumpdata - -; LZP decompression algorithm - - lzp_decompress: ; EDX - how much bytes to dump - - cld - - mov edi,ifile - mov esi,ofile+1 - - pusha ; fill hash table - mov eax,ifile - mov edi,hashtable - mov ecx,65536 - rep stosd - popa - - lodsd - - mov ebx,edi - add ebx,eax - mov dword [endpointer],ebx - - movsw - movsb - - lodsb - mov byte [controld],al - mov byte [controlb],0 - - d_loop: - cmp dword [endpointer],edi - ja d_loop_ok - jmp finish_d_loop - d_loop_ok: - - call getbit - cmp al,0 - jnz match_d - call dhash - movsb - call dhash - movsb - jmp end_d_loop - - match_d: - - call getbit - cmp al,0 - jnz no_literal_before_match - call dhash - movsb - no_literal_before_match: - - call dhash - mov ecx,1 - call copymatch - - call getbit - cmp al,0 - jz end_d_loop - mov ecx,1 - call copymatch - call getbit - cmp al,0 - jz dc2 - mov ecx,2 - call copymatch - call getbit - cmp al,0 - jz end_d_loop - mov ecx,1 - call copymatch - call getbit - cmp al,0 - jz dc4 - mov ecx,4 - call copymatch - call getbit - cmp al,0 - jz dc5 - call getbit - cmp al,0 - jz dc6 - mov ecx,3 - call copymatch - - do: - lodsb - xor ecx,ecx - mov cl,al - call copymatch - cmp al,0xFF - jnz end_do - jmp do - end_do: - jmp end_d_loop - - dc6: - mov ecx,2 - call copymatch - jmp end_d_loop - - dc5: - call getbit - cmp al,0 - jz ndc5 - mov ecx,1 - call copymatch - ndc5: - jmp end_d_loop - - dc4: - call getbit - cmp al,0 - jz ndc4 - call getbit - mov ecx,3 - cmp al,1 - jz ndcc4 - dec ecx - ndcc4: - call copymatch - jmp end_d_loop - ndc4: - call getbit - cmp al,0 - jz ndccc4 - mov ecx,1 - call copymatch - ndccc4: - jmp end_d_loop - - dc2: - call getbit - cmp al,0 - jz ndc2 - mov ecx,1 - call copymatch - ndc2: - - end_d_loop: - jmp d_loop - finish_d_loop: - - mov edx, dword [ofile+1] - - jmp decompress_dumpdata - -; LZP subroutines - - putbit: ; bit -> byte tag, AL holds bit for output - pusha - mov cl,byte [controlb] - shl al,cl - mov bl,byte [controld] - or bl,al - mov byte [controld],bl - inc cl - cmp cl,8 - jnz just_increment - mov byte [controlb],0 - mov byte [controld],0 - push edi - mov edi, dword [controlp] - mov al,bl - stosb - pop edi - mov dword [controlp],edi - popa - inc edi - ret - just_increment: - mov byte [controlb],cl - popa - ret - - getbit: ; tag byte -> bit, AL holds input - push ecx - mov al,byte [controld] - mov cl,byte [controlb] - shr al,cl - and al,1 - inc cl - cmp cl,8 - jnz just_increment_d - mov byte [controlb],0 - push eax - lodsb - mov byte [controld],al - pop eax - pop ecx - ret - just_increment_d: - mov byte [controlb],cl - pop ecx - ret - - chash: ; calculate hash -> mp -> fill position - pusha - xor eax,eax - mov al, byte [esi-1] - mov ah, byte [esi-2] - shl eax,2 - add eax,hashtable - mov edx,dword [eax] - mov dword [mp],edx - mov dword [eax],esi - popa - ret - - dhash: ; calculate hash -> mp -> fill position - pusha - xor eax,eax - mov al, byte [edi-1] - mov ah, byte [edi-2] - shl eax,2 - add eax,hashtable - mov edx,dword [eax] - mov dword [mp],edx - mov dword [eax],edi - popa - ret - - copymatch: ; ECX bytes from [mp] to [rp] - push esi - mov esi,dword [mp] - rep movsb - mov dword [mp],esi - pop esi - ret - - compare: ; compare [mp] with [cpos] - push edi - push esi - mov edi,dword [mp] - cmpsb - pop esi - pop edi - ret - - incpos: - inc dword [mp] - inc esi - ret - - -; LZP algorithm data - - endpointer dd 0 - controlp dd 0 - controlb db 0 - controld db 0 - mp dd 0 - literal db 0 - -MHC_END: ; the end... - Nikita Lesnikov (nlo_one) +; +; MHC archiver for MenuetOS - very fast compression tool +; +; version 0.09 +; +; Written by Nikita Lesnikov (nlo_one@mail.ru, Republic of Belarus, Sluck) +; + +;============================================================================== + +; +; Brief file format description: +; +; +-----------+------------------------+ +; File structure: | Method ID | Compressed data | +; +-----------+------------------------+ +; +; Methods list: +; +; 0. LZP (order-2 specified specially for *.ASM,*.RAW and MeOS executables) +; +; New methods can be easily added without loss of compatibility +; with older versions +; + +;============================================================================== + +; SYSTEM HEADER + +use32 + + org 0x0 + db "MENUET01" + dd 0x01 + dd ENTRANCE + dd MHC_END + dd 0x300000 ; 3 megs of memory needed + dd 0x2FF000 + dd 0x0 + dd 0x0 + +include 'lang.inc' ; Language support for locales: de_DE, en_US. +include '..\..\..\macros.inc' +; CODE AREA + +ENTRANCE: + +; ======== user interface ========= + + + call draw_window ; draw the window + + still: + + mov eax,10 ; wait for event + mcall + + cmp eax,1 ; redraw? + jnz no_redraw + call draw_window + no_redraw: + + cmp eax,2 ; key pressed? + jz key + + cmp eax,3 ; button pressed? + jz button + + jmp still + + ; Key handler + + key: + mov eax,2 ; read it + mcall + shr eax,8 + + cmp byte [editstate],0 + jz still + + cmp al,8 ; backspace + jnz no_bksp + cmp byte [editpos],0 + jz no_del_last + dec byte [editpos] + xor ebx,ebx + mov bl,byte [editpos] + add ebx,cmfile + cmp byte [editstate],2 + jnz no_add_base_1 + add ebx,12 + no_add_base_1: + mov byte [ebx],32 + no_del_last: + call draw_info + jmp still + no_bksp: + + cmp al,13 ; enter + jnz no_enter + mov byte [editstate],0 + call draw_info + jmp still + no_enter: + + cmp eax,dword 31 + jbe no_lit + cmp eax,dword 95 + jb capital + sub eax,32 + capital: + xor ebx,ebx + mov bl,byte [editpos] + add ebx,cmfile + cmp byte [editstate],2 + jnz no_add_base_2 + add ebx,12 + no_add_base_2: + mov byte [ebx],al + inc byte [editpos] + cmp byte [editpos],12 + jnz no_null_state + mov byte [editstate],0 + no_null_state: + call draw_info + no_lit: + + jmp still + + ; Button handler + + button: + + mov eax,17 + mcall + + cmp ah,1 + jnz no_quit + mov eax,-1 + mcall + no_quit: + + cmp ah,4 + jnz nofirst + cld + mov byte [editstate],1 + mov edi,cmfile + mov eax,0x20202020 + mov ecx,3 + rep stosd + mov byte [editpos],0 + mov byte [msgid],0 + call draw_info + nofirst: + + cmp ah,5 + jnz nosecond + cld + mov byte [editstate],2 + mov edi,iofile + mov eax,0x20202020 + mov ecx,3 + rep stosd + mov byte [editpos],0 + mov byte [msgid],0 + call draw_info + nosecond: + + cmp ah,2 + jnz no_compress + call compress + no_compress: + + cmp ah,3 + jnz no_decompress + call decompress + no_decompress: + + cmp ah,6 + jnz no_delete_io + pusha + mov eax,32 + mov ebx,iofile + mcall + popa + no_delete_io: + + cmp ah,7 + jnz no_delete_archive + pusha + mov eax,32 + mov ebx,cmfile + mcall + popa + no_delete_archive: + + jmp still + + ; WINDOW DRAW + + draw_window: + + mov eax,12 ; Start redrawing + mov ebx,1 + mcall + + xor eax,eax ; Define window + mov ebx,100*65536+240 + mov ecx,100*65536+130 + mov edx,0x04AAAAAA + mov esi,0x80777777 + mov edi,0x00777777 + mcall + + mov eax,4 ; Draw all needed texts + mov ebx,8*65536+8 + mov ecx,0x00FFFFFF + mov edx,title + mov esi,arclab-title + mcall + + xor ecx,ecx + mov edx,arclab + mov esi,unplab-arclab + add ebx,10*65536+28 + mcall + + mov edx,unplab + mov esi,fin_text-unplab + add ebx,18 + mcall + + pusha + +; mov eax,8 ; Buttons +; mov ebx,222*65536+10 +; mov ecx,6*65536+10 +; mov edx,1 +; mov esi,0x555555 +; mcall + + mov eax,8 + mov ebx,15*65536+100 + mov ecx,70*65536+13 + mov edx,2 + mcall + + inc edx + add ebx,110*65536 + mcall + + inc edx + mov ebx,214*65536+11 + mov ecx,33*65536+11 + mcall + + inc edx + add ecx,18*65536 + mcall + + inc edx + mov ebx,15*65536+100 + mov ecx,86*65536+13 + mcall + + inc edx + add ebx,110*65536 + mcall + + popa + + mov ecx,0x00FFFFFF + mov edx,keylab + mov esi,dellab-keylab + add ebx,19 + mcall + + mov edx,dellab + mov esi,title-dellab + add ebx,16 + mcall + + call draw_info + + mov eax,12 ; Finish redrawing + mov ebx,2 + mcall + + ret + + draw_info: ; Draw filenames and compressor state + + activecolor equ 0x00112299 + + pusha ; Save registers + + mov eax,13 ; Clean draw area + mov ebx,127*65536+85 + mov ecx,33*65536+33 + mov edx,0x00AAAAAA + mcall + + mov eax,4 ; Draw filenames + mov ebx,134*65536+36 + mov edx,cmfile + xor ecx,ecx + mov esi,12 + cmp byte [editstate],1 + jnz no_active_1 + mov ecx,activecolor + no_active_1: + mcall + xor ecx,ecx + cmp byte [editstate],2 + jnz no_active_2 + mov ecx,activecolor + no_active_2: + add ebx,18 + add edx,12 + mcall + + mov eax,13 ; Clean info area + mov ebx,14*65536+210 + mov ecx,107*65536+14 + mov edx,0x00AAAAAA + mcall + + cmp byte [msgid],0 ; Draw info string + jz notype + mov ebx,16*65536+110 + xor ecx,ecx + mov esi,16 + mov al, byte [msgid] + dec al + shl al,4 + xor ah,ah + xor edx,edx + mov dx,ax + add edx,msgtable + mov eax,4 + mcall + notype: + + popa ; Restore registers + + ret + + ; interface data + + if lang eq de_DE + + keylab db " PACKEN ENTPACKEN" + dellab db " LOESCHE I/O LOESCHE *.MHC" + title db "MHC 0.09" + arclab db "GEOACJTE DATEI:" + unplab db "EIN/AUSGABE DATEI:" + fin_text: + + cmfile db "FILENAME.MHC" + iofile db "FILENAME.XYZ" + + msgtable: + db "PACKE... " + db "ENTPACKE... " + db "KEIN I/O! " + db "KEINE *.MHC! " + db "FALSCHE METHODE!" + + else ; Default to en_US + + keylab db " COMPRESS DECOMPRESS" + dellab db " DELETE I/O DELETE *.MHC" + title db "MHC 0.09" + arclab db "COMPRESSED FILE:" + unplab db "INPUT/OUTPUT FILE:" + fin_text: + + cmfile db "FILENAME.MHC" + iofile db "FILENAME.XYZ" + + msgtable: + db "COMPRESSING... " + db "DECOMPRESSING..." + db "I/O NOT FOUND! " + db "*.MHC NOT FOUND!" + db "INVALID METHOD! " + + end if + + + editstate db 0 + editpos db 0 + msgid db 0 + + +; ======== compression/decompression engine ======== + +; Adresses declaration + + hashtable equ MHC_END + ifile equ hashtable+65536*4 + ofile equ ifile+1000000 + + compress: ; File compression + + call fill_filebufs + + mov eax,6 + mov ebx,iofile + xor ecx,ecx + mov edx,ecx + not edx + mov esi,ifile + mcall + + cmp eax,0xFFFFFFFF + jnz compress_filefound ; i/o file not found + mov byte [msgid],3 + call draw_info + ret + + compress_filefound: + + mov byte [msgid],1 + call draw_info + + jmp lzp_compress ; compress with order-2 LZP + compress_dumpdata: + + push edx + + mov eax,32 + mov ebx,cmfile + mcall + + mov eax,33 + pop edx + mov ebx,cmfile + mov ecx,ofile + xor esi,esi + mcall + + mov byte [msgid],0 + call draw_info + + ret + + + decompress: ; File decompression + + call fill_filebufs + + mov eax,6 + mov ebx,cmfile + xor ecx,ecx + mov edx,ecx + not edx + mov esi,ofile + mcall + + cmp eax,0xFFFFFFFF + jnz decompress_filefound ; *.mhc file not found + mov byte [msgid],4 + call draw_info + ret + + decompress_filefound: + + cmp byte [ofile],0 ; Invalid method! + jz right_method + mov byte [msgid],5 + call draw_info + ret + + right_method: + mov byte [msgid],2 + call draw_info + + jmp lzp_decompress + decompress_dumpdata: + + push edx + + mov eax,32 + mov ebx,iofile + mcall + + mov eax,33 + pop edx + mov ebx,iofile + mov ecx,ifile + xor esi,esi + mcall + + mov byte [msgid],0 + call draw_info + + ret + + fill_filebufs: ; Fill filebufs with garbage to simplify matching + pusha + cld + mov eax,0xF7D9A03F ; <- "magic number" :) just garbage... + mov ecx,2000000/4 + mov edi,ifile + rep stosd + popa + ret + +; ==== algorithms section ==== + +; Method 0: LZP compression algorithm + + lzp_compress: ; EDX - how much bytes to dump + + cld ; clear direction flag + + mov esi,ifile ; init pointers + mov edi,ofile + + push eax ; write header: ID0+4bfilesize => total 5 bytes + xor eax,eax + stosb + pop eax + stosd + + pusha ; fill hash table + mov eax,ifile + mov edi,hashtable + mov ecx,65536 + rep stosd + popa + + add eax,esi ; calculate endpointer + mov dword [endpointer],eax + + movsw ; copy three bytes + movsb + + mov dword [controlp],edi + inc edi + + mov byte [controld],0 + mov byte [controlb],0 + + c_loop: + cmp dword [endpointer],esi ; check end of file + ja c_loop_ok + jmp finish_c_loop + c_loop_ok: + + call chash + call compare + jz two_match_c + + lodsb + mov byte [literal],al + call chash + call compare + jz lit_match_c + + mov al,0 + call putbit + mov al,byte [literal] + stosb + movsb + jmp end_c_loop + + lit_match_c: + mov al,1 + call putbit + mov al,0 + call putbit + mov al,byte [literal] + stosb + jmp encode_match + + two_match_c: + mov al,1 + call putbit + call putbit + + encode_match: + call incpos + call compare + jz one_c + mov al,0 + call putbit + jmp end_c_loop + one_c: + + call incpos + mov al,1 + call putbit + + call compare + jnz ec1 + call incpos + call compare + jnz ec2 + call incpos + call compare + jnz ec3 + call incpos + mov al,1 + call putbit + call putbit + call compare + jnz ec4 + call incpos + call compare + jnz ec5 + call incpos + call compare + jnz ec6 + call incpos + call compare + jnz ec7 + call incpos + call compare + jnz ec8 + call incpos + call compare + jnz ec9 + call incpos + call compare + jnz ec10 + call incpos + + mov al,1 + call putbit + call putbit + call putbit + xor ecx,ecx + + match_loop_c: + cmp esi,dword [endpointer] + jae out_match_loop_c + call compare + jnz out_match_loop_c + inc ecx + call incpos + jmp match_loop_c + out_match_loop_c: + + mov al,0xFF + out_lg: + cmp ecx,255 + jb out_lg_out + stosb + sub ecx,255 + jmp out_lg + out_lg_out: + mov al,cl + stosb + jmp end_c_loop + + ec10: + mov al,1 + call putbit + call putbit + mov al,0 + call putbit + jmp end_c_loop + + ec9: + mov al,1 + call putbit + mov al,0 + call putbit + mov al,1 + call putbit + jmp end_c_loop + + ec8: + mov al,1 + call putbit + mov al,0 + call putbit + call putbit + jmp end_c_loop + + ec7: + mov al,0 + call putbit + mov al,1 + call putbit + call putbit + jmp end_c_loop + + ec6: + mov al,0 + call putbit + mov al,1 + call putbit + mov al,0 + call putbit + jmp end_c_loop + + ec5: + mov al,0 + call putbit + call putbit + mov al,1 + call putbit + jmp end_c_loop + + ec4: + mov al,0 + call putbit + call putbit + call putbit + jmp end_c_loop + + ec3: + mov al,1 + call putbit + mov al,0 + call putbit + jmp end_c_loop + + ec2: + mov al,0 + call putbit + mov al,1 + call putbit + jmp end_c_loop + + ec1: + mov al,0 + call putbit + call putbit + + end_c_loop: + jmp c_loop + + finish_c_loop: + + mov eax,dword [controlp] ; store last tagbyte + mov bl,byte [controld] + mov [eax], byte bl + + sub edi,ofile ; calculate dump size + mov edx,edi + + jmp compress_dumpdata + +; LZP decompression algorithm + + lzp_decompress: ; EDX - how much bytes to dump + + cld + + mov edi,ifile + mov esi,ofile+1 + + pusha ; fill hash table + mov eax,ifile + mov edi,hashtable + mov ecx,65536 + rep stosd + popa + + lodsd + + mov ebx,edi + add ebx,eax + mov dword [endpointer],ebx + + movsw + movsb + + lodsb + mov byte [controld],al + mov byte [controlb],0 + + d_loop: + cmp dword [endpointer],edi + ja d_loop_ok + jmp finish_d_loop + d_loop_ok: + + call getbit + cmp al,0 + jnz match_d + call dhash + movsb + call dhash + movsb + jmp end_d_loop + + match_d: + + call getbit + cmp al,0 + jnz no_literal_before_match + call dhash + movsb + no_literal_before_match: + + call dhash + mov ecx,1 + call copymatch + + call getbit + cmp al,0 + jz end_d_loop + mov ecx,1 + call copymatch + call getbit + cmp al,0 + jz dc2 + mov ecx,2 + call copymatch + call getbit + cmp al,0 + jz end_d_loop + mov ecx,1 + call copymatch + call getbit + cmp al,0 + jz dc4 + mov ecx,4 + call copymatch + call getbit + cmp al,0 + jz dc5 + call getbit + cmp al,0 + jz dc6 + mov ecx,3 + call copymatch + + do: + lodsb + xor ecx,ecx + mov cl,al + call copymatch + cmp al,0xFF + jnz end_do + jmp do + end_do: + jmp end_d_loop + + dc6: + mov ecx,2 + call copymatch + jmp end_d_loop + + dc5: + call getbit + cmp al,0 + jz ndc5 + mov ecx,1 + call copymatch + ndc5: + jmp end_d_loop + + dc4: + call getbit + cmp al,0 + jz ndc4 + call getbit + mov ecx,3 + cmp al,1 + jz ndcc4 + dec ecx + ndcc4: + call copymatch + jmp end_d_loop + ndc4: + call getbit + cmp al,0 + jz ndccc4 + mov ecx,1 + call copymatch + ndccc4: + jmp end_d_loop + + dc2: + call getbit + cmp al,0 + jz ndc2 + mov ecx,1 + call copymatch + ndc2: + + end_d_loop: + jmp d_loop + finish_d_loop: + + mov edx, dword [ofile+1] + + jmp decompress_dumpdata + +; LZP subroutines + + putbit: ; bit -> byte tag, AL holds bit for output + pusha + mov cl,byte [controlb] + shl al,cl + mov bl,byte [controld] + or bl,al + mov byte [controld],bl + inc cl + cmp cl,8 + jnz just_increment + mov byte [controlb],0 + mov byte [controld],0 + push edi + mov edi, dword [controlp] + mov al,bl + stosb + pop edi + mov dword [controlp],edi + popa + inc edi + ret + just_increment: + mov byte [controlb],cl + popa + ret + + getbit: ; tag byte -> bit, AL holds input + push ecx + mov al,byte [controld] + mov cl,byte [controlb] + shr al,cl + and al,1 + inc cl + cmp cl,8 + jnz just_increment_d + mov byte [controlb],0 + push eax + lodsb + mov byte [controld],al + pop eax + pop ecx + ret + just_increment_d: + mov byte [controlb],cl + pop ecx + ret + + chash: ; calculate hash -> mp -> fill position + pusha + xor eax,eax + mov al, byte [esi-1] + mov ah, byte [esi-2] + shl eax,2 + add eax,hashtable + mov edx,dword [eax] + mov dword [mp],edx + mov dword [eax],esi + popa + ret + + dhash: ; calculate hash -> mp -> fill position + pusha + xor eax,eax + mov al, byte [edi-1] + mov ah, byte [edi-2] + shl eax,2 + add eax,hashtable + mov edx,dword [eax] + mov dword [mp],edx + mov dword [eax],edi + popa + ret + + copymatch: ; ECX bytes from [mp] to [rp] + push esi + mov esi,dword [mp] + rep movsb + mov dword [mp],esi + pop esi + ret + + compare: ; compare [mp] with [cpos] + push edi + push esi + mov edi,dword [mp] + cmpsb + pop esi + pop edi + ret + + incpos: + inc dword [mp] + inc esi + ret + + +; LZP algorithm data + + endpointer dd 0 + controlp dd 0 + controlb db 0 + controld db 0 + mp dd 0 + literal db 0 + +MHC_END: ; the end... - Nikita Lesnikov (nlo_one) diff --git a/programs/other/outdated/mv/trunk/mv.asm b/programs/other/outdated/mv/trunk/mv.asm index 28cbc5feb..c974c5bc9 100644 --- a/programs/other/outdated/mv/trunk/mv.asm +++ b/programs/other/outdated/mv/trunk/mv.asm @@ -35,6 +35,7 @@ dd temp_area , 0x0 ; I_Param , I_Icon include 'lang.inc' +; Language support for locales: ru_RU (CP866), en_US, de_DE. include '..\..\..\..\macros.inc' include '..\..\..\..\develop\examples\editbox\trunk\editbox.inc' ;include 'macros.inc' @@ -655,9 +656,9 @@ labelt: db 'MeView v.0.4' lsz buttext,\ - en, ' FILE OPEN INFO BGRD',\ - ru, ' ',\ - de, 'DATEI OEFNEN INFO HGRD' + en_US, ' FILE OPEN INFO BGRD',\ + ru_RU, ' ',\ + de_DE, 'DATEI OEFNEN INFO HGRD' thread1: ; start of thread1 @@ -926,25 +927,25 @@ draw_window2: ; DATA AREA lsz labelt2,\ - en, 'File info',\ - ru, 'ଠ 䠩',\ - de, 'Dateiinfo' + en_US, 'File info',\ + ru_RU, 'ଠ 䠩',\ + de_DE, 'Dateiinfo' lsz fitext,\ - en, 'FILE SIZE ',\ - en, 'X SIZE ',\ - en, 'Y SIZE ',\ - en, 'BITS PER PIXEL',\ + en_US, 'FILE SIZE ',\ + en_US, 'X SIZE ',\ + en_US, 'Y SIZE ',\ + en_US, 'BITS PER PIXEL',\ \ - ru, ' 䠩 ',\ - ru, 'ਭ ',\ - ru, ' ',\ - ru, ' ᥫ ',\ + ru_RU, ' 䠩 ',\ + ru_RU, 'ਭ ',\ + ru_RU, ' ',\ + ru_RU, ' ᥫ ',\ \ - de, 'FATEIGROESSE ',\ - de, 'X GROESSE ',\ - de, 'Y GROESSE ',\ - de, 'BITS PER PIXEL' + de_DE, 'FATEIGROESSE ',\ + de_DE, 'X GROESSE ',\ + de_DE, 'Y GROESSE ',\ + de_DE, 'BITS PER PIXEL' thread3: ; start of bgrd thread @@ -1114,29 +1115,29 @@ wnd_width dd 210 wnd_height dd 53 lsz labelt3,\ - en, 'Background set',\ - ru, "⠭ 䮭",\ - de, 'Hintergrund gesetzt' + en_US, 'Background set',\ + ru_RU, "⠭ 䮭",\ + de_DE, 'Hintergrund gesetzt' lsz bgrdtext,\ - en, 'SET AS BACKGROUND:',\ - ru, ' :',\ - de, 'ALS HINTERGRUND' + en_US, 'SET AS BACKGROUND:',\ + ru_RU, ' :',\ + de_DE, 'ALS HINTERGRUND' lsz tiled,\ - en, 'TILED',\ - ru, '',\ - de, 'GEKACHELT' + en_US, 'TILED',\ + ru_RU, '',\ + de_DE, 'GEKACHELT' lsz stretch,\ - en, 'STRETCH',\ - ru, '',\ - de, 'GESTRECKT' + en_US, 'STRETCH',\ + ru_RU, '',\ + de_DE, 'GESTRECKT' lsz ok_btn,\ - en, 'Ok',\ - ru, 'Ok',\ - de, 'Ok' + en_US, 'Ok',\ + ru_RU, 'Ok',\ + de_DE, 'Ok' image_file dd 0 image_file_1 dd 0 diff --git a/programs/other/outdated/rb/trunk/rb.asm b/programs/other/outdated/rb/trunk/rb.asm index fd76eff39..60db279a7 100644 --- a/programs/other/outdated/rb/trunk/rb.asm +++ b/programs/other/outdated/rb/trunk/rb.asm @@ -1,393 +1,393 @@ -; -; DESKTOP CONTEXT MENU -; written by Ivan Poddubny -; -; - 㡭 -; e-mail: ivan-yar@bk.ru -; -; Compile with flat assembler -; -;------------------------------------------------------------------------------ -; version: 1.1 -; last update: 27/03/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: The program uses only 3404 bytes memory is now. -; Optimisations and code refactoring. -;------------------------------------------------------------------------------ -include 'lang.inc' -include '..\..\..\..\macros.inc' -;------------------------------------------------------------------------------ - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd IM_END ; size of image - dd I_END ; memory for app - dd stack_area ; esp - dd 0 ; boot parameters - dd 0 ; path -;------------------------------------------------------------------------------ -START: -; ⥬ 梥 - mcall 48,3,sc,sizeof.system_colors -; ⠭ ᮡ⨩ - ⮫쪮 - mcall 40,100000b -;------------------------------------------------------------------------------ -align 4 -still: ; 横 ᭮ - mcall 10 ; ᮡ - - mcall 37,2 ; ? - cmp eax,ebx ; ᫨ ࠢ, - jne still -;-------------------------------------- -; ⫠ - ᫨ 窥 (0;0), ஥ -; xor ebx,ebx -; mcall 37 -; test eax,eax ; 窥 (0;0), .. eax = 0 -; je exit -;-------------------------------------- -; न - xor ebx,ebx - mcall 37 - - mov ebx,eax ; eax = cursor_x - shr eax,16 ; ebx = cursor_y - and ebx,0xffff - mov [curx1],eax ; curx1 = cursor_x - mov [cury1],ebx ; cury1 = cursor_y -; ਭ 窠? - mcall 34,[curx1],[cury1] - cmp al,1 ; 1 - - jne still -;-------------------------------------- -align 4 -@@: ; , 짮⥫ ⨫ ࠢ - mcall 37,2 ; ? - test eax,ebx ; ᫨ ⨫, (eax != 2) - jz @f ; 砫 横 - - mcall 68,1 ; ४稬 ᫥騩 ⮪ ⥬ - jmp @b ; 믮 ୥ ⮬ ⮪, ஢ਬ -;-------------------------------------- -align 4 -@@: -; ᫨ 㦥 뫮 , 㦭 , ஥: - cmp [menu_opened],0 - je @f - - mcall 68,1 ; ४稬 ᫥騩 ⮪ ⥬ - ; 䥪⨢ ᯮᮡ প 祬 mcall 5 - jmp @b -;-------------------------------------- -align 4 -@@: -; ⥯ ᬥ ᪠ (⮪) - mcall 51,1,start_wnd,stack_wnd - jmp still -;------------------------------------------------------------------------------ -align 4 -exit_menu: ; ᫨ 室 , [menu_opened] 0 - mov [menu_opened],0 -;-------------------------------------- -align 4 -exit: ;  , 室 ᭮ - or eax,-1 ; eax = -1 - mcall -;------------------------------------------------------------------------------ -; -;------------------------------------------------------------------------------ -align 4 -start_wnd: - mov [menu_opened],1 -; ⠭ ᮡ⨩: + + ᮢ - mcall 40,100101b -;------------------------------------------------------------------------------ -align 4 -red: - call draw_window -;------------------------------------------------------------------------------ -align 4 -still2: ; 横 - mcall 10 ; ᮡ - - cmp eax,1 ; ᮢ? - je red - - cmp eax,3 ; ? - je button - - cmp eax,6 ; ? - je mouse - - jmp still2 ; 砫 横 -;------------------------------------------------------------------------------ -align 4 -; -mouse: ; 짮⥫ , ஥ - mcall 37,2 ; ? - test eax,eax ; ? - ⮣ ४᭮! 横 - jz still2 - - mcall 37,0 - - mov esi, eax - shr esi, 16 - movzx edi, ax - mcall 9, procinfo, -1 - - mov eax, [procinfo.box.left] - cmp esi, eax - jl exit_menu - - add eax, [procinfo.box.width] - cmp esi, eax - jge exit_menu - - mov eax, [procinfo.box.top] - cmp edi, eax - jl exit_menu - - add eax, [procinfo.box.height] - cmp edi, eax - jge exit_menu - - jmp still2 -;------------------------------------------------------------------------------ -align 4 -; -button: - mcall 17 ; 䨪 ⮩ - - sub ah,10 ; ࠢ 10 - jl nofuncbtns ; ᫨ - 뢠 - - movzx ebx,ah ; 稫 ணࠬ ᯨ᪥ ebx - mov esi,[startapps + ebx*4] - mov edi,start_info.path - cld -;-------------------------------------- -align 4 -@@: - lodsb - stosb - test al,al - jnz @b - mcall 70, start_info - -; mov eax,5 ; , ணࠬ -; mov ebx,1 ; 㤥 ᮢ ( ???) -; mcall ; ᪮ ப, ᫨ ஡ - ; ᮢ -;-------------------------------------- -align 4 -nofuncbtns: ; 뢠 - jmp exit_menu -;------------------------------------------------------------------------------ -_BTNS_ = 6 ; ⢮ ("㭪⮢ ") - -if lang eq ru_RU - font = 0x00000000 - string_length = 20 ; ப - wnd_x_size = 133 ; ਭ - title_pos = 36 shl 16 + 7 -else - font = 0x10000000 - string_length = 12 ; ப - wnd_x_size = 105 ; ਭ - title_pos = 23 shl 16 + 7 -end if -;------------------------------------------------------------------------------ -;******************************* -;******** ******** -;******************************* -draw_window: - mcall 12,1 ; 稭 "ᮢ" - - mov eax,[curx1] ; ⥪騥 न - mov [curx],eax ; 襬 न - mov eax,[cury1] - mov [cury],eax -; ⥯ 㤥 न , ⮡ ࠩ ࠭ 뫥 - mcall 14 ; 稬 ࠧ ࠭ - - mov ebx,eax - shr eax,16 ; eax - x_screen - and ebx,0xffff ; ebx - y_screen - add eax,-wnd_x_size ; eax = [x_screen - ਭ ] - add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ] - - cmp eax,[curx] - jg .okx ; ᫨ ᫨誮 ࠢ , - add [curx],-wnd_x_size ; ᤢ 100 -;-------------------------------------- -align 4 -.okx: - cmp ebx, [cury] - jg .oky ; ⨪ 筮 ⠪ - add [cury], -_BTNS_*15-21 -;-------------------------------------- -align 4 -.oky: - xor eax, eax ; 㭪 0 - ᮧ - mov ebx, [curx] ; ebx = [न x] shl 16 + [ਭ] - shl ebx, 16 - add ebx, wnd_x_size - mov ecx, [cury] ; ecx = [न y] shl 16 + [] - shl ecx, 16 - add ecx, _BTNS_*15+21 - mov edx, [sc.work] ; 梥 ࠡ祩 - mov esi, [sc.grab] ; 梥 - or esi, 0x81000000 - mov edi, [sc.frame] ; 梥 ࠬ - mcall - - mov eax, 4 ; - mov ebx, title_pos ; [x] shl 16 + [y] - mov ecx, [sc.grab_text]; 梥 () - or ecx, 0x10000000 - - push ecx - push ecx - xor edx,edx -;-------------------------------------- -align 4 -.dec_color: - sub byte [esp+edx], 0x33 - jae @f - mov byte [esp+edx], 0 -;-------------------------------------- -align 4 -@@: - inc edx - jnp .dec_color - pop ecx - mov edx, title ; - mov esi, title.size ; ("M E N U") - mcall - pop ecx - add ebx, 1 shl 16 ; ᤢ ࠢ 1 - mcall - - mov ebx, 1*65536+wnd_x_size-2 ; 稭 - mov ecx, 20*65536+15 - mov edx, 10 or 0x40000000 ; 30 ⠭ => - - mov edi,_BTNS_ ; ⢮ (稪) -;-------------------------------------- -align 4 -newbtn: ; 砫 横 - mcall 8 ; ᮧ - - ; 襬 ⥪ - pushad ; ᯠᠥ ॣ - shr ecx, 16 - and ebx, 0xffff0000 - add ebx, ecx ; ebx = [x] shl 16 + [y]; - add ebx, 10*65536+4 ; ebx += ᬥ饭 ⭮⥫쭮 ; - mov ecx, [sc.work_text] ; 梥 - or ecx, font - add edx, -10 ; edx = ; - imul edx, string_length ; edx *= ப; - add edx, text ; edx += text; ⥯ edx ப - mov esi, string_length ; esi - ப - mcall 4 - popad - - inc edx ; ++; - add ecx,15*65536 ; 㢥稬 ᬥ饭 y - dec edi ; 㬥訬 稪 - jnz newbtn ; ᫨ , ਬ ࠧ - - mcall 12,2 ; 稫 "ᮢ" - ret ; -;------------------------------------------------------------------------------ -align 4 -; - - macro strtbl name, [string] - { - common - label name dword - forward - local str - dd str - forward - str db string - } - - strtbl startapps ,\ - <"/sys/PIC4",0> ,\ - <"/sys/DESKTOP",0> ,\ - <"/sys/ICON",0>,\ - <"/sys/SETUP",0> ,\ - <"/sys/DEVELOP/BOARD",0> ,\ - <"/sys/CPU",0> - - sz title, "KolibriOS" - - lsz text,\ - en, 'Background ',\ - en, 'Desktop ',\ - en, 'Icon manager',\ - en, 'Device setup',\ - en, 'Debug board ',\ - en, 'Processes ',\ - \ - ru, ' ',\ - ru, 'ன ',\ - ru, 'ࠢ ',\ - ru, 'ன ன ',\ - ru, ' ⫠ ',\ - ru, ' ',\ - \ - et, 'Taust ',\ - et, 'Tlaud ',\ - et, 'Ikooni hald.',\ - et, 'Seadme hald.',\ - et, 'Silumis aken',\ - et, 'Protsessid ' - -;------------------------------------------------------------------------------ -align 4 -start_info: - .mode dd 7 - dd 0 - .params dd 0 - dd 0 - dd 0 - db 0 - dd start_info.path -;------------------------------------------------------------------------------ -IM_END: -align 4 -; - curx1 dd ? ; न - cury1 dd ? - curx dd ? ; न - cury dd ? - - menu_opened db ? ; ? (1-, 0-) -;------------------------------------------------------------------------------ -align 4 -start_info.path rb 256 -;------------------------------------------------------------------------------ -align 4 -sc system_colors ; ⥬ 梥 -;------------------------------------------------------------------------------ -align 4 -procinfo process_information ; ଠ -;------------------------------------------------------------------------------ -align 4 - rb 512 ; - 墠 1 -stack_wnd: -;------------------------------------------------------------------------------ -align 4 - rb 512 -stack_area: -;------------------------------------------------------------------------------ -I_END: -;------------------------------------------------------------------------------ -; -;------------------------------------------------------------------------------ +; +; DESKTOP CONTEXT MENU +; written by Ivan Poddubny +; +; - 㡭 +; e-mail: ivan-yar@bk.ru +; +; Compile with flat assembler +; +;------------------------------------------------------------------------------ +; version: 1.1 +; last update: 27/03/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: The program uses only 3404 bytes memory is now. +; Optimisations and code refactoring. +;------------------------------------------------------------------------------ +include 'lang.inc' +include '..\..\..\..\macros.inc' +;------------------------------------------------------------------------------ + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd IM_END ; size of image + dd I_END ; memory for app + dd stack_area ; esp + dd 0 ; boot parameters + dd 0 ; path +;------------------------------------------------------------------------------ +START: +; ⥬ 梥 + mcall 48,3,sc,sizeof.system_colors +; ⠭ ᮡ⨩ - ⮫쪮 + mcall 40,100000b +;------------------------------------------------------------------------------ +align 4 +still: ; 横 ᭮ + mcall 10 ; ᮡ + + mcall 37,2 ; ? + cmp eax,ebx ; ᫨ ࠢ, + jne still +;-------------------------------------- +; ⫠ - ᫨ 窥 (0;0), ஥ +; xor ebx,ebx +; mcall 37 +; test eax,eax ; 窥 (0;0), .. eax = 0 +; je exit +;-------------------------------------- +; न + xor ebx,ebx + mcall 37 + + mov ebx,eax ; eax = cursor_x + shr eax,16 ; ebx = cursor_y + and ebx,0xffff + mov [curx1],eax ; curx1 = cursor_x + mov [cury1],ebx ; cury1 = cursor_y +; ਭ 窠? + mcall 34,[curx1],[cury1] + cmp al,1 ; 1 - + jne still +;-------------------------------------- +align 4 +@@: ; , 짮⥫ ⨫ ࠢ + mcall 37,2 ; ? + test eax,ebx ; ᫨ ⨫, (eax != 2) + jz @f ; 砫 横 + + mcall 68,1 ; ४稬 ᫥騩 ⮪ ⥬ + jmp @b ; 믮 ୥ ⮬ ⮪, ஢ਬ +;-------------------------------------- +align 4 +@@: +; ᫨ 㦥 뫮 , 㦭 , ஥: + cmp [menu_opened],0 + je @f + + mcall 68,1 ; ४稬 ᫥騩 ⮪ ⥬ + ; 䥪⨢ ᯮᮡ প 祬 mcall 5 + jmp @b +;-------------------------------------- +align 4 +@@: +; ⥯ ᬥ ᪠ (⮪) + mcall 51,1,start_wnd,stack_wnd + jmp still +;------------------------------------------------------------------------------ +align 4 +exit_menu: ; ᫨ 室 , [menu_opened] 0 + mov [menu_opened],0 +;-------------------------------------- +align 4 +exit: ;  , 室 ᭮ + or eax,-1 ; eax = -1 + mcall +;------------------------------------------------------------------------------ +; +;------------------------------------------------------------------------------ +align 4 +start_wnd: + mov [menu_opened],1 +; ⠭ ᮡ⨩: + + ᮢ + mcall 40,100101b +;------------------------------------------------------------------------------ +align 4 +red: + call draw_window +;------------------------------------------------------------------------------ +align 4 +still2: ; 横 + mcall 10 ; ᮡ + + cmp eax,1 ; ᮢ? + je red + + cmp eax,3 ; ? + je button + + cmp eax,6 ; ? + je mouse + + jmp still2 ; 砫 横 +;------------------------------------------------------------------------------ +align 4 +; +mouse: ; 짮⥫ , ஥ + mcall 37,2 ; ? + test eax,eax ; ? - ⮣ ४᭮! 横 + jz still2 + + mcall 37,0 + + mov esi, eax + shr esi, 16 + movzx edi, ax + mcall 9, procinfo, -1 + + mov eax, [procinfo.box.left] + cmp esi, eax + jl exit_menu + + add eax, [procinfo.box.width] + cmp esi, eax + jge exit_menu + + mov eax, [procinfo.box.top] + cmp edi, eax + jl exit_menu + + add eax, [procinfo.box.height] + cmp edi, eax + jge exit_menu + + jmp still2 +;------------------------------------------------------------------------------ +align 4 +; +button: + mcall 17 ; 䨪 ⮩ + + sub ah,10 ; ࠢ 10 + jl nofuncbtns ; ᫨ - 뢠 + + movzx ebx,ah ; 稫 ணࠬ ᯨ᪥ ebx + mov esi,[startapps + ebx*4] + mov edi,start_info.path + cld +;-------------------------------------- +align 4 +@@: + lodsb + stosb + test al,al + jnz @b + mcall 70, start_info + +; mov eax,5 ; , ணࠬ +; mov ebx,1 ; 㤥 ᮢ ( ???) +; mcall ; ᪮ ப, ᫨ ஡ + ; ᮢ +;-------------------------------------- +align 4 +nofuncbtns: ; 뢠 + jmp exit_menu +;------------------------------------------------------------------------------ +_BTNS_ = 6 ; ⢮ ("㭪⮢ ") + +if lang eq ru_RU + font = 0x00000000 + string_length = 20 ; ப + wnd_x_size = 133 ; ਭ + title_pos = 36 shl 16 + 7 +else + font = 0x10000000 + string_length = 12 ; string length + wnd_x_size = 105 ; window width + title_pos = 23 shl 16 + 7 +end if +;------------------------------------------------------------------------------ +;******************************* +;******** ******** +;******************************* +draw_window: + mcall 12,1 ; 稭 "ᮢ" + + mov eax,[curx1] ; ⥪騥 न + mov [curx],eax ; 襬 न + mov eax,[cury1] + mov [cury],eax +; ⥯ 㤥 न , ⮡ ࠩ ࠭ 뫥 + mcall 14 ; 稬 ࠧ ࠭ + + mov ebx,eax + shr eax,16 ; eax - x_screen + and ebx,0xffff ; ebx - y_screen + add eax,-wnd_x_size ; eax = [x_screen - ਭ ] + add ebx,-_BTNS_*15-21 ; ebx = [y_screen - ] + + cmp eax,[curx] + jg .okx ; ᫨ ᫨誮 ࠢ , + add [curx],-wnd_x_size ; ᤢ 100 +;-------------------------------------- +align 4 +.okx: + cmp ebx, [cury] + jg .oky ; ⨪ 筮 ⠪ + add [cury], -_BTNS_*15-21 +;-------------------------------------- +align 4 +.oky: + xor eax, eax ; 㭪 0 - ᮧ + mov ebx, [curx] ; ebx = [न x] shl 16 + [ਭ] + shl ebx, 16 + add ebx, wnd_x_size + mov ecx, [cury] ; ecx = [न y] shl 16 + [] + shl ecx, 16 + add ecx, _BTNS_*15+21 + mov edx, [sc.work] ; 梥 ࠡ祩 + mov esi, [sc.grab] ; 梥 + or esi, 0x81000000 + mov edi, [sc.frame] ; 梥 ࠬ + mcall + + mov eax, 4 ; + mov ebx, title_pos ; [x] shl 16 + [y] + mov ecx, [sc.grab_text]; 梥 () + or ecx, 0x10000000 + + push ecx + push ecx + xor edx,edx +;-------------------------------------- +align 4 +.dec_color: + sub byte [esp+edx], 0x33 + jae @f + mov byte [esp+edx], 0 +;-------------------------------------- +align 4 +@@: + inc edx + jnp .dec_color + pop ecx + mov edx, title ; + mov esi, title.size ; ("M E N U") + mcall + pop ecx + add ebx, 1 shl 16 ; ᤢ ࠢ 1 + mcall + + mov ebx, 1*65536+wnd_x_size-2 ; 稭 + mov ecx, 20*65536+15 + mov edx, 10 or 0x40000000 ; 30 ⠭ => + + mov edi,_BTNS_ ; ⢮ (稪) +;-------------------------------------- +align 4 +newbtn: ; 砫 横 + mcall 8 ; ᮧ + + ; 襬 ⥪ + pushad ; ᯠᠥ ॣ + shr ecx, 16 + and ebx, 0xffff0000 + add ebx, ecx ; ebx = [x] shl 16 + [y]; + add ebx, 10*65536+4 ; ebx += ᬥ饭 ⭮⥫쭮 ; + mov ecx, [sc.work_text] ; 梥 + or ecx, font + add edx, -10 ; edx = ; + imul edx, string_length ; edx *= ப; + add edx, text ; edx += text; ⥯ edx ப + mov esi, string_length ; esi - ப + mcall 4 + popad + + inc edx ; ++; + add ecx,15*65536 ; 㢥稬 ᬥ饭 y + dec edi ; 㬥訬 稪 + jnz newbtn ; ᫨ , ਬ ࠧ + + mcall 12,2 ; 稫 "ᮢ" + ret ; +;------------------------------------------------------------------------------ +align 4 +; PROGRAM DATA + + macro strtbl name, [string] + { + common + label name dword + forward + local str + dd str + forward + str db string + } + + strtbl startapps ,\ + <"/sys/PIC4",0> ,\ + <"/sys/DESKTOP",0> ,\ + <"/sys/ICON",0>,\ + <"/sys/SETUP",0> ,\ + <"/sys/DEVELOP/BOARD",0> ,\ + <"/sys/CPU",0> + + sz title, "KolibriOS" + + lsz text,\ + en_US, 'Background ',\ + en_US, 'Desktop ',\ + en_US, 'Icon manager',\ + en_US, 'Device setup',\ + en_US, 'Debug board ',\ + en_US, 'Processes ',\ + \ + ru_RU, ' ',\ + ru_RU, 'ன ',\ + ru_RU, 'ࠢ ',\ + ru_RU, 'ன ன ',\ + ru_RU, ' ⫠ ',\ + ru_RU, ' ',\ + \ + et_EE, 'Taust ',\ + et_EE, 'Tlaud ',\ + et_EE, 'Ikooni hald.',\ + et_EE, 'Seadme hald.',\ + et_EE, 'Silumis aken',\ + et_EE, 'Protsessid ' + +;------------------------------------------------------------------------------ +align 4 +start_info: + .mode dd 7 + dd 0 + .params dd 0 + dd 0 + dd 0 + db 0 + dd start_info.path +;------------------------------------------------------------------------------ +IM_END: +align 4 +; + curx1 dd ? ; न + cury1 dd ? + curx dd ? ; न + cury dd ? + + menu_opened db ? ; ? (1-, 0-) +;------------------------------------------------------------------------------ +align 4 +start_info.path rb 256 +;------------------------------------------------------------------------------ +align 4 +sc system_colors ; ⥬ 梥 +;------------------------------------------------------------------------------ +align 4 +procinfo process_information ; ଠ +;------------------------------------------------------------------------------ +align 4 + rb 512 ; - 墠 1 +stack_wnd: +;------------------------------------------------------------------------------ +align 4 + rb 512 +stack_area: +;------------------------------------------------------------------------------ +I_END: +;------------------------------------------------------------------------------ +; +;------------------------------------------------------------------------------ diff --git a/programs/other/t_edit/t_data.inc b/programs/other/t_edit/t_data.inc index 4b8b13546..ea7d45425 100644 --- a/programs/other/t_edit/t_data.inc +++ b/programs/other/t_edit/t_data.inc @@ -1 +1,644 @@ -fn_col_option dd def_col_file fn_syntax_dir db 'info/',0 def_col_file db 'default.syn',0 exit_code dd 0 ;६ ᯮ㥬 室 ணࠬ panel_but rb 21 ;ன ⮡ࠦ ;祭 㬮砭, ini 䠩 ini_def_window_t equ 20 ini_def_window_l equ 200 ini_def_window_w equ 570 ini_def_window_h equ 470 ini_def_symbol_w equ 7 ini_def_symbol_h equ 10 ini_def_font_s equ 0 ini_def_scroll_type equ 0 ;ᠭ ࠬ஢ ini 䠩 ini_name db 't_edit.ini',0 ini_sec_window db 'Window',0 key_window_t db 't',0 key_window_l db 'l',0 key_window_w db 'w',0 key_window_h db 'h',0 key_symbol_w db 'symbol_w',0 key_symbol_h db 'symbol_h',0 key_font_s db 'font_s',0 key_scroll_type db 'scroll_type',0 key_but_new db 'but_new',0 key_but_open db 'but_open',0 key_but_save db 'but_save',0 key_but_save_as db 'but_save_as',0 key_but_select db 'but_select',0 key_but_cut db 'but_cut',0 key_but_copy db 'but_copy',0 key_but_paste db 'but_paste',0 key_but_find db 'but_find',0 key_but_replace db 'but_replace',0 key_but_key_words db 'but_key_words',0 key_but_upper db 'but_upper',0 key_but_lower db 'but_lower',0 key_but_reverse db 'but_reverse',0 key_but_undo db 'but_undo',0 key_but_redo db 'but_redo',0 key_but_invisible db 'but_invisible',0 key_but_syntax_list db 'but_syntax_list',0 key_but_syntax_mode db 'but_syntax_mode',0 key_but_convert_1251_866 db 'but_convert_1251_866',0 key_but_convert_866_1251 db 'but_convert_866_1251',0 ini_sec_options db 'Options',0 key_synt_file: db 'syntax_' .numb: db '0',0 key_synt_ext: db 'ext_' .numb: db '0',0 ini_def_synt_f db 0 align 4 max_synt_auto_open equ 10 synt_auto_open: rb 64*max_synt_auto_open db 0 system_dir_0 db '/sys/lib/' lib_name_0 db 'box_lib.obj',0 system_dir_1 db '/sys/lib/' lib_name_1 db 'msgbox.obj',0 system_dir_2 db '/sys/lib/' lib_name_2 db 'proc_lib.obj',0 system_dir_3 db '/sys/lib/' lib_name_3 db 'libimg.obj',0 system_dir_4 db '/sys/lib/' lib_name_4 db 'libini.obj',0 system_dir_5 db '/sys/lib/' lib_name_5 db 'kmenu.obj',0 ;--------------------------------------------------------------------- align 4 import_box_lib: dd alib_init0 ;㭪 ᪠ ᮬ 1 ࠧ 祭 ⥪, ⮬ ணࠬ ⪠ 㦭 edit_box_draw dd aEdit_box_draw edit_box_key dd aEdit_box_key edit_box_mouse dd aEdit_box_mouse ;edit_box_set_text dd aEdit_box_set_text ;version_ed dd aVersion_ed init_checkbox dd ainit_checkbox check_box_draw dd acheck_box_draw check_box_mouse dd acheck_box_mouse option_box_draw dd aOption_box_draw option_box_mouse dd aOption_box_mouse ;version_op dd aVersion_op scrollbar_ver_draw dd aScrollbar_ver_draw scrollbar_ver_mouse dd aScrollbar_ver_mouse scrollbar_hor_draw dd aScrollbar_hor_draw scrollbar_hor_mouse dd aScrollbar_hor_mouse ;version_scrollbar dd aVersion_scrollbar tl_data_init dd sz_tl_data_init tl_data_clear dd sz_tl_data_clear tl_info_clear dd sz_tl_info_clear tl_key dd sz_tl_key tl_mouse dd sz_tl_mouse tl_draw dd sz_tl_draw tl_info_undo dd sz_tl_info_undo tl_info_redo dd sz_tl_info_redo tl_node_add dd sz_tl_node_add tl_node_set_data dd sz_tl_node_set_data tl_node_get_data dd sz_tl_node_get_data tl_node_delete dd sz_tl_node_delete tl_cur_beg dd sz_tl_cur_beg tl_cur_next dd sz_tl_cur_next tl_cur_perv dd sz_tl_cur_perv ;tl_node_close_open dd sz_tl_node_close_open tl_node_lev_inc dd sz_tl_node_lev_inc tl_node_lev_dec dd sz_tl_node_lev_dec ted_but_sumb_upper dd sz_ted_but_sumb_upper ted_but_sumb_lover dd sz_ted_but_sumb_lover ted_but_convert_by_table dd sz_ted_but_convert_by_table ted_can_save dd sz_ted_can_save ted_clear dd sz_ted_clear ted_delete dd sz_ted_delete ted_draw dd sz_ted_draw ted_init dd sz_ted_init ted_init_scroll_bars dd sz_ted_init_scroll_bars ted_init_syntax_file dd sz_ted_init_syntax_file ted_is_select dd sz_ted_is_select ted_key dd sz_ted_key ted_mouse dd sz_ted_mouse ted_open_file dd sz_ted_open_file ted_save_file dd sz_ted_save_file ted_text_add dd sz_ted_text_add ted_but_select_word dd sz_ted_but_select_word ted_but_cut dd sz_ted_but_cut ted_but_copy dd sz_ted_but_copy ted_but_paste dd sz_ted_but_paste ted_but_undo dd sz_ted_but_undo ted_but_redo dd sz_ted_but_redo ted_but_reverse dd sz_ted_but_reverse ted_but_find dd sz_ted_but_find ted_but_replace dd sz_ted_but_replace ted_text_colored dd sz_ted_text_colored ted_go_to_position dd sz_ted_go_to_position version_text_edit dd sz_ted_version dd 0,0 alib_init0 db 'lib_init',0 aEdit_box_draw db 'edit_box_draw',0 aEdit_box_key db 'edit_box_key',0 aEdit_box_mouse db 'edit_box_mouse',0 ;aEdit_box_set_text db 'edit_box_set_text',0 ;aVersion_ed db 'version_ed',0 ainit_checkbox db 'init_checkbox2',0 acheck_box_draw db 'check_box_draw2',0 acheck_box_mouse db 'check_box_mouse2',0 aOption_box_draw db 'option_box_draw',0 aOption_box_mouse db 'option_box_mouse',0 ;aVersion_op db 'version_op',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0 aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 aScrollbar_hor_draw db 'scrollbar_h_draw',0 aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 ;aVersion_scrollbar db 'version_scrollbar',0 sz_tl_data_init db 'tl_data_init',0 sz_tl_data_clear db 'tl_data_clear',0 sz_tl_info_clear db 'tl_info_clear',0 sz_tl_key db 'tl_key',0 sz_tl_mouse db 'tl_mouse',0 sz_tl_draw db 'tl_draw',0 sz_tl_info_undo db 'tl_info_undo',0 sz_tl_info_redo db 'tl_info_redo',0 sz_tl_node_add db 'tl_node_add',0 sz_tl_node_set_data db 'tl_node_set_data',0 sz_tl_node_get_data db 'tl_node_get_data',0 sz_tl_node_delete db 'tl_node_delete',0 sz_tl_cur_beg db 'tl_cur_beg',0 sz_tl_cur_next db 'tl_cur_next',0 sz_tl_cur_perv db 'tl_cur_perv',0 ;sz_tl_node_close_open db 'tl_node_close_open',0 sz_tl_node_lev_inc db 'tl_node_lev_inc',0 sz_tl_node_lev_dec db 'tl_node_lev_dec',0 sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0 sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0 sz_ted_but_convert_by_table db 'ted_but_convert_by_table',0 sz_ted_can_save db 'ted_can_save',0 sz_ted_clear db 'ted_clear',0 sz_ted_delete db 'ted_delete',0 sz_ted_draw db 'ted_draw',0 sz_ted_init db 'ted_init',0 sz_ted_init_scroll_bars db 'ted_init_scroll_bars',0 sz_ted_init_syntax_file db 'ted_init_syntax_file',0 sz_ted_is_select db 'ted_is_select',0 sz_ted_key db 'ted_key',0 sz_ted_mouse db 'ted_mouse',0 sz_ted_open_file db 'ted_open_file',0 sz_ted_save_file db 'ted_save_file',0 sz_ted_text_add db 'ted_text_add',0 sz_ted_but_select_word db 'ted_but_select_word',0 sz_ted_but_cut db 'ted_but_cut',0 sz_ted_but_copy db 'ted_but_copy',0 sz_ted_but_paste db 'ted_but_paste',0 sz_ted_but_undo db 'ted_but_undo',0 sz_ted_but_redo db 'ted_but_redo',0 sz_ted_but_reverse db 'ted_but_reverse',0 sz_ted_but_find db 'ted_but_find',0 sz_ted_but_replace db 'ted_but_replace',0 sz_ted_text_colored db 'ted_text_colored',0 sz_ted_go_to_position db 'ted_go_to_position',0 sz_ted_version db 'version_text_edit',0 align 4 import_proclib: OpenDialog_Init dd aOpenDialog_Init OpenDialog_Start dd aOpenDialog_Start dd 0,0 aOpenDialog_Init db 'OpenDialog_init',0 aOpenDialog_Start db 'OpenDialog_start',0 align 4 import_msgbox_lib: mb_create dd amb_create mb_reinit dd amb_reinit mb_setfunctions dd amb_setfunctions dd 0,0 amb_create db 'mb_create',0 amb_reinit db 'mb_reinit',0 amb_setfunctions db 'mb_setfunctions',0 align 4 import_libimg: dd alib_init1 img_to_rgb2 dd aimg_to_rgb2 img_decode dd aimg_decode img_destroy dd aimg_destroy dd 0,0 alib_init1 db 'lib_init',0 aimg_to_rgb2 db 'img_to_rgb2',0 aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ aimg_destroy db 'img_destroy',0 align 4 import_libini: dd alib_init2 ini_get_str dd aini_get_str ini_get_int dd aini_get_int ini_get_color dd aini_get_color dd 0,0 alib_init2 db 'lib_init',0 aini_get_str db 'ini_get_str',0 aini_get_int db 'ini_get_int',0 aini_get_color db 'ini_get_color',0 align 4 import_libkmenu: kmenu_init dd akmenu_init kmainmenu_draw dd akmainmenu_draw kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent ksubmenu_new dd aksubmenu_new ksubmenu_delete dd aksubmenu_delete ksubmenu_draw dd aksubmenu_draw ksubmenu_add dd aksubmenu_add kmenuitem_new dd akmenuitem_new kmenuitem_delete dd akmenuitem_delete kmenuitem_draw dd akmenuitem_draw dd 0,0 akmenu_init db 'kmenu_init',0 akmainmenu_draw db 'kmainmenu_draw',0 akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 aksubmenu_new db 'ksubmenu_new',0 aksubmenu_delete db 'ksubmenu_delete',0 aksubmenu_draw db 'ksubmenu_draw',0 aksubmenu_add db 'ksubmenu_add',0 akmenuitem_new db 'kmenuitem_new',0 akmenuitem_delete db 'kmenuitem_delete',0 akmenuitem_draw db 'kmenuitem_draw',0 ;--------------------------------------------------------------------- align 4 wScr scrollbar 16,50, 300,50, 15, 100,30,0, 0,0,0, 1 align 4 hScr scrollbar 150,0, 16,50, 15, 100,30,0, 0,0,0, 1 ;୨ ஫ ListBox align 4 ws_dir_lbox scrollbar 16,0, 30,70, 15, 100,30,0, 0,0,0, 1 ;--------------------------------------------------------------------- align 4 OpenDialog_data: .type dd 0 .procinfo dd procinfo ;+4 .com_area_name dd communication_area_name ;+8 .com_area dd 0 ;+12 .opendir_path dd plugin_path ;+16 .dir_default_path dd default_dir ;+20 .start_path dd file_name ;+24 䠩 .draw_window dd draw_window ;+28 .status dd 0 ;+32 .openfile_path dd openfile_path ;+36 뢠 䠩 .filename_area dd filename_area ;+40 뢠 䠩 .filter_area dd Filter .x: .x_size dw 420 ;+48 ; Window X size .x_start dw 10 ;+50 ; Window X position .y: .y_size dw 320 ;+52 ; Window y size .y_start dw 10 ;+54 ; Window Y position default_dir db '/sys',0 ;४ 㬮砭 communication_area_name: db 'FFFFFFFF_open_dialog',0 open_dialog_name: db 'opendial',0 communication_area_default_path: db '/sys/File managers/',0 Filter: dd Filter.end - Filter.1 .1: db 'ASM',0 db 'CPP',0 db 'INC',0 db 'MAC',0 db 'INI',0 db 'TXT',0 db 'H',0 db 'C',0 db 'HTM',0 db 'HTML',0 db 'PY',0 db 'SH',0 db 'BAT',0 db 'LUA',0 db 'INF',0 db 'LOG',0 db 'DBG',0 db 'DAT',0 .end: db 0 txt_Info db '" -tI',0 TED_PANEL_NULL equ 0 ; ⮩ TED_PANEL_FIND equ 1 ; ᪠ TED_PANEL_REPLACE equ 2 ; TED_PANEL_SYNTAX equ 3 ; 롮 䠩 ᢥ⪨ TED_PANEL_GOTO equ 4 ; 室 TED_PANEL_WIDTH equ 150 ;ਭ count_of_dir_list_files equ 15 ;ᨬ쭮 ᫮ 䠩 ᨭ⠪ 뢠 tree1 ;------------------------------------------------------------------------------ struct TexSelect x0 dd ? y0 dd ? x1 dd ? y1 dd ? ends ;------------------------------------------------------------------------------ align 4 tedit0: ; ⥪⮢ । .wnd BOX 0,50,440,150 ;+ 0 .rec BOX 30,25,ini_def_symbol_w,ini_def_symbol_h ;+16 .drag_m db 0 ;+32 뤥 .drag_k db 0 ;+33 뤥 .sel TexSelect 0,0,0,0 ;+34 뤥 .seln TexSelect ;+50 ⥫쭠 뤥 .tex dd 0 ;+66 text memory pointer .tex_1 dd 0 ;+70 text first symbol pointer .tex_end dd 0 ;+74 text end memory pointer .cur_x dd 0 ;+78 न x .cur_y dd 0 ;+82 न y .max_chars dd maxChars ;+86 ᨬ쭮 ᫮ ᨬ 㬥 .count_colors_text dd 1 ;+90 ⢮ 梥⮢ ⥪ .count_key_words dd 0 ;+94 ⢮ 祢 ᫮ .color_cursor dd 0x808080 ;+98 梥 .color_wnd_capt dd 0x80 ;+102 梥 .color_wnd_work dd 0x0 ;+106 梥 䮭 .color_wnd_bord dd 0xd0d0d0 ;+110 梥 ⥪ .color_select dd 0x208080 ;+114 梥 뤥 .color_cur_text dd 0xff0000 ;+118 梥 ᨬ ஬ .color_wnd_text dd 0xffff00 ;+122 梥 ⥪ .syntax_file dd 0 ;+126 㪠⥫ 砫 䠩 ᨭ⠪ .syntax_file_size dd maxSyntaxFileSize ;+130 ᨬ ࠧ 䠩 ᨭ⠪ .text_colors dd 0 ;+134 㪠⥫ ᨢ 梥⮢ ⥪ .help_text_f1 dd 0 ;+138 㪠⥫ ⥪ ࠢ ( ⨨ F1) .help_id dd -1 ;+142 䨪 ࠢ .key_words_data dd 0 ;+146 㪠⥫ 祢 ᫮ TexColViv .tim_ch dd ? ;+150 ⢮ 䠩 .tim_undo dd ? ;+154 ⢮ ⬥ ⢨ .tim_ls dd ? ;+158 ६ ᫥ ࠭ .tim_co dd ? ;+162 ६ ᫥ 梥⮢ ࠧ⪨ .el_focus dd el_focus ;+166 㪠⥫ ६ 䮪 .err_save db 0 ;+170 訡 ࠭ 䠩 .panel_id db 0 ;+171 ⮩ .key_new db 0 ;+172 ᨬ, 㤥 .symbol_new_line db 20 ;+173 ᨬ 襭 ப .scr_w dd wScr ;+174 ⨪ ஫ .scr_h dd hScr ;+178 ਧ⠫ ஫ .arr_key_pos dd 0 ;+182 㪠⥫ ᨢ 権 祢 ᫮ .buffer dd buf ;+186 㪠⥫ ஢/⠢ .buffer_find dd buf_find ;+190 㪠⥫ ᪠ .cur_ins db 1 ;+194 ० ࠡ ( ) .mode_color db 1 ;+195 ० 뤥 ᫮ 梥⮬ (0-몫. 1-.) .mode_invis db 0 ;+196 ० ⠥ ᨬ .gp_opt db 0 ;+197 樨 頥 㭪樥 ted_get_pos_by_cursor .fun_on_key_ctrl_all dd ted_but_ctrl_all ;+198 㪠⥫ 㭪 뢠 ⨨ Ctrl+N,O,S,F,H,G dd 0,0,0 ;१ࢨ஢ .buffer_size dd BUF_SIZE ;+214 ࠧ ஢/⠢ .fun_find_err dd ted_on_find_err ;+218 㪠⥫ 㭪 뢠 ᫨ 稫 㤠筮 .fun_init_synt_err dd 0 ;+222 .fun_draw_panel_buttons dd draw_but_toolbar ;+226 㪠⥫ 㭪 ᮢ .fun_draw_panels dd draw_panels ;+230 㪠⥫ 㭪 ᮢ ᪠/ dd 0 ;+234 १ࢨ஢ .fun_save_err dd ted_save_err_msg ;+238 㪠⥫ 㭪 뢠 ᫨ ࠭ 䠩 稫 㤠筮 .increase_size dd 200 ;+242 ᫮ ᨬ 㤥 㢥稢 墠⪥ .ptr_free_symb dd ? ;+246 ᯮ ᪮७ ⠢ ⥪ .font_size dd 0 ;+250 ⥫ ࠧ ;------------------------------------------------------------------------------ conv_tabl rb 128 ; ⠡ ஢ scan- ascii- el_focus dd tedit0 mouse_dd dd 0 tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\ 16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TED_PANEL_WIDTH-17,120, 0,0,0, el_focus,\ ws_dir_lbox,0 ;dir_list memory tree_file_struct: dd 1,0,0,count_of_dir_list_files dd dir_mem db 0 .f: dd file_name align 4 opt_gr1 dd opt1 opt_grlist1 dd opt1,opt2,opt3,0 ;end option group opt1 option_box opt_gr1, 5, 90,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_next,txt_f_opt_next.end-txt_f_opt_next opt2 option_box opt_gr1, 5,108,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_perv,txt_f_opt_perv.end-txt_f_opt_perv opt3 option_box opt_gr1, 5,126,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_beg,txt_f_opt_beg.end-txt_f_opt_beg check_boxes: ch1 check_box2 (5 shl 16+12),(144 shl 16 +12),5,0xffffff,0,0x80ff,ch_text.1,ch_flag_en+ch_flag_middle check_boxes_end: if lang eq ru_RU msgbox_1: db '"',13,10,' : ' .z: rb 10 msgbox_2: db 3,0 db '',0 db '࠭ 䠩?',0 db '࠭',0 db ' ࠭',0 db '⬥',0 db 0 msgbox_3: db 1,0 db '',0 db '訡 ⨨ 䠩 梥⮢묨 ன!',13,\ '⮬ 뤥 ᫮ 梥⮬ .',13,\ ' ( 訡 =' .err: db '?' db ')',0 db '',0 db 0 msgbox_4: db 1,0 db '',0 db '訡 ⨨ 䠩!',13,\ ' 䠩 ࠢ쭮.',13,\ ' ( 訡 =' .err: db '?' db ')',0 db '',0 db 0 msgbox_6: db 1,0 db '',0 db '訡 ࠭ 䠩!',13,\ ' 䠩 ࠢ쭮.',13,\ ' ( 訡 =' .err: db '?' db ')',0 db '',0 db 0 msgbox_7: db '" ',13,10 db '஡ ." -tI',0 msgbox_9: db 3,0 db '',0 db ' ',39,' 䠩',39,'.',13 .fdp: rb 100 db 0 db '',0 db 0 txtFindCapt db ':',0 txtFindNext db ' ',0 txtRerlaceCapt db ' :',0 txtRerlace db '',0 txtRerlaceAll db ' ',0 txtFormatCapt db 'ଠ',0 txtFormatApply db 'ਬ',0 txtReplace db '',0 txtReplaceAll db ' ',0 txtGotoCapt db '室 ப:',0 txtGoto db '३',0 txt_f_opt_next: db '' .end: db 0 txt_f_opt_perv: db '' .end: db 0 txt_f_opt_beg: db ' 砫' .end: db 0 ch_text: .1 db '뢠 ॣ',0 else msgbox_1: db '"Replace',13,10,'Made replacements: ' .z: rb 10 msgbox_2: db 3,0 db 'Warning',0 db 'Save changes to the file?',0 db 'Save',0 db 'Discard',0 db 'Cancel',0 db 0 msgbox_3: db 1,0 db 'Warning',0 db 'Error opening the file with the color settings!',13,\ 'Because color selection of words is not possible.',13,\ ' (error code =' .err: db '?' db ')',0 db 'Close',0 db 0 msgbox_4: db 1,0 db 'Warning',0 db 'Error opening file!',13,\ 'Maybe the file name is not entered correctly.',13,\ ' (error code =' .err: db '?' db ')',0 db 'Close',0 db 0 msgbox_6: db 1,0 db 'Warning',0 db 'Error saving file!',13,\ 'Maybe the file name is not entered correctly.',13,\ ' (error code =' .err: db '?' db ')',0 db 'Close',0 db 0 msgbox_7: db '"Text not found.',13,10 db 'Try change the query and search again." -tI',0 msgbox_9: db 3,0 db 'Warning',0 db 'Error run ',39,'open file dialog',39,'.',13 .fdp: rb 100 db 0 db 'Close',0 db 0 txtFindCapt db 'Search:',0 txtFindNext db 'Find next',0 txtRerlaceCapt db 'Replace with:',0 txtRerlace db 'Replace',0 txtRerlaceAll db 'Replace all',0 txtFormatCapt db 'Format',0 txtFormatApply db 'Apply',0 txtReplace db 'Replace',0 txtReplaceAll db 'Replace all',0 txtGotoCapt db 'Go to line:',0 txtGoto db 'Go to',0 txt_f_opt_next: db 'Down' .end: db 0 txt_f_opt_perv: db 'Up' .end: db 0 txt_f_opt_beg: db 'At first' .end: db 0 ch_text: .1 db 'Case sensitive',0 end if ;㭪樨 ᮮ饭 msgbox_2N_funct: dd On_SaveAndNewFile dd On_NewFile dd 0 msgbox_2O_funct: dd On_SaveAndOpenFile dd ted_but_open_file.no_msg dd 0 msgbox_2E_funct: dd On_SaveAndExit dd On_Exit dd 0 KM_SHIFT equ 0x00010000 KM_CTRL equ 0x00020000 KM_ALT equ 0x00040000 KM_NUMLOCK equ 0x00080000 ; KEY CODES KEY_F1 equ 0x0000003B KEY_F2 equ 0x0000003C KEY_F3 equ 0x0000003D +fn_col_option dd def_col_file +fn_syntax_dir db 'info/',0 +def_col_file db 'default.syn',0 + +exit_code dd 0 ;६ ᯮ㥬 室 ணࠬ +panel_but rb 21 ;ன ⮡ࠦ + +;祭 㬮砭, ini 䠩 +ini_def_window_t equ 20 +ini_def_window_l equ 200 +ini_def_window_w equ 570 +ini_def_window_h equ 470 +ini_def_symbol_w equ 7 +ini_def_symbol_h equ 10 +ini_def_font_s equ 0 +ini_def_scroll_type equ 0 +;ᠭ ࠬ஢ ini 䠩 +ini_name db 't_edit.ini',0 +ini_sec_window db 'Window',0 +key_window_t db 't',0 +key_window_l db 'l',0 +key_window_w db 'w',0 +key_window_h db 'h',0 +key_symbol_w db 'symbol_w',0 +key_symbol_h db 'symbol_h',0 +key_font_s db 'font_s',0 +key_scroll_type db 'scroll_type',0 +key_but_new db 'but_new',0 +key_but_open db 'but_open',0 +key_but_save db 'but_save',0 +key_but_save_as db 'but_save_as',0 +key_but_select db 'but_select',0 +key_but_cut db 'but_cut',0 +key_but_copy db 'but_copy',0 +key_but_paste db 'but_paste',0 +key_but_find db 'but_find',0 +key_but_replace db 'but_replace',0 +key_but_key_words db 'but_key_words',0 +key_but_upper db 'but_upper',0 +key_but_lower db 'but_lower',0 +key_but_reverse db 'but_reverse',0 +key_but_undo db 'but_undo',0 +key_but_redo db 'but_redo',0 +key_but_invisible db 'but_invisible',0 +key_but_syntax_list db 'but_syntax_list',0 +key_but_syntax_mode db 'but_syntax_mode',0 +key_but_convert_1251_866 db 'but_convert_1251_866',0 +key_but_convert_866_1251 db 'but_convert_866_1251',0 +ini_sec_options db 'Options',0 +key_synt_file: + db 'syntax_' + .numb: db '0',0 +key_synt_ext: + db 'ext_' + .numb: db '0',0 +ini_def_synt_f db 0 + +align 4 +max_synt_auto_open equ 10 +synt_auto_open: + rb 64*max_synt_auto_open + db 0 + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'box_lib.obj',0 + +system_dir_1 db '/sys/lib/' +lib_name_1 db 'msgbox.obj',0 + +system_dir_2 db '/sys/lib/' +lib_name_2 db 'proc_lib.obj',0 + +system_dir_3 db '/sys/lib/' +lib_name_3 db 'libimg.obj',0 + +system_dir_4 db '/sys/lib/' +lib_name_4 db 'libini.obj',0 + +system_dir_5 db '/sys/lib/' +lib_name_5 db 'kmenu.obj',0 + + +;--------------------------------------------------------------------- +align 4 +import_box_lib: + dd alib_init0 ;㭪 ᪠ ᮬ 1 ࠧ 祭 ⥪, ⮬ ணࠬ ⪠ 㦭 + + edit_box_draw dd aEdit_box_draw + edit_box_key dd aEdit_box_key + edit_box_mouse dd aEdit_box_mouse + ;edit_box_set_text dd aEdit_box_set_text + ;version_ed dd aVersion_ed + + init_checkbox dd ainit_checkbox + check_box_draw dd acheck_box_draw + check_box_mouse dd acheck_box_mouse + + option_box_draw dd aOption_box_draw + option_box_mouse dd aOption_box_mouse + ;version_op dd aVersion_op + + scrollbar_ver_draw dd aScrollbar_ver_draw + scrollbar_ver_mouse dd aScrollbar_ver_mouse + scrollbar_hor_draw dd aScrollbar_hor_draw + scrollbar_hor_mouse dd aScrollbar_hor_mouse + ;version_scrollbar dd aVersion_scrollbar + + tl_data_init dd sz_tl_data_init + tl_data_clear dd sz_tl_data_clear + tl_info_clear dd sz_tl_info_clear + tl_key dd sz_tl_key + tl_mouse dd sz_tl_mouse + tl_draw dd sz_tl_draw + tl_info_undo dd sz_tl_info_undo + tl_info_redo dd sz_tl_info_redo + tl_node_add dd sz_tl_node_add + tl_node_set_data dd sz_tl_node_set_data + tl_node_get_data dd sz_tl_node_get_data + tl_node_delete dd sz_tl_node_delete + tl_cur_beg dd sz_tl_cur_beg + tl_cur_next dd sz_tl_cur_next + tl_cur_perv dd sz_tl_cur_perv + ;tl_node_close_open dd sz_tl_node_close_open + tl_node_lev_inc dd sz_tl_node_lev_inc + tl_node_lev_dec dd sz_tl_node_lev_dec + + ted_but_sumb_upper dd sz_ted_but_sumb_upper + ted_but_sumb_lover dd sz_ted_but_sumb_lover + ted_but_convert_by_table dd sz_ted_but_convert_by_table + ted_can_save dd sz_ted_can_save + ted_clear dd sz_ted_clear + ted_delete dd sz_ted_delete + ted_draw dd sz_ted_draw + ted_init dd sz_ted_init + ted_init_scroll_bars dd sz_ted_init_scroll_bars + ted_init_syntax_file dd sz_ted_init_syntax_file + ted_is_select dd sz_ted_is_select + ted_key dd sz_ted_key + ted_mouse dd sz_ted_mouse + ted_open_file dd sz_ted_open_file + ted_save_file dd sz_ted_save_file + ted_text_add dd sz_ted_text_add + ted_but_select_word dd sz_ted_but_select_word + ted_but_cut dd sz_ted_but_cut + ted_but_copy dd sz_ted_but_copy + ted_but_paste dd sz_ted_but_paste + ted_but_undo dd sz_ted_but_undo + ted_but_redo dd sz_ted_but_redo + ted_but_reverse dd sz_ted_but_reverse + ted_but_find dd sz_ted_but_find + ted_but_replace dd sz_ted_but_replace + ted_text_colored dd sz_ted_text_colored + ted_go_to_position dd sz_ted_go_to_position + version_text_edit dd sz_ted_version + +dd 0,0 + alib_init0 db 'lib_init',0 + + aEdit_box_draw db 'edit_box_draw',0 + aEdit_box_key db 'edit_box_key',0 + aEdit_box_mouse db 'edit_box_mouse',0 + ;aEdit_box_set_text db 'edit_box_set_text',0 + ;aVersion_ed db 'version_ed',0 + + ainit_checkbox db 'init_checkbox2',0 + acheck_box_draw db 'check_box_draw2',0 + acheck_box_mouse db 'check_box_mouse2',0 + + aOption_box_draw db 'option_box_draw',0 + aOption_box_mouse db 'option_box_mouse',0 + ;aVersion_op db 'version_op',0 + + aScrollbar_ver_draw db 'scrollbar_v_draw',0 + aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 + aScrollbar_hor_draw db 'scrollbar_h_draw',0 + aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 + ;aVersion_scrollbar db 'version_scrollbar',0 + + sz_tl_data_init db 'tl_data_init',0 + sz_tl_data_clear db 'tl_data_clear',0 + sz_tl_info_clear db 'tl_info_clear',0 + sz_tl_key db 'tl_key',0 + sz_tl_mouse db 'tl_mouse',0 + sz_tl_draw db 'tl_draw',0 + sz_tl_info_undo db 'tl_info_undo',0 + sz_tl_info_redo db 'tl_info_redo',0 + sz_tl_node_add db 'tl_node_add',0 + sz_tl_node_set_data db 'tl_node_set_data',0 + sz_tl_node_get_data db 'tl_node_get_data',0 + sz_tl_node_delete db 'tl_node_delete',0 + sz_tl_cur_beg db 'tl_cur_beg',0 + sz_tl_cur_next db 'tl_cur_next',0 + sz_tl_cur_perv db 'tl_cur_perv',0 + ;sz_tl_node_close_open db 'tl_node_close_open',0 + sz_tl_node_lev_inc db 'tl_node_lev_inc',0 + sz_tl_node_lev_dec db 'tl_node_lev_dec',0 + + sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0 + sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0 + sz_ted_but_convert_by_table db 'ted_but_convert_by_table',0 + sz_ted_can_save db 'ted_can_save',0 + sz_ted_clear db 'ted_clear',0 + sz_ted_delete db 'ted_delete',0 + sz_ted_draw db 'ted_draw',0 + sz_ted_init db 'ted_init',0 + sz_ted_init_scroll_bars db 'ted_init_scroll_bars',0 + sz_ted_init_syntax_file db 'ted_init_syntax_file',0 + sz_ted_is_select db 'ted_is_select',0 + sz_ted_key db 'ted_key',0 + sz_ted_mouse db 'ted_mouse',0 + sz_ted_open_file db 'ted_open_file',0 + sz_ted_save_file db 'ted_save_file',0 + sz_ted_text_add db 'ted_text_add',0 + sz_ted_but_select_word db 'ted_but_select_word',0 + sz_ted_but_cut db 'ted_but_cut',0 + sz_ted_but_copy db 'ted_but_copy',0 + sz_ted_but_paste db 'ted_but_paste',0 + sz_ted_but_undo db 'ted_but_undo',0 + sz_ted_but_redo db 'ted_but_redo',0 + sz_ted_but_reverse db 'ted_but_reverse',0 + sz_ted_but_find db 'ted_but_find',0 + sz_ted_but_replace db 'ted_but_replace',0 + sz_ted_text_colored db 'ted_text_colored',0 + sz_ted_go_to_position db 'ted_go_to_position',0 + sz_ted_version db 'version_text_edit',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +align 4 +import_msgbox_lib: + mb_create dd amb_create + mb_reinit dd amb_reinit + mb_setfunctions dd amb_setfunctions +dd 0,0 + amb_create db 'mb_create',0 + amb_reinit db 'mb_reinit',0 + amb_setfunctions db 'mb_setfunctions',0 + +align 4 +import_libimg: + dd alib_init1 + img_to_rgb2 dd aimg_to_rgb2 + img_decode dd aimg_decode + img_destroy dd aimg_destroy +dd 0,0 + alib_init1 db 'lib_init',0 + aimg_to_rgb2 db 'img_to_rgb2',0 + aimg_decode db 'img_decode',0 ;⮬᪨ । ଠ ᪨ + aimg_destroy db 'img_destroy',0 + +align 4 +import_libini: + dd alib_init2 + ini_get_str dd aini_get_str + ini_get_int dd aini_get_int + ini_get_color dd aini_get_color +dd 0,0 + alib_init2 db 'lib_init',0 + aini_get_str db 'ini_get_str',0 + aini_get_int db 'ini_get_int',0 + aini_get_color db 'ini_get_color',0 + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +;--------------------------------------------------------------------- +align 4 +wScr scrollbar 16,50, 300,50, 15, 100,30,0, 0,0,0, 1 + +align 4 +hScr scrollbar 150,0, 16,50, 15, 100,30,0, 0,0,0, 1 + +;୨ ஫ ListBox +align 4 +ws_dir_lbox scrollbar 16,0, 30,70, 15, 100,30,0, 0,0,0, 1 + +;--------------------------------------------------------------------- +align 4 +OpenDialog_data: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 䠩 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 뢠 䠩 +.filename_area dd filename_area ;+40 뢠 䠩 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 ;४ 㬮砭 + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_name: + db 'opendial',0 +communication_area_default_path: + db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +db 'ASM',0 +db 'CPP',0 +db 'INC',0 +db 'MAC',0 +db 'INI',0 +db 'TXT',0 +db 'H',0 +db 'C',0 +db 'HTM',0 +db 'HTML',0 +db 'PY',0 +db 'SH',0 +db 'BAT',0 +db 'LUA',0 +db 'INF',0 +db 'LOG',0 +db 'DBG',0 +db 'DAT',0 +.end: +db 0 + +txt_Info db '" -tI',0 + +TED_PANEL_NULL equ 0 ; ⮩ +TED_PANEL_FIND equ 1 ; ᪠ +TED_PANEL_REPLACE equ 2 ; +TED_PANEL_SYNTAX equ 3 ; 롮 䠩 ᢥ⪨ +TED_PANEL_GOTO equ 4 ; 室 +TED_PANEL_WIDTH equ 150 ;ਭ + +count_of_dir_list_files equ 15 ;ᨬ쭮 ᫮ 䠩 ᨭ⠪ 뢠 tree1 + +;------------------------------------------------------------------------------ +struct TexSelect + x0 dd ? + y0 dd ? + x1 dd ? + y1 dd ? +ends +;------------------------------------------------------------------------------ +align 4 +tedit0: ; ⥪⮢ । + .wnd BOX 0,50,440,150 ;+ 0 + .rec BOX 30,25,ini_def_symbol_w,ini_def_symbol_h ;+16 + .drag_m db 0 ;+32 뤥 + .drag_k db 0 ;+33 뤥 + .sel TexSelect 0,0,0,0 ;+34 뤥 + .seln TexSelect ;+50 ⥫쭠 뤥 + .tex dd 0 ;+66 text memory pointer + .tex_1 dd 0 ;+70 text first symbol pointer + .tex_end dd 0 ;+74 text end memory pointer + .cur_x dd 0 ;+78 न x + .cur_y dd 0 ;+82 न y + .max_chars dd maxChars ;+86 ᨬ쭮 ᫮ ᨬ 㬥 + .count_colors_text dd 1 ;+90 ⢮ 梥⮢ ⥪ + .count_key_words dd 0 ;+94 ⢮ 祢 ᫮ + .color_cursor dd 0x808080 ;+98 梥 + .color_wnd_capt dd 0x80 ;+102 梥 + .color_wnd_work dd 0x0 ;+106 梥 䮭 + .color_wnd_bord dd 0xd0d0d0 ;+110 梥 ⥪ + .color_select dd 0x208080 ;+114 梥 뤥 + .color_cur_text dd 0xff0000 ;+118 梥 ᨬ ஬ + .color_wnd_text dd 0xffff00 ;+122 梥 ⥪ + .syntax_file dd 0 ;+126 㪠⥫ 砫 䠩 ᨭ⠪ + .syntax_file_size dd maxSyntaxFileSize ;+130 ᨬ ࠧ 䠩 ᨭ⠪ + .text_colors dd 0 ;+134 㪠⥫ ᨢ 梥⮢ ⥪ + .help_text_f1 dd 0 ;+138 㪠⥫ ⥪ ࠢ ( ⨨ F1) + .help_id dd -1 ;+142 䨪 ࠢ + .key_words_data dd 0 ;+146 㪠⥫ 祢 ᫮ TexColViv + .tim_ch dd ? ;+150 ⢮ 䠩 + .tim_undo dd ? ;+154 ⢮ ⬥ ⢨ + .tim_ls dd ? ;+158 ६ ᫥ ࠭ + .tim_co dd ? ;+162 ६ ᫥ 梥⮢ ࠧ⪨ + .el_focus dd el_focus ;+166 㪠⥫ ६ 䮪 + .err_save db 0 ;+170 訡 ࠭ 䠩 + .panel_id db 0 ;+171 ⮩ + .key_new db 0 ;+172 ᨬ, 㤥 + .symbol_new_line db 20 ;+173 ᨬ 襭 ப + .scr_w dd wScr ;+174 ⨪ ஫ + .scr_h dd hScr ;+178 ਧ⠫ ஫ + .arr_key_pos dd 0 ;+182 㪠⥫ ᨢ 権 祢 ᫮ + .buffer dd buf ;+186 㪠⥫ ஢/⠢ + .buffer_find dd buf_find ;+190 㪠⥫ ᪠ + .cur_ins db 1 ;+194 ० ࠡ ( ) + .mode_color db 1 ;+195 ० 뤥 ᫮ 梥⮬ (0-몫. 1-.) + .mode_invis db 0 ;+196 ० ⠥ ᨬ + .gp_opt db 0 ;+197 樨 頥 㭪樥 ted_get_pos_by_cursor + .fun_on_key_ctrl_all dd ted_but_ctrl_all ;+198 㪠⥫ 㭪 뢠 ⨨ Ctrl+N,O,S,F,H,G + dd 0,0,0 ;१ࢨ஢ + .buffer_size dd BUF_SIZE ;+214 ࠧ ஢/⠢ + .fun_find_err dd ted_on_find_err ;+218 㪠⥫ 㭪 뢠 ᫨ 稫 㤠筮 + .fun_init_synt_err dd 0 ;+222 + .fun_draw_panel_buttons dd draw_but_toolbar ;+226 㪠⥫ 㭪 ᮢ + .fun_draw_panels dd draw_panels ;+230 㪠⥫ 㭪 ᮢ ᪠/ + dd 0 ;+234 १ࢨ஢ + .fun_save_err dd ted_save_err_msg ;+238 㪠⥫ 㭪 뢠 ᫨ ࠭ 䠩 稫 㤠筮 + .increase_size dd 200 ;+242 ᫮ ᨬ 㤥 㢥稢 墠⪥ + .ptr_free_symb dd ? ;+246 ᯮ ᪮७ ⠢ ⥪ + .font_size dd 0 ;+250 ⥫ ࠧ +;------------------------------------------------------------------------------ + +conv_tabl rb 128 ; ⠡ ஢ scan- ascii- + +el_focus dd tedit0 +mouse_dd dd 0 +tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\ + 16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TED_PANEL_WIDTH-17,120, 0,0,0, el_focus,\ + ws_dir_lbox,0 + +;dir_list memory +tree_file_struct: + dd 1,0,0,count_of_dir_list_files + dd dir_mem + db 0 +.f: dd file_name + +align 4 +opt_gr1 dd opt1 +opt_grlist1 dd opt1,opt2,opt3,0 ;end option group + +opt1 option_box opt_gr1, 5, 90,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_next,txt_f_opt_next.end-txt_f_opt_next +opt2 option_box opt_gr1, 5,108,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_perv,txt_f_opt_perv.end-txt_f_opt_perv +opt3 option_box opt_gr1, 5,126,6,12,0xd0d0ff, 0xff, 0x80ff,txt_f_opt_beg,txt_f_opt_beg.end-txt_f_opt_beg + +check_boxes: +ch1 check_box2 (5 shl 16+12),(144 shl 16 +12),5,0xffffff,0,0x80ff,ch_text.1,ch_flag_en+ch_flag_middle +check_boxes_end: + + + +if lang eq ru_RU + +msgbox_1: + db '"',13,10,' : ' +.z: rb 10 +msgbox_2: + db 3,0 + db '',0 + db '࠭ 䠩?',0 + db '࠭',0 + db ' ࠭',0 + db '⬥',0 + db 0 +msgbox_3: + db 1,0 + db '',0 + db '訡 ⨨ 䠩 梥⮢묨 ன!',13,\ + '⮬ 뤥 ᫮ 梥⮬ .',13,\ + ' ( 訡 =' + .err: db '?' + db ')',0 + db '',0 + db 0 +msgbox_4: + db 1,0 + db '',0 + db '訡 ⨨ 䠩!',13,\ + ' 䠩 ࠢ쭮.',13,\ + ' ( 訡 =' + .err: db '?' + db ')',0 + db '',0 + db 0 +msgbox_6: + db 1,0 + db '',0 + db '訡 ࠭ 䠩!',13,\ + ' 䠩 ࠢ쭮.',13,\ + ' ( 訡 =' + .err: db '?' + db ')',0 + db '',0 + db 0 +msgbox_7: + db '" ',13,10 + db '஡ ." -tI',0 +msgbox_9: + db 3,0 + db '',0 + db ' ',39,' 䠩',39,'.',13 + .fdp: + rb 100 + db 0 + db '',0 + db 0 + +txtFindCapt db ':',0 +txtFindNext db ' ',0 +txtRerlaceCapt db ' :',0 +txtRerlace db '',0 +txtRerlaceAll db ' ',0 +txtFormatCapt db 'ଠ',0 +txtFormatApply db 'ਬ',0 +txtReplace db '',0 +txtReplaceAll db ' ',0 +txtGotoCapt db '室 ப:',0 +txtGoto db '३',0 +txt_f_opt_next: db '' +.end: db 0 +txt_f_opt_perv: db '' +.end: db 0 +txt_f_opt_beg: db ' 砫' +.end: db 0 +ch_text: +.1 db '뢠 ॣ',0 + +else ; Default to en_US + +msgbox_1: + db '"Replace',13,10,'Made replacements: ' +.z: rb 10 +msgbox_2: + db 3,0 + db 'Warning',0 + db 'Save changes to the file?',0 + db 'Save',0 + db 'Discard',0 + db 'Cancel',0 + db 0 +msgbox_3: + db 1,0 + db 'Warning',0 + db 'Error opening the file with the color settings!',13,\ + 'Because color selection of words is not possible.',13,\ + ' (error code =' + .err: db '?' + db ')',0 + db 'Close',0 + db 0 +msgbox_4: + db 1,0 + db 'Warning',0 + db 'Error opening file!',13,\ + 'Maybe the file name is not entered correctly.',13,\ + ' (error code =' + .err: db '?' + db ')',0 + db 'Close',0 + db 0 +msgbox_6: + db 1,0 + db 'Warning',0 + db 'Error saving file!',13,\ + 'Maybe the file name is not entered correctly.',13,\ + ' (error code =' + .err: db '?' + db ')',0 + db 'Close',0 + db 0 +msgbox_7: + db '"Text not found.',13,10 + db 'Try change the query and search again." -tI',0 +msgbox_9: + db 3,0 + db 'Warning',0 + db 'Error run ',39,'open file dialog',39,'.',13 + .fdp: + rb 100 + db 0 + db 'Close',0 + db 0 + +txtFindCapt db 'Search:',0 +txtFindNext db 'Find next',0 +txtRerlaceCapt db 'Replace with:',0 +txtRerlace db 'Replace',0 +txtRerlaceAll db 'Replace all',0 +txtFormatCapt db 'Format',0 +txtFormatApply db 'Apply',0 +txtReplace db 'Replace',0 +txtReplaceAll db 'Replace all',0 +txtGotoCapt db 'Go to line:',0 +txtGoto db 'Go to',0 +txt_f_opt_next: db 'Down' +.end: db 0 +txt_f_opt_perv: db 'Up' +.end: db 0 +txt_f_opt_beg: db 'At first' +.end: db 0 +ch_text: +.1 db 'Case sensitive',0 + +end if + +;㭪樨 ᮮ饭 +msgbox_2N_funct: + dd On_SaveAndNewFile + dd On_NewFile + dd 0 +msgbox_2O_funct: + dd On_SaveAndOpenFile + dd ted_but_open_file.no_msg + dd 0 +msgbox_2E_funct: + dd On_SaveAndExit + dd On_Exit + dd 0 + +KM_SHIFT equ 0x00010000 +KM_CTRL equ 0x00020000 +KM_ALT equ 0x00040000 +KM_NUMLOCK equ 0x00080000 + +; KEY CODES +KEY_F1 equ 0x0000003B +KEY_F2 equ 0x0000003C +KEY_F3 equ 0x0000003D diff --git a/programs/other/t_edit/wnd_k_words.inc b/programs/other/t_edit/wnd_k_words.inc index 1426eda97..ec81f04e4 100644 --- a/programs/other/t_edit/wnd_k_words.inc +++ b/programs/other/t_edit/wnd_k_words.inc @@ -1,209 +1,211 @@ -; -; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ -; ࠡ ᪮ 祢 ᫮ -; - -prop_wnd_width equ 350 ;ਭ ᪮ -SIZE_ONE_FLOAT equ 14 - -IMAGE_TOOLBAR_ICON_SIZE equ 20*20*3 - -wnd_k_words_run dd 0 ;६ ᫥ ⥬ - ᪠ 1- ६ - -if lang eq ru_RU -txt_caption db ' 祢 ᫮',0 -else -txt_caption db 'Search in keywords',0 -end if - -; () 뢠 㭪樥 but_wnd_coords -align 4 -prop_start: -pushad - mcall SF_SET_EVENTS_MASK,0xC0000027 ;᪠ ᮡ⨩ - - ;ன ᯨ᪠ ꥪ⮢ - mov dword[tree3.info_max_count],2 - mov edi,tedit0 - mov edx,ted_key_words_count - add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祢 ᫮ 䠩 ᢥ⪨ (+2 砫 ᯨ᪠) - stdcall [tl_data_init], tree3 - mov eax,dword[icon_tl_sys] - mov dword[tree3.data_img],eax - mov eax,dword[tree1.data_img_sys] - mov dword[tree3.data_img_sys],eax - - edit_boxes_set_sys_color edit3,editboxes_end,sc ;⠭ ⥬ 梥⮢ -popad - -align 4 -prop_red_win: -pushad - mcall SF_REDRAW,SSF_BEGIN_DRAW - - mov bx,word[procinfo.box.left] - add bx,5 ;word[buf_0.l] - shl ebx,16 - mov bx,prop_wnd_width - mov cx,word[procinfo.box.top] - add cx,42 ;word[buf_0.t] - shl ecx,16 - mov cx,250 - mcall SF_CREATE_WINDOW,,,0x33ffffd0,,txt_caption - - mcall SF_DEFINE_BUTTON,(5 shl 16)+19,(5 shl 16)+19,3,[sc.work_button] - add ebx,(25 shl 16) - mcall ,,,4 - - mov ebx,[bmp_icon] - add ebx,(ID_BUT_FIND-ID_BUT_0)*IMAGE_TOOLBAR_ICON_SIZE - mcall SF_PUT_IMAGE,,(20 shl 16)+20,(5 shl 16)+5 ; - - sub ebx,2*IMAGE_TOOLBAR_ICON_SIZE - mov edx,(30 shl 16)+5 ;஢ - int 0x40 - - mcall SF_THREAD_INFO,procinfo,-1 - mov eax,[procinfo.box.height] - cmp eax,90 - jge @f - mov eax,90 ;min size - @@: - sub eax,58 - cmp [tree3.box_height],eax - je @f - mov [tree3.box_height],eax - mov word[w_scr_t3.y_size],ax - ;need call tb_scrol_resize - @@: - - mov dword[w_scr_t3.all_redraw],1 - stdcall [scrollbar_ver_draw], w_scr_t3 - stdcall [tl_draw], tree3 - stdcall [edit_box_draw], edit3 - mcall SF_REDRAW,SSF_END_DRAW -popad - -; 뢠 㭪 ।饩 -align 4 -prop_still: - mcall SF_WAIT_EVENT - - cmp al,1 ;. - jz prop_red_win - cmp al,2 - jne @f - call prop_key - @@: - cmp al,3 - jne @f - call prop_button - @@: - cmp al,6 - jne @f - call prop_mouse - @@: - jmp prop_still -.exit: - mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 - mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 - stdcall [tl_data_clear], tree3 - mov dword[wnd_k_words_run],0 ;塞 ID - mcall SF_TERMINATE_PROCESS - -align 4 -prop_key: -push eax - mcall SF_GET_KEY - stdcall [edit_box_key], edit3 - stdcall [tl_key], tree3 -pop eax - ret - -align 4 -prop_mouse: - ;push ecx edi - stdcall [tl_mouse], tree3 - stdcall [edit_box_mouse], edit3 - ;pop edi ecx - ret - -align 4 -prop_button: - pushad - mcall SF_GET_BUTTON - - cmp ah,1 - je prop_still.exit - - cmp ah,3 - jne @f - ; ᫮ - mov edi,tedit0 - cmp ted_syntax_file,0 - je @f - stdcall [tl_info_clear], tree3 - and dword[tree3.style], not tl_cursor_pos_limited - - mov ebx,ted_key_words_data - mov ecx,ted_key_words_count - cld - .cycle_0: - stdcall str_instr, ebx,[edit3.text] - test al,al - jnz .end_add - ;祢 ᫮ - stdcall [tl_node_add], tree3, (1 shl 16), ebx - stdcall [tl_cur_next], tree3 - mov edx,[ebx+MAX_COLOR_WORD_LEN] - or edx,edx - jz .end_add - ;ࠢ 祢 ᫮ - add edx,ted_help_text_f1 - stdcall [tl_node_add], tree3, 1, edx - stdcall [tl_cur_next], tree3 - .end_add: - add ebx,MAX_COLOR_WORD_LEN+8 ;sizeof.TexColViv - loop .cycle_0 - - stdcall [tl_cur_beg], tree3 - or dword[tree3.style], tl_cursor_pos_limited ;࠭稢 । ᯨ᪠ - stdcall [tl_draw], tree3 - jmp .no_select_0 - @@: - cmp ah,4 - jne @f - ;஢ - stdcall [tl_node_get_data],tree3 - or eax,eax - jz .no_select_0 - mov esi,eax - mov edi,[tedit0.buffer] - mov dword[edi],MAX_COLOR_WORD_LEN - mov dword[edi+4],0 ;text data - mov dword[edi+8],1 ;code 866 - add edi,12 ;system buffer header size - mov byte[edi+MAX_COLOR_WORD_LEN],0 - mov ecx,MAX_COLOR_WORD_LEN - cld - rep movsb - mcall SF_CLIPBOARD,SSF_WRITE_CB,12+MAX_COLOR_WORD_LEN,[tedit0.buffer] - .no_select_0: - @@: - - popad - ret - -;ॢ ꥪ⠬ 짮⥫᪮ 䠩 -align 4 -tree3 tree_list MAX_COLOR_WORD_LEN,3,tl_key_no_edit,\ - 16,16, 0x8080ff,0x0000ff,0xffffff, 5,30,300,160, 16, 0,0, el_focus, w_scr_t3,0 - -align 4 -edit3 edit_box 80, 70, 8, 0xffffff, 0xff, 0x80ff, 0, 0x8000, MAX_COLOR_WORD_LEN+2, string1, mouse_dd, ed_focus -editboxes_end: - -string1 rb MAX_COLOR_WORD_LEN - -align 4 -w_scr_t3 scrollbar 16,0, 3,0, 15, 100, 0,0, 0xeeeeee, 0xbbddff, 0, 1 +; +; ⮬ 䠩 ᮡ࠭ 㭪樨 㦭 ᮧ +; ࠡ ᪮ 祢 ᫮ +; + +; Language support for locales: ru_RU (CP866), en_US. + +prop_wnd_width equ 350 ;ਭ ᪮ +SIZE_ONE_FLOAT equ 14 + +IMAGE_TOOLBAR_ICON_SIZE equ 20*20*3 + +wnd_k_words_run dd 0 ;६ ᫥ ⥬ - ᪠ 1- ६ + +if lang eq ru_RU +txt_caption db ' 祢 ᫮',0 +else ; Default to en_US +txt_caption db 'Search in keywords',0 +end if + +; () 뢠 㭪樥 but_wnd_coords +align 4 +prop_start: +pushad + mcall SF_SET_EVENTS_MASK,0xC0000027 ;᪠ ᮡ⨩ + + ;ன ᯨ᪠ ꥪ⮢ + mov dword[tree3.info_max_count],2 + mov edi,tedit0 + mov edx,ted_key_words_count + add dword[tree3.info_max_count],edx ;⠢ ᫮ 㧫, ࠢ 祢 ᫮ 䠩 ᢥ⪨ (+2 砫 ᯨ᪠) + stdcall [tl_data_init], tree3 + mov eax,dword[icon_tl_sys] + mov dword[tree3.data_img],eax + mov eax,dword[tree1.data_img_sys] + mov dword[tree3.data_img_sys],eax + + edit_boxes_set_sys_color edit3,editboxes_end,sc ;⠭ ⥬ 梥⮢ +popad + +align 4 +prop_red_win: +pushad + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mov bx,word[procinfo.box.left] + add bx,5 ;word[buf_0.l] + shl ebx,16 + mov bx,prop_wnd_width + mov cx,word[procinfo.box.top] + add cx,42 ;word[buf_0.t] + shl ecx,16 + mov cx,250 + mcall SF_CREATE_WINDOW,,,0x33ffffd0,,txt_caption + + mcall SF_DEFINE_BUTTON,(5 shl 16)+19,(5 shl 16)+19,3,[sc.work_button] + add ebx,(25 shl 16) + mcall ,,,4 + + mov ebx,[bmp_icon] + add ebx,(ID_BUT_FIND-ID_BUT_0)*IMAGE_TOOLBAR_ICON_SIZE + mcall SF_PUT_IMAGE,,(20 shl 16)+20,(5 shl 16)+5 ; + + sub ebx,2*IMAGE_TOOLBAR_ICON_SIZE + mov edx,(30 shl 16)+5 ;஢ + int 0x40 + + mcall SF_THREAD_INFO,procinfo,-1 + mov eax,[procinfo.box.height] + cmp eax,90 + jge @f + mov eax,90 ;min size + @@: + sub eax,58 + cmp [tree3.box_height],eax + je @f + mov [tree3.box_height],eax + mov word[w_scr_t3.y_size],ax + ;need call tb_scrol_resize + @@: + + mov dword[w_scr_t3.all_redraw],1 + stdcall [scrollbar_ver_draw], w_scr_t3 + stdcall [tl_draw], tree3 + stdcall [edit_box_draw], edit3 + mcall SF_REDRAW,SSF_END_DRAW +popad + +; 뢠 㭪 ।饩 +align 4 +prop_still: + mcall SF_WAIT_EVENT + + cmp al,1 ;. + jz prop_red_win + cmp al,2 + jne @f + call prop_key + @@: + cmp al,3 + jne @f + call prop_button + @@: + cmp al,6 + jne @f + call prop_mouse + @@: + jmp prop_still +.exit: + mov dword[tree3.data_img],0 ;⨬ 㪠⥫ - 㤠 + mov dword[tree3.data_img_sys],0 ;. . ᯮ 㣨 + stdcall [tl_data_clear], tree3 + mov dword[wnd_k_words_run],0 ;塞 ID + mcall SF_TERMINATE_PROCESS + +align 4 +prop_key: +push eax + mcall SF_GET_KEY + stdcall [edit_box_key], edit3 + stdcall [tl_key], tree3 +pop eax + ret + +align 4 +prop_mouse: + ;push ecx edi + stdcall [tl_mouse], tree3 + stdcall [edit_box_mouse], edit3 + ;pop edi ecx + ret + +align 4 +prop_button: + pushad + mcall SF_GET_BUTTON + + cmp ah,1 + je prop_still.exit + + cmp ah,3 + jne @f + ; ᫮ + mov edi,tedit0 + cmp ted_syntax_file,0 + je @f + stdcall [tl_info_clear], tree3 + and dword[tree3.style], not tl_cursor_pos_limited + + mov ebx,ted_key_words_data + mov ecx,ted_key_words_count + cld + .cycle_0: + stdcall str_instr, ebx,[edit3.text] + test al,al + jnz .end_add + ;祢 ᫮ + stdcall [tl_node_add], tree3, (1 shl 16), ebx + stdcall [tl_cur_next], tree3 + mov edx,[ebx+MAX_COLOR_WORD_LEN] + or edx,edx + jz .end_add + ;ࠢ 祢 ᫮ + add edx,ted_help_text_f1 + stdcall [tl_node_add], tree3, 1, edx + stdcall [tl_cur_next], tree3 + .end_add: + add ebx,MAX_COLOR_WORD_LEN+8 ;sizeof.TexColViv + loop .cycle_0 + + stdcall [tl_cur_beg], tree3 + or dword[tree3.style], tl_cursor_pos_limited ;࠭稢 । ᯨ᪠ + stdcall [tl_draw], tree3 + jmp .no_select_0 + @@: + cmp ah,4 + jne @f + ;஢ + stdcall [tl_node_get_data],tree3 + or eax,eax + jz .no_select_0 + mov esi,eax + mov edi,[tedit0.buffer] + mov dword[edi],MAX_COLOR_WORD_LEN + mov dword[edi+4],0 ;text data + mov dword[edi+8],1 ;code 866 + add edi,12 ;system buffer header size + mov byte[edi+MAX_COLOR_WORD_LEN],0 + mov ecx,MAX_COLOR_WORD_LEN + cld + rep movsb + mcall SF_CLIPBOARD,SSF_WRITE_CB,12+MAX_COLOR_WORD_LEN,[tedit0.buffer] + .no_select_0: + @@: + + popad + ret + +;ॢ ꥪ⠬ 짮⥫᪮ 䠩 +align 4 +tree3 tree_list MAX_COLOR_WORD_LEN,3,tl_key_no_edit,\ + 16,16, 0x8080ff,0x0000ff,0xffffff, 5,30,300,160, 16, 0,0, el_focus, w_scr_t3,0 + +align 4 +edit3 edit_box 80, 70, 8, 0xffffff, 0xff, 0x80ff, 0, 0x8000, MAX_COLOR_WORD_LEN+2, string1, mouse_dd, ed_focus +editboxes_end: + +string1 rb MAX_COLOR_WORD_LEN + +align 4 +w_scr_t3 scrollbar 16,0, 3,0, 15, 100, 0,0, 0xeeeeee, 0xbbddff, 0, 1 diff --git a/programs/system/MyKey/trunk/MyKey.asm b/programs/system/MyKey/trunk/MyKey.asm index baee823c8..809c091cb 100644 --- a/programs/system/MyKey/trunk/MyKey.asm +++ b/programs/system/MyKey/trunk/MyKey.asm @@ -1,1080 +1,1075 @@ -; -; MyKey. Version 0.2. -; -; Author: Asper -; Date of issue: 29.12.2009 -; Compiler: FASM -; Target: KolibriOS -; - -use32 - org 0x0 - - db 'MENUET01' ; 8 byte id - dd 38 ; required os - dd STARTAPP ; program start - dd I_END ; program image size - dd 0x1000000 ; required amount of memory - dd 0x1000000 ; stack heap - dd 0x0 - dd app_path - -include 'lang.inc' ;language support - -include 'string.inc' -;include 'macros.inc' -include '../../../macros.inc' -include 'ASPAPI.INC' -;include 'editbox_ex.mac' -include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -;include 'load_lib.mac' -include '../../../develop/libraries/box_lib/load_lib.mac' -include '../../../dll.inc' - -include 'debug.inc' -DEBUG equ 0;1 - -N_KEYCOLOR equ 0x00EEEEEE ; Normal button color -C_KEYCOLOR equ 0x00CBE1E1 ; Control button color -A_KEYCOLOR equ 0x00FF6400;258778 ; Active button color -C_TEXTCOLOR equ 0x80000000 ; Button caption color -CA_TEXTCOLOR equ 0x80FFFFFF ; Active button caption color -A_TEXTCOLOR equ 0x00FFFFFF ; Active text color - -WIN_X equ 265 -WIN_Y equ 50;175 -WIN_W equ 595 -WIN_H equ 415 ;570 -WIN_COLOR equ 0x040099BB;0x04EEEEEE - -ITEM_BUTTON_W equ 192;100 -ITEM_BUTTON_H equ 23 -ITEM_BUTTON_SPACE equ 0 -FIRST_ITEM_BUTTON_ID equ 7 - -BUT_W equ 80 -BUT_H equ 20 - -MAX_HOTKEYS_NUM equ 15 ; Bad bounding :/. Until we have normal listbox control. -PATH_MAX_CHARS equ 255 - -@use_library - -STARTAPP: - ; Initialize memory - mcall 68, 11 - or eax,eax - jz close_app - ; Import libraries - sys_load_library boxlib_name, sys_path, boxlib_name, system_dir0, err_message_found_lib, head_f_l, myimport,err_message_import, head_f_i - cmp eax,-1 - jz close_app - stdcall dll.Load,importTable - test eax, eax - jnz close_app - - mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS ; Get memory for editboxes text - mov dword [buf_cmd_line], eax - mov dword [edit1.text], eax - mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS - mov dword [buf_cmd_params], eax - mov dword [edit2.text], eax - mcall 68, 12, MAX_HOTKEYS_NUM*32 - mov dword [it_buf_cmd_line], eax - mov dword [it_edit.text], eax - - call Load_HotkeyList - - mcall 66, 1, 1 ; Set keyboard mode to get scancodes. - mcall 26, 2, 1, ascii_keymap - -get_mykey_window_slot_number: - call draw_window - mcall 18, 7 - mov [mykey_window], eax - -set_event_mask: - mcall 40, 0xC0000027 - -red: - .test_slot: - mcall 18, 7 - mov ebx, [mykey_window] - cmp eax, ebx - jne @f - - mov ecx, [it_window] - cmp ebx, ecx - je @f - .activate_it_window: - mov al, byte [it_alive] - test al, al - jz @f - mov byte [it_alive], 0 - - mcall 18, 3 ; Activate input thread window - @@: - call draw_window - -still: - call reset_modifiers - - mcall 10 ; Wait for an event in the queue. - - cmp al,1 ; redraw request ? - jz red - cmp al,2 ; key in buffer ? - jz key - cmp al,3 ; button in buffer ? - jz button - cmp al,6 - jz mouse - - jmp still - -key: - mcall 2 - - push eax - mcall 66, 3 - ;mov edx, eax - ;and edx, 0x00000FF;F - mov dword [modifiers], eax;edx - pop eax - - test word [edit1.flags], 10b - jnz .editbox_input - test word [edit2.flags], 10b - jz @f - .editbox_input: - cmp ah, 0x80 ;if key up - ja still - cmp ah, 42 ;LShift - je still - cmp ah, 54 ;RShift - je still - cmp ah, 56 ;Alt - je still - cmp ah, 29 ;Ctrl - je still - cmp ah, 69 ;Pause/Break - je still - - mov esi, ascii_keymap - call Scan2ASCII - - push dword edit1 - call [edit_box_key] - - push dword edit2 - call [edit_box_key] - jmp still - @@: - - ;------------------------ - mov cl, byte [hotkeys_num] - .test_next_hotkey: - dec cl - mov bl, cl - and ebx, 0xFF - shl ebx, 2;5 -; mov esi, ebx - add ebx, dword Hotkeys.codes - - mov edx, dword [ebx] - cmp ah, dl - jne @f - - shr edx, 8 - cmp edx, dword [modifiers] - jne @f - - push eax - mov eax, PATH_MAX_CHARS - mul cl - mov edx, eax - add edx, dword [buf_cmd_params] - add eax, dword [buf_cmd_line] - mov esi, eax - pop eax - call RunProgram - jmp .end_test - @@: - or cl, cl - jnz .test_next_hotkey - .end_test: - ;------------------------ - - jmp still - -button: - mcall 17 ; Get pressed button code - cmp ah, 1 ; Test x button - je close_app - - cmp ah, 2 - jne @f - call AddHotKey - jmp red - @@: - cmp ah, 5 - jne @f - call Load_HotkeyList - jmp red - @@: - cmp ah, 6 - jne @f - call WriteIni - xor edx, edx - mov esi, aRamSaver - call RunProgram - @@: - - cmp ah, FIRST_ITEM_BUTTON_ID ; Test if pressed buttons - jb still ; is a HotKey button... - mov al, ah - sub al, FIRST_ITEM_BUTTON_ID - cmp al, byte [hotkeys_num] - jnb still ; ...so, if not then still, - - - mov byte [butt], ah ; if yes then save pressed button ID - and eax, 0xFF - mov cl, byte PATH_MAX_CHARS - mul cl - mov ebx, eax - add ebx, dword [buf_cmd_params] - add eax, dword [buf_cmd_line] - - mov dword [edit1.text], eax - mov dword [edit2.text], ebx - - mov esi, eax - call strlen - mov dword [edit1.size], ecx - mov dword [edit1.pos], ecx - - mov esi, ebx - call strlen - mov dword [edit2.size], ecx - mov dword [edit2.pos], ecx - - jmp red - -mouse: - push dword edit1 - call [edit_box_mouse] - push dword edit2 - call [edit_box_mouse] - - jmp still - - -close_app: - mov eax,-1 ; close this program - int 0x40 - - -draw_window: - start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt - - ;bar 5, 24, 585, 385, 0x800000 or 0x90D2 - ;rectangle2 6, 25, 585, 385, 0xFFFFFF, 0 - - ;bar 5, 24, BUT_W+4, 350, 0x008C00D2;0x800000 or A_KEYCOLOR - ;rectangle2 6, 25, BUT_W+4, 350, 0xFFFFFF, 0 - - - push dword edit1 - call [edit_box_draw] - push dword edit2 - call [edit_box_draw] - - stdcall draw_button, 7,WIN_H-BUT_H-10,BUT_W,BUT_H,2,0x0050D250,AddKeyText, 0,C_TEXTCOLOR ; Add Hotkey. - if 0 - stdcall draw_button, 90,WIN_H-BUT_H-10,BUT_W,BUT_H,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR ; Delete Hotkey. - stdcall draw_button, 173,WIN_H-BUT_H-10,BUT_W,BUT_H,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR ; Manage Hotkey. - end if - stdcall draw_button, WIN_W-BUT_W*2-14,WIN_H-BUT_H-10,BUT_W,BUT_H,5,0x0050D250,ReloadKeyText, 0,C_TEXTCOLOR ; Save Hotkeys list. - stdcall draw_button, WIN_W-BUT_W-7,WIN_H-BUT_H-10,BUT_W,BUT_H,6,0x0050D250,SaveKeyText, 0,C_TEXTCOLOR ; Save Hotkeys list. - - movzx ecx, byte [hotkeys_num] - cmp ecx, MAX_HOTKEYS_NUM - jng @f - mov ecx, MAX_HOTKEYS_NUM - @@: - mov eax, 30 - mov ebx, FIRST_ITEM_BUTTON_ID - @@: - or cl, cl - jz @f - - mov edx, ebx - sub edx, FIRST_ITEM_BUTTON_ID - shl edx, 5; edx=edx*32 - add edx, dword Hotkeys - - cmp bl, byte [butt] - jne .l1 - stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,A_KEYCOLOR ,edx,0,CA_TEXTCOLOR - bar 220, 70, 350, 30, 0x00C8E1F0 ;0x800000 or A_KEYCOLOR - rectangle2 221, 71, 350, 30, 0xFFFFFF, 0 - mov esi, Hotkeys.code_names - sub edx, dword Hotkeys - shl edx, 1 - add esi, edx - stdcall outtextxy, 225, 80, esi, 64, C_TEXTCOLOR - jmp .l2 - .l1: - stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR - .l2: - - add eax, ITEM_BUTTON_H+ITEM_BUTTON_SPACE - inc ebx - dec cl - jmp @b - @@: - end_draw_window -ret - - -AddHotKey: - mov al, byte [hotkeys_num] - cmp al, MAX_HOTKEYS_NUM - jge .end - inc al - mov byte [hotkeys_num], al - - mcall 51, 1, dword start_input_thread, dword input_thread_stack_top - .end: -ret - - -Load_HotkeyList: - call ReadIni - - mov al, byte [butt] - and eax, 0xFF - sub al, FIRST_ITEM_BUTTON_ID - mov cl, byte PATH_MAX_CHARS - mul cl - mov ebx, eax - add eax, dword [buf_cmd_line] - add ebx, dword [buf_cmd_params] - - - ;mov [butt], FIRST_ITEM_BUTTON_ID - mov esi, eax - call strlen - mov dword [edit1.size], ecx - mov dword [edit1.pos], ecx - - mov esi, ebx - call strlen - mov dword [edit2.size], ecx - mov dword [edit2.pos], ecx -ret - - -reset_modifiers: - pusha - mov esi, dword [it_hotkey_addr] - test esi, esi - jz .end_set_mods - - lodsd - - ; Set new hotkey for the main thread - mov cl, al - shr eax, 8 - - xor edx, edx - push cx - mov cl, 3 - .next_pair: - shl edx, 4 - mov bl, al - and bl, 3 - - or bl, bl - jz .l1 - - cmp bl, 3 ; both? - jne @f - or dl, 2 - jmp .l1 - @@: - add bl, 2 - or dl, bl - .l1: - shr eax, 2 - dec cl - test cl, cl - jnz .next_pair - - mov bx, dx - and bx, 0xF0F - xchg bl, bh - and dx, 0x0F0 - or dx, bx - pop cx - - mcall 66, 4 - mov dword [it_hotkey_addr], 0 - .end_set_mods: - popa -ret - - -;######################## Input Thread code start ########################## - -start_input_thread: - mov ecx, 1 ; to get scancodes. - mcall 26, 2, 1, it_ascii_keymap - mcall 66, 1 ; Set keyboard mode - mov dword [it_hotkey_addr], 0 -it_set_editbox: - mov al, byte [hotkeys_num] - sub al, 1 - and eax, 0xFF - shl eax, 5 - add eax, dword Hotkeys.names - mov dword [it_edit.text], eax - - mov esi, eax - call strlen - mov dword [it_edit.size], ecx - mov dword [it_edit.pos], ecx -get_it_window_slot_number: - call it_draw_window - mcall 18, 7 - mov [it_window], eax - -it_set_event_mask: - mcall 40, 39 -it_red: - call it_draw_window - -it_still: - mcall 10 ; Wait for an event in the queue. - - cmp al,1 ; redraw request ? - jz it_red - cmp al,2 ; key in buffer ? - jz it_key - cmp al,3 ; button in buffer ? - jz it_button - cmp al,6 - jz it_mouse - - jmp it_still - -it_key: - mcall 2 - - mov byte [it_keycode], 0 - stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0 - - cmp ah, 1 ;Esc - jne @f - dec byte [hotkeys_num] - jmp close_app - @@: - - cmp ah, 0x80 ;if key up - ja .end - cmp ah, 42 ;[Shift] (left) - je .end - cmp ah, 54 ;[Shift] (right) - je .end - cmp ah, 56 ;[Alt] - je .end - cmp ah, 29 ;[Ctrl] - je .end - cmp ah, 69 ;[Pause Break] - je .end - - mov byte [it_keycode], ah - mov esi, it_ascii_keymap - call Scan2ASCII - - test word [it_edit.flags], 10b - jz .end - push dword it_edit - call [edit_box_key] - jmp it_still - .end: - - mcall 26, 2, 1, it_ascii_keymap - call it_test_key_modifiers - test dl, 3 - jz @f - push edx - mcall 26, 2, 2, it_ascii_keymap - pop edx - @@: - - mov al, byte [it_keycode] - test al, al - jz @f - shl edx, 8 - mov dl, al - - mov eax, dword [it_hotkey_addr] - test eax, eax - jnz @f - - call it_set_keycode_name - - mov al, byte [hotkeys_num] - dec al - and eax, 0xFF - shl eax, 2;5 - add eax, dword Hotkeys.codes - mov dword [eax], edx - mov dword [it_hotkey_addr], eax - - mov cl, dl ; finally set hotkey - shr edx, 8 - mcall 66, 4 - @@: - - jmp it_still - - -it_test_key_modifiers: - push eax - mcall 66, 3 ;get control keys state - mov edx, eax - ;and edx, 0x00000FFF - .lshift: - test al, 1 ; LShift ? - jz .rshift - stdcall outtextxy, 10, 100, ctrl_key_names, 6, A_TEXTCOLOR - .rshift: - test al, 2 ; RShift ? - jz .lctrl - stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, A_TEXTCOLOR - .lctrl: - test al, 4 ; LCtrl ? - jz .rctrl - stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, A_TEXTCOLOR - .rctrl: - test al, 8 ; RCtrl ? - jz .lalt - stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, A_TEXTCOLOR - .lalt: - test al, 0x10 ; LAlt ? - jz .ralt - stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, A_TEXTCOLOR - .ralt: - test al, 0x20 ; RAlt ? - jz @f - stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, A_TEXTCOLOR - @@: - pop eax -ret - - -it_set_keycode_name: - pusha - mov al, byte [hotkeys_num] - dec al - and eax, 0xFF - shl eax, 6 - mov edi, Hotkeys.code_names - add edi, eax - - mov ecx, 64 - xor ax, ax - call strnset - mcall 66, 3 ;get control keys state - .lshift: - test al, 1 ; LShift ? - jz .rshift - mov esi, ctrl_key_names - mov ecx, 6 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 10, 100, ctrl_key_names, 6, 0x00FF0000 - .rshift: - test al, 2 ; RShift ? - jz .lctrl - mov esi, ctrl_key_names+29 - mov ecx, 6 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, 0x00FF0000 - .lctrl: - test al, 4 ; LCtrl ? - jz .rctrl - mov esi, ctrl_key_names+7 - mov ecx, 5 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, 0x00FF0000 - .rctrl: - test al, 8 ; RCtrl ? - jz .lalt - mov esi, ctrl_key_names+23 - mov ecx, 5 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, 0x00FF0000 - .lalt: - test al, 0x10 ; LAlt ? - jz .ralt - mov esi, ctrl_key_names+13 - mov ecx, 4 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, 0x00FF0000 - .ralt: - test al, 0x20 ; RAlt ? - jz @f - mov esi, ctrl_key_names+18 - mov ecx, 4 - call strncat - - mov esi, aPlus - mov ecx, 3 - call strncat - ;stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, 0x00FF0000 - @@: - mov esi, it_ascii_keymap - and edx, 0xFF - add esi, edx - mov ecx, 1 - call strncat - - if 1;DEBUG - mov esi, edi;Hotkeys.code_names - call SysMsgBoardStr - newline - end if - - popa -ret - - -it_button: - mcall 17 ; Get pressed button code - cmp ah, 1 ; Test x button - jne @f - jmp close_app - @@: - jmp it_still - -it_mouse: - - push dword it_edit - call [edit_box_mouse] - - jmp it_still - -it_draw_window: - start_draw_window 450,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt - - push dword it_edit - call [edit_box_draw] - - stdcall outtextxy, 43, 50, it_hint, 0, 0x323232 - stdcall outtextxy, 10, 100, ctrl_key_names, 0, 0 - ;stdcall draw_button, 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText, 0,C_TEXTCOLOR ; Add Hot key. - end_draw_window - mov byte [it_alive], 1 -ret - -;######################## Input Thread code end ########################## - - -; Read configuration file -ReadIni: - ; Get path - mov edi, ini_path - mov esi, app_path - call strlen - - .get_path: - cmp byte [app_path+ecx-1], '/' - je @f - loop .get_path - @@: - call strncpy - mov byte [ini_path+ecx], 0 - mov esi, aIni - call strlen - call strncat - - ; Get hotkey number - invoke ini_get_int, ini_path, aMain, aKeynum, 0 - - and eax, 0xFF - test al, al - jz .end - cmp al, MAX_HOTKEYS_NUM - jle @f - mov al, MAX_HOTKEYS_NUM - @@: - mov byte [hotkeys_num], al - - mov ecx, eax - xor eax, eax - .get_next_hotkey_values: - call set_next_hotkey_section_name - ; Get hotkey name - mov edi, eax - shl edi, 5 ; edi=eax*32 - add edi, dword Hotkeys - push eax ecx - invoke ini_get_str, ini_path, aHotkey, aName, edi, 32, 0 - pop ecx eax - ; Get hotkey code - mov edi, eax - shl edi, 2 ; edi=eax*4 - add edi, dword Hotkeys.codes - push eax ecx edx - invoke ini_get_int, ini_path, aHotkey, aKeycode, 0 - mov dword [it_hotkey_addr], edi - stosd - ; set hotkey - call reset_modifiers - pop edx ecx eax - ; Get hotkey code_name - mov edi, eax - shl edi, 6 ; edi=eax*64 - add edi, dword Hotkeys.code_names - push eax ecx - invoke ini_get_str, ini_path, aHotkey, aKeycodeName, edi, 64, 0 - pop ecx eax - ; Get hotkey path and param - push eax ecx - mov cl, byte PATH_MAX_CHARS - mul cl - mov edi, eax - push edi - add edi, dword [buf_cmd_line] - invoke ini_get_str, ini_path, aHotkey, aPath, edi, 32, 0 - pop edi - add edi, dword [buf_cmd_params] - invoke ini_get_str, ini_path, aHotkey, aParam, edi, 32, 0 - pop ecx eax - - inc al - dec ecx - test ecx, ecx - jnz .get_next_hotkey_values - .end: -ret - - -; Write configuration file -WriteIni: - mov edi, ini_path - ; Set hotkey number - movzx ecx, byte [hotkeys_num] - invoke ini_set_int, ini_path, aMain, aKeynum, ecx - - xor eax, eax - .get_next_hotkey_values: - call set_next_hotkey_section_name - ; Set hotkey name - push eax ecx - mov esi, eax - shl esi, 5 ; edi=eax*32 - add esi, dword Hotkeys - call strlen - invoke ini_set_str, ini_path, aHotkey, aName, esi, ecx - pop ecx eax - ; Set hotkey code - mov esi, eax - shl esi, 2 ; edi=eax*4 - add esi, dword Hotkeys.codes - push eax ecx edx - invoke ini_set_int, ini_path, aHotkey, aKeycode, dword [esi] - pop edx ecx eax - ; Set hotkey code_name - mov esi, eax - shl esi, 6 ; edi=eax*64 - add esi, dword Hotkeys.code_names - push eax ecx - call strlen - invoke ini_set_str, ini_path, aHotkey, aKeycodeName, esi, ecx - pop ecx eax - ; Set hotkey path and param - push eax ecx - ;inc al - mov cl, byte PATH_MAX_CHARS - mul cl - mov esi, eax - push esi - add esi, dword [buf_cmd_line] - call strlen - invoke ini_set_str, ini_path, aHotkey, aPath, esi, ecx - pop esi - add esi, dword [buf_cmd_params] - call strlen - invoke ini_set_str, ini_path, aHotkey, aParam, esi, ecx - pop ecx eax - - inc al - dec ecx - test ecx, ecx - jnz .get_next_hotkey_values - .end: -ret - - -set_next_hotkey_section_name: ;(eax - num) -; this code mainly from debug.inc - push eax ecx edi - mov edi, aHotkey - add edi, 6 ; + strlen("hotkey") - mov ecx, 10 - push -'0' - .l0: - xor edx, edx - div ecx - push edx - test eax, eax - jnz .l0 - .l1: - pop eax - add al, '0' - ;call debug_outchar - stosb - jnz .l1 - pop edi ecx eax -ret - - -;**************************************** -;* input: esi = pointer to keymap * -;* ah = scan code * -;* output: ah = ascii code * -;**************************************** -Scan2ASCII: - push esi - shr eax, 8 - add esi, eax - lodsb - shl eax, 8 - pop esi -ret - - - -;******************************************** -;* input: esi = pointer to the file name * -;* edx = pointer to the parametrs * -;******************************************** - -RunProgram: - pusha - mov dword [InfoStructure], 7 ; run program - mov dword [InfoStructure+4], 0 ; flags - mov dword [InfoStructure+8], edx ; pointer to the parametrs - mov dword [InfoStructure+12], 0 ; reserved - mov dword [InfoStructure+16], 0 ; reserved - mov dword [InfoStructure+20], 0 ; reserved - mov dword [InfoStructure+21], esi ; pointer to the file name - mcall 70, InfoStructure - cmp eax, 0 - jl .err_out - .out: - popa - clc - ret - .err_out: - if lang eq it_IT - print "Impossibile caricare il programma" -;-------------------------------------- - else - print "Can't load program" - - end if - popa - stc - ret - - -; DATA AREA - -; Application Title -labelt db 'MyKey v.0.2' -mykey_window dd 0 ; Slot number of MyKey - - -;########### Input Thread data start ############ - -; Input Thread Title -if lang eq it_IT - it_labelt db "Inserisci hotkey e nome " -;-------------------------------------- -else - it_labelt db "Input hotkey and it's name" - -end if -;labellen: -it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0 -it_buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*32 dup(0) ; !Make it dynamic!!! -it_window dd 0 ; Slot number of the input thread -it_alive db 0 ; Flag of the input thread existance -it_keycode db 0 -it_hotkey_addr dd 0 -if lang eq it_IT - it_hint db 'o premi Esc per cancellare',0 -;-------------------------------------- -else - it_hint db 'or press Esc to cancel',0 - -end if -;########### Input Thread data end ############ - -;Button names -if lang eq it_IT - AddKeyText db 'Aggiungi',0 - ReloadKeyText db 'Ricarica',0 - SaveKeyText db 'Salva',0 - ;DeleteKeyText db 'Delete',0 - ;ManageKeyText db 'Manage',0 -;-------------------------------------- -else - AddKeyText db 'Add',0 - ReloadKeyText db 'Reload',0 - SaveKeyText db 'Save',0 - ;DeleteKeyText db 'Delete',0 - ;ManageKeyText db 'Manage',0 - -end if - -hotkeys_num db 0;15 -;keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan -butt db FIRST_ITEM_BUTTON_ID ; Pressed button ID -modifiers dd 0 - -;Data structures for loadlib.mac and editbox_ex.mac [ -edit1 edit_box 350, 220, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_line, 0, 0 -edit2 edit_box 350, 220, 50, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_params, 0, 0 - -buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!! -buf_cmd_params dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!! - -sys_path: -system_dir0 db '/sys/lib/' -boxlib_name db 'box_lib.obj',0 - -if lang eq it_IT - err_message_found_lib db "Non trovo box_lib.obj",0 - head_f_i: - head_f_l db 'Errore di sistema',0 - err_message_import db 'Error di importazione di box_lib.obj',0 -;-------------------------------------- -else - err_message_found_lib db "Can't find box_lib.obj",0 - head_f_i: - head_f_l db 'System error',0 - err_message_import db 'Error on import box_lib.obj',0 - -end if -align 4 -myimport: -edit_box_draw dd aEdit_box_draw -edit_box_key dd aEdit_box_key -edit_box_mouse dd aEdit_box_mouse -version_ed dd aVersion_ed - dd 0,0 - -aEdit_box_draw db 'edit_box_draw',0 -aEdit_box_key db 'edit_box_key',0 -aEdit_box_mouse db 'edit_box_mouse',0 -aVersion_ed db 'version_ed',0 - -align 16 -importTable: -library \ - libini, 'libini.obj';, \ -; boxlib, 'boxlib.obj', \ -; libio, 'libio.obj', \ - -;import boxlib, \ -;edit_box_draw , 'edit_box_draw', \ -;edit_box_key , 'edit_box_key', \ -;edit_box_mouse , 'edit_box_mouse', \ -;version_ed , 'version_ed' - - -import libini, \ - ini_get_str ,'ini_get_str', \ - ini_set_str ,'ini_set_str', \ - ini_get_int ,'ini_get_int', \ - ini_set_int ,'ini_set_int';, \ -; ini_get_color,'ini_get_color', \ -; ini_set_color,'ini_set_color' - - -;] Data structures for loadlib.mac and editbox_ex.mac - -InfoStructure: - dd 0x0 ; subfunction number - dd 0x0 ; position in the file in bytes - dd 0x0 ; upper part of the position address - dd 0x0 ; number of bytes to read - dd 0x0 ; pointer to the buffer to write data - db 0 - dd 0 ; pointer to the filename - - -I_END: ; End of application code and data marker - - rb 300 ;input thread stack size -input_thread_stack_top: - -ascii_keymap: - db 128 dup(?) -ctrl_key_names db 'LShift LCtrl LAlt RAlt RCtrl RShift',0 -aPlus db ' + ',0 -aIni db 'settings/mykey.ini',0 -aMain db 'main',0 -aKeynum db 'keynum',0 -aHotkey db 'hotkey',0,0,0 -aName db 'name',0 -aKeycode db 'keycode',0 -aKeycodeName db 'keycode_name',0 -aPath db 'path',0 -aParam db 'param',0 -aRamSaver db '/sys/rdsave',0 - -app_path rb 255 -ini_path rb 255 - -Hotkeys: ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) = 36 byte for 1 hotkey - .names: - db 'My1',0 - rb 28 - db 'My2',0 - rb 28 - db 'My3',0 - rb 28 - rb MAX_HOTKEYS_NUM*32-3 - .codes: - dd MAX_HOTKEYS_NUM dup (0) - .code_names: - rb MAX_HOTKEYS_NUM*64 - -it_ascii_keymap: +; +; MyKey. Version 0.2. +; +; Author: Asper +; Date of issue: 29.12.2009 +; Compiler: FASM +; Target: KolibriOS +; + +use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 38 ; required os + dd STARTAPP ; program start + dd I_END ; program image size + dd 0x1000000 ; required amount of memory + dd 0x1000000 ; stack heap + dd 0x0 + dd app_path + +include 'lang.inc' ; Language support for locales: it_IT, en_US. + +include 'string.inc' +;include 'macros.inc' +include '../../../macros.inc' +include 'ASPAPI.INC' +;include 'editbox_ex.mac' +include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +;include 'load_lib.mac' +include '../../../develop/libraries/box_lib/load_lib.mac' +include '../../../dll.inc' + +include 'debug.inc' +DEBUG equ 0;1 + +N_KEYCOLOR equ 0x00EEEEEE ; Normal button color +C_KEYCOLOR equ 0x00CBE1E1 ; Control button color +A_KEYCOLOR equ 0x00FF6400;258778 ; Active button color +C_TEXTCOLOR equ 0x80000000 ; Button caption color +CA_TEXTCOLOR equ 0x80FFFFFF ; Active button caption color +A_TEXTCOLOR equ 0x00FFFFFF ; Active text color + +WIN_X equ 265 +WIN_Y equ 50;175 +WIN_W equ 595 +WIN_H equ 415 ;570 +WIN_COLOR equ 0x040099BB;0x04EEEEEE + +ITEM_BUTTON_W equ 192;100 +ITEM_BUTTON_H equ 23 +ITEM_BUTTON_SPACE equ 0 +FIRST_ITEM_BUTTON_ID equ 7 + +BUT_W equ 80 +BUT_H equ 20 + +MAX_HOTKEYS_NUM equ 15 ; Bad bounding :/. Until we have normal listbox control. +PATH_MAX_CHARS equ 255 + +@use_library + +STARTAPP: + ; Initialize memory + mcall 68, 11 + or eax,eax + jz close_app + ; Import libraries + sys_load_library boxlib_name, sys_path, boxlib_name, system_dir0, err_message_found_lib, head_f_l, myimport,err_message_import, head_f_i + cmp eax,-1 + jz close_app + stdcall dll.Load,importTable + test eax, eax + jnz close_app + + mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS ; Get memory for editboxes text + mov dword [buf_cmd_line], eax + mov dword [edit1.text], eax + mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS + mov dword [buf_cmd_params], eax + mov dword [edit2.text], eax + mcall 68, 12, MAX_HOTKEYS_NUM*32 + mov dword [it_buf_cmd_line], eax + mov dword [it_edit.text], eax + + call Load_HotkeyList + + mcall 66, 1, 1 ; Set keyboard mode to get scancodes. + mcall 26, 2, 1, ascii_keymap + +get_mykey_window_slot_number: + call draw_window + mcall 18, 7 + mov [mykey_window], eax + +set_event_mask: + mcall 40, 0xC0000027 + +red: + .test_slot: + mcall 18, 7 + mov ebx, [mykey_window] + cmp eax, ebx + jne @f + + mov ecx, [it_window] + cmp ebx, ecx + je @f + .activate_it_window: + mov al, byte [it_alive] + test al, al + jz @f + mov byte [it_alive], 0 + + mcall 18, 3 ; Activate input thread window + @@: + call draw_window + +still: + call reset_modifiers + + mcall 10 ; Wait for an event in the queue. + + cmp al,1 ; redraw request ? + jz red + cmp al,2 ; key in buffer ? + jz key + cmp al,3 ; button in buffer ? + jz button + cmp al,6 + jz mouse + + jmp still + +key: + mcall 2 + + push eax + mcall 66, 3 + ;mov edx, eax + ;and edx, 0x00000FF;F + mov dword [modifiers], eax;edx + pop eax + + test word [edit1.flags], 10b + jnz .editbox_input + test word [edit2.flags], 10b + jz @f + .editbox_input: + cmp ah, 0x80 ;if key up + ja still + cmp ah, 42 ;LShift + je still + cmp ah, 54 ;RShift + je still + cmp ah, 56 ;Alt + je still + cmp ah, 29 ;Ctrl + je still + cmp ah, 69 ;Pause/Break + je still + + mov esi, ascii_keymap + call Scan2ASCII + + push dword edit1 + call [edit_box_key] + + push dword edit2 + call [edit_box_key] + jmp still + @@: + + ;------------------------ + mov cl, byte [hotkeys_num] + .test_next_hotkey: + dec cl + mov bl, cl + and ebx, 0xFF + shl ebx, 2;5 +; mov esi, ebx + add ebx, dword Hotkeys.codes + + mov edx, dword [ebx] + cmp ah, dl + jne @f + + shr edx, 8 + cmp edx, dword [modifiers] + jne @f + + push eax + mov eax, PATH_MAX_CHARS + mul cl + mov edx, eax + add edx, dword [buf_cmd_params] + add eax, dword [buf_cmd_line] + mov esi, eax + pop eax + call RunProgram + jmp .end_test + @@: + or cl, cl + jnz .test_next_hotkey + .end_test: + ;------------------------ + + jmp still + +button: + mcall 17 ; Get pressed button code + cmp ah, 1 ; Test x button + je close_app + + cmp ah, 2 + jne @f + call AddHotKey + jmp red + @@: + cmp ah, 5 + jne @f + call Load_HotkeyList + jmp red + @@: + cmp ah, 6 + jne @f + call WriteIni + xor edx, edx + mov esi, aRamSaver + call RunProgram + @@: + + cmp ah, FIRST_ITEM_BUTTON_ID ; Test if pressed buttons + jb still ; is a HotKey button... + mov al, ah + sub al, FIRST_ITEM_BUTTON_ID + cmp al, byte [hotkeys_num] + jnb still ; ...so, if not then still, + + + mov byte [butt], ah ; if yes then save pressed button ID + and eax, 0xFF + mov cl, byte PATH_MAX_CHARS + mul cl + mov ebx, eax + add ebx, dword [buf_cmd_params] + add eax, dword [buf_cmd_line] + + mov dword [edit1.text], eax + mov dword [edit2.text], ebx + + mov esi, eax + call strlen + mov dword [edit1.size], ecx + mov dword [edit1.pos], ecx + + mov esi, ebx + call strlen + mov dword [edit2.size], ecx + mov dword [edit2.pos], ecx + + jmp red + +mouse: + push dword edit1 + call [edit_box_mouse] + push dword edit2 + call [edit_box_mouse] + + jmp still + + +close_app: + mov eax,-1 ; close this program + int 0x40 + + +draw_window: + start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt + + ;bar 5, 24, 585, 385, 0x800000 or 0x90D2 + ;rectangle2 6, 25, 585, 385, 0xFFFFFF, 0 + + ;bar 5, 24, BUT_W+4, 350, 0x008C00D2;0x800000 or A_KEYCOLOR + ;rectangle2 6, 25, BUT_W+4, 350, 0xFFFFFF, 0 + + + push dword edit1 + call [edit_box_draw] + push dword edit2 + call [edit_box_draw] + + stdcall draw_button, 7,WIN_H-BUT_H-10,BUT_W,BUT_H,2,0x0050D250,AddKeyText, 0,C_TEXTCOLOR ; Add Hotkey. + if 0 + stdcall draw_button, 90,WIN_H-BUT_H-10,BUT_W,BUT_H,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR ; Delete Hotkey. + stdcall draw_button, 173,WIN_H-BUT_H-10,BUT_W,BUT_H,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR ; Manage Hotkey. + end if + stdcall draw_button, WIN_W-BUT_W*2-14,WIN_H-BUT_H-10,BUT_W,BUT_H,5,0x0050D250,ReloadKeyText, 0,C_TEXTCOLOR ; Save Hotkeys list. + stdcall draw_button, WIN_W-BUT_W-7,WIN_H-BUT_H-10,BUT_W,BUT_H,6,0x0050D250,SaveKeyText, 0,C_TEXTCOLOR ; Save Hotkeys list. + + movzx ecx, byte [hotkeys_num] + cmp ecx, MAX_HOTKEYS_NUM + jng @f + mov ecx, MAX_HOTKEYS_NUM + @@: + mov eax, 30 + mov ebx, FIRST_ITEM_BUTTON_ID + @@: + or cl, cl + jz @f + + mov edx, ebx + sub edx, FIRST_ITEM_BUTTON_ID + shl edx, 5; edx=edx*32 + add edx, dword Hotkeys + + cmp bl, byte [butt] + jne .l1 + stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,A_KEYCOLOR ,edx,0,CA_TEXTCOLOR + bar 220, 70, 350, 30, 0x00C8E1F0 ;0x800000 or A_KEYCOLOR + rectangle2 221, 71, 350, 30, 0xFFFFFF, 0 + mov esi, Hotkeys.code_names + sub edx, dword Hotkeys + shl edx, 1 + add esi, edx + stdcall outtextxy, 225, 80, esi, 64, C_TEXTCOLOR + jmp .l2 + .l1: + stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR + .l2: + + add eax, ITEM_BUTTON_H+ITEM_BUTTON_SPACE + inc ebx + dec cl + jmp @b + @@: + end_draw_window +ret + + +AddHotKey: + mov al, byte [hotkeys_num] + cmp al, MAX_HOTKEYS_NUM + jge .end + inc al + mov byte [hotkeys_num], al + + mcall 51, 1, dword start_input_thread, dword input_thread_stack_top + .end: +ret + + +Load_HotkeyList: + call ReadIni + + mov al, byte [butt] + and eax, 0xFF + sub al, FIRST_ITEM_BUTTON_ID + mov cl, byte PATH_MAX_CHARS + mul cl + mov ebx, eax + add eax, dword [buf_cmd_line] + add ebx, dword [buf_cmd_params] + + + ;mov [butt], FIRST_ITEM_BUTTON_ID + mov esi, eax + call strlen + mov dword [edit1.size], ecx + mov dword [edit1.pos], ecx + + mov esi, ebx + call strlen + mov dword [edit2.size], ecx + mov dword [edit2.pos], ecx +ret + + +reset_modifiers: + pusha + mov esi, dword [it_hotkey_addr] + test esi, esi + jz .end_set_mods + + lodsd + + ; Set new hotkey for the main thread + mov cl, al + shr eax, 8 + + xor edx, edx + push cx + mov cl, 3 + .next_pair: + shl edx, 4 + mov bl, al + and bl, 3 + + or bl, bl + jz .l1 + + cmp bl, 3 ; both? + jne @f + or dl, 2 + jmp .l1 + @@: + add bl, 2 + or dl, bl + .l1: + shr eax, 2 + dec cl + test cl, cl + jnz .next_pair + + mov bx, dx + and bx, 0xF0F + xchg bl, bh + and dx, 0x0F0 + or dx, bx + pop cx + + mcall 66, 4 + mov dword [it_hotkey_addr], 0 + .end_set_mods: + popa +ret + + +;######################## Input Thread code start ########################## + +start_input_thread: + mov ecx, 1 ; to get scancodes. + mcall 26, 2, 1, it_ascii_keymap + mcall 66, 1 ; Set keyboard mode + mov dword [it_hotkey_addr], 0 +it_set_editbox: + mov al, byte [hotkeys_num] + sub al, 1 + and eax, 0xFF + shl eax, 5 + add eax, dword Hotkeys.names + mov dword [it_edit.text], eax + + mov esi, eax + call strlen + mov dword [it_edit.size], ecx + mov dword [it_edit.pos], ecx +get_it_window_slot_number: + call it_draw_window + mcall 18, 7 + mov [it_window], eax + +it_set_event_mask: + mcall 40, 39 +it_red: + call it_draw_window + +it_still: + mcall 10 ; Wait for an event in the queue. + + cmp al,1 ; redraw request ? + jz it_red + cmp al,2 ; key in buffer ? + jz it_key + cmp al,3 ; button in buffer ? + jz it_button + cmp al,6 + jz it_mouse + + jmp it_still + +it_key: + mcall 2 + + mov byte [it_keycode], 0 + stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0 + + cmp ah, 1 ;Esc + jne @f + dec byte [hotkeys_num] + jmp close_app + @@: + + cmp ah, 0x80 ;if key up + ja .end + cmp ah, 42 ;[Shift] (left) + je .end + cmp ah, 54 ;[Shift] (right) + je .end + cmp ah, 56 ;[Alt] + je .end + cmp ah, 29 ;[Ctrl] + je .end + cmp ah, 69 ;[Pause Break] + je .end + + mov byte [it_keycode], ah + mov esi, it_ascii_keymap + call Scan2ASCII + + test word [it_edit.flags], 10b + jz .end + push dword it_edit + call [edit_box_key] + jmp it_still + .end: + + mcall 26, 2, 1, it_ascii_keymap + call it_test_key_modifiers + test dl, 3 + jz @f + push edx + mcall 26, 2, 2, it_ascii_keymap + pop edx + @@: + + mov al, byte [it_keycode] + test al, al + jz @f + shl edx, 8 + mov dl, al + + mov eax, dword [it_hotkey_addr] + test eax, eax + jnz @f + + call it_set_keycode_name + + mov al, byte [hotkeys_num] + dec al + and eax, 0xFF + shl eax, 2;5 + add eax, dword Hotkeys.codes + mov dword [eax], edx + mov dword [it_hotkey_addr], eax + + mov cl, dl ; finally set hotkey + shr edx, 8 + mcall 66, 4 + @@: + + jmp it_still + + +it_test_key_modifiers: + push eax + mcall 66, 3 ;get control keys state + mov edx, eax + ;and edx, 0x00000FFF + .lshift: + test al, 1 ; LShift ? + jz .rshift + stdcall outtextxy, 10, 100, ctrl_key_names, 6, A_TEXTCOLOR + .rshift: + test al, 2 ; RShift ? + jz .lctrl + stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, A_TEXTCOLOR + .lctrl: + test al, 4 ; LCtrl ? + jz .rctrl + stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, A_TEXTCOLOR + .rctrl: + test al, 8 ; RCtrl ? + jz .lalt + stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, A_TEXTCOLOR + .lalt: + test al, 0x10 ; LAlt ? + jz .ralt + stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, A_TEXTCOLOR + .ralt: + test al, 0x20 ; RAlt ? + jz @f + stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, A_TEXTCOLOR + @@: + pop eax +ret + + +it_set_keycode_name: + pusha + mov al, byte [hotkeys_num] + dec al + and eax, 0xFF + shl eax, 6 + mov edi, Hotkeys.code_names + add edi, eax + + mov ecx, 64 + xor ax, ax + call strnset + mcall 66, 3 ;get control keys state + .lshift: + test al, 1 ; LShift ? + jz .rshift + mov esi, ctrl_key_names + mov ecx, 6 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 10, 100, ctrl_key_names, 6, 0x00FF0000 + .rshift: + test al, 2 ; RShift ? + jz .lctrl + mov esi, ctrl_key_names+29 + mov ecx, 6 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, 0x00FF0000 + .lctrl: + test al, 4 ; LCtrl ? + jz .rctrl + mov esi, ctrl_key_names+7 + mov ecx, 5 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, 0x00FF0000 + .rctrl: + test al, 8 ; RCtrl ? + jz .lalt + mov esi, ctrl_key_names+23 + mov ecx, 5 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, 0x00FF0000 + .lalt: + test al, 0x10 ; LAlt ? + jz .ralt + mov esi, ctrl_key_names+13 + mov ecx, 4 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, 0x00FF0000 + .ralt: + test al, 0x20 ; RAlt ? + jz @f + mov esi, ctrl_key_names+18 + mov ecx, 4 + call strncat + + mov esi, aPlus + mov ecx, 3 + call strncat + ;stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, 0x00FF0000 + @@: + mov esi, it_ascii_keymap + and edx, 0xFF + add esi, edx + mov ecx, 1 + call strncat + + if 1;DEBUG + mov esi, edi;Hotkeys.code_names + call SysMsgBoardStr + newline + end if + + popa +ret + + +it_button: + mcall 17 ; Get pressed button code + cmp ah, 1 ; Test x button + jne @f + jmp close_app + @@: + jmp it_still + +it_mouse: + + push dword it_edit + call [edit_box_mouse] + + jmp it_still + +it_draw_window: + start_draw_window 450,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt + + push dword it_edit + call [edit_box_draw] + + stdcall outtextxy, 43, 50, it_hint, 0, 0x323232 + stdcall outtextxy, 10, 100, ctrl_key_names, 0, 0 + ;stdcall draw_button, 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText, 0,C_TEXTCOLOR ; Add Hot key. + end_draw_window + mov byte [it_alive], 1 +ret + +;######################## Input Thread code end ########################## + + +; Read configuration file +ReadIni: + ; Get path + mov edi, ini_path + mov esi, app_path + call strlen + + .get_path: + cmp byte [app_path+ecx-1], '/' + je @f + loop .get_path + @@: + call strncpy + mov byte [ini_path+ecx], 0 + mov esi, aIni + call strlen + call strncat + + ; Get hotkey number + invoke ini_get_int, ini_path, aMain, aKeynum, 0 + + and eax, 0xFF + test al, al + jz .end + cmp al, MAX_HOTKEYS_NUM + jle @f + mov al, MAX_HOTKEYS_NUM + @@: + mov byte [hotkeys_num], al + + mov ecx, eax + xor eax, eax + .get_next_hotkey_values: + call set_next_hotkey_section_name + ; Get hotkey name + mov edi, eax + shl edi, 5 ; edi=eax*32 + add edi, dword Hotkeys + push eax ecx + invoke ini_get_str, ini_path, aHotkey, aName, edi, 32, 0 + pop ecx eax + ; Get hotkey code + mov edi, eax + shl edi, 2 ; edi=eax*4 + add edi, dword Hotkeys.codes + push eax ecx edx + invoke ini_get_int, ini_path, aHotkey, aKeycode, 0 + mov dword [it_hotkey_addr], edi + stosd + ; set hotkey + call reset_modifiers + pop edx ecx eax + ; Get hotkey code_name + mov edi, eax + shl edi, 6 ; edi=eax*64 + add edi, dword Hotkeys.code_names + push eax ecx + invoke ini_get_str, ini_path, aHotkey, aKeycodeName, edi, 64, 0 + pop ecx eax + ; Get hotkey path and param + push eax ecx + mov cl, byte PATH_MAX_CHARS + mul cl + mov edi, eax + push edi + add edi, dword [buf_cmd_line] + invoke ini_get_str, ini_path, aHotkey, aPath, edi, 32, 0 + pop edi + add edi, dword [buf_cmd_params] + invoke ini_get_str, ini_path, aHotkey, aParam, edi, 32, 0 + pop ecx eax + + inc al + dec ecx + test ecx, ecx + jnz .get_next_hotkey_values + .end: +ret + + +; Write configuration file +WriteIni: + mov edi, ini_path + ; Set hotkey number + movzx ecx, byte [hotkeys_num] + invoke ini_set_int, ini_path, aMain, aKeynum, ecx + + xor eax, eax + .get_next_hotkey_values: + call set_next_hotkey_section_name + ; Set hotkey name + push eax ecx + mov esi, eax + shl esi, 5 ; edi=eax*32 + add esi, dword Hotkeys + call strlen + invoke ini_set_str, ini_path, aHotkey, aName, esi, ecx + pop ecx eax + ; Set hotkey code + mov esi, eax + shl esi, 2 ; edi=eax*4 + add esi, dword Hotkeys.codes + push eax ecx edx + invoke ini_set_int, ini_path, aHotkey, aKeycode, dword [esi] + pop edx ecx eax + ; Set hotkey code_name + mov esi, eax + shl esi, 6 ; edi=eax*64 + add esi, dword Hotkeys.code_names + push eax ecx + call strlen + invoke ini_set_str, ini_path, aHotkey, aKeycodeName, esi, ecx + pop ecx eax + ; Set hotkey path and param + push eax ecx + ;inc al + mov cl, byte PATH_MAX_CHARS + mul cl + mov esi, eax + push esi + add esi, dword [buf_cmd_line] + call strlen + invoke ini_set_str, ini_path, aHotkey, aPath, esi, ecx + pop esi + add esi, dword [buf_cmd_params] + call strlen + invoke ini_set_str, ini_path, aHotkey, aParam, esi, ecx + pop ecx eax + + inc al + dec ecx + test ecx, ecx + jnz .get_next_hotkey_values + .end: +ret + + +set_next_hotkey_section_name: ;(eax - num) +; this code mainly from debug.inc + push eax ecx edi + mov edi, aHotkey + add edi, 6 ; + strlen("hotkey") + mov ecx, 10 + push -'0' + .l0: + xor edx, edx + div ecx + push edx + test eax, eax + jnz .l0 + .l1: + pop eax + add al, '0' + ;call debug_outchar + stosb + jnz .l1 + pop edi ecx eax +ret + + +;**************************************** +;* input: esi = pointer to keymap * +;* ah = scan code * +;* output: ah = ascii code * +;**************************************** +Scan2ASCII: + push esi + shr eax, 8 + add esi, eax + lodsb + shl eax, 8 + pop esi +ret + + + +;******************************************** +;* input: esi = pointer to the file name * +;* edx = pointer to the parametrs * +;******************************************** + +RunProgram: + pusha + mov dword [InfoStructure], 7 ; run program + mov dword [InfoStructure+4], 0 ; flags + mov dword [InfoStructure+8], edx ; pointer to the parametrs + mov dword [InfoStructure+12], 0 ; reserved + mov dword [InfoStructure+16], 0 ; reserved + mov dword [InfoStructure+20], 0 ; reserved + mov dword [InfoStructure+21], esi ; pointer to the file name + mcall 70, InfoStructure + cmp eax, 0 + jl .err_out + .out: + popa + clc + ret + .err_out: + if lang eq it_IT + print "Impossibile caricare il programma" + else ; Default to en_US + print "Cannot load program" + end if + popa + stc + ret + + +; DATA AREA + +; Application Title +labelt db 'MyKey v.0.2' +mykey_window dd 0 ; Slot number of MyKey + + +;########### Input Thread data start ############ + +; Input Thread Title + +if lang eq it_IT + it_labelt db "Inserisci hotkey e nome " +else ; Default to en_US + it_labelt db "Input hotkey and its name" +end if + +;labellen: +it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0 +it_buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*32 dup(0) ; !Make it dynamic!!! +it_window dd 0 ; Slot number of the input thread +it_alive db 0 ; Flag of the input thread existance +it_keycode db 0 +it_hotkey_addr dd 0 + +if lang eq it_IT + it_hint db 'o premi Esc per cancellare',0 +else ; Default to en_US + it_hint db 'or press Esc to cancel',0 +end if + +;########### Input Thread data end ############ + +;Button names +if lang eq it_IT + AddKeyText db 'Aggiungi',0 + ReloadKeyText db 'Ricarica',0 + SaveKeyText db 'Salva',0 + ;DeleteKeyText db 'Delete',0 + ;ManageKeyText db 'Manage',0 +else ; Default to en_US + AddKeyText db 'Add',0 + ReloadKeyText db 'Reload',0 + SaveKeyText db 'Save',0 + ;DeleteKeyText db 'Delete',0 + ;ManageKeyText db 'Manage',0 +end if + +hotkeys_num db 0;15 +;keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan +butt db FIRST_ITEM_BUTTON_ID ; Pressed button ID +modifiers dd 0 + +;Data structures for loadlib.mac and editbox_ex.mac [ +edit1 edit_box 350, 220, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_line, 0, 0 +edit2 edit_box 350, 220, 50, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_params, 0, 0 + +buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!! +buf_cmd_params dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!! + +sys_path: +system_dir0 db '/sys/lib/' +boxlib_name db 'box_lib.obj',0 + +if lang eq it_IT + err_message_found_lib db "Non trovo box_lib.obj",0 + head_f_i: + head_f_l db 'Errore di sistema',0 + err_message_import db 'Error di importazione di box_lib.obj',0 +else ; Default to en_US + err_message_found_lib db "Can't find box_lib.obj",0 + head_f_i: + head_f_l db 'System error',0 + err_message_import db 'Error on import box_lib.obj',0 +end if + +align 4 +myimport: +edit_box_draw dd aEdit_box_draw +edit_box_key dd aEdit_box_key +edit_box_mouse dd aEdit_box_mouse +version_ed dd aVersion_ed + dd 0,0 + +aEdit_box_draw db 'edit_box_draw',0 +aEdit_box_key db 'edit_box_key',0 +aEdit_box_mouse db 'edit_box_mouse',0 +aVersion_ed db 'version_ed',0 + +align 16 +importTable: +library \ + libini, 'libini.obj';, \ +; boxlib, 'boxlib.obj', \ +; libio, 'libio.obj', \ + +;import boxlib, \ +;edit_box_draw , 'edit_box_draw', \ +;edit_box_key , 'edit_box_key', \ +;edit_box_mouse , 'edit_box_mouse', \ +;version_ed , 'version_ed' + + +import libini, \ + ini_get_str ,'ini_get_str', \ + ini_set_str ,'ini_set_str', \ + ini_get_int ,'ini_get_int', \ + ini_set_int ,'ini_set_int';, \ +; ini_get_color,'ini_get_color', \ +; ini_set_color,'ini_set_color' + + +;] Data structures for loadlib.mac and editbox_ex.mac + +InfoStructure: + dd 0x0 ; subfunction number + dd 0x0 ; position in the file in bytes + dd 0x0 ; upper part of the position address + dd 0x0 ; number of bytes to read + dd 0x0 ; pointer to the buffer to write data + db 0 + dd 0 ; pointer to the filename + + +I_END: ; End of application code and data marker + + rb 300 ;input thread stack size +input_thread_stack_top: + +ascii_keymap: + db 128 dup(?) +ctrl_key_names db 'LShift LCtrl LAlt RAlt RCtrl RShift',0 +aPlus db ' + ',0 +aIni db 'settings/mykey.ini',0 +aMain db 'main',0 +aKeynum db 'keynum',0 +aHotkey db 'hotkey',0,0,0 +aName db 'name',0 +aKeycode db 'keycode',0 +aKeycodeName db 'keycode_name',0 +aPath db 'path',0 +aParam db 'param',0 +aRamSaver db '/sys/rdsave',0 + +app_path rb 255 +ini_path rb 255 + +Hotkeys: ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) = 36 byte for 1 hotkey + .names: + db 'My1',0 + rb 28 + db 'My2',0 + rb 28 + db 'My3',0 + rb 28 + rb MAX_HOTKEYS_NUM*32-3 + .codes: + dd MAX_HOTKEYS_NUM dup (0) + .code_names: + rb MAX_HOTKEYS_NUM*64 + +it_ascii_keymap: diff --git a/programs/system/calendar/trunk/data.inc b/programs/system/calendar/trunk/data.inc index ddae8fbaf..90b6db103 100644 --- a/programs/system/calendar/trunk/data.inc +++ b/programs/system/calendar/trunk/data.inc @@ -1,321 +1,323 @@ -; program data - -curMonth dd ? -curYear dd ? -curDay dd ? - -remainder dd ? -quotient dd ? - -firstday dd ? -Year dd ? -Month dd ? -day_sel dd ? - -datestr dd ? -leap_year dd ? -number dd ? - -; colors -COL_WINDOW_BG equ 0x54E7E7E7 -COL_TOOLBAR_BG equ 0x555555 -COL_ACTIVE_TEXT equ 0x10e7c750 -COL_WEEKDAY_BG equ 0xCCCDDD -COL_DATE_BUTTONS equ 0xF3F3F3 -COL_TIME_BUTTONS equ 0x5555dd -COL_GO_TODAY_T equ 0xd048c8 -COL_MONTH_YEAR_B equ 0x555555 -COL_DROPDOWN_BG equ 0x666666 -COL_DROPDOWN_T equ 0x10CCCccc -COL_NEW_STYLE_T equ 0xef3333 - -COL_DATE_INACTIVE_1 equ 0x388CAF -COL_DATE_INACTIVE_2 equ 0x75B9D5 -COL_DATE_INACTIVE_3 equ 0x9ECBDF -COL_DATE_INACTIVE_4 equ 0xABD7E8 - -COL_DATE_ACTIVE_1 equ 0xA57F2C -COL_DATE_ACTIVE_2 equ 0xEFB52D -COL_DATE_ACTIVE_3 equ 0xFAD84C -COL_DATE_ACTIVE_4 equ 0xFAE995 - -COL_DATE_1 equ 0x8C8C8C -COL_DATE_2 equ 0xFFFfff -COL_DATE_3 equ 0xF2F2F2 -COL_DATE_4 equ 0xF2F2F2 - -; definitions -WIN_W equ 275 -WIN_H equ 326 - -DATE_BUTTON_WIDTH equ 32 -DATE_BUTTON_HEIGHT equ 30 - - -LINE1 equ 27 shl 16+16 -B_MONTH_X equ 15 shl 16+158 -B_Y equ LINE1 -B_MONTH equ 63 shl 16+27 - -BT_WBAR_Y equ 283 shl 16+43 - -B_WBAR_X equ 1 shl 16+WIN_W-1 -B_WBAR_Y equ 64 shl 16+20 -B_WEEK equ 34 shl 16+66 -B_WX_SHIFT equ 32 shl 16 - -B_DROP equ B_MONTH+16 -B_DAYS_Y equ 106 -B_DAYS_SHIFT equ 30 - -B_YEAR equ 204 shl 16+28 - -B_SPIN_X equ 186 shl 16+12 -B_SPIN equ 188 shl 16+28 -spinner db '< >' - -B_TODAY_X equ 25 shl 16 -B_TODAY_Y equ 48 shl 16+10 -B_TODAY equ 30 shl 16+50 - -B_NS_X equ 185 shl 16+75 -B_NS_Y equ 48 shl 16+10 -B_NS equ 190 shl 16+50 - -FOCUSABLE equ 4 - -; multilanguage interface - configuratable in lang.inc -day_count db 3,0,3,2,3,2,3,3,2,3,2,3 -Fkeys db 210,211,212,213,214,215,216,217,208,209,228,159 - -month_name: -if lang eq ru_RU - db 8 - db ' ' - db 'ࠫ ' - db ' ' - db '५ ' - db ' ' - db ' ' - db ' ' - db ' ' - db '' - db ' ' - db ' ' - db ' ' -else if lang eq de_DE - db 9 - db 'Januar ' - db 'Februar ' - db 'M+rz ' - db 'April ' - db 'Mai ' - db 'Juni ' - db 'Juli ' - db 'August ' - db 'September' - db 'Oktober ' - db 'November ' - db 'Dezember ' -else if lang eq fr_FR - db 9 - db 'Janvier ' - db 'Fevrier ' - db 'Mars ' - db 'Avril ' - db 'Mai ' - db 'Juin ' - db 'Juliet ' - db 'Aout ' - db 'Septembre' - db 'Octobre ' - db 'Novembre ' - db 'Decembre ' -else if lang eq fi_FI - db 9 - db 'Tammikuu ' - db 'Helmikuu ' - db 'Maaliskuu' - db 'Huhtikuu ' - db 'Toukokuu ' - db 'Kes+kuu ' - db 'Hein+kuu ' - db 'Elokuu ' - db 'Syyskuu ' - db 'Lokakuu ' - db 'Marraskuu' - db 'Joulukuu ' -else if lang eq et_EE - db 9 - db 'Jaanuar ' - db 'Veebruar ' - db 'Mrts ' - db 'Aprill ' - db 'Mai ' - db 'Juuni ' - db 'Juuli ' - db 'August ' - db 'September' - db 'Oktoober ' - db 'November ' - db 'Detsember' -else if lang eq it_IT - db 9 - db 'Gennaio ' - db 'Febbraio ' - db 'Marzo ' - db 'Aprile ' - db 'Maggio ' - db 'Giugno ' - db 'Luglio ' - db 'Agosto ' - db 'Settembre' - db 'Ottobre ' - db 'Novembre ' - db 'Dicembre ' -else - db 9 - db 'January ' - db 'February ' - db 'March ' - db 'April ' - db 'May ' - db 'June ' - db 'July ' - db 'August ' - db 'September' - db 'October ' - db 'November ' - db 'December ' -end if -week_days: -if lang eq ru_RU - db 2 - db 1 - db '' - db '' - db '' - db '' - db '' - db '' - db '' -else if lang eq de_DE - db 2 - db 7 - db 'So' - db 'Mo' - db 'Di' - db 'Mi' - db 'Do' - db 'Fr' - db 'Sa' -else if lang eq fr_FR - db 3 - db 7 - db 'Dim' - db 'Lun' - db 'Mar' - db 'Mer' - db 'Jeu' - db 'Ven' - db 'Sam' -else if lang eq fi_FI - db 2 - db 7 - db 'Su' - db 'Ma' - db 'Ti' - db 'Ke' - db 'To' - db 'Pe' - db 'La' -else if lang eq et_EE - db 3 - db 7 - db 'Esm' - db 'Tei' - db 'Kol' - db 'Nel' - db 'Ree' - db 'Lau' - db 'Ph' -else if lang eq it_IT - db 3 - db 7 - db 'Dom' - db 'Lun' - db 'Mar' - db 'Mer' - db 'Gio' - db 'Ven' - db 'Sab' -else - db 3 - db 7 - db 'Sun' - db 'Mon' - db 'Tue' - db 'Wed' - db 'Thu' - db 'Fri' - db 'Sat' -end if - -title: -if lang eq ru_RU - db '',0 -else if lang eq de_DE - db 'Kalender',0 -else if lang eq fr_FR - db 'Calendrier',0 -else if lang eq et_EE - db 'Kalender',0 -else if lang eq it_IT - db 'Calendario',0 -else - db 'Calendar',0 -end if - -today_msg: -if lang eq ru_RU - db '' -else if lang eq de_DE - db 'Heute' -else if lang eq fr_FR - db "Aujourd'hui" -else if lang eq et_EE - db 'Tna' -else if lang eq it_IT - db 'Oggi' -else - db 'Today' -end if -today_end: -focus dd 3 -new_style dd 1 -dropped db 0 - -sys_text: -if lang eq ru_RU - db '६',0 -else if lang eq it_IT - db ' Ora',0 -else if lang eq et_EE - db ' Aeg ',0 -else - db ' Time',0 -end if -separator db ':',0 -plus db '+',0 -minus db '-',0 -set_date_t: -if lang eq ru_RU - db '⠭ ',0 -else if lang eq it_IT - db ' Impostazioni ',0 -else if lang eq et_EE - db ' Mra kuupev ',0 -else - db ' Set date ',0 -end if - +; program data + +curMonth dd ? +curYear dd ? +curDay dd ? + +remainder dd ? +quotient dd ? + +firstday dd ? +Year dd ? +Month dd ? +day_sel dd ? + +datestr dd ? +leap_year dd ? +number dd ? + +; colors +COL_WINDOW_BG equ 0x54E7E7E7 +COL_TOOLBAR_BG equ 0x555555 +COL_ACTIVE_TEXT equ 0x10e7c750 +COL_WEEKDAY_BG equ 0xCCCDDD +COL_DATE_BUTTONS equ 0xF3F3F3 +COL_TIME_BUTTONS equ 0x5555dd +COL_GO_TODAY_T equ 0xd048c8 +COL_MONTH_YEAR_B equ 0x555555 +COL_DROPDOWN_BG equ 0x666666 +COL_DROPDOWN_T equ 0x10CCCccc +COL_NEW_STYLE_T equ 0xef3333 + +COL_DATE_INACTIVE_1 equ 0x388CAF +COL_DATE_INACTIVE_2 equ 0x75B9D5 +COL_DATE_INACTIVE_3 equ 0x9ECBDF +COL_DATE_INACTIVE_4 equ 0xABD7E8 + +COL_DATE_ACTIVE_1 equ 0xA57F2C +COL_DATE_ACTIVE_2 equ 0xEFB52D +COL_DATE_ACTIVE_3 equ 0xFAD84C +COL_DATE_ACTIVE_4 equ 0xFAE995 + +COL_DATE_1 equ 0x8C8C8C +COL_DATE_2 equ 0xFFFfff +COL_DATE_3 equ 0xF2F2F2 +COL_DATE_4 equ 0xF2F2F2 + +; definitions +WIN_W equ 275 +WIN_H equ 326 + +DATE_BUTTON_WIDTH equ 32 +DATE_BUTTON_HEIGHT equ 30 + + +LINE1 equ 27 shl 16+16 +B_MONTH_X equ 15 shl 16+158 +B_Y equ LINE1 +B_MONTH equ 63 shl 16+27 + +BT_WBAR_Y equ 283 shl 16+43 + +B_WBAR_X equ 1 shl 16+WIN_W-1 +B_WBAR_Y equ 64 shl 16+20 +B_WEEK equ 34 shl 16+66 +B_WX_SHIFT equ 32 shl 16 + +B_DROP equ B_MONTH+16 +B_DAYS_Y equ 106 +B_DAYS_SHIFT equ 30 + +B_YEAR equ 204 shl 16+28 + +B_SPIN_X equ 186 shl 16+12 +B_SPIN equ 188 shl 16+28 +spinner db '< >' + +B_TODAY_X equ 25 shl 16 +B_TODAY_Y equ 48 shl 16+10 +B_TODAY equ 30 shl 16+50 + +B_NS_X equ 185 shl 16+75 +B_NS_Y equ 48 shl 16+10 +B_NS equ 190 shl 16+50 + +FOCUSABLE equ 4 + +day_count db 3,0,3,2,3,2,3,3,2,3,2,3 +Fkeys db 210,211,212,213,214,215,216,217,208,209,228,159 + +; Multilanguage interface - configurable in lang.inc +; Language support for locales: ru_RU (CP866), de_DE, fr_FR, fi_FI, et_EE, it_IT, en_US + +month_name: +if lang eq ru_RU + db 8 + db ' ' + db 'ࠫ ' + db ' ' + db '५ ' + db ' ' + db ' ' + db ' ' + db ' ' + db '' + db ' ' + db ' ' + db ' ' +else if lang eq de_DE + db 9 + db 'Januar ' + db 'Februar ' + db 'M+rz ' + db 'April ' + db 'Mai ' + db 'Juni ' + db 'Juli ' + db 'August ' + db 'September' + db 'Oktober ' + db 'November ' + db 'Dezember ' +else if lang eq fr_FR + db 9 + db 'Janvier ' + db 'Fevrier ' + db 'Mars ' + db 'Avril ' + db 'Mai ' + db 'Juin ' + db 'Juliet ' + db 'Aout ' + db 'Septembre' + db 'Octobre ' + db 'Novembre ' + db 'Decembre ' +else if lang eq fi_FI + db 9 + db 'Tammikuu ' + db 'Helmikuu ' + db 'Maaliskuu' + db 'Huhtikuu ' + db 'Toukokuu ' + db 'Kes+kuu ' + db 'Hein+kuu ' + db 'Elokuu ' + db 'Syyskuu ' + db 'Lokakuu ' + db 'Marraskuu' + db 'Joulukuu ' +else if lang eq et_EE + db 9 + db 'Jaanuar ' + db 'Veebruar ' + db 'Mrts ' + db 'Aprill ' + db 'Mai ' + db 'Juuni ' + db 'Juuli ' + db 'August ' + db 'September' + db 'Oktoober ' + db 'November ' + db 'Detsember' +else if lang eq it_IT + db 9 + db 'Gennaio ' + db 'Febbraio ' + db 'Marzo ' + db 'Aprile ' + db 'Maggio ' + db 'Giugno ' + db 'Luglio ' + db 'Agosto ' + db 'Settembre' + db 'Ottobre ' + db 'Novembre ' + db 'Dicembre ' +else ; Default to en_US + db 9 + db 'January ' + db 'February ' + db 'March ' + db 'April ' + db 'May ' + db 'June ' + db 'July ' + db 'August ' + db 'September' + db 'October ' + db 'November ' + db 'December ' +end if +week_days: +if lang eq ru_RU + db 2 + db 1 + db '' + db '' + db '' + db '' + db '' + db '' + db '' +else if lang eq de_DE + db 2 + db 7 + db 'So' + db 'Mo' + db 'Di' + db 'Mi' + db 'Do' + db 'Fr' + db 'Sa' +else if lang eq fr_FR + db 3 + db 7 + db 'Dim' + db 'Lun' + db 'Mar' + db 'Mer' + db 'Jeu' + db 'Ven' + db 'Sam' +else if lang eq fi_FI + db 2 + db 7 + db 'Su' + db 'Ma' + db 'Ti' + db 'Ke' + db 'To' + db 'Pe' + db 'La' +else if lang eq et_EE + db 3 + db 7 + db 'Esm' + db 'Tei' + db 'Kol' + db 'Nel' + db 'Ree' + db 'Lau' + db 'Ph' +else if lang eq it_IT + db 3 + db 7 + db 'Dom' + db 'Lun' + db 'Mar' + db 'Mer' + db 'Gio' + db 'Ven' + db 'Sab' +else ; Default to en_US + db 3 + db 7 + db 'Sun' + db 'Mon' + db 'Tue' + db 'Wed' + db 'Thu' + db 'Fri' + db 'Sat' +end if + +title: +if lang eq ru_RU + db '',0 +else if lang eq de_DE + db 'Kalender',0 +else if lang eq fr_FR + db 'Calendrier',0 +else if lang eq et_EE + db 'Kalender',0 +else if lang eq it_IT + db 'Calendario',0 +else ; Default to en_US + db 'Calendar',0 +end if + +today_msg: +if lang eq ru_RU + db '' +else if lang eq de_DE + db 'Heute' +else if lang eq fr_FR + db "Aujourd'hui" +else if lang eq et_EE + db 'Tna' +else if lang eq it_IT + db 'Oggi' +else ; Default to en_US + db 'Today' +end if +today_end: +focus dd 3 +new_style dd 1 +dropped db 0 + +sys_text: +if lang eq ru_RU + db '६',0 +else if lang eq it_IT + db ' Ora',0 +else if lang eq et_EE + db ' Aeg ',0 +else ; Default to en_US + db ' Time',0 +end if +separator db ':',0 +plus db '+',0 +minus db '-',0 + +set_date_t: +if lang eq ru_RU + db '⠭ ',0 +else if lang eq it_IT + db ' Impostazioni ',0 +else if lang eq et_EE + db ' Mra kuupev ',0 +else ; Default to en_US + db ' Set date ',0 +end if diff --git a/programs/system/cd_tray/CD_tray.ASM b/programs/system/cd_tray/CD_tray.ASM index 0e74fa9c0..60fcd5ddb 100644 --- a/programs/system/cd_tray/CD_tray.ASM +++ b/programs/system/cd_tray/CD_tray.ASM @@ -1,163 +1,165 @@ -; -; ATAPI -; 22.07.2007 Mario79 -;--------------------------------------------------------------------- - - use32 ; 32- - org 0x0 ; - - db 'MENUET01' ; 8- MenuetOS - dd 0x01 ; ( 1) - dd START ; - dd I_END ; - dd 0x11000 ; - dd 0x11000 ; - dd 0x0 ; ( ) - dd 0x0 ; - -include 'macros.inc' ; ! - -;--------------------------------------------------------------------- -;--- ---------------------------------------------- -;--------------------------------------------------------------------- - -START: - -red: ; - call draw_window ; - -;--------------------------------------------------------------------- -;--- ---------------------------------------- -;--------------------------------------------------------------------- - -still: - mcall 10 ; 10 - - - cmp eax,1 ; ? - je red ; - red - cmp eax,2 ; ? - je key ; - key - cmp eax,3 ; ? - je button ; - button - - jmp still ; - - - -;--------------------------------------------------------------------- - - - key: ; - mcall 2 ; 2 - ( ah) - - jmp still ; - -;--------------------------------------------------------------------- - - button: - mcall 17 ; 17 - -; 2,3,4,5 - load tray CD0/CD1/CD2/CD3 - movzx ecx, ah - sub ecx, 2 - cmp ecx, 3 - ja b6 - mcall 24,5 - jmp red - b6: -; 6,7,8,9 - eject tray CD0/CD1/CD2/CD3 - sub ecx, 4 - cmp ecx, 3 - ja b1 - mcall 24,4 - jmp red - b1: - cmp ah, 1 ; 1, - jne still ; - - .exit: - mcall -1 ; - - - -;--------------------------------------------------------------------- -;--- ---------------------------------- -;--------------------------------------------------------------------- - -draw_window: - mcall 12, 1 ; 12: - ; 1 - - ; - - if lang eq it_IT - mcall 0, <100,250>, <100,110>, 0x03AABBCC, 0x805080D0, 0x005080D0 - else - mcall 0, <100,230>, <100,110>, 0x03AABBCC, 0x805080D0, 0x005080D0 - end if - mcall 71, 1 ,header - mcall 8,<15,42>,<40,20>,2,0xaaaaaa - call draw_buttons - mov edx,6 - add ecx,30 shl 16 - mcall - call draw_buttons - - if lang eq it_IT - mcall 4, <16,25>, 0x80ffffff,text1 - else - mcall 4, <25,25>, 0x80ffffff,text1 - end if - mov edx,text2 - - add ebx,3 shl 16+20 - mcall - mov edx,text3 - add ebx,30 - sub ebx,3 shl 16 - mcall - - mcall 12, 2 ; 12: - ; 2, - - ret ; - -draw_buttons: - pusha - if lang eq it_IT - add ebx,60 shl 16 - else - add ebx,50 shl 16 - end if - inc edx - mcall - if lang eq it_IT - add ebx,60 shl 16 - else - add ebx,50 shl 16 - end if - inc edx - mcall - if lang eq it_IT - add ebx,60 shl 16 - else - add ebx,50 shl 16 - end if - inc edx - mcall - popa - ret -;--------------------------------------------------------------------- -;--- ---------------------------------------------- -;--------------------------------------------------------------------- -header db ' ATAPI Device Tray Control',0 -if lang eq it_IT - text3 db 'espelli espelli espelli espelli',0 - text2 db 'carica carica carica carica',0 - text1 db '/cd0/ /cd1/ /cd2/ /cd3/',0 -else - text3 db 'eject eject eject eject',0 - text2 db 'load load load load',0 - text1 db '/cd0/ /cd1/ /cd2/ /cd3/',0 -end if - -;--------------------------------------------------------------------- - -I_END: ; +; +; ATAPI +; 22.07.2007 Mario79 +;--------------------------------------------------------------------- + + use32 ; 32- + org 0x0 ; + + db 'MENUET01' ; 8- MenuetOS + dd 0x01 ; ( 1) + dd START ; + dd I_END ; + dd 0x11000 ; + dd 0x11000 ; + dd 0x0 ; ( ) + dd 0x0 ; + +; Language support for locales: it_IT, en_US. + +include 'macros.inc' ; ! + +;--------------------------------------------------------------------- +;--- ---------------------------------------------- +;--------------------------------------------------------------------- + +START: + +red: ; + call draw_window ; + +;--------------------------------------------------------------------- +;--- ---------------------------------------- +;--------------------------------------------------------------------- + +still: + mcall 10 ; 10 - + + cmp eax,1 ; ? + je red ; - red + cmp eax,2 ; ? + je key ; - key + cmp eax,3 ; ? + je button ; - button + + jmp still ; - + + +;--------------------------------------------------------------------- + + + key: ; + mcall 2 ; 2 - ( ah) + + jmp still ; + +;--------------------------------------------------------------------- + + button: + mcall 17 ; 17 - +; 2,3,4,5 - load tray CD0/CD1/CD2/CD3 + movzx ecx, ah + sub ecx, 2 + cmp ecx, 3 + ja b6 + mcall 24,5 + jmp red + b6: +; 6,7,8,9 - eject tray CD0/CD1/CD2/CD3 + sub ecx, 4 + cmp ecx, 3 + ja b1 + mcall 24,4 + jmp red + b1: + cmp ah, 1 ; 1, + jne still ; + + .exit: + mcall -1 ; + + + +;--------------------------------------------------------------------- +;--- ---------------------------------- +;--------------------------------------------------------------------- + +draw_window: + mcall 12, 1 ; 12: + ; 1 - + ; + + if lang eq it_IT + mcall 0, <100,250>, <100,110>, 0x03AABBCC, 0x805080D0, 0x005080D0 + else ; Default to en_US + mcall 0, <100,230>, <100,110>, 0x03AABBCC, 0x805080D0, 0x005080D0 + end if + mcall 71, 1 ,header + mcall 8,<15,42>,<40,20>,2,0xaaaaaa + call draw_buttons + mov edx,6 + add ecx,30 shl 16 + mcall + call draw_buttons + + if lang eq it_IT + mcall 4, <16,25>, 0x80ffffff,text1 + else ; Default to en_US + mcall 4, <25,25>, 0x80ffffff,text1 + end if + mov edx,text2 + + add ebx,3 shl 16+20 + mcall + mov edx,text3 + add ebx,30 + sub ebx,3 shl 16 + mcall + + mcall 12, 2 ; 12: + ; 2, + + ret ; + +draw_buttons: + pusha + if lang eq it_IT + add ebx,60 shl 16 + else ; Default to en_US + add ebx,50 shl 16 + end if + inc edx + mcall + if lang eq it_IT + add ebx,60 shl 16 + else ; Default to en_US + add ebx,50 shl 16 + end if + inc edx + mcall + if lang eq it_IT + add ebx,60 shl 16 + else ; Default to en_US + add ebx,50 shl 16 + end if + inc edx + mcall + popa + ret +;--------------------------------------------------------------------- +;--- ---------------------------------------------- +;--------------------------------------------------------------------- +header db ' ATAPI Device Tray Control',0 +if lang eq it_IT + text3 db 'espelli espelli espelli espelli',0 + text2 db 'carica carica carica carica',0 + text1 db '/cd0/ /cd1/ /cd2/ /cd3/',0 +else ; Default to en_US + text3 db 'eject eject eject eject',0 + text2 db 'load load load load',0 + text1 db '/cd0/ /cd1/ /cd2/ /cd3/',0 +end if + +;--------------------------------------------------------------------- + +I_END: ; diff --git a/programs/system/cpu/trunk/cpu.asm b/programs/system/cpu/trunk/cpu.asm index 40f9e127e..da50e176a 100644 --- a/programs/system/cpu/trunk/cpu.asm +++ b/programs/system/cpu/trunk/cpu.asm @@ -6,7 +6,7 @@ use32 org 0x0 - + db "MENUET01" ; 8 byte id dd 0x01 ; header version dd START ; start of code @@ -16,7 +16,7 @@ dd 0x0 ; boot parameters dd cur_dir_path ; path ;------------------------------------------------------------------------------- -include "lang.inc" +include "lang.inc" ; Language support for locales (UTF-8): de_DE, et_EE, ru_RU, it_IT, en_US. include "../../../macros.inc" include "../../../develop/libraries/box_lib/trunk/box_lib.mac" include "../../../KOSfuncs.inc" @@ -43,7 +43,7 @@ EDITBOX: .Y = UNDERTABLE.Y + BUTTON.HEIGHT + 20 .WIDTH = 465 .HEIGHT = 23 - + CHECKBOX: .X = PROCESS_TABLE.X .Y = UNDERTABLE.Y + BUTTON.HEIGHT + 25 @@ -300,7 +300,7 @@ draw_next_process: add ebx, BUTTON.WIDTH mcall -;create terminate process button +;create terminate process button ;mov ecx,[curposy] shl ecx,16 mov cx, BUTTON.HEIGHT @@ -478,7 +478,7 @@ align 4 ;show window y size movzx eax, word [process_info_buffer.box.top] add ebx, 70 shl 16 - call draw_ra_dec_number + call draw_ra_dec_number pop edi ;------------------------------------------------------------------------------- align 4 @@ -515,36 +515,36 @@ draw_window: test [window_status],10b ; window is minimized to panel jnz .exit - + mov eax, strings.process_name mov ebx, 130 shl 16 + 5 xor ecx, ecx call draw_ra_text - + mov eax, strings.ptid add ebx, 80 shl 16 call draw_ra_text - + mov eax, strings.cpu_usage_cycles add ebx, 100 shl 16 call draw_ra_text - + mov eax, strings.cpu_usage_percent add ebx, 55 shl 16 call draw_ra_text - + mov eax, strings.memory_usage add ebx, 60 shl 16 call draw_ra_text - + mov eax, strings.window_stack_pos add ebx, 70 shl 16 call draw_ra_text - + mov eax, strings.window_position.x add ebx, 70 shl 16 call draw_ra_text - + mov eax, strings.window_position.y add ebx, 70 shl 16 call draw_ra_text @@ -621,7 +621,7 @@ align 4 align 4 .exit: ret - + ;------------------------------------------------------------------------------- draw_ra_dec_number: @@ -638,13 +638,13 @@ draw_ra_dec_number: ror ebx, 16 mov ebp, eax - + test edx, edx jz .no_postfix - + mov eax, edx call count_utf8z_chars - + test eax, eax jz .no_postfix push ecx @@ -655,13 +655,13 @@ draw_ra_dec_number: mcall SF_DRAW_TEXT ror ebx, 16 pop ecx - + .no_postfix: mov eax, ebp push edx xor edi, edi - + mov esi, 10 @@: xor edx, edx @@ -681,7 +681,7 @@ draw_ra_dec_number: sub dx, ax rol edx, 16 mcall SF_DRAW_NUMBER, (11 shl 16) or 0x80000000 - + popa ret ;------------------------------------------------------------------------------- @@ -702,7 +702,7 @@ draw_ra_data_size: cmp eax, 1024 ja @f jmp .draw_text - + @@: cmp eax, 1024*1024 jae @f @@ -710,7 +710,7 @@ draw_ra_data_size: div esi mov edx, strings.KB jmp .draw_text - + @@: cmp eax, 1024*1024*1024 jae @f @@ -718,15 +718,15 @@ draw_ra_data_size: div esi mov edx, strings.MB jmp .draw_text - + @@: mov esi, 1024*1024*1024 div esi mov edx, strings.GB - + .draw_text: call draw_ra_dec_number - + popa ret ;------------------------------------------------------------------------------- @@ -743,9 +743,9 @@ draw_ra_text: ror ebx, 16 mov edx, eax - + call count_utf8z_chars - + test eax, eax jz .ret lea eax, [eax*8] @@ -753,7 +753,7 @@ draw_ra_text: rol ebx, 16 or ecx, 0xB0000000 mcall SF_DRAW_TEXT - + .ret: popa ret @@ -773,7 +773,7 @@ draw_button_with_caption: ;ebx = x+width shl 16 + y ;------------------------------------------------------------------------------- pusha - + xor ebp, ebp mov edi, eax test eax, eax @@ -782,7 +782,7 @@ draw_button_with_caption: call count_utf8z_chars mov ebp, eax -.no_caption_0: +.no_caption_0: push ebx esi lea eax, [ebp*8] mov esi, edx @@ -804,7 +804,7 @@ draw_button_with_caption: mov ecx, esi or ecx, 0xB0000000 mcall SF_DRAW_TEXT - + .no_caption_1: popa ret @@ -820,7 +820,7 @@ count_utf8z_chars: push esi ebx mov esi, eax xor ebx, ebx - + .0: lodsb test al, al @@ -836,25 +836,25 @@ count_utf8z_chars: ja @f inc esi jmp .0 - + @@: cmp al, 0xEF ja @f inc esi inc esi jmp .0 - + @@: cmp al, 0xF7 ja .err add esi, 3 jmp .0 - + .ok: mov eax, ebx pop ebx esi ret - + .err: xor eax, eax pop ebx esi @@ -920,7 +920,7 @@ sys_reboot: strings: if lang eq de_DE .window_caption utf8z "Prozesse v0.2.3 - [Ctrl+Alt+Del]" - + .process_name utf8z "NAME/BEENDEN" .ptid utf8z "PID/TID" .cpu_usage_cycles utf8z "CPU(ZYKLEN)" @@ -929,21 +929,21 @@ if lang eq de_DE .window_stack_pos utf8z "W-STACK" .window_position.x utf8z " WIN-X" .window_position.y utf8z " WIN-Y" - + .previous_page utf8z "SEITE ZURUECK" .next_page utf8z "SEITE VOR" .reboot utf8z "REBOOT SYSTEM" .run utf8z "START" - + .checkbox_caption utf8z "System" - + .KB utf8z " KB" .MB utf8z " MB" .GB utf8z " GB" ;------------------------------------------------------------------------------- else if lang eq et_EE .window_caption utf8z "Protsessid v0.2.3 - [Ctrl+Alt+Del]" - + .process_name utf8z "NIMI/LÕPETA" .ptid utf8z "PID/TID" .cpu_usage_cycles utf8z "CPU(TSÜKLID)" @@ -952,21 +952,21 @@ else if lang eq et_EE .window_stack_pos utf8z "W-PUHVER" .window_position.x utf8z " WIN-X" .window_position.y utf8z " WIN-Y" - + .previous_page utf8z "EELMINE LEHT" .next_page utf8z "JÄRGMINE LEHT" .reboot utf8z "REBOODI SÜSTEEM" .run utf8z "START" - + .checkbox_caption utf8z "System" - + .KB utf8z " KB" .MB utf8z " MB" .GB utf8z " GB" ;------------------------------------------------------------------------------- else if lang eq ru_RU .window_caption utf8z "Диспетчер процессов v0.2.3 - [Ctrl+Alt+Del]" - + .process_name utf8z "ИМЯ/ЗАВЕРШИТЬ" .ptid utf8z "PID/TID" .cpu_usage_cycles utf8z "CPU(ТАКТЫ)" @@ -975,21 +975,21 @@ else if lang eq ru_RU .window_stack_pos utf8z "W-STACK" .window_position.x utf8z " WIN-X" .window_position.y utf8z " WIN-Y" - + .previous_page utf8z "ПРЕД. СТР." .next_page utf8z "СЛЕД. СТР." .reboot utf8z "ПЕРЕЗАГРУЗКА" .run utf8z "ЗАПУСК" - + .checkbox_caption utf8z "Системные" - + .KB utf8z " КБ" .MB utf8z " МБ" .GB utf8z " ГБ" ;------------------------------------------------------------------------------- else if lang eq it_IT .window_caption utf8z "Gestore processi v0.2.3 - [Ctrl+Alt+Del]" - + .process_name utf8z "NOME-PROGRAMMA" .ptid utf8z "PID/TID" .cpu_usage_cycles utf8z "CPU(CICLI)" @@ -998,21 +998,21 @@ else if lang eq it_IT .window_stack_pos utf8z "W-STACK" .window_position.x utf8z " WIN-X" .window_position.y utf8z " WIN-Y" - + .previous_page utf8z "INDIETRO" .next_page utf8z "AVANTI" .reboot utf8z "RIAVVIA SISTEMA" .run utf8z "START" - + .checkbox_caption utf8z "System" - + .KB utf8z " KB" .MB utf8z " MB" .GB utf8z " GB" ;------------------------------------------------------------------------------- -else +else ; Default to en_US .window_caption utf8z "Process manager v0.2.3 - [Ctrl+Alt+Del]" - + .process_name utf8z "NAME/TERMINATE" .ptid utf8z "PID/TID" .cpu_usage_cycles utf8z "CPU(CYCLES)" @@ -1021,15 +1021,15 @@ else .window_stack_pos utf8z "W-STACK" .window_position.x utf8z " WIN-X" .window_position.y utf8z " WIN-Y" - - + + .previous_page utf8z "PREV PAGE" .next_page utf8z "NEXT PAGE" .reboot utf8z "REBOOT SYSTEM" .run utf8z "RUN" - + .checkbox_caption utf8z "System" - + .KB utf8z " KB" .MB utf8z " MB" .GB utf8z " GB" diff --git a/programs/system/docpack/trunk/docpack.asm b/programs/system/docpack/trunk/docpack.asm index ae1d91377..d02dd3530 100755 --- a/programs/system/docpack/trunk/docpack.asm +++ b/programs/system/docpack/trunk/docpack.asm @@ -1,227 +1,227 @@ -;--------------------------------------------------------------------- -; -; DOCPAK FOR KOLIBRI v1.2 -; Written in pure assembly by Ivushkin Andrey aka Willow -; -;--------------------------------------------------------------------- - -FILE_COUNT=0 -DEF_FILE equ 'g' - -macro embed_docdir_file fn -{ - forward - local label,label2,label3 - dd label2-label - dd label-label3 - label3: - db fn - label: - file '%DOCDIR%' # fn - label2: - FILE_COUNT=FILE_COUNT+1 -} -macro embed_local_file fn -{ - forward - local label,label2,label3 - dd label2-label - dd label-label3 - label3: - db fn - label: - file fn - label2: - FILE_COUNT=FILE_COUNT+1 -} - - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd start ; start of code - dd I_END ; size of image - dd I_END+0x400 ; memory for app - dd I_END+0x400 ; esp - dd my_param , 0x0 ; I_Param , I_Icon -include '../../../macros.inc' -include 'lang.inc' - -start: - cmp [my_param],0 - je red - cmp [my_param],'a' - jb .par_a - cmp [my_param],'z' - jbe .ok2 - .par_a: - mov [my_param],DEF_FILE - .ok2: - movzx ecx,[my_param] - mov [my_param],'*' - .open: - sub ecx,'a'-1 - mov edx,embedded - xor esi,esi - .list: - lea edx,[edx+esi+8] - mov esi,[edx-8] - add edx,[edx-4] - test esi,esi - jz .close - loop .list - push edx -; convert number in esi to decimal representation - mov ecx, 10 - push -'0' - mov eax, esi -@@: - xor edx, edx - div ecx - push edx - test eax, eax - jnz @b - mov edi, fsize -@@: - pop eax - add al, '0' - stosb - jnz @b - mcall 70,fileinfo - mov ecx,eax - mcall 5,20 - pop edx - mcall 60,2 - cmp [my_param],'*' - jne still - .close: - mcall -1 - -red: - mov [my_param],'a' - - mcall 48, 3, sc, sizeof.system_colors - - mcall 12,1 - -BTN_H equ 21 - - mov edx,[sc.work] - or edx,0x34000000 - mcall 0, <220,141>, <30,FILECOUNT*(BTN_H+3)+37>, , ,title - - mov ecx,FILECOUNT - mov ebx,23 shl 16+100 - mov esi,[sc.work_button] - mov edi,5 shl 16+BTN_H - mov edx,10 - mov eax,8 - .btnlp: - push ecx - mcall ,,edi - add edi,(BTN_H+3) shl 16 - inc edx - pop ecx - loop .btnlp - mov ecx,FILECOUNT - mov edx,embedded - xor edi,edi - mov ebx,30 shl 16+8 - mov eax,4 - .list: - lea edx,[edx+edi+8] - mov edi,[edx-8] - pusha - sub ebx,20 shl 16 - mov ecx, [sc.work_text] - or ecx, 0x30000000 - mcall ,,,my_param,1 - inc [my_param] - popa - push ecx - mov esi, [edx-4] - sub esi, 4 ;remove .txt extension - mov ecx, [sc.work_button_text] - or ecx, 0x30000000 - mcall - pop ecx - add esi, 4 - add edx, esi - add ebx,(BTN_H+3) - loop .list - mcall 12,2 - -still: - mcall 10 - cmp eax,1 - je red - cmp eax,2 - jne .nokey - mcall 2 - cmp ah,27 ;Esc - je start.close - cmp ah,'a' - jb still - cmp ah,'a'+FILECOUNT - jae still - jmp .cxax - .nokey: - mcall 17 - cmp ah,1 - je start.close - sub ah,10-'a' - .cxax: - movzx ecx,ah - jmp start.open - -fileinfo: - dd 7 - dd 0 - dd param - dd 0 ,0 - db '/sys/TINYPAD',0 - -param db '*' -fsize: - times 10 db '0' - db 0 - -embedded: - -; Please use only filenames w/o path! - -; -- Start of embedding area ------ - embed_docdir_file 'CREDITS.TXT' ;a -if lang eq ru_RU - embed_docdir_file 'GNU.TXT' ;b -else - embed_docdir_file 'COPYING.TXT' ;b -end if - embed_docdir_file 'HOT_KEYS.TXT' ;c - embed_local_file 'FASM.TXT' ;d - embed_docdir_file 'MTDBG.TXT' ;e -if lang eq ru_RU - embed_local_file 'SYSFUNCR.TXT' ;f -else - embed_local_file 'SYSFUNCS.TXT' ;f -end if - embed_local_file 'STACK.TXT' ;g - embed_docdir_file 'KFAR_KEYS.TXT' ;h - embed_docdir_file 'INI.TXT' ;i - embed_docdir_file 'OPENDIAL.TXT' ;j -; -- End of embedding area ------- - - dd 0 -FILECOUNT = FILE_COUNT - - if ~ FILECOUNT>0 - error 'No embedded files' - end if - -my_param db 0 - rb 256 -I_END: - -title db 'Doc Pack',0 - -sc system_colors +;--------------------------------------------------------------------- +; +; DOCPAK FOR KOLIBRI v1.2 +; Written in pure assembly by Ivushkin Andrey aka Willow +; +;--------------------------------------------------------------------- + +FILE_COUNT=0 +DEF_FILE equ 'g' + +macro embed_docdir_file fn +{ + forward + local label,label2,label3 + dd label2-label + dd label-label3 + label3: + db fn + label: + file '%DOCDIR%' # fn + label2: + FILE_COUNT=FILE_COUNT+1 +} +macro embed_local_file fn +{ + forward + local label,label2,label3 + dd label2-label + dd label-label3 + label3: + db fn + label: + file fn + label2: + FILE_COUNT=FILE_COUNT+1 +} + + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd start ; start of code + dd I_END ; size of image + dd I_END+0x400 ; memory for app + dd I_END+0x400 ; esp + dd my_param , 0x0 ; I_Param , I_Icon +include '../../../macros.inc' +include 'lang.inc' ; Language support for locales: ru_RU, en_US. + +start: + cmp [my_param],0 + je red + cmp [my_param],'a' + jb .par_a + cmp [my_param],'z' + jbe .ok2 + .par_a: + mov [my_param],DEF_FILE + .ok2: + movzx ecx,[my_param] + mov [my_param],'*' + .open: + sub ecx,'a'-1 + mov edx,embedded + xor esi,esi + .list: + lea edx,[edx+esi+8] + mov esi,[edx-8] + add edx,[edx-4] + test esi,esi + jz .close + loop .list + push edx +; convert number in esi to decimal representation + mov ecx, 10 + push -'0' + mov eax, esi +@@: + xor edx, edx + div ecx + push edx + test eax, eax + jnz @b + mov edi, fsize +@@: + pop eax + add al, '0' + stosb + jnz @b + mcall 70,fileinfo + mov ecx,eax + mcall 5,20 + pop edx + mcall 60,2 + cmp [my_param],'*' + jne still + .close: + mcall -1 + +red: + mov [my_param],'a' + + mcall 48, 3, sc, sizeof.system_colors + + mcall 12,1 + +BTN_H equ 21 + + mov edx,[sc.work] + or edx,0x34000000 + mcall 0, <220,141>, <30,FILECOUNT*(BTN_H+3)+37>, , ,title + + mov ecx,FILECOUNT + mov ebx,23 shl 16+100 + mov esi,[sc.work_button] + mov edi,5 shl 16+BTN_H + mov edx,10 + mov eax,8 + .btnlp: + push ecx + mcall ,,edi + add edi,(BTN_H+3) shl 16 + inc edx + pop ecx + loop .btnlp + mov ecx,FILECOUNT + mov edx,embedded + xor edi,edi + mov ebx,30 shl 16+8 + mov eax,4 + .list: + lea edx,[edx+edi+8] + mov edi,[edx-8] + pusha + sub ebx,20 shl 16 + mov ecx, [sc.work_text] + or ecx, 0x30000000 + mcall ,,,my_param,1 + inc [my_param] + popa + push ecx + mov esi, [edx-4] + sub esi, 4 ;remove .txt extension + mov ecx, [sc.work_button_text] + or ecx, 0x30000000 + mcall + pop ecx + add esi, 4 + add edx, esi + add ebx,(BTN_H+3) + loop .list + mcall 12,2 + +still: + mcall 10 + cmp eax,1 + je red + cmp eax,2 + jne .nokey + mcall 2 + cmp ah,27 ;Esc + je start.close + cmp ah,'a' + jb still + cmp ah,'a'+FILECOUNT + jae still + jmp .cxax + .nokey: + mcall 17 + cmp ah,1 + je start.close + sub ah,10-'a' + .cxax: + movzx ecx,ah + jmp start.open + +fileinfo: + dd 7 + dd 0 + dd param + dd 0 ,0 + db '/sys/TINYPAD',0 + +param db '*' +fsize: + times 10 db '0' + db 0 + +embedded: + +; Please use only filenames w/o path! + +; -- Start of embedding area ------ + embed_docdir_file 'CREDITS.TXT' ;a +if lang eq ru_RU + embed_docdir_file 'GNU.TXT' ;b +else ; Default to en_US + embed_docdir_file 'COPYING.TXT' ;b +end if + embed_docdir_file 'HOT_KEYS.TXT' ;c + embed_local_file 'FASM.TXT' ;d + embed_docdir_file 'MTDBG.TXT' ;e +if lang eq ru_RU + embed_local_file 'SYSFUNCR.TXT' ;f +else ; Default to en_US + embed_local_file 'SYSFUNCS.TXT' ;f +end if + embed_local_file 'STACK.TXT' ;g + embed_docdir_file 'KFAR_KEYS.TXT' ;h + embed_docdir_file 'INI.TXT' ;i + embed_docdir_file 'OPENDIAL.TXT' ;j +; -- End of embedding area ------- + + dd 0 +FILECOUNT = FILE_COUNT + + if ~ FILECOUNT>0 + error 'No embedded files' + end if + +my_param db 0 + rb 256 +I_END: + +title db 'Doc Pack',0 + +sc system_colors diff --git a/programs/system/end/light/data.inc b/programs/system/end/light/data.inc index f6b3faf02..ac7525f35 100644 --- a/programs/system/end/light/data.inc +++ b/programs/system/end/light/data.inc @@ -1,68 +1,71 @@ -WIN_W = 440 -WIN_H = 200 -BOT_PANEL_H = 70 -;--------------------------------------------------------------------- -CANCEL_BUTTON_ID = 1+BT_HIDE -HOME_BUTTON_ID = 2 -REBOOT_BUTTON_ID = 3 -POWEROFF_BUTTON_ID = 4 -CHECKBOX_BUTTON_ID = 5+BT_HIDE -;--------------------------------------------------------------------- -TEXT_HOME: db 'Home',0 -TEXT_ENTER: db 'Enter',0 -TEXT_END: db 'End',0 -TEXT_CANCEL: db 'x',0 -;--------------------------------------------------------------------- -if lang eq ru_RU - TEXT_WTITLE: db '襭 ࠡ',0 - TEXT_RDSAVE1: db '࠭ , ᤥ ',0 - TEXT_RDSAVE2: db ' ࠡ ⥬ (Ctrl+S)',0 - TEXT_KERNEL: db '',0 - TEXT_REBOOT: db '१㧪',0 - TEXT_OFF: db '몫祭',0 - TEXT_SAVING: db '࠭ ࠧ...',0 -else if lang eq de_DE - TEXT_WTITLE: db 'Shutdown computer',0 - TEXT_RDSAVE1: db 'Save all changes that were done',0 - TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 - TEXT_KERNEL: db 'Kernel',0 - TEXT_REBOOT: db 'Neustart',0 - TEXT_OFF: db 'Beenden',0 - TEXT_SAVING: db 'Saving RAM-drive...',0 -else if lang eq it_IT - TEXT_WTITLE: db 'Shutdown computer',0 - TEXT_RDSAVE1: db 'Save all changes that were done',0 - TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 - TEXT_KERNEL: db 'Kernel',0 - TEXT_REBOOT: db 'Riavvio',0 - TEXT_OFF: db 'Spegni',0 - TEXT_SAVING: db 'Saving RAM-drive...',0 -else - TEXT_WTITLE: db 'Shutdown computer',0 - TEXT_RDSAVE1: db 'Save all changes that were done',0 - TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 - TEXT_KERNEL: db 'Kernel',0 - TEXT_REBOOT: db 'Reboot',0 - TEXT_OFF: db 'Power off',0 - TEXT_SAVING: db 'Saving RAM-drive...',0 -end if -;--------------------------------------------------------------------- -rdsave: - dd SSF_START_APP,0,hide,0,0 - db '/sys/rdsave',0 -hide db 'h',0 -asettings db 'settings',0 -aautosave db 'autosave',0 -ini_file db '/sys/settings/rdsave.ini',0 -;--------------------------------------------------------------------- -importLib: -library \ - libini, 'libini.obj' - -import libini, \ - ini_set_int ,'ini_set_int', \ - ini_get_int ,'ini_get_int' -;--------------------------------------------------------------------- -checkbox_sharedname db 'CHECKBOX',0 -checkbox_img dd ? -;--------------------------------------------------------------------- +WIN_W = 440 +WIN_H = 200 +BOT_PANEL_H = 70 +;--------------------------------------------------------------------- +CANCEL_BUTTON_ID = 1+BT_HIDE +HOME_BUTTON_ID = 2 +REBOOT_BUTTON_ID = 3 +POWEROFF_BUTTON_ID = 4 +CHECKBOX_BUTTON_ID = 5+BT_HIDE +;--------------------------------------------------------------------- +TEXT_HOME: db 'Home',0 +TEXT_ENTER: db 'Enter',0 +TEXT_END: db 'End',0 +TEXT_CANCEL: db 'x',0 +;--------------------------------------------------------------------- + +; Language support for locales: ru_RU (CP866), de_DE, it_IT, en_US + +if lang eq ru_RU + TEXT_WTITLE: db '襭 ࠡ',0 + TEXT_RDSAVE1: db '࠭ , ᤥ ',0 + TEXT_RDSAVE2: db ' ࠡ ⥬ (Ctrl+S)',0 + TEXT_KERNEL: db '',0 + TEXT_REBOOT: db '१㧪',0 + TEXT_OFF: db '몫祭',0 + TEXT_SAVING: db '࠭ ࠧ...',0 +else if lang eq de_DE + TEXT_WTITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Neustart',0 + TEXT_OFF: db 'Beenden',0 + TEXT_SAVING: db 'Saving RAM-drive...',0 +else if lang eq it_IT + TEXT_WTITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Riavvio',0 + TEXT_OFF: db 'Spegni',0 + TEXT_SAVING: db 'Saving RAM-drive...',0 +else ; Default to en_US + TEXT_WTITLE: db 'Shutdown computer',0 + TEXT_RDSAVE1: db 'Save all changes that were done',0 + TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0 + TEXT_KERNEL: db 'Kernel',0 + TEXT_REBOOT: db 'Reboot',0 + TEXT_OFF: db 'Power off',0 + TEXT_SAVING: db 'Saving RAM-drive...',0 +end if +;--------------------------------------------------------------------- +rdsave: + dd SSF_START_APP,0,hide,0,0 + db '/sys/rdsave',0 +hide db 'h',0 +asettings db 'settings',0 +aautosave db 'autosave',0 +ini_file db '/sys/settings/rdsave.ini',0 +;--------------------------------------------------------------------- +importLib: +library \ + libini, 'libini.obj' + +import libini, \ + ini_set_int ,'ini_set_int', \ + ini_get_int ,'ini_get_int' +;--------------------------------------------------------------------- +checkbox_sharedname db 'CHECKBOX',0 +checkbox_img dd ? +;--------------------------------------------------------------------- diff --git a/programs/system/format/format.asm b/programs/system/format/format.asm index 069801dfc..d19428471 100644 --- a/programs/system/format/format.asm +++ b/programs/system/format/format.asm @@ -1,866 +1,866 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Formatting Disk Utility ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Compile with FASM -; FORMAT ver. Oct 19, 2018 - -; Copyright (c) 2018, Efremenkov Sergey aka TheOnlyMirage -; All rights reserved. -; Redistribution and use in source and binary forms, with or without modification, -; are permitted provided that the following conditions are met: -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation and/or -; other materials provided with the distribution. -; * Neither the name of the nor the names of its contributors may -; be used to endorse or promote products derived from this software without -; specific prior written permission. - -; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -; -------------------------------------------------------------------------------------- -format binary as "" - -use32 -org 0 - -db 'MENUET01' -dd 1 -dd START -dd I_END -dd MEM -dd STACKTOP -dd 0, 0 - -KMENUITEM_NORMAL equ 0 -KMENUITEM_SUBMENU equ 1 -KMENUITEM_SEPARATOR equ 2 - -include 'lang.inc' -include '../../macros.inc' -include '../../proc32.inc' -include '../../KOSfuncs.inc' -include '../../dll.inc' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' ;for uses checkBox and editBox -include '../../load_lib.mac' -@use_library - -START: - mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors ;get system colors - - stdcall dll.Load, @IMPORT - or eax, eax - jnz exit - - load_libraries l_libs_start,load_lib_end - stdcall [OpenDialog_Init],OpenDialog_data - - ;set mask for events: - ; , , , (- - ; ) - mcall SF_SET_EVENTS_MASK, 0x27 - - mov ecx,[sc.work_text] - and ecx,0x9FFFFFFF - or ecx,0x90000000 - - call initBuf - - mov dword[editLabel.text_color], ecx - mov dword[editMBR.text_color], ecx - - invoke init_checkbox, ch1 - invoke init_checkbox, ch2 - - stdcall [kmenu_init], sc - stdcall [ksubmenu_new] - mov [kmFS], eax - - stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmNone, 110 - stdcall [ksubmenu_add], [kmFS], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmFat16, 111 - stdcall [ksubmenu_add], [kmFS], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmFat32, 112 - stdcall [ksubmenu_add], [kmFS], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmNTFS, 113 - stdcall [ksubmenu_add], [kmFS], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmExt2, 114 - stdcall [ksubmenu_add], [kmFS], eax - mov byte[kmID], 0 - - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, kmFat16, [kmFS] - - - stdcall [ksubmenu_new] - mov [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.0, 120 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.1, 121 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.2, 122 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.3, 123 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.4, 124 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.5, 125 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.6, 126 - stdcall [ksubmenu_add], [kmUnit], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.7, 127 - stdcall [ksubmenu_add], [kmUnit], eax - mov byte[kmUnitID], 0 - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, unittext.0, [kmUnit] - - call getDeviceList - - call draw_window - -event_wait: - mcall SF_WAIT_EVENT - - cmp eax, 1 ; Event redraw - je redraw - - cmp eax, 2 ; Event key in buffer ? - je key - - cmp eax, 3 ; Event button in buffer ? - je button - - cmp eax, 6 ; Event mouse in buffer ? - je mouse - - jmp event_wait - - -redraw: - call draw_window - jmp event_wait - -key: - mcall SF_GET_KEY - invoke edit_box_key, editLabel - invoke edit_box_key, editMBR - jmp event_wait - -button: - mcall SF_GET_BUTTON - - cmp ah, 1 ;Close button - jne @f -exit: - mcall SF_TERMINATE_PROCESS -@@: - cmp ah, 2 ;Format button - jne @f - call butFormat - jmp event_wait -@@: - cmp ah, 3 ;Brouse button - jne @f - call butBrouse - jmp event_wait -@@: - cmp ah, 4 ;Select FS button - jne @f - call butSelectFS - jmp event_wait -@@: - cmp ah, 5 ;Select unit size button - jne @f - call butUnit - jmp event_wait -@@: - cmp ah, 6 ;Select Device button - jne @f - call butDevice - jmp event_wait -@@: - cmp ah, 110 ;kmenu list FS - jb @f - cmp ah, 114 - ja @f - sub ah, 110 - mov byte[kmID], ah - jmp redraw -@@: - cmp ah, 120 ;kmenu Unit Size - jb @f - cmp ah, 127 - ja @f - sub ah, 120 - mov byte[kmUnitID], ah - jmp redraw -@@: - cmp ah, 130 ;kmenu Device - jb @f - cmp ah, 250 - ja @f - sub ah, 130 - mov byte[kmDeviceID], ah - jmp redraw -@@: - jmp event_wait - -mouse: - invoke check_box_mouse, ch1 ; - invoke check_box_mouse, ch2 - - invoke edit_box_mouse, editLabel ; editBox' - invoke edit_box_mouse, editMBR - - stdcall [kmainmenu_dispatch_cursorevent], [kmFS] - jmp event_wait - -butBrouse: - call but_open_dlg - ret - -butFormat: - ret - -butSelectFS: - push eax ebx ecx - mcall SF_THREAD_INFO, pi, -1 ;get window coord - - mov eax, dword[pi+34] - add eax, Otstup - mov word[coord.x], ax - - mov eax, dword[pi+38] - add eax, 129 - mov word[coord.y], ax - - stdcall [ksubmenu_draw], [kmFS], coord - pop ecx ebx eax - ret - -butUnit: - push eax ebx ecx - mcall SF_THREAD_INFO, pi, -1 - - mov eax, dword[pi+34] - add eax, Otstup+80+30+delta - mov word[coordUnit.x], ax - - mov eax, dword[pi+38] - add eax, 129 - mov word[coordUnit.y], ax - - stdcall [ksubmenu_draw], [kmUnit], coordUnit - pop ecx ebx eax - ret - -butDevice: - push eax ebx ecx - mcall SF_THREAD_INFO, pi, -1 - - mov eax, dword[pi+34] - add eax, Otstup+80+30+delta - mov word[coordDevice.x], ax - - mov eax, dword[pi+38] - add eax, 79 - mov word[coordDevice.y], ax - - stdcall [ksubmenu_draw], [kmDevice], coordDevice - pop ecx ebx eax - ret - - -delta = 50 -dy = 15 + 40 -warning_title: db 'Warning!',0 -draw_warningWindow: - ret - -draw_window: - mcall SF_REDRAW, SSF_BEGIN_DRAW - - mov eax, SF_CREATE_WINDOW ; define and draw window - mov ebx, 100 * 65536 + (290+delta) ; [x start] *65536 + [x size] - mov ecx, 100 * 65536 + (310+dy) ; [y start] *65536 + [y size] - mov edx,[sc.work] ;0x14FFFFFF - add edx, 0x14000000 ; color of work area RRGGBB - ; 0x02000000 = window type 4 (fixed size, skinned window) - mov esi, 0x808899ff ; color of grab bar RRGGBB - ; 0x80000000 = color glide - mov edi, title - mcall - - - mov esi, 0xAABBCC - mcall SF_DEFINE_BUTTON, (290+delta-Otstup-130+10)*65536+130, (270+dy)*65536+(20+3), 2 - - inc edx - mcall , (290+delta-Otstup-50-2)*65536+(50+2), (210+dy)*65536+21 ;14 - - ;button select FS - inc edx - mov esi, 0xFFFFFF - mcall , Otstup*65536+120, (110)*65536+(21) - - ;button select unit size - inc edx - mcall , (Otstup+80+30+delta)*65536+120, (110)*65536+(21) - - ;button select device - inc edx - mcall , (Otstup+80+30+delta)*65536+120, (60)*65536+(21) - - invoke check_box_draw, ch1 ; - invoke check_box_draw, ch2 - - invoke edit_box_draw, editMBR ; edit box' - invoke edit_box_draw, editLabel - - call draw_super_text - - - mov ecx,[sc.work] - mov dword [frame_data.font_backgr_color],ecx - push dword frame_data - invoke frame_draw - - mov ecx,[sc.work] - mov dword [frame_data2.font_backgr_color],ecx - push dword frame_data2 - invoke frame_draw - - mcall SF_REDRAW, SSF_END_DRAW - ret - - - -Otstup = 30 - -; 0x224466 0x90000000 0 -ch1 check_box2 Otstup shl 16 + 12, (170+dy) shl 16 + 12, 6, 0xFFFFFFFF, 0xAABBCC, 0, ch_text.1, 100b ; 110b = ch_flag_en and ch_flag_middl -ch2 check_box2 Otstup shl 16 + 12, (190+dy) shl 16 + 12, 6, 0xFFFFFFFF, 0xAABBCC, 0, ch_text.2, 100b - - -browse db '...', 0 - -if lang eq ru_RU ; Russian language - -title db "Formatting Disk Utility", 0 - -ch_text: ;text for CheckBoxs -.1 db ' ଠ஢',0 -.2 db ' 㧮 , MBR:',0 - -text: - .volume db '⪠ ⮬:', 0 - .fs db ' ⥬:', 0 - .disk db '⥫:', 0 ;':', 0 - .unit db ' :', 0 - .option db 'ࠬ:', 0 - .format db 'ଠ஢', 0 - -unittext: - .0 db '512 ', 0 - .1 db '1024 ', 0 - .2 db '2048 ', 0 - .3 db '4096 ', 0 - .4 db '8192 ', 0 - .5 db '16 ', 0 - .6 db '32 ', 0 - .7 db '64 ', 0 - -else ; English language - -title db "Formatting Disk Utility", 0 - -ch_text: -.1 db 'Full and long disk formatting',0 -.2 db 'Create startup disk, write MBR:',0 - -text: - .volume db 'Volume Label:', 0 - .fs db 'File System:', 0 - .disk db 'Storage device:', 0 ;'Capacity:', 0 - .unit db 'Allocation unit size:', 0 - .option db 'Options:', 0 - .format db 'Format', 0 - -unittext: - .0 db '512 bytes', 0 - .1 db '1024 bytes', 0 - .2 db '2048 bytes', 0 - .3 db '4096 bytes', 0 - .4 db '8192 bytes', 0 - .5 db '16 Kb', 0 - .6 db '32 Kb', 0 - .7 db '64 Kb', 0 - -end if - - - -root_path: db "/", 0 - -align 4 -maxDeviceCount = 250-130 -read_folder_struct: - .subfunction dd 1 - .start dd 0 ;start block - .encoding dd 3 ;1-cp866, 2-UTF-16LE, 3-utf8 - .count dd maxDeviceCount ;count blocks - .return dd 0 ; - .name db 0 - .path_adr dd root_path -noneDevice: db '-', 0 -;adrDevice: dd 0 - -getDeviceList: - push eax ebx ecx esi - stdcall [ksubmenu_new] - mov [kmDevice], eax - sizeBDVK = 560 ;304 ; - - mcall SF_SYS_MISC, SSF_HEAP_INIT - - mcall SF_SYS_MISC, SSF_MEM_ALLOC, sizeBDVK*maxDeviceCount+32 - mov dword[read_folder_struct.return], eax - mcall SF_FILE, read_folder_struct - cmp eax, 0 - je .next - cmp eax, 6 - je .next - jmp .none -.next: - mov eax, dword[read_folder_struct.return] - mov esi, deviceAdrStr - add eax, 32 - mov ecx, 130 -@@: - cmp ebx, 0 - je @f - push eax ebx ecx - add eax, 40 - ;mov [adrDevice], eax - mov dword[esi], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, [esi], ecx ; [adrDevice], ecx - stdcall [ksubmenu_add], [kmDevice], eax - pop ecx ebx eax - add esi, 4 - inc ecx - dec ebx - add eax, sizeBDVK - cmp ecx, 250 - ja @f - jmp @b -.none: - stdcall [kmenuitem_new], KMENUITEM_NORMAL, noneDevice, 130 - mov dword[esi], noneDevice - stdcall [ksubmenu_add], [kmDevice], eax -@@: - mov byte[kmDeviceID], 0 - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, unittext.0, [kmDevice] - pop esi ecx ebx eax - ret - - -draw_super_text: - push eax ebx ecx edx edi esi - mov ebx, Otstup * 65536 + 49-6 ; draw info text with function 4 (x, y) - mov ecx, 0x90000000 ;0x90224466 ;0x224466 - mov eax, text.volume - mov edx, eax - mov esi, 13 - mcall SF_DRAW_TEXT - - mov ebx, Otstup * 65536 + 99-6 - mov edx, text.fs - mov esi, 12 - mcall SF_DRAW_TEXT - - mov ebx, (Otstup+80+30+delta) * 65536 + 99-6 - mov edx, text.unit - mov esi, 21 - mcall SF_DRAW_TEXT - - mov ebx, (Otstup+80+30+delta) * 65536 + 49-6 - mov edx, text.disk - mov esi, 9 - mcall SF_DRAW_TEXT - -; mov ebx, Otstup * 65536 + (151-6+dy) -; mov edx, text.option -; mov esi, 8 -; mcall SF_DRAW_TEXT - - mov ebx, (Otstup+80+30+delta +5) * 65536 + (110+3) - mov dl, byte[kmUnitID] - cmp dl, 0 - jne @f - mov edx, unittext.0 - jmp .printUnit -@@: - cmp dl, 1 - jne @f - mov edx, unittext.1 - jmp .printUnit -@@: - cmp dl, 2 - jne @f - mov edx, unittext.2 - jmp .printUnit -@@: - cmp dl, 3 - jne @f - mov edx, unittext.3 - jmp .printUnit -@@: - cmp dl, 4 - jne @f - mov edx, unittext.4 - jmp .printUnit -@@: - cmp dl, 5 - jne @f - mov edx, unittext.5 - jmp .printUnit -@@: - cmp dl, 6 - jne @f - mov edx, unittext.6 - jmp .printUnit -@@: - cmp dl, 7 - jne @f - mov edx, unittext.7 - jmp .printUnit -@@: - mov byte[kmUnitID], 0 - mov edx, unittext.0 -.printUnit: - mcall SF_DRAW_TEXT - - mov ebx, (Otstup+5) * 65536 + (110+3) - mov dl, byte[kmID] - cmp dl, 0 - jne @f - mov edx, kmNone - jmp .printFS -@@: - cmp dl, 1 - jne @f - mov edx, kmFat16 - jmp .printFS -@@: - cmp dl, 2 - jne @f - mov edx, kmFat32 - jmp .printFS -@@: - cmp dl, 3 - jne @f - mov edx, kmNTFS - jmp .printFS -@@: - cmp dl, 4 - jne @f - mov edx, kmExt2 - jmp .printFS -@@: - mov byte[kmID], 0 - mov edx, kmNone -.printFS: - ;mov esi, 8 - mcall SF_DRAW_TEXT - - ;button device - mov ebx, (Otstup+80+30+delta +5) * 65536 + (60+3) - mov edx, dword[kmDeviceID] - shl edx, 2 - add edx, deviceAdrStr - mov edx, dword[edx] - ;call setCurrentDeviceInEDX - mcall SF_DRAW_TEXT - - ;buttons text - mov ebx, (290+delta-Otstup-130+10+2+10) * 65536 + (277-3+dy) - mov ecx, 0x90FFFFFF - mov eax, text.format - mov edx, eax - mov esi, 6 - mcall SF_DRAW_TEXT - - mov ebx, (290+delta-Otstup-52+6+8) * 65536 + (213+dy) - ;mov ecx, 0xFFFFFF - mov eax, browse ;text.browse - mov edx, eax - mov esi, 6 - mcall SF_DRAW_TEXT - - pop esi edi edx ecx ebx eax - ret - - - -Buf: - .1 db 'NONAME18',0,0 - ;.3 db 'hd0 [4Gb]',0,0 ;100 dup(0) - .5 rb 512 ;db '/sys/format/fat32mbr.bin', 0, 0 - -initBuf: - push eax ecx - ;buf.1 - label - mov dword[Buf.1], 'NONA' - mov dword[Buf.1+4], 'ME18' - mov word[Buf.1+8], 0 - - ;buf.5 - full name for file mbr - mov eax, Buf.5 - mov ecx, 512/4 -@@: - mov dword[eax], 4 - add eax, 4 - dec ecx - cmp ecx, 0 - je @f - jmp @b -@@: - - pop ecx eax - ret - - - -copyPath: - push eax ebx ecx edx ;copy file name path - mov eax, openfile_path - mov ebx, Buf.5 - mov ecx, 0 - @@: - mov dl, byte[eax] - cmp dl, 0 - je @f - mov byte[ebx], dl - inc eax - inc ebx - inc ecx - jmp @b - @@: - mov byte[ebx], 0 - mov dword[editMBR.size], ecx - mov dword[editMBR.pos], ecx - pop edx ecx ebx eax - ret - -align 4 -but_open_dlg: - pushad - copy_path open_dialog_name,communication_area_default_path,file_name,0 - mov [OpenDialog_data.type],0 - stdcall[OpenDialog_Start], OpenDialog_data - cmp [OpenDialog_data.status],2 - je @f - cmp [OpenDialog_data.status],0 ; Cancel? - je .end_open - ; - ;... - call copyPath - jmp .end_open - @@: - ; - ;... - .end_open: - popad - ret - -; -align 4 -OpenDialog_data: -.type dd 0 ;0 - , 1 - , 2 - -.procinfo dd procinfo -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 -.dir_default_path dd default_dir ;+20 -.start_path dd file_name ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -default_dir db '/sys',0 ; -communication_area_name: db 'FFFFFFFF_open_dialog',0 -open_dialog_name: db 'opendial',0 -communication_area_default_path: db '/sys/File managers/',0 - -Filter: -dd Filter.end - Filter.1 -.1: -;db 'BIN',0 -.end: -db 0 - - -align 16 -@IMPORT: -library box_lib, 'box_lib.obj' - -import box_lib,\ - edit_box_draw, 'edit_box_draw',\ - edit_box_key, 'edit_box_key',\ - edit_box_mouse, 'edit_box_mouse',\ - init_checkbox, 'init_checkbox2',\ - check_box_draw, 'check_box_draw2',\ - check_box_mouse, 'check_box_mouse2',\ - option_box_draw, 'option_box_draw',\ - option_box_mouse, 'option_box_mouse',\ - frame_draw, 'frame_draw' - -align 4 -import_libkmenu: - kmenu_init dd akmenu_init - kmainmenu_draw dd akmainmenu_draw - kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent - ksubmenu_new dd aksubmenu_new - ksubmenu_delete dd aksubmenu_delete - ksubmenu_draw dd aksubmenu_draw - ksubmenu_add dd aksubmenu_add - kmenuitem_new dd akmenuitem_new - kmenuitem_delete dd akmenuitem_delete - kmenuitem_draw dd akmenuitem_draw -dd 0,0 - akmenu_init db 'kmenu_init',0 - akmainmenu_draw db 'kmainmenu_draw',0 - akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 - aksubmenu_new db 'ksubmenu_new',0 - aksubmenu_delete db 'ksubmenu_delete',0 - aksubmenu_draw db 'ksubmenu_draw',0 - aksubmenu_add db 'ksubmenu_add',0 - akmenuitem_new db 'kmenuitem_new',0 - akmenuitem_delete db 'kmenuitem_delete',0 - akmenuitem_draw db 'kmenuitem_draw',0 - -align 4 -import_proclib: - OpenDialog_Init dd aOpenDialog_Init - OpenDialog_Start dd aOpenDialog_Start -dd 0,0 - aOpenDialog_Init db 'OpenDialog_init',0 - aOpenDialog_Start db 'OpenDialog_start',0 - -system_dir0 db '/sys/lib/' -lib0_name db 'proc_lib.obj',0 -lib1_name db 'kmenu.obj',0 - - -frame_data: -.type dd 0 ;+0 -.x: -.x_size dw 290+delta-2*(Otstup-10) ;+4 -.x_start dw Otstup-10 ;+6 -.y: -.y_size dw 80+20 ;+8 -.y_start dw 151-6+dy ;+10 -.ext_fr_col dd 0x888888 ;+12 -.int_fr_col dd 0xffffff ;+16 -.draw_text_flag dd 1 ;+20 -.text_pointer dd text.option ;+24 -.text_position dd 0 ;+28 -.font_number dd 1;0 ;+32 -.font_size_y dd 9 ;+36 -.font_color dd 0x000000 ;+40 -.font_backgr_color dd 0xFFFFFF ;dddddd ;+44 - -frame_data2: -.type dd 0 -.x: -.x_size dw 290+delta-2*(Otstup-10) -.x_start dw Otstup-10 -.y: -.y_size dw 110 -.y_start dw Otstup+5 -.ext_fr_col dd 0x888888 -.int_fr_col dd 0xffffff -.draw_text_flag dd 0;1 -.text_pointer dd 0 ;text.option -.text_position dd 0 -.font_number dd 0 -.font_size_y dd 9 -.font_color dd 0x0 -.font_backgr_color dd 0xdddddd - -;symbolDownArrow db 25,0 - -kmNone: db 'None', 0 ;only MBR or ZeroDestroy -;kmFat12: db 'FAT12', 0 -kmFat16: db 'FAT16', 0 -kmFat32: db 'FAT32', 0 -;kmExtFat: db 'EXTFAT', 0 -kmNTFS: db 'NTFS', 0 -kmExt2: db 'EXT2', 0 -;kmExt3: db 'EXT3', 0 -;kmExt4: db 'EXT4', 0 -;kmXFS: db 'XFS', 0 - -l_libs_start: - lib0 l_libs lib0_name, file_name, system_dir0, import_proclib - lib1 l_libs lib1_name, file_name, system_dir0, import_libkmenu -load_lib_end: - -;: 80 120 -editLabel edit_box 120,Otstup,60,0xffffff,0x6a9480,0,0xAABBCC,0,8,Buf.1, mouse_dd, 0,8,8 -;editRU edit_box 120,Otstup+80+30+delta,60,0xffffff,0x6a9480,0,0xAABBCC,0,16,Buf.3, mouse_dd, 0,16,16 -editMBR edit_box 290+delta-Otstup-52-Otstup-20,Otstup+20,210+dy,0xffffff,0x6a9480,0,0xAABBCC,0,255,Buf.5, mouse_dd, 0,0,0 ;25,25 - -data_of_code dd 0 - -sc system_colors -mouse_dd rd 1 - -coord: - .x: rw 1 - .y: rw 1 - -coordUnit: - .x: rw 1 - .y: rw 1 - -coordDevice: - .x: rw 1 - .y: rw 1 - -kmDeviceID: rd 1 -kmDevice: rd 1 - -kmUnitID: rd 1 -kmUnit: rd 1 - -kmID: rb 1 ; -kmFS: rd 1 -mbr: rb 512 - -sys_path: rb 4096 -file_name: rb 4096 -plugin_path: rb 4096 -openfile_path: rb 4096 -filename_area: rb 256 -rb 1024 -procinfo process_information -pi rb 1024 - -deviceAdrStr: rd maxDeviceCount - -I_END: - rb 256 -align 4 -STACKTOP: -MEM: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Formatting Disk Utility ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Compile with FASM +; FORMAT ver. Oct 19, 2018 + +; Copyright (c) 2018, Efremenkov Sergey aka TheOnlyMirage +; All rights reserved. +; Redistribution and use in source and binary forms, with or without modification, +; are permitted provided that the following conditions are met: +; * Redistributions of source code must retain the above copyright notice, this +; list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright notice, +; this list of conditions and the following disclaimer in the documentation and/or +; other materials provided with the distribution. +; * Neither the name of the nor the names of its contributors may +; be used to endorse or promote products derived from this software without +; specific prior written permission. + +; THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +; -------------------------------------------------------------------------------------- +format binary as "" + +use32 +org 0 + +db 'MENUET01' +dd 1 +dd START +dd I_END +dd MEM +dd STACKTOP +dd 0, 0 + +KMENUITEM_NORMAL equ 0 +KMENUITEM_SUBMENU equ 1 +KMENUITEM_SEPARATOR equ 2 + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../dll.inc' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' ;for uses checkBox and editBox +include '../../load_lib.mac' +@use_library + +START: + mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors ;get system colors + + stdcall dll.Load, @IMPORT + or eax, eax + jnz exit + + load_libraries l_libs_start,load_lib_end + stdcall [OpenDialog_Init],OpenDialog_data + + ;set mask for events: + ; , , , (- - ; ) + mcall SF_SET_EVENTS_MASK, 0x27 + + mov ecx,[sc.work_text] + and ecx,0x9FFFFFFF + or ecx,0x90000000 + + call initBuf + + mov dword[editLabel.text_color], ecx + mov dword[editMBR.text_color], ecx + + invoke init_checkbox, ch1 + invoke init_checkbox, ch2 + + stdcall [kmenu_init], sc + stdcall [ksubmenu_new] + mov [kmFS], eax + + stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmNone, 110 + stdcall [ksubmenu_add], [kmFS], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmFat16, 111 + stdcall [ksubmenu_add], [kmFS], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmFat32, 112 + stdcall [ksubmenu_add], [kmFS], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmNTFS, 113 + stdcall [ksubmenu_add], [kmFS], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, kmExt2, 114 + stdcall [ksubmenu_add], [kmFS], eax + mov byte[kmID], 0 + + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, kmFat16, [kmFS] + + + stdcall [ksubmenu_new] + mov [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.0, 120 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.1, 121 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.2, 122 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.3, 123 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.4, 124 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.5, 125 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.6, 126 + stdcall [ksubmenu_add], [kmUnit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, unittext.7, 127 + stdcall [ksubmenu_add], [kmUnit], eax + mov byte[kmUnitID], 0 + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, unittext.0, [kmUnit] + + call getDeviceList + + call draw_window + +event_wait: + mcall SF_WAIT_EVENT + + cmp eax, 1 ; Event redraw + je redraw + + cmp eax, 2 ; Event key in buffer ? + je key + + cmp eax, 3 ; Event button in buffer ? + je button + + cmp eax, 6 ; Event mouse in buffer ? + je mouse + + jmp event_wait + + +redraw: + call draw_window + jmp event_wait + +key: + mcall SF_GET_KEY + invoke edit_box_key, editLabel + invoke edit_box_key, editMBR + jmp event_wait + +button: + mcall SF_GET_BUTTON + + cmp ah, 1 ;Close button + jne @f +exit: + mcall SF_TERMINATE_PROCESS +@@: + cmp ah, 2 ;Format button + jne @f + call butFormat + jmp event_wait +@@: + cmp ah, 3 ;Brouse button + jne @f + call butBrouse + jmp event_wait +@@: + cmp ah, 4 ;Select FS button + jne @f + call butSelectFS + jmp event_wait +@@: + cmp ah, 5 ;Select unit size button + jne @f + call butUnit + jmp event_wait +@@: + cmp ah, 6 ;Select Device button + jne @f + call butDevice + jmp event_wait +@@: + cmp ah, 110 ;kmenu list FS + jb @f + cmp ah, 114 + ja @f + sub ah, 110 + mov byte[kmID], ah + jmp redraw +@@: + cmp ah, 120 ;kmenu Unit Size + jb @f + cmp ah, 127 + ja @f + sub ah, 120 + mov byte[kmUnitID], ah + jmp redraw +@@: + cmp ah, 130 ;kmenu Device + jb @f + cmp ah, 250 + ja @f + sub ah, 130 + mov byte[kmDeviceID], ah + jmp redraw +@@: + jmp event_wait + +mouse: + invoke check_box_mouse, ch1 ; + invoke check_box_mouse, ch2 + + invoke edit_box_mouse, editLabel ; editBox' + invoke edit_box_mouse, editMBR + + stdcall [kmainmenu_dispatch_cursorevent], [kmFS] + jmp event_wait + +butBrouse: + call but_open_dlg + ret + +butFormat: + ret + +butSelectFS: + push eax ebx ecx + mcall SF_THREAD_INFO, pi, -1 ;get window coord + + mov eax, dword[pi+34] + add eax, Otstup + mov word[coord.x], ax + + mov eax, dword[pi+38] + add eax, 129 + mov word[coord.y], ax + + stdcall [ksubmenu_draw], [kmFS], coord + pop ecx ebx eax + ret + +butUnit: + push eax ebx ecx + mcall SF_THREAD_INFO, pi, -1 + + mov eax, dword[pi+34] + add eax, Otstup+80+30+delta + mov word[coordUnit.x], ax + + mov eax, dword[pi+38] + add eax, 129 + mov word[coordUnit.y], ax + + stdcall [ksubmenu_draw], [kmUnit], coordUnit + pop ecx ebx eax + ret + +butDevice: + push eax ebx ecx + mcall SF_THREAD_INFO, pi, -1 + + mov eax, dword[pi+34] + add eax, Otstup+80+30+delta + mov word[coordDevice.x], ax + + mov eax, dword[pi+38] + add eax, 79 + mov word[coordDevice.y], ax + + stdcall [ksubmenu_draw], [kmDevice], coordDevice + pop ecx ebx eax + ret + + +delta = 50 +dy = 15 + 40 +warning_title: db 'Warning!',0 +draw_warningWindow: + ret + +draw_window: + mcall SF_REDRAW, SSF_BEGIN_DRAW + + mov eax, SF_CREATE_WINDOW ; define and draw window + mov ebx, 100 * 65536 + (290+delta) ; [x start] *65536 + [x size] + mov ecx, 100 * 65536 + (310+dy) ; [y start] *65536 + [y size] + mov edx,[sc.work] ;0x14FFFFFF + add edx, 0x14000000 ; color of work area RRGGBB + ; 0x02000000 = window type 4 (fixed size, skinned window) + mov esi, 0x808899ff ; color of grab bar RRGGBB + ; 0x80000000 = color glide + mov edi, title + mcall + + + mov esi, 0xAABBCC + mcall SF_DEFINE_BUTTON, (290+delta-Otstup-130+10)*65536+130, (270+dy)*65536+(20+3), 2 + + inc edx + mcall , (290+delta-Otstup-50-2)*65536+(50+2), (210+dy)*65536+21 ;14 + + ;button select FS + inc edx + mov esi, 0xFFFFFF + mcall , Otstup*65536+120, (110)*65536+(21) + + ;button select unit size + inc edx + mcall , (Otstup+80+30+delta)*65536+120, (110)*65536+(21) + + ;button select device + inc edx + mcall , (Otstup+80+30+delta)*65536+120, (60)*65536+(21) + + invoke check_box_draw, ch1 ; + invoke check_box_draw, ch2 + + invoke edit_box_draw, editMBR ; edit box' + invoke edit_box_draw, editLabel + + call draw_super_text + + + mov ecx,[sc.work] + mov dword [frame_data.font_backgr_color],ecx + push dword frame_data + invoke frame_draw + + mov ecx,[sc.work] + mov dword [frame_data2.font_backgr_color],ecx + push dword frame_data2 + invoke frame_draw + + mcall SF_REDRAW, SSF_END_DRAW + ret + + + +Otstup = 30 + +; 0x224466 0x90000000 0 +ch1 check_box2 Otstup shl 16 + 12, (170+dy) shl 16 + 12, 6, 0xFFFFFFFF, 0xAABBCC, 0, ch_text.1, 100b ; 110b = ch_flag_en and ch_flag_middl +ch2 check_box2 Otstup shl 16 + 12, (190+dy) shl 16 + 12, 6, 0xFFFFFFFF, 0xAABBCC, 0, ch_text.2, 100b + + +browse db '...', 0 + +if lang eq ru_RU + +title db "Formatting Disk Utility", 0 + +ch_text: ;text for CheckBoxs +.1 db ' ଠ஢',0 +.2 db ' 㧮 , MBR:',0 + +text: + .volume db '⪠ ⮬:', 0 + .fs db ' ⥬:', 0 + .disk db '⥫:', 0 ;':', 0 + .unit db ' :', 0 + .option db 'ࠬ:', 0 + .format db 'ଠ஢', 0 + +unittext: + .0 db '512 ', 0 + .1 db '1024 ', 0 + .2 db '2048 ', 0 + .3 db '4096 ', 0 + .4 db '8192 ', 0 + .5 db '16 ', 0 + .6 db '32 ', 0 + .7 db '64 ', 0 + +else ; Default to en_US + +title db "Formatting Disk Utility", 0 + +ch_text: +.1 db 'Full and long disk formatting',0 +.2 db 'Create startup disk, write MBR:',0 + +text: + .volume db 'Volume Label:', 0 + .fs db 'File System:', 0 + .disk db 'Storage device:', 0 ;'Capacity:', 0 + .unit db 'Allocation unit size:', 0 + .option db 'Options:', 0 + .format db 'Format', 0 + +unittext: + .0 db '512 bytes', 0 + .1 db '1024 bytes', 0 + .2 db '2048 bytes', 0 + .3 db '4096 bytes', 0 + .4 db '8192 bytes', 0 + .5 db '16 Kb', 0 + .6 db '32 Kb', 0 + .7 db '64 Kb', 0 + +end if + + + +root_path: db "/", 0 + +align 4 +maxDeviceCount = 250-130 +read_folder_struct: + .subfunction dd 1 + .start dd 0 ;start block + .encoding dd 3 ;1-cp866, 2-UTF-16LE, 3-utf8 + .count dd maxDeviceCount ;count blocks + .return dd 0 ; + .name db 0 + .path_adr dd root_path +noneDevice: db '-', 0 +;adrDevice: dd 0 + +getDeviceList: + push eax ebx ecx esi + stdcall [ksubmenu_new] + mov [kmDevice], eax + sizeBDVK = 560 ;304 ; + + mcall SF_SYS_MISC, SSF_HEAP_INIT + + mcall SF_SYS_MISC, SSF_MEM_ALLOC, sizeBDVK*maxDeviceCount+32 + mov dword[read_folder_struct.return], eax + mcall SF_FILE, read_folder_struct + cmp eax, 0 + je .next + cmp eax, 6 + je .next + jmp .none +.next: + mov eax, dword[read_folder_struct.return] + mov esi, deviceAdrStr + add eax, 32 + mov ecx, 130 +@@: + cmp ebx, 0 + je @f + push eax ebx ecx + add eax, 40 + ;mov [adrDevice], eax + mov dword[esi], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, [esi], ecx ; [adrDevice], ecx + stdcall [ksubmenu_add], [kmDevice], eax + pop ecx ebx eax + add esi, 4 + inc ecx + dec ebx + add eax, sizeBDVK + cmp ecx, 250 + ja @f + jmp @b +.none: + stdcall [kmenuitem_new], KMENUITEM_NORMAL, noneDevice, 130 + mov dword[esi], noneDevice + stdcall [ksubmenu_add], [kmDevice], eax +@@: + mov byte[kmDeviceID], 0 + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, unittext.0, [kmDevice] + pop esi ecx ebx eax + ret + + +draw_super_text: + push eax ebx ecx edx edi esi + mov ebx, Otstup * 65536 + 49-6 ; draw info text with function 4 (x, y) + mov ecx, 0x90000000 ;0x90224466 ;0x224466 + mov eax, text.volume + mov edx, eax + mov esi, 13 + mcall SF_DRAW_TEXT + + mov ebx, Otstup * 65536 + 99-6 + mov edx, text.fs + mov esi, 12 + mcall SF_DRAW_TEXT + + mov ebx, (Otstup+80+30+delta) * 65536 + 99-6 + mov edx, text.unit + mov esi, 21 + mcall SF_DRAW_TEXT + + mov ebx, (Otstup+80+30+delta) * 65536 + 49-6 + mov edx, text.disk + mov esi, 9 + mcall SF_DRAW_TEXT + +; mov ebx, Otstup * 65536 + (151-6+dy) +; mov edx, text.option +; mov esi, 8 +; mcall SF_DRAW_TEXT + + mov ebx, (Otstup+80+30+delta +5) * 65536 + (110+3) + mov dl, byte[kmUnitID] + cmp dl, 0 + jne @f + mov edx, unittext.0 + jmp .printUnit +@@: + cmp dl, 1 + jne @f + mov edx, unittext.1 + jmp .printUnit +@@: + cmp dl, 2 + jne @f + mov edx, unittext.2 + jmp .printUnit +@@: + cmp dl, 3 + jne @f + mov edx, unittext.3 + jmp .printUnit +@@: + cmp dl, 4 + jne @f + mov edx, unittext.4 + jmp .printUnit +@@: + cmp dl, 5 + jne @f + mov edx, unittext.5 + jmp .printUnit +@@: + cmp dl, 6 + jne @f + mov edx, unittext.6 + jmp .printUnit +@@: + cmp dl, 7 + jne @f + mov edx, unittext.7 + jmp .printUnit +@@: + mov byte[kmUnitID], 0 + mov edx, unittext.0 +.printUnit: + mcall SF_DRAW_TEXT + + mov ebx, (Otstup+5) * 65536 + (110+3) + mov dl, byte[kmID] + cmp dl, 0 + jne @f + mov edx, kmNone + jmp .printFS +@@: + cmp dl, 1 + jne @f + mov edx, kmFat16 + jmp .printFS +@@: + cmp dl, 2 + jne @f + mov edx, kmFat32 + jmp .printFS +@@: + cmp dl, 3 + jne @f + mov edx, kmNTFS + jmp .printFS +@@: + cmp dl, 4 + jne @f + mov edx, kmExt2 + jmp .printFS +@@: + mov byte[kmID], 0 + mov edx, kmNone +.printFS: + ;mov esi, 8 + mcall SF_DRAW_TEXT + + ;button device + mov ebx, (Otstup+80+30+delta +5) * 65536 + (60+3) + mov edx, dword[kmDeviceID] + shl edx, 2 + add edx, deviceAdrStr + mov edx, dword[edx] + ;call setCurrentDeviceInEDX + mcall SF_DRAW_TEXT + + ;buttons text + mov ebx, (290+delta-Otstup-130+10+2+10) * 65536 + (277-3+dy) + mov ecx, 0x90FFFFFF + mov eax, text.format + mov edx, eax + mov esi, 6 + mcall SF_DRAW_TEXT + + mov ebx, (290+delta-Otstup-52+6+8) * 65536 + (213+dy) + ;mov ecx, 0xFFFFFF + mov eax, browse ;text.browse + mov edx, eax + mov esi, 6 + mcall SF_DRAW_TEXT + + pop esi edi edx ecx ebx eax + ret + + + +Buf: + .1 db 'NONAME18',0,0 + ;.3 db 'hd0 [4Gb]',0,0 ;100 dup(0) + .5 rb 512 ;db '/sys/format/fat32mbr.bin', 0, 0 + +initBuf: + push eax ecx + ;buf.1 - label + mov dword[Buf.1], 'NONA' + mov dword[Buf.1+4], 'ME18' + mov word[Buf.1+8], 0 + + ;buf.5 - full name for file mbr + mov eax, Buf.5 + mov ecx, 512/4 +@@: + mov dword[eax], 4 + add eax, 4 + dec ecx + cmp ecx, 0 + je @f + jmp @b +@@: + + pop ecx eax + ret + + + +copyPath: + push eax ebx ecx edx ;copy file name path + mov eax, openfile_path + mov ebx, Buf.5 + mov ecx, 0 + @@: + mov dl, byte[eax] + cmp dl, 0 + je @f + mov byte[ebx], dl + inc eax + inc ebx + inc ecx + jmp @b + @@: + mov byte[ebx], 0 + mov dword[editMBR.size], ecx + mov dword[editMBR.pos], ecx + pop edx ecx ebx eax + ret + +align 4 +but_open_dlg: + pushad + copy_path open_dialog_name,communication_area_default_path,file_name,0 + mov [OpenDialog_data.type],0 + stdcall[OpenDialog_Start], OpenDialog_data + cmp [OpenDialog_data.status],2 + je @f + cmp [OpenDialog_data.status],0 ; Cancel? + je .end_open + ; + ;... + call copyPath + jmp .end_open + @@: + ; + ;... + .end_open: + popad + ret + +; +align 4 +OpenDialog_data: +.type dd 0 ;0 - , 1 - , 2 - +.procinfo dd procinfo +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 +.dir_default_path dd default_dir ;+20 +.start_path dd file_name ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +default_dir db '/sys',0 ; +communication_area_name: db 'FFFFFFFF_open_dialog',0 +open_dialog_name: db 'opendial',0 +communication_area_default_path: db '/sys/File managers/',0 + +Filter: +dd Filter.end - Filter.1 +.1: +;db 'BIN',0 +.end: +db 0 + + +align 16 +@IMPORT: +library box_lib, 'box_lib.obj' + +import box_lib,\ + edit_box_draw, 'edit_box_draw',\ + edit_box_key, 'edit_box_key',\ + edit_box_mouse, 'edit_box_mouse',\ + init_checkbox, 'init_checkbox2',\ + check_box_draw, 'check_box_draw2',\ + check_box_mouse, 'check_box_mouse2',\ + option_box_draw, 'option_box_draw',\ + option_box_mouse, 'option_box_mouse',\ + frame_draw, 'frame_draw' + +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_proclib: + OpenDialog_Init dd aOpenDialog_Init + OpenDialog_Start dd aOpenDialog_Start +dd 0,0 + aOpenDialog_Init db 'OpenDialog_init',0 + aOpenDialog_Start db 'OpenDialog_start',0 + +system_dir0 db '/sys/lib/' +lib0_name db 'proc_lib.obj',0 +lib1_name db 'kmenu.obj',0 + + +frame_data: +.type dd 0 ;+0 +.x: +.x_size dw 290+delta-2*(Otstup-10) ;+4 +.x_start dw Otstup-10 ;+6 +.y: +.y_size dw 80+20 ;+8 +.y_start dw 151-6+dy ;+10 +.ext_fr_col dd 0x888888 ;+12 +.int_fr_col dd 0xffffff ;+16 +.draw_text_flag dd 1 ;+20 +.text_pointer dd text.option ;+24 +.text_position dd 0 ;+28 +.font_number dd 1;0 ;+32 +.font_size_y dd 9 ;+36 +.font_color dd 0x000000 ;+40 +.font_backgr_color dd 0xFFFFFF ;dddddd ;+44 + +frame_data2: +.type dd 0 +.x: +.x_size dw 290+delta-2*(Otstup-10) +.x_start dw Otstup-10 +.y: +.y_size dw 110 +.y_start dw Otstup+5 +.ext_fr_col dd 0x888888 +.int_fr_col dd 0xffffff +.draw_text_flag dd 0;1 +.text_pointer dd 0 ;text.option +.text_position dd 0 +.font_number dd 0 +.font_size_y dd 9 +.font_color dd 0x0 +.font_backgr_color dd 0xdddddd + +;symbolDownArrow db 25,0 + +kmNone: db 'None', 0 ;only MBR or ZeroDestroy +;kmFat12: db 'FAT12', 0 +kmFat16: db 'FAT16', 0 +kmFat32: db 'FAT32', 0 +;kmExtFat: db 'EXTFAT', 0 +kmNTFS: db 'NTFS', 0 +kmExt2: db 'EXT2', 0 +;kmExt3: db 'EXT3', 0 +;kmExt4: db 'EXT4', 0 +;kmXFS: db 'XFS', 0 + +l_libs_start: + lib0 l_libs lib0_name, file_name, system_dir0, import_proclib + lib1 l_libs lib1_name, file_name, system_dir0, import_libkmenu +load_lib_end: + +;: 80 120 +editLabel edit_box 120,Otstup,60,0xffffff,0x6a9480,0,0xAABBCC,0,8,Buf.1, mouse_dd, 0,8,8 +;editRU edit_box 120,Otstup+80+30+delta,60,0xffffff,0x6a9480,0,0xAABBCC,0,16,Buf.3, mouse_dd, 0,16,16 +editMBR edit_box 290+delta-Otstup-52-Otstup-20,Otstup+20,210+dy,0xffffff,0x6a9480,0,0xAABBCC,0,255,Buf.5, mouse_dd, 0,0,0 ;25,25 + +data_of_code dd 0 + +sc system_colors +mouse_dd rd 1 + +coord: + .x: rw 1 + .y: rw 1 + +coordUnit: + .x: rw 1 + .y: rw 1 + +coordDevice: + .x: rw 1 + .y: rw 1 + +kmDeviceID: rd 1 +kmDevice: rd 1 + +kmUnitID: rd 1 +kmUnit: rd 1 + +kmID: rb 1 ; +kmFS: rd 1 +mbr: rb 512 + +sys_path: rb 4096 +file_name: rb 4096 +plugin_path: rb 4096 +openfile_path: rb 4096 +filename_area: rb 256 +rb 1024 +procinfo process_information +pi rb 1024 + +deviceAdrStr: rd maxDeviceCount + +I_END: + rb 256 +align 4 +STACKTOP: +MEM: diff --git a/programs/system/gmon/tab_about.inc b/programs/system/gmon/tab_about.inc index 4d70a019f..056539080 100644 --- a/programs/system/gmon/tab_about.inc +++ b/programs/system/gmon/tab_about.inc @@ -1,44 +1,45 @@ -; -; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы -; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) -; All Right Reserved - - - mov edx, msg_about - mov ebx, 17 * 65536 + 285 - call show_text - jmp redraw - -if lang eq it_IT - msg_about mls \ - ' Ghost Monitor',\ - '',\ - 'strumento per testare il proprio hardware',\ - '',\ - 'Supported SuperIO : W83627HF,W83697HF',\ - ' W83627THF,W83627THF-A,W83627EHF-A,',\ - ' W83637THF,IT8705F,IT8712F,SiS950',\ - ' ABIT uGuru',\ - '',\ - 'Test basati su R.J.Redelmeier CPUBurn',\ - '',\ - 'Mailto : ghost.nsk@mail.ru',\ - '',\ - ' *** Usare a prioprio rischio ***' -else - msg_about mls \ ; должна быть хотябы одна строка - ' Ghost Monitor',\ - '',\ - ' tool for testing and monitoring hardware',\ - '',\ - 'Supported SuperIO : W83627HF,W83697HF',\ - ' W83627THF,W83627THF-A,W83627EHF-A,',\ - ' W83637THF,IT8705F,IT8712F,SiS950',\ - ' ABIT uGuru',\ - '',\ - 'Tests based on R.J.Redelmeier CPUBurn',\ - '',\ - 'Mailto : ghost.nsk@mail.ru',\ - '',\ - ' *** Use at YOUR own RISK ***' -end if +; +; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы +; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) +; All Right Reserved + +; Language support for locales: it_IT, en_US. + + mov edx, msg_about + mov ebx, 17 * 65536 + 285 + call show_text + jmp redraw + +if lang eq it_IT + msg_about mls \ + ' Ghost Monitor',\ + '',\ + 'strumento per testare il proprio hardware',\ + '',\ + 'Supported SuperIO : W83627HF,W83697HF',\ + ' W83627THF,W83627THF-A,W83627EHF-A,',\ + ' W83637THF,IT8705F,IT8712F,SiS950',\ + ' ABIT uGuru',\ + '',\ + 'Test basati su R.J.Redelmeier CPUBurn',\ + '',\ + 'Mailto : ghost.nsk@mail.ru',\ + '',\ + ' *** Usare a prioprio rischio ***' +else ; Default to en_US + msg_about mls \ ; должна быть хотябы одна строка + ' Ghost Monitor',\ + '',\ + ' tool for testing and monitoring hardware',\ + '',\ + 'Supported SuperIO : W83627HF,W83697HF',\ + ' W83627THF,W83627THF-A,W83627EHF-A,',\ + ' W83637THF,IT8705F,IT8712F,SiS950',\ + ' ABIT uGuru',\ + '',\ + 'Tests based on R.J.Redelmeier CPUBurn',\ + '',\ + 'Mailto : ghost.nsk@mail.ru',\ + '',\ + ' *** Use at your own risk ***' +end if diff --git a/programs/system/gmon/tab_test.inc b/programs/system/gmon/tab_test.inc index 49cee21ca..c522f9b9f 100644 --- a/programs/system/gmon/tab_test.inc +++ b/programs/system/gmon/tab_test.inc @@ -1,123 +1,125 @@ -; -; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы -; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) -; All Right Reserved -; -; Вкладка тестов -; -; "GenuineIntel" - International Electronics -; "GenuineTMx86" - Transmeta Processor -; "AuthenticAMD" - Advanced Micro Devices -; "AMD ISBETTER" - Advanced Micro Devices -; "UMC UMC UMC " - United Microelectronics Corporation -; "CyrixInstead" - Cyrix Processor -; "Geode by NSC" - National Semiconductor Processor -; "SiS SiS SiS " - SiS Processor -; "RiseRiseRise" - Rise Processor -; "NexGenDriven" - NexGen Processor (acquired by AMD) -; "CentaurHauls" - IDT/Centaur, now VIA Processor - - ; Pentium (P5) button - mov eax, 8 - mov ebx, 17 * 65536 + 145 - mov ecx, 297 * 65536 + 25 - mov edx, 6 - mov esi, tcol - cmp byte[Vendor + 11], 'l' - jne p5n - cmp byte[CPU_fam], 5 - jne p5n - mov esi, atcol -p5n: int 0x40 - ; Pentium Pro / II / III (P6) button - add ecx, 27 * 65536 - inc edx - mov esi, tcol - cmp byte[Vendor + 11], 'l' - jne p6n - cmp byte[CPU_fam], 6 - jne p6n - mov esi, atcol -p6n: int 0x40 - ; AMD K6 button - add ecx, 27 * 65536 - inc edx - mov esi, tcol - cmp byte[Vendor], 'A' - jne k6n - cmp byte[CPU_fam], 5 - jne k6n - mov esi, atcol -k6n: int 0x40 - ; AMD K7 (Athlon / Duron) - add ecx, 27 * 65536 - inc edx - mov esi, tcol - cmp byte[Vendor], 'A' - jne k7n - cmp byte[CPU_fam], 6 - jne k7n - mov esi, atcol -k7n: int 0x40 - ; Пишем названия кнопок - mov eax, 4 - mov ebx, 30 * 65536 + 307 - mov esi, 7 - mov edx, tmsg_p ; P5 - xor ecx, ecx - cmp byte[test_id], 6 - jne nr1 - mov ecx, 0xFF0000 -nr1: int 0x40 - add ebx, 27 - mov esi, 20 ; P6 - xor ecx, ecx - cmp byte[test_id], 7 - jne nr2 - mov ecx, 0xFF0000 -nr2: int 0x40 - add ebx, 27 - mov edx, tmsg_k6 ; K6 - mov esi, 13 - xor ecx, ecx - cmp byte[test_id], 8 - jne nr3 - mov ecx, 0xFF0000 -nr3: int 0x40 - add ebx, 27 - mov edx, tmsg_k7 ; K7 - mov esi, 15 - xor ecx, ecx - cmp byte[test_id], 9 - jne nr4 - mov ecx, 0xFF0000 -nr4: int 0x40 - xor ecx, ecx - mov ebx, 190 * 65536 + 420 - mov edx, tmsg_rec - mov esi, 11 - int 0x40 - ; read about - mov ebx, 30 * 65536 + 282 - mov edx, tmsg_war - mov esi, 35 - mov ecx, 0xFF0000 - int 0x40 - ; recommendate color - mov eax, 13 - mov ebx, 170 * 65536 + 10 - mov ecx, 418 * 65536 + 10 - mov edx, atcol - int 0x40 - - jmp redraw - -tmsg_p db 'Pentium (Pro/II/III)' ; 7/20 -tmsg_k6 db 'K6 (I/II/III)' ; 13 -tmsg_k7 db 'K7/Athlon/Duron' ; 15 -tmsg_rec db 'recommended' ; 11 -if lang eq it_IT - tmsg_war db 'Potrebbe danneggiare lo hardware ' -else - tmsg_war db 'May permanently damage the hardware' -end if +; +; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы +; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) +; All Right Reserved +; +; Вкладка тестов + +; Language support for locales: it_IT, en_US. + +; "GenuineIntel" - International Electronics +; "GenuineTMx86" - Transmeta Processor +; "AuthenticAMD" - Advanced Micro Devices +; "AMD ISBETTER" - Advanced Micro Devices +; "UMC UMC UMC " - United Microelectronics Corporation +; "CyrixInstead" - Cyrix Processor +; "Geode by NSC" - National Semiconductor Processor +; "SiS SiS SiS " - SiS Processor +; "RiseRiseRise" - Rise Processor +; "NexGenDriven" - NexGen Processor (acquired by AMD) +; "CentaurHauls" - IDT/Centaur, now VIA Processor + + ; Pentium (P5) button + mov eax, 8 + mov ebx, 17 * 65536 + 145 + mov ecx, 297 * 65536 + 25 + mov edx, 6 + mov esi, tcol + cmp byte[Vendor + 11], 'l' + jne p5n + cmp byte[CPU_fam], 5 + jne p5n + mov esi, atcol +p5n: int 0x40 + ; Pentium Pro / II / III (P6) button + add ecx, 27 * 65536 + inc edx + mov esi, tcol + cmp byte[Vendor + 11], 'l' + jne p6n + cmp byte[CPU_fam], 6 + jne p6n + mov esi, atcol +p6n: int 0x40 + ; AMD K6 button + add ecx, 27 * 65536 + inc edx + mov esi, tcol + cmp byte[Vendor], 'A' + jne k6n + cmp byte[CPU_fam], 5 + jne k6n + mov esi, atcol +k6n: int 0x40 + ; AMD K7 (Athlon / Duron) + add ecx, 27 * 65536 + inc edx + mov esi, tcol + cmp byte[Vendor], 'A' + jne k7n + cmp byte[CPU_fam], 6 + jne k7n + mov esi, atcol +k7n: int 0x40 + ; Пишем названия кнопок + mov eax, 4 + mov ebx, 30 * 65536 + 307 + mov esi, 7 + mov edx, tmsg_p ; P5 + xor ecx, ecx + cmp byte[test_id], 6 + jne nr1 + mov ecx, 0xFF0000 +nr1: int 0x40 + add ebx, 27 + mov esi, 20 ; P6 + xor ecx, ecx + cmp byte[test_id], 7 + jne nr2 + mov ecx, 0xFF0000 +nr2: int 0x40 + add ebx, 27 + mov edx, tmsg_k6 ; K6 + mov esi, 13 + xor ecx, ecx + cmp byte[test_id], 8 + jne nr3 + mov ecx, 0xFF0000 +nr3: int 0x40 + add ebx, 27 + mov edx, tmsg_k7 ; K7 + mov esi, 15 + xor ecx, ecx + cmp byte[test_id], 9 + jne nr4 + mov ecx, 0xFF0000 +nr4: int 0x40 + xor ecx, ecx + mov ebx, 190 * 65536 + 420 + mov edx, tmsg_rec + mov esi, 11 + int 0x40 + ; read about + mov ebx, 30 * 65536 + 282 + mov edx, tmsg_war + mov esi, 35 + mov ecx, 0xFF0000 + int 0x40 + ; recommendate color + mov eax, 13 + mov ebx, 170 * 65536 + 10 + mov ecx, 418 * 65536 + 10 + mov edx, atcol + int 0x40 + + jmp redraw + +tmsg_p db 'Pentium (Pro/II/III)' ; 7/20 +tmsg_k6 db 'K6 (I/II/III)' ; 13 +tmsg_k7 db 'K7/Athlon/Duron' ; 15 +tmsg_rec db 'recommended' ; 11 +if lang eq it_IT + tmsg_war db 'Potrebbe danneggiare lo hardware ' +else ; Default to en_US + tmsg_war db 'May permanently damage the hardware' +end if diff --git a/programs/system/icon/trunk/data.inc b/programs/system/icon/trunk/data.inc index ee5591d84..cfdb514e7 100644 --- a/programs/system/icon/trunk/data.inc +++ b/programs/system/icon/trunk/data.inc @@ -1,206 +1,209 @@ -;------------------------------------------------------------------------------ -tl dd 8 -yw: dd 51 -ya dd 0 -cur_btn dd 40 -;------------------------------------------------------------------------------ -; DATA AREA -bcolor dd 0x335599 -;------------------------------------------------------------------------------ -icon_table: - times 4 db 'xxxx xxxx' - times 2 db ' ' - times 1 db ' ' - times 2 db 'xxxx xxxx' -; times 1 db ' ' -;------------------------------------------------------------------------------ -icons_reserved: - times 9 db ' ' -;------------------------------------------------------------------------------ -if lang eq ru_RU -text: - db 255,255,255,0, ' ' - db 255,255,255,0, ' ' - db 255,255,255,0, ' ' - db 255,255,255,0, ' ' - db 255,255,255,0, ' ' - db 0,0,0,0, ' ' - db 'x' ; <- END MARKER, DONT DELETE - -add_text db ' ',0 -rem_text db ' ',0 -title db ' ',0 - -else if lang eq de_DE -text: - db 255,255,255,0, ' TITLE ' - db 255,255,255,0, ' APP NAME ' - db 255,255,255,0, ' PARAMETER ' - db 255,255,255,0, ' ANWENDEN ' - db 255,255,255,0, ' HINZUFUEGEN ENTFERNEN ' - db 0,0,0,0, 'AUF BUTTON KLICKEN, UM ICON ZU EDITIEREN ' - db 'x' ; <- END MARKER, DONT DELETE - -add_text db 'AUF UNBENUTZTE ICONPOSITION KLICKEN ',0 -rem_text db 'ICON ANKLICKEN; DAS GELOESCHT WERDEN SOLL ',0 -title db 'Icon Manager',0 - -else if lang eq it_IT -text: - db 255,255,255,0, 'Titolo ' - db 255,255,255,0, 'Nome app ' - db 255,255,255,0, 'Parametri ' - db 255,255,255,0, ' Applica modifiche ' - db 255,255,255,0, ' Aggiungi Rimuovi ' - db 0,0,0,0, 'Clicca sull icona per effettuare modifiche ' - db 'x' ; <- END MARKER, DONT DELETE - -add_text db 'Clicca su una posizione non usata ',0 -rem_text db 'Cliccare sull icona da rimuovere ',0 -title db 'Gestore Icone',0 - -else -text: - db 255,255,255,0, ' TITLE ' - db 255,255,255,0, ' APP NAME ' - db 255,255,255,0, ' PARAMETERS ' - db 255,255,255,0, ' APPLY CHANGES ' - db 255,255,255,0, ' ADD ICON REMOVE ICON ' - db 0,0,0,0, 'CLICK BUTTON ON ICON POSITION FOR EDIT ' - db 'x' ; <- END MARKER, DONT DELETE -add_text db 'CLICK ON A NOT USED POSITION ',0 -rem_text db 'CLICK ICON POSITION; YOU WANT TO DELETE ',0 -title db 'Icon Manager',0 - -end if -;------------------------------------------------------------------------------ -arrows db '' -;------------------------------------------------------------------------------ -iconname: - db ICON_APP,0 -;------------------------------------------------------------------------------ -icon_default: - db 'AA-CALC -004-/SYS/CALC ' - db '- *' - db 13,10 -;------------------------------------------------------------------------------ -rep_text: -if lang eq ru_RU - db ' - , #' -;else if lang eq it_IT -; db 'Icone - di , Selezionate' -else - db 'ICONS - OF , SELECTED' -end if - -rep_text_len: -;------------------------------------------------------------------------------ -align 4 -finfo_start: - dd 7 - dd 0 -.params dd 0 - dd 0 - dd 0 - db 0 - dd finfo.path -;------------------------------------------------------------------------------ -align 4 -finfo: - dd 5 - dd 0 - dd 0 -.size dd 0 -.point dd procinfo -.path: - db ICON_STRIP,0 - rb 31-($-.path) -;------------------------------------------------------------------------------ -align 4 -positions dd 3,16,47 -str_lens db 8,30,30 - -current_icon dd icon_data - -iconlst db ICONS_DAT,0 - -;image dd image_area -;------------------------------------------------------------------------------ -; not change this section!!! -; start section -;------------------------------------------------------------------------------ -align 4 -image_file dd 0 ;+0 -raw_pointer dd 0 ;+4 -return_code dd 0 ;+8 -img_size dd 0 ;+12 -deflate_unpack dd 0 ;+16 ; not use for scaling -raw_pointer_2 dd 0 ;+20 ; not use for scaling -;------------------------------------------------------------------------------ -; end section -;------------------------------------------------------------------------------ -system_dir_CnvPNG db '/sys/lib/cnv_png.obj',0 -system_dir_UNPACK db '/sys/lib/archiver.obj',0 - -;plugins_directory db 'plugins/',0 -plugins_directory db 0 -;------------------------------------------------------------------------------ -l_libs_start: - -library01 l_libs system_dir_CnvPNG+9,library_path,system_dir_CnvPNG,\ -cnv_png_import,plugins_directory - -library02 l_libs system_dir_UNPACK+9,library_path,system_dir_UNPACK,\ -UNPACK_import,plugins_directory - -end_l_libs: -;--------------------------------------------------------------------- -align 4 -cnv_png_import: -.Start dd aCP_Start -.Version dd aCP_Version -.Check dd aCP_Check -.Assoc dd aCP_Assoc - dd 0 - dd 0 -aCP_Start db 'START',0 -aCP_Version db 'version',0 -aCP_Check db 'Check_Header',0 -aCP_Assoc db 'Associations',0 -;--------------------------------------------------------------------- -align 4 -UNPACK_import: -;unpack_Version dd aUnpack_Version -;unpack_PluginLoad dd aUnpack_PluginLoad -;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin -;unpack_ClosePlugin dd aUnpack_ClosePlugin -;unpack_ReadFolder dd aUnpack_ReadFolder -;unpack_SetFolder dd aUnpack_SetFolder -;unpack_GetFiles dd aUnpack_GetFiles -;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo -;unpack_Getattr dd aUnpack_Getattr -;unpack_Open dd aUnpack_Open -;unpack_Read dd aUnpack_Read -;unpack_Setpos dd aUnpack_Setpos -;unpack_Close dd aUnpack_Close -;unpack_DeflateUnpack dd aUnpack_DeflateUnpack -unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2 - dd 0 - dd 0 - -;aUnpack_Version db 'version',0 -;aUnpack_PluginLoad db 'plugin_load',0 -;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0 -;aUnpack_ClosePlugin db 'ClosePlugin',0 -;aUnpack_ReadFolder db 'ReadFolder',0 -;aUnpack_SetFolder db 'SetFolder',0 -;aUnpack_GetFiles db 'GetFiles',0 -;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0 -;aUnpack_Getattr db 'getattr',0 -;aUnpack_Open db 'open',0 -;aUnpack_Read db 'read',0 -;aUnpack_Setpos db 'setpos',0 -;aUnpack_Close db 'close',0 -;aUnpack_DeflateUnpack db 'deflate_unpack',0 -aUnpack_DeflateUnpack2 db 'deflate_unpack2',0 -;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +tl dd 8 +yw: dd 51 +ya dd 0 +cur_btn dd 40 +;------------------------------------------------------------------------------ +; DATA AREA +bcolor dd 0x335599 +;------------------------------------------------------------------------------ +icon_table: + times 4 db 'xxxx xxxx' + times 2 db ' ' + times 1 db ' ' + times 2 db 'xxxx xxxx' +; times 1 db ' ' +;------------------------------------------------------------------------------ +icons_reserved: + times 9 db ' ' +;------------------------------------------------------------------------------ + +; Language support for locales: ru_RU (CP866), de_DE, it_IT, en_US + +if lang eq ru_RU +text: + db 255,255,255,0, ' ' + db 255,255,255,0, ' ' + db 255,255,255,0, ' ' + db 255,255,255,0, ' ' + db 255,255,255,0, ' ' + db 0,0,0,0, ' ' + db 'x' ; <- END MARKER, DO NOT DELETE + +add_text db ' ',0 +rem_text db ' ',0 +title db ' ',0 + +else if lang eq de_DE +text: + db 255,255,255,0, ' TITLE ' + db 255,255,255,0, ' APP NAME ' + db 255,255,255,0, ' PARAMETER ' + db 255,255,255,0, ' ANWENDEN ' + db 255,255,255,0, ' HINZUFUEGEN ENTFERNEN ' + db 0,0,0,0, 'AUF BUTTON KLICKEN, UM ICON ZU EDITIEREN ' + db 'x' ; <- END MARKER, DO NOT DELETE + +add_text db 'AUF UNBENUTZTE ICONPOSITION KLICKEN ',0 +rem_text db 'ICON ANKLICKEN; DAS GELOESCHT WERDEN SOLL ',0 +title db 'Icon Manager',0 + +else if lang eq it_IT +text: + db 255,255,255,0, 'Titolo ' + db 255,255,255,0, 'Nome app ' + db 255,255,255,0, 'Parametri ' + db 255,255,255,0, ' Applica modifiche ' + db 255,255,255,0, ' Aggiungi Rimuovi ' + db 0,0,0,0, 'Clicca sull icona per effettuare modifiche ' + db 'x' ; <- END MARKER, DO NOT DELETE + +add_text db 'Clicca su una posizione non usata ',0 +rem_text db 'Cliccare sull icona da rimuovere ',0 +title db 'Gestore Icone',0 + +else ; Default to en_US +text: + db 255,255,255,0, ' TITLE ' + db 255,255,255,0, ' APP NAME ' + db 255,255,255,0, ' PARAMETERS ' + db 255,255,255,0, ' APPLY CHANGES ' + db 255,255,255,0, ' ADD ICON REMOVE ICON ' + db 0,0,0,0, 'CLICK BUTTON ON ICON POSITION FOR EDIT ' + db 'x' ; <- END MARKER, DO NOT DELETE +add_text db 'CLICK ON A NOT USED POSITION ',0 +rem_text db 'CLICK ICON POSITION; YOU WANT TO DELETE ',0 +title db 'Icon Manager',0 + +end if +;------------------------------------------------------------------------------ +arrows db '' +;------------------------------------------------------------------------------ +iconname: + db ICON_APP,0 +;------------------------------------------------------------------------------ +icon_default: + db 'AA-CALC -004-/SYS/CALC ' + db '- *' + db 13,10 +;------------------------------------------------------------------------------ +rep_text: +if lang eq ru_RU + db ' - , #' +;else if lang eq it_IT +; db 'Icone - di , Selezionate' +else ; Default to en_US + db 'ICONS - OF , SELECTED' +end if + +rep_text_len: +;------------------------------------------------------------------------------ +align 4 +finfo_start: + dd 7 + dd 0 +.params dd 0 + dd 0 + dd 0 + db 0 + dd finfo.path +;------------------------------------------------------------------------------ +align 4 +finfo: + dd 5 + dd 0 + dd 0 +.size dd 0 +.point dd procinfo +.path: + db ICON_STRIP,0 + rb 31-($-.path) +;------------------------------------------------------------------------------ +align 4 +positions dd 3,16,47 +str_lens db 8,30,30 + +current_icon dd icon_data + +iconlst db ICONS_DAT,0 + +;image dd image_area +;------------------------------------------------------------------------------ +; not change this section!!! +; start section +;------------------------------------------------------------------------------ +align 4 +image_file dd 0 ;+0 +raw_pointer dd 0 ;+4 +return_code dd 0 ;+8 +img_size dd 0 ;+12 +deflate_unpack dd 0 ;+16 ; not use for scaling +raw_pointer_2 dd 0 ;+20 ; not use for scaling +;------------------------------------------------------------------------------ +; end section +;------------------------------------------------------------------------------ +system_dir_CnvPNG db '/sys/lib/cnv_png.obj',0 +system_dir_UNPACK db '/sys/lib/archiver.obj',0 + +;plugins_directory db 'plugins/',0 +plugins_directory db 0 +;------------------------------------------------------------------------------ +l_libs_start: + +library01 l_libs system_dir_CnvPNG+9,library_path,system_dir_CnvPNG,\ +cnv_png_import,plugins_directory + +library02 l_libs system_dir_UNPACK+9,library_path,system_dir_UNPACK,\ +UNPACK_import,plugins_directory + +end_l_libs: +;--------------------------------------------------------------------- +align 4 +cnv_png_import: +.Start dd aCP_Start +.Version dd aCP_Version +.Check dd aCP_Check +.Assoc dd aCP_Assoc + dd 0 + dd 0 +aCP_Start db 'START',0 +aCP_Version db 'version',0 +aCP_Check db 'Check_Header',0 +aCP_Assoc db 'Associations',0 +;--------------------------------------------------------------------- +align 4 +UNPACK_import: +;unpack_Version dd aUnpack_Version +;unpack_PluginLoad dd aUnpack_PluginLoad +;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin +;unpack_ClosePlugin dd aUnpack_ClosePlugin +;unpack_ReadFolder dd aUnpack_ReadFolder +;unpack_SetFolder dd aUnpack_SetFolder +;unpack_GetFiles dd aUnpack_GetFiles +;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo +;unpack_Getattr dd aUnpack_Getattr +;unpack_Open dd aUnpack_Open +;unpack_Read dd aUnpack_Read +;unpack_Setpos dd aUnpack_Setpos +;unpack_Close dd aUnpack_Close +;unpack_DeflateUnpack dd aUnpack_DeflateUnpack +unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2 + dd 0 + dd 0 + +;aUnpack_Version db 'version',0 +;aUnpack_PluginLoad db 'plugin_load',0 +;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0 +;aUnpack_ClosePlugin db 'ClosePlugin',0 +;aUnpack_ReadFolder db 'ReadFolder',0 +;aUnpack_SetFolder db 'SetFolder',0 +;aUnpack_GetFiles db 'GetFiles',0 +;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0 +;aUnpack_Getattr db 'getattr',0 +;aUnpack_Open db 'open',0 +;aUnpack_Read db 'read',0 +;aUnpack_Setpos db 'setpos',0 +;aUnpack_Close db 'close',0 +;aUnpack_DeflateUnpack db 'deflate_unpack',0 +aUnpack_DeflateUnpack2 db 'deflate_unpack2',0 +;------------------------------------------------------------------------------ diff --git a/programs/system/icon_new/DlgAdd.inc b/programs/system/icon_new/DlgAdd.inc index fb277cc2f..f4d3c564b 100644 --- a/programs/system/icon_new/DlgAdd.inc +++ b/programs/system/icon_new/DlgAdd.inc @@ -1,842 +1,844 @@ -idbChange equ 2 -idbCreate equ 3 -idbLeft equ 4 -idbRight equ 5 -idbCancel equ 1 - -DlgAdd: -DlgProp: - - mov eax,[SelIcon] - mov [DlgSelIcon],eax - cmp eax,-1 - jne SetProp - - ;----------- - mov eax,[MouseX] - mov ebx,[MouseY] - - cmp ax,[wsX] - jae @f - mov ax,[wsX] - @@: - - cmp bx,[wsY] - jae @f - mov bx,[wsY] - @@: ;eax,ebx - ॠ쭠 न. न ண ⭮⥫쭮 孥 㣫 ࠡ祩 - - xor edx,edx - mov dx,[wsXe] - sub edx,ICON_SIZE - cmp eax,edx - jbe @f - mov eax,edx - @@: - - mov dx,[wsYe] - sub edx,ICON_SIZE - cmp ebx,edx - jbe @f - mov ebx,edx - @@: - - xor edx,edx ;८ࠧ뢠 ⭮⥫ - mov dx,[wsW] - shr edx,1 - add dx,[wsX] - cmp eax,edx - jbe @f - sub ax,[wsXe] - inc ax - jmp .dlg1 - @@: - sub ax,[wsX] - .dlg1: - - xor edx,edx - mov dx,[wsH] - shr edx,1 - add dx,[wsY] - cmp ebx,edx - jbe @f - sub bx,[wsYe] - inc bx - jmp .dlg2 - @@: - sub bx,[wsY] - .dlg2: - - mov [AddX],eax - mov [AddY],ebx - ;----------- - - mov ecx,NAME_LENGTH - mov edi,DAreaName - xor al,al - rep stosb - mov dword[edtName.size],0 - mov dword[edtName.pos],0 - - mov ecx,256 - mov edi,DAreaPath - rep stosb - mov dword[edtExePath.size],0 - mov dword[edtExePath.pos],0 - - mov ecx,256 - mov edi,DAreaParams - rep stosb - mov dword[edtParams.size],0 - mov dword[edtParams.pos],0 - - mov ecx,256 - mov edi,DAreaIcon - - mov [DAreaIcon],'0' - mov dword[edtIcon.size],1 - mov dword[edtIcon.pos],1 - - jmp startDlg - ;-------- -SetProp: - mov esi,[IconsOffs+eax*4] - mov edi,DAreaName - xor ecx,ecx - @@: - lodsb - stosb - inc ecx - test al,al - jnz @b - dec ecx - mov dword[edtName.size],ecx - mov dword[edtName.pos],ecx - - xor ecx,ecx - mov edi,DAreaPath - @@: - lodsb - stosb - inc ecx - test al,al - jnz @b - dec ecx - mov dword[edtExePath.size],ecx - mov dword[edtExePath.pos],ecx - - xor ecx,ecx - mov edi,DAreaParams - @@: - lodsb - stosb - inc ecx - test al,al - jnz @b - dec ecx - mov dword[edtParams.size],ecx - mov dword[edtParams.pos],ecx - - xor ecx,ecx - mov edi,DAreaIcon - @@: - lodsb - stosb - inc ecx - test al,al - jnz @b - dec ecx - mov dword[edtIcon.size],ecx - mov dword[edtIcon.pos],ecx - - -startDlg: - mcall 9,RBProcInfo,-1 - mcall 18,21,dword[RBProcInfo+30] - mov [slotDlgAdd],eax - - or [edtName.flags],ed_focus - - mcall 40,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER - xor eax,eax - mov dword[MaxPage],0 - @@: - add eax,ICONS_DRAW_COUNTW - inc dword[MaxPage] - cmp eax,[icon_count] - jb @b - dec dword[MaxPage] - cmp dword[MaxPage],0 - jne @f - mov dword[MaxPage],1 - @@: - -DReDraw: - mcall 48,3,sc,40 - - mov eax,[sc.work] - rol eax,16 - add al,9 - jnc @f - mov al,0FFh - @@: - rol eax,16 - add al,9 - jnc @f - mov al,0FFh - @@: - add ah,9 - jnc @f - mov ah,0FFh - @@: - - mov [sbIcons.bckg_col],eax - m2m [sbIcons.frnt_col],[sc.work] - m2m [sbIcons.line_col],[sc.work_graph] - - ;edit_boxes_set_sys_color edtIcon,endEdits,sc - edit_boxes_set_sys_color edtName,endEdits,sc - - m2m [edtIcon.color],[sc.work] - m2m [edtIcon.blur_border_color],[sc.work] - - call DRedrawWin - -DMessages: - mcall 10 ;WaitMessage - - dec eax - jz DReDraw - dec eax - jz DKey - dec eax - jz DButton - sub eax,3 - jz DMouse - - jmp DMessages - - -;--------------------------------------------------------------------- -DKey: - mcall 2 ;GetKeyPressed - cmp ah,1Bh - je DExit - cmp ah,9 ;Tab - je DNextEdit - stdcall [edit_box_key],edtName - stdcall [edit_box_key],edtExePath - stdcall [edit_box_key],edtParams - ;stdcall [edit_box_key],edtIcon - - jmp DMessages - - -DNextEdit: - test [edtName.flags],ed_focus - jne .DNE1 - test [edtExePath.flags],ed_focus - jne .DNE2 - test [edtParams.flags],ed_focus - jne .DNE3 - ;test [edtIcon.flags],ed_focus - ;jne .DNE4 - jmp DMessages - - .DNE1: - and [edtName.flags],not ed_focus - or [edtExePath.flags],ed_focus - stdcall [edit_box_draw],edtName - stdcall [edit_box_draw],edtExePath - jmp DMessages - - .DNE2: - and [edtExePath.flags],not ed_focus - or [edtParams.flags],ed_focus - stdcall [edit_box_draw],edtExePath - stdcall [edit_box_draw],edtParams - jmp DMessages - - .DNE3: - and [edtParams.flags],not ed_focus - or [edtName.flags],ed_focus - stdcall [edit_box_draw],edtParams - stdcall [edit_box_draw],edtName - jmp DMessages - - ;.DNE4: - ; and [edtIcon.flags],not ed_focus - ; or [edtName.flags],ed_focus - ; stdcall [edit_box_draw],edtName - ; stdcall [edit_box_draw],edtIcon - ; jmp DMessages -;--------------------------------------------------------------------- -DButton: - mcall 17 ;GetButtonPressed - cmp ah, idbCancel - je DExit - cmp ah,idbChange - je DSetExePath - cmp ah,idbCreate - je DSaveIcon - - jmp DMessages -;------------------------------------------------------------------------------- -DMouse: - stdcall [edit_box_mouse],edtName - stdcall [edit_box_mouse],edtExePath - stdcall [edit_box_mouse],edtParams -; stdcall [edit_box_mouse],edtIcon - - push [sbIcons.position] - stdcall [scrollbar_h_mouse],sbIcons - pop eax - cmp eax,[sbIcons.position] - je @f - call DrawStdIcons - @@: - - mcall 37,2 ;GetMouseKey - test eax,1 - jz DMessages - mcall 37,1 ;GetMouseWinPos - - test eax,10001000h - jne DMessages - xor edx,edx - mov dx,ax ;y - shr eax,16 ;x - - sub eax,ICONSX - js DMessages - sub edx,ICONSY - js DMessages - - cmp eax,(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW - ja DMessages - cmp edx,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH - ja DMessages - - xor ebx,ebx - mov ecx,[sbIcons.position] - test ecx,ecx - jz .DM - @@: - add ebx,ICONS_DRAW_COUNTH - loop @b - .DM: - - sub eax,IMG_SIZE+SPCW - js .DM1 - @@: - add ebx,ICONS_DRAW_COUNTH - sub eax,IMG_SIZE+SPCW - jns @b - .DM1: - - - sub edx,IMG_SIZE+SPCH - js .DM2 - @@: - inc ebx - sub edx,IMG_SIZE+SPCH - jns @b - .DM2: - - mov eax,ebx - - cmp eax,[icon_count] - jae DMessages - -; stdcall byteToHex,al,DAreaIcon ;2 - stdcall intToStr,eax,DAreaIcon - mov dword[edtIcon.size],edx - - ; stdcall [edit_box_draw],edtIcon - - call DrawSelIcon - jmp DMessages -;------------------------------------------------------------------------------- -DSetExePath: - stdcall [OpenDialog_Start],OpenDialog_data - mov edi,DAreaPath - xor al,al - or ecx,-1 - repne scasb - sub edi,DAreaPath - dec edi - mov dword[edtExePath+12*4],edi - - jmp DMessages;DReDraw; - -DSaveIcon: - mov edi,DAreaName - mov esi,secRButt - @@: lodsb - scasb - jne @f - test al,al - jnz @b - - mov dword[fiRunProg+8],ErrName - mov dword[fiRunProg+21],pthNotify - mcall 70,fiRunProg - - jmp DMessages - @@: - mov dword[fiRunProg+8],WarningSave - mov dword[fiRunProg+21],pthNotify - mcall 70,fiRunProg - - - cmp [DlgSelIcon],-1 - je @f - - stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams - mov ebx,[DlgSelIcon] - mov eax,[IconsID+ebx*4] - jmp DExitAndSave - @@: - - call GenerateID - - mov ebx,[MaxNumIcon] - mov [IconsID+ebx*4],eax - push eax - stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams - pop eax - -;------------------------------------------------------------------------------- -DExitAndSave: - - mov dword[nameSection],eax - stdcall [ini_set_str],IconIni,nameSection,keyName,DAreaName,dword[edtName.size] - stdcall [ini_set_str],IconIni,nameSection,keyPath,DAreaPath,dword[edtExePath.size] - stdcall [ini_set_str],IconIni,nameSection,keyParams,DAreaParams,dword[edtParams.size] - stdcall [ini_set_str],IconIni,nameSection,keyIco,DAreaIcon,dword[edtIcon.size] - - cmp [DlgSelIcon],-1 - jne @f - stdcall [ini_set_int],IconIni,nameSection,keyX,[MouseX] - stdcall [ini_set_int],IconIni,nameSection,keyY,[MouseY] - @@: -DExit: - mov [DlgAddActiv],0 - mov [slotDlgAdd],0 - mcall -1 ;ExitThread - -;################################################################## -proc DRedrawWin - mcall 12,1 ;RedrawWinBeg - mov edx,[sc.work] - or edx,34000000h - cmp [DlgSelIcon],-1 - jne @f - mov edi,DTitleAdd - jmp .l1 - @@: - mov edi,DTitleProp - .l1: - mcall 0,<100,END_ICONS_AREAW+ICONSX+10>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+178>,,, - - stdcall [edit_box_draw],edtName - stdcall [edit_box_draw],edtExePath - stdcall [edit_box_draw],edtParams - - call DrawStdIcons - - - stdcall [scrollbar_h_draw],sbIcons - mcall 38,,,[sc.work_graph] - mcall ,,,[sc.work_graph] - - mcall ,,,[sc.work_graph] - mcall ,,,[sc.work_graph] - - ;BUTTONS - mcall 8,<265,75>,<30+END_ICONS_AREAH,24>,idbCreate,[sc.work_button] - mcall ,<360,77>, ,idbCancel - mcall ,,<30,20> ,idbChange - - ;CAPTIONS - mov ecx,[sc.work_text] - or ecx,90000000h - mcall 4,<30+IMG_SIZE,10>,,DCaptName - mcall ,<30+IMG_SIZE,35>,,DCaptPath - mcall ,<30+IMG_SIZE,59>,,DCaptParams - -if lang eq ru_RU - mov ecx,[sc.work_button_text] - or ecx,90000000h - mcall ,<369,35+END_ICONS_AREAH>,,DCaptCancel - - cmp [DlgSelIcon],-1 - jne @f - mpack ebx,275,35+END_ICONS_AREAH - mov edx,DCaptCreate - jmp .DRD1 - @@: - mpack ebx,272,35+END_ICONS_AREAH - mov edx,DCaptProperties - .DRD1: -else - mov ecx,[sc.work_button_text] - or ecx,90000000h - mcall ,<372,35+END_ICONS_AREAH>,,DCaptCancel - - - cmp [DlgSelIcon],-1 - jne @f - mpack ebx,277,35+END_ICONS_AREAH - mov edx,DCaptCreate - jmp .DRD1 - @@: - mpack ebx,277,35+END_ICONS_AREAH - mov edx,DCaptProperties - .DRD1: -end if - mcall - - pusha - mov ecx,[sc.work_button_text] - or ecx,90000000h - mcall 4,,,DCaptDots - popa - - call DrawSelIcon - - mcall 12,2 ;RedrawWinEnd - ret -endp - - -proc DrawStdIcons -local IcoX:DWORD,\ - IcoY:DWORD,\ - iIcon:DWORD - - mov ecx,[sbIcons.position] - xor eax,eax - m2m dword[iIcon],0 - - test ecx,ecx - jz .DST1 - @@: - add [iIcon],ICONS_DRAW_COUNTH - add eax,IMG_SIZE*IMG_SIZE*4*ICONS_DRAW_COUNTH - loop @b - .DST1: - - lea esi,[eax+44] - add esi,[raw_pointer] - - mov [IcoX],ICONSX - - mov ecx,ICONS_DRAW_COUNTW - .DrawIcons: - push ecx - - mov [IcoY],ICONSY - - mov ecx,ICONS_DRAW_COUNTH - .DrawIcoStolb: - push ecx - - mov edi,DlgBufImg - mov edx,IMG_SIZE - - .DrawLine: - - - mov ecx,IMG_SIZE - .DrawPix: - - lodsd - test eax,0FF000000h - jnz @f - mov eax,[sc.work] - @@: - - mov [edi],ax - shr eax,16 - mov [edi+2],al - add edi,3 - - loop .DrawPix - - dec edx - jnz .DrawLine - - mov edx,[IcoX] - shl edx,16 - mov dx,word[IcoY] - mcall 7,DlgBufImg, - - inc [iIcon] - mov eax,[iIcon] - cmp eax,[icon_count] - jae .endDrawIcon - - add dword[IcoY],IMG_SIZE+SPCH - pop ecx - loop .DrawIcoStolb - - add dword[IcoX],IMG_SIZE+SPCW - pop ecx - loop .DrawIcons - jmp .endProc - - .endDrawIcon: - - mov ecx,IMG_SIZE*IMG_SIZE - mov edi,DlgBufImg - mov eax,[sc.work] - mov ebx,eax - shr ebx,16 - @@: - mov word[edi],ax - mov [edi+2],bl - add edi,3 - loop @b - - ;࠭ ᯮ짮 - jmp .Dalee - - .DrawIcons2: - push ecx - - mov [IcoY],ICONSY - mov ecx,ICONS_DRAW_COUNTH - .DrawIcoStolb2: - push ecx - - mov edx,[IcoX] - shl edx,16 - mov dx,word[IcoY] - mcall 7,DlgBufImg, - - .Dalee: - add dword[IcoY],IMG_SIZE+SPCH - pop ecx - loop .DrawIcoStolb2 - - add dword[IcoX],IMG_SIZE+SPCW - pop ecx - loop .DrawIcons2 - - .endProc: - - ret -endp - -proc DrawSelIcon - mov edx,[sc.work] - mcall 13,,<59,12> - - mov ecx,[sc.work_text] - or ecx,90000000h - mcall 4,,,DAreaIcon - - mov edi,DAreaIcon - cmp byte[edi],0 - jne @f - ret - @@: - - ;stdcall hexToInt, edi - stdcall strToInt, edi - @@: ;eax=num icon - cmp eax,[icon_count] - jb @f - xor eax,eax - @@: - test eax,eax - je .DI1 - mov ecx,eax - xor eax,eax - @@: - add eax,IMG_SIZE*IMG_SIZE*4 - loop @b - .DI1: - mov esi,eax - add esi,[raw_pointer] - add esi,44 - - mov edi,DlgBufImg - mov edx,IMG_SIZE - .DrawLine: - - mov ecx,IMG_SIZE - .DrawPix: - - lodsd - test eax,0FF000000h - jnz @f - mov eax,[sc.work] - @@: - - mov word[edi],ax - shr eax,16 - mov [edi+2],al - add edi,3 - - loop .DrawPix - - dec edx - jnz .DrawLine - - mcall 7,DlgBufImg,,<30,15> - - ret -endp - -;NOT USED -proc hexToInt strz:DWORD - push ebx - mov ebx,[strz] - mov al,[ebx] - xor edx,edx -.loop: - xor ecx,ecx - inc ebx - shl edx,4 - cmp al,'0' - jb .err - cmp al,'9' - jbe .conv - mov ecx,10 - sub al,11h - cmp al,'0' - jb .err - cmp al,'6' - ja .err -.conv: - sub al,30h - add dl,al - mov al,[ebx] - add dl,cl - test al,al - jnz .loop - mov eax,edx - pop ebx - ret -.err: - xor eax,eax - pop ebx - ret -endp - - -;NOT USED -proc byteToHex byti:BYTE,target:DWORD - push ebx - mov ebx,[target] - mov dl,[byti] - rol dl,4 - mov ecx,2 -.loop: - mov al,dl - and al,0xF - cmp al,10 - jae @f - add al,0x30 - jmp .n -@@: - add al,0x41-10 -.n: - mov [ebx],al - inc ebx - rol dl,4 - loop .loop - - mov byte[ebx],0 -@@: pop ebx - ret - jmp @b -endp - - -proc strToInt strz:DWORD - push ebx edi esi - stdcall strLen, [strz] - xor edx,edx - xor ebx,ebx - xor edi,edi - std - inc ebx - mov esi,[strz] - lea esi,[esi+eax-2] -.loop: - xor eax,eax - lodsb - cmp al,'0' - jb .err - cmp al,'9' - ja .err - - sub al,0x30 - mul ebx - lea ebx,[ebx*4+ebx] ;ebx = ebx*10 - shl ebx,1 - add edi,eax - cmp esi,[strz] - jae .loop - cld - mov eax,edi - pop esi edi ebx - ret -.err: - cld - or eax,-1 - pop esi edi ebx - ret -endp - - -;ret: target - string, edx - length string -proc intToStr inti:DWORD, target:DWORD -locals - resl rb 16 -endl - lea edi,[resl] - mov eax,[inti] - xor ecx,ecx - mov ebx,10 - jmp .stlp -.loop: - xor edx,edx - div ebx - mov [edi],dl - inc edi - inc ecx -.stlp: cmp eax,10 - jae .loop - mov [edi],al - inc ecx - mov edx,ecx - mov ebx,[target] -.conv: - mov al,[edi] - add al,0x30 - mov [ebx],al - inc ebx - dec edi - loop .conv - mov byte[ebx],0 - ret -endp - -;for 'ab',0 strLen = 3 -proc strLen stringZ:DWORD - push edi - xor al,al - mov edi,[stringZ] - or ecx,-1 - repne scasb - sub edi,[stringZ] - mov eax,edi - pop edi - ret -endp - - +; Language support for locales: ru_RU (CP866), en_US. + +idbChange equ 2 +idbCreate equ 3 +idbLeft equ 4 +idbRight equ 5 +idbCancel equ 1 + +DlgAdd: +DlgProp: + + mov eax,[SelIcon] + mov [DlgSelIcon],eax + cmp eax,-1 + jne SetProp + + ;----------- + mov eax,[MouseX] + mov ebx,[MouseY] + + cmp ax,[wsX] + jae @f + mov ax,[wsX] + @@: + + cmp bx,[wsY] + jae @f + mov bx,[wsY] + @@: ;eax,ebx - ॠ쭠 न. न ண ⭮⥫쭮 孥 㣫 ࠡ祩 + + xor edx,edx + mov dx,[wsXe] + sub edx,ICON_SIZE + cmp eax,edx + jbe @f + mov eax,edx + @@: + + mov dx,[wsYe] + sub edx,ICON_SIZE + cmp ebx,edx + jbe @f + mov ebx,edx + @@: + + xor edx,edx ;८ࠧ뢠 ⭮⥫ + mov dx,[wsW] + shr edx,1 + add dx,[wsX] + cmp eax,edx + jbe @f + sub ax,[wsXe] + inc ax + jmp .dlg1 + @@: + sub ax,[wsX] + .dlg1: + + xor edx,edx + mov dx,[wsH] + shr edx,1 + add dx,[wsY] + cmp ebx,edx + jbe @f + sub bx,[wsYe] + inc bx + jmp .dlg2 + @@: + sub bx,[wsY] + .dlg2: + + mov [AddX],eax + mov [AddY],ebx + ;----------- + + mov ecx,NAME_LENGTH + mov edi,DAreaName + xor al,al + rep stosb + mov dword[edtName.size],0 + mov dword[edtName.pos],0 + + mov ecx,256 + mov edi,DAreaPath + rep stosb + mov dword[edtExePath.size],0 + mov dword[edtExePath.pos],0 + + mov ecx,256 + mov edi,DAreaParams + rep stosb + mov dword[edtParams.size],0 + mov dword[edtParams.pos],0 + + mov ecx,256 + mov edi,DAreaIcon + + mov [DAreaIcon],'0' + mov dword[edtIcon.size],1 + mov dword[edtIcon.pos],1 + + jmp startDlg + ;-------- +SetProp: + mov esi,[IconsOffs+eax*4] + mov edi,DAreaName + xor ecx,ecx + @@: + lodsb + stosb + inc ecx + test al,al + jnz @b + dec ecx + mov dword[edtName.size],ecx + mov dword[edtName.pos],ecx + + xor ecx,ecx + mov edi,DAreaPath + @@: + lodsb + stosb + inc ecx + test al,al + jnz @b + dec ecx + mov dword[edtExePath.size],ecx + mov dword[edtExePath.pos],ecx + + xor ecx,ecx + mov edi,DAreaParams + @@: + lodsb + stosb + inc ecx + test al,al + jnz @b + dec ecx + mov dword[edtParams.size],ecx + mov dword[edtParams.pos],ecx + + xor ecx,ecx + mov edi,DAreaIcon + @@: + lodsb + stosb + inc ecx + test al,al + jnz @b + dec ecx + mov dword[edtIcon.size],ecx + mov dword[edtIcon.pos],ecx + + +startDlg: + mcall 9,RBProcInfo,-1 + mcall 18,21,dword[RBProcInfo+30] + mov [slotDlgAdd],eax + + or [edtName.flags],ed_focus + + mcall 40,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER + xor eax,eax + mov dword[MaxPage],0 + @@: + add eax,ICONS_DRAW_COUNTW + inc dword[MaxPage] + cmp eax,[icon_count] + jb @b + dec dword[MaxPage] + cmp dword[MaxPage],0 + jne @f + mov dword[MaxPage],1 + @@: + +DReDraw: + mcall 48,3,sc,40 + + mov eax,[sc.work] + rol eax,16 + add al,9 + jnc @f + mov al,0FFh + @@: + rol eax,16 + add al,9 + jnc @f + mov al,0FFh + @@: + add ah,9 + jnc @f + mov ah,0FFh + @@: + + mov [sbIcons.bckg_col],eax + m2m [sbIcons.frnt_col],[sc.work] + m2m [sbIcons.line_col],[sc.work_graph] + + ;edit_boxes_set_sys_color edtIcon,endEdits,sc + edit_boxes_set_sys_color edtName,endEdits,sc + + m2m [edtIcon.color],[sc.work] + m2m [edtIcon.blur_border_color],[sc.work] + + call DRedrawWin + +DMessages: + mcall 10 ;WaitMessage + + dec eax + jz DReDraw + dec eax + jz DKey + dec eax + jz DButton + sub eax,3 + jz DMouse + + jmp DMessages + + +;--------------------------------------------------------------------- +DKey: + mcall 2 ;GetKeyPressed + cmp ah,1Bh + je DExit + cmp ah,9 ;Tab + je DNextEdit + stdcall [edit_box_key],edtName + stdcall [edit_box_key],edtExePath + stdcall [edit_box_key],edtParams + ;stdcall [edit_box_key],edtIcon + + jmp DMessages + + +DNextEdit: + test [edtName.flags],ed_focus + jne .DNE1 + test [edtExePath.flags],ed_focus + jne .DNE2 + test [edtParams.flags],ed_focus + jne .DNE3 + ;test [edtIcon.flags],ed_focus + ;jne .DNE4 + jmp DMessages + + .DNE1: + and [edtName.flags],not ed_focus + or [edtExePath.flags],ed_focus + stdcall [edit_box_draw],edtName + stdcall [edit_box_draw],edtExePath + jmp DMessages + + .DNE2: + and [edtExePath.flags],not ed_focus + or [edtParams.flags],ed_focus + stdcall [edit_box_draw],edtExePath + stdcall [edit_box_draw],edtParams + jmp DMessages + + .DNE3: + and [edtParams.flags],not ed_focus + or [edtName.flags],ed_focus + stdcall [edit_box_draw],edtParams + stdcall [edit_box_draw],edtName + jmp DMessages + + ;.DNE4: + ; and [edtIcon.flags],not ed_focus + ; or [edtName.flags],ed_focus + ; stdcall [edit_box_draw],edtName + ; stdcall [edit_box_draw],edtIcon + ; jmp DMessages +;--------------------------------------------------------------------- +DButton: + mcall 17 ;GetButtonPressed + cmp ah, idbCancel + je DExit + cmp ah,idbChange + je DSetExePath + cmp ah,idbCreate + je DSaveIcon + + jmp DMessages +;------------------------------------------------------------------------------- +DMouse: + stdcall [edit_box_mouse],edtName + stdcall [edit_box_mouse],edtExePath + stdcall [edit_box_mouse],edtParams +; stdcall [edit_box_mouse],edtIcon + + push [sbIcons.position] + stdcall [scrollbar_h_mouse],sbIcons + pop eax + cmp eax,[sbIcons.position] + je @f + call DrawStdIcons + @@: + + mcall 37,2 ;GetMouseKey + test eax,1 + jz DMessages + mcall 37,1 ;GetMouseWinPos + + test eax,10001000h + jne DMessages + xor edx,edx + mov dx,ax ;y + shr eax,16 ;x + + sub eax,ICONSX + js DMessages + sub edx,ICONSY + js DMessages + + cmp eax,(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW + ja DMessages + cmp edx,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH + ja DMessages + + xor ebx,ebx + mov ecx,[sbIcons.position] + test ecx,ecx + jz .DM + @@: + add ebx,ICONS_DRAW_COUNTH + loop @b + .DM: + + sub eax,IMG_SIZE+SPCW + js .DM1 + @@: + add ebx,ICONS_DRAW_COUNTH + sub eax,IMG_SIZE+SPCW + jns @b + .DM1: + + + sub edx,IMG_SIZE+SPCH + js .DM2 + @@: + inc ebx + sub edx,IMG_SIZE+SPCH + jns @b + .DM2: + + mov eax,ebx + + cmp eax,[icon_count] + jae DMessages + +; stdcall byteToHex,al,DAreaIcon ;2 + stdcall intToStr,eax,DAreaIcon + mov dword[edtIcon.size],edx + + ; stdcall [edit_box_draw],edtIcon + + call DrawSelIcon + jmp DMessages +;------------------------------------------------------------------------------- +DSetExePath: + stdcall [OpenDialog_Start],OpenDialog_data + mov edi,DAreaPath + xor al,al + or ecx,-1 + repne scasb + sub edi,DAreaPath + dec edi + mov dword[edtExePath+12*4],edi + + jmp DMessages;DReDraw; + +DSaveIcon: + mov edi,DAreaName + mov esi,secRButt + @@: lodsb + scasb + jne @f + test al,al + jnz @b + + mov dword[fiRunProg+8],ErrName + mov dword[fiRunProg+21],pthNotify + mcall 70,fiRunProg + + jmp DMessages + @@: + mov dword[fiRunProg+8],WarningSave + mov dword[fiRunProg+21],pthNotify + mcall 70,fiRunProg + + + cmp [DlgSelIcon],-1 + je @f + + stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams + mov ebx,[DlgSelIcon] + mov eax,[IconsID+ebx*4] + jmp DExitAndSave + @@: + + call GenerateID + + mov ebx,[MaxNumIcon] + mov [IconsID+ebx*4],eax + push eax + stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams + pop eax + +;------------------------------------------------------------------------------- +DExitAndSave: + + mov dword[nameSection],eax + stdcall [ini_set_str],IconIni,nameSection,keyName,DAreaName,dword[edtName.size] + stdcall [ini_set_str],IconIni,nameSection,keyPath,DAreaPath,dword[edtExePath.size] + stdcall [ini_set_str],IconIni,nameSection,keyParams,DAreaParams,dword[edtParams.size] + stdcall [ini_set_str],IconIni,nameSection,keyIco,DAreaIcon,dword[edtIcon.size] + + cmp [DlgSelIcon],-1 + jne @f + stdcall [ini_set_int],IconIni,nameSection,keyX,[MouseX] + stdcall [ini_set_int],IconIni,nameSection,keyY,[MouseY] + @@: +DExit: + mov [DlgAddActiv],0 + mov [slotDlgAdd],0 + mcall -1 ;ExitThread + +;################################################################## +proc DRedrawWin + mcall 12,1 ;RedrawWinBeg + mov edx,[sc.work] + or edx,34000000h + cmp [DlgSelIcon],-1 + jne @f + mov edi,DTitleAdd + jmp .l1 + @@: + mov edi,DTitleProp + .l1: + mcall 0,<100,END_ICONS_AREAW+ICONSX+10>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+178>,,, + + stdcall [edit_box_draw],edtName + stdcall [edit_box_draw],edtExePath + stdcall [edit_box_draw],edtParams + + call DrawStdIcons + + + stdcall [scrollbar_h_draw],sbIcons + mcall 38,,,[sc.work_graph] + mcall ,,,[sc.work_graph] + + mcall ,,,[sc.work_graph] + mcall ,,,[sc.work_graph] + + ;BUTTONS + mcall 8,<265,75>,<30+END_ICONS_AREAH,24>,idbCreate,[sc.work_button] + mcall ,<360,77>, ,idbCancel + mcall ,,<30,20> ,idbChange + + ;CAPTIONS + mov ecx,[sc.work_text] + or ecx,90000000h + mcall 4,<30+IMG_SIZE,10>,,DCaptName + mcall ,<30+IMG_SIZE,35>,,DCaptPath + mcall ,<30+IMG_SIZE,59>,,DCaptParams + +if lang eq ru_RU + mov ecx,[sc.work_button_text] + or ecx,90000000h + mcall ,<369,35+END_ICONS_AREAH>,,DCaptCancel + + cmp [DlgSelIcon],-1 + jne @f + mpack ebx,275,35+END_ICONS_AREAH + mov edx,DCaptCreate + jmp .DRD1 + @@: + mpack ebx,272,35+END_ICONS_AREAH + mov edx,DCaptProperties + .DRD1: +else ; Default to en_US + mov ecx,[sc.work_button_text] + or ecx,90000000h + mcall ,<372,35+END_ICONS_AREAH>,,DCaptCancel + + + cmp [DlgSelIcon],-1 + jne @f + mpack ebx,277,35+END_ICONS_AREAH + mov edx,DCaptCreate + jmp .DRD1 + @@: + mpack ebx,277,35+END_ICONS_AREAH + mov edx,DCaptProperties + .DRD1: +end if + mcall + + pusha + mov ecx,[sc.work_button_text] + or ecx,90000000h + mcall 4,,,DCaptDots + popa + + call DrawSelIcon + + mcall 12,2 ;RedrawWinEnd + ret +endp + + +proc DrawStdIcons +local IcoX:DWORD,\ + IcoY:DWORD,\ + iIcon:DWORD + + mov ecx,[sbIcons.position] + xor eax,eax + m2m dword[iIcon],0 + + test ecx,ecx + jz .DST1 + @@: + add [iIcon],ICONS_DRAW_COUNTH + add eax,IMG_SIZE*IMG_SIZE*4*ICONS_DRAW_COUNTH + loop @b + .DST1: + + lea esi,[eax+44] + add esi,[raw_pointer] + + mov [IcoX],ICONSX + + mov ecx,ICONS_DRAW_COUNTW + .DrawIcons: + push ecx + + mov [IcoY],ICONSY + + mov ecx,ICONS_DRAW_COUNTH + .DrawIcoStolb: + push ecx + + mov edi,DlgBufImg + mov edx,IMG_SIZE + + .DrawLine: + + + mov ecx,IMG_SIZE + .DrawPix: + + lodsd + test eax,0FF000000h + jnz @f + mov eax,[sc.work] + @@: + + mov [edi],ax + shr eax,16 + mov [edi+2],al + add edi,3 + + loop .DrawPix + + dec edx + jnz .DrawLine + + mov edx,[IcoX] + shl edx,16 + mov dx,word[IcoY] + mcall 7,DlgBufImg, + + inc [iIcon] + mov eax,[iIcon] + cmp eax,[icon_count] + jae .endDrawIcon + + add dword[IcoY],IMG_SIZE+SPCH + pop ecx + loop .DrawIcoStolb + + add dword[IcoX],IMG_SIZE+SPCW + pop ecx + loop .DrawIcons + jmp .endProc + + .endDrawIcon: + + mov ecx,IMG_SIZE*IMG_SIZE + mov edi,DlgBufImg + mov eax,[sc.work] + mov ebx,eax + shr ebx,16 + @@: + mov word[edi],ax + mov [edi+2],bl + add edi,3 + loop @b + + ;࠭ ᯮ짮 + jmp .Dalee + + .DrawIcons2: + push ecx + + mov [IcoY],ICONSY + mov ecx,ICONS_DRAW_COUNTH + .DrawIcoStolb2: + push ecx + + mov edx,[IcoX] + shl edx,16 + mov dx,word[IcoY] + mcall 7,DlgBufImg, + + .Dalee: + add dword[IcoY],IMG_SIZE+SPCH + pop ecx + loop .DrawIcoStolb2 + + add dword[IcoX],IMG_SIZE+SPCW + pop ecx + loop .DrawIcons2 + + .endProc: + + ret +endp + +proc DrawSelIcon + mov edx,[sc.work] + mcall 13,,<59,12> + + mov ecx,[sc.work_text] + or ecx,90000000h + mcall 4,,,DAreaIcon + + mov edi,DAreaIcon + cmp byte[edi],0 + jne @f + ret + @@: + + ;stdcall hexToInt, edi + stdcall strToInt, edi + @@: ;eax=num icon + cmp eax,[icon_count] + jb @f + xor eax,eax + @@: + test eax,eax + je .DI1 + mov ecx,eax + xor eax,eax + @@: + add eax,IMG_SIZE*IMG_SIZE*4 + loop @b + .DI1: + mov esi,eax + add esi,[raw_pointer] + add esi,44 + + mov edi,DlgBufImg + mov edx,IMG_SIZE + .DrawLine: + + mov ecx,IMG_SIZE + .DrawPix: + + lodsd + test eax,0FF000000h + jnz @f + mov eax,[sc.work] + @@: + + mov word[edi],ax + shr eax,16 + mov [edi+2],al + add edi,3 + + loop .DrawPix + + dec edx + jnz .DrawLine + + mcall 7,DlgBufImg,,<30,15> + + ret +endp + +;NOT USED +proc hexToInt strz:DWORD + push ebx + mov ebx,[strz] + mov al,[ebx] + xor edx,edx +.loop: + xor ecx,ecx + inc ebx + shl edx,4 + cmp al,'0' + jb .err + cmp al,'9' + jbe .conv + mov ecx,10 + sub al,11h + cmp al,'0' + jb .err + cmp al,'6' + ja .err +.conv: + sub al,30h + add dl,al + mov al,[ebx] + add dl,cl + test al,al + jnz .loop + mov eax,edx + pop ebx + ret +.err: + xor eax,eax + pop ebx + ret +endp + + +;NOT USED +proc byteToHex byti:BYTE,target:DWORD + push ebx + mov ebx,[target] + mov dl,[byti] + rol dl,4 + mov ecx,2 +.loop: + mov al,dl + and al,0xF + cmp al,10 + jae @f + add al,0x30 + jmp .n +@@: + add al,0x41-10 +.n: + mov [ebx],al + inc ebx + rol dl,4 + loop .loop + + mov byte[ebx],0 +@@: pop ebx + ret + jmp @b +endp + + +proc strToInt strz:DWORD + push ebx edi esi + stdcall strLen, [strz] + xor edx,edx + xor ebx,ebx + xor edi,edi + std + inc ebx + mov esi,[strz] + lea esi,[esi+eax-2] +.loop: + xor eax,eax + lodsb + cmp al,'0' + jb .err + cmp al,'9' + ja .err + + sub al,0x30 + mul ebx + lea ebx,[ebx*4+ebx] ;ebx = ebx*10 + shl ebx,1 + add edi,eax + cmp esi,[strz] + jae .loop + cld + mov eax,edi + pop esi edi ebx + ret +.err: + cld + or eax,-1 + pop esi edi ebx + ret +endp + + +;ret: target - string, edx - length string +proc intToStr inti:DWORD, target:DWORD +locals + resl rb 16 +endl + lea edi,[resl] + mov eax,[inti] + xor ecx,ecx + mov ebx,10 + jmp .stlp +.loop: + xor edx,edx + div ebx + mov [edi],dl + inc edi + inc ecx +.stlp: cmp eax,10 + jae .loop + mov [edi],al + inc ecx + mov edx,ecx + mov ebx,[target] +.conv: + mov al,[edi] + add al,0x30 + mov [ebx],al + inc ebx + dec edi + loop .conv + mov byte[ebx],0 + ret +endp + +;for 'ab',0 strLen = 3 +proc strLen stringZ:DWORD + push edi + xor al,al + mov edi,[stringZ] + or ecx,-1 + repne scasb + sub edi,[stringZ] + mov eax,edi + pop edi + ret +endp + + diff --git a/programs/system/icon_new/icon.asm b/programs/system/icon_new/icon.asm index de8516501..f6ff15f7b 100644 --- a/programs/system/icon_new/icon.asm +++ b/programs/system/icon_new/icon.asm @@ -1,1349 +1,1350 @@ -ICON_STRIP equ '/sys/icons32.png' -ICON_INI equ '/sys/settings/icon.ini' -ICON_SIZE equ 68 ;ࠧ -IMG_SIZE equ 32 ;ࠧ -TEXT_BOTTOM_Y equ 14 ; Y ⥪ -IMAGE_TOP_Y equ 10 ;>=1 न Y -ALIGN_SIZE equ 68 ;ࠧ ⪨ ࠢ -NAME_LENGTH equ 11 ; -MIN_NO_MOVING equ 8 ;१ ⮫쪮 ᥫ ᤢ 稭 ᪠ - - ;-------- ᮧ/।஢ -ICONSX equ 20 -ICONSY equ 90 -ICONS_DRAW_COUNTW equ 12 ;⢮ ਭ -ICONS_DRAW_COUNTH equ 6 ;⢮ -SPCW equ 3 ;஡ ਧ⠫ -SPCH equ 3 -END_ICONS_AREAW equ ICONSX+(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW -END_ICONS_AREAH equ ICONSY+(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH - - - -SizeData equ bufStdIco+32 -BegData equ fiStdIco.point -;------------------------------------------------------------------------------ - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd ENDMEM ; memory for app - dd stack_main ; esp - dd 0 ; boot parameters - dd 0 ; path -;------------------------------------------------------------------------------ -include 'lang.inc' -include '../../macros.inc' -include '../../proc32.inc' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../dll.inc' -include '../../debug.inc' - - -; include '../include/lang.inc' -; include '../include/macros.inc' -; include '../include/proc32.inc' -; include '../include/box_lib.mac' -; include '../include/dll.inc' - -;------------------------------------------------------------------------------ -START: ; start of execution - - mcall 68,11 - stdcall dll.Load,IMPORTS - test eax,eax - jnz ErrLoadLibs - - mcall 30,1,curpath - -; unpack deflate - mov eax,[unpack_DeflateUnpack2] - mov [deflate_unpack],eax -;--------------------------------------------------------------------- -; get size of file icons32.png - mcall 70,fiStdIco - test eax,eax - jnz ErrorStrp -; get memory for icons32.png - mov ecx,dword[bufStdIco+32] - mov [fiStdIco.size],ecx - mov [img_size],ecx - mcall 68,12 - mov [fiStdIco.point],eax - mov [image_file],eax -; load icons32.png - mov dword[fiStdIco],0 - mcall 70,fiStdIco - test eax,eax - jnz close -; convert PNG to RAW - xor eax,eax - mov [return_code],eax -;int3 - - push image_file - call [cnv_png_import.Start] - - mov eax,[raw_pointer] - mov ebx,[eax+32] - mov [strip_file_size],ebx - mov eax,[eax+28] - add eax,[raw_pointer] - mov [strip_file],eax -; back memory to system - mcall 68,13,[fiStdIco.point] - - mov eax,[raw_pointer] - mov eax,[eax+8] - shr eax,5 - mov [icon_count],eax - - and eax,0x7 - mov [cur_band_compensation],eax - -;########## 㦠 ########################## - - mcall 70,fiIni ;뤥塞 , 筮 ࠭ ini 䠩. - test eax,eax ; 筮 墠 ࠭ - jnz ErrorIni - - cmp dword[bufIni+32],0 - je ErrorIni - mcall 68,12,dword[bufIni+32] - mov dword[BegData],eax - jmp NoErrIni - - ErrorIni: - mcall 70,fiRunProg - mcall -1 - - NoErrIni: - m2m [PIcoDB],[BegData] - - - - mov edi,IconsID - xor eax,eax - mov ecx,100h/4 - rep stosd - mov [nLoadIcon],0 - stdcall [ini_enum_sections],IconIni,LoadIconsData - - mov eax,dword[PIcoDB] - sub eax,[BegData] - mov dword[SizeData],eax - mov eax,[BegData] - cmp eax,[PIcoDB] - jne @f - mov dword[eax],0 - mov dword[SizeData],0 - @@: -;###################################################################### - call FillIconsOffs ; MaxNumIcon,IconsOffs - -;樠 IPC - mov dword[IPCbuffer],0 - mov dword[IPCbuffer+4],8 - mcall 60,1,IPCbuffer,1024 - - mcall 40,EVM_MOUSE+EVM_IPC ;㦭 ⮫쪮 ᮡ IPC, - ;ᮢ 㤥 㣮 ⮪ - mov eax,[icon_count] - mov bl,ICONS_DRAW_COUNTH - div bl - test ah,ah - jz @f - inc al - @@: - and eax,0FFh - mov [sbIcons.max_area],eax - - mcall 51,1,BGRedrawThread,stack_bredraw ;᪠ ⮪ ᮢ - stdcall [OpenDialog_Init],OpenDialog_data - -;dph [MaxNumIcon] - -messages: - mcall 10 - sub eax,6 - jz MSGMouse - dec eax - jz MSGIPC - jmp messages - -MSGIPC: - call IPCCreateIcon - jmp messages - -MSGMouse: - mcall 37,0 ;GetMousePos - xor ebx,ebx - mov bx,ax - shr eax,16 - mov ecx,ebx - mov ebx,eax - - mcall 34 - cmp eax,1 - jne messages - - cmp [RButtonActiv],1 - je messages - - mov [MouseY],ecx - mov [MouseX],ebx - -MOUSE_STATE_LMB_HOLD = $00000001 -MOUSE_STATE_RMB_HOLD = $00000002 -MOUSE_EVENT_LMB_DOWN = $00000100 -MOUSE_EVENT_RMB_DOWN = $00000200 - - mcall 37,3 -;check LMB is pressed - test eax, MOUSE_STATE_LMB_HOLD - jz @f - test eax, MOUSE_EVENT_LMB_DOWN - jz @f - jmp LButtonPress -@@: -;check RMB is pressed - test eax, MOUSE_STATE_RMB_HOLD - jz @f - test eax, MOUSE_EVENT_RMB_DOWN - jz @f - jmp RButtonPress -@@: - jmp messages - -ErrLoadLibs: - ;dps ' 㤠 㧨 室 ⥪' - ;debug_newline - jmp close -ErrorStrp: - ;dps '訡 icons32.png' - ;debug_newline -close: - mcall -1 - -LButtonPress: - - stdcall GetNumIcon,[MouseX],[MouseY],-1 -;int3 - cmp eax,-1 - jnz @f - - WaitLB1: - mcall 37,2 - test al,001b - jz messages - ;Yield - mcall 5,1 - jmp WaitLB1 - - - @@: - push eax - stdcall DrawIcon,eax,1 - WaitLB: - mcall 37,2 - test al,001b - jz endWaitLB - - mcall 37,0 - xor ebx,ebx - mov bx,ax - shr eax,16 - sub eax,[MouseX] - jns @f - neg eax - @@: - sub ebx,[MouseY] - jns @f - neg ebx - @@: - cmp [bFixIcons],0 - jne @f - cmp eax,MIN_NO_MOVING - ja MovingIcon - cmp ebx,MIN_NO_MOVING - ja MovingIcon - @@: - ;Yield - mcall 5,1 ;Sleep 1 - - jmp WaitLB - endWaitLB: - - mcall 37,0 - xor ebx,ebx - mov bx,ax - shr eax,16 - mov ecx,ebx - mov ebx,eax - mov [MouseX],ebx - mov [MouseY],ecx - - stdcall GetNumIcon,[MouseX],[MouseY],-1 - cmp eax,[esp] ;[esp] = - jne @f - - mov edi,[IconsOffs+eax*4] - or ecx,-1 - xor al,al - repne scasb - mov ebx,edi - repne scasb - ;run program - mov dword[fiRunProg+8],edi - mov dword[fiRunProg+21],ebx - mcall 70,fiRunProg - - test eax,80000000h - jz @f - - mov dword[fiRunProg+8],ErrRunProg - mov dword[fiRunProg+21],pthNotify - mcall 70,fiRunProg - - @@: - pop eax - stdcall RestoreBackgrnd,eax - mcall 5, 60 - jmp messages - -;------------------------------------------------------------------------------- -MovingIcon: - stdcall GetNumIcon,[MouseX],[MouseY],-1 - mov [SelIcon],eax - mov [IconNoDraw],eax - stdcall RestoreBackgrnd,[SelIcon] - -; mov ecx,[MaxNumIcon] -; xor ebx,ebx -; .MI: push ecx -; cmp ebx,[SelIcon] -; je @f -; stdcall DrawIcon,ebx,0 -; @@: -; inc ebx -; pop ecx -; loop .MI - - - -;dps 'Moving' -;debug_newline -; mov edi,[SelIcon] -; mov edi,[IconsOffs+edi*4] -; or ecx,-1 -; xor al,al -; repne scasb -; repne scasb -; repne scasb -; repne scasb -; xor ebx,ebx -; xor esi,esi -; mov bx,word[edi+2] -; mov si,word[edi] -; stdcall GetNumIcon,ebx,esi,[SelIcon] -; cmp eax,-1 -; je @f -; dps 'Q' -; stdcall DrawIcon,eax,0 -; @@: -; -; add ebx,ICON_SIZE-1 -; stdcall GetNumIcon,ebx,esi,[SelIcon] -; cmp eax,-1 -; je @f -; dps 'Q' -; stdcall DrawIcon,eax,0 -; -; @@: -; add esi,ICON_SIZE-1 -; stdcall GetNumIcon,ebx,esi,[SelIcon] -; cmp eax,-1 -; je @f -; dps 'Q' -; stdcall DrawIcon,eax,0 -; -; @@: -; sub ebx,ICON_SIZE-1 -; stdcall GetNumIcon,ebx,esi,[SelIcon] -; cmp eax,-1 -; je @f -; dps 'Q' -; stdcall DrawIcon,eax,0 -; @@: - - -; Sleep 40 - -;qweqwe: - - mov [MovingActiv],1 - mcall 51,1,MovingWnd,stack_mov ;CreateThread MovingWnd,stack_dlg - .WaitLB: - mcall 37,2 ;GetMouseKey - test al,001b - jz .endWaitLB - - ;Yield - mcall 5,1 ;Sleep 1 - jmp .WaitLB - .endWaitLB: - - - mcall 37,0 ;GetMousePos - xor ebx,ebx - mov bx,ax - shr eax,16 - - sub eax,1+ICON_SIZE/2 - jnc @f - xor eax,eax - @@: - - sub ebx,ICON_SIZE/2-7 - jnc @f - xor ebx,ebx - @@: - - cmp ax,[wsX] - jae @f - mov ax,[wsX] - @@: - - cmp bx,[wsY] - jae @f - mov bx,[wsY] - @@: ;eax,ebx - ॠ쭠 न. न ண ⭮⥫쭮 孥 㣫 ࠡ祩 - - xor edx,edx - mov dx,[wsXe] - sub edx,ICON_SIZE - cmp eax,edx - jbe @f - mov eax,edx - @@: - - mov dx,[wsYe] - sub edx,ICON_SIZE - cmp ebx,edx - jbe @f - mov ebx,edx - @@: - - xor edx,edx ;८ࠧ뢠 ⭮⥫ - mov dx,[wsW] - shr edx,1 - add dx,[wsX] - cmp eax,edx - jbe @f - sub ax,[wsXe] - inc ax - jmp .mov1 - @@: - sub ax,[wsX] - .mov1: - - xor edx,edx - mov dx,[wsH] - shr edx,1 - add dx,[wsY] - cmp ebx,edx - jbe @f - sub bx,[wsYe] - inc bx - jmp .mov2 - @@: - sub bx,[wsY] - .mov2: - - stdcall SetPosition,[SelIcon],eax,ebx - - m2m [PIcoDB],[BegData] - stdcall [ini_enum_sections],IconIni,Ini_SavePos ;in RButton.inc - - mov [bNotSave],1 - mov [IconNoDraw],-1 - - mov [MovingActiv],0 ;⮫쪮 ⥯ ⪫砥 - - jmp messages - -;------------------------------------------------------------------------------- - -RButtonPress: - mov [RButtonActiv],1 - - @@: - mcall 37,2 ;GetMouseKey - test al,010b - jz @f - mcall 5,1 ;Yield - jmp @b - @@: - - mcall 51,1,RButtonWin,stack_rmenu ;CreateThread RButtonWin,stack_rmenu - - jmp messages - - -;############################################################################### -;ret eax = 1/0 = 㤠/訡 -proc DrawIcon NumIcon:DWORD,Activ:DWORD ;NumIcon = 0..n -local IconData:DWORD - push ebx edi esi - - mov ecx,ICON_SIZE*ICON_SIZE - xor eax,eax - mov edi,IconArea - rep stosd - - mov eax,[NumIcon] - cmp eax,[MaxNumIcon] - jb @f - xor eax,eax - pop esi edi ebx - ret - @@: - - mov esi,[IconsOffs+eax*4] - mov [IconData],esi - - ;㥬 ⥪ - mov edi,esi - xor al,al - or ecx,-1 - repne scasb - mov edx,esi - mov eax,edi - sub eax,esi - dec eax - shl eax,1 ;*6 - lea eax,[eax*2+eax] - mov ebx,ICON_SIZE - sub ebx,eax - shr ebx,1 ;ebx = x ⥪ - shl ebx,16 - mov bx,ICON_SIZE - sub bx,TEXT_BOTTOM_Y - mov ecx,88000000h - mov edi,IconAreaH - add ebx,-1*10000h+0 - mcall 4 - add ebx,2*10000h+0 - mcall ;4 - add ebx,-1*10000h-1 - mcall ;4 - add ebx,0*10000h+2 - mcall ;4 - add ebx,1*10000h+0 - mcall ;4 - inc ebx;add ebx,0*10000h+1 - mcall ;4 - add ebx,-1*10000h+0 - mcall ;4 - add ebx,0*10000h-2 - mov ecx,88FFFFFFh - mcall ;4 - ;㥬 ⨭ - - mov edi,esi - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - - ;stdcall hexToInt,edi - stdcall strToInt,edi - @@: ;eax=num icon - cmp eax,[icon_count] - jb @f - xor eax,eax - @@: - test eax,eax - je DI1 - mov ecx,eax - xor eax,eax - @@: - add eax,IMG_SIZE*IMG_SIZE*4 - loop @b - DI1: - add eax,[raw_pointer] - add eax,0+4*11 - mov esi,eax - - CopyToMem: - mov edi,IconArea+((IMAGE_TOP_Y*ICON_SIZE)+((ICON_SIZE-IMG_SIZE)/2))*4 - - mov eax,IMG_SIZE - mov edx,eax - @@: - mov ecx,eax - rep movsd - add edi,(ICON_SIZE-IMG_SIZE)*4 - dec edx - jnz @b - -;----------------- - ;᫨ , 㥬 - cmp [Activ],0 - je .NoSelect - - mov edi,IconArea - mov eax,0FF000000h - mov ecx,ICON_SIZE - rep stosd - ;mov edi,IconArea+ICON_SIZE*1 - - mov ecx,ICON_SIZE-1 - @@: mov dword[edi],eax - add edi,(ICON_SIZE)*4 - loop @b - - mov edi,IconArea+ICON_SIZE*2*4-4 - mov ecx,ICON_SIZE-1 - @@: mov dword[edi],eax - add edi,(ICON_SIZE)*4 - loop @b - - mov edi,IconArea+ICON_SIZE*(ICON_SIZE-1)*4+4 - mov ecx,ICON_SIZE-2 - rep stosd - - - mov edi,IconArea+ICON_SIZE*4+4 - mov eax,0FFFFFFFFh - mov ecx,ICON_SIZE-2 - rep stosd - - mov edi,IconArea+ICON_SIZE*4+4 - mov ecx,ICON_SIZE-2 - @@: mov dword[edi],eax - add edi,(ICON_SIZE)*4 - loop @b - - mov edi,IconArea+ICON_SIZE*2*4-4*2 - mov ecx,ICON_SIZE-3 - @@: mov dword[edi],eax - add edi,(ICON_SIZE)*4 - loop @b - - mov edi,IconArea+ICON_SIZE*(ICON_SIZE-2)*4+4*2 - mov ecx,ICON_SIZE-3 - rep stosd -;-------------- - - .NoSelect: - mov edi,[IconData] - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - repne scasb - mov edx,[edi] - - test edx,00008000h - jz @f - add dx,[wsYe] - jmp .DI11 - @@: - add dx,[wsY] - .DI11: - - test edx,80000000h - jz @f - mov ax,[wsXe] - shl eax,16 - add edx,eax - jmp .DI12 - @@: - mov ax,[wsX] - shl eax,16 - add edx,eax - .DI12: - - mov ebx,IconArea - mov ecx,ICON_SIZE*10000h+ICON_SIZE - mcall 25 - -; mov eax,1 - pop esi edi ebx - ret -endp - -proc RestoreBackgrnd,NumIcon:DWORD - push ebx edi - mov eax,[NumIcon] - cmp eax,[MaxNumIcon] - jb @f - xor eax,eax - pop edi ebx - ret - @@: - - mov edi,[IconsOffs+eax*4] - xor al,al - or ecx,-1 - repne scasb - repne scasb - repne scasb - repne scasb - - mov ax,[edi+2] - test ax,8000h - jz @f - add ax,[wsXe] - jmp .rbg1 - @@: - add ax,[wsX] - .rbg1: - - mov bx,[edi] - test bx,8000h - jz @f - add bx,[wsYe] - jmp .rbg2 - @@: - add bx,[wsY] - .rbg2: - - mov cx,ax - shl ecx,16 - add ax,ICON_SIZE - mov cx,ax - mov dx,bx - shl edx,16 - add bx,ICON_SIZE - mov dx,bx - dec ecx - dec edx - mcall 15,9 - pop edi ebx - ret -endp - - ; MaxNumIcon,IconsOffs -proc FillIconsOffs - push ebx edi - mov edi,[BegData] - mov dword[MaxNumIcon],0 - cmp dword[edi],0 - jne @f - mov dword[IconsOffs],0 - pop edi ebx - ret - @@: - - mov [IconsOffs],edi - xor al,al - xor edx,edx - mov ebx,dword[SizeData] - add ebx,dword[BegData] - or ecx,-1 - .CalcNumIc: - - repne scasb - repne scasb - repne scasb - repne scasb - add edi,4 - mov dword[IconsOffs+edx+4],edi - inc dword[MaxNumIcon] - add edx,4 - - cmp edi,ebx - jae @f - jmp .CalcNumIc - @@: - - mov dword[IconsOffs+edx],0 - - pop edi ebx - ret -endp - -proc LoadIconsData stdcall,f_name,sec_name - push ebx esi edi - - mov edi,secRButt - mov esi,[sec_name] - @@: lodsb - scasb - jnz .lid1 - test al,al - jnz @b - - mov eax,1 - pop edi esi ebx - ret - .lid1: - - - mov ebx,[sec_name] ;㥬 ID - mov ax,[ebx] - mov edi,[nLoadIcon] - mov word[edi*4+IconsID],ax - mov word[edi*4+IconsID+2],0 - - mov edi,[PIcoDB] - stdcall [ini_get_str],[f_name],[sec_name],keyName,edi,4096,0 - test eax,eax - jz @f - xor eax,eax - pop edi esi ebx - ret - @@: - xor al,al - or ecx,-1 - repne scasb - - - - stdcall [ini_get_str],[f_name],[sec_name],keyPath,edi,4096,0 - test eax,eax - jz @f - xor eax,eax - pop edi esi ebx - ret - @@: - xor al,al - or ecx,-1 - repne scasb - - stdcall [ini_get_str],[f_name],[sec_name],keyParams,edi,4096,0 - test eax,eax - jz @f - xor eax,eax - pop edi esi ebx - ret - @@: - xor al,al - or ecx,-1 - repne scasb - - stdcall [ini_get_str],[f_name],[sec_name],keyIco,edi,4096,0 - test eax,eax - jz @f - xor eax,eax - pop edi esi ebx - ret - @@: - xor al,al - or ecx,-1 - repne scasb - - stdcall [ini_get_int],[f_name],[sec_name],keyX,80000000h - cmp eax,80000000h - jne @f - xor eax,eax - pop edi esi ebx - ret - @@: - mov word[edi+2],ax - - stdcall [ini_get_int],[f_name],[sec_name],keyY,80000000h - cmp eax,80000000h - jne @f - xor eax,eax - pop edi esi ebx - ret - @@: - mov word[edi],ax - add edi,4 - mov [PIcoDB],edi - - inc [nLoadIcon] - - mov eax,1 - pop edi esi ebx - ret -endp - -proc GenerateID ;ax = ID - push ebx edi - mov ebx,[MaxNumIcon] - test ebx,ebx - jnz @f - mov eax,'00' - pop edi ebx - ret - @@: - - mov eax,dword[IconsID+ebx*4-4] - .inc: - inc ah - cmp ah,'9'+1 - jne @f - mov ah,'A' - @@: - cmp ah,'F'+1 - jne @f - mov ah,'0' - inc al - @@: - cmp al,'9'+1 - jne @f - mov al,'A' - @@: - cmp al,'F'+1 - jne @f - mov al,'0' - @@: - - - mov edi,IconsID - ;cmp dword[edi],0 - ;je @f - mov ecx,100h - @@: scasd - je .inc - cmp dword[edi],0 - je @f - loop @b - @@: - - pop edi ebx - ret -endp - -;------------------------------------------------------------------------------- - - -;ଠ IPC-ᮮ饭 -;dd X -;dd Y -;asciiz Icon - in decimal -;asciiz Name -;asciiz Path -;asciiz Params -;------------------------------------------------------------------------------- -proc IPCCreateIcon -locals - ix rd 1 - iy rd 1 -endl - - mov eax,IPCbuffer+8 - mov dword[IPCbuffer],1 - lea edx,[eax+8] - - m2m dword[ix],dword[edx] - m2m dword[iy],dword[edx+4] - - lea esi,[edx+8] - - mov ecx,256 - mov edi,DAreaIcon - @@: lodsb - stosb - test al,al - jnz @b - - mov ecx,NAME_LENGTH+1 - mov edi,DAreaName - @@: lodsb - stosb - test al,al - jz @f - loop @b - @@: - - mov edi,DAreaPath - @@: lodsb - stosb - test al,al - jnz @b - - mov edi,DAreaParams - @@: lodsb - stosb - test al,al - jnz @b - - mov dword[IPCbuffer+4],8 - mov dword[IPCbuffer],0 - - stdcall AddIcon,[ix],[iy],DAreaIcon,DAreaName,DAreaPath,DAreaParams - - mcall 15,3 - ret -endp - - -include 'iconman.inc' -include 'bgredraw.inc' -include 'RButton.inc' -include 'DlgAdd.inc' -include 'Moving.inc' - -;'Eolite',0,'/sys/File managers/eolite',0,'/hd0/3/Muzik',0,'1',0,00010001h -;------------------------------------------------------------------------------- -;##### DATA #################################################################### -;------------------------------------------------------------------------------- -; not change this section!!! -; start section -;------------------------------------------------------------------------------ -align 4 -image_file dd 0 ;+0 -raw_pointer dd 0 ;+4 -return_code dd 0 ;+8 -img_size dd 0 ;+12 -deflate_unpack dd 0 ;+16 ; not use for scaling -raw_pointer_2 dd 0 ;+20 ; not use for scaling -;------------------------------------------------------------------------------ -; end section -;------------------------------------------------------------------------------ - - -align 4 -fiStdIco: - dd 5 - dd 0 - dd 0 -.size dd 0 -.point dd bufStdIco - db ICON_STRIP,0 - - -align 4 -fiRunProg: ; ᪠ ணࠬ - dd 7 - dd 0 - dd 0 - dd 0 - dd ErrNotFoundIni - db 0 - dd pthNotify - -fiIni dd 5 ; ini 䠩 - dd 0 - dd 0 - dd 0 - dd bufIni - db 0 - dd IconIni - - -IconsFile db ICON_STRIP,0 - -align 4 -MaxNumIcon dd 0 ;⢮ -IconNoDraw dd -1 ;-1 , ᮢ( ᪠ ) - -bFixIcons dd 1 -bNotSave dd 0 - -LButtonActiv dd 0 -RButtonActiv dd 0 -MovingActiv dd 0 -DlgAddActiv dd 0 - -IconIni db ICON_INI,0 - -pthNotify db '/sys/@notify',0 - -keyName db 'name',0 -keyPath db 'path',0 -keyParams db 'param',0 -keyIco db 'ico',0 -keyX db 'x',0 -keyY db 'y',0 - -;------------------------------------------------------------------------------- -IMPORTS: -library cnv_png ,'cnv_png.obj',\ - archiver,'archiver.obj',\ - box_lib ,'box_lib.obj',\ - proc_lib,'proc_lib.obj',\ - libini ,'libini.obj' - -import cnv_png,\ - cnv_png_import.Start ,'START',\ - cnv_png_import.Version ,'version',\ - cnv_png_import.Check ,'Check_Header',\ - cnv_png_import.Assoc ,'Associations' - -import archiver,\ - unpack_DeflateUnpack2 ,'deflate_unpack2' - -import box_lib,\ - edit_box_draw ,'edit_box_draw',\ - edit_box_key ,'edit_box_key',\ - edit_box_mouse ,'edit_box_mouse',\ - scrollbar_h_draw ,'scrollbar_h_draw',\ - scrollbar_h_mouse ,'scrollbar_h_mouse' - -import proc_lib,\ - OpenDialog_Init ,'OpenDialog_init',\ - OpenDialog_Start ,'OpenDialog_start' - -import libini,\ - ini_enum_sections ,'ini_enum_sections',\ - ini_enum_keys ,'ini_enum_keys',\ - ini_get_str ,'ini_get_str',\ - ini_set_str ,'ini_set_str',\ - ini_get_color ,'ini_get_color',\ - ini_get_int ,'ini_get_int',\ - ini_set_int ,'ini_set_int',\ - ini_del_section ,'ini_del_section',\ - ini_exist_sect ,'ini_exist_sect' - - -;ini.get_str (f_name, sec_name, key_name, buffer, buf_len, def_val) -;ini.set_str (f_name, sec_name, key_name, buffer, buf_len) - - -;------------------------------------------------------------------------------- -;----- RButton.inc ------------------------------------------------------------- -;------------------------------------------------------------------------------- - -if lang eq ru_RU - MinRMenuW dd 18*6+10 -else - MinRMenuW dd 15*6+10 -end if - -secRButt db 'rbmenu',0 - -curpath db '/sys',0 - -PredItem dd -1 - -if lang eq ru_RU - RMenuRedrawFon db 'ᮢ',0 - RMenuAlign db '஢ ⪥',0 - RMenuOffMoving db '९ ',0 - RMenuOnMoving db '९ ',0 - RMenuAdd db '',0 - RMenuDel db '',0 - RMenuProp db '⢠',0 -else - RMenuRedrawFon db 'Redraw',0 - RMenuAlign db 'Snap to grid',0 - RMenuOffMoving db 'Fix the icons',0 - RMenuOnMoving db 'Unfix the icons',0 - RMenuAdd db 'Add',0 - RMenuDel db 'Delete',0 - RMenuProp db 'Properties',0 -end if - -if lang eq ru_RU - ErrRunProg db '訡 ᪠ ணࠬ',0 - WarningSave db ' ࠭ , RDSave',0 - ErrNotFoundIni db ' icon.ini',0 - ErrName db ' "rbmenu" १ࢨ஢',0 -else - ErrRunProg db 'Error running program',0 - WarningSave db 'Remember to save changes with "RDSave"',0 - ErrNotFoundIni db 'icon.ini not found',0 - ErrName db 'The name "rbmenu" reserved',0 -end if - -;------------------------------------------------------------------------------- -;------- AddDlg.inc --------------------------------------------------------------- -;------------------------------------------------------------------------------- -if lang eq ru_RU -DTitleAdd db ' ',0 -DTitleProp db ' ',0 - -DCaptName db ' ',0 -DCaptPath db ' ',0 -DCaptParams db ' ',0 -;DCaptChange db '.',0 -DCaptCreate db '',0 -DCaptProperties db '',0 -DCaptCancel db '⬥',0 - -else -DTitleAdd db 'Add icon',0 -DTitleProp db 'Change icon',0 - -DCaptName db ' Name',0 -DCaptPath db ' Path',0 -DCaptParams db ' Params',0 -DCaptCreate db 'Create',0 -DCaptProperties db 'Change',0 -DCaptCancel db 'Cancel',0 -end if -DCaptDots db '...',0 - -;/ -edtName edit_box NAME_LENGTH*8+4,120+IMG_SIZE,6,0FFFFFFh,06F9480h,0FFh,0h,0x90000000,NAME_LENGTH,\ - DAreaName,mouse_dd,0,0,0 -edtExePath edit_box END_ICONS_AREAW-120-IMG_SIZE-40,120+IMG_SIZE,30,0FFFFFFh,06F9480h,\ - 0FFh,0h,0x90000000,255, DAreaPath,mouse_dd,0,0,0 -edtParams edit_box END_ICONS_AREAW-120-IMG_SIZE, 120+IMG_SIZE,54,0FFFFFFh,06F9480h,\ - 0FFh,0h,0x90000000,255, DAreaParams,mouse_dd,0,0,0 -edtIcon edit_box 28,24,62,0FFFFFFh,0FFFFFFh,0FFh,0h,0x90000000,3,\ - DAreaIcon,0,0,0,0 -endEdits: -;\ - -sbIcons: - dw END_ICONS_AREAW-ICONSX - dw ICONSX - dw 15 - dw END_ICONS_AREAH+3 - dd 0 - dd 1 - .max_area dd 0 - .cur_area dd ICONS_DRAW_COUNTW - .position dd 0 - .bckg_col dd 0 - .frnt_col dd 0 - .line_col dd 0 - .redraw dd 0 - .delta dd 0 - .delta2 dd 0 - .r_size_x dw 0 - .r_start_x dw 0 - .r_size_y dw 0 - - .r_start_y dw 0 - .m_pos dd 0 - .m_pos2 dd 0 - .m_keys dd 0 - .run_size dd 0 - .position2 dd 0 - .work_size dd 0 - .all_redraw dd 0 - .ar_offset dd 0 - -;------------------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 -.procinfo dd RBProcInfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd DRedrawWin;draw_window_for_OD ;+28 -.status dd 0 ;+32 -.openfile_pach dd DAreaPath;fname_Info ;+36 -.filename_area dd 0;DAreaPath ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 100 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 100 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: - db '/sys/File managers/opendial',0 - -communication_area_default_pach: - db '/sys',0 - -Filter dd 0 - -;open_dialog db 0 -;------------------------------------------------------------------------------- - -;/ ࠧ -align 4 -IconAreaH dd ICON_SIZE,ICON_SIZE -I_END: -;##### UDATA ################################################################### -IconArea rb 4*ICON_SIZE*ICON_SIZE -;\ - -sc system_colors -sc.workL rd 1 -sc.workH rd 1 - - -align 4 -IPCbuffer rb 1024 - -align 4 - -ScreenW rw 1 -ScreenH rw 1 -wsX rw 1 -wsY rw 1 -wsXe rw 1 -wsYe rw 1 -wsW rw 1 -wsH rw 1 - - -MouseX rd 1 -MouseY rd 1 - -RBSlot rd 1 -AddX rd 1 -AddY rd 1 - -SelIcon rd 1 -DlgSelIcon rd 1 -slotDlgAdd rd 1 -DlgBufImg rb IMG_SIZE*IMG_SIZE*3 - -align 4 -bufStdIco rb 40 -IconsOffs rd 100h ;⠡ 㪠⥫ﬨ ( ᪮७) -PIcoDB rd 1 ;㪠⥫ 䮩 -nLoadIcon rd 1 ; ⠥ ini -IconsID rd 100h ;ID - 2 a + 0 + ࠢ騩 - ப 2 ᭠묨 ࠬ - -nameSection rb 4 - -align 4 -icon_count rd 1 -strip_file rd 1 -strip_file_size rd 1 - -cur_band_compensation rd 1 - -;---- RButton ----------------------------------------------------------------------- - -bufIni rb 40 -NumMenuButt rd 1 -RBMenuCP rd MAX_USER_BUTTONS*2 ;㪠⥫ ண (Caption(dd), Path(dd)) ᭮ (dd) 饣 -RMenuW rw 1 -RMenuH rw 1 - -MaxPage rd 1 -mouse_dd rd 1 - -DAreaName rb NAME_LENGTH+1 -DAreaPath rb 255+1 -DAreaParams rb 255+1 -DAreaIcon rb 255+1 - -align 4 -RBProcInfo rb 1024 -align 4 - - -;------ OpenDialog ------------------------------- -temp_dir_pach rb 1024 -fname_Info rb 1024 - -;------------------------------------------------------------------------------- - rb 512 -stack_mov: ;६ ᪠ ঠ -stack_rmenu: - rb 512 -stack_dlg: - rb 512 -stack_bredraw: - rb 512 -stack_main: -;------------------------------------------------------------------------------ - - - - -ENDMEM: +ICON_STRIP equ '/sys/icons32.png' +ICON_INI equ '/sys/settings/icon.ini' +ICON_SIZE equ 68 ;ࠧ +IMG_SIZE equ 32 ;ࠧ +TEXT_BOTTOM_Y equ 14 ; Y ⥪ +IMAGE_TOP_Y equ 10 ;>=1 न Y +ALIGN_SIZE equ 68 ;ࠧ ⪨ ࠢ +NAME_LENGTH equ 11 ; +MIN_NO_MOVING equ 8 ;१ ⮫쪮 ᥫ ᤢ 稭 ᪠ + + ;-------- ᮧ/।஢ +ICONSX equ 20 +ICONSY equ 90 +ICONS_DRAW_COUNTW equ 12 ;⢮ ਭ +ICONS_DRAW_COUNTH equ 6 ;⢮ +SPCW equ 3 ;஡ ਧ⠫ +SPCH equ 3 +END_ICONS_AREAW equ ICONSX+(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW +END_ICONS_AREAH equ ICONSY+(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH + + + +SizeData equ bufStdIco+32 +BegData equ fiStdIco.point +;------------------------------------------------------------------------------ + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd ENDMEM ; memory for app + dd stack_main ; esp + dd 0 ; boot parameters + dd 0 ; path +;------------------------------------------------------------------------------ + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US. +include '../../macros.inc' +include '../../proc32.inc' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../dll.inc' +include '../../debug.inc' + + +; include '../include/lang.inc' +; include '../include/macros.inc' +; include '../include/proc32.inc' +; include '../include/box_lib.mac' +; include '../include/dll.inc' + +;------------------------------------------------------------------------------ +START: ; start of execution + + mcall 68,11 + stdcall dll.Load,IMPORTS + test eax,eax + jnz ErrLoadLibs + + mcall 30,1,curpath + +; unpack deflate + mov eax,[unpack_DeflateUnpack2] + mov [deflate_unpack],eax +;--------------------------------------------------------------------- +; get size of file icons32.png + mcall 70,fiStdIco + test eax,eax + jnz ErrorStrp +; get memory for icons32.png + mov ecx,dword[bufStdIco+32] + mov [fiStdIco.size],ecx + mov [img_size],ecx + mcall 68,12 + mov [fiStdIco.point],eax + mov [image_file],eax +; load icons32.png + mov dword[fiStdIco],0 + mcall 70,fiStdIco + test eax,eax + jnz close +; convert PNG to RAW + xor eax,eax + mov [return_code],eax +;int3 + + push image_file + call [cnv_png_import.Start] + + mov eax,[raw_pointer] + mov ebx,[eax+32] + mov [strip_file_size],ebx + mov eax,[eax+28] + add eax,[raw_pointer] + mov [strip_file],eax +; back memory to system + mcall 68,13,[fiStdIco.point] + + mov eax,[raw_pointer] + mov eax,[eax+8] + shr eax,5 + mov [icon_count],eax + + and eax,0x7 + mov [cur_band_compensation],eax + +;########## 㦠 ########################## + + mcall 70,fiIni ;뤥塞 , 筮 ࠭ ini 䠩. + test eax,eax ; 筮 墠 ࠭ + jnz ErrorIni + + cmp dword[bufIni+32],0 + je ErrorIni + mcall 68,12,dword[bufIni+32] + mov dword[BegData],eax + jmp NoErrIni + + ErrorIni: + mcall 70,fiRunProg + mcall -1 + + NoErrIni: + m2m [PIcoDB],[BegData] + + + + mov edi,IconsID + xor eax,eax + mov ecx,100h/4 + rep stosd + mov [nLoadIcon],0 + stdcall [ini_enum_sections],IconIni,LoadIconsData + + mov eax,dword[PIcoDB] + sub eax,[BegData] + mov dword[SizeData],eax + mov eax,[BegData] + cmp eax,[PIcoDB] + jne @f + mov dword[eax],0 + mov dword[SizeData],0 + @@: +;###################################################################### + call FillIconsOffs ; MaxNumIcon,IconsOffs + +;樠 IPC + mov dword[IPCbuffer],0 + mov dword[IPCbuffer+4],8 + mcall 60,1,IPCbuffer,1024 + + mcall 40,EVM_MOUSE+EVM_IPC ;㦭 ⮫쪮 ᮡ IPC, + ;ᮢ 㤥 㣮 ⮪ + mov eax,[icon_count] + mov bl,ICONS_DRAW_COUNTH + div bl + test ah,ah + jz @f + inc al + @@: + and eax,0FFh + mov [sbIcons.max_area],eax + + mcall 51,1,BGRedrawThread,stack_bredraw ;᪠ ⮪ ᮢ + stdcall [OpenDialog_Init],OpenDialog_data + +;dph [MaxNumIcon] + +messages: + mcall 10 + sub eax,6 + jz MSGMouse + dec eax + jz MSGIPC + jmp messages + +MSGIPC: + call IPCCreateIcon + jmp messages + +MSGMouse: + mcall 37,0 ;GetMousePos + xor ebx,ebx + mov bx,ax + shr eax,16 + mov ecx,ebx + mov ebx,eax + + mcall 34 + cmp eax,1 + jne messages + + cmp [RButtonActiv],1 + je messages + + mov [MouseY],ecx + mov [MouseX],ebx + +MOUSE_STATE_LMB_HOLD = $00000001 +MOUSE_STATE_RMB_HOLD = $00000002 +MOUSE_EVENT_LMB_DOWN = $00000100 +MOUSE_EVENT_RMB_DOWN = $00000200 + + mcall 37,3 +;check LMB is pressed + test eax, MOUSE_STATE_LMB_HOLD + jz @f + test eax, MOUSE_EVENT_LMB_DOWN + jz @f + jmp LButtonPress +@@: +;check RMB is pressed + test eax, MOUSE_STATE_RMB_HOLD + jz @f + test eax, MOUSE_EVENT_RMB_DOWN + jz @f + jmp RButtonPress +@@: + jmp messages + +ErrLoadLibs: + ;dps ' 㤠 㧨 室 ⥪' + ;debug_newline + jmp close +ErrorStrp: + ;dps '訡 icons32.png' + ;debug_newline +close: + mcall -1 + +LButtonPress: + + stdcall GetNumIcon,[MouseX],[MouseY],-1 +;int3 + cmp eax,-1 + jnz @f + + WaitLB1: + mcall 37,2 + test al,001b + jz messages + ;Yield + mcall 5,1 + jmp WaitLB1 + + + @@: + push eax + stdcall DrawIcon,eax,1 + WaitLB: + mcall 37,2 + test al,001b + jz endWaitLB + + mcall 37,0 + xor ebx,ebx + mov bx,ax + shr eax,16 + sub eax,[MouseX] + jns @f + neg eax + @@: + sub ebx,[MouseY] + jns @f + neg ebx + @@: + cmp [bFixIcons],0 + jne @f + cmp eax,MIN_NO_MOVING + ja MovingIcon + cmp ebx,MIN_NO_MOVING + ja MovingIcon + @@: + ;Yield + mcall 5,1 ;Sleep 1 + + jmp WaitLB + endWaitLB: + + mcall 37,0 + xor ebx,ebx + mov bx,ax + shr eax,16 + mov ecx,ebx + mov ebx,eax + mov [MouseX],ebx + mov [MouseY],ecx + + stdcall GetNumIcon,[MouseX],[MouseY],-1 + cmp eax,[esp] ;[esp] = + jne @f + + mov edi,[IconsOffs+eax*4] + or ecx,-1 + xor al,al + repne scasb + mov ebx,edi + repne scasb + ;run program + mov dword[fiRunProg+8],edi + mov dword[fiRunProg+21],ebx + mcall 70,fiRunProg + + test eax,80000000h + jz @f + + mov dword[fiRunProg+8],ErrRunProg + mov dword[fiRunProg+21],pthNotify + mcall 70,fiRunProg + + @@: + pop eax + stdcall RestoreBackgrnd,eax + mcall 5, 60 + jmp messages + +;------------------------------------------------------------------------------- +MovingIcon: + stdcall GetNumIcon,[MouseX],[MouseY],-1 + mov [SelIcon],eax + mov [IconNoDraw],eax + stdcall RestoreBackgrnd,[SelIcon] + +; mov ecx,[MaxNumIcon] +; xor ebx,ebx +; .MI: push ecx +; cmp ebx,[SelIcon] +; je @f +; stdcall DrawIcon,ebx,0 +; @@: +; inc ebx +; pop ecx +; loop .MI + + + +;dps 'Moving' +;debug_newline +; mov edi,[SelIcon] +; mov edi,[IconsOffs+edi*4] +; or ecx,-1 +; xor al,al +; repne scasb +; repne scasb +; repne scasb +; repne scasb +; xor ebx,ebx +; xor esi,esi +; mov bx,word[edi+2] +; mov si,word[edi] +; stdcall GetNumIcon,ebx,esi,[SelIcon] +; cmp eax,-1 +; je @f +; dps 'Q' +; stdcall DrawIcon,eax,0 +; @@: +; +; add ebx,ICON_SIZE-1 +; stdcall GetNumIcon,ebx,esi,[SelIcon] +; cmp eax,-1 +; je @f +; dps 'Q' +; stdcall DrawIcon,eax,0 +; +; @@: +; add esi,ICON_SIZE-1 +; stdcall GetNumIcon,ebx,esi,[SelIcon] +; cmp eax,-1 +; je @f +; dps 'Q' +; stdcall DrawIcon,eax,0 +; +; @@: +; sub ebx,ICON_SIZE-1 +; stdcall GetNumIcon,ebx,esi,[SelIcon] +; cmp eax,-1 +; je @f +; dps 'Q' +; stdcall DrawIcon,eax,0 +; @@: + + +; Sleep 40 + +;qweqwe: + + mov [MovingActiv],1 + mcall 51,1,MovingWnd,stack_mov ;CreateThread MovingWnd,stack_dlg + .WaitLB: + mcall 37,2 ;GetMouseKey + test al,001b + jz .endWaitLB + + ;Yield + mcall 5,1 ;Sleep 1 + jmp .WaitLB + .endWaitLB: + + + mcall 37,0 ;GetMousePos + xor ebx,ebx + mov bx,ax + shr eax,16 + + sub eax,1+ICON_SIZE/2 + jnc @f + xor eax,eax + @@: + + sub ebx,ICON_SIZE/2-7 + jnc @f + xor ebx,ebx + @@: + + cmp ax,[wsX] + jae @f + mov ax,[wsX] + @@: + + cmp bx,[wsY] + jae @f + mov bx,[wsY] + @@: ;eax,ebx - ॠ쭠 न. न ண ⭮⥫쭮 孥 㣫 ࠡ祩 + + xor edx,edx + mov dx,[wsXe] + sub edx,ICON_SIZE + cmp eax,edx + jbe @f + mov eax,edx + @@: + + mov dx,[wsYe] + sub edx,ICON_SIZE + cmp ebx,edx + jbe @f + mov ebx,edx + @@: + + xor edx,edx ;८ࠧ뢠 ⭮⥫ + mov dx,[wsW] + shr edx,1 + add dx,[wsX] + cmp eax,edx + jbe @f + sub ax,[wsXe] + inc ax + jmp .mov1 + @@: + sub ax,[wsX] + .mov1: + + xor edx,edx + mov dx,[wsH] + shr edx,1 + add dx,[wsY] + cmp ebx,edx + jbe @f + sub bx,[wsYe] + inc bx + jmp .mov2 + @@: + sub bx,[wsY] + .mov2: + + stdcall SetPosition,[SelIcon],eax,ebx + + m2m [PIcoDB],[BegData] + stdcall [ini_enum_sections],IconIni,Ini_SavePos ;in RButton.inc + + mov [bNotSave],1 + mov [IconNoDraw],-1 + + mov [MovingActiv],0 ;⮫쪮 ⥯ ⪫砥 + + jmp messages + +;------------------------------------------------------------------------------- + +RButtonPress: + mov [RButtonActiv],1 + + @@: + mcall 37,2 ;GetMouseKey + test al,010b + jz @f + mcall 5,1 ;Yield + jmp @b + @@: + + mcall 51,1,RButtonWin,stack_rmenu ;CreateThread RButtonWin,stack_rmenu + + jmp messages + + +;############################################################################### +;ret eax = 1/0 = 㤠/訡 +proc DrawIcon NumIcon:DWORD,Activ:DWORD ;NumIcon = 0..n +local IconData:DWORD + push ebx edi esi + + mov ecx,ICON_SIZE*ICON_SIZE + xor eax,eax + mov edi,IconArea + rep stosd + + mov eax,[NumIcon] + cmp eax,[MaxNumIcon] + jb @f + xor eax,eax + pop esi edi ebx + ret + @@: + + mov esi,[IconsOffs+eax*4] + mov [IconData],esi + + ;㥬 ⥪ + mov edi,esi + xor al,al + or ecx,-1 + repne scasb + mov edx,esi + mov eax,edi + sub eax,esi + dec eax + shl eax,1 ;*6 + lea eax,[eax*2+eax] + mov ebx,ICON_SIZE + sub ebx,eax + shr ebx,1 ;ebx = x ⥪ + shl ebx,16 + mov bx,ICON_SIZE + sub bx,TEXT_BOTTOM_Y + mov ecx,88000000h + mov edi,IconAreaH + add ebx,-1*10000h+0 + mcall 4 + add ebx,2*10000h+0 + mcall ;4 + add ebx,-1*10000h-1 + mcall ;4 + add ebx,0*10000h+2 + mcall ;4 + add ebx,1*10000h+0 + mcall ;4 + inc ebx;add ebx,0*10000h+1 + mcall ;4 + add ebx,-1*10000h+0 + mcall ;4 + add ebx,0*10000h-2 + mov ecx,88FFFFFFh + mcall ;4 + ;㥬 ⨭ + + mov edi,esi + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + + ;stdcall hexToInt,edi + stdcall strToInt,edi + @@: ;eax=num icon + cmp eax,[icon_count] + jb @f + xor eax,eax + @@: + test eax,eax + je DI1 + mov ecx,eax + xor eax,eax + @@: + add eax,IMG_SIZE*IMG_SIZE*4 + loop @b + DI1: + add eax,[raw_pointer] + add eax,0+4*11 + mov esi,eax + + CopyToMem: + mov edi,IconArea+((IMAGE_TOP_Y*ICON_SIZE)+((ICON_SIZE-IMG_SIZE)/2))*4 + + mov eax,IMG_SIZE + mov edx,eax + @@: + mov ecx,eax + rep movsd + add edi,(ICON_SIZE-IMG_SIZE)*4 + dec edx + jnz @b + +;----------------- + ;᫨ , 㥬 + cmp [Activ],0 + je .NoSelect + + mov edi,IconArea + mov eax,0FF000000h + mov ecx,ICON_SIZE + rep stosd + ;mov edi,IconArea+ICON_SIZE*1 + + mov ecx,ICON_SIZE-1 + @@: mov dword[edi],eax + add edi,(ICON_SIZE)*4 + loop @b + + mov edi,IconArea+ICON_SIZE*2*4-4 + mov ecx,ICON_SIZE-1 + @@: mov dword[edi],eax + add edi,(ICON_SIZE)*4 + loop @b + + mov edi,IconArea+ICON_SIZE*(ICON_SIZE-1)*4+4 + mov ecx,ICON_SIZE-2 + rep stosd + + + mov edi,IconArea+ICON_SIZE*4+4 + mov eax,0FFFFFFFFh + mov ecx,ICON_SIZE-2 + rep stosd + + mov edi,IconArea+ICON_SIZE*4+4 + mov ecx,ICON_SIZE-2 + @@: mov dword[edi],eax + add edi,(ICON_SIZE)*4 + loop @b + + mov edi,IconArea+ICON_SIZE*2*4-4*2 + mov ecx,ICON_SIZE-3 + @@: mov dword[edi],eax + add edi,(ICON_SIZE)*4 + loop @b + + mov edi,IconArea+ICON_SIZE*(ICON_SIZE-2)*4+4*2 + mov ecx,ICON_SIZE-3 + rep stosd +;-------------- + + .NoSelect: + mov edi,[IconData] + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + repne scasb + mov edx,[edi] + + test edx,00008000h + jz @f + add dx,[wsYe] + jmp .DI11 + @@: + add dx,[wsY] + .DI11: + + test edx,80000000h + jz @f + mov ax,[wsXe] + shl eax,16 + add edx,eax + jmp .DI12 + @@: + mov ax,[wsX] + shl eax,16 + add edx,eax + .DI12: + + mov ebx,IconArea + mov ecx,ICON_SIZE*10000h+ICON_SIZE + mcall 25 + +; mov eax,1 + pop esi edi ebx + ret +endp + +proc RestoreBackgrnd,NumIcon:DWORD + push ebx edi + mov eax,[NumIcon] + cmp eax,[MaxNumIcon] + jb @f + xor eax,eax + pop edi ebx + ret + @@: + + mov edi,[IconsOffs+eax*4] + xor al,al + or ecx,-1 + repne scasb + repne scasb + repne scasb + repne scasb + + mov ax,[edi+2] + test ax,8000h + jz @f + add ax,[wsXe] + jmp .rbg1 + @@: + add ax,[wsX] + .rbg1: + + mov bx,[edi] + test bx,8000h + jz @f + add bx,[wsYe] + jmp .rbg2 + @@: + add bx,[wsY] + .rbg2: + + mov cx,ax + shl ecx,16 + add ax,ICON_SIZE + mov cx,ax + mov dx,bx + shl edx,16 + add bx,ICON_SIZE + mov dx,bx + dec ecx + dec edx + mcall 15,9 + pop edi ebx + ret +endp + + ; MaxNumIcon,IconsOffs +proc FillIconsOffs + push ebx edi + mov edi,[BegData] + mov dword[MaxNumIcon],0 + cmp dword[edi],0 + jne @f + mov dword[IconsOffs],0 + pop edi ebx + ret + @@: + + mov [IconsOffs],edi + xor al,al + xor edx,edx + mov ebx,dword[SizeData] + add ebx,dword[BegData] + or ecx,-1 + .CalcNumIc: + + repne scasb + repne scasb + repne scasb + repne scasb + add edi,4 + mov dword[IconsOffs+edx+4],edi + inc dword[MaxNumIcon] + add edx,4 + + cmp edi,ebx + jae @f + jmp .CalcNumIc + @@: + + mov dword[IconsOffs+edx],0 + + pop edi ebx + ret +endp + +proc LoadIconsData stdcall,f_name,sec_name + push ebx esi edi + + mov edi,secRButt + mov esi,[sec_name] + @@: lodsb + scasb + jnz .lid1 + test al,al + jnz @b + + mov eax,1 + pop edi esi ebx + ret + .lid1: + + + mov ebx,[sec_name] ;㥬 ID + mov ax,[ebx] + mov edi,[nLoadIcon] + mov word[edi*4+IconsID],ax + mov word[edi*4+IconsID+2],0 + + mov edi,[PIcoDB] + stdcall [ini_get_str],[f_name],[sec_name],keyName,edi,4096,0 + test eax,eax + jz @f + xor eax,eax + pop edi esi ebx + ret + @@: + xor al,al + or ecx,-1 + repne scasb + + + + stdcall [ini_get_str],[f_name],[sec_name],keyPath,edi,4096,0 + test eax,eax + jz @f + xor eax,eax + pop edi esi ebx + ret + @@: + xor al,al + or ecx,-1 + repne scasb + + stdcall [ini_get_str],[f_name],[sec_name],keyParams,edi,4096,0 + test eax,eax + jz @f + xor eax,eax + pop edi esi ebx + ret + @@: + xor al,al + or ecx,-1 + repne scasb + + stdcall [ini_get_str],[f_name],[sec_name],keyIco,edi,4096,0 + test eax,eax + jz @f + xor eax,eax + pop edi esi ebx + ret + @@: + xor al,al + or ecx,-1 + repne scasb + + stdcall [ini_get_int],[f_name],[sec_name],keyX,80000000h + cmp eax,80000000h + jne @f + xor eax,eax + pop edi esi ebx + ret + @@: + mov word[edi+2],ax + + stdcall [ini_get_int],[f_name],[sec_name],keyY,80000000h + cmp eax,80000000h + jne @f + xor eax,eax + pop edi esi ebx + ret + @@: + mov word[edi],ax + add edi,4 + mov [PIcoDB],edi + + inc [nLoadIcon] + + mov eax,1 + pop edi esi ebx + ret +endp + +proc GenerateID ;ax = ID + push ebx edi + mov ebx,[MaxNumIcon] + test ebx,ebx + jnz @f + mov eax,'00' + pop edi ebx + ret + @@: + + mov eax,dword[IconsID+ebx*4-4] + .inc: + inc ah + cmp ah,'9'+1 + jne @f + mov ah,'A' + @@: + cmp ah,'F'+1 + jne @f + mov ah,'0' + inc al + @@: + cmp al,'9'+1 + jne @f + mov al,'A' + @@: + cmp al,'F'+1 + jne @f + mov al,'0' + @@: + + + mov edi,IconsID + ;cmp dword[edi],0 + ;je @f + mov ecx,100h + @@: scasd + je .inc + cmp dword[edi],0 + je @f + loop @b + @@: + + pop edi ebx + ret +endp + +;------------------------------------------------------------------------------- + + +;ଠ IPC-ᮮ饭 +;dd X +;dd Y +;asciiz Icon - in decimal +;asciiz Name +;asciiz Path +;asciiz Params +;------------------------------------------------------------------------------- +proc IPCCreateIcon +locals + ix rd 1 + iy rd 1 +endl + + mov eax,IPCbuffer+8 + mov dword[IPCbuffer],1 + lea edx,[eax+8] + + m2m dword[ix],dword[edx] + m2m dword[iy],dword[edx+4] + + lea esi,[edx+8] + + mov ecx,256 + mov edi,DAreaIcon + @@: lodsb + stosb + test al,al + jnz @b + + mov ecx,NAME_LENGTH+1 + mov edi,DAreaName + @@: lodsb + stosb + test al,al + jz @f + loop @b + @@: + + mov edi,DAreaPath + @@: lodsb + stosb + test al,al + jnz @b + + mov edi,DAreaParams + @@: lodsb + stosb + test al,al + jnz @b + + mov dword[IPCbuffer+4],8 + mov dword[IPCbuffer],0 + + stdcall AddIcon,[ix],[iy],DAreaIcon,DAreaName,DAreaPath,DAreaParams + + mcall 15,3 + ret +endp + + +include 'iconman.inc' +include 'bgredraw.inc' +include 'RButton.inc' +include 'DlgAdd.inc' +include 'Moving.inc' + +;'Eolite',0,'/sys/File managers/eolite',0,'/hd0/3/Muzik',0,'1',0,00010001h +;------------------------------------------------------------------------------- +;##### DATA #################################################################### +;------------------------------------------------------------------------------- +; not change this section!!! +; start section +;------------------------------------------------------------------------------ +align 4 +image_file dd 0 ;+0 +raw_pointer dd 0 ;+4 +return_code dd 0 ;+8 +img_size dd 0 ;+12 +deflate_unpack dd 0 ;+16 ; not use for scaling +raw_pointer_2 dd 0 ;+20 ; not use for scaling +;------------------------------------------------------------------------------ +; end section +;------------------------------------------------------------------------------ + + +align 4 +fiStdIco: + dd 5 + dd 0 + dd 0 +.size dd 0 +.point dd bufStdIco + db ICON_STRIP,0 + + +align 4 +fiRunProg: ; ᪠ ணࠬ + dd 7 + dd 0 + dd 0 + dd 0 + dd ErrNotFoundIni + db 0 + dd pthNotify + +fiIni dd 5 ; ini 䠩 + dd 0 + dd 0 + dd 0 + dd bufIni + db 0 + dd IconIni + + +IconsFile db ICON_STRIP,0 + +align 4 +MaxNumIcon dd 0 ;⢮ +IconNoDraw dd -1 ;-1 , ᮢ( ᪠ ) + +bFixIcons dd 1 +bNotSave dd 0 + +LButtonActiv dd 0 +RButtonActiv dd 0 +MovingActiv dd 0 +DlgAddActiv dd 0 + +IconIni db ICON_INI,0 + +pthNotify db '/sys/@notify',0 + +keyName db 'name',0 +keyPath db 'path',0 +keyParams db 'param',0 +keyIco db 'ico',0 +keyX db 'x',0 +keyY db 'y',0 + +;------------------------------------------------------------------------------- +IMPORTS: +library cnv_png ,'cnv_png.obj',\ + archiver,'archiver.obj',\ + box_lib ,'box_lib.obj',\ + proc_lib,'proc_lib.obj',\ + libini ,'libini.obj' + +import cnv_png,\ + cnv_png_import.Start ,'START',\ + cnv_png_import.Version ,'version',\ + cnv_png_import.Check ,'Check_Header',\ + cnv_png_import.Assoc ,'Associations' + +import archiver,\ + unpack_DeflateUnpack2 ,'deflate_unpack2' + +import box_lib,\ + edit_box_draw ,'edit_box_draw',\ + edit_box_key ,'edit_box_key',\ + edit_box_mouse ,'edit_box_mouse',\ + scrollbar_h_draw ,'scrollbar_h_draw',\ + scrollbar_h_mouse ,'scrollbar_h_mouse' + +import proc_lib,\ + OpenDialog_Init ,'OpenDialog_init',\ + OpenDialog_Start ,'OpenDialog_start' + +import libini,\ + ini_enum_sections ,'ini_enum_sections',\ + ini_enum_keys ,'ini_enum_keys',\ + ini_get_str ,'ini_get_str',\ + ini_set_str ,'ini_set_str',\ + ini_get_color ,'ini_get_color',\ + ini_get_int ,'ini_get_int',\ + ini_set_int ,'ini_set_int',\ + ini_del_section ,'ini_del_section',\ + ini_exist_sect ,'ini_exist_sect' + + +;ini.get_str (f_name, sec_name, key_name, buffer, buf_len, def_val) +;ini.set_str (f_name, sec_name, key_name, buffer, buf_len) + + +;------------------------------------------------------------------------------- +;----- RButton.inc ------------------------------------------------------------- +;------------------------------------------------------------------------------- + +if lang eq ru_RU + MinRMenuW dd 18*6+10 +else ; Default to en_US + MinRMenuW dd 15*6+10 +end if + +secRButt db 'rbmenu',0 + +curpath db '/sys',0 + +PredItem dd -1 + +if lang eq ru_RU + RMenuRedrawFon db 'ᮢ',0 + RMenuAlign db '஢ ⪥',0 + RMenuOffMoving db '९ ',0 + RMenuOnMoving db '९ ',0 + RMenuAdd db '',0 + RMenuDel db '',0 + RMenuProp db '⢠',0 +else ; Default to en_US + RMenuRedrawFon db 'Redraw',0 + RMenuAlign db 'Snap to grid',0 + RMenuOffMoving db 'Fix the icons',0 + RMenuOnMoving db 'Unfix the icons',0 + RMenuAdd db 'Add',0 + RMenuDel db 'Delete',0 + RMenuProp db 'Properties',0 +end if + +if lang eq ru_RU + ErrRunProg db '訡 ᪠ ணࠬ',0 + WarningSave db ' ࠭ , RDSave',0 + ErrNotFoundIni db ' icon.ini',0 + ErrName db ' "rbmenu" १ࢨ஢',0 +else ; Default to en_US + ErrRunProg db 'Error running program',0 + WarningSave db 'Remember to save changes with "RDSave"',0 + ErrNotFoundIni db 'icon.ini not found',0 + ErrName db 'The name "rbmenu" reserved',0 +end if + +;------------------------------------------------------------------------------- +;------- AddDlg.inc --------------------------------------------------------------- +;------------------------------------------------------------------------------- +if lang eq ru_RU +DTitleAdd db ' ',0 +DTitleProp db ' ',0 + +DCaptName db ' ',0 +DCaptPath db ' ',0 +DCaptParams db ' ',0 +;DCaptChange db '.',0 +DCaptCreate db '',0 +DCaptProperties db '',0 +DCaptCancel db '⬥',0 + +else ; Default to en_US +DTitleAdd db 'Add icon',0 +DTitleProp db 'Change icon',0 + +DCaptName db ' Name',0 +DCaptPath db ' Path',0 +DCaptParams db ' Params',0 +DCaptCreate db 'Create',0 +DCaptProperties db 'Change',0 +DCaptCancel db 'Cancel',0 +end if +DCaptDots db '...',0 + +;/ +edtName edit_box NAME_LENGTH*8+4,120+IMG_SIZE,6,0FFFFFFh,06F9480h,0FFh,0h,0x90000000,NAME_LENGTH,\ + DAreaName,mouse_dd,0,0,0 +edtExePath edit_box END_ICONS_AREAW-120-IMG_SIZE-40,120+IMG_SIZE,30,0FFFFFFh,06F9480h,\ + 0FFh,0h,0x90000000,255, DAreaPath,mouse_dd,0,0,0 +edtParams edit_box END_ICONS_AREAW-120-IMG_SIZE, 120+IMG_SIZE,54,0FFFFFFh,06F9480h,\ + 0FFh,0h,0x90000000,255, DAreaParams,mouse_dd,0,0,0 +edtIcon edit_box 28,24,62,0FFFFFFh,0FFFFFFh,0FFh,0h,0x90000000,3,\ + DAreaIcon,0,0,0,0 +endEdits: +;\ + +sbIcons: + dw END_ICONS_AREAW-ICONSX + dw ICONSX + dw 15 + dw END_ICONS_AREAH+3 + dd 0 + dd 1 + .max_area dd 0 + .cur_area dd ICONS_DRAW_COUNTW + .position dd 0 + .bckg_col dd 0 + .frnt_col dd 0 + .line_col dd 0 + .redraw dd 0 + .delta dd 0 + .delta2 dd 0 + .r_size_x dw 0 + .r_start_x dw 0 + .r_size_y dw 0 + + .r_start_y dw 0 + .m_pos dd 0 + .m_pos2 dd 0 + .m_keys dd 0 + .run_size dd 0 + .position2 dd 0 + .work_size dd 0 + .all_redraw dd 0 + .ar_offset dd 0 + +;------------------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 +.procinfo dd RBProcInfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd DRedrawWin;draw_window_for_OD ;+28 +.status dd 0 ;+32 +.openfile_pach dd DAreaPath;fname_Info ;+36 +.filename_area dd 0;DAreaPath ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 100 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 100 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: + db '/sys/File managers/opendial',0 + +communication_area_default_pach: + db '/sys',0 + +Filter dd 0 + +;open_dialog db 0 +;------------------------------------------------------------------------------- + +;/ ࠧ +align 4 +IconAreaH dd ICON_SIZE,ICON_SIZE +I_END: +;##### UDATA ################################################################### +IconArea rb 4*ICON_SIZE*ICON_SIZE +;\ + +sc system_colors +sc.workL rd 1 +sc.workH rd 1 + + +align 4 +IPCbuffer rb 1024 + +align 4 + +ScreenW rw 1 +ScreenH rw 1 +wsX rw 1 +wsY rw 1 +wsXe rw 1 +wsYe rw 1 +wsW rw 1 +wsH rw 1 + + +MouseX rd 1 +MouseY rd 1 + +RBSlot rd 1 +AddX rd 1 +AddY rd 1 + +SelIcon rd 1 +DlgSelIcon rd 1 +slotDlgAdd rd 1 +DlgBufImg rb IMG_SIZE*IMG_SIZE*3 + +align 4 +bufStdIco rb 40 +IconsOffs rd 100h ;⠡ 㪠⥫ﬨ ( ᪮७) +PIcoDB rd 1 ;㪠⥫ 䮩 +nLoadIcon rd 1 ; ⠥ ini +IconsID rd 100h ;ID - 2 a + 0 + ࠢ騩 - ப 2 ᭠묨 ࠬ + +nameSection rb 4 + +align 4 +icon_count rd 1 +strip_file rd 1 +strip_file_size rd 1 + +cur_band_compensation rd 1 + +;---- RButton ----------------------------------------------------------------------- + +bufIni rb 40 +NumMenuButt rd 1 +RBMenuCP rd MAX_USER_BUTTONS*2 ;㪠⥫ ண (Caption(dd), Path(dd)) ᭮ (dd) 饣 +RMenuW rw 1 +RMenuH rw 1 + +MaxPage rd 1 +mouse_dd rd 1 + +DAreaName rb NAME_LENGTH+1 +DAreaPath rb 255+1 +DAreaParams rb 255+1 +DAreaIcon rb 255+1 + +align 4 +RBProcInfo rb 1024 +align 4 + + +;------ OpenDialog ------------------------------- +temp_dir_pach rb 1024 +fname_Info rb 1024 + +;------------------------------------------------------------------------------- + rb 512 +stack_mov: ;६ ᪠ ঠ +stack_rmenu: + rb 512 +stack_dlg: + rb 512 +stack_bredraw: + rb 512 +stack_main: +;------------------------------------------------------------------------------ + + + + +ENDMEM: diff --git a/programs/system/keybi/keybi.asm b/programs/system/keybi/keybi.asm index 632b8023d..5e789e11a 100644 --- a/programs/system/keybi/keybi.asm +++ b/programs/system/keybi/keybi.asm @@ -1,198 +1,198 @@ -; Keyboard indicators v0.2 -; by Albom and IgorA - -use32 - org 0 - db 'MENUET01' - dd 1 - dd _start - dd _end - dd _memory - dd stacktop - dd 0 - dd sys_path - -include '../../macros.inc' -include '../../proc32.inc' -include '../../develop/libraries/box_lib/load_lib.mac' -include '../../develop/libraries/box_lib/trunk/box_lib.mac' -;include 'mem.inc' -;include 'dll.inc' -include 'lang.inc' - -@use_library ;_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load - -align 4 -_start: - load_libraries l_libs_start,l_libs_end - mcall 48,3,sc,sizeof.system_colors - mcall 40,0x27 - - init_checkboxes2 check_boxes,check_boxes_end - check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc - call _key_set - -align 4 -red_win: - call draw_window - - -align 4 -still: - mcall 10 - - cmp al,1 ;. - jz red_win - cmp al,2 - jz key - cmp al,3 - jz button - - ;stdcall [check_box_mouse], ch1 - ;stdcall [check_box_mouse], ch2 - ;stdcall [check_box_mouse], ch3 - - jmp still - -; " " -align 4 -_key_set: -mov eax, 66 -mov ebx, 4 -mov edx, 0 -mov cl, 69 -int 0x40 - -mov eax, 66 -mov ebx, 4 -mov edx, 0 -mov cl, 58 -int 0x40 - -mov eax, 66 -mov ebx, 4 -mov edx, 0 -mov cl, 70 -int 0x40 - -ret - -align 4 -draw_window: -pushad - mcall 12,1 - mov edx, [sc.work] - or edx, 0x34000000 - mcall 0, (10 shl 16)+100, (10 shl 16)+75 - - stdcall [check_box_draw], ch1 - stdcall [check_box_draw], ch2 - stdcall [check_box_draw], ch3 - mcall 12,2 -popad - ret - -align 4 -key: - mcall 2 - call _indicators_check - jmp still - -align 4 -_indicators_check: -pusha - mov eax, 66 - mov ebx, 3 - int 40h - -test_ins: - test eax, 0x80 - jz @f - bts dword[ch1.flags],1 - jmp test_caps -@@: - btr dword[ch1.flags],1 - -test_caps: - test eax, 0x40 - jz @f - bts dword[ch2.flags],1 - jmp test_scroll -@@: - btr dword[ch2.flags],1 - -test_scroll: - test eax, 0x100 - jz @f - bts dword[ch3.flags],1 - jmp test_ok -@@: - btr dword[ch3.flags],1 - -test_ok: - call draw_window -popa -ret - -align 4 -button: - mcall 17 - cmp ah,1 - jne still -.exit: - mcall -1 - - -check_boxes: -ch1 check_box2 (5 shl 16)+15,(5 shl 16)+10,5, 0xffffff,0x8000,0xff,\ - txt_160,0+ch_flag_middle -ch2 check_box2 (5 shl 16)+15,(17 shl 16)+10,5, 0xffffff,0x8000,0xff,\ - txt_159,0+ch_flag_middle -ch3 check_box2 (5 shl 16)+15,(29 shl 16)+10,5, 0xffffff,0x8000,0xff,\ - txt_158,0+ch_flag_middle -check_boxes_end: - -if lang eq it_IT - txt_160 db 'Bloc Num',0 - txt_159 db 'Bloc Maiusc',0 - txt_158 db 'Bloc Scorr',0 -else - txt_160 db 'Num',0 - txt_159 db 'Caps',0 - txt_158 db 'Scroll',0 -end if -head_f_i: -head_f_l db ' ',0 - -system_dir_0 db '/sys/lib/' -lib_name_0 db 'box_lib.obj',0 -err_msg_found_lib_0 db ' box_lib.obj',0 -err_msg_import_0 db ' box_lib',0 - -l_libs_start: - lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\ - err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i -l_libs_end: - -align 4 -import_box_lib: - ;init dd sz_init - init_checkbox dd sz_init_checkbox - check_box_draw dd sz_check_box_draw - check_box_mouse dd sz_check_box_mouse - dd 0,0 - ;sz_init db 'lib_init',0 - sz_init_checkbox db 'init_checkbox2',0 - sz_check_box_draw db 'check_box_draw2',0 - sz_check_box_mouse db 'check_box_mouse2',0 - -;mouse_dd dd 0x0 -sc system_colors - -_end: -align 32 - rb 2048 -stacktop: - sys_path rb 1024 - library_path rb 1024 -_memory: +; Keyboard indicators v0.2 +; by Albom and IgorA + +use32 + org 0 + db 'MENUET01' + dd 1 + dd _start + dd _end + dd _memory + dd stacktop + dd 0 + dd sys_path + +include '../../macros.inc' +include '../../proc32.inc' +include '../../develop/libraries/box_lib/load_lib.mac' +include '../../develop/libraries/box_lib/trunk/box_lib.mac' +;include 'mem.inc' +;include 'dll.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. + +@use_library ;_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load + +align 4 +_start: + load_libraries l_libs_start,l_libs_end + mcall 48,3,sc,sizeof.system_colors + mcall 40,0x27 + + init_checkboxes2 check_boxes,check_boxes_end + check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc + call _key_set + +align 4 +red_win: + call draw_window + + +align 4 +still: + mcall 10 + + cmp al,1 ;. + jz red_win + cmp al,2 + jz key + cmp al,3 + jz button + + ;stdcall [check_box_mouse], ch1 + ;stdcall [check_box_mouse], ch2 + ;stdcall [check_box_mouse], ch3 + + jmp still + +; " " +align 4 +_key_set: +mov eax, 66 +mov ebx, 4 +mov edx, 0 +mov cl, 69 +int 0x40 + +mov eax, 66 +mov ebx, 4 +mov edx, 0 +mov cl, 58 +int 0x40 + +mov eax, 66 +mov ebx, 4 +mov edx, 0 +mov cl, 70 +int 0x40 + +ret + +align 4 +draw_window: +pushad + mcall 12,1 + mov edx, [sc.work] + or edx, 0x34000000 + mcall 0, (10 shl 16)+100, (10 shl 16)+75 + + stdcall [check_box_draw], ch1 + stdcall [check_box_draw], ch2 + stdcall [check_box_draw], ch3 + mcall 12,2 +popad + ret + +align 4 +key: + mcall 2 + call _indicators_check + jmp still + +align 4 +_indicators_check: +pusha + mov eax, 66 + mov ebx, 3 + int 40h + +test_ins: + test eax, 0x80 + jz @f + bts dword[ch1.flags],1 + jmp test_caps +@@: + btr dword[ch1.flags],1 + +test_caps: + test eax, 0x40 + jz @f + bts dword[ch2.flags],1 + jmp test_scroll +@@: + btr dword[ch2.flags],1 + +test_scroll: + test eax, 0x100 + jz @f + bts dword[ch3.flags],1 + jmp test_ok +@@: + btr dword[ch3.flags],1 + +test_ok: + call draw_window +popa +ret + +align 4 +button: + mcall 17 + cmp ah,1 + jne still +.exit: + mcall -1 + + +check_boxes: +ch1 check_box2 (5 shl 16)+15,(5 shl 16)+10,5, 0xffffff,0x8000,0xff,\ + txt_160,0+ch_flag_middle +ch2 check_box2 (5 shl 16)+15,(17 shl 16)+10,5, 0xffffff,0x8000,0xff,\ + txt_159,0+ch_flag_middle +ch3 check_box2 (5 shl 16)+15,(29 shl 16)+10,5, 0xffffff,0x8000,0xff,\ + txt_158,0+ch_flag_middle +check_boxes_end: + +if lang eq it_IT + txt_160 db 'Bloc Num',0 + txt_159 db 'Bloc Maiusc',0 + txt_158 db 'Bloc Scorr',0 +else ; Default to en_US + txt_160 db 'Num',0 + txt_159 db 'Caps',0 + txt_158 db 'Scroll',0 +end if +head_f_i: +head_f_l db ' ',0 + +system_dir_0 db '/sys/lib/' +lib_name_0 db 'box_lib.obj',0 +err_msg_found_lib_0 db ' box_lib.obj',0 +err_msg_import_0 db ' box_lib',0 + +l_libs_start: + lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\ + err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i +l_libs_end: + +align 4 +import_box_lib: + ;init dd sz_init + init_checkbox dd sz_init_checkbox + check_box_draw dd sz_check_box_draw + check_box_mouse dd sz_check_box_mouse + dd 0,0 + ;sz_init db 'lib_init',0 + sz_init_checkbox db 'init_checkbox2',0 + sz_check_box_draw db 'check_box_draw2',0 + sz_check_box_mouse db 'check_box_mouse2',0 + +;mouse_dd dd 0x0 +sc system_colors + +_end: +align 32 + rb 2048 +stacktop: + sys_path rb 1024 + library_path rb 1024 +_memory: diff --git a/programs/system/launch/trunk/launch.asm b/programs/system/launch/trunk/launch.asm index 37d3ffd67..bd194b02f 100755 --- a/programs/system/launch/trunk/launch.asm +++ b/programs/system/launch/trunk/launch.asm @@ -1,468 +1,470 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;; -;; Launch is free software: you can redistribute it and/or modify it under the terms of the GNU ;; -;; General Public License as published by the Free Software Foundation, either version 3 ;; -;; of the License, or (at your option) any later version. ;; -;; ;; -;; Launch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;; -;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; -;; General Public License for more details. ;; -;; ;; -;; You should have received a copy of the GNU General Public License along with Launch. ;; -;; If not, see . ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Launch finds program in search dirictories and runs it. ;; -;; For more details see readme.txt ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -format binary - -APP_NAME fix 'Launch' -APP_VERSION fix '0.1.80.1' - -use32 -org 0x0 - -db 'MENUET01' -dd 0x01 -dd START -dd APP_END -dd MEM_END -dd APP_STACK -dd args -dd path - -define DEBUG_NO 0 -define DEBUG_CONSOLE 1 -define DEBUG_BOARD 2 ;; Not used now - -define PATH_MAX_LEN 1024 -define DEBUG_MAX_LEN 8 -define DEBUG_DEFAULT 0 -define BUFF_SIZE 1024 - -include 'proc32.inc' -include 'macros.inc' -include 'libio.inc' -include 'dll.inc' - -purge mov - -include 'thread.inc' -include 'ipc.inc' -include 'kobra.inc' - -;;-------------------------------------------------------------------------------------------------- -;; Basic initialization -START: - ;; Initialize process heap - mcall 68,11 - test eax, eax - jz exit - - ;; Import modules - stdcall dll.Load,importTable - test eax, eax - jnz exit - -;;-------------------------------------------------------------------------------------------------- -;; Reading config -read_ini_path: ;; Read search path - ;; First read config in /sys/etc - invoke ini.get_str, etc_cfg, cfg_main, cfg_path, search_path, PATH_MAX_LEN, empty_str - - ;; Next, read config from current directory - ;; Find end of path string -.find_path_eol: - mov edi, path - mov ecx, PATH_MAX_LEN - xor al, al - cld - repne scasb - - ;; Append ext to run path (NOTE: this work only when config file has name .cfg and ext size is dword) - mov eax, dword [cfg_ext] - dec edi - mov dword [edi], eax - mov byte [edi+5], 0 - - ;; Currently there is no checking for repeating pathes, so we should only concatenate two strings - ;; So we need to find end of current search_path string -.find_search_eol: - mov edi, search_path - mov ecx, PATH_MAX_LEN - xor al, al - ;cld - repne scasb - dec edi - - ;; Now we need to correct buffer length - mov eax, path+PATH_MAX_LEN - sub eax, edi - ;; Read ini - invoke ini.get_str, path, cfg_main, cfg_path, edi, PATH_MAX_LEN, empty_str - -read_ini_debug: ;; Read debug options - ;; Read debug options from config files - invoke ini.get_option_str, etc_cfg, cfg_debug, cfg_debug, debug_strings, DEBUG_MAX_LEN, DEBUG_DEFAULT - invoke ini.get_option_str, path, cfg_debug, cfg_debug, debug_strings, DEBUG_MAX_LEN, eax - mov [debug_option], eax - - test eax, eax ;; No console - je .ok - - jmp .con_init - -.console_err: - mov byte [debug_option], 0 - jmp .ok - -.con_init: - stdcall dll.Load, consoleImport - test eax, eax - jnz .console_err - invoke con.init, -1, -1, -1, -1, window_title - -.read_level: - invoke ini.get_int, etc_cfg, cfg_debug, cfg_level, 0 - invoke ini.get_int, path, cfg_debug, cfg_level, eax - mov byte [debug_level], al -.ok: - -read_ini_kobra: - invoke ini.get_bool, etc_cfg, cfg_kobra, cfg_use, 0 - invoke ini.get_bool, path, cfg_kobra, cfg_use, eax - - mov byte [kobra_use], al - -;;-------------------------------------------------------------------------------------------------- -;; Parse command line options -parse_args: - ;; Now parse command line arguments - ;; TODO: use optparse library - ;; Currently the only argument to parse is program name with its' arguments - -.skip_spaces: - mov ecx, -1 - mov edi, args - mov al, ' ' - xor bl, bl - ;cld - repe scasb - - push edi - - mov ecx, -1 -@@: - scasb - je @f - xchg al, bl - dec edi - scasb - jne @b -@@: - mov dword [prog_args], edi - - pop edi - dec edi - ;; Now edi = program name - -;;-------------------------------------------------------------------------------------------------- -;; Finding file -search_file: - push edi - mov esi, search_path - xchg esi, [esp] -.loop: - or dl, dl - je .prn_dbg - xor dl, dl - jmp .prn_end -.prn_dbg: - push eax - mov al, byte [debug_option] -; dec al - test al, al - je .prn_stp - mov al, byte [debug_level] - or al, al - je .prn_stp - dec al - or al, al - je .prn_1 -.prn_1: - cinvoke con.printf, message_dbg_not_found, buff - -.prn_stp: - pop eax -.prn_end: - xor eax, eax ;; When we check is proramme launched we are checking for eax - xchg esi, [esp] - mov edi, buff -.copy_path: - lodsb - cmp al, ';' - je .copy_file - or al, al - je exit - stosb - jmp .copy_path - -.copy_file: - xchg esi, [esp] - push esi -.cp_file_loop: - lodsb - or al, al - je .copy_end - cmp al, ' ' - je .copy_end - stosb - jmp .cp_file_loop - -.copy_end: - pop esi - xor al, al - stosb - - ;; Try to launch - - mov dword [LaunchStruct.Function], 7 - push dword [prog_args] - pop dword [LaunchStruct.Arguments] - mov dword [LaunchStruct.Flags], 0 - mov dword [LaunchStruct.Zero], 0 - mov dword [LaunchStruct.FileNameP], buff - mcall 70, LaunchStruct - cmp eax, 0 - jl .loop - -;;-------------------------------------------------------------------------------------------------- -;; Exit -exit: - mov dword [tid], eax - ;; If console is present we should write some info - mov al, byte [debug_option] - cmp al, DEBUG_CONSOLE - jne .kobra - -.write_console: - mov eax, dword [tid] - test eax, eax - jz .write_error -.write_launched: - cinvoke con.printf, message_ok, buff, eax, eax - jmp .wr_end -.write_error: - pop edi - cinvoke con.printf, message_error, edi -.wr_end: - invoke con.exit, 0 - -.kobra: - mov al, byte [kobra_use] - test al, al - je .close - -.register: - mov dword [IPC_area], buff - call IPC_init -; jnz .close - - mov dword [thread_find_buff], another_buff - - call kobra_register - - test eax, eax - jnz .close - - ;; Prepare message - mov dword [kobra_message], KOBRA_MESSAGE_LAUNCH_STATE - - mov eax, dword [tid] - mov dword [kobra_message+4], eax - -.kobra_send: - stdcall kobra_send_message, kobra_group_launch_reactive, kobra_message, 8 - -.close: - mcall -1 - -;; End of code -;;-------------------------------------------------------------------------------------------------- - -;;-------------------------------------------------------------------------------------------------- -;; Imports -align 16 -importTable: - -library libini, 'libconfig.obj' ;, \ -; libio, 'libio.obj', \ - -import libini, \ - ini.get_str ,'ini_get_str', \ -\; ini.set_str ,'ini_set_str', \ - ini.get_int ,'ini_get_int', \ -\; ini.set_int ,'ini_set_int', \ -\; ini.get_color ,'ini_get_color', \ -\; ini.set_color ,'ini_set_color', \ - ini.get_option_str ,'ini_get_option_str', \ - ini.get_bool ,'ini_get_bool';,\ - -;import libio, \ -; file_find_first,'file_find_first', \ -; file_find_next ,'file_find_next', \ -; file_find_close,'file_find_close', \ -; file_size ,'file_size', \ -; file_open ,'file_open', \ -; file_read ,'file_read', \ -; file_write ,'file_write', \ -; file_seek ,'file_seek', \ -; file_tell ,'file_tell', \ -; file_eof? ,'file_eof?', \ -; file_truncate ,'file_truncate', \ -; file_close ,'file_close' - -consoleImport: -library \ - conlib, 'console.obj' - -import conlib,\ - con.init, 'con_init',\ - con.exit, 'con_exit',\ - con.printf, 'con_printf' ;,\ -; con.write_asciiz, 'con_write_asciiz' - -;;-------------------------------------------------------------------------------------------------- -;; Data -align 16 -APP_DATA: - -;; Window title -window_title: - db APP_NAME, ' ', APP_VERSION, 0 - -;; Messages -if lang eq it_IT - message_dbg_not_found: - db '%s non trovato', 10, 0 - - message_error: - db 'File (%s) non trovato!', 0 - - message_ok: - db '%s caricato correttamente. PID: %d (0x%X)', 0 -else - message_dbg_not_found: - db '%s not found', 10, 0 - - message_error: - db 'File (%s) not found!', 0 - - message_ok: - db '%s loaded succesfully. PID: %d (0x%X)', 0 -end if -;; Configuration path -etc_cfg: - db '/sys/etc/' -cfg_name: - db 'launch' -cfg_ext: - db '.cfg', 0 - -;; Strings in config file -cfg_main: - db 'main', 0 -cfg_path: - db 'path', 0 -cfg_debug: - db 'debug', 0 -cfg_level: - db 'level', 0 -cfg_kobra: - db 'kobra', 0 -cfg_use: - db 'use', 0 - -;; List of debug modes for parsing debug option -debug_strings: - dd debug_no - dd debug_console - dd 0 - -debug_no: - db 'no', 0 -debug_console: - db 'console', 0 - -;; Empty string -empty_str: - db 0 - -kobra_group_launch_reactive: - db 'launch_reactive', 0 - -;;-------------------------------------------------------------------------------------------------- -;; Configuration options -debug_level: - db 0 - -; debug_kobra: -; db 0 - -;; debug option (bool) -debug_option: - db 0 - -kobra_use: - db 0 - -;;-------------------------------------------------------------------------------------------------- -tid: - dd 0 - -struct FileInfoRun - Function dd 7 - Flags dd ? - Arguments dd 0 - Reserved0 dd ? - Reserved1 dd ? - union - FileName rb 1024 - struct - Zero db 0 - FileNameP dd ? - ends - ends -ends - -LaunchStruct FileInfoRun - -args: db 0 -APP_END: -rb 255 - -prog_args: - rd 1 -path: - rb 1024 - -;; Search path will be here -search_path: - rb PATH_MAX_LEN - -;; Buffer -buff: - rb BUFF_SIZE - -another_buff: - rb 0x1000 - -kobra_message: - rb 0x100 - -rb 0x1000 ;; 4 Kb stack -APP_STACK: -MEM_END: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;; +;; Launch is free software: you can redistribute it and/or modify it under the terms of the GNU ;; +;; General Public License as published by the Free Software Foundation, either version 3 ;; +;; of the License, or (at your option) any later version. ;; +;; ;; +;; Launch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;; +;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; +;; General Public License for more details. ;; +;; ;; +;; You should have received a copy of the GNU General Public License along with Launch. ;; +;; If not, see . ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Launch finds program in search dirictories and runs it. ;; +;; For more details see readme.txt ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Language support for locales: it_IT, en_US. + +format binary + +APP_NAME fix 'Launch' +APP_VERSION fix '0.1.80.1' + +use32 +org 0x0 + +db 'MENUET01' +dd 0x01 +dd START +dd APP_END +dd MEM_END +dd APP_STACK +dd args +dd path + +define DEBUG_NO 0 +define DEBUG_CONSOLE 1 +define DEBUG_BOARD 2 ;; Not used now + +define PATH_MAX_LEN 1024 +define DEBUG_MAX_LEN 8 +define DEBUG_DEFAULT 0 +define BUFF_SIZE 1024 + +include 'proc32.inc' +include 'macros.inc' +include 'libio.inc' +include 'dll.inc' + +purge mov + +include 'thread.inc' +include 'ipc.inc' +include 'kobra.inc' + +;;-------------------------------------------------------------------------------------------------- +;; Basic initialization +START: + ;; Initialize process heap + mcall 68,11 + test eax, eax + jz exit + + ;; Import modules + stdcall dll.Load,importTable + test eax, eax + jnz exit + +;;-------------------------------------------------------------------------------------------------- +;; Reading config +read_ini_path: ;; Read search path + ;; First read config in /sys/etc + invoke ini.get_str, etc_cfg, cfg_main, cfg_path, search_path, PATH_MAX_LEN, empty_str + + ;; Next, read config from current directory + ;; Find end of path string +.find_path_eol: + mov edi, path + mov ecx, PATH_MAX_LEN + xor al, al + cld + repne scasb + + ;; Append ext to run path (NOTE: this work only when config file has name .cfg and ext size is dword) + mov eax, dword [cfg_ext] + dec edi + mov dword [edi], eax + mov byte [edi+5], 0 + + ;; Currently there is no checking for repeating pathes, so we should only concatenate two strings + ;; So we need to find end of current search_path string +.find_search_eol: + mov edi, search_path + mov ecx, PATH_MAX_LEN + xor al, al + ;cld + repne scasb + dec edi + + ;; Now we need to correct buffer length + mov eax, path+PATH_MAX_LEN + sub eax, edi + ;; Read ini + invoke ini.get_str, path, cfg_main, cfg_path, edi, PATH_MAX_LEN, empty_str + +read_ini_debug: ;; Read debug options + ;; Read debug options from config files + invoke ini.get_option_str, etc_cfg, cfg_debug, cfg_debug, debug_strings, DEBUG_MAX_LEN, DEBUG_DEFAULT + invoke ini.get_option_str, path, cfg_debug, cfg_debug, debug_strings, DEBUG_MAX_LEN, eax + mov [debug_option], eax + + test eax, eax ;; No console + je .ok + + jmp .con_init + +.console_err: + mov byte [debug_option], 0 + jmp .ok + +.con_init: + stdcall dll.Load, consoleImport + test eax, eax + jnz .console_err + invoke con.init, -1, -1, -1, -1, window_title + +.read_level: + invoke ini.get_int, etc_cfg, cfg_debug, cfg_level, 0 + invoke ini.get_int, path, cfg_debug, cfg_level, eax + mov byte [debug_level], al +.ok: + +read_ini_kobra: + invoke ini.get_bool, etc_cfg, cfg_kobra, cfg_use, 0 + invoke ini.get_bool, path, cfg_kobra, cfg_use, eax + + mov byte [kobra_use], al + +;;-------------------------------------------------------------------------------------------------- +;; Parse command line options +parse_args: + ;; Now parse command line arguments + ;; TODO: use optparse library + ;; Currently the only argument to parse is program name with its' arguments + +.skip_spaces: + mov ecx, -1 + mov edi, args + mov al, ' ' + xor bl, bl + ;cld + repe scasb + + push edi + + mov ecx, -1 +@@: + scasb + je @f + xchg al, bl + dec edi + scasb + jne @b +@@: + mov dword [prog_args], edi + + pop edi + dec edi + ;; Now edi = program name + +;;-------------------------------------------------------------------------------------------------- +;; Finding file +search_file: + push edi + mov esi, search_path + xchg esi, [esp] +.loop: + or dl, dl + je .prn_dbg + xor dl, dl + jmp .prn_end +.prn_dbg: + push eax + mov al, byte [debug_option] +; dec al + test al, al + je .prn_stp + mov al, byte [debug_level] + or al, al + je .prn_stp + dec al + or al, al + je .prn_1 +.prn_1: + cinvoke con.printf, message_dbg_not_found, buff + +.prn_stp: + pop eax +.prn_end: + xor eax, eax ;; When we check is proramme launched we are checking for eax + xchg esi, [esp] + mov edi, buff +.copy_path: + lodsb + cmp al, ';' + je .copy_file + or al, al + je exit + stosb + jmp .copy_path + +.copy_file: + xchg esi, [esp] + push esi +.cp_file_loop: + lodsb + or al, al + je .copy_end + cmp al, ' ' + je .copy_end + stosb + jmp .cp_file_loop + +.copy_end: + pop esi + xor al, al + stosb + + ;; Try to launch + + mov dword [LaunchStruct.Function], 7 + push dword [prog_args] + pop dword [LaunchStruct.Arguments] + mov dword [LaunchStruct.Flags], 0 + mov dword [LaunchStruct.Zero], 0 + mov dword [LaunchStruct.FileNameP], buff + mcall 70, LaunchStruct + cmp eax, 0 + jl .loop + +;;-------------------------------------------------------------------------------------------------- +;; Exit +exit: + mov dword [tid], eax + ;; If console is present we should write some info + mov al, byte [debug_option] + cmp al, DEBUG_CONSOLE + jne .kobra + +.write_console: + mov eax, dword [tid] + test eax, eax + jz .write_error +.write_launched: + cinvoke con.printf, message_ok, buff, eax, eax + jmp .wr_end +.write_error: + pop edi + cinvoke con.printf, message_error, edi +.wr_end: + invoke con.exit, 0 + +.kobra: + mov al, byte [kobra_use] + test al, al + je .close + +.register: + mov dword [IPC_area], buff + call IPC_init +; jnz .close + + mov dword [thread_find_buff], another_buff + + call kobra_register + + test eax, eax + jnz .close + + ;; Prepare message + mov dword [kobra_message], KOBRA_MESSAGE_LAUNCH_STATE + + mov eax, dword [tid] + mov dword [kobra_message+4], eax + +.kobra_send: + stdcall kobra_send_message, kobra_group_launch_reactive, kobra_message, 8 + +.close: + mcall -1 + +;; End of code +;;-------------------------------------------------------------------------------------------------- + +;;-------------------------------------------------------------------------------------------------- +;; Imports +align 16 +importTable: + +library libini, 'libconfig.obj' ;, \ +; libio, 'libio.obj', \ + +import libini, \ + ini.get_str ,'ini_get_str', \ +\; ini.set_str ,'ini_set_str', \ + ini.get_int ,'ini_get_int', \ +\; ini.set_int ,'ini_set_int', \ +\; ini.get_color ,'ini_get_color', \ +\; ini.set_color ,'ini_set_color', \ + ini.get_option_str ,'ini_get_option_str', \ + ini.get_bool ,'ini_get_bool';,\ + +;import libio, \ +; file_find_first,'file_find_first', \ +; file_find_next ,'file_find_next', \ +; file_find_close,'file_find_close', \ +; file_size ,'file_size', \ +; file_open ,'file_open', \ +; file_read ,'file_read', \ +; file_write ,'file_write', \ +; file_seek ,'file_seek', \ +; file_tell ,'file_tell', \ +; file_eof? ,'file_eof?', \ +; file_truncate ,'file_truncate', \ +; file_close ,'file_close' + +consoleImport: +library \ + conlib, 'console.obj' + +import conlib,\ + con.init, 'con_init',\ + con.exit, 'con_exit',\ + con.printf, 'con_printf' ;,\ +; con.write_asciiz, 'con_write_asciiz' + +;;-------------------------------------------------------------------------------------------------- +;; Data +align 16 +APP_DATA: + +;; Window title +window_title: + db APP_NAME, ' ', APP_VERSION, 0 + +;; Messages +if lang eq it_IT + message_dbg_not_found: + db '%s non trovato', 10, 0 + + message_error: + db 'File (%s) non trovato!', 0 + + message_ok: + db '%s caricato correttamente. PID: %d (0x%X)', 0 +else ; Default to en_US + message_dbg_not_found: + db '%s not found', 10, 0 + + message_error: + db 'File (%s) not found!', 0 + + message_ok: + db '%s loaded successfully. PID: %d (0x%X)', 0 +end if +;; Configuration path +etc_cfg: + db '/sys/etc/' +cfg_name: + db 'launch' +cfg_ext: + db '.cfg', 0 + +;; Strings in config file +cfg_main: + db 'main', 0 +cfg_path: + db 'path', 0 +cfg_debug: + db 'debug', 0 +cfg_level: + db 'level', 0 +cfg_kobra: + db 'kobra', 0 +cfg_use: + db 'use', 0 + +;; List of debug modes for parsing debug option +debug_strings: + dd debug_no + dd debug_console + dd 0 + +debug_no: + db 'no', 0 +debug_console: + db 'console', 0 + +;; Empty string +empty_str: + db 0 + +kobra_group_launch_reactive: + db 'launch_reactive', 0 + +;;-------------------------------------------------------------------------------------------------- +;; Configuration options +debug_level: + db 0 + +; debug_kobra: +; db 0 + +;; debug option (bool) +debug_option: + db 0 + +kobra_use: + db 0 + +;;-------------------------------------------------------------------------------------------------- +tid: + dd 0 + +struct FileInfoRun + Function dd 7 + Flags dd ? + Arguments dd 0 + Reserved0 dd ? + Reserved1 dd ? + union + FileName rb 1024 + struct + Zero db 0 + FileNameP dd ? + ends + ends +ends + +LaunchStruct FileInfoRun + +args: db 0 +APP_END: +rb 255 + +prog_args: + rd 1 +path: + rb 1024 + +;; Search path will be here +search_path: + rb PATH_MAX_LEN + +;; Buffer +buff: + rb BUFF_SIZE + +another_buff: + rb 0x1000 + +kobra_message: + rb 0x100 + +rb 0x1000 ;; 4 Kb stack +APP_STACK: +MEM_END: diff --git a/programs/system/open/open.asm b/programs/system/open/open.asm index a1e089625..0d5f5b813 100644 --- a/programs/system/open/open.asm +++ b/programs/system/open/open.asm @@ -1,1066 +1,1066 @@ - DEBUG = 0 - - LIST_WIDTH = 256 - WIN_WIDTH = (LIST_WIDTH + 16 + 12) - LIST_SIZE = 12 - LINE_SIZE = 40 - LIST_HEIGHT = (LIST_SIZE * LINE_SIZE / 2) - WIN_HEIGHT = (LIST_HEIGHT + 80) - - use32 - org 0 - db 'MENUET01' - dd 1, main, dataend, memory, memory -M01header.params: - dd params, 0 - - include "../../proc32.inc" - include "../../macros.inc" - include "../../dll.inc" - include "../../string.inc" - include "../../develop/libraries/box_lib/trunk/box_lib.mac" - - include "lang.inc" - -if DEBUG eq 1 - include "../../debug.inc" -end if - - ;=============================== - -if lang eq ru_RU - title db " ", 0 - browse_txt db "...", 0 - notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 - checkbox_txt db "ᯮ짮 ᥣ", 0 -else if lang eq et_EE - title db "Open with", 0 - browse_txt db "Browse...", 0 - notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 - checkbox_txt db "Always use selected program", 0 -else if lang eq it_IT - title db "Open with", 0 - browse_txt db "Browse...", 0 - notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 - checkbox_txt db "Always use selected program", 0 -else - title db "Open with", 0 - browse_txt db "Browse...", 0 - notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 - checkbox_txt db "Always use selected program", 0 -end if - - sys_dir db "/sys", 0 - slash db "/", 0 - open_dialog_path db "/sys/file managers/opendial", 0 - app_link db "$", 0 - icons db "/sys/icons32.png", 0 - communication_area_name db "FFFFFF_open_dialog", 0 - assoc_ini db "/sys/settings/assoc.ini", 0 - .sec db "Assoc", 0 - .exec db "exec", 0 - .next db "next", 0 - .icon db "icon", 0 - - sb_apps scrollbar \ - 13, WIN_WIDTH - 25, LIST_HEIGHT, 10 + 12, \ ;; w, x, h, y - 0, 0, LIST_SIZE / 2, 0, \ ;; b.h, max, area, pos - 0, 0, 0, 2 - - cb_always check_box2 \ - 5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 6, 0, 0, 0, checkbox_txt, ch_flag_middle - - opendialog: - .type dd 0 - .procinfo dd buffer3 - .com_area_name dd communication_area_name - .com_area dd 0 - .opendir_path dd buffer4 - .dir_default_path dd sys_dir - .start_path dd open_dialog_path - .draw_window dd draw_window - .status dd 0 - .openfile_pach dd buffer - .filename_area dd buffer5 - .filter_area dd .filter - .x: - .x_size dw 420 - .x_start dw 200 - .y: - .y_size dw 320 - .y_start dw 120 - - .filter dd 0 - - ps_addres: - dd 0 ;; type - dw 7 ;; y - dw 4 ;; x - dw 6 ;; font.w - dw LIST_WIDTH ;; w - dd 0 ;; mono - dd 0 ;; without bg - .color dd 0 ;; text color - dd 0 ;; bg color - .txt dd 0 ;; text - dd buffer2 - dd 0 - - is_execute: - dd 7, 0, 0, 0, 0 - db 0 - dd buffer - - is_openas: - dd 7, 0, 0, 0, 0 - db 0 - dd buffer - - is_open: - dd 7, 0, 0, 0, 0 - db 0 - dd buffer - - is_undefined: - dd 7, 0, notify_txt, 0, 0 - db "/sys/@notify", 0 - - is_openimg_info: - dd 5, 0, 0, 0, img.buf - db 0 - dd icons - - is_openimg: - dd 0, 0, 0, 0, 0 - db 0 - dd icons - - is_file_exists: - dd 0, 0, 0, 0, buffer6 - db 0 - dd buffer - - last_x dd -1 - last_y dd -1 - -if DEBUG eq 1 - std_param db "~/sys/example.asm", 0 -end if - - imports: - library libini, "libini.obj" - import libini, libini.get_str, "ini_get_str", \ - libini.set_str, "ini_set_str", \ - libini.get_num, "ini_get_int", \ - libini.for_each_section, "ini_enum_sections" - - imports_add: - library libimg, "libimg.obj", \ - boxlib, "box_lib.obj", \ - prclib, "proc_lib.obj" - import libimg, libimg.init, "lib_init", \ - libimg.toRGB, "img_to_rgb2", \ - libimg.decode, "img_decode", \ - libimg.destroy, "img_destroy" - import boxlib, scrollbar.draw, "scrollbar_v_draw", \ - scrollbar.mouse, "scrollbar_v_mouse", \ - pathshow.init, "PathShow_prepare", \ - pathshow.draw, "PathShow_draw", \ - checkbox.init, "init_checkbox2", \ - checkbox.draw, "check_box_draw2", \ - checkbox.mouse, "check_box_mouse2" - import prclib, opendialog.lib_init, "lib_init", \ - opendialog.init, "OpenDialog_init", \ - opendialog.start, "OpenDialog_start" - - ;=============================== - - main: - mcall 68, 11 - stdcall dll.Load, imports - -if DEBUG eq 1 - stdcall string.copy, std_param, [M01header.params] -end if - - ;; trim params - stdcall string.copy, [M01header.params], paramorig - stdcall string.trim_last, paramorig - stdcall string.trim_first, paramorig - mov [param_s], eax - - stdcall string.to_lower_case, [M01header.params] - stdcall string.trim_last, [M01header.params] - stdcall string.trim_first, [M01header.params] - mov [param_lwr], eax - - ;; if empty - exit - cmpe [eax], byte 0, exit - - ;; if folder - stdcall string.length, [param_s] - add eax, [param_s] - cmpe [eax - 1], byte '/', open - - ;; if dialog - mov eax, [param_s] - mov [is_openas + 8], eax - cmpne [eax], byte '~', @f - inc [param_s] - mov eax, [param_s] - mov [is_openas + 8], eax - jmp start_dialog - @@: - - ;; if without '.' - execute - stdcall string.last_index_of, [param_s], '.', 1 - cmpe eax, -1, execute - ;; if '.' is part of path - execute - mov esi, eax - stdcall string.last_index_of, [param_s], '/', 1 - cmpg eax, esi, execute - - ;; if ext == "kex" - execute - add esi, [param_lwr] - mov [param_e], esi - cmpe [esi], dword "kex", execute - - open_as: - invoke libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer8, 2048, undefined - cmpe byte [buffer8], 0, start_dialog_pre - .run: - mov edi, 0 - cmpne byte [buffer8], "$", .pre_open - mov edi, 1 - invoke libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.exec, buffer, 2048, undefined - cmpe byte [buffer], 0, ini_error - jmp @f - .pre_open: - stdcall string.copy, buffer8, buffer - @@: - mcall 70, is_openas - cmpge eax, 0, exit - cmpe edi, 0, start_dialog - invoke libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.next, buffer8, 2048, undefined - cmpne byte [buffer], 0, .run - jmp start_dialog - - execute: - mov eax, [param_s] - mov [is_execute + 21], eax - mcall 70, is_execute - jmp exit - - open: - invoke libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined - cmpne [buffer], byte "$", @f - invoke libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined - cmpe [buffer], byte 0, ini_error - @@: - mov eax, [param_s] - mov [is_open + 8], eax - mcall 70, is_open - jmp exit - - ini_error: - mcall 70, is_undefined - jmp exit - - ;---------------------- - - start_dialog_pre: - or [cb_always.flags], ch_flag_en - - start_dialog: - stdcall dll.Load, imports_add - invoke opendialog.lib_init - - mcall 40, 100111b - - ;; get title - stdcall string.copy, title, win.title - - ;; get positions - mcall 14 - movzx ebx, ax - shr ebx, 1 - shr eax, 16 + 1 - sub eax, WIN_WIDTH / 2 - 1 - sub ebx, WIN_HEIGHT / 2 - 1 - mov [win.x], eax - mov [win.y], ebx - - ;; get colors - mcall 48, 3, skin, sizeof.system_colors - - ;; get opendialog - invoke opendialog.init, opendialog - - ;; get pathshow - mov eax, [param_s] - mov ebx, [skin.work_text] - mov [ps_addres.txt], eax - mov [ps_addres], ebx - m2m [ps_addres.color], [skin.work_text] - invoke pathshow.init, ps_addres - - ;; get checkbox - mov eax, 0xFFFfff - mov ebx, [skin.work_graph] - mov ecx, [skin.work_text] - mov [cb_always.color], eax - mov [cb_always.border_color], ebx - mov [cb_always.text_color], ecx - invoke checkbox.init, cb_always - - ;; get list - invoke libini.for_each_section, assoc_ini, section_cb - stdcall sort_list - mov eax, [sb_apps.max_area] - and eax, 1b - shr [sb_apps.max_area], 1 - add [sb_apps.max_area], eax - - mov eax, 0xFFFfff - mov ebx, 0xCCCccc ;[skin.3d] - mov [sb_apps.bg_color], eax - mov [sb_apps.front_color], ebx - mov [sb_apps.line_color], ebx - - ;; get icons - mcall 70, is_openimg_info - mov edx, dword [img.buf + 32] - shl edx, 4 - stdcall mem.Alloc, edx - mov [img.rgb], eax - - mov [is_openimg + 12], edx - m2m dword[is_openimg + 16], dword[img.rgb] - mcall 70, is_openimg - - invoke libimg.decode, dword[img.rgb], ebx, 0 - mov [img], eax - - ;; alpha - mov edi, [eax + 8] - shl edi, 7 - sub edi, 4 - mov eax, [eax + 24] - .setalpha: - mov ebx, [eax + edi] - shr ebx, 24 - cmpne ebx, 0, @f - mov ecx, 0xFFFfff - mov [eax + edi], ecx - @@: - cmpe edi, 0, @f - sub edi, 4 - jmp .setalpha - @@: - - invoke libimg.toRGB, [img], [img.rgb] - invoke libimg.destroy, [img] - - ;---------------------- - - update: - mcall 10 - cmpe eax, EV_REDRAW, event_redraw - cmpe eax, EV_KEY, event_key - cmpe eax, EV_BUTTON, event_button - cmpe eax, EV_MOUSE, event_mouse - jmp update - - ;---------------------- - - event_redraw: - call draw_window - jmp update - - ;---------------------- - - event_key: - mcall 2 - cmpe ah, 27, exit - - cmpe ah, 13, list_item_activate - cmpe ah, 9, event_button.opendialog - cmpe ah, 32, .toggle_cb - cmpe ah, 179, .go_right - cmpe ah, 176, .go_left - cmpe ah, 178, .go_up - cmpe ah, 177, .go_down - - cmpl ah, "a", @f - cmpg ah, "z", @f - jmp .letter - @@: - - cmpl ah, "", @f - cmpg ah, "", @f - jmp .letter - @@: - - cmpl ah, "A", @f - cmpg ah, "Z", @f - jmp .letter_big - @@: - - cmpl ah, "", @f - cmpg ah, "", @f - jmp .letter_big - @@: - - cmpl ah, "0", @f - cmpg ah, "9", @f - jmp .letter - @@: - - jmp update - - .letter_big: - movzx ebx, ah - stdcall downcase_char, ebx - mov ah, al - - .letter: - push eax - - stdcall get_index - inc eax - - mov ecx, eax - - imul ebx, eax, 32 - add ebx, list - - pop eax - - mov edi, 0 - mov esi, [list.size] - .search: - shl esi, 5 - add esi, list - @@: - cmpe ebx, esi, @f - - movzx edx, byte [ebx] - stdcall downcase_char, edx - cmpne ah, al, .next - stdcall set_index, ecx - stdcall draw_list - jmp update - - .next: - inc ecx - add ebx, 32 - jmp @b - @@: - cmpe edi, 1, update - mov ebx, list - mov ecx, 0 - mov edi, 1 - push eax - stdcall get_index - mov esi, eax - pop eax - jmp .search - - .toggle_cb: - mov eax, [cb_always.flags] - mov ebx, eax - and ebx, ch_flag_en - cmpe ebx, 0, @f - sub eax, ch_flag_en - jmp .toggle_cb.redraw - @@: - add eax, ch_flag_en - .toggle_cb.redraw: - mov [cb_always.flags], eax - invoke checkbox.draw, cb_always - jmp update - - .go_right: - mov esi, 1 - jmp .go_anyway - - .go_left: - mov esi, -1 - jmp .go_anyway - - .go_up: - mov esi, -2 - jmp .go_anyway - - .go_down: - mov esi, 2 - - .go_anyway: -;; HIDE OLD SELECTION - stdcall draw_item, [last_x], [last_y], 0 - -;; [X, Y] -> INDEX - stdcall get_index - -;; CHANGE INDEX - .check_p2: - cmpne esi, 2, .check_m2 - mov ebx, [list.size] - dec ebx - sub ebx, eax - cmpg ebx, 1, .add - jmp .check - - .check_m2: - cmpne esi, -2, .add - cmpg eax, 1, .add - jmp .check - - .add: - add eax, esi - - .check: - cmpl eax, [list.size], @f - mov eax, [list.size] - dec eax - @@: - - cmpge eax, 0, @f - mov eax, 0 - @@: - -;; INDEX -> [X, Y] - stdcall set_index, eax - cmpe eax, 1, @f - -;; PARTLY REDRAW - stdcall draw_item, [last_x], [last_y], 1 - jmp update - -;; FULL REDRAW - @@: - stdcall draw_list - jmp update - - ;---------------------- - - event_button: - mcall 17 - cmpe ah, 1, exit - cmpe ah, 2, .opendialog - jmp list_item_activate - - .opendialog: - invoke opendialog.start, opendialog - cmpne [opendialog.status], 1, update - mcall 70, is_openas - - mov edi, 0 - jmp save_assoc - - ;---------------------- - - list_item_activate: - stdcall get_index - shl eax, 5 - add eax, list - cmpe byte [eax], 0, update - mov [param_a], eax - invoke libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined - cmpe byte [buffer], 0, ini_error - mcall 70, is_openas - - mov edi, 1 - jmp save_assoc - - ;---------------------- - - save_assoc: - mov eax, [cb_always.flags] - and eax, ch_flag_en - cmpe eax, 0, exit - - cmpe edi, 0, @f - stdcall string.copy, app_link, buffer - stdcall string.concatenate, [param_a], buffer - @@: - - stdcall string.length, buffer - mov edi, eax - - invoke libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, edi - jmp exit - - ;---------------------- - - event_mouse: - invoke checkbox.mouse, cb_always - mov edi, [sb_apps.position] - invoke scrollbar.mouse, sb_apps - sub edi, [sb_apps.position] - jz @f - call draw_list - @@: - - mcall 37, 1 - movzx edi, ax - shr eax, 16 - mov esi, eax - sub esi, 4 - sub edi, 10 + 12 - cmpl esi, 0, .out - cmpge esi, LIST_WIDTH, .out - cmpl edi, 0, .out - cmpge edi, LIST_HEIGHT, .out - - mcall 37, 7 - and eax, 0xFFFF - cmpe eax, 65535, .scroll_up - cmpe eax, 0, @f - - .scroll_down: - mov eax, [sb_apps.position] - add eax, LIST_SIZE / 2 - shl eax, 1 - cmpge eax, [list.size], @f - inc [sb_apps.position] - stdcall draw_list - jmp update - - .scroll_up: - cmpe [sb_apps.position], 0, @f - dec [sb_apps.position] - stdcall draw_list - jmp update - - @@: - - mov eax, esi - mov ebx, LIST_WIDTH / 2 - mov edx, 0 - div ebx - mov esi, eax - - mov eax, edi - mov ebx, LINE_SIZE - mov edx, 0 - div ebx - mov edi, eax - - cmpne esi, [last_x], .redraw - cmpne edi, [last_y], .redraw - jmp @f - - .redraw: - stdcall draw_item, [last_x], [last_y], 0 - mov [last_x], esi - mov [last_y], edi - stdcall draw_item, esi, edi, 1 - jmp @f - - .out: - cmpe [last_x], -1, @f - stdcall draw_item, [last_x], [last_y], 0 - mov [last_x], -1 - mov [last_y], -1 - @@: - - jmp update - - ;---------------------- - - exit: - mcall -1 - - ;---------------------- - - proc draw_window - mcall 12, 1 - - mov edx, [skin.work] - or edx, 0x34 shl 24 - mcall 0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title - stdcall draw_list - invoke pathshow.draw, ps_addres - invoke checkbox.draw, cb_always - - mcall 8, <208, 63>, , 2, [skin.work_button] -; - mov ecx, [skin.work_button_text] - add ecx, 0x80 shl 24 - mcall 4, <214, LIST_HEIGHT + 36>, , browse_txt - - ;; buttons - mov eax, 8 - mov ebx, 4 shl 16 + LIST_WIDTH / 2 - mov ecx, (10 + 12) shl 16 + LINE_SIZE - 1 - mov edx, 0x60 shl 24 + 10 - mov edi, LIST_SIZE - mov esi, 0 - @@: - cmpe edi, 0, @f - mcall - - cmpe esi, 0, .doA - .doB: - sub ebx, LIST_WIDTH shl 16 - add ecx, LINE_SIZE shl 16 - .doA: - add ebx, (LIST_WIDTH / 2) shl 16 - sub ecx, LINE_SIZE shl 16 - - not esi - add ecx, LINE_SIZE shl 16 - inc edx - dec edi - jmp @b - @@: - - mcall 12, 2 - ret - endp - - ;---------------------- - - proc draw_list - mcall 13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph] - mcall , , - mcall , <3, 1>, <9 + 12, LIST_HEIGHT + 1> - mcall , <3 + LIST_WIDTH + 12 + 1, 1> - mcall , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff - - mov esi, 1 - mov edi, LIST_SIZE / 2 - 1 - .draw_loop: - mov edx, 0 - cmpne [last_x], esi, @f - cmpne [last_y], edi, @f - mov edx, 1 - @@: - stdcall draw_item, esi, edi, edx - dec esi - cmpne esi, -1, @f - mov esi, 1 - dec edi - @@: - cmpne edi, -1, .draw_loop - - invoke scrollbar.draw, sb_apps - - ret - endp - - ;---------------------- - - proc draw_item uses edx edi esi, _x, _y, _sel - ;; get index - stdcall get_index_cur, [_x], [_y] - mov edi, eax - - cmpge edi, [list.size], .break - - ;; background - mov ebx, [_x] - shl ebx, 7 + 16 - add ebx, 4 shl 16 + LIST_WIDTH / 2 - - imul ecx, [_y], LINE_SIZE - shl ecx, 16 - add ecx, (10 + 12) shl 16 + LINE_SIZE - - mov edx, 0xFFFfff - cmpe [_sel], 0, @f - mov edx, 0x94AECE - @@: - mcall 13 - - ;; shadows - push ecx - cmpe [_sel], 1, .after_shadows - mov edx, 0xCCCccc ;[skin.3d] - - cmpne [_x], 0, @f - imul ecx, [_y], LINE_SIZE - shl ecx, 16 - add ecx, (10 + 12) shl 16 + LINE_SIZE - mcall , <4, 1> - @@: - - cmpne [_y], 0, @f - imul ebx, [_x], LIST_WIDTH / 2 - shl ebx, 16 - add ebx, 4 shl 16 + LIST_WIDTH / 2 - mcall , , <10 + 12, 1> - @@: - - .after_shadows: - pop ecx - - ;; icon - and ebx, 0xFFFF shl 16 - shr ecx, 16 - add ecx, ebx - mov edx, ecx - add edx, 6 shl 16 + (LINE_SIZE - 32) / 2 - - mov ebx, edi - shl ebx, 2 - mov ebx, [ebx + list.icon] - imul ebx, 32 * 32 * 3 - add ebx, [img.rgb] - cmpe [_sel], 0, .draw_icon - .selected: - mov eax, img.sel - mov ecx, 32 * 32 - push edx - @@: - mov edx, [ebx] - and edx, 0xFFFFFF - cmpne edx, 0xFFFFFF, .not - mov edx, 0x94AECE - .not: - mov [eax], edx - add eax, 3 - add ebx, 3 - dec ecx - jnz @b - pop edx - mov ebx, img.sel - - .draw_icon: - mcall 7, , <32, 32> - - ;; text - mov ebx, edx - add ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2 - - mov ecx, 0x000000 ; inactive item text - cmpe [_sel], 0, @f - mov ecx, 0x000000 ; active item text - @@: - add ecx, 0x80 shl 24 - - mov edx, edi - shl edx, 5 - add edx, list - - mcall 4 - - .break: - ret - endp - - ;---------------------- - - proc downcase_char uses ebx, _ch - mov ebx, [_ch] - - cmpl bl, "A", @f - cmpg bl, "Z", @f - sub bl, "A" - "a" - jmp .ret - @@: - - cmpl bl, "", @f - cmpg bl, "", @f - sub bl, "" - "" - @@: - - .ret: - mov al, bl - ret - endp - - ;---------------------- - - proc get_index_cur uses ebx, _x, _y - mov eax, [_y] - shl eax, 1 - add eax, [_x] - mov ebx, [sb_apps.position] - shl ebx, 1 - add eax, ebx - - ret - endp - - ;---------------------- - - proc get_index - stdcall get_index_cur, [last_x], [last_y] - ret - endp - - ;---------------------- - - proc set_index uses ebx,_index - mov eax, [_index] - mov ebx, [sb_apps.position] - shl ebx, 1 - sub eax, ebx - - mov ebx, eax - and ebx, 1b - mov [last_x], ebx - shr eax, 1 - mov [last_y], eax - - mov eax, 0 - - cmpl [last_y], 0xFFFF, @f - mov ebx, 0xFFFFFFFF shr 1 - sub ebx, [last_y] - inc ebx - mov [last_y], 0 - ;dec [sb_apps.position] - sub [sb_apps.position], ebx - mov eax, 1 - jmp .exit - @@: - - cmpl [last_y], LIST_SIZE / 2, @f - mov ebx, [last_y] - sub ebx, LIST_SIZE / 2 - 1 - mov [last_y], LIST_SIZE / 2 - 1 - add [sb_apps.position], ebx - mov eax, 1 - jmp .exit - @@: - - .exit: - cmpge [sb_apps.position], 0, @f - mov [sb_apps.position], 0 - @@: - - ret - endp - - ;---------------------- - - proc section_cb, _file, _sec - ;; CHECK IF EXISTS - invoke libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined - mcall 70, is_file_exists - cmpe ebx, -1, .exit - - mov ebx, [list.size] - shl ebx, 5 - add ebx, list - stdcall string.cmp, [_sec], assoc_ini.sec - cmpe eax, 0, @f - stdcall string.copy, [_sec], ebx - invoke libini.get_num, [_file], [_sec], assoc_ini.icon, 0 - mov ecx, [list.size] - shl ecx, 2 - mov [ecx + list.icon], eax - inc [list.size] - inc [sb_apps.max_area] - @@: - mov eax, 1 - .exit: - ret - endp - - ;---------------------- - - proc sort_list - mov eax, list - mov ebx, list.lowercased - @@: - stdcall string.copy, eax, ebx - stdcall string.to_lower_case, ebx - add eax, 32 - add ebx, 32 - cmpne byte [eax], 0, @b - - mov edi, 0 - mov ebx, list.lowercased ;; i = 0 - imul ecx, [list.size], 32 ;; i < n - 1 - sub ecx, 32 - add ecx, list.lowercased - - .loop1: - mov edx, list.lowercased ;; j = 0 - mov esi, [list.size] ;; j < n - i - 1 - sub esi, edi - dec esi - imul esi, 32 - add esi, list.lowercased - .loop2: - mov eax, edx - add eax, 32 - stdcall string.cmp, edx, eax, 32 - cmpne eax, 1, .next2 -;; swap names lw - mov eax, edx - add eax, 32 - stdcall string.copy, edx, buffer7 - stdcall string.copy, eax, edx - stdcall string.copy, buffer7, eax -;; swap names - mov eax, edx - sub eax, 256 * 32 - 32 - sub edx, 256 * 32 - stdcall string.copy, edx, buffer7 - stdcall string.copy, eax, edx - stdcall string.copy, buffer7, eax - add edx, 256 * 32 -;; swap icons - mov eax, edx - sub eax, list.lowercased - shr eax, 3 - add eax, list.icon - push ebx ecx - mov ebx, [eax] - mov ecx, [eax + 4] - mov [eax], ecx - mov [eax + 4], ebx - pop ecx ebx - .next2: - add edx, 32 - cmpne edx, esi, .loop2 - .next1: - inc edi - add ebx, 32 - cmpne ebx, ecx, .loop1 - - ret - endp - - ;---------------------- - - dataend: - - ;=============================== - - skin system_colors - list rb 32 * 256 - .lowercased rd 32 * 256 - .icon rd 256 - .size rd 1 - img rd 1 - .rgb rd 1 - .size rd 1 - .buf rb 40 - .sel rb 32 * 32 * 3 - win: - .x rd 1 - .y rd 1 - win.title rb 256 - param_lwr rd 1 - param_e rd 1 - param_a rd 1 - param_s rd 1 - undefined rb 1 - buffer rb 2048 - buffer2 rb 2048 ;OD - buffer3 rb 2048 ;OD - buffer4 rb 2048 ;OD - buffer5 rb 2048 ;OD - buffer6 rb 2048 ;check existance - buffer7 rb 32 ;for sorting - buffer8 rd 2048 - paramorig rb 2048 - _stack rb 2048 - params rb 256 - memory: + DEBUG = 0 + + LIST_WIDTH = 256 + WIN_WIDTH = (LIST_WIDTH + 16 + 12) + LIST_SIZE = 12 + LINE_SIZE = 40 + LIST_HEIGHT = (LIST_SIZE * LINE_SIZE / 2) + WIN_HEIGHT = (LIST_HEIGHT + 80) + + use32 + org 0 + db 'MENUET01' + dd 1, main, dataend, memory, memory +M01header.params: + dd params, 0 + + include "../../proc32.inc" + include "../../macros.inc" + include "../../dll.inc" + include "../../string.inc" + include "../../develop/libraries/box_lib/trunk/box_lib.mac" + + include "lang.inc" ; Language support for locales: ru_RU (CP866), et_EE, it_IT, en_US. + +if DEBUG eq 1 + include "../../debug.inc" +end if + + ;=============================== + +if lang eq ru_RU + title db " ", 0 + browse_txt db "...", 0 + notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 + checkbox_txt db "ᯮ짮 ᥣ", 0 +else if lang eq et_EE + title db "Open with", 0 + browse_txt db "Browse...", 0 + notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 + checkbox_txt db "Always use selected program", 0 +else if lang eq it_IT + title db "Open with", 0 + browse_txt db "Browse...", 0 + notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 + checkbox_txt db "Always use selected program", 0 +else ; Default to en_US + title db "Open with", 0 + browse_txt db "Browse...", 0 + notify_txt db "'Incorrect ", '"', "/sys/settings/assoc.ini", '"', " file' -tE", 0 + checkbox_txt db "Always use selected program", 0 +end if + + sys_dir db "/sys", 0 + slash db "/", 0 + open_dialog_path db "/sys/file managers/opendial", 0 + app_link db "$", 0 + icons db "/sys/icons32.png", 0 + communication_area_name db "FFFFFF_open_dialog", 0 + assoc_ini db "/sys/settings/assoc.ini", 0 + .sec db "Assoc", 0 + .exec db "exec", 0 + .next db "next", 0 + .icon db "icon", 0 + + sb_apps scrollbar \ + 13, WIN_WIDTH - 25, LIST_HEIGHT, 10 + 12, \ ;; w, x, h, y + 0, 0, LIST_SIZE / 2, 0, \ ;; b.h, max, area, pos + 0, 0, 0, 2 + + cb_always check_box2 \ + 5 shl 16 + 16, (LIST_HEIGHT + 33) shl 16 + 16, 6, 0, 0, 0, checkbox_txt, ch_flag_middle + + opendialog: + .type dd 0 + .procinfo dd buffer3 + .com_area_name dd communication_area_name + .com_area dd 0 + .opendir_path dd buffer4 + .dir_default_path dd sys_dir + .start_path dd open_dialog_path + .draw_window dd draw_window + .status dd 0 + .openfile_pach dd buffer + .filename_area dd buffer5 + .filter_area dd .filter + .x: + .x_size dw 420 + .x_start dw 200 + .y: + .y_size dw 320 + .y_start dw 120 + + .filter dd 0 + + ps_addres: + dd 0 ;; type + dw 7 ;; y + dw 4 ;; x + dw 6 ;; font.w + dw LIST_WIDTH ;; w + dd 0 ;; mono + dd 0 ;; without bg + .color dd 0 ;; text color + dd 0 ;; bg color + .txt dd 0 ;; text + dd buffer2 + dd 0 + + is_execute: + dd 7, 0, 0, 0, 0 + db 0 + dd buffer + + is_openas: + dd 7, 0, 0, 0, 0 + db 0 + dd buffer + + is_open: + dd 7, 0, 0, 0, 0 + db 0 + dd buffer + + is_undefined: + dd 7, 0, notify_txt, 0, 0 + db "/sys/@notify", 0 + + is_openimg_info: + dd 5, 0, 0, 0, img.buf + db 0 + dd icons + + is_openimg: + dd 0, 0, 0, 0, 0 + db 0 + dd icons + + is_file_exists: + dd 0, 0, 0, 0, buffer6 + db 0 + dd buffer + + last_x dd -1 + last_y dd -1 + +if DEBUG eq 1 + std_param db "~/sys/example.asm", 0 +end if + + imports: + library libini, "libini.obj" + import libini, libini.get_str, "ini_get_str", \ + libini.set_str, "ini_set_str", \ + libini.get_num, "ini_get_int", \ + libini.for_each_section, "ini_enum_sections" + + imports_add: + library libimg, "libimg.obj", \ + boxlib, "box_lib.obj", \ + prclib, "proc_lib.obj" + import libimg, libimg.init, "lib_init", \ + libimg.toRGB, "img_to_rgb2", \ + libimg.decode, "img_decode", \ + libimg.destroy, "img_destroy" + import boxlib, scrollbar.draw, "scrollbar_v_draw", \ + scrollbar.mouse, "scrollbar_v_mouse", \ + pathshow.init, "PathShow_prepare", \ + pathshow.draw, "PathShow_draw", \ + checkbox.init, "init_checkbox2", \ + checkbox.draw, "check_box_draw2", \ + checkbox.mouse, "check_box_mouse2" + import prclib, opendialog.lib_init, "lib_init", \ + opendialog.init, "OpenDialog_init", \ + opendialog.start, "OpenDialog_start" + + ;=============================== + + main: + mcall 68, 11 + stdcall dll.Load, imports + +if DEBUG eq 1 + stdcall string.copy, std_param, [M01header.params] +end if + + ;; trim params + stdcall string.copy, [M01header.params], paramorig + stdcall string.trim_last, paramorig + stdcall string.trim_first, paramorig + mov [param_s], eax + + stdcall string.to_lower_case, [M01header.params] + stdcall string.trim_last, [M01header.params] + stdcall string.trim_first, [M01header.params] + mov [param_lwr], eax + + ;; if empty - exit + cmpe [eax], byte 0, exit + + ;; if folder + stdcall string.length, [param_s] + add eax, [param_s] + cmpe [eax - 1], byte '/', open + + ;; if dialog + mov eax, [param_s] + mov [is_openas + 8], eax + cmpne [eax], byte '~', @f + inc [param_s] + mov eax, [param_s] + mov [is_openas + 8], eax + jmp start_dialog + @@: + + ;; if without '.' - execute + stdcall string.last_index_of, [param_s], '.', 1 + cmpe eax, -1, execute + ;; if '.' is part of path - execute + mov esi, eax + stdcall string.last_index_of, [param_s], '/', 1 + cmpg eax, esi, execute + + ;; if ext == "kex" - execute + add esi, [param_lwr] + mov [param_e], esi + cmpe [esi], dword "kex", execute + + open_as: + invoke libini.get_str, assoc_ini, assoc_ini.sec, esi, buffer8, 2048, undefined + cmpe byte [buffer8], 0, start_dialog_pre + .run: + mov edi, 0 + cmpne byte [buffer8], "$", .pre_open + mov edi, 1 + invoke libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.exec, buffer, 2048, undefined + cmpe byte [buffer], 0, ini_error + jmp @f + .pre_open: + stdcall string.copy, buffer8, buffer + @@: + mcall 70, is_openas + cmpge eax, 0, exit + cmpe edi, 0, start_dialog + invoke libini.get_str, assoc_ini, buffer8 + 1, assoc_ini.next, buffer8, 2048, undefined + cmpne byte [buffer], 0, .run + jmp start_dialog + + execute: + mov eax, [param_s] + mov [is_execute + 21], eax + mcall 70, is_execute + jmp exit + + open: + invoke libini.get_str, assoc_ini, assoc_ini.sec, slash, buffer, 2048, undefined + cmpne [buffer], byte "$", @f + invoke libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined + cmpe [buffer], byte 0, ini_error + @@: + mov eax, [param_s] + mov [is_open + 8], eax + mcall 70, is_open + jmp exit + + ini_error: + mcall 70, is_undefined + jmp exit + + ;---------------------- + + start_dialog_pre: + or [cb_always.flags], ch_flag_en + + start_dialog: + stdcall dll.Load, imports_add + invoke opendialog.lib_init + + mcall 40, 100111b + + ;; get title + stdcall string.copy, title, win.title + + ;; get positions + mcall 14 + movzx ebx, ax + shr ebx, 1 + shr eax, 16 + 1 + sub eax, WIN_WIDTH / 2 - 1 + sub ebx, WIN_HEIGHT / 2 - 1 + mov [win.x], eax + mov [win.y], ebx + + ;; get colors + mcall 48, 3, skin, sizeof.system_colors + + ;; get opendialog + invoke opendialog.init, opendialog + + ;; get pathshow + mov eax, [param_s] + mov ebx, [skin.work_text] + mov [ps_addres.txt], eax + mov [ps_addres], ebx + m2m [ps_addres.color], [skin.work_text] + invoke pathshow.init, ps_addres + + ;; get checkbox + mov eax, 0xFFFfff + mov ebx, [skin.work_graph] + mov ecx, [skin.work_text] + mov [cb_always.color], eax + mov [cb_always.border_color], ebx + mov [cb_always.text_color], ecx + invoke checkbox.init, cb_always + + ;; get list + invoke libini.for_each_section, assoc_ini, section_cb + stdcall sort_list + mov eax, [sb_apps.max_area] + and eax, 1b + shr [sb_apps.max_area], 1 + add [sb_apps.max_area], eax + + mov eax, 0xFFFfff + mov ebx, 0xCCCccc ;[skin.3d] + mov [sb_apps.bg_color], eax + mov [sb_apps.front_color], ebx + mov [sb_apps.line_color], ebx + + ;; get icons + mcall 70, is_openimg_info + mov edx, dword [img.buf + 32] + shl edx, 4 + stdcall mem.Alloc, edx + mov [img.rgb], eax + + mov [is_openimg + 12], edx + m2m dword[is_openimg + 16], dword[img.rgb] + mcall 70, is_openimg + + invoke libimg.decode, dword[img.rgb], ebx, 0 + mov [img], eax + + ;; alpha + mov edi, [eax + 8] + shl edi, 7 + sub edi, 4 + mov eax, [eax + 24] + .setalpha: + mov ebx, [eax + edi] + shr ebx, 24 + cmpne ebx, 0, @f + mov ecx, 0xFFFfff + mov [eax + edi], ecx + @@: + cmpe edi, 0, @f + sub edi, 4 + jmp .setalpha + @@: + + invoke libimg.toRGB, [img], [img.rgb] + invoke libimg.destroy, [img] + + ;---------------------- + + update: + mcall 10 + cmpe eax, EV_REDRAW, event_redraw + cmpe eax, EV_KEY, event_key + cmpe eax, EV_BUTTON, event_button + cmpe eax, EV_MOUSE, event_mouse + jmp update + + ;---------------------- + + event_redraw: + call draw_window + jmp update + + ;---------------------- + + event_key: + mcall 2 + cmpe ah, 27, exit + + cmpe ah, 13, list_item_activate + cmpe ah, 9, event_button.opendialog + cmpe ah, 32, .toggle_cb + cmpe ah, 179, .go_right + cmpe ah, 176, .go_left + cmpe ah, 178, .go_up + cmpe ah, 177, .go_down + + cmpl ah, "a", @f + cmpg ah, "z", @f + jmp .letter + @@: + + cmpl ah, "", @f + cmpg ah, "", @f + jmp .letter + @@: + + cmpl ah, "A", @f + cmpg ah, "Z", @f + jmp .letter_big + @@: + + cmpl ah, "", @f + cmpg ah, "", @f + jmp .letter_big + @@: + + cmpl ah, "0", @f + cmpg ah, "9", @f + jmp .letter + @@: + + jmp update + + .letter_big: + movzx ebx, ah + stdcall downcase_char, ebx + mov ah, al + + .letter: + push eax + + stdcall get_index + inc eax + + mov ecx, eax + + imul ebx, eax, 32 + add ebx, list + + pop eax + + mov edi, 0 + mov esi, [list.size] + .search: + shl esi, 5 + add esi, list + @@: + cmpe ebx, esi, @f + + movzx edx, byte [ebx] + stdcall downcase_char, edx + cmpne ah, al, .next + stdcall set_index, ecx + stdcall draw_list + jmp update + + .next: + inc ecx + add ebx, 32 + jmp @b + @@: + cmpe edi, 1, update + mov ebx, list + mov ecx, 0 + mov edi, 1 + push eax + stdcall get_index + mov esi, eax + pop eax + jmp .search + + .toggle_cb: + mov eax, [cb_always.flags] + mov ebx, eax + and ebx, ch_flag_en + cmpe ebx, 0, @f + sub eax, ch_flag_en + jmp .toggle_cb.redraw + @@: + add eax, ch_flag_en + .toggle_cb.redraw: + mov [cb_always.flags], eax + invoke checkbox.draw, cb_always + jmp update + + .go_right: + mov esi, 1 + jmp .go_anyway + + .go_left: + mov esi, -1 + jmp .go_anyway + + .go_up: + mov esi, -2 + jmp .go_anyway + + .go_down: + mov esi, 2 + + .go_anyway: +;; HIDE OLD SELECTION + stdcall draw_item, [last_x], [last_y], 0 + +;; [X, Y] -> INDEX + stdcall get_index + +;; CHANGE INDEX + .check_p2: + cmpne esi, 2, .check_m2 + mov ebx, [list.size] + dec ebx + sub ebx, eax + cmpg ebx, 1, .add + jmp .check + + .check_m2: + cmpne esi, -2, .add + cmpg eax, 1, .add + jmp .check + + .add: + add eax, esi + + .check: + cmpl eax, [list.size], @f + mov eax, [list.size] + dec eax + @@: + + cmpge eax, 0, @f + mov eax, 0 + @@: + +;; INDEX -> [X, Y] + stdcall set_index, eax + cmpe eax, 1, @f + +;; PARTLY REDRAW + stdcall draw_item, [last_x], [last_y], 1 + jmp update + +;; FULL REDRAW + @@: + stdcall draw_list + jmp update + + ;---------------------- + + event_button: + mcall 17 + cmpe ah, 1, exit + cmpe ah, 2, .opendialog + jmp list_item_activate + + .opendialog: + invoke opendialog.start, opendialog + cmpne [opendialog.status], 1, update + mcall 70, is_openas + + mov edi, 0 + jmp save_assoc + + ;---------------------- + + list_item_activate: + stdcall get_index + shl eax, 5 + add eax, list + cmpe byte [eax], 0, update + mov [param_a], eax + invoke libini.get_str, assoc_ini, eax, assoc_ini.exec, buffer, 256, undefined + cmpe byte [buffer], 0, ini_error + mcall 70, is_openas + + mov edi, 1 + jmp save_assoc + + ;---------------------- + + save_assoc: + mov eax, [cb_always.flags] + and eax, ch_flag_en + cmpe eax, 0, exit + + cmpe edi, 0, @f + stdcall string.copy, app_link, buffer + stdcall string.concatenate, [param_a], buffer + @@: + + stdcall string.length, buffer + mov edi, eax + + invoke libini.set_str, assoc_ini, assoc_ini.sec, [param_e], buffer, edi + jmp exit + + ;---------------------- + + event_mouse: + invoke checkbox.mouse, cb_always + mov edi, [sb_apps.position] + invoke scrollbar.mouse, sb_apps + sub edi, [sb_apps.position] + jz @f + call draw_list + @@: + + mcall 37, 1 + movzx edi, ax + shr eax, 16 + mov esi, eax + sub esi, 4 + sub edi, 10 + 12 + cmpl esi, 0, .out + cmpge esi, LIST_WIDTH, .out + cmpl edi, 0, .out + cmpge edi, LIST_HEIGHT, .out + + mcall 37, 7 + and eax, 0xFFFF + cmpe eax, 65535, .scroll_up + cmpe eax, 0, @f + + .scroll_down: + mov eax, [sb_apps.position] + add eax, LIST_SIZE / 2 + shl eax, 1 + cmpge eax, [list.size], @f + inc [sb_apps.position] + stdcall draw_list + jmp update + + .scroll_up: + cmpe [sb_apps.position], 0, @f + dec [sb_apps.position] + stdcall draw_list + jmp update + + @@: + + mov eax, esi + mov ebx, LIST_WIDTH / 2 + mov edx, 0 + div ebx + mov esi, eax + + mov eax, edi + mov ebx, LINE_SIZE + mov edx, 0 + div ebx + mov edi, eax + + cmpne esi, [last_x], .redraw + cmpne edi, [last_y], .redraw + jmp @f + + .redraw: + stdcall draw_item, [last_x], [last_y], 0 + mov [last_x], esi + mov [last_y], edi + stdcall draw_item, esi, edi, 1 + jmp @f + + .out: + cmpe [last_x], -1, @f + stdcall draw_item, [last_x], [last_y], 0 + mov [last_x], -1 + mov [last_y], -1 + @@: + + jmp update + + ;---------------------- + + exit: + mcall -1 + + ;---------------------- + + proc draw_window + mcall 12, 1 + + mov edx, [skin.work] + or edx, 0x34 shl 24 + mcall 0, <[win.x], WIN_WIDTH>, <[win.y], WIN_HEIGHT>, , , win.title + stdcall draw_list + invoke pathshow.draw, ps_addres + invoke checkbox.draw, cb_always + + mcall 8, <208, 63>, , 2, [skin.work_button] +; + mov ecx, [skin.work_button_text] + add ecx, 0x80 shl 24 + mcall 4, <214, LIST_HEIGHT + 36>, , browse_txt + + ;; buttons + mov eax, 8 + mov ebx, 4 shl 16 + LIST_WIDTH / 2 + mov ecx, (10 + 12) shl 16 + LINE_SIZE - 1 + mov edx, 0x60 shl 24 + 10 + mov edi, LIST_SIZE + mov esi, 0 + @@: + cmpe edi, 0, @f + mcall + + cmpe esi, 0, .doA + .doB: + sub ebx, LIST_WIDTH shl 16 + add ecx, LINE_SIZE shl 16 + .doA: + add ebx, (LIST_WIDTH / 2) shl 16 + sub ecx, LINE_SIZE shl 16 + + not esi + add ecx, LINE_SIZE shl 16 + inc edx + dec edi + jmp @b + @@: + + mcall 12, 2 + ret + endp + + ;---------------------- + + proc draw_list + mcall 13, <3, LIST_WIDTH + 2 + 12>, <9 + 12, 1>, [skin.work_graph] + mcall , , + mcall , <3, 1>, <9 + 12, LIST_HEIGHT + 1> + mcall , <3 + LIST_WIDTH + 12 + 1, 1> + mcall , <4, LIST_WIDTH>, <10 + 12, LIST_HEIGHT>, 0xFFFfff + + mov esi, 1 + mov edi, LIST_SIZE / 2 - 1 + .draw_loop: + mov edx, 0 + cmpne [last_x], esi, @f + cmpne [last_y], edi, @f + mov edx, 1 + @@: + stdcall draw_item, esi, edi, edx + dec esi + cmpne esi, -1, @f + mov esi, 1 + dec edi + @@: + cmpne edi, -1, .draw_loop + + invoke scrollbar.draw, sb_apps + + ret + endp + + ;---------------------- + + proc draw_item uses edx edi esi, _x, _y, _sel + ;; get index + stdcall get_index_cur, [_x], [_y] + mov edi, eax + + cmpge edi, [list.size], .break + + ;; background + mov ebx, [_x] + shl ebx, 7 + 16 + add ebx, 4 shl 16 + LIST_WIDTH / 2 + + imul ecx, [_y], LINE_SIZE + shl ecx, 16 + add ecx, (10 + 12) shl 16 + LINE_SIZE + + mov edx, 0xFFFfff + cmpe [_sel], 0, @f + mov edx, 0x94AECE + @@: + mcall 13 + + ;; shadows + push ecx + cmpe [_sel], 1, .after_shadows + mov edx, 0xCCCccc ;[skin.3d] + + cmpne [_x], 0, @f + imul ecx, [_y], LINE_SIZE + shl ecx, 16 + add ecx, (10 + 12) shl 16 + LINE_SIZE + mcall , <4, 1> + @@: + + cmpne [_y], 0, @f + imul ebx, [_x], LIST_WIDTH / 2 + shl ebx, 16 + add ebx, 4 shl 16 + LIST_WIDTH / 2 + mcall , , <10 + 12, 1> + @@: + + .after_shadows: + pop ecx + + ;; icon + and ebx, 0xFFFF shl 16 + shr ecx, 16 + add ecx, ebx + mov edx, ecx + add edx, 6 shl 16 + (LINE_SIZE - 32) / 2 + + mov ebx, edi + shl ebx, 2 + mov ebx, [ebx + list.icon] + imul ebx, 32 * 32 * 3 + add ebx, [img.rgb] + cmpe [_sel], 0, .draw_icon + .selected: + mov eax, img.sel + mov ecx, 32 * 32 + push edx + @@: + mov edx, [ebx] + and edx, 0xFFFFFF + cmpne edx, 0xFFFFFF, .not + mov edx, 0x94AECE + .not: + mov [eax], edx + add eax, 3 + add ebx, 3 + dec ecx + jnz @b + pop edx + mov ebx, img.sel + + .draw_icon: + mcall 7, , <32, 32> + + ;; text + mov ebx, edx + add ebx, (32 + 6) shl 16 + 32 / 2 - 9 / 2 + + mov ecx, 0x000000 ; inactive item text + cmpe [_sel], 0, @f + mov ecx, 0x000000 ; active item text + @@: + add ecx, 0x80 shl 24 + + mov edx, edi + shl edx, 5 + add edx, list + + mcall 4 + + .break: + ret + endp + + ;---------------------- + + proc downcase_char uses ebx, _ch + mov ebx, [_ch] + + cmpl bl, "A", @f + cmpg bl, "Z", @f + sub bl, "A" - "a" + jmp .ret + @@: + + cmpl bl, "", @f + cmpg bl, "", @f + sub bl, "" - "" + @@: + + .ret: + mov al, bl + ret + endp + + ;---------------------- + + proc get_index_cur uses ebx, _x, _y + mov eax, [_y] + shl eax, 1 + add eax, [_x] + mov ebx, [sb_apps.position] + shl ebx, 1 + add eax, ebx + + ret + endp + + ;---------------------- + + proc get_index + stdcall get_index_cur, [last_x], [last_y] + ret + endp + + ;---------------------- + + proc set_index uses ebx,_index + mov eax, [_index] + mov ebx, [sb_apps.position] + shl ebx, 1 + sub eax, ebx + + mov ebx, eax + and ebx, 1b + mov [last_x], ebx + shr eax, 1 + mov [last_y], eax + + mov eax, 0 + + cmpl [last_y], 0xFFFF, @f + mov ebx, 0xFFFFFFFF shr 1 + sub ebx, [last_y] + inc ebx + mov [last_y], 0 + ;dec [sb_apps.position] + sub [sb_apps.position], ebx + mov eax, 1 + jmp .exit + @@: + + cmpl [last_y], LIST_SIZE / 2, @f + mov ebx, [last_y] + sub ebx, LIST_SIZE / 2 - 1 + mov [last_y], LIST_SIZE / 2 - 1 + add [sb_apps.position], ebx + mov eax, 1 + jmp .exit + @@: + + .exit: + cmpge [sb_apps.position], 0, @f + mov [sb_apps.position], 0 + @@: + + ret + endp + + ;---------------------- + + proc section_cb, _file, _sec + ;; CHECK IF EXISTS + invoke libini.get_str, assoc_ini, [_sec], assoc_ini.exec, buffer, 2048, undefined + mcall 70, is_file_exists + cmpe ebx, -1, .exit + + mov ebx, [list.size] + shl ebx, 5 + add ebx, list + stdcall string.cmp, [_sec], assoc_ini.sec + cmpe eax, 0, @f + stdcall string.copy, [_sec], ebx + invoke libini.get_num, [_file], [_sec], assoc_ini.icon, 0 + mov ecx, [list.size] + shl ecx, 2 + mov [ecx + list.icon], eax + inc [list.size] + inc [sb_apps.max_area] + @@: + mov eax, 1 + .exit: + ret + endp + + ;---------------------- + + proc sort_list + mov eax, list + mov ebx, list.lowercased + @@: + stdcall string.copy, eax, ebx + stdcall string.to_lower_case, ebx + add eax, 32 + add ebx, 32 + cmpne byte [eax], 0, @b + + mov edi, 0 + mov ebx, list.lowercased ;; i = 0 + imul ecx, [list.size], 32 ;; i < n - 1 + sub ecx, 32 + add ecx, list.lowercased + + .loop1: + mov edx, list.lowercased ;; j = 0 + mov esi, [list.size] ;; j < n - i - 1 + sub esi, edi + dec esi + imul esi, 32 + add esi, list.lowercased + .loop2: + mov eax, edx + add eax, 32 + stdcall string.cmp, edx, eax, 32 + cmpne eax, 1, .next2 +;; swap names lw + mov eax, edx + add eax, 32 + stdcall string.copy, edx, buffer7 + stdcall string.copy, eax, edx + stdcall string.copy, buffer7, eax +;; swap names + mov eax, edx + sub eax, 256 * 32 - 32 + sub edx, 256 * 32 + stdcall string.copy, edx, buffer7 + stdcall string.copy, eax, edx + stdcall string.copy, buffer7, eax + add edx, 256 * 32 +;; swap icons + mov eax, edx + sub eax, list.lowercased + shr eax, 3 + add eax, list.icon + push ebx ecx + mov ebx, [eax] + mov ecx, [eax + 4] + mov [eax], ecx + mov [eax + 4], ebx + pop ecx ebx + .next2: + add edx, 32 + cmpne edx, esi, .loop2 + .next1: + inc edi + add ebx, 32 + cmpne ebx, ecx, .loop1 + + ret + endp + + ;---------------------- + + dataend: + + ;=============================== + + skin system_colors + list rb 32 * 256 + .lowercased rd 32 * 256 + .icon rd 256 + .size rd 1 + img rd 1 + .rgb rd 1 + .size rd 1 + .buf rb 40 + .sel rb 32 * 32 * 3 + win: + .x rd 1 + .y rd 1 + win.title rb 256 + param_lwr rd 1 + param_e rd 1 + param_a rd 1 + param_s rd 1 + undefined rb 1 + buffer rb 2048 + buffer2 rb 2048 ;OD + buffer3 rb 2048 ;OD + buffer4 rb 2048 ;OD + buffer5 rb 2048 ;OD + buffer6 rb 2048 ;check existance + buffer7 rb 32 ;for sorting + buffer8 rd 2048 + paramorig rb 2048 + _stack rb 2048 + params rb 256 + memory: diff --git a/programs/system/rdsave/trunk/rdsave.asm b/programs/system/rdsave/trunk/rdsave.asm index 57249af3c..e60757068 100644 --- a/programs/system/rdsave/trunk/rdsave.asm +++ b/programs/system/rdsave/trunk/rdsave.asm @@ -1,701 +1,701 @@ -; RDsave Kolibri (0.6.5.0 ) -; Save RAM-disk to hard or floppy drive -;--------------------------------------------------------------------- -; Mario79 2005 -; Heavyiron 12.02.2007 -; 11.05.2009 - ࠡ 㦭 ⥬ ⥪ box_lib.obj -; Mario79 08.09.2010 - select path with OpenDialog,keys 1,2,3,4 for select options -; Heavyiron 01.12.2013 - new logic -;--------------------------------------------------------------------- -appname equ 'RDsave ' -version equ '1.44' -debug equ no - -use32 ; 32- ० ᥬ -org 0x0 ; - -db 'MENUET01' ; 8- 䨪 MenuetOS -dd 0x01 ; (ᥣ 1) -dd START ; ࢮ -dd IM_END ; ࠧ ணࠬ -dd I_END ; ⢮ -dd stacktop ; 設 ⥪ -dd PARAMS ; ࠬ஢ -dd cur_dir_path - - -include 'lang.inc' -include '../../../macros.inc' -if debug eq yes -include '../../../debug.inc' -end if -include '../../../proc32.inc' -include '../../../dll.inc' -include '../../../KOSfuncs.inc' -include '../../../load_lib.mac' -include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include 'str.inc' - - @use_library -;--------------------------------------------------------------------- -;--- ---------------------------------------------- -;--------------------------------------------------------------------- -align 4 -START: -;--------------------------------------------------------------------- - mcall 68,11 - -load_libraries l_libs_start,end_l_libs - inc eax - test eax,eax - jz close - - stdcall dll.Init,[init_lib] - - invoke ini_get_int,ini_file,ini_section,aautoclose,0 - mov [autoclose],eax - invoke ini_get_str,ini_file,ini_section,apath,fname_buf,4096,path - stdcall _lstrcpy,ini_path,fname_buf - stdcall _lstrcpy,filename_area,start_temp_file_name - - mov eax,PARAMS - cmp byte[eax], 0 - je no_params - cmp byte[eax], 'h' - je @f - cmp byte[eax], 'H' - jne .no_h -@@: - mov [hidden],1 - jmp no_params -.no_h: - mov [param],1 - stdcall _lstrcpy,fname_buf,eax - mov ah,2 - jmp noclose - -;--------------------------------------------------------------------- -no_params: - stdcall _lstrcpy,check_dir,ini_path - call check_path - test eax,eax - jz path_ok - cmp eax,6 - je path_ok -;--------------------------------------------------------------------- -if debug eq yes -dps 'read_folder_error' -newline -end if -;--------------------------------------------------------------------- -default_path: - stdcall _lstrcpy,fname_buf,communication_area_default_path - mov [hidden],0 - -;OpenDialog initialisation - push dword OpenDialog_data - call [OpenDialog_Init] - -; prepare for PathShow - push dword PathShow_data_1 - call [PathShow_prepare] - - mcall 40,0x00000027 - - call draw_window - mov ah,3 - jmp noclose -;--------------------------------------------------------------------- -path_ok: -;OpenDialog initialisation - push dword OpenDialog_data - call [OpenDialog_Init] - -; prepare for PathShow - push dword PathShow_data_1 - call [PathShow_prepare] - - mcall 40,0x00000027 - - cmp [hidden],1 - jne red - mov ah,2 - jmp noclose -red: - call draw_window -;--------------------------------------------------------------------- -still: - mcall 10 - - dec eax ; ᮢ ? - jz red ; ᫨ - red - dec eax - jz key - dec eax - jz button - jmp still -;--------------------------------------------------------------------- -button: - mcall 17 ; 䨪 ⮩ - cmp ah,1 ; id=1("")? - jne noclose -close: - mcall -1 ; 㭪 -1: ணࠬ - -;--------------------------------------------------------------------- -key: - mcall 2 - cmp ah,0x1b - je close - cmp ah,0x0D - jne @f - mov ah,2 - jmp noclose -@@: - cmp ah,9h - jne still -;--------------------------------------------------------------------- -noclose: - mov ecx,fname_buf - push 16 - mov ebx,1 - cmp byte[ecx+1],'f' - je @f - cmp byte[ecx+1],'F' - jne not_fdd -@@: - cmp byte[ecx+4],'1' - jne @f - cmp ah,2 - je doit -@@: - inc ebx - cmp ah,2 - je doit -not_fdd: - push 18 - mov ebx,6 ; 18.6 = save to specified folder - cmp ah,2 - je doit - -; invoke OpenDialog - push dword OpenDialog_data - call [OpenDialog_Start] - cmp [OpenDialog_data.status],1 - jne still - -; prepare for PathShow - push dword PathShow_data_1 - call [PathShow_prepare] - call draw_window - mov ah,2 - jmp noclose - -doit: - cmp [param],0 - jne @f - call save_ini -@@: - cmp byte[ecx+1],'r' - je @f - cmp byte[ecx+1],'R' - je @f - cmp byte[ecx],'/' - je not_rd -@@: - mov edx,rdError - call print_err - jmp still -not_rd: - cmp [hidden],0 - jne @f - pusha - stdcall _lstrcpy,msg,label2 - mov eax,[sc.work_text] - or eax,0xc0000088 - mov [color],eax - call print_msg - popa -@@: - pop eax - mcall - call check_for_error - jmp still - -;--------------------------------------------------------------------- -check_for_error: ;ࠡ稪 訡 - test eax,eax - jz print_ok - cmp ebx,6 - je @f - mov edx,error11 - jmp print_err -@@: - cmp eax, 11 - ja .unknown - mov edx, [errors+eax*4] - stdcall _lstrcpy,msg,error - stdcall _lstrcat,msg,edx - mov edx,msg - jmp print_err -.unknown: - mov edx, aUnknownError - -print_err: - stdcall _lstrlen,ini_path - pusha - invoke ini_set_str,ini_file,ini_section,apath,ini_path,eax - popa - stdcall _lstrcpy,msg,edx - cmp [hidden],1 - je @f - cmp [param],1 - je @f - mov ecx,[sc.work_text] - or ecx,0xc0880000 - mov [color],ecx - call print_msg - ret -@@: - stdcall _lstrcpy, ntf_msg, ntf_start - stdcall _lstrcat, ntf_msg, edx - stdcall _lstrcat, ntf_msg, ntf_end_e - mov dword [is_notify + 8], ntf_msg - mcall 70, is_notify - mov [param],0 - mov [hidden],0 - stdcall _lstrcpy,fname_buf,ini_path - jmp no_params - -print_ok: - cmp [hidden],1 - je @f - cmp [param],1 - je @f - stdcall _lstrcpy,msg,ok - mov ecx,[sc.work_text] - or ecx,0xc0008800 - mov [color],ecx - call print_msg - mcall 5,100 - cmp [autoclose],1 - je close - ret -@@: - stdcall _lstrcpy,msg,ok - stdcall _lstrcat,msg,fname_buf - stdcall _lstrcpy, ntf_msg, ntf_start - stdcall _lstrcat, ntf_msg, msg - stdcall _lstrcat, ntf_msg, ntf_end_o - mov edx,ntf_msg - mov dword [is_notify + 8], edx - mcall 70, is_notify - mcall 5,100 - jmp close -;--------------------------------------------------------------------- -print_msg: - mcall 13,<5,380>,<96,10>,[sc.work] - stdcall _lstrlen,msg - lea eax,[eax+eax*2] - add eax,eax - mov ebx,390 - sub ebx,eax - shl ebx,15 - add ebx,96 - mcall 4, ,[color],msg, ,[sc.work] - ret -;--------------------------------------------------------------------- -draw_PathShow: - pusha - mcall 13,<15,280>,<32,16>,0xffffff - push dword PathShow_data_1 - call [PathShow_draw] - popa - ret -;--------------------------------------------------------------------- -save_ini: - pusha - stdcall _lstrlen,fname_buf - invoke ini_set_str,ini_file,ini_section,apath,fname_buf,eax - invoke ini_set_int,ini_file,ini_section,aautoclose,[autoclose] - popa - ret -;--------------------------------------------------------------------- -check_path: -stdcall _lstrlen,check_dir - add eax,check_dir -@@: - dec eax - cmp byte [eax],'/' - jne @b - mov byte [eax+1],0 - - mcall 70,read_folder - ret -;--------------------------------------------------------------------- -;--- Draw window --------------------------------------------------- -;--------------------------------------------------------------------- -draw_window: - mcall 48,3,sc,sizeof.system_colors - mcall 12,1 - - mcall 48,4 - mov ecx,200*65536+111 - add ecx,eax - - mov edx,[sc.work] - or edx,0x34000000 - mcall 0,<200,400>,, , ,title - -;buttons - mcall 8,<198,70>,<68,20>,1,[sc.work_button] - inc edx - mcall ,<125,70>, - inc edx - mcall ,<300,75>,<30,20> - -;labels - mov ecx,[sc.work_button_text] - or ecx,0x80000000 - mcall 4,<134,75>, ,save - mcall ,<215,75>, ,cancel - mcall ,<315,36>, ,select - - m2m dword [frame_data.font_backgr_color],[sc.work] - m2m dword [frame_data.font_color],[sc.work_text] - m2m dword [frame_data.ext_fr_col],[sc.work_graph] - m2m dword [frame_data.int_fr_col],[sc.work_light] - - push dword frame_data - call [Frame_draw] - - call draw_PathShow - call print_msg - - mcall 12,2 - ret - -;--------------------------------------------------------------------- -;--- Data ---------------------------------------------------------- -;--------------------------------------------------------------------- -if lang eq ru_RU -save db '࠭',0 -cancel db '⬥',0 -select db '',0 -label1 db ' ࠧ 㤥 ࠭ : ',0 -label2 db '࠭ ࠧ...',0 -ok db 'RAM- ࠭ ᯥ譮 ',0 -error1 db ' । / ࠧ ⪮ ᪠',0 -error2 db '㭪 ন 䠩 ⥬',0 -error3 db '⭠ 䠩 ⥬',0 -error4 db '࠭... 訡 4',0 -error5 db '騩 ',0 -error6 db '䠩 稫',0 -error7 db '㪠⥫ ਫ',0 -error8 db ' ',0 -error9 db '䠩 ࠧ襭',0 -error10 db ' ',0 -error11 db '訡 ன⢠',0 -aUnknownError db '⭠ 訡',0 -rdError db ' ࠭ ࠧ ᠬ ᥡ',0 -error db '訡: ',0 -;--------------------------------------------------------------------- -else if lang eq et_EE -save db 'Salvesta',0 -cancel db 'Cancel',0 -select db ' Valige',0 -label1 db ' RAM-drive will be saved as: ',0 -label2 db 'Saving in progress...',0 -ok db 'RAM-ketas salvestatud edukalt ',0 -error1 db 'hard disk base and/or partition not defined',0 -error2 db 'the file system does not support this function',0 -error3 db 'tundmatu failissteem',0 -error4 db 'strange... Error 4',0 -error5 db 'vigane teekond',0 -error6 db 'end of file',0 -error7 db 'pointer is outside of application memory',0 -error8 db 'ketas tis',0 -error9 db 'FAT tabel vigane',0 -error10 db 'juurdeps keelatud',0 -error11 db 'Seadme viga',0 -aUnknownError db 'Tundmatu viga',0 -rdError db "You can't save image on itself",0 -error db 'Viga: ',0 -;--------------------------------------------------------------------- -else if lang eq it_IT -save db ' Salva',0 -cancel db 'Cancel',0 -select db 'Seleziona',0 -label1 db ' RAM-drive will be saved as: ',0 -label2 db 'Saving in progress...',0 -ok db 'Il RAM-drivet e stato salvato ',0 -error1 db 'hard disk base and/or partition not defined',0 -error2 db 'the file system does not support this function',0 -error3 db 'filesystem sconosciuto',0 -error4 db 'strange... Error 4',0 -error5 db 'percorso non valido',0 -error6 db 'end of file',0 -error7 db 'pointer is outside of application memory',0 -error8 db 'disco pieno',0 -error9 db 'tabella FAT corrotta',0 -error10 db 'accesso negato',0 -error11 db 'Errore di device',0 -aUnknownError db 'Errore sconosciuto',0 -rdError db "You can't save image on itself",0 -error db 'Errore: ',0 -;--------------------------------------------------------------------- -else -save db ' Save',0 -cancel db 'Cancel',0 -select db ' Select',0 -label1 db ' RAM-drive will be saved as: ',0 -label2 db 'Saving in progress...',0 -ok db 'RAM-drive was saved successfully ',0 -error1 db 'hard disk base and/or partition not defined',0 -error2 db 'the file system does not support this function',0 -error3 db 'unknown file system',0 -error4 db 'strange... Error 4',0 -error5 db 'incorrect path',0 -error6 db 'end of file',0 -error7 db 'pointer is outside of application memory',0 -error8 db 'disk is full',0 -error9 db 'file structure is destroyed',0 -error10 db 'access denied',0 -error11 db 'Device error',0 -aUnknownError db 'Unknown error',0 -rdError db "You can't save image on itself",0 -error db 'Error: ',0 -end if -;--------------------------------------------------------------------- -ntf_start db '"RDSave\n', 0 -ntf_end_o db '" -tO', 0 -ntf_end_e db '" -tE', 0 -;--------------------------------------------------------------------- -errors: - dd ok - dd error1 - dd error2 - dd error3 - dd error4 - dd error5 - dd error6 - dd error7 - dd error8 - dd error9 - dd error10 - dd error11 -;--------------------------------------------------------------------- - -title db appname,version,0 - -;Lib_DATA -;ᥣ ᮡ ᫥⥫쭮 . -system_dir_Boxlib db '/sys/lib/box_lib.obj',0 -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 -system_dir_libini db '/sys/lib/libini.obj',0 -;--------------------------------------------------------------------- -l_libs_start: - -library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ - Box_lib_import - -library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ - ProcLib_import - -library03 l_libs system_dir_libini+9, library_path, system_dir_libini, \ - libini_import - -end_l_libs: -;--------------------------------------------------------------------- -OpenDialog_data: -.type dd 1 ; Save -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd temp_dir_path ;+16 -.dir_default_path dd communication_area_default_path ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd fname_buf ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 200 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 120 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: -if __nightbuild eq yes - db '/sys/MANAGERS/opendial',0 -else - db '/sys/File Managers/opendial',0 -end if -communication_area_default_path: - db '/',0 - -Filter: -dd Filter.end - Filter -.1: -db 'IMG',0 -db 'IMA',0 -.end: -db 0 - -start_temp_file_name: db 'kolibri.img',0 - -;--------------------------------------------------------------------- -align 4 -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start - dd 0,0 -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 -;--------------------------------------------------------------------- -PathShow_data_1: -.type dd 0 ;+0 -.start_y dw 36 ;+4 -.start_x dw 20 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 -.area_size_x dw 270 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable -.background_flag dd 0 ;+16 -.font_color dd 0 ;+20 -.background_color dd 0 ;+24 -.text_pointer dd fname_buf ;+28 -.work_area_pointer dd text_work_area ;+32 -.temp_text_length dd 0 ;+36 -;--------------------------------------------------------------------- -align 4 -Box_lib_import: -;edit_box_draw dd aEdit_box_draw -;edit_box_key dd aEdit_box_key -;edit_box_mouse dd aEdit_box_mouse -;version_ed dd aVersion_ed - -PathShow_prepare dd sz_PathShow_prepare -PathShow_draw dd sz_PathShow_draw -Frame_draw dd sz_Frame_draw - dd 0,0 - -;aEdit_box_draw db 'edit_box_draw',0 -;aEdit_box_key db 'edit_box_key',0 -;aEdit_box_mouse db 'edit_box_mouse',0 -;aVersion_ed db 'version_ed',0 - -sz_PathShow_prepare db 'PathShow_prepare',0 -sz_PathShow_draw db 'PathShow_draw',0 - -sz_Frame_draw db 'frame_draw',0 -;szVersion_frame db 'version_frame',0 -;--------------------------------------------------------------------- -frame_data: -.type dd 0 ;+0 -.x: -.x_size dw 374 ;+4 -.x_start dw 8 ;+6 -.y: -.y_size dw 45 ;+8 -.y_start dw 17 ;+10 -.ext_fr_col dd 0x888888 ;+12 -.int_fr_col dd 0xffffff ;+16 -.draw_text_flag dd 1 ;+20 -.text_pointer dd label1 ;+24 -.text_position dd 0 ;+28 -.font_number dd 0 ;+32 -.font_size_y dd 9 ;+36 -.font_color dd 0x0 ;+40 -.font_backgr_color dd 0xdddddd ;+44 -;--------------------------------------------------------------------- -align 4 -libini_import: -init_lib dd a_init -ini_get_str dd aini_get_str -ini_get_int dd aini_get_int -ini_set_str dd aini_set_str -ini_set_int dd aini_set_int - dd 0,0 -a_init db 'lib_init',0 -aini_get_str db 'ini_get_str',0 -aini_get_int db 'ini_get_int',0 -aini_set_str db 'ini_set_str',0 -aini_set_int db 'ini_set_int',0 -;--------------------------------------------------------------------- - -ini_file db '/sys/settings/app.ini',0 -ini_section db 'RDSave',0 -apath db 'path',0 -aautoclose db 'autoclose',0 -path db '/hd2/1/kolibri.img',0 -;--------------------------------------------------------------------- -is_notify: - dd 7, 0, ok, 0, 0 - db "/sys/@notify", 0 - -read_folder: -.subfunction dd 1 -.start dd 0 -.flags dd 0 -.size dd 1 -.return dd folder_data - db 0 -.name: dd check_dir - -param dd 0 -hidden dd 0 -;--------------------------------------------------------------------- -IM_END: -;--------------------------------------------------------------------- -align 4 -PARAMS: - rb 256 -ini_path: - rb 4096 -check_dir: - rb 4096 - -sc system_colors - -autoclose rd 1 - -color rd 1 - -msg: - rb 1024 - -ntf_msg: - rb 1024 - -folder_data: - rb 304*32+32 ; 9 Kb -;--------------------------------------------------------------------- -cur_dir_path: - rb 4096 -;--------------------------------------------------------------------- -library_path: - rb 4096 -;--------------------------------------------------------------------- -temp_dir_path: - rb 4096 -;--------------------------------------------------------------------- -fname_buf: - rb 4096 -;--------------------------------------------------------------------- -procinfo: - rb 1024 -;--------------------------------------------------------------------- -filename_area: - rb 256 -;--------------------------------------------------------------------- -text_work_area: - rb 1024 -;--------------------------------------------------------------------- -align 32 - rb 4096 -stacktop: -I_END: +; RDsave Kolibri (0.6.5.0 ) +; Save RAM-disk to hard or floppy drive +;--------------------------------------------------------------------- +; Mario79 2005 +; Heavyiron 12.02.2007 +; 11.05.2009 - ࠡ 㦭 ⥬ ⥪ box_lib.obj +; Mario79 08.09.2010 - select path with OpenDialog,keys 1,2,3,4 for select options +; Heavyiron 01.12.2013 - new logic +;--------------------------------------------------------------------- +appname equ 'RDsave ' +version equ '1.44' +debug equ no + +use32 ; 32- ० ᥬ +org 0x0 ; + +db 'MENUET01' ; 8- 䨪 MenuetOS +dd 0x01 ; (ᥣ 1) +dd START ; ࢮ +dd IM_END ; ࠧ ணࠬ +dd I_END ; ⢮ +dd stacktop ; 設 ⥪ +dd PARAMS ; ࠬ஢ +dd cur_dir_path + + +include 'lang.inc' ; Language support for locales: ru_RU (CP866), et_EE, it_IT, en_US. +include '../../../macros.inc' +if debug eq yes +include '../../../debug.inc' +end if +include '../../../proc32.inc' +include '../../../dll.inc' +include '../../../KOSfuncs.inc' +include '../../../load_lib.mac' +include '../../../develop/libraries/box_lib/trunk/box_lib.mac' +include 'str.inc' + + @use_library +;--------------------------------------------------------------------- +;--- ---------------------------------------------- +;--------------------------------------------------------------------- +align 4 +START: +;--------------------------------------------------------------------- + mcall 68,11 + +load_libraries l_libs_start,end_l_libs + inc eax + test eax,eax + jz close + + stdcall dll.Init,[init_lib] + + invoke ini_get_int,ini_file,ini_section,aautoclose,0 + mov [autoclose],eax + invoke ini_get_str,ini_file,ini_section,apath,fname_buf,4096,path + stdcall _lstrcpy,ini_path,fname_buf + stdcall _lstrcpy,filename_area,start_temp_file_name + + mov eax,PARAMS + cmp byte[eax], 0 + je no_params + cmp byte[eax], 'h' + je @f + cmp byte[eax], 'H' + jne .no_h +@@: + mov [hidden],1 + jmp no_params +.no_h: + mov [param],1 + stdcall _lstrcpy,fname_buf,eax + mov ah,2 + jmp noclose + +;--------------------------------------------------------------------- +no_params: + stdcall _lstrcpy,check_dir,ini_path + call check_path + test eax,eax + jz path_ok + cmp eax,6 + je path_ok +;--------------------------------------------------------------------- +if debug eq yes +dps 'read_folder_error' +newline +end if +;--------------------------------------------------------------------- +default_path: + stdcall _lstrcpy,fname_buf,communication_area_default_path + mov [hidden],0 + +;OpenDialog initialisation + push dword OpenDialog_data + call [OpenDialog_Init] + +; prepare for PathShow + push dword PathShow_data_1 + call [PathShow_prepare] + + mcall 40,0x00000027 + + call draw_window + mov ah,3 + jmp noclose +;--------------------------------------------------------------------- +path_ok: +;OpenDialog initialisation + push dword OpenDialog_data + call [OpenDialog_Init] + +; prepare for PathShow + push dword PathShow_data_1 + call [PathShow_prepare] + + mcall 40,0x00000027 + + cmp [hidden],1 + jne red + mov ah,2 + jmp noclose +red: + call draw_window +;--------------------------------------------------------------------- +still: + mcall 10 + + dec eax ; ᮢ ? + jz red ; ᫨ - red + dec eax + jz key + dec eax + jz button + jmp still +;--------------------------------------------------------------------- +button: + mcall 17 ; 䨪 ⮩ + cmp ah,1 ; id=1("")? + jne noclose +close: + mcall -1 ; 㭪 -1: ணࠬ + +;--------------------------------------------------------------------- +key: + mcall 2 + cmp ah,0x1b + je close + cmp ah,0x0D + jne @f + mov ah,2 + jmp noclose +@@: + cmp ah,9h + jne still +;--------------------------------------------------------------------- +noclose: + mov ecx,fname_buf + push 16 + mov ebx,1 + cmp byte[ecx+1],'f' + je @f + cmp byte[ecx+1],'F' + jne not_fdd +@@: + cmp byte[ecx+4],'1' + jne @f + cmp ah,2 + je doit +@@: + inc ebx + cmp ah,2 + je doit +not_fdd: + push 18 + mov ebx,6 ; 18.6 = save to specified folder + cmp ah,2 + je doit + +; invoke OpenDialog + push dword OpenDialog_data + call [OpenDialog_Start] + cmp [OpenDialog_data.status],1 + jne still + +; prepare for PathShow + push dword PathShow_data_1 + call [PathShow_prepare] + call draw_window + mov ah,2 + jmp noclose + +doit: + cmp [param],0 + jne @f + call save_ini +@@: + cmp byte[ecx+1],'r' + je @f + cmp byte[ecx+1],'R' + je @f + cmp byte[ecx],'/' + je not_rd +@@: + mov edx,rdError + call print_err + jmp still +not_rd: + cmp [hidden],0 + jne @f + pusha + stdcall _lstrcpy,msg,label2 + mov eax,[sc.work_text] + or eax,0xc0000088 + mov [color],eax + call print_msg + popa +@@: + pop eax + mcall + call check_for_error + jmp still + +;--------------------------------------------------------------------- +check_for_error: ;ࠡ稪 訡 + test eax,eax + jz print_ok + cmp ebx,6 + je @f + mov edx,error11 + jmp print_err +@@: + cmp eax, 11 + ja .unknown + mov edx, [errors+eax*4] + stdcall _lstrcpy,msg,error + stdcall _lstrcat,msg,edx + mov edx,msg + jmp print_err +.unknown: + mov edx, aUnknownError + +print_err: + stdcall _lstrlen,ini_path + pusha + invoke ini_set_str,ini_file,ini_section,apath,ini_path,eax + popa + stdcall _lstrcpy,msg,edx + cmp [hidden],1 + je @f + cmp [param],1 + je @f + mov ecx,[sc.work_text] + or ecx,0xc0880000 + mov [color],ecx + call print_msg + ret +@@: + stdcall _lstrcpy, ntf_msg, ntf_start + stdcall _lstrcat, ntf_msg, edx + stdcall _lstrcat, ntf_msg, ntf_end_e + mov dword [is_notify + 8], ntf_msg + mcall 70, is_notify + mov [param],0 + mov [hidden],0 + stdcall _lstrcpy,fname_buf,ini_path + jmp no_params + +print_ok: + cmp [hidden],1 + je @f + cmp [param],1 + je @f + stdcall _lstrcpy,msg,ok + mov ecx,[sc.work_text] + or ecx,0xc0008800 + mov [color],ecx + call print_msg + mcall 5,100 + cmp [autoclose],1 + je close + ret +@@: + stdcall _lstrcpy,msg,ok + stdcall _lstrcat,msg,fname_buf + stdcall _lstrcpy, ntf_msg, ntf_start + stdcall _lstrcat, ntf_msg, msg + stdcall _lstrcat, ntf_msg, ntf_end_o + mov edx,ntf_msg + mov dword [is_notify + 8], edx + mcall 70, is_notify + mcall 5,100 + jmp close +;--------------------------------------------------------------------- +print_msg: + mcall 13,<5,380>,<96,10>,[sc.work] + stdcall _lstrlen,msg + lea eax,[eax+eax*2] + add eax,eax + mov ebx,390 + sub ebx,eax + shl ebx,15 + add ebx,96 + mcall 4, ,[color],msg, ,[sc.work] + ret +;--------------------------------------------------------------------- +draw_PathShow: + pusha + mcall 13,<15,280>,<32,16>,0xffffff + push dword PathShow_data_1 + call [PathShow_draw] + popa + ret +;--------------------------------------------------------------------- +save_ini: + pusha + stdcall _lstrlen,fname_buf + invoke ini_set_str,ini_file,ini_section,apath,fname_buf,eax + invoke ini_set_int,ini_file,ini_section,aautoclose,[autoclose] + popa + ret +;--------------------------------------------------------------------- +check_path: +stdcall _lstrlen,check_dir + add eax,check_dir +@@: + dec eax + cmp byte [eax],'/' + jne @b + mov byte [eax+1],0 + + mcall 70,read_folder + ret +;--------------------------------------------------------------------- +;--- Draw window --------------------------------------------------- +;--------------------------------------------------------------------- +draw_window: + mcall 48,3,sc,sizeof.system_colors + mcall 12,1 + + mcall 48,4 + mov ecx,200*65536+111 + add ecx,eax + + mov edx,[sc.work] + or edx,0x34000000 + mcall 0,<200,400>,, , ,title + +;buttons + mcall 8,<198,70>,<68,20>,1,[sc.work_button] + inc edx + mcall ,<125,70>, + inc edx + mcall ,<300,75>,<30,20> + +;labels + mov ecx,[sc.work_button_text] + or ecx,0x80000000 + mcall 4,<134,75>, ,save + mcall ,<215,75>, ,cancel + mcall ,<315,36>, ,select + + m2m dword [frame_data.font_backgr_color],[sc.work] + m2m dword [frame_data.font_color],[sc.work_text] + m2m dword [frame_data.ext_fr_col],[sc.work_graph] + m2m dword [frame_data.int_fr_col],[sc.work_light] + + push dword frame_data + call [Frame_draw] + + call draw_PathShow + call print_msg + + mcall 12,2 + ret + +;--------------------------------------------------------------------- +;--- Data ---------------------------------------------------------- +;--------------------------------------------------------------------- +if lang eq ru_RU +save db '࠭',0 +cancel db '⬥',0 +select db '',0 +label1 db ' ࠧ 㤥 ࠭ : ',0 +label2 db '࠭ ࠧ...',0 +ok db 'RAM- ࠭ ᯥ譮 ',0 +error1 db ' । / ࠧ ⪮ ᪠',0 +error2 db '㭪 ন 䠩 ⥬',0 +error3 db '⭠ 䠩 ⥬',0 +error4 db '࠭... 訡 4',0 +error5 db '騩 ',0 +error6 db '䠩 稫',0 +error7 db '㪠⥫ ਫ',0 +error8 db ' ',0 +error9 db '䠩 ࠧ襭',0 +error10 db ' ',0 +error11 db '訡 ன⢠',0 +aUnknownError db '⭠ 訡',0 +rdError db ' ࠭ ࠧ ᠬ ᥡ',0 +error db '訡: ',0 +;--------------------------------------------------------------------- +else if lang eq et_EE +save db 'Salvesta',0 +cancel db 'Cancel',0 +select db ' Valige',0 +label1 db ' RAM-drive will be saved as: ',0 +label2 db 'Saving in progress...',0 +ok db 'RAM-ketas salvestatud edukalt ',0 +error1 db 'hard disk base and/or partition not defined',0 +error2 db 'the file system does not support this function',0 +error3 db 'tundmatu failissteem',0 +error4 db 'strange... Error 4',0 +error5 db 'vigane teekond',0 +error6 db 'end of file',0 +error7 db 'pointer is outside of application memory',0 +error8 db 'ketas tis',0 +error9 db 'FAT tabel vigane',0 +error10 db 'juurdeps keelatud',0 +error11 db 'Seadme viga',0 +aUnknownError db 'Tundmatu viga',0 +rdError db "You can't save image on itself",0 +error db 'Viga: ',0 +;--------------------------------------------------------------------- +else if lang eq it_IT +save db ' Salva',0 +cancel db 'Cancel',0 +select db 'Seleziona',0 +label1 db ' RAM-drive will be saved as: ',0 +label2 db 'Saving in progress...',0 +ok db 'Il RAM-drivet e stato salvato ',0 +error1 db 'hard disk base and/or partition not defined',0 +error2 db 'the file system does not support this function',0 +error3 db 'filesystem sconosciuto',0 +error4 db 'strange... Error 4',0 +error5 db 'percorso non valido',0 +error6 db 'end of file',0 +error7 db 'pointer is outside of application memory',0 +error8 db 'disco pieno',0 +error9 db 'tabella FAT corrotta',0 +error10 db 'accesso negato',0 +error11 db 'Errore di device',0 +aUnknownError db 'Errore sconosciuto',0 +rdError db "You can't save image on itself",0 +error db 'Errore: ',0 +;--------------------------------------------------------------------- +else ; Default to en_US +save db ' Save',0 +cancel db 'Cancel',0 +select db ' Select',0 +label1 db ' RAM-drive will be saved as: ',0 +label2 db 'Saving in progress...',0 +ok db 'RAM-drive was saved successfully ',0 +error1 db 'hard disk base and/or partition not defined',0 +error2 db 'the file system does not support this function',0 +error3 db 'unknown file system',0 +error4 db 'strange... Error 4',0 +error5 db 'incorrect path',0 +error6 db 'end of file',0 +error7 db 'pointer is outside of application memory',0 +error8 db 'disk is full',0 +error9 db 'file structure is destroyed',0 +error10 db 'access denied',0 +error11 db 'Device error',0 +aUnknownError db 'Unknown error',0 +rdError db "You can't save image on itself",0 +error db 'Error: ',0 +end if +;--------------------------------------------------------------------- +ntf_start db '"RDSave\n', 0 +ntf_end_o db '" -tO', 0 +ntf_end_e db '" -tE', 0 +;--------------------------------------------------------------------- +errors: + dd ok + dd error1 + dd error2 + dd error3 + dd error4 + dd error5 + dd error6 + dd error7 + dd error8 + dd error9 + dd error10 + dd error11 +;--------------------------------------------------------------------- + +title db appname,version,0 + +;Lib_DATA +;ᥣ ᮡ ᫥⥫쭮 . +system_dir_Boxlib db '/sys/lib/box_lib.obj',0 +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 +system_dir_libini db '/sys/lib/libini.obj',0 +;--------------------------------------------------------------------- +l_libs_start: + +library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ + Box_lib_import + +library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ + ProcLib_import + +library03 l_libs system_dir_libini+9, library_path, system_dir_libini, \ + libini_import + +end_l_libs: +;--------------------------------------------------------------------- +OpenDialog_data: +.type dd 1 ; Save +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd temp_dir_path ;+16 +.dir_default_path dd communication_area_default_path ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd fname_buf ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 200 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 120 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: +if __nightbuild eq yes + db '/sys/MANAGERS/opendial',0 +else + db '/sys/File Managers/opendial',0 +end if +communication_area_default_path: + db '/',0 + +Filter: +dd Filter.end - Filter +.1: +db 'IMG',0 +db 'IMA',0 +.end: +db 0 + +start_temp_file_name: db 'kolibri.img',0 + +;--------------------------------------------------------------------- +align 4 +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start + dd 0,0 +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 +;--------------------------------------------------------------------- +PathShow_data_1: +.type dd 0 ;+0 +.start_y dw 36 ;+4 +.start_x dw 20 ;+6 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.area_size_x dw 270 ;+10 +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.background_flag dd 0 ;+16 +.font_color dd 0 ;+20 +.background_color dd 0 ;+24 +.text_pointer dd fname_buf ;+28 +.work_area_pointer dd text_work_area ;+32 +.temp_text_length dd 0 ;+36 +;--------------------------------------------------------------------- +align 4 +Box_lib_import: +;edit_box_draw dd aEdit_box_draw +;edit_box_key dd aEdit_box_key +;edit_box_mouse dd aEdit_box_mouse +;version_ed dd aVersion_ed + +PathShow_prepare dd sz_PathShow_prepare +PathShow_draw dd sz_PathShow_draw +Frame_draw dd sz_Frame_draw + dd 0,0 + +;aEdit_box_draw db 'edit_box_draw',0 +;aEdit_box_key db 'edit_box_key',0 +;aEdit_box_mouse db 'edit_box_mouse',0 +;aVersion_ed db 'version_ed',0 + +sz_PathShow_prepare db 'PathShow_prepare',0 +sz_PathShow_draw db 'PathShow_draw',0 + +sz_Frame_draw db 'frame_draw',0 +;szVersion_frame db 'version_frame',0 +;--------------------------------------------------------------------- +frame_data: +.type dd 0 ;+0 +.x: +.x_size dw 374 ;+4 +.x_start dw 8 ;+6 +.y: +.y_size dw 45 ;+8 +.y_start dw 17 ;+10 +.ext_fr_col dd 0x888888 ;+12 +.int_fr_col dd 0xffffff ;+16 +.draw_text_flag dd 1 ;+20 +.text_pointer dd label1 ;+24 +.text_position dd 0 ;+28 +.font_number dd 0 ;+32 +.font_size_y dd 9 ;+36 +.font_color dd 0x0 ;+40 +.font_backgr_color dd 0xdddddd ;+44 +;--------------------------------------------------------------------- +align 4 +libini_import: +init_lib dd a_init +ini_get_str dd aini_get_str +ini_get_int dd aini_get_int +ini_set_str dd aini_set_str +ini_set_int dd aini_set_int + dd 0,0 +a_init db 'lib_init',0 +aini_get_str db 'ini_get_str',0 +aini_get_int db 'ini_get_int',0 +aini_set_str db 'ini_set_str',0 +aini_set_int db 'ini_set_int',0 +;--------------------------------------------------------------------- + +ini_file db '/sys/settings/app.ini',0 +ini_section db 'RDSave',0 +apath db 'path',0 +aautoclose db 'autoclose',0 +path db '/hd2/1/kolibri.img',0 +;--------------------------------------------------------------------- +is_notify: + dd 7, 0, ok, 0, 0 + db "/sys/@notify", 0 + +read_folder: +.subfunction dd 1 +.start dd 0 +.flags dd 0 +.size dd 1 +.return dd folder_data + db 0 +.name: dd check_dir + +param dd 0 +hidden dd 0 +;--------------------------------------------------------------------- +IM_END: +;--------------------------------------------------------------------- +align 4 +PARAMS: + rb 256 +ini_path: + rb 4096 +check_dir: + rb 4096 + +sc system_colors + +autoclose rd 1 + +color rd 1 + +msg: + rb 1024 + +ntf_msg: + rb 1024 + +folder_data: + rb 304*32+32 ; 9 Kb +;--------------------------------------------------------------------- +cur_dir_path: + rb 4096 +;--------------------------------------------------------------------- +library_path: + rb 4096 +;--------------------------------------------------------------------- +temp_dir_path: + rb 4096 +;--------------------------------------------------------------------- +fname_buf: + rb 4096 +;--------------------------------------------------------------------- +procinfo: + rb 1024 +;--------------------------------------------------------------------- +filename_area: + rb 256 +;--------------------------------------------------------------------- +text_work_area: + rb 1024 +;--------------------------------------------------------------------- +align 32 + rb 4096 +stacktop: +I_END: diff --git a/programs/system/run/trunk/run.asm b/programs/system/run/trunk/run.asm index b81fd3901..a4046c644 100644 --- a/programs/system/run/trunk/run.asm +++ b/programs/system/run/trunk/run.asm @@ -7,7 +7,7 @@ include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include 'txtbut.inc' include '../../../macros.inc' include 'run.mac' -include 'lang.inc' +include 'lang.inc' ; Language support for locales: ru_RU (CP866), it_IT, en_US. use32 org 0 db 'MENUET01' @@ -263,7 +263,7 @@ else if lang eq it_IT run_ok db 'Il programma eseguito correttamente',0 grab_text db 'RUN',0 run_but_text db 'Esegui',0 -else +else ; Default to en_US hello db 'Enter full path to file and press ',0 bad_file_sys db 'Unknown file system',0 ; 3 file_not_find db 'File not found',0 ; 5 diff --git a/programs/system/skincfg/trunk/idata.inc b/programs/system/skincfg/trunk/idata.inc index 4992bc971..245d8c0c3 100644 --- a/programs/system/skincfg/trunk/idata.inc +++ b/programs/system/skincfg/trunk/idata.inc @@ -1,387 +1,385 @@ -;----------------------------------------------------------------------------- -text: -if lang eq ru_RU - db ' Unused1 ' - db ' Unused2 ' - db ' 3d ⥬ ஭ ' - db ' 3d ᢥ⫠ ஭ ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' ' - db ' 䨪 ' - db 'x' -else if lang eq et_EE - db ' Unused1 ' - db ' Unused2 ' - db ' 3d dark ' - db ' 3d light ' - db ' Akna pealkiri ' - db ' Akna tpiirkond ' - db ' Akna tpiirkonna nupp ' - db ' Akna tpiirkonna nuppu tekst ' - db ' Akna tpiirkonna tekst ' - db ' Akna tpiirkonna graafika ' - db 'x' -else - db ' Unused1 ' - db ' Unused2 ' - db ' 3d dark ' - db ' 3d light ' - db ' Window title ' - db ' Window background ' - db ' Button ' - db ' Button text ' - db ' Window text ' - db ' Window graph ' - db 'x' -end if -;----------------------------------------------------------------------------- -if lang eq ru_RU - sz t1,' ' -else if lang eq et_EE - sz t1,' LAADI SALVESTA KINNITA' -else - sz t1,' LOAD SAVE APPLY' -end if -;----------------------------------------------------------------------------- -if lang eq ru_RU - sz t2,' 3D ' -else if lang eq et_EE - sz t2,' LAADI 3D LAME KINNITA' -else - sz t2,' LOAD 3D FLAT APPLY' -end if -;----------------------------------------------------------------------------- -select_dtp_text: -if lang eq ru_RU - db ' 롮 梥⮢ ଫ: ',0 -else if lang eq et_EE - db ' Valik varviskeeme: ',0 -else - db ' Choice of color schemes: ',0 -end if -;----------------------------------------------------------------------------- -select_skin_text: -if lang eq ru_RU - db ' 롮 ᪨: ',0 -else if lang eq et_EE - db ' Valik nahad: ',0 -else - db ' Choice of skins: ',0 -end if -;----------------------------------------------------------------------------- -if lang eq ru_RU - sz caption_text,'' -else if lang eq et_EE - sz caption_text,'Pealkiri' -else - sz caption_text,'Caption' -end if -;----------------------------------------------------------------------------- -sz close_text,'x' -;----------------------------------------------------------------------------- -if lang eq ru_RU - sz window_text,' ' -else if lang eq et_EE - sz window_text,'Akna tekst' -else - sz window_text,'Window text' -end if -;----------------------------------------------------------------------------- -if lang eq ru_RU - sz button_text,' ' -else if lang eq et_EE - sz button_text,'Nupu tekst' -else - sz button_text,'Button text' -end if -;----------------------------------------------------------------------------- -if lang eq ru_RU - title db 'ன ',0 -else if lang eq et_EE - title db 'Akna seaded',0 -else if lang eq it_IT - title db 'Impostazioni',0 -else - title db 'Windows settings',0 -end if -;--------------------------------------------------------------------- -LibIniImportTable: -library \ - libini, 'libini.obj' - -import libini, \ - ini_set_int ,'ini_set_int' - -aIni db '/sys/settings/system.ini',0 -aSectionSkn db 'style',0 -aButtonStyle db 'buttons_gradient',0 -;--------------------------------------------------------------------- -l_libs_start: - -library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ - Box_lib_import - -library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ - ProcLib_import - -end_l_libs: -;--------------------------------------------------------------------- -system_dir_Boxlib db '/sys/lib/box_lib.obj',0 -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 - -;--------------------------------------------------------------------- -align 4 - -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start - -ColorDialog_Init dd aColorDialog_Init -ColorDialog_Start dd aColorDialog_Start -;OpenDialog__Version dd aOpenDialog_Version - dd 0 - dd 0 - -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 - -aColorDialog_Init db 'ColorDialog_init',0 -aColorDialog_Start db 'ColorDialog_start',0 -;aOpenDialog_Version db 'Version_OpenDialog',0 -;--------------------------------------------------------------------- -align 4 -Box_lib_import: -;init_lib dd a_init -;version_lib dd a_version - - -;edit_box_draw dd aEdit_box_draw -;edit_box_key dd aEdit_box_key -;edit_box_mouse dd aEdit_box_mouse -;version_ed dd aVersion_ed - -;check_box_draw dd aCheck_box_draw -;check_box_mouse dd aCheck_box_mouse -;version_ch dd aVersion_ch - -;option_box_draw dd aOption_box_draw -;option_box_mouse dd aOption_box_mouse -;version_op dd aVersion_op - -;scrollbar_ver_draw dd aScrollbar_ver_draw -;scrollbar_ver_mouse dd aScrollbar_ver_mouse -;scrollbar_hor_draw dd aScrollbar_hor_draw -;scrollbar_hor_mouse dd aScrollbar_hor_mouse -;version_scrollbar dd aVersion_scrollbar - -;dinamic_button_draw dd aDbutton_draw -;dinamic_button_mouse dd aDbutton_mouse -;version_dbutton dd aVersion_dbutton - -;menu_bar_draw dd aMenu_bar_draw -;menu_bar_mouse dd aMenu_bar_mouse -;menu_bar_activate dd aMenu_bar_activate -;version_menu_bar dd aVersion_menu_bar - -;FileBrowser_draw dd aFileBrowser_draw -;FileBrowser_mouse dd aFileBrowser_mouse -;FileBrowser_key dd aFileBrowser_key -;Version_FileBrowser dd aVersion_FileBrowser - -PathShow_prepare dd sz_PathShow_prepare -PathShow_draw dd sz_PathShow_draw -;Version_path_show dd szVersion_path_show - -Frame_draw dd sz_Frame_draw -;Version_frame dd szVersion_frame - - dd 0,0 - -;a_init db 'lib_init',0 -;a_version db 'version',0 - -;aEdit_box_draw db 'edit_box_draw',0 -;aEdit_box_key db 'edit_box_key',0 -;aEdit_box_mouse db 'edit_box_mouse',0 -;aVersion_ed db 'version_ed',0 - -;aCheck_box_draw db 'check_box_draw',0 -;aCheck_box_mouse db 'check_box_mouse',0 -;aVersion_ch db 'version_ch',0 - -;aOption_box_draw db 'option_box_draw',0 -;aOption_box_mouse db 'option_box_mouse',0 -;aVersion_op db 'version_op',0 - -;aScrollbar_ver_draw db 'scrollbar_v_draw',0 -;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 -;aScrollbar_hor_draw db 'scrollbar_h_draw',0 -;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 -;aVersion_scrollbar db 'version_scrollbar',0 - -;aDbutton_draw db 'dbutton_draw',0 -;aDbutton_mouse db 'dbutton_mouse',0 -;aVersion_dbutton db 'version_dbutton',0 - -;aMenu_bar_draw db 'menu_bar_draw',0 -;aMenu_bar_mouse db 'menu_bar_mouse',0 -;aMenu_bar_activate db 'menu_bar_activate',0 -;aVersion_menu_bar db 'version_menu_bar',0 - -;aFileBrowser_draw db 'FileBrowser_draw',0 -;aFileBrowser_mouse db 'FileBrowser_mouse',0 -;aFileBrowser_key db 'FileBrowser_key',0 -;aVersion_FileBrowser db 'version_FileBrowser',0 - -sz_PathShow_prepare db 'PathShow_prepare',0 -sz_PathShow_draw db 'PathShow_draw',0 -;szVersion_path_show db 'version_PathShow',0 - -sz_Frame_draw db 'frame_draw',0 -;szVersion_frame db 'version_frame',0 -;--------------------------------------------------------------------- -PathShow_data_1: -.type dd 0 ;+0 -.start_y dw frame_1.y+19 ;+4 -.start_x dw frame_1.x+15 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 -.area_size_x dw frame_1.w-28 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable -.background_flag dd 0 ;+16 -.font_color dd 0x0 ;+20 -.background_color dd 0x0 ;+24 -.text_pointer dd dtp_name ;+28 -.work_area_pointer dd text_work_area ;+32 -.temp_text_length dd 0 ;+36 -;--------------------------------------------------------------------- -PathShow_data_2: -.type dd 0 ;+0 -.start_y dw frame_2.y+19 ;+4 -.start_x dw frame_2.x+15 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 -.area_size_x dw frame_2.w-28 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable -.background_flag dd 0 ;+16 -.font_color dd 0x0 ;+20 -.background_color dd 0x0 ;+24 -.text_pointer dd skin_info ;+28 -.work_area_pointer dd text_work_area2 ;+32 -.temp_text_length dd 0 ;+36 -;--------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd dtp_name ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -OpenDialog_data2: -.type dd 0 -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name2 ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach2 ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd skin_info ;+36 -.filename_area dd filename_area2 ;+40 -.filter_area dd Filter2 -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -communication_area_name2: - db 'FFFFFFFF_open_dialog',0 - -communication_area_name: - db 'FFFFFFFF_open_dialog2',0 -open_dialog_path: -if __nightbuild eq yes - db '/sys/MANAGERS/opendial',0 -else - db '/sys/File Managers/opendial',0 -end if -communication_area_default_pach: - db '/sys',0 - -Filter: - dd Filter.end - Filter -.1: - db 'DTP',0 -.end: - db 0 - -Filter2: - dd Filter.end - Filter -.1: - db 'SKN',0 -.end: - db 0 - -default_skin: - db '/sys/default.skn',0 -default_dtp: - db '/sys/default.dtp',0 -;--------------------------------------------------------------------- -ColorDialog_data: -.type dd 0 -.procinfo dd procinfo ;+4 -.com_area_name dd cd_communication_area_name ;+8 -.com_area dd 0 ;+12 -.start_path dd colordialog_path ;+16 -.draw_window dd draw_window ;+20 -.status dd 0 ;+24 -.x: -.x_size dw 510 ;+28 ; Window X size -.x_start dw 10 ;+30 ; Window X position -.y: -.y_size dw 310 ;+32 ; Window y size -.y_start dw 10 ;+34 ; Window Y position -.color_type dd 0 ;+36 ; 0- RGB, 1 or other - reserved -.color dd 0 ;+40 ; Selected color - -cd_communication_area_name: - db 'FFFFFFFF_color_dialog',0 -colordialog_path: - db '/sys/colrdial',0 -;--------------------------------------------------------------------- -frame_data: -.type dd 0 ;+0 -.x: -.x_size dw 0 ;+4 -.x_start dw 0 ;+6 -.y: -.y_size dw 0 ;+8 -.y_start dw 0 ;+10 -.ext_fr_col dd 0x0 ;+12 -.int_fr_col dd 0xffffff ;+16 -.draw_text_flag dd 1 ;+20 -.text_pointer dd 0 ;+24 -.text_position dd 0 ;+28 -.font_number dd 1 ;+32 -.font_size_y dd 14 ;+36 -.font_color dd 0x0 ;+40 -.font_backgr_color dd 0xffffff ;+44 -;--------------------------------------------------------------------- -IncludeIGlobals + ; Language support for locales: ru_RU (CP866), et_EE, en_US. + +;----------------------------------------------------------------------------- +text: + db ' Unused1 ' + db ' Unused2 ' +if lang eq ru_RU + db ' 3D ⥬ ஭ ' + db ' 3D ᢥ⫠ ஭ ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' ' + db ' 䨪 ' + db 'x' +else if lang eq et_EE + db ' 3D dark ' + db ' 3D light ' + db ' Akna pealkiri ' + db ' Akna tpiirkond ' + db ' Akna tpiirkonna nupp ' + db ' Akna tpiirkonna nuppu tekst ' + db ' Akna tpiirkonna tekst ' + db ' Akna tpiirkonna graafika ' + db 'x' +else ; Default to en_US + db ' 3D dark ' + db ' 3D light ' + db ' Window title ' + db ' Window background ' + db ' Button ' + db ' Button text ' + db ' Window text ' + db ' Window graph ' + db 'x' +end if +;----------------------------------------------------------------------------- +if lang eq ru_RU + sz t1,' ' +else if lang eq et_EE + sz t1,' LAADI SALVESTA KINNITA' +else ; Default to en_US + sz t1,' LOAD SAVE APPLY' +end if +;----------------------------------------------------------------------------- +if lang eq ru_RU + sz t2,' 3D ' +else if lang eq et_EE + sz t2,' LAADI 3D LAME KINNITA' +else ; Default to en_US + sz t2,' LOAD 3D FLAT APPLY' +end if +;----------------------------------------------------------------------------- +select_dtp_text: +if lang eq ru_RU + db ' 롮 梥⮢ ଫ: ',0 +else if lang eq et_EE + db ' Valik varviskeeme: ',0 +else ; Default to en_US + db ' Choice of color schemes: ',0 +end if +;----------------------------------------------------------------------------- +select_skin_text: +if lang eq ru_RU + db ' 롮 ᪨: ',0 +else if lang eq et_EE + db ' Valik nahad: ',0 +else ; Default to en_US + db ' Choice of skins: ',0 +end if +;----------------------------------------------------------------------------- +if lang eq ru_RU + sz caption_text,'' +else if lang eq et_EE + sz caption_text,'Pealkiri' +else ; Default to en_US + sz caption_text,'Caption' +end if +;----------------------------------------------------------------------------- +sz close_text,'x' +;----------------------------------------------------------------------------- +if lang eq ru_RU + sz window_text,' ' +else if lang eq et_EE + sz window_text,'Akna tekst' +else ; Default to en_US + sz window_text,'Window text' +end if +;----------------------------------------------------------------------------- +if lang eq ru_RU + sz button_text,' ' +else if lang eq et_EE + sz button_text,'Nupu tekst' +else ; Default to en_US + sz button_text,'Button text' +end if +;----------------------------------------------------------------------------- +if lang eq ru_RU + title db 'ன ',0 +else if lang eq et_EE + title db 'Akna seaded',0 +else if lang eq it_IT + title db 'Impostazioni',0 +else ; Default to en_US + title db 'Windows settings',0 +end if +;--------------------------------------------------------------------- +LibIniImportTable: +library \ + libini, 'libini.obj' + +import libini, \ + ini_set_int ,'ini_set_int' + +aIni db '/sys/settings/system.ini',0 +aSectionSkn db 'style',0 +aButtonStyle db 'buttons_gradient',0 +;--------------------------------------------------------------------- +l_libs_start: + +library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ + Box_lib_import + +library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ + ProcLib_import + +end_l_libs: +;--------------------------------------------------------------------- +system_dir_Boxlib db '/sys/lib/box_lib.obj',0 +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 + +;--------------------------------------------------------------------- +align 4 + +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start + +ColorDialog_Init dd aColorDialog_Init +ColorDialog_Start dd aColorDialog_Start +;OpenDialog__Version dd aOpenDialog_Version + dd 0 + dd 0 + +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 + +aColorDialog_Init db 'ColorDialog_init',0 +aColorDialog_Start db 'ColorDialog_start',0 +;aOpenDialog_Version db 'Version_OpenDialog',0 +;--------------------------------------------------------------------- +align 4 +Box_lib_import: +;init_lib dd a_init +;version_lib dd a_version + + +;edit_box_draw dd aEdit_box_draw +;edit_box_key dd aEdit_box_key +;edit_box_mouse dd aEdit_box_mouse +;version_ed dd aVersion_ed + +;check_box_draw dd aCheck_box_draw +;check_box_mouse dd aCheck_box_mouse +;version_ch dd aVersion_ch + +;option_box_draw dd aOption_box_draw +;option_box_mouse dd aOption_box_mouse +;version_op dd aVersion_op + +;scrollbar_ver_draw dd aScrollbar_ver_draw +;scrollbar_ver_mouse dd aScrollbar_ver_mouse +;scrollbar_hor_draw dd aScrollbar_hor_draw +;scrollbar_hor_mouse dd aScrollbar_hor_mouse +;version_scrollbar dd aVersion_scrollbar + +;dinamic_button_draw dd aDbutton_draw +;dinamic_button_mouse dd aDbutton_mouse +;version_dbutton dd aVersion_dbutton + +;menu_bar_draw dd aMenu_bar_draw +;menu_bar_mouse dd aMenu_bar_mouse +;menu_bar_activate dd aMenu_bar_activate +;version_menu_bar dd aVersion_menu_bar + +;FileBrowser_draw dd aFileBrowser_draw +;FileBrowser_mouse dd aFileBrowser_mouse +;FileBrowser_key dd aFileBrowser_key +;Version_FileBrowser dd aVersion_FileBrowser + +PathShow_prepare dd sz_PathShow_prepare +PathShow_draw dd sz_PathShow_draw +;Version_path_show dd szVersion_path_show + +Frame_draw dd sz_Frame_draw +;Version_frame dd szVersion_frame + + dd 0,0 + +;a_init db 'lib_init',0 +;a_version db 'version',0 + +;aEdit_box_draw db 'edit_box_draw',0 +;aEdit_box_key db 'edit_box_key',0 +;aEdit_box_mouse db 'edit_box_mouse',0 +;aVersion_ed db 'version_ed',0 + +;aCheck_box_draw db 'check_box_draw',0 +;aCheck_box_mouse db 'check_box_mouse',0 +;aVersion_ch db 'version_ch',0 + +;aOption_box_draw db 'option_box_draw',0 +;aOption_box_mouse db 'option_box_mouse',0 +;aVersion_op db 'version_op',0 + +;aScrollbar_ver_draw db 'scrollbar_v_draw',0 +;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 +;aScrollbar_hor_draw db 'scrollbar_h_draw',0 +;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 +;aVersion_scrollbar db 'version_scrollbar',0 + +;aDbutton_draw db 'dbutton_draw',0 +;aDbutton_mouse db 'dbutton_mouse',0 +;aVersion_dbutton db 'version_dbutton',0 + +;aMenu_bar_draw db 'menu_bar_draw',0 +;aMenu_bar_mouse db 'menu_bar_mouse',0 +;aMenu_bar_activate db 'menu_bar_activate',0 +;aVersion_menu_bar db 'version_menu_bar',0 + +;aFileBrowser_draw db 'FileBrowser_draw',0 +;aFileBrowser_mouse db 'FileBrowser_mouse',0 +;aFileBrowser_key db 'FileBrowser_key',0 +;aVersion_FileBrowser db 'version_FileBrowser',0 + +sz_PathShow_prepare db 'PathShow_prepare',0 +sz_PathShow_draw db 'PathShow_draw',0 +;szVersion_path_show db 'version_PathShow',0 + +sz_Frame_draw db 'frame_draw',0 +;szVersion_frame db 'version_frame',0 +;--------------------------------------------------------------------- +PathShow_data_1: +.type dd 0 ;+0 +.start_y dw frame_1.y+19 ;+4 +.start_x dw frame_1.x+15 ;+6 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.area_size_x dw frame_1.w-28 ;+10 +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.background_flag dd 0 ;+16 +.font_color dd 0x0 ;+20 +.background_color dd 0x0 ;+24 +.text_pointer dd dtp_name ;+28 +.work_area_pointer dd text_work_area ;+32 +.temp_text_length dd 0 ;+36 +;--------------------------------------------------------------------- +PathShow_data_2: +.type dd 0 ;+0 +.start_y dw frame_2.y+19 ;+4 +.start_x dw frame_2.x+15 ;+6 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.area_size_x dw frame_2.w-28 ;+10 +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.background_flag dd 0 ;+16 +.font_color dd 0x0 ;+20 +.background_color dd 0x0 ;+24 +.text_pointer dd skin_info ;+28 +.work_area_pointer dd text_work_area2 ;+32 +.temp_text_length dd 0 ;+36 +;--------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd dtp_name ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +OpenDialog_data2: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name2 ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach2 ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd skin_info ;+36 +.filename_area dd filename_area2 ;+40 +.filter_area dd Filter2 +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name2: + db 'FFFFFFFF_open_dialog',0 + +communication_area_name: + db 'FFFFFFFF_open_dialog2',0 +open_dialog_path: +if __nightbuild eq yes + db '/sys/MANAGERS/opendial',0 +else + db '/sys/File Managers/opendial',0 +end if +communication_area_default_pach: + db '/sys',0 + +Filter: + dd Filter.end - Filter +.1: + db 'DTP',0 +.end: + db 0 + +Filter2: + dd Filter.end - Filter +.1: + db 'SKN',0 +.end: + db 0 + +default_skin: + db '/sys/default.skn',0 +default_dtp: + db '/sys/default.dtp',0 +;--------------------------------------------------------------------- +ColorDialog_data: +.type dd 0 +.procinfo dd procinfo ;+4 +.com_area_name dd cd_communication_area_name ;+8 +.com_area dd 0 ;+12 +.start_path dd colordialog_path ;+16 +.draw_window dd draw_window ;+20 +.status dd 0 ;+24 +.x: +.x_size dw 510 ;+28 ; Window X size +.x_start dw 10 ;+30 ; Window X position +.y: +.y_size dw 310 ;+32 ; Window y size +.y_start dw 10 ;+34 ; Window Y position +.color_type dd 0 ;+36 ; 0- RGB, 1 or other - reserved +.color dd 0 ;+40 ; Selected color + +cd_communication_area_name: + db 'FFFFFFFF_color_dialog',0 +colordialog_path: + db '/sys/colrdial',0 +;--------------------------------------------------------------------- +frame_data: +.type dd 0 ;+0 +.x: +.x_size dw 0 ;+4 +.x_start dw 0 ;+6 +.y: +.y_size dw 0 ;+8 +.y_start dw 0 ;+10 +.ext_fr_col dd 0x0 ;+12 +.int_fr_col dd 0xffffff ;+16 +.draw_text_flag dd 1 ;+20 +.text_pointer dd 0 ;+24 +.text_position dd 0 ;+28 +.font_number dd 1 ;+32 +.font_size_y dd 14 ;+36 +.font_color dd 0x0 ;+40 +.font_backgr_color dd 0xffffff ;+44 +;--------------------------------------------------------------------- +IncludeIGlobals diff --git a/programs/system/skincfg/trunk/skincfg.asm b/programs/system/skincfg/trunk/skincfg.asm index c3e580407..5a2f14eb5 100644 --- a/programs/system/skincfg/trunk/skincfg.asm +++ b/programs/system/skincfg/trunk/skincfg.asm @@ -26,7 +26,7 @@ M01header.params: dd app_param ; parameters dd cur_dir_path ; path to file - + include 'lang.inc' include '../../../proc32.inc' include '../../../config.inc' ;for nightbuild @@ -85,7 +85,7 @@ frame_1: .y = area.y + area.height + 20 .w = area.w + 217 .height = 65 -;-------------------------------------- +;-------------------------------------- frame_2: .x = frame_1.x .y = frame_1.y + frame_1.height + 20 @@ -99,11 +99,11 @@ win: START: ; start of execution ;--------------------------------------------------------------------- mcall SF_SYS_MISC,SSF_HEAP_INIT - - test eax,eax - jz close -stdcall dll.Load,LibIniImportTable + test eax,eax + jz close + +stdcall dll.Load,LibIniImportTable load_libraries l_libs_start,end_l_libs ;if return code =-1 then exit, else nornary work @@ -125,7 +125,7 @@ load_libraries l_libs_start,end_l_libs cmp ecx, '.dtp' je load_dtp_from_param jmp no_param - + load_dtp_from_param: stdcall string.copy, [M01header.params], dtp_name call load_dtp_file.1 @@ -139,8 +139,8 @@ load_skin_from_param: no_param: mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,color_table,4*10 ; get current colors call load_skin_file.2 - -skin_path_ready: + +skin_path_ready: ;--------------------------------------------------------------------- ;OpenDialog initialisation push dword OpenDialog_data @@ -156,13 +156,13 @@ skin_path_ready: ; prepare for PathShow push dword PathShow_data_1 call [PathShow_prepare] - + push dword PathShow_data_2 call [PathShow_prepare] -;--------------------------------------------------------------------- +;--------------------------------------------------------------------- red: call draw_window ; at first, draw the window -;--------------------------------------------------------------------- +;--------------------------------------------------------------------- still: mcall SF_WAIT_EVENT @@ -250,19 +250,19 @@ no_apply_skin: cmp ah,41 jg no_new_colour - -;--------------------------------------------------------------------- + +;--------------------------------------------------------------------- .start_ColorDialog: push dword ColorDialog_data call [ColorDialog_Start] ; 2 - use another method/not found program cmp [ColorDialog_data.status],2 je still -; 1 - OK, color selected +; 1 - OK, color selected cmp [ColorDialog_data.status],1 jne still -;--------------------------------------------------------------------- - +;--------------------------------------------------------------------- + shr eax,8 sub eax,31 shl eax,2 @@ -449,9 +449,9 @@ newcol: add bx,4 sub ecx,2 shl 16 add cx,4 - + mov [frame_data.x],ebx - mov [frame_data.y],ecx + mov [frame_data.y],ecx push dword frame_data call [Frame_draw] @@ -473,7 +473,7 @@ draw_PathShow: ; draw for PathShow push dword PathShow_data_1 call [PathShow_draw] - + push dword PathShow_data_2 call [PathShow_draw] popa @@ -498,7 +498,7 @@ draw_window: mcall ,<110, win.w>,,,,title mcall SF_THREAD_INFO,procinfo,-1 - + mov eax,[procinfo+70] ;status of window test eax,100b jne .end @@ -527,8 +527,8 @@ draw_window: mcall SF_DEFINE_BUTTON,,,16 ; button 17 ; select color DTP button text mcall SF_DRAW_TEXT,,[w_work_button_text],t1,t1.size -;----------------------------------- -; select skin frame +;----------------------------------- +; select skin frame ; LOAD SKIN BUTTON ; button 17 mcall SF_DEFINE_BUTTON,,,17,[w_work_button] ; 3D @@ -543,7 +543,7 @@ draw_window: mcall ,,,18 ; button 18 ; select skin button text mcall SF_DRAW_TEXT,,[w_work_button_text],t2,t2.size -;----------------------------------- +;----------------------------------- call draw_button_row call draw_button_row_of_texts call draw_colours @@ -556,7 +556,7 @@ draw_window: mov eax,[w_work_text] mov [frame_data.font_color],eax mov [frame_data.draw_text_flag],dword 1 - + push dword frame_data call [Frame_draw] ;----------------------------------- diff --git a/programs/system/taskbar/trunk/TASKBAR.ASM b/programs/system/taskbar/trunk/TASKBAR.ASM index 88bcfb663..e4fe7f936 100644 --- a/programs/system/taskbar/trunk/TASKBAR.ASM +++ b/programs/system/taskbar/trunk/TASKBAR.ASM @@ -1,1178 +1,1178 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; ; -; TASK PANEL for KolibriOS - Compile with fasm ; -; ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;------------------------------------------------------------------------------ -; version: 2.25 -; last update: 14/07/2013 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Reinstall screen work area after change screen resolution -;------------------------------------------------------------------------------ -; version: 2.24 -; last update: 16/06/2013 -; changed by: hidnplayr -; changes: Changed keymap hotkeys to only use left alt -; (Right alt has special function on some keyboards) -;------------------------------------------------------------------------------ -; version: 2.23 -; last update: 26/04/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Using new f18.23 - minimize all windows -;------------------------------------------------------------------------------ -; version: 2.22 -; last update: 20/04/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Activation mechanism when trying to run an existing appl. -; Forced redrawing the background after the clean desktop (Win+D) -;------------------------------------------------------------------------------ -; version: 2.2 -; last update: 19/04/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Support PrintScreen for SCRSHOOT. -; Path to run applications from the INI file. -; Algorithm anti-duplication of applications for run with hotkey. -; Added color selection for the Alt+Tab. -; Alt+Ctrl+ArrowLeft - Page list next -; Alt+Ctrl+ArrowRight - Page list previous -;------------------------------------------------------------------------------ -; version: 2.1 -; last update: 18/04/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Added color selection for the text. -; Show "change page list" only if the applications -; does not fit in the panel. -; Display file names up to 11 char previously displ. only 8 char. -;------------------------------------------------------------------------------ -; version: 2.0 -; last update: 17/04/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: New logic of switching windows (turnoff/restore) -; New logic of button "clear desktop". -; Win+D (restore/clear desktop), Win+R (start RUN application). -; Using the library LibINI to set the parameters. -; New style of panel. Start application Menu with boot options. -; two versions of the location of the panel - -; the bottom of the desktop and on top of the desktop. -;------------------------------------------------------------------------------ -; last update: 31/03/2012 -; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: The program uses only 20 Kb memory is now. -; Code optimizing and refactoring. -;------------------------------------------------------------------------------ -format binary as "" - - use32 - org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; program start - dd IM_END ; program image size - dd I_END ; reguired amount of memory - 10 Kb - dd stack_top ; esp - dd 0x0 ; boot parameters - dd path ; application pach -;------------------------------------------------------------------------------ -include 'lang.inc' -include '../../../macros.inc' -include '../../../proc32.inc' -;include '../../../debug.inc' -include 'MOI.INC' ;᪫ -include '../../../develop/libraries/box_lib/load_lib.mac' - @use_library ;use load lib macros -;------------------------------------------------------------------------------ -caps_lock_check fix 1 -;------------------------------------------------------------------------------ -time_bgr_color = 0x66cc -;PANEL_HEIGHT = 18 -ML_SIZE = 10 -MR_SIZE = 10 -if lang eq et_EE -MENU_SIZE = 60 -else -MENU_SIZE = 50 -end if -CLD_SIZE = 20 -TAB_SIZE = 75 ;60 -TRAY_SIZE = 140 - -CLOCK_SIZE = 40 -CPU_USAGE_SIZE = 10 -CHLANG_SIZE = 20 -PAGE_LIST_SIZE = 36 -;------------------------------------------------------------------------------ -align 4 -handle_key: - mcall 18,7 - mov [active_process],eax - - mcall 2 - -; dps "panel key: " -; dph eax -; newline - - cmp al, 2 - jnz begin_1.ret - - mov ebx, exec_fileinfo - shr eax, 8 - cmp al, 0 - je prod - - mov [key_r],al - sub [key_r],3 - cmp [key_r],9 - jc alter - -if caps_lock_check - cmp al,58 ;CAPS LOCK DOWN - jne @f - - pusha - mcall 26,2,9 - mov ebx,eax - mov eax,2 - mov [draw_flag_certainly],1 - call draw_flag ; language - popa - ret -@@: -end if - - cmp al, 15 ; Alt+Tab DOWN - jz alt_tab_pressed - - cmp al, 88 ; Ctrl+Alt+F12 - jz start_end_application - - cmp al, 91 ; RWin DOWN - jz set_win_key_flag - - cmp al, 92 ; LWin DOWN - jz set_win_key_flag - - cmp al, 1 ; LCtrl+Esc DOWN - jz set_win_key_flag - - cmp al, 219 ; RWin UP - jz cut_win_key_flag ;start_menu_application - - cmp al, 220 ; LWin UP - jz cut_win_key_flag ;start_menu_application - - cmp al, 129 ; LCtrl+Esc UP - jz cut_win_key_flag ;start_menu_application - - cmp al, 62 ; Alt+F4 - jz kill_active_application - - cmp al, 205 - jz page_list_next - - cmp al, 203 - jz page_list_prev - - cmp al, 69 ; Alt+Shift+NumLock - jz start_mousemul_application - - cmp al, 19 ; Win+R - jz start_run_application - - cmp al, 32 ; Win+D - jz minimize_all_windows - - cmp al, 55 ; PrintScreen DOWN - jz start_PrintScreen_application -;-------------------------------------- -align 4 -prod: - cmp [current_alt_tab_app], -1 - jz @f - - test ah, 0x30 ; Alt+Tab UP - jz alt_tab_released -;-------------------------------------- -align 4 -@@: -; this is hotkey LCtrl+LShift ;or LShift+RShift - jmp karu -;------------------------------------------------------------------------------ -align 4 -set_win_key_flag: - mov [win_key_flag],1 - ret -;------------------------------------------------------------------------------ -align 4 -cut_win_key_flag: - xor eax,eax - mov [win_key_flag],al - xchg [start_menu_flag],al - test al,al - jz start_menu_application - ret -;------------------------------------------------------------------------------ -align 4 -change_key_lang: - mov dword [ebx+8], chlang - mcall 70 -;-------------------------------------- -align 4 -begin_1: - mov ecx,[active_process] - mcall 18, 3 - mcall 5, 25 -;-------------------------------------- -align 4 -.ret: - ret -;------------------------------------------------------------------------------ -align 4 -start_end_application: - mov esi,end_name - call algorithm_anti_duplication - test eax,eax - jz @f - - mcall 18,3,edi - ret -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx + 21],end_name - mcall 70 - ret -;------------------------------------------------------------------------------ -align 4 -start_mousemul_application: - mov esi,mousemul_name - call algorithm_anti_duplication - test eax,eax - jz @f - ret -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx + 21],mousemul_name - mcall 70 - ret -;------------------------------------------------------------------------------ -align 4 -kill_active_application: - mcall 72,1,3,1 - jmp begin_1.ret -;------------------------------------------------------------------------------ - -align 4 -start_menu_application: - call menu_handler - jmp begin_1.ret -;------------------------------------------------------------------------------ -align 4 -start_run_application: - cmp [win_key_flag],1 - je @f - ret -;-------------------------------------- -align 4 -@@: - mov [start_menu_flag],1 - - mov esi,run_name - call algorithm_anti_duplication - test eax,eax - jz @f - - mcall 18,3,edi - ret -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx + 21], run_name - mcall 70 - jmp begin_1.ret -;------------------------------------------------------------------------------ -align 4 -start_PrintScreen_application: - mov esi,printscreen_name - call algorithm_anti_duplication - test eax,eax - jz @f - mcall 18,3,edi - ret -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx + 21],printscreen_name - mov [ebx+8],dword bootparam_printscreen - mcall 70 - jmp begin_1.ret -;------------------------------------------------------------------------------ -align 4 -minimize_all_windows: - cmp [win_key_flag],1 - je @f - ret -;-------------------------------------- -align 4 -@@: - mov [start_menu_flag],1 - call clean_desktop - ret -;------------------------------------------------------------------------------ -align 4 -algorithm_anti_duplication: - cld -;-------------------------------------- -align 4 -@@: - lodsb - test al,al - jnz @r -;-------------------------------------- -align 4 -@@: - std - lodsb - cmp al,'/' - jnz @r - add esi,2 - mov edx,esi - - mov edi,1 -;-------------------------------------- -align 4 -@@: - inc edi - mov ecx,edi - mcall 9,procinfo_window_tabs - - cmp edi,eax - jg .apply_changes - - mov esi,edx - mov ecx,11 - add ebx,9 - cld -;-------------------------------------- -align 4 -.loop: - lodsb - inc ebx - cmp al,[ebx] - jne @r - - loop .loop - - mov eax,1 - ret -;-------------------------------------- -align 4 -.apply_changes: - xor eax,eax - ret -;------------------------------------------------------------------------------ -align 4 -page_list_next: - cmp [page_list],50 - je @f - - xor eax,eax - cmp [page_list_enable],eax - je @f - - inc [page_list] - mov [redraw_window_flag],1 -;-------------------------------------- -align 4 -@@: - jmp begin_1.ret -;------------------------------------------------------------------------------ -align 4 -page_list_prev: - xor eax,eax - cmp [page_list],eax - je @f - - cmp [page_list_enable],eax - je @f - - dec [page_list] - mov [redraw_window_flag],1 -;-------------------------------------- -align 4 -@@: - jmp begin_1.ret -;------------------------------------------------------------------------------ -align 4 -alt_tab_pressed: -; handle Alt+Tab and Alt+Shift+Tab - mov ebp, eax - cmp [current_alt_tab_app], -1 - jnz has_alt_tab_app -; 塞 ⠡ ਫ, ४祭 - xor edx, edx - mov ebx, procinfo_window_tabs - mov ecx, 1 -;-------------------------------------- -align 4 -.fill: - inc ecx - mcall 9 - call need_window_tab - jz @f - - cmp edx, 256 - jz @f - - mov [alt_tab_list+edx*8], ecx - movzx esi, word [ebx+4] - mov [alt_tab_list+edx*8+4], esi - inc edx -;-------------------------------------- -align 4 -@@: - cmp ecx,eax - jb .fill - - mov [alt_tab_list_size], edx - test edx, edx - jz begin_1.ret - - mcall 66,4,0,0 ; ᪠ ࠢ - test eax, eax - jnz begin_1.ret - - xor edx, edx - mov eax, [alt_tab_list+4] - xor ecx, ecx - inc ecx -;-------------------------------------- -align 4 -.findmax: - cmp [alt_tab_list+ecx*8+4], eax - jb @f - - mov edx, ecx - mov eax, [alt_tab_list+ecx*8+4] -;-------------------------------------- -align 4 -@@: - inc ecx - cmp ecx, [alt_tab_list_size] - jb .findmax - - mov [current_alt_tab_app], edx -;-------------------------------------- -align 4 -has_alt_tab_app: - mov eax, [current_alt_tab_app] - mov edx, [alt_tab_list+eax*8+4] ; slot - xor ecx, ecx - or eax, -1 - test ebp, 300h - jz .notshift - - or esi, -1 -;-------------------------------------- -align 4 -.loop1: - cmp [alt_tab_list+ecx*8+4], edx - jbe @f - - cmp [alt_tab_list+ecx*8+4], esi - jae @f - - mov eax, ecx - mov esi, [alt_tab_list+ecx*8+4] -;-------------------------------------- -align 4 -@@: - inc ecx - cmp ecx, [alt_tab_list_size] - jb .loop1 - - cmp eax, -1 - jnz .found - - xor edx, edx - xor ecx, ecx - jmp .loop1 -;-------------------------------------- -align 4 -.notshift: - xor esi, esi -;-------------------------------------- -align 4 -.loop2: - cmp [alt_tab_list+ecx*8+4], edx - jae @f - - cmp [alt_tab_list+ecx*8+4], esi - jbe @f - - mov eax, ecx - mov esi, [alt_tab_list+ecx*8+4] -;-------------------------------------- -align 4 -@@: - inc ecx - cmp ecx, [alt_tab_list_size] - jb .loop2 - - cmp eax, -1 - jnz .found - - or edx, -1 - xor ecx, ecx - jmp .loop2 -;-------------------------------------- -align 4 -.found: - mov [current_alt_tab_app], eax - push eax - xor edx, edx - div [max_applications] - mov [page_list], eax - mov edi, app_list - push edi - mov ecx, 20 - or eax, -1 - rep stosd - pop edi - pop ecx - sub ecx, edx -;-------------------------------------- -align 4 -@@: - cmp ecx, [alt_tab_list_size] - jae redraw_window_tabs - - mov eax, [alt_tab_list+ecx*8] - stosd - inc ecx - jmp @b -;-------------------------------------- -align 4 -alt_tab_released: - mcall 66,5,0,0 ; 㦥 , 墠 :) - - or eax, -1 - xchg eax, [current_alt_tab_app] - mov ecx, [alt_tab_list+eax*8] - mcall 18,3 - - jmp redraw_window_tabs -;------------------------------------------------------------------------------ -align 4 -active_process dd 0 - -exit: - mcall -1 -;------------------------------------------------------------------------------ -START: - mcall 68,11 - mcall 66,1,1 - - mcall 9,process_info_buffer,-1 - mov ecx, [ebx + process_information.PID] ; PID - mcall 18,21 - mov [my_active_slot],eax ; WINDOW SLOT - - -load_libraries l_libs_start,end_l_libs - - test eax,eax - jnz exit - - call Get_ini - - mcall 66,4,0,2 ; LShift+RShift - mcall 66,,,33h ; LCtrl+LShift - mcall 66,,88,110h ; Alt+Ctrl+F12 - mcall 66,,91,0h ; RWin DOWN - mcall 66,,92 ; LWin DOWN - mcall 66,,219 ; RWin UP - mcall 66,,220 ; LWin UP - mcall 66,,19,0h ; Win+R DOWN - mcall 66,,32,0h ; Win+D DOWN - mcall 66,,55,10h ; Ctrl+PrintScreen DOWN - mcall 66,,1,30h ; LCtrl+Esc DOWN - mcall 66,,129 ; LCtrl+Esc UP - mcall 66,,62,300h ; Alt+F4 - mcall 66,,2 ; Alt+1 - mcall 66,,3 ; Alt+2 - mcall 66,,4 ; Alt+3 - mcall 66,,5 ; Alt+4 - mcall 66,,6 ; Alt+5 - mcall 66,,7 ; Alt+6 - mcall 66,,8 ; Alt+7 - mcall 66,,9 ; Alt+8 - mcall 66,,10 ; Alt+9 - mcall 66,,15 ; Alt+Tab DOWN - mcall 66,,15,301h ; Alt+Shift+Tab DOWN - mcall 66,,69 ; Alt+Shift+NumLock - -if caps_lock_check - xor edx,edx - mcall 66,4,58 -end if - mcall 14 - mov [screen_size],eax - - call set_work_ares_pf_screen - - mcall 9,process_info_buffer,-1 - mov ecx,[process_info_buffer.PID] - mcall 18,21 - mov [this_slot],eax - mov [max_slot],255 -;-------------------------------------- -align 4 -start_after_minimize: - call draw_window - call draw_running_applications - - mcall 23,30 - call load_ini -;------------------------------------------------------------------------------ -align 4 -still: - call draw_time - call draw_cpu_usage - call draw_running_applications - - mcall 18,7 ; check if active window changed - cmp eax, [last_active_window] - jz @f -; need_window_tab: -; in: ebx->process info -; out: ZF set <=> do not draw - mov ebx,[last_active_window] - mov [prev_active_window], ebx - mov [last_active_window], eax - - mov ecx, eax - mcall 9,process_info_buffer - - call need_window_tab - jnz .need_repaint - - mcall 9,process_info_buffer,[prev_active_window] - call need_window_tab - jz @f -;-------------------------------------- -align 4 -.need_repaint: - mov dword [active_window_changed], 1 -;-------------------------------------- -align 4 -@@: - mcall 23,20 - - push eax - mcall 18,7 - cmp [my_active_slot],eax - je @f - - mov [current_active_slot],eax -;-------------------------------------- -align 4 -@@: - pop eax - - cmp eax,1 ; redraw ? - jz red - - push eax - mov eax,[redraw_window_flag] - test eax,eax - jz @f - - call draw_window -;-------------------------------------- -align 4 -@@: - pop eax - - cmp eax,2 - jnz @f - call handle_key - jmp .key -;-------------------------------------- -align 4 -@@: - cmp eax,3 ; button ? - jz button -;-------------------------------------- -align 4 -.key: - cmp dword [active_window_changed], 0 - jnz red_active - - call draw_flag ; language - jmp still -;------------------------------------------------------------------------------ -align 4 -set_work_ares_pf_screen: -;eax = [xsize]*65536 + [ysize] - mov ecx,eax - shr ecx,16 - and eax,0xFFFF - cmp [place_attachment],1 - je @f - - ror eax,16 - add eax,[height] - rol eax,16 - mov edx,eax - jmp .selected -;-------------------------------------- -align 4 -@@: - sub eax,[height] - mov edx, eax -;-------------------------------------- -align 4 -.selected: - mcall 48,6 - ret -;------------------------------------------------------------------------------ -align 4 -red_active: -red: - mov dword [active_window_changed], 0 - - mcall 14 - movzx ecx,ax - mov edx,eax - shr edx,16 - cmp [screen_size.height],ax - jne @f - - rol eax,16 - cmp [screen_size.width],ax - je .lp1 - - rol eax,16 -;-------------------------------------- -align 4 -@@: - mov [screen_size],eax - - push ecx edx - call set_work_ares_pf_screen - pop edx ecx - - sub ecx,[height] - mcall 67,0,,,[height] -;-------------------------------------- -align 4 -.lp1: - call draw_window - jmp still -;------------------------------------------------------------------------------ -align 4 -button: - mcall 17 - test eax,0xfffffe00 ; is it close button? (signal from @taskbar) - jz still ; if so - wait for another event, because @taskbar shouldn't be closed - - cmp al, 0 - jnz right_mouse - - cmp ah,50 - jb no_activate - cmp ah,70 - jg no_activate - - movzx ecx,byte ah - sub ecx,52 - shl ecx,2 - - mov ecx,[app_list+ecx] - - mcall 9,process_info_buffer - - test [ebx + process_information.wnd_state], byte 10b ; window is minimized to panel - jnz @f - - cmp ecx,[current_active_slot] - je .turn_off -;-------------------------------------- -align 4 -@@: - mcall 18,3, - jmp .task_switching -;-------------------------------------- -align 4 -.turn_off: - mov edx,ecx - mcall 18,22,0 -;-------------------------------------- -align 4 -.task_switching: - mcall 68,1 - jmp still -;------------------------------------------------------------------------------ -align 4 -right_mouse: - cmp ah,50 - jb still - - cmp ah,70 - jg still - - movzx ecx,byte ah - sub ecx,52 - - cmp ecx, [app_tab_count] - jge still - - shl ecx,2 - mcall 37,0 - mov ebx, eax - shr eax, 16 - mov [x_coord], ax - and ebx, 0xFFFF - mov [y_coord], bx - - mov ecx,[app_list+ecx] ; ecx->selected app.slot - mov [n_slot], ecx - mcall 9,procinfo_for_detect - - mcall 51,1,context_menu_start,ctx_menu_stack - - mov [ctx_menu_PID], eax - jmp still -;------------------------------------------------------------------------------ -align 4 -no_activate: - cmp ah,101 ; minimize to left - je left_button - - cmp ah,102 ; minimize to right - je right_button - - cmp ah, 103 - je clean_desktop_1 ; minimize all windows - - cmp ah,byte 1 ; start/terminate menu - jnz noselect - - call menu_handler - - jmp still -;-------------------------------------- -align 4 -clean_desktop_1: - call clean_desktop - jmp still -;-------------------------------------- -align 4 -noselect: - mov ebx, exec_fileinfo - cmp ah,byte 2 ; start calendar - jnz noid15 ;noclock - - mov esi,calendar_name - call algorithm_anti_duplication - test eax,eax - jz @f - - mcall 18,2,edi - jmp still -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx+21], calendar_name - mcall 70 - jmp still -;-------------------------------------- -align 4 -noid15: - cmp ah,16 - jne noid16 - - call karu - call draw_flag ; language - jmp still -;-------------------------------------- -align 4 -noid16: - cmp ah,18 - jne noid18 - - mov esi,sysmeter_name - call algorithm_anti_duplication - test eax,eax - jz @f - - mcall 18,2,edi - jmp still -;-------------------------------------- -align 4 -@@: - mov ebx, exec_fileinfo - mov dword [ebx+21], sysmeter_name - mcall 70 - jmp still -;-------------------------------------- -align 4 -noid18: - cmp ah,21 - jnz noid21 - - cmp [page_list],50 - jnc still - inc [page_list] - jmp red -;-------------------------------------- -align 4 -noid21: - cmp ah,22 - jnz still - - cmp [page_list],0 - je still - - dec [page_list] - jmp red -;------------------------------------------------------------------------------ -align 4 -restore_desktop: - mcall 9,process_info_buffer,-1 - mov [max_slot], eax - mov ecx, 2 - mov edx, 2 -;-------------------------------------- -align 4 -@@: - mcall 18, 22 - inc edx - cmp edx, [max_slot] - jbe @b - ret -;------------------------------------------------------------------------------ -align 4 -clean_desktop: - mcall 18,23 - test eax,eax - jnz @f - call restore_desktop -;-------------------------------------- -align 4 -@@: - ret -;------------------------------------------------------------------------------ -align 4 -conversion_HEX_to_ASCII: - ror eax,12 - mov ecx,4 -;-------------------------------------- -align 4 -.loop: - mov bl,al - rol eax,4 - and bl,0xf - cmp bl,0xA ; check for ABCDEF - jae @f - - add bl,0x30 ; 0-9 - jmp .store -;-------------------------------------- -align 4 -@@: - add bl,0x57 ; A-F -;-------------------------------------- -align 4 -.store: -; dps "param_store: " - mov [edi],bl - inc edi - dec ecx - jnz .loop - ret -;------------------------------------------------------------------------------ -align 4 -menu_handler: - mov edi,bootparam - - mov eax,[menu_button_x.start] - call conversion_HEX_to_ASCII - - mov eax,[menu_button_x.size] - call conversion_HEX_to_ASCII - - mov eax,[menu_button_y.start] - call conversion_HEX_to_ASCII - - mov eax,[menu_button_y.size] - call conversion_HEX_to_ASCII - - mov eax,[height] - call conversion_HEX_to_ASCII - - mov eax,[place_attachment] - call conversion_HEX_to_ASCII - - xor eax,eax ; terminator for boot parameters string - stosd - - mov ebx, exec_fileinfo - mov [ebx+21],dword menu_name - mov [ebx+8],dword bootparam - mcall 70 - mov [ebx+8],dword 0 - ret -;------------------------------------------------------------------------------ -align 4 -draw_small_right: - pusha - mcall 12,1 - - xor eax,eax - mov edx,[wcolor] - mov esi,edx - mov edi,edx - or edx, 0x01000000 - mcall - - xor ecx,ecx - mov cx,[height] - mcall 8,<0,10>,,1,[wcolor] - - mov ebx,2*65536 ;+6 - mov bx,[height] - shr bx,1 - sub bx,3 - mov edx,[wcolor] - mov eax,COLOR_CHANGE_MAGNITUDE_2 - call add_color_change_magnitude - mov ecx,edx - mcall 4,,,hidetext,1 - - mcall 12,2 - popa - ret -;------------------------------------------------------------------------------ -align 4 -draw_small_left: - pusha - mcall 12,1 - - xor eax,eax - mov edx,[wcolor] - mov esi,edx - mov edi,edx - or edx, 0x01000000 - mcall - - xor ecx,ecx - mov cx,[height] - mcall 8,<0,9>,,1,[wcolor] - - mov ebx,3*65536 ;+6 - mov bx,[height] - shr bx,1 - sub bx,3 - mov edx,[wcolor] - mov eax,COLOR_CHANGE_MAGNITUDE_2 - call add_color_change_magnitude - mov ecx,edx - mcall 4,,,hidetext+1,1 - - mcall 12,2 - popa - ret -;------------------------------------------------------------------------------ -align 4 -right_button: - mov [small_draw],dword draw_small_right - - mcall 14 - - shr eax, 16 - mov ebx, eax - mov ecx, -1 - mov edx, 9 - sub ebx, edx - mov esi, -1 - mcall 67 - - call draw_small_right - jmp small_wait -;------------------------------------------------------------------------------ -align 4 -left_button: - mov [small_draw],dword draw_small_left - - xor ebx,ebx - mcall 67,,-1,9,-1 - - call draw_small_left -;-------------------------------------- -align 4 -small_wait: - mcall 10 - cmp eax,1 - jne no_win - - call [small_draw] - jmp small_wait -;-------------------------------------- -align 4 -no_win: - cmp eax,2 - jne no_key - - call handle_key - jmp small_wait -;-------------------------------------- -align 4 -no_key: - mcall 17 - cmp ah,1 - jne no_full - - mcall 14 ; get screen max x & max y - - mov edx, eax - shr edx, 16 - xor ebx, ebx - mcall 67,,-1,,-1 ; x0 y0 xs ys - - jmp still -;-------------------------------------- -align 4 -no_full: - call menu_handler - jmp small_wait -;------------------------------------------------------------------------------ -include 'libini.inc' -;------------------------------------------------------------------------------ -include '../../../dll.inc' -;------------------------------------------------------------------------------ -include 'drawappl.inc' -;------------------------------------------------------------------------------ -include 'drawbutt.inc' -;------------------------------------------------------------------------------ -include 'drawwind.inc' -;------------------------------------------------------------------------------ -include 'drawtray.inc' -;------------------------------------------------------------------------------ -include 'ctx_menu.asm' -;------------------------------------------------------------------------------ -include 'i_data.inc' -;------------------------------------------------------------------------------ -IM_END: -;------------------------------------------------------------------------------ -include 'u_data.inc' -;------------------------------------------------------------------------------ -I_END: -;------------------------------------------------------------------------------ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; TASK PANEL for KolibriOS - Compile with fasm ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;------------------------------------------------------------------------------ +; version: 2.25 +; last update: 14/07/2013 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Reinstall screen work area after change screen resolution +;------------------------------------------------------------------------------ +; version: 2.24 +; last update: 16/06/2013 +; changed by: hidnplayr +; changes: Changed keymap hotkeys to only use left alt +; (Right alt has special function on some keyboards) +;------------------------------------------------------------------------------ +; version: 2.23 +; last update: 26/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Using new f18.23 - minimize all windows +;------------------------------------------------------------------------------ +; version: 2.22 +; last update: 20/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Activation mechanism when trying to run an existing appl. +; Forced redrawing the background after the clean desktop (Win+D) +;------------------------------------------------------------------------------ +; version: 2.2 +; last update: 19/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Support PrintScreen for SCRSHOOT. +; Path to run applications from the INI file. +; Algorithm anti-duplication of applications for run with hotkey. +; Added color selection for the Alt+Tab. +; Alt+Ctrl+ArrowLeft - Page list next +; Alt+Ctrl+ArrowRight - Page list previous +;------------------------------------------------------------------------------ +; version: 2.1 +; last update: 18/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Added color selection for the text. +; Show "change page list" only if the applications +; does not fit in the panel. +; Display file names up to 11 char previously displ. only 8 char. +;------------------------------------------------------------------------------ +; version: 2.0 +; last update: 17/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: New logic of switching windows (turnoff/restore) +; New logic of button "clear desktop". +; Win+D (restore/clear desktop), Win+R (start RUN application). +; Using the library LibINI to set the parameters. +; New style of panel. Start application Menu with boot options. +; two versions of the location of the panel - +; the bottom of the desktop and on top of the desktop. +;------------------------------------------------------------------------------ +; last update: 31/03/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: The program uses only 20 Kb memory is now. +; Code optimizing and refactoring. +;------------------------------------------------------------------------------ +format binary as "" + + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; program start + dd IM_END ; program image size + dd I_END ; reguired amount of memory - 10 Kb + dd stack_top ; esp + dd 0x0 ; boot parameters + dd path ; application pach +;------------------------------------------------------------------------------ +include 'lang.inc' +include '../../../macros.inc' +include '../../../proc32.inc' +;include '../../../debug.inc' +include 'MOI.INC' ;᪫ +include '../../../develop/libraries/box_lib/load_lib.mac' + @use_library ;use load lib macros +;------------------------------------------------------------------------------ +caps_lock_check fix 1 +;------------------------------------------------------------------------------ +time_bgr_color = 0x66cc +;PANEL_HEIGHT = 18 +ML_SIZE = 10 +MR_SIZE = 10 +if lang eq et_EE +MENU_SIZE = 60 +else +MENU_SIZE = 50 +end if +CLD_SIZE = 20 +TAB_SIZE = 75 ;60 +TRAY_SIZE = 140 + +CLOCK_SIZE = 40 +CPU_USAGE_SIZE = 10 +CHLANG_SIZE = 20 +PAGE_LIST_SIZE = 36 +;------------------------------------------------------------------------------ +align 4 +handle_key: + mcall 18,7 + mov [active_process],eax + + mcall 2 + +; dps "panel key: " +; dph eax +; newline + + cmp al, 2 + jnz begin_1.ret + + mov ebx, exec_fileinfo + shr eax, 8 + cmp al, 0 + je prod + + mov [key_r],al + sub [key_r],3 + cmp [key_r],9 + jc alter + +if caps_lock_check + cmp al,58 ;CAPS LOCK DOWN + jne @f + + pusha + mcall 26,2,9 + mov ebx,eax + mov eax,2 + mov [draw_flag_certainly],1 + call draw_flag ; language + popa + ret +@@: +end if + + cmp al, 15 ; Alt+Tab DOWN + jz alt_tab_pressed + + cmp al, 88 ; Ctrl+Alt+F12 + jz start_end_application + + cmp al, 91 ; RWin DOWN + jz set_win_key_flag + + cmp al, 92 ; LWin DOWN + jz set_win_key_flag + + cmp al, 1 ; LCtrl+Esc DOWN + jz set_win_key_flag + + cmp al, 219 ; RWin UP + jz cut_win_key_flag ;start_menu_application + + cmp al, 220 ; LWin UP + jz cut_win_key_flag ;start_menu_application + + cmp al, 129 ; LCtrl+Esc UP + jz cut_win_key_flag ;start_menu_application + + cmp al, 62 ; Alt+F4 + jz kill_active_application + + cmp al, 205 + jz page_list_next + + cmp al, 203 + jz page_list_prev + + cmp al, 69 ; Alt+Shift+NumLock + jz start_mousemul_application + + cmp al, 19 ; Win+R + jz start_run_application + + cmp al, 32 ; Win+D + jz minimize_all_windows + + cmp al, 55 ; PrintScreen DOWN + jz start_PrintScreen_application +;-------------------------------------- +align 4 +prod: + cmp [current_alt_tab_app], -1 + jz @f + + test ah, 0x30 ; Alt+Tab UP + jz alt_tab_released +;-------------------------------------- +align 4 +@@: +; this is hotkey LCtrl+LShift ;or LShift+RShift + jmp karu +;------------------------------------------------------------------------------ +align 4 +set_win_key_flag: + mov [win_key_flag],1 + ret +;------------------------------------------------------------------------------ +align 4 +cut_win_key_flag: + xor eax,eax + mov [win_key_flag],al + xchg [start_menu_flag],al + test al,al + jz start_menu_application + ret +;------------------------------------------------------------------------------ +align 4 +change_key_lang: + mov dword [ebx+8], chlang + mcall 70 +;-------------------------------------- +align 4 +begin_1: + mov ecx,[active_process] + mcall 18, 3 + mcall 5, 25 +;-------------------------------------- +align 4 +.ret: + ret +;------------------------------------------------------------------------------ +align 4 +start_end_application: + mov esi,end_name + call algorithm_anti_duplication + test eax,eax + jz @f + + mcall 18,3,edi + ret +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx + 21],end_name + mcall 70 + ret +;------------------------------------------------------------------------------ +align 4 +start_mousemul_application: + mov esi,mousemul_name + call algorithm_anti_duplication + test eax,eax + jz @f + ret +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx + 21],mousemul_name + mcall 70 + ret +;------------------------------------------------------------------------------ +align 4 +kill_active_application: + mcall 72,1,3,1 + jmp begin_1.ret +;------------------------------------------------------------------------------ + +align 4 +start_menu_application: + call menu_handler + jmp begin_1.ret +;------------------------------------------------------------------------------ +align 4 +start_run_application: + cmp [win_key_flag],1 + je @f + ret +;-------------------------------------- +align 4 +@@: + mov [start_menu_flag],1 + + mov esi,run_name + call algorithm_anti_duplication + test eax,eax + jz @f + + mcall 18,3,edi + ret +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx + 21], run_name + mcall 70 + jmp begin_1.ret +;------------------------------------------------------------------------------ +align 4 +start_PrintScreen_application: + mov esi,printscreen_name + call algorithm_anti_duplication + test eax,eax + jz @f + mcall 18,3,edi + ret +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx + 21],printscreen_name + mov [ebx+8],dword bootparam_printscreen + mcall 70 + jmp begin_1.ret +;------------------------------------------------------------------------------ +align 4 +minimize_all_windows: + cmp [win_key_flag],1 + je @f + ret +;-------------------------------------- +align 4 +@@: + mov [start_menu_flag],1 + call clean_desktop + ret +;------------------------------------------------------------------------------ +align 4 +algorithm_anti_duplication: + cld +;-------------------------------------- +align 4 +@@: + lodsb + test al,al + jnz @r +;-------------------------------------- +align 4 +@@: + std + lodsb + cmp al,'/' + jnz @r + add esi,2 + mov edx,esi + + mov edi,1 +;-------------------------------------- +align 4 +@@: + inc edi + mov ecx,edi + mcall 9,procinfo_window_tabs + + cmp edi,eax + jg .apply_changes + + mov esi,edx + mov ecx,11 + add ebx,9 + cld +;-------------------------------------- +align 4 +.loop: + lodsb + inc ebx + cmp al,[ebx] + jne @r + + loop .loop + + mov eax,1 + ret +;-------------------------------------- +align 4 +.apply_changes: + xor eax,eax + ret +;------------------------------------------------------------------------------ +align 4 +page_list_next: + cmp [page_list],50 + je @f + + xor eax,eax + cmp [page_list_enable],eax + je @f + + inc [page_list] + mov [redraw_window_flag],1 +;-------------------------------------- +align 4 +@@: + jmp begin_1.ret +;------------------------------------------------------------------------------ +align 4 +page_list_prev: + xor eax,eax + cmp [page_list],eax + je @f + + cmp [page_list_enable],eax + je @f + + dec [page_list] + mov [redraw_window_flag],1 +;-------------------------------------- +align 4 +@@: + jmp begin_1.ret +;------------------------------------------------------------------------------ +align 4 +alt_tab_pressed: +; handle Alt+Tab and Alt+Shift+Tab + mov ebp, eax + cmp [current_alt_tab_app], -1 + jnz has_alt_tab_app +; 塞 ⠡ ਫ, ४祭 + xor edx, edx + mov ebx, procinfo_window_tabs + mov ecx, 1 +;-------------------------------------- +align 4 +.fill: + inc ecx + mcall 9 + call need_window_tab + jz @f + + cmp edx, 256 + jz @f + + mov [alt_tab_list+edx*8], ecx + movzx esi, word [ebx+4] + mov [alt_tab_list+edx*8+4], esi + inc edx +;-------------------------------------- +align 4 +@@: + cmp ecx,eax + jb .fill + + mov [alt_tab_list_size], edx + test edx, edx + jz begin_1.ret + + mcall 66,4,0,0 ; ᪠ ࠢ + test eax, eax + jnz begin_1.ret + + xor edx, edx + mov eax, [alt_tab_list+4] + xor ecx, ecx + inc ecx +;-------------------------------------- +align 4 +.findmax: + cmp [alt_tab_list+ecx*8+4], eax + jb @f + + mov edx, ecx + mov eax, [alt_tab_list+ecx*8+4] +;-------------------------------------- +align 4 +@@: + inc ecx + cmp ecx, [alt_tab_list_size] + jb .findmax + + mov [current_alt_tab_app], edx +;-------------------------------------- +align 4 +has_alt_tab_app: + mov eax, [current_alt_tab_app] + mov edx, [alt_tab_list+eax*8+4] ; slot + xor ecx, ecx + or eax, -1 + test ebp, 300h + jz .notshift + + or esi, -1 +;-------------------------------------- +align 4 +.loop1: + cmp [alt_tab_list+ecx*8+4], edx + jbe @f + + cmp [alt_tab_list+ecx*8+4], esi + jae @f + + mov eax, ecx + mov esi, [alt_tab_list+ecx*8+4] +;-------------------------------------- +align 4 +@@: + inc ecx + cmp ecx, [alt_tab_list_size] + jb .loop1 + + cmp eax, -1 + jnz .found + + xor edx, edx + xor ecx, ecx + jmp .loop1 +;-------------------------------------- +align 4 +.notshift: + xor esi, esi +;-------------------------------------- +align 4 +.loop2: + cmp [alt_tab_list+ecx*8+4], edx + jae @f + + cmp [alt_tab_list+ecx*8+4], esi + jbe @f + + mov eax, ecx + mov esi, [alt_tab_list+ecx*8+4] +;-------------------------------------- +align 4 +@@: + inc ecx + cmp ecx, [alt_tab_list_size] + jb .loop2 + + cmp eax, -1 + jnz .found + + or edx, -1 + xor ecx, ecx + jmp .loop2 +;-------------------------------------- +align 4 +.found: + mov [current_alt_tab_app], eax + push eax + xor edx, edx + div [max_applications] + mov [page_list], eax + mov edi, app_list + push edi + mov ecx, 20 + or eax, -1 + rep stosd + pop edi + pop ecx + sub ecx, edx +;-------------------------------------- +align 4 +@@: + cmp ecx, [alt_tab_list_size] + jae redraw_window_tabs + + mov eax, [alt_tab_list+ecx*8] + stosd + inc ecx + jmp @b +;-------------------------------------- +align 4 +alt_tab_released: + mcall 66,5,0,0 ; 㦥 , 墠 :) + + or eax, -1 + xchg eax, [current_alt_tab_app] + mov ecx, [alt_tab_list+eax*8] + mcall 18,3 + + jmp redraw_window_tabs +;------------------------------------------------------------------------------ +align 4 +active_process dd 0 + +exit: + mcall -1 +;------------------------------------------------------------------------------ +START: + mcall 68,11 + mcall 66,1,1 + + mcall 9,process_info_buffer,-1 + mov ecx, [ebx + process_information.PID] ; PID + mcall 18,21 + mov [my_active_slot],eax ; WINDOW SLOT + + +load_libraries l_libs_start,end_l_libs + + test eax,eax + jnz exit + + call Get_ini + + mcall 66,4,0,2 ; LShift+RShift + mcall 66,,,33h ; LCtrl+LShift + mcall 66,,88,110h ; Alt+Ctrl+F12 + mcall 66,,91,0h ; RWin DOWN + mcall 66,,92 ; LWin DOWN + mcall 66,,219 ; RWin UP + mcall 66,,220 ; LWin UP + mcall 66,,19,0h ; Win+R DOWN + mcall 66,,32,0h ; Win+D DOWN + mcall 66,,55,10h ; Ctrl+PrintScreen DOWN + mcall 66,,1,30h ; LCtrl+Esc DOWN + mcall 66,,129 ; LCtrl+Esc UP + mcall 66,,62,300h ; Alt+F4 + mcall 66,,2 ; Alt+1 + mcall 66,,3 ; Alt+2 + mcall 66,,4 ; Alt+3 + mcall 66,,5 ; Alt+4 + mcall 66,,6 ; Alt+5 + mcall 66,,7 ; Alt+6 + mcall 66,,8 ; Alt+7 + mcall 66,,9 ; Alt+8 + mcall 66,,10 ; Alt+9 + mcall 66,,15 ; Alt+Tab DOWN + mcall 66,,15,301h ; Alt+Shift+Tab DOWN + mcall 66,,69 ; Alt+Shift+NumLock + +if caps_lock_check + xor edx,edx + mcall 66,4,58 +end if + mcall 14 + mov [screen_size],eax + + call set_work_ares_pf_screen + + mcall 9,process_info_buffer,-1 + mov ecx,[process_info_buffer.PID] + mcall 18,21 + mov [this_slot],eax + mov [max_slot],255 +;-------------------------------------- +align 4 +start_after_minimize: + call draw_window + call draw_running_applications + + mcall 23,30 + call load_ini +;------------------------------------------------------------------------------ +align 4 +still: + call draw_time + call draw_cpu_usage + call draw_running_applications + + mcall 18,7 ; check if active window changed + cmp eax, [last_active_window] + jz @f +; need_window_tab: +; in: ebx->process info +; out: ZF set <=> do not draw + mov ebx,[last_active_window] + mov [prev_active_window], ebx + mov [last_active_window], eax + + mov ecx, eax + mcall 9,process_info_buffer + + call need_window_tab + jnz .need_repaint + + mcall 9,process_info_buffer,[prev_active_window] + call need_window_tab + jz @f +;-------------------------------------- +align 4 +.need_repaint: + mov dword [active_window_changed], 1 +;-------------------------------------- +align 4 +@@: + mcall 23,20 + + push eax + mcall 18,7 + cmp [my_active_slot],eax + je @f + + mov [current_active_slot],eax +;-------------------------------------- +align 4 +@@: + pop eax + + cmp eax,1 ; redraw ? + jz red + + push eax + mov eax,[redraw_window_flag] + test eax,eax + jz @f + + call draw_window +;-------------------------------------- +align 4 +@@: + pop eax + + cmp eax,2 + jnz @f + call handle_key + jmp .key +;-------------------------------------- +align 4 +@@: + cmp eax,3 ; button ? + jz button +;-------------------------------------- +align 4 +.key: + cmp dword [active_window_changed], 0 + jnz red_active + + call draw_flag ; language + jmp still +;------------------------------------------------------------------------------ +align 4 +set_work_ares_pf_screen: +;eax = [xsize]*65536 + [ysize] + mov ecx,eax + shr ecx,16 + and eax,0xFFFF + cmp [place_attachment],1 + je @f + + ror eax,16 + add eax,[height] + rol eax,16 + mov edx,eax + jmp .selected +;-------------------------------------- +align 4 +@@: + sub eax,[height] + mov edx, eax +;-------------------------------------- +align 4 +.selected: + mcall 48,6 + ret +;------------------------------------------------------------------------------ +align 4 +red_active: +red: + mov dword [active_window_changed], 0 + + mcall 14 + movzx ecx,ax + mov edx,eax + shr edx,16 + cmp [screen_size.height],ax + jne @f + + rol eax,16 + cmp [screen_size.width],ax + je .lp1 + + rol eax,16 +;-------------------------------------- +align 4 +@@: + mov [screen_size],eax + + push ecx edx + call set_work_ares_pf_screen + pop edx ecx + + sub ecx,[height] + mcall 67,0,,,[height] +;-------------------------------------- +align 4 +.lp1: + call draw_window + jmp still +;------------------------------------------------------------------------------ +align 4 +button: + mcall 17 + test eax,0xfffffe00 ; is it close button? (signal from @taskbar) + jz still ; if so - wait for another event, because @taskbar shouldn't be closed + + cmp al, 0 + jnz right_mouse + + cmp ah,50 + jb no_activate + cmp ah,70 + jg no_activate + + movzx ecx,byte ah + sub ecx,52 + shl ecx,2 + + mov ecx,[app_list+ecx] + + mcall 9,process_info_buffer + + test [ebx + process_information.wnd_state], byte 10b ; window is minimized to panel + jnz @f + + cmp ecx,[current_active_slot] + je .turn_off +;-------------------------------------- +align 4 +@@: + mcall 18,3, + jmp .task_switching +;-------------------------------------- +align 4 +.turn_off: + mov edx,ecx + mcall 18,22,0 +;-------------------------------------- +align 4 +.task_switching: + mcall 68,1 + jmp still +;------------------------------------------------------------------------------ +align 4 +right_mouse: + cmp ah,50 + jb still + + cmp ah,70 + jg still + + movzx ecx,byte ah + sub ecx,52 + + cmp ecx, [app_tab_count] + jge still + + shl ecx,2 + mcall 37,0 + mov ebx, eax + shr eax, 16 + mov [x_coord], ax + and ebx, 0xFFFF + mov [y_coord], bx + + mov ecx,[app_list+ecx] ; ecx->selected app.slot + mov [n_slot], ecx + mcall 9,procinfo_for_detect + + mcall 51,1,context_menu_start,ctx_menu_stack + + mov [ctx_menu_PID], eax + jmp still +;------------------------------------------------------------------------------ +align 4 +no_activate: + cmp ah,101 ; minimize to left + je left_button + + cmp ah,102 ; minimize to right + je right_button + + cmp ah, 103 + je clean_desktop_1 ; minimize all windows + + cmp ah,byte 1 ; start/terminate menu + jnz noselect + + call menu_handler + + jmp still +;-------------------------------------- +align 4 +clean_desktop_1: + call clean_desktop + jmp still +;-------------------------------------- +align 4 +noselect: + mov ebx, exec_fileinfo + cmp ah,byte 2 ; start calendar + jnz noid15 ;noclock + + mov esi,calendar_name + call algorithm_anti_duplication + test eax,eax + jz @f + + mcall 18,2,edi + jmp still +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx+21], calendar_name + mcall 70 + jmp still +;-------------------------------------- +align 4 +noid15: + cmp ah,16 + jne noid16 + + call karu + call draw_flag ; language + jmp still +;-------------------------------------- +align 4 +noid16: + cmp ah,18 + jne noid18 + + mov esi,sysmeter_name + call algorithm_anti_duplication + test eax,eax + jz @f + + mcall 18,2,edi + jmp still +;-------------------------------------- +align 4 +@@: + mov ebx, exec_fileinfo + mov dword [ebx+21], sysmeter_name + mcall 70 + jmp still +;-------------------------------------- +align 4 +noid18: + cmp ah,21 + jnz noid21 + + cmp [page_list],50 + jnc still + inc [page_list] + jmp red +;-------------------------------------- +align 4 +noid21: + cmp ah,22 + jnz still + + cmp [page_list],0 + je still + + dec [page_list] + jmp red +;------------------------------------------------------------------------------ +align 4 +restore_desktop: + mcall 9,process_info_buffer,-1 + mov [max_slot], eax + mov ecx, 2 + mov edx, 2 +;-------------------------------------- +align 4 +@@: + mcall 18, 22 + inc edx + cmp edx, [max_slot] + jbe @b + ret +;------------------------------------------------------------------------------ +align 4 +clean_desktop: + mcall 18,23 + test eax,eax + jnz @f + call restore_desktop +;-------------------------------------- +align 4 +@@: + ret +;------------------------------------------------------------------------------ +align 4 +conversion_HEX_to_ASCII: + ror eax,12 + mov ecx,4 +;-------------------------------------- +align 4 +.loop: + mov bl,al + rol eax,4 + and bl,0xf + cmp bl,0xA ; check for ABCDEF + jae @f + + add bl,0x30 ; 0-9 + jmp .store +;-------------------------------------- +align 4 +@@: + add bl,0x57 ; A-F +;-------------------------------------- +align 4 +.store: +; dps "param_store: " + mov [edi],bl + inc edi + dec ecx + jnz .loop + ret +;------------------------------------------------------------------------------ +align 4 +menu_handler: + mov edi,bootparam + + mov eax,[menu_button_x.start] + call conversion_HEX_to_ASCII + + mov eax,[menu_button_x.size] + call conversion_HEX_to_ASCII + + mov eax,[menu_button_y.start] + call conversion_HEX_to_ASCII + + mov eax,[menu_button_y.size] + call conversion_HEX_to_ASCII + + mov eax,[height] + call conversion_HEX_to_ASCII + + mov eax,[place_attachment] + call conversion_HEX_to_ASCII + + xor eax,eax ; terminator for boot parameters string + stosd + + mov ebx, exec_fileinfo + mov [ebx+21],dword menu_name + mov [ebx+8],dword bootparam + mcall 70 + mov [ebx+8],dword 0 + ret +;------------------------------------------------------------------------------ +align 4 +draw_small_right: + pusha + mcall 12,1 + + xor eax,eax + mov edx,[wcolor] + mov esi,edx + mov edi,edx + or edx, 0x01000000 + mcall + + xor ecx,ecx + mov cx,[height] + mcall 8,<0,10>,,1,[wcolor] + + mov ebx,2*65536 ;+6 + mov bx,[height] + shr bx,1 + sub bx,3 + mov edx,[wcolor] + mov eax,COLOR_CHANGE_MAGNITUDE_2 + call add_color_change_magnitude + mov ecx,edx + mcall 4,,,hidetext,1 + + mcall 12,2 + popa + ret +;------------------------------------------------------------------------------ +align 4 +draw_small_left: + pusha + mcall 12,1 + + xor eax,eax + mov edx,[wcolor] + mov esi,edx + mov edi,edx + or edx, 0x01000000 + mcall + + xor ecx,ecx + mov cx,[height] + mcall 8,<0,9>,,1,[wcolor] + + mov ebx,3*65536 ;+6 + mov bx,[height] + shr bx,1 + sub bx,3 + mov edx,[wcolor] + mov eax,COLOR_CHANGE_MAGNITUDE_2 + call add_color_change_magnitude + mov ecx,edx + mcall 4,,,hidetext+1,1 + + mcall 12,2 + popa + ret +;------------------------------------------------------------------------------ +align 4 +right_button: + mov [small_draw],dword draw_small_right + + mcall 14 + + shr eax, 16 + mov ebx, eax + mov ecx, -1 + mov edx, 9 + sub ebx, edx + mov esi, -1 + mcall 67 + + call draw_small_right + jmp small_wait +;------------------------------------------------------------------------------ +align 4 +left_button: + mov [small_draw],dword draw_small_left + + xor ebx,ebx + mcall 67,,-1,9,-1 + + call draw_small_left +;-------------------------------------- +align 4 +small_wait: + mcall 10 + cmp eax,1 + jne no_win + + call [small_draw] + jmp small_wait +;-------------------------------------- +align 4 +no_win: + cmp eax,2 + jne no_key + + call handle_key + jmp small_wait +;-------------------------------------- +align 4 +no_key: + mcall 17 + cmp ah,1 + jne no_full + + mcall 14 ; get screen max x & max y + + mov edx, eax + shr edx, 16 + xor ebx, ebx + mcall 67,,-1,,-1 ; x0 y0 xs ys + + jmp still +;-------------------------------------- +align 4 +no_full: + call menu_handler + jmp small_wait +;------------------------------------------------------------------------------ +include 'libini.inc' +;------------------------------------------------------------------------------ +include '../../../dll.inc' +;------------------------------------------------------------------------------ +include 'drawappl.inc' +;------------------------------------------------------------------------------ +include 'drawbutt.inc' +;------------------------------------------------------------------------------ +include 'drawwind.inc' +;------------------------------------------------------------------------------ +include 'drawtray.inc' +;------------------------------------------------------------------------------ +include 'ctx_menu.asm' +;------------------------------------------------------------------------------ +include 'i_data.inc' +;------------------------------------------------------------------------------ +IM_END: +;------------------------------------------------------------------------------ +include 'u_data.inc' +;------------------------------------------------------------------------------ +I_END: +;------------------------------------------------------------------------------ diff --git a/programs/system/taskbar/trunk/drawwind.inc b/programs/system/taskbar/trunk/drawwind.inc index 525f8fe74..42b855e05 100644 --- a/programs/system/taskbar/trunk/drawwind.inc +++ b/programs/system/taskbar/trunk/drawwind.inc @@ -35,7 +35,7 @@ no_def_width: cmp [place_attachment],1 je @f - + xor ecx,ecx mov cx,[height] dec cx @@ -51,19 +51,19 @@ align 4 ;-------------------------------------- align 4 .attachment_selected: - xor eax,eax ; DEFINE AND DRAW WINDOW + xor eax,eax ; DEFINE AND DRAW WINDOW mov edx, [wcolor] or edx, 0x01000000 ; do not draw the window mov esi, [wcolor] or esi, 0x01000000 ; unmovable window mov edi, [wcolor] mov [panel_x_pos], ebx - mov [panel_y_pos], ecx ; . + mov [panel_y_pos], ecx ; So far ok mcall movzx eax,word [screenxy+2] mov [max_x],eax - + call fill_window call minimize_left_button call minimize_right_button @@ -78,7 +78,7 @@ align 4 ret ;------------------------------------------------------------------------------ align 4 -fill_window: +fill_window: movzx ebx,word [screenxy+2] xor ecx,ecx mov edx,[wcolor] @@ -192,7 +192,7 @@ align 4 .exit: ret ;------------------------------------------------------------------------------ -align 4 +align 4 minimize_right_button: cmp [minimize_right],dword 0 je .exit @@ -247,19 +247,19 @@ align 4 mov ecx, [height] mov edx, 0x60d1ff01 mcall 8,,,,[wcolor] ; MENU BUTTON - + mov eax,ebx shr eax,16 mov [menu_button_x.start],eax - + mov eax,ebx and eax,0xffff mov [menu_button_x.size],eax - + mov eax,ecx shr eax,16 mov [menu_button_y.start],eax - + mov eax,ecx and eax,0xffff mov [menu_button_y.size],eax @@ -268,7 +268,7 @@ align 4 mov edx,[MenuButton_color] ;0x44aa44 mov esi,[wcolor] add ebx,3 shl 16 - 5 - call draw_appl_button + call draw_appl_button add ebx, 4*65536 mov bx,[height] @@ -276,7 +276,7 @@ align 4 sub bx,7 mov ecx,[PanelText_color] or ecx,0x10000000 - if lang eq et_EE + if lang eq et_ET mcall 4,,,m_text,5 else mcall 4,,,m_text,4 @@ -289,7 +289,7 @@ no_menu: je .exit ; calculate and draw clean desktop button mov ebx, (0 shl 16) + CLD_SIZE-5 -; check for left minimize button enabled +; check for left minimize button enabled cmp [minimize_left],dword 0 je @f @@ -300,7 +300,7 @@ align 4 ; check for menu button enabled cmp [menu_enable],dword 0 je @f - + add ebx, MENU_SIZE shl 16 ;-------------------------------------- align 4 @@ -311,7 +311,7 @@ align 4 mov edx, 0x60000000 + 103 mov ecx, [height] mcall 8 ;,,<3,13> - + call calculate_button_y_coordinate_and_size mov edx,[CleanDesktopButton_color] ;time_bgr_color mov esi,[wcolor] @@ -354,31 +354,31 @@ align 4 @@: cmp [clock_enable],dword 0 je @f - + sub eax,CLOCK_SIZE ;-------------------------------------- -align 4 +align 4 @@: cmp [cpu_usage_enable],dword 0 je @f - + sub eax,CPU_USAGE_SIZE ;-------------------------------------- -align 4 +align 4 @@: cmp [chlang_enable],dword 0 je @f - + sub eax,CHLANG_SIZE ;-------------------------------------- -align 4 +align 4 @@: cmp [page_list_enable],dword 0 je @f - + sub eax,PAGE_LIST_SIZE ;-------------------------------------- -align 4 +align 4 @@: mov ebx, TAB_SIZE xor edx,edx @@ -419,11 +419,11 @@ calculate_offset_X: add eax, ML_SIZE ;-------------------------------------- align 4 -@@: +@@: ; check for menu button enabled cmp [menu_enable],dword 0 je @f - + add eax, MENU_SIZE ;-------------------------------------- align 4 diff --git a/programs/testing/cpuid/trunk/CPUID.ASM b/programs/testing/cpuid/trunk/CPUID.ASM index 37c31ae75..355471553 100644 --- a/programs/testing/cpuid/trunk/CPUID.ASM +++ b/programs/testing/cpuid/trunk/CPUID.ASM @@ -1,4329 +1,4281 @@ -;****************************************************************************** -; project name: CPUID * -; platform: KolibriOS, x86 (IA-32), x86-64 achitectures * -; compiler: flat assembler 1.70.03 * -; version: 2.31 * -; last update: 9 October 2018 * -; maintained by: Sergey Kuzmin aka Wildwest * -; e-mail: kuzmin_serg@list.ru * -; site: http://coolthemes.narod.ru/files.html * -; license: Copyright 2004-2018 Sergey Kuzmin and co-authors * -; Rules: * -; 1)you can use pieces of code in your project, but should * -; mention the original author (include copyright notice); * -; 2)if you modify CPUID (improve, port, translate, etc) send * -; your changes to the maintainer or make about post changes * -; at forum http://board.kolibrios.org/viewtopic.php?f=42&t=594* -;-----------------------------------------------------------------------------* -; English comments * -;------------------------------------------------------------------------------ -use32 - org 0x0 - db 'MENUET01' - dd 0x01 - dd START - dd I_END - dd U_END+4096 - dd U_END+4096 - dd 0x0 - dd path - -include '..\..\..\develop\libraries\box_lib\load_lib.mac' -include '..\..\..\macros.inc' -include '../../../gui_patterns.inc' -include '../../../KOSfuncs.inc' -include 'lang.inc' -include 'draw.inc' -include 'brand.inc' ; brand ID decoding -include 'caches.inc' ; L1 and L2 cashes decoding for Intel -include 'multipli.inc' ; multiplier decoding -include 'features.inc' ; features decoding -include 'logos.inc' ; include file where gif's are stored -include 'rsatest.inc' -include 'variable.inc' -include 'gif_lite.inc' - -@use_library - -START: - mcall 68,11 - mcall 66,1,1 - mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors - -load_libraries l_libs_start,end_l_libs -;----------------------------------------------------------------------------- -;OpenDialog initialisation - push dword OpenDialog_data - call [OpenDialog_Init] - - mov edi,filename_area - mov esi,start_temp_file_name - call copy_file_name_path -;----------------------------------------------------------------------------- - mcall 68,12,4096*8 ; 16 Kb - I hope this will be enough for store of data - mov [store_text_area_start],eax - - -;------------ -CYCLES: -; CPU speed - mov eax, 18 - mov ebx,5 - mcall - mov [total1],eax ;in Hz, example 1600490000 - xor edx,edx - mov ebx,1000000 - div ebx - mov [total], eax ; in Mhz, example 1600 - xor edx, edx - mov eax, [total1] - mov ebx, 10000 - div ebx - mov [ost], eax ; example 160049 - mov ecx, [total] - imul ecx, 100 - neg ecx - add ecx, eax - mov [sot], ecx ; example 49 -;------------ -cpu: ;is CPUID supported? - pushfd ;push original EFLAGS - pop eax ;get original EFLAGS - mov ebx, eax ;save original EFLAGS - xor eax, 00200000h ;flip 21th bit in EFLAGS - push eax ;save new EFLAGS value on stack - popfd ;replace current EFLAGS value - pushfd ;get new EFLAGS - pop eax ;store new EFLAGS in EAX - cmp eax, ebx ;compare values of 21th bit - jz NO_CPUID ;CPUID isn't supported -;------------ -CPUNAME: ; VENDOR - mov eax,0 ; eax=0 - cpuid - - mov [stdc], eax ; number of calls - mov [cpuname+ 12],ebx - mov [cpuname+ 16],edx - mov [cpuname+ 20],ecx - mov [smallvendor],ecx - -; for various vendors we should later use different methods - -;Decoding cache L1 and L2 for Intel - - cmp ecx, 'ntel' - jne cpu1 ;is not Intel - -;Starting L1, L2, L3 caches detection (Intel made it VERY HARD) - - mov eax, 2 - cpuid - - mov [che], al ; number of calls -multik: - -.eaxl: - test eax, eax ; Test bit 31 - js .ebxl ; <> 0 =>invalid values - call decodecache24 -.ebxl: - test ebx, ebx - js .ecxl - mov eax, ebx - call decodecache32 -.ecxl: - test ecx, ecx - js .edxl - mov eax, ecx - call decodecache32 -.edxl: - test edx, edx - js cpu1 - mov eax, edx - call decodecache32 - - dec [che] ; we made all calls - je cpu1 - -multi: ; not yet - - mov eax, 2 ; so we made call again - cpuid - - jmp multik - -; FAMILY MODEL STEPPING -cpu1: - xor eax, eax - inc eax ; eax=1 - cpuid - - mov ecx, eax - shr ecx,8 ; shift it to the correct position - and ecx,0000000Fh ; get CPU family - mov dword[f],ecx - - mov ecx, eax - shr ecx,4 - and ecx,0000000Fh ; get CPU model - mov dword[m],ecx - - mov ecx, eax - and ecx,0000000Fh ; get CPU stepping - mov dword[s],ecx - - ;- - mov ecx, eax ; get Type - shl ecx, 18 - shr ecx,30 - ;and ecx, 0000000Fh ; only two lower bits can be nonzero - mov dword[t], ecx -;======================================================= - - cmp dword[smallvendor], 'cAMD' - jz maybe_athlon - cmp dword[smallvendor], 'ntel' - jnz no_full ; if not AMD or Intel - -;detect_it: -;cmp [f], 0Fh -;jne no_full fixed calculation of extended model for Intel - -full: - - mov ecx, eax ; get Extended model - shr ecx,16 ;shift it to the correct position - and ecx, 0000000Fh - shl ecx, 4 - mov dword[newpc],ecx ; this value for old pc=0 and for new pc>0 - add ecx, [m] - mov dword[em],ecx ; effective model - - mov ecx, eax ; get Extended family - shr ecx, 20 ;shift it to the correct position - and ecx, 000000FFh - add ecx, [f] - mov dword[ef],ecx ; effective family - - - jmp fut - -no_full: - - mov ecx, [m] - mov [em], ecx - - mov ecx, [f] - mov [ef], ecx - - jmp fut - -maybe_athlon: - mov eax, 0x80000001 ; CPUID ext. function 0x80000001 - cpuid - mov ecx, eax - shr ecx,8 ; shift it to the correct position - and ecx,0000000Fh ; get CPU family - mov dword[ef],ecx - - mov ecx, eax - shr ecx,4 - and ecx,0000000Fh ; get CPU model - mov dword[em],ecx - -fut: - - call decode_sse3_5 - - - - ;call decode_sse3_5 - ;- - call decode_extended - - mov eax,$80000000 - cpuid - - mov [extc], eax ; max number of calls - - test eax, $80000000 ;// Test bit 31 - jz .noname - - cmp eax,$80000003 - ja .mynameis - jmp .noname - -.mynameis: - mov eax,$80000002 - cpuid - mov [myname],eax - mov [myname+4],ebx - mov [myname+8],ecx - mov [myname+12],edx - mov eax,$80000003 - cpuid - mov [myname+16],eax - mov [myname+20],ebx - mov [myname+24],ecx - mov [myname+28],edx - mov eax,$80000004 - cpuid - mov [myname+32],eax - mov [myname+36],ebx - mov [myname+40],ecx - mov [myname+44],edx - jmp red - -.noname: - -red: - - ;mov byte [multiplier], 115; ; for testing - - call decode_sse3 - - call multipl ; get multiplier - mov byte [multiplier], cl - - mov dword [freqbb], 0 - mov dword [freqll], 0 - - mov ebx, dword [multiplier] - test ebx, ebx - jz output - - calc: - - mov eax,dword [ost] ; example 166474 - imul eax, 10 ; example 1664740 - xor edx,edx - div ebx ; get system clock (if multiplier detected) - - xor edx, edx ; example eax=16647 - mov ebx, 100 - div ebx - mov dword [freqbb], eax ; example 166 - mov dword [freqll], edx ; example 47 - - xor edx, edx - mov eax,dword[multiplier] ; example 115 - mov ebx,10 - div ebx - mov dword[multb], eax ; example 11 - mov dword[multa], edx ; example 5 - -output: - - call draw_window ; Draw window - -;HRERE - -PROCCORE: ; Who are you? -; Intel - "GenuineIntel" + -; AMD - "AuthenticAMD" + -; Cyrix - "CyrixInstead" + -; UMC - "UMC UMC UMC " -; NexGen - "NexGenDriven" -; Centaur - "CentaurHauls" + -; Rise Technology - "RiseRiseRise" -; SiS - "SiS SiS SiS " -; Transmeta - "GenuineTMx86" + -; National Semiconductor - "Geode by NSC" -; Vortex - "Vortex86 SoC" + initial support - cmp dword[smallvendor], 'ntel' ;1 - jz Intel - cmp dword[smallvendor], 'cAMD' ;2 - jz AMD - cmp dword[smallvendor], 'tead' ;3 - jz Cyrix - cmp dword[smallvendor], 'auls' ;4 - jz Centaur - cmp dword[smallvendor], 'Mx86' ;5 - jz Transmeta - cmp dword[smallvendor], ' SoC' ;6 - jz Vortex - -; cmp ecx, 'UMC ' -; jz .UMC -; cmp ecx, 'iven' -; jz .NexGen -; cmp ecx, 'Rise' -; jz .Rise -; cmp ecx, 'SiS ' -; jz .SiS -; cmp ecx, ' NSC' -; jz .NSC -; jmp Other ; I don't know what to do with you... -Other: - Text 75,70,0x00000000,other, otherlen-other - - mov esi, other - mov edi, [saveproc] - call concatname - - jmp MMXtest -;------------------------- - -AMD: - -;------------------------------------------------------------------------------- - - Text 15, 190,0x00000000,cache, cachelen-cache - - Text 75,70,,AMDn, AMDnlen-AMDn - mov esi, AMDnNew - mov edi, saveproc - call concatname - mov esi, amd - call load_gif - PutImage 135,107,201,49,img_area+8 - MOV [codeN], 2 -; place size - -; Relax, man. AMD made PRETTY SIMPLE cache detection routine -;CACHE1: - mov eax, 80000005h - cpuid - - movzx eax, cl - mov [lineld], eax - - mov eax, ecx - ;shl eax, 8 - ;shr eax, 24 - - and eax,00FF0000h - shr eax, 16 - mov [wayld], eax - - shr ecx, 24 - mov [L1d], ecx - - - movzx eax, dl - mov [lineli], eax - - mov eax, edx - ;shl eax, 8 - ;shr eax, 24 - - and eax,00FF0000h - shr eax, 16 - mov [wayli], eax - - - shr edx, 24 - mov [L1i], edx - - -;CACHE2: - mov eax, 80000006h - cpuid - - movzx eax, cl - mov dword[linel2], eax - - push ecx - shr ecx, 12+1 - and ecx, 0x7 - mov eax, 1 - shl eax, cl - mov dword [wayl2], eax - pop ecx - - shr ecx, 16 - mov [L2],ecx - -;CACHE3: edx provides l3 - - mov eax, 80000006h - cpuid - - movzx eax, cl ;mov cl to eax, zero extend; cl is counter reg for loop,shifts - mov dword[linel3], eax - - push edx - shr edx, 12+1 - and edx, 0x7 - mov eax, 1 - shl eax, cl - mov dword [wayl3], eax - pop edx - - shr edx, 18 - mov [L3],ecx - - cmp [f], $5 - jz .fiv - cmp [f], $6 - jz .si - cmp [f], $F - jz fif - cmp [f], $10 ;family 16, 010h, - jz ten - - -.fiv: ; Family=5 - mov [micron], 50 - mov edx, A50 - cmp [m], $0 - jz @f - mov [micron], 35 - mov edx, A51 - cmp [m], $1 - jz @f - mov edx, A52 - cmp [m], $2 - jz @f - mov edx, A53 - cmp [m], $3 - jz @f - mov [micron], 30 - mov edx, A56 - cmp [m], $6 - jz @f - mov [micron], 25 - mov edx, A57 - cmp [m], $7 - jz @f - mov edx, A58 - cmp [m], $8 - jz @f - mov edx, A59 - cmp [m], $9 - jz @f - mov [micron], 18 - mov edx, A5D -@@: - jmp @f - -.si: ; Family=6 - mov [micron], 25 - mov edx, At1 - cmp [m], $1 - jz @f - mov [micron], 18 - mov edx, At2 - cmp [m], $2 - jz @f - mov edx, At3 - cmp [m], $3 - jz @f - mov edx, At4 - cmp [m], $4 - jz @f - cmp [m], $6 - jz A6 - mov [micron], 13 - mov edx, At7 - cmp [m], $7 - jz @f - cmp [m], $8 - jz A8 - jmp AA -@@: - mov [cname], edx - jmp MMXtest -A6: -;mov [FRS], 266 ;!!!!!! -;Number 315,90,0,3,dword [FRS],0x000000; MHz - - call newrating; !!!! - - Text 245,70,0x00000000,pr, prlen-pr - Number 310,70,0,4,dword [rating],0x000000 - mov edx, At6 - jmp @b - -A8: - -;mov [FRS], 266 ;!!!!!! -;Number 315,90,0,3,dword [FRS],0x000000; MHz - - cmp [L2], 256 - jl .App ; Applebred - - call newrating;!!!! - - Text 245,70,0x00000000,pr, prlen-pr - Number 310,70,0,4,dword [rating],0x000000 - mov edx, At8 - jmp @b - -.App: - mov edx, At8a - jmp @b - -AA: - -; mov [FRS], 333; !!!! - Text 245,70,0x00000000,pr, prlen-pr - -; Number 315,90,0,3,dword [FRS],0x000000; MHz - - mov edx, Atat - cmp [L2], 256 - jl .Tho ; Thorton - mov edx, Ata -.Tho: - push edx - - call newrating;!!!!! - - Number 310,70,0,4,dword [rating],0x000000 - pop edx - jmp @b - -fif: ; AMD-64 Family=15 - -;here is a need to rewrite detection of AMD F-th family according to "Revision Guide for -;AMD AthlonTM 64 and AMD OpteronTM Processors" 25759.pdf - - - cmp [m],$1 ;Dual-core Opteron - jz AF1. - cmp [m],$3 ;Toledo 1024 0.09 - jz AF3. - cmp [m],$4 ;Athlon 64 Mobile Athlon 64 FX ClawHammer (1024) 0.13 - jz AF4. - cmp [m],$5 ;Opteron Athlon 64 FX 0.13 (1024) - jz AF5. - cmp [m],$7 ;Athlon 64 Athlon 64 FX Clawhammer(1024) 0.13 Sledgehammer(1024) 0.13 // SSE3+ SanDiego(1024) - jz AF7. - cmp [m],$8 ;Athlon 64 Mobile Athlon 64 FX ClawHammer (1024) 0.13 - jz AF8. - cmp [m],$B ;Athlon 64 - jz AFB. - cmp [m],$C ;Athlon 64 Newcastle(512) 0.13 Sempron> Paris (256) 0.13 |SSE3+ Sempron > Palermo FC0 0.09 // (Venice) - jz AFC. - cmp [m],$E ;Athlon 64 - jz AFE. - cmp [m],$F ;Athlon 64 Winchester(512) |SSE3+ SanDiego(1024) Venice (512) Palermo (256) 0.09 - jz AFF. - jmp next_generation - -ten: ;family = 10h - - cmp [m],$2 - jz AB23. - cmp [m], $8 - jz AB83. - cmp [m], $9 - jz AB9. - cmp [m], $2 - jz AB8check2. - -AB8check2.: - cmp [s],03h - jz AB8right2. - cmp [m],$2 - jz athlonCheck - -athlonCheck: - cmp [s],03h - jz athlonKuma - - cmp [m], $5 - jz AB4. - cmp [m],$1 - jz AB1. - cmp [m],$4 - jz AB8check. - -AB8check.: - cmp [s],02h - jz ABC2. - cmp [s],01h - jz ABC3. - cmp [m], $9 - jz AB6. - cmp [m], $2 - jz AB8check. - cmp [m], 06h - jz ABM. - -athlonKuma: - mov [micron], 65 - Text 100,70,0x00000000,AthlonKuma, AthlonKumalen-AthlonKuma - mov esi, AthlonKuma - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB23.: - mov [micron], 65 - Text 100,70,0x00000000,AB23, AB23len-AB23 - mov esi, AB23 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB83.: - mov [micron], 65 - Text 100,70,0x00000000,AB83, AB83len-AB83 - mov esi, AB83 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB9.: - mov [micron], 65 - Text 100,70,0x00000000,AB9, AB9len-AB9 - mov esi, AB9 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB8right2.: - mov [micron], 65 - Text 100,70,0x00000000,AB8right2, AB8right2len-AB8right2 - mov esi, AB8right2 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB4.: - mov [micron], 45 - Text 100,70,0x00000000,AB4, AB4len-AB4 - mov esi, AB4 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB1.: - mov [micron], 65 - Text 100,70,0x00000000,AB1, AB1len-AB1 - mov esi, AB1 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -ABC2.: - mov [micron], 45 - Text 100,70,0x00000000,ABC2, ABC2len-ABC2 - mov esi, ABC2 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AB6.: - mov [micron], 45 - Text 100,70,0x00000000,AB6, AB6len-AB6 - mov esi, AB6 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -ABC3.: - mov [micron], 45 - Text 100,70,0x00000000,ABC3, ABC3len-ABC3 - mov esi, ABC3 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -ABM.: - mov [micron], 45 - Text 100,70,0x00000000,ABM2, ABM2len-ABM - mov esi, ABM2 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AF1.: - mov [micron], 09 ;? - Text 100,70,0x00000000,AF1, AF1len-AF1 - mov esi, AF1 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest -AF3.: - mov [micron], 09 - Text 100,70,0x00000000,AF3, AF3len-AF3 - mov esi, AF3 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest -AF4.: - mov [micron], 13 - Text 100,70,0x00000000,AF4, AF4len-AF4 - mov esi, AF4 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest -AF5.: - mov [micron], 13 - Text 100,70,0x00000000,AF5, AF5len-AF5 - jmp MMXtest - -AF7.: - mov [micron], 13 - Text 100,70,0x00000000,AF5, AF5len-AF5 - mov esi, AF5 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AF8.: - mov [micron], 13 - Text 100,70,0x00000000,AF4, AF4len-AF4 - mov esi, AF4 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AFB.: - mov [micron], 13 - Text 100,70,0x00000000,AF4, AF4len-AF4 - mov esi, AF4 - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AFC.: - cmp [L2], 512 - je AFC.n - - cmp [sse3sup], 1 - je AFC.npal - -AFC.npar: ; paris - mov [micron], 13 - Text 100,70,0x00000000,AFCs, AFCslen-AFCs - mov esi, AFCs - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AFC.npal: ; palermo - mov [micron], 9 - Text 100,70,0x00000000,AFCsp, AFCsplen-AFCsp - mov esi, AFCsp - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AFC.n: ;newcastle - mov [micron], 13 - Text 100,70,0x00000000,AFC, AFClen-AFC - mov esi, AFC - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -AFE.: ; error in cpu - jmp AFC. - -AFF.: - - cmp [sse3sup], 1 - je .AFFsse - -.win: - mov [micron], 9 ; winchester - jmp MMXtest - -.AFFsse: - mov [micron], 9 - cmp [L2], 1024 - jz .AFs - cmp [L2], 512 - jz .AFd - cmp [L2], 256 - jz .AFp - -.AFs: - Text 100,70,0x00000000,AFS, AFSlen-AFS - mov esi, AFS - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -.AFd: - Text 100,70,0x00000000,AFV, AFVlen-AFV - mov esi, AFV - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest - -.AFp: - Text 100,70,0x00000000,AFCsp, AFCsplen-AFCsp - mov esi, AFCsp - mov edi, saveproc + 0x4 - call concatname - jmp MMXtest -;----------------------------------------------- -Intel: - mov [codeN], $1 - Text 75,70,0x00000000,Inteln, Intelnlen-Inteln - mov esi, IntelnNew - mov edi, saveproc - call concatname - mov esi, intel - call load_gif - PutImage 135,107,201,49,img_area+8 - -det: - cmp [f], $5 - jz five - cmp [f], $6 - jz six - cmp [f], $7 - jz sev - cmp [f], $F - jz fift -five: ;Family=5 - - Text 15, 190,0x00000000,cache, cachelen-cache - - cmp [m],$0 - jz .I0 - cmp [m],$1 - jz .I1 - cmp [m],$2 - jz .I2 - cmp [m],$3 - jz .I3 - cmp [m],$4 - jz .I4 - cmp [m],$7 - jz .I7 - cmp [m],$8 - jz .I8 -.I0: - mov [cname], P50 - mov esi, P50 - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 80 - jmp MMXtest -.I1: - mov [cname], P5 - mov esi, P5 - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 50 - jmp MMXtest - -.I2: - mov [cname], P54C - mov esi, P54C - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 50 - jmp MMXtest - -.I3: - mov [cname], P54T - mov esi, P54T - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 50 - jmp MMXtest - -.I4: - mov [cname], P55C - mov esi, P55C - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 35 - jmp MMXtest - - -.I7: - mov [cname], P54C - mov esi, P54C - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 8 - mov [L1i], 8 - mov [L2], 256 - mov [micron], 35 - jmp MMXtest - -.I8: - mov [cname], P55C - mov esi, P55C - mov edi, saveproc + 0x6 - call concatname - mov [L1d], 16 - mov [L1i], 16 - mov [L2], 256 - mov [micron], 35 - jmp MMXtest - -six: ;Family=6 - - Text 15, 190,0x00000000,cache, cachelen-cache - cmp [newpc],$0 - jnz NEWintel - - cmp [m],$0 - jz .I60 - cmp [m],$1 - jz .I61 - cmp [m],$3 - jz .I63 - cmp [m],$5 - jz .I65 - cmp [m],$6 - jz .I66 - cmp [m],$7 - jz .I67 - cmp [m],$8 - jz .I68 - cmp [m],$9 - jz .I69 - cmp [m],$A - jz .I6A - cmp [m],$B - jz .I6B - cmp [m],$D - jz .I6D - cmp [m],$E - jz .I6E - cmp [m],$F - jz .I6F -.I60: - mov [micron], 50 - mov [cname], P60 - mov esi, P60 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I61: - mov [micron], 35 - mov [cname], P61 - mov esi, P61 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I63: - mov [micron], 28 - mov [cname], P63 - mov esi, P63 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I65: - mov [micron], 25 - cmp [L2], 0 - jne .pp65 ; Pentium - mov [cname], P65c - mov esi, P65c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.pp65: - mov [cname], P65 - mov esi, P65 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.I66: - mov [micron], 25 - mov [cname], P66 - mov esi, P66 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.I67: - mov [micron], 25 - ;but if SSE4.1 supported then it is Intel Core (Penryn) - mov [cname], P67 - mov esi, P67 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I68: - mov [micron], 18 - cmp [L2], 128 - jne .pp68 ; Pentium - mov [cname], P68c - mov esi, P68c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - - .pp68: - mov [cname], P68 - mov esi, P68 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I69: - mov [micron], 13 - mov [cname], P69 - mov esi, P69 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I6A: - mov [micron], 18 - ;but if SSE4.2 supported then it is Intel Core (Nehalem) - mov [cname], P6A - mov esi, P6A - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I6B: - mov [micron], 13 - cmp [L2], 256 - jne .pp6B ; Pentium - mov [cname], P6Bc - mov esi, P6Bc - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.pp6B: - mov [cname], P6B - mov esi, P6B - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I6D: - mov [micron], 9 - mov [cname], P6D - mov esi, P6D - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I6E: - mov [micron], 6 - mov [cname], P6E - mov esi, P6E - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.I6F: - mov [micron], 6 - mov [cname], P6F - mov esi, P6F - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -;06Ex - Pentium M Yonah 0.065 -;06Fx - Pentium D Conroe 0.065, Xeon Woodcrest, Celeron D AllenDale, Core 2 Kentsfield - -NEWintel: - - cmp [em],$3A ;IvyBridge - jz I3A - cmp [em],$2A ;SandyBridge - jz I2A - cmp [em],$2D ;SandyBridge-E/EN/EP - jz I2D - cmp [em],$25 ;Arrandale/Clarksdale - jz I25 - cmp [em],$2C ;Gulftown/Westmere-EP - jz I2C ;westmere-EP stepping B1 -> micron 0.032 - cmp [em],$2F ;Westmere-EX - jz I2F - cmp [em],$1E ;Clarksfield/Lynnfield/Jasper Forest - jz I1E - cmp [em],$1A ;Bloomfield/Nehalem-EP - jz I1A - cmp [em],$2E ;Nehalem-EX - jz I2E - cmp [em],$17 ;Yorkfield/Wolfdale/Penryn/Harpertown (DP) - jz I17 - cmp [em],$1D ;Dunnington (MP) - jz I1D - cmp [em],$0F ;Clovertown/Kentsfield/Conroe/Merom/Woodcrest - jz I0F - cmp [em],$16 ;Merom Conroe - jz I16 - cmp [em],$06 ;Cedar Mill/Presler - jz I06 - cmp [em],$03 ;Nocona Irwindale / Prescott - jz I03 - cmp [em],$04 ;NoconaIrwindale / Prescott - jz I03 - cmp [em],$0D ;Dothan - jz I0D - cmp [em],$36 ;Cedarview - jz I36 - cmp [em],$26 ;Lincroft - jz I26 - cmp [em],$1C ;Pineview/Silverthorne - jz I1C - mov [cname], no_known - -Inewunknown: - jmp MMXtest - -I3A: - mov [micron], 32 - mov [cname], P3A - mov esi, P3A - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I2A: - mov [micron], 32 - mov [cname], P2A - mov esi, P2A - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I2D: - mov [micron], 32 - mov [cname], P2D - mov esi, P2D - mov edi,saveproc + 0x10 - call concatname - jmp MMXtest - -I25: - mov [micron], 32 - mov [cname], P25 ;P25 - mov esi, P25 - mov edi, saveproc + 0x10 ;12 - call concatname - jmp MMXtest - -I2C: - mov [micron], 32 - mov [cname], P2C - mov esi, P2C - mov edi,saveproc + 0x10 - call concatname - jmp MMXtest - -I2F: - mov [micron], 32 - mov [cname], P2F - mov esi, P2F - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I1E: - mov [micron], 32 - mov [cname], P1E - mov esi, P1E - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I1A: - mov [micron], 45 - mov [cname], P1A - mov esi, P1A - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I2E: - mov [micron], 45 - mov [cname], P2E - mov esi, P2E - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I17: - mov [micron], 45 - mov [cname], P17 - mov esi, P17 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I1D: - mov [micron], 45 - mov [cname], P1D - mov esi, P1D - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I0F: - mov [micron], 65 - mov [cname], P0F - mov esi, P0F - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I16: - mov [micron], 65 - mov [cname], P16 - mov esi, P16 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I06: - mov [micron], 32 - mov [cname], P06 - mov esi, P06 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I03: - mov [micron], 32 - mov [cname], P03 - mov esi, P03 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I0D: - mov [micron], 32 - mov [cname], P0D - mov esi, P0D - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I36: - mov [micron], 32 - mov [cname], P36 - mov esi, P36 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I26: - mov [micron], 32 - mov [cname], P26 - mov esi, P26 - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - -I1C: - mov [micron], 32 - mov [cname], P1C - mov esi, P1C - mov edi, saveproc + 0x10 - call concatname - jmp MMXtest - - -;;;;;;;;;;;;;;;;;;; -sev: ;Family=7 -.IS0: - - Text 15, 190,0x00000000,cache, cachelen-cache - mov [micron], 18 - mov [cname], PS0 - mov esi, PS0 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -fift: ;Family=15 - - Text 15, 190,0x00000000,cacheP4, cacheP4len-cacheP4 - - cmp [m],$0 - jz .IF0 - cmp [m],$1 - jz .IF1 - cmp [m],$2 - jz .IF2 - cmp [m],$3 - jz .IF3 - cmp [m],$4 - jz .IF3 ;identical to F3xh - cmp [m],$5 - jz .IF5 - cmp [m],$6 - jz .IF6 - jmp next_generation -.IF0: - mov [micron], 18 - cmp [L2], 128 - jne .ppF0 ; Pentium - mov [cname], PF0c - mov esi, PF0c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.ppF0: - mov [cname], PF0 - mov esi, PF0 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.IF1: - mov [micron], 18 - cmp [L2], 128 - je .IF0;jne.ppF1 ; Pentium - ; mov eax,dword 0x00000004 - ; mov ebx,115*65536+80 - ; mov ecx,dword 0x00000000 - ; mov edx,PF0c - ; mov esi,PF0clen-PF0c - ; mcall - ;jmp MMXtest -;.ppF1: - mov [cname], PF0 - mov esi, PF0 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.IF2: - mov [micron], 13 - cmp [L2], 128 - jne .ppF2 ; Pentium - mov [cname], PF2c - mov esi, PF2c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.ppF2: - mov [cname], PF2 - mov esi, PF2 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.IF3: - mov [micron], 09 - cmp [L2], 256 - jne .ppF3 ; Pentium - mov [cname], PF3c - mov esi, PF3c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.ppF3: - mov [cname], PF3 - mov esi, PF3 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.IF5: - mov [micron], 09 - cmp [L2], 512 - jae .ppF5 ; Pentium - mov [cname], PF5c - mov esi, PF5c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.ppF5: - mov [cname], PF5 - mov esi, PF5 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - - .IF6: - mov [micron], 06 ; 065 - cmp [L2], 512 - ja .ppF6 ; Pentium - mov [cname], PF6c - mov esi, PF6c - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.ppF6: - mov [cname], PF6 - mov esi, PF6 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - - - next_generation: - mov [cname], NG - mov esi, NG - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -;---------------------------------- -Cyrix: - - mov [codeN], 3 - Text 15, 190,0x00000000,cache, cachelen-cache - - mov esi, cyrix - call load_gif - PutImage 135,107,201,49,img_area+8 - - - cmp [f], $5 - jz .fivv - cmp [f], $6 - jz .sixx -.fivv: ;Family=5 - cmp [m],$2 - jz .C52 - cmp [m],$4 - jz .C54 -.C52: - mov [micron], 50 ;35? - mov [L1i], 8 - mov [L1d], 8 - mov [L2], 512 - Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn - mov esi, Cyrixn - mov edi, saveproc - call concatname - mov [cname], C52 - mov esi, C52 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.C54: - mov [micron], 50 - mov [L1i], 8 - mov [L1d], 8 - mov [L2], 512 - Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn - mov esi, Cyrixn - mov edi, saveproc - call concatname - mov [cname], C54 - mov esi, C54 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest - -.sixx: ;Family=6 - cmp [m],$0 - jz .C60 - cmp [m],$5 - jz .C65 -.C60: - mov [micron], 25 - mov [L1i], 32 - mov [L1d], 32 - mov [L2], 512 - Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn - mov esi, Cyrixn - mov edi, saveproc - call concatname - mov [cname], C60 - mov esi, C60 - mov edi, saveproc + 0x6 - call concatname - jmp MMXtest -.C65: - mov [micron], 25 ;35? - mov [L1i], 32 - mov [L1d], 32 - mov [L2], 512 - Text 75,70,0x00000000,Centaurn, Centaurnlen-Centaurn - mov esi, Centaurn - mov edi, saveproc - call concatname - mov edx,C65 - mov esi,C65len-C65 - jmp OutProcName -;--------------------- -Centaur: - - Text 15, 190,0x00000000,cache, cachelen-cache - -;CACHE1: - mov eax, 80000005h - cpuid - shr ecx, 24 - mov [L1d], ecx - shr edx, 24 - mov [L1i], edx - -; cache detection routine -;CACHE1: - mov eax, 80000005h - cpuid - - movzx eax, cl - mov [lineld], eax - - mov eax, ecx - shr eax, 16 - and eax,000000FFh - mov [wayld], eax - - shr ecx, 24 - mov [L1d], ecx - - movzx eax, dl - mov [lineli], eax - - mov eax, edx - - shr eax, 16 - and eax,000000FFh - mov [wayli], eax - - shr edx, 24 - mov [L1i], edx - - -;CACHE2: - mov eax, 80000006h - cpuid - - cmp [f], $6 - jz vn - jmp vl2old ; if not then old identification -vn: - cmp [m],$9 - jl vl2old - ; else new - movzx eax, cl - mov dword[linel2], eax - - mov eax, ecx - shl eax, 16 - shr eax, 28 - - mov dword[wayl2], eax - - shr ecx, 16 ; it is 16 bits now - mov [L2],ecx - - - -vl2old: - movzx eax, cl - mov dword[linel2], eax - - mov eax, ecx - shl eax, 8 - shr eax, 24 - - mov dword[wayl2], eax - - shr ecx, 24 ; it was 8 bits earlier - mov [L2],ecx - - - cmp [f], $5 - jz fivC - cmp [f], $6 - jz sixC - -fivC: ;Family=5 - - mov esi, idt - call load_gif - PutImage 135,107,201,49,img_area+8 - ;PutImage 125,107,201,49,img_area+8 - ; place size - - Text 75,70,0x00000000,IDTn, IDTnlen-IDTn - mov esi, IDTn - mov edi, saveproc + 0x4 - call concatname - cmp [m],$4 - jz .V54 - cmp [m],$8 - jz .V58 - cmp [m],$9 - jz .V59 -.V54: - mov [micron], 35 - mov edx,V54 - mov esi,V54len-V54 - jmp OutProcName -.V58: - mov [micron], 25 - mov edx,V58 - mov esi,V58len-V58 - jmp OutProcName -.V59: - mov [micron], 25 - mov edx,V59 - mov esi,V59len-V59 - jmp OutProcName - -sixC: ;Family=6 - - mov esi, via - call load_gif - PutImage 135,107,201,49,img_area+8 - - - Text 75,70,0x00000000,Centaurn, Centaurnlen-Centaurn - mov esi, Centaurn - mov edi, saveproc - call concatname - cmp [m],$6 - jz .V66 - cmp [m],$7 - jz .V67 - cmp [m],$8 - jz .V68 - cmp [m],$9 - jz .V69 - cmp [m],$A - jz .V6A -.V66: - mov [micron], 18 ; 25? - mov edx,V66 - mov esi,V66len-V66 - jmp OutProcName -.V67: - mov [micron], 15 - mov edx,V67 - mov esi,V67len-V67 - jmp OutProcName -.V68: - mov [micron], 13 - mov edx,V68 - mov esi,V68len-V68 - jmp OutProcName -.V69: - mov [micron], 13 - mov edx,V69 - mov esi,V69len-V69 - jmp OutProcName -.V6A: - mov [micron], 9 - mov edx,VA - mov esi,VAlen-VA - jmp OutProcName -;----------- -Transmeta: - - Text 15, 190,0x00000000,cache, cachelen-cache - - Text 75,70,,Tranmsmetan, Tranmsmetanlen-Tranmsmetan - mov esi, Tranmsmetan - mov edi, saveproc - call concatname - - mov esi, transmeta - call load_gif - PutImage 135,107,201,49,img_area+8 - -; cache detection routine - it is the same as for AMD (almost) -;CACHE1: - mov eax, 80000005h - cpuid - - movzx eax, cl - mov [lineld], eax - - mov eax, ecx - - shr eax,16 - and eax,000000FFh - mov [wayld], eax - - shr ecx, 24 - mov [L1d], ecx - - movzx eax, dl - mov [lineli], eax - - mov eax, edx - - shr eax, 16 - and eax,000000FFh - mov [wayli], eax - - shr edx, 24 - mov [L1i], edx - - -;CACHE2: - mov eax, 80000006h - cpuid - - movzx eax, cl - mov dword[linel2], eax - - mov eax, ecx - shl eax, 16 - shr eax, 28 - - mov dword[wayl2], eax - - shr ecx, 16 - mov [L2],ecx - - - cmp [f], $5 - jz .fivt - cmp [f], $F - jz .fift -.fivt: ; Family=5 - - mov edx,T5 - mov esi,T5len-T5 - jmp @f - -.fift: ; Family=F - mov edx,TF - mov esi,TFlen-TF -@@: - mov [micron], 13 ; - Text 140,70,0 - jmp MMXtest - -OutProcName: - Text 100,70,0 - -;---- -;---------------------------------- new -Vortex: - - Text 15, 190,0x00000000,cache, cachelen-cache - - mov esi, vortex - call load_gif - PutImage 135,107,201,49,img_area+8 - ;PutImage 130,127,201,49,img_area+8 - ; place size - - cmp [f], $5 - jz .V54 ;fivvtx -;.fivvtx: ;Family=5 -; cmp [m],$4 -; jz .V54 -.V54: - mov [micron], 13 - mov [L1i], 16 - mov [L1d], 16 - mov [L2], 256 - mov [wayl2], 4 - mov [wayli], 4 - mov [wayld], 4 - Text 75,70,0x00000000,Vortexn, Vortexnlen-Vortexn - mov esi, Vortexn - mov edi, saveproc - call concatname - jmp MMXtest - -;--------------------- - - - -MMXtest: ; MMX test and Brand ID decoding - - call decodebrand ; get Brand ID - - call decode_standard_features - - call decode_extended_features - - xor eax,eax - inc eax - cpuid -HTTtest: - test edx, $10000000; ;Test bit 28 - jz .ELN - -.EL: ;HTT technology is supported - and ebx,00FF0000h ; numbers of logical processors - cmp ebx, 1 shl 16 - ; mov [number_of_log_cpus], ebx - je .ELN ; HHT not enabled (Celeron) - - mov dword [HTTn+9], $736579 - mov dword [HTT+ 6], $736579 - jmp TEXTOUT -.ELN: - - mov dword [HTTn+ 9], $6F6E - mov dword [HTT+ 6], $6F6E - -TEXTOUT: - - Text 275,290,0x00000000,HTT, HTTlen-HTT - Text 275,310,,sse3, sse3len-sse3 - Text 15,290,,MMXs, MMXslen-MMXs - Text 15,310,,SSE, SSElen-SSE - Text 95,310,,SSE2, SSE2len-SSE2 - -;------------------- -TEST3DNOW: - - xor edx, edx - cmp [smallvendor], 'ntel' - ; je @f ;recent change - jne .t - -.t: - - mov eax, $80000001 ;// Setup extended function 8000_0001h - cpuid - - test edx, $80000000 ;// Test bit 31 - jnz .XIT - -.NOEXTENDED: ;// 3DNow! technology is supported - mov dword [now+ 9], $6F6E - jmp TEST3DNOWP -.XIT: - mov dword [now+ 9], $736579 - jmp TEST3DNOWP - -TEST3DNOWP: - - cmp [smallvendor], 'ntel' - je .NOEXTENDEDP - -.tp: - - mov eax, $80000001 ;// Setup extended function 8000_0001h - cpuid - - test edx, $40000000 ;// Test bit 30 - jnz .XITP ;// 3DNow! technology is supported - -.NOEXTENDEDP: - mov dword [nowp+ 9], $6F6E - jmp TESTMMXP -.XITP: - mov dword [nowp+ 9], $736579 - jmp TESTMMXP - - -TESTMMXP: - - mov eax,$80000000 - cpuid - - test eax, 80000000h - jna NOEXTENDEDM - - ;cmp eax, $80000000 ;// Is 800_0001h supported? - ;jz .NOEXTENDEDM ;// If not, 3DNow! technology is not supported - mov eax, $80000001 ;// Setup extended function 8000_0001h - cpuid - cmp [smallvendor], 'tead' - jne noCyr -Cyrmx: - test edx, $01000000 ;// Test bit 24 - jnz XITM ;// 3DNow! technology is supported - jz NOEXTENDEDM -noCyr: - test edx, $00400000 ;// Test bit 22 - jnz XITM ;// 3DNow! technology is supported - ;jz .NOEXTENDEDM - -NOEXTENDEDM: - mov dword [mmxp+ 7], $6F6E - mov dword [MMXPi+ 8], $6F6E - jmp text3d -XITM: - mov dword [mmxp+ 7], $736579 - mov dword [MMXPi+ 8], $736579 - -text3d: - - Text 15,330,0x00000000,now, nowlen-now - Text 95,330,,nowp, nowplen-nowp - Text 95,290,,mmxp, mmxplen-mmxp - Text 110,70,0x80000000,dword[cname] - - jmp still - -;-------------------------- -NO_CPUID: - mov [nocpuid], 1 - Text 15,50,0x00000000,oblom, oblomlen-oblom - -FREEZE: - nop - jmp FREEZE ; maybe we should close application or just made some Warning and jump to still: -;---------------- -still: - -; waiting for events -event_wait: - - mov eax,23 ; function 23 - event wait - mov ebx,50 ; wait for 0.5 second - mcall - - cmp eax,1 ; - je red ; redraw - cmp eax,2 ; - je key ; key - cmp eax,3 ; - je button ; button - jmp still ; - key: ; - mcall ; - jmp still ; - button: ; - mov eax,17 ; - mcall ; - cmp ah,1 ; = 1 ? - je close ; close - - cmp ah,2 ; = 2 ? - je thread_start ; - - cmp ah, 3 - je call_OpenDialog - - mov eax,11 ; function 23 - event wait - mov ebx,1 - mcall - - mov eax,15 ; function 23 - event wait - mov ebx,3 - mcall - -; cmp ah,3 ; = 3 ? - jne still - -close: - mov eax,-1 - mcall - -;**************************** THREAD-SECOND WINDOW -thread_start: - - cmp [num_win2],0 - jne still - -;================================================RSA test - -;test rsa coding speed - call init_test -;length of module - 256 bit - mov eax,26 - mov ebx,9 - mcall - add eax,100 ;test lasts 1 second. - push eax -.loop: - push 4 ;do 4 iterations - this reduces number of calls mcall. -.loop1: - call rsa_test ;this procedure change all registers - dec dword [esp] - jnz .loop1 - pop ecx - mov eax,26 - mov ebx,9 - mcall - cmp eax,dword [esp] ;Is time changed? - jl .loop - pop eax - shr dword [iter],4 ;[iter] - speed in Kb/sec. (every iteration codes 64 bytes) - CreateTread window_2,thread2_esp - jmp still - -window_2: - mov [num_win2],1 - call draw_window_2 - -still_2: - - mov eax,10 - mcall - - cmp eax,1 - je window_2 ; window_2 - cmp eax,2 ; - je key_2 ; key_2 - cmp eax,3 ; - je button_2 ; button_2 - - jmp still_2 ; - - key_2: ; - mcall ; - jmp still_2 ; - - button_2: ; - mov eax,17 ; 17 - mcall ; - - cmp ah,1 ; = 1 ? - jne still_2 ; noclose - - mov [num_win2],0 ; - - or eax,-1 ; - mcall - - -draw_window_2: - - ;call prepare_text_area - - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1h ; 1, start of draw - mcall - - - Window 250,250,420,520, 0x33FFFFFF, 0x805080d0, standard ;460 - ; place size - - - Text 15, 10,0x00000000, STDCA, STDCAlen-STDCA - Text 215, 10,, EXTCA, EXTCAlen-EXTCA - - Text 15, 30,0x00000000, FPU, FPUlen-FPU - Text 115, 30,, VME, VMElen-VME - Text 215, 30,, DE, DElen-DE - Text 315, 30,, PSE, PSElen-PSE - - Text 15, 50,,TSC, TSClen-TSC - Text 115,50,,MSR, MSRlen-MSR - Text 215,50,,PAE, PAElen-PAE - Text 315,50,,MCE, MCElen-MCE - - Text 15,70,,CX8, CX8len-CX8 - Text 115,70,,APIC, APIClen-APIC - Text 215,70,,Res, Reslen-Res - Text 315,70,,SEP, SEPlen-SEP - - Text 15,90,,MTRR, MTRRlen-MTRR - Text 115,90,,PGE, PGElen-PGE - Text 215,90,,MCA, MCAlen-MCA - Text 315,90,,CMOV, CMOVlen-CMOV - - Text 15,110,,PAT, PATlen-PAT - Text 115,110,,PSE36, PSE36len-PSE36 - Text 215,110,,PSNUM, PSNUMlen-PSNUM - Text 315,110,,CLFLUSHn, CLFLUSHnlen-CLFLUSHn - - Text 15,130,,Res, Reslen-Res - Text 115,130,,DTS, DTSlen-DTS - Text 215,130,,ACPI, ACPIlen-ACPI - Text 315,130,,MMX, MMXlen-MMX - - Text 15,150,,FXSR, FXSRlen-FXSR - Text 115,150,,SSE, SSElen-SSE - Text 215,150,,SSE2, SSE2len-SSE2 - Text 315,150,,SSn, SSnlen-SSn - - Text 15,170,,HTT, HTTnlen-HTTn - Text 115,170,,TM, TMlen-TM - Text 215,170,,IA64, IA64len-IA64 - Text 315,170,,PBE, PBElen-PBE - ;--------------- - DrawLine 0, 410, 185,185,0x8080FF ;10 - - mov eax,$80000000 - cpuid - ;mov eax, $03020101 \A0for test of reaction - test eax, eax - js goooddd - -baaadd: - Text 95,235,0x00000000,NEF, NEFlen-NEF - jmp too - -goooddd: - Text 15,195,0x00000000,SS3, SS3len-SS3 - Text 15,215,,MON, MONlen-MON - Text 15,235,,DS_CPL, DS_CPLlen-DS_CPL - Text 15,255,,EST, ESTlen-EST - Text 15,275,,TM2, TM2len-TM2 - Text 15,295,,VMX, VMXlen-VMX - Text 15,315,,SVM, SVMlen-SVM - - Text 15,355,0x00000000,SMX, SMXlen-SMX - Text 15,335,0x00000000,PAGE, PAGElen-PAGE - Text 15,375,0x00000000,MIS, MISlen-MIS - Text 115,355,0x00000000,WDT, WDTlen-WDT - - Text 115,195,,CNXT_ID, CNXT_IDlen-CNXT_ID - Text 115,215,,CX16, CX16len-CX16 - Text 115,235,,ETPRD, ETPRDlen-ETPRD - Text 115,255,,SYS, SYSlen-SYS - Text 115,275,,LAF, LAFlen-LAF - Text 115,295,,SSSE3, SSSE3len-SSSE3 - Text 115,315,,MCR8, MCR8len-MCR8 - - - Text 115,335,0x00000000,EAS, EASlen-EAS - - Text 115,375,0x00000000,DNP, DNPlen-DNP - - - Text 315,375,0x00000000,SSE5, SSE5len-SSE5 - - Text 215,195,,MP, MPlen-MP - Text 215,215,,NX, NXlen-NX - Text 215,235,,MMXPi, MMXPilen-MMXPi - Text 215,255,,MMXn, MMXnlen-MMXn - Text 215,275,,FXSRn, FXSRnlen-FXSRn - Text 215,295,,DCA,DCAlen-DCA - - Text 315,295,0x00000000,SSE41,SSE41len-SSE41 - Text 215,335,0x00000000,x2APIC,x2APIClen-x2APIC - Text 215,355,0x00000000,ABM,ABMlen-ABM - Text 215,375,0x00000000,OSVW,OSVWlen-OSVW - - Text 315,195,,FFXSR, FFXSRlen-FFXSR - Text 315,215,,TSCP, TSCPlen-TSCP - Text 315,235,,LM, LMlen-LM - Text 315,255,,DNo, DNolen-DNo - Text 315,275,,DN, DNlen-DN - Text 215,315,,CMPL, CMPLlen-CMPL - Text 315,315,0x00000000,SS42,SS42len-SS42 - Text 315,335,0x00000000,PPCNT,PPCNTlen-PPCNT - Text 315,295,0x00000000,SSE4A,SSE4Alen-SSE4A - Text 315,355,0x00000000,SKINIT_,SKINIT_len-SKINIT_ - -too: - DrawLine 10, 400, 430,430,0x8080FF ;10 - - Text 15,415,0x00000000,speed, speedlen-speed - Text 130,415,,kbpersec, kbperseclen-kbpersec - - DrawLine 10, 80, 400, 400, 0x8080FF - - Text 90,400,0x80000000,performancestr, 0 - DrawLine 322, 400, 400, 400, 0x8080FF - DrawLine 10, 10, 400, 490, 0x8080FF - DrawLine 400, 400, 400, 490, 0x8080FF - - DrawLine 10, 400, 490, 490, 0x8080FF - - ; your proc - Text 20,415,0x808080FF,currentcpu, 0 - Number 170,415,0,5,dword [iter],0x000000 ; + 15 - ;Text 115,370,,kbpersec, kbperseclen-kbpersec ;+ 355 - mov eax, dword[iter] - ;mov ebx, 100 - ;mul ebx - add eax, 215 - mov word[linelen], ax ; need to store it as drawline corrupts eax - DrawLine 215, [linelen], 416,416,0x8080FF ;10 + 355 , 357 - DrawLine 215, [linelen], 417,417,0x8080FF ;10 - DrawLine 215, [linelen], 418,418,0x8080FF ;10 -;;; DrawLine 20, 390, 371,371,0x8080FF ;10 - - ; sample proc 1 - Text 20,435,0x80000000,samplename1,0 ; 10 + 40 + 40 +40 + 380 - Number 170,435,0,5,dword [samplespeed1],0x000000; ; 25 + 40 + 40 +40 + 380 - ;Text 115,470,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 40 +40 + 380 - mov eax, dword[samplespeed1] - add eax, 215 - mov dword[linelen], eax ; need to store it as drawline corrupts eax - DrawLine 215, [linelen], 436,436,0x8080FF ;27+40 + 40 +40 + 380 - DrawLine 215, [linelen], 437,437,0x8080FF ;10 - DrawLine 215, [linelen], 438,438,0x8080FF ;10 - - ; sample proc 2 - Text 20,455,0x80000000,samplename2,0 ; 10 + 40 + 350 - Number 170,455,0,5,dword [samplespeed2],0x000000; ; 25 + 40 + 350 - ;Text 115,410,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 350 - mov eax, dword[samplespeed2] - add eax, 215 - mov dword[linelen], eax ; need to store it as drawline corrupts eax - DrawLine 215, [linelen], 456,456,0x8080FF ;27+40 + 355 - DrawLine 215, [linelen], 457,457,0x8080FF ;10 - DrawLine 215, [linelen], 458,458,0x8080FF ;10 - - ; sample proc 3 - Text 20,475,0x80000000,samplename3,0 ; 10 + 40 + 40 + 38 - Number 170,475,0,5,dword [samplespeed3],0x000000; ; 25 + 40 + 40 + 355 - ;Text 115,440,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 40 + 380 - mov eax, dword[samplespeed3] - add eax, 215 - mov dword[linelen], eax ; need to store it as drawline corrupts eax - DrawLine 215, [linelen], 476,476,0x8080FF ;27+40 + 40 - DrawLine 215, [linelen], 477,477,0x8080FF ;10 - DrawLine 215, [linelen], 478,478,0x8080FF ;10 - - mov eax,12 - mov ebx,2h - mcall - - ret - -linelen dd 0 -currentcpu db 'Current CPU',0 -samplename1 db 'Intel Core i5 CPU', 0x000000 ; not real results! -samplespeed1 dd 62 -samplename2 db 'Intel Core i3 CPU', 0 -samplespeed2 dd 48 -samplename3 db 'Intel Pentium Dual CPU', 0 -samplespeed3 dd 35 -performancestr db 'PERFORMANCE (KB/S in RSA test 256 bit)',0 -ptsstring db '' -num_win2 db 0 - -draw_window: - mcall SF_REDRAW, SSF_BEGIN_DRAW - - Window 150, 150, 350, 405, 0x34FFFFFF, 0x805080d0, title - - mov esi, [sc.work_button] - mcall SF_DEFINE_BUTTON, <138,92>, <345,24>, 2 - mcall SF_DEFINE_BUTTON, <238,92>, <345,24>, 3 - - mov ecx, [sc.work_button_text] - or ecx, 0x90000000 - mov edx, btn_more_cap - mcall SF_DRAW_TEXT, (138 + (92 - 7 * 8) / 2) shl 16 + 350 - mov edx, btn_save_cap - mcall SF_DRAW_TEXT, (238 + (92 - 4 * 8) / 2) shl 16 + 350 - - Text 130,270,0x00000000,instruct, instructlen-instruct - DrawLine 10, 330, 340,340,0x8080FF - DrawLine 330, 330, 275,340;,0x8080FF - DrawLine 10, 10, 275,340;,0x8080FF - DrawLine 10, 125, 275,275;,0x8080FF - DrawLine 230, 330, 275,275;,0x8080FF - - cmp dword[smallvendor], 'cAMD' - jne cont - cmp [f], $6 - jne cont - -; Button 240,85,69,15,3,0x030000FF ; button for rating -; Text 245,90,0x00FFFFFF,FR, FRlen-FR ; text at button - - call newrating; !!!! - -cont: - ;Number 82,50,0,4,dword [total],0x000000; MHz - mov esi, total - mov edi, tsum + 0xB ;0xA - call savenumber - - ;Number 110,50,0,2,dword [sot]; KHz - mov esi, sot - mov edi, tsum + 0x10 - call savenumber - - ;Number 75,110,1*256,1,dword [f],0x000000 ; - mov esi, f - mov edi, fam + 0x8 ;0x9 - call savenumber - - ;Number 75,130,,,dword [m] - mov esi, m - mov edi, mode + 0x7 - call savenumber - - ;Number 75,150,,,dword [s] - mov esi, s - mov edi, step + 0xa ;0x9 - call savenumber - - ;Number 110,110,1*256,2,dword [ef] - mov esi, ef - mov edi, fam + 0xE ;0x9 - call savenumber - - ;Number 110,130,,,dword [em] - mov esi, em - mov edi, mode + 0xE ;0xD - call savenumber - - mov esi, multb - mov edi, multil + 0xB - call savenumber - - ;Number 105,30,0,1,dword [multa] - mov esi, multa - mov edi, multil + 0xf - call savenumber - - ;Number 140,170,0,2,dword [wayld],0x000000 - mov esi, wayld - mov edi, cache2 + 0x14 ;0x14 - call savenumber - - ;Number 218,170,,,dword [lineld] - mov esi, lineld - mov edi, cache2 + 0x21 - call savenumber - - ;Number 140,190,,,dword [wayli] - mov esi, wayli - mov edi, cache + 0x14 - call savenumber - ;Number 218,190,,,dword [lineli] - mov esi, lineli - mov edi, cache + 0x21 - call savenumber - - ;Number 140,210,,,dword [wayl2] - mov esi, wayl2 - mov edi, cache3 + 0x14 - call savenumber - ;Number 218,210,,,dword [linel2] - mov esi, linel2 - mov edi, cache3 + 0x21 - call savenumber - - ;Number 140,230,,,dword [wayl3] - mov esi, wayl3 - mov edi, cache4 + 0x14 - call savenumber - ;Number 218,230,,,dword [linel3] - mov esi, linel3 - mov edi, cache4 + 0x21 - call savenumber - - mov esi, L1d - mov edi, cache2 + 0xa - call savenumber - - ;Number 75,190,,,dword [ L1i] - mov esi, L1i - mov edi, cache + 0xa - call savenumber - - ;Number 41,210,0,4,dword[L2] - mov esi, L2 - mov edi, cache3 + 0x4 ;0x3 - call savenumber - - ;Number 35,230,0,5,dword[L3] - mov esi, L3 - mov edi, cache4 + 0x4 ;0x3 - call savenumber - - ;-----------Features - ;Number 258,50,0,2,dword [micron] ; micron - mov esi, micron - mov edi, tech + 0xE - call savenumber - - mov esi, stdc - mov edi, STDCA + 0x14 - call savenumber - - ;Number 335,10,,,dword [extc], - mov esi, extc - mov edi, EXTCA + 0x14 - call savenumber - - Text 15,90,,cpuname, cpunamelen-cpuname; - Text 255,250,,typen, typenlen-typen - Text 175, 50,,tech, techlen-tech; - - red2: - - ;;;;;;;;;;;;;;;;;;;;;;;; - goon: - - call decodebrand - - typedetect: - mov edx, t1 - cmp [t], 00b - jz @f - mov edx, t2 - cmp [t], 01b - jz @f - mov edx, t3 - cmp [t], 11b - jz @f - mov edx, t4 -@@: - mov ebx, 290*65536 + 250 - mov ecx, 0x80000000 - mcall 4 - - Text 15,250,,brandid, brandidlen-brandid - - Text 15,50,0x00000000,tsum, tsumlen-tsum - Text 15,110,0x00000000,fam, famlen-fam - Text 15,130,0x00000000,mode, modelen-mode - Text 15,150,0x00000000,step, steplen-step - - Text 275,290,0x00000000,HTT, HTTlen-HTT - Text 275,310,,sse3, sse3len-sse3 - - Text 175,290,0x00000000,SSE41, SSE41len-SSE41 - Text 175,310,0x00000000,SSE42, SSE42len-SSE42 - Text 175,330,0x00000000,SSE5, SSE5len-SSE5 - - - Text 15,70,,name, namelen-name - Text 15,290,,MMXs, MMXslen-MMXs - Text 15,310,,SSE, SSElen-SSE - Text 95,310,,SSE2, SSE2len-SSE2 - - Text 95,290,,mmxp, mmxplen-mmxp - Text 15,330,0x00000000,now, nowlen-now - Text 95,330,,nowp, nowplen-nowp - - Text 15, 190,0x00000000,cache, cachelen-cache - Text 15,170,0x00000000,cache2, cache2len-cache2 - Text 15,210,,cache3, cache3len-cache3 - Text 15,230,,cache4, cache4len-cache4 - call load_gif - - cmp [nomultiplier], $1 - je nomultip - Text 15,30,0x00000000,multil2, multil2len-multil2 - Text 175,30,0x00000000,freql2, freql2len-freql2 - Number 85,30,0,2,dword [multb],0x000000; - Number 105,30,0,1,dword [multa] - Number 259,30,0,4,dword [freqbb] - Number 289,30,0,2,dword [freqll] - -JumpForCodename: - cmp [codeN], $1 - je codeNIntel - cmp [codeN], $2 - je codeNAMD - cmp [codeN], $3 - je codeNCyrix - cmp [codeN], $4 - je codeNCentaur - cmp [codeN],$5 - je codeNTransmeta - cmp [codeN], $6 - je codeNVortex - jmp nnn - -codeNIntel: - Text 75,70,0x00000000,Inteln, Intelnlen-Inteln - mov esi, intel - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -codeNAMD: - Text 75,70,,AMDn, AMDnlen-AMDn - mov esi, amd - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -codeNCyrix: - Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn - mov esi, cyrix - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -codeNCentaur: - Text 75,70,0x00000000,IDTn, IDTnlen-IDTn - mov esi, idt - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -codeNTransmeta: - Text 75,70,,Tranmsmetan, Tranmsmetanlen-Tranmsmetan - mov esi, transmeta - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -codeNVortex: - Text 75,70,0x00000000,Vortexn, Vortexnlen-Vortexn - mov esi, vortex - call load_gif - PutImage 135,107,201,49,img_area+8 - jmp nnn - -nomultip: - Text 15,30,0x00000000,multi3, multi3len-multi3 - Text 175,30,0x00000000,freql3, freql3len-freql3 - Text 259,30,0x00000000, clock0, clock0len-clock0 - - jmp JumpForCodename - - nnn: - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - Text 15,10,0x00000000,stm, stmlen-stm - ; Fix for deleting leading whitespaces - ; in Intel P4's internal name - ; by Madis Calme - ; 23.12.2004 ver. 0.81 - cld - mov edi,myname - mov al,20h - or ecx,-1 - repe scasb - dec edi - mov esi,mynamelen - sub esi,edi - Text 105, 10, 0x00000000, edi, esi -;- - Text 15,250,,brandid, brandidlen-brandid - - mcall SF_REDRAW, SSF_END_DRAW - - ret ; - -call_OpenDialog: - - mov [OpenDialog_data.type],1 ; Save - - push dword OpenDialog_data - call [OpenDialog_Start] - - cmp [OpenDialog_data.status],2 ; OpenDialog does not start - je .save_file_default_path - - cmp [OpenDialog_data.status],1 - jne still - - call store_data - jmp still - -.save_file_default_path: - mov edi,file_name - mov esi,file_default_path - call copy_file_name_path - call store_data - jmp still - -copy_file_name_path: - xor eax,eax - cld -@@: - lodsb - stosb - test eax,eax - jnz @r - ret - -;----------------------------------------------------------------------------- -prepare_text_area: - mov edi,[store_text_area_start] - - push edi - mov ecx,4096 - mov eax,dword ' ' - cld - rep stosd - pop edi - mov [store_text_area_end], edi - - mov esi,title - call addstring - - mov esi, stm - call addstring - - mov esi, myname - call addstring - - cmp [nomultiplier], $1 - je noMult - jne detMulti - ;jne detFreq - - detMulti: - mov esi,multil - call addstring - jmp detFreq - - detFreq: - mov esi, freql - call addstring - - noMult: - mov esi,multi3 - call addstring - - mov esi,freql3 - call addstring - - mov esi, tech - call addstring - - mov esi, saveproc - call addstring - - mov esi, cpuname - call addstring - - mov esi, fam - call addstring - - mov esi, mode - call addstring - - mov esi, step - call addstring - - mov esi, cache2 - call addstring - - mov esi, cache - call addstring - - mov esi, cache3 - call addstring - - mov esi, cache4 - call addstring - - mov esi, brandid - call addstring - - mov esi, MMXs - call addstring - - mov esi, mmxp - call addstring - - mov esi, now - call addstring - - mov esi, HTT - call addstring - - mov esi, SSE - call addstring - - mov esi, SSE41 - call addstring - - mov esi, SSE42 - call addstring - - mov esi, SSE5 - call addstring - - mov esi, SSE2 - call addstring - - mov esi, nowp - call addstring - - mov esi, sse3 - call addstring - - mov esi, standard - call addstring - - mov esi, STDCA - call addstring - - mov esi, EXTCA - call addstring - - mov esi, FPU - call addstring - - mov esi, VME - call addstring - - mov esi, DE - call addstring - - mov esi, PSE - call addstring - - mov esi, TSC - call addstring - - mov esi, MSR - call addstring - - mov esi, PAE - call addstring - - mov esi, MCE - call addstring - - mov esi, CX8 - call addstring - - mov esi, APIC - call addstring - - mov esi, Res - call addstring - - mov esi, SEP - call addstring - - mov esi, MTRR - call addstring - - mov esi, PGE - call addstring - - mov esi, MCA - call addstring - - mov esi, CMOV - call addstring - - mov esi, PAT - call addstring - - mov esi, PSE36 - call addstring - - mov esi, PSNUM - call addstring - - mov esi, CLFLUSHn - call addstring - - mov esi, Res - call addstring - - mov esi, DTS - call addstring - - mov esi, ACPI - call addstring - - mov esi, MMX - call addstring - - mov esi, FXSR - call addstring - - mov esi, SSE - call addstring - - - mov esi, SSn - call addstring - - mov esi, HTT - call addstring - - mov esi, TM - call addstring - - mov esi, IA64 - call addstring - - mov esi, PBE - call addstring - - mov esi, SS3 - call addstring - - mov esi, CNXT_ID - call addstring - - mov esi, MP - call addstring - - mov esi, FFXSR - call addstring - - mov esi, MON - call addstring - - mov esi, CX16 - call addstring - - mov esi, NX - call addstring - - mov esi, TSCP - call addstring - - mov esi, DS_CPL - call addstring - - mov esi, ETPRD - call addstring - - mov esi, MMXPi - call addstring - - mov esi, LM - call addstring - - mov esi, EST - call addstring - - mov esi, SYS - call addstring - - mov esi, MMXn - call addstring - - mov esi, DNo - call addstring - - mov esi, TM2 - call addstring - - mov esi, LAF - call addstring - - mov esi, FFXSR - call addstring - - mov esi, DN - call addstring - - mov esi, VMX - call addstring - - mov esi, SSSE3 - call addstring - - mov esi, DCA - call addstring - - mov esi, CMPL - call addstring - - mov esi, SVM - call addstring - - mov esi, MCR8 - call addstring - - mov esi, SMX - call addstring - - mov esi, x2APIC - call addstring - - mov esi, PPCNT - call addstring - - mov esi, PAGE - call addstring - - mov esi, EAS - call addstring - - mov esi, ABM - call addstring - - mov esi, MIS - call addstring - - mov esi,OSVW - call addstring - - mov esi,SKINIT_ - call addstring - - mov esi, WDT - call addstring - - ret - -addstring: - mov edi, [store_text_area_end] - xor eax, eax - xor ecx, ecx - cld -@@: - lodsb - stosb - inc [store_text_area_end] - cmp [esi], byte 0x0 - jnz @r - mov al,0Ah - stosb - - mov [store_text_area_end],edi - xor edi,edi - xor esi, esi - ret - -savenumber: - xor eax, eax - cld - lodsw - call numbertostring - xor esi, esi - xor edi, edi - - ret - -savestring: - xor eax, eax - cld - lodsw - ;call numbertostring - xor esi, esi - xor edi, edi - - ret - -numbertostring: - mov bx, 10 - xor ecx, ecx -@@m1: - xor dx, dx - div bx - push dx - inc cx - test ax, ax - jnz @@m1 -@@m2: - pop ax - add al, '0' - stosb - loop @@m2 - ret - -concatname: - ;mov edi, [saveproc] - xor eax, eax - xor ecx, ecx - cld -@@: - lodsb - stosb - cmp [esi], byte 0x0 - jnz @r - - xor edi,edi - xor esi, esi - ret - -store_data: - call prepare_text_area - mov eax,[store_text_area_start] - mov [fileinfo.return],eax - mov ebx,[store_text_area_end] - sub ebx,eax - inc ebx - mov [fileinfo.size],ebx - mcall 70,fileinfo - ret - -load_gif: - mov edi, img_area - jmp ReadGIF - - -; DATA AREA - -title db 'CPUID 2.31 by S.Kuzmin & KolibriOS Team',0 - -stm: - db 'Internal name:', 0 - -stmlen: - -SS42: - db 'SSE4.2: ',0 -SS42len: - -SMX: - db 'SMX: ',0 -SMXlen: - -x2APIC: - db 'x2APIC: ' -x2APIClen: - -PPCNT: - db 'POPCNT: ' -PPCNTlen: - -PAGE: - db 'Page1Gb: ' -PAGElen: - -EAS: - db 'EAS: ',0 -EASlen: - -newLabel: - db '3DNP: ',0 -newLabellen: - - -ABM: - db 'ABM: ' -ABMlen: - -SSE4A: - db 'SSE4A: ' -SSE4Alen: - -MIS: - db 'MIS: ',0 -MISlen: - -DNP: - db '3DNP: ' -DNPlen: - -OSVW: - db 'OSVW: ',0 -OSVWlen: - -SKINIT_: - db 'SKINIT: ',0 -SKINIT_len: - -WDT: - db 'WDT: ',0 -WDTlen: - - -saveproc: - db ' ',0 - -multil: - db 'Multiplier: . ', 0 - -multillen: - -multil2: - - db 'Multiplier: . ' - -multil2len: - -multi3: - - db 'Multiplier: n/a',0 - -multi3len: - -freql: - - db 'System clock: . MHz', 0 -freqllen: - -freql2: - - db 'System clock: . MHz' - - -freql2len: - -freql3: - - db 'System clock: n/a ' - - -freql3len: - -tsum: - - db 'Frequency: . MHz ',0 - -tsumlen: - -tech: - - db 'Technology: 0. micron ', 0 - -techlen: - -name: - -if lang eq it_IT - - db 'Codename:',0 - -else - - db 'CODENAME:',0 - - -end if - -namelen: - -vendorname: - -if lang eq it_IT - - db 'Vendor CPU ', 0 - -else - - db 'CPU VENDOR: ', 0 - -end if - -vendornamelen: - -cpuname: - -if lang eq it_IT - - db 'Vendor CPU ', 0 - -else - - db 'CPU VENDOR: ', 0 - -end if - -cpunamelen: - - -fam: - -if lang eq it_IT - - db 'Famiglia: std ext', 0 - -else - - db 'FAMILY: std ext', 0 - -end if - -famlen: - -mode: - -if lang eq it_IT - - db 'Modello: std ext', 0 - -else - - db 'MODEL: std ext', 0 - -end if - -modelen: - -step: - -if lang eq it_IT - - db 'Stepping: ', 0 - -else - - db 'STEPPING: ', 0 - -end if - -steplen: - -cache: - - db 'L1(inst): KB -way set -byte line size',0 - -cachelen: - -cache2: - - db 'L1(data): KB -way set -byte line size',0 - -cache2len: - - -cache3: - - db 'L2: KB -way set -byte line size',0 - -cache3len: - -cache4: - - db 'L3: KB -way set -byte line size',0 - -cache4len: - -brandid: - - db 'Brand:', 0 - -brandidlen: - -MMXs: - - db 'MMX: ',0 - -MMXslen: - - -total dd 0x0 - -total1 dd 0x0 - -rating dd 0x0 - -rat dd 0x0 ; - -NEF: - -db 'EXTENDED FEATURES ARE NOT AVAILABLE',0 - -NEFlen: - - - -mb : - -db 'MB' - -mblen: - - - -logcpus : - -db 'Number of logical CPU:' - -logcpuslen: - - - -speed : - -if lang eq it_IT - -; db 'Performance',0 - -else - -; db 'PERFORMANCE:',0 - -end if - -speedlen: - - - -kbpersec: - -db 'KB/SEC' - -kbperseclen: - - - -instruct: - -if lang eq it_IT - - db 'Set istruzioni' - -else - - db 'Instruction sets' - -end if - -instructlen: - - - -standard db 'Standard and Extended features plus Performance test',0 - - -STDCA: - - db 'Highest STD call is ',0 - -STDCAlen: - - - -EXTCA: - - db 'Highest EXT call is h',0 - -EXTCAlen: - - -oblom: - -if lang eq it_IT - - db 'CPUID non e disponibile' - -else - - db 'SORRY, CPUID IS NOT AVAILABLE' - -end if - -oblomlen: - - -other: - -if lang eq it_IT - - db 'Questo vendor non e supportato' - -else - - db 'SORRY, THIS VENDOR IS NOT SUPPORTED YET' - -end if - -otherlen: - -cacheP4: - - db 'L1(inst): Kuops -way set -byte line size' - -cacheP4len: - - - - -typen: - -if lang eq it_IT - - db 'Tipo:' - -else - - db 'Type:' - -end if - - - -typenlen: - - - -pr: - - db 'P-rating:' - -prlen: - - - - -AMDn: - - db 'AMD',0 - -AMDnlen: - -AMDnNew: - - db 'CODENAME: AMD',0 - -AMDnNewlen: - -Inteln: - - db 'Intel',0 - -Intelnlen: - -IntelnNew: - db 'CODENAME: Intel',0 - -IntelnNewlen: - - -Cyrixn: - - db 'Cyrix',0 - -Cyrixnlen: - -IDTn: - - db 'IDT/Centaur',0 - -IDTnlen: - -Centaurn: - - db 'VIA',0 - -Centaurnlen: - - - -Tranmsmetan: - - db 'Transmeta',0 - -Tranmsmetanlen: - - -Vortexn: - db 'Vortex86',0 -Vortexnlen: - - -mmxp: - - db 'MMX+: ',0 - -mmxplen: - - - -HTT: - - db 'HTT: ',0 - -HTTlen: - - -HTTn: - - db 'HTT: ',0 - -HTTnlen: - - -sse3: - - db 'SSE3: ',0 - -sse3len: - -SSE41: - db 'SSE4.1: ',0 -SSE41len: - -SSE42: - db 'SSE4.2: ',0 -SSE42len: - -SSE5: - db 'SSE5: ',0 -SSE5len: - -now: - - db '3DNOW!: ',0 - -nowlen: - -nowp: - - db '3DNOW!+: ',0 - -nowplen: - -;-Type - -t1 db 'OEM',0 - -t2 db 'Overdrive',0 - -t3 db 'Dual',0 - -t4 db 'Unknown',0 - - - -;----------Intel - -P50: - -db 'P5 A-step',0 - -P50len: - -P5: - -db 'P5',0 - -P5len: - -P54T: - -db 'P24T Overdrive',0 - -P54Tlen: - -P54C: - -db 'P54C',0 - -P54Clen: - -P55C: - -db 'P55C (with MMX)',0 - -P55Clen: - -; --- - -P60: - -db 'Pentium Pro A-step',0 - -P60len: - -P61: - -db 'Pentium Pro',0 - -P61len: - -P63: - -db 'Pentium II (Klamath)',0 - -P63len: - -P65: - -db 'Pentium II (Deschutes)',0 - -P65len: - -P66: - -db 'Celeron (Medocino)',0 - -P66len: - -P67: - -db 'Pentium III (Katmai)',0 - -P67len: - -P68: - -db 'Pentium III (Coppermine)',0 - -P68len: - -P69: - -db 'Pentium M (Banias)',0 - -P69len: - -P6A: - -db 'Pentium III Xeon (Cascades)',0 - -P6Alen: - -P6B: - -db 'Pentium III (Tualatin)',0 - -P6Blen: - -P6D: - -db 'Pentium M (Dothan)',0 - -P6Dlen: - -P6E: - -db 'Pentium M (Yonah)/ Core',0 - -P6Elen: - -P6F: - -db 'Pentium D (Conroe)/ Core 2 (Kentsfield)',0 - -P6Flen: - -;--- - -PS0: - -db 'Itanium (IA-64)',0 - -PS0len: - -;------------ - -PF0: - -db 'Pentium 4 (Willamete)',0 - -PF0len: - -PF2: - -db 'Pentium 4 (Northwood)',0 - -PF2len: - -PF3: - -db 'Pentium 4 (Prescott)',0 - -PF3len: - -PF5: - -db 'Pentium 4 (Tejas)',0 - -PF5len: - -PF6: - -db 'Pentium 4 (Presler)',0 - -PF6len: - -;----------------Intel Celerons - -P65c: - -db 'Celeron (Covington)',0 - -P65clen: - -P68c: - -db 'Celeron (Coppermine)',0 - -P68clen: - -P6Bc: - -db 'Celeron (Tualatin)',0 - -P6Bclen: - -PF0c: - -db 'Celeron (Willamete)',0 - -PF0clen: - -PF2c: - -db 'Celeron (Northwood)',0 - -PF2clen: - -PF3c: - -db 'Celeron (Prescott)',0 - -PF3clen: - -PF5c: - -db 'Celeron D (Texas)',0 - -PF5clen: - -PF6c: - -db 'Celeron D (Presler)',0 - -PF6clen: - -;---------New Intel -P3A: - -db 'IvyBridge',0 - -P3Alen: - -P2A: - -db 'Sandy Bridge',0 - -P2Alen: - -P2D: -db 'Sandy bridge-E',0 - -P2Dlen: - - -P25: -db 'Arrandale',0 -P25len: - -P2C: -db 'Gulftown',0 -P2Clen: - -P2F: -db 'Westmere-EX',0 -P2Flen: - -P1E: -db 'Clarksfield',0 -P1Elen: - -P1A: -db 'Bloomfield',0 -P1Alen: - -P2E: -db 'Nehalem-EX',0 -P2Elen: - -P17: -db 'Yorkfield',0 -P17len: - -P1D: -db 'Dunnington',0 -P1Dlen: - -P0F: -db 'Clovertown',0 -P0Flen: - -P16: -db 'Merom Conroe',0 -P16len: - -P06: -db 'Cedar Mill',0 -P06len: - -P03: -db 'Nocona Irwindale',0 -P03len: - -P04: -db 'NoconaIrwindale',0 -P04len: - -P0D: -db 'Dothan',0 -P0Dlen: - -P36: -db 'Cedarview',0 -P36len: - -P26: -db 'Lincroft',0 -P26len: - -P1C: -db 'Pineview',0 -P1Clen: - -no_known: -db 'SORRY, CODENAME IS NOT SUPPORTED YET ', 0 - -;---------AMD - -A50 db 'K5 (PR75, PR90, PR100)',0 - -A51 db '5k86 (PR120, PR133)',0 - -A52 db '5k86 (PR166)',0 - -A53 db '5k86 (PR200)',0 - -A56 db 'K6',0 - -A57 db 'K6',0 - -A58 db 'K6-2',0 - -A59 db 'K6-III',0 - -A5D db 'K6-2+ or K6-III+',0 - -;------------------- - -At1 db 'Athlon',0 - -At2 db 'Athlon',0 - -At3 db 'Duron (Spitfire)',0 - -At4 db 'Athlon (Thunderbird)',0 - -At6 db 'AthlonXP (Palomino)',0 - -At7 db 'Duron (Morgan)',0 - -At8 db 'AthlonXP (Thoroughbred)',0 - -At8a db 'Duron (Applebred)',0 - -Ata db 'AthlonXP (Barton)',0 - -Atat db 'AthlonXP (Thorton)',0 - -;------------------- -AthlonKuma: - -db 'AMD Athlon 7750 Black Edition',0 - -AthlonKumalen: - -AB23: - -db 'Opteron 2300-series',0 - -AB23len: - -AB83: - -db 'Opteron 8300-series',0 - -AB83len: - -AB9: -db 'Phenom X4',0 - -AB9len: - -AB8right2: - -db 'Phenom X3',0 - -AB8right2len: - -AB4: - -db 'Athlon X2',0 - -AB4len: - -AB1: - -db 'Sempron',0 - -AB1len: - -ABC2: - -db 'Opteron (Shanghai) 2387',0 - -ABC2len: - -AB6: - -db 'Opteron (Magny-Cours)',0 - -AB6len: - -ABC3: - -db 'Opteron (Shanghai) 8300 series',0 - -ABC3len: - -ABM2: - -db 'Turion II ',0 - -ABM2len: - -;--- - -AF1: - -db 'Dual-core Opteron',0 - -AF1len: - -AF3: - -db 'Athlon 64 (Toledo)',0 - -AF3len: - -AF4: - -db 'Athlon 64 (ClawHammer)',0 - -AF4len: - -AF5: - -db 'Opteron/Athlon 64 FX (SledgeHammer)',0 - -AF5len: - - -AFC: - -db 'Athlon 64 (Newcastle)',0 - -AFClen: - - -AFF: - -db 'Athlon 64 (Winchester)',0 - -AFFlen: - - -AFS: - -db 'Athlon 64 (San Diego)',0 - -AFSlen: - - -AFV: - -db 'Athlon 64 (Venice)',0 - -AFVlen: - - -AFCs: - -db 'Sempron (Paris)',0 - -AFCslen: - - - -AFCsp: - -db 'Sempron (Palermo)',0 - -AFCsplen: - - - -;---------Cyrix - -C52: - -db '6x86 M1',0 - -C52len: - -C54: - -db 'MediaGX',0 - -C54len: - -C60: - -db '6x86MX M2',0 - -C60len: - -C65: - -db 'C3 (Cyrix M2)',0 ;? - -C65len: - -;--------IDT - -V54: - -db 'WinChip C6',0 - -V54len: - -V58: - -db 'WinChip 2',0 - -V58len: - -V59: - -db 'WinChip 3',0 - -V59len: - -;-------VIA - -V66: - -db 'C3 (Samuel)',0 ; Joshua is unreleased 065 - -V66len: - -V67: - -db 'C3 (Samuel2/Ezra)',0 ; ? - -V67len: - -V68: - -db 'C3 (Ezra-T/Eden)',0 ;? - -V68len: - -V69: - -db 'C3 (Antaur/Nehemiah)',0 ;? - -V69len: - -VA: - -db 'C7 (Esther)',0 ;? - -VAlen: - -;---------Transmeta - -T5: - -db 'Crusoe',0 ; - -T5len: - -TF: - -db 'Efficeon',0 ; - -TFlen: - -;--------- - -NG: - - db 'Next generation CPU',0 - -NGlen: - - -athloncoef db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 120 - - db 190, 120, 200, 130, 135, 140, 210, 150, 220, 160, 165, 170, 180, 230, 240 - -athlonmcoef: db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105 - - db 30, 190, 40, 200, 130, 135, 14, 210, 150, 220, 160, 165, 170, 230, 240 - -athloncoef3 db 45, 50, 40, 55, 25, 30, 60, 35 - -p4coef db 160, 170, 180, 190, 200, 210, 220, 230, 80, 90, 100, 110, 120, 130, 140, 150 ; Pentium 4 (Willamete) - -coppercoeff db 50, 30, 40, 20, 55, 35, 45, 25, 35, 70, 80, 60, 20, 75, 15, 65, 90, 110, 120, 20, 95, 115, 85, 25, 35, 70, 80, 100, 20, 75, 15, 105 - -tualatcoeff db 120, 35, 35, 40, 55, 35, 115, 35, 160, 70, 80, 60, 40, 75, 35, 65, 90, 110, 35, 35, 95, 35, 85, 35, 35, 35, 130, 100, 140, 35, 150, 105 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -I_END: - -img_area: ; image is going to be unpacked to here -rb 201*49*3+8 ; image resolution (bits to reserve) - -img_area2: ; image is going to be unpacked to here -rb 93*24*3+8 ; image resolution (bits to reserve) - -img_area3: ; image is going to be unpacked to here -rb 93*24*3+8 ; image resolution (bits to reserve) - -gif_hash_area: -rd 4096+1 ;hash area size for unpacking gif -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 - -err_message_found_lib2 db 'proc_lib.obj - Not found!',0 - -err_message_import2 db 'proc_lib.obj - Wrong import!',0 - -head_f_i: -head_f_l db 'error',0 -;--------------------------------------------------------------------- -l_libs_start: - -library02 l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \ -err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i - -end_l_libs: -;--------------------------------------------------------------------- -align 4 -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start -;OpenDialog__Version dd aOpenDialog_Version - dd 0 - dd 0 -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 -;aOpenDialog_Version db 'Version_OpenDialog',0 -;--------------------------------------------------------------------- -align 4 -OpenDialog_data: -.type dd 0 -.procinfo dd Proc_Info ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd file_name ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog',0 -open_dialog_path: - db '/sys/File Managers/opendial',0 -communication_area_default_pach: - db '/sys',0 -Filter: -dd Filter.end - Filter.1 -.1: -db 'TXT',0 -db 'LOG',0 -.end: -dd 0 - -file_default_path: - db '/sys/' -start_temp_file_name: - db 'CPUID.txt',0 -btn_more_cap: - db 'Details', 0 -btn_save_cap: - db 'Save', 0 -;--------------------------------------------------------------------- -align 4 -fileinfo: -.subfunction dd 2 -.Offset dd 0 -.Offset_1 dd 0 -.size dd 4096 -.return dd 0 - db 0 -.name: dd file_name - -align 4 -sc system_colors - -store_text_area_start dd ? -store_text_area_end dd ? -store_text_size dd ? - -;--------------------------------------------------------------------- -library_path: - rb 4096 -;--------------------------------------------------------------------- -path: - rb 4096 -;--------------------------------------------------------------------- -temp_dir_pach: - rb 4096 -;--------------------------------------------------------------------- -file_name: - rb 4096 -;--------------------------------------------------------------------- -file_name_1: - rb 4096 -;--------------------------------------------------------------------- -filename_area: - rb 256 -;--------------------------------------------------------------------- - rb 4096 -stacktop: -;--------------------------------------------------------------------- -Proc_Info process_information -; RSA test data -align 4 - num1 rd 40 - num2 rd 40 - num3 rd 40 - iter rd 1 - openkey rd 1 - - -IncludeUGlobals - -nocpuid db ? -ost dd ? -sot dd ? -f dd ? -m dd ? -s dd ? -t dd ? - -ef dd ? -em dd ? - -multiplier dd ? -multa dd ? -multb dd ? -smallvendor dd ? -L1d dd ? -L1i dd ? -L2 dd ? -L3 dd ? -micron dd ? -brand dd ? -newpc dd ? -nomultiplier dd ? -ram_size_a dd ? -ram_size_t dd ? - -stdc dd ? -extc dd ? - -FRS dd ? -freqsel db ? -sse3sup db ? -sse41sup dd ? -sse42sup dd ? -sse5sup dd ? - -freqbb dd ? -freqll dd ? - -wayli dd ? -lineli dd ? - -wayld dd ? -lineld dd ? - -wayl2 dd ? -linel2 dd ? - -wayl3 dd ? -linel3 dd ? -che db ? ; numbers of calls for Intel caches detection -cname dd ? -codeN dd ? - -myname: - rb 48 - -mynamelen: - db ? - -align 4 - thread2_stack_area rb 64 - thread2_esp = $ -U_END: +;****************************************************************************** +; project name: CPUID * +; platform: KolibriOS, x86 (IA-32), x86-64 achitectures * +; compiler: flat assembler 1.70.03 * +; version: 2.31 * +; last update: 9 October 2018 * +; maintained by: Sergey Kuzmin aka Wildwest * +; e-mail: kuzmin_serg@list.ru * +; site: http://coolthemes.narod.ru/files.html * +; license: Copyright 2004-2018 Sergey Kuzmin and co-authors * +; Rules: * +; 1)you can use pieces of code in your project, but should * +; mention the original author (include copyright notice); * +; 2)if you modify CPUID (improve, port, translate, etc) send * +; your changes to the maintainer or make about post changes * +; at forum http://board.kolibrios.org/viewtopic.php?f=42&t=594* +;-----------------------------------------------------------------------------* +; English comments * +;------------------------------------------------------------------------------ +use32 + org 0x0 + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd U_END+4096 + dd U_END+4096 + dd 0x0 + dd path + +include '..\..\..\develop\libraries\box_lib\load_lib.mac' +include '..\..\..\macros.inc' +include '../../../gui_patterns.inc' +include '../../../KOSfuncs.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. +include 'draw.inc' +include 'brand.inc' ; brand ID decoding +include 'caches.inc' ; L1 and L2 cashes decoding for Intel +include 'multipli.inc' ; multiplier decoding +include 'features.inc' ; features decoding +include 'logos.inc' ; include file where gif's are stored +include 'rsatest.inc' +include 'variable.inc' +include 'gif_lite.inc' + +@use_library + +START: + mcall 68,11 + mcall 66,1,1 + mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors + +load_libraries l_libs_start,end_l_libs +;----------------------------------------------------------------------------- +;OpenDialog initialisation + push dword OpenDialog_data + call [OpenDialog_Init] + + mov edi,filename_area + mov esi,start_temp_file_name + call copy_file_name_path +;----------------------------------------------------------------------------- + mcall 68,12,4096*8 ; 16 Kb - I hope this will be enough for store of data + mov [store_text_area_start],eax + + +;------------ +CYCLES: +; CPU speed + mov eax, 18 + mov ebx,5 + mcall + mov [total1],eax ;in Hz, example 1600490000 + xor edx,edx + mov ebx,1000000 + div ebx + mov [total], eax ; in Mhz, example 1600 + xor edx, edx + mov eax, [total1] + mov ebx, 10000 + div ebx + mov [ost], eax ; example 160049 + mov ecx, [total] + imul ecx, 100 + neg ecx + add ecx, eax + mov [sot], ecx ; example 49 +;------------ +cpu: ;is CPUID supported? + pushfd ;push original EFLAGS + pop eax ;get original EFLAGS + mov ebx, eax ;save original EFLAGS + xor eax, 00200000h ;flip 21th bit in EFLAGS + push eax ;save new EFLAGS value on stack + popfd ;replace current EFLAGS value + pushfd ;get new EFLAGS + pop eax ;store new EFLAGS in EAX + cmp eax, ebx ;compare values of 21th bit + jz NO_CPUID ;CPUID isn't supported +;------------ +CPUNAME: ; VENDOR + mov eax,0 ; eax=0 + cpuid + + mov [stdc], eax ; number of calls + mov [cpuname+ 12],ebx + mov [cpuname+ 16],edx + mov [cpuname+ 20],ecx + mov [smallvendor],ecx + +; for various vendors we should later use different methods + +;Decoding cache L1 and L2 for Intel + + cmp ecx, 'ntel' + jne cpu1 ;is not Intel + +;Starting L1, L2, L3 caches detection (Intel made it VERY HARD) + + mov eax, 2 + cpuid + + mov [che], al ; number of calls +multik: + +.eaxl: + test eax, eax ; Test bit 31 + js .ebxl ; <> 0 =>invalid values + call decodecache24 +.ebxl: + test ebx, ebx + js .ecxl + mov eax, ebx + call decodecache32 +.ecxl: + test ecx, ecx + js .edxl + mov eax, ecx + call decodecache32 +.edxl: + test edx, edx + js cpu1 + mov eax, edx + call decodecache32 + + dec [che] ; we made all calls + je cpu1 + +multi: ; not yet + + mov eax, 2 ; so we made call again + cpuid + + jmp multik + +; FAMILY MODEL STEPPING +cpu1: + xor eax, eax + inc eax ; eax=1 + cpuid + + mov ecx, eax + shr ecx,8 ; shift it to the correct position + and ecx,0000000Fh ; get CPU family + mov dword[f],ecx + + mov ecx, eax + shr ecx,4 + and ecx,0000000Fh ; get CPU model + mov dword[m],ecx + + mov ecx, eax + and ecx,0000000Fh ; get CPU stepping + mov dword[s],ecx + + ;- + mov ecx, eax ; get Type + shl ecx, 18 + shr ecx,30 + ;and ecx, 0000000Fh ; only two lower bits can be nonzero + mov dword[t], ecx +;======================================================= + + cmp dword[smallvendor], 'cAMD' + jz maybe_athlon + cmp dword[smallvendor], 'ntel' + jnz no_full ; if not AMD or Intel + +;detect_it: +;cmp [f], 0Fh +;jne no_full fixed calculation of extended model for Intel + +full: + + mov ecx, eax ; get Extended model + shr ecx,16 ;shift it to the correct position + and ecx, 0000000Fh + shl ecx, 4 + mov dword[newpc],ecx ; this value for old pc=0 and for new pc>0 + add ecx, [m] + mov dword[em],ecx ; effective model + + mov ecx, eax ; get Extended family + shr ecx, 20 ;shift it to the correct position + and ecx, 000000FFh + add ecx, [f] + mov dword[ef],ecx ; effective family + + + jmp fut + +no_full: + + mov ecx, [m] + mov [em], ecx + + mov ecx, [f] + mov [ef], ecx + + jmp fut + +maybe_athlon: + mov eax, 0x80000001 ; CPUID ext. function 0x80000001 + cpuid + mov ecx, eax + shr ecx,8 ; shift it to the correct position + and ecx,0000000Fh ; get CPU family + mov dword[ef],ecx + + mov ecx, eax + shr ecx,4 + and ecx,0000000Fh ; get CPU model + mov dword[em],ecx + +fut: + + call decode_sse3_5 + + + + ;call decode_sse3_5 + ;- + call decode_extended + + mov eax,$80000000 + cpuid + + mov [extc], eax ; max number of calls + + test eax, $80000000 ;// Test bit 31 + jz .noname + + cmp eax,$80000003 + ja .mynameis + jmp .noname + +.mynameis: + mov eax,$80000002 + cpuid + mov [myname],eax + mov [myname+4],ebx + mov [myname+8],ecx + mov [myname+12],edx + mov eax,$80000003 + cpuid + mov [myname+16],eax + mov [myname+20],ebx + mov [myname+24],ecx + mov [myname+28],edx + mov eax,$80000004 + cpuid + mov [myname+32],eax + mov [myname+36],ebx + mov [myname+40],ecx + mov [myname+44],edx + jmp red + +.noname: + +red: + + ;mov byte [multiplier], 115; ; for testing + + call decode_sse3 + + call multipl ; get multiplier + mov byte [multiplier], cl + + mov dword [freqbb], 0 + mov dword [freqll], 0 + + mov ebx, dword [multiplier] + test ebx, ebx + jz output + + calc: + + mov eax,dword [ost] ; example 166474 + imul eax, 10 ; example 1664740 + xor edx,edx + div ebx ; get system clock (if multiplier detected) + + xor edx, edx ; example eax=16647 + mov ebx, 100 + div ebx + mov dword [freqbb], eax ; example 166 + mov dword [freqll], edx ; example 47 + + xor edx, edx + mov eax,dword[multiplier] ; example 115 + mov ebx,10 + div ebx + mov dword[multb], eax ; example 11 + mov dword[multa], edx ; example 5 + +output: + + call draw_window ; Draw window + +;HRERE + +PROCCORE: ; Who are you? +; Intel - "GenuineIntel" + +; AMD - "AuthenticAMD" + +; Cyrix - "CyrixInstead" + +; UMC - "UMC UMC UMC " +; NexGen - "NexGenDriven" +; Centaur - "CentaurHauls" + +; Rise Technology - "RiseRiseRise" +; SiS - "SiS SiS SiS " +; Transmeta - "GenuineTMx86" + +; National Semiconductor - "Geode by NSC" +; Vortex - "Vortex86 SoC" + initial support + cmp dword[smallvendor], 'ntel' ;1 + jz Intel + cmp dword[smallvendor], 'cAMD' ;2 + jz AMD + cmp dword[smallvendor], 'tead' ;3 + jz Cyrix + cmp dword[smallvendor], 'auls' ;4 + jz Centaur + cmp dword[smallvendor], 'Mx86' ;5 + jz Transmeta + cmp dword[smallvendor], ' SoC' ;6 + jz Vortex + +; cmp ecx, 'UMC ' +; jz .UMC +; cmp ecx, 'iven' +; jz .NexGen +; cmp ecx, 'Rise' +; jz .Rise +; cmp ecx, 'SiS ' +; jz .SiS +; cmp ecx, ' NSC' +; jz .NSC +; jmp Other ; I don't know what to do with you... +Other: + Text 75,70,0x00000000,other, otherlen-other + + mov esi, other + mov edi, [saveproc] + call concatname + + jmp MMXtest +;------------------------- + +AMD: + +;------------------------------------------------------------------------------- + + Text 15, 190,0x00000000,cache, cachelen-cache + + Text 75,70,,AMDn, AMDnlen-AMDn + mov esi, AMDnNew + mov edi, saveproc + call concatname + mov esi, amd + call load_gif + PutImage 135,107,201,49,img_area+8 + MOV [codeN], 2 +; place size + +; Relax, man. AMD made PRETTY SIMPLE cache detection routine +;CACHE1: + mov eax, 80000005h + cpuid + + movzx eax, cl + mov [lineld], eax + + mov eax, ecx + ;shl eax, 8 + ;shr eax, 24 + + and eax,00FF0000h + shr eax, 16 + mov [wayld], eax + + shr ecx, 24 + mov [L1d], ecx + + + movzx eax, dl + mov [lineli], eax + + mov eax, edx + ;shl eax, 8 + ;shr eax, 24 + + and eax,00FF0000h + shr eax, 16 + mov [wayli], eax + + + shr edx, 24 + mov [L1i], edx + + +;CACHE2: + mov eax, 80000006h + cpuid + + movzx eax, cl + mov dword[linel2], eax + + push ecx + shr ecx, 12+1 + and ecx, 0x7 + mov eax, 1 + shl eax, cl + mov dword [wayl2], eax + pop ecx + + shr ecx, 16 + mov [L2],ecx + +;CACHE3: edx provides l3 + + mov eax, 80000006h + cpuid + + movzx eax, cl ;mov cl to eax, zero extend; cl is counter reg for loop,shifts + mov dword[linel3], eax + + push edx + shr edx, 12+1 + and edx, 0x7 + mov eax, 1 + shl eax, cl + mov dword [wayl3], eax + pop edx + + shr edx, 18 + mov [L3],ecx + + cmp [f], $5 + jz .fiv + cmp [f], $6 + jz .si + cmp [f], $F + jz fif + cmp [f], $10 ;family 16, 010h, + jz ten + + +.fiv: ; Family=5 + mov [micron], 50 + mov edx, A50 + cmp [m], $0 + jz @f + mov [micron], 35 + mov edx, A51 + cmp [m], $1 + jz @f + mov edx, A52 + cmp [m], $2 + jz @f + mov edx, A53 + cmp [m], $3 + jz @f + mov [micron], 30 + mov edx, A56 + cmp [m], $6 + jz @f + mov [micron], 25 + mov edx, A57 + cmp [m], $7 + jz @f + mov edx, A58 + cmp [m], $8 + jz @f + mov edx, A59 + cmp [m], $9 + jz @f + mov [micron], 18 + mov edx, A5D +@@: + jmp @f + +.si: ; Family=6 + mov [micron], 25 + mov edx, At1 + cmp [m], $1 + jz @f + mov [micron], 18 + mov edx, At2 + cmp [m], $2 + jz @f + mov edx, At3 + cmp [m], $3 + jz @f + mov edx, At4 + cmp [m], $4 + jz @f + cmp [m], $6 + jz A6 + mov [micron], 13 + mov edx, At7 + cmp [m], $7 + jz @f + cmp [m], $8 + jz A8 + jmp AA +@@: + mov [cname], edx + jmp MMXtest +A6: +;mov [FRS], 266 ;!!!!!! +;Number 315,90,0,3,dword [FRS],0x000000; MHz + + call newrating; !!!! + + Text 245,70,0x00000000,pr, prlen-pr + Number 310,70,0,4,dword [rating],0x000000 + mov edx, At6 + jmp @b + +A8: + +;mov [FRS], 266 ;!!!!!! +;Number 315,90,0,3,dword [FRS],0x000000; MHz + + cmp [L2], 256 + jl .App ; Applebred + + call newrating;!!!! + + Text 245,70,0x00000000,pr, prlen-pr + Number 310,70,0,4,dword [rating],0x000000 + mov edx, At8 + jmp @b + +.App: + mov edx, At8a + jmp @b + +AA: + +; mov [FRS], 333; !!!! + Text 245,70,0x00000000,pr, prlen-pr + +; Number 315,90,0,3,dword [FRS],0x000000; MHz + + mov edx, Atat + cmp [L2], 256 + jl .Tho ; Thorton + mov edx, Ata +.Tho: + push edx + + call newrating;!!!!! + + Number 310,70,0,4,dword [rating],0x000000 + pop edx + jmp @b + +fif: ; AMD-64 Family=15 + +;here is a need to rewrite detection of AMD F-th family according to "Revision Guide for +;AMD AthlonTM 64 and AMD OpteronTM Processors" 25759.pdf + + + cmp [m],$1 ;Dual-core Opteron + jz AF1. + cmp [m],$3 ;Toledo 1024 0.09 + jz AF3. + cmp [m],$4 ;Athlon 64 Mobile Athlon 64 FX ClawHammer (1024) 0.13 + jz AF4. + cmp [m],$5 ;Opteron Athlon 64 FX 0.13 (1024) + jz AF5. + cmp [m],$7 ;Athlon 64 Athlon 64 FX Clawhammer(1024) 0.13 Sledgehammer(1024) 0.13 // SSE3+ SanDiego(1024) + jz AF7. + cmp [m],$8 ;Athlon 64 Mobile Athlon 64 FX ClawHammer (1024) 0.13 + jz AF8. + cmp [m],$B ;Athlon 64 + jz AFB. + cmp [m],$C ;Athlon 64 Newcastle(512) 0.13 Sempron> Paris (256) 0.13 |SSE3+ Sempron > Palermo FC0 0.09 // (Venice) + jz AFC. + cmp [m],$E ;Athlon 64 + jz AFE. + cmp [m],$F ;Athlon 64 Winchester(512) |SSE3+ SanDiego(1024) Venice (512) Palermo (256) 0.09 + jz AFF. + jmp next_generation + +ten: ;family = 10h + + cmp [m],$2 + jz AB23. + cmp [m], $8 + jz AB83. + cmp [m], $9 + jz AB9. + cmp [m], $2 + jz AB8check2. + +AB8check2.: + cmp [s],03h + jz AB8right2. + cmp [m],$2 + jz athlonCheck + +athlonCheck: + cmp [s],03h + jz athlonKuma + + cmp [m], $5 + jz AB4. + cmp [m],$1 + jz AB1. + cmp [m],$4 + jz AB8check. + +AB8check.: + cmp [s],02h + jz ABC2. + cmp [s],01h + jz ABC3. + cmp [m], $9 + jz AB6. + cmp [m], $2 + jz AB8check. + cmp [m], 06h + jz ABM. + +athlonKuma: + mov [micron], 65 + Text 100,70,0x00000000,AthlonKuma, AthlonKumalen-AthlonKuma + mov esi, AthlonKuma + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB23.: + mov [micron], 65 + Text 100,70,0x00000000,AB23, AB23len-AB23 + mov esi, AB23 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB83.: + mov [micron], 65 + Text 100,70,0x00000000,AB83, AB83len-AB83 + mov esi, AB83 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB9.: + mov [micron], 65 + Text 100,70,0x00000000,AB9, AB9len-AB9 + mov esi, AB9 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB8right2.: + mov [micron], 65 + Text 100,70,0x00000000,AB8right2, AB8right2len-AB8right2 + mov esi, AB8right2 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB4.: + mov [micron], 45 + Text 100,70,0x00000000,AB4, AB4len-AB4 + mov esi, AB4 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB1.: + mov [micron], 65 + Text 100,70,0x00000000,AB1, AB1len-AB1 + mov esi, AB1 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +ABC2.: + mov [micron], 45 + Text 100,70,0x00000000,ABC2, ABC2len-ABC2 + mov esi, ABC2 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AB6.: + mov [micron], 45 + Text 100,70,0x00000000,AB6, AB6len-AB6 + mov esi, AB6 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +ABC3.: + mov [micron], 45 + Text 100,70,0x00000000,ABC3, ABC3len-ABC3 + mov esi, ABC3 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +ABM.: + mov [micron], 45 + Text 100,70,0x00000000,ABM2, ABM2len-ABM + mov esi, ABM2 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AF1.: + mov [micron], 09 ;? + Text 100,70,0x00000000,AF1, AF1len-AF1 + mov esi, AF1 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest +AF3.: + mov [micron], 09 + Text 100,70,0x00000000,AF3, AF3len-AF3 + mov esi, AF3 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest +AF4.: + mov [micron], 13 + Text 100,70,0x00000000,AF4, AF4len-AF4 + mov esi, AF4 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest +AF5.: + mov [micron], 13 + Text 100,70,0x00000000,AF5, AF5len-AF5 + jmp MMXtest + +AF7.: + mov [micron], 13 + Text 100,70,0x00000000,AF5, AF5len-AF5 + mov esi, AF5 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AF8.: + mov [micron], 13 + Text 100,70,0x00000000,AF4, AF4len-AF4 + mov esi, AF4 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AFB.: + mov [micron], 13 + Text 100,70,0x00000000,AF4, AF4len-AF4 + mov esi, AF4 + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AFC.: + cmp [L2], 512 + je AFC.n + + cmp [sse3sup], 1 + je AFC.npal + +AFC.npar: ; paris + mov [micron], 13 + Text 100,70,0x00000000,AFCs, AFCslen-AFCs + mov esi, AFCs + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AFC.npal: ; palermo + mov [micron], 9 + Text 100,70,0x00000000,AFCsp, AFCsplen-AFCsp + mov esi, AFCsp + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AFC.n: ;newcastle + mov [micron], 13 + Text 100,70,0x00000000,AFC, AFClen-AFC + mov esi, AFC + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +AFE.: ; error in cpu + jmp AFC. + +AFF.: + + cmp [sse3sup], 1 + je .AFFsse + +.win: + mov [micron], 9 ; winchester + jmp MMXtest + +.AFFsse: + mov [micron], 9 + cmp [L2], 1024 + jz .AFs + cmp [L2], 512 + jz .AFd + cmp [L2], 256 + jz .AFp + +.AFs: + Text 100,70,0x00000000,AFS, AFSlen-AFS + mov esi, AFS + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +.AFd: + Text 100,70,0x00000000,AFV, AFVlen-AFV + mov esi, AFV + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest + +.AFp: + Text 100,70,0x00000000,AFCsp, AFCsplen-AFCsp + mov esi, AFCsp + mov edi, saveproc + 0x4 + call concatname + jmp MMXtest +;----------------------------------------------- +Intel: + mov [codeN], $1 + Text 75,70,0x00000000,Inteln, Intelnlen-Inteln + mov esi, IntelnNew + mov edi, saveproc + call concatname + mov esi, intel + call load_gif + PutImage 135,107,201,49,img_area+8 + +det: + cmp [f], $5 + jz five + cmp [f], $6 + jz six + cmp [f], $7 + jz sev + cmp [f], $F + jz fift +five: ;Family=5 + + Text 15, 190,0x00000000,cache, cachelen-cache + + cmp [m],$0 + jz .I0 + cmp [m],$1 + jz .I1 + cmp [m],$2 + jz .I2 + cmp [m],$3 + jz .I3 + cmp [m],$4 + jz .I4 + cmp [m],$7 + jz .I7 + cmp [m],$8 + jz .I8 +.I0: + mov [cname], P50 + mov esi, P50 + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 80 + jmp MMXtest +.I1: + mov [cname], P5 + mov esi, P5 + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 50 + jmp MMXtest + +.I2: + mov [cname], P54C + mov esi, P54C + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 50 + jmp MMXtest + +.I3: + mov [cname], P54T + mov esi, P54T + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 50 + jmp MMXtest + +.I4: + mov [cname], P55C + mov esi, P55C + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 35 + jmp MMXtest + + +.I7: + mov [cname], P54C + mov esi, P54C + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 8 + mov [L1i], 8 + mov [L2], 256 + mov [micron], 35 + jmp MMXtest + +.I8: + mov [cname], P55C + mov esi, P55C + mov edi, saveproc + 0x6 + call concatname + mov [L1d], 16 + mov [L1i], 16 + mov [L2], 256 + mov [micron], 35 + jmp MMXtest + +six: ;Family=6 + + Text 15, 190,0x00000000,cache, cachelen-cache + cmp [newpc],$0 + jnz NEWintel + + cmp [m],$0 + jz .I60 + cmp [m],$1 + jz .I61 + cmp [m],$3 + jz .I63 + cmp [m],$5 + jz .I65 + cmp [m],$6 + jz .I66 + cmp [m],$7 + jz .I67 + cmp [m],$8 + jz .I68 + cmp [m],$9 + jz .I69 + cmp [m],$A + jz .I6A + cmp [m],$B + jz .I6B + cmp [m],$D + jz .I6D + cmp [m],$E + jz .I6E + cmp [m],$F + jz .I6F +.I60: + mov [micron], 50 + mov [cname], P60 + mov esi, P60 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I61: + mov [micron], 35 + mov [cname], P61 + mov esi, P61 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I63: + mov [micron], 28 + mov [cname], P63 + mov esi, P63 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I65: + mov [micron], 25 + cmp [L2], 0 + jne .pp65 ; Pentium + mov [cname], P65c + mov esi, P65c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.pp65: + mov [cname], P65 + mov esi, P65 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.I66: + mov [micron], 25 + mov [cname], P66 + mov esi, P66 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.I67: + mov [micron], 25 + ;but if SSE4.1 supported then it is Intel Core (Penryn) + mov [cname], P67 + mov esi, P67 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I68: + mov [micron], 18 + cmp [L2], 128 + jne .pp68 ; Pentium + mov [cname], P68c + mov esi, P68c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + + .pp68: + mov [cname], P68 + mov esi, P68 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I69: + mov [micron], 13 + mov [cname], P69 + mov esi, P69 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I6A: + mov [micron], 18 + ;but if SSE4.2 supported then it is Intel Core (Nehalem) + mov [cname], P6A + mov esi, P6A + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I6B: + mov [micron], 13 + cmp [L2], 256 + jne .pp6B ; Pentium + mov [cname], P6Bc + mov esi, P6Bc + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.pp6B: + mov [cname], P6B + mov esi, P6B + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I6D: + mov [micron], 9 + mov [cname], P6D + mov esi, P6D + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I6E: + mov [micron], 6 + mov [cname], P6E + mov esi, P6E + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.I6F: + mov [micron], 6 + mov [cname], P6F + mov esi, P6F + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +;06Ex - Pentium M Yonah 0.065 +;06Fx - Pentium D Conroe 0.065, Xeon Woodcrest, Celeron D AllenDale, Core 2 Kentsfield + +NEWintel: + + cmp [em],$3A ;IvyBridge + jz I3A + cmp [em],$2A ;SandyBridge + jz I2A + cmp [em],$2D ;SandyBridge-E/EN/EP + jz I2D + cmp [em],$25 ;Arrandale/Clarksdale + jz I25 + cmp [em],$2C ;Gulftown/Westmere-EP + jz I2C ;westmere-EP stepping B1 -> micron 0.032 + cmp [em],$2F ;Westmere-EX + jz I2F + cmp [em],$1E ;Clarksfield/Lynnfield/Jasper Forest + jz I1E + cmp [em],$1A ;Bloomfield/Nehalem-EP + jz I1A + cmp [em],$2E ;Nehalem-EX + jz I2E + cmp [em],$17 ;Yorkfield/Wolfdale/Penryn/Harpertown (DP) + jz I17 + cmp [em],$1D ;Dunnington (MP) + jz I1D + cmp [em],$0F ;Clovertown/Kentsfield/Conroe/Merom/Woodcrest + jz I0F + cmp [em],$16 ;Merom Conroe + jz I16 + cmp [em],$06 ;Cedar Mill/Presler + jz I06 + cmp [em],$03 ;Nocona Irwindale / Prescott + jz I03 + cmp [em],$04 ;NoconaIrwindale / Prescott + jz I03 + cmp [em],$0D ;Dothan + jz I0D + cmp [em],$36 ;Cedarview + jz I36 + cmp [em],$26 ;Lincroft + jz I26 + cmp [em],$1C ;Pineview/Silverthorne + jz I1C + mov [cname], no_known + +Inewunknown: + jmp MMXtest + +I3A: + mov [micron], 32 + mov [cname], P3A + mov esi, P3A + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I2A: + mov [micron], 32 + mov [cname], P2A + mov esi, P2A + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I2D: + mov [micron], 32 + mov [cname], P2D + mov esi, P2D + mov edi,saveproc + 0x10 + call concatname + jmp MMXtest + +I25: + mov [micron], 32 + mov [cname], P25 ;P25 + mov esi, P25 + mov edi, saveproc + 0x10 ;12 + call concatname + jmp MMXtest + +I2C: + mov [micron], 32 + mov [cname], P2C + mov esi, P2C + mov edi,saveproc + 0x10 + call concatname + jmp MMXtest + +I2F: + mov [micron], 32 + mov [cname], P2F + mov esi, P2F + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I1E: + mov [micron], 32 + mov [cname], P1E + mov esi, P1E + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I1A: + mov [micron], 45 + mov [cname], P1A + mov esi, P1A + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I2E: + mov [micron], 45 + mov [cname], P2E + mov esi, P2E + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I17: + mov [micron], 45 + mov [cname], P17 + mov esi, P17 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I1D: + mov [micron], 45 + mov [cname], P1D + mov esi, P1D + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I0F: + mov [micron], 65 + mov [cname], P0F + mov esi, P0F + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I16: + mov [micron], 65 + mov [cname], P16 + mov esi, P16 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I06: + mov [micron], 32 + mov [cname], P06 + mov esi, P06 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I03: + mov [micron], 32 + mov [cname], P03 + mov esi, P03 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I0D: + mov [micron], 32 + mov [cname], P0D + mov esi, P0D + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I36: + mov [micron], 32 + mov [cname], P36 + mov esi, P36 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I26: + mov [micron], 32 + mov [cname], P26 + mov esi, P26 + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + +I1C: + mov [micron], 32 + mov [cname], P1C + mov esi, P1C + mov edi, saveproc + 0x10 + call concatname + jmp MMXtest + + +;;;;;;;;;;;;;;;;;;; +sev: ;Family=7 +.IS0: + + Text 15, 190,0x00000000,cache, cachelen-cache + mov [micron], 18 + mov [cname], PS0 + mov esi, PS0 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +fift: ;Family=15 + + Text 15, 190,0x00000000,cacheP4, cacheP4len-cacheP4 + + cmp [m],$0 + jz .IF0 + cmp [m],$1 + jz .IF1 + cmp [m],$2 + jz .IF2 + cmp [m],$3 + jz .IF3 + cmp [m],$4 + jz .IF3 ;identical to F3xh + cmp [m],$5 + jz .IF5 + cmp [m],$6 + jz .IF6 + jmp next_generation +.IF0: + mov [micron], 18 + cmp [L2], 128 + jne .ppF0 ; Pentium + mov [cname], PF0c + mov esi, PF0c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.ppF0: + mov [cname], PF0 + mov esi, PF0 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.IF1: + mov [micron], 18 + cmp [L2], 128 + je .IF0;jne.ppF1 ; Pentium + ; mov eax,dword 0x00000004 + ; mov ebx,115*65536+80 + ; mov ecx,dword 0x00000000 + ; mov edx,PF0c + ; mov esi,PF0clen-PF0c + ; mcall + ;jmp MMXtest +;.ppF1: + mov [cname], PF0 + mov esi, PF0 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.IF2: + mov [micron], 13 + cmp [L2], 128 + jne .ppF2 ; Pentium + mov [cname], PF2c + mov esi, PF2c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.ppF2: + mov [cname], PF2 + mov esi, PF2 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.IF3: + mov [micron], 09 + cmp [L2], 256 + jne .ppF3 ; Pentium + mov [cname], PF3c + mov esi, PF3c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.ppF3: + mov [cname], PF3 + mov esi, PF3 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.IF5: + mov [micron], 09 + cmp [L2], 512 + jae .ppF5 ; Pentium + mov [cname], PF5c + mov esi, PF5c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.ppF5: + mov [cname], PF5 + mov esi, PF5 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + + .IF6: + mov [micron], 06 ; 065 + cmp [L2], 512 + ja .ppF6 ; Pentium + mov [cname], PF6c + mov esi, PF6c + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.ppF6: + mov [cname], PF6 + mov esi, PF6 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + + + next_generation: + mov [cname], NG + mov esi, NG + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +;---------------------------------- +Cyrix: + + mov [codeN], 3 + Text 15, 190,0x00000000,cache, cachelen-cache + + mov esi, cyrix + call load_gif + PutImage 135,107,201,49,img_area+8 + + + cmp [f], $5 + jz .fivv + cmp [f], $6 + jz .sixx +.fivv: ;Family=5 + cmp [m],$2 + jz .C52 + cmp [m],$4 + jz .C54 +.C52: + mov [micron], 50 ;35? + mov [L1i], 8 + mov [L1d], 8 + mov [L2], 512 + Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn + mov esi, Cyrixn + mov edi, saveproc + call concatname + mov [cname], C52 + mov esi, C52 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.C54: + mov [micron], 50 + mov [L1i], 8 + mov [L1d], 8 + mov [L2], 512 + Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn + mov esi, Cyrixn + mov edi, saveproc + call concatname + mov [cname], C54 + mov esi, C54 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest + +.sixx: ;Family=6 + cmp [m],$0 + jz .C60 + cmp [m],$5 + jz .C65 +.C60: + mov [micron], 25 + mov [L1i], 32 + mov [L1d], 32 + mov [L2], 512 + Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn + mov esi, Cyrixn + mov edi, saveproc + call concatname + mov [cname], C60 + mov esi, C60 + mov edi, saveproc + 0x6 + call concatname + jmp MMXtest +.C65: + mov [micron], 25 ;35? + mov [L1i], 32 + mov [L1d], 32 + mov [L2], 512 + Text 75,70,0x00000000,Centaurn, Centaurnlen-Centaurn + mov esi, Centaurn + mov edi, saveproc + call concatname + mov edx,C65 + mov esi,C65len-C65 + jmp OutProcName +;--------------------- +Centaur: + + Text 15, 190,0x00000000,cache, cachelen-cache + +;CACHE1: + mov eax, 80000005h + cpuid + shr ecx, 24 + mov [L1d], ecx + shr edx, 24 + mov [L1i], edx + +; cache detection routine +;CACHE1: + mov eax, 80000005h + cpuid + + movzx eax, cl + mov [lineld], eax + + mov eax, ecx + shr eax, 16 + and eax,000000FFh + mov [wayld], eax + + shr ecx, 24 + mov [L1d], ecx + + movzx eax, dl + mov [lineli], eax + + mov eax, edx + + shr eax, 16 + and eax,000000FFh + mov [wayli], eax + + shr edx, 24 + mov [L1i], edx + + +;CACHE2: + mov eax, 80000006h + cpuid + + cmp [f], $6 + jz vn + jmp vl2old ; if not then old identification +vn: + cmp [m],$9 + jl vl2old + ; else new + movzx eax, cl + mov dword[linel2], eax + + mov eax, ecx + shl eax, 16 + shr eax, 28 + + mov dword[wayl2], eax + + shr ecx, 16 ; it is 16 bits now + mov [L2],ecx + + + +vl2old: + movzx eax, cl + mov dword[linel2], eax + + mov eax, ecx + shl eax, 8 + shr eax, 24 + + mov dword[wayl2], eax + + shr ecx, 24 ; it was 8 bits earlier + mov [L2],ecx + + + cmp [f], $5 + jz fivC + cmp [f], $6 + jz sixC + +fivC: ;Family=5 + + mov esi, idt + call load_gif + PutImage 135,107,201,49,img_area+8 + ;PutImage 125,107,201,49,img_area+8 + ; place size + + Text 75,70,0x00000000,IDTn, IDTnlen-IDTn + mov esi, IDTn + mov edi, saveproc + 0x4 + call concatname + cmp [m],$4 + jz .V54 + cmp [m],$8 + jz .V58 + cmp [m],$9 + jz .V59 +.V54: + mov [micron], 35 + mov edx,V54 + mov esi,V54len-V54 + jmp OutProcName +.V58: + mov [micron], 25 + mov edx,V58 + mov esi,V58len-V58 + jmp OutProcName +.V59: + mov [micron], 25 + mov edx,V59 + mov esi,V59len-V59 + jmp OutProcName + +sixC: ;Family=6 + + mov esi, via + call load_gif + PutImage 135,107,201,49,img_area+8 + + + Text 75,70,0x00000000,Centaurn, Centaurnlen-Centaurn + mov esi, Centaurn + mov edi, saveproc + call concatname + cmp [m],$6 + jz .V66 + cmp [m],$7 + jz .V67 + cmp [m],$8 + jz .V68 + cmp [m],$9 + jz .V69 + cmp [m],$A + jz .V6A +.V66: + mov [micron], 18 ; 25? + mov edx,V66 + mov esi,V66len-V66 + jmp OutProcName +.V67: + mov [micron], 15 + mov edx,V67 + mov esi,V67len-V67 + jmp OutProcName +.V68: + mov [micron], 13 + mov edx,V68 + mov esi,V68len-V68 + jmp OutProcName +.V69: + mov [micron], 13 + mov edx,V69 + mov esi,V69len-V69 + jmp OutProcName +.V6A: + mov [micron], 9 + mov edx,VA + mov esi,VAlen-VA + jmp OutProcName +;----------- +Transmeta: + + Text 15, 190,0x00000000,cache, cachelen-cache + + Text 75,70,,Tranmsmetan, Tranmsmetanlen-Tranmsmetan + mov esi, Tranmsmetan + mov edi, saveproc + call concatname + + mov esi, transmeta + call load_gif + PutImage 135,107,201,49,img_area+8 + +; cache detection routine - it is the same as for AMD (almost) +;CACHE1: + mov eax, 80000005h + cpuid + + movzx eax, cl + mov [lineld], eax + + mov eax, ecx + + shr eax,16 + and eax,000000FFh + mov [wayld], eax + + shr ecx, 24 + mov [L1d], ecx + + movzx eax, dl + mov [lineli], eax + + mov eax, edx + + shr eax, 16 + and eax,000000FFh + mov [wayli], eax + + shr edx, 24 + mov [L1i], edx + + +;CACHE2: + mov eax, 80000006h + cpuid + + movzx eax, cl + mov dword[linel2], eax + + mov eax, ecx + shl eax, 16 + shr eax, 28 + + mov dword[wayl2], eax + + shr ecx, 16 + mov [L2],ecx + + + cmp [f], $5 + jz .fivt + cmp [f], $F + jz .fift +.fivt: ; Family=5 + + mov edx,T5 + mov esi,T5len-T5 + jmp @f + +.fift: ; Family=F + mov edx,TF + mov esi,TFlen-TF +@@: + mov [micron], 13 ; + Text 140,70,0 + jmp MMXtest + +OutProcName: + Text 100,70,0 + +;---- +;---------------------------------- new +Vortex: + + Text 15, 190,0x00000000,cache, cachelen-cache + + mov esi, vortex + call load_gif + PutImage 135,107,201,49,img_area+8 + ;PutImage 130,127,201,49,img_area+8 + ; place size + + cmp [f], $5 + jz .V54 ;fivvtx +;.fivvtx: ;Family=5 +; cmp [m],$4 +; jz .V54 +.V54: + mov [micron], 13 + mov [L1i], 16 + mov [L1d], 16 + mov [L2], 256 + mov [wayl2], 4 + mov [wayli], 4 + mov [wayld], 4 + Text 75,70,0x00000000,Vortexn, Vortexnlen-Vortexn + mov esi, Vortexn + mov edi, saveproc + call concatname + jmp MMXtest + +;--------------------- + + + +MMXtest: ; MMX test and Brand ID decoding + + call decodebrand ; get Brand ID + + call decode_standard_features + + call decode_extended_features + + xor eax,eax + inc eax + cpuid +HTTtest: + test edx, $10000000; ;Test bit 28 + jz .ELN + +.EL: ;HTT technology is supported + and ebx,00FF0000h ; numbers of logical processors + cmp ebx, 1 shl 16 + ; mov [number_of_log_cpus], ebx + je .ELN ; HHT not enabled (Celeron) + + mov dword [HTTn+9], $736579 + mov dword [HTT+ 6], $736579 + jmp TEXTOUT +.ELN: + + mov dword [HTTn+ 9], $6F6E + mov dword [HTT+ 6], $6F6E + +TEXTOUT: + + Text 275,290,0x00000000,HTT, HTTlen-HTT + Text 275,310,,sse3, sse3len-sse3 + Text 15,290,,MMXs, MMXslen-MMXs + Text 15,310,,SSE, SSElen-SSE + Text 95,310,,SSE2, SSE2len-SSE2 + +;------------------- +TEST3DNOW: + + xor edx, edx + cmp [smallvendor], 'ntel' + ; je @f ;recent change + jne .t + +.t: + + mov eax, $80000001 ;// Setup extended function 8000_0001h + cpuid + + test edx, $80000000 ;// Test bit 31 + jnz .XIT + +.NOEXTENDED: ;// 3DNow! technology is supported + mov dword [now+ 9], $6F6E + jmp TEST3DNOWP +.XIT: + mov dword [now+ 9], $736579 + jmp TEST3DNOWP + +TEST3DNOWP: + + cmp [smallvendor], 'ntel' + je .NOEXTENDEDP + +.tp: + + mov eax, $80000001 ;// Setup extended function 8000_0001h + cpuid + + test edx, $40000000 ;// Test bit 30 + jnz .XITP ;// 3DNow! technology is supported + +.NOEXTENDEDP: + mov dword [nowp+ 9], $6F6E + jmp TESTMMXP +.XITP: + mov dword [nowp+ 9], $736579 + jmp TESTMMXP + + +TESTMMXP: + + mov eax,$80000000 + cpuid + + test eax, 80000000h + jna NOEXTENDEDM + + ;cmp eax, $80000000 ;// Is 800_0001h supported? + ;jz .NOEXTENDEDM ;// If not, 3DNow! technology is not supported + mov eax, $80000001 ;// Setup extended function 8000_0001h + cpuid + cmp [smallvendor], 'tead' + jne noCyr +Cyrmx: + test edx, $01000000 ;// Test bit 24 + jnz XITM ;// 3DNow! technology is supported + jz NOEXTENDEDM +noCyr: + test edx, $00400000 ;// Test bit 22 + jnz XITM ;// 3DNow! technology is supported + ;jz .NOEXTENDEDM + +NOEXTENDEDM: + mov dword [mmxp+ 7], $6F6E + mov dword [MMXPi+ 8], $6F6E + jmp text3d +XITM: + mov dword [mmxp+ 7], $736579 + mov dword [MMXPi+ 8], $736579 + +text3d: + + Text 15,330,0x00000000,now, nowlen-now + Text 95,330,,nowp, nowplen-nowp + Text 95,290,,mmxp, mmxplen-mmxp + Text 110,70,0x80000000,dword[cname] + + jmp still + +;-------------------------- +NO_CPUID: + mov [nocpuid], 1 + Text 15,50,0x00000000,oblom, oblomlen-oblom + +FREEZE: + nop + jmp FREEZE ; maybe we should close application or just made some Warning and jump to still: +;---------------- +still: + +; waiting for events +event_wait: + + mov eax,23 ; function 23 - event wait + mov ebx,50 ; wait for 0.5 second + mcall + + cmp eax,1 ; + je red ; redraw + cmp eax,2 ; + je key ; key + cmp eax,3 ; + je button ; button + jmp still ; + key: ; + mcall ; + jmp still ; + button: ; + mov eax,17 ; + mcall ; + cmp ah,1 ; = 1 ? + je close ; close + + cmp ah,2 ; = 2 ? + je thread_start ; + + cmp ah, 3 + je call_OpenDialog + + mov eax,11 ; function 23 - event wait + mov ebx,1 + mcall + + mov eax,15 ; function 23 - event wait + mov ebx,3 + mcall + +; cmp ah,3 ; = 3 ? + jne still + +close: + mov eax,-1 + mcall + +;**************************** THREAD-SECOND WINDOW +thread_start: + + cmp [num_win2],0 + jne still + +;================================================RSA test + +;test rsa coding speed + call init_test +;length of module - 256 bit + mov eax,26 + mov ebx,9 + mcall + add eax,100 ;test lasts 1 second. + push eax +.loop: + push 4 ;do 4 iterations - this reduces number of calls mcall. +.loop1: + call rsa_test ;this procedure change all registers + dec dword [esp] + jnz .loop1 + pop ecx + mov eax,26 + mov ebx,9 + mcall + cmp eax,dword [esp] ;Is time changed? + jl .loop + pop eax + shr dword [iter],4 ;[iter] - speed in Kb/sec. (every iteration codes 64 bytes) + CreateTread window_2,thread2_esp + jmp still + +window_2: + mov [num_win2],1 + call draw_window_2 + +still_2: + + mov eax,10 + mcall + + cmp eax,1 + je window_2 ; window_2 + cmp eax,2 ; + je key_2 ; key_2 + cmp eax,3 ; + je button_2 ; button_2 + + jmp still_2 ; + + key_2: ; + mcall ; + jmp still_2 ; + + button_2: ; + mov eax,17 ; 17 + mcall ; + + cmp ah,1 ; = 1 ? + jne still_2 ; noclose + + mov [num_win2],0 ; + + or eax,-1 ; + mcall + + +draw_window_2: + + ;call prepare_text_area + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1h ; 1, start of draw + mcall + + + Window 250,250,420,520, 0x33FFFFFF, 0x805080d0, standard ;460 + ; place size + + + Text 15, 10,0x00000000, STDCA, STDCAlen-STDCA + Text 215, 10,, EXTCA, EXTCAlen-EXTCA + + Text 15, 30,0x00000000, FPU, FPUlen-FPU + Text 115, 30,, VME, VMElen-VME + Text 215, 30,, DE, DElen-DE + Text 315, 30,, PSE, PSElen-PSE + + Text 15, 50,,TSC, TSClen-TSC + Text 115,50,,MSR, MSRlen-MSR + Text 215,50,,PAE, PAElen-PAE + Text 315,50,,MCE, MCElen-MCE + + Text 15,70,,CX8, CX8len-CX8 + Text 115,70,,APIC, APIClen-APIC + Text 215,70,,Res, Reslen-Res + Text 315,70,,SEP, SEPlen-SEP + + Text 15,90,,MTRR, MTRRlen-MTRR + Text 115,90,,PGE, PGElen-PGE + Text 215,90,,MCA, MCAlen-MCA + Text 315,90,,CMOV, CMOVlen-CMOV + + Text 15,110,,PAT, PATlen-PAT + Text 115,110,,PSE36, PSE36len-PSE36 + Text 215,110,,PSNUM, PSNUMlen-PSNUM + Text 315,110,,CLFLUSHn, CLFLUSHnlen-CLFLUSHn + + Text 15,130,,Res, Reslen-Res + Text 115,130,,DTS, DTSlen-DTS + Text 215,130,,ACPI, ACPIlen-ACPI + Text 315,130,,MMX, MMXlen-MMX + + Text 15,150,,FXSR, FXSRlen-FXSR + Text 115,150,,SSE, SSElen-SSE + Text 215,150,,SSE2, SSE2len-SSE2 + Text 315,150,,SSn, SSnlen-SSn + + Text 15,170,,HTT, HTTnlen-HTTn + Text 115,170,,TM, TMlen-TM + Text 215,170,,IA64, IA64len-IA64 + Text 315,170,,PBE, PBElen-PBE + ;--------------- + DrawLine 0, 410, 185,185,0x8080FF ;10 + + mov eax,$80000000 + cpuid + ;mov eax, $03020101 \A0for test of reaction + test eax, eax + js goooddd + +baaadd: + Text 95,235,0x00000000,NEF, NEFlen-NEF + jmp too + +goooddd: + Text 15,195,0x00000000,SS3, SS3len-SS3 + Text 15,215,,MON, MONlen-MON + Text 15,235,,DS_CPL, DS_CPLlen-DS_CPL + Text 15,255,,EST, ESTlen-EST + Text 15,275,,TM2, TM2len-TM2 + Text 15,295,,VMX, VMXlen-VMX + Text 15,315,,SVM, SVMlen-SVM + + Text 15,355,0x00000000,SMX, SMXlen-SMX + Text 15,335,0x00000000,PAGE, PAGElen-PAGE + Text 15,375,0x00000000,MIS, MISlen-MIS + Text 115,355,0x00000000,WDT, WDTlen-WDT + + Text 115,195,,CNXT_ID, CNXT_IDlen-CNXT_ID + Text 115,215,,CX16, CX16len-CX16 + Text 115,235,,ETPRD, ETPRDlen-ETPRD + Text 115,255,,SYS, SYSlen-SYS + Text 115,275,,LAF, LAFlen-LAF + Text 115,295,,SSSE3, SSSE3len-SSSE3 + Text 115,315,,MCR8, MCR8len-MCR8 + + + Text 115,335,0x00000000,EAS, EASlen-EAS + + Text 115,375,0x00000000,DNP, DNPlen-DNP + + + Text 315,375,0x00000000,SSE5, SSE5len-SSE5 + + Text 215,195,,MP, MPlen-MP + Text 215,215,,NX, NXlen-NX + Text 215,235,,MMXPi, MMXPilen-MMXPi + Text 215,255,,MMXn, MMXnlen-MMXn + Text 215,275,,FXSRn, FXSRnlen-FXSRn + Text 215,295,,DCA,DCAlen-DCA + + Text 315,295,0x00000000,SSE41,SSE41len-SSE41 + Text 215,335,0x00000000,x2APIC,x2APIClen-x2APIC + Text 215,355,0x00000000,ABM,ABMlen-ABM + Text 215,375,0x00000000,OSVW,OSVWlen-OSVW + + Text 315,195,,FFXSR, FFXSRlen-FFXSR + Text 315,215,,TSCP, TSCPlen-TSCP + Text 315,235,,LM, LMlen-LM + Text 315,255,,DNo, DNolen-DNo + Text 315,275,,DN, DNlen-DN + Text 215,315,,CMPL, CMPLlen-CMPL + Text 315,315,0x00000000,SS42,SS42len-SS42 + Text 315,335,0x00000000,PPCNT,PPCNTlen-PPCNT + Text 315,295,0x00000000,SSE4A,SSE4Alen-SSE4A + Text 315,355,0x00000000,SKINIT_,SKINIT_len-SKINIT_ + +too: + DrawLine 10, 400, 430,430,0x8080FF ;10 + + Text 15,415,0x00000000,speed, speedlen-speed + Text 130,415,,kbpersec, kbperseclen-kbpersec + + DrawLine 10, 80, 400, 400, 0x8080FF + + Text 90,400,0x80000000,performancestr, 0 + DrawLine 322, 400, 400, 400, 0x8080FF + DrawLine 10, 10, 400, 490, 0x8080FF + DrawLine 400, 400, 400, 490, 0x8080FF + + DrawLine 10, 400, 490, 490, 0x8080FF + + ; your proc + Text 20,415,0x808080FF,currentcpu, 0 + Number 170,415,0,5,dword [iter],0x000000 ; + 15 + ;Text 115,370,,kbpersec, kbperseclen-kbpersec ;+ 355 + mov eax, dword[iter] + ;mov ebx, 100 + ;mul ebx + add eax, 215 + mov word[linelen], ax ; need to store it as drawline corrupts eax + DrawLine 215, [linelen], 416,416,0x8080FF ;10 + 355 , 357 + DrawLine 215, [linelen], 417,417,0x8080FF ;10 + DrawLine 215, [linelen], 418,418,0x8080FF ;10 +;;; DrawLine 20, 390, 371,371,0x8080FF ;10 + + ; sample proc 1 + Text 20,435,0x80000000,samplename1,0 ; 10 + 40 + 40 +40 + 380 + Number 170,435,0,5,dword [samplespeed1],0x000000; ; 25 + 40 + 40 +40 + 380 + ;Text 115,470,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 40 +40 + 380 + mov eax, dword[samplespeed1] + add eax, 215 + mov dword[linelen], eax ; need to store it as drawline corrupts eax + DrawLine 215, [linelen], 436,436,0x8080FF ;27+40 + 40 +40 + 380 + DrawLine 215, [linelen], 437,437,0x8080FF ;10 + DrawLine 215, [linelen], 438,438,0x8080FF ;10 + + ; sample proc 2 + Text 20,455,0x80000000,samplename2,0 ; 10 + 40 + 350 + Number 170,455,0,5,dword [samplespeed2],0x000000; ; 25 + 40 + 350 + ;Text 115,410,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 350 + mov eax, dword[samplespeed2] + add eax, 215 + mov dword[linelen], eax ; need to store it as drawline corrupts eax + DrawLine 215, [linelen], 456,456,0x8080FF ;27+40 + 355 + DrawLine 215, [linelen], 457,457,0x8080FF ;10 + DrawLine 215, [linelen], 458,458,0x8080FF ;10 + + ; sample proc 3 + Text 20,475,0x80000000,samplename3,0 ; 10 + 40 + 40 + 38 + Number 170,475,0,5,dword [samplespeed3],0x000000; ; 25 + 40 + 40 + 355 + ;Text 115,440,0,kbpersec, kbperseclen-kbpersec ; 25 + 40 + 40 + 380 + mov eax, dword[samplespeed3] + add eax, 215 + mov dword[linelen], eax ; need to store it as drawline corrupts eax + DrawLine 215, [linelen], 476,476,0x8080FF ;27+40 + 40 + DrawLine 215, [linelen], 477,477,0x8080FF ;10 + DrawLine 215, [linelen], 478,478,0x8080FF ;10 + + mov eax,12 + mov ebx,2h + mcall + + ret + +linelen dd 0 +currentcpu db 'Current CPU',0 +samplename1 db 'Intel Core i5 CPU', 0x000000 ; not real results! +samplespeed1 dd 62 +samplename2 db 'Intel Core i3 CPU', 0 +samplespeed2 dd 48 +samplename3 db 'Intel Pentium Dual CPU', 0 +samplespeed3 dd 35 +performancestr db 'PERFORMANCE (KB/S in RSA test 256 bit)',0 +ptsstring db '' +num_win2 db 0 + +draw_window: + mcall SF_REDRAW, SSF_BEGIN_DRAW + + Window 150, 150, 350, 405, 0x34FFFFFF, 0x805080d0, title + + mov esi, [sc.work_button] + mcall SF_DEFINE_BUTTON, <138,92>, <345,24>, 2 + mcall SF_DEFINE_BUTTON, <238,92>, <345,24>, 3 + + mov ecx, [sc.work_button_text] + or ecx, 0x90000000 + mov edx, btn_more_cap + mcall SF_DRAW_TEXT, (138 + (92 - 7 * 8) / 2) shl 16 + 350 + mov edx, btn_save_cap + mcall SF_DRAW_TEXT, (238 + (92 - 4 * 8) / 2) shl 16 + 350 + + Text 130,270,0x00000000,instruct, instructlen-instruct + DrawLine 10, 330, 340,340,0x8080FF + DrawLine 330, 330, 275,340;,0x8080FF + DrawLine 10, 10, 275,340;,0x8080FF + DrawLine 10, 125, 275,275;,0x8080FF + DrawLine 230, 330, 275,275;,0x8080FF + + cmp dword[smallvendor], 'cAMD' + jne cont + cmp [f], $6 + jne cont + +; Button 240,85,69,15,3,0x030000FF ; button for rating +; Text 245,90,0x00FFFFFF,FR, FRlen-FR ; text at button + + call newrating; !!!! + +cont: + ;Number 82,50,0,4,dword [total],0x000000; MHz + mov esi, total + mov edi, tsum + 0xB ;0xA + call savenumber + + ;Number 110,50,0,2,dword [sot]; KHz + mov esi, sot + mov edi, tsum + 0x10 + call savenumber + + ;Number 75,110,1*256,1,dword [f],0x000000 ; + mov esi, f + mov edi, fam + 0x8 ;0x9 + call savenumber + + ;Number 75,130,,,dword [m] + mov esi, m + mov edi, mode + 0x7 + call savenumber + + ;Number 75,150,,,dword [s] + mov esi, s + mov edi, step + 0xa ;0x9 + call savenumber + + ;Number 110,110,1*256,2,dword [ef] + mov esi, ef + mov edi, fam + 0xE ;0x9 + call savenumber + + ;Number 110,130,,,dword [em] + mov esi, em + mov edi, mode + 0xE ;0xD + call savenumber + + mov esi, multb + mov edi, multil + 0xB + call savenumber + + ;Number 105,30,0,1,dword [multa] + mov esi, multa + mov edi, multil + 0xf + call savenumber + + ;Number 140,170,0,2,dword [wayld],0x000000 + mov esi, wayld + mov edi, cache2 + 0x14 ;0x14 + call savenumber + + ;Number 218,170,,,dword [lineld] + mov esi, lineld + mov edi, cache2 + 0x21 + call savenumber + + ;Number 140,190,,,dword [wayli] + mov esi, wayli + mov edi, cache + 0x14 + call savenumber + ;Number 218,190,,,dword [lineli] + mov esi, lineli + mov edi, cache + 0x21 + call savenumber + + ;Number 140,210,,,dword [wayl2] + mov esi, wayl2 + mov edi, cache3 + 0x14 + call savenumber + ;Number 218,210,,,dword [linel2] + mov esi, linel2 + mov edi, cache3 + 0x21 + call savenumber + + ;Number 140,230,,,dword [wayl3] + mov esi, wayl3 + mov edi, cache4 + 0x14 + call savenumber + ;Number 218,230,,,dword [linel3] + mov esi, linel3 + mov edi, cache4 + 0x21 + call savenumber + + mov esi, L1d + mov edi, cache2 + 0xa + call savenumber + + ;Number 75,190,,,dword [ L1i] + mov esi, L1i + mov edi, cache + 0xa + call savenumber + + ;Number 41,210,0,4,dword[L2] + mov esi, L2 + mov edi, cache3 + 0x4 ;0x3 + call savenumber + + ;Number 35,230,0,5,dword[L3] + mov esi, L3 + mov edi, cache4 + 0x4 ;0x3 + call savenumber + + ;-----------Features + ;Number 258,50,0,2,dword [micron] ; micron + mov esi, micron + mov edi, tech + 0xE + call savenumber + + mov esi, stdc + mov edi, STDCA + 0x14 + call savenumber + + ;Number 335,10,,,dword [extc], + mov esi, extc + mov edi, EXTCA + 0x14 + call savenumber + + Text 15,90,,cpuname, cpunamelen-cpuname; + Text 255,250,,typen, typenlen-typen + Text 175, 50,,tech, techlen-tech; + + red2: + + ;;;;;;;;;;;;;;;;;;;;;;;; + goon: + + call decodebrand + + typedetect: + mov edx, t1 + cmp [t], 00b + jz @f + mov edx, t2 + cmp [t], 01b + jz @f + mov edx, t3 + cmp [t], 11b + jz @f + mov edx, t4 +@@: + mov ebx, 290*65536 + 250 + mov ecx, 0x80000000 + mcall 4 + + Text 15,250,,brandid, brandidlen-brandid + + Text 15,50,0x00000000,tsum, tsumlen-tsum + Text 15,110,0x00000000,fam, famlen-fam + Text 15,130,0x00000000,mode, modelen-mode + Text 15,150,0x00000000,step, steplen-step + + Text 275,290,0x00000000,HTT, HTTlen-HTT + Text 275,310,,sse3, sse3len-sse3 + + Text 175,290,0x00000000,SSE41, SSE41len-SSE41 + Text 175,310,0x00000000,SSE42, SSE42len-SSE42 + Text 175,330,0x00000000,SSE5, SSE5len-SSE5 + + + Text 15,70,,name, namelen-name + Text 15,290,,MMXs, MMXslen-MMXs + Text 15,310,,SSE, SSElen-SSE + Text 95,310,,SSE2, SSE2len-SSE2 + + Text 95,290,,mmxp, mmxplen-mmxp + Text 15,330,0x00000000,now, nowlen-now + Text 95,330,,nowp, nowplen-nowp + + Text 15, 190,0x00000000,cache, cachelen-cache + Text 15,170,0x00000000,cache2, cache2len-cache2 + Text 15,210,,cache3, cache3len-cache3 + Text 15,230,,cache4, cache4len-cache4 + call load_gif + + cmp [nomultiplier], $1 + je nomultip + Text 15,30,0x00000000,multil2, multil2len-multil2 + Text 175,30,0x00000000,freql2, freql2len-freql2 + Number 85,30,0,2,dword [multb],0x000000; + Number 105,30,0,1,dword [multa] + Number 259,30,0,4,dword [freqbb] + Number 289,30,0,2,dword [freqll] + +JumpForCodename: + cmp [codeN], $1 + je codeNIntel + cmp [codeN], $2 + je codeNAMD + cmp [codeN], $3 + je codeNCyrix + cmp [codeN], $4 + je codeNCentaur + cmp [codeN],$5 + je codeNTransmeta + cmp [codeN], $6 + je codeNVortex + jmp nnn + +codeNIntel: + Text 75,70,0x00000000,Inteln, Intelnlen-Inteln + mov esi, intel + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +codeNAMD: + Text 75,70,,AMDn, AMDnlen-AMDn + mov esi, amd + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +codeNCyrix: + Text 75,70,0x00000000,Cyrixn, Cyrixnlen-Cyrixn + mov esi, cyrix + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +codeNCentaur: + Text 75,70,0x00000000,IDTn, IDTnlen-IDTn + mov esi, idt + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +codeNTransmeta: + Text 75,70,,Tranmsmetan, Tranmsmetanlen-Tranmsmetan + mov esi, transmeta + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +codeNVortex: + Text 75,70,0x00000000,Vortexn, Vortexnlen-Vortexn + mov esi, vortex + call load_gif + PutImage 135,107,201,49,img_area+8 + jmp nnn + +nomultip: + Text 15,30,0x00000000,multi3, multi3len-multi3 + Text 175,30,0x00000000,freql3, freql3len-freql3 + Text 259,30,0x00000000, clock0, clock0len-clock0 + + jmp JumpForCodename + + nnn: + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + Text 15,10,0x00000000,stm, stmlen-stm + ; Fix for deleting leading whitespaces + ; in Intel P4's internal name + ; by Madis Calme + ; 23.12.2004 ver. 0.81 + cld + mov edi,myname + mov al,20h + or ecx,-1 + repe scasb + dec edi + mov esi,mynamelen + sub esi,edi + Text 105, 10, 0x00000000, edi, esi +;- + Text 15,250,,brandid, brandidlen-brandid + + mcall SF_REDRAW, SSF_END_DRAW + + ret ; + +call_OpenDialog: + + mov [OpenDialog_data.type],1 ; Save + + push dword OpenDialog_data + call [OpenDialog_Start] + + cmp [OpenDialog_data.status],2 ; OpenDialog does not start + je .save_file_default_path + + cmp [OpenDialog_data.status],1 + jne still + + call store_data + jmp still + +.save_file_default_path: + mov edi,file_name + mov esi,file_default_path + call copy_file_name_path + call store_data + jmp still + +copy_file_name_path: + xor eax,eax + cld +@@: + lodsb + stosb + test eax,eax + jnz @r + ret + +;----------------------------------------------------------------------------- +prepare_text_area: + mov edi,[store_text_area_start] + + push edi + mov ecx,4096 + mov eax,dword ' ' + cld + rep stosd + pop edi + mov [store_text_area_end], edi + + mov esi,title + call addstring + + mov esi, stm + call addstring + + mov esi, myname + call addstring + + cmp [nomultiplier], $1 + je noMult + jne detMulti + ;jne detFreq + + detMulti: + mov esi,multil + call addstring + jmp detFreq + + detFreq: + mov esi, freql + call addstring + + noMult: + mov esi,multi3 + call addstring + + mov esi,freql3 + call addstring + + mov esi, tech + call addstring + + mov esi, saveproc + call addstring + + mov esi, cpuname + call addstring + + mov esi, fam + call addstring + + mov esi, mode + call addstring + + mov esi, step + call addstring + + mov esi, cache2 + call addstring + + mov esi, cache + call addstring + + mov esi, cache3 + call addstring + + mov esi, cache4 + call addstring + + mov esi, brandid + call addstring + + mov esi, MMXs + call addstring + + mov esi, mmxp + call addstring + + mov esi, now + call addstring + + mov esi, HTT + call addstring + + mov esi, SSE + call addstring + + mov esi, SSE41 + call addstring + + mov esi, SSE42 + call addstring + + mov esi, SSE5 + call addstring + + mov esi, SSE2 + call addstring + + mov esi, nowp + call addstring + + mov esi, sse3 + call addstring + + mov esi, standard + call addstring + + mov esi, STDCA + call addstring + + mov esi, EXTCA + call addstring + + mov esi, FPU + call addstring + + mov esi, VME + call addstring + + mov esi, DE + call addstring + + mov esi, PSE + call addstring + + mov esi, TSC + call addstring + + mov esi, MSR + call addstring + + mov esi, PAE + call addstring + + mov esi, MCE + call addstring + + mov esi, CX8 + call addstring + + mov esi, APIC + call addstring + + mov esi, Res + call addstring + + mov esi, SEP + call addstring + + mov esi, MTRR + call addstring + + mov esi, PGE + call addstring + + mov esi, MCA + call addstring + + mov esi, CMOV + call addstring + + mov esi, PAT + call addstring + + mov esi, PSE36 + call addstring + + mov esi, PSNUM + call addstring + + mov esi, CLFLUSHn + call addstring + + mov esi, Res + call addstring + + mov esi, DTS + call addstring + + mov esi, ACPI + call addstring + + mov esi, MMX + call addstring + + mov esi, FXSR + call addstring + + mov esi, SSE + call addstring + + + mov esi, SSn + call addstring + + mov esi, HTT + call addstring + + mov esi, TM + call addstring + + mov esi, IA64 + call addstring + + mov esi, PBE + call addstring + + mov esi, SS3 + call addstring + + mov esi, CNXT_ID + call addstring + + mov esi, MP + call addstring + + mov esi, FFXSR + call addstring + + mov esi, MON + call addstring + + mov esi, CX16 + call addstring + + mov esi, NX + call addstring + + mov esi, TSCP + call addstring + + mov esi, DS_CPL + call addstring + + mov esi, ETPRD + call addstring + + mov esi, MMXPi + call addstring + + mov esi, LM + call addstring + + mov esi, EST + call addstring + + mov esi, SYS + call addstring + + mov esi, MMXn + call addstring + + mov esi, DNo + call addstring + + mov esi, TM2 + call addstring + + mov esi, LAF + call addstring + + mov esi, FFXSR + call addstring + + mov esi, DN + call addstring + + mov esi, VMX + call addstring + + mov esi, SSSE3 + call addstring + + mov esi, DCA + call addstring + + mov esi, CMPL + call addstring + + mov esi, SVM + call addstring + + mov esi, MCR8 + call addstring + + mov esi, SMX + call addstring + + mov esi, x2APIC + call addstring + + mov esi, PPCNT + call addstring + + mov esi, PAGE + call addstring + + mov esi, EAS + call addstring + + mov esi, ABM + call addstring + + mov esi, MIS + call addstring + + mov esi,OSVW + call addstring + + mov esi,SKINIT_ + call addstring + + mov esi, WDT + call addstring + + ret + +addstring: + mov edi, [store_text_area_end] + xor eax, eax + xor ecx, ecx + cld +@@: + lodsb + stosb + inc [store_text_area_end] + cmp [esi], byte 0x0 + jnz @r + mov al,0Ah + stosb + + mov [store_text_area_end],edi + xor edi,edi + xor esi, esi + ret + +savenumber: + xor eax, eax + cld + lodsw + call numbertostring + xor esi, esi + xor edi, edi + + ret + +savestring: + xor eax, eax + cld + lodsw + ;call numbertostring + xor esi, esi + xor edi, edi + + ret + +numbertostring: + mov bx, 10 + xor ecx, ecx +@@m1: + xor dx, dx + div bx + push dx + inc cx + test ax, ax + jnz @@m1 +@@m2: + pop ax + add al, '0' + stosb + loop @@m2 + ret + +concatname: + ;mov edi, [saveproc] + xor eax, eax + xor ecx, ecx + cld +@@: + lodsb + stosb + cmp [esi], byte 0x0 + jnz @r + + xor edi,edi + xor esi, esi + ret + +store_data: + call prepare_text_area + mov eax,[store_text_area_start] + mov [fileinfo.return],eax + mov ebx,[store_text_area_end] + sub ebx,eax + inc ebx + mov [fileinfo.size],ebx + mcall 70,fileinfo + ret + +load_gif: + mov edi, img_area + jmp ReadGIF + + +; DATA AREA + +title db 'CPUID 2.31 by S.Kuzmin & KolibriOS Team',0 + +stm: + db 'Internal name:', 0 + +stmlen: + +SS42: + db 'SSE4.2: ',0 +SS42len: + +SMX: + db 'SMX: ',0 +SMXlen: + +x2APIC: + db 'x2APIC: ' +x2APIClen: + +PPCNT: + db 'POPCNT: ' +PPCNTlen: + +PAGE: + db 'Page1Gb: ' +PAGElen: + +EAS: + db 'EAS: ',0 +EASlen: + +newLabel: + db '3DNP: ',0 +newLabellen: + + +ABM: + db 'ABM: ' +ABMlen: + +SSE4A: + db 'SSE4A: ' +SSE4Alen: + +MIS: + db 'MIS: ',0 +MISlen: + +DNP: + db '3DNP: ' +DNPlen: + +OSVW: + db 'OSVW: ',0 +OSVWlen: + +SKINIT_: + db 'SKINIT: ',0 +SKINIT_len: + +WDT: + db 'WDT: ',0 +WDTlen: + + +saveproc: + db ' ',0 + +multil: + db 'Multiplier: . ', 0 + +multillen: + +multil2: + + db 'Multiplier: . ' + +multil2len: + +multi3: + + db 'Multiplier: n/a',0 + +multi3len: + +freql: + + db 'System clock: . MHz', 0 +freqllen: + +freql2: + + db 'System clock: . MHz' + + +freql2len: + +freql3: + + db 'System clock: n/a ' + + +freql3len: + +tsum: + + db 'Frequency: . MHz ',0 + +tsumlen: + +tech: + + db 'Technology: 0. micron ', 0 + +techlen: + +name: + +if lang eq it_IT + db 'Codename:',0 +else ; Default to en_US + db 'CODENAME:',0 +end if + +namelen: + +vendorname: + +if lang eq it_IT + db 'Vendor CPU ', 0 +else ; Default to en_US + db 'CPU VENDOR: ', 0 +end if + +vendornamelen: + +cpuname: + +if lang eq it_IT + db 'Vendor CPU ', 0 +else ; Default to en_US + db 'CPU VENDOR: ', 0 +end if + +cpunamelen: + + +fam: + +if lang eq it_IT + db 'Famiglia: std ext', 0 +else ; Default to en_US + db 'FAMILY: std ext', 0 +end if + +famlen: + +mode: + +if lang eq it_IT + db 'Modello: std ext', 0 +else ; Default to en_US + db 'MODEL: std ext', 0 +end if + +modelen: + +step: + +if lang eq it_IT + db 'Stepping: ', 0 +else ; Default to en_US + db 'STEPPING: ', 0 +end if + +steplen: + +cache: + + db 'L1(inst): KB -way set -byte line size',0 + +cachelen: + +cache2: + + db 'L1(data): KB -way set -byte line size',0 + +cache2len: + + +cache3: + + db 'L2: KB -way set -byte line size',0 + +cache3len: + +cache4: + + db 'L3: KB -way set -byte line size',0 + +cache4len: + +brandid: + + db 'Brand:', 0 + +brandidlen: + +MMXs: + + db 'MMX: ',0 + +MMXslen: + + +total dd 0x0 + +total1 dd 0x0 + +rating dd 0x0 + +rat dd 0x0 ; + +NEF: + +db 'EXTENDED FEATURES ARE NOT AVAILABLE',0 + +NEFlen: + + + +mb : + +db 'MB' + +mblen: + + + +logcpus : + +db 'Number of logical CPU:' + +logcpuslen: + + + +speed : + +if lang eq it_IT +; db 'Performance',0 +else ; Default to en_US +; db 'PERFORMANCE:',0 +end if + +speedlen: + + + +kbpersec: + +db 'KB/SEC' + +kbperseclen: + + + +instruct: + +if lang eq it_IT + db 'Set istruzioni' +else ; Default to en_US + db 'Instruction sets' +end if + +instructlen: + + + +standard db 'Standard and Extended features plus Performance test',0 + + +STDCA: + + db 'Highest STD call is ',0 + +STDCAlen: + + + +EXTCA: + + db 'Highest EXT call is h',0 + +EXTCAlen: + + +oblom: + +if lang eq it_IT + db 'CPUID non e disponibile' +else ; Default to en_US + db 'SORRY, CPUID IS NOT AVAILABLE' +end if + +oblomlen: + + +other: + +if lang eq it_IT + db 'Questo vendor non e supportato' +else ; Default to en_US + db 'SORRY, THIS VENDOR IS NOT SUPPORTED YET' +end if + +otherlen: + + +cacheP4: + + db 'L1(inst): Kuops -way set -byte line size' + +cacheP4len: + + +typen: + +if lang eq it_IT + db 'Tipo:' +else ; Default to en_US + db 'Type:' +end if + +typenlen: + + + +pr: + + db 'P-rating:' + +prlen: + + + + +AMDn: + + db 'AMD',0 + +AMDnlen: + +AMDnNew: + + db 'CODENAME: AMD',0 + +AMDnNewlen: + +Inteln: + + db 'Intel',0 + +Intelnlen: + +IntelnNew: + db 'CODENAME: Intel',0 + +IntelnNewlen: + + +Cyrixn: + + db 'Cyrix',0 + +Cyrixnlen: + +IDTn: + + db 'IDT/Centaur',0 + +IDTnlen: + +Centaurn: + + db 'VIA',0 + +Centaurnlen: + + + +Tranmsmetan: + + db 'Transmeta',0 + +Tranmsmetanlen: + + +Vortexn: + db 'Vortex86',0 +Vortexnlen: + + +mmxp: + + db 'MMX+: ',0 + +mmxplen: + + + +HTT: + + db 'HTT: ',0 + +HTTlen: + + +HTTn: + + db 'HTT: ',0 + +HTTnlen: + + +sse3: + + db 'SSE3: ',0 + +sse3len: + +SSE41: + db 'SSE4.1: ',0 +SSE41len: + +SSE42: + db 'SSE4.2: ',0 +SSE42len: + +SSE5: + db 'SSE5: ',0 +SSE5len: + +now: + + db '3DNOW!: ',0 + +nowlen: + +nowp: + + db '3DNOW!+: ',0 + +nowplen: + +;-Type + +t1 db 'OEM',0 + +t2 db 'Overdrive',0 + +t3 db 'Dual',0 + +t4 db 'Unknown',0 + + + +;----------Intel + +P50: + +db 'P5 A-step',0 + +P50len: + +P5: + +db 'P5',0 + +P5len: + +P54T: + +db 'P24T Overdrive',0 + +P54Tlen: + +P54C: + +db 'P54C',0 + +P54Clen: + +P55C: + +db 'P55C (with MMX)',0 + +P55Clen: + +; --- + +P60: + +db 'Pentium Pro A-step',0 + +P60len: + +P61: + +db 'Pentium Pro',0 + +P61len: + +P63: + +db 'Pentium II (Klamath)',0 + +P63len: + +P65: + +db 'Pentium II (Deschutes)',0 + +P65len: + +P66: + +db 'Celeron (Medocino)',0 + +P66len: + +P67: + +db 'Pentium III (Katmai)',0 + +P67len: + +P68: + +db 'Pentium III (Coppermine)',0 + +P68len: + +P69: + +db 'Pentium M (Banias)',0 + +P69len: + +P6A: + +db 'Pentium III Xeon (Cascades)',0 + +P6Alen: + +P6B: + +db 'Pentium III (Tualatin)',0 + +P6Blen: + +P6D: + +db 'Pentium M (Dothan)',0 + +P6Dlen: + +P6E: + +db 'Pentium M (Yonah)/ Core',0 + +P6Elen: + +P6F: + +db 'Pentium D (Conroe)/ Core 2 (Kentsfield)',0 + +P6Flen: + +;--- + +PS0: + +db 'Itanium (IA-64)',0 + +PS0len: + +;------------ + +PF0: + +db 'Pentium 4 (Willamete)',0 + +PF0len: + +PF2: + +db 'Pentium 4 (Northwood)',0 + +PF2len: + +PF3: + +db 'Pentium 4 (Prescott)',0 + +PF3len: + +PF5: + +db 'Pentium 4 (Tejas)',0 + +PF5len: + +PF6: + +db 'Pentium 4 (Presler)',0 + +PF6len: + +;----------------Intel Celerons + +P65c: + +db 'Celeron (Covington)',0 + +P65clen: + +P68c: + +db 'Celeron (Coppermine)',0 + +P68clen: + +P6Bc: + +db 'Celeron (Tualatin)',0 + +P6Bclen: + +PF0c: + +db 'Celeron (Willamete)',0 + +PF0clen: + +PF2c: + +db 'Celeron (Northwood)',0 + +PF2clen: + +PF3c: + +db 'Celeron (Prescott)',0 + +PF3clen: + +PF5c: + +db 'Celeron D (Texas)',0 + +PF5clen: + +PF6c: + +db 'Celeron D (Presler)',0 + +PF6clen: + +;---------New Intel +P3A: + +db 'IvyBridge',0 + +P3Alen: + +P2A: + +db 'Sandy Bridge',0 + +P2Alen: + +P2D: +db 'Sandy bridge-E',0 + +P2Dlen: + + +P25: +db 'Arrandale',0 +P25len: + +P2C: +db 'Gulftown',0 +P2Clen: + +P2F: +db 'Westmere-EX',0 +P2Flen: + +P1E: +db 'Clarksfield',0 +P1Elen: + +P1A: +db 'Bloomfield',0 +P1Alen: + +P2E: +db 'Nehalem-EX',0 +P2Elen: + +P17: +db 'Yorkfield',0 +P17len: + +P1D: +db 'Dunnington',0 +P1Dlen: + +P0F: +db 'Clovertown',0 +P0Flen: + +P16: +db 'Merom Conroe',0 +P16len: + +P06: +db 'Cedar Mill',0 +P06len: + +P03: +db 'Nocona Irwindale',0 +P03len: + +P04: +db 'NoconaIrwindale',0 +P04len: + +P0D: +db 'Dothan',0 +P0Dlen: + +P36: +db 'Cedarview',0 +P36len: + +P26: +db 'Lincroft',0 +P26len: + +P1C: +db 'Pineview',0 +P1Clen: + +no_known: +db 'SORRY, CODENAME IS NOT SUPPORTED YET ', 0 + +;---------AMD + +A50 db 'K5 (PR75, PR90, PR100)',0 + +A51 db '5k86 (PR120, PR133)',0 + +A52 db '5k86 (PR166)',0 + +A53 db '5k86 (PR200)',0 + +A56 db 'K6',0 + +A57 db 'K6',0 + +A58 db 'K6-2',0 + +A59 db 'K6-III',0 + +A5D db 'K6-2+ or K6-III+',0 + +;------------------- + +At1 db 'Athlon',0 + +At2 db 'Athlon',0 + +At3 db 'Duron (Spitfire)',0 + +At4 db 'Athlon (Thunderbird)',0 + +At6 db 'AthlonXP (Palomino)',0 + +At7 db 'Duron (Morgan)',0 + +At8 db 'AthlonXP (Thoroughbred)',0 + +At8a db 'Duron (Applebred)',0 + +Ata db 'AthlonXP (Barton)',0 + +Atat db 'AthlonXP (Thorton)',0 + +;------------------- +AthlonKuma: + +db 'AMD Athlon 7750 Black Edition',0 + +AthlonKumalen: + +AB23: + +db 'Opteron 2300-series',0 + +AB23len: + +AB83: + +db 'Opteron 8300-series',0 + +AB83len: + +AB9: +db 'Phenom X4',0 + +AB9len: + +AB8right2: + +db 'Phenom X3',0 + +AB8right2len: + +AB4: + +db 'Athlon X2',0 + +AB4len: + +AB1: + +db 'Sempron',0 + +AB1len: + +ABC2: + +db 'Opteron (Shanghai) 2387',0 + +ABC2len: + +AB6: + +db 'Opteron (Magny-Cours)',0 + +AB6len: + +ABC3: + +db 'Opteron (Shanghai) 8300 series',0 + +ABC3len: + +ABM2: + +db 'Turion II ',0 + +ABM2len: + +;--- + +AF1: + +db 'Dual-core Opteron',0 + +AF1len: + +AF3: + +db 'Athlon 64 (Toledo)',0 + +AF3len: + +AF4: + +db 'Athlon 64 (ClawHammer)',0 + +AF4len: + +AF5: + +db 'Opteron/Athlon 64 FX (SledgeHammer)',0 + +AF5len: + + +AFC: + +db 'Athlon 64 (Newcastle)',0 + +AFClen: + + +AFF: + +db 'Athlon 64 (Winchester)',0 + +AFFlen: + + +AFS: + +db 'Athlon 64 (San Diego)',0 + +AFSlen: + + +AFV: + +db 'Athlon 64 (Venice)',0 + +AFVlen: + + +AFCs: + +db 'Sempron (Paris)',0 + +AFCslen: + + + +AFCsp: + +db 'Sempron (Palermo)',0 + +AFCsplen: + + + +;---------Cyrix + +C52: + +db '6x86 M1',0 + +C52len: + +C54: + +db 'MediaGX',0 + +C54len: + +C60: + +db '6x86MX M2',0 + +C60len: + +C65: + +db 'C3 (Cyrix M2)',0 ;? + +C65len: + +;--------IDT + +V54: + +db 'WinChip C6',0 + +V54len: + +V58: + +db 'WinChip 2',0 + +V58len: + +V59: + +db 'WinChip 3',0 + +V59len: + +;-------VIA + +V66: + +db 'C3 (Samuel)',0 ; Joshua is unreleased 065 + +V66len: + +V67: + +db 'C3 (Samuel2/Ezra)',0 ; ? + +V67len: + +V68: + +db 'C3 (Ezra-T/Eden)',0 ;? + +V68len: + +V69: + +db 'C3 (Antaur/Nehemiah)',0 ;? + +V69len: + +VA: + +db 'C7 (Esther)',0 ;? + +VAlen: + +;---------Transmeta + +T5: + +db 'Crusoe',0 ; + +T5len: + +TF: + +db 'Efficeon',0 ; + +TFlen: + +;--------- + +NG: + + db 'Next generation CPU',0 + +NGlen: + + +athloncoef db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 120 + + db 190, 120, 200, 130, 135, 140, 210, 150, 220, 160, 165, 170, 180, 230, 240 + +athlonmcoef: db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105 + + db 30, 190, 40, 200, 130, 135, 14, 210, 150, 220, 160, 165, 170, 230, 240 + +athloncoef3 db 45, 50, 40, 55, 25, 30, 60, 35 + +p4coef db 160, 170, 180, 190, 200, 210, 220, 230, 80, 90, 100, 110, 120, 130, 140, 150 ; Pentium 4 (Willamete) + +coppercoeff db 50, 30, 40, 20, 55, 35, 45, 25, 35, 70, 80, 60, 20, 75, 15, 65, 90, 110, 120, 20, 95, 115, 85, 25, 35, 70, 80, 100, 20, 75, 15, 105 + +tualatcoeff db 120, 35, 35, 40, 55, 35, 115, 35, 160, 70, 80, 60, 40, 75, 35, 65, 90, 110, 35, 35, 95, 35, 85, 35, 35, 35, 130, 100, 140, 35, 150, 105 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +I_END: + +img_area: ; image is going to be unpacked to here +rb 201*49*3+8 ; image resolution (bits to reserve) + +img_area2: ; image is going to be unpacked to here +rb 93*24*3+8 ; image resolution (bits to reserve) + +img_area3: ; image is going to be unpacked to here +rb 93*24*3+8 ; image resolution (bits to reserve) + +gif_hash_area: +rd 4096+1 ;hash area size for unpacking gif +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 + +err_message_found_lib2 db 'proc_lib.obj - Not found!',0 + +err_message_import2 db 'proc_lib.obj - Wrong import!',0 + +head_f_i: +head_f_l db 'error',0 +;--------------------------------------------------------------------- +l_libs_start: + +library02 l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \ +err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i + +end_l_libs: +;--------------------------------------------------------------------- +align 4 +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start +;OpenDialog__Version dd aOpenDialog_Version + dd 0 + dd 0 +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 +;aOpenDialog_Version db 'Version_OpenDialog',0 +;--------------------------------------------------------------------- +align 4 +OpenDialog_data: +.type dd 0 +.procinfo dd Proc_Info ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd file_name ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: + db '/sys/File Managers/opendial',0 +communication_area_default_pach: + db '/sys',0 +Filter: +dd Filter.end - Filter.1 +.1: +db 'TXT',0 +db 'LOG',0 +.end: +dd 0 + +file_default_path: + db '/sys/' +start_temp_file_name: + db 'CPUID.txt',0 +btn_more_cap: + db 'Details', 0 +btn_save_cap: + db 'Save', 0 +;--------------------------------------------------------------------- +align 4 +fileinfo: +.subfunction dd 2 +.Offset dd 0 +.Offset_1 dd 0 +.size dd 4096 +.return dd 0 + db 0 +.name: dd file_name + +align 4 +sc system_colors + +store_text_area_start dd ? +store_text_area_end dd ? +store_text_size dd ? + +;--------------------------------------------------------------------- +library_path: + rb 4096 +;--------------------------------------------------------------------- +path: + rb 4096 +;--------------------------------------------------------------------- +temp_dir_pach: + rb 4096 +;--------------------------------------------------------------------- +file_name: + rb 4096 +;--------------------------------------------------------------------- +file_name_1: + rb 4096 +;--------------------------------------------------------------------- +filename_area: + rb 256 +;--------------------------------------------------------------------- + rb 4096 +stacktop: +;--------------------------------------------------------------------- +Proc_Info process_information +; RSA test data +align 4 + num1 rd 40 + num2 rd 40 + num3 rd 40 + iter rd 1 + openkey rd 1 + + +IncludeUGlobals + +nocpuid db ? +ost dd ? +sot dd ? +f dd ? +m dd ? +s dd ? +t dd ? + +ef dd ? +em dd ? + +multiplier dd ? +multa dd ? +multb dd ? +smallvendor dd ? +L1d dd ? +L1i dd ? +L2 dd ? +L3 dd ? +micron dd ? +brand dd ? +newpc dd ? +nomultiplier dd ? +ram_size_a dd ? +ram_size_t dd ? + +stdc dd ? +extc dd ? + +FRS dd ? +freqsel db ? +sse3sup db ? +sse41sup dd ? +sse42sup dd ? +sse5sup dd ? + +freqbb dd ? +freqll dd ? + +wayli dd ? +lineli dd ? + +wayld dd ? +lineld dd ? + +wayl2 dd ? +linel2 dd ? + +wayl3 dd ? +linel3 dd ? +che db ? ; numbers of calls for Intel caches detection +cname dd ? +codeN dd ? + +myname: + rb 48 + +mynamelen: + db ? + +align 4 + thread2_stack_area rb 64 + thread2_esp = $ +U_END: diff --git a/programs/testing/disptest/trunk/disptest.ASM b/programs/testing/disptest/trunk/disptest.ASM index fbb6b5cd2..d5f0f5817 100644 --- a/programs/testing/disptest/trunk/disptest.ASM +++ b/programs/testing/disptest/trunk/disptest.ASM @@ -1,930 +1,930 @@ -;------------------------------------------------------------------------------ -; Display Test for KolibriOS -;------------------------------------------------------------------------------ -; version: 0.41 -; last update: 17/03/2012 -; written by: Marat Zakiyanov aka Mario79, aka Mario -; changes: some optimisations and code refactoring -;------------------------------------------------------------------------------ -; compiler: FASM 1.50 -; name: Display Test -; version: 0.4 -; original author: barsuk - -; <--- include all MeOS stuff ---> -include "lang.inc" -include "../../../macros.inc" - -; <--- start of MenuetOS application ---> -MEOS_APP_START - -;include "..\..\..\debug.inc" - - -; <--- start of code ---> -CODE - mcall 37,4,cursor,2 - or eax, eax - jz exit - mov [cursorID], eax -;------------------------------------------------------------------------------ -redraw: - call draw_window ; at first create and draw the window -;------------------------------------------------------------------------------ -wait_event: ; main cycle - xor ebx, ebx - mcall 10 - - 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 -;------------------------------------------------------------------------------ -key: ; key event handler - mcall 2 ; get key code - - cmp ah, 27 - jz exit - - cmp ah, 0x20 - jz next_test - - cmp ah, 179 ; -> - jz next_test - - cmp ah, 176 ; <- - jz prev_test - - cmp ah, 'i' - jz toggle_info - - cmp ah, 'I' ; 祫 )) - jz toggle_info - - cmp ah, 'c' - jz toggle_cursor - - cmp ah, 'C' - jz toggle_cursor - - cmp ah, 'd' - jz redraw - - cmp ah, 'D' - jz redraw - - jmp wait_event -;------------------------------------------------------------------------------ -next_test: - cmp dword [test_done], 1 - jz wait_event - - inc dword [test_num] - call draw_window - jmp wait_event -;------------------------------------------------------------------------------ -prev_test: - cmp dword [test_num], ebx - jz wait_event - - dec dword [test_num] - mov dword [test_done], ebx - call draw_window - jmp wait_event -;------------------------------------------------------------------------------ -toggle_info: - xor dword [show_info], 1 - call draw_window - jmp wait_event -;------------------------------------------------------------------------------ -toggle_cursor: - mov eax, cursorVisible - cmp dword [eax], 0 - jz .no_cursor - - mov dword [eax], 0 - mov ecx, [cursorID] - jmp .set -;-------------------------------------- -.no_cursor: - mov dword [eax], 1 - xor ecx, ecx -;-------------------------------------- -.set: - mcall 37,5 - mcall 18,15 ; ⮡ - jmp wait_event -;------------------------------------------------------------------------------ -button: ; button event handler - mcall 17 ; get button identifier - cmp ah, 1 - jne wait_event ; return if button id != 1 -;-------------------------------------- -exit: - or eax, -1 ; exit application - mcall -;------------------------------------------------------------------------------ -draw_window: - mcall 12,1 - - ; - ;mov eax, 37 - ;mov ebx, 5 - ;mov ecx, cursorID - ;int 0x40 - - mcall 14 ; screen size - - mov ebx, eax - shr ebx, 16 - mov ecx, eax - and ecx, 0xffff - mov [screenx], ebx - mov [screeny], ecx - - inc ebx - inc ecx - xor eax, eax ; create and draw the window - mov edx, 0x01000000 - mov esi, edx - mcall - ; ࠭ - xor edx, edx - mcall 13 ; 㡮 ⠪ - - dec ebx - dec ecx - - mov eax, [test_num] - mov eax, [test_proc + eax*4] - or eax, eax - jz end_of_test - call eax - jmp exit_draw -;-------------------------------------- -end_of_test: - mcall 4,<8,8>,0xffffff,test_finish,test_finish.size - mov dword [test_done], 1 - jmp no_info -;-------------------------------------- -exit_draw: - cmp dword [show_info], 1 - jnz no_info -; ᭮ ࠧ ࠭ - mov ebx, [screenx] - mov ecx, [screeny] -; ᣥ ࠧ襭 ࠭. 㦭, ⮬ - ; אַ㣮쭨 20040 䮩 - mov edx, 200 - sub ebx, edx - shl ebx, 15 - mov bx, dx - mov edx, 40 - sub ecx, edx - shl ecx, 15 - mov cx, dx - mcall 13,,,0xffffff - - xor edx, edx - add ebx, 0x0000fffe ; 祭 㤮 :)))) - add ecx, 0x0000fffe - mcall -; ⥪ - shr ecx, 16 - mov bx, cx - add ebx, 0x00010001 - mov ecx, 0x80ffffff - mov edx, [test_num] - mov edx, [test_info + edx*4] - mcall 4 - - add ebx, 12 - mcall ,,,press_space - - add ebx, 8 - mcall ,,,press_i - - add ebx, 8 - mcall ,,,press_c -;-------------------------------------- -no_info: - mcall 12,2 - ret -;------------------------------------------------------------------------------ -; <---- procedures for various tests of display -----> -; in: ebx = screen_width, ecx = screen_height -;------------------------------------------------------------------------------ -lsz i_image_size,\ - ru, " ࠦ ࠧ饭",\ - en, "Image Size and Placement" -db 0 -;------------------------------------------------------------------------------ -t_image_size: - mov esi, ebx - mov edi, ecx -; 6 १ - xor ecx, ecx - mcall 38,,,0xffffff - - mov ecx, edi - shl ecx, 16 - xor ebx, ebx - mcall - - mov ebx, esi - shl ebx, 16 - add ecx, edi - mcall - - sub ecx, edi - add ebx, esi - mcall -; ࠬ ⮢ - mov ebx, esi - shl ebx, 16 - mov ecx, edi - shl ecx, 15 - mov cx, di - shr cx, 1 - mcall - - shr ebx, 1 - mov bx, si - shr bx, 1 - mov ecx, edi - shl ecx, 16 - mcall - ret -;------------------------------------------------------------------------------ -lsz i_grid,\ - ru, "⪠",\ - en, "Grid" -db 0 -;------------------------------------------------------------------------------ -t_grid: -; ⪠ ࠧ஬ 64 ᥫ - mov eax, 38 - inc ebx - inc ecx - mov esi, ebx - mov edi, ecx - mov edx, 0xffffff - mov ebp, 0x00400040 -; ਧ⠫ - shl ebx, 16 - xor ecx, ecx -;-------------------------------------- -grid_next_y: - mcall - - add ecx, ebp - cmp cx, di - jnae grid_next_y - sub ecx, 0x00010001 - mcall -; ⨪ - mov ecx, edi - shl ecx, 16 - xor ebx, ebx -;-------------------------------------- -grid_next_x: - mcall - add ebx, ebp - cmp bx, si - jnae grid_next_x - sub ebx, 0x00010001 - mcall - ret -;------------------------------------------------------------------------------ -lsz i_horstr,\ - ru, "ਧ⠫ ",\ - en, "Horizontal Straightness" -db 0 -;------------------------------------------------------------------------------ -t_horstr: - mov eax, 38 - mov edi, ecx - mov edx, 0xffffff - mov esi, ecx - inc esi - shr esi, 3 - mov ebp, esi - shl ebp, 16 - mov bp, si -; ਧ⠫ - shl ebx, 16 - mov ecx, ebp - shr ecx, 1 - mov cx, bp - shr cx, 1 -;-------------------------------------- -hor_next_y: - mcall - add ecx, ebp - cmp cx, di - jnae hor_next_y - ret -;------------------------------------------------------------------------------ -lsz i_vertstr,\ - ru, "⨪ ",\ - en, "Vertical Straightness" -db 0 -;------------------------------------------------------------------------------ -t_vertstr: - mov eax, 38 - mov edx, 0xffffff - mov esi, ebx - shl ecx, 16 - mov edi, esi - shr edi, 3 - mov ebp, edi - shl ebp, 16 - mov bp, di - mov ebx, ebp - shr ebx, 1 - mov bx, bp - shr bx, 1 -;-------------------------------------- -vert_next_x: - mcall - add ebx, ebp - cmp bx, si - jnae vert_next_x - ret -;------------------------------------------------------------------------------ -lsz i_distort,\ - ru, "஢ઠ ᪠",\ - en, "Distortion", -db 0 -;------------------------------------------------------------------------------ -t_distort: - mov edx, 0xffffff - mov esi, ebx - mov edi, ecx - mov ebp, 3 - xor ebx, ebx -;-------------------------------------- -dist_next: - push ebp - mov ebp, ebx - shl ebx, 16 - or ebx, ebp - - mov ecx, edi - shl ecx, 16 - or ecx, ebp - mcall 38 - - mov ebx, esi - shl ebx, 16 - mov bx, si - mcall - - mov bx, bp - mov ecx, ebp - shl ecx, 16 - or ecx, ebp - mcall - - mov ecx, edi - shl ecx, 16 - mov cx, di - mcall - - mov eax, 30 - sub esi, eax - sub edi, eax - mov ebx, ebp - add ebx, eax - pop ebp - dec ebp - jnz dist_next - ret -;------------------------------------------------------------------------------ -lsz i_horres,\ - ru, "襭 ਧ⠫",\ - en, "Horizontal Resolution", -db 0 -;------------------------------------------------------------------------------ -t_horres: - mov eax, 38 - mov edx, 0xffffff - mov edi, ecx - shl ecx, 16 - mov esi, ebx - xor ebx, ebx - mov edi, 0x003A003A - mov ebp, 0x00030003 -;-------------------------------------- -horres_next: - add ebx, edi - mcall - - add ebx, ebp - mcall - - add ebx, ebp - mcall - - add ebx, ebp - mcall - - add ebx, ebp - mcall - - cmp bx, si - jna horres_next - ret -;------------------------------------------------------------------------------ -lsz i_vertres,\ - ru, "襭 ⨪",\ - en, "Vertical Resolution", -db 0 -;------------------------------------------------------------------------------ -t_vertres: - mov eax, 38 - mov edx, 0xffffff -; mov esi, ebx - shl ebx, 16 - mov edi, ecx - xor ecx, ecx - mov ebp, 0x00030003 - mov esi, 0x002A002A -;-------------------------------------- -vertres_next: - add ecx, esi - mcall - - add ecx, ebp - mcall - - add ecx, ebp - mcall - - add ecx, ebp - mcall - - add ecx, ebp - mcall - - add ecx, 0x00540054 - cmp cx, di - jna vertres_next - ret -;------------------------------------------------------------------------------ -lsz i_moire,\ - ru, " ",\ - en, "Moire Patterns", -db 0 -;------------------------------------------------------------------------------ -t_moire: - mov eax, 38 - mov edx, 0xffffff - mov edi, ecx - shl ecx, 16 - mov esi, ebx - xor ebx, ebx - mov ebp, 0x00030003 -;-------------------------------------- -moire_next: - mcall - add ebx, ebp - cmp bx, si - jna moire_next - ret -;------------------------------------------------------------------------------ -lsz i_revsharp,\ - ru, "ᨢ १ ",\ - en, "Reverse Video Sharpness", -db 0 -;------------------------------------------------------------------------------ -t_revsharp: - mov esi, ebx - mov edi, ecx - shr ecx, 1 - mcall 13,,,0xffffff -; ⥯ - - mov eax, 38 - mov ecx, edi - mov edx, 0x01000000 - xor ebx, ebx - mov ebp, 0x00010001 - mov edi, 0x003F003F -;-------------------------------------- -revsharp_next: - add ebx, edi - mcall - - add ebx, ebp - mcall - - add ebx, ebp - mcall - - add ebx, edi - sub ebx, ebp - mcall - - cmp bx, si - jna revsharp_next - ret -;------------------------------------------------------------------------------ -lsz i_flicker,\ - ru, "஢ 栭",\ - en, "Flicker Severity", -db 0 -;------------------------------------------------------------------------------ -t_flicker: - mcall 13,,,0xffffff - ret -;------------------------------------------------------------------------------ -lsz i_glare,\ - ru, "஢ ᢥ⪨",\ - en, "Glare Severity", -db 0 -;------------------------------------------------------------------------------ -t_glare: ; ⨬஢ 祣 - ret -;------------------------------------------------------------------------------ -lsz i_interlace,\ - ru, "㦥 ૥ᨭ",\ - en, "Interlacing Detection", -db 0 -;------------------------------------------------------------------------------ -t_interlace: - mov edi, ecx - mov eax, 38 - mov edx, 0xffffff - xor ecx, ecx - mov ebp, 0x00020002 -;-------------------------------------- -interlace_next: - add ecx, ebp - mcall - cmp cx, di - jna interlace_next - ret -;------------------------------------------------------------------------------ -lsz i_scrreg,\ - ru, "㫨஢ ࠭",\ - en, "Screen Regulation", -db 0 -;------------------------------------------------------------------------------ -t_scrreg: - add ebx, 0x0018FFCD ; +25 砫 -50 - shr ecx, 1 - add ecx, 0x0013FFEC ; +19 砫 -19 - mcall 13,,,0xffffff - ret -;------------------------------------------------------------------------------ -lsz i_pricol,\ - ru, " ᭮ 梥⮢",\ - en, "Primary Color Purity", -db 0 -;------------------------------------------------------------------------------ -t_pricol: - mov esi, ebx - mov edi, ecx - - shr ebx, 4 ; /16 - mov ebp, ebx - shl ebx, 16 - mov bx, bp - shl ebp, 16 - lea ebp, [ebp + ebp * 4] ; ebp *= 5 - - mov ecx, 0x00280000 - mov cx, di - sub cx, 80 - ;shr cx, 1 - - shl bx, 2 - mcall 13,,,0xff0000 - - add ebx, ebp - shr edx, 8 - mcall - - add ebx, ebp - shr edx, 8 - mcall - ret -;------------------------------------------------------------------------------ -lsz i_colint,\ - ru, "ࠤ ⥭ᨢ 梥",\ - en, "Color Intensity Gradient", -db 0 -;------------------------------------------------------------------------------ -t_colint: - - mov esi, ebx - mov edi, ecx - -; mov eax, ecx -; shr ecx, 2 ; end y coord -; and ecx, 0xffffff80 ; not 7F -; shr eax, 7 ; / 128 -; mov ebp, eax -; mov edx, eax -; lea eax, [eax + eax * 2] ; eax *= 5 -; shl ebp, 4 -; add eax, ebp - -; shl eax, 16 -; add ecx, eax -; mov edx, ebp -; shl ebp, 16 -; mov bp, dx ; 쭮 - - ; , ⠬ , 訫 ᭮ _ - - ; ᣥ ecx (砫 ᤢ) ebp (蠣 ) - - mov eax, edi - lea eax, [eax + 2 * eax] - shr eax, 5 ; eax = 3/32 - mov ebp, eax - shl ebp, 16 - mov bp, ax ; ebp = ax ᫮ - - mov ebx, eax ; ࠭ 祭 - - mov eax, edi - inc eax - shr eax, 4 ; 3/16 - 砫쭮 祭 - ; ᥣ 3/4 , ⮣ 3/32 ( ஢ ) - lea eax, [eax + eax * 2] - mov ecx, eax - shl ecx, 16 - shr ebx, 2 - lea ebx, [ebx + ebx * 2] ; ebx = 3/4 ebx, .. 3/4 - add eax, ebx - mov cx, ax - - xor edx, edx - mov eax, 0xffff - div esi - mov edi, eax ; edi = 64K/width - - mov dword [color_index], 0 - jmp colint_next -;------------------------------------------------------------------------------ -color_table dd 0x00ff0000, 0x0000ff00, 0x00ffff00, \ - 0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff -color_index dd 0 -;------------------------------------------------------------------------------ -colint_next: - xor edx, edx - xor ebx, ebx - mov eax, 38 -;-------------------------------------- -colint_next_line: - push edx - push eax - movzx eax, dh - shl eax, 16 - mov dl, dh - or edx, eax - mov eax, [color_index] - mov eax, [color_table + eax * 4] - and edx, eax - pop eax - mcall - pop edx - add ebx, 0x00010001 - add edx, edi - cmp bx, si - jna colint_next_line - - add ecx, ebp - inc dword [color_index] - cmp dword [color_index], 7 - jb colint_next - ret -;------------------------------------------------------------------------------ -lsz i_colalign,\ - ru, "⮢ ࠢ",\ - en, "Color Alignment Grid", -db 0 -;------------------------------------------------------------------------------ -t_colalign: -; ᭠ ⪠ - inc ebx ; ⠪ 㦭 - inc ecx - mov esi, ebx - mov edi, ecx - mov edx, 0xff0000 -; ਧ⠫ - shl ebx, 16 - xor ecx, ecx - push edi - shr edi, 3 - mov ebp, edi - shl ebp, 16 - mov bp, di - pop edi - mov [yshift], ebp - mov eax, 38 -;-------------------------------------- -cgrid_next_y: - mcall - add ecx, ebp - cmp cx, di - jnae cgrid_next_y - ; ᫥ : - sub ecx, 0x00010001 - mcall - -; ⨪ - mov ecx, edi - shl ecx, 16 - xor ebx, ebx - push esi - shr esi, 3 - mov ebp, esi - shl ebp, 16 - mov bp, si - mov [xshift], ebp - pop esi - mov eax, 38 -;-------------------------------------- -cgrid_next_x: - mcall - add ebx, ebp - cmp bx, si - jnae cgrid_next_x - ; ᫥ - sub ebx, 0x00010001 - mcall - jmp cgrid_green -;------------------------------------------------------------------------------ - xshift dd 0 - yshift dd 0 - shift dd 0 -;------------------------------------------------------------------------------ -cgrid_green: -; : ਧ⠫ - mov edx, esi - shr edx, 5 - lea eax, [edx + edx * 2] - shl edx, 16 - or edx, eax - mov [shift], edx - mov eax, 38 - mov edx, 0x00ff00 - xor ecx, ecx - mov ebp, [xshift] -;-------------------------------------- -ggrid_next_yy: - mov ebx, [shift] -;-------------------------------------- -ggrid_next_yx: - mcall - add ebx, ebp - cmp bx, si - jnae ggrid_next_yx - sub ebx, 0x00010001 - mcall - - add ecx, [yshift] - cmp cx, di - jnae ggrid_next_yy - ; last row of lines - mov ebx, [shift] - dec ecx -;-------------------------------------- -ggrid_last_yx: - mcall - add ebx, ebp - cmp bx, si - jnae ggrid_last_yx - -; ⨪ - mov edx, edi - shr edx, 5 - lea eax, [edx + edx * 2] - shl edx, 16 - or edx, eax - mov [shift], edx - - mov eax, 38 - mov edx, 0x00ff00 - mov ecx, [shift] - mov ebp, [xshift] -;-------------------------------------- -ggrid_next_xy: - xor ebx, ebx -;-------------------------------------- -ggrid_next_xx: - mcall - - add ebx, ebp - cmp bx, si - jnae ggrid_next_xx - sub ebx, 0x00010001 - mcall - - add ecx, [yshift] - cmp cx, di - jnae ggrid_next_xy - xor ebx, ebx - dec ecx -;-------------------------------------- -ggrid_last_xy: - ;int 0x40 - ;add ebx, ebp - ;cmp bx, si - ;jnae ggrid_last_xy - ret -;------------------------------------------------------------------------------ -lsz i_colsyn,\ - ru, "஭ 梥",\ - en, "Color Synchronization", -db 0 -;------------------------------------------------------------------------------ -t_colsyn: - inc ebx - inc ecx - mov esi, ebx - mov edi, ecx - - shr ebx, 5 - mov eax, ebx - lea ebx, [ebx + ebx * 4] - shl ebx, 1 ; 10/32 - mov ebp, ebx - shl eax, 16 - or ebx, eax - shl ebp, 16 - - mov edi, 0x0000ffff - add ecx, 0x003FFF7F - mov edx, edi - mcall 13 - - mov edx, 0x00ff0000 - add ebx, ebp - mcall - - mov edx, edi - add ebx, ebp - mcall - ret -;------------------------------------------------------------------------------ -; <--- initialised data ---> -DATA - screenx dd 0 - screeny dd 0 - - test_num dd 0 - test_done dd 0 - show_info dd 1 - test_proc dd t_image_size, t_grid, t_horstr, t_vertstr,\ - t_distort, t_horres, t_vertres, t_moire, t_revsharp, \ - t_flicker, t_glare, t_interlace, t_scrreg, t_pricol, \ - t_colint, t_colalign, t_colsyn, 0 - test_info dd i_image_size, i_grid, i_horstr, i_vertstr, \ - i_distort, i_horres, i_vertres, i_moire, i_revsharp, \ - i_flicker, i_glare, i_interlace, i_scrreg, i_pricol, \ - i_colint, i_colalign, i_colsyn, 0 - - lsz press_space,\ - ru, " ஡ த,",\ - en, "Press 'Space' key to continue", - db 0 - - lsz press_i,\ - ru, "I ४祭 ᢥ,",\ - en, "I to turn details on and off ", - db 0 - - lsz press_c,\ - ru, " C ४祭 ",\ - en, "and C to show and hide cursor", - db 0 - - lsz header,\ - ru, " ",\ - en, "Display test", - db 0 - - lsz test_finish,\ - ru, " . ESC.",\ - en, "Test has been finished. Press ESC.", - db 0 - - cursor dd 32*32 dup(0x00000000) ; ࠢ ᮦ - - cursorVisible dd 1 - cursorID dd 0 -;------------------------------------------------------------------------------ -; <--- uninitialised data ---> -UDATA -;------------------------------------------------------------------------------ -MEOS_APP_END -; <--- end of MenuetOS application ---> -;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +; Display Test for KolibriOS +;------------------------------------------------------------------------------ +; version: 0.41 +; last update: 17/03/2012 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: some optimisations and code refactoring +;------------------------------------------------------------------------------ +; compiler: FASM 1.50 +; name: Display Test +; version: 0.4 +; original author: barsuk + +; <--- include all MeOS stuff ---> +include "lang.inc" ; Language support for locales: ru_RU (CP866), en_US. +include "../../../macros.inc" + +; <--- start of MenuetOS application ---> +MEOS_APP_START + +;include "..\..\..\debug.inc" + + +; <--- start of code ---> +CODE + mcall 37,4,cursor,2 + or eax, eax + jz exit + mov [cursorID], eax +;------------------------------------------------------------------------------ +redraw: + call draw_window ; at first create and draw the window +;------------------------------------------------------------------------------ +wait_event: ; main cycle + xor ebx, ebx + mcall 10 + + 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 +;------------------------------------------------------------------------------ +key: ; key event handler + mcall 2 ; get key code + + cmp ah, 27 + jz exit + + cmp ah, 0x20 + jz next_test + + cmp ah, 179 ; -> + jz next_test + + cmp ah, 176 ; <- + jz prev_test + + cmp ah, 'i' + jz toggle_info + + cmp ah, 'I' ; 祫 )) + jz toggle_info + + cmp ah, 'c' + jz toggle_cursor + + cmp ah, 'C' + jz toggle_cursor + + cmp ah, 'd' + jz redraw + + cmp ah, 'D' + jz redraw + + jmp wait_event +;------------------------------------------------------------------------------ +next_test: + cmp dword [test_done], 1 + jz wait_event + + inc dword [test_num] + call draw_window + jmp wait_event +;------------------------------------------------------------------------------ +prev_test: + cmp dword [test_num], ebx + jz wait_event + + dec dword [test_num] + mov dword [test_done], ebx + call draw_window + jmp wait_event +;------------------------------------------------------------------------------ +toggle_info: + xor dword [show_info], 1 + call draw_window + jmp wait_event +;------------------------------------------------------------------------------ +toggle_cursor: + mov eax, cursorVisible + cmp dword [eax], 0 + jz .no_cursor + + mov dword [eax], 0 + mov ecx, [cursorID] + jmp .set +;-------------------------------------- +.no_cursor: + mov dword [eax], 1 + xor ecx, ecx +;-------------------------------------- +.set: + mcall 37,5 + mcall 18,15 ; ⮡ + jmp wait_event +;------------------------------------------------------------------------------ +button: ; button event handler + mcall 17 ; get button identifier + cmp ah, 1 + jne wait_event ; return if button id != 1 +;-------------------------------------- +exit: + or eax, -1 ; exit application + mcall +;------------------------------------------------------------------------------ +draw_window: + mcall 12,1 + + ; + ;mov eax, 37 + ;mov ebx, 5 + ;mov ecx, cursorID + ;int 0x40 + + mcall 14 ; screen size + + mov ebx, eax + shr ebx, 16 + mov ecx, eax + and ecx, 0xffff + mov [screenx], ebx + mov [screeny], ecx + + inc ebx + inc ecx + xor eax, eax ; create and draw the window + mov edx, 0x01000000 + mov esi, edx + mcall + ; ࠭ + xor edx, edx + mcall 13 ; 㡮 ⠪ + + dec ebx + dec ecx + + mov eax, [test_num] + mov eax, [test_proc + eax*4] + or eax, eax + jz end_of_test + call eax + jmp exit_draw +;-------------------------------------- +end_of_test: + mcall 4,<8,8>,0xffffff,test_finish,test_finish.size + mov dword [test_done], 1 + jmp no_info +;-------------------------------------- +exit_draw: + cmp dword [show_info], 1 + jnz no_info +; ᭮ ࠧ ࠭ + mov ebx, [screenx] + mov ecx, [screeny] +; ᣥ ࠧ襭 ࠭. 㦭, ⮬ + ; אַ㣮쭨 20040 䮩 + mov edx, 200 + sub ebx, edx + shl ebx, 15 + mov bx, dx + mov edx, 40 + sub ecx, edx + shl ecx, 15 + mov cx, dx + mcall 13,,,0xffffff + + xor edx, edx + add ebx, 0x0000fffe ; 祭 㤮 :)))) + add ecx, 0x0000fffe + mcall +; ⥪ + shr ecx, 16 + mov bx, cx + add ebx, 0x00010001 + mov ecx, 0x80ffffff + mov edx, [test_num] + mov edx, [test_info + edx*4] + mcall 4 + + add ebx, 12 + mcall ,,,press_space + + add ebx, 8 + mcall ,,,press_i + + add ebx, 8 + mcall ,,,press_c +;-------------------------------------- +no_info: + mcall 12,2 + ret +;------------------------------------------------------------------------------ +; <---- procedures for various tests of display -----> +; in: ebx = screen_width, ecx = screen_height +;------------------------------------------------------------------------------ +lsz i_image_size,\ + ru_RU, " ࠦ ࠧ饭",\ + en_US, "Image Size and Placement" +db 0 +;------------------------------------------------------------------------------ +t_image_size: + mov esi, ebx + mov edi, ecx +; 6 १ + xor ecx, ecx + mcall 38,,,0xffffff + + mov ecx, edi + shl ecx, 16 + xor ebx, ebx + mcall + + mov ebx, esi + shl ebx, 16 + add ecx, edi + mcall + + sub ecx, edi + add ebx, esi + mcall +; ࠬ ⮢ + mov ebx, esi + shl ebx, 16 + mov ecx, edi + shl ecx, 15 + mov cx, di + shr cx, 1 + mcall + + shr ebx, 1 + mov bx, si + shr bx, 1 + mov ecx, edi + shl ecx, 16 + mcall + ret +;------------------------------------------------------------------------------ +lsz i_grid,\ + ru_RU, "⪠",\ + en_US, "Grid" +db 0 +;------------------------------------------------------------------------------ +t_grid: +; ⪠ ࠧ஬ 64 ᥫ + mov eax, 38 + inc ebx + inc ecx + mov esi, ebx + mov edi, ecx + mov edx, 0xffffff + mov ebp, 0x00400040 +; ਧ⠫ + shl ebx, 16 + xor ecx, ecx +;-------------------------------------- +grid_next_y: + mcall + + add ecx, ebp + cmp cx, di + jnae grid_next_y + sub ecx, 0x00010001 + mcall +; ⨪ + mov ecx, edi + shl ecx, 16 + xor ebx, ebx +;-------------------------------------- +grid_next_x: + mcall + add ebx, ebp + cmp bx, si + jnae grid_next_x + sub ebx, 0x00010001 + mcall + ret +;------------------------------------------------------------------------------ +lsz i_horstr,\ + ru_RU, "ਧ⠫ ",\ + en_US, "Horizontal Straightness" +db 0 +;------------------------------------------------------------------------------ +t_horstr: + mov eax, 38 + mov edi, ecx + mov edx, 0xffffff + mov esi, ecx + inc esi + shr esi, 3 + mov ebp, esi + shl ebp, 16 + mov bp, si +; ਧ⠫ + shl ebx, 16 + mov ecx, ebp + shr ecx, 1 + mov cx, bp + shr cx, 1 +;-------------------------------------- +hor_next_y: + mcall + add ecx, ebp + cmp cx, di + jnae hor_next_y + ret +;------------------------------------------------------------------------------ +lsz i_vertstr,\ + ru_RU, "⨪ ",\ + en_US, "Vertical Straightness" +db 0 +;------------------------------------------------------------------------------ +t_vertstr: + mov eax, 38 + mov edx, 0xffffff + mov esi, ebx + shl ecx, 16 + mov edi, esi + shr edi, 3 + mov ebp, edi + shl ebp, 16 + mov bp, di + mov ebx, ebp + shr ebx, 1 + mov bx, bp + shr bx, 1 +;-------------------------------------- +vert_next_x: + mcall + add ebx, ebp + cmp bx, si + jnae vert_next_x + ret +;------------------------------------------------------------------------------ +lsz i_distort,\ + ru_RU, "஢ઠ ᪠",\ + en_US, "Distortion", +db 0 +;------------------------------------------------------------------------------ +t_distort: + mov edx, 0xffffff + mov esi, ebx + mov edi, ecx + mov ebp, 3 + xor ebx, ebx +;-------------------------------------- +dist_next: + push ebp + mov ebp, ebx + shl ebx, 16 + or ebx, ebp + + mov ecx, edi + shl ecx, 16 + or ecx, ebp + mcall 38 + + mov ebx, esi + shl ebx, 16 + mov bx, si + mcall + + mov bx, bp + mov ecx, ebp + shl ecx, 16 + or ecx, ebp + mcall + + mov ecx, edi + shl ecx, 16 + mov cx, di + mcall + + mov eax, 30 + sub esi, eax + sub edi, eax + mov ebx, ebp + add ebx, eax + pop ebp + dec ebp + jnz dist_next + ret +;------------------------------------------------------------------------------ +lsz i_horres,\ + ru_RU, "襭 ਧ⠫",\ + en_US, "Horizontal Resolution", +db 0 +;------------------------------------------------------------------------------ +t_horres: + mov eax, 38 + mov edx, 0xffffff + mov edi, ecx + shl ecx, 16 + mov esi, ebx + xor ebx, ebx + mov edi, 0x003A003A + mov ebp, 0x00030003 +;-------------------------------------- +horres_next: + add ebx, edi + mcall + + add ebx, ebp + mcall + + add ebx, ebp + mcall + + add ebx, ebp + mcall + + add ebx, ebp + mcall + + cmp bx, si + jna horres_next + ret +;------------------------------------------------------------------------------ +lsz i_vertres,\ + ru_RU, "襭 ⨪",\ + en_US, "Vertical Resolution", +db 0 +;------------------------------------------------------------------------------ +t_vertres: + mov eax, 38 + mov edx, 0xffffff +; mov esi, ebx + shl ebx, 16 + mov edi, ecx + xor ecx, ecx + mov ebp, 0x00030003 + mov esi, 0x002A002A +;-------------------------------------- +vertres_next: + add ecx, esi + mcall + + add ecx, ebp + mcall + + add ecx, ebp + mcall + + add ecx, ebp + mcall + + add ecx, ebp + mcall + + add ecx, 0x00540054 + cmp cx, di + jna vertres_next + ret +;------------------------------------------------------------------------------ +lsz i_moire,\ + ru_RU, " ",\ + en_US, "Moire Patterns", +db 0 +;------------------------------------------------------------------------------ +t_moire: + mov eax, 38 + mov edx, 0xffffff + mov edi, ecx + shl ecx, 16 + mov esi, ebx + xor ebx, ebx + mov ebp, 0x00030003 +;-------------------------------------- +moire_next: + mcall + add ebx, ebp + cmp bx, si + jna moire_next + ret +;------------------------------------------------------------------------------ +lsz i_revsharp,\ + ru_RU, "ᨢ १ ",\ + en_US, "Reverse Video Sharpness", +db 0 +;------------------------------------------------------------------------------ +t_revsharp: + mov esi, ebx + mov edi, ecx + shr ecx, 1 + mcall 13,,,0xffffff +; ⥯ - + mov eax, 38 + mov ecx, edi + mov edx, 0x01000000 + xor ebx, ebx + mov ebp, 0x00010001 + mov edi, 0x003F003F +;-------------------------------------- +revsharp_next: + add ebx, edi + mcall + + add ebx, ebp + mcall + + add ebx, ebp + mcall + + add ebx, edi + sub ebx, ebp + mcall + + cmp bx, si + jna revsharp_next + ret +;------------------------------------------------------------------------------ +lsz i_flicker,\ + ru_RU, "஢ 栭",\ + en_US, "Flicker Severity", +db 0 +;------------------------------------------------------------------------------ +t_flicker: + mcall 13,,,0xffffff + ret +;------------------------------------------------------------------------------ +lsz i_glare,\ + ru_RU, "஢ ᢥ⪨",\ + en_US, "Glare Severity", +db 0 +;------------------------------------------------------------------------------ +t_glare: ; ⨬஢ 祣 + ret +;------------------------------------------------------------------------------ +lsz i_interlace,\ + ru_RU, "㦥 ૥ᨭ",\ + en_US, "Interlacing Detection", +db 0 +;------------------------------------------------------------------------------ +t_interlace: + mov edi, ecx + mov eax, 38 + mov edx, 0xffffff + xor ecx, ecx + mov ebp, 0x00020002 +;-------------------------------------- +interlace_next: + add ecx, ebp + mcall + cmp cx, di + jna interlace_next + ret +;------------------------------------------------------------------------------ +lsz i_scrreg,\ + ru_RU, "㫨஢ ࠭",\ + en_US, "Screen Regulation", +db 0 +;------------------------------------------------------------------------------ +t_scrreg: + add ebx, 0x0018FFCD ; +25 砫 -50 + shr ecx, 1 + add ecx, 0x0013FFEC ; +19 砫 -19 + mcall 13,,,0xffffff + ret +;------------------------------------------------------------------------------ +lsz i_pricol,\ + ru_RU, " ᭮ 梥⮢",\ + en_US, "Primary Color Purity", +db 0 +;------------------------------------------------------------------------------ +t_pricol: + mov esi, ebx + mov edi, ecx + + shr ebx, 4 ; /16 + mov ebp, ebx + shl ebx, 16 + mov bx, bp + shl ebp, 16 + lea ebp, [ebp + ebp * 4] ; ebp *= 5 + + mov ecx, 0x00280000 + mov cx, di + sub cx, 80 + ;shr cx, 1 + + shl bx, 2 + mcall 13,,,0xff0000 + + add ebx, ebp + shr edx, 8 + mcall + + add ebx, ebp + shr edx, 8 + mcall + ret +;------------------------------------------------------------------------------ +lsz i_colint,\ + ru_RU, "ࠤ ⥭ᨢ 梥",\ + en_US, "Color Intensity Gradient", +db 0 +;------------------------------------------------------------------------------ +t_colint: + + mov esi, ebx + mov edi, ecx + +; mov eax, ecx +; shr ecx, 2 ; end y coord +; and ecx, 0xffffff80 ; not 7F +; shr eax, 7 ; / 128 +; mov ebp, eax +; mov edx, eax +; lea eax, [eax + eax * 2] ; eax *= 5 +; shl ebp, 4 +; add eax, ebp + +; shl eax, 16 +; add ecx, eax +; mov edx, ebp +; shl ebp, 16 +; mov bp, dx ; 쭮 + + ; , ⠬ , 訫 ᭮ _ + + ; ᣥ ecx (砫 ᤢ) ebp (蠣 ) + + mov eax, edi + lea eax, [eax + 2 * eax] + shr eax, 5 ; eax = 3/32 + mov ebp, eax + shl ebp, 16 + mov bp, ax ; ebp = ax ᫮ + + mov ebx, eax ; ࠭ 祭 + + mov eax, edi + inc eax + shr eax, 4 ; 3/16 - 砫쭮 祭 + ; ᥣ 3/4 , ⮣ 3/32 ( ஢ ) + lea eax, [eax + eax * 2] + mov ecx, eax + shl ecx, 16 + shr ebx, 2 + lea ebx, [ebx + ebx * 2] ; ebx = 3/4 ebx, .. 3/4 + add eax, ebx + mov cx, ax + + xor edx, edx + mov eax, 0xffff + div esi + mov edi, eax ; edi = 64K/width + + mov dword [color_index], 0 + jmp colint_next +;------------------------------------------------------------------------------ +color_table dd 0x00ff0000, 0x0000ff00, 0x00ffff00, \ + 0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff +color_index dd 0 +;------------------------------------------------------------------------------ +colint_next: + xor edx, edx + xor ebx, ebx + mov eax, 38 +;-------------------------------------- +colint_next_line: + push edx + push eax + movzx eax, dh + shl eax, 16 + mov dl, dh + or edx, eax + mov eax, [color_index] + mov eax, [color_table + eax * 4] + and edx, eax + pop eax + mcall + pop edx + add ebx, 0x00010001 + add edx, edi + cmp bx, si + jna colint_next_line + + add ecx, ebp + inc dword [color_index] + cmp dword [color_index], 7 + jb colint_next + ret +;------------------------------------------------------------------------------ +lsz i_colalign,\ + ru_RU, "⮢ ࠢ",\ + en_US, "Color Alignment Grid", +db 0 +;------------------------------------------------------------------------------ +t_colalign: +; ᭠ ⪠ + inc ebx ; ⠪ 㦭 + inc ecx + mov esi, ebx + mov edi, ecx + mov edx, 0xff0000 +; ਧ⠫ + shl ebx, 16 + xor ecx, ecx + push edi + shr edi, 3 + mov ebp, edi + shl ebp, 16 + mov bp, di + pop edi + mov [yshift], ebp + mov eax, 38 +;-------------------------------------- +cgrid_next_y: + mcall + add ecx, ebp + cmp cx, di + jnae cgrid_next_y + ; ᫥ : + sub ecx, 0x00010001 + mcall + +; ⨪ + mov ecx, edi + shl ecx, 16 + xor ebx, ebx + push esi + shr esi, 3 + mov ebp, esi + shl ebp, 16 + mov bp, si + mov [xshift], ebp + pop esi + mov eax, 38 +;-------------------------------------- +cgrid_next_x: + mcall + add ebx, ebp + cmp bx, si + jnae cgrid_next_x + ; ᫥ + sub ebx, 0x00010001 + mcall + jmp cgrid_green +;------------------------------------------------------------------------------ + xshift dd 0 + yshift dd 0 + shift dd 0 +;------------------------------------------------------------------------------ +cgrid_green: +; : ਧ⠫ + mov edx, esi + shr edx, 5 + lea eax, [edx + edx * 2] + shl edx, 16 + or edx, eax + mov [shift], edx + mov eax, 38 + mov edx, 0x00ff00 + xor ecx, ecx + mov ebp, [xshift] +;-------------------------------------- +ggrid_next_yy: + mov ebx, [shift] +;-------------------------------------- +ggrid_next_yx: + mcall + add ebx, ebp + cmp bx, si + jnae ggrid_next_yx + sub ebx, 0x00010001 + mcall + + add ecx, [yshift] + cmp cx, di + jnae ggrid_next_yy + ; last row of lines + mov ebx, [shift] + dec ecx +;-------------------------------------- +ggrid_last_yx: + mcall + add ebx, ebp + cmp bx, si + jnae ggrid_last_yx + +; ⨪ + mov edx, edi + shr edx, 5 + lea eax, [edx + edx * 2] + shl edx, 16 + or edx, eax + mov [shift], edx + + mov eax, 38 + mov edx, 0x00ff00 + mov ecx, [shift] + mov ebp, [xshift] +;-------------------------------------- +ggrid_next_xy: + xor ebx, ebx +;-------------------------------------- +ggrid_next_xx: + mcall + + add ebx, ebp + cmp bx, si + jnae ggrid_next_xx + sub ebx, 0x00010001 + mcall + + add ecx, [yshift] + cmp cx, di + jnae ggrid_next_xy + xor ebx, ebx + dec ecx +;-------------------------------------- +ggrid_last_xy: + ;int 0x40 + ;add ebx, ebp + ;cmp bx, si + ;jnae ggrid_last_xy + ret +;------------------------------------------------------------------------------ +lsz i_colsyn,\ + ru_RU, "஭ 梥",\ + en_US, "Color Synchronization", +db 0 +;------------------------------------------------------------------------------ +t_colsyn: + inc ebx + inc ecx + mov esi, ebx + mov edi, ecx + + shr ebx, 5 + mov eax, ebx + lea ebx, [ebx + ebx * 4] + shl ebx, 1 ; 10/32 + mov ebp, ebx + shl eax, 16 + or ebx, eax + shl ebp, 16 + + mov edi, 0x0000ffff + add ecx, 0x003FFF7F + mov edx, edi + mcall 13 + + mov edx, 0x00ff0000 + add ebx, ebp + mcall + + mov edx, edi + add ebx, ebp + mcall + ret +;------------------------------------------------------------------------------ +; <--- initialised data ---> +DATA + screenx dd 0 + screeny dd 0 + + test_num dd 0 + test_done dd 0 + show_info dd 1 + test_proc dd t_image_size, t_grid, t_horstr, t_vertstr,\ + t_distort, t_horres, t_vertres, t_moire, t_revsharp, \ + t_flicker, t_glare, t_interlace, t_scrreg, t_pricol, \ + t_colint, t_colalign, t_colsyn, 0 + test_info dd i_image_size, i_grid, i_horstr, i_vertstr, \ + i_distort, i_horres, i_vertres, i_moire, i_revsharp, \ + i_flicker, i_glare, i_interlace, i_scrreg, i_pricol, \ + i_colint, i_colalign, i_colsyn, 0 + + lsz press_space,\ + ru_RU, " ஡ த,",\ + en_US, "Press 'Space' key to continue", + db 0 + + lsz press_i,\ + ru_RU, "I ४祭 ᢥ,",\ + en_US, "I to turn details on and off ", + db 0 + + lsz press_c,\ + ru_RU, " C ४祭 ",\ + en_US, "and C to show and hide cursor", + db 0 + + lsz header,\ + ru_RU, " ",\ + en_US, "Display test", + db 0 + + lsz test_finish,\ + ru_RU, " . ESC.",\ + en_US, "Test has finished. Press ESC.", + db 0 + + cursor dd 32*32 dup(0x00000000) ; ࠢ ᮦ + + cursorVisible dd 1 + cursorID dd 0 +;------------------------------------------------------------------------------ +; <--- uninitialised data ---> +UDATA +;------------------------------------------------------------------------------ +MEOS_APP_END +; <--- end of MenuetOS application ---> +;------------------------------------------------------------------------------ diff --git a/programs/testing/fspeed/idata.inc b/programs/testing/fspeed/idata.inc index d296fcbe0..e5c43025d 100644 --- a/programs/testing/fspeed/idata.inc +++ b/programs/testing/fspeed/idata.inc @@ -1,301 +1,303 @@ -;----------------------------------------------------------------------------- -s_text: -if lang eq ru_RU - db '롮 䠩',0 -else - db 'Select file',0 -end if -;----------------------------------------------------------------------------- -r_text: -if lang eq ru_RU - db '',0 -else - db 'Start',0 -end if -;----------------------------------------------------------------------------- -result_table_text: -if lang eq ru_RU - db ' ⥭ (/) (/)',0 -else - db 'Size Read (KB/s) Write (KB/s)',0 -end if -;----------------------------------------------------------------------------- -title db 'File Speed v0.3',0 -;----------------------------------------------------------------------------- -include_debug_strings -;----------------------------------------------------------------------------- -l_libs_start: - -library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, Box_lib_import - -library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, ProcLib_import - -end_l_libs: -;----------------------------------------------------------------------------- -system_dir_Boxlib db '/sys/lib/box_lib.obj',0 -system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 - -;----------------------------------------------------------------------------- -align 4 -ProcLib_import: -OpenDialog_Init dd aOpenDialog_Init -OpenDialog_Start dd aOpenDialog_Start -;OpenDialog_Version dd aOpenDialog_Version - -;ColorDialog_Init dd aColorDialog_Init -;ColorDialog_Start dd aColorDialog_Start -;ColorDialog_Version dd aColorDialog_Version - - dd 0 - dd 0 - -aOpenDialog_Init db 'OpenDialog_init',0 -aOpenDialog_Start db 'OpenDialog_start',0 -;aOpenDialog_Version db 'Version_OpenDialog',0 - -;aColorDialog_Init db 'ColorDialog_init',0 -;aColorDialog_Start db 'ColorDialog_start',0 -;aColorDialog_Version db 'Version_ColorDialog',0 -;----------------------------------------------------------------------------- -align 4 -Box_lib_import: -;init_lib dd a_init -;version_lib dd a_version - - -;edit_box_draw dd aEdit_box_draw -;edit_box_key dd aEdit_box_key -;edit_box_mouse dd aEdit_box_mouse -;version_ed dd aVersion_ed - -init_checkbox dd aInit_checkbox -check_box_draw dd aCheck_box_draw -check_box_mouse dd aCheck_box_mouse -;version_ch dd aVersion_ch - -;option_box_draw dd aOption_box_draw -;option_box_mouse dd aOption_box_mouse -;version_op dd aVersion_op - -;scrollbar_ver_draw dd aScrollbar_ver_draw -;scrollbar_ver_mouse dd aScrollbar_ver_mouse -;scrollbar_hor_draw dd aScrollbar_hor_draw -;scrollbar_hor_mouse dd aScrollbar_hor_mouse -;version_scrollbar dd aVersion_scrollbar - -;dinamic_button_draw dd aDbutton_draw -;dinamic_button_mouse dd aDbutton_mouse -;version_dbutton dd aVersion_dbutton - -;menu_bar_draw dd aMenu_bar_draw -;menu_bar_mouse dd aMenu_bar_mouse -;menu_bar_activate dd aMenu_bar_activate -;version_menu_bar dd aVersion_menu_bar - -;FileBrowser_draw dd aFileBrowser_draw -;FileBrowser_mouse dd aFileBrowser_mouse -;FileBrowser_key dd aFileBrowser_key -;Version_FileBrowser dd aVersion_FileBrowser - -PathShow_prepare dd sz_PathShow_prepare -PathShow_draw dd sz_PathShow_draw -;Version_path_show dd szVersion_path_show - -;Frame_draw dd sz_Frame_draw -;Version_frame dd szVersion_frame - - dd 0,0 - -;a_init db 'lib_init',0 -;a_version db 'version',0 - -;aEdit_box_draw db 'edit_box_draw',0 -;aEdit_box_key db 'edit_box_key',0 -;aEdit_box_mouse db 'edit_box_mouse',0 -;aVersion_ed db 'version_ed',0 - -aInit_checkbox db 'init_checkbox2',0 -aCheck_box_draw db 'check_box_draw2',0 -aCheck_box_mouse db 'check_box_mouse2',0 -;aVersion_ch db 'version_ch2',0 - -;aOption_box_draw db 'option_box_draw',0 -;aOption_box_mouse db 'option_box_mouse',0 -;aVersion_op db 'version_op',0 - -;aScrollbar_ver_draw db 'scrollbar_v_draw',0 -;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 -;aScrollbar_hor_draw db 'scrollbar_h_draw',0 -;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 -;aVersion_scrollbar db 'version_scrollbar',0 - -;aDbutton_draw db 'dbutton_draw',0 -;aDbutton_mouse db 'dbutton_mouse',0 -;aVersion_dbutton db 'version_dbutton',0 - -;aMenu_bar_draw db 'menu_bar_draw',0 -;aMenu_bar_mouse db 'menu_bar_mouse',0 -;aMenu_bar_activate db 'menu_bar_activate',0 -;aVersion_menu_bar db 'version_menu_bar',0 - -;aFileBrowser_draw db 'FileBrowser_draw',0 -;aFileBrowser_mouse db 'FileBrowser_mouse',0 -;aFileBrowser_key db 'FileBrowser_key',0 -;aVersion_FileBrowser db 'version_FileBrowser',0 - -sz_PathShow_prepare db 'PathShow_prepare',0 -sz_PathShow_draw db 'PathShow_draw',0 -;szVersion_path_show db 'version_PathShow',0 - -;sz_Frame_draw db 'frame_draw',0 -;szVersion_frame db 'version_frame',0 -;----------------------------------------------------------------------------- -PathShow_data: -.type dd 0 ;+0 -.start_y dw 5+4 ;+4 -.start_x dw 5+5 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 -.area_size_x dw 400-30 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable -.background_flag dd 0 ;+16 -.font_color dd 0x0 ;+20 -.background_color dd 0x0 ;+24 -.text_pointer dd fname ;+28 -.work_area_pointer dd text_work_area ;+32 -.temp_text_length dd 0 ;+36 -;----------------------------------------------------------------------------- -check1 check_box2 (100 shl 16)+12,(27 shl 16)+12,6,0xFFFFFF,0,0xffffff,\ - check_text1,ch_flag_middle - -check_text1: -if lang eq ru_RU - db '஢ ',0 -else - db 'Use testing of write',0 -end if - -check_box_warning_text: -if lang eq ru_RU - db '! ஢ઠ ᪮ 㭨⮦ ᮤন 䠩!',0 -else - db 'WARNING! Testing of write speed is destroy contents of file!',0 -end if -;----------------------------------------------------------------------------- -OpenDialog_data: -.type dd 0 -.procinfo dd process_info ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_pach dd temp_dir_pach ;+16 -.dir_default_pach dd communication_area_default_pach ;+20 -.start_path dd open_dialog_path ;+24 -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_pach dd fname ;+36 -.filename_area dd filename_area ;+40 -.filter_area dd Filter -.x: -.x_size dw 420 ;+48 ; Window X size -.x_start dw 10 ;+50 ; Window X position -.y: -.y_size dw 320 ;+52 ; Window y size -.y_start dw 10 ;+54 ; Window Y position - -communication_area_name: - db 'FFFFFFFF_open_dialog2',0 - -open_dialog_path: -if __nightbuild eq yes - db '/sys/MANAGERS/opendial',0 -else - db '/sys/File Managers/opendial',0 -end if - -communication_area_default_pach: - db '/sys',0 - -Filter: -dd Filter.end - Filter.1 -.1: -;db 'BIN',0 -;db 'DAT',0 -.end: -db 0 - -start_temp_file_name: - db 'default.dtp',0 - -default_dtp: - db '/sys/default.dtp',0 -;----------------------------------------------------------------------------- -sector equ 512 -;-------------------------------------- -result_table: - dd a512b, 0, 0, sector*1 - dd a1K, 1, 1, sector*2 - dd a2K, 2, 2, sector*4 - dd a4K, 3, 3, sector*8 - dd a8K, 4, 4, sector*16 - dd a16K, 5, 5, sector*32 - dd a32K, 6, 6, sector*64 - dd a64K, 7, 7, sector*128 - dd a128K, 8, 8, sector*256 - dd a256K, 9, 9, sector*512 - dd a512K, 10, 10, sector*1024 - dd a1M, 11, 11, sector*2*1024 - dd a2M, 12, 12, sector*4*1024 - dd a4M, 13, 13, sector*8*1024 - dd a8M, 14, 14, sector*16*1024 - dd a16M, 15, 15, sector*32*1024 - dd a32M, 16, 16, sector*64*1024 - dd a64M, 17, 17, sector*128*1024 -;----------------------------------------------------------------------------- -a512b db ' 512',0 -a1K db ' 1K',0 -a2K db ' 2K',0 -a4K db ' 4K',0 -a8K db ' 8K',0 -a16K db ' 16K',0 -a32K db ' 32K',0 -a64K db ' 64K',0 -a128K db '128K',0 -a256K db '256K',0 -a512K db '512K',0 -a1M db ' 1M',0 -a2M db ' 2M',0 -a4M db ' 4M',0 -a8M db ' 8M',0 -a16M db ' 16M',0 -a32M db ' 32M',0 -a64M db ' 64M',0 -;----------------------------------------------------------------------------- -align 4 -fileinfo: -.subfunction dd 5 -.offset dd 0 -.offset_1 dd 0 -.size dd 0 -.return dd file_info - db 0 -.name: dd fname -;----------------------------------------------------------------------------- -align 4 -fileread: -.subfunction dd 0 -.offset dd 0 -.offset_1 dd 0 -.size dd 0 -.return dd process_info - db 0 -.name: dd fname -;----------------------------------------------------------------------------- -align 4 -filewrite: -.subfunction dd 3 -.offset dd 0 -.offset_1 dd 0 -.size dd 0 -.data dd process_info - db 0 -.name: dd fname -;----------------------------------------------------------------------------- +; Language support for locales: ru_RU (CP866), en_US. + +;----------------------------------------------------------------------------- +s_text: +if lang eq ru_RU + db '롮 䠩',0 +else ; Default to en_US + db 'Select file',0 +end if +;----------------------------------------------------------------------------- +r_text: +if lang eq ru_RU + db '',0 +else ; Default to en_US + db 'Start',0 +end if +;----------------------------------------------------------------------------- +result_table_text: +if lang eq ru_RU + db ' ⥭ (/) (/)',0 +else ; Default to en_US + db 'Size Read (KB/s) Write (KB/s)',0 +end if +;----------------------------------------------------------------------------- +title db 'File Speed v0.3',0 +;----------------------------------------------------------------------------- +include_debug_strings +;----------------------------------------------------------------------------- +l_libs_start: + +library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, Box_lib_import + +library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, ProcLib_import + +end_l_libs: +;----------------------------------------------------------------------------- +system_dir_Boxlib db '/sys/lib/box_lib.obj',0 +system_dir_ProcLib db '/sys/lib/proc_lib.obj',0 + +;----------------------------------------------------------------------------- +align 4 +ProcLib_import: +OpenDialog_Init dd aOpenDialog_Init +OpenDialog_Start dd aOpenDialog_Start +;OpenDialog_Version dd aOpenDialog_Version + +;ColorDialog_Init dd aColorDialog_Init +;ColorDialog_Start dd aColorDialog_Start +;ColorDialog_Version dd aColorDialog_Version + + dd 0 + dd 0 + +aOpenDialog_Init db 'OpenDialog_init',0 +aOpenDialog_Start db 'OpenDialog_start',0 +;aOpenDialog_Version db 'Version_OpenDialog',0 + +;aColorDialog_Init db 'ColorDialog_init',0 +;aColorDialog_Start db 'ColorDialog_start',0 +;aColorDialog_Version db 'Version_ColorDialog',0 +;----------------------------------------------------------------------------- +align 4 +Box_lib_import: +;init_lib dd a_init +;version_lib dd a_version + + +;edit_box_draw dd aEdit_box_draw +;edit_box_key dd aEdit_box_key +;edit_box_mouse dd aEdit_box_mouse +;version_ed dd aVersion_ed + +init_checkbox dd aInit_checkbox +check_box_draw dd aCheck_box_draw +check_box_mouse dd aCheck_box_mouse +;version_ch dd aVersion_ch + +;option_box_draw dd aOption_box_draw +;option_box_mouse dd aOption_box_mouse +;version_op dd aVersion_op + +;scrollbar_ver_draw dd aScrollbar_ver_draw +;scrollbar_ver_mouse dd aScrollbar_ver_mouse +;scrollbar_hor_draw dd aScrollbar_hor_draw +;scrollbar_hor_mouse dd aScrollbar_hor_mouse +;version_scrollbar dd aVersion_scrollbar + +;dinamic_button_draw dd aDbutton_draw +;dinamic_button_mouse dd aDbutton_mouse +;version_dbutton dd aVersion_dbutton + +;menu_bar_draw dd aMenu_bar_draw +;menu_bar_mouse dd aMenu_bar_mouse +;menu_bar_activate dd aMenu_bar_activate +;version_menu_bar dd aVersion_menu_bar + +;FileBrowser_draw dd aFileBrowser_draw +;FileBrowser_mouse dd aFileBrowser_mouse +;FileBrowser_key dd aFileBrowser_key +;Version_FileBrowser dd aVersion_FileBrowser + +PathShow_prepare dd sz_PathShow_prepare +PathShow_draw dd sz_PathShow_draw +;Version_path_show dd szVersion_path_show + +;Frame_draw dd sz_Frame_draw +;Version_frame dd szVersion_frame + + dd 0,0 + +;a_init db 'lib_init',0 +;a_version db 'version',0 + +;aEdit_box_draw db 'edit_box_draw',0 +;aEdit_box_key db 'edit_box_key',0 +;aEdit_box_mouse db 'edit_box_mouse',0 +;aVersion_ed db 'version_ed',0 + +aInit_checkbox db 'init_checkbox2',0 +aCheck_box_draw db 'check_box_draw2',0 +aCheck_box_mouse db 'check_box_mouse2',0 +;aVersion_ch db 'version_ch2',0 + +;aOption_box_draw db 'option_box_draw',0 +;aOption_box_mouse db 'option_box_mouse',0 +;aVersion_op db 'version_op',0 + +;aScrollbar_ver_draw db 'scrollbar_v_draw',0 +;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 +;aScrollbar_hor_draw db 'scrollbar_h_draw',0 +;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 +;aVersion_scrollbar db 'version_scrollbar',0 + +;aDbutton_draw db 'dbutton_draw',0 +;aDbutton_mouse db 'dbutton_mouse',0 +;aVersion_dbutton db 'version_dbutton',0 + +;aMenu_bar_draw db 'menu_bar_draw',0 +;aMenu_bar_mouse db 'menu_bar_mouse',0 +;aMenu_bar_activate db 'menu_bar_activate',0 +;aVersion_menu_bar db 'version_menu_bar',0 + +;aFileBrowser_draw db 'FileBrowser_draw',0 +;aFileBrowser_mouse db 'FileBrowser_mouse',0 +;aFileBrowser_key db 'FileBrowser_key',0 +;aVersion_FileBrowser db 'version_FileBrowser',0 + +sz_PathShow_prepare db 'PathShow_prepare',0 +sz_PathShow_draw db 'PathShow_draw',0 +;szVersion_path_show db 'version_PathShow',0 + +;sz_Frame_draw db 'frame_draw',0 +;szVersion_frame db 'version_frame',0 +;----------------------------------------------------------------------------- +PathShow_data: +.type dd 0 ;+0 +.start_y dw 5+4 ;+4 +.start_x dw 5+5 ;+6 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.area_size_x dw 400-30 ;+10 +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.background_flag dd 0 ;+16 +.font_color dd 0x0 ;+20 +.background_color dd 0x0 ;+24 +.text_pointer dd fname ;+28 +.work_area_pointer dd text_work_area ;+32 +.temp_text_length dd 0 ;+36 +;----------------------------------------------------------------------------- +check1 check_box2 (100 shl 16)+12,(27 shl 16)+12,6,0xFFFFFF,0,0xffffff,\ + check_text1,ch_flag_middle + +check_text1: +if lang eq ru_RU + db '஢ ',0 +else ; Default to en_US + db 'Use testing of write',0 +end if + +check_box_warning_text: +if lang eq ru_RU + db '! ஢ઠ ᪮ 㭨⮦ ᮤন 䠩!',0 +else ; Default to en_US + db 'WARNING! Testing of write speed will destroy file contents!',0 +end if +;----------------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 +.procinfo dd process_info ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_pach dd fname ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog2',0 + +open_dialog_path: +if __nightbuild eq yes + db '/sys/MANAGERS/opendial',0 +else + db '/sys/File Managers/opendial',0 +end if + +communication_area_default_pach: + db '/sys',0 + +Filter: +dd Filter.end - Filter.1 +.1: +;db 'BIN',0 +;db 'DAT',0 +.end: +db 0 + +start_temp_file_name: + db 'default.dtp',0 + +default_dtp: + db '/sys/default.dtp',0 +;----------------------------------------------------------------------------- +sector equ 512 +;-------------------------------------- +result_table: + dd a512b, 0, 0, sector*1 + dd a1K, 1, 1, sector*2 + dd a2K, 2, 2, sector*4 + dd a4K, 3, 3, sector*8 + dd a8K, 4, 4, sector*16 + dd a16K, 5, 5, sector*32 + dd a32K, 6, 6, sector*64 + dd a64K, 7, 7, sector*128 + dd a128K, 8, 8, sector*256 + dd a256K, 9, 9, sector*512 + dd a512K, 10, 10, sector*1024 + dd a1M, 11, 11, sector*2*1024 + dd a2M, 12, 12, sector*4*1024 + dd a4M, 13, 13, sector*8*1024 + dd a8M, 14, 14, sector*16*1024 + dd a16M, 15, 15, sector*32*1024 + dd a32M, 16, 16, sector*64*1024 + dd a64M, 17, 17, sector*128*1024 +;----------------------------------------------------------------------------- +a512b db ' 512',0 +a1K db ' 1K',0 +a2K db ' 2K',0 +a4K db ' 4K',0 +a8K db ' 8K',0 +a16K db ' 16K',0 +a32K db ' 32K',0 +a64K db ' 64K',0 +a128K db '128K',0 +a256K db '256K',0 +a512K db '512K',0 +a1M db ' 1M',0 +a2M db ' 2M',0 +a4M db ' 4M',0 +a8M db ' 8M',0 +a16M db ' 16M',0 +a32M db ' 32M',0 +a64M db ' 64M',0 +;----------------------------------------------------------------------------- +align 4 +fileinfo: +.subfunction dd 5 +.offset dd 0 +.offset_1 dd 0 +.size dd 0 +.return dd file_info + db 0 +.name: dd fname +;----------------------------------------------------------------------------- +align 4 +fileread: +.subfunction dd 0 +.offset dd 0 +.offset_1 dd 0 +.size dd 0 +.return dd process_info + db 0 +.name: dd fname +;----------------------------------------------------------------------------- +align 4 +filewrite: +.subfunction dd 3 +.offset dd 0 +.offset_1 dd 0 +.size dd 0 +.data dd process_info + db 0 +.name: dd fname +;----------------------------------------------------------------------------- diff --git a/programs/testing/kbd/trunk/kbd.ASM b/programs/testing/kbd/trunk/kbd.ASM index cf4540756..715bb50cc 100644 --- a/programs/testing/kbd/trunk/kbd.ASM +++ b/programs/testing/kbd/trunk/kbd.ASM @@ -1,617 +1,616 @@ -; -; Kolibri Bus Disconnect -; Test for bus disconnect -; -; Compile with FASM for Menuet -; -; - -include '..\..\..\macros.inc' -include 'lang.inc' - -memsize = 1000h - org 0 -PARAMS = memsize - 1024 - -appname equ 'Kolibri Bus Disconnect' -version equ ' 1.1 ' - - use32 ; 32- ० ᥬ - - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd memsize ; memory for app - dd memsize - 1024 ; esp - dd PARAMS , 0x0 ; I_Param , I_Icon - - - -;--------------------------------------------------------------------- -;--- ---------------------------------------------- -;--------------------------------------------------------------------- - -START: - cmp [PARAMS], byte 0 - jne check_parameters - -no_params: - call find_north_bridg - - test dword[bd_id], -1 ; check zero - jnz drawwindow - -controller_not_found: - push .notify - dec esp - push 0 - push 0 - push .error_message - push 0 - push dword 7 ;SSF_START_APP - - mcall 70, esp - add esp, 6*4 + 1 - mcall -1 -.error_message: - db '"KBD\nController not found" -tdE',0 -.notify: - db '/sys/@notify',0 - -drawwindow: - mov eax,48 - mov ebx,3 - mov ecx,sc - mov edx,sizeof.system_colors - mcall - - mov eax, 12 - mov ebx, 1 ; start redraw - mcall - - mov eax, 0 ; window - mov ebx, 100 shl 16 + 300 - mov ecx, 100 shl 16 + 90 - mov edx, [sc.work] - or edx, 0x13000000 - mov edi, title - mcall - - mov eax, 4 - mov ebx, 17 shl 16 + 30 - mov ecx, [sc.work_text] - mov edx, msg_nb - mov esi, msg_nb.length - mcall - - mov ebx, 105 shl 16 + 30 - mov edx, [nb_name] - movzx esi, byte[edx] - inc edx - mcall - - mov ebx, 17 shl 16 + 40 - mov edx, msg_stat - mov esi, msg_stat.length - mcall - - mov ebx, 102 shl 16 + 50 - mov edx, msg_divs - mov esi, msg_divs.length - mcall - mov ebx, 17 shl 16 + 62 - mov edx, msg_hdd - mov esi, msg_hdd.length - mcall - mov ebx, 17 shl 16 + 72 - mov edx, msg_sgd - mov esi, msg_sgd.length - mcall - - call get_divs - mov eax, 47 - mov ebx, 0x30000 - mov ecx, [val_hdd] - mov edx, 8 - shl edx, cl - mov ecx, edx - mov edx, 80 shl 16 + 62 - mov esi, [sc.work_text] - mcall - - mov ecx, [val_sgd] - mov edx, 8 - shl edx, cl - mov ecx, edx - mov edx, 80 shl 16 + 72 - mcall - - - call get_bd_stat - mov ecx, [sc.work_text] - mov esi, msg_nf.length - mov ebx, 105 shl 16 + 40 - mov edx, msg_nf - mov al, [bd_stat] - test al, al - jz @f - mov edx, msg_dis - dec al - jz @f - mov edx, msg_en - mov esi, msg_en.length -@@: mov eax, 4 - mcall - - ; - mov ecx, 27 shl 16 + 20 - mov eax, 8 - mov ebx, 220 shl 16 + 70 - mov esi, [sc.work_button] - mov edx, 2 - mcall - - ; 14 ;) - mov edi, 7 - mov ecx, 60 shl 16 + 10 - mov eax, 8 - mov ebx, 105 shl 16 + 25 - mov edx, 3 - -@@: mcall - inc edx - add ebx, 27 shl 16 - dec edi - jnz @b - - add ecx, 12 shl 16 - mov ebx, 105 shl 16 + 25 - mov edi, 7 -@@: mcall - inc edx - add ebx, 27 shl 16 - dec edi - jnz @b - -end_dr: mov eax, 12 - mov ebx, 2 ; end redraw - mcall - -; Wait for event ... - mov eax, 10 - mcall - - cmp al, 3 - jne not_bt - - mov eax, 17 ; get id - mcall - cmp ah, 1 - jne no_exit - mov eax, -1 ; close this program - mcall -no_exit: - cmp ah, 2 - jne no_ch_bt - mov dl, [bd_stat] - test dl, dl - jz drawwindow - xor eax, eax - dec dl - jnz @f - inc eax -@@: call set_bd_stat - jmp drawwindow - -no_ch_bt: - cmp ah, 9 - jg no_hdd_bt - sub ah, 3 - movzx esi, ah - mov edi, [val_sgd] - call set_divs - jmp drawwindow -no_hdd_bt: - sub ah, 10 - movzx edi, ah - mov esi, [val_hdd] - call set_divs - jmp drawwindow - - -not_bt: cmp al, 2 - jne drawwindow - mov eax, 2 ; ন - ⠥ 뢠 - mcall - jmp drawwindow -;-------------------------------------------------------------------------- -bus_num: db 2 ; 設 -devfn: db 255 -bd_id: dd 0 ; 䨪 ன⢠ -bd_stat: db 0 ; 0 - , 1 - 몫祭, 2 - 祭 - -nb_name dd nb_nf -bd_msk dd msk_i440 - -if lang eq it_IT - ;nb_nf db 9, 'Non trovato' - nb_nf db 11, 'Non trovato' -else - nb_nf db 9, 'Not found' -end if -msk_i440 db 0 -nb_i440 db 4, 'i440' -msk_nforce db 0x6D, 0x80, 0xE7, 0x06, 0 ; ॣ, ᪠, ॣ, ᪠, ... , 0 -nb_nforce db 6, 'nForce' -msk_nforce2 db 0x6F, 0x10, 0 -nb_nforce2 db 8, 'nForce 2' -msk_sis730 db 0x6B, 0x01, 0 -nb_sis730 db 7, 'SiS 730' -nb_sis733 db 7, 'SiS 733' -msk_sis735 db 0x6A, 0x03, 0 -nb_sis735 db 7, 'SiS 735' -nb_sis740 db 7, 'SiS 740' -nb_sis741 db 7, 'SiS 741' -nb_sis745 db 7, 'SiS 745' -msk_sis746 db 0x6C, 0x01, 0 -nb_sis746 db 7, 'SiS 746' -nb_sis748 db 7, 'SiS 748' -msk_amd751 db 0x62, 0x06, 0 -nb_amd751 db 7, 'AMD 751' -nb_amd751s db 8, 'AMD 751S' -nb_amd761 db 7, 'AMD 761' -msk_amd762 db 0x62, 0x02, 0x6A, 0x02, 0 -nb_amd762 db 7, 'AMD 762' -msk_viakt133 db 0x52, 0x80, 0x70, 0x08, 0 -nb_viakt133 db 30, 'VIA KT133(A)/KM133/KL133/KN133' -nb_viakx133 db 9, 'VIA KX133' -nb_viakle133 db 10, 'VIA KLE133' -msk_viakt266 db 0x92, 0x80, 0x95, 0x02, 0x70, 0x08, 0 -nb_viakt266 db 18, 'VIA KT266(A)/KT333' -nb_viakm266 db 21, 'VIA KM266/KL266/KM333' -nb_viakn266 db 9, 'VIA KN266' -msk_viakt400 db 0xD2, 0x80, 0xD5, 0x02, 0x70, 0x08, 0 -nb_viakt400 db 18, 'VIA KT400(A)/KT600' -nb_viakm400 db 9, 'VIA KM400' -msk_viakt880 db 0x82, 0x80, 0x85, 0x02, 0 -nb_viakt880 db 9, 'VIA KT880' - - -bd_table: dd 0x70061022 ; AMD 751 ---- - dd nb_amd751 - dd msk_amd751 - - dd 0x70041022 ; AMD 751S - dd nb_amd751s - dd msk_amd751 - - dd 0x700E1022 ; AMD 761 - dd nb_amd761 - dd msk_amd751 - - dd 0x700C1022 ; AMD 762 - dd nb_amd762 - dd msk_amd762 - - dd 0x71908086 ; i440 --- - dd nb_i440 - dd msk_i440 - - dd 0x01A410DE ; nForce ---- - dd nb_nforce - dd msk_nforce - - dd 0x01E010DE ; nForce 2 - dd nb_nforce2 - dd msk_nforce2 - - dd 0x07301039 ; SiS 730 ---- - dd nb_sis730 - dd msk_sis730 - - dd 0x07331039 ; SiS 733 - dd nb_sis733 - dd msk_sis730 - - dd 0x07351039 ; SiS 735 - dd nb_sis735 - dd msk_sis735 - - dd 0x07401039 ; SiS 740 - dd nb_sis740 - dd msk_sis735 - - dd 0x07411039 ; SiS 741 - dd nb_sis741 - dd msk_sis735 - - dd 0x07451039 ; SiS 745 - dd nb_sis745 - dd msk_sis735 - - dd 0x07461039 ; SiS 746 - dd nb_sis746 - dd msk_sis746 - - dd 0x07481039 ; SiS 748 - dd nb_sis748 - dd msk_sis746 - - dd 0x03051106 ; VIA KT133(A)/KM133/KL133/KN133 ---- - dd nb_viakt133 - dd msk_viakt133 - - dd 0x03911106 ; VIA KX133 - dd nb_viakx133 - dd msk_viakt133 - - dd 0x06911106 ; VIA KLE133 - dd nb_viakle133 - dd msk_viakt133 - - dd 0x30991106 ; VIA KT266(A)/KT333 - dd nb_viakt266 - dd msk_viakt266 - - dd 0x31161106 ; VIA KM266/KL266/KM333 - dd nb_viakm266 - dd msk_viakt266 - - dd 0x31561106 ; VIA KN266 - dd nb_viakn266 - dd msk_viakt266 - - dd 0x31891106 ; VIA KT400(A)/KT600 - dd nb_viakt400 - dd msk_viakt400 - - dd 0x32051106 ; VIA KM400 - dd nb_viakm400 - dd msk_viakt400 - - dd 0x22691106 ; VIA KT880 - dd nb_viakt880 - dd msk_viakt880 -bd_table_end: - - -find_north_bridg: - mov bl, 6 - xor cl, cl -nbus: mov bh, [bus_num] -ndevfn: mov ch, [devfn] - mov eax, 62 - mcall - cmp eax, 0xffffffff - je bd_next - ;--------- - mov esi, bd_table_end - bd_table - 12 -@@: cmp eax, [bd_table + esi] - je bd_found - test esi, esi - jz bd_next - sub esi, 12 - jmp @b - ;--------- -bd_next:dec byte[devfn] - jns ndevfn - mov byte[devfn], 0 - dec byte[bus_num] - jns nbus - ret -bd_found: - add esi, bd_table + 4 - mov edi, nb_name - mov ecx, 2 - rep movsd - - mov [bd_id], eax - ret - -;---------------------- -;bd_stat: db 0 ; 0 - , 1 - 몫祭, 2 - 祭 -get_bd_stat: - mov byte[bd_stat], 1 - cld - mov esi, [bd_msk] - lodsw - test al, al - jnz @f - mov byte[bd_stat], 0 - ret -@@: push eax - mov bh, [bus_num] - mov bl, 4 - mov ch, [devfn] - mov cl, al - mov eax, 62 - mcall - pop edx - and al, dh - jnz @f - lodsw - test al, al - jnz @b - ret -@@: mov byte[bd_stat], 2 - ret -;---------------------- -set_bd_stat: - cmp dword[bd_id], 0x01E010DE ; ᯥ樠쭮 nForce2 400 - je set_stat_nforce2 - - mov edi, eax - cld - mov esi, [bd_msk] -bd_ss_nxt: - lodsw - test al, al - jz bd_ss_end - mov dl, ah ; ᪠ - mov bh, [bus_num] - mov bl, 4 - mov ch, [devfn] - mov cl, al - mov eax, 62 - mcall - mov bl, 8 - test edi, edi - jz @f - or al, dl - mov dl, al - mov eax, 62 - mcall - jmp bd_ss_nxt -@@: not dl - and al, dl - mov dl, al - mov eax, 62 - mcall - jmp bd_ss_nxt -bd_ss_end: - ret -;------- nForce 2 ----------- -set_stat_nforce2: -; IN : eax = 0 - disable, !0 - enable - push eax - mov bh, [bus_num] - mov bl, 4 - mov ch, [devfn] - mov cl, 0x6f - mov eax, 62 - mcall - and al, 0x1F - mov dl, al - mov bl, 8 - mov eax, 62 - mcall - pop eax - test eax, eax - jz @f - or dl, 0x10 - mov eax, 62 - mcall - ret -@@: and dl, 0xef - mov eax, 62 - mcall - ret -;-------------------------------------------------------------------------- -; x8 x16 x32 x64 x128 x256 x512 -div_hdd: db 0x23, 0x27, 0x2B, 0x2F, 0x63, 0x67, 0x6B ; Halt Disconnect Divisor -div_sgd: db 0x12, 0x52, 0x92, 0xD2, 0x12, 0x52, 0x92 ; Stop Grand Divisor -; low word of 0xC001001B MSR -; HDD\SGD 8 16 32 64 128 256 512 -; 8 0x1223 0x5223 0x9223 0xD223 | 0x1223 0x5223 0x9223 -; 16 0x1227 | -; 32 0x122B | -; 64 0x122F | 0x522F -; 128 0x1263 | -; 256 0x1267 & bit 18 is clear | & bit 18 is set -; 512 0x126B | - ; ^^^^ - ; ||||_HDD - ; ||_SGD -set_divs: -; IN : ESI - hdd (0 = x8, 1 = x16 ..) -; EDI - sgd (0 = x8, 1 = x16 ..) - mov eax, 68 - mov ebx, 3 - mov edx, 0xC001001b - mcall - mov al, [div_hdd + esi] - mov ah, [div_sgd + edi] - and eax, 0xFFFBFFFF - cmp edi, 3 - jle @f - or eax, 0x40000 -@@: mov edi, eax - mov esi, ebx - mov eax, 68 - mov ebx, 4 - mcall - ret - -get_divs: -; OUT : val_hdd - hdd (0 = x8, 1 = x16 ..) -; val_sgd - sgd ... - mov eax, 68 - mov ebx, 3 - mov edx, 0xC001001b - mcall - mov ecx, 7 -@@: cmp [div_hdd + ecx - 1], al - je @f - loop @b -@@: dec ecx - mov [val_hdd], ecx - mov ecx, 4 -@@: cmp [div_sgd + ecx - 1], ah - je @f - loop @b -@@: dec ecx - test eax, 0x40000 - jz @f - add ecx, 4 -@@: mov [val_sgd], ecx - ret - -;****************************************************************************** - -check_parameters: - cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler - je boot_bd_enable - jmp no_params - -;****************************************************************************** - -boot_bd_enable: - - call find_north_bridg - test dword[bd_id], -1 ; check zero - jz controller_not_found - - call set_bd_stat - mcall -1 - -;****************************************************************************** - - -;-------------------------------------------------------------------------- - -title db appname,version,0 - -msg_divs db ' x8 x16 x32 x64 x128 x256 x512' -.length = $ - msg_divs -msg_hdd db 'Hatl Disc.' -.length = $ - msg_hdd -msg_sgd db 'Stop Grand' -.length = $ - msg_sgd -msg_nb db 'North bridge :' -.length = $ - msg_nb -msg_stat db 'Status :' -.length = $ - msg_stat - -if lang eq it_IT - msg_en db 'Abilitato ' - .length = $ - msg_en - msg_dis db 'Disabilitato' - .length = $ - msg_dis - msg_nf db 'Non trovato ' - .length = $ - msg_nf -else - msg_en db 'Enabled ' - .length = $ - msg_en - msg_dis db 'Disabled ' - .length = $ - msg_dis - msg_nf db 'Not found' - .length = $ - msg_nf -end if - -I_END: - -sc system_colors -val_hdd dd ? -val_sgd dd ? - +; +; Kolibri Bus Disconnect +; Test for bus disconnect +; +; Compile with FASM for Menuet +; +; + +include '..\..\..\macros.inc' +include 'lang.inc' ; Language support for locales: it_IT, en_US. + +memsize = 1000h + org 0 +PARAMS = memsize - 1024 + +appname equ 'Kolibri Bus Disconnect' +version equ ' 1.1 ' + + use32 ; 32- ० ᥬ + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd memsize ; memory for app + dd memsize - 1024 ; esp + dd PARAMS , 0x0 ; I_Param , I_Icon + + + +;--------------------------------------------------------------------- +;--- ---------------------------------------------- +;--------------------------------------------------------------------- + +START: + cmp [PARAMS], byte 0 + jne check_parameters + +no_params: + call find_north_bridg + + test dword[bd_id], -1 ; check zero + jnz drawwindow + +controller_not_found: + push .notify + dec esp + push 0 + push 0 + push .error_message + push 0 + push dword 7 ;SSF_START_APP + + mcall 70, esp + add esp, 6*4 + 1 + mcall -1 +.error_message: + db '"KBD\nController not found" -tdE',0 +.notify: + db '/sys/@notify',0 + +drawwindow: + mov eax,48 + mov ebx,3 + mov ecx,sc + mov edx,sizeof.system_colors + mcall + + mov eax, 12 + mov ebx, 1 ; start redraw + mcall + + mov eax, 0 ; window + mov ebx, 100 shl 16 + 300 + mov ecx, 100 shl 16 + 90 + mov edx, [sc.work] + or edx, 0x13000000 + mov edi, title + mcall + + mov eax, 4 + mov ebx, 17 shl 16 + 30 + mov ecx, [sc.work_text] + mov edx, msg_nb + mov esi, msg_nb.length + mcall + + mov ebx, 105 shl 16 + 30 + mov edx, [nb_name] + movzx esi, byte[edx] + inc edx + mcall + + mov ebx, 17 shl 16 + 40 + mov edx, msg_stat + mov esi, msg_stat.length + mcall + + mov ebx, 102 shl 16 + 50 + mov edx, msg_divs + mov esi, msg_divs.length + mcall + mov ebx, 17 shl 16 + 62 + mov edx, msg_hdd + mov esi, msg_hdd.length + mcall + mov ebx, 17 shl 16 + 72 + mov edx, msg_sgd + mov esi, msg_sgd.length + mcall + + call get_divs + mov eax, 47 + mov ebx, 0x30000 + mov ecx, [val_hdd] + mov edx, 8 + shl edx, cl + mov ecx, edx + mov edx, 80 shl 16 + 62 + mov esi, [sc.work_text] + mcall + + mov ecx, [val_sgd] + mov edx, 8 + shl edx, cl + mov ecx, edx + mov edx, 80 shl 16 + 72 + mcall + + + call get_bd_stat + mov ecx, [sc.work_text] + mov esi, msg_nf.length + mov ebx, 105 shl 16 + 40 + mov edx, msg_nf + mov al, [bd_stat] + test al, al + jz @f + mov edx, msg_dis + dec al + jz @f + mov edx, msg_en + mov esi, msg_en.length +@@: mov eax, 4 + mcall + + ; + mov ecx, 27 shl 16 + 20 + mov eax, 8 + mov ebx, 220 shl 16 + 70 + mov esi, [sc.work_button] + mov edx, 2 + mcall + + ; 14 ;) + mov edi, 7 + mov ecx, 60 shl 16 + 10 + mov eax, 8 + mov ebx, 105 shl 16 + 25 + mov edx, 3 + +@@: mcall + inc edx + add ebx, 27 shl 16 + dec edi + jnz @b + + add ecx, 12 shl 16 + mov ebx, 105 shl 16 + 25 + mov edi, 7 +@@: mcall + inc edx + add ebx, 27 shl 16 + dec edi + jnz @b + +end_dr: mov eax, 12 + mov ebx, 2 ; end redraw + mcall + +; Wait for event ... + mov eax, 10 + mcall + + cmp al, 3 + jne not_bt + + mov eax, 17 ; get id + mcall + cmp ah, 1 + jne no_exit + mov eax, -1 ; close this program + mcall +no_exit: + cmp ah, 2 + jne no_ch_bt + mov dl, [bd_stat] + test dl, dl + jz drawwindow + xor eax, eax + dec dl + jnz @f + inc eax +@@: call set_bd_stat + jmp drawwindow + +no_ch_bt: + cmp ah, 9 + jg no_hdd_bt + sub ah, 3 + movzx esi, ah + mov edi, [val_sgd] + call set_divs + jmp drawwindow +no_hdd_bt: + sub ah, 10 + movzx edi, ah + mov esi, [val_hdd] + call set_divs + jmp drawwindow + + +not_bt: cmp al, 2 + jne drawwindow + mov eax, 2 ; ন - ⠥ 뢠 + mcall + jmp drawwindow +;-------------------------------------------------------------------------- +bus_num: db 2 ; 設 +devfn: db 255 +bd_id: dd 0 ; 䨪 ன⢠ +bd_stat: db 0 ; 0 - , 1 - 몫祭, 2 - 祭 + +nb_name dd nb_nf +bd_msk dd msk_i440 + +if lang eq it_IT + nb_nf db 11, 'Non trovato' +else ; Default to en_US + nb_nf db 9, 'Not found' +end if +msk_i440 db 0 +nb_i440 db 4, 'i440' +msk_nforce db 0x6D, 0x80, 0xE7, 0x06, 0 ; ॣ, ᪠, ॣ, ᪠, ... , 0 +nb_nforce db 6, 'nForce' +msk_nforce2 db 0x6F, 0x10, 0 +nb_nforce2 db 8, 'nForce 2' +msk_sis730 db 0x6B, 0x01, 0 +nb_sis730 db 7, 'SiS 730' +nb_sis733 db 7, 'SiS 733' +msk_sis735 db 0x6A, 0x03, 0 +nb_sis735 db 7, 'SiS 735' +nb_sis740 db 7, 'SiS 740' +nb_sis741 db 7, 'SiS 741' +nb_sis745 db 7, 'SiS 745' +msk_sis746 db 0x6C, 0x01, 0 +nb_sis746 db 7, 'SiS 746' +nb_sis748 db 7, 'SiS 748' +msk_amd751 db 0x62, 0x06, 0 +nb_amd751 db 7, 'AMD 751' +nb_amd751s db 8, 'AMD 751S' +nb_amd761 db 7, 'AMD 761' +msk_amd762 db 0x62, 0x02, 0x6A, 0x02, 0 +nb_amd762 db 7, 'AMD 762' +msk_viakt133 db 0x52, 0x80, 0x70, 0x08, 0 +nb_viakt133 db 30, 'VIA KT133(A)/KM133/KL133/KN133' +nb_viakx133 db 9, 'VIA KX133' +nb_viakle133 db 10, 'VIA KLE133' +msk_viakt266 db 0x92, 0x80, 0x95, 0x02, 0x70, 0x08, 0 +nb_viakt266 db 18, 'VIA KT266(A)/KT333' +nb_viakm266 db 21, 'VIA KM266/KL266/KM333' +nb_viakn266 db 9, 'VIA KN266' +msk_viakt400 db 0xD2, 0x80, 0xD5, 0x02, 0x70, 0x08, 0 +nb_viakt400 db 18, 'VIA KT400(A)/KT600' +nb_viakm400 db 9, 'VIA KM400' +msk_viakt880 db 0x82, 0x80, 0x85, 0x02, 0 +nb_viakt880 db 9, 'VIA KT880' + + +bd_table: dd 0x70061022 ; AMD 751 ---- + dd nb_amd751 + dd msk_amd751 + + dd 0x70041022 ; AMD 751S + dd nb_amd751s + dd msk_amd751 + + dd 0x700E1022 ; AMD 761 + dd nb_amd761 + dd msk_amd751 + + dd 0x700C1022 ; AMD 762 + dd nb_amd762 + dd msk_amd762 + + dd 0x71908086 ; i440 --- + dd nb_i440 + dd msk_i440 + + dd 0x01A410DE ; nForce ---- + dd nb_nforce + dd msk_nforce + + dd 0x01E010DE ; nForce 2 + dd nb_nforce2 + dd msk_nforce2 + + dd 0x07301039 ; SiS 730 ---- + dd nb_sis730 + dd msk_sis730 + + dd 0x07331039 ; SiS 733 + dd nb_sis733 + dd msk_sis730 + + dd 0x07351039 ; SiS 735 + dd nb_sis735 + dd msk_sis735 + + dd 0x07401039 ; SiS 740 + dd nb_sis740 + dd msk_sis735 + + dd 0x07411039 ; SiS 741 + dd nb_sis741 + dd msk_sis735 + + dd 0x07451039 ; SiS 745 + dd nb_sis745 + dd msk_sis735 + + dd 0x07461039 ; SiS 746 + dd nb_sis746 + dd msk_sis746 + + dd 0x07481039 ; SiS 748 + dd nb_sis748 + dd msk_sis746 + + dd 0x03051106 ; VIA KT133(A)/KM133/KL133/KN133 ---- + dd nb_viakt133 + dd msk_viakt133 + + dd 0x03911106 ; VIA KX133 + dd nb_viakx133 + dd msk_viakt133 + + dd 0x06911106 ; VIA KLE133 + dd nb_viakle133 + dd msk_viakt133 + + dd 0x30991106 ; VIA KT266(A)/KT333 + dd nb_viakt266 + dd msk_viakt266 + + dd 0x31161106 ; VIA KM266/KL266/KM333 + dd nb_viakm266 + dd msk_viakt266 + + dd 0x31561106 ; VIA KN266 + dd nb_viakn266 + dd msk_viakt266 + + dd 0x31891106 ; VIA KT400(A)/KT600 + dd nb_viakt400 + dd msk_viakt400 + + dd 0x32051106 ; VIA KM400 + dd nb_viakm400 + dd msk_viakt400 + + dd 0x22691106 ; VIA KT880 + dd nb_viakt880 + dd msk_viakt880 +bd_table_end: + + +find_north_bridg: + mov bl, 6 + xor cl, cl +nbus: mov bh, [bus_num] +ndevfn: mov ch, [devfn] + mov eax, 62 + mcall + cmp eax, 0xffffffff + je bd_next + ;--------- + mov esi, bd_table_end - bd_table - 12 +@@: cmp eax, [bd_table + esi] + je bd_found + test esi, esi + jz bd_next + sub esi, 12 + jmp @b + ;--------- +bd_next:dec byte[devfn] + jns ndevfn + mov byte[devfn], 0 + dec byte[bus_num] + jns nbus + ret +bd_found: + add esi, bd_table + 4 + mov edi, nb_name + mov ecx, 2 + rep movsd + + mov [bd_id], eax + ret + +;---------------------- +;bd_stat: db 0 ; 0 - , 1 - 몫祭, 2 - 祭 +get_bd_stat: + mov byte[bd_stat], 1 + cld + mov esi, [bd_msk] + lodsw + test al, al + jnz @f + mov byte[bd_stat], 0 + ret +@@: push eax + mov bh, [bus_num] + mov bl, 4 + mov ch, [devfn] + mov cl, al + mov eax, 62 + mcall + pop edx + and al, dh + jnz @f + lodsw + test al, al + jnz @b + ret +@@: mov byte[bd_stat], 2 + ret +;---------------------- +set_bd_stat: + cmp dword[bd_id], 0x01E010DE ; ᯥ樠쭮 nForce2 400 + je set_stat_nforce2 + + mov edi, eax + cld + mov esi, [bd_msk] +bd_ss_nxt: + lodsw + test al, al + jz bd_ss_end + mov dl, ah ; ᪠ + mov bh, [bus_num] + mov bl, 4 + mov ch, [devfn] + mov cl, al + mov eax, 62 + mcall + mov bl, 8 + test edi, edi + jz @f + or al, dl + mov dl, al + mov eax, 62 + mcall + jmp bd_ss_nxt +@@: not dl + and al, dl + mov dl, al + mov eax, 62 + mcall + jmp bd_ss_nxt +bd_ss_end: + ret +;------- nForce 2 ----------- +set_stat_nforce2: +; IN : eax = 0 - disable, !0 - enable + push eax + mov bh, [bus_num] + mov bl, 4 + mov ch, [devfn] + mov cl, 0x6f + mov eax, 62 + mcall + and al, 0x1F + mov dl, al + mov bl, 8 + mov eax, 62 + mcall + pop eax + test eax, eax + jz @f + or dl, 0x10 + mov eax, 62 + mcall + ret +@@: and dl, 0xef + mov eax, 62 + mcall + ret +;-------------------------------------------------------------------------- +; x8 x16 x32 x64 x128 x256 x512 +div_hdd: db 0x23, 0x27, 0x2B, 0x2F, 0x63, 0x67, 0x6B ; Halt Disconnect Divisor +div_sgd: db 0x12, 0x52, 0x92, 0xD2, 0x12, 0x52, 0x92 ; Stop Grand Divisor +; low word of 0xC001001B MSR +; HDD\SGD 8 16 32 64 128 256 512 +; 8 0x1223 0x5223 0x9223 0xD223 | 0x1223 0x5223 0x9223 +; 16 0x1227 | +; 32 0x122B | +; 64 0x122F | 0x522F +; 128 0x1263 | +; 256 0x1267 & bit 18 is clear | & bit 18 is set +; 512 0x126B | + ; ^^^^ + ; ||||_HDD + ; ||_SGD +set_divs: +; IN : ESI - hdd (0 = x8, 1 = x16 ..) +; EDI - sgd (0 = x8, 1 = x16 ..) + mov eax, 68 + mov ebx, 3 + mov edx, 0xC001001b + mcall + mov al, [div_hdd + esi] + mov ah, [div_sgd + edi] + and eax, 0xFFFBFFFF + cmp edi, 3 + jle @f + or eax, 0x40000 +@@: mov edi, eax + mov esi, ebx + mov eax, 68 + mov ebx, 4 + mcall + ret + +get_divs: +; OUT : val_hdd - hdd (0 = x8, 1 = x16 ..) +; val_sgd - sgd ... + mov eax, 68 + mov ebx, 3 + mov edx, 0xC001001b + mcall + mov ecx, 7 +@@: cmp [div_hdd + ecx - 1], al + je @f + loop @b +@@: dec ecx + mov [val_hdd], ecx + mov ecx, 4 +@@: cmp [div_sgd + ecx - 1], ah + je @f + loop @b +@@: dec ecx + test eax, 0x40000 + jz @f + add ecx, 4 +@@: mov [val_sgd], ecx + ret + +;****************************************************************************** + +check_parameters: + cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler + je boot_bd_enable + jmp no_params + +;****************************************************************************** + +boot_bd_enable: + + call find_north_bridg + test dword[bd_id], -1 ; check zero + jz controller_not_found + + call set_bd_stat + mcall -1 + +;****************************************************************************** + + +;-------------------------------------------------------------------------- + +title db appname,version,0 + +msg_divs db ' x8 x16 x32 x64 x128 x256 x512' +.length = $ - msg_divs +msg_hdd db 'Hatl Disc.' +.length = $ - msg_hdd +msg_sgd db 'Stop Grand' +.length = $ - msg_sgd +msg_nb db 'North bridge :' +.length = $ - msg_nb +msg_stat db 'Status :' +.length = $ - msg_stat + +if lang eq it_IT + msg_en db 'Abilitato ' + .length = $ - msg_en + msg_dis db 'Disabilitato' + .length = $ - msg_dis + msg_nf db 'Non trovato ' + .length = $ - msg_nf +else ; Default to en_US + msg_en db 'Enabled ' + .length = $ - msg_en + msg_dis db 'Disabled ' + .length = $ - msg_dis + msg_nf db 'Not found' + .length = $ - msg_nf +end if + +I_END: + +sc system_colors +val_hdd dd ? +val_sgd dd ? +