minor changes in fat32

This commit is contained in:
2025-09-20 08:29:43 -04:00
parent 137735431a
commit 4a944bc493
2 changed files with 10 additions and 18 deletions

View File

@@ -126,11 +126,12 @@ FAT32_load_vbr:
; - fill fat32_bpb_t and compute derived fields ; - fill fat32_bpb_t and compute derived fields
; - read FSInfo (free count/next free) ; - read FSInfo (free count/next free)
; - ??? ; - ???
; int fat32_mount(uint32_t partition_lba, fat32_bpb_t* out); ; int fat32_mount(FAT32_State_t* state, uint32_t partition_lba);
FAT32_mountfs: FAT32_mountfs:
__CDECL16_PROC_ENTRY __CDECL16_PROC_ENTRY
.proc: .proc:
; mount: parse BPB, derive fat0_lba, data_lba, cluster0_lba. ; mount: parse BPB, derive fat0_lba, data_lba, cluster0_lba.
.endp: .endp:
__CDECL16_PROC_EXIT __CDECL16_PROC_EXIT
ret ret
@@ -138,7 +139,7 @@ FAT32_mountfs:
ERROR STEVIA_DEBUG_ERR ERROR STEVIA_DEBUG_ERR
; int fat32_read_fat(const fat32_bpb_t* v, uint32_t clus, uint32_t* out); ; int fat32_read_fat(FAT32_State_t* state, uint32_t clus, uint32_t* out);
FAT32_read_fat: FAT32_read_fat:
__CDECL16_PROC_ENTRY __CDECL16_PROC_ENTRY
.proc: .proc:
@@ -153,7 +154,7 @@ FAT32_read_fat:
; EOC if (val & 0x0FFFFFFF) >= 0x0FFFFFF8. ; EOC if (val & 0x0FFFFFFF) >= 0x0FFFFFF8.
; bad if == 0x0FFFFFF7. ; bad if == 0x0FFFFFF7.
; free if == 0x00000000. ; free if == 0x00000000.
; int fat32_next_clus(const fat32_bpb_t* v, uint32_t clus, uint32_t* out_next); ; int fat32_next_clus(FAT32_State_t* state, uint32_t clus, uint32_t* out_next);
FAT32_next_cluster: FAT32_next_cluster:
__CDECL16_PROC_ENTRY __CDECL16_PROC_ENTRY
.proc: .proc:
@@ -165,7 +166,7 @@ FAT32_next_cluster:
ERROR STEVIA_DEBUG_ERR ERROR STEVIA_DEBUG_ERR
; e.g: ; e.g:
; uint64_t clus_to_lba(const fat32_bpb_t* v, uint32_t clus) { ; uint64_t clus_to_lba(FAT32_State_t* state, uint32_t clus) {
; return v->data_lba + (uint64_t)(clus - 2) * v->secs_per_clus; ; return v->data_lba + (uint64_t)(clus - 2) * v->secs_per_clus;
; } ; }
FAT32_clus_to_lba: FAT32_clus_to_lba:

View File

@@ -195,20 +195,11 @@ endstruc
; 32 bytes ; 32 bytes
struc FAT32_State_t struc FAT32_State_t
.first_data_sector_32 resd 1 .u32_TotalClusters resd 1
.first_fat_sector_32 resd 1 .u32_DataAreaStartSector resd 1
.fat_size_32 resd 1 .u32_FATAreaStartSector resd 1
.curr_FAT_cluster_32 resd 1 .p16_FATBuffer resw 1
.curr_dir_cluster_32 resd 1 .p16_ClustBuffer resw 1
.curr_drive_lba_32 resd 1
endstruc
; 16 bytes
struc FAT32_NextClusterData_t
.fat_offset resd 1
.fat_sector resd 1
.entry_offset resd 1
.reserved_1 resd 1
endstruc endstruc
; FAT32 Attributes ; FAT32 Attributes