flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > Root_Directory at FAT32 partition

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 20 Jan 2005, 10:20
Hi!

How can I find the root_Directory at a FAT32 partition?
I read an official tutorial by microsoft and found a value called: BPB_Root_Clust.

This value is at my 1st computer 0xE9 and at my second 0x2.

A cluster is here 32 sectors.

Let's calculate:

0xE9*32= 7.456
0x2*32=64

The Root_Directory has to start at sector 7.456 and at 64.

Well, in reality it starts at sector 19.??? and 20.??? (20thousend+anything).

does anybody know a solution?
i saw menuet working at the second computer (with rd=0x2).

but i dont really understand the uncommented FAT32 source.

i'm looking forward reading some answeres...

greets, ...
Post 20 Jan 2005, 10:20
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2138
Location: Estonia
Madis731 20 Jan 2005, 17:49
...and why can't I make dual-boot with MenuetOS and Win2000 Sad
I made a special FAT32 20MB partition in the beginning and let the rest of the HDD remain NTFS(it nearly impossible to convert it to FAT32). Hmm, MenuetOS booted fine, but NTLDR couldn find the other OS (yes the Win2000 that should be in the multi(0)disk(0)rdisk(0)partition(2) now.)

I hoped that Menuet would push Windows from partition 1 to 2, because partition 1 was MenuetOS. When that didn't work I deleted the 20MB and now it stays empty at the beginning of the drive Sad
Post 20 Jan 2005, 17:49
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
spideros1



Joined: 17 Jan 2004
Posts: 77
Location: Poland
spideros1 20 Jan 2005, 19:43
It's the best to format disk to fat32 using mkdosfs in linux. You just use mkdosfs -F 32 somedevice and you can even have fat32 floppy Smile
Post 20 Jan 2005, 19:43
View user's profile Send private message Visit poster's website Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach 21 Jan 2005, 07:38
a fat32 floppy..? Smile does windows detect it?
Post 21 Jan 2005, 07:38
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 21 Jan 2005, 09:06
bubach wrote:
a fat32 floppy..? Smile does windows detect it?


For this you would need a very big Smile floppy, since the kind of FAT (12,16 or 32) is decided on the base of count of clusters (for instance a usual 1.44 MB format merely has 2880 clusters -> FAT12).
Post 21 Jan 2005, 09:06
View user's profile Send private message Reply with quote
gLes



Joined: 21 Jan 2005
Posts: 3
Location: Budapest, Hungary
gLes 21 Jan 2005, 14:06
Madis731 wrote:
...and why can't I make dual-boot with MenuetOS and Win2000 Sad
I made a special FAT32 20MB partition in the beginning and let the rest of the HDD remain NTFS(it nearly impossible to convert it to FAT32). Hmm, MenuetOS booted fine, but NTLDR couldn find the other OS (yes the Win2000 that should be in the multi(0)disk(0)rdisk(0)partition(2) now.)


As far as I know NTLDR won't boot anything other than Windows operating Systems Rolling Eyes Try Linux Smile GRUB will boot you anything Wink
Post 21 Jan 2005, 14:06
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
gLes



Joined: 21 Jan 2005
Posts: 3
Location: Budapest, Hungary
gLes 21 Jan 2005, 14:10
Endre wrote:
For this you would need a very big Smile floppy, since the kind of FAT (12,16 or 32) is decided on the base of count of clusters (for instance a usual 1.44 MB format merely has 2880 clusters -> FAT12).


I'd like to see an NTFS formatted floppy Laughing I suppose the MFT would consume the whole amount of space on the disk Cool
Post 21 Jan 2005, 14:10
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3174
Location: Denmark
f0dder 21 Jan 2005, 16:28
gLes, NTLDR will boot other OSes just fine, you just need the bootsector in a file on the drive. Read linux HOWTOs.

gLes, www.sysinternals.com has an article on NTFS formatted floppy.
Post 21 Jan 2005, 16:28
View user's profile Send private message Reply with quote
gLes



Joined: 21 Jan 2005
Posts: 3
Location: Budapest, Hungary
gLes 21 Jan 2005, 16:36
f0dder wrote:
gLes, NTLDR will boot other OSes just fine, you just need the bootsector in a file on the drive. Read linux HOWTOs.

gLes, www.sysinternals.com has an article on NTFS formatted floppy.


Well on it's own it surely won't if you need to read Linux HOWTOs Wink

Shouldn't have asked Cool
Post 21 Jan 2005, 16:36
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3174
Location: Denmark
f0dder 21 Jan 2005, 19:54
It does it on it's own, it's just not documented. You need to get a bootsector into a file, just like NTLDR does when booting 9x partitions.
Post 21 Jan 2005, 19:54
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 21 Jan 2005, 20:05
SPTH wrote:
Hi!

How can I find the root_Directory at a FAT32 partition?
I read an official tutorial by microsoft and found a value called: BPB_Root_Clust.

This value is at my 1st computer 0xE9 and at my second 0x2.

A cluster is here 32 sectors.

Let's calculate:

0xE9*32= 7.456
0x2*32=64

The Root_Directory has to start at sector 7.456 and at 64.

Well, in reality it starts at sector 19.??? and 20.??? (20thousend+anything).

does anybody know a solution?
i saw menuet working at the second computer (with rd=0x2).

but i dont really understand the uncommented FAT32 source.

i'm looking forward reading some answeres...

greets, ...


Calculating physical sectors (not speaking about heads, and tracks) from logical ones is not so simple:

Note, logical sectors are relative to the beginning of the given partition

The physical position of a logical sector is given by 3 coordinates:
1. sector number in the given track (1..max number of sectors per track)
2. head number (0..max number of heads-1)
3. track number (0..max number of tracks-1)

When going forward on the disk it will first change the sector count then the head count and last the track count.

example:
pretend we have a drive with 2 heads, 3 sectors per track and 2 tracks. So we have 12 sectors on the disk. Thus the physical addresses of the sectors are:
sector 1 is at (t:0, h:0, s:0)
sector 2 is at (t:0, h:0, s:1)
sector 3 is at (t:0, h:0, s:2)
sector 4 is at (t:0, h:1, s:0)
sector 5 is at (t:0, h:1, s:1)
sector 6 is at (t:0, h:1, s:2)
sector 7 is at (t:1, h:0, s:0)
sector 8 is at (t:1, h:0, s:1)
sector 9 is at (t:1, h:0, s:2)
sector 10 is at (t:1, h:1, s:0)
sector 11 is at (t:1, h:1, s:1)
sector 12 is at (t:1, h:1, s:2)
So if I want to reach the logical sector 9 then I have to use the physical position (t:1, h:0, s:2).

In the above example I intentionally used sector/track number 3 to make it clear that individual coordinates don't have to be conforming to the base 2 digit bounds.

Endre.
Post 21 Jan 2005, 20:05
View user's profile Send private message Reply with quote
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 24 Jan 2005, 15:22
Hi Endre!
Thank you for your answere.
Well, but still I dont know how I can get the sector of the Root_Directory.

I thought this:
1sector=512 byte
Root_Cluser*SecPerCluster=RootSector.

but that's not true as far as I've tested.
I've tested it with HexEditor at my two Partitions.

How can I get the Sectore of the root_directory?

greets, ...
Post 24 Jan 2005, 15:22
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 24 Jan 2005, 20:06
SPTH wrote:
Hi Endre!
Thank you for your answere.
Well, but still I dont know how I can get the sector of the Root_Directory.

I thought this:
1sector=512 byte
Root_Cluser*SecPerCluster=RootSector.

but that's not true as far as I've tested.
I've tested it with HexEditor at my two Partitions.

How can I get the Sectore of the root_directory?

greets, ...

You calculate RootSector correctly. But this gives a relative logical sector number and not a physical one.

1.) you have to read the given entry of the partition table to determine the absolute logical sector number of the beginning of your partition.
The coordinates of the parttion table:
physical: track=0; head=0; sector=1;
or
absolute logical: sector=0;
for int 0x13 you need the physical data.

2.) As mentioned RootSector is relative logical. That means that it starts from beginning of the partition.
RootSector_Abs = RootSector + Partition_Start

3.) Now you have an absolute logical sector number which you have to convert to physical coordinates (recall: track, head, sector)
sector = (RootSector_Abs % BPB_SecPerTrk) + 1
head = (RootSector_Abs / BPB_SecPerTrk) % BPB_NumHeads
track = (RootSector_Abs / BPB_SecPerTrk) / BPB_NumHeads

Maybe I've made mistakes at some points. I tried just to explain the main idea of FAT addressing.

Gruß Endre
Post 24 Jan 2005, 20:06
View user's profile Send private message Reply with quote
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 25 Jan 2005, 06:31
Thank you Endre!
I think now I understand it. I'll try tonight if it really works.

greets, ...
Post 25 Jan 2005, 06:31
View user's profile Send private message Reply with quote
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 15 Feb 2005, 22:07
Hi again!

well, finally I had enough time to code again (damn school).

OK, still the same damn problem:

BRB_Root_Cust: 0xE9 = 233
SectPerClus: 0x20 = 32

relative Root_Directory: 233*32=7456

1 partition starts at: 0x3F = 63

That means, that the Root_Directory_Entry should be at:
7456+63=7519 Sector

But that's NOT true Sad
it is at Sector 19094.

How comes that value?

I've tested:
- Partition really starts at Sector 63(+1).
- BRB_Root_Cust and SecPerClus are right values
- Real Root_Directory_Entry ARE at 19094.

I dont have any idea what is wrong in my calculation.

I've done the CHS calculation:


Sector = ((LBA Mod Total Sectors) +1)
CylHead = (LBA Div Total Sectors)
Head = (CylHead Mod (Total Heads + 1))
Cylinder = (CylHead Div (Total Heads + 1))

But: It returned a value (nearly) 7519. I had some minor errors, but not that big. So some major things aren't right at my calculation.

I've searched for hours and even tested everything x times.
Does anybody have an idea???

much thanks + looking for an answere,
SPTH
Post 15 Feb 2005, 22:07
View user's profile Send private message Reply with quote
Wildwest



Joined: 13 Sep 2004
Posts: 100
Location: Russia
Wildwest 16 Feb 2005, 14:21
Recently Mario79 (author of many fixes for FAT32 and author of FAT16 support) said what MS docs is shit and FAT32 and FAT16 have undocumented formulas for calculating some things.
I think: root_Directory is included in this hide_from_non-MS-programmers_formulas_list.
E-mail to Mario79 - he know truth.
Post 16 Feb 2005, 14:21
View user's profile Send private message Reply with quote
sonny73044



Joined: 08 Dec 2004
Posts: 28
Location: Oklahoma,USA
sonny73044 16 Feb 2005, 15:02
From what I can tell the root directory is not in a fixed location:
http://www.microsoft.com/whdc/archive/fat32preinstall.mspx
http://www.ntfs.com/fat-boot-modif.htm
http://www.systweak.com/fat32/fat4.htm
It looks as if your best bet is going to be to try to read the
BIOS Parameter Block (BPB) which should tell you the location of the root directory

_________________
Sonny
Post 16 Feb 2005, 15:02
View user's profile Send private message Visit poster's website Reply with quote
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 16 Feb 2005, 20:42
Hi!
much thanks for your help!
well, i have no time to read the sites today, but tomorrow
and,yes, i'll contact Mario79! thanks for the idea!

greets, ...
Post 16 Feb 2005, 20:42
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 16 Feb 2005, 23:50
offset in the boot sector
13 ;db sectors per cluster
14 ;dw fat offset or reserved sectors
16 ;db number of fats
44 ;dd root cluster
36 ;dd sectors per fat
first sector of fat32 directory is :
(boot sector)+(number of fats)*(sectors per fat)+(reserved sectors)+(root cluster-2)*(sectors per cluster)
Post 16 Feb 2005, 23:50
View user's profile Send private message Visit poster's website Reply with quote
SPTH



Joined: 24 Jul 2004
Posts: 91
SPTH 17 Feb 2005, 10:26
cool, that sounds differnet to the old version. i'm going to test it today afternoon.

about Mario79: i've searched his profil for the email-addy, but mario79@ezmail.ru does not work, and mario79@email.ru also not...

Does anybody know how to contact him?

greets, Mario
Post 17 Feb 2005, 10:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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 can attach files in this forum
You can download files in this forum


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

Website powered by rwasa.