# theprimeagen/apollo-11 architecture

> Architecture diagram of the GitHub repository theprimeagen/apollo-11, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theprimeagen/apollo-11
- Repository: https://github.com/theprimeagen/apollo-11

## Overview

#### Purpose and Scope
This is an archival source repository for the Apollo 11 Apollo Guidance Computer (AGC), preserving transcribed assembly listings rather than delivering a single executable application. It contains two independently assembled flight programs: Command Module Comanche 055 and Lunar Module Luminary 099. Compilation is delegated to the external Virtual AGC/yaYUL toolchain.

#### Primary Assembly Entry Points
Each AGC program is rooted at its `MAIN.agc` include/assembly entry, which composes named source decks into a complete fixed-memory program:
- `Comanche055/MAIN.agc`
- `Luminary099/MAIN.agc`
- `Comanche055/README.md`
- `Luminary099/README.md`

The two trees are architectural peers, not variants built from shared local libraries. Their separation reflects different spacecraft responsibilities and hardware interfaces.

#### Command Module Flight Software
Comanche provides Command and Service Module guidance, navigation, display, control, and reentry behavior. Its major execution/control substrate is the AGC executive, interrupts, restart machinery, and deferred work queue:
- `Comanche055/EXECUTIVE.agc`
- `Comanche055/INTERRUPT_LEAD_INS.agc`
- `Comanche055/WAITLIST.agc`

Mission operations flow from DSKY verb/noun input through program sequences and guidance/control routines. Representative program families cover targeting, maneuvers, powered flight, CSM autopilot, and entry:
- `Comanche055/P20-P25.agc`
- `Comanche055/P30-P37.agc`
- `Comanche055/CM_ENTRY_DIGITAL_AUTOPILOT.agc`

#### Lunar Module Flight Software
Luminary is the Lunar Module counterpart, with landing, ascent, radar, throttle, and LM attitude-control responsibilities. It uses the same broad AGC execution model but implements LM-specific guidance and actuators:
- `Luminary099/MAIN.agc`
- `Luminary099/THE_LUNAR_LANDING.agc`
- `Luminary099/ASCENT_GUIDANCE.agc`

The landing pipeline combines radar-related inputs, lunar guidance equations, throttle control, and vehicle-control routines:
- `Luminary099/RADAR_LEADIN_ROUTINES.agc`
- `Luminary099/LUNAR_LANDING_GUIDANCE_EQUATIONS.agc`
- `Luminary099/THROTTLE_CONTROL_ROUTINES.agc`

#### Shared AGC Functional Boundaries
Both program trees organize source by traditional AGC subsystems: erasable-memory assignments and constants; navigation state estimation and IMU processing; mission program sequences; DSKY display/input; telemetry; and hardware I/O. Key boundaries include:
- Memory/data definitions: `Comanche055/ERASABLE_ASSIGNMENTS.agc`, `Luminary099/FIXED_FIXED_CONSTANT_POOL.agc`
- Navigation and state updates: `Comanche055/MEASUREMENT_INCORPORATION.agc`, `Luminary099/KALMAN_FILTER.agc`
- Crew interface: `Comanche055/DISPLAY_INTERFACE_ROUTINES.agc`, `Luminary099/PINBALL_NOUN_TABLES.agc`
- External telemetry/radio interfaces: `Comanche055/DOWN-TELEMETRY_PROGRAM.agc`, `Luminary099/S-BAND_ANTENNA_FOR_LM.agc`

#### Supporting Experimental Programs
Several independent Go modules are terminal/graphics/simulation experiments around Apollo-themed interfaces; they are not part of assembling either historical AGC image. Their own executable entry points are separate:
- `exec-tui/main.go` with simulation/UI layers in `exec-tui/sim/engine.go` and `exec-tui/ui/ui.go`
- `dsky-lab/main.go` with `dsky-lab/dsky/dsky.go`
- `lander-lab/main.go` with `lander-lab/lander/lander.go`

These use Go module runtimes (`go.mod` per lab). The repository also has Lua/Markdown scenario artifacts, such as `alarm_recovery.lua`, but no internal production service, database, or deployment infrastructure.

#### External Dependencies and Governance
The authoritative external integration boundary is source assembly via Virtual AGC’s yaYUL assembler and comparison against MIT Museum/Virtual AGC source scans. GitHub workflows provide only repository maintenance automation:
- `.github/workflows/label.yml`
- `.github/workflows/markdownlint.yml`
- `CONTRIBUTING.md`

Translations under `Translations/` localize documentation only and do not alter program source or assembly behavior.

Main entry points: [`Luminary099/MAIN.agc`](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/MAIN.agc) (Luminary assembly root), [`Comanche055/P20-P25.agc`](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/P20-P25.agc) (Mission programs), [`Comanche055/EXECUTIVE.agc`](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/EXECUTIVE.agc) (Executive and deferred work), [`Comanche055/MAIN.agc`](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/MAIN.agc) (Comanche assembly root)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cm["Command Module — Comanche 055"]
  node_cm_main["Comanche assembly root<br/>AGC entry<br/>[MAIN.agc]"]
  node_cm_runtime["Executive and deferred work<br/>AGC runtime<br/>[EXECUTIVE.agc]"]
  node_cm_interrupts["Interrupt lead-ins<br/>interrupt handling"]
  node_cm_waitlist["Waitlist queue<br/>deferred work<br/>[WAITLIST.agc]"]
  node_cm_mission["Mission programs<br/>guidance sequences<br/>[P20-P25.agc]"]
  node_cm_entry["Entry digital autopilot<br/>reentry control"]
  node_cm_display["DSKY display interface<br/>crew I/O"]
  node_cm_navigation["Measurement incorporation<br/>navigation state"]
  node_cm_telemetry["Down telemetry<br/>telemetry I/O"]
end

subgraph group_lm["Lunar Module — Luminary 099"]
  node_lm_main["Luminary assembly root<br/>AGC entry<br/>[MAIN.agc]"]
  node_lm_landing["Lunar landing program<br/>landing guidance"]
  node_lm_radar["Radar lead-ins<br/>sensor I/O"]
  node_lm_equations["Landing guidance equations<br/>guidance computation"]
  node_lm_throttle["Throttle control<br/>actuator control"]
  node_lm_ascent["Ascent guidance"]
  node_lm_navigation["Kalman filter<br/>navigation state<br/>[KALMAN_FILTER.agc]"]
end

subgraph group_labs["Independent Go Labs"]
  node_exec_tui["Executive TUI experiment<br/>Go executable<br/>[main.go]"]
  node_dsky_lab["DSKY lab<br/>Go executable<br/>[main.go]"]
  node_lander_lab["Lander lab<br/>Go executable<br/>[main.go]"]
end

subgraph group_external["External Boundary"]
  node_yayul{{"Virtual AGC yaYUL<br/>external assembler"}}
  node_source_scans["Museum and Virtual AGC scans<br/>external reference"]
end

node_cm_main -->|"includes"| node_cm_runtime
node_cm_runtime -->|"dispatches"| node_cm_interrupts
node_cm_runtime -->|"schedules"| node_cm_waitlist
node_cm_waitlist -->|"runs deferred programs"| node_cm_mission
node_cm_display -->|"crew input selects"| node_cm_mission
node_cm_mission -->|"uses"| node_cm_navigation
node_cm_mission -->|"transitions to"| node_cm_entry
node_cm_navigation -->|"reports state"| node_cm_telemetry
node_lm_main -->|"includes"| node_lm_landing
node_lm_main -->|"includes"| node_lm_ascent
node_lm_landing -->|"consumes inputs"| node_lm_radar
node_lm_radar -->|"supplies measurements"| node_lm_equations
node_lm_navigation -->|"provides state"| node_lm_equations
node_lm_equations -->|"commands"| node_lm_throttle
node_cm_main -->|"assembled by"| node_yayul
node_lm_main -->|"assembled by"| node_yayul
node_source_scans -.->|"compared against"| node_cm_main
node_source_scans -.->|"compared against"| node_lm_main

click node_cm_main "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/MAIN.agc"
click node_cm_runtime "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/EXECUTIVE.agc"
click node_cm_interrupts "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/INTERRUPT_LEAD_INS.agc"
click node_cm_waitlist "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/WAITLIST.agc"
click node_cm_mission "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/P20-P25.agc"
click node_cm_entry "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/CM_ENTRY_DIGITAL_AUTOPILOT.agc"
click node_cm_display "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/DISPLAY_INTERFACE_ROUTINES.agc"
click node_cm_navigation "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/MEASUREMENT_INCORPORATION.agc"
click node_cm_telemetry "https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/DOWN-TELEMETRY_PROGRAM.agc"
click node_lm_main "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/MAIN.agc"
click node_lm_landing "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/THE_LUNAR_LANDING.agc"
click node_lm_radar "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/RADAR_LEADIN_ROUTINES.agc"
click node_lm_equations "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/LUNAR_LANDING_GUIDANCE_EQUATIONS.agc"
click node_lm_throttle "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/THROTTLE_CONTROL_ROUTINES.agc"
click node_lm_ascent "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/ASCENT_GUIDANCE.agc"
click node_lm_navigation "https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/KALMAN_FILTER.agc"
click node_exec_tui "https://github.com/theprimeagen/apollo-11/blob/master/exec-tui/main.go"
click node_dsky_lab "https://github.com/theprimeagen/apollo-11/blob/master/dsky-lab/main.go"
click node_lander_lab "https://github.com/theprimeagen/apollo-11/blob/master/lander-lab/main.go"

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_cm_main,node_cm_runtime,node_cm_interrupts,node_cm_waitlist,node_cm_mission,node_cm_entry,node_cm_display,node_cm_navigation,node_cm_telemetry toneBlue
class node_lm_main,node_lm_landing,node_lm_radar,node_lm_equations,node_lm_throttle,node_lm_ascent,node_lm_navigation toneAmber
class node_exec_tui,node_dsky_lab,node_lander_lab toneMint
class node_yayul,node_source_scans toneRose
```

## Components

### Command Module — Comanche 055

CSM flight-program source decks.

- [Comanche assembly root](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/MAIN.agc): AGC entry · Includes Comanche source decks into one fixed-memory program. · `Comanche055/MAIN.agc`
- [Executive and deferred work](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/EXECUTIVE.agc): AGC runtime · `Comanche055/EXECUTIVE.agc`
- [Interrupt lead-ins](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/INTERRUPT_LEAD_INS.agc): interrupt handling · `Comanche055/INTERRUPT_LEAD_INS.agc`
- [Waitlist queue](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/WAITLIST.agc): deferred work · `Comanche055/WAITLIST.agc`
- [Mission programs](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/P20-P25.agc): guidance sequences · Targeting, maneuver, and powered-flight program families. · `Comanche055/P20-P25.agc`
- [Entry digital autopilot](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/CM_ENTRY_DIGITAL_AUTOPILOT.agc): reentry control · `Comanche055/CM_ENTRY_DIGITAL_AUTOPILOT.agc`
- [DSKY display interface](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/DISPLAY_INTERFACE_ROUTINES.agc): crew I/O · `Comanche055/DISPLAY_INTERFACE_ROUTINES.agc`
- [Measurement incorporation](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/MEASUREMENT_INCORPORATION.agc): navigation state · `Comanche055/MEASUREMENT_INCORPORATION.agc`
- [Down telemetry](https://github.com/theprimeagen/apollo-11/blob/master/Comanche055/DOWN-TELEMETRY_PROGRAM.agc): telemetry I/O · `Comanche055/DOWN-TELEMETRY_PROGRAM.agc`

### Lunar Module — Luminary 099

LM flight-program source decks.

- [Luminary assembly root](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/MAIN.agc): AGC entry · Includes Luminary source decks into one fixed-memory program. · `Luminary099/MAIN.agc`
- [Lunar landing program](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/THE_LUNAR_LANDING.agc): landing guidance · `Luminary099/THE_LUNAR_LANDING.agc`
- [Radar lead-ins](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/RADAR_LEADIN_ROUTINES.agc): sensor I/O · `Luminary099/RADAR_LEADIN_ROUTINES.agc`
- [Landing guidance equations](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/LUNAR_LANDING_GUIDANCE_EQUATIONS.agc): guidance computation · `Luminary099/LUNAR_LANDING_GUIDANCE_EQUATIONS.agc`
- [Throttle control](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/THROTTLE_CONTROL_ROUTINES.agc): actuator control · `Luminary099/THROTTLE_CONTROL_ROUTINES.agc`
- [Ascent guidance](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/ASCENT_GUIDANCE.agc): ascent guidance · `Luminary099/ASCENT_GUIDANCE.agc`
- [Kalman filter](https://github.com/theprimeagen/apollo-11/blob/master/Luminary099/KALMAN_FILTER.agc): navigation state · `Luminary099/KALMAN_FILTER.agc`

### Independent Go Labs

Experimental executables outside AGC assembly.

- [Executive TUI experiment](https://github.com/theprimeagen/apollo-11/blob/master/exec-tui/main.go): Go executable · Terminal simulation and UI experiment. · `exec-tui/main.go`
- [DSKY lab](https://github.com/theprimeagen/apollo-11/blob/master/dsky-lab/main.go): Go executable · Standalone DSKY interface experiment. · `dsky-lab/main.go`
- [Lander lab](https://github.com/theprimeagen/apollo-11/blob/master/lander-lab/main.go): Go executable · Standalone lander simulation experiment. · `lander-lab/main.go`

### External Boundary

- **Virtual AGC yaYUL**: external assembler · Build tool for both historical AGC images.
- **Museum and Virtual AGC scans**: external reference · Authoritative comparison source.

## Connections

- Comanche assembly root → Executive and deferred work: includes
- Executive and deferred work → Interrupt lead-ins: dispatches
- Executive and deferred work → Waitlist queue: schedules
- Waitlist queue → Mission programs: runs deferred programs
- DSKY display interface → Mission programs: crew input selects
- Mission programs → Measurement incorporation: uses
- Mission programs → Entry digital autopilot: transitions to
- Measurement incorporation → Down telemetry: reports state
- Luminary assembly root → Lunar landing program: includes
- Luminary assembly root → Ascent guidance: includes
- Lunar landing program → Radar lead-ins: consumes inputs
- Radar lead-ins → Landing guidance equations: supplies measurements
- Kalman filter → Landing guidance equations: provides state
- Landing guidance equations → Throttle control: commands
- Comanche assembly root → Virtual AGC yaYUL: assembled by
- Luminary assembly root → Virtual AGC yaYUL: assembled by
- Museum and Virtual AGC scans → Comanche assembly root: compared against
- Museum and Virtual AGC scans → Luminary assembly root: compared against
