šŸ“„ nanochess/bootOS/architecture/README

File: README.md | Updated: 11/18/2025

Architecture

Technical documentation for bootOS internals.

Overview

bootOS is a monolithic operating system that fits entirely within a 512-byte boot sector. Despite its tiny size, it provides:

  • Complete filesystem with 32-file capacity
  • Program execution environment
  • Keyboard and screen I/O services
  • File management (load, save, delete)
  • Self-relocation and memory management

Architecture Documents

System Overview

High-level architecture and design principles of bootOS.

Topics covered:

  • Design philosophy
  • System components
  • Boot process
  • Execution model

Memory Layout

Detailed memory organization and address mapping.

Topics covered:

  • Memory regions
  • Stack and buffers
  • Code relocation
  • Address constraints

Filesystem Design

How bootOS organizes and manages files on disk.

Topics covered:

  • Disk layout
  • Directory structure
  • File allocation
  • Sector mapping

Key Specifications

| Feature | Specification | |---------|--------------| | Code Size | 512 bytes (including boot signature) | | Minimum CPU | 8086/8088 | | Memory Required | 1.5 KB (768 bytes + 512 bytes OS + 256 bytes buffer) | | Max Files | 32 files | | File Size | 512 bytes per file | | Disk Support | 360K to 1.44M floppies | | Load Address | 0x7C00 (BIOS standard) | | Runtime Address | 0x7A00 (relocated) |

Design Constraints

Size Limitations

With only 512 bytes available:

  • Boot signature uses 2 bytes (0x55, 0xAA)
  • Padding to fill sector uses variable space
  • Actual code limited to ~510 bytes

Compatibility Requirements

  • 8086/8088 instruction set only
  • BIOS interrupt compatibility
  • Standard boot sector format
  • Floppy disk geometry constraints

System Components

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│         BIOS (0x0000-0x03FF)        │  ← Interrupt vectors
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│          Free Memory                │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  Stack (0x7700) ↓                   │  ← Grows down
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  Line Buffer (0x7780)               │  ← 128 bytes
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  Directory Sector (0x7800)          │  ← 512 bytes
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  bootOS Code (0x7A00)               │  ← 512 bytes
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  Program Execution (0x7C00)         │  ← 512 bytes
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Execution Flow

  1. BIOS loads boot sector at 0x7C00
  2. bootOS relocates itself to 0x7A00
  3. Interrupt vectors installed at 0x0080-0x0094
  4. System initializes and shows prompt
  5. Command loop waits for user input
  6. Programs execute at 0x7C00
  7. Services available via interrupts 0x20-0x25

Technical Innovations

Code Reuse

  • Shared routines minimize duplication
  • Interrupt-based services
  • Clever register usage

Memory Efficiency

  • Self-relocation frees boot sector space
  • Stack and buffers carefully positioned
  • No wasted memory regions

Size Optimization

  • Compact instruction sequences
  • BIOS leveraging for I/O
  • Minimal error handling

Further Reading