This story has been in a few places this week, but my link is to Design News.
Chris Garry, a former NASA intern, has uploaded the full source code for the Apollo 11 flight computer to GitHub, a popular site where programmers share code and tips, and it's proven to be a nice slice of nostalgia in more ways than one.How much memory? The computer contained a blistering 37 Kilobytes of memory. For those of you younger than 40, that's .000037 Gigabytes or 1 millionth of the storage in a 32 Gig smartphone. That's OK because it is a form of core memory, and each byte required tiny ferrite cores be woven into place, so building 37K bytes is a pretty difficult accomplishment. According to the Wiki:
The software for NASA's Apollo Guidance Computer (AGC), which was installed on Apollo command modules and lunar modules, was developed in the 1960s at MIT. At the time nothing for what NASA was trying to do existed so the team from MIT had to code the entire thing from scratch. To do so they created their own version of Assembly language as well as a method for storing computer programs called “core rope memory”, which at the time offered greater storage capacity.
Contrary to ordinary coincident-current magnetic-core memory, which was used for RAM at the time, the ferrite cores in a core rope are just used as transformers. The signal from a word line wire passing through a given core is coupled to the bit line wire and interpreted as a binary "one", while a word line wire that bypasses the core is not coupled to the bit line wire and is read as a "zero". In the AGC, up to 64 wires could be passed through a single core.
The overall code required was quite a bit larger than 37K; the article quotes an estimate of 2 Megs. Because that's such a severe size constraint, the engineers relied on switching programs and only running what was needed for a particular part of the mission. Planning for the unforeseeable, they developed the ability for the code to swap less important tasks for critical tasks. You may have read (or remember!) that during the last few minutes of Apollo 11's landing approach, the computer started flooding its display with warning messages. This was intentional and probably saved the landing.
Due to an error in the checklist manual, the rendezvous radar switch was placed in the wrong position. This caused it to send erroneous signals to the computer. The result was that the computer was being asked to perform all of its normal functions for landing while receiving an extra load of spurious data which used up 15% of its time. The computer (or rather the software in it) was smart enough to recognize that it was being asked to perform more tasks than it should be performing. It then sent out an alarm, which meant to the astronaut, I'm overloaded with more tasks than I should be doing at this time and I'm going to keep only the more important tasks; i.e., the ones needed for landing ... Actually, the computer was programmed to do more than recognize error conditions. A complete set of recovery programs was incorporated into the software. The software's action, in this case, was to eliminate lower priority tasks and re-establish the more important ones ... If the computer hadn't recognized this problem and taken recovery action, I doubt if Apollo 11 would have been the successful moon landing it was.The code was written by a group at MIT who was literally "going where no man has gone before", at least in the software sense. At some point, they took this publicity photo of a printer dump of the entire source code listing, alongside Margaret Hamilton, director of Apollo Flight Computer Programming at MIT's Draper Laboratory, and source of the previous quoted paragraph.
Back in 2003 MIT scanned the physical pages of the AGC code and made them available. But Gary Neff, an airline pilot from Colorado saw how unreadable some of the pages were and decided to reconstruct the code himself. It popped up in a few other places, like on a Google blog from 2009, but Neff's work mostly languished in Internet obscurity until Garry found it and uploaded it to GitHub, where it has found new life among programmers poring over the code and suggesting ways to improve and change it.One of the online sources I came across was surprised that software engineers left jokes in the code comments. A sure sign they never worked around any!
Users scanning over the source code have found the coding comments peppered with jokes, asides, and even references to popular songs, Shakespeare, and cultural events of the time.
The code, though, is a monument to great thinking, excellent resource management, and the best of what geeks can do. I hope it lives forever on GitHub.