The very first sector of a hard disk (head 0, cylinder 0, sector 1)
contains the Master Boot Record which is loaded into memory at 0:7c00 and
executed by the ROM-BIOS during the System Startup Sequence.

The last part of this sector contains the partition table--a 4-entry table
with each entry being 16 bytes long.  This table is manipulated by FDISK
(or the equivalent utility of a non-DOS operating system).

At boot time, the ROM-BIOS loads the Master Boot Record and jumps to its
code.  That code examines the Partition Table to determine which partition
is marked as active.  It then reads the correct boot sector into memory
and executes it.

MasterBootRec
Offset Size Contents
                                                                          
+0    1beH abBootCode   master boot executable code
+1beH    10H rPrtnInfo_1  partition 1 entry  (see below)
+1ceH    10H rPrtnInfo_2  partition 2 entry
+1deH    10H rPrtnInfo_3  partition 3 entry
+1eeH    10H rPrtnInfo_4  partition 4 entry
+1feH     2  wPrtnTblSig  partition table signature (aa55H)
512               size of the master boot sector

abBootCode  The first part of the sector (446 bytes) contains executable
code.  This code examines the partition table (starting at
offset 1beH) and learns which partition is active.  It then
seeks to that portion of the disk and reads the first sector
of that partition.  That sector is laid out as a

rPrtnInfo_n  These four entries define the partitions allocated on the
disk.  Their layout is described below.

wPrtnTblSig  The final two bytes of the sector contain AA55H.  This
signature identifies the sector as a Master Boot Record.

PartitionEntryRec
Offset Size Contents
                                                                          
+0      1  bBootFlag    0=not active, 80H = active (boot this partition)
+1      1  bBeginHead   partition begins at this head...
+2      2  rBeginSecCyl ...and this sector and cylinder (see below)
+4      1  bFileSysCode file system type
+5      1  bEndHead     partition ends at this head...
+6      2  bEndSecCyl   ...and this sector and cylinder (see below)
+8      4  lBeginAbsSec partition begins at this absolute sector #
+0cH     4  lTotalSects  total sectors in this partition
16               size of a PartitonEntryRec
+10H                     start of next entry or AA55H if last entry

bBootFlag  specifies if this partition is the active, bootable partition.
00H means not active (or not bootable)
80H means this is the partition to boot
Only one entry can be set to 80H.

bBeginHead  the head number to use as the start of this partition.
rBeginSecCyl  the sector and cylinder number of the first sector in this
partition.

Sector and Cylinder values are actually 6 bits and 10 bits:
1 1 1 1 1 1
 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 
 c c c c c c c c C c S s s s s s 
                                 
The high two bits of the second byte are used as the high bits
of a 10-bit value.  This allows for as many as 1024 cylinders
and 64 sectors per cylinder.

This is ordered so that when you load CX with the 16-bit
value, it will be set up for a call to INT 13H to read the
desired portion of the disk.

bFileSysCode  The following codes are recognized by DOS:
00H  unknown file system type
01H  DOS 12-bit FAT; partition smaller than 10 MB
04H  DOS 16-bit FAT; partition smaller than 32 MB
05H  Extended DOS Partition (see notes, below)
06H  DOS 16-bit FAT; partition larger than or exactly 32 MB

Other codes may exist; for instance, in non-DOS partitions.

Types 1, 4, and 6, are given their own drive ID.  Type 5
provides a way to have more than 4 DOS partitions on a drive.

bEndHead  the head number for identifying the end of the partition
bEndSecCyl  the sector and cylinder number of the last sector in this
partition (see rBeginSecCyl, above)

lBeginAbsSec  the partition starts at the absolute sector # (just another
way to express rBeginHead and rBeginSecCyl; see notes, below).
lTotalSects  total number of sectors in this partition.

Notes:   The absolute sector value at offset 08H of each entry is
equivalent to the head, sector, and cylinder of the partition
start address:

Relative sector 0 is equal to cylinder 0, head 0, sector 1.
The relative sector number increments first for each
sector-per-track, next for each head, and finally for each
cylinder.  This formula applies:

relSec =  (CylNo * SecsPerTrack * Heads)
+ (HeadNo * SecsPerTrack)
+ (SecNo - 1)

Use SecNo-1 since sectors are always numbered starting with 1.

You can obtain low-level information such as sectors-per-track
by using INT 13H, fn 08H.

  Partitions begin on an even cylinder number, except for the
first partition which may begin on cylinder 0, head 0, sector 2
(since sector 1 is occupied by the Master Boot Record).

  When the boot record of a partition receives control, its
partition table entry is pointed to by DS:SI.

  Logical Volumes and DOS Extended Partitions  
Prior to DOS 3.3 DOS was incapable of accessing a drive larger than 32 MB
(see FAT and INT 25H/26H for reasons).  You could define four DOS
partitions, but that maxed out at 128 MB.  DOS 3.3 added the concept of
"logical volumes, so that one disk could define more than 4 partitions.

Note: Starting with DOS 4.0, the 32 MB limit went away, and the
extended DOS Partition concept is useful only of you need to
access more than 4 DOS partitions.

With DOS 6, you may find it advantageous to make the entire disk
as one large volume and use DoubleSpace to break it up into
several drives.

When a partition table entry bFileSysCode contains a 05H, then the
partition defined by the entry is treated as if it were the start of
another physical drive; that is, the Master Boot code reads the table to
learn about additional partitions.  Each extended partition can define up
to four DOS partitions.

See Extended DOS Partition for a detailed discussion of this topic.

  Logical Volumes and DOS Extended Partitions  
The trans-32M support in DOS 4.0 caused no changes in the partition table
or the 3.3 logical volume support.  The significant differences are found
in the Boot Sector Layout at the start of each DOS 4.0-formatted
partition, in the changes to INT 25H/26H, and in the new functionality
required in block device drivers.

See Also: INT 13H (disk I/O
INT 19H (bootstrap)
- -

Disk Partition Table