I have started to build a FAT code, that should support FAT12, FAT16 and FAT32.
I know that FAT12 is "packed", it means that it takes up 1.5 bytes, or 12 bits out of 16 bits of a word. The remaining 4 bits are taken up by the next packed 12 bits of the next entry.
Is the FAT32 packed as well, using only 28 bits per entry and then using the remaining 4 bits for the next entry? Or is it aligned to (4-byte) 32-bit boundary?
Building FAT Driver
Could one not simply define something like:
That totals 3 bytes, so one would expect that if you do a pointer to an array of those, you'll get GCC do all the hard work for you, right?
Haven't tested. Will test in a minute, since my next project is to read the fat off the floppies, which I now got working properly.
Code: Select all
struct fat12_2 {
unsigned a : 12;
unsigned b : 12;
} __attribute__((packed));
Haven't tested. Will test in a minute, since my next project is to read the fat off the floppies, which I now got working properly.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Read the FAT document (released by M$). It has tables to show you the directory structure, BPB structure etc... and also has code that shows how to handle the FAT structure itself.
It's what it took for me to finally be able to read FAT12 floppies. Now I'm onto reading FAT16 and FAT32 on hard drives, and soon I'll support NTFS. The documents M$ releases are so useful sometimes.
NB: The same goes for the ATA specs...
It's what it took for me to finally be able to read FAT12 floppies. Now I'm onto reading FAT16 and FAT32 on hard drives, and soon I'll support NTFS. The documents M$ releases are so useful sometimes.
NB: The same goes for the ATA specs...