# frost-rvl/system-programming-guide architecture

> Architecture diagram of the GitHub repository frost-rvl/system-programming-guide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frost-rvl/system-programming-guide
- Repository: https://github.com/frost-rvl/system-programming-guide

## Overview

This repository is a system-programming learning journey, organized as a roadmap with two practical projects: an LC-3 virtual machine and a small operating system. The LC-3 workflow loads object images, fetches and executes instructions, and delegates memory, flags, traps, and input handling to helpers. The OS project boots a kernel with serial/VGA output and a small C runtime. Source excerpts show LC-3 call sites and the OS output path; other OS connections are limited to references in the source index.

Main entry points: [`projects/01_virtual_lc3/src/main.c`](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/main.c) (Instruction runner), [`projects/02_little_os/src/lib/stdio.c`](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/stdio.c) (Formatted output), [`projects/02_little_os/src/kernel/kmain.c`](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/kernel/kmain.c) (Kernel entry), [`projects/01_virtual_lc3/src/memory.c`](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/memory.c) (Memory access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_roadmap["Learning roadmap"]
  node_foundations["Building foundations"]
  node_core_topics["Core system topics"]
  node_advanced_topics["Advanced topics"]
end

subgraph group_lc3["LC-3 virtual machine"]
  node_lc3_runner["Instruction runner<br/>[main.c]"]
  node_lc3_memory["Memory access<br/>[memory.c]"]
  node_lc3_registers["Registers<br/>[registers.c]"]
  node_lc3_flags["Condition flags<br/>[flags.c]"]
  node_lc3_traps["Trap services<br/>[traps.c]"]
  node_lc3_utils["Image and input<br/>[utils.c]"]
end

subgraph group_os["Little OS"]
  node_os_boot["Boot loader<br/>[loader.s]"]
  node_os_kernel["Kernel entry<br/>[kmain.c]"]
  node_os_stdio["Formatted output<br/>[stdio.c]"]
  node_os_log["Logging<br/>[log.c]"]
  node_os_string["String helpers<br/>[string.c]"]
  node_os_math["Math helpers<br/>[math.c]"]
  node_os_serial["Serial driver<br/>[serial.c]"]
  node_os_vga["VGA driver<br/>[vga.c]"]
  node_os_io["Port I/O<br/>[io.s]"]
end

node_learner(("Learner"))
node_lc3_user(("VM user"))

node_learner -->|"follows roadmap"| node_foundations
node_learner -->|"follows roadmap"| node_core_topics
node_learner -->|"follows roadmap"| node_advanced_topics
node_lc3_user -->|"runs images"| node_lc3_runner
node_lc3_runner -->|"reads and writes"| node_lc3_memory
node_lc3_runner -->|"updates flags"| node_lc3_flags
node_lc3_runner -->|"dispatches traps"| node_lc3_traps
node_lc3_runner -->|"loads images"| node_lc3_utils
node_lc3_memory -->|"uses registers"| node_lc3_registers
node_lc3_flags -->|"updates register state"| node_lc3_registers
node_lc3_traps -->|"accesses memory"| node_lc3_memory
node_lc3_traps -->|"uses registers"| node_lc3_registers
node_lc3_utils -->|"loads image data"| node_lc3_memory
node_os_boot -.->|"starts kernel"| node_os_kernel
node_os_kernel -->|"initializes serial"| node_os_serial
node_os_kernel -->|"logs messages"| node_os_log
node_os_kernel -->|"prints output"| node_os_stdio
node_os_log -->|"formats output"| node_os_stdio
node_os_stdio -->|"writes serial"| node_os_serial
node_os_stdio -->|"writes display"| node_os_vga
node_os_stdio -->|"measures strings"| node_os_string
node_os_serial -->|"uses port I/O"| node_os_io
node_os_vga -->|"uses port I/O"| node_os_io
node_os_vga -->|"uses math helpers"| node_os_math

click node_foundations "https://github.com/frost-rvl/system-programming-guide/blob/main/docs/01_building_foundations.md"
click node_core_topics "https://github.com/frost-rvl/system-programming-guide/blob/main/docs/02_core_system_programming.md"
click node_advanced_topics "https://github.com/frost-rvl/system-programming-guide/blob/main/docs/03_advanced_topics.md"
click node_lc3_runner "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/main.c"
click node_lc3_memory "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/memory.c"
click node_lc3_registers "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/registers.c"
click node_lc3_flags "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/flags.c"
click node_lc3_traps "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/traps.c"
click node_lc3_utils "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/utils.c"
click node_os_boot "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/boot/loader.s"
click node_os_kernel "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/kernel/kmain.c"
click node_os_stdio "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/stdio.c"
click node_os_log "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/log.c"
click node_os_string "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/string.c"
click node_os_math "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/math.c"
click node_os_serial "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/drivers/serial/serial.c"
click node_os_vga "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/drivers/vga/vga.c"
click node_os_io "https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/io/io.s"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_foundations,node_core_topics,node_advanced_topics,node_lc3_user toneBlue
class node_lc3_runner,node_lc3_memory,node_lc3_registers,node_lc3_flags,node_lc3_traps,node_lc3_utils toneAmber
class node_os_boot,node_os_kernel,node_os_stdio,node_os_log,node_os_string,node_os_math,node_os_serial,node_os_vga,node_os_io toneMint
class node_learner toneIndigo
```

## Components

### Learning roadmap

- [Building foundations](https://github.com/frost-rvl/system-programming-guide/blob/main/docs/01_building_foundations.md): `docs/01_building_foundations.md`
- [Core system topics](https://github.com/frost-rvl/system-programming-guide/blob/main/docs/02_core_system_programming.md): `docs/02_core_system_programming.md`
- [Advanced topics](https://github.com/frost-rvl/system-programming-guide/blob/main/docs/03_advanced_topics.md): `docs/03_advanced_topics.md`

### LC-3 virtual machine

- [Instruction runner](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/main.c): `projects/01_virtual_lc3/src/main.c`
- [Memory access](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/memory.c): `projects/01_virtual_lc3/src/memory.c`
- [Registers](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/registers.c): `projects/01_virtual_lc3/src/registers.c`
- [Condition flags](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/flags.c): `projects/01_virtual_lc3/src/flags.c`
- [Trap services](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/traps.c): `projects/01_virtual_lc3/src/traps.c`
- [Image and input](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/01_virtual_lc3/src/utils.c): `projects/01_virtual_lc3/src/utils.c`

### Little OS

- [Boot loader](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/boot/loader.s): `projects/02_little_os/src/boot/loader.s`
- [Kernel entry](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/kernel/kmain.c): `projects/02_little_os/src/kernel/kmain.c`
- [Formatted output](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/stdio.c): `projects/02_little_os/src/lib/stdio.c`
- [Logging](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/log.c): `projects/02_little_os/src/lib/log.c`
- [String helpers](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/string.c): `projects/02_little_os/src/lib/string.c`
- [Math helpers](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/lib/math.c): `projects/02_little_os/src/lib/math.c`
- [Serial driver](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/drivers/serial/serial.c): `projects/02_little_os/src/drivers/serial/serial.c`
- [VGA driver](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/drivers/vga/vga.c): `projects/02_little_os/src/drivers/vga/vga.c`
- [Port I/O](https://github.com/frost-rvl/system-programming-guide/blob/main/projects/02_little_os/src/io/io.s): `projects/02_little_os/src/io/io.s`

### Other components

- **Learner**
- **VM user**

## Connections

- Learner → Building foundations: follows roadmap (evidence: `README.md`)
- Learner → Core system topics: follows roadmap (evidence: `README.md`)
- Learner → Advanced topics: follows roadmap (evidence: `README.md`)
- VM user → Instruction runner: runs images (evidence: `projects/01_virtual_lc3/src/main.c`)
- Instruction runner → Memory access: reads and writes (evidence: `projects/01_virtual_lc3/src/main.c`)
- Instruction runner → Condition flags: updates flags (evidence: `projects/01_virtual_lc3/src/main.c`)
- Instruction runner → Trap services: dispatches traps (evidence: `projects/01_virtual_lc3/src/main.c`)
- Instruction runner → Image and input: loads images (evidence: `projects/01_virtual_lc3/src/main.c`)
- Memory access → Registers: uses registers (evidence: `projects/01_virtual_lc3/src/memory.c`)
- Condition flags → Registers: updates register state (evidence: `projects/01_virtual_lc3/src/flags.c`)
- Trap services → Memory access: accesses memory (evidence: `projects/01_virtual_lc3/src/traps.c`)
- Trap services → Registers: uses registers (evidence: `projects/01_virtual_lc3/src/traps.c`)
- Image and input → Memory access: loads image data (evidence: `projects/01_virtual_lc3/src/utils.c`)
- Boot loader → Kernel entry: starts kernel
- Kernel entry → Serial driver: initializes serial (evidence: `projects/02_little_os/src/kernel/kmain.c`)
- Kernel entry → Logging: logs messages (evidence: `projects/02_little_os/src/kernel/kmain.c`)
- Kernel entry → Formatted output: prints output (evidence: `projects/02_little_os/src/kernel/kmain.c`)
- Logging → Formatted output: formats output (evidence: `projects/02_little_os/src/lib/log.c`)
- Formatted output → Serial driver: writes serial (evidence: `projects/02_little_os/src/lib/stdio.c`)
- Formatted output → VGA driver: writes display (evidence: `projects/02_little_os/src/lib/stdio.c`)
- Formatted output → String helpers: measures strings (evidence: `projects/02_little_os/src/lib/stdio.c`)
- Serial driver → Port I/O: uses port I/O (evidence: `projects/02_little_os/src/drivers/serial/serial.c`)
- VGA driver → Port I/O: uses port I/O (evidence: `projects/02_little_os/src/drivers/vga/vga.c`)
- VGA driver → Math helpers: uses math helpers (evidence: `projects/02_little_os/src/drivers/vga/vga.c`)
