Page 2 of 2

Re: FAT Troubles

Posted: Wed Nov 23, 2011 2:07 am
by mark3094
mark3094 wrote:Is this formula still relevant?
FYI, I have confirmed that it is the same formula for dealing with entries in the FAT.

Thank you all

Re: FAT Troubles

Posted: Wed Nov 23, 2011 5:25 am
by egos
mark3094 wrote:Just want to check, is this the same formula that I should use when I get the next cluster in the chain from the FAT?
For FAT16 next cluster number is held in the word at FAT1Pos+2*ClusterNumber, where 2 is a FAT cell size. To get next cluster number for FAT12 you should use a specific algorithm.
What's the best way to check for EOF?
Firstly you should use filesize field. But don't forget that if filesize value is not zero you should check the cluster number before reading the cluster: 1<ClusterNumber<xFF6h (minimal support), or 1<ClusterNumber<ClusterCount+2 (advanced support). Additionally you can check last cluster cell for EOF mark (>xFF7h). To control the size of the directories you should use LastDirEntry mark and EOF mark while the size is less than 2 mb.