Page 1 of 1
FAT Filesystem Implementation
Posted: Fri Jul 27, 2012 2:20 am
by Ziddia
Hi,
I've been working on the theory and code found
here and I've set everything up, but I'm confused on one point. How do I get the data that makes up fat_BS_t and either fat_extBS_16_t or fat_extBS_32_t? Do I need to read it from the BIOS during boot, or read it from the floppy I'm using somehow, or provide it myself?
Thanks!
Re: FAT Filesystem Implementation
Posted: Fri Jul 27, 2012 2:31 am
by Combuster
fat_BS_t can be found at the first byte of the medium or partition. The bootloader also starts at the first byte of the medium or partition. The bootloader doesn't need any additional steps to read that structure because it's an integral part of itself.
If you need to read a filesystem at a later point, just read the first sector.
Re: FAT Filesystem Implementation
Posted: Fri Jul 27, 2012 3:04 am
by Ziddia
Combuster wrote:fat_BS_t can be found at the first byte of the medium or partition. The bootloader also starts at the first byte of the medium or partition. The bootloader doesn't need any additional steps to read that structure because it's an integral part of itself.
If you need to read a filesystem at a later point, just read the first sector.
So all the information's located in the BPB, I assume. Assuming the first sector of the disk is loaded into ram at the position 0x0000:0x7c00, as the wiki page tells me, where would I read to find what I need? For example, the bytes per sector value is, according to the wiki, at an offset of 11 bytes. Is that relevant to where in memory the value is?
Questions are kind of silly and probably obvious, but I'm just kind of muddling through this at the moment.
Re: FAT Filesystem Implementation
Posted: Fri Jul 27, 2012 3:44 am
by Nessphoro
Well eh, yeah.
It will be located at (Where you loaded the first sector)+11
In this case 0x7C00+11
Re: FAT Filesystem Implementation
Posted: Fri Jul 27, 2012 4:16 am
by Ziddia
Nessphoro wrote:Well eh, yeah.
It will be located at (Where you loaded the first sector)+11
In this case 0x7C00+11
Alright, seems simple enough. Thanks. I'll check back once I'm done with it.