DOS - Design - Boot Sequence

Boot Sequence

  • The bootstrap loader on PC-compatible computers (MBR or boot sector) is located at track zero, the first sector on a disk. The ROM BIOS will load this sector into memory at address 0000h:7C00h, and typically check for a signature "55h AAh" at offset +1FEh. If the sector is not considered to be valid, the ROM BIOS will try the next physical disk in the row, otherwise it will jump to the load address with certain registers set up.
  • If the loaded boot sector happens to be a Master Boot Record (MBR), as found on partitioned media, it will relocate itself to 0000h:0600h in memory, otherwise this step is skipped. The MBR code will scan the partition table, which is located within this sector, for an active partition (modern MBRs check if bit 7 is set at offset +1BEh+10h*n, whereas old MBRs simply check for a value of 80h), and, if found, load the first sector of the corresponding partition, which holds the Volume Boot Record (VBR) of that volume, into memory at 0000h:7C00h in the similar fashion as it had been loaded by the ROM BIOS itself. The MBR will then pass execution to the loaded portion with certain registers set up.
  • The sector content loaded at 0000h:7C00h constitutes a VBR now. VBRs are operating system specific and cannot be exchanged between different DOS versions in general, as the exact behaviour differs between different DOS versions. In very old versions of DOS such as DOS 1.x, the VBR would load the whole IO.SYS/IBMBIO.COM file into memory at 0000h:0600h. For this to work, these sectors had to be stored in consecutive order on disk by SYS. In later issues, it would locate and store the contents of the first two entries in the root directory at 0000h:0500h and if they happen to reflect the correct boot files as recorded in the VBR, the VBR would load the first 3 consecutive sectors of the IO.SYS/IBMBIO.COM file into memory at 0070h:0000h. The VBR also has to take care to preserve the contents of the Disk Parameter Table (DPT). Finally, it passes control to the loaded portion by jumping to its entry point with certain registers set up (with considerable differences between different DOS versions).
  • In modern DOS versions, where the VBR has loaded only the first 3 sectors of the IO.SYS/IBMBIO.COM file into memory, the loaded portion contains another boot loader, which will then load the remainder of itself into memory, using the root directory information stored at 0000h:0500h. For most versions, the file contents still need to be stored in consecutive order on disk. In older versions of DOS, which were still loaded as a whole, this step is skipped.
  • The DOS system initialization code will initial its builtin device drivers and then load the DOS kernel, located in MSDOS.SYS on MS-DOS systems, into memory as well. In Windows 9x, the DOS system initialization code and builtin device drivers and the DOS kernel are combined into a single IO.SYS file while MSDOS.SYS is used as a text configuration file.
  • The CONFIG.SYS file is then read to parse configuration parameters. The SHELL variable specifies the location of the shell which defaults to COMMAND.COM.
  • The shell is loaded and executed.
  • The startup batch file AUTOEXEC.BAT is then run by the shell.

The DOS system files loaded by the boot sector must be contiguous and be the first two directory entries. As such, removing and adding this file is likely to render the media unbootable. It is, however, possible to replace the shell at will, a method that can be used to start the execution of dedicated applications faster. This limitation does not apply to any version of DR DOS, where the system files can be located anywhere in the root directory and do not need to be contiguous. Therefore, system files can be simply copied to a disk provided that the boot sector is DR DOS compatible already.

In PC DOS and DR DOS 5.0 and above, the DOS system files are named IBMBIO.COM instead of IO.SYS and IBMDOS.COM instead of MSDOS.SYS. Older versions of DR DOS used DRBIOS.SYS and DRBDOS.SYS instead.

Read more about this topic:  DOS, Design

Famous quotes containing the words boot and/or sequence:

    ... until the shopkeeper plants his boot in our eyes,
    and unties our bone and is finished with the case,
    and turns to the next customer, forgetting our face
    or how we knelt at the yellow bulb with sighs
    like moth wings for a short while in a small place.
    Anne Sexton (1928–1974)

    It isn’t that you subordinate your ideas to the force of the facts in autobiography but that you construct a sequence of stories to bind up the facts with a persuasive hypothesis that unravels your history’s meaning.
    Philip Roth (b. 1933)