some debuging text for fat32 stuff

This commit is contained in:
2024-10-15 20:37:49 -04:00
parent e680620148
commit c9f4b18d2b
2 changed files with 15 additions and 4 deletions

View File

@@ -90,6 +90,8 @@ ALIGN 4, db 0x90
SearchFATDIR: SearchFATDIR:
__CDECL16_ENTRY __CDECL16_ENTRY
.file_lookup: .file_lookup:
print_string SearchFATDIR_INFO_cstr
.load_first_dir: .load_first_dir:
mov eax, dword [fat32_state + FAT32_State_t.active_dir_cluster_32] mov eax, dword [fat32_state + FAT32_State_t.active_dir_cluster_32]
push dword eax ; cluster push dword eax ; cluster
@@ -156,6 +158,7 @@ SearchFATDIR:
jmp SearchFATDIR.empty_dir_entry jmp SearchFATDIR.empty_dir_entry
.parse_dir: .parse_dir:
print_string MaybeFound_Boot_INFO_cstr
.lfn_check: .lfn_check:
; check for ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID (0x0F) in offset 11 ; check for ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID (0x0F) in offset 11
; TODO: going to skip LFN for now, since all valid volumes will have SFN's ; TODO: going to skip LFN for now, since all valid volumes will have SFN's
@@ -182,8 +185,8 @@ SearchFATDIR:
.endp: .endp:
__CDECL16_EXIT __CDECL16_EXIT
ret ret
; BUG: this function needs review ; BUG: this function needs review
;
; bp - 2 - byte boot_drive ; bp - 2 - byte boot_drive
; uint32_t NextCluster(uint32_t active_cluster); ; uint32_t NextCluster(uint32_t active_cluster);
; if eax >= 0x0FFFFFF8 then there are no more clusters (end of chain) ; if eax >= 0x0FFFFFF8 then there are no more clusters (end of chain)
@@ -192,6 +195,8 @@ ALIGN 4, db 0x90
NextCluster: NextCluster:
__CDECL16_ENTRY __CDECL16_ENTRY
.func: .func:
print_string NextFATCluster_INFO_cstr
mov bx, [boot_drive_ptr] mov bx, [boot_drive_ptr]
movzx ax, byte [ds:bx] movzx ax, byte [ds:bx]
mov byte [bp - 2], al ; save boot drive as a local for easy access mov byte [bp - 2], al ; save boot drive as a local for easy access
@@ -202,8 +207,8 @@ NextCluster:
.calc_offset: .calc_offset:
; fat_offset = active_cluster * 4 ; fat_offset = active_cluster * 4
mov eax, 4 mov eax, 4
mul edx mul edx ; BUG: should check for carry here
mov dword [si + FAT32_NextClusterData_t.fat_offset], eax mov dword [si + FAT32_NextClusterData_t.fat_offset], eax ; move lower 32 bits to fat offset
.calc_fat_sector: .calc_fat_sector:
; fat_sector = first_fat_sector + (fat_offset / sector_size) ; fat_sector = first_fat_sector + (fat_offset / sector_size)
@@ -282,6 +287,8 @@ ALIGN 4, db 0x90
ReadFATCluster: ReadFATCluster:
__CDECL16_ENTRY __CDECL16_ENTRY
.func: .func:
print_string ReadFATCluster_INFO_cstr
mov bx, [boot_drive_ptr] mov bx, [boot_drive_ptr]
movzx ax, byte [ds:bx] movzx ax, byte [ds:bx]
mov byte [bp - 2], al ; save boot drive as a local for easy access mov byte [bp - 2], al ; save boot drive as a local for easy access

View File

@@ -400,8 +400,12 @@ define_cstr MemoryMap_OK, "Memory map OK"
define_cstr UnrealMode_OK, "Unreal mode OK" define_cstr UnrealMode_OK, "Unreal mode OK"
define_cstr FileFound_OK, "Found SFN entry for bootable binary, first cluster -> " define_cstr FileFound_OK, "Found SFN entry for bootable binary, first cluster -> "
define_cstr InitFATSYS_OK, "FAT32 Driver Init..." define_cstr InitFATSYS_OK, "FAT32 Driver Init..."
define_cstr NewLine, ""
define_cstr SearchFATDIR_INFO, "Searching FAT DIR for bootable file..."
define_cstr NextFATCluster_INFO, "Attempting to find next FAT cluster..."
define_cstr ReadFATCluster_INFO, "Attempting to load next FAT"
define_cstr MaybeFound_Boot_INFO, "Maybe found a file...checking..."
define_cstr NewLine, ""
define_str BootTarget, "BOOT BIN" define_str BootTarget, "BOOT BIN"