Page 1 of 1

FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 8:25 am
by Raddel
hello,

Plz need help how i can determine a value in FAT16 for some Media. Here is the example for 256Mb flashdisk i've got from windows formater.

FAT16 Boot structure: (256Mb Flashdisk)

JMP instruction: '0xEB 0x3C 0x90'
OEM: 'MSDOS5.0'
Bytes per Sector: '0x0200' (512 dec)
Sectors per cluster: '0x08' (8 dec)
Reserved Sectors: '0x0004' (4 dec)
Number of FATs: '0x02'
Max root entries: '0x0200' (512 dec)
Small sectors: '0x0000' (0 dec)
Media type: '0xF8'
Sectors per FAT: '0x00FA' (250 dec)
Sectors per track: '0x003F' (63 dec)
Number of heads: '0x00FF' (255 dec)
Hidden sectors: '0x00000000' (0 dec)
Large sectors: '0x0007D200' (512512 dec)
Disk number: '0x00'
Current head (not used): '0x00'
NT signature: '0x29' (41 dec)
Volume serial number: '0xDC7F521A' (3699331610 dec)
Volume label: 'NO NAME '
System ID: 'FAT16 '

My question is.. How we calculation the large sector? and determine heads and track?
I have count the large sector in bytes :512512*512bytes = 262406144 bytes
And compare with this 256*1024*1024 = 268435456 bytes
Not Same...! How it can be?

Plz need help some the algorithm or clue here...

Best Regards,
Raddel

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 8:52 am
by Chandra
You may want to check out the official FAT documents.
Microsoft at your service.

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 3:12 pm
by Raddel
I have already reading about FAT16, and i don't found how to determine the value inside the FAT16 BPB, i want make some formater program for some media, so i must determine the BPB value right? Is there any site link or information about that...
Many Thanks.

Best Regards,
Raddel

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 4:37 pm
by Chandra
FAT16 BPB is same as that of FAT12. The major difference is that FAT16 uses 16 bit cluster entry whereas FAT12 uses 12 bit cluster entry in the File Allocation Table.

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 9:10 pm
by Raddel
Yap.. i agree that FAT16 is same with FAT12, but my question how i can determine a value inside BPB. It's mean different media size have different value right? example Media 256Mb have N sector.. and 512Mb have M sector and 1GB have R sector.. Now my question how the way calculate the sector on base media size?

I'have try to calculate, but it's not match..? or i have a wrong calculation.. :? i need help and suggestion..
Thank you.

Best Regards,
Raddel

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 10:46 pm
by DavidCooper
Raddel wrote:My question is.. How we calculation the large sector? and determine heads and track?
I have count the large sector in bytes :512512*512bytes = 262406144 bytes
And compare with this 256*1024*1024 = 268435456 bytes
Not Same...! How it can be?

Plz need help some the algorithm or clue here...
It's 1001*1024*256 rather than 1024*1024*256, so the mismatch is the result of differing opinions as to what qualifies as a megabyte. I can't see how it affects your calculation of track and head - they should be the same as if it was 1024*1024*256 up to the point where you hit the 512512th sector.

Re: FAT16 BPB Calculation

Posted: Sat Feb 26, 2011 11:35 pm
by bewing
1) A formatter never formats the entire space. There will always be some left unformatted at the end.

2) You must get the heads and tracks values from the BIOS using INT0x13/ah=8. The values in the BPB are often wrong and can not be trusted.

Re: FAT16 BPB Calculation

Posted: Sun Feb 27, 2011 9:48 am
by Raddel
bewing wrote:1) A formatter never formats the entire space. There will always be some left unformatted at the end.
So i can determine how many sector reserved right? and i can have my own value right, it doesn't have a standart value for formating disk? Am i correct? :)

Re: FAT16 BPB Calculation

Posted: Sun Feb 27, 2011 10:11 am
by Chandra
Raddel wrote:
bewing wrote:1) A formatter never formats the entire space. There will always be some left unformatted at the end.
So i can determine how many sector reserved right? and i can have my own value right? :)
Right. But don't go way off as you'll lose the compatibility with other Operating systems.The media formatted by your OS will be identified as a RAW media if you don't use standard values where possible.