Tag Archives: ms-dos

MSDOS Booting on a snow day

Anyway, big snow day in southeastern Virginia, so to kill time I was looking around at source on the internet. I had played around with the MSDOS start sequence before, but never looked closely.

The typical start, considering a start from hard drive, is MBR load to 0x7C00, relocate to 0x0600, and the active partition boot sector is loaded at 0x7C00. The boot sector loads either io.sys or ibmbios.com based on the OS flavor at 0x0700. What I had learned some time ago, io.sys or ibmbios.com is about 40K bytes in size. This means the load would overwrite the current boot sector which is currently executing. Being bored, I found the MSDOS 3.3 OAK disks which have a makefile for the bios containing:

copy /b msload.com+msbio.bin io.sys

So, io.sys is the bios file with msload.com grafted to the front end. A closer look at msload seems that it is a small loader. Here is the sequence:

  • Boot sector loads at 0x7C00.
  • Boot sector loads the first few sectors of io.sys which is really msload to 0x0700.
  • The msload module relocates higher in memory with all the needed BPB information.
  • The module then loads the bios portion of io.sys to 0x0700 which overwrites both the original boot sector and the first loaded msload.
  • The msload code jumps into the bios and off we go …

That is a brief sequence that I can figure out, so it is overly simple. I wondered why it was done this way. I looked at the GitHub MSDOS v2.0 source and there was no msload source included. Possibility the older versions of the MSDOS bios file was smaller and did not overwrite the boot sector? Then around V3 it became too large, and this was the work around. Hey, it cannot be discounted that systems back then measured memory in megabytes.

Well, that killed some time on a cold day.