Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 320 → Rev 321

/kernel/trunk/blkdev/hd_drv.inc
75,13 → 75,11
hd_read_pio:
push eax edx
 
call disable_ide_int
 
call wait_for_hd_idle
cmp [hd_error],0
jne hd_read_error
 
; cli
cli
xor eax,eax
mov edx,[hdbase]
inc edx
107,7 → 105,7
inc edx
mov al,20h
out dx,al ; ATACommand ॣ¨áâà ª®¬ ­¤
; sti
sti
 
call wait_for_sector_buffer
 
114,7 → 112,7
cmp [hd_error],0
jne hd_read_error
 
; cli
cli
push edi
shl edi,9
add edi,0x600000+65536
123,10 → 121,8
cld
rep insw
pop edi
; sti
sti
 
call enable_ide_int
 
pop edx eax
ret
 
420,8 → 416,8
 
hd_timeout_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_timeout_str
call sys_msg_board_str
; jmp $
431,8 → 427,8
 
hd_read_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_read_str
call sys_msg_board_str
pop edx eax
440,15 → 436,15
 
hd_write_error:
 
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_write_str
call sys_msg_board_str
ret
 
hd_write_error_dma:
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi, hd_write_str
call sys_msg_board_str
pop esi
455,8 → 451,8
ret
 
hd_lba_error:
call clear_hd_cache
call clear_application_table_status
; call clear_hd_cache
; call clear_application_table_status
mov esi,hd_lba_str
call sys_msg_board_str
jmp LBA_read_ret
/kernel/trunk/blkdev/rd.inc
1466,12 → 1466,13
 
;----------------------------------------------------------------
;
; fs_RamdiskRewrite - LFN variant for writing sys floppy
; fs_RamdiskRewrite - LFN variant for writing ramdisk
; fs_RamdiskCreateFolder - create folder on ramdisk
;
; esi points to filename
; esi points to file/folder name
; ebx ignored (reserved)
; ecx number of bytes to write, 0+
; edx mem location to data
; ecx number of bytes to write, 0+ (ignored for folders)
; edx mem location to data (ignored for folders)
;
; ret ebx = number of written bytes
; eax = 0 ok read or other = errormsg
1482,7 → 1483,13
xor ebx, ebx
ret
 
fs_RamdiskCreateFolder:
mov al, 1 ; create folder
jmp fs_RamdiskRewrite.common
 
fs_RamdiskRewrite:
xor eax, eax ; create file
.common:
cmp byte [esi], 0
jz @b
pushad
1537,9 → 1544,25
.common1:
call fat_find_lfn
jc .notfound
; found; must not be directory
; found
test byte [edi+11], 10h
jz .exists_file
; found directory; if we are creating directory, return OK,
; if we are creating file, say "access denied"
add esp, 20
popad
test al, al
mov eax, ERROR_ACCESS_DENIED
jz @f
mov al, 0
@@:
xor ebx, ebx
ret
.exists_file:
; found file; if we are creating directory, return "access denied",
; if we are creating file, delete existing file and continue
cmp byte [esp+20+28], 0
jz @f
add esp, 20
popad
mov eax, ERROR_ACCESS_DENIED
1556,7 → 1579,7
@@:
cmp eax, 0xFF8
jae .done1
lea edi, [0x280000 + eax*2] ; position in FAT
lea edi, [RAMDISK_FAT + eax*2] ; position in FAT
xor eax, eax
xchg ax, [edi]
jmp @b
1748,6 → 1771,12
and word [edi+20], 0 ; high word of cluster
and word [edi+26], 0 ; low word of cluster - to be filled
and dword [edi+28], 0 ; file size - to be filled
cmp byte [esp+20+28], 0
jz .doit
; create directory
mov byte [edi+11], 10h ; attributes: folder
mov ecx, 32*2
mov edx, edi
.doit:
push edx
push ecx
1756,7 → 1785,7
push edi
jecxz .done
mov ecx, 2849
mov edi, 0x280000
mov edi, RAMDISK_FAT
.write_loop:
; allocate new cluster
xor eax, eax
1764,7 → 1793,7
jnz .disk_full2
dec edi
dec edi
lea eax, [edi-0x280000]
lea eax, [edi-(RAMDISK_FAT)]
shr eax, 1 ; eax = cluster
mov word [edi], 0xFFF ; mark as last cluster
xchg edi, [esp]
1773,8 → 1802,11
push edi
inc ecx
; write data
cmp byte [esp+16+20+28], 0
jnz .writedir
shl eax, 9
add eax, 0x100000+31*512
add eax, RAMDISK+31*512
.writefile:
mov ebx, edx
xchg eax, ebx
push ecx
1809,6 → 1841,34
push ERROR_DISK_FULL
pop eax
ret
.writedir:
mov edi, eax
shl edi, 9
add edi, RAMDISK+31*512
mov esi, edx
mov ecx, 32/4
push ecx
rep movsd
mov dword [edi-32], '. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov word [edi-32+26], ax
mov esi, edx
pop ecx
rep movsd
mov dword [edi-32], '.. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov eax, [esp+16+8]
mov word [edi-32+26], ax
pop edi edi ecx edx
add esp, 20
popad
xor eax, eax
xor ebx, ebx
ret
 
.read_symbol:
or ax, -1
/kernel/trunk/blkdev/rdsave.inc
16,10 → 16,12
add edx,ecx
img_save_hd_3:
call reserve_hd1
call reserve_hd_channel
call restorefatchain ; restore FAT !!!
mov eax,image_save
mov ebx,1440*1024 ; size 1440 Kb
mov ecx,0x100000 ; address of image
call file_write
call free_hd_channel
mov [esp+36],eax
ret
/kernel/trunk/boot/bootcode.inc
91,7 → 91,7
 
graph_data_l:
 
dw 0x3ff
dw 0x7ff
dw 0x0000
db 0x00
dw 11010000b *256 +11110010b
/kernel/trunk/boot/rdload.inc
65,7 → 65,6
jmp yes_sys_on_hd
 
search_and_read_image:
; mov [0xfe10],dword 0 ; entries in hd cache
call set_FAT32_variables
mov edx, bootpath
call read_image
/kernel/trunk/const.inc
175,7 → 175,6
Y_UNDER equ OS_BASE+0x000FB4C
ScreenBPP equ OS_BASE+0x000FBF1
MOUSE_BUFF_COUNT equ OS_BASE+0x000FCFF
HD_CACHE_ENT equ OS_BASE+0x000FE10
LFBAddress equ OS_BASE+0x000FE80
MEM_AMOUNT equ OS_BASE+0x000FE8C
;LFBSize equ OS_BASE+0x02f9050
/kernel/trunk/core/heap.inc
366,7 → 366,7
endp
 
align 4
proc free_kernel_space stdcall, base:dword
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
 
mov ebx, heap_mutex
call wait_mutex ;ebx
461,7 → 461,7
.m_eq:
xor eax, eax
mov [heap_mutex], eax
not eax
dec eax
ret
.insert:
remove_from_used esi
480,7 → 480,7
mov [esi+block_flags],FREE_BLOCK
xor eax, eax
mov [heap_mutex], eax
not eax
dec eax
ret
.fail:
xor eax, eax
557,6 → 557,7
 
align 4
proc kernel_free stdcall, base:dword
push ebx esi
 
mov ebx, heap_mutex
call wait_mutex ;ebx
577,13 → 578,17
 
and [heap_mutex], 0
 
push ecx
mov ecx, [esi+block_size];
shr ecx, 12
call release_pages ;eax, ecx
pop ecx
stdcall free_kernel_space, [base]
pop esi ebx
ret
.fail:
and [heap_mutex], 0
pop esi ebx
ret
endp
 
/kernel/trunk/core/memory.inc
231,6 → 231,7
 
align 4
proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
push ebx
mov eax, [phis_addr]
and eax, not 0xFFF
or eax, [flags]
239,6 → 240,7
mov [pages_tab+ebx*4], eax
mov eax, [lin_addr]
invlpg [eax]
pop ebx
ret
endp
 
290,7 → 292,7
align 4
release_pages:
push ebp
pushad
mov ebx, pg_data.pg_mutex
call wait_mutex ;ebx
 
329,11 → 331,12
jnz @B
mov [pg_data.pages_free], ebp
and [pg_data.pg_mutex],0
pop ebp
popad
ret
 
align 4
proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
push ebx
mov ebx, [lin_addr]
shr ebx, 22
mov eax, [phis_addr]
344,6 → 347,7
shr eax, 10
add eax, pages_tab
invlpg [eax]
pop ebx
ret
endp
 
/kernel/trunk/core/sys32.inc
768,10 → 768,12
mov esi, [esi+0x3000+TASKDATA.pid]
cmp [hd1_status], esi
jnz @f
call free_hd_channel
mov [hd1_status], 0
@@:
cmp [cd_status], esi
jnz @f
call free_cd_channel
mov [cd_status], 0
@@:
cmp [flp_status], esi
/kernel/trunk/core/taskman.inc
208,6 → 208,7
.err_file:
xor eax, eax
mov [application_table_status],eax
mov eax, ecx
ret
endp
 
951,15 → 952,16
wait_mutex:
push eax
push ebx
.do_wait:
cmp dword [ebx],0
je .get_lock
call change_task
jmp wait_mutex
jmp .do_wait
.get_lock:
mov eax, 1
xchg eax, [ebx]
test eax, eax
jnz wait_mutex
jnz .do_wait
pop ebx
pop eax
ret
/kernel/trunk/detect/sear_par.inc
76,21 → 76,21
partition_data_transfer:
mov edi,[transfer_adress]
mov esi,PARTITION_START
xor ecx,ecx
mov cx,69 ;100
rep movsb
mov ecx,(file_system_data_size+3)/4
rep movsd
ret
uglobal
transfer_adress dd 0
endg
partition_data_transfer_1:
cli
; cli
push edi
mov edi,PARTITION_START
mov esi,[transfer_adress]
xor ecx,ecx
mov cx,69 ;100
rep movsb
mov ecx,(file_system_data_size+3)/4
rep movsd
pop edi
sti
; sti
ret
 
end_search_partitions_ide:
/kernel/trunk/docs/sysfuncr.txt
2905,8 → 2905,6
„®áâã¯­ë¥ ¯®¤ä㭪樨:
* ¯®¤äã­ªæ¨ï 0 - ç⥭¨¥ ä ©« /¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 1 - ¯¥à¥§ ¯¨áì ä ©« 
* ¯®¤äã­ªæ¨ï 4 - ᮧ¤ ­¨¥ ¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 5 - ¯¥à¥¨¬¥­®¢ ­¨¥/¯¥à¥¬¥é¥­¨¥ ä ©« /¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 8 - LBA-ç⥭¨¥ á ãáâனá⢠
* ¯®¤äã­ªæ¨ï 15 - ¯®«ã祭¨¥ ¨­ä®à¬ æ¨¨ ® ä ©«®¢®© á¨á⥬¥
 
2995,59 → 2993,6
* â  äã­ªæ¨ï ãáâ à¥« , ¨á¯®«ì§ã©â¥ ¯®¤äã­ªæ¨î 2 ä㭪樨 70.
 
======================================================================
============== ”ã­ªæ¨ï 58, ¯®¤äã­ªæ¨ï 4 - ᮧ¤ âì ¯ ¯ªã. =============
======================================================================
 à ¬¥âàë:
* eax = 58 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨­ä®à¬ æ¨®­­ãî áâàãªâãàã
”®à¬ â ¨­ä®à¬ æ¨®­­®© áâàãªâãàë:
* +0: dword: 4 = ­®¬¥à ¯®¤ä㭪樨
* +4: dword: ¨£­®à¨àã¥âáï
* +8: dword: ¨£­®à¨àã¥âáï
* +12 = +0xC: dword: ¨£­®à¨àã¥âáï
* +16 = +0x10: dword: 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
(4096 ¡ ©â)
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨«  ä®à¬¨à®¢ ­¨ï ¨¬ñ­ 㪠§ ­ë ¢
®¡é¥¬ ®¯¨á ­¨¨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
* ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
*  ¬¤¨áª ¨ ¤¨áª¥âë ­¥ ¯®¤¤¥à¦¨¢ îâ íâã äã­ªæ¨î,
®­  ⮫쪮 ¤«ï ¦ñáâª¨å ¤¨áª®¢.
 
======================================================================
== ”ã­ªæ¨ï 58, ¯®¤äã­ªæ¨ï 5 - ¯¥à¥¨¬¥­®¢ âì/¯¥à¥¬¥áâ¨âì ä ©«/¯ ¯ªã. ==
======================================================================
 à ¬¥âàë:
* eax = 58 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨­ä®à¬ æ¨®­­ãî áâàãªâãàã
”®à¬ â ¨­ä®à¬ æ¨®­­®© áâàãªâãàë:
* +0: dword: 5 = ­®¬¥à ¯®¤ä㭪樨
* +4: dword: ¨£­®à¨àã¥âáï
* +8: dword: ¨£­®à¨àã¥âáï
* +12 = +0xC: dword: ¨£­®à¨àã¥âáï
* +16 = +0x10: dword: 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
(4096 ¡ ©â)
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨«  ä®à¬¨à®¢ ­¨ï ¨¬ñ­ 㪠§ ­ë ¢
®¡é¥¬ ®¯¨á ­¨¨
* +20+n: (áࠧ㠯®á«¥ § ¢¥àè î饣® ­ã«¥¢®£® ᨬ¢®« ) ­®¢®¥
ASCIIZ-¨¬ï, ¤®«¦­® ­ ç¨­ âìáï á /hd/1, çâ® ¨­â¥à¯à¥â¨àã¥âáï ª ª
¦ñá⪨© ¤¨áª, 㪠§ ­­ë© ¢ ¯¥à¢®¬ ¨¬¥­¨
(¯¥à¥¬¥é¥­¨¥ á ®¤­®£® ¤¨áª  ­  ¤à㣮© ­¥ ¯®¤¤¥à¦¨¢ ¥âáï)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
* ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
*  ¬¤¨áª ¨ ¤¨áª¥âë ­¥ ¯®¤¤¥à¦¨¢ îâ íâã äã­ªæ¨î,
®­  ⮫쪮 ¤«ï ¦ñáâª¨å ¤¨áª®¢.
* …᫨ ­®¢®¥ ASCIIZ-¨¬ï ᨫ쭮 ­¥¯à ¢¨«ì­®¥, â.¥. ­¥ ­ ç¨­ ¥âáï á
/hd/1, /hd/first, /harddisk/1, /harddisk/first ¨«¨ ¯®á«¥ í⮣®
­ ç «  ¨¤ñ⠯஡¥« ¨«¨ ᨬ¢®« á ª®¤®¬ 0, â® äã­ªæ¨ï ¢®§¢à é ¥â,
ª ª ­¨ áâà ­­®, ª®¤ ®è¨¡ª¨ 4. â® ¥¤¨­á⢥­­ ï äã­ªæ¨ï, ª®â®à ï
¢®®¡é¥ ¢®§¢à é ¥â íâ®â ª®¤.
 
======================================================================
========= ”ã­ªæ¨ï 58, ¯®¤äã­ªæ¨ï 8 - LBA-ç⥭¨¥ á ãáâனá⢠. ========
======================================================================
 à ¬¥âàë:
4097,6 → 4042,7
* ¯®¤äã­ªæ¨ï 6 - ãáâ ­®¢ª   âਡã⮢ ä ©« /¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 7 - § ¯ã᪠¯à®£à ¬¬ë
* ¯®¤äã­ªæ¨ï 8 - 㤠«¥­¨¥ ä ©« /¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 9 - ᮧ¤ ­¨¥ ¯ ¯ª¨
„«ï CD-¯à¨¢®¤®¢ ¢ á¢ï§¨ á  ¯¯ à â­ë¬¨ ®£à ­¨ç¥­¨ï¬¨ ¤®áâ㯭ë
⮫쪮 ¯®¤ä㭪樨 0,1,5 ¨ 7, ¢ë§®¢ ¤àã£¨å ¯®¤ä㭪権 § ¢¥àè¨âáï
®è¨¡ª®© á ª®¤®¬ 2.
4435,6 → 4381,31
¯à¨¢¥¤ñâ ª ®è¨¡ª¥ á ª®¤®¬ 10, "¤®áâ㯠§ ¯à¥éñ­").
 
======================================================================
============= ”ã­ªæ¨ï 70, ¯®¤äã­ªæ¨ï 9 - ᮧ¤ ­¨¥ ¯ ¯ª¨. =============
======================================================================
 à ¬¥âàë:
* eax = 70 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨­ä®à¬ æ¨®­­ãî áâàãªâãàã
”®à¬ â ¨­ä®à¬ æ¨®­­®© áâàãªâãàë:
* +0: dword: 9 = ­®¬¥à ¯®¤ä㭪樨
* +4: dword: 0 (§ à¥§¥à¢¨à®¢ ­®)
* +8: dword: 0 (§ à¥§¥à¢¨à®¢ ­®)
* +12 = +0xC: dword: 0 (§ à¥§¥à¢¨à®¢ ­®)
* +16 = +0x10: dword: 0 (§ à¥§¥à¢¨à®¢ ­®)
* +20 = +0x14: ASCIIZ-¨¬ï ¯ ¯ª¨, ¯à ¢¨«  ä®à¬¨à®¢ ­¨ï ¨¬ñ­ 㪠§ ­ë ¢
®¡é¥¬ ®¯¨á ­¨¨
¨«¨
* +20 = +0x14: db 0
* +21 = +0x15: dd 㪠§ â¥«ì ­  ASCIIZ-áâபã á ¨¬¥­¥¬ ¯ ¯ª¨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
* ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* ”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï CD (¢¥à­ñâáï ª®¤ ®è¨¡ª¨ 2).
* ®¤¨â¥«ìáª ï ¯ ¯ª  ¤®«¦­  㦥 áãé¥á⢮¢ âì.
* …᫨ ¯ ¯ª  㦥 áãé¥áâ¢ã¥â, äã­ªæ¨ï § ¢¥àè¨âáï ãᯥ譮 (eax=0).
 
======================================================================
=== ”ã­ªæ¨ï 71, ¯®¤äã­ªæ¨ï 1 - ãáâ ­®¢¨âì § £®«®¢®ª ®ª­  ¯à®£à ¬¬ë. ==
======================================================================
 à ¬¥âàë:
/kernel/trunk/docs/sysfuncs.txt
2878,8 → 2878,6
Existing subfunctions:
* subfunction 0 - read file/folder
* subfunction 1 - rewrite file
* subfunction 4 - make folder
* subfunction 5 - rename/move file/folder
* subfunction 8 - LBA-read from device
* subfunction 15 - get file system information
 
2969,59 → 2967,6
* This function is obsolete, use subfunction 2 of function 70.
 
======================================================================
============== Function 58, subfunction 4 - make folder. =============
======================================================================
Parameters:
* eax = 58 - function number
* ebx = pointer to the information structure
Format of the information structure:
* +0: dword: 4 = subfunction number
* +4: dword: ignored
* +8: dword: ignored
* +12 = +0xC: dword: ignored
* +16 = +0x10: dword: pointer to buffer for system operations
(4096 bytes)
* +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
given in the general description
Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* Ramdisk and floppies do not support this function, it is only
for hard disks.
 
======================================================================
======== Function 58, subfunction 5 - rename/move file/folder. =======
======================================================================
Parameters:
* eax = 58 - function number
* ebx = pointer to the information structure
Format of the information structure:
* +0: dword: 5 = subfunction number
* +4: dword: ignored
* +8: dword: ignored
* +12 = +0xC: dword: ignored
* +16 = +0x10: dword: pointer to buffer for system operations
(4096 bytes)
* +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
given in the general description
* +20+n: (at once after terminating null character) new
ASCIIZ-name, must start from /hd/1, that is interpreted as
the hard disk, indicated in the first name
(moving from one disk to another is not supported)
Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* Ramdisk and floppies do not support this function, it is only
for hard disks.
* If the new ASCIIZ-name is strongly incorrect, i.e. does not start
from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
space or null character follows, function returns, strangely
enough, error code 4. It is the only function which returns
this code.
 
======================================================================
========= Function 58, subfunction 8 - LBA-read from device. =========
======================================================================
Parameters:
4060,6 → 4005,7
* subfunction 6 - set attributes of file/folder
* subfunction 7 - start application
* subfunction 8 - delete file/folder
* subfunction 9 - create folder
For CD-drives due to hardware limitations only subfunctions
0,1,5 and 7 are available, other subfunctions return error
with code 2.
4158,7 → 4104,7
* +40 = +0x28: name
* for ASCII format: maximum length is 263 characters
(263 bytes), byte after the name has value 0
* äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
* for UNICODE format: maximum length is 259 characters
(518 bytes), 2 bytes after the name have value 0
Time format:
* +0: byte: seconds
4393,6 → 4339,31
nonempty folder results in error with code 10, "access denied").
 
======================================================================
============= Function 70, subfunction 9 - create folder. ============
======================================================================
Parameters:
* eax = 70 - function number
* ebx = pointer to the information structure
Format of the information structure:
* +0: dword: 9 = subfunction number
* +4: dword: 0 (reserved)
* +8: dword: 0 (reserved)
* +12 = +0xC: dword: 0 (reserved)
* +16 = +0x10: dword: 0 (reserved)
* +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
given in the general description
or
* +20 = +0x14: db 0
* +21 = +0x15: dd pointer to ASCIIZ-string with folder name
Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* The function is not supported for CD (returns error code 2).
* The parent folder must already exist.
* If target folder already exists, function returns success (eax=0).
 
======================================================================
========== Function 71, subfunction 1 - set window caption. ==========
======================================================================
Parameters:
/kernel/trunk/fs/fat12.inc
1550,7 → 1550,13
xor ebx, ebx
ret
 
fs_FloppyCreateFolder:
mov al, 1
jmp fs_FloppyRewrite.common
 
fs_FloppyRewrite:
xor eax, eax
.common:
cmp byte [esi], 0
jz @b
call read_flp_fat
1616,9 → 1622,25
.common1:
call fat_find_lfn
jc .notfound
; found; must not be directory
; found
test byte [edi+11], 10h
jz .exists_file
; found directory; if we are creating directory, return OK,
; if we are creating file, say "access denied"
add esp, 28
popad
test al, al
mov eax, ERROR_ACCESS_DENIED
jz @f
mov al, 0
@@:
xor ebx, ebx
ret
.exists_file:
; found file; if we are creating directory, return "access denied",
; if we are creating file, delete existing file and continue
cmp byte [esp+28+28], 0
jz @f
add esp, 28
popad
mov eax, ERROR_ACCESS_DENIED
1635,7 → 1657,7
@@:
cmp eax, 0xFF8
jae .done1
lea edi, [0x282000 + eax*2] ; position in FAT
lea edi, [FLOPPY_FAT + eax*2] ; position in FAT
xor eax, eax
xchg ax, [edi]
jmp @b
1840,6 → 1862,12
and word [edi+20], 0 ; high word of cluster
and word [edi+26], 0 ; low word of cluster - to be filled
and dword [edi+28], 0 ; file size - to be filled
cmp byte [esp+28+28], 0
jz .doit
; create directory
mov byte [edi+11], 10h ; attributes: folder
mov ecx, 32*2
mov edx, edi
.doit:
lea eax, [esp+8]
call dword [eax+12] ; flush directory
1847,9 → 1875,10
push edi
push 0
mov esi, edx
jecxz .done
test ecx, ecx
jz .done
mov ecx, 2849
mov edi, 0x282000
mov edi, FLOPPY_FAT
push 0 ; first cluster
.write_loop:
; allocate new cluster
1859,7 → 1888,7
jnz .ret
dec edi
dec edi
lea eax, [edi-0x282000]
lea eax, [edi-(FLOPPY_FAT)]
shr eax, 1 ; eax = cluster
mov word [edi], 0xFFF ; mark as last cluster
xchg edi, [esp+4]
1879,10 → 1908,13
jae @f
mov ecx, [esp+20]
@@:
mov edi, 0xD000
cmp byte [esp+24+28+28], 0
jnz .writedir
push ecx
mov edi, 0xD000
rep movsb
pop ecx
.writedircont:
push ecx
sub ecx, 512
neg ecx
1935,6 → 1967,28
mov eax, 11
pop edi ecx
jmp .ret
.writedir:
push ecx
mov ecx, 32/4
push ecx esi
rep movsd
pop esi ecx
mov dword [edi-32], '. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov word [edi-32+26], ax
push esi
rep movsd
pop esi
mov dword [edi-32], '.. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov ecx, [esp+28+8]
mov word [edi-32+26], cx
pop ecx
jmp .writedircont
 
;----------------------------------------------------------------
;
2059,6 → 2113,13
jz .ret
call SetUserInterrupts
.write_loop:
; skip unmodified sectors
cmp dword [esp], 0x200
jb .modify
sub ebx, 0x200
jae .skip
add ebx, 0x200
.modify:
lea eax, [edi+31] ; current sector
; get length of data in current sector
push ecx
2129,6 → 2190,7
sub [esp], ecx
pop ecx
jz .done
.skip:
.next_cluster:
movzx edi, word [edi*2+0x282000]
sub esi, 0x200
2488,6 → 2550,7
@@:
ret
 
if 0
;----------------------------------------------------------------
;
; fs_FloppyExecute - LFN variant for executing from floppy
2589,6 → 2652,7
popad
mov eax, 11
ret
end if
 
;----------------------------------------------------------------
;
/kernel/trunk/fs/fat32.inc
7,6 → 7,7
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
;; ;;
;; See file COPYING for details ;;
;; 04.02.2007 LFN create folder - diamond ;;
;; 08.10.2006 LFN delete file/folder - diamond ;;
;; 20.08.2006 LFN set file size (truncate/extend) - diamond ;;
;; 17.08.2006 LFN write/append to file - diamond ;;
101,13 → 102,6
fsinfo_buffer: times 512 db 0
endg
 
iglobal
NewDirEntry1 db ". ",0x10
times 20 db 0
NewDirEntry2 db ".. ",0x10
times 20 db 0
endg
 
uglobal
dir_entry: times 32 db 0
 
139,6 → 133,11
sti
ret
;********************************************
 
uglobal
hd_in_cache db ?
endg
 
reserve_hd_channel:
cmp [hdbase], 0x1F0
jne .IDE_Channel_2
155,12 → 154,25
je .reserve_ok_2
sti
call change_task
jmp .IDE_Channel_1
jmp .IDE_Channel_2
.reserve_ok_1:
mov [IDE_Channel_1],1
ret
push eax
mov al, 1
jmp @f
.reserve_ok_2:
mov [IDE_Channel_2],1
push eax
mov al, 3
@@:
cmp [hdid], 1
sbb al, -1
cmp al, [hd_in_cache]
jz @f
mov [hd_in_cache], al
call clear_hd_cache
@@:
pop eax
ret
free_hd_channel:
806,190 → 818,7
ret
 
 
makedir:
;-----------------------------------------------------
; input : eax = directory name
; edx = path
; output : eax = 0 - ok
; 3 - unknown FS
; 5 - file not found
; 8 - disk full
; 10 - access denied
; Note : can only make one directory at time
;-----------------------------------------------------
cmp [fs_type], 16
jz make_dir_fat_ok
cmp [fs_type], 32
jz make_dir_fat_ok
push ERROR_UNKNOWN_FS
pop eax
ret
 
make_dir_fat_ok:
; call reserve_hd1
 
pushad
 
mov ebx,edx
call get_cluster_of_a_path
jnc make_dir_found_path
cmp [hd_error],0
jne make_dir_error_1
 
make_dir_path_not_found:
popad
call update_disk ; write all of cache and fat to hd
cmp [hd_error],0
jne make_dir_error_2
 
mov [hd1_status],0
mov eax,ERROR_FILE_NOT_FOUND
ret
 
make_dir_disk_full:
cmp [hd_error],0
jne make_dir_error_1
popad
call update_disk ; write all of cache and fat to hd
cmp [hd_error],0
jne make_dir_error_2
 
mov [hd1_status],0
mov eax,ERROR_DISK_FULL
ret
 
make_dir_already_exist:
cmp [hd_error],0
jne make_dir_error_1
mov eax,[cluster] ; directory cluster
xor edx,edx ; free
call set_FAT
cmp [hd_error],0
jne make_dir_error_1
 
popad
call update_disk ; write all of cache and fat to hd
make_dir_error_2:
mov [hd1_status],0
mov eax,ERROR_ACCESS_DENIED
ret
 
make_dir_error_1:
popad
jmp make_dir_error_2
 
make_dir_error_3:
add esp,4
jmp make_dir_error_1
 
make_dir_found_path:
cmp eax,[ROOT_CLUSTER]
jnz make_dir_not_root
xor eax,eax
 
make_dir_not_root:
mov ecx,eax ; directorys start cluster
mov word [NewDirEntry2+26],cx ; 16 bits low of cluster
shr ecx,16
mov word [NewDirEntry2+20],cx ; 16 bits high of cluster (=0 fat16)
 
push eax ; save parent directory cluster
mov eax,2
call get_free_FAT
mov [cluster],eax ; first free cluster
pop eax
jc make_dir_disk_full
 
push eax
mov eax,[cluster] ; directory cluster
mov edx,[fatEND] ; end for directory
call set_FAT
cmp [hd_error],0
jne make_dir_error_3
pop eax
 
mov ebx,PUSHAD_EAX ; dir name
push eax
call analyze_directory ; check if directory already exist
cmp [hd_error],0
jne make_dir_error_1
 
pop eax
jnc make_dir_already_exist ; need to free allocated cluster!
 
call analyze_directory_to_write
jc make_dir_already_exist ; need to free allocated cluster!
 
mov esi,PUSHAD_EAX ; dir name
mov edi,ebx ; pointer in buffer
mov ecx,11
cld
rep movsb
 
mov dword [ebx+28],0 ; dir size is always 0
mov ecx,[cluster]
mov [ebx+26],cx ; 16 bits low of cluster
mov word [NewDirEntry1+26],cx
shr ecx,16
mov [ebx+20],cx ; 16 bits high of cluster (=0 fat16)
mov word [NewDirEntry1+20],cx
mov byte [ebx+11],0x10 ; attribute = directory
 
call set_current_time_for_entry
mov ecx,[ebx+22]
mov dword [NewDirEntry1+22],ecx
mov dword [NewDirEntry2+22],ecx
 
mov ebx,buffer ; save the directory name,length,cluster
call hd_write
cmp [hd_error],0
jne make_dir_error_1
 
mov ecx,512/4
xor eax,eax
mov edi,buffer
cld
rep stosd ; clear new directory cluster
 
mov eax,[cluster] ; new directory cluster
sub eax,2
mov edx,[SECTORS_PER_CLUSTER]
imul eax,edx
add eax,[DATA_START]
mov ebx,buffer
add eax,edx ; start from last sector
 
dir_set_empty_directory:
dec eax ; next sector
cmp edx,1 ; is first directory sector?
jnz not_first_sector ; no. write empty sector
mov esi,NewDirEntry1
mov edi,buffer
mov ecx,64/4
cld
rep movsd ; copy 2 first directory entrys "." and ".."
 
not_first_sector:
call hd_write
cmp [hd_error],0
jne make_dir_error_1
dec edx
jnz dir_set_empty_directory
 
mov ecx,-1 ; remove 1 cluster from free disk space
call add_disk_free_space
cmp [hd_error],0
jne make_dir_error_1
 
popad
call update_disk ; write all of cache and fat to hd
cmp [hd_error],0
jne make_dir_error_2
mov [hd1_status],0
xor eax,eax
ret
 
add_disk_free_space:
;-----------------------------------------------------
; input : ecx = cluster count
1664,172 → 1493,6
ret
 
 
rename:
;-----------------------------------------------------------
; input : eax = source directory name
; edx = source path
; ebx = dest directory name
; edi = dest path
; output : eax = 0 - ok
; 3 - unknown FS
; 5 - file not found
; 8 - disk full
; 10 - access denied
;-----------------------------------------------------------
cmp [fs_type], 16
jz fat_ok_for_rename
cmp [fs_type], 32
jz fat_ok_for_rename
push ERROR_UNKNOWN_FS
pop eax
ret
 
fat_ok_for_rename:
; call reserve_hd1
 
pushad
 
mov ebx,edx ; source path
call get_cluster_of_a_path
jc rename_entry_not_found
 
mov ebx,PUSHAD_EAX ; source directory name
call analyze_directory
jc rename_entry_not_found
 
mov [sector_tmp],eax ; save source sector
mov [entry_pos],ebx
mov esi,ebx
mov edi,dir_entry
mov ecx,32/4
cld
rep movsd ; save entry
 
mov ebx,PUSHAD_EDI ; dest path
call get_cluster_of_a_path
jc rename_entry_not_found
 
mov edx,eax ; save dest directory cluster
mov ebx,PUSHAD_EBX ; dest directory name
push [longname_sec1]
push [longname_sec2]
call analyze_directory ; check if entry already exist
cmp [hd_error],0
jne rename_entry_already_exist_1
 
pop [longname_sec2]
pop [longname_sec1]
jnc rename_entry_already_exist
 
mov eax,edx
call analyze_directory_to_write
jc rename_disk_full
 
mov esi,dir_entry
mov edi,ebx
mov ecx,32/4
cld
rep movsd ; copy entry
mov esi,PUSHAD_EBX ; dest directory name
mov edi,ebx
mov ecx,11
rep movsb ; copy name
 
mov ebx,buffer ; save the directory name,length,cluster
call hd_write
 
test byte [dir_entry+11],0x10 ; is it directory?
jz rename_not_dir ; no
mov eax,[dir_entry+20-2] ; FAT entry
mov ax,[dir_entry+26]
and eax,[fatMASK]
call change_2dot_cluster
cmp [hd_error],0
jne rename_entry_already_exist
 
rename_not_dir:
cmp [hd_error],0
jne rename_entry_already_exist
mov eax,[sector_tmp]
mov ebx,buffer
call hd_read ; read source directory sector
cmp [hd_error],0
jne rename_entry_already_exist
 
mov ebx,[entry_pos]
call delete_entry_name
cmp [hd_error],0
jne rename_entry_already_exist
 
popad
call update_disk ; write all of cache and fat to hd
cmp [hd_error],0
jne rename_entry_already_exist_2
mov [hd1_status],0
xor eax,eax
ret
 
rename_entry_not_found:
cmp [hd_error],0
jne rename_entry_already_exist
popad
mov [hd1_status],0
mov eax,ERROR_FILE_NOT_FOUND
ret
 
rename_entry_already_exist_1:
add esp,8
rename_entry_already_exist:
popad
rename_entry_already_exist_2:
mov [hd1_status],0
mov eax,ERROR_ACCESS_DENIED
ret
 
rename_disk_full:
cmp [hd_error],0
jne rename_entry_already_exist
popad
mov [hd1_status],0
mov eax,ERROR_DISK_FULL
ret
 
 
change_2dot_cluster:
;-----------------------------------------------------------
; input : eax = directory cluster
; edx = value to save
; change : eax,ebx,edx
;-----------------------------------------------------------
cmp eax,[LAST_CLUSTER]
ja not_2dot ; too big cluster number, something is wrong
sub eax,2
jb not_2dot
 
imul eax,[SECTORS_PER_CLUSTER]
add eax,[DATA_START]
mov ebx,buffer
call hd_read
cmp [hd_error],0
jne not_2dot
 
cmp dword [ebx+32],'.. '
jnz not_2dot
 
cmp edx,[ROOT_CLUSTER] ; is rootdir cluster?
jne not_2dot_root
xor edx,edx ; yes. set it zero
 
not_2dot_root:
mov [ebx+32+26],dx ; 16 bits low of cluster
shr edx,16
mov [ebx+32+20],dx ; 16 bits high of cluster (=0 fat16)
call hd_write
 
not_2dot:
ret
 
 
get_hd_info:
;-----------------------------------------------------------
; output : eax = 0 - ok
2555,7 → 2218,13
xor ebx, ebx
ret
 
fs_HdCreateFolder:
mov al, 1
jmp fs_HdRewrite.common
 
fs_HdRewrite:
xor eax, eax
.common:
cmp [fs_type], 1
jz ntfs_HdRewrite
cmp [fs_type], 16
2627,9 → 2296,25
.common1:
call fat_find_lfn
jc .notfound
; found; must not be directory
; found
test byte [edi+11], 10h
jz .exists_file
; found directory; if we are creating directory, return OK,
; if we are creating file, say "access denied"
add esp, 32
popad
test al, al
mov eax, ERROR_ACCESS_DENIED
jz @f
mov al, 0
@@:
xor ebx, ebx
ret
.exists_file:
; found file; if we are creating directory, return "access denied",
; if we are creating file, delete existing file and continue
cmp byte [esp+32+28], 0
jz @f
add esp, 32
popad
mov eax, ERROR_ACCESS_DENIED
2865,11 → 2550,23
mov word [edi+20], cx ; high word of cluster
mov word [edi+26], cx ; low word of cluster - to be filled
mov dword [edi+28], ecx ; file size - to be filled
cmp byte [esp+32+28], cl
jz .doit
; create directory
mov byte [edi+11], 10h ; attributes: folder
mov edx, edi
lea eax, [esp+8]
call dword [eax+16] ; flush directory
push ecx
mov ecx, [SECTORS_PER_CLUSTER]
shl ecx, 9
jmp .doit2
.doit:
lea eax, [esp+8]
call dword [eax+16] ; flush directory
push ecx
mov ecx, [esp+4+32+24]
.doit2:
push ecx
push edi
mov esi, edx
2898,6 → 2595,8
add eax, [DATA_START]
; write data
.write_sector:
cmp byte [esp+16+32+28], 0
jnz .writedir
mov ecx, 512
cmp dword [esp+8], ecx
jb .writeshort
2911,6 → 2610,7
mov edi, buffer
mov ebx, edi
rep movsb
.writedircont:
mov ecx, buffer+0x200
sub ecx, edi
push eax
2977,6 → 2677,40
call update_disk
popad
ret
.writedir:
push 512
mov edi, buffer
mov ebx, edi
mov ecx, [SECTORS_PER_CLUSTER]
shl ecx, 9
cmp ecx, [esp+12]
jnz .writedircont
dec dword [esp+16]
push esi
mov ecx, 32/4
rep movsd
pop esi
mov dword [edi-32], '. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
push esi
mov ecx, 32/4
rep movsd
pop esi
mov dword [edi-32], '.. '
mov dword [edi-32+4], ' '
mov dword [edi-32+8], ' '
mov byte [edi-32+11], 10h
mov ecx, [esp+20+8]
cmp ecx, [ROOT_CLUSTER]
jnz @f
xor ecx, ecx
@@:
mov word [edi-32+26], cx
shr ecx, 16
mov [edi-32+20], cx
jmp .writedircont
 
;----------------------------------------------------------------
;
3119,6 → 2853,13
sub ecx, ebx
jz .ret
.write_loop:
; skip unmodified sectors
cmp dword [esp], 0x200
jb .modify
sub ebx, 0x200
jae .skip
add ebx, 0x200
.modify:
; get length of data in current sector
push ecx
sub ebx, 0x200
3175,9 → 2916,8
add edi, esi
rep stosb
@@:
pop edi ecx eax
pop edi ecx
; copy new data
push eax
mov eax, edx
neg ebx
jecxz @f
3197,6 → 2937,7
sub [esp], ecx
pop ecx
jz .ret
.skip:
; next sector
inc ebp
cmp ebp, [SECTORS_PER_CLUSTER]
/kernel/trunk/fs/fs.inc
4,7 → 4,6
;; (C) 2004 Ville Turjanmaa, License: GPL ;;
;; 29.04.2006 Elimination of hangup after the ;;
;; expiration hd_wait_timeout (for LBA) - Mario79 ;;
;; xx.04.2006 LFN support - diamond ;;
;; 15.01.2005 get file size/attr/date, file_append (only for hd) - ATV ;;
;; 23.11.2004 test if hd/partition is set - ATV ;;
;; 18.11.2004 get_disk_info and more error codes - ATV ;;
37,8 → 36,6
;
; eax = 0 ; read file /RamDisk/First 6
; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56
; eax = 4 ; makedir
; eax = 5 ; rename file/directory
; eax = 8 ; lba read
; eax = 15 ; get_disk_info
;
87,10 → 84,6
 
cmp dword [eax+0],15 ; GET_DISK_INFO
je fs_info
cmp dword [eax+0],5 ; RENAME - dont care about read&write blocks
je fs_read
cmp dword [eax+0],4 ; MAKEDIR - dont care about read&write blocks
je fs_read
 
cmp dword [0x3000],1 ; no memory checks for kernel requests
jz no_checks_for_kernel
384,6 → 377,7
mov [hdid],0x10
mov [hdpos],4
fs_yesharddisk_partition:
call reserve_hd_channel
; call choice_necessity_partition
; jmp fs_yesharddisk_all
jmp fs_for_new_semantic
445,6 → 439,7
cmp [fat32part],0 ; is partition set?
jnz @f
hd_err_return:
call free_hd_channel
and [hd1_status], 0
jmp file_system_return
@@:
469,6 → 464,8
mov edi,[esp+0]
mov byte [edi],'/'
 
call free_hd_channel
and [hd1_status], 0
jmp file_system_return
 
fs_noharddisk_read:
493,77 → 490,17
 
; eax=0 ok - eax=1 not enough free space
 
call free_hd_channel
and [hd1_status], 0
jmp file_system_return
 
 
fs_noharddisk_write:
 
cmp dword [esp+20],4 ; MAKEDIR
jne fs_noharddisk_makedir
 
mov eax,[esp+0] ; /dirname
mov byte [eax],0 ; path to asciiz
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
call free_hd_channel
and [hd1_status], 0
 
call makedir
 
mov edi,[esp+0]
mov byte [edi],'/'
 
jmp file_system_return
 
fs_noharddisk_makedir:
 
cmp dword [esp+20],5 ; RENAME
jne fs_noharddisk_rename
 
mov edi,[esp+0] ; start of source file name
add edi,12+1 ; continue after name
call expand_pathz ; convert destination name
 
mov eax,[edi+1]
cmp eax,'HD '
je fs_rename_test1
cmp eax,'HARD'
jne fs_rename_error
 
fs_rename_test1:
mov eax,[edi+1+12]
cmp eax,'1 '
je fs_rename_start
cmp eax,'FIRS'
jne fs_rename_error
 
fs_rename_start:
mov byte [ebx],0 ; path to asciiz
inc ebx ; filename start
add edi,12*2 ; path start
cmp byte [ebx],0
je fs_rename_error
cmp byte [ebx],32
je fs_rename_error
 
mov eax,[esp+0] ; /filename
mov byte [eax],0 ; path to asciiz
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
 
call rename
 
mov edi,[esp+0]
mov byte [edi],'/'
 
jmp file_system_return
 
fs_rename_error:
mov eax,4 ; partition not defined at hd
jmp file_system_return
 
fs_noharddisk_rename:
 
fs_noharddisk:
; \begin{diamond}[18.03.2006]
mov eax, 5 ; file not found
/kernel/trunk/fs/fs_lfn.inc
83,7 → 83,7
; 6 : set file/directory attributes structure
; 7 : start application
; 8 : delete file
; 9 : create directory - not implemented yet
; 9 : create directory
 
add eax, std_application_base_address
; parse file name
362,8 → 362,9
dd fs_RamdiskSetFileEnd
dd fs_RamdiskGetFileInfo
dd fs_RamdiskSetFileInfo
dd fs_RamdiskExecute
dd 0 ;fs_RamdiskExecute
dd fs_RamdiskDelete
dd fs_RamdiskCreateFolder
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
 
fs_OnFloppy:
392,8 → 393,9
dd fs_FloppySetFileEnd
dd fs_FloppyGetFileInfo
dd fs_FloppySetFileInfo
dd fs_FloppyExecute
dd 0 ;fs_FloppyExecute
dd fs_FloppyDelete
dd fs_FloppyCreateFolder
fs_NumFloppyServices = ($ - fs_FloppyServices)/4
 
fs_OnHd0:
466,6 → 468,7
dd fs_HdSetFileInfo
dd 0 ;fs_HdExecute
dd fs_HdDelete
dd fs_HdCreateFolder
fs_NumHdServices = ($ - fs_HdServices)/4
 
;*******************************************************
/kernel/trunk/fs/ntfs.inc
222,6 → 222,7
mov [ntfs_data.cur_index_buf], eax
 
popad
call free_hd_channel
and [hd1_status], 0
ret
 
/kernel/trunk/fs/part_set.inc
39,6 → 39,10
fatMASK dd 0x0FFFFFFF
 
fs_dependent_data_end:
file_system_data_size = $ - PARTITION_START
if file_system_data_size > 96
ERROR: sizeof(file system data) too big!
end if
 
virtual at fs_dependent_data_start
; NTFS data
111,10 → 115,9
; - it will skip over removed partitions
 
set_FAT32_variables:
mov [0xfe10],dword 0 ; entries in hd cache
mov [problem_partition],0
call reserve_hd1
call clear_hd_cache
call reserve_hd_channel
 
cmp dword [hdpos],0
je problem_hd
303,6 → 306,7
 
problem_hd:
mov [fs_type],0
call free_hd_channel
mov [hd1_status],0 ; free
mov [problem_partition],1
ret
420,6 → 424,7
mov [fatEND],0x0FFFFFF8
mov [fatMASK],0x0FFFFFFF
mov [fs_type],32 ; Fat32
call free_hd_channel
mov [hd1_status],0 ; free
ret
 
434,5 → 439,6
mov [fatEND],0x0000FFF8
mov [fatMASK],0x0000FFFF
mov [fs_type],16 ; Fat16
call free_hd_channel
mov [hd1_status],0 ; free
ret
/kernel/trunk/kernel.asm
1496,9 → 1496,9
mov [hdpos],4
; call set_FAT32_variables
noseslhd:
mov [0xfe10],dword 0
call reserve_hd1
call clear_hd_cache
call reserve_hd_channel
call free_hd_channel
mov [hd1_status],0 ; free
nosethd:
ret
1514,7 → 1514,8
mov [fat32part],ebx
; call set_FAT32_variables
call reserve_hd1
call clear_hd_cache
call reserve_hd_channel
call free_hd_channel
pusha
call choice_necessity_partition_1
popa
/kernel/trunk/memmap.inc
105,7 → 105,6
; FE04 dword screen y size
; FE08 dword screen y multiplier
; FE0C dword screen mode
; FE10 dword entries in hd cache
; FE80 dword address of LFB in physical
; FE84 dword address of applications memory start in physical
; FE88 dword address of button list
/programs/fs/kfar/trunk/kfar.asm
34,7 → 34,6
stosb
test al, al
jnz @b
@@:
mov esi, def_right_dir
mov edi, panel2_dir
@@:
675,12 → 674,13
.dorun:
lea esi, [ebp + panel1_dir - panel1_data]
mov edi, execdata
; TODO: add overflow check
@@:
lodsb
test al, al
jz @f
stosb
cmp edi, execdataend-1
jae .bigfilename
jmp @b
@@:
lea esi, [ecx+40]
689,6 → 689,8
@@:
lodsb
stosb
cmp edi, execdataend
ja .bigfilename
test al, al
jnz @b
; for fasm call - special handling, because
699,7 → 701,8
jz .nofasm
cmp [execptr], fasm
jnz .nofasm
; TODO: add buffer/cmdline overflow check
cmp edi, execdata+(execdataend-execdata)/2
ja .bigfilename
mov esi, execdata
@@:
lodsb
717,6 → 720,8
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
724,10 → 729,45
mov byte [edi], 0
pop edi
.nofasm:
mov ebx, execinfo
; if command line is more than 256 symbols, the kernel will truncate it
; we does 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 70
pop eax
mov ebx, execinfo
int 40h
neg eax
js @f
push aContinue
mov esi, esp
call get_error_msg
push eax
push aRunError
mov eax, esp
push esi
push 1
push eax
push 2
push -1
push -1
push aError
call SayErr
add esp, 3*4
ret
@@:
test edx, edx
jz @f
push 5
738,6 → 778,38
jmp .ctrl_r
@@:
ret
.bigfilename3:
pop esi
.bigfilename2:
pop esi
.bigfilename:
mov eax, aFileNameTooBig
@@:
push aContinue
mov esi, esp
push eax
mov eax, esp
push esi
push 1
push eax
push 1
push -1
push -1
push aError
call SayErr
add esp, 2*4
ret
.bigcmdline:
mov eax, aCmdLineTooBig
jmp @b
.bigfoldername2:
mov byte [ecx], 0
.bigfoldername:
mov eax, aFolderNameTooBig
jmp @b
.copytoself:
mov eax, aCannotCopyToSelf
jmp @b
.enter_folder:
lea esi, [ecx+40]
cmp word [esi], '..'
754,15 → 826,19
test al, al
jnz @b
lea edi, [esi-1]
lea edx, [ebp + panel1_dir - panel1_data + 1024]
cmp esi, edx
pop esi
jae .bigfoldername
mov ecx, edi
mov al, '/'
cmp [edi-1], al
jz @f
stosb
@@:
; TODO: add buffer overflow check
@@:
lodsb
cmp edi, edx
jae .bigfoldername2
stosb
test al, al
jnz @b
791,9 → 867,7
mov ecx, [ebp + panel1_numfiles - panel1_data]
.scanloop:
mov esi, [edx]
mov eax, [ebp + panel1_nfa - panel1_data]
lea esi, [esi+eax*4+32+40]
add esi, [ebp + panel1_files - panel1_data]
add esi, 40
push esi edi
@@:
lodsb
1019,6 → 1093,8
lodsb
test al, al
jz @f
cmp edi, CopyDestEditBuf+12+511
jae .bigfoldername
stosb
jmp @b
@@:
1123,6 → 1199,14
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]
1164,6 → 1248,8
test cl, 0x10
jz .copyfile
;  ¬ ¯®¤áã­ã«¨ ª â «®£ ­ §­ ç¥­¨ï, ¤®¯¨á뢠¥¬ ¨¬ï ä ©« 
cmp edi, CopyDestEditBuf+12+513
jae .bigfilename
mov al, '/'
stosb
push esi
1171,6 → 1257,8
lea esi, [ecx+40]
@@:
lodsb
cmp edi, CopyDestEditBuf+12+513
jae .bigfilename2
stosb
test al, al
jnz @b
1194,6 → 1282,8
lea esi, [ecx+40]
@@:
lodsb
cmp edi, saved_file_name+1024
jae .bigfilename3
stosb
test al, al
jnz @b
1203,7 → 1293,7
push esi edi
call strcmpi
pop edi esi
jz .ret2
jz .copytoself
; ‘®¡á⢥­­®, ª®¯¨à㥬
; esi->source name, edi->destination name
mov [writeinfo.code], 2
1222,17 → 1312,58
push 70
pop eax
int 0x40
cmp ebx, -1
jz .copydone
test eax, eax
jz .copyreadok
cmp eax, 6
jz .copyreadok
push esi
push aCannotReadFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
test eax, eax
jz .copyloop
jmp .copyfailed
.copyreadok:
test ebx, ebx
jz .copydone
add dword [readinfo.first], ebx
adc dword [readinfo.first+4], 0
mov [writeinfo.size], ebx
.copywrite:
mov ebx, writeinfo
push 70
pop eax
int 0x40
test eax, eax
jz .copywriteok
push edi
push aCannotWriteFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
test eax, eax
jz .copywrite
jmp .copyfailed
.copywriteok:
mov ecx, [writeinfo.size]
add dword [writeinfo.first], ecx
adc dword [writeinfo.first+4], 0
1245,6 → 1376,34
pop ebp
xor ebp, panel1_data xor panel2_data
jmp .ctrl_r
.copyfailed:
cmp [bConfirmDeleteIncomplete], 0
jz @f
cmp [writeinfo.code], 2
jz .copydone
push aIncompleteFile
mov eax, esp
push DeleteOrKeepBtn
push 2
push eax
push 1
push -1
push -1
push aCopyCaption
call SayErr
add esp, 4
test eax, eax
jnz .copydone
@@:
mov ebx, delinfo
push dword [ebx+21]
mov dword [ebx+21], edi
push 70
pop eax
int 0x40
; ignore errors
pop dword [delinfo+21]
jmp .copydone
 
.f3:
call view_file
1326,13 → 1485,39
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 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
test eax, eax
jz .retrydel
.ctrl_r:
; Rescan panel
; call read_folder
1356,10 → 1541,9
inc eax
cmp eax, [ebp + panel1_numfiles - panel1_data]
jae .ctrl_r.notfound
mov esi, [ebp + panel1_nfa - panel1_data]
mov ecx, [ebp + panel1_files - panel1_data]
lea esi, [ecx+esi*4+32+40]
add esi, [ecx+eax*4]
mov esi, [ecx+eax*4]
add esi, 40
mov edi, saved_file_name
call strcmpi
jnz @b
1496,6 → 1680,102
pop eax
call get_curfile_folder_entry
jmp .run_association2
.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 + mkdir_dlgdata.width2], eax
shr eax, 1
dec eax
dec eax
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cont_x2], eax
sub eax, a_ContinueLength-1
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cont_x1], eax
add eax, a_ContinueLength+3
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cnl_x1], eax
add eax, aCancelBLength - 1
mov [ebx - mkdir_dlgdata + mkdir_dlgdata.cnl_x2], eax
mov byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags0], 0xC
and byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags1], not 4
and byte [ebx - mkdir_dlgdata + mkdir_dlgdata.flags2], not 4
push ebx
call DialogBox
cmp eax, mkdir_dlgdata.cont_btn
jnz .ret2
mov esi, CopyDestEditBuf+12
cmp byte [esi], 0
jz .ret2
cmp byte [esi], '/'
jz .mkdir_absolute_path
push esi
lea edi, [ebp + panel1_dir - panel1_data]
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 + panel1_dir - panel1_data]
push edi
mov ecx, edx
rep movsb
mov byte [edi-1], '/'
pop esi
.mkdir_absolute_path:
.mkdir_retry:
push 70
pop eax
mov ebx, mkdirinfo
int 0x40
test eax, eax
jz @f
push CopyDestEditBuf+12
push aCannotMakeFolder
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
test eax, eax
jz .mkdir_retry
@@:
jmp .copydone
 
panels_OnRedraw:
call draw_cmdbar
1539,14 → 1819,10
ret
 
get_curfile_folder_entry:
push eax
mov ecx, [ebp + panel1_index - panel1_data]
mov eax, [ebp + panel1_files - panel1_data]
mov ecx, [eax+ecx*4]
mov eax, [ebp + panel1_nfa - panel1_data]
lea ecx, [ecx+eax*4+32]
shl ecx, 2
add ecx, [ebp + panel1_files - panel1_data]
pop eax
mov ecx, [ecx]
ret
get_curfile_name:
call get_curfile_folder_entry
1602,12 → 1878,11
sub ebx, [esp]
dec esi
push esi
mov edx, [ebp + panel1_files - panel1_data]
mov esi, [ebp + panel1_index - panel1_data]
mov esi, [edx+esi*4]
add esi, edx
mov edx, [ebp + panel1_nfa - panel1_data]
lea esi, [esi+edx*4+32+40]
shl esi, 2
add esi, [ebp + panel1_files - panel1_data]
mov esi, [esi]
add esi, 40
push esi
@@:
lodsb
2286,9 → 2561,6
mov ebx, [ebp + panel1_index - panel1_data]
mov eax, [ebp + panel1_files - panel1_data]
mov ebx, [eax+ebx*4]
mov eax, [ebp + panel1_nfa - panel1_data]
lea ebx, [ebx+eax*4+32]
add ebx, [ebp + panel1_files - panel1_data]
mov eax, [ebp + panel1_left - panel1_data]
add eax, [ebp + panel1_width - panel1_data]
dec eax
2519,9 → 2791,7
mov esi, [column_index]
mov ecx, [ebp + panel1_files - panel1_data]
mov esi, [ecx+esi*4]
mov ecx, [ebp + panel1_nfa - panel1_data]
lea esi, [esi + ecx*4 + 32 + 40]
add esi, [ebp + panel1_files - panel1_data]
add esi, 40
mov ah, [esi - 40 + 5]
cmp ebp, [active_panel]
jnz @f
2732,6 → 3002,7
.succ1:
mov [ebp + panel1_files - panel1_data], eax
pop [ebp + panel1_nfa - panel1_data]
mov [prev_dir], 0
jmp read_folder
.readdone:
and [ebp + panel1_start - panel1_data], 0
2739,22 → 3010,44
and [ebp + panel1_start - panel1_data], 0
mov edi, [ebp + panel1_files - panel1_data]
mov eax, [ebp + panel1_nfa - panel1_data]
lea esi, [edi + eax*4 + 32]
xor eax, eax
mov ecx, [esi-32+4]
lea eax, [edi + eax*4 + 32]
mov ecx, [eax-32+4]
test ecx, ecx
jz .loopdone
xor edx, edx
; ˆ£­®à¨à㥬 ᯥ樠«ì­ë¥ ¢å®¤ë, ᮮ⢥âáâ¢ãî騥 ¯ ¯ª¥ '.' ¨ ¬¥âª¥ ⮬ 
.ptrinit:
cmp word [esi+eax+40], '.'
cmp word [eax+40], '.'
jz .loopcont
test byte [esi+eax], 8
test byte [eax], 8
jnz .loopcont
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 + panel1_files - panel1_data]
jbe @f
push dword [edi-4]
pop dword [edi]
sub edi, 4
jmp @b
@@:
stosd
pop edi
scasd
jmp .dotdot
.nodotdot:
stosd
.dotdot:
; ¯®¤á¢¥âª 
; call insert_last_dot
pushad
lea ebp, [esi+eax]
mov ebp, eax
lea esi, [ebp+40]
mov edi, lower_file_name
mov edx, edi
2817,27 → 3110,21
mov ebx, [compare_fns + eax*4]
mov edx, [ebp + panel1_files - panel1_data]
mov ecx, [ebp + panel1_numfiles - panel1_data]
jecxz .skip
mov eax, [edx]
cmp word [eax], '..'
jnz .nodotdot
cmp byte [eax+2], 0
jnz .nodotdot
dec ecx
add edx, 4
.nodotdot:
call sort
.skip:
mov [bSilentFolderMode], 0 ; leave silent mode
ret
 
compare_name:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
2858,22 → 3145,6
ret
 
compare_name_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
2908,22 → 3179,6
ret
 
compare_ext:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
2955,22 → 3210,6
ret
 
compare_ext_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3021,22 → 3260,6
ret
 
compare_modified:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3069,22 → 3292,6
ret
 
compare_modified_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3118,22 → 3325,6
ret
 
compare_size:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3166,22 → 3357,6
ret
 
compare_size_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3218,49 → 3393,10
cmp esi, edi
ret
compare_unordered_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
cmp edi, esi
ret
.greater:
test esi, esi
ret
.less:
xor edi, edi
stc
ret
 
compare_created:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3293,22 → 3429,6
ret
 
compare_created_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3342,22 → 3462,6
ret
 
compare_accessed:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
3390,22 → 3494,6
ret
 
compare_accessed_rev:
push eax
mov eax, [ebp + panel1_nfa - panel1_data]
add esi, [ebp + panel1_files - panel1_data]
add edi, [ebp + panel1_files - panel1_data]
lea esi, [esi+eax*4+0x20]
lea edi, [edi+eax*4+0x20]
pop eax
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz .less
@@: cmp word [edi+40], '..'
jnz @f
cmp byte [edi+42], 0
jz .greater
@@:
test byte [esi], 10h
jnz .1dir
test byte [edi], 10h
4007,7 → 4095,7
pop esi
ret
 
header db 'Kolibri Far 0.2',0
header db 'Kolibri Far 0.21',0
 
nomem_draw db 'No memory for redraw.',0
.size = $ - nomem_draw
4534,6 → 4622,8
dd panels_OnKey.f5
dw 0x3F, 1
dd panels_OnKey.shift_f5
dw 0x41, 0
dd panels_OnKey.f7
dw 0x42, 0
dd panels_OnKey.f8
dw 0x43, 0x100
4644,6 → 4734,15
db 0
dd execdata
 
mkdirinfo:
dd 9
dd 0
dd 0
dd 0
dd 0
db 0
dd CopyDestEditBuf+12
 
if lang eq ru
compare_names db '¨ˆà¬Œ €­á‘¤„'
else
4854,6 → 4953,7
animage db '/rd/1/animage',0
 
bConfirmDelete db 1
bConfirmDeleteIncomplete db 0
 
; ‡¤¥áì § ª ­ç¨¢ îâáï ª®­ä¨£ãà æ¨®­­ë¥ ¤ ­­ë¥
 
4924,7 → 5024,7
.del_x2 dd ?
dd 2
dd aDelete
.flags1 dd 4
.flags1 dd 0xC
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
4932,7 → 5032,7
.cnl_x2 dd ?
dd 2
dd aCancel
.flags2 dd 0
.flags2 dd 8
 
; ¤¨ «®£ ª®¯¨à®¢ ­¨ï
copy_dlgdata:
4983,7 → 5083,57
dd aCancelB
.flags2 dd 8
 
mkdir_dlgdata:
dd 1
dd -1, -1
.width dd ?
.height dd 4
dd 4, 2
dd aMkDirCaption
dd ?
dd 0
dd 0
dd 4
; ‘âப  "‘®§¤ âì ¯ ¯ªã"
dd 1
dd 1,0,aMkDirLen,0
dd aMkDir
dd 0
; ¯®«¥ । ªâ¨à®¢ ­¨ï á ¨¬¥­¥¬ ᮧ¤ ¢ ¥¬®© ¯ ¯ª¨
dd 3
dd 1,1
.width2 dd ?
dd 1
dd CopyDestEditBuf
.flags0 dd 0xC
; ª­®¯ª  "à®¤®«¦¨âì"
.cont_btn:
dd 2
.cont_x1 dd ?
dd 3
.cont_x2 dd ?
dd 3
dd a_Continue
.flags1 dd 18h
; ª­®¯ª  "®â¬¥­¨âì"
dd 2
.cnl_x1 dd ?
dd 3
.cnl_x2 dd ?
dd 3
dd aCancelB
.flags2 dd 8
 
RetryOrCancelBtn:
dd aRetry
dd a_Cancel
DeleteOrKeepBtn:
dd a_Delete
dd aKeep
RetryOrIgnoreBtn:
dd aRetry
dd aIgnore
 
if lang eq ru
aDeleteCaption db '“¤ «¥­¨¥',0
aConfirmDeleteText db '‚ë å®â¨â¥ 㤠«¨âì ',0
4999,11 → 5149,15
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
error0msg db '‘âà ­­®... ¥â ®è¨¡ª¨',0
error1msg db '‘âà ­­®... ¥ ®¯à¥¤¥«¥­  ¡ §  ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0
error2msg db '”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë',0
5021,6 → 5175,22
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
aIgnore db 'ˆ£­®à¨à®¢ âì',0
aMkDirCaption db '‘®§¤ ­¨¥ ¯ ¯ª¨',0
aMkDir db '‘®§¤ âì ¯ ¯ªã',0
aMkDirLen = $ - aMkDir - 1
aCannotMakeFolder db '¥ ¬®£ã ᮧ¤ âì ¯ ¯ªã',0
else
aDeleteCaption db 'Delete',0
aConfirmDeleteText db 'Do you wish to delete ',0
5036,11 → 5206,15
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
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
5058,6 → 5232,22
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 file',0
aCannotDeleteFile db 'Cannot delete file',0
aCannotDeleteFolder db 'Cannot delete 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
end if
aOk db 'OK',0
aNoMemory db 'No memory!',0
5078,6 → 5268,7
IncludeUGlobals
 
execdata rb 1024
execdataend:
align 4
attrinfo.attr rb 40
 
5161,7 → 5352,7
aConfirmDeleteTextBuf rb aConfirmDeleteTextMax + 1
CopySourceTextBuf rb 512
CopyDestEditBuf rb 12+512+1
.length = $ - CopyDestEditBuf - 9
.length = $ - CopyDestEditBuf - 13
 
align 4
layout rb 128
/programs/fs/kfar/trunk/viewer.inc
19,9 → 19,6
view_file:
mov eax, [ebp + panel1_files - panel1_data]
mov ecx, [eax+ecx*4]
mov eax, [ebp + panel1_nfa - panel1_data]
lea ecx, [ecx+eax*4+32]
add ecx, [ebp + panel1_files - panel1_data]
test byte [ecx], 10h
jz .file
ret
59,10 → 56,32
push eax
mov ebx, attrinfo
mov [ebx+21], eax
.attr_retry:
push 70
pop eax
int 40h
; TODO: add error handling
test eax, eax
jz @f
lea ebx, [ebp+viewer_data.filename]
push ebx
push aCannotReadFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
mov ebx, attrinfo
test eax, eax
jz .attr_retry
jmp delete_active_screen
@@:
mov eax, dword [attrinfo.attr+32]
mov dword [ebp+viewer_data.filesize], eax
mov eax, dword [attrinfo.attr+36]
80,11 → 99,35
mov [readinfo.data], eax
mov [ebp+viewer_data.buf_pos], eax
pop dword [readinfo.name]
.retry:
push 70
pop eax
int 40h
mov [ebp+viewer_data.buf_size], ebx
; TODO: add error handling
test eax, eax
jz .readok
cmp eax, 6
jz .readok
lea ebx, [ebp+viewer_data.filename]
push ebx
push aCannotReadFile
call get_error_msg
push eax
mov eax, esp
push RetryOrCancelBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
mov ebx, readinfo
test eax, eax
jz .attr_retry
jmp delete_active_screen
.readok:
call viewer_set_keybar
call viewer_draw_text
ret
118,10 → 161,18
mov [readinfo.data], edi
lea eax, [ebp+viewer_data.filename]
mov [readinfo.name], eax
.readretry:
mov ebx, readinfo
push 70
pop eax
int 40h
test eax, eax
jz .readok
cmp eax, 6
jz .readok
call ask_retry_ignore
jz .readretry
.readok:
sub [ebp+viewer_data.buf_pos], 8192
add ebx, 16384-8192
mov [ebp+viewer_data.buf_size], ebx
781,6 → 832,13
push 70
pop eax
int 40h
test eax, eax
jz .readok
cmp eax, 6
jz .readok
call ask_retry_ignore
jz .doread
.readok:
cmp ebx, [readinfo.size]
jnz @f
add ebx, [ebp+viewer_data.buf_size]
822,13 → 880,44
mov [ebx+12], eax
lea eax, [ebp+viewer_data.filename]
mov [ebx+21], eax
@@:
push 70
pop eax
int 40h
test eax, eax
jz @f
cmp eax, 6
jz @f
call ask_retry_ignore
jnz @f
mov ebx, readinfo
jmp @b
@@:
sub ebx, [readinfo.size]
add ebx, 16384
jmp .ret
 
ask_retry_ignore:
push esi
lea esi, [ebp+viewer_data.filename]
push esi
push aCannotReadFile
call get_error_msg
push eax
mov eax, esp
push RetryOrIgnoreBtn
push 2
push eax
push 3
push -1
push -1
push aError
call SayErr
add esp, 3*4
pop esi
test eax, eax
ret
 
viewer_set_curpos:
mov eax, [ebp+viewer_data.buf_pos]
sub eax, ebp