use bx rel addressing for fat32_state in SearchFATDIR

This commit is contained in:
2024-10-18 07:58:09 -04:00
parent 94c2a1626d
commit b7e2a8e886

View File

@@ -114,8 +114,9 @@ SearchFATDIR:
__CDECL16_ENTRY __CDECL16_ENTRY
.file_lookup: .file_lookup:
print_string SearchFATDIR_info print_string SearchFATDIR_info
mov bx, fat32_state
.load_first_dir: .load_first_dir:
mov eax, dword [fat32_state + FAT32_State_t.curr_dir_cluster_32] mov eax, dword [bx + FAT32_State_t.curr_dir_cluster_32]
push dword eax ; cluster push dword eax ; cluster
mov ax, dir_buffer mov ax, dir_buffer
push ax ; offset push ax ; offset
@@ -131,7 +132,7 @@ SearchFATDIR:
; if eax >= 0x0FFFFFF8 then there are no more clusters (end of chain) ; if eax >= 0x0FFFFFF8 then there are no more clusters (end of chain)
; if eax == 0x0FFFFFF7 then this is a cluster that is marked as bad ; if eax == 0x0FFFFFF7 then this is a cluster that is marked as bad
mov eax, dword [fat32_state + FAT32_State_t.curr_dir_cluster_32] mov eax, dword [bx + FAT32_State_t.curr_dir_cluster_32]
push dword eax push dword eax
call NextCluster ; uint32_t NextCluster(uint32_t active_cluster); call NextCluster ; uint32_t NextCluster(uint32_t active_cluster);
add sp, 0x4 add sp, 0x4
@@ -143,7 +144,7 @@ SearchFATDIR:
.load_next_dir_next_OK: .load_next_dir_next_OK:
; load 512 bytes of directory entries from data sector ; load 512 bytes of directory entries from data sector
mov eax, [fat32_state + FAT32_State_t.curr_dir_cluster_32] mov eax, [bx + FAT32_State_t.curr_dir_cluster_32]
push dword eax ; cluster push dword eax ; cluster
mov ax, dir_buffer mov ax, dir_buffer
@@ -180,6 +181,7 @@ SearchFATDIR:
jae SearchFATDIR.load_next_dir jae SearchFATDIR.load_next_dir
jmp SearchFATDIR.empty_dir_entry jmp SearchFATDIR.empty_dir_entry
; TODO: move this to a seperate string search function
.parse_dir: .parse_dir:
print_string MaybeFound_Boot_info print_string MaybeFound_Boot_info
.lfn_check: .lfn_check: