Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 470 → Rev 474

/programs/fs/kfar/trunk/memalloc.inc
File deleted
/programs/fs/kfar/trunk/dialogs.inc
27,6 → 27,8
pushad
mov ebx, [esp+20h+4]
; center window if required
push [ebx+dlgtemplate.x]
push [ebx+dlgtemplate.y]
cmp [ebx+dlgtemplate.x], -1
jnz @f
mov eax, [cur_width]
59,6 → 61,8
cmp [ebx+dlgtemplate.border_size_y], 1
jge .sizeok
.sizeerr:
pop [ebx+dlgtemplate.y]
pop [ebx+dlgtemplate.x]
popad
or eax, -1
ret 8
73,11 → 77,11
jz @f
mov edi, warning_colors
.setcolor:
mov al, [dialog_main_color-dialog_colors+edi]
mov al, [edi + dialog_main_color-dialog_colors]
mov [ebx+dlgtemplate.main_color], al
mov al, [dialog_border_color-dialog_colors+edi]
mov al, [edi + dialog_border_color-dialog_colors]
mov [ebx+dlgtemplate.border_color], al
mov al, [dialog_header_color-dialog_colors+edi]
mov al, [edi + dialog_header_color-dialog_colors]
mov [ebx+dlgtemplate.header_color], al
@@:
; allocate memory for data under dialog
95,10 → 99,12
add edx, [ebx+dlgtemplate.border_size_y]
inc edx
mul edx
add eax, eax
call mf_alloc
lea ecx, [eax*2]
call xpgalloc
test eax, eax
jnz @f
pop [ebx+dlgtemplate.y]
pop [ebx+dlgtemplate.x]
popad
or eax, -1
ret 8
296,7 → 302,7
dec edx
jnz @b
; send redraw message
mov eax, [esp+20h+8]
mov eax, [esp+28h+8]
push ebx ebp
push 0
push 0
347,7 → 353,7
jz .alt_down
cmp al, 0xB8
jz .alt_up
mov ecx, [esp+20h+8]
mov ecx, [esp+28h+8]
push ebx ebp
push 0
push eax
357,7 → 363,7
pop ebp ebx
test eax, eax
jz .event
mov [esp+28], eax
mov [esp+8+28], eax
jmp .exit
.ctrl_down:
test ah, ah
430,9 → 436,11
call draw_keybar
cmp ebx, nomem_dlgdata
jz @f
mov eax, ebp
call mf_free
mov ecx, ebp
call pgfree
@@:
pop [ebx+dlgtemplate.y]
pop [ebx+dlgtemplate.x]
or [cursor_x], -1
or [cursor_y], -1
call draw_image
548,7 → 556,7
; void* variants, const char* title, unsigned flags);
menu_centered_in:
pushad
mov eax, 56
mov ecx, 56
; 36 bytes for dlgtemplate + additional:
; +36: dd cur_variant
; +40: dd num_variants
555,7 → 563,7
; +44: dd begin_variant
; +48: dd end_variant
; +52: dd cur_variant_idx
call xmalloc
call xpgalloc
test eax, eax
jnz @f
.ret_bad:
700,8 → 708,8
push ebx
call GenericBox
mov [esp+28], eax
mov eax, ebx
call mf_free
mov ecx, ebx
call pgfree
popad
ret 28
 
715,6 → 723,33
.draw:
call .dodraw
ret 16
.prev:
mov eax, [ebx+36]
cmp dword [eax+4], 0
jz .end
call .line_prev
.posret:
mov [ebx+36], eax
.redraw:
call .dodraw
call draw_image
xor eax, eax
ret 16
.next:
mov eax, [ebx+36]
cmp dword [eax], 0
jz .home
call .line_next
jmp .posret
.pgdn:
mov eax, [ebx+36]
mov ecx, [ebx+dlgtemplate.height]
.pgdnl:
cmp dword [eax], 0
jz .posret
call .line_next
loop .pgdnl
jmp .posret
.key:
mov al, [esp+12]
cmp al, 0x48
773,33 → 808,6
call .line_prev
loop .pgupl
jmp .posret
.prev:
mov eax, [ebx+36]
cmp dword [eax+4], 0
jz .end
call .line_prev
.posret:
mov [ebx+36], eax
.redraw:
call .dodraw
call draw_image
xor eax, eax
ret 16
.next:
mov eax, [ebx+36]
cmp dword [eax], 0
jz .home
call .line_next
jmp .posret
.pgdn:
mov eax, [ebx+36]
mov ecx, [ebx+dlgtemplate.height]
.pgdnl:
cmp dword [eax], 0
jz .posret
call .line_next
loop .pgdnl
jmp .posret
.home:
mov eax, [ebx+36]
@@:
1083,6 → 1091,7
ret 16
@@:
lea ebx, [ebp+dlgtemplate.size+12]
mov ecx, [ebx-4]
.enter_find:
cmp [ebx+dlgitemtemplate.type], 2
jnz @f
1090,7 → 1099,8
jnz .enter_found
@@:
add ebx, dlgitemtemplate.size
jmp .enter_find
loop .enter_find
jmp .enter_found
.tab:
test [ctrlstate], 3
jnz .shift_tab
1159,46 → 1169,14
cmp al, 0x0E
jz .editor_backspace
cmp al, 0x53
jz .editor_del
test [ctrlstate], 0x3C
jnz .ret_draw
; query keyboard layout
pushad
push 26
pop eax
push 2
pop ebx
xor ecx, ecx
cmp [ctrlstate], 1
sbb ecx, -2
mov edx, layout
int 0x40
popad
; translate scancode to ASCII
movzx eax, al
movzx eax, byte [layout+eax]
push eax
; insert entered symbol
xor eax, eax
lea edi, [edx+12]
or ecx, -1
repnz scasb
not ecx
pop eax
cmp ecx, [edx]
ja .ret_test ; buffer capacity exceeded
lea edi, [edx+ecx+12-1]
mov esi, [edx+4]
lea esi, [edx+esi+12]
@@:
mov cl, [edi]
mov [edi+1], cl
dec edi
cmp edi, esi
jae @b
mov [esi], al
inc dword [edx+4]
@@: jmp .ret_test
jnz .editor_char
.editor_del:
mov ecx, [edx+4]
lea edi, [ecx+edx+12]
lea esi, [edi+1]
cmp byte [edi], 0
jz .ret_test
jmp .copy_and_ret_test
.editor_left:
mov ecx, [edx+4]
jecxz @f
1248,13 → 1226,46
test al, al
jnz @b
jmp .ret_test
.editor_del:
mov ecx, [edx+4]
lea edi, [ecx+edx+12]
lea esi, [edi+1]
cmp byte [edi], 0
jz .ret_test
jmp .copy_and_ret_test
.editor_char:
test [ctrlstate], 0x3C
jnz .ret_draw
; query keyboard layout
pushad
push 26
pop eax
push 2
pop ebx
xor ecx, ecx
cmp [ctrlstate], 1
sbb ecx, -2
mov edx, layout
int 0x40
popad
; translate scancode to ASCII
movzx eax, al
movzx eax, byte [layout+eax]
push eax
; insert entered symbol
xor eax, eax
lea edi, [edx+12]
or ecx, -1
repnz scasb
not ecx
pop eax
cmp ecx, [edx]
ja .ret_test ; buffer capacity exceeded
lea edi, [edx+ecx+12-1]
mov esi, [edx+4]
lea esi, [edx+esi+12]
@@:
mov cl, [edi]
mov [edi+1], cl
dec edi
cmp edi, esi
jae @b
mov [esi], al
inc dword [edx+4]
@@: jmp .ret_test
 
.dodraw:
or [cursor_x], -1
1434,6 → 1445,16
; int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
; may be x=-1 and/or y=-1
SayErr:
push 2
jmp @f
 
; int __stdcall Message(const char* title, int x, int y,
; int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
Message:
push 1
@@:
; [esp+4] = title
; [esp+8] = x
; [esp+12] = y
1441,21 → 1462,22
; [esp+20] = strings
; [esp+24] = num_buttons
; [esp+28] = buttons
SayErr:
mov eax, [esp+16]
add eax, [esp+24]
imul eax, dlgitemtemplate.size
add eax, dlgtemplate.size+12
call xmalloc
pop eax
pushad
mov ecx, [esp+4+16]
add ecx, [esp+4+24]
imul ecx, dlgitemtemplate.size
add ecx, dlgtemplate.size+12
call xpgalloc
test eax, eax
jnz @f
popad
or eax, -1
ret 28
@@:
pushad
mov ebx, eax
mov edi, eax
mov eax, 2
mov eax, [esp+28]
stosd ; dlgtemplate.flags
mov eax, [esp+32+8]
stosd ; dlgtemplate.x
1592,7 → 1614,7
sub eax, [esp+32+16]
@@:
mov [esp+28], eax
mov eax, ebx
call mf_free
mov ecx, ebx
call pgfree
popad
ret 28
/programs/fs/kfar/trunk/filetool.inc
0,0 → 1,226
delete_file_worker:
; in: ecx=flags: 1=deleting directory
; out: eax=0 - OK, eax=1 - retry, eax=2 - skip, eax=-1 - cancel,
; PF, ZF, CF and SF set accordingly to 'cmp eax,2' (or 'cmp al,2')
push ebx
push 70
pop eax
mov ebx, delinfo
int 0x40
pop ebx
test eax, eax
jz .ret
cmp [del_bSkipAll], 0
jz @f
push 2
pop eax
jmp .ret
@@:
push execdata
push aCannotDeleteFolder
test cl, 1
jnz @f
mov dword [esp], aCannotDeleteFile
@@:
call get_error_msg
push eax
mov eax, esp
push DeleteErrorBtn
push 4
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
cmp al, -1
jz @f
inc eax
cmp al, 4 ; "cancel" button
jnz @f
or eax, -1
@@:
cmp al, 3 ; "skip all" button
jnz .ret
mov [del_bSkipAll], 1
dec eax
.ret:
cmp al, 2
ret
 
delete_file:
; in: eax->BDFE block
; out: CF and ZF not set <=> cancel job ("ja cancel_label")
pushad
mov [del_dir_stack_ptr], del_dir_stack
lea esi, [ebp + panel1_dir - panel1_data]
mov edi, execdata
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov esi, [esp+28]
mov ecx, esi
add esi, 40
mov al, '/'
stosb
.l1:
lodsb
cmp edi, execdataend
jb @f
call panels_OnKey.bigfilename
popad
ret
@@:
stosb
test al, al
jnz .l1
mov ecx, [esp+28]
test byte [ecx], 10h
jnz .delete_dir
.retrydel:
xor ecx, ecx
call delete_file_worker
jae @f
jp .retrydel
@@:
popad
ret
 
.delete_dir:
; recursive delete of directory
xor ebp, ebp ; ebp will contain number of undeletable items
.return_from_recursion:
mov ebx, dirinfo
mov [ebx+dirinfo.first-dirinfo], ebp
mov [ebx+dirinfo.size-dirinfo], del_dir_query_size
mov [ebx+dirinfo.dirdata-dirinfo], del_dir_query_area
mov [ebx+dirinfo.name-dirinfo], execdata
push 70
pop eax
int 0x40
; if we get read error, the best available action is try to delete directory itself
test eax, eax
jz @f
cmp eax, 6
jnz .do_delete_dir
@@:
; loop through a directory and delete items
mov edx, del_dir_query_area+32
imul ebx, 304
add ebx, edx
.delete_dir_entry_loop:
cmp edx, ebx
jae .delete_dir_entry_done
; ignore special entries "." and ".."
inc ebp
cmp word [edx+40], '.'
jz .delete_dir_entry_continue
cmp word [edx+40], '..'
jnz @f
cmp byte [edx+42], 0
jz .delete_dir_entry_continue
@@:
dec ebp
mov esi, execdata
@@:
lodsb
test al, al
jnz @b
mov byte [esi-1], '/'
mov edi, esi
lea esi, [edx+40]
@@:
cmp edi, execdataend
jae .fullname_big
lodsb
stosb
test al, al
jnz @b
test byte [edx], 10h
jnz .entry_is_folder
.retry2:
xor ecx, ecx
call delete_file_worker
ja .cancel
jz .skip
jp .retry2
jmp .restore_name
.entry_is_folder:
; allocate new item in directory stack
mov eax, [del_dir_stack_ptr]
mov [eax], ebp
add eax, 4
mov [del_dir_stack_ptr], eax
; do recursive deleting
jmp .delete_dir
.fullname_big:
; we will just ignore such files and continue - in real life this situation can not happen
inc ebp
mov esi, execdataend-1
jmp .do_restore_name
.skip:
inc ebp
.restore_name:
mov esi, execdata
@@:
lodsb
test al, al
jnz @b
dec esi
dec esi
.do_restore_name:
std
@@:
lodsb
cmp al, '/'
jnz @b
cld
mov byte [esi+1], 0
.delete_dir_entry_continue:
add edx, 304
jmp .delete_dir_entry_loop
.delete_dir_entry_done:
.do_delete_dir:
mov cl, 1
call delete_file_worker
ja .cancel
jz @f
jp .delete_dir
@@:
; al=0 - OK, al=2 - skip this directory
; return to previous directory
; pop item from directory stack
mov ecx, [del_dir_stack_ptr]
cmp ecx, del_dir_stack
jbe .done
sub ecx, 4
mov [del_dir_stack_ptr], ecx
mov ebp, [ecx]
cmp al, 2
sbb ebp, -1
; restore prev directory name
mov esi, execdata
@@:
lodsb
test al, al
jnz @b
dec esi
dec esi
std
@@:
lodsb
cmp al, '/'
jnz @b
cld
mov byte [esi+1], 0
jmp .return_from_recursion
.done:
.cancel:
mov [dirinfo.first], 0 ; do not destroys flags
popad
ret
/programs/fs/kfar/trunk/font.inc
22,27 → 22,111
end virtual
 
font:
macro set_name_test a,b
{
if %=a
font_data_#a = b
end if
}
macro set_name b
{
set_name_test 1,b
set_name_test 2,b
set_name_test 3,b
set_name_test 4,b
set_name_test 5,b
set_name_test 6,b
set_name_test 7,b
set_name_test 8,b
set_name_test 9,b
set_name_test 10,b
set_name_test 11,b
set_name_test 12,b
set_name_test 13,b
set_name_test 14,b
set_name_test 15,b
set_name_test 16,b
}
macro db_name_test a
{
if %=a
db font_data_#a
end if
}
macro db_name
{
db_name_test 1
db_name_test 2
db_name_test 3
db_name_test 4
db_name_test 5
db_name_test 6
db_name_test 7
db_name_test 8
db_name_test 9
db_name_test 10
db_name_test 11
db_name_test 12
db_name_test 13
db_name_test 14
db_name_test 15
db_name_test 16
}
macro dw_name_test a
{
if %=a
dw font_data_#a
end if
}
macro dw_name
{
dw_name_test 1
dw_name_test 2
dw_name_test 3
dw_name_test 4
dw_name_test 5
dw_name_test 6
dw_name_test 7
dw_name_test 8
dw_name_test 9
dw_name_test 10
dw_name_test 11
dw_name_test 12
dw_name_test 13
dw_name_test 14
dw_name_test 15
dw_name_test 16
}
repeat font_height
cur_scan = %
repeat 256
repeat 16
virtual at 0
a2 = (font_width+14) shr 3
if cur_scan=1 & %=0x10
a2 = (font_width+7) shr 3
end if
file fontname:3Eh + font_bmp_scanline*(font_height*(16-((%-1) shr 4))-cur_scan) + ((((%-1) and 0xF)*font_width) shr 3), a2
file fontname:3Eh + font_bmp_scanline*(font_height*(17-%)-cur_scan), font_width*2
dd 0
load a1 dword from 0
repeat 16
load a1 dword from ((%-1)*font_width) shr 3
a1 = ((a1 and 0x55555555) shl 1) or ((a1 and 0xAAAAAAAA) shr 1)
a1 = ((a1 and 0x33333333) shl 2) or ((a1 and 0xCCCCCCCC) shr 2)
a1 = ((a1 and 0x0F0F0F0F) shl 4) or ((a1 and 0xF0F0F0F0) shr 4)
end virtual
a1 = (a1 shr (((%-1)*font_width) and 7)) and ((1 shl font_width) - 1)
a1 = a1 xor ((1 shl font_width) - 1)
set_name a1
end repeat
end virtual
if font_width > 8
dw a1
repeat 16
dw_name
end repeat
else
db a1
repeat 16
db_name
end repeat
end if
end repeat
end repeat
purge set_name_test
purge db_name_test
purge dw_name_test
purge set_name
purge db_name
purge dw_name
/programs/fs/kfar/trunk/kfar.asm
5,20 → 5,62
dd i_end
memsize dd mem
dd stacktop
dd 0, 0
dd 0, app_path
 
include 'lang.inc'
include 'font.inc'
include 'sort.inc'
include 'kglobals.inc'
include 'memalloc.inc'
include 'dialogs.inc'
include 'viewer.inc'
include 'tools.inc'
include 'filetool.inc'
 
start:
mov eax, mem
call mf_init
mov edi, tolower_table
push 'A'
pop ecx
xor eax, eax
@@:
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+'ð'], 'ñ'
push 68
pop eax
push 11
pop ebx
int 0x40
call init_console
call draw_window
push 66
27,29 → 69,13
pop ebx
mov ecx, ebx
int 40h ; set keyboard mode to scancodes
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
mov eax, 200
mov [panel1_nfa], eax
mov [panel2_nfa], eax
mov eax, 200*4 + 32 + 200*304
push eax
call mf_alloc
mov ecx, 200*4 + 32 + 200*304
call pgalloc
mov [panel1_files], eax
pop eax
call mf_alloc
call pgalloc
mov [panel2_files], eax
test eax, eax
jz exit
57,9 → 83,13
jz exit
mov [panel1_sortmode], 0 ; sort by name
mov [panel2_sortmode], 0
push 2 ; "á।­¨©" ä®à¬ â
pop eax
mov [panel1_colmode], eax
mov [panel2_colmode], eax
mov [num_screens], 1
mov eax, 8
call mf_alloc
mov ecx, 0x1000
call pgalloc
mov [screens], eax
test eax, eax
jz exit
66,14 → 96,154
mov ecx, panels_vtable
mov [eax], ecx
mov [active_screen_vtable], ecx
; load libini.obj and kfar.ini
mov eax, libini_name
mov esi, ini_import
push 2
pop ebp ; we use version 2 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
mov ecx, 0x1000
call xpgalloc
test eax, eax
jz .skip_assoc
@@:
mov edx, eax
push edx ecx
push ecx
push edx
push dword aAssociations
push dword app_path
call [ini.query_sec]
pop ecx edx
cmp eax, ecx
jbe @f
add ecx, ecx
call xpgrealloc
test eax, eax
jz .skip_assoc
jmp @b
@@:
cmp ecx, 0x1000
jbe @f
mov ecx, eax
call xpgrealloc ; must succeed, because we decrease size
mov edx, eax
@@:
mov [associations], edx
xor ebp, ebp
xor esi, esi
.skip_assoc:
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
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 .skip_assoc
mov esi, FolderShortcuts
mov ecx, 10
dec ebp
.l3:
lodsd
test eax, eax
jz @f
add [esi-4], ebp
@@:
loop .l3
.skip_shortcuts:
.noini:
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_data
call calc_colwidths
call read_folder
call draw_panel
mov [bSilentFolderMode], 1
mov ebp, panel2_data
call calc_colwidths
call read_folder
call draw_panel
event:
196,6 → 366,9
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
414,28 → 587,37
ret
 
new_screen:
call xmalloc
; 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 ebx, [num_screens]
inc ebx
shl ebx, 3
mov eax, [screens]
call xrealloc
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 eax, ebp
call mf_free
mov ecx, ebp
call pgfree
xor eax, eax
ret
@@:
mov [screens], eax
.norealloc:
inc [num_screens]
mov [eax+ebx-8], edx
mov [eax+ebx-4], ebp
mov [eax+ecx-8], edx
mov [eax+ecx-4], ebp
mov eax, [num_screens]
dec eax
mov [active_screen], eax
465,12 → 647,16
add ecx, ecx
rep movsd
dec [num_screens]
mov ebx, [num_screens]
shl ebx, 3
mov eax, [screens]
call mf_realloc ; must succeed, because we decrease size
pop eax
call mf_free
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
and [active_screen], 0
 
change_screen:
491,7 → 677,8
add eax, 8
mov esi, eax
mul [num_screens]
call xmalloc
mov ecx, eax
call xpgalloc
test eax, eax
jnz @f
ret
553,7 → 740,7
mul esi
add eax, ebx
push 1
push aScreens
push dword aScreens
push eax
call menu
cmp eax, -1
562,8 → 749,8
div esi
mov [active_screen], eax
@@:
mov eax, ebx
call mf_free
mov ecx, ebx
call pgfree
jmp change_screen
 
panels_OnKey:
587,10 → 774,38
; call draw_panel
; ret
jmp draw_panel
.insert:
lea eax, [ecx*4]
add eax, [ebp + panel1_files - panel1_data]
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 + panel1_selected_size - panel1_data], edx
sbb dword [ebp + panel1_selected_size+4 - panel1_data], eax
dec [ebp + panel1_selected_num - panel1_data]
jmp .insert.down
.insert.increase:
add dword [ebp + panel1_selected_size - panel1_data], edx
adc dword [ebp + panel1_selected_size+4 - panel1_data], eax
inc [ebp + panel1_selected_num - panel1_data]
.insert.down:
inc ecx
cmp ecx, [ebp + panel1_numfiles - panel1_data]
jae .done_redraw
jmp @f
.down:
inc ecx
cmp ecx, [ebp + panel1_numfiles - panel1_data]
jae .ret
@@:
mov [ebp + panel1_index - panel1_data], ecx
cmp ecx, ebx
jb .done_redraw
599,22 → 814,45
mov [ebp + panel1_start - panel1_data], ecx
jmp .done_redraw
.left:
jecxz .ret
sub ecx, [ebp + panel1_colsz - panel1_data]
test ecx, ecx
jnz @f
ret
@@:
mov eax, [ebp + panel1_colsz - panel1_data]
sub ecx, eax
jae @f
xor ecx, ecx
@@:
mov [ebp + panel1_index - panel1_data], ecx
.finalize_left:
cmp ecx, edx
jae .done_redraw
sub edx, [ebp + panel1_colsz - panel1_data]
sub edx, eax
jae @f
xor edx, edx
@@:
mov [ebp + panel1_start - panel1_data], edx
jmp .done_redraw
.pgup:
mov eax, [ebp + panel1_colst - panel1_data]
dec eax
jnz @f
inc eax
@@:
test ecx, ecx
jnz @f
ret
@@:
sub ecx, eax
jae @f
xor ecx, ecx
@@:
mov [ebp + panel1_index - panel1_data], ecx
dec ecx
jmp .finalize_left
.right:
add ecx, [ebp + panel1_colsz - panel1_data]
mov eax, [ebp + panel1_colsz - panel1_data]
add ecx, eax
cmp ecx, [ebp + panel1_numfiles - panel1_data]
jb @f
mov ecx, [ebp + panel1_numfiles - panel1_data]
621,9 → 859,10
dec ecx
@@:
mov [ebp + panel1_index - panel1_data], ecx
.finalize_right:
cmp ecx, ebx
jb .done_redraw
add ebx, [ebp + panel1_colsz - panel1_data]
add ebx, eax
cmp ebx, [ebp + panel1_numfiles - panel1_data]
jbe @f
mov ebx, [ebp + panel1_numfiles - panel1_data]
634,6 → 873,21
@@:
mov [ebp + panel1_start - panel1_data], ebx
jmp .done_redraw
.pgdn:
mov eax, [ebp + panel1_colst - panel1_data]
dec eax
jnz @f
inc eax
@@:
add ecx, eax
cmp ecx, [ebp + panel1_numfiles - panel1_data]
jb @f
mov ecx, [ebp + panel1_numfiles - panel1_data]
dec ecx
@@:
mov [ebp + panel1_index - panel1_data], ecx
inc ecx
jmp .finalize_right
.tab:
xor [active_panel], panel1_data xor panel2_data
call draw_cmdbar
661,12 → 915,28
jnz .enter_folder
call find_extension
jc .run_app
jnz .run_app
.run_association:
mov eax, [edi+4]
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], eax
mov [execptr], edi
jmp .dorun
.run_app:
mov [execptr], execdata
699,7 → 969,14
xor edx, edx
cmp [execparams], edx
jz .nofasm
cmp [execptr], fasm
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
749,13 → 1026,19
push 70
pop eax
int 40h
xor esi, esi
xchg esi, [restore_semicolon]
test esi, esi
jz @f
mov byte [esi], ';'
@@:
neg eax
js @f
push aContinue
push dword aContinue
mov esi, esp
call get_error_msg
push eax
push aRunError
push dword aRunError
mov eax, esp
push esi
push 1
763,7 → 1046,7
push 2
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 3*4
ret
784,8 → 1067,14
pop esi
.bigfilename:
mov eax, aFileNameTooBig
.l2:
xor esi, esi
xchg esi, [restore_semicolon]
test esi, esi
jz @f
mov byte [esi], ';'
@@:
push aContinue
push dword aContinue
mov esi, esp
push eax
mov eax, esp
795,21 → 1084,21
push 1
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 2*4
ret
.bigcmdline:
mov eax, aCmdLineTooBig
jmp @b
jmp .l2
.bigfoldername2:
mov byte [ecx], 0
.bigfoldername:
mov eax, aFolderNameTooBig
jmp @b
jmp .l2
.copytoself:
mov eax, aCannotCopyToSelf
jmp @b
jmp .l2
.enter_folder:
lea esi, [ecx+40]
cmp word [esi], '..'
940,6 → 1229,7
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
965,17 → 1255,20
mov ebx, dirinfo
test eax, eax
jnz .drive_loop_i_done
mov eax, 32+8
call xmalloc
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
jz .drive_loop_i_done
jecxz @f
mov [ecx], eax
jnz @f
pop eax
ret
@@:
and dword [eax], 0
mov [eax+4], ecx
mov ecx, eax
lea edi, [eax+8]
lea edi, [edx+ecx-32]
mov esi, tmpname
@@:
lodsb
1000,6 → 1293,20
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 + panel1_dir - panel1_data]
.find_cur_drive_loop:
push edi
1013,12 → 1320,13
inc edi
jmp @b
@@:
cmp dword [ecx+4], 0
cmp dword [ecx], 0
jz @f
pop edi
mov ecx, [ecx+4]
mov ecx, [ecx]
jmp .find_cur_drive_loop
@@:
mov ecx, edx
.cur_drive_found:
pop edi
push 1
1049,17 → 1357,8
stosb
test al, al
jnz @b
@@:
cmp dword [ecx+4], 0
jz @f
mov ecx, [ecx+4]
jmp @b
@@:
mov eax, ecx
mov ecx, [ecx]
call mf_free
test ecx, ecx
jnz @b
mov ecx, edx
call pgfree
call read_folder
jmp .done_redraw
.shift_f5:
1317,17 → 1616,17
cmp eax, 6
jz .copyreadok
push esi
push aCannotReadFile
push dword aCannotReadFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push dword RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 3*4
test eax, eax
1347,17 → 1646,17
test eax, eax
jz .copywriteok
push edi
push aCannotWriteFile
push dword aCannotWriteFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push dword RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 3*4
test eax, eax
1381,15 → 1680,15
jz @f
cmp [writeinfo.code], 2
jz .copydone
push aIncompleteFile
push dword aIncompleteFile
mov eax, esp
push DeleteOrKeepBtn
push dword DeleteOrKeepBtn
push 2
push eax
push 1
push -1
push -1
push aCopyCaption
push dword aCopyCaption
call SayErr
add esp, 4
test eax, eax
1409,13 → 1708,83
call view_file
.ret2:
ret
.f8_has_selected:
mov edi, saved_file_name+511
mov byte [edi], 0
mov eax, [ebp + panel1_selected_num - panel1_data]
if lang eq 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 -1
push -1
push aDeleteCaption
call Message
add esp, 8
test eax, eax
jnz .ret2
mov [del_bSkipAll], 0
mov ecx, [ebp + panel1_numfiles - panel1_data]
jecxz .ret2
mov esi, [ebp + panel1_files - panel1_data]
.f8_loop:
lodsd
test byte [eax+303], 1
jz @f
call delete_file
ja .f8_multiple_cancel
@@:
loop .f8_loop
.f8_multiple_cancel:
jmp .ctrl_r
.f8:
cmp [ebp + panel1_selected_num - panel1_data], 0
jnz .f8_has_selected
call get_curfile_folder_entry
cmp [bConfirmDelete], 0
jz .f8_allowed
mov ebx, f8_confirm_dlgdata
lea eax, [ecx+40]
push eax
mov esi, aConfirmDeleteText
mov edi, aConfirmDeleteTextBuf
push edi
@@:
lodsb
stosb
1431,93 → 1800,23
stosb
test al, al
jnz @b
lea esi, [ecx+40]
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.name], esi
or eax, -1
@@:
inc eax
cmp byte [eax+esi], 0
jnz @b
sub edi, aConfirmDeleteTextBuf+1
cmp eax, edi
jae @f
mov eax, edi
@@:
inc eax
inc eax
mov edx, [cur_width]
sub edx, 8
cmp eax, edx
jbe @f
mov eax, edx
@@:
mov [ebx + dlgtemplate.width], eax
dec eax
dec eax
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.width2], eax
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.width3], eax
shr eax, 1
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.del_x2], eax
sub eax, aDeleteLength-1
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.del_x1], eax
add eax, aDeleteLength
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x1], eax
add eax, aCancelLength - 1
mov [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.cnl_x2], eax
or byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags1], 4
and byte [ebx - f8_confirm_dlgdata + f8_confirm_dlgdata.flags2], not 4
push ebx
call DialogBox
cmp eax, f8_confirm_dlgdata.del_btn
jnz .ret2
.f8_allowed:
lea esi, [ebp + panel1_dir - panel1_data]
mov edi, execdata
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
lea esi, [ecx+40]
mov al, '/'
stosb
@@:
lodsb
cmp edi, execdataend
jae .bigfilename
stosb
test al, al
jnz @b
.retrydel:
push 70
pop eax
mov ebx, delinfo
int 0x40
test eax, eax
jz .ctrl_r
push execdata
push aCannotDeleteFolder
call get_curfile_folder_entry
test byte [ecx], 10h
jnz @f
mov dword [esp], aCannotDeleteFile
@@:
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push DeleteOrCancelBtn
push 2
push eax
push 3
push 2
push -1
push -1
push aError
call SayErr
add esp, 3*4
push aDeleteCaption
call Message
add esp, 8
test eax, eax
jz .retrydel
jz .f8_allowed
ret
.f8_allowed:
mov [del_bSkipAll], 0
mov eax, ecx
call delete_file
.ctrl_r:
; Rescan panel
; call read_folder
1589,11 → 1888,25
@@:
call find_extension
jc .menuret
jnz .menuret
; known extension
mov ebx, [edi+8]
test ebx, ebx
@@:
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
1605,34 → 1918,91
mov cl, 15
@@:
xor edx, edx
xor ebp, ebp
push edx
.menucreateloop:
mov eax, [ebx]
test eax, eax
jz .menucreated
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
cmp byte [eax-1], 0
jnz @b
sub eax, [ebx]
jmp @b
@@:
mov byte [eax], 0
push eax
sub eax, saved_file_name-1
cmp eax, ecx
ja @f
mov eax, ecx
@@:
add eax, 12
call xmalloc
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
add eax, 4
@@:
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 [eax+4], edx
mov edx, eax
push esi
mov esi, [ebx+4]
mov [eax-4], esi
mov esi, [ebx]
push esi edi
mov esi, saved_file_name
lea edi, [eax+8]
@@:
lodsb
1639,7 → 2009,8
stosb
test al, al
jnz @b
sub esi, [ebx]
push esi
sub esi, saved_file_name
sub esi, ecx
jae .menunoadd
neg esi
1650,36 → 2021,50
jnz @b
.menunoadd:
pop esi
add ebx, 8
jmp .menucreateloop
@@:
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
jz .menuret_free
and dword [edx], 0
pop edx
mov ecx, edx
add [ecx], edx
@@:
cmp dword [edx+4], 0
mov ecx, [ecx]
cmp dword [ecx], 0
jz @f
mov edx, [edx+4]
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
push dword [eax-4]
jz .menuret_free
lea edi, [eax+8]
@@:
test edx, edx
jz @f
lea eax, [edx-4]
mov edx, [edx]
call mf_free
jmp @b
@@:
pop eax
inc edi
cmp byte [edi-1], 0
jnz @b
mov ebp, [active_panel]
call get_curfile_folder_entry
jmp .run_association2
call .run_association2
.menuret_free:
pop ecx
jmp pgfree
.f7:
mov dword [CopyDestEditBuf], CopyDestEditBuf.length
and dword [CopyDestEditBuf+4], 0
1758,18 → 2143,18
int 0x40
test eax, eax
jz @f
push CopyDestEditBuf+12
push aCannotMakeFolder
push dword CopyDestEditBuf+12
push dword aCannotMakeFolder
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push dword RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 3*4
test eax, eax
1776,24 → 2161,143
jz .mkdir_retry
@@:
jmp .copydone
.change_mode:
dec eax
mov [ebp + panel1_colmode - panel1_data], 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
@@:
lea esi, [ebp + panel1_dir - panel1_data]
push eax 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.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 + panel1_numfiles - panel1_data]
mov ebx, [ebp + panel1_files - panel1_data]
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 + panel1_selected_size - panel1_data], eax
mov eax, [esi+36]
sbb dword [ebp + panel1_selected_size+4 - panel1_data], eax
dec dword [ebp + panel1_selected_num - panel1_data]
jmp @f
.doselect:
test byte [esi+303], 1
jnz @f
or byte [esi+303], 1
add dword [ebp + panel1_selected_size - panel1_data], eax
mov eax, [esi+36]
adc dword [ebp + panel1_selected_size+4 - panel1_data], eax
inc dword [ebp + panel1_selected_num - panel1_data]
@@:
add ebx, 4
dec ecx
jnz .selectloop
pop eax
jmp .done_redraw
 
panels_OnRedraw:
call draw_cmdbar
mov ebp, panel1_data
call calc_colwidths
call draw_panel
mov ebp, panel2_data
call calc_colwidths
call draw_panel
ret
 
init_console:
mov eax, [console_data_ptr]
call mf_free
mov ecx, [console_data_ptr]
call pgfree
mov eax, [cur_width]
mul [cur_height]
mov ecx, eax
add eax, eax
add eax, eax
call mf_alloc
push ecx
shl ecx, 2
call pgalloc
pop ecx
test eax, eax
jz exit
mov [console_data_ptr], eax
1963,7 → 2467,6
@@:
cmp [fill_height], 0
jz @f
mov al, 13
xor edx, edx
mov ebx, 50000h
mov bx, word [wnd_width]
1977,15 → 2480,21
@@:
; xor ecx, ecx
; call draw_image
and [min_x], 0
and [min_y], 0
mov eax, [cur_width]
dec eax
mov [max_x], eax
mov eax, [cur_height]
dec eax
mov [max_y], eax
call draw_image.force
mov al, 65
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, 12
push 2
pop ebx
2012,159 → 2521,121
ret
 
draw_image:
; determine draw rectangle
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:
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]
xor eax, eax
xor edx, edx
mov ecx, [cur_height]
.lh:
push ecx
mov ecx, [cur_width]
imul ecx, [cur_height]
.m1:
mov bx, [esi]
cmp bx, [esi+ecx*2]
jz .m2
cmp eax, [min_x]
ja @f
mov [min_x], eax
.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
@@:
cmp eax, [max_x]
jb @f
mov [max_x], eax
@@:
cmp edx, [min_y]
jae @f
mov [min_y], edx
@@:
mov [max_y], edx
.m2:
add esi, 2
inc eax
cmp eax, [cur_width]
jb .m1
xor eax, eax
inc edx
cmp edx, [cur_height]
jb .m1
mov eax, [cursor_x]
cmp eax, -1
jz .m3
cmp eax, [min_x]
mov [eax*2+esi], bx
cmp ecx, [min_x]
ja @f
mov [min_x], eax
mov [min_x], ecx
@@:
cmp eax, [max_x]
cmp ecx, [max_x]
jb @f
mov [max_x], eax
mov [max_x], ecx
@@:
mov edx, [cursor_y]
cmp edx, [min_y]
ja @f
mov [min_y], edx
@@:
cmp edx, [max_y]
mov eax, [esp+4]
mov [min_y], eax
cmp eax, [max_y]
jb @f
mov [max_y], edx
mov [max_y], eax
@@:
.m3:
xchg eax, [old_cursor_x]
xchg edx, [old_cursor_y]
cmp eax, -1
jz .m4
cmp eax, [min_x]
ja @f
mov [min_x], eax
@@:
cmp eax, [max_x]
jb @f
mov [max_x], eax
@@:
cmp edx, [min_y]
ja @f
mov [min_y], edx
@@:
cmp edx, [max_y]
jb @f
mov [max_y], edx
@@:
.m4:
cmp [min_y], -1
jz .nodraw
.force:
; allocate memory for image
mov ecx, [max_x]
sub ecx, [min_x]
inc ecx
mov [used_width], ecx
mov edx, [max_y]
sub edx, [min_y]
inc edx
mov [used_height], edx
imul ecx, edx
imul ecx, font_width*font_height
add ecx, [heapend]
push 64
pop eax
push 1
pop ebx
int 0x40
test eax, eax
jnz draw_image.nomem
mov edi, [heapend]
mov esi, [console_data_ptr]
mov eax, [min_y]
imul eax, [cur_width]
add eax, [min_x]
lea esi, [esi+eax*2]
mov ecx, [used_height]
.lh:
push ecx esi
mov ecx, [used_width]
.lw:
push ecx
mov ebx, [esi]
mov eax, [cur_width]
imul eax, [cur_height]
mov [eax*2+esi], bx
movzx eax, bl
push edi
movzx ebx, bh
mov ebp, ebx
shr ebp, 4
and ebx, 0xF
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
add esi, 2
lodsb
inc esi
if font_width > 8
lea edx, [eax+eax+font]
else
lea edx, [eax+font]
end if
mov ecx, font_height
.sh:
push ecx edx edi
xor ecx, ecx
mov edx, [edx]
.sw:
shr edx, 1
mov ecx, [edx]
repeat font_width
shr ecx, 1
sbb eax, eax
and eax, ebx
add eax, ebp
mov [edi], al
add ecx, 1
add edi, 1
cmp ecx, font_width
jb .sw
pop edi edx ecx
mov eax, [used_width]
imul eax, font_width
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
loop .sh
jb .sh
pop edi
.skip_symbol:
pop ecx
2171,12 → 2642,10
add edi, font_width
dec ecx
jnz .lw
mov eax, [used_width]
mov eax, [cur_width]
imul eax, (font_height-1)*font_width
add edi, eax
pop esi ecx
add esi, [cur_width]
add esi, [cur_width]
pop ecx
dec ecx
jnz .lh
; cursor
2183,16 → 2652,14
mov eax, [cursor_y]
inc eax
jz .nocursor
sub eax, [min_y]
mul [used_width]
mul [cur_width]
imul eax, font_height*font_width
mov edx, [cursor_x]
sub edx, [min_x]
inc edx
imul edx, font_width
add eax, edx
add eax, [heapend]
mov edx, [used_width]
add eax, [MemForImage]
mov edx, [cur_width]
imul edx, font_width
neg edx
mov ecx, (font_height*15+50)/100
2210,31 → 2677,44
pop ecx
loop .cursor_loop
.nocursor:
mov ecx, [used_width]
imul ecx, font_width*65536
mov cx, word [used_height]
imul cx, font_height
mov edx, [min_x]
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
add edx, 5
mov eax, edx
shl edx, 16
mov dx, word [min_y]
imul dx, font_height
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 65
pop eax
mov ebx, [heapend]
mov edi, console_colors
push 8
pop esi
mov edi, console_colors
xor ebp, ebp
int 0x40
push 64
pop eax
push 1
pop ebx
mov ecx, [heapend]
int 0x40
int 40h
.nodraw:
ret
 
2419,6 → 2899,60
stosw
ret
 
calc_colwidths:
; in: ebp->panel data
imul esi, [ebp + panel1_colmode - panel1_data], 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 + panel1_colwidths - panel1_data]
test ebx, ebx
jz .loop2
mov eax, [ebp + panel1_width - panel1_data]
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
 
draw_panel:
mov eax, [ebp + panel1_left - panel1_data]
mov edx, [ebp + panel1_top - panel1_data]
2442,27 → 2976,43
rep stosw
mov al, 0xB6
stosw
mov eax, [ebp + panel1_width - panel1_data]
sub eax, 3
shr eax, 1
mov [column_width], eax
 
imul esi, [ebp + panel1_colmode - panel1_data], PanelMode.size
add esi, colmodes
lodsd
mov ecx, eax ; number of columns
lea ebx, [ebp + panel1_colwidths - panel1_data]
mov eax, [ebp + panel1_left - panel1_data]
inc eax
mov [column_left], eax
add eax, [column_width]
mov eax, [ebp + panel1_top - panel1_data]
inc eax
mov [column_top], eax
mov eax, [ebp + panel1_height - panel1_data]
sub eax, 4
mov [column_height], eax
dec eax
mov [ebp + panel1_colsz - panel1_data], eax
and [ebp + panel1_colst - panel1_data], 0
mov eax, [ebp + panel1_start - panel1_data]
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 + panel1_top - panel1_data]
inc edx
mov [column_top], edx
dec edx
call get_console_ptr
mov ah, [panel_border_color]
mov ah, [panel_header_color]
mov al, 0xD1
mov [edi], ax
add edi, [cur_width]
add edi, [cur_width]
mov ecx, [ebp + panel1_height - panel1_data]
sub ecx, 4
mov [column_height], ecx
mov ecx, [column_height]
mov al, 0xB3
@@:
mov [edi], ax
2471,22 → 3021,60
loop @b
mov al, 0xC1
stosw
mov eax, [column_height]
dec eax
mov [ebp + panel1_colsz - panel1_data], eax
add eax, eax
mov [ebp + panel1_colst - panel1_data], eax
mov eax, [ebp + panel1_start - panel1_data]
mov [column_index], eax
call draw_column
mov eax, [ebp + panel1_width - panel1_data]
sub eax, 3
.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]
sub eax, ecx
mov [column_width], eax
@@:
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
add [column_left], ecx
call draw_column
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 + panel1_dir - panel1_data]
mov edi, cur_header
2555,9 → 3143,68
movzx eax, [ebp + panel1_sortmode - panel1_data]
mov al, [compare_names+eax]
stosb
mov eax, [ebp + panel1_selected_num - panel1_data]
test eax, eax
jz .skip_selected_info
; ˆ­ä®à¬ æ¨ï ® ¢ë¤¥«¥­­ëå ä ©« å
push dword [ebp + panel1_selected_size+4 - panel1_data]
push dword [ebp + panel1_selected_size - panel1_data]
call fill_total_info
mov eax, [ebp + panel1_width - panel1_data]
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 + panel1_left - panel1_data]
mov edx, [ebp + panel1_top - panel1_data]
add edx, [ebp + panel1_height - panel1_data]
sub edx, 3
call get_console_ptr
mov ah, [panel_numselected_color]
@@:
lodsb
stosw
loop @b
.skip_selected_info:
; ˆ­ä®à¬ æ¨ï ®¡ ®¡é¥¬ ç¨á«¥ ¨ à §¬¥à¥ ä ©«®¢ ¯ ­¥«¨
mov eax, [ebp + panel1_total_num - panel1_data]
push dword [ebp + panel1_total_size+4 - panel1_data]
push dword [ebp + panel1_total_size - panel1_data]
call fill_total_info
mov eax, [ebp + panel1_width - panel1_data]
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 + panel1_left - panel1_data]
add edx, [ebp + panel1_top - panel1_data]
add edx, [ebp + panel1_height - panel1_data]
dec edx
mov esi, edi
call get_console_ptr
mov ah, [panel_number_color]
@@:
lodsb
stosw
loop @b
cmp [ebp + panel1_numfiles - panel1_data], 0
jz .skip_curinfo
; ˆ­ä®à¬ æ¨ï ® ¢ë¡à ­­®¬ ä ©«¥
; ˆ­ä®à¬ æ¨ï ® ⥪ã饬 ä ©«¥
mov ebx, [ebp + panel1_index - panel1_data]
mov eax, [ebp + panel1_files - panel1_data]
mov ebx, [eax+ebx*4]
2572,6 → 3219,8
mov ecx, [ebp + panel1_width - panel1_data]
dec ecx
dec ecx
cmp [ebp + panel1_colmode - panel1_data], 3
jz .show_curname
; ‚à¥¬ï ¬®¤¨ä¨ª æ¨¨
sub edi, 5*2
sub ecx, 6
2702,6 → 3351,7
jnz .size_num
.size_done:
cld
.show_curname:
; ˆ¬ï
sub edi, ecx
sub edi, ecx
2735,52 → 3385,115
call draw_image
ret
 
draw_column:
mov eax, [column_left]
mov edx, [column_top]
call get_console_ptr
; § £®«®¢®ª á⮫¡æ 
push edi
mov ah, [column_header_color]
mov al, ' '
mov ecx, [column_width]
fill_total_info:
mov edi, saved_file_name+511
mov byte [edi], ' '
if lang eq ru
sub ecx, 3
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
sub ecx, 4
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
shr ecx, 1
rep stosw
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
mov al, 'ˆ'
stosw
mov al, '¬'
stosw
mov al, 'ï'
stosw
mov dword [edi-4], 'â ¢ '
mov dword [edi-8], ' ¡ ©'
sub edi, 8
else
mov al, 'N'
stosw
mov al, 'a'
stosw
mov al, 'm'
stosw
mov al, 'e'
stosw
mov dword [edi-4], ' in '
mov dword [edi-8], 'ytes'
mov word [edi-10], ' b'
sub edi, 10
end if
mov al, ' '
mov ecx, [column_width]
if lang eq ru
sub ecx, 2
else
sub ecx, 3
end if
shr ecx, 1
rep stosw
pop edi
add edi, [cur_width]
add edi, [cur_width]
; ä ©«ë
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
 
get_file_color:
mov ah, [esi + 6]
cmp ebp, [active_panel]
jnz @f
cmp ecx, [ebp + panel1_index - panel1_data]
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 + panel1_index - panel1_data]
jnz @f
mov ah, [esi + 5]
@@:
ret
 
draw_name_column:
mov eax, [column_index]
mov [last_column_index], eax
mov edx, [ebp + panel1_numfiles - panel1_data]
mov ecx, [column_height]
dec ecx
2788,18 → 3501,12
cmp [column_index], edx
jae .ret
push ecx
mov esi, [column_index]
mov ecx, [ebp + panel1_files - panel1_data]
mov esi, [ecx+esi*4]
mov ecx, [column_index]
mov esi, [ebp + panel1_files - panel1_data]
mov esi, [esi+ecx*4]
mov ebx, [esi]
call get_file_color
add esi, 40
mov ah, [esi - 40 + 5]
cmp ebp, [active_panel]
jnz @f
mov ecx, [column_index]
cmp ecx, [ebp + panel1_index - panel1_data]
jnz @f
mov ah, [esi - 40 + 6]
@@:
mov ecx, [column_width]
push edi
@@:
2808,12 → 3515,68
jz @f
stosw
loop @b
cmp byte [esi], 0
lodsb
test al, al
jz @f
mov byte [edi], '}'
jmp .continue
@@:
test bl, 10h
jnz .noalignext
mov ebx, [ebp + panel1_colmode - panel1_data]
; 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]
2822,6 → 3585,8
dec ecx
jnz .l
.ret:
mov eax, [ebp + panel1_colsz - panel1_data]
add [ebp + panel1_colst - panel1_data], eax
cmp ebp, panel1_data
jnz .ret2
; —¨á«® íªà ­®¢
2855,8 → 3620,269
mov ah, [panel_nscreens_color]
stosw
.ret2:
draw_empty_column:
ret
 
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 + panel1_numfiles - panel1_data]
cmp [last_column_index], edx
jae .ret
push ecx
push edi
mov ecx, [last_column_index]
mov esi, [ebp + panel1_files - panel1_data]
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
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
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
 
draw_date_column:
mov ecx, [column_height]
dec ecx
push [last_column_index]
.l:
mov edx, [ebp + panel1_numfiles - panel1_data]
cmp [last_column_index], edx
jae .ret
push ecx
push edi
mov ecx, [last_column_index]
mov esi, [ebp + panel1_files - panel1_data]
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
 
draw_time_column:
mov ecx, [column_height]
dec ecx
push [last_column_index]
.l:
mov edx, [ebp + panel1_numfiles - panel1_data]
cmp [last_column_index], edx
jae .ret
push ecx
push edi
mov ecx, [last_column_index]
mov esi, [ebp + panel1_files - panel1_data]
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
2899,6 → 3925,13
mov [dirinfo.dirdata], eax
lea eax, [ebp + panel1_dir - panel1_data]
mov [dirinfo.name], eax
xor eax, eax
mov [ebp + panel1_total_num - panel1_data], eax
mov dword [ebp + panel1_total_size - panel1_data], eax
mov dword [ebp + panel1_total_size+4 - panel1_data], eax
mov [ebp + panel1_selected_num - panel1_data], eax
mov dword [ebp + panel1_selected_size - panel1_data], eax
mov dword [ebp + panel1_selected_size+4 - panel1_data], eax
.retry:
push 70
pop eax
2911,12 → 3944,12
; Failed to read folder, notify user
cmp [bSilentFolderMode], 0
jnz .dont_notify
push aContinue
push aRetry
push dword aContinue
push dword aRetry
mov edx, esp
call get_error_msg
push [dirinfo.name]
push aCannotReadFolder
push dword aCannotReadFolder
push eax
mov eax, esp
push edx
2925,7 → 3958,7
push 3
push -1
push -1
push aError
push dword aError
call SayErr
add esp, 5*4
test eax, eax
2984,17 → 4017,16
mov eax, [dirinfo.dirdata]
cmp [eax+8], ebx
jz .readdone
push eax
mov eax, [ebp + panel1_files - panel1_data]
call mf_free
pop eax
mov eax, [eax+8]
add eax, 0xF
and eax, not 0xF
push eax
imul eax, 4+304
add eax, 32
call xmalloc
push dword [eax+8]
mov ecx, [ebp + panel1_files - panel1_data]
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
3021,6 → 4053,7
jz .loopcont
test byte [eax], 8
jnz .loopcont
mov byte [eax+303], 0
test edx, edx
jnz .nodotdot
cmp word [eax+40], '..'
3043,6 → 4076,14
jmp .dotdot
.nodotdot:
stosd
xor ebx, ebx
test byte [eax], 10h
setz bl
add [ebp + panel1_total_num - panel1_data], ebx
mov ebx, dword [eax+32]
add dword [ebp + panel1_total_size - panel1_data], ebx
mov ebx, dword [eax+36]
adc dword [ebp + panel1_total_size+4 - panel1_data], ebx
.dotdot:
; ¯®¤á¢¥âª 
; call insert_last_dot
3051,9 → 4092,10
lea esi, [ebp+40]
mov edi, lower_file_name
mov edx, edi
xor eax, eax
@@:
lodsb
call tolower
mov al, [tolower_table+eax]
stosb
test al, al
jnz @b
3075,13 → 4117,25
jnz @f
mov ah, [panel_normal_color]
@@:
mov [ebp+5], ah
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
3089,9 → 4143,13
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_cursor_color]
mov ah, [panel_selected_color]
mov [ebp+6], ah
mov ah, [panel_selected_cursor_color]
mov [ebp+7], ah
.doname:
; call delete_last_dot
popad
3112,9 → 4170,9
mov ecx, [ebp + panel1_numfiles - panel1_data]
jecxz .skip
mov eax, [edx]
cmp word [eax], '..'
cmp word [eax+40], '..'
jnz .nodotdot
cmp byte [eax+2], 0
cmp byte [eax+42], 0
jnz .nodotdot
dec ecx
add edx, 4
3869,24 → 4927,22
jmp .done_succ
end if
 
tolower:
cmp al, 'A'
jb @f
cmp al, 'Z'
ja @f
add al, ' '
@@: ret
;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
call tolower
mov ah, [edi]
xchg al, ah
call tolower
cmp ah, al
pop eax
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:
3903,6 → 4959,8
jz @f
cmp al, ','
jz @f
cmp al, ';'
jz @f
cmp al, '|'
jnz @b
@@:
3914,6 → 4972,8
jnc .found
cmp al, ','
jz .main_cycle
cmp al, ';'
jz .main_cycle
.done_fail:
stc
popa
3936,6 → 4996,8
test al, al
jz @f
cmp al, ','
jz @f
cmp al, ';'
jnz @b
@@:
dec esi
4079,23 → 5141,31
ret
.found_ext:
inc esi
mov edi, associations
@@:
mov edi, [associations]
.find_loop:
push esi edi
mov edi, [edi]
call strcmpi
pop edi esi
jz @f
add edi, 12
cmp edi, associations_end
jb @b
; unknown extension
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
; unknown extension
stc
.found:
pop esi
ret
 
header db 'Kolibri Far 0.21',0
header db 'Kolibri Far 0.32',0
 
nomem_draw db 'No memory for redraw.',0
.size = $ - nomem_draw
4121,8 → 5191,10
aScreens db 'Screens',0
end if
 
align 4
_10d dd 10
_100d dd 100
muldiv10 dd 429496729
_10 db 10
_100 db 100
 
4481,11 → 5553,13
 
cursor_x dd -1
cursor_y dd -1
old_cursor_x dd -1
old_cursor_y dd -1
cur_cursor_pos dd -1
old_cursor_pos dd -1
 
active_panel dd panel1_data
 
associations dd 0
 
console_colors dd 0x000000, 0x000080, 0x008000, 0x008080
dd 0x800000, 0x800080, 0x808000, 0xC0C0C0
dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF
4555,10 → 5629,14
encodings:
.cp866 = 0
.cp1251 = 1
.koi8r = 2
.unicode = 3
 
.names:
db 'cp866 '
db 'cp1251 '
db 'koi8-r '
db 'Unicode '
 
.tables:
; cp866 - trivial map
4570,7 → 5648,50
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
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
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
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
tabsize dd 8
 
4608,6 → 5729,10
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
4644,6 → 5769,24
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
db 0
 
viewer_ctrlkeys:
4679,6 → 5822,8
dd viewer_OnKey.f4
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
4753,11 → 5898,15
 
;  ­¥«ì
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:
4814,151 → 5963,71
; ”®à¬ â ®¯¨á ­¨ï £àã¯¯ë ¯®¤á¢¥âª¨:
virtual at 0
highlight:
.IncludeAttributes db ?
.NormalColor db ?
.CursorColor db ?
.IncludeAttributes db ?
.SelectedColor db ?
.SelectedCursorColor db ?
.Mask: ; ASCIIZ-string
end virtual
 
; all highlight masks must be in lowercase!
highlight_group0:
db 13h
db 38h
db 2
db 13h, 38h, 0, 0
db '*',0
highlight_group1:
db 13h
db 38h
db 4
db 13h, 38h, 0, 0
db '*',0
highlight_group2:
db 1Fh
db 3Fh
db 10h
db 1Fh, 3Fh, 0, 0
db '*|..',0
highlight_group3:
db 0
db 0
db 10h
db 0, 0, 0, 0
db '..',0
highlight_group4:
db 1Ah
db 3Ah
db 0
db 1Ah, 3Ah, 0, 0
db '*.exe,*.com,*.bat,*.cmd',0
highlight_group5:
db 1Ah
db 3Ah
db 0
db 1Ah, 3Ah, 0, 0
db '*|*.*',0
highlight_group6:
db 1Dh
db 3Dh
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 16h
db 36h
db 0
db 16h, 36h, 0, 0
db '*.bak,*.tmp',0
highlight_group8:
db 17h
db 37h
db 0
db 17h, 37h, 0, 0
db '*.asm,*.inc',0
highlight_group9:
db 1Fh
db 3Fh
db 10h
db 1Fh, 3Fh, 0, 0
db '*',0
 
associations:
dd aAsm, tinypad, AsmMenu
dd aInc, tinypad, 0
dd aTxt, tinypad, 0
dd aJpg, jpegview, 0
dd aJpeg, jpegview, 0
dd aGif, gifview, GifMenu
dd aWav, ac97, 0
dd aMp3, ac97, 0
dd aMid, midamp, 0
dd aBmp, mv, BmpMenu
dd aPng, archer, 0
dd aRtf, rtfread, 0
dd a3ds, view3ds, 0
dd aLif, life2, 0
associations_end:
 
aAsm db 'asm',0
aInc db 'inc',0
aTxt db 'txt',0
tinypad db '/rd/1/TinyPad',0
 
aJpg db 'jpg',0
aJpeg db 'jpeg',0
jpegview db '/rd/1/JpegView',0
 
aGif db 'gif',0
gifview db '/rd/1/GIFVIEW',0
 
aWav db 'wav',0
aMp3 db 'mp3',0
ac97 db '/rd/1/AC97SND',0
 
aMid db 'mid',0
midamp db '/rd/1/MIDAMP',0
 
aBmp db 'bmp',0
mv db '/rd/1/MV',0
 
aPng db 'png',0
archer db '/rd/1/@rcher',0
 
aRtf db 'rtf',0
rtfread db '/rd/1/RtfRead',0
 
a3ds db '3ds',0
view3ds db '/rd/1/3d/view3ds',0
 
aLif db 'lif',0
life2 db '/rd/1/demos/life2',0
 
AsmMenu:
dd aEdit, tinypad
dd aCompile, fasm
dd 0
BmpMenu:
dd aView, mv
dd aEdit, animage
dd 0
GifMenu:
dd aView, gifview
dd aEdit, animage
dd 0
 
if lang eq en
aView db '&View',0
aCompile db '&Compile',0
aEdit db '&Edit',0
else
aView db '&à®á¬®âà',0
aCompile db '&Š®¬¯¨«¨à®¢ âì',0
aEdit db '&¥¤ ªâ®à',0
end if
 
fasm db '/rd/1/develop/fasm',0
animage db '/rd/1/animage',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
MemForImage dd 0
restore_semicolon dd 0
bForHex db 0
 
align 4
; ‘®®¡é¥­¨¥ ® ®¡«®¬¥ ¯à¨ ¢ë¤¥«¥­¨¨ ¯ ¬ïâ¨
4986,54 → 6055,6
dd aOk
dd 0xD
 
f8_confirm_dlgdata:
dd 1
.x dd -1
.y dd -1
.width dd ?
.height dd 3
dd 4
dd 2
dd aDeleteCaption
.main_color db ?
.border_color db ?
.header_color db ?
db 0
dd 0
dd 0
dd 4
; áâப  "‚ë å®â¨â¥ 㤠«¨âì ..."
dd 1
dd 1,0
.width2 dd ?
dd 0
dd aConfirmDeleteTextBuf
dd 1
; áâப  á ¨¬¥­¥¬ ä ©« /¯ ¯ª¨
dd 1
dd 1,1
.width3 dd ?
dd 1
.name dd ?
dd 1
; ª­®¯ª  "㤠«¨âì"
.del_btn:
dd 2
.del_x1 dd ?
dd 2
.del_x2 dd ?
dd 2
dd aDelete
.flags1 dd 0xC
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 2
.cnl_x2 dd ?
dd 2
dd aCancel
.flags2 dd 8
 
; ¤¨ «®£ ª®¯¨à®¢ ­¨ï
copy_dlgdata:
dd 1
5124,6 → 6145,22
dd aCancelB
.flags2 dd 8
 
; ¤¨ «®£ ¢ë¤¥«¥­¨ï/á­ïâ¨ï
mark_dlgdata:
dd 1
dd -1, -1
dd 37, 1
dd 4, 2
.title dd ?
dd ?
dd 0, 0
dd 1
; ¯®«¥ । ªâ¨à®¢ ­¨ï
dd 3
dd 1, 0, 35, 0
dd enter_string_buf
.flags dd ?
 
RetryOrCancelBtn:
dd aRetry
dd a_Cancel
5133,6 → 6170,14
RetryOrIgnoreBtn:
dd aRetry
dd aIgnore
DeleteOrCancelBtn:
dd a_Delete
dd a_Cancel
DeleteErrorBtn:
dd aRetry
dd aSkip
dd aSkipAll
dd a_Cancel
 
if lang eq ru
aDeleteCaption db '“¤ «¥­¨¥',0
5140,10 → 6185,6
aDeleteFolder db '¯ ¯ªã',0
aConfirmDeleteTextMax = $ - aConfirmDeleteText - 2
aDeleteFile db 'ä ©«',0
aDelete db ' “¤ «¨âì ',0
aDeleteLength = $ - aDelete - 1
aCancel db ' Žâ¬¥­¨âì ',0
aCancelLength = $ - aCancel - 1
aCancelB db '[ Žâ¬¥­¨âì ]',0
aCancelBLength = $ - aCancelB - 1
aCopyCaption db 'Š®¯¨à®¢ ­¨¥',0
5158,6 → 6199,8
aRetry db '®¢â®à¨âì',0
a_Cancel db 'Žâ¬¥­¨âì',0
a_Delete db '“¤ «¨âì',0
aSkip db 'à®¯ãáâ¨âì',0
aSkipAll db 'à®¯ãáâ¨âì ¢á¥',0
error0msg db '‘âà ­­®... ¥â ®è¨¡ª¨',0
error1msg db '‘âà ­­®... ¥ ®¯à¥¤¥«¥­  ¡ §  ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0
error2msg db '”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë',0
5191,6 → 6234,18
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
aInvalidDLL db '” ©« ­¥ ­ ©¤¥­ ¨«¨ ¨¬¥¥â ­¥¢¥à­ë© ä®à¬ â',0
aMissingExport db '¥®¡å®¤¨¬ ï äã­ªæ¨ï ­¥ ­ ©¤¥­ ',0
aInitFailed db 'Žè¨¡ª  ¯à¨ ¨­¨æ¨ «¨§ æ¨¨',0
aIncompatibleVersion db '¥á®¢¬¥á⨬ ï ¢¥àá¨ï',0
aTables db '’ ¡«¨æë',0
aSelect db '®¬¥â¨âì',0
aDeselect db '‘­ïâì',0
else
aDeleteCaption db 'Delete',0
aConfirmDeleteText db 'Do you wish to delete ',0
5215,6 → 6270,8
aRetry db 'Retry',0
a_Cancel db 'Cancel',0
a_Delete db 'Delete',0
aSkip db 'Skip',0
aSkipAll db 'Skip all',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
5240,18 → 6297,151
aCannotReadFile db 'Cannot read file',0
aIncompleteFile db 'Incomplete file was retrieved. Delete it?',0
aKeep db 'Keep',0
aCannotWriteFile db 'Cannot write file',0
aCannotDeleteFile db 'Cannot delete file',0
aCannotDeleteFolder db 'Cannot delete folder',0
aCannotWriteFile db 'Cannot write to the file',0
aCannotDeleteFile db 'Cannot delete the file',0
aCannotDeleteFolder db 'Cannot delete the 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
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
end if
 
aOk db 'OK',0
aNoMemory db 'No memory!',0
aNoMemory db 'No memory!'
nullstr db 0
standard_dll_path:
libini_name db '/rd/1/dll/'
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
aIniQuerySec db 'ini.query_sec',0
 
aConfirmations db 'Confirmations',0
aConfirmDelete db 'Delete',0
aConfirmDeleteIncomplete db 'DeleteIncomplete',0
 
aAssociations db 'Associations',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.query_sec dd aIniQuerySec
dd 0
 
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
5286,6 → 6476,12
panel1_nfa dd ?
panel1_numfiles dd ?
panel1_files dd ?
panel1_colmode dd ?
panel1_colwidths rd 16+1
panel1_total_num dd ?
panel1_total_size dq ?
panel1_selected_num dd ?
panel1_selected_size dq ?
panel1_dir rb 1024
 
panel2_data:
5302,6 → 6498,12
panel2_nfa dd ?
panel2_numfiles dd ?
panel2_files dd ?
panel2_colmode dd ?
panel2_colwidths rd 16+1
panel2_total_num dd ?
panel2_total_size dq ?
panel2_selected_num dd ?
panel2_selected_size dq ?
panel2_dir rb 1024
 
;console_data rb max_width*max_height*2
5329,6 → 6531,7
column_width dd ?
column_height dd ?
column_index dd ?
last_column_index dd ?
 
scrpos dq ?
viewer_right_side dq ?
5337,6 → 6540,8
procinfo rb 1024
lower_file_name = procinfo + 512
 
app_path rb 1100
 
error_msg rb 128
 
prev_dir rb 1024
5354,12 → 6559,26
CopyDestEditBuf rb 12+512+1
.length = $ - CopyDestEditBuf - 13
 
enter_string_buf rb 12+512+1
 
bMemForImageValidData db ?
 
align 4
tolower_table rb 256
layout rb 128
 
copy_buffer_size = 32768
copy_buffer rb copy_buffer_size
 
; 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
del_bSkipAll db ?
 
; stack
align 4
rb 512
/programs/fs/kfar/trunk/tools.inc
1,7 → 1,43
xmalloc:
; in: eax=size
pgalloc:
; in: ecx=size
; out: eax=pointer or NULL
call mf_alloc
push ebx
push 68
pop eax
push 12
pop ebx
int 0x40
pop ebx
ret
 
pgfree:
; in: ecx=pointer
; destroys eax
push ebx
push 68
pop eax
push 13
pop ebx
int 0x40
pop ebx
ret
 
pgrealloc:
; in: ecx=size, edx=pointer
; out: eax=pointer
push ebx
push 68
pop eax
push 20
pop ebx
int 0x40
pop ebx
ret
 
xpgalloc:
; in: ecx=size
; out: eax=pointer or NULL
call pgalloc
.common:
test eax, eax
jnz @f
10,11 → 46,11
@@:
ret
 
xrealloc:
; in: eax=pointer, ebx=new size
xpgrealloc:
; in: edx=pointer, ecx=new size
; out: eax=pointer or NULL
call mf_realloc
jmp xmalloc.common
call pgrealloc
jmp xpgalloc.common
 
get_error_msg:
; in: eax=error code
67,3 → 103,171
pop ecx edx
stosb
jmp .ret
 
libini_alloc:
push ecx
mov ecx, [esp+8]
call xpgalloc
pop ecx
ret 4
libini_free:
push ecx
mov ecx, [esp+8]
call pgfree
pop ecx
ret 4
libini_realloc:
push ecx edx
mov edx, [esp+8+4]
mov ecx, [esp+8+8]
call xpgrealloc
pop edx ecx
ret 8
 
libini_dllload:
push esi
mov esi, [esp+8]
.lib:
lodsd
test eax, eax
jz .ret
push eax
lodsd
xchg esi, [esp]
xor ebp, ebp ; no version control
call load_dll_and_import
pop esi
test eax, eax
jz .lib
.ret:
pop esi
ret 4
 
load_dll_and_import:
cmp byte [eax], '/'
jz .do
push esi
mov edi, saved_file_name
push edi
mov esi, standard_dll_path
mov ecx, standard_dll_path_size
rep movsb
mov esi, eax
mov ecx, 1024-standard_dll_path_size
@@:
lodsb
stosb
test al, al
loopnz @b
pop eax
pop esi
jz .do
push eax
mov edi, aFileNameTooBig
.sayerr:
push dword aCannotLoadDLL
push edi
mov eax, esp
push dword aOk
push esp
push 1
push eax
push 3
push -1
push -1
push dword aError
call SayErr
add esp, 16
xor eax, eax
inc eax
ret
.do:
push eax
mov ecx, eax
push 68
pop eax
push 19
pop ebx
int 0x40
mov edi, aInvalidDLL
test eax, eax
jz .sayerr
; initialize import
mov edi, aMissingExport
mov edx, eax
.import_loop:
lodsd
test eax, eax
jz .import_done
call .find_exported_function
jc .sayerr
mov [esi-4], eax
jmp .import_loop
.import_done:
; check version
test ebp, ebp
jz .version_ok
mov edi, aIncompatibleVersion
mov eax, aVersion
call .find_exported_function
jc .sayerr
cmp ax, bp
jb .sayerr
shr eax, 16
cmp eax, ebp
ja .sayerr
.version_ok:
; initialize library
mov eax, aStart
call .find_exported_function
jc @f
push 1 ; DLL_ENTRY
call eax
.ret0:
pop eax
xor eax, eax
ret
@@:
mov eax, aLibInit
call .find_exported_function
jc .ret0
mov esi, eax
mov eax, libini_alloc
mov ebx, libini_free
mov ecx, libini_realloc
mov edx, libini_dllload
call esi
mov edi, aInitFailed
test eax, eax
jnz .sayerr
jmp .ret0
 
.find_exported_function:
push edx
.import_loop_i:
mov ebx, [edx]
test ebx, ebx
jz .import_notfound
push eax
@@:
mov cl, [eax]
cmp cl, [ebx]
jnz .import_find_next
test cl, cl
jz .import_found
inc eax
inc ebx
jmp @b
.import_find_next:
pop eax
add edx, 8
jmp .import_loop_i
.import_found:
pop eax
mov eax, [edx+4]
pop edx
ret
.import_notfound:
pop edx
stc
ret
/programs/fs/kfar/trunk/viewer.inc
10,6 → 10,7
.bEofReached db ?
.flags db ? ; & 1: hex mode
; & 2: unwrap
; & 4: big-endian unicode
rb 1
.filename rb 1024
.buf rb 16384
24,9 → 25,11
ret
.file:
lea esi, [ebp + panel1_dir - panel1_data]
mov eax, viewer_data.size
push ecx
mov ecx, viewer_data.size
mov edx, viewer_vtable
call new_screen
pop ecx
test eax, eax
jnz @f
ret
128,6 → 131,16
jz .attr_retry
jmp delete_active_screen
.readok:
cmp ebx, 2
jb .nounicode
cmp word [ebp+viewer_data.buf], 0xFEFF
jz @f
cmp word [ebp+viewer_data.buf], 0xFFFE
jnz .nounicode
or byte [ebp+viewer_data.flags], 4
@@:
mov [ebp+viewer_data.encoding], encodings.unicode
.nounicode:
call viewer_set_keybar
call viewer_draw_text
ret
134,6 → 147,24
 
viewer_get_next_char:
pusha
cmp [ebp+viewer_data.encoding], encodings.unicode
jnz @f
cmp [bForHex], 0
jnz @f
cmp dword [ebp+viewer_data.buf_start], 0
jnz @f
cmp dword [ebp+viewer_data.buf_start+4], 0
jnz @f
lea eax, [ebp+viewer_data.buf]
cmp eax, [ebp+viewer_data.buf_pos]
jnz @f
cmp word [eax], 0xFFFE
jz .skip
cmp word [eax], 0xFEFF
jnz @f
.skip:
add [ebp+viewer_data.buf_pos], 2
@@:
mov eax, [ebp+viewer_data.buf_pos]
lea ecx, [ebp+viewer_data.buf]
add ecx, [ebp+viewer_data.buf_size]
184,6 → 215,8
popa
ret
.buffered:
cmp [ebp+viewer_data.encoding], encodings.unicode
jz .unicode
mov al, [eax]
.done:
mov [esp+28], al
192,6 → 225,17
popa
ret
 
.unicode:
inc [ebp+viewer_data.buf_pos]
cmp [bForHex], 0
jnz @f
call read_unicode_char
jmp .done
@@:
mov ax, [eax]
mov [esp+29], ah
jmp .done
 
viewer_get_prev_char:
pusha
lea ecx, [ebp+viewer_data.buf]
217,14 → 261,61
.buffered:
mov eax, [ebp+viewer_data.buf_pos]
dec eax
cmp [ebp+viewer_data.encoding], encodings.unicode
jz .unicode
mov [ebp+viewer_data.buf_pos], eax
mov al, [eax]
mov [esp+28], al
.done:
clc
.ret:
popa
ret
 
.unicode:
dec eax
mov [ebp+viewer_data.buf_pos], eax
call read_unicode_char
jmp .done
 
read_unicode_char:
mov ax, [eax]
uni2ansi_char:
test [ebp+viewer_data.flags], 4
jz @f
xchg al, ah
@@:
cmp ax, 0x80
jb .ret
cmp ax, 0x401
jz .yo1
cmp ax, 0x451
jz .yo2
cmp ax, 0x410
jb .unk
cmp ax, 0x440
jb .rus1
cmp ax, 0x450
jb .rus2
.unk:
mov al, ' '
.ret:
ret
.yo1:
mov al, 'ð'
ret
.yo2:
mov al, 'ñ'
ret
.rus1:
; 0x410-0x43F -> 0x80-0xAF
add al, 0x70
ret
.rus2:
; 0x440-0x44F -> 0xE0-0xEF
add al, 0xA0
ret
 
fld_uint64:
fild qword [eax]
test byte [eax+7], 80h
508,6 → 599,8
test al, al
jns @f
movzx esi, [ebp+viewer_data.encoding]
cmp esi, encodings.unicode
jz @f
shl esi, 7
movzx eax, al
mov al, [encodings.tables-80h+esi+eax]
609,12 → 702,15
rep stosw
mov ebx, edi
pop edi
mov [bForHex], 1
call viewer_get_next_char
mov [bForHex], 0
jc .hexdone
push eax
push edi
add edi, 36*2
mov al, 0xB3
mov ah, [view_normal_color]
call .safechar
pop edi
mov eax, dword [ebp+viewer_data.cur_pos]
655,9 → 751,13
pop eax
jmp @f
.hexchar:
mov [bForHex], 1
call viewer_get_next_char
mov [bForHex], 0
jc .hexdone
@@:
cmp [ebp+viewer_data.encoding], encodings.unicode
jz .hexchar_unicode
push eax
shr al, 4
call .hex_digit
698,6 → 798,53
@@:
cmp ecx, 16
jnz .hexchar
jmp .hexchar_nextline
.hexchar_unicode:
push eax
shr eax, 12
call .hex_digit
pop eax
push eax
shr eax, 8
and al, 0xF
call .hex_digit
pop eax
push eax
shr al, 4
call .hex_digit
pop eax
push eax
and al, 0xF
call .hex_digit
mov al, ' '
mov ah, [view_normal_color]
call .safechar
pop eax
push edi
add edi, 38*2
push ecx
shl ecx, 3
sub edi, ecx
pop ecx
cmp ecx, 4
jb @f
sub edi, 4
@@:
call uni2ansi_char
mov ah, [view_normal_color]
call .safechar
pop edi
inc ecx
cmp ecx, 4
jnz @f
mov al, 0xB3
call .safechar
mov al, ' '
call .safechar
@@:
cmp ecx, 8
jnz .hexchar
.hexchar_nextline:
mov edi, ebx
add esi, 3
mov edx, esi
932,8 → 1079,11
viewer_next_newline:
test [ebp+viewer_data.flags], 1
jz .nohex
push 10h
push 8
pop ecx
cmp [ebp+viewer_data.encoding], encodings.unicode
jz @f
add ecx, ecx
@@:
call viewer_get_next_char
jc @f
978,6 → 1128,9
cmp cl, 0xD xor 0xA
jz .2
dec [ebp+viewer_data.buf_pos]
cmp [ebp+viewer_data.encoding], encodings.unicode
jnz .2
dec [ebp+viewer_data.buf_pos]
.2:
.ret:
call viewer_set_curpos
986,8 → 1139,11
viewer_prev_newline:
test [ebp+viewer_data.flags], 1
jz .nohex
push 10h
push 8
pop ecx
cmp [ebp+viewer_data.encoding], encodings.unicode
jz @f
add ecx, ecx
@@:
call viewer_get_prev_char
jc @f
1096,7 → 1252,11
@@:
end if
movzx esi, [ebp+viewer_data.encoding]
xor esi, 1
dec esi
jz @f
push 1
pop esi
@@:
lea esi, [encodings.names+esi*8]
lea edi, [eax+keybar_cp-keybar_viewer]
movsd
1154,11 → 1314,13
ret
.f8:
movzx esi, [ebp+viewer_data.encoding]
xor [ebp+viewer_data.encoding], 1
call viewer_set_keybar
jmp .done_redraw
dec [ebp+viewer_data.encoding]
jz .done_redraw_keybar
mov [ebp+viewer_data.encoding], 1
jmp .done_redraw_keybar
.f2:
xor [ebp+viewer_data.flags], 2
.done_redraw_keybar:
call viewer_set_keybar
jmp .done_redraw
.f4:
1167,7 → 1329,13
call viewer_set_keybar
popf
jnz .tohex
add dword [ebp+viewer_data.cur_pos], 1
push 1
pop eax
cmp [ebp+viewer_data.encoding], encodings.unicode
jnz @f
add eax, eax
@@:
add dword [ebp+viewer_data.cur_pos], eax
adc dword [ebp+viewer_data.cur_pos+4], 0
call viewer_seek_to_current
call viewer_prev_newline
1249,6 → 1417,29
mov dword [ebp+viewer_data.col], eax
mov dword [ebp+viewer_data.col+4], edx
jmp .done_redraw
.shift_f8:
mov ecx, encodings.menu.1
mov al, [ebp+viewer_data.encoding]
@@:
cmp byte [ecx-1], al
jz @f
mov ecx, [ecx]
jmp @b
@@:
push 1
push aTables
push ecx
call menu
cmp eax, -1
jz .ret
mov al, [eax-1]
mov [ebp+viewer_data.encoding], al
cmp al, encodings.unicode
jnz .done_redraw_keybar
add dword [ebp+viewer_data.cur_pos], 1
adc dword [ebp+viewer_data.cur_pos+4], 0
and dword [ebp+viewer_data.cur_pos], not 1
jmp .done_redraw_keybar
 
viewer_getname:
if lang eq ru
/programs/network/smtps/trunk/smtps.asm
8,7 → 8,7
;; Compile with FASM for Menuet ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include 'lang.inc'
 
version equ '0.1'
 
use32
23,27 → 23,23
dd 0xffff0
dd 0,0
 
include 'macros.inc'
 
save_file:
 
pusha
; cmp [file_start],0x100000+10
; jbe nosub
; sub [file_start],8
; nosub:
 
cmp [file_start],0x100000+10
jbe nosub
sub [file_start],8
nosub:
 
mov edi,[file_start]
 
mov eax,[file_start]
sub eax,0x100000
mov [files+8],eax
mov ebx,files
mov [ebx+12],eax
 
mov eax,58
mov ebx,files
mov eax,70
int 0x40
 
popa
 
ret
 
 
51,12 → 47,15
 
mov [file_start],0x100000
 
mov eax,58
mov eax,70
mov ebx,filel
int 0x40
 
cmp eax,0
jne notfound
test eax,eax
jz @f
cmp eax,6
jnz notfound
@@:
add [file_start],ebx
notfound:
 
63,7 → 62,7
 
mov edi,I_END
mov ecx,60*120
mov eax,32
mov al,32
cld
rep stosb
 
630,19 → 629,10
mov eax,0 ; draw window
mov ebx,5*65536+400
mov ecx,5*65536+200
mov edx,[wcolor]
add edx,0x03ffffff
mov esi,0x80555599
mov edi,0x00ffffff
mov edx,0x13ffffff
mov edi,labelt
int 0x40
 
mov eax,4 ; label
mov ebx,9*65536+8
mov ecx,0x10ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
 
mov eax,8 ; button: open socket
mov ebx,23*65536+22
mov ecx,169*65536+10
746,7 → 736,7
db ' '
db ' Open SMTP server port 25 Close SMTP '
 
db 'x <- END MARKER, DONT DELETE '
db 'x' ; <- END MARKER, DONT DELETE
 
 
irc_server_ip db 192,168,1,1
754,10 → 744,10
file_start dd 0x100000
 
files:
dd 1,0,0,0x100000,0xd0000
dd 2,0,0,?,0x100000
db '/rd/1/smtps.txt',0
filel:
dd 0,0,10000/512,0x100000,0xd0000
dd 0,0,0,0x100000,0x100000
db '/rd/1/smtps.txt',0
 
 
840,10 → 830,6
 
numtext db ' '
 
wcolor dd 0x000000
labelt db 'Tiny SMTP email server v ',version,0
 
labelt db 'Tiny SMTP email server v ',version
labellen:
 
 
I_END: