# Apollo 11 Command Module Source Code: Where to Find It in the chrislgarry/Apollo-11 Repository

> Explore the Apollo 11 Command Module source code within the chrislgarry/Apollo-11 repository. Discover the Comanche055 directory and the MAIN.agc file for the complete software.

- Repository: [Chris Garry/Apollo-11](https://github.com/chrislgarry/Apollo-11)
- Tags: how-to-guide
- Published: 2026-03-04

---

**The complete Apollo 11 Command Module source code resides in the `Comanche055` directory of the chrislgarry/Apollo-11 repository, consisting of modular `.agc` files assembled via the `MAIN.agc` include file.**

The Apollo 11 Command Module (CM) software, historically designated as **Comanche 55**, represents the flight software that guided astronauts to the Moon and back. Originally developed by the MIT Instrumentation Laboratory, this codebase has been digitized and preserved in the open-source Apollo-11 repository. Understanding the repository structure allows developers and historians to navigate the assembly language modules that controlled navigation, guidance, and re-entry.

## Locating the CM Source Code in the Repository

The Command Module software is distinct from the Lunar Module software within the repository. While both spacecraft used the Apollo Guidance Computer (AGC), they ran different program versions stored in separate directories.

### The Comanche055 Directory Structure

All **Apollo 11 Command Module source code** files live inside the `Comanche055/` directory at the root of the repository. This directory preserves the historical structure used by MIT in 1969, organizing the AGC program into dozens of **`.agc`** files. Each file represents a logical sub-module—such as navigation routines, digital autopilot logic, or display drivers—that were originally stored on separate punch-card decks.

The modular layout follows functional groups including:

- **COMERASE** – Eraseable memory initialization
- **COMAID** – Abort and inertial data routines  
- **COMEKISS** – Command Module-specific guidance and re-entry logic
- **CHIEFTAN** – Kalman filter and navigation
- **TVCDAPS** – Thrust vector control
- **MISCELLANEOUS** – Utility routines and constants

### The MAIN.agc Assembly File

The file `Comanche055/MAIN.agc` serves as the master include list for the entire program. Because the original developers used no linker, they simulated modularity by concatenating files in a specific order through textual inclusion.

```agc
$CONTRACT_AND_APPROVALS.agc            # p. 1

$ASSEMBLY_AND_OPERATION_INFORMATION.agc # pp. 2-26

...
$CM_ENTRY_DIGITAL_AUTOPILOT.agc        # pp. 1063-1092

$DOWN-TELEMETRY_PROGRAM.agc            # pp. 1093-1102

...

```

The `MAIN.agc` file simply lists every component file prefixed with `$`, instructing the **yaYUL** assembler (a modern recreation of the original YUL/GAP assemblers) to process them sequentially into a single executable.

## Key Components of the Command Module Software

Within the `Comanche055` directory, certain files implement logic that exists only in the Command Module, distinguishing it from the Lunar Module codebase.

### CM-Specific Modules (COMEKISS Group)

Files prefixed with **`CM_`** contain routines exclusive to the Command Module's flight phases, particularly atmospheric entry and body attitude control. These reside primarily in the **COMEKISS** functional group:

- **`CM_ENTRY_DIGITAL_AUTOPILOT.agc`** – Implements the digital autopilot for re-entry, managing the spacecraft's roll modulation and lift vector during atmospheric descent (pages 1063-1092 in original documentation).
- **`CM_BODY_ATTITUDE.agc`** – Calculates spacecraft body-attitude angles specifically for the Command Module's orientation requirements.

These modules interface with the Entry Monitor System and handle the unique guidance constraints of returning from lunar distance, including skip-entry trajectories and heat shield positioning.

### Modular Functional Groups

The remaining `.agc` files partition the system architecture into manageable sub-programs:

- **CONTRACT_AND_APPROVALS.agc** – The first file in the build, containing NASA-mandated mission approvals and contracting information.
- **REENTRY_CONTROL.agc** – High-level re-entry guidance algorithms.
- **IMU_COMPENSATION_PACKAGE.agc** – Inertial Measurement Unit drift compensation.

Each group was originally maintained as a separate punch-card deck, allowing multiple programmers to work simultaneously without merge conflicts.

## How the Code Is Organized

The repository preserves not just the instructions but also the metadata and documentation structure that MIT engineers relied upon for verification and maintenance.

### File Headers and Documentation

Every `.agc` file begins with a standardized header comment providing provenance and context:

```agc

# Copyright: Public domain.

# Filename:    CM_ENTRY_DIGITAL_AUTOPILOT.agc

# Purpose:    Part of the source code for Colossus 2A, AKA Comanche 055.

#            It is part of the source code for the Command Module's (CM)

#            Apollo Guidance Computer (AGC), for Apollo 11.

# Assembler:   yaYUL

...

```

These headers map directly to scanned PDF pages from the original Apollo manuals, allowing researchers to cross-reference the digitized code against the 1969 printouts. The comments specify the assembler directive (`# Assembler: yaYUL`) required for modern reconstruction.

### The yaYUL Assembler Format

All syntax targets the **yaYUL** assembler, which faithfully reproduces the original YUL/GAP assembler behavior used during Apollo. The header comment in each file identifies this requirement, ensuring that anyone attempting to build the code uses the correct toolchain. The assembler processes the `$filename.agc` includes from `MAIN.agc` and resolves symbolic addresses across the monolithic build.

## Navigating the Source Files

To explore the Apollo 11 Command Module software effectively:

1. **Consult the index** – Open [`Comanche055/README.md`](https://github.com/chrislgarry/Apollo-11/blob/main/Comanche055/README.md) for a comprehensive mapping of every `.agc` file to its original page numbers in the MIT documentation, with direct GitHub hyperlinks.
2. **Start with MAIN.agc** – Review the master include file to understand the dependency order and overall program architecture.
3. **Study CM-specific logic** – Examine `CM_ENTRY_DIGITAL_AUTOPILOT.agc` and `CM_BODY_ATTITUDE.agc` to understand Command Module unique functions.
4. **Cross-reference documentation** – Use the page numbers cited in file headers to locate the scanned original source listings for verification.

## Summary

- The **Apollo 11 Command Module source code** is located in the **`Comanche055`** directory of the chrislgarry/Apollo-11 repository.
- **`MAIN.agc`** acts as the master include file, listing all component `.agc` modules in assembly order.
- **CM-specific files** (prefixed with `CM_`) contain logic for re-entry and attitude control unique to the Command Module.
- The **[`Comanche055/README.md`](https://github.com/chrislgarry/Apollo-11/blob/main/Comanche055/README.md)** provides the definitive index linking files to original MIT documentation page numbers.
- All code targets the **yaYUL** assembler, with headers documenting provenance and historical context.

## Frequently Asked Questions

### Where exactly is the Apollo 11 Command Module source code located in the repository?

The source code resides in the **`Comanche055`** directory at the repository root. This directory contains all `.agc` assembly files for the Command Module software (Comanche 55), while the Lunar Module software is stored separately in the `Luminary099` directory.

### What is the difference between the MAIN.agc file and the other .agc files?

`MAIN.agc` is the master include file that contains no executable logic itself, but rather a list of `$filename.agc` directives that instruct the assembler to concatenate all component files in the correct order. The other `.agc` files contain the actual implementation of guidance algorithms, autopilot routines, and system utilities.

### Which files contain code specific to the Command Module versus generic AGC routines?

Files prefixed with **`CM_`** contain Command Module-specific logic, particularly for re-entry and atmospheric flight. Examples include `CM_ENTRY_DIGITAL_AUTOPILOT.agc` and `CM_BODY_ATTITUDE.agc`. Generic routines used by both the Command Module and Lunar Module lack this prefix and handle core functions like IMU compensation and telemetry.

### How can I verify that the digitized code matches the original Apollo 11 software?

Each `.agc` file header includes the original page range from the MIT Instrumentation Laboratory source listings (e.g., "pp. 1063-1092"). The [`Comanche055/README.md`](https://github.com/chrislgarry/Apollo-11/blob/main/Comanche055/README.md) provides a complete index mapping files to page numbers, allowing direct comparison with the scanned original documents archived by MIT and NASA.