/* * fat_memorymap.h - Structure of the FAT File System * * ALL values are offsets of the sector or cluster they reside in * * */ #define FAT12 0x00 #define FAT16 0x01 #define FAT32 0x02 /* MASTER BOOT RECORD SECTOR * * Sector begins at 0x0 of the disk if disk is partitioned * */ #define MBR_DISK_ID 0x1b4 #define MBR_PARTITIONTABLE 0x1be // Partition Table Entry (16 bytes) // Each Entry = MBR_PARTITONTABLE + (16 * entry_number) // Values offset from start of entry // // NOTE: Start and end sector: bits 0-5: sector // Bits 6-7 = bits 8-9 of cylinder #define PT_STATUS 0x000 #define PT_START_HEAD 0x001 #define PT_START_SECTOR 0x002 #define PT_START_CYLINDER 0x003 #define PT_PARTITION_TYPE 0x004 #define PT_END_HEAD 0x005 #define PT_END_SECTOR 0x006 #define PT_END_CYLINDER 0x007 #define PT_START_LBA 0x008 #define PT_TOTAL_SECTORS 0x00c /* VOLUME BOOT RECORD SECTOR * * Sector begins at 0x0 of the disk if unpartitioned, otherwise * begins at sector specified by partition table * */ //BIOS Parameter Block #define BPB_OEM_NAME 0x003 #define BPB_BYTES_PER_SECTOR 0x00b #define BPB_SECTORS_PER_CLUSTER 0x00d #define BPB_RESERVED_SECTORS 0x00e #define BPB_NUMBER_FATS 0x010 #define BPB_NUMBER_DIR_ENTRIES 0x011 #define BPB_SECTORS_IN_VOLUME 0x013 #define BPB_MEDIA_DESCRIPTOR 0x015 #define BPB_SECTORS_PER_FAT 0x016 #define BPB_SECTORS_PER_TRACK 0x018 #define BPB_NUMBER_HEADS 0x01a #define BPB_HIDDEN_SECTORS 0x01c #define BPB_LARGE_SECTORS 0x020 // Extended BPB (FAT12/16) #define EBPB_DRIVE_NUMBER 0x024 #define EBPB_FLAGS 0x025 #define EBPB_SIGNATURE 0x026 #define EBPB_VOLUME_ID 0x027 #define EBPB_VOLUME_LABEL 0x02B #define EBPB_IDENTIFIER 0x036 // Extended BPB (FAT32) #define EBPB32_SECTORS_PER_FAT 0x024 #define EBPB32_FLAGS 0x028 #define EBPB32_FAT_VERSION 0x02a #define EBPB32_ROOT_CLUSTER 0x02c #define EBPB32_FSINFO_CLUSTER 0x030 #define EBPB32_CLUSTER_BACKUP 0x032 #define EBPB32_RESERVED 0x034 #define EBPB32_DRIVE_NUMBER 0x040 #define EBPB32_NT_FLAGS 0x041 #define EBPB32_SIGNATURE 0x042 #define EBPB32_VOLUME_ID 0x043 #define EBPB32_VOLUME_LABEL 0x047 #define EBPB32_IDENTIFIER 0x052