On Wed, 2006-05-31 at 09:50 -0700, Harold Hallikainen wrote: > I hope this is ok under the PIC tag. I'm using a pic for it! I'm looking > at the contents of the sectors of an SD card formatted FAT16. I'm finding > the boot record for partition #1 at sector 0x5f. At offset 22 decimal is > supposed to be a 16 bit word with sectors/FAT, according to various > documents I've found on the web. This location has 0x00f2. The next word > (at offset 24 decimal) is supposed to be sectors/track (which seems > meaningless on an SD card). The value I'm finding there is 0x0020. > > I find the first FAT at sector 0x60. I find the second FAT at sector 0x80. > I'm trying to figure out how one determines how long the FAT is (so I can > figure out where the second FAT starts and where the root directory starts > after it). It SEEMS we should somewhere have a "clusters per FAT" since > that would tell us how many FAT table entries there are. With > "sectors/FAT" we'd need to divide by the number of sectors per cluster > (which I'm finding in the boot record at offset 13 decimal as 0x04). > > It IS interesting that the value at offset 24 (supposedly sectors/track) > has a value of 0x20, which appears to be the size of the FAT (first one at > sector 0x60, second at 0x80). > > So... can someone suggest exactly what I should be looking at to determine > the size of the FAT? My carmon project does a very minimalistic handling of a FAT16 volume, basically by just reading and writing a single large file: http://repatch.dyndns.org:8383/pic_stuff/carmon That said, the only reason I did it that way was it was all the functionality I needed. The references I provide point to all the information you'd need to do a "real" FAT manipulation. As a warning though, it can get pretty confusing very quickly, read the sections very carefully, all the information is in the spec, but it doesn't make sense the first time you read it. On top of that, get a raw disk viewer (under windows winhex is excellent) that will let you see the sectors. That will make things MUCH easier to correlate. TTYL -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist