Windows 95b Boot Sector


Abstract

This is a continuation of Windows 95b MBR which discusses the PC boot sequence and the MBR from a PC running Windows 95 OSR2. This page concentrates on the boot sector from the same PC, including new parameters in the BPB for FAT32, and the use of interrupt 13 extensions by disassembly of the program code. For previous versions of the boot code, up to DOS 6.22, see Hale's HIW series listed in the On Line References section, especially the page How It Works: DOS Floppy Disk Boot Sector. Hale's HIW series contain additional information not presented here.

Table of Contents


Introduction

With the new System ID's mentioned in Windows 95b MBR and the introduction of FAT32 volumes, the boot sector has changed. The BIOS Parameter Block (BPB) in the boot sector has been altered and lengthened to accommodate new parameters. The reserved area, which formerly consisted of a single sector boot record, has been lengthened to allow for two copies of the boot record and a longer boot program. The boot program now uses Interrupt 13 extensions when available. OEM ID's found at the beginning of the BPB are also briefly discussed. For information on previous boot sectors or additional information see the references at the bottom of the page, especially Hale's HIW documents which contain information not repeated here as well as other related information. For more information on these additional boot sectors see the follow-up page Windows 98SE Boot Sector.

Disk Structure

This is a quick look at the FAT32 disk structure to help visualize some of the nomenclature. For additional information see the section FAT32 in Windows 98SE Boot Sector and Windows 98SE, FAT32 Example.

The first sector on the hard disk contains the MBR. The remaining sectors on this track are unused. Then follows the primary and extended partitions defined in the MBR partition table. The first sector of a primary partition is the boot sector while the first sector of an extended partition is a Partition Boot Record.

For DOS partitions, starting with the boot sector, there are the following areas:

Boot Sectors, FAT1, FAT2, Data files and subdirectories
where the Root Directory is now part of the data area and not a separate fixed area on the disk as shown in the Windows 95a Disk Structure for 16 bit FAT. The starting cluster number of the Root Directory is now contained in the BPB for FAT32.

Definitions

See PC Glossary for a list of definitions. Especially important is the use (or misuse) of MB and GB.

Go back to the Table of Contents.

Boot Record - Layout

Boot Record (bootable) - Hex view

OFFSET  0  1  2  3  4  5  6  7    8  9  A  B  C  D  E  F  0123456789ABCDEF
--------------------------------------------------------------------------
000000 EB 58 90 4D 53 57 49 4E - 34 2E 31 00 02 08 21 00  .X.MSWIN4.1...!.
000010 02 00 00 00 00 F8 00 00 - 3F 00 80 00 3F 00 00 00  ........?...?...
000020 41 99 40 00 1F 10 00 00 - 00 00 00 00 02 00 00 00  A.@.............
000030 01 00 06 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
000040 80 00 29 D5 0F 04 1F 4E - 4F 20 4E 41 4D 45 00 00  ..)....NO NAME..
000050 00 00 46 41 54 33 32 20 - 20 20 FA 33 C9 8E D1 BC  ..FAT32   .3....
000060 F8 7B 8E C1 BD 78 00 C5 - 76 00 1E 56 16 55 BF 22  .{...x..v..V.U."
000070 05 89 7E 00 89 4E 02 B1 - 0B FC F3 A4 8E D9 BD 00  ..~..N..........
000080 7C C6 45 FE 0F 8B 46 18 - 88 45 F9 38 4E 40 7D 25  |.E...F..E.8N@}%
000090 8B C1 99 BB 00 07 E8 97 - 00 72 1A 83 EB 3A 66 A1  .........r...:f.
0000A0 1C 7C 66 3B 07 8A 57 FC - 75 06 80 CA 02 88 56 02  .|f;..W.u.....V.
0000B0 80 C3 10 73 ED BF 02 00 - 83 7E 16 00 75 45 8B 46  ...s.....~..uE.F
0000C0 1C 8B 56 1E B9 03 00 49 - 40 75 01 42 BB 00 7E E8  ..V....I@u.B..~.
0000D0 5F 00 73 26 B0 F8 4F 74 - 1D 8B 46 32 33 D2 B9 03  _.s...Ot..F23...
0000E0 00 3B C8 77 1E 8B 76 0E - 3B CE 73 17 2B F1 03 46  .;.w..v.;.s.+..F
0000F0 1C 13 56 1E EB D1 73 0B - EB 27 83 7E 2A 00 77 03  ..V...s..'.~*.w.
000100 E9 FD 02 BE 7E 7D AC 98 - 03 F0 AC 84 C0 74 17 3C  ....~}.......t..
000110 FF 74 09 B4 0E BB 07 00 - CD 10 EB EE BE 81 7D EB  .t............}.
000120 E5 BE 7F 7D EB E0 98 CD - 16 5E 1F 66 8F 04 CD 19  ...}.....^.f....
000130 41 56 66 6A 00 52 50 06 - 53 6A 01 6A 10 8B F4 60  AVfj.RP.Sj.j...`
000140 80 7E 02 0E 75 04 B4 42 - EB 1D 91 92 33 D2 F7 76  .~..u..B....3..v
000150 18 91 F7 76 18 42 87 CA - F7 76 1A 8A F2 8A E8 C0  ...v.B...v......
000160 CC 02 0A CC B8 01 02 8A - 56 40 CD 13 61 8D 64 10  ........V@..a.d.
000170 5E 72 0A 40 75 01 42 03 - 5E 0B 49 75 B4 C3 03 18  ^r.@u.B.^.Iu....
000180 01 27 0D 0A 49 6E 76 61 - 6C 69 64 20 73 79 73 74  .'..Invalid syst
000190 65 6D 20 64 69 73 6B FF - 0D 0A 44 69 73 6B 20 49  em disk...Disk I
0001A0 2F 4F 20 65 72 72 6F 72 - FF 0D 0A 52 65 70 6C 61  /O error...Repla
0001B0 63 65 20 74 68 65 20 64 - 69 73 6B 2C 20 61 6E 64  ce the disk, and
0001C0 20 74 68 65 6E 20 70 72 - 65 73 73 20 61 6E 79 20   then press any
0001D0 6B 65 79 0D 0A 00 00 00 - 49 4F 20 20 20 20 20 20  key.....IO
0001E0 53 59 53 4D 53 44 4F 53 - 20 20 20 53 59 53 7E 01  SYSMSDOS   SYS~.
0001F0 00 57 49 4E 42 4F 4F 54 - 20 53 59 53 00 00 55 AA  .WINBOOT SYS..U.

Go back to the Table of Contents.


BIOS Parameter Block (BPB)

The BPB contains information about the physical parameters of the current volume. Some sources include the OEM ID as part of the BPB while most others do not. This document does not include the OEM ID in the BPB. The BPB in this document is for a FAT32 volume running Windows 95b (OSR2).

Overview of BPB differences between FAT16 and FAT32

For FAT32, the Extended BPB has been moved to make room for a longer BPB. See the Microsoft articles in On Line References at the end of this page for more details on these differences.

Comparison of FAT16 and FAT32 Boot sectors
FAT16FAT32Field Name
Byte OffsetField LengthByte OffsetField Length
0x003 bytes0x003 bytesJump Instruction
0x038 bytes0x038 bytesOEM ID
0x0B25 bytes0x0B53 bytesBPB
0x2426 bytes0x4026 bytesExtended BPB
0x3E448 bytes0x5A420 bytesBootstrap Code
0x01FE2 bytes0x01FE2 bytesEnd of Sector Marker

Go back to the Table of Contents.

OEM ID and corresponding OS's

The following is a partial list of OEM ID's and the corresponding DOS versions that were used to format the boot sector. The Windows OEM ID's were obtained from Chapter 1 - Disk Concepts and Troubleshooting and a brief mention is made in the Microsoft KB article Q100092 MS-DOS 6 and 6.2 Boot-Sector Identification Tag Is "MSDOS5.0". Obviously more than one source can produce the same OEM ID.

Examples of OEM ID's
OEM IDFormatted by
IBM 3.3Compaq DOS 3.31
MSDOS5.0MS-DOS later than 4
Windows 2000 (on FAT16 and FAT32 disks)
MSWIN4.0Windows 95
MSWIN4.1Windows 95 OSR2 or Windows 98
NTFS Windows 2000 (on NTFS disks)
IBM 20.0OS/2
4

Bios Parameter Block (BPB) Fields for FAT32 Volumes

In the following table, numbers are followed by a d for decimal or an h for hex, while those not followed by a d or an h refer to the bytes in the order they are stored in the BPB. Small Sectors is not used and Large Sectors contains the total number of sectors in the FAT32 volume. The first column labeled "Start of entry" refers to the start of the boot sector not the start of the BPB. The OEM ID field is not strictly part of the BPB but is included here for completeness. The sector numbers at offsets 30h and 32h are relative sector numbers with the first sector being 0. This is the DOS logical numbering scheme. In DOS, sectors numbers start with 0 being the first boot sector and then numbering the sectors in order from track to track in the same cylinder and then from cylinder to cylinder. For more information on the individual fields see the Microsoft document FAT32 File System Specification which is listed in On Line References below.

BPB and EBPB Fields for FAT32 Volumes
Hex Offset from
Start of Entry

Length

Value

Description
03h8 bytesMSWIN4.1OEM ID (Windows 95 OSR2 in this case)
0Bh2 bytes0002 = 0200h = 512d Number of bytes per sector
0Dh1 byte08h = 8d Number of sectors per cluster
0Eh2 bytes2100 = 0021h = 33d Number of sectors in reserved area
10h1 byte02Number of copies of FAT
11h2 bytes0000 = 0d Number of root directory entries (FAT12/FAT16 only)
13h2 bytes0000 = 0d Small Sectors
15h1 byteF8 DOS media descriptor - 0xF8 for hard disk
16h2 bytes0000 = 0d Number of sectors per FAT (FAT12/FAT16 only)
18h2 bytes3F00 = 003Fh = 63d Number of sectors per track
1Ah2 bytes8000 = 0080h = 128d Number of heads (sides)
1Ch4 bytes0000003Fh = 63d Number of hidden sectors
20h4 bytes00409941h = 4,233,537d Large Sectors if Small Sectors = 0
FAT32 BPB fields ONLY
24h4 bytes0000101Fh = 4127d Sectors per FAT (FAT32 only)
28h2 bytes0000h Extended Flags (FAT32 only)
2Ah2 bytes0000h File System Version (FAT32 only)
2Ch4 bytes00000002h = 2d Root Cluster Number (FAT32 only)
30h2 bytes0001h File System Information Sector Number (FAT32 only)
32h2 bytes0006h Backup Boot Sector (FAT32 only)
34h12 bytesall 0'sReserved (FAT32 only)
Extended BPB Fields for FAT32 Volumes
40h1 byte80hPhysical drive number
41h1 byte00h(Reserved)
42h1 byte29hSignature byte (29h)
43h4 bytesD50F041F = 1F040FD5h Volume serial number
47h11 bytesNO NAMEVolume label
52h8 bytesFAT32File System Type

For FAT32 volumes the following fields must be set to zero:

Go back to the Table of Contents.

Interrupt 13 Functions

For a list of Interrupt functions used in both the MBR and boot codes see the page Interrupt 13 Functions. For information on the Interrupt 13 extensions and hard drive sizes, see Interrupt 13 Extensions on the Windows 95b MBR page. For more information on these extensions, as well as other Interrupts, see the On Line References at the end of this page.

Go back to the Table of Contents.

Boot Record - Program

Overview of Boot Program

Note that the boot partition in this example has been formatted using FAT32.

The MBR code loads the boot sector into memory location 0000:7C00 and uses a RET instruction to transfer execution to the boot sector code.

  1. Save address of Diskette Parameter Table (DPT) pointed to by INT 1Eh.
  2. Change INT 1E so that it will point to the altered DPT at 0000:0522.
  3. Copy DPT to 0000:0522.
  4. Alter the copy of the Diskette Parameter Table.
  5. If fixed disk, read MBR and fetch System Indicator for current partition.
  6. Load next 2 boot sectors into memory location 0000:7E00 (ending at 0000:81FF)
  7. Continue execution at memory location 0000:8000 (see Disassembly of Additional Boot Code on Windows 98SE Boot Sector web page for continuation)

Disassembly of Boot Program

Numbers in parentheses are actual values from the MBR or BPB

The first 3 bytes of the boot sector are JMP and NOP instructions.

0000:7C00 EB58        JMP     7C5A            jmp over BPB to START
0000:7C02 90          NOP                     No Op instruction (do nothing)

The BPB (BIOS Parameter Block) is contained in Offsets 7C03 to 7C59
See structure and values above.

               START:                        START OF BOOT SECTOR PROGRAM

0000:7C5A FA          CLI                     clear interrupts (turn off)
0000:7C5B 33C9        XOR     CX,CX           set CX (Count Register) to zero
0000:7C5D 8ED1        MOV     SS,CX           set SS (Stack Segment) to zero
0000:7C5F BCF87B      MOV     SP,7BF8         set SP (Stack Ptr) to 7BF8
0000:7C62 8EC1        MOV     ES,CX           set ES (Extra Segment Register) to zero

The Interrupt Vector Table (IVT) occupies the first 1024 bytes of low memory and
contains 256 4-byte entries.  Each entry is an address to an Interrupt routine.
The INT 1E vector (Diskette Configuration pointer) is at 0000:0078 and contains
the address to the Diskette Parameter Table (DPT).  (78h/4 = 1Eh)

                      Copy the address that the INT 1E vector points to 
                         into the DS:SI registers.

0000:7C64 BD7800      MOV     BP,0078         set BP = address of INT 1E
0000:7C67 C57600      LDS     SI,[BP+00]      set DS:SI = address of DPT
0000:7C6A 1E          PUSH    DS              save DS:SI --
0000:7C6B 56          PUSH    SI                 original address of DPT
0000:7C6C 16          PUSH    SS              save SS:BP --
0000:7C6D 55          PUSH    BP                 address of INT 1E
0000:7C6E BF2205      MOV     DI,0522         ES:DI = new address of DPT at 0000:0522

                      Change INT 1E so that it points to the altered 
                         Diskette parameter table at 0000:0522.

0000:7C71 897E00      MOV     [BP+00],DI      change INT 1E offset to 0522
0000:7C74 894E02      MOV     [BP+02],CX      change INT 1E segment to 0000

                      Copy the diskette parameter table to 0000:0522.

0000:7C77 B10B        MOV     CL,0B           set CX (Count register) to 11d
0000:7C79 FC          CLD                     clear Direction Flag (set DF=0)
0000:7C7A F3          REPZ                    Copy the diskette parameter table (11 bytes)
0000:7C7B A4          MOVSB                      from DS:SI to ES:DI
0000:7C7C 8ED9        MOV     DS,CX           also set DS to 0
0000:7C7E BD007C      MOV     BP,7C00            and BP to 7C00

                      Alter some of the diskette parameter table data.

0000:7C81 C645FE0F    MOV     BYTE PTR [DI-02],0F     set Diskette settling time = 15ms
0000:7C85 8B4618      MOV     AX,[BP+18]              set AX=003F (63 sectors per track)
0000:7C88 8845F9      MOV     [DI-07],AL                 and save in new table

                      If booting from hard disk, load MBR and look for the active partition.

0000:7C8B 384E40      CMP     [BP+40],CL      check Physical drive number(80h)
0000:7C8E 7D25        JGE     7CB5               if floppy (< 80h), jmp to READ_BOOT1
0000:7C90 8BC1        MOV     AX,CX           set AX=CX=0
0000:7C92 99          CWD                     set DX,AX to point to MBR
0000:7C93 BB0007      MOV     BX,0700         set BX = 0700 (load MBR into 0700)
0000:7C96 E89700      CALL    7D30            CALL READ_MBR
0000:7C99 721A        JB      7CB5            if READ error, jmp to READ_BOOT1
0000:7C9B 83EB3A      SUB     BX,+3A          set BX to Starting sector in 1st entry of MBR
0000:7C9E 66A11C7C    MOV     EAX,DWord Ptr [7C1C]    set EAX = # hidden sectors from BPB

     BOOT_PARTITION:  If entry is the current partition, save System Indicator in DL.
                           "Starting Sector" in partition table should be the
                                same as number of hidden sectors from BPB.

0000:7CA2 663B07      CMP     EAX,DWord Ptr [BX]   if this is the current partition
0000:7CA5 8A57FC      MOV     DL,[BX-04]              then set DL = Sys Ind in MBR
0000:7CA8 7506        JNZ     7CB0                 else, jmp to NEXT_PARTITION
0000:7CAA 80CA02      OR      DL,02                if Sys Ind = 0C, convert to 0E
0000:7CAD 885602      MOV     [BP+02],DL           save in [BP+02] (overwrite NOP instr)

     NEXT_PARTITION:  Set pointer to next partition table entry.

0000:7CB0 80C310      ADD     BL,10           set BX to point to next entry in MBR
0000:7CB3 73ED        JNB     7CA2            if not beyond MBR, jmp to BOOT_PARTITION

     READ_BOOT1:      Initialize values for READ_LOOP.

0000:7CB5 BF0200      MOV     DI,0002                 allow 2 attempts to read boot sectors
0000:7CB8 837E1600    CMP     WORD PTR [BP+16],+00    is sectors per FAT16 = 0?
0000:7CBC 7545        JNZ     7D03                       if not, jmp to NOT_FAT32
0000:7CBE 8B461C      MOV     AX,[BP+1C]      else set DX:AX to
0000:7CC1 8B561E      MOV     DX,[BP+1E]      Number of hidden sectors
0000:7CC4 B90300      MOV     CX,0003         set CX = 3 (see next instruction)

     READ_BOOT2:

0000:7CC7 49          DEC     CX              decrement CX (# of sectors to read)
0000:7CC8 40          INC     AX              LBA address of next boot sector
0000:7CC9 7501        JNZ     7CCC            if carry out of AX
0000:7CCB 42          INC     DX                 then, increment DX
0000:7CCC BB007E      MOV     BX,7E00         set BX = 7E00 (next segment for code)
0000:7CCF E85F00      CALL    7D31            CALL READ_LOOP (read boot sectors)
0000:7CD2 7326        JNB     7CFA            if no READ error, jmp to DONE

                      If READ error on backup boot sector, quit via READ_ERROR.

0000:7CD4 B0F8        MOV     AL,F8           set AL = F8
0000:7CD6 4F          DEC     DI              only 2 READ attempts allowed
0000:7CD7 741D        JZ      7CF6            if second READ failed, jmp to READ_ERROR

                      Try reading backup boot sectors.

0000:7CD9 8B4632      MOV     AX,[BP+32]      AX = Backup Boot Sector (0006h)
0000:7CDC 33D2        XOR     DX,DX           reset DX to 0
0000:7CDE B90300      MOV     CX,0003         set CX = 3
0000:7CE1 3BC8        CMP     CX,AX           if CX > AX
0000:7CE3 771E        JA      7D03               then jmp to NOT_FAT32
0000:7CE5 8B760E      MOV     SI,[BP+0E]      SI = Num sectors in reserved area
0000:7CE8 3BCE        CMP     CX,SI           if CX >= SI
0000:7CEA 7317        JNB     7D03               then jmp to NOT_FAT32
0000:7CEC 2BF1        SUB     SI,CX           SI = SI - CX
0000:7CEE 03461C      ADD     AX,[BP+1C]      add number of hidden sectors
0000:7CF1 13561E      ADC     DX,[BP+1E]         to DX:AX
0000:7CF4 EBD1        JMP     7CC7            jmp to READ_BOOT2

     READ_ERROR:      Error reading extended boot sectors.

0000:7CF6 730B        JNB     7D03            if no READ error, jmp to NOT_FAT32
0000:7CF8 EB27        JMP     7D21               else jmp to IO_ERROR:

     DONE:            One last check then continue at next boot sector.

0000:7CFA 837E2A00    CMP     WORD PTR [BP+2A],+00    is File System Version > 0000h
0000:7CFE 7703        JA      7D03                       yes, jmp to NOT_FAT32
0000:7D00 E9FD02      JMP     8000                    else continue execution at 8000

     NOT_FAT32:       Not a valid FAT32 partition.

0000:7D03 BE7E7D      MOV     SI,7D7E         For message = "Invalid system disk"

     GET_MSG:         Compute message address (SI + [SI] + LODSB increments SI).

0000:7D06 AC          LODSB                   get message offset from [SI] and put in AL
0000:7D07 98          CBW                     extend sign bit in AL to AX
0000:7D08 03F0        ADD     SI,AX           add offset to SI (LODSB also increments SI)

     DISPLAY_MSG:     Display message loop (SI now points to message).

0000:7D0A AC          LODSB                   get char of message from [SI] and put in AL
0000:7D0B 84C0        TEST    AL,AL           is AL = 0?
0000:7D0D 7417        JZ      7D26               yes - jmp to ANY_KEY:
0000:7D0F 3CFF        CMP     AL,FF           is AL = FF?
0000:7D11 7409        JZ      7D1C               yes - jmp to ERROR_MSG:
0000:7D13 B40E        MOV     AH,0E           output 1 char of message
0000:7D15 BB0700      MOV     BX,0007            with screen attributes
0000:7D18 CD10        INT     10                 to the display
0000:7D1A EBEE        JMP     7D0A            jmp to DISPLAY_MSG (next char of message)

     ERROR_MSG:       For message "Replace the disk, and then press any key" (followed by 00h)

0000:7D1C BE817D      MOV     SI,7D81         [SI] = 27h  ([7D81h+27h+1]=[7DA9])
0000:7D1F EBE5        JMP     7D06            jmp to GET_MSG

     IO_ERROR:        For message "Disk I/O error" (followed by FFh)

0000:7D21 BE7F7D      MOV     SI,7D7F         [SI] = 18h  ([7D7Fh+18h+1]=[7D98])
0000:7D24 EBE0        JMP     7D06            jmp to GET_MSG

     ANY_KEY:         Wait for keyboard response and reboot.

0000:7D26 98          CBW                     extend sign bit in AL to AX = 0
0000:7D27 CD16        INT     16              read Keyboard input
0000:7D29 5E          POP     SI              restore SI
0000:7D2A 1F          POP     DS              restore DS
0000:7D2B 668F04      POP     DWord Ptr [SI]  restore 4 bytes into [SI]
0000:7D2E CD19        INT     19              Bootstrap Loader (load MBR)

     READ_MBR:        Set up for Int 13 READ of MBR (CALLed from 7C96).

0000:7D30 41          INC     CX              CX = # of sectors to read (= 1 for MBR)

     READ_LOOP:       Set up for INT 13h READ of boot sector (CALLed from 7CCF).
                         Set up the disk address packet pointed to by DS:SI
                            for INT 13h extension, function 42h, EXTENDED READ.

0000:7D31 56          PUSH    SI              save SI
0000:7D32 666A00      PUSH    00              starting absolute block number - High DWord
0000:7D35 52          PUSH    DX              starting absolute block number - next Word
0000:7D36 50          PUSH    AX              starting absolute block number - Low Word
0000:7D37 06          PUSH    ES              address of Transfer buffer (High Word)
0000:7D38 53          PUSH    BX              address of Transfer buffer (Low Word)
0000:7D39 6A01        PUSH    01              0001h blocks to transfer
0000:7D3B 6A10        PUSH    10              Size of packet = 10h, Reserved = 00h
0000:7D3D 8BF4        MOV     SI,SP           SI now points to disk address packet
0000:7D3F 60          PUSHA                   save AX, CX, DX, BX, SP, BP, SI, DI
0000:7D40 807E020E    CMP     BYTE PTR [BP+02],0E     if Sys Ind <> 0E, then
                                                      (0E = PRI DOS, 16-bit, 
                                                        requires Int 13 extensions)

0000:7D44 7504        JNZ     7D4A               jmp over next 2 instructions
0000:7D46 B442        MOV     AH,42           INT 13h Ext - EXTENDED READ function
0000:7D48 EB1D        JMP     7D67            jmp to READ_SECTOR:

                      Save AX in CX, put DX in AX and set DX to 0 for CHS computation.
                          DX = high Word for Starting Sector to read.
                          AX = low Word for Starting Sector to read.

0000:7D4A 91          XCHG    CX,AX           save AX into CX
0000:7D4B 92          XCHG    DX,AX           save DX into AX
0000:7D4C 33D2        XOR     DX,DX           set DX (Data Register) to zero

                      Compute number of tracks and store in DX:AX.
                          CX will contain number of sectors in CHS format.

0000:7D4E F77618      DIV     WORD PTR [BP+18]   DX:AX / Num sectors per track
0000:7D51 91          XCHG    CX,AX           store quotient in CX, restore original AX
0000:7D52 F77618      DIV     WORD PTR [BP+18]   DX:AX / Num sectors per track
0000:7D55 42          INC     DX                 this will be CHS number of sectors
0000:7D56 87CA        XCHG    CX,DX           restore first quotient into DX

                      Compute number of cylinders and set registers for CHS read.

0000:7D58 F7761A      DIV     WORD PTR [BP+1A]        DX:AX / Num heads (sides)
0000:7D5B 8AF2        MOV     DH,DL           set DH = head number
0000:7D5D 8AE8        MOV     CH,AL           set CH = low eight bits of cylinder number
0000:7D5F C0CC02      ROR     AH,02           put high two bits of cylinder number
0000:7D62 0ACC        OR      CL,AH              into bits 6-7 of CL register
0000:7D64 B80102      MOV     AX,0201         read 1 sector into memory using CHS

     READ_SECTOR:     Loads sector from disk into memory.

0000:7D67 8A5640      MOV     DL,[BP+40]      DL = drive # from BPB
0000:7D6A CD13        INT     13              read 1 sector into ES:BX
0000:7D6C 61          POPA                    restore DI, SI, BP, SP, BX, DX, CX, AX
0000:7D6D 8D6410      LEA     SP,[SI+10]      restore SP to TOS before "disk address packet"
0000:7D70 5E          POP     SI              restore SI
0000:7D71 720A        JB      7D7D            if READ error, Return from CALL via 0000:7D7D

                      Setup for next sector to read.
                           (DX,AX = low 2 words of starting sector address,  
                               ES:BX = Memory location of blocks read.)

0000:7D73 40          INC     AX              increment AX
0000:7D74 7501        JNZ     7D77            if no carry out of AX, skip next instruction
0000:7D76 42          INC     DX              increment DX if carry out of AX
0000:7D77 035E0B      ADD     BX,[BP+0B]      increase BX by one sector (512 bytes)
0000:7D7A 49          DEC     CX              if more sectors to read (CX > 0) then
0000:7D7B 75B4        JNZ     7D31               jmp to READ_LOOP
0000:7D7D C3          RET                     else return from CALL at 7C96 or 7CCF


Locations 7D7E through 7D81 contain offset values used in GET_MSG
0000:7D7E 03180127


        The remainder of the boot sector is the message area

0000:7D80       0D 0A 49 6E 76 61 - 6C 69 64 20 73 79 73 74  ....Invalid syst
0000:7D90 65 6D 20 64 69 73 6B FF - 0D 0A 44 69 73 6B 20 49  em disk...Disk I
0000:7DA0 2F 4F 20 65 72 72 6F 72 - FF 0D 0A 52 65 70 6C 61  /O error...Repla
0000:7DB0 63 65 20 74 68 65 20 64 - 69 73 6B 2C 20 61 6E 64  ce the disk, and
0000:7DC0 20 74 68 65 6E 20 70 72 - 65 73 73 20 61 6E 79 20   then press any
0000:7DD0 6B 65 79 0D 0A 00 00 00 - 49 4F 20 20 20 20 20 20  key.....IO
0000:7DE0 53 59 53 4D 53 44 4F 53 - 20 20 20 53 59 53 7E 01  SYSMSDOS   SYS~.
0000:7DF0 00 57 49 4E 42 4F 4F 54 - 20 53 59 53 00 00 55 AA  .WINBOOT SYS..U.

Final Step in Boot Process

The additional boot sectors were not examined but it is assumed that the code basically follows the Microsoft KB article Q174018, Description of the Windows 95 Startup Process even though that article is based on the original version of Windows 95 and not the OSR2 version. For more information on these boot sectors see the follow-up page Windows 98SE Boot Sector.

Go back to the Table of Contents.

On Line References

The Starman has some interesting material on his site at The Starman's Realm, including information on DEBUG, SEGMENT:OFFSET, Assembly, FDISK, as well as the MBR and Boot sectors and other interesting stuff. He is constantly adding more. There is now considerable overlap between his pages and mine though there is information on his pages not included here. See his Boot Records Revealed! for an index into his MBR and boot pages.

For comparison with an older version of the boot sector see:

The Microsoft article "Disk Sectors Critical to Startup" contains information on both the MBR and the boot sector including details on the BPB for both FAT16 and FAT32 volumes. This article is part of Chapter 32 "Disk Concepts and Troubleshooting" in the Microsoft Windows 2000 Professional Resource Kit. Thanks to the Starman and Fons Van Assche for keeping me updated on Microsoft's changing links. (updated 7/2/03)

Also see FAT Boot Sector by Alex Verstak for a more detailed description of the boot sector BPB fields for FAT32, FAT16, and FAT12 file systems.

For more information on Interrupt 13 extensions as well as other interrupts:

The disassembly code was checked using the Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual which is part of a three-volume set that describes the architecture and programming environment of all Intel Architecture processors and can be downloaded as a PDF file.

Other Intel documents can be found through Intel's Literature Center

Additional sources of information:

Go back to the Table of Contents.


MBR/Boot Index

Home Page

This page was created on 16 December 2000, last updated on 19 March 2010.