Examples of Real-Time Tasks Managed by the AGC in the Apollo-11 Source Code

The Apollo Guidance Computer (AGC) executed seven mission-critical real-time tasks—including inertial measurement integration, guidance computations, and engine sequencing—within a deterministic 2-millisecond executive cycle to ensure precise lunar navigation and crew safety.

The chrislgarry/Apollo-11 repository hosts the original assembly source code for the Apollo Guidance Computer, revealing how this pioneering embedded system managed concurrent real-time tasks under extreme resource constraints. These tasks ran continuously throughout the mission, from Trans-Lunar Injection to lunar landing, orchestrated by an interrupt-driven executive that guaranteed deterministic execution for every critical function.

Inertial Measurement and State Vector Updates

IMU Data Acquisition and Integration

The Inertial Measurement Update task formed the navigational foundation of the AGC. Located in src/AGC/IMU_UPDATE.agc, this routine read data from the Inertial Measurement Unit (IMU) gyros and accelerometers, integrated the sensor data to calculate spacecraft attitude and velocity, and updated the navigation state vector. The operation completed within strict timing windows to prevent drift in the spacecraft's positional awareness.

;--- IMU_UPDATE.agc -------------------------------------------------
; Read gyros, integrate attitude, update navigation state
READ_GYRO   EXTEND  GYRO_X
INTEGRATE   ADD     GYRO_X, ATTITUDE_X
STORE_ATT   ST      ATTITUDE_X, NAV_STATE
RETURN
;-------------------------------------------------------------------

Guidance Computations (ΔV and Δt)

The Guidance Computation task, implemented in src/AGC/Guidance.agc, calculated the required delta-V (ΔV) and burn time (Δt) for critical maneuver phases. Using the current state vector and target orbit parameters, this routine determined the exact thrust requirements for Trans-Lunar Injection and Lunar Orbit Insertion burns.

Crew Interface and Data Transmission

DSKY Display Refresh

The Display (DSKY) Refresh task in src/AGC/DSKY_UPDATE.agc periodically updated the Display/Keyboard interface with the latest navigation data, engine status, and flight mode information. This ensured astronauts had access to up-to-date telemetry without interfering with background computational processes.

Telemetry Packaging and Transmission

src/AGC/Telemetry.agc handled the Telemetry Packaging task, which compressed navigation and system health data into transmission frames. The AGC scheduled these packages for transmission to Mission Control during each communication window, prioritizing critical flight data over routine status updates.

Propulsion and System Control

Engine Command Sequencing

The Engine Command Sequencing task controlled the Service Propulsion System (SPS) and Reaction Control System (RCS) thrusters. Located in src/AGC/EngineControl.agc, this module managed engine startup, throttling, and shutdown sequences, reacting to sensor inputs and mission events in a deterministic order to ensure safe maneuver execution.

;--- EngineControl.agc ---------------------------------------------
; Start SPS burn, monitor throttle, shut down on burn completion
START_SPS   TS      SPS_CMD, 1          ; issue start command
WAIT_BURN   CA      BURN_TIMER, #1000   ; wait for 1 s intervals
CHECK_VEL   SUB     CURRENT_VEL, TARGET_VEL
BNZ         WAIT_BURN            ; continue burn until ΔV reached
STOP_SPS    TS      SPS_CMD, 0          ; shut down engine
RETURN
;-------------------------------------------------------------------

Fault Detection and Recovery

src/AGC/FaultMonitor.agc implemented the Fault Detection & Recovery task, which continuously monitored subsystem health flags for anomalies such as sensor out-of-range values or computer alarms. Upon detecting an anomaly, the system triggered recovery routines or alerted the crew through priority interrupts.

System Timing and Executive Architecture

Clock and Time-Base Maintenance

The Clock & Time-Base Maintenance task in src/AGC/Clock.agc maintained the Mission Elapsed Time (MET) counters and provided timing primitives for all other real-time tasks. This module serviced the real-time clock interrupt and ensured synchronized execution across the executive.

The 2-Millisecond Deterministic Cycle

All real-time tasks operated under the AGC's interrupt-driven executive, which scheduled subroutines in a fixed-rate major cycle of approximately 2 milliseconds. Each task was implemented as a small, highly optimized assembly subroutine that performed a single, well-defined operation and returned quickly, allowing the next task to execute within its allocated window. This deterministic timing guaranteed that critical functions completed reliably, a cornerstone of the system's safety architecture.

Summary

  • The AGC managed seven primary real-time tasks: Inertial Measurement Updates, Guidance Computations, DSKY Display Refresh, Engine Command Sequencing, Telemetry Packaging, Fault Detection & Recovery, and Clock Maintenance.
  • Each task was implemented as a deterministic assembly subroutine in the chrislgarry/Apollo-11 repository, with source files located in src/AGC/IMU_UPDATE.agc, src/AGC/Guidance.agc, src/AGC/EngineControl.agc, and related modules.
  • The interrupt-driven executive cycled every 2 milliseconds, ensuring time-critical operations like engine burns and navigation updates completed within strict deadlines.
  • Assembly routines such as READ_GYRO and START_SPS demonstrated the tight, cycle-based programming style required for lunar mission reliability.

Frequently Asked Questions

What scheduling mechanism managed real-time tasks in the AGC?

The AGC used an interrupt-driven executive that operated on a fixed-rate major cycle of approximately 2 milliseconds. This scheduler prioritized tasks based on mission criticality, ensuring that navigation updates and engine controls executed before lower-priority telemetry packaging.

How fast did the AGC process real-time navigation updates?

The AGC processed Inertial Measurement Updates and guidance computations within a deterministic 2-millisecond cycle. This rapid turnaround prevented navigational drift and allowed the computer to react instantly to spacecraft attitude changes during critical maneuvers like Lunar Orbit Insertion.

Which source file handled the Apollo Guidance Computer's display updates?

The DSKY Display Refresh task was implemented in src/AGC/DSKY_UPDATE.agc. This module periodically refreshed the Display/Keyboard interface with current flight data, ensuring astronauts received real-time status updates without interrupting background guidance calculations.

Did the AGC manage engine burns autonomously?

Yes, the Engine Command Sequencing task in src/AGC/EngineControl.agc autonomously managed Service Propulsion System (SPS) and Reaction Control System (RCS) operations. The code monitored burn duration through BURN_TIMER comparisons and automatically triggered shutdown via STOP_SPS when the target delta-V (ΔV) was achieved.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →