Margaret Hamilton - Apollo and Beyond
Written by Sue Gee   
Monday, 05 September 2016
Article Index
Margaret Hamilton - Apollo and Beyond
Engineering Mission Critical Software
Hamilton Technologies




Programming the Apollo Guidance Computer

Programming was a rather different activity at the time of the lunar landings as this photo of Margaret Hamilton standing beside the printout of the source code for the  Apollo Guidance Computer (AGC) indicates. 

Hamilton together with her team at MIT coded all of the code by hand: that is they wrote all of the AGC source code on AGC source coding paper, and then would give it to the "keypunchers" to copy, that is punch the code from the coding paper onto cards would be processed overnight on a mainframe computer to output the source code as listings (printouts) which were then put into binders. The fact that code is written in assembly language explains why it prints to such a large volume of paper - each line printed is a single machine instruction. 




This wasn't the end of story, however.  Once the code was considered solid, expert seamstresses, referred to as "Little Old Ladies", threaded copper wires through magnetic rings (a wire going through a core was a 1; a wire going around the core was a 0) to create rope memory that was built into the onboard navigation computer.

One thing that hasn't changed is that task was demanding and stressful. Once, after a late-night party, Hamilton rushed back to the computer lab to correct a piece of code she’d suddenly realized was flawed:

“I was always imagining headlines in the newspapers, and they would point back to how it happened, and it would point back to me.”

It was during this period that Hamilton coined the term "software engineering to gain recognition for the work she and her team were doing:

Software during the early days of this project was treated like a stepchild and not taken as seriously as other engineering disciplines, such as hardware engineering; and it was regarded as an art and as magic, not a science. I had always believed that both art and science were involved in its creation, but at that time most thought otherwise. Knowing this, I fought to bring the software legitimacy so that it (and those building it) would be given its due respect and thus I began to use the term “software engineering” to distinguish it from hardware and other kinds of engineering; yet, treat each type of engineering as part of the overall systems engineering process. When I first started using this phrase, it was considered to be quite amusing. It was an ongoing joke for a long time. They liked to kid me about my radical ideas. Software eventually and necessarily gained the same respect as any other discipline.

Astronauts Not Infallible

Programming isn't a conventional 9-5 job and in the evenings and weekends Hamilton would take her daughter Lauren with her, which would make an important contribution to the success of Apollo 8. 




As Hamilton recounted in an interview for Wired with Robert Macmillan, one day, Lauren, then aged 4, was playing with the MIT command module simulator’s display-and-keyboard unit, nicknamed the DSKY (dis-key). As she toyed with the keyboard, an error message popped up. Lauren had crashed the simulator by somehow launching a prelaunch program called P01 while the simulator was in midflight. As a result of this incident, Hamilton wanted to add code to prevent the crash.

She recounted this concern in 2001 at the First Conference of the Apollo Guidance Computer History Project:

Many of the things I was intrigued by had to do with how to make the mission software safe and reliable. And one of the things I remember trying very hard to do was to get permission to be able to put more error detection and recovery into the software. So that if the astronaut made a mistake, the software would come back and say "You can't do that." But we were forbidden to put that software in because it was more software to debug, to work with. So one of the things that we were really worried about is what if the astronaut made a mistake -- We were also told that the astronauts would never make any mistakes, because they were trained never to make mistakes. (Laughter) 

So we were very worried that what if the astronaut, during mid-course, would select pre-launch, for example? Never would happen, they said. Never would happen. (Laughter) It happened.

Apollo 8

In December 1968, five days into the historic Apollo 8 flight, the first manned orbit of the moon, astronaut Jim Lovell inadvertently replicated Lauren Hamilton's action and selected P01 during flight. Launching this routine had the effect of wiping out all the navigation data Lovell had been collecting and without that data, the Apollo navigation computer wouldn’t be able to figure out how to get the astronauts home.  

Having been overruled by NASA from providing error checking code against this very scenario, Hamilton had created a program note that would be available to NASA engineers and the astronauts, saying:

Do not select P01 during flight

At least the cause of the problem was clear and Hamilton and the MIT coders started working on a fix. Nine hours later, after poring through the 8-inch-thick program listing they had a plan. Houston uploaded new navigational data and Apollo 8 and its crew returned to earth.




Apollo 11

The Apollo 11 mission, which the world remembers for "the Eagle has landed" and  Neil Armstrong's "one small step for [a] man, one giant leap for mankind" announcements, proved to be another tense time for Hamilton. Approximately three minutes prior to touchdown the crew reported a 1202 alarm signalling a computer overload error that could have resulted in the mission being aborted in its final few seconds.

It transpired that due to a "checklist error" the crew had prematurely initiated the radar system needed for leaving the moon. This produced an "executive overflow condition" of the 72K on-board computer. Fortunately, due to the way in which Hamilton's team had designed the system, the software prioritized the task of landing the lunar module above all competing tasks and effectively saved the mission.



Last Updated ( Saturday, 20 July 2019 )