File: overview.md | Updated: 11/18/2025
A comprehensive look at bootOS architecture and design.
bootOS demonstrates that a complete operating system can fit in just 512 bytes while providing:
Location: Initially at 0x7C00, relocates to 0x7A00
The boot loader is responsible for:
Code: os.asm:214-248
The command processor provides an interactive shell:
Code: os.asm:326-465
Handles all disk operations:
Code: os.asm:510-565
Provides character and line-based I/O:
Code: os.asm:639-653
Six interrupt services for programs:
1. BIOS POST completes
2. BIOS reads sector 0, track 0, head 0
3. Loads 512 bytes to 0x7C00
4. Checks for signature 0x55AA
5. Jumps to 0x7C00
; Code at os.asm:178-200
xor ax,ax ; Zero all segments
mov ds,ax
mov es,ax
mov ss,ax
mov sp,stack ; Setup stack
cld ; Clear direction flag
mov si,boot ; Copy from 0x7C00
mov di,osbase ; To 0x7A00
mov cx,512
rep movsb ; Relocate bootOS
; Code at os.asm:194-200
mov si,int_0x20 ; Service table
mov di,0x0020*4 ; Int 0x20 vector
mov cl,6 ; 6 services
.load_vec:
movsw ; IP address
stosw ; CS address (0)
loop .load_vec
; Code at os.asm:214-248
restart:
; Initialize segments and stack
mov al,'$' ; Prompt
call input_line ; Get command
; Parse and execute
jmp restart ; Repeat
User Input → Line Buffer → Command Parser
↓
┌─────────────┴─────────────┐
↓ ↓
Built-in Command Try Execute File
↓ ↓
Execute & Return Load from Disk
↓ ↓
Jump to restart Jump to 0x7C00
↓
Program Runs
↓
INT 0x20 to exit
↓
Jump to restart
exec_from_disk (os.asm:250)Programs execute with:
; Program ends with:
int 0x20 ; Exit to bootOS
; This jumps to restart routine
; Returns to command prompt
| Address | Size | Purpose | |---------|------|---------| | 0x0000-0x03FF | 1KB | BIOS interrupt vectors | | 0x0400-0x04FF | 256B | BIOS data area | | 0x0500-0x76FF | ~29KB | Free/unused | | 0x7700-0x777F | 128B | Stack (grows down) | | 0x7780-0x77FF | 128B | Line input buffer | | 0x7800-0x79FF | 512B | Directory sector | | 0x7A00-0x7BFF | 512B | bootOS code | | 0x7C00-0x7DFF | 512B | Program execution | | 0x7E00+ | | Available |
The stack at 0x7700 is used for:
Stack grows downward, so corruption is possible if programs use memory below 0x7700.
bootOS installs its services in the IVT:
Address Interrupt Service
0x0080 INT 0x20 restart (Exit to OS)
0x0084 INT 0x21 input_key (Input with echo)
0x0088 INT 0x22 output_char (Character output)
0x008C INT 0x23 load_file (Load file)
0x0090 INT 0x24 save_file (Save file)
0x0094 INT 0x25 delete_file (Delete file)
Each entry contains:
Since CS is 0, the IP values point directly to code in the first 64KB.
Functions are designed to serve multiple purposes:
; Same routine used for read and write
disk:
; AH determines operation
; 0x02 = read, 0x03 = write
Clever register usage avoids unnecessary moves:
xor ax,ax ; Zero AX (2 bytes)
; vs
mov ax,0 ; (3 bytes)
Leveraging known states:
; After movsb, SI is already incremented
; No need for explicit inc si
Using BIOS instead of implementing:
Due to size constraints, error handling is minimal:
bootOS has no security features:
This is acceptable for a single-user, single-tasking educational OS.
While bootOS is complete, possible enhancements include:
However, all enhancements must fit in 512 bytes!