Rev 75 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 75 | Rev 77 | ||
---|---|---|---|
Line 3051... | Line 3051... | ||
3051 | ; ebx pointer to 64-bit number = first wanted byte, 0+ |
3051 | ; ebx pointer to 64-bit number = first wanted byte, 0+ |
3052 | ; may be ebx=0 - start from first byte |
3052 | ; may be ebx=0 - start from first byte |
3053 | ; ecx number of bytes to read, 0+ |
3053 | ; ecx number of bytes to read, 0+ |
3054 | ; edx mem location to return data |
3054 | ; edx mem location to return data |
3055 | ; |
3055 | ; |
3056 | ; ret ebx = size or 0xffffffff file not found |
3056 | ; ret ebx = bytes read or 0xffffffff file not found |
3057 | ; eax = 0 ok read or other = errormsg |
3057 | ; eax = 0 ok read or other = errormsg |
3058 | ; |
3058 | ; |
3059 | ;-------------------------------------------------------------- |
3059 | ;-------------------------------------------------------------- |
3060 | fs_HdRead: |
3060 | fs_HdRead: |
3061 | cmp [fat_type], 0 |
3061 | cmp [fat_type], 0 |
Line 3097... | Line 3097... | ||
3097 | jnz .noaccess |
3097 | jnz .noaccess |
3098 | test ebx, ebx |
3098 | test ebx, ebx |
3099 | jz .l1 |
3099 | jz .l1 |
3100 | cmp dword [ebx+4], 0 |
3100 | cmp dword [ebx+4], 0 |
3101 | jz @f |
3101 | jz @f |
3102 | mov ebx, [edi+28] |
3102 | xor ebx, ebx |
3103 | .reteof: |
3103 | .reteof: |
3104 | mov eax, 6 |
3104 | mov eax, 6 |
3105 | pop edi |
3105 | pop edi |
3106 | ret |
3106 | ret |
3107 | @@: |
3107 | @@: |
3108 | mov ebx, [ebx] |
3108 | mov ebx, [ebx] |
3109 | .l1: |
3109 | .l1: |
- | 3110 | push ecx edx |
|
- | 3111 | push 0 |
|
3110 | push dword [edi+28] ; file size |
3112 | mov eax, [edi+28] |
- | 3113 | sub eax, ebx |
|
- | 3114 | jb .eof |
|
- | 3115 | cmp eax, ecx |
|
- | 3116 | jae @f |
|
- | 3117 | mov ecx, eax |
|
- | 3118 | mov byte [esp], 6 |
|
- | 3119 | @@: |
|
3111 | mov eax, [edi+20-2] |
3120 | mov eax, [edi+20-2] |
3112 | mov ax, [edi+26] |
3121 | mov ax, [edi+26] |
3113 | push ecx edx |
- | |
3114 | push dword [edi+28] |
- | |
3115 | ; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
3122 | ; now eax=cluster, ebx=position, ecx=count, edx=buffer for data |
3116 | .new_cluster: |
3123 | .new_cluster: |
3117 | jecxz .new_sector |
3124 | jecxz .new_sector |
3118 | test eax, eax |
3125 | test eax, eax |
3119 | jz .eof |
3126 | jz .eof |
Line 3132... | Line 3139... | ||
3132 | jae .skip |
3139 | jae .skip |
3133 | add ebx, 512 |
3140 | add ebx, 512 |
3134 | jnz .force_buf |
3141 | jnz .force_buf |
3135 | cmp ecx, 512 |
3142 | cmp ecx, 512 |
3136 | jb .force_buf |
3143 | jb .force_buf |
3137 | cmp dword [esp], 512 |
- | |
3138 | jb .force_buf |
- | |
3139 | ; we may read directly to given buffer |
3144 | ; we may read directly to given buffer |
3140 | push ebx |
3145 | push ebx |
3141 | mov ebx, edx |
3146 | mov ebx, edx |
3142 | call hd_read |
3147 | call hd_read |
3143 | cmp [hd_error],0 |
3148 | cmp [hd_error],0 |
3144 | jne .noaccess_1 |
3149 | jne .noaccess_1 |
3145 | - | ||
3146 | pop ebx |
3150 | pop ebx |
3147 | add edx, 512 |
3151 | add edx, 512 |
3148 | sub ecx, 512 |
3152 | sub ecx, 512 |
3149 | sub dword [esp], 512 |
- | |
3150 | jmp .skip |
3153 | jmp .skip |
3151 | .force_buf: |
3154 | .force_buf: |
3152 | ; we must read sector to temporary buffer and then copy it to destination |
3155 | ; we must read sector to temporary buffer and then copy it to destination |
3153 | push eax ebx |
3156 | push eax ebx |
3154 | mov ebx, buffer |
3157 | mov ebx, buffer |
Line 3164... | Line 3167... | ||
3164 | cmp ecx, 512 |
3167 | cmp ecx, 512 |
3165 | jbe @f |
3168 | jbe @f |
3166 | mov ecx, 512 |
3169 | mov ecx, 512 |
3167 | @@: |
3170 | @@: |
3168 | sub ecx, ebx |
3171 | sub ecx, ebx |
3169 | cmp ecx, [esp+8] |
- | |
3170 | jbe @f |
- | |
3171 | mov ecx, [esp+8] |
- | |
3172 | @@: |
- | |
3173 | mov ebx, edx |
3172 | mov ebx, edx |
3174 | call memmove |
3173 | call memmove |
3175 | add edx, ecx |
3174 | add edx, ecx |
3176 | sub [esp], ecx |
3175 | sub [esp], ecx |
3177 | sub [esp+8], ecx |
- | |
3178 | pop ecx |
3176 | pop ecx |
3179 | pop eax |
3177 | pop eax |
3180 | xor ebx, ebx |
3178 | xor ebx, ebx |
3181 | cmp [esp], ebx |
- | |
3182 | jnz .skip |
- | |
3183 | jecxz .done |
- | |
3184 | jmp .eof |
- | |
3185 | .skip: |
3179 | .skip: |
3186 | inc eax |
3180 | inc eax |
3187 | dec edi |
3181 | dec edi |
3188 | jnz .new_sector |
3182 | jnz .new_sector |
3189 | mov eax, [cluster_tmp] |
3183 | mov eax, [cluster_tmp] |
Line 3191... | Line 3185... | ||
3191 | cmp [hd_error],0 |
3185 | cmp [hd_error],0 |
3192 | jne .noaccess_4 |
3186 | jne .noaccess_4 |
Line 3193... | Line 3187... | ||
3193 | 3187 | ||
3194 | jmp .new_cluster |
3188 | jmp .new_cluster |
- | 3189 | .done: |
|
3195 | .done: |
3190 | mov ebx, edx |
3196 | pop ebx edx ecx ebx edi |
3191 | pop eax edx ecx edi |
3197 | xor eax, eax |
3192 | sub ebx, edx |
3198 | ret |
3193 | ret |
- | 3194 | .eof: |
|
3199 | .eof: |
3195 | mov ebx, edx |
- | 3196 | pop eax edx ecx |
|
3200 | pop ebx edx ecx ebx |
3197 | sub ebx, edx |
Line 3201... | Line 3198... | ||
3201 | jmp .reteof |
3198 | jmp .reteof |
3202 | 3199 | ||
3203 | ;---------------------------------------------------------------- |
3200 | ;---------------------------------------------------------------- |
Line 3207... | Line 3204... | ||
3207 | ; esi points to filename |
3204 | ; esi points to filename |
3208 | ; ebx pointer to 32-bit number = first wanted block, 0+ |
3205 | ; ebx pointer to 32-bit number = first wanted block, 0+ |
3209 | ; ecx number of blocks to read, 0+ |
3206 | ; ecx number of blocks to read, 0+ |
3210 | ; edx mem location to return data |
3207 | ; edx mem location to return data |
3211 | ; |
3208 | ; |
3212 | ; ret ebx = size or 0xffffffff folder not found |
3209 | ; ret ebx = blocks read or 0xffffffff folder not found |
3213 | ; eax = 0 ok read or other = errormsg |
3210 | ; eax = 0 ok read or other = errormsg |
3214 | ; |
3211 | ; |
3215 | ;-------------------------------------------------------------- |
3212 | ;-------------------------------------------------------------- |
3216 | fs_HdReadFolder: |
3213 | fs_HdReadFolder: |
3217 | mov ebx, [ebx] |
3214 | mov ebx, [ebx] |
Line 3356... | Line 3353... | ||
3356 | or ebx, -1 |
3353 | or ebx, -1 |
3357 | ret |
3354 | ret |
3358 | .done: |
3355 | .done: |
3359 | add esp, 262*2+4+8 |
3356 | add esp, 262*2+4+8 |
3360 | pop ebp |
3357 | pop ebp |
3361 | mov ebx, [edx+8] |
3358 | mov ebx, [edx+4] |
3362 | xor eax, eax |
3359 | xor eax, eax |
3363 | dec ecx |
3360 | dec ecx |
3364 | js @f |
3361 | js @f |
3365 | mov al, ERROR_END_OF_FILE |
3362 | mov al, ERROR_END_OF_FILE |
3366 | @@: |
3363 | @@: |