beanz Magazine

Coding the Apollo Guidance Computer (AGC)

Learn about and explore the code used to guide Apollo missions.

When we think of history, we might think of famous politicians or military leaders or athletes. Programming has been around long enough, since the 1930s and 1940s, to have its own history. However, most people don’t think to save their code beyond, at most, saving the code to a repository.

The Apollo moon landing missions used a lot of programming code to guide each mission. As computers and digital storage have evolved (do you remember the 5 inch floppy disk?), for decades the Apollo code was locked in paper printouts. For the 40th anniversary of the first moon landing, in 2009, Google made available online AGC code which Ron Burkey and others had transcribed into digital code from these printouts. The Apollo code can be studied online and run within a virtual Apollo Guicance Computer (AGC) emulator.

How the AGC Worked

The AGC had two parts, a front end device with buttons and a backend processing computer which processed data from the front end device as well as data from various devices within the Apollo command module and lunar lander. For example, the flight data for speed, altitude, and other metrics. While the command module and lunar lander each had an AGC, the software on them was different because each spacecraft had a different purpose.

The front end with buttons was called DSKY, shorthand for display and keyboard, and pronounced dis-key. It had status lights, a display for data, and buttons to enter commands. The backend computer processed the commands entered with buttons and returned data to the display screen.

Here’s an old NASA video which shows how the DSKY worked, about 6 minutes into the program:

This video also provides an overview of the guidance-related problems the AGC had to solve in real time as the astronauts flew to the moon and back. Also note that, while men are everywhere in this video and Dr. Widnall’s lecture video linked below, women made critical contributions to many parts of the AGC program.

notebook-nasa-agc-dsky-display

Here is a NASA illustration of the Apollo AGC, which differs a little from the AGC in the video above.

Warning and status lights are on the top left while the activity displays on the top right. For example, the No ATT warning light is lit when the inertial subsystem, which tracks the location of the spacecraft, could not provide an attitude reference. The PROG status light lit when the DSKY needed additional information from the crew to complete the requested program, for example, to enter position data for the telescope used to navigate.

AGC Software

The AGC software had several parts. The operating system was called Exec and it managed jobs based on priority. Exec could run up to eight tasks at a time with each task periodically checking back with the Exec to see if a task with a higher priority was waiting to run. The Waitlist held tasks waiting for the Exec to have capacity to run them.

The Exec always had one lowest priority job to run, called the dummy job, to check the system status. When the dummy job ran, it meant the AGC software had nothing better to do and the green computer activity status light was turned off.

The AGC also included a software intrepreter to handle complex calculations and data processing. The interpreter was created at MIT by a team led by Margaret Hamilton. The software made the most of the hardware memory limits of the AGC while doing often complicated tasks. The software also was written in AGC Assembly language, a variant of the Assembly language.

If you want to look at the AGC code or learn more about programming Apollo computers, explore the Github and other links below. Google Earth also lets you explore the moon and the Apollo landing sites.

Learn More

Virtual AGC – AGS – LVDC – Gemini Website

Details about the AGC with instructions for the AGC emulator and a link to ownload the emulator software.
http://www.ibiblio.org/apollo/

Virtual AGC Github

The original Google code has moved from Google servers to Github. Others have created Virtual AGCs which can be found searching Github.
https://github.com/rburkey2005/virtualagc
https://github.com/rburkey2005/virtualagc/search?utf8=%E2%9C%93&q=virtualagc

Apollo Guidance Computer (AGC)

https://en.wikipedia.org/wiki/Apollo_Guidance_Computer

Computers in Spaceflight: Computers On Board the Apollo Spacecraft

http://history.nasa.gov/computers/Ch2-7.html

AGC Assembly Language Programmer’s Manual

http://www.ibiblio.org/apollo/assembly_language_manual.html
http://www.ibiblio.org/apollo/NARA-SW/E-2052.pdf

Dr. Widnall on Apollo’s Guidance, Navigation, and Control

A lecture he gave to an MIT class which describes the problems the AGC had to solve.
http://mit.tv/z2q0Lr

David SF Portree’s Spaceflight History Blog

An amazing and exhaustive exploration of human spaceflight, from the obvious to missions that were never executed.
http://spaceflighthistory.blogspot.com/
http://www.wired.com/category/science/science-blogs/beyondapollo/

Google Earth

Download their software to visit the moon and the Apollo landing sites.
http://www.google.com/earth/

Also In The August 2015 Issue

In his classroom, he and his students learn together as a community.

These fifth grade students use their genius hours and Trello software to answer tough questions.

Visual storytelling apps are a great way for kids to document and explore their lives.

Raspberry Pi, Arduino, BeagleBone, Micro Bit, Edison, CHIP, and other handheld computers trace their history to board computers used by engineers.

Random Hacks of Kindness, Jr. helps schools and groups host one day hacking events for kids to work with local non-profit groups.

Resources based on teacher recommendations and other sources.

The new Sphero SPRK Edition makes it even easier for teachers, parents, and kids to learn math, robotics, and programming.

Facts, programs, and groups can help girls succeed at STEM careers.

She was in her 30s when she led the team that developed mission critical software used guide the Apollo moon landings.

Learn about and explore the code used to guide Apollo missions.

CRUD is a powerful concept used everywhere in software programming that uses a database.

Links from the bottom of all the August 2015 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for August 2015.

Some thoughts on starting the third year of publishing this magazine and what's new this month.