MS-DOS 6.22 FAT Boot Sector Structure Explained

When formatting a logical FAT12 or FAT16 volume, MS-DOS 6.22 writes a standardized 512-byte boot record to Sector 0 of the partition. This article breaks down how the MS-DOS 6.22 FORMAT utility constructs this sector, detailing the jump instruction, OEM signature, BIOS Parameter Block (BPB), Extended BPB, the bootstrap machine code designed to locate and launch IO.SYS, and the end-of-sector signature.

Jump Instruction and OEM Identification (Offsets 0x000–0x00A)

The boot sector begins with a 3-byte x86 machine code jump instruction that skips past the embedded configuration metadata directly to the executable bootstrap routine:

  • Offset 0x000 (3 bytes): Typically contains EB 3C 90 (a short relative jump JMP 0x3E followed by a NOP) or E9 XX XX (a near jump). This directs CPU execution to offset 0x03E where the bootloader code resides.
  • Offset 0x003 (8 bytes): The OEM identifier string. Despite being MS-DOS 6.22, the FORMAT command typically writes MSDOS5.0 padded with spaces (4D 53 44 4F 53 35 2E 30) to maintain strict backward compatibility with third-party utilities and earlier BIOS implementations.

Standard BIOS Parameter Block (Offsets 0x00B–0x017)

Following the OEM string is the standard DOS 2.0/3.0 BIOS Parameter Block (BPB), which defines the fundamental physical and logical geometry of the file system:

  • 0x00B (2 bytes): Bytes per logical sector, nearly always 512 (00 02).
  • 0x00D (1 byte): Sectors per cluster (power of 2, such as 4, 8, 16, 32, or 64 depending on partition size).
  • 0x00E (2 bytes): Number of reserved sectors before the first FAT. For FAT12 and FAT16, this is almost universally 1 (the boot sector itself).
  • 0x010 (1 byte): Number of File Allocation Tables (FATs), standardly set to 2.
  • 0x011 (2 bytes): Maximum number of 32-byte root directory entries. Typical values are 512 for hard drives or 224 for 1.44 MB floppy disks.
  • 0x013 (2 bytes): Total sector count across the volume (16-bit). If the volume exceeds 32 MB (65,535 sectors), this field is set to 0, and the 32-bit count at offset 0x020 is used instead.
  • 0x015 (1 byte): Media descriptor byte (e.g., F8h for fixed hard disks, F0h for 1.44 MB 3.5-inch floppies).
  • 0x016 (2 bytes): Sectors occupied by each individual FAT copy.

DOS 4.0+ Extended BPB (Offsets 0x018–0x03D)

MS-DOS 6.22 utilizes the Extended BPB introduced in DOS 4.0 to support partitions larger than 32 MB and track volume metadata:

  • 0x018 (2 bytes): Sectors per track (matches BIOS INT 13h drive geometry).
  • 0x01A (2 bytes): Number of read/write heads.
  • 0x01C (4 bytes): Hidden sectors preceding the partition (the LBA offset from the physical disk start to the logical volume).
  • 0x020 (4 bytes): Total sectors as a 32-bit integer (used if offset 0x013 is 0).
  • 0x024 (1 byte): Physical drive number (80h for the primary fixed disk, 00h for the first floppy drive).
  • 0x025 (1 byte): Reserved byte (often used by OS/2 or Windows NT for dirty bit flags, set to 00h by standard DOS format).
  • 0x026 (1 byte): Extended boot signature (29h), indicating the presence of the following three fields.
  • 0x027 (4 bytes): Volume Serial Number, generated dynamically by FORMAT using the system date and time algorithm.
  • 0x02B (11 bytes): Volume Label, space-padded ASCII text (or "NO NAME " if none was specified during format).
  • 0x036 (8 bytes): File system type string in ASCII (either "FAT12 " or "FAT16 "). This field is descriptive and not used by DOS to determine filesystem logic.

Bootstrap Loader Routine (Offsets 0x03E–0x1FD)

The execution code begins at offset 0x03E. When the system BIOS or Master Boot Record (MBR) transfers execution to 0000:7C00, this routine executes the following sequence:

  1. Environment Initialization: Disables interrupts (CLI), normalizes segment registers (DS, ES, SS), and sets up a local execution stack.
  2. Geometry Calculation: Reads the BPB fields into CPU registers to calculate the starting sector of the root directory and the data region: \[\text{RootDirStart} = \text{ReservedSectors} + (\text{NumberOfFATs} \times \text{SectorsPerFAT})\]
  3. Directory Scanning: Issues BIOS INT 13h disk read commands to load the root directory into memory. It parses directory entries searching explicitly for the first operating system file, IO.SYS.
  4. File Verification: Confirms that IO.SYS is the first file entry and that its clusters are contiguous. It also checks for the presence of MSDOS.SYS.
  5. Loading the Kernel: Reads the initial sectors of IO.SYS into memory at 0070:0000h.
  6. Transfer of Control: If successful, executes a far jump to the entry point of IO.SYS, passing drive parameters in hardware registers.
  7. Error Handling: If IO.SYS is absent or unreadable, the code prints the hardcoded error message: "Non-System disk or disk error" "Replace and strike any key when ready" It then invokes BIOS INT 16h to wait for a keystroke, followed by INT 19h to restart the bootstrap sequence.

Sector Signature (Offsets 0x1FE–0x1FF)

The final two bytes of the 512-byte sector contain the standard boot record signature:

  • 0x1FE: 0x55
  • 0x1FF: 0xAA

The BIOS and MBR inspect this little-endian word (0xAA55) before attempting execution. If this signature is missing, the BIOS marks the device as non-bootable.