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? > > THANKS! > > Harold > > > You will drive yourself crazy trying to learn FAT16. The way several folks have done it is to create a large file which is contiguous and fills the entire SD card. Then simply write directly into the file in a scheme that will work for you. It becomes very easy this way. The "file" is never removed, ever. But the PC can read it, and its trivial for the host application to extract your data from it. --Bob -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist