Compare commits
2 Commits
6caaf6aa6d
...
4a944bc493
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a944bc493 | |||
| 137735431a |
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -453,17 +453,19 @@ align 16, resb 1
|
|||||||
%define BIOSMemoryMap_SIZE 1024
|
%define BIOSMemoryMap_SIZE 1024
|
||||||
BIOSMemoryMap:
|
BIOSMemoryMap:
|
||||||
resb BIOSMemoryMap_SIZE
|
resb BIOSMemoryMap_SIZE
|
||||||
|
|
||||||
align 16, resb 1
|
|
||||||
stack_bottom:
|
|
||||||
resb 2048
|
|
||||||
stack_top:
|
|
||||||
end_bss:
|
end_bss:
|
||||||
|
; !!! End bss data !!!
|
||||||
|
%define STACK_SIZE 0x1000 ; 4 KiB
|
||||||
|
|
||||||
; Pad to the cap (emits nothing in the file; only increases .bss virtual size).
|
; Pad to the cap (emits nothing in the file; only increases .bss virtual size).
|
||||||
; If BSS_SIZE > BSS_MAX_BYTES, this becomes negative and NASM errors out.
|
; If BSS_SIZE > BSS_MAX_BYTES, this becomes negative and NASM errors out.
|
||||||
%define BSS_MAX_BYTES 0x2000
|
%define BSS_MAX_BYTES (0x2000 - STACK_SIZE)
|
||||||
resb (BSS_MAX_BYTES - (end_bss - begin_bss))
|
resb (BSS_MAX_BYTES - (end_bss - begin_bss))
|
||||||
|
|
||||||
|
align 16, resb 1
|
||||||
|
stack_bottom:
|
||||||
|
resb STACK_SIZE
|
||||||
|
stack_top:
|
||||||
|
|
||||||
; Optional: keep a label for later math:
|
; Optional: keep a label for later math:
|
||||||
bss_cap_end:
|
bss_cap_end:
|
||||||
Reference in New Issue
Block a user