SD and tiny fat checkout problem

I am testing the TinyFat program with an application I made using the CrossArm software from Rowley. I used my XP to format an SD card with three files specifying (FAT) format in xp.

The first two files are very short (less than 100 characters long) and read great. The third file is slightly over 512 bytes just to see if it gets the next sector o.k. Unfortunately it only reads in (correctly) the first 512 byte sector of this long record. Then it reads in nothing.

I tried to walk thru the program and in the section below it seems to jump from the second return from the bottom to the last return from the buttom hence it doesnt return the LD_WORD value but instead the 1.

static

WORD get_cluster (WORD clust) /* Cluster# to get the link information */

{

WORD wc, bc;

DWORD fatsect;

FATFS *fs = FatFs;

if ((clust >= 2) && (clust < fs->max_clust)) { /* Valid cluster# */

fatsect = fs->fatbase;

if (fs->fs_type == FS_FAT12) {

bc = clust * 3 / 2;

if (!move_window(fatsect + bc / 512)) return 1;

wc = fs->win[bc % 512]; bc++;

if (!move_window(fatsect + bc / 512)) return 1;

wc |= (WORD)fs->win[bc % 512] << 8;

return (clust & 1) ? (wc >> 4) : (wc & 0xFFF);

} else {

if (!move_window(fatsect + clust / 256)) return 1;

return LD_WORD(&(fs->win[(clust * 2) % 512]));

}

}

return 1; /* Return with 1 means function failed */

}

I could be way off but this is my best guess so far. I must confess I haven’t figured out how exactly this works.

I suspect my XP may have formatted something out there besides a FAT16 format but I can’t prove it.

Any ideas would be appreciated.

Regards to all;

I also noticed that the f-read doesnt act like I thought it woul. It reads in 512 bytes starting at 0x40002780 on the first disk_read and then jumps to address 0x40003780 and reads in the next sector. It then thinks its finished and quits reading. It also looks like the disk_read only reads 1 sector no matter what its 3rd argument is. I noticed the f_read in tinyfat is quite a bit different from the one in the longer fat program. Was something left out or is this just the expected diffrences?

Hope I’m not just talking to myself.

regards