microchip an1003
Hi,
you have to read that FAT specification carefully, and you will see that:
(assuming a FAT32 formatted MMC card)
- you have to calculate the position of the FAT table and the root directory from several data bytes stored in the boot record, partition table etc,
- search for the filename you want in the root directory
- the directory record contains the starting cluster of the file
cluster == a branch of sectors (for example 4 or 8 etc)
After you found the starting cluster you can write sectors to that cluster on the disk. If you want to write more than a cluster (and you will
than you have to allocate another (not used) cluster in the FAT table for that file. And you can write the next sectors to the newly allocated cluster and so on.
How the cluster chain works and how to allocate a new cluster is all written in that doc.
I strongly recommend Acronis Disk Editor or another disk editor and a card reader,
format to FAT place just one file on it (with 0 size), search it on the card with the disk editor,
find out bytes/sector sectors/cluster values and try to grow the file slowly and watch how the windoz allocates new cluster for the file.
Do it with nothing else on the disk/card and you'll see how it works.
Remember FAT32 stores the filename in unicode so try with a 8.3 filename first.
It's not really easy, but not impossible
Zed