* New sysfunction 70.9, create folder

* Deleted obsolete 58.4 (create folder 8.3 on hd)
* Updated docs
* Bugfixes (file system; core; direct screen access), improvements (sysfn 70.3)
* KFar 0.21, full error handling, folder creation (with new kernel)

git-svn-id: svn://kolibrios.org@321 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2007-02-05 14:20:36 +00:00
parent 5756e1bfc8
commit 1ace68286b
23 changed files with 913 additions and 870 deletions

View File

@ -75,13 +75,11 @@ align 4
hd_read_pio: hd_read_pio:
push eax edx push eax edx
call disable_ide_int
call wait_for_hd_idle call wait_for_hd_idle
cmp [hd_error],0 cmp [hd_error],0
jne hd_read_error jne hd_read_error
; cli cli
xor eax,eax xor eax,eax
mov edx,[hdbase] mov edx,[hdbase]
inc edx inc edx
@ -107,14 +105,14 @@ hd_read_pio:
inc edx inc edx
mov al,20h mov al,20h
out dx,al ; ATACommand ॣ¨áâà ª®¬ ­¤ out dx,al ; ATACommand ॣ¨áâà ª®¬ ­¤
; sti sti
call wait_for_sector_buffer call wait_for_sector_buffer
cmp [hd_error],0 cmp [hd_error],0
jne hd_read_error jne hd_read_error
; cli cli
push edi push edi
shl edi,9 shl edi,9
add edi,0x600000+65536 add edi,0x600000+65536
@ -123,9 +121,7 @@ hd_read_pio:
cld cld
rep insw rep insw
pop edi pop edi
; sti sti
call enable_ide_int
pop edx eax pop edx eax
ret ret
@ -420,8 +416,8 @@ endg
hd_timeout_error: hd_timeout_error:
call clear_hd_cache ; call clear_hd_cache
call clear_application_table_status ; call clear_application_table_status
mov esi,hd_timeout_str mov esi,hd_timeout_str
call sys_msg_board_str call sys_msg_board_str
; jmp $ ; jmp $
@ -431,8 +427,8 @@ hd_timeout_error:
hd_read_error: hd_read_error:
call clear_hd_cache ; call clear_hd_cache
call clear_application_table_status ; call clear_application_table_status
mov esi,hd_read_str mov esi,hd_read_str
call sys_msg_board_str call sys_msg_board_str
pop edx eax pop edx eax
@ -440,23 +436,23 @@ hd_read_error:
hd_write_error: hd_write_error:
call clear_hd_cache ; call clear_hd_cache
call clear_application_table_status ; call clear_application_table_status
mov esi,hd_write_str mov esi,hd_write_str
call sys_msg_board_str call sys_msg_board_str
ret ret
hd_write_error_dma: hd_write_error_dma:
call clear_hd_cache ; call clear_hd_cache
call clear_application_table_status ; call clear_application_table_status
mov esi, hd_write_str mov esi, hd_write_str
call sys_msg_board_str call sys_msg_board_str
pop esi pop esi
ret ret
hd_lba_error: hd_lba_error:
call clear_hd_cache ; call clear_hd_cache
call clear_application_table_status ; call clear_application_table_status
mov esi,hd_lba_str mov esi,hd_lba_str
call sys_msg_board_str call sys_msg_board_str
jmp LBA_read_ret jmp LBA_read_ret

View File

@ -1466,12 +1466,13 @@ fat_gen_short_name:
;---------------------------------------------------------------- ;----------------------------------------------------------------
; ;
; 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) ; ebx ignored (reserved)
; ecx number of bytes to write, 0+ ; ecx number of bytes to write, 0+ (ignored for folders)
; edx mem location to data ; edx mem location to data (ignored for folders)
; ;
; ret ebx = number of written bytes ; ret ebx = number of written bytes
; eax = 0 ok read or other = errormsg ; eax = 0 ok read or other = errormsg
@ -1482,7 +1483,13 @@ fat_gen_short_name:
xor ebx, ebx xor ebx, ebx
ret ret
fs_RamdiskCreateFolder:
mov al, 1 ; create folder
jmp fs_RamdiskRewrite.common
fs_RamdiskRewrite: fs_RamdiskRewrite:
xor eax, eax ; create file
.common:
cmp byte [esi], 0 cmp byte [esi], 0
jz @b jz @b
pushad pushad
@ -1537,8 +1544,24 @@ fs_RamdiskRewrite:
.common1: .common1:
call fat_find_lfn call fat_find_lfn
jc .notfound jc .notfound
; found; must not be directory ; found
test byte [edi+11], 10h 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 jz @f
add esp, 20 add esp, 20
popad popad
@ -1556,7 +1579,7 @@ fs_RamdiskRewrite:
@@: @@:
cmp eax, 0xFF8 cmp eax, 0xFF8
jae .done1 jae .done1
lea edi, [0x280000 + eax*2] ; position in FAT lea edi, [RAMDISK_FAT + eax*2] ; position in FAT
xor eax, eax xor eax, eax
xchg ax, [edi] xchg ax, [edi]
jmp @b jmp @b
@ -1748,6 +1771,12 @@ fs_RamdiskRewrite:
and word [edi+20], 0 ; high word of cluster and word [edi+20], 0 ; high word of cluster
and word [edi+26], 0 ; low word of cluster - to be filled and word [edi+26], 0 ; low word of cluster - to be filled
and dword [edi+28], 0 ; file size - 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: .doit:
push edx push edx
push ecx push ecx
@ -1756,7 +1785,7 @@ fs_RamdiskRewrite:
push edi push edi
jecxz .done jecxz .done
mov ecx, 2849 mov ecx, 2849
mov edi, 0x280000 mov edi, RAMDISK_FAT
.write_loop: .write_loop:
; allocate new cluster ; allocate new cluster
xor eax, eax xor eax, eax
@ -1764,7 +1793,7 @@ fs_RamdiskRewrite:
jnz .disk_full2 jnz .disk_full2
dec edi dec edi
dec edi dec edi
lea eax, [edi-0x280000] lea eax, [edi-(RAMDISK_FAT)]
shr eax, 1 ; eax = cluster shr eax, 1 ; eax = cluster
mov word [edi], 0xFFF ; mark as last cluster mov word [edi], 0xFFF ; mark as last cluster
xchg edi, [esp] xchg edi, [esp]
@ -1773,8 +1802,11 @@ fs_RamdiskRewrite:
push edi push edi
inc ecx inc ecx
; write data ; write data
cmp byte [esp+16+20+28], 0
jnz .writedir
shl eax, 9 shl eax, 9
add eax, 0x100000+31*512 add eax, RAMDISK+31*512
.writefile:
mov ebx, edx mov ebx, edx
xchg eax, ebx xchg eax, ebx
push ecx push ecx
@ -1809,6 +1841,34 @@ fs_RamdiskRewrite:
push ERROR_DISK_FULL push ERROR_DISK_FULL
pop eax pop eax
ret 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: .read_symbol:
or ax, -1 or ax, -1

View File

@ -16,10 +16,12 @@ sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
add edx,ecx add edx,ecx
img_save_hd_3: img_save_hd_3:
call reserve_hd1 call reserve_hd1
call reserve_hd_channel
call restorefatchain ; restore FAT !!! call restorefatchain ; restore FAT !!!
mov eax,image_save mov eax,image_save
mov ebx,1440*1024 ; size 1440 Kb mov ebx,1440*1024 ; size 1440 Kb
mov ecx,0x100000 ; address of image mov ecx,0x100000 ; address of image
call file_write call file_write
call free_hd_channel
mov [esp+36],eax mov [esp+36],eax
ret ret

View File

@ -91,7 +91,7 @@ app_data_l:
graph_data_l: graph_data_l:
dw 0x3ff dw 0x7ff
dw 0x0000 dw 0x0000
db 0x00 db 0x00
dw 11010000b *256 +11110010b dw 11010000b *256 +11110010b

View File

@ -65,7 +65,6 @@
jmp yes_sys_on_hd jmp yes_sys_on_hd
search_and_read_image: search_and_read_image:
; mov [0xfe10],dword 0 ; entries in hd cache
call set_FAT32_variables call set_FAT32_variables
mov edx, bootpath mov edx, bootpath
call read_image call read_image

View File

@ -175,7 +175,6 @@ X_UNDER equ OS_BASE+0x000FB4A
Y_UNDER equ OS_BASE+0x000FB4C Y_UNDER equ OS_BASE+0x000FB4C
ScreenBPP equ OS_BASE+0x000FBF1 ScreenBPP equ OS_BASE+0x000FBF1
MOUSE_BUFF_COUNT equ OS_BASE+0x000FCFF MOUSE_BUFF_COUNT equ OS_BASE+0x000FCFF
HD_CACHE_ENT equ OS_BASE+0x000FE10
LFBAddress equ OS_BASE+0x000FE80 LFBAddress equ OS_BASE+0x000FE80
MEM_AMOUNT equ OS_BASE+0x000FE8C MEM_AMOUNT equ OS_BASE+0x000FE8C
;LFBSize equ OS_BASE+0x02f9050 ;LFBSize equ OS_BASE+0x02f9050

View File

@ -366,7 +366,7 @@ proc alloc_kernel_space stdcall, size:dword
endp endp
align 4 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 mov ebx, heap_mutex
call wait_mutex ;ebx call wait_mutex ;ebx
@ -461,7 +461,7 @@ proc free_kernel_space stdcall, base:dword
.m_eq: .m_eq:
xor eax, eax xor eax, eax
mov [heap_mutex], eax mov [heap_mutex], eax
not eax dec eax
ret ret
.insert: .insert:
remove_from_used esi remove_from_used esi
@ -480,7 +480,7 @@ proc free_kernel_space stdcall, base:dword
mov [esi+block_flags],FREE_BLOCK mov [esi+block_flags],FREE_BLOCK
xor eax, eax xor eax, eax
mov [heap_mutex], eax mov [heap_mutex], eax
not eax dec eax
ret ret
.fail: .fail:
xor eax, eax xor eax, eax
@ -557,6 +557,7 @@ endp
align 4 align 4
proc kernel_free stdcall, base:dword proc kernel_free stdcall, base:dword
push ebx esi
mov ebx, heap_mutex mov ebx, heap_mutex
call wait_mutex ;ebx call wait_mutex ;ebx
@ -577,13 +578,17 @@ proc kernel_free stdcall, base:dword
and [heap_mutex], 0 and [heap_mutex], 0
push ecx
mov ecx, [esi+block_size]; mov ecx, [esi+block_size];
shr ecx, 12 shr ecx, 12
call release_pages ;eax, ecx call release_pages ;eax, ecx
pop ecx
stdcall free_kernel_space, [base] stdcall free_kernel_space, [base]
pop esi ebx
ret ret
.fail: .fail:
and [heap_mutex], 0 and [heap_mutex], 0
pop esi ebx
ret ret
endp endp

View File

@ -231,6 +231,7 @@ endp
align 4 align 4
proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
push ebx
mov eax, [phis_addr] mov eax, [phis_addr]
and eax, not 0xFFF and eax, not 0xFFF
or eax, [flags] or eax, [flags]
@ -239,6 +240,7 @@ proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
mov [pages_tab+ebx*4], eax mov [pages_tab+ebx*4], eax
mov eax, [lin_addr] mov eax, [lin_addr]
invlpg [eax] invlpg [eax]
pop ebx
ret ret
endp endp
@ -290,7 +292,7 @@ commit_pages: ;not implemented
align 4 align 4
release_pages: release_pages:
push ebp pushad
mov ebx, pg_data.pg_mutex mov ebx, pg_data.pg_mutex
call wait_mutex ;ebx call wait_mutex ;ebx
@ -329,11 +331,12 @@ release_pages:
jnz @B jnz @B
mov [pg_data.pages_free], ebp mov [pg_data.pages_free], ebp
and [pg_data.pg_mutex],0 and [pg_data.pg_mutex],0
pop ebp popad
ret ret
align 4 align 4
proc map_page_table stdcall, lin_addr:dword, phis_addr:dword proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
push ebx
mov ebx, [lin_addr] mov ebx, [lin_addr]
shr ebx, 22 shr ebx, 22
mov eax, [phis_addr] mov eax, [phis_addr]
@ -344,6 +347,7 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
shr eax, 10 shr eax, 10
add eax, pages_tab add eax, pages_tab
invlpg [eax] invlpg [eax]
pop ebx
ret ret
endp endp

View File

@ -768,10 +768,12 @@ fpu_ok_1:
mov esi, [esi+0x3000+TASKDATA.pid] mov esi, [esi+0x3000+TASKDATA.pid]
cmp [hd1_status], esi cmp [hd1_status], esi
jnz @f jnz @f
call free_hd_channel
mov [hd1_status], 0 mov [hd1_status], 0
@@: @@:
cmp [cd_status], esi cmp [cd_status], esi
jnz @f jnz @f
call free_cd_channel
mov [cd_status], 0 mov [cd_status], 0
@@: @@:
cmp [flp_status], esi cmp [flp_status], esi

View File

@ -208,6 +208,7 @@ end if
.err_file: .err_file:
xor eax, eax xor eax, eax
mov [application_table_status],eax mov [application_table_status],eax
mov eax, ecx
ret ret
endp endp
@ -951,15 +952,16 @@ align 4
wait_mutex: wait_mutex:
push eax push eax
push ebx push ebx
.do_wait:
cmp dword [ebx],0 cmp dword [ebx],0
je .get_lock je .get_lock
call change_task call change_task
jmp wait_mutex jmp .do_wait
.get_lock: .get_lock:
mov eax, 1 mov eax, 1
xchg eax, [ebx] xchg eax, [ebx]
test eax, eax test eax, eax
jnz wait_mutex jnz .do_wait
pop ebx pop ebx
pop eax pop eax
ret ret

View File

@ -76,21 +76,21 @@
partition_data_transfer: partition_data_transfer:
mov edi,[transfer_adress] mov edi,[transfer_adress]
mov esi,PARTITION_START mov esi,PARTITION_START
xor ecx,ecx mov ecx,(file_system_data_size+3)/4
mov cx,69 ;100 rep movsd
rep movsb
ret ret
uglobal
transfer_adress dd 0 transfer_adress dd 0
endg
partition_data_transfer_1: partition_data_transfer_1:
cli ; cli
push edi push edi
mov edi,PARTITION_START mov edi,PARTITION_START
mov esi,[transfer_adress] mov esi,[transfer_adress]
xor ecx,ecx mov ecx,(file_system_data_size+3)/4
mov cx,69 ;100 rep movsd
rep movsb
pop edi pop edi
sti ; sti
ret ret
end_search_partitions_ide: end_search_partitions_ide:

View File

@ -2905,8 +2905,6 @@ dword-
„®αβγ―­λ¥ ―®¤δγ­<CEB3>樨: „®αβγ―­λ¥ ―®¤δγ­<CEB3>樨:
* ―®¤δγ­<CEB3>ζ¨ο 0 - ηβ¥­¨¥ δ ©« /― <C2A0>¨ * ―®¤δγ­<CEB3>ζ¨ο 0 - ηβ¥­¨¥ δ ©« /― <C2A0>¨
* ―®¤δγ­<CEB3>ζ¨ο 1 - ―¥ΰ¥§ ―¨αμ δ ©«  * ―®¤δγ­<CEB3>ζ¨ο 1 - ―¥ΰ¥§ ―¨αμ δ ©« 
* ¯®¤äã­ªæ¨ï 4 - ᮧ¤ ­¨¥ ¯ ¯ª¨
* ¯®¤äã­ªæ¨ï 5 - ¯¥à¥¨¬¥­®¢ ­¨¥/¯¥à¥¬¥é¥­¨¥ ä ©« /¯ ¯ª¨
* ―®¤δγ­<CEB3>ζ¨ο 8 - LBA-ηβ¥­¨¥ α γαβΰ®©αβΆ  * ―®¤δγ­<CEB3>ζ¨ο 8 - LBA-ηβ¥­¨¥ α γαβΰ®©αβΆ 
* ―®¤δγ­<CEB3>ζ¨ο 15 - ―®«γη¥­¨¥ ¨­δ®ΰ¬ ζ¨¨ ® δ ©«®Ά®© α¨α⥬¥ * ―®¤δγ­<CEB3>ζ¨ο 15 - ―®«γη¥­¨¥ ¨­δ®ΰ¬ ζ¨¨ ® δ ©«®Ά®© α¨α⥬¥
@ -2994,59 +2992,6 @@ dword-
‡ ¬¥η ­¨ο: ‡ ¬¥η ­¨ο:
* <20>β  δγ­<CEB3>ζ¨ο γαβ ΰ¥« , ¨α―®«μ§γ©β¥ ―®¤δγ­<CEB3>ζ¨ξ 2 δγ­<CEB3>樨 70. * <20>β  δγ­<CEB3>ζ¨ο γαβ ΰ¥« , ¨α―®«μ§γ©β¥ ―®¤δγ­<CEB3>ζ¨ξ 2 δγ­<CEB3>樨 70.
======================================================================
============== ”ã­ªæ¨ï 58, ¯®¤äã­ªæ¨ï 4 - ᮧ¤ âì ¯ ¯ªã. =============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 58 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨­ä®à¬ æ¨®­­ãî áâàãªâãàã
”®à¬ â ¨­ä®à¬ æ¨®­­®© áâàãªâãàë:
* +0: dword: 4 = ­®¬¥à ¯®¤ä㭪樨
* +4: dword: ¨£­®à¨àã¥âáï
* +8: dword: ¨£­®à¨àã¥âáï
* +12 = +0xC: dword: ¨£­®à¨àã¥âáï
* +16 = +0x10: dword: 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
(4096 ¡ ©â)
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨«  ä®à¬¨à®¢ ­¨ï ¨¬ñ­ 㪠§ ­ë ¢
®¡é¥¬ ®¯¨á ­¨¨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
* ebx à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* <20> ¬¤¨áª ¨ ¤¨áª¥âë ­¥ ¯®¤¤¥à¦¨¢ îâ íâã äã­ªæ¨î,
®­  ⮫쪮 ¤«ï ¦ñáâª¨å ¤¨áª®¢.
======================================================================
== ”ã­ªæ¨ï 58, ¯®¤äã­ªæ¨ï 5 - ¯¥à¥¨¬¥­®¢ âì/¯¥à¥¬¥áâ¨âì ä ©«/¯ ¯ªã. ==
======================================================================
<EFBFBD> à ¬¥âàë:
* 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 à §àãè ¥âáï
‡ ¬¥ç ­¨ï:
* <20> ¬¤¨áª ¨ ¤¨áª¥âë ­¥ ¯®¤¤¥à¦¨¢ îâ íâã äã­ªæ¨î,
®­  ⮫쪮 ¤«ï ¦ñáâª¨å ¤¨áª®¢.
* …᫨ ­®¢®¥ ASCIIZ-¨¬ï ᨫ쭮 ­¥¯à ¢¨«ì­®¥, â.¥. ­¥ ­ ç¨­ ¥âáï á
/hd/1, /hd/first, /harddisk/1, /harddisk/first ¨«¨ ¯®á«¥ í⮣®
­ ç «  ¨¤ñ⠯஡¥« ¨«¨ ᨬ¢®« á ª®¤®¬ 0, â® äã­ªæ¨ï ¢®§¢à é ¥â,
ª ª ­¨ áâà ­­®, ª®¤ ®è¨¡ª¨ 4. <20>â® ¥¤¨­á⢥­­ ï äã­ªæ¨ï, ª®â®à ï
¢®®¡é¥ ¢®§¢à é ¥â íâ®â ª®¤.
====================================================================== ======================================================================
========= ”γ­<CEB3>ζ¨ο 58, ―®¤δγ­<CEB3>ζ¨ο 8 - LBA-ηβ¥­¨¥ α γαβΰ®©αβΆ . ======== ========= ”γ­<CEB3>ζ¨ο 58, ―®¤δγ­<CEB3>ζ¨ο 8 - LBA-ηβ¥­¨¥ α γαβΰ®©αβΆ . ========
====================================================================== ======================================================================
@ -4097,6 +4042,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ―®¤δγ­<CEB3>ζ¨ο 6 - γαβ ­®Ά<C2AE>   βਡγβ®Ά δ ©« /― <C2A0>¨ * ―®¤δγ­<CEB3>ζ¨ο 6 - γαβ ­®Ά<C2AE>   βਡγβ®Ά δ ©« /― <C2A0>¨
* ―®¤δγ­<CEB3>ζ¨ο 7 - § γα<CEB3> ―ணࠬ¬λ * ―®¤δγ­<CEB3>ζ¨ο 7 - § γα<CEB3> ―ணࠬ¬λ
* ―®¤δγ­<CEB3>ζ¨ο 8 - γ¤ «¥­¨¥ δ ©« /― <C2A0>¨ * ―®¤δγ­<CEB3>ζ¨ο 8 - γ¤ «¥­¨¥ δ ©« /― <C2A0>¨
* ¯®¤äã­ªæ¨ï 9 - ᮧ¤ ­¨¥ ¯ ¯ª¨
„«ο CD-―ΰ¨Ά®¤®Ά Ά αΆο§¨ α  ―― ΰ β­λ¬¨ ®£ΰ ­¨η¥­¨ο¬¨ ¤®αβγ―­λ „«ο CD-―ΰ¨Ά®¤®Ά Ά αΆο§¨ α  ―― ΰ β­λ¬¨ ®£ΰ ­¨η¥­¨ο¬¨ ¤®αβγ―­λ
β®«μ<EFBFBD>® ―®¤δγ­<CEB3>樨 0,1,5 ¨ 7, Άλ§®Ά ¤ΰγ£¨ε ―®¤δγ­<CEB3>権 § Ά¥ΰθ¨βαο β®«μ<EFBFBD>® ―®¤δγ­<CEB3>樨 0,1,5 ¨ 7, Άλ§®Ά ¤ΰγ£¨ε ―®¤δγ­<CEB3>権 § Ά¥ΰθ¨βαο
®θ¨΅<EFBFBD>®© α <20>®¤®¬ 2. ®θ¨΅<EFBFBD>®© α <20>®¤®¬ 2.
@ -4434,6 +4380,31 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* <20>®¦­® γ¤ «οβμ β®«μ<C2AB>® ―γαβλ¥ ― <C2A0>¨ (―®―λβ<CEBB>  γ¤ «¥­¨ο ­¥―γαβ®© ― <C2A0>¨ * <20>®¦­® γ¤ «οβμ β®«μ<C2AB>® ―γαβλ¥ ― <C2A0>¨ (―®―λβ<CEBB>  γ¤ «¥­¨ο ­¥―γαβ®© ― <C2A0>¨
―ΰ¨Ά¥¤ρβ <20> ®θ¨΅<C2A8>¥ α <20>®¤®¬ 10, "¤®αβγ― § ―ΰ¥ιρ­"). ―ΰ¨Ά¥¤ρβ <20> ®θ¨΅<C2A8>¥ α <20>®¤®¬ 10, "¤®αβγ― § ―ΰ¥ιρ­").
======================================================================
============= ”ã­ªæ¨ï 70, ¯®¤äã­ªæ¨ï 9 - ᮧ¤ ­¨¥ ¯ ¯ª¨. =============
======================================================================
<EFBFBD> à ¬¥âàë:
* 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).
* <20>®¤¨â¥«ìáª ï ¯ ¯ª  ¤®«¦­  㦥 áãé¥á⢮¢ âì.
* …᫨ ¯ ¯ª  㦥 áãé¥áâ¢ã¥â, äã­ªæ¨ï § ¢¥àè¨âáï ãᯥ譮 (eax=0).
====================================================================== ======================================================================
=== ”γ­<CEB3>ζ¨ο 71, ―®¤δγ­<CEB3>ζ¨ο 1 - γαβ ­®Ά¨βμ § £®«®Ά®<CE86> ®<>­  ―ணࠬ¬λ. == === ”γ­<CEB3>ζ¨ο 71, ―®¤δγ­<CEB3>ζ¨ο 1 - γαβ ­®Ά¨βμ § £®«®Ά®<CE86> ®<>­  ―ணࠬ¬λ. ==
====================================================================== ======================================================================

View File

@ -2878,8 +2878,6 @@ Examples:
Existing subfunctions: Existing subfunctions:
* subfunction 0 - read file/folder * subfunction 0 - read file/folder
* subfunction 1 - rewrite file * subfunction 1 - rewrite file
* subfunction 4 - make folder
* subfunction 5 - rename/move file/folder
* subfunction 8 - LBA-read from device * subfunction 8 - LBA-read from device
* subfunction 15 - get file system information * subfunction 15 - get file system information
@ -2968,59 +2966,6 @@ Returned value:
Remarks: Remarks:
* This function is obsolete, use subfunction 2 of function 70. * 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. ========= ========= Function 58, subfunction 8 - LBA-read from device. =========
====================================================================== ======================================================================
@ -4060,6 +4005,7 @@ Available subfunctions:
* subfunction 6 - set attributes of file/folder * subfunction 6 - set attributes of file/folder
* subfunction 7 - start application * subfunction 7 - start application
* subfunction 8 - delete file/folder * subfunction 8 - delete file/folder
* subfunction 9 - create folder
For CD-drives due to hardware limitations only subfunctions For CD-drives due to hardware limitations only subfunctions
0,1,5 and 7 are available, other subfunctions return error 0,1,5 and 7 are available, other subfunctions return error
with code 2. with code 2.
@ -4158,7 +4104,7 @@ Structure of block of data for folder entry (BDFE):
* +40 = +0x28: name * +40 = +0x28: name
* for ASCII format: maximum length is 263 characters * for ASCII format: maximum length is 263 characters
(263 bytes), byte after the name has value 0 (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 (518 bytes), 2 bytes after the name have value 0
Time format: Time format:
* +0: byte: seconds * +0: byte: seconds
@ -4392,6 +4338,31 @@ Remarks:
* The function can delete only empty folders (attempt to delete * The function can delete only empty folders (attempt to delete
nonempty folder results in error with code 10, "access denied"). 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. ========== ========== Function 71, subfunction 1 - set window caption. ==========
====================================================================== ======================================================================

View File

@ -1550,7 +1550,13 @@ fsfrfe:
xor ebx, ebx xor ebx, ebx
ret ret
fs_FloppyCreateFolder:
mov al, 1
jmp fs_FloppyRewrite.common
fs_FloppyRewrite: fs_FloppyRewrite:
xor eax, eax
.common:
cmp byte [esi], 0 cmp byte [esi], 0
jz @b jz @b
call read_flp_fat call read_flp_fat
@ -1616,8 +1622,24 @@ fs_FloppyRewrite:
.common1: .common1:
call fat_find_lfn call fat_find_lfn
jc .notfound jc .notfound
; found; must not be directory ; found
test byte [edi+11], 10h 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 jz @f
add esp, 28 add esp, 28
popad popad
@ -1635,7 +1657,7 @@ fs_FloppyRewrite:
@@: @@:
cmp eax, 0xFF8 cmp eax, 0xFF8
jae .done1 jae .done1
lea edi, [0x282000 + eax*2] ; position in FAT lea edi, [FLOPPY_FAT + eax*2] ; position in FAT
xor eax, eax xor eax, eax
xchg ax, [edi] xchg ax, [edi]
jmp @b jmp @b
@ -1840,6 +1862,12 @@ fs_FloppyRewrite:
and word [edi+20], 0 ; high word of cluster and word [edi+20], 0 ; high word of cluster
and word [edi+26], 0 ; low word of cluster - to be filled and word [edi+26], 0 ; low word of cluster - to be filled
and dword [edi+28], 0 ; file size - 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: .doit:
lea eax, [esp+8] lea eax, [esp+8]
call dword [eax+12] ; flush directory call dword [eax+12] ; flush directory
@ -1847,9 +1875,10 @@ fs_FloppyRewrite:
push edi push edi
push 0 push 0
mov esi, edx mov esi, edx
jecxz .done test ecx, ecx
jz .done
mov ecx, 2849 mov ecx, 2849
mov edi, 0x282000 mov edi, FLOPPY_FAT
push 0 ; first cluster push 0 ; first cluster
.write_loop: .write_loop:
; allocate new cluster ; allocate new cluster
@ -1859,7 +1888,7 @@ fs_FloppyRewrite:
jnz .ret jnz .ret
dec edi dec edi
dec edi dec edi
lea eax, [edi-0x282000] lea eax, [edi-(FLOPPY_FAT)]
shr eax, 1 ; eax = cluster shr eax, 1 ; eax = cluster
mov word [edi], 0xFFF ; mark as last cluster mov word [edi], 0xFFF ; mark as last cluster
xchg edi, [esp+4] xchg edi, [esp+4]
@ -1879,10 +1908,13 @@ fs_FloppyRewrite:
jae @f jae @f
mov ecx, [esp+20] mov ecx, [esp+20]
@@: @@:
push ecx
mov edi, 0xD000 mov edi, 0xD000
cmp byte [esp+24+28+28], 0
jnz .writedir
push ecx
rep movsb rep movsb
pop ecx pop ecx
.writedircont:
push ecx push ecx
sub ecx, 512 sub ecx, 512
neg ecx neg ecx
@ -1935,6 +1967,28 @@ fs_FloppyRewrite:
mov eax, 11 mov eax, 11
pop edi ecx pop edi ecx
jmp .ret 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 @@ fs_FloppyWrite:
jz .ret jz .ret
call SetUserInterrupts call SetUserInterrupts
.write_loop: .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 lea eax, [edi+31] ; current sector
; get length of data in current sector ; get length of data in current sector
push ecx push ecx
@ -2129,6 +2190,7 @@ fs_FloppyWrite:
sub [esp], ecx sub [esp], ecx
pop ecx pop ecx
jz .done jz .done
.skip:
.next_cluster: .next_cluster:
movzx edi, word [edi*2+0x282000] movzx edi, word [edi*2+0x282000]
sub esi, 0x200 sub esi, 0x200
@ -2488,6 +2550,7 @@ fs_FloppySetFileInfo:
@@: @@:
ret ret
if 0
;---------------------------------------------------------------- ;----------------------------------------------------------------
; ;
; fs_FloppyExecute - LFN variant for executing from floppy ; fs_FloppyExecute - LFN variant for executing from floppy
@ -2589,6 +2652,7 @@ fs_FloppyExecute:
popad popad
mov eax, 11 mov eax, 11
ret ret
end if
;---------------------------------------------------------------- ;----------------------------------------------------------------
; ;

View File

@ -7,6 +7,7 @@
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;; ;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
;; ;; ;; ;;
;; See file COPYING for details ;; ;; See file COPYING for details ;;
;; 04.02.2007 LFN create folder - diamond ;;
;; 08.10.2006 LFN delete file/folder - diamond ;; ;; 08.10.2006 LFN delete file/folder - diamond ;;
;; 20.08.2006 LFN set file size (truncate/extend) - diamond ;; ;; 20.08.2006 LFN set file size (truncate/extend) - diamond ;;
;; 17.08.2006 LFN write/append to file - diamond ;; ;; 17.08.2006 LFN write/append to file - diamond ;;
@ -101,13 +102,6 @@ fat_cache: times 512 db 0
fsinfo_buffer: times 512 db 0 fsinfo_buffer: times 512 db 0
endg endg
iglobal
NewDirEntry1 db ". ",0x10
times 20 db 0
NewDirEntry2 db ".. ",0x10
times 20 db 0
endg
uglobal uglobal
dir_entry: times 32 db 0 dir_entry: times 32 db 0
@ -139,6 +133,11 @@ reserve_hd1:
sti sti
ret ret
;******************************************** ;********************************************
uglobal
hd_in_cache db ?
endg
reserve_hd_channel: reserve_hd_channel:
cmp [hdbase], 0x1F0 cmp [hdbase], 0x1F0
jne .IDE_Channel_2 jne .IDE_Channel_2
@ -155,12 +154,25 @@ reserve_hd_channel:
je .reserve_ok_2 je .reserve_ok_2
sti sti
call change_task call change_task
jmp .IDE_Channel_1 jmp .IDE_Channel_2
.reserve_ok_1: .reserve_ok_1:
mov [IDE_Channel_1],1 mov [IDE_Channel_1], 1
ret push eax
mov al, 1
jmp @f
.reserve_ok_2: .reserve_ok_2:
mov [IDE_Channel_2],1 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 ret
free_hd_channel: free_hd_channel:
@ -806,189 +818,6 @@ set_current_time_for_entry:
ret 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: add_disk_free_space:
;----------------------------------------------------- ;-----------------------------------------------------
@ -1664,172 +1493,6 @@ delete_entry_name:
ret 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: get_hd_info:
;----------------------------------------------------------- ;-----------------------------------------------------------
; output : eax = 0 - ok ; output : eax = 0 - ok
@ -2555,7 +2218,13 @@ fshrfs:
xor ebx, ebx xor ebx, ebx
ret ret
fs_HdCreateFolder:
mov al, 1
jmp fs_HdRewrite.common
fs_HdRewrite: fs_HdRewrite:
xor eax, eax
.common:
cmp [fs_type], 1 cmp [fs_type], 1
jz ntfs_HdRewrite jz ntfs_HdRewrite
cmp [fs_type], 16 cmp [fs_type], 16
@ -2627,8 +2296,24 @@ fs_HdRewrite:
.common1: .common1:
call fat_find_lfn call fat_find_lfn
jc .notfound jc .notfound
; found; must not be directory ; found
test byte [edi+11], 10h 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 jz @f
add esp, 32 add esp, 32
popad popad
@ -2865,11 +2550,23 @@ fs_HdRewrite:
mov word [edi+20], cx ; high word of cluster mov word [edi+20], cx ; high word of cluster
mov word [edi+26], cx ; low word of cluster - to be filled mov word [edi+26], cx ; low word of cluster - to be filled
mov dword [edi+28], ecx ; file size - 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: .doit:
lea eax, [esp+8] lea eax, [esp+8]
call dword [eax+16] ; flush directory call dword [eax+16] ; flush directory
push ecx push ecx
mov ecx, [esp+4+32+24] mov ecx, [esp+4+32+24]
.doit2:
push ecx push ecx
push edi push edi
mov esi, edx mov esi, edx
@ -2898,6 +2595,8 @@ fs_HdRewrite:
add eax, [DATA_START] add eax, [DATA_START]
; write data ; write data
.write_sector: .write_sector:
cmp byte [esp+16+32+28], 0
jnz .writedir
mov ecx, 512 mov ecx, 512
cmp dword [esp+8], ecx cmp dword [esp+8], ecx
jb .writeshort jb .writeshort
@ -2911,6 +2610,7 @@ fs_HdRewrite:
mov edi, buffer mov edi, buffer
mov ebx, edi mov ebx, edi
rep movsb rep movsb
.writedircont:
mov ecx, buffer+0x200 mov ecx, buffer+0x200
sub ecx, edi sub ecx, edi
push eax push eax
@ -2977,6 +2677,40 @@ fs_HdRewrite:
call update_disk call update_disk
popad popad
ret 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 @@ fs_HdWrite:
sub ecx, ebx sub ecx, ebx
jz .ret jz .ret
.write_loop: .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 ; get length of data in current sector
push ecx push ecx
sub ebx, 0x200 sub ebx, 0x200
@ -3175,9 +2916,8 @@ fs_HdWrite:
add edi, esi add edi, esi
rep stosb rep stosb
@@: @@:
pop edi ecx eax pop edi ecx
; copy new data ; copy new data
push eax
mov eax, edx mov eax, edx
neg ebx neg ebx
jecxz @f jecxz @f
@ -3197,6 +2937,7 @@ fs_HdWrite:
sub [esp], ecx sub [esp], ecx
pop ecx pop ecx
jz .ret jz .ret
.skip:
; next sector ; next sector
inc ebp inc ebp
cmp ebp, [SECTORS_PER_CLUSTER] cmp ebp, [SECTORS_PER_CLUSTER]

View File

@ -4,7 +4,6 @@
;; (C) 2004 Ville Turjanmaa, License: GPL ;; ;; (C) 2004 Ville Turjanmaa, License: GPL ;;
;; 29.04.2006 Elimination of hangup after the ;; ;; 29.04.2006 Elimination of hangup after the ;;
;; expiration hd_wait_timeout (for LBA) - Mario79 ;; ;; 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 ;; ;; 15.01.2005 get file size/attr/date, file_append (only for hd) - ATV ;;
;; 23.11.2004 test if hd/partition is set - ATV ;; ;; 23.11.2004 test if hd/partition is set - ATV ;;
;; 18.11.2004 get_disk_info and more error codes - ATV ;; ;; 18.11.2004 get_disk_info and more error codes - ATV ;;
@ -37,8 +36,6 @@ file_system:
; ;
; eax = 0 ; read file /RamDisk/First 6 ; eax = 0 ; read file /RamDisk/First 6
; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56 ; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56
; eax = 4 ; makedir
; eax = 5 ; rename file/directory
; eax = 8 ; lba read ; eax = 8 ; lba read
; eax = 15 ; get_disk_info ; eax = 15 ; get_disk_info
; ;
@ -87,10 +84,6 @@ file_system:
cmp dword [eax+0],15 ; GET_DISK_INFO cmp dword [eax+0],15 ; GET_DISK_INFO
je fs_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 cmp dword [0x3000],1 ; no memory checks for kernel requests
jz no_checks_for_kernel jz no_checks_for_kernel
@ -384,6 +377,7 @@ fs_yesharddisk_IDE3:
mov [hdid],0x10 mov [hdid],0x10
mov [hdpos],4 mov [hdpos],4
fs_yesharddisk_partition: fs_yesharddisk_partition:
call reserve_hd_channel
; call choice_necessity_partition ; call choice_necessity_partition
; jmp fs_yesharddisk_all ; jmp fs_yesharddisk_all
jmp fs_for_new_semantic jmp fs_for_new_semantic
@ -445,6 +439,7 @@ choice_necessity_partition_1:
cmp [fat32part],0 ; is partition set? cmp [fat32part],0 ; is partition set?
jnz @f jnz @f
hd_err_return: hd_err_return:
call free_hd_channel
and [hd1_status], 0 and [hd1_status], 0
jmp file_system_return jmp file_system_return
@@: @@:
@ -469,6 +464,8 @@ hd_err_return:
mov edi,[esp+0] mov edi,[esp+0]
mov byte [edi],'/' mov byte [edi],'/'
call free_hd_channel
and [hd1_status], 0
jmp file_system_return jmp file_system_return
fs_noharddisk_read: fs_noharddisk_read:
@ -493,76 +490,16 @@ hd_err_return:
; eax=0 ok - eax=1 not enough free space ; eax=0 ok - eax=1 not enough free space
call free_hd_channel
and [hd1_status], 0
jmp file_system_return jmp file_system_return
fs_noharddisk_write: fs_noharddisk_write:
cmp dword [esp+20],4 ; MAKEDIR
jne fs_noharddisk_makedir
mov eax,[esp+0] ; /dirname call free_hd_channel
mov byte [eax],0 ; path to asciiz and [hd1_status], 0
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
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: fs_noharddisk:
; \begin{diamond}[18.03.2006] ; \begin{diamond}[18.03.2006]

View File

@ -83,7 +83,7 @@ file_system_lfn:
; 6 : set file/directory attributes structure ; 6 : set file/directory attributes structure
; 7 : start application ; 7 : start application
; 8 : delete file ; 8 : delete file
; 9 : create directory - not implemented yet ; 9 : create directory
add eax, std_application_base_address add eax, std_application_base_address
; parse file name ; parse file name
@ -362,8 +362,9 @@ fs_RamdiskServices:
dd fs_RamdiskSetFileEnd dd fs_RamdiskSetFileEnd
dd fs_RamdiskGetFileInfo dd fs_RamdiskGetFileInfo
dd fs_RamdiskSetFileInfo dd fs_RamdiskSetFileInfo
dd fs_RamdiskExecute dd 0 ;fs_RamdiskExecute
dd fs_RamdiskDelete dd fs_RamdiskDelete
dd fs_RamdiskCreateFolder
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4 fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
fs_OnFloppy: fs_OnFloppy:
@ -392,8 +393,9 @@ fs_FloppyServices:
dd fs_FloppySetFileEnd dd fs_FloppySetFileEnd
dd fs_FloppyGetFileInfo dd fs_FloppyGetFileInfo
dd fs_FloppySetFileInfo dd fs_FloppySetFileInfo
dd fs_FloppyExecute dd 0 ;fs_FloppyExecute
dd fs_FloppyDelete dd fs_FloppyDelete
dd fs_FloppyCreateFolder
fs_NumFloppyServices = ($ - fs_FloppyServices)/4 fs_NumFloppyServices = ($ - fs_FloppyServices)/4
fs_OnHd0: fs_OnHd0:
@ -466,6 +468,7 @@ fs_HdServices:
dd fs_HdSetFileInfo dd fs_HdSetFileInfo
dd 0 ;fs_HdExecute dd 0 ;fs_HdExecute
dd fs_HdDelete dd fs_HdDelete
dd fs_HdCreateFolder
fs_NumHdServices = ($ - fs_HdServices)/4 fs_NumHdServices = ($ - fs_HdServices)/4
;******************************************************* ;*******************************************************

View File

@ -222,6 +222,7 @@ ntfs_setup: ; CODE XREF: part_set.inc
mov [ntfs_data.cur_index_buf], eax mov [ntfs_data.cur_index_buf], eax
popad popad
call free_hd_channel
and [hd1_status], 0 and [hd1_status], 0
ret ret

View File

@ -39,6 +39,10 @@ fatEND dd 0x0FFFFFF8
fatMASK dd 0x0FFFFFFF fatMASK dd 0x0FFFFFFF
fs_dependent_data_end: 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 virtual at fs_dependent_data_start
; NTFS data ; NTFS data
@ -111,10 +115,9 @@ endg
; - it will skip over removed partitions ; - it will skip over removed partitions
set_FAT32_variables: set_FAT32_variables:
mov [0xfe10],dword 0 ; entries in hd cache
mov [problem_partition],0 mov [problem_partition],0
call reserve_hd1 call reserve_hd1
call clear_hd_cache call reserve_hd_channel
cmp dword [hdpos],0 cmp dword [hdpos],0
je problem_hd je problem_hd
@ -303,6 +306,7 @@ problem_partition_or_fat:
problem_hd: problem_hd:
mov [fs_type],0 mov [fs_type],0
call free_hd_channel
mov [hd1_status],0 ; free mov [hd1_status],0 ; free
mov [problem_partition],1 mov [problem_partition],1
ret ret
@ -420,6 +424,7 @@ fat32_partition:
mov [fatEND],0x0FFFFFF8 mov [fatEND],0x0FFFFFF8
mov [fatMASK],0x0FFFFFFF mov [fatMASK],0x0FFFFFFF
mov [fs_type],32 ; Fat32 mov [fs_type],32 ; Fat32
call free_hd_channel
mov [hd1_status],0 ; free mov [hd1_status],0 ; free
ret ret
@ -434,5 +439,6 @@ fat16_partition:
mov [fatEND],0x0000FFF8 mov [fatEND],0x0000FFF8
mov [fatMASK],0x0000FFFF mov [fatMASK],0x0000FFFF
mov [fs_type],16 ; Fat16 mov [fs_type],16 ; Fat16
call free_hd_channel
mov [hd1_status],0 ; free mov [hd1_status],0 ; free
ret ret

View File

@ -1496,9 +1496,9 @@ cd_base db 0
mov [hdpos],4 mov [hdpos],4
; call set_FAT32_variables ; call set_FAT32_variables
noseslhd: noseslhd:
mov [0xfe10],dword 0
call reserve_hd1 call reserve_hd1
call clear_hd_cache call reserve_hd_channel
call free_hd_channel
mov [hd1_status],0 ; free mov [hd1_status],0 ; free
nosethd: nosethd:
ret ret
@ -1514,7 +1514,8 @@ endg
mov [fat32part],ebx mov [fat32part],ebx
; call set_FAT32_variables ; call set_FAT32_variables
call reserve_hd1 call reserve_hd1
call clear_hd_cache call reserve_hd_channel
call free_hd_channel
pusha pusha
call choice_necessity_partition_1 call choice_necessity_partition_1
popa popa

View File

@ -105,7 +105,6 @@
; FE04 dword screen y size ; FE04 dword screen y size
; FE08 dword screen y multiplier ; FE08 dword screen y multiplier
; FE0C dword screen mode ; FE0C dword screen mode
; FE10 dword entries in hd cache
; FE80 dword address of LFB in physical ; FE80 dword address of LFB in physical
; FE84 dword address of applications memory start in physical ; FE84 dword address of applications memory start in physical
; FE88 dword address of button list ; FE88 dword address of button list

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,6 @@ end virtual
view_file: view_file:
mov eax, [ebp + panel1_files - panel1_data] mov eax, [ebp + panel1_files - panel1_data]
mov ecx, [eax+ecx*4] 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 test byte [ecx], 10h
jz .file jz .file
ret ret
@ -59,10 +56,32 @@ view_file:
push eax push eax
mov ebx, attrinfo mov ebx, attrinfo
mov [ebx+21], eax mov [ebx+21], eax
.attr_retry:
push 70 push 70
pop eax pop eax
int 40h 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 eax, dword [attrinfo.attr+32]
mov dword [ebp+viewer_data.filesize], eax mov dword [ebp+viewer_data.filesize], eax
mov eax, dword [attrinfo.attr+36] mov eax, dword [attrinfo.attr+36]
@ -80,11 +99,35 @@ view_file:
mov [readinfo.data], eax mov [readinfo.data], eax
mov [ebp+viewer_data.buf_pos], eax mov [ebp+viewer_data.buf_pos], eax
pop dword [readinfo.name] pop dword [readinfo.name]
.retry:
push 70 push 70
pop eax pop eax
int 40h int 40h
mov [ebp+viewer_data.buf_size], ebx 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_set_keybar
call viewer_draw_text call viewer_draw_text
ret ret
@ -118,10 +161,18 @@ viewer_get_next_char:
mov [readinfo.data], edi mov [readinfo.data], edi
lea eax, [ebp+viewer_data.filename] lea eax, [ebp+viewer_data.filename]
mov [readinfo.name], eax mov [readinfo.name], eax
.readretry:
mov ebx, readinfo mov ebx, readinfo
push 70 push 70
pop eax pop eax
int 40h 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 sub [ebp+viewer_data.buf_pos], 8192
add ebx, 16384-8192 add ebx, 16384-8192
mov [ebp+viewer_data.buf_size], ebx mov [ebp+viewer_data.buf_size], ebx
@ -781,6 +832,13 @@ viewer_seek:
push 70 push 70
pop eax pop eax
int 40h int 40h
test eax, eax
jz .readok
cmp eax, 6
jz .readok
call ask_retry_ignore
jz .doread
.readok:
cmp ebx, [readinfo.size] cmp ebx, [readinfo.size]
jnz @f jnz @f
add ebx, [ebp+viewer_data.buf_size] add ebx, [ebp+viewer_data.buf_size]
@ -822,13 +880,44 @@ viewer_seek:
mov [ebx+12], eax mov [ebx+12], eax
lea eax, [ebp+viewer_data.filename] lea eax, [ebp+viewer_data.filename]
mov [ebx+21], eax mov [ebx+21], eax
@@:
push 70 push 70
pop eax pop eax
int 40h 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] sub ebx, [readinfo.size]
add ebx, 16384 add ebx, 16384
jmp .ret 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: viewer_set_curpos:
mov eax, [ebp+viewer_data.buf_pos] mov eax, [ebp+viewer_data.buf_pos]
sub eax, ebp sub eax, ebp