codeworking.org
Search
Developer Skill / Gist

Deep Dive into MS-DOS

The Foundation of the PC Revolution: Released in August 1981, MS-DOS (Microsoft Disk Operating System) defined the personal computing era for over two decades. Originating as QDOS (Quick and Dirty Operating System) by Tim Paterson, MS-DOS powered the revolutionary IBM Personal Computer (IBM PC 5150) and established Microsoft as the dominant force in global computing software.


1. The Origins of MS-DOS & The IBM PC Contract

In 1980, IBM was secretly developing Project Chess (the IBM PC) and urgently required an operating system for the Intel 8088 16-bit processor:

+-----------------------------------------------------------------------------------+
|                           THE GENESIS OF MS-DOS (1980–1981)                       |
+-----------------------------------------------------------------------------------+
  1. Seattle Computer Products (SCP):
     • Tim Paterson writes **QDOS / 86-DOS** (1980) as a 16-bit CP/M clone.

            v
  2. The Microsoft Acquisition:
     • Bill Gates & Paul Allen purchase non-exclusive rights to 86-DOS for $25,000,
       later buying exclusive ownership in July 1981 for $50,000.

            v
  3. The Historic IBM Deal:
     • Microsoft licenses the OS to IBM as **PC DOS 1.0**, while retaining non-exclusive
       rights to license **MS-DOS** to third-party PC clone manufacturers (Compaq, Dell).
+-----------------------------------------------------------------------------------+

2. System Architecture & Memory Model (16-Bit Real Mode)

MS-DOS operated entirely in Intel x86 16-bit Real Mode, where software had direct, unmediated access to physical memory without virtual memory protection or hardware privilege rings.

+-----------------------------------------------------------------------------------+
|                        MS-DOS 1 MB MEMORY ADDRESS SPACE LAYOUT                    |
+-----------------------------------------------------------------------------------+
  0xFFFFF (1024 KB) ┌─────────────────────────────────────────────────────────────┐
                    │ System ROM BIOS & Expansion ROMs (VGA BIOS, Network)        │
  0xC0000 (768 KB)  ├─────────────────────────────────────────────────────────────┤
                    │ Video Display Buffer RAM (CGA / EGA / VGA Text & Graphics)  │
  0xA0000 (640 KB)  ├─────────────────────────────────────────────────────────────┤ ◄── 640 KB Barrier
                    │ Transient Application Program Space (TPA)                   │
                    │ • User executables (.COM, .EXE) & TSR programs             │
                    ├─────────────────────────────────────────────────────────────┤
                    │ COMMAND.COM (Command Processor / Shell)                     │
                    ├─────────────────────────────────────────────────────────────┤
                    │ MSDOS.SYS (DOS Kernel & Filesystem Drivers)                 │
                    ├─────────────────────────────────────────────────────────────┤
                    │ IO.SYS (Hardware-dependent device drivers)                  │
  0x00400 (1 KB)    ├─────────────────────────────────────────────────────────────┤
                    │ BIOS Data Area (BDA)                                        │
  0x00000 (0 KB)    └─────────────────────────────────────────────────────────────┘
                    │ Interrupt Vector Table (IVT: 256 4-byte ISR addresses)      │
+-----------------------------------------------------------------------------------+

The 640 KB Conventional Memory Barrier

Because the Intel 8086 used a 20-bit address bus (2^{20} = 1 MB), IBM allocated the lower 640 KB (0x00000 to 0x9FFFF) for user software and the upper 384 KB for hardware video memory and BIOS ROMs. This created the infamous conventional memory ceiling that shaped PC gaming and software optimization for 15 years.


3. Core Operating System Components

MS-DOS consists of four fundamental subsystem files:

  1. IO.SYS (or IBMBIO.COM):
    • The hardware interface layer loaded by the Master Boot Record (MBR).
    • Initializes standard peripheral drivers: CON (Console), AUX (Serial), PRN (Printer), and CLOCK$.
  2. MSDOS.SYS (or IBMDOS.COM):
    • The core operating system kernel.
    • Manages the FAT filesystem, file handles, memory arena blocks, and process lifecycle.
    • Exposes the primary API via software interrupt INT 21h.
  3. COMMAND.COM:
    • The interactive command interpreter and shell.
    • Divided into a Resident portion (stays in memory) and a Transient portion (can be overwritten by large programs and reloaded from disk on exit).
  4. CONFIG.SYS & AUTOEXEC.BAT:
    • Boot-time configuration scripts loading device drivers (DEVICE=HIMEM.SYS) and shell environment variables (PATH, PROMPT).

4. Software Interrupts & The INT 21h API

Applications interacted with MS-DOS by loading a function number into the AH register and triggering the CPU software interrupt INT 21h:

; hello.asm (x86 16-bit MS-DOS .COM Program)
; Assemble with: nasm -f bin hello.asm -o HELLO.COM

org 100h                ; .COM executables load at offset 0x100

section .text
start:
    mov dx, msg         ; Load pointer to '$'-terminated string into DX
    mov ah, 09h         ; DOS Function 09h: Print String
    int 21h             ; Call DOS Kernel API

    mov ah, 4Ch         ; DOS Function 4Ch: Terminate Process with Exit Code
    mov al, 00h         ; Return Code 0
    int 21h             ; Return control to COMMAND.COM

section .data
    msg db 'Hello from MS-DOS 16-Bit Real Mode!$', 0Dh, 0Ah

5. TSR Programs (Terminate and Stay Resident)

Because MS-DOS was strictly single-tasking, developers invented TSR (Terminate and Stay Resident) utilities via INT 21h Function 31h.

A TSR program:

  1. Intercepts the hardware keyboard interrupt (INT 09h) or timer tick (INT 08h).
  2. Leaves its executable code resident in memory while returning prompt control to COMMAND.COM.
  3. Pops up instantly over active applications when a designated “hotkey” is pressed (used by early mouse drivers, audio drivers, and tools like Borland Sidekick).

6. Version Evolution & The Open-Source Milestone

Version Release Year Landmark Features
MS-DOS 1.0 1981 Initial release for IBM PC; single-sided 160 KB 5.25“ floppy disks; FAT12.
MS-DOS 2.0 1983 Hard drive support (10 MB IBM PC/XT); hierarchical directory trees (/ and \); installable device drivers.
MS-DOS 3.0 1984 1.2 MB high-density floppies; network sharing support; FAT16 introduced.
MS-DOS 4.0 1988 Hard disk partition sizes >32 MB; graphical DOS Shell (DOSSHELL).
MS-DOS 5.0 1991 High Memory Area (HMA) loading (DOS=HIGH,UMB); full-screen QBasic editor.
MS-DOS 6.22 1994 Peak standalone DOS release; DriveSpace disk compression; SCANDISK utility.
MS-DOS 7.x / 8.0 1995–2000 Embedded as the 16-bit bootstrap engine underneath Windows 95, 98, and ME (FAT32 support).

The GitHub Open-Source Milestone

In an extraordinary commitment to computer science historical preservation, Microsoft officially open-sourced the original assembly source code of MS-DOS v1.25, v2.0, and v4.0 on GitHub under the permissive MIT License:


7. Summary & Legacy

# 🕹️ Classic MS-DOS CLI Commands
DIR /W                  # List directory contents in wide format
CD \GAMES\DOOM          # Change working directory
COPY A:\FILE.TXT C:\    # Copy files across drive letters
MEM /C /P               # Display detailed conventional & upper memory usage
EDIT CONFIG.SYS         # Launch full-screen text editor

MS-DOS demonstrated how a lightweight, pragmatic 16-bit disk operating system could democratize personal computing worldwide—paving the path for the modern graphical operating systems that followed.

S

Computer Science educator, Software Engineer, Cloud Computing & Cloud Native Architect, and AI/ML Engineer. Founder & Owner of unus.one, softwork.ing, and codeworking.org.

Comments & Discussion