Page 1 of 1
Floppy disk layout.
Posted: Sat Jul 18, 2009 4:02 pm
by eXeCuTeR
As far as I know, the floppy disk layout consists of 4 sections: boot sector, fat tables, root directory, data area.
Now, there's a "formula" of calculating logical sector numbers into physical one which goes: 33 + logical sector - 2....my question is why the minus 2 is included?
The boot sector takes surprisingly 1 sector, 2 fat tables which take 9*2+1 sectors, 1 root directory that takes 33-19 sectors, and the data area goes from that part till the end of sectors...so what's up with this minus 2? as I've heard, it is because that 2 FAT table entries are reserved for the EOC mark and something that I forgot (remind me ;o) but the 2 FAT tables are located back at sectors 1-19, so how does this relate eventually?
Re: Floppy disk layout.
Posted: Sat Jul 18, 2009 7:41 pm
by Firestryke31
It's because cluster numbering, for some strange reason, starts at 2 instead of 0. Thus, to get the real offset, you have to subtract 2 from the cluster and then can do the cluster to sector conversion.
Re: Floppy disk layout.
Posted: Sun Jul 19, 2009 6:52 pm
by kop99
the floppy disk layout consists of 4 sections
Isn't it fat layout?
And minus 2 is not absolute.
Generally, that value is 2, but follow BR sector's start cluster number field.
Re: Floppy disk layout.
Posted: Mon Jul 20, 2009 3:58 am
by eXeCuTeR
Firestryke31 wrote:It's because cluster numbering, for some strange reason, starts at 2 instead of 0. Thus, to get the real offset, you have to subtract 2 from the cluster and then can do the cluster to sector conversion.
That is the point...what is that strange reason that cluster/sector numbering starts at 2 instead of 0?
And another question...what does it exactly mean when saying root directory's sector?
Re: Floppy disk layout.
Posted: Wed Jul 22, 2009 12:07 am
by manonthemoon
Well, I'm assuming you already read
FAT. At the very bottom is an external link to the FAT specs directly from Microsoft.
Microsoft wrote: The first data cluster is cluster 2.
@kop99: The first data cluster is
always 2, according to the document. It
is an absolute constant. What you're thinking of is the offset of the root cluster, which defaults to 2, but can be moved up to skip over bad clusters.
eXeCuTeR wrote:what is that strange reason that cluster/sector numbering starts at 2 instead of 0?
Again, do a little research and actually read the docs.
Microsoft wrote:The first reserved cluster, FAT[0], contains the BPB_Media byte value in its low 8 bits ... ... The second reserved cluster, FAT[1], is set by FORMAT to the EOC mark. ... ... ... (read the doc for more details)
Basically there are two clusters in the FAT that don't correspond to real clusters because they hold codes. You must subtract 2 to get the physical cluster number because the two reserved ones are just placeholders in the FAT.
And another question...what does it exactly mean when saying root directory's sector?
The sector on the disk that holds the root directory. What don't you understand? The root directory is like A:\ or C:\. It holds entries that point to all the other directories and files at the root level.