Page 1 of 1

FAT12: calculating the root directory location

PostPosted: Tue Jul 18, 2017 1:53 pm
by CodeVisio
Hi,

I've been following your OS series development.

On "Operating Systems Development - Bootloaders 4" page, under the sections "Step 2: Get start of root directory" and "Root Directory - Complete example",
you show assembly code to calculate the position, as number of sectors, of the FAT12 root directory .

In particular you do:
(number of FATs) * (number of sector per FAT) + (number of reserved sectors)
2 * 9 + 1 = 19

Shouldn't it be:
(number of FATs) * (number of sector per FAT) + (number of reserved sectors) + boot sector
2 * 9 + 1 + 1 = 20

?


Thanks

Re: FAT12: calculating the root directory location

PostPosted: Fri Jul 21, 2017 8:38 pm
by CodeVisio
Hi again,

I'm going to answer myself, should someone else run into the same misunderstanding.

As those first sectors are layout on the OS Development tutorial causes misunderstanding, because the reserved-sectors sector comes right after the boot sector, forcing to think is something separated and different from the boot sector.

According to Wikipedia*, the number of reserved sectors includes, by definition, the boot sector as well.

Anyway, a big thanks to Mike for his effort in making this tutorial.



* https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system