29,7 → 29,7 |
dd program_end ; program image size |
dd stacktop ; required amount of memory |
dd stacktop ; stack |
dd params,0x0 ; parameters,icon |
dd params,cur_dir_path ; parameters,icon |
|
include 'lang.inc' |
include '..\..\..\macros.inc' |
36,9 → 36,24 |
purge add,sub ; macros.inc does incorrect substitution |
include 'fasm.inc' |
|
include '..\..\..\develop\libraries\box_lib\trunk\editbox.mac' |
include '..\..\..\develop\libraries\box_lib\load_lib.mac' |
@use_library |
|
|
|
center fix true |
|
START: ; Start of execution |
sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
|
cmp eax,-1 |
jne @f |
mcall -1 ;exit if not open box_lib.obj |
@@: |
mcall 40,0x27 ;¬ ᪠á¨á⥬ëå ᮡë⨩ |
|
mov edi, fileinfos |
mov ecx, (fileinfos_end-fileinfos)/4 |
or eax, -1 |
98,6 → 113,10 |
push 10 ; Wait here for event |
pop eax |
mcall |
cmp al,6 |
jne @f |
call mouse |
@@: |
dec eax |
je red ; Redraw request |
dec eax |
106,6 → 125,14 |
key: ; Key |
mov al,2 ; Read it and ignore |
mcall |
|
push dword edit1 |
call [edit_box_key] |
push dword edit2 |
call [edit_box_key] |
push dword edit3 |
call [edit_box_key] |
|
jmp still |
|
button: ; Button in Window |
142,12 → 169,6 |
mov ecx,5 |
mov [ya],ecx |
|
cmp ah,11 ; Infile |
je f1 |
cmp ah,12 ; Outfile |
je f2 |
cmp ah,13 ; Path |
je f3 |
cmp ah,14 |
je f4 |
|
159,8 → 180,16 |
call draw_checkbox |
jmp still |
|
mouse: |
push dword edit1 |
call [edit_box_mouse] |
push dword edit2 |
call [edit_box_mouse] |
push dword edit3 |
call [edit_box_mouse] |
ret |
|
draw_window: |
|
pusha |
|
mcall 12,1 ; Start of draw |
181,35 → 210,12 |
mov ebx,[pinfo.box.width] |
sub ebx,10 |
|
push ecx |
madd ecx, 14*3+16+2, 14*3+16+2 |
mcall 38,,,[sc.work_graph] |
pop ecx |
|
sub ebx,MAGIC1+3 |
mcall |
madd ecx, 14, 14 |
mcall |
madd ecx, 14, 14 |
mcall |
madd ecx, 14, 14 |
mcall |
push ebx |
mpack ebx,MAGIC1,MAGIC1 |
sub ecx, 14*3 |
mcall |
mov ebx,[esp-2] |
pop bx |
mcall |
add esp,2 |
|
mpack ebx,0,MAGIC1-1 |
mpack ecx,1+1, 14-2 |
mcall 8,,,0x4000000B ; Button: Enter Infile |
mov eax,8 |
mov edx,0x4000000B |
madd ecx, 14,0 |
mcall ,,,0x4000000C ; Button: Enter Outfile |
; mcall ,,,0x4000000C ; Button: Enter Outfile |
madd ecx, 14,0 |
mcall ,,,0x4000000D ; Button: Enter Path |
; mcall ,,,0x4000000D ; Button: Enter Path |
|
mpack ebx,[pinfo.box.width],MAGIC1 |
msub ebx,MAGIC1+10+1,0 |
229,7 → 235,7 |
mov eax,4 |
newline: |
mcall |
add ebx, 14 |
add ebx, 16 ;14 |
add edx,text.line_size |
cmp byte[edx],'x' |
jne newline |
255,16 → 261,17 |
jbe @f |
mov al,MAX_PATH |
@@: movzx esi,al |
mcall 4,,[sc.work_text],infile |
add ebx,14 |
mcall ,,,outfile |
add ebx,14 |
mcall ,,,path |
|
call draw_checkbox |
|
call draw_messages |
|
push dword edit1 |
call [edit_box_draw] |
push dword edit2 |
call [edit_box_draw] |
push dword edit3 |
call [edit_box_draw] |
|
mcall 12,2 ; End of Draw |
|
popa |
328,101 → 335,29 |
pop ecx ebx |
ret |
|
; read string |
|
f1: mov [addr],infile |
add [ya], 14*0 |
jmp rk |
f2: mov [addr],outfile |
add [ya], 14*1 |
jmp rk |
f3: mov [addr],path |
add [ya], 14*2 |
rk: |
; DATA |
|
mov edi,[addr] |
mov al,0 |
mov ecx,MAX_PATH |
add edi,ecx |
dec edi |
std |
repe scasb |
sub ecx,MAX_PATH |
neg ecx |
mov al,$1C ; '' |
add edi,2 |
push edi |
cld |
rep stosb |
call print_text |
pop edi |
f11:mcall 10 |
cmp eax,2 |
jne read_done |
mcall; 2 |
shr eax,8 |
cmp al,13 |
je read_done |
cmp al,8 |
jne nobs |
cmp edi,[addr] |
je f11 |
sub edi,1 |
mov byte[edi],$1C ; '_' |
call print_text |
jmp f11 |
nobs: |
movzx ebx,al |
sub ebx,$20 |
jle f11 |
sub al,[sub_table+ebx] |
keyok: |
mov ecx,[addr] |
add ecx,MAX_PATH |
cmp edi,ecx |
jae f11 |
mov [edi],al |
if lang eq ru |
text: |
db ' å ©«:' |
.line_size = $-text |
db 'ëå ©«:' |
db ' ãâì:' |
db 'x' |
|
call print_text |
inc edi |
jmp f11 |
s_compile db '®¬¯¨«.' |
s_run db ' ã᪠' |
s_debug db 'â« ¤ª ' |
s_dbgdescr db '®§¤ ¢ âì ®â« ¤®çãî ¨ä®à¬ æ¨î',0 |
|
read_done: |
|
mov ecx,[addr] |
add ecx,MAX_PATH |
sub ecx,edi |
mov al,0;' ' |
cld |
rep stosb |
call print_text |
|
jmp still |
|
print_text: |
|
mpack ebx,MAGIC1+6,[pinfo.box.width] |
sub ebx,MAGIC1*2+19 |
movzx esi,bx |
mov ecx,[ya-2] |
mov cx,8 |
mcall 13,,,[sc.work] |
|
mpack ebx,MAGIC1+6,[ya] |
mov eax,esi |
mov cl,6 |
div cl |
cmp al,MAX_PATH |
jbe @f |
mov al,MAX_PATH |
@@: movzx esi,al |
mcall 4,,[sc.work_text],[addr] |
|
ret |
|
|
; DATA |
|
err_message_import db '訡ª ¯à¨ ¨¬¯®à⥠box_lib.obj',0 |
err_message_found_lib db '訡ª ¯à¨ ¯®¨áª¥ box_lib.obj',0 ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ®¬ ®ª¥, ¥á«¨ ¡¨¡«¨®â¥ª ¥ ¡ã¤¥â ©¤¥ |
head_f_i: |
head_f_l db '¨á⥬ ï ®è¨¡ª ',0 ;§ £®«®¢®ª ®ª , ¯à¨ ¢®§¨ª®¢¥¨¨ ®è¨¡ª¨ |
system_path db '/sys/lib/' |
library_name db 'box_lib.obj',0 |
else |
text: |
db ' INFILE:' |
.line_size = $-text |
433,9 → 368,43 |
s_compile db 'COMPILE' |
s_run db ' RUN ' |
s_debug db ' DEBUG ' |
|
s_dbgdescr db 'Generate debug information',0 |
|
err_message_import db 'Error on load import library box_lib.obj',0 |
err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ®¬ ®ª¥, ¥á«¨ ¡¨¡«¨®â¥ª ¥ ¡ã¤¥â ©¤¥ |
head_f_i: |
head_f_l db 'System error',0 ;§ £®«®¢®ª ®ª , ¯à¨ ¢®§¨ª®¢¥¨¨ ®è¨¡ª¨ |
system_path db '/sys/lib/' |
library_name db 'box_lib.obj',0 |
end if |
|
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 |
|
;check_box_draw dd aCheck_box_draw |
;check_box_mouse dd aCheck_box_mouse |
;version_ch dd aVersion_ch |
|
dd 0,0 |
|
aEdit_box_draw db 'edit_box',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 |
|
edit1 edit_box 153, 56, 1, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, infile, mouse_dd, 0, 11,11 |
edit2 edit_box 153, 56, 17, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, outfile, mouse_dd, 0, 7,7 |
edit3 edit_box 153, 56, 33, 0xe0ffff, 0xff, 0x80ff, 0, 0xa000, MAX_PATH+$, path, mouse_dd, 0, 6,6 |
|
mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox |
|
infile db 'example.asm' |
times MAX_PATH+$-infile db 0 |
outfile db 'example' |
580,9 → 549,12 |
;include_debug_strings |
|
params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/', |
cur_dir_path rb 4096 |
library_path rb 4096 |
|
program_end: |
|
rb 1000h |
|
align 4 |
|
include 'variable.inc' |