| The "FAT" is the same as MSDOS disks. You can find the details in any
good technical book on MSDOS internals, such as Microsoft's "Advanced
MSDOS".
As an overview:
- Block 0 of the disks contains a table of the disks parameters,
including the size of each FAT, and the number of FAT tables,
and the block address of the root directory, which always
follows the FAT.
- A "cluster" is the allocation unit that is managed in the FAT.
The table in block 0 indicates the number of blocks (sectors)
in a cluster, but for some reason it is always 2. Therefore,
cluster 2 is sector 4, cluster 3 is sector 6, etc.
- A file's entry in a directory contains the cluster number of the
first block.
- The File Access Table (FAT) is a table which when indexed
by a cluster number, and returns the cluster number of the next
cluster in the file. Special values are used to indicate free
clusters, bad blocks, and end-of-file clusters.
- A "folder" or subdirectory is indicated as a flag in a the
directory entry, and the starting cluster is the first
cluster of the directory. The size of subdirectories is managed
entirely with the FAT table, so the indicated size is always 0.
I have written code that implements a crude but usable MSDOS file
system, so I can answer questions on it. (It's crude only because it
doesn't implement any file locking, or protections against programs
crashing with files open, or other similar protections.)
|