/kernel/trunk/fs/fat12.inc |
---|
1174,7 → 1174,7 |
; ecx number of bytes to read, 0+ |
; edx mem location to return data |
; |
; ret ebx = size or 0xffffffff file not found |
; ret ebx = bytes read or 0xffffffff file not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
1198,7 → 1198,7 |
jz .l1 |
cmp dword [ebx+4], 0 |
jz @f |
mov ebx, [edi+28] |
xor ebx, ebx |
.reteof: |
mov eax, 6 ; EOF |
pop edi |
1206,10 → 1206,17 |
@@: |
mov ebx, [ebx] |
.l1: |
push dword [edi+28] |
push dword [edi+28] |
push ecx edx |
push 0 |
mov eax, [edi+28] |
sub eax, ebx |
jb .eof |
cmp eax, ecx |
jae @f |
mov ecx, eax |
mov byte [esp], 6 ; EOF |
@@: |
movzx edi, word [edi+26] |
push ecx edx |
.new: |
jecxz .done |
test edi, edi |
1216,8 → 1223,7 |
jz .eof |
cmp edi, 0xFF8 |
jae .eof |
mov eax, edi |
add eax, 31 |
lea eax, [edi+31] |
pusha |
call read_chs_sector |
popa |
1225,7 → 1231,7 |
jnz .err |
sub ebx, 512 |
jae .skip |
lea eax, [eax+ebx+512] |
lea eax, [0xD000+ebx+512] |
neg ebx |
push ecx |
cmp ecx, ebx |
1232,35 → 1238,29 |
jbe @f |
mov ecx, ebx |
@@: |
cmp ecx, [esp+12] |
jbe @f |
mov ecx, [esp+12] |
@@: |
mov ebx, edx |
mov eax, 0xD000 |
call memmove |
add edx, ecx |
sub [esp], ecx |
sub [esp+12], ecx |
pop ecx |
xor ebx, ebx |
cmp [esp+8], ebx |
jnz .skip |
jecxz .done |
jmp .eof |
.skip: |
movzx edi, word [edi*2+0x282000] |
jmp .new |
.done: |
pop edx ecx ebx ebx edi |
xor eax, eax |
mov ebx, edx |
pop eax edx ecx edi |
sub ebx, edx |
ret |
.eof: |
pop edx ecx ebx ebx |
mov ebx, edx |
pop eax edx ecx |
jmp .reteof |
.err: |
mov eax, 5 ; may be other error code? |
pop edx ecx ebx ebx edi |
mov ebx, edx |
pop eax edx ecx edi |
sub ebx, edx |
mov al, 5 ; may be other error code? |
ret |
;---------------------------------------------------------------- |
1272,7 → 1272,7 |
; ecx number of blocks to read, 0+ |
; edx mem location to return data |
; |
; ret ebx = size or 0xffffffff folder not found |
; ret ebx = blocks read or 0xffffffff folder not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
1388,7 → 1388,7 |
.done: |
add esp, 262*2+4 |
pop ebp |
mov ebx, [edx+8] |
mov ebx, [edx+4] |
xor eax, eax |
dec ecx |
js @f |
/kernel/trunk/fs/fat32.inc |
---|
3053,7 → 3053,7 |
; ecx number of bytes to read, 0+ |
; edx mem location to return data |
; |
; ret ebx = size or 0xffffffff file not found |
; ret ebx = bytes read or 0xffffffff file not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
3099,7 → 3099,7 |
jz .l1 |
cmp dword [ebx+4], 0 |
jz @f |
mov ebx, [edi+28] |
xor ebx, ebx |
.reteof: |
mov eax, 6 |
pop edi |
3107,11 → 3107,18 |
@@: |
mov ebx, [ebx] |
.l1: |
push dword [edi+28] ; file size |
push ecx edx |
push 0 |
mov eax, [edi+28] |
sub eax, ebx |
jb .eof |
cmp eax, ecx |
jae @f |
mov ecx, eax |
mov byte [esp], 6 |
@@: |
mov eax, [edi+20-2] |
mov ax, [edi+26] |
push ecx edx |
push dword [edi+28] |
; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
.new_cluster: |
jecxz .new_sector |
3134,8 → 3141,6 |
jnz .force_buf |
cmp ecx, 512 |
jb .force_buf |
cmp dword [esp], 512 |
jb .force_buf |
; we may read directly to given buffer |
push ebx |
mov ebx, edx |
3142,11 → 3147,9 |
call hd_read |
cmp [hd_error],0 |
jne .noaccess_1 |
pop ebx |
add edx, 512 |
sub ecx, 512 |
sub dword [esp], 512 |
jmp .skip |
.force_buf: |
; we must read sector to temporary buffer and then copy it to destination |
3166,22 → 3169,13 |
mov ecx, 512 |
@@: |
sub ecx, ebx |
cmp ecx, [esp+8] |
jbe @f |
mov ecx, [esp+8] |
@@: |
mov ebx, edx |
call memmove |
add edx, ecx |
sub [esp], ecx |
sub [esp+8], ecx |
pop ecx |
pop eax |
xor ebx, ebx |
cmp [esp], ebx |
jnz .skip |
jecxz .done |
jmp .eof |
.skip: |
inc eax |
dec edi |
3193,11 → 3187,14 |
jmp .new_cluster |
.done: |
pop ebx edx ecx ebx edi |
xor eax, eax |
mov ebx, edx |
pop eax edx ecx edi |
sub ebx, edx |
ret |
.eof: |
pop ebx edx ecx ebx |
mov ebx, edx |
pop eax edx ecx |
sub ebx, edx |
jmp .reteof |
;---------------------------------------------------------------- |
3209,7 → 3206,7 |
; ecx number of blocks to read, 0+ |
; edx mem location to return data |
; |
; ret ebx = size or 0xffffffff folder not found |
; ret ebx = blocks read or 0xffffffff folder not found |
; eax = 0 ok read or other = errormsg |
; |
;-------------------------------------------------------------- |
3358,7 → 3355,7 |
.done: |
add esp, 262*2+4+8 |
pop ebp |
mov ebx, [edx+8] |
mov ebx, [edx+4] |
xor eax, eax |
dec ecx |
js @f |