Page 1 of 1

FAT12

Posted: Thu Mar 05, 2009 10:06 pm
by sweetgum
So I've read the official Microsoft FAT documentation and its time for me to make use of it via int 13.

Although, I've run into some confusion.

Code: Select all

FirstRootDirSecNum = BPB_ResvdSecCnt + (BPB_NumFATs * BPB_FATSz16);
I get Sector 19 from this equation, although that doesn't work.
While coding there was a typo and I put sector 18, which coincidentally worked, just before that fat equation, the documentation mentions that this value is relative to the first sector, does that mean - 1 since the first sector is 1?
For FAT12 and FAT16 media, the first sector of the root directory is sector number relative to the first sector of the FAT volume:
If someone could clue me in I'd really appreciate it. I'd like full floppy support in my OS!

Re: FAT12

Posted: Thu Mar 05, 2009 10:25 pm
by 01000101
are you sure the numbers you're plugging in are correct?
Are you positive that your reserved sector count is right, it seems that since you're only one sector off (assuming you are and it's not just some freak cooincidence) then something small like the reserved sector count is probably wrong.

Re: FAT12

Posted: Thu Mar 05, 2009 10:32 pm
by Firestryke31
Also, while it's mostly useless for floppies, I've found that the Hidden Sector Count (Number of sectors before partition) is +1 on the two Windows-formatted disks I've tested on, though they weren't partitioned (one was a floppy img and the other was a logical drive img). But it doesn't look like you're using the Hidden Sector Count field anyway, so...

If you want, I can post Socks' ASM FAT12 LoadClusterChain routine. It might be a tad buggy, but I haven't been able to test it a lot so FAIK it could be almost bug-free. Though I wouldn't bet on it...

Re: FAT12

Posted: Thu Mar 05, 2009 11:29 pm
by sweetgum
Turns out all I had to do is convert the LBA to a CHS to get sector 2 cylinder 0 head 1, i have to do more research to understand why sector 18 head 0 cylinder 0 works!