A DOS, read from the inside

LainDOS.

A tiny single-tasking DOS for x86 real modereal modeThe original 8086-compatible CPU mode where addresses are segment:offset and there is no memory protection., written from scratch in NASMNASMNetwide Assembler, the assembler used for LainDOS boot, kernel, shell, and focused test programs. — small enough to read end to end, complete enough to boot The Secret of Monkey Island.

These docs walk the source the way the machine runs it. Start with the boot path — the whole journey from power-on to a running game — then branch into the subsystems.

How to read this

The machine

Low memory seg:0
FFFF
Relocated kernel (HMA)
HMA_SEG:0010 — stack top at FFF0h, A20 kept on
A000
VGA graphics memory
MEM_TOP — mode 13h framebuffer
0B00
Program + environment arena
MCB_START — where games live
08C0
Subdirectory cache
SUBDIR_CACHE_BUF
06C0
CD file cache buffers
CD_CACHE_BUF
06A0
Write cache buffer
WRITE_CACHE_BUF
02A0
Root directory buffer
ROOT_SEG
0220
Read cache buffer
READ_CACHE_BUF
0200
Sector buffer
SEC_BUF
0180
CD-ROM sector buffer
CD_BUF
0060
FAT scratch buffer
FAT_SEG
0040
BIOS Data Area
tick count, equipment word
0000
Interrupt Vector Table
256 far pointers