ApolloRS

News: ApolloRS was accepted to the 2027 IEEE Aerospace Conference (March 6–13, 2027, Big Sky, Montana). It is an independent project I built for fun, just trying to learn Rust. Paper details.

This page is long. What do you want to read?


Quick version

ApolloRS is my Rust project for working with Apollo 11 flight software at the machine level. I am not trying to take Apollo assembly, make it look like modern Rust, and call that done. That would be the easy version, but it would not prove much.

The actual goal is to preserve the original Apollo software, execute real Apollo Guidance Computer machine words, record what the machine does, and compare that behavior against a pinned reference emulator.

In other words, ApolloRS is not just a rewrite. It is an emulator, source-preservation system, trace generator, validation pipeline, and eventually a path toward readable Rust reconstructions of bounded Apollo routines.

The repository is here: ApolloRS on GitHub.

Back to top

What ApolloRS actually is

ApolloRS is an executable Rust system for the Apollo Guidance Computer, also called the AGC. The AGC was the computer used in the Apollo spacecraft. It was not a general-purpose computer like a modern laptop. It had its own instruction set, memory system, arithmetic rules, input/output channels, interrupt behavior, and timing assumptions.

That matters because Apollo software was written for that specific machine. If I rewrite it too quickly into normal Rust, I can easily remove the behavior that made the original software correct. The code might look cleaner, but it would no longer mean the same thing.

So ApolloRS starts from the bottom. First, it preserves the historical source. Then it builds or imports validated rope images. Then it executes those images in Rust. Then it records detailed traces of the machine state. Then it compares those traces against a reference implementation.

The current ApolloRS README describes the project as a 24-crate, unsafe-free Rust workspace that preserves Comanche 055 and Luminary 099, executes real rope images, models DSKY and deterministic hardware inputs, records traces, and compares those traces with a pinned yaAGC reference.

Back to top

Why this is not simple

This is one of the most important parts of the project. Converting Apollo assembly into Rust is not like converting Python into Java.

Python and Java are both high-level languages. They already have variables, functions, objects, libraries, and runtime systems that are meant for people to read and write directly. A Python-to-Java rewrite can usually keep the same general algorithm and change the syntax and structure around it.

Apollo assembly is different. It is much closer to the hardware. A line of assembly is not just a line of code in the modern sense. It is an instruction that changes a specific machine state.

That machine state includes the program counter, registers, memory banks, arithmetic state, channels, timers, interrupt state, and sometimes machine behavior that does not have a normal modern equivalent.

So the question is not simply:

What Rust code looks similar to this assembly?

The better question is:

What exact machine behavior did this instruction produce, and can Rust reproduce that behavior closely enough to check it?

Apollo assembly depends on details that normal Rust does not automatically model: 15-bit words, one's-complement arithmetic, positive and negative zero, banked memory, indexed instructions, hardware channels, and interrupt timing.

If I ignore those details, I can write Rust that looks nice but is wrong. That is why ApolloRS starts with emulation and trace comparison before trying to make anything look readable.

The hard part is not generating Rust code. The hard part is proving what kind of Rust representation I have: original machine execution, mechanical translation, readable reconstruction, or behaviorally verified equivalence over a bounded run.

Back to top

What the AGC is

The AGC stands for Apollo Guidance Computer. It was the onboard computer used in Apollo spacecraft for navigation, guidance, and control.

The AGC handled more than just calculations. It interacted with astronaut input, timers, interrupts, memory banks, input/output channels, and flight software routines that controlled mission behavior.

ApolloRS models the AGC as a machine. That means the project has to represent registers, memory, instructions, channels, timers, interrupts, and execution traces instead of treating the original source as normal text.

This is why the project is closer to systems work than a normal translation project. I am not only asking what the code says. I am asking what the computer did when that code ran.

Back to top

What a rope image is

A rope image is the executable program image for the Apollo Guidance Computer. Apollo flight software was stored in fixed memory called rope memory.

For ApolloRS, the rope image is what the Rust AGC machine loads and executes. This is different from just reading the source files.

Reading source tells me what is written. Executing the rope tells me what the AGC machine actually does instruction by instruction.

That difference is important because the project is not only a source-code reader. It is meant to run Apollo software as machine code and record the resulting behavior.

Back to top

The machine details that make this difficult

15-bit words

Modern computers usually use word sizes like 8, 16, 32, or 64 bits. The AGC used 15-bit words.

That means a normal Rust integer is not automatically an AGC word. ApolloRS needs explicit word types so the emulator preserves the way the AGC stored and transformed values.

One's-complement arithmetic

Most modern computers use two's-complement arithmetic for signed integers. The AGC used one's-complement arithmetic.

One consequence is that the AGC has both positive zero and negative zero. That sounds small, but it is real machine behavior. If ApolloRS collapses both zeros into one normal Rust zero too early, it is already no longer representing the AGC correctly.

Banked memory

The AGC used banked memory. This means an address does not always identify one physical location by itself. The selected bank registers help determine what memory is actually being accessed.

So ApolloRS cannot just do this:

memory[address]
  

The emulator has to translate addresses through the current bank state. Otherwise, the same apparent address could point to the wrong memory.

Interrupts

Interrupts are events that temporarily pull the computer away from its current path so it can handle something else. For Apollo, interrupts matter because timers, inputs, and hardware events interact with the running flight software.

ApolloRS has to model interrupt entry, interrupt return, and the registers affected by that process. A small mistake in interrupt handling can completely change where the program goes.

Channels

Channels are how the AGC communicated with hardware-facing systems. Instead of pretending input is just typed into a modern terminal, ApolloRS models the channel activity that the original software expected.

This matters because many meaningful Apollo scenarios are not just arithmetic. They involve hardware input, display behavior, and interrupt-driven software paths.

DSKY

The DSKY was the display and keyboard interface used by astronauts. It is where inputs like verbs, nouns, program numbers, and execute commands were entered.

ApolloRS models DSKY behavior because it lets the project drive real Apollo software paths. For example, entering a program through the DSKY is much stronger than forcing the emulator to jump to a label.

Indexed instructions

Some AGC instructions can be modified by previous instructions through indexing. That means the instruction that runs may not be interpreted in isolation.

This is another reason a simple source-to-source rewrite is not enough. The emulator has to understand the instruction behavior in machine context.

Interpretive code

Some Apollo code was not ordinary AGC instruction code. It ran through an interpretive system inside the AGC.

That means part of the software stack looks like this:

Rust AGC emulator
      |
      v
AGC machine instructions
      |
      v
Apollo interpretive system
      |
      v
higher-level guidance mathematics
  

That is why the project has to be layered. There is machine code, and then there are higher-level behaviors built on top of that machine code.

Back to top

The three levels of the project

Level 1: historical emulation

This level runs the original AGC machine words in a Rust implementation of the AGC. The Apollo program is still the Apollo program. Rust is acting as the computer.

historical Apollo source
        |
        v
validated rope image
        |
        v
AGC machine words
        |
        v
Rust AGC execution
        |
        v
trace of machine behavior
  

This is the foundation. If this layer is wrong, then every higher-level translation is built on bad evidence.

Level 2: mechanical translation

This level transforms source or decoded instructions into Rust while preserving the structure of the original program. It keeps the program counter, labels, memory operations, banks, and instruction boundaries.

This is not meant to look like normal application code. It is meant to stay close enough to the assembly that it can be compared against the emulator.

Level 3: readable reconstruction

This level is where a bounded piece of Apollo behavior is rewritten as normal typed Rust. This is where routines can become functions and machine state can become structs.

But this level has to be earned. Apollo assembly does not automatically give me clean high-level structure. I have to infer it from source labels, memory locations, comments, instruction behavior, and trace evidence.

That is why ApolloRS only treats a readable reconstruction as meaningful when it is bounded and compared against original rope execution.

Back to top

What I have built so far

ApolloRS is currently organized as a 24-crate Rust workspace. A crate is a Rust package. Splitting the project into crates lets each part of the system have a clear job.

The workspace includes code for one's-complement words, fixed-point behavior, source preservation, source parsing, overlays, instruction decoding, AGC memory, CPU execution, runtime events, timers, interrupts, channels, DSKY behavior, faults, traces, validation, reports, cross references, and Rust generation.

That organization is important because this is not one task. It is a pipeline.

preserve source
      |
      v
validate executable image
      |
      v
execute AGC words
      |
      v
record trace
      |
      v
compare against reference
      |
      v
make bounded higher-level claims
  

The project also has provenance records. That means it tracks source revisions, toolchain versions, hashes, generated artifacts, and limitations. I want the project to say exactly what was executed and exactly how it was produced.

Back to top

Comanche and Luminary

ApolloRS works with Comanche 055 and Luminary 099.

Comanche was the Command Module flight software. Luminary was the Lunar Module flight software. They are different programs, but both target the Apollo Guidance Computer.

Supporting both matters because it tests whether ApolloRS is modeling the AGC generally, not just fitting one narrow example.

If the same machine model can work with both programs, that is stronger evidence that the architecture is on the right path.

The project preserves both historical source sets and handles their rope images through documented paths. Luminary is built through a pinned yaYUL integration path. Comanche uses a reference binsource path validated by bank checksums.

Back to top

How I validate it

ApolloRS does not use "it seems to work" as a final claim. The stronger question is whether ApolloRS agrees with a reference implementation on a defined set of observable machine states.

A trace comparison can check event kind, cycle, program counter, instruction, registers, bank registers, and interrupt identity.

If those match over a bounded run, that is real evidence. It is still bounded evidence, but it is much stronger than only showing that the program compiled.

A matched trace for one scenario does not prove the whole emulator is perfect. It proves that, for the tested scenario and compared fields, ApolloRS and the reference agree over that interval.

That distinction is the whole point. I would rather make a precise claim than a huge claim that cannot be checked.

Back to top

The P63 result

The current major result is a Luminary 099 P63 entry slice. P63 is part of the Lunar Module landing guidance software.

In the current run, ApolloRS sends V37E63E through the DSKY input path. That means the program is selected through the interface the Apollo software expected, instead of manually forcing a jump.

The run enters Program 63, reaches the historical P63LM rope location, and records the first landing-guidance writes.

The important part is the comparison. The recorded ApolloRS run matches the pinned yaAGC reference trace for 300,468 instruction and interrupt events on the compared fields.

Those compared fields include event kind, cycle, program counter, instruction, A/L/Q registers, EB/FB/BB bank registers, and interrupt identity.

This is a real result, but it is not overstated. It proves P63 selection, entry, and initial equation activity under a documented scenario. It does not claim ApolloRS has reproduced the entire powered descent.

Back to top

What I am not claiming

ApolloRS is not a complete high-level rewrite of every Apollo routine.

It is not proof that every possible execution agrees with yaAGC.

It is not a full physical Lunar Module simulator with continuous vehicle state, IMU behavior, and landing radar.

Those boundaries matter. They make the work stronger because the claims are specific.

A precise result is better than a huge claim that cannot be checked.

Back to top

The long-term goal

The long-term goal is to create a path from original Apollo software to readable Rust explanations without breaking the connection to the original machine.

historical source
      |
      v
validated rope image
      |
      v
Rust AGC execution
      |
      v
trace comparison
      |
      v
bounded readable Rust reconstruction
  

If those layers agree over defined scenarios, then the readable Rust is not just a rewrite. It becomes an explanation backed by execution evidence.

That is why I like this project. It forces me to be careful about what was preserved, what was executed, what was compared, what matched, and what has not been proven yet.

ApolloRS is not only about making old code run. It is about taking an important historical system and building a modern way to inspect, execute, validate, and explain it.

Back to top

Repository

ApolloRS on GitHub

Back to homepage