The code that flew Apollo 11 to the Moon is free to read
The assembly code that landed Apollo 11 has 77,000 GitHub stars. Reading it is a masterclass in doing more with less.

On this pageJump to section
The software that landed the first humans on the Moon is on GitHub. The repository is called Apollo-11, it holds the original guidance computer code for the command module and the lunar module, and more than 77,000 people have starred it. It is the code, transcribed from the printouts, down to the comments the programmers left in the margins.
Open the lunar module half, called Luminary 099, and you are reading the program that ran the descent to the Sea of Tranquility: the engine ignition, the landing guidance, the display routines, and the priority scheduler that kept the landing going when the computer started flashing alarms. All of it ran on a machine with 2,048 words of working memory.
A computer the size of a suitcase
The Apollo Guidance Computer weighed about 70 pounds and filled roughly a cubic foot. It ran at just over 1 megahertz, drew 55 watts, and held 2,048 words of erasable memory plus 36,864 words of read-only memory. A single addition took about 23 microseconds. It was the first computer built from silicon integrated circuits, designed at the MIT Instrumentation Laboratory and built by Raytheon, and only 57 were ever made.
That read-only memory was core rope: copper wire woven by hand through tiny magnetic rings. A wire threaded through a ring meant one thing, a wire passing around it meant another. The program was literally woven into the hardware, so changing a line of code meant re-weaving the memory.
The astronauts talked to the machine through the DSKY, a display and keyboard unit with green seven-segment numerals, where commands were typed as two-digit verbs and nouns. A verb said what to do, a noun said which data it applied to.
From a museum shelf to a repository
The code survived because a hardcopy sat in the MIT Museum. Volunteers with the Virtual AGC project digitized the listing, Paul Fjeld photographed the pages, and Ron Burkey's team transcribed them into the repository.
The command module program is Comanche 055, assembled April 1, 1969. The lunar module program is Luminary 099, printed July 14, 1969, six days before the landing. Margaret Hamilton submitted the command module code as the lab's Colossus programming leader on March 28, 1969.
GitHub lists no license for the repository. The README states the code is public domain, which fits its origin: it was written under a NASA contract at MIT. The files are organized as the original listing was, with a table of contents that joins the pieces together. The original team had no linker, so the build was one monolithic listing, assembled by inclusion, and the repository keeps it that way.
What you find inside
The file names alone are worth the visit. The engine ignition routine is called BURN_BABY_BURN, after a catchphrase of 1960s radio DJ Magnificent Montague, a joke its authors Don Eyles and Peter Adler kept in the flight code. The display and keyboard routines live in a file called PINBALL_GAME_BUTTONS_AND_LIGHTS. The landing itself is THE_LUNAR_LANDING, eight pages of assembly starting on page 785 of the listing.
# BURN, BABY, BURN -- MASTER IGNITION ROUTINE
# THE MASTER IGNITION ROUTINE IS DESIGNED FOR USE BY THE FOLLOWING LEM PROGRAMS: P12, P40, P42, P61, P63.
BURNBABY TC PHASCHNG # GROUP 4 RESTARTS HERE
The code is assembly language, with a second interpretive language for the mathematics, and the comments explain the intent in plain sentences. The ignition routine opens with a note that it serves five programs and handles everything from 45 seconds before ignition to 26 seconds after. Reading it feels like reading a workshop manual written by people who knew the machine would be 240,000 miles from help.
The code still runs. The Virtual AGC project ships an emulator of the computer and a simulated DSKY, so the original programs execute on a modern desktop, and the same emulator drives simulated landings in the Orbiter space-flight simulator.
The alarms that almost ended the landing
Minutes into the powered descent, the DSKY flashed 1202. Then 1201. The alarms repeated every 10 seconds or so, and neither astronaut could tell from the codes what was wrong. In Houston, guidance officer Steve Bales and computer specialist Jack Garman had seconds to decide whether the landing should go on. Garman had a crib sheet of alarm codes, and the team had drilled exactly this failure in a simulation on July 5, after a practice run ended in an abort. The call was go.
The cause was found after the landing, and it was almost embarrassingly ordinary. A rendezvous radar switch had been left in the automatic position, as the crew's procedures required, so the computer spent its time looking for radar data it did not need. The extra work stole cycles until the computer was running at about 80 percent of its normal speed. Buzz Aldrin had wanted the computer to track both radars at once, in case the landing had to be aborted, but that capability was never built in, and the simulations never caught the gap.
The alarms were the executive scheduler announcing it could not keep up, and dropping the lowest-priority jobs to protect the ones flying the spacecraft. The software was built around that trade from the start: a priority-driven executive that kept the essential jobs and let the rest fall off the queue, with restart routines that could pick the work back up. The MIT engineers who wrote it later said the system had operated as designed, and saved the flight.
Before the ascent the next day, flight director Glenn Lunney told the crew to put the rendezvous radar switch in the manual position. The ascent ran without incident.
Start with Luminary 099. Its table of contents is the map, the file names are the tour, and the ignition routine is the first stop. The computer that ran it never failed in flight. Its calculated mean time between failures was 50,000 hours, and the code that did the work is a public repository you can open tonight.


