From 5f02a78eaf424d595ee78ac3f5ee88c356ba5044 Mon Sep 17 00:00:00 2001 From: Marat Zakiyanov Date: Sun, 6 Feb 2022 20:05:54 +0000 Subject: [PATCH] KFM - fixed the display of files larger than 4GB. git-svn-id: svn://kolibrios.org@9691 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/kfm/trunk/build.bat | 1 + programs/fs/kfm/trunk/draw.inc | 107 ++++++++++++++++++++--------- programs/fs/kfm/trunk/file_inf.inc | 2 +- programs/fs/kfm/trunk/kfm.asm | 2 +- 4 files changed, 79 insertions(+), 33 deletions(-) diff --git a/programs/fs/kfm/trunk/build.bat b/programs/fs/kfm/trunk/build.bat index e1e9f91d22..4953fffa6d 100644 --- a/programs/fs/kfm/trunk/build.bat +++ b/programs/fs/kfm/trunk/build.bat @@ -1,4 +1,5 @@ @echo lang fix en >lang.inc @fasm -m 16384 kfm.asm kfm +@kpack kfm @erase lang.inc @pause diff --git a/programs/fs/kfm/trunk/draw.inc b/programs/fs/kfm/trunk/draw.inc index d60c329083..4d63069fde 100644 --- a/programs/fs/kfm/trunk/draw.inc +++ b/programs/fs/kfm/trunk/draw.inc @@ -399,57 +399,103 @@ draw_type_size_date: mov [size_table+4],word '- ' jmp .date ;-------------------------------------- +.qword_div: + mov eax,[edx-40+32] + mov ebx,[edx-40+32+4] +@@: ; /1024 + shrd eax,ebx,5 ; /32 + shr ebx,5 ; /32 + shrd eax,ebx,5 ; /32 + shr ebx,5 ; /32 + dec ecx + jnz @b +; /(1024*1024) + shr eax,20 + test eax,eax + ret +;-------------------------------------- .copy_size: -;/0x40000000 - Gb -;/0x100000 - Mb -;/0x400 Kb +;/0x1000000000000000 - EB +;/0x4000000000000 - PB +;/0x10000000000 - TB +;/0x40000000 - GB +;/0x100000 - MB +;/0x400 - KB mov [size_table],dword ' ' mov [size_table+4],word ' ' - push ebx - push edx - mov eax,[edx-40+32] - mov ebx,0x40000000 - xor edx,edx - div ebx - cmp eax,0 - je @f + push ebx edx + push ecx + mov ecx,4 + call .qword_div + pop ecx + jz @f mov ebx,size_table call decimal_string_4 - mov [ebx],byte 'G' + mov [ebx],byte 'E' ; Exa Byte jmp .size_convert_end ;-------------------------------------- @@: - mov edx,[esp] - mov eax,[edx-40+32] - mov ebx,0x100000 - xor edx,edx - div ebx - cmp eax,0 - je @f + push ecx + mov ecx,3 + call .qword_div + pop ecx + jz @f mov ebx,size_table call decimal_string_4 - mov [ebx],byte 'M' + mov [ebx],byte 'P' ; Peta Byte jmp .size_convert_end ;-------------------------------------- @@: - mov edx,[esp] - mov eax,[edx-40+32] - mov ebx,0x400 - xor edx,edx - div ebx - cmp eax,0 - je @f + push ecx + mov ecx,2 + call .qword_div + pop ecx + jz @f mov ebx,size_table call decimal_string_4 - mov [ebx],byte 'K' + mov [ebx],byte 'T' ; Tera Byte + jmp .size_convert_end +;-------------------------------------- +@@: + push ecx + mov ecx,1 + call .qword_div + pop ecx + jz @f + + mov ebx,size_table + call decimal_string_4 + mov [ebx],byte 'G' ; Giga Byte jmp .size_convert_end ;-------------------------------------- @@: - mov edx,[esp] mov eax,[edx-40+32] + mov ebx,eax + shr eax,20 ; /(1024*1024) + test eax,eax + jz @f + + mov ebx,size_table + call decimal_string_4 + mov [ebx],byte 'M' ; Mega Byte + jmp .size_convert_end +;-------------------------------------- +@@: + mov eax,ebx + shr eax,10 ; /1024 + test eax,eax + jz @f + + mov ebx,size_table + call decimal_string_4 + mov [ebx],byte 'K' ; Kilo Byte + jmp .size_convert_end +;-------------------------------------- +@@: + mov eax,ebx ;.size_convert: mov ebx,size_table call decimal_string_4 @@ -473,8 +519,7 @@ draw_type_size_date: jmp @r ;-------------------------------------- @@: - pop edx - pop ebx + pop edx ebx ;-------------------------------------- .date: xor eax,eax diff --git a/programs/fs/kfm/trunk/file_inf.inc b/programs/fs/kfm/trunk/file_inf.inc index 1f6ec85350..eda058685f 100644 --- a/programs/fs/kfm/trunk/file_inf.inc +++ b/programs/fs/kfm/trunk/file_inf.inc @@ -60,7 +60,7 @@ draw_files_information_window: @@: ; show file or directory size add edx,INF_LINEH - mcall 47,0x80140001,files_size + mcall 47,0xc0140001,files_size ;-------------------------------------- mov ebp,date.create call show_date_and_time_of_files_information diff --git a/programs/fs/kfm/trunk/kfm.asm b/programs/fs/kfm/trunk/kfm.asm index 1efc8c7c7c..2b0d765c9b 100644 --- a/programs/fs/kfm/trunk/kfm.asm +++ b/programs/fs/kfm/trunk/kfm.asm @@ -391,8 +391,8 @@ include 'file_inf.inc' ;--------------------------------------------------------------------- include 'text.inc' ;--------------------------------------------------------------------- -I_END: ;include_debug_strings +I_END: ;--------------------------------------------------------------------- include 'data.inc' ;---------------------------------------------------------------------