flat assembler
Message board for the users of flat assembler.

Index > OS Construction > What is "Hidden Sectors" on FAT volumes?

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 490
Location: Belarus
zhak
Hi everyone!
Can someone explain what 'Hidden Sectors' in FAT file systems actually is?
Maybe some example or a picture could help. I mean where these sectors actually reside and how should I count them when formatting disk drive...
MS FAT32 FS Spec (ver 1.03 - Dec 6, 2000) pg. 14:
Code:
FirstDataSector = BPB_RsvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors;
    

but disassembly of a floppy disk boot sector shows that FirstDataSector actually computed as:
Code:
FirstDataSector = BPB_RsvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors + BPB_HiddSec;
    

It seems like there's an error in specification...
Post 30 Dec 2007, 16:11
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 490
Location: Belarus
zhak
Ah, yes. I've got one more question about FAT...
MS FAT32 FS Spec (ver 1.03 - Dec 6, 2000) pg. 13:
Quote:

RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec – 1)) / BPB_BytsPerSec;

Note that on a FAT32 volume the BPB_RootEntCnt value is always 0, so on a FAT32 volume
RootDirSectors is always 0. The 32 in the above is the size of one FAT directory entry in bytes.
Note also that this computation rounds up.

Does it really rounds up? And why is it computed in such way??? For example, we have standard FAT12 floppy disk with 224 root directory entries and 512 bytes per sector. Then
RootDirSectors = ((224 * 32)+(512-1)) / 512 = 14,99

it seems that root directory has to have 14 sectors (224 * 32 / 512). Why can't we use this simple formula? Or I'm mistaken and in the example above RootDirSectors is actually 15, but not 14??? But if it's so, then for FAT32 this parameter cannot be equal to zero, as it's written in specification, because for FAT32 we have

RootDirSectors = ((0 * 32) + (512-1)) / 512 = 0,99
Post 30 Dec 2007, 17:35
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
1. A FAT12 floppy is really bad to explore FAT32 Sad

2. It is ZERO because on FAT32 the main directory can be anywhere in the data area and can grow Shocked
Post 31 Dec 2007, 00:39
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 490
Location: Belarus
zhak
1. I do not explore FAT32 on floppy disk. I explore FAT in general to write: a) FORMAT program, that will be able to create system disks for my OS, and b) boot sector that will work on ANY FAT12/16 volume.
2. Yes, I know why RootDirSectors = 0 on FAT32.
My questions were a little bit different. Nevertheless, thanks for your reply.
Post 31 Dec 2007, 09:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.