Created
September 25, 2010 13:44
-
-
Save Solvalou/596848 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FAT16 | |
sector0 = mbr | |
MASTER BOOT RECORD (512 bytes) | |
$0000 - $01FF | |
{ | |
executable code (446 bytes) | |
$0000 - $01BD | |
partition 1 | |
$01BE - $01CD | |
{ | |
boot indicator (1 byte) | |
$01BE | |
{ | |
#$80 - boot from this partition | |
#$00 - skip booting | |
} | |
starting head (1 byte) | |
$01BF | |
{ | |
starting head for the partition in hex | |
#$xx - number of head | |
maximum is #$FF = 255 | |
} | |
starting sector/cylinder (2 bytes) | |
$01C0 - $01C1 | |
{ | |
starting sector and cylinder for the partition | |
convert hex to binary: | |
$xx, xx - %0123 4567, 89AB CDEF | |
sector position: | |
%--23 4567 | |
cylinder position: | |
%--12 89AB CDEF | |
} | |
partition type (1 byte) | |
$01C2 | |
{ | |
visible - $06 | |
hidden - $16 | |
if the value differs, an other partition type than fat16 is used | |
} | |
ending head (1 byte) | |
$01C3 | |
{ | |
same as starting head, but ending | |
} | |
ending sector/cylinder (2 bytes) | |
$01C4 - $01C5 | |
{ | |
same as starting sector/cylinder, but ending | |
} | |
the starting sector (4 bytes) | |
$01C6 - $01C9 | |
{ | |
points to sector wich contains the boot record | |
bytes must be flipped to be read: | |
$00, $11, $22, $33 -> $33, $22, $11, $00 | |
=> convert to decimal to get the sector-# | |
} | |
sectors in the partition (4 bytes) | |
$01CA - $01CD | |
{ | |
number of sectors in the partition | |
bytes must be flipped to be read: | |
$00, $11, $22, $33 -> $33, $22, $11, $00 | |
=> convert to get the # of sectors | |
} | |
} | |
partition 2 | |
$01CE - $01DD | |
{ | |
//same as partition 1, addresses differ | |
} | |
partition 3 | |
$01DE - $01ED | |
{ | |
//see above | |
} | |
partition 4 | |
$01EE - $01FD | |
{ | |
//see above | |
} | |
executable signature (2 bytes) | |
$01FE - $01FF | |
{ | |
these two bytes indicate if the partition is executable | |
} | |
} | |
sectors 1 - 62 (62x512 bytes = 31.744 bytes) | |
$0200 - $7DFF | |
{ | |
empty or unused | |
} | |
BOOT RECORD of the partition (512 bytes) | |
// Address-range: start sector is defined via chs-code in the mbr | |
// addressing is described as a offset from this start-sector | |
$0000 - $01FF | |
{ | |
jumpcode (3 bytes) | |
$0000 - $0002 | |
{ | |
offset jump to the boot(strap) executable code | |
$EB, $xx, $90 | |
=> jumpshort(to) $XX | |
NOP | |
} | |
oem/id name (8 bytes) | |
$0003 - $000A | |
{ | |
indicates the system wich formatted the device | |
} | |
bytes per sector (2 bytes) | |
$000B - $000C | |
{ | |
read the value: | |
$00, $11 flip -> $11, $00 | |
convert to decimal | |
normally set to $0002 = 512bytes | |
} | |
sectors per cluster (1 byte) | |
$000D | |
{ | |
number of sectors per cluster | |
depends on partition-size | |
} | |
reserved sectors (2 bytes) | |
$000E - $000F | |
{ | |
number of reserved sectors | |
} | |
no. of fats (1 byte) | |
$0010 | |
{ | |
number of fats used, normally two | |
} | |
root entries (2 bytes) | |
$0011 - $0012 | |
{ | |
maximum number of 32byte entries in the root directory | |
$00, $11 flip -> $11, $00 | |
convert to decimal and multiply with 32(bytes) | |
to get the data stored after this point | |
} | |
total sectors(16) (2 bytes) | |
$0013 - $0014 | |
{ | |
set if the partition is less than 32mb in size | |
} | |
media type (1 byte) | |
$0015 | |
{ | |
$F8 - HDD, SD, MMC... | |
} | |
sectors per fat (2 bytes) | |
$0016 - $0017 | |
{ | |
number of sectors in one fat | |
$00, $11 flip-> $11, $00 | |
convert to decimal and multiply with 512(bytes per sector) | |
if there are two copies of the fat, multiply again with to | |
to geht the complete size (jump to the root directory) | |
} | |
sectors per track (2 bytes) | |
$0018 - $0019 | |
{ | |
number of sectors per track | |
} | |
no. of heads (2 bytes) | |
$001A - $001B | |
{ | |
number of disk drive heads | |
$00, $11 flip-> $11, $00 | |
} | |
hidden sectors (4 bytes) | |
$001C - $001F | |
{ | |
will matchup with the starting sector stated in the mbr | |
states the number of hidden sectors from the beginning of the drive | |
to the boot record of the partition | |
$00, $11, $22, $33 flip-> $33, $22, $11, $00 | |
convert to decimal to get the # of hidden sectors | |
} | |
total sectors(32) (4 bytes) | |
$0020 - $0023 | |
{ | |
this is used if total sectors(16) is set to $0000 | |
total number of sectors in this partition | |
$00, $11, $22, $33 flip-> $33, $22, $11, $00 | |
} | |
drive id (1 byte) | |
$0024 | |
{ | |
logical drive number | |
$00 - floppy | |
$80 - hd | |
} | |
nt reserved (1 byte) | |
$0025 | |
{ | |
set to $00, not checked | |
} | |
extended boot signature (1 bytes) | |
$0026 | |
{ | |
if set to $29, serial, label and type data is present | |
} | |
volume serial number (4 bytes) | |
$0027 - $002A | |
{ | |
serial number of the drive | |
unique indentifier to keep track of drives in use | |
} | |
volume/partition name (11 bytes) | |
$002B - $0035 | |
{ | |
lable of the volume | |
} | |
fat type (8 bytes) | |
$0036 - $003D | |
{ | |
type of the partition | |
} | |
executable boot code (448 bytes) | |
$003E - $01FD | |
executable signature (2 bytes) | |
$01FE - $01FF | |
{ | |
has to be $55, $AA to be valid | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment