hos/fat12.h

59 lines
1.5 KiB
C

// fat12.h
// Author: Josh Holtrop
// Created: 01/04/04
typedef struct {
char fileName[8];
char ext[3];
byte attributes;
dword createTime;
word createDate;
word accessDate;
word unused0;
word modifiedDate;
word modifiedTime;
word firstCluster;
dword fileSize;
} __attribute__((packed)) Fat12Entry;
typedef struct {
byte jump[3];
byte sysName[8];
word bytesPerSector;
byte sectorsPerCluster;
word reservedSectors;
byte FATcount;
word maxRootEntries;
word totalSectors1;
byte mediaDescriptor;
word sectorsPerFAT;
word sectorsPerTrack;
word headCount;
dword hiddenSectors;
dword totalSectors2;
byte driveNumber;
byte reserved1;
byte extBootSignature;
dword volumeSerial;
char volumeLabel[11];
char fileSystemID[8];
} __attribute__((packed)) Fat12BootSector;
byte *fat12_readFile(char *fileName, DiskDevice *dd);
dword fat12_getFileHandle(char *fileName, DiskDevice *dd, Fat12Entry *destination);
dword fat12_getDirectoryHandle(char *directory, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination);
Fat12Entry *fat12_readClusterChain(DiskDevice *dd, Fat12Entry *directory);
dword fat12_getFileHandleInDirectory(char *fileName, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination);
dword fat12_readClusterChainCount(DiskDevice *dd, Fat12Entry *directory);
dword fat12_getFileSize(char *fileName, DiskDevice *dd);
dword getClusterChain(DiskDevice *dd);
dword fat12_getNextCluster(dword thisCluster);
byte *clusterChain = 0;