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
A000
VGA graphics memory
MEM_TOP — mode 13h framebuffer
1000
Program + environment arena
MCB_START — where games live
0B40
Root directory buffer
ROOT_SEG
0B20
Read cache buffer
READ_CACHE_BUF
0B00
Sector buffer
SEC_BUF
0340
Relocated kernel
RELOC_SEG — stack top at 0FC00h
0060
FAT scratch buffer
FAT_SEG
0040
BIOS Data Area
tick count, equipment word
0000
Interrupt Vector Table
256 far pointers