Hi!
I got confused reading about FAT12. Two FAT entries are saved on 3 bytes. But FDD sector is 512 bytes what is not divisible by 3. So what you have to do to read FAT table? You read 1 sector on demand. Do you need to check if entry is written on 2 sectors and read 1st sector, remember part of entry, than read 2nd sector and remember second part of this entry?
Am I right that you have to include this special case reading procedure, or I'm missing something?
Best regards,
cybek
Reading FAT12 entries sector by sector
Re: Reading FAT12 entries sector by sector
For the sake of efficiency you want to cache the FAT in RAM. If I were to support FAT12 I would just read the whole table from the disk and treat it as a large array.
Re: Reading FAT12 entries sector by sector
FAT12 is not always floppy disk (and floppy disk is not always FAT12).cybek wrote:I got confused reading about FAT12. Two FAT entries are saved on 3 bytes. But FDD sector is 512 bytes what is not divisible by 3.
Re: Reading FAT12 entries sector by sector
I agree with both replies.
Your understanding is correct. However, a FAT12 (legally) cannot be larger than 4,084 clusters which would use a 6,126 byte FAT table. Easily managed in 16-bit code.
Ben
http://www.fysnet.net/the_virtual_file_system.htm
Your understanding is correct. However, a FAT12 (legally) cannot be larger than 4,084 clusters which would use a 6,126 byte FAT table. Easily managed in 16-bit code.
Ben
http://www.fysnet.net/the_virtual_file_system.htm
Re: Reading FAT12 entries sector by sector
If it helps, note that 3 512-byte sectors contain an integral number of 12-bit integers.
Re: Reading FAT12 entries sector by sector
Yeah, but my main thought is RAM efficiency. If I would write 32bit OS, I would cache whole FATiansjack wrote:For the sake of efficiency you want to cache the FAT in RAM. If I were to support FAT12 I would just read the whole table from the disk and treat it as a large array.
Yes, I know. But I'm thinking about floppy. And is there really anything else what use FAT12? Maybe first hdds were.mikegonta wrote:FAT12 is not always floppy disk (and floppy disk is not always FAT12).
Thanks for answer. Right, 6kB is not much, maybe I'm wondering too much about RAM efficiency.BenLunt wrote:I agree with both replies.
Your understanding is correct. However, a FAT12 (legally) cannot be larger than 4,084 clusters which would use a 6,126 byte FAT table. Easily managed in 16-bit code.
I feel stupid now. This is the method I will probably use. Thank you very much!alexfru wrote:If it helps, note that 3 512-byte sectors contain an integral number of 12-bit integers.
Re: Reading FAT12 entries sector by sector
You are accepting abysmal performance to save 4.5KB of RAM?cybek wrote:Yeah, but my main thought is RAM efficiency.iansjack wrote:For the sake of efficiency you want to cache the FAT in RAM. If I were to support FAT12 I would just read the whole table from the disk and treat it as a large array.
Poor design decision.