
A Glimpse into the Apollo Guidance Computer - bradddd
https://medium.com/@borja/a-glimpse-into-the-apollo-guidance-computer-8ee06e5e1a5c#.1oz85ff7b
======
danso
Included near the bottom of the article is a link to a Spanish outlet's
interview with Margaret Hamilton (the lead flight software engineer) that I
had only recently discovered:

[https://medium.com/@verne/margaret-hamilton-the-engineer-
who...](https://medium.com/@verne/margaret-hamilton-the-engineer-who-took-the-
apollo-to-the-moon-7d550c73d3fa)

She gives some general insight to how the code works, but the biggest
highlight for me was how she apparently coined the term "software
engineering":

> _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._

Apparently, she's kept off of the social network grid, but would love if
someone could convince her to do an AMA.

~~~
zappo2938
Do you think in the male dominated world of engineering in the middle part of
the 20th century that they considering programming to not be a serious
discipline in engineering lead to women being hired in positions they would
not have if programming carried higher prestige? If so what does this tell us
about the contributions made by women like Margaret Hamilton, Grace Hopper,
and the ENIAC programmers? The issue of men dominating software engineering
today isn't about talent or potential, but likely grounded in sexism. If you
consider hiring women you double your potential labor pool.

(If you are going to down vote this comment, can you please take a moment to
explain why?)

~~~
spectre256
Absolutely they considered programming to be not as serious. There's a great
book called Digital Apollo by David Mindell[1] that talks about the creation
of the Apollo Guidance Computer.

One of the stories is of a male manager who, after being put in charge of a
team of software developers, asks his wife not to tell any of their friends he
was managing a software team.

[1] [https://www.amazon.com/Digital-Apollo-Human-Machine-
Spacefli...](https://www.amazon.com/Digital-Apollo-Human-Machine-
Spaceflight/dp/0262516101)

~~~
jakub_h
Actually, it was his wife who asked him (as a joke).

------
js2
_To address the limited instruction set, the AGC team wrote a software virtual
machine (or p-code machine) for the AGC to interpret an entirely new
instruction set called the “interpretive language”._

Interestingly, Steve Wozniak would come up with a similar solution for the
Apple II about a decade later:

[https://en.m.wikipedia.org/wiki/SWEET16](https://en.m.wikipedia.org/wiki/SWEET16)

 _SWEET16 is an interpreted byte-code language invented by Steve Wozniak and
implemented as part of the Integer BASIC ROM in the Apple II series of
computers. It was created because Wozniak needed to manipulate 16-bit pointer
data in his implementation of BASIC, and the Apple II was an 8-bit computer._

~~~
kragen
Short Code was an interpreted bytecode proposed by Mauchly in 1949 and
implemented by Schmitt on the UNIVAC I in 1950:

[https://en.wikipedia.org/wiki/Short_Code_%28computer_languag...](https://en.wikipedia.org/wiki/Short_Code_%28computer_language%29)

Going back further, Turing's 1936 Universal Machine is "universal" because it
can interpret a description of another machine, which could be a different
Universal Machine (i.e. an interpreter), an application-specific machine, or
even the same universal machine (i.e. self-emulation).

Gates and Allen developed Altair BASIC on a PDP-10 at Harvard in 1976,
handling invalid-instruction traps by emulating the 8080 instructions they
were using, thus turning the PDP-10's operating system into an interpreter for
a different instruction set.

The Alto being used at the same time at Xerox PARC was optimized for such
emulations: it ran "microcode" loaded from RAM, so that you could program it
to interpret whatever instruction set was most appropriate for your
application.

Throughout the 1960s and 1970s, a large fraction of IBM computer time was
spent running emulators of earlier IBM models like the 650, 704, 709, and
7090, in order to run the software developed for those older machines.

And of course today much of our computer time is spent running software
represented as JVM bytecodes, SpiderMonkey bytecodes
[https://developer.mozilla.org/en-
US/docs/Mozilla/Projects/Sp...](https://developer.mozilla.org/en-
US/docs/Mozilla/Projects/SpiderMonkey/Internals/Bytecodes), CPython bytecodes,
or Lua "bytecodes"; and Vulkan, the new replacement for OpenGL, defines a
vendor-independent bytecode format for representing GPU programs.

A level below this, the currently popular out-of-order CPUs recompile the i386
or amd64 instructions emitted by our compilers into sets of "micro-ops", which
are then independently scheduled; sometimes these micro-op representations are
cached so that the recompilation process doesn't have to be repeated every
time through a loop. You could argue that this, even more than the usual
microcode approach that was supposed to go out the window with the advent of
RISC, has turned our entire software infrastructure into bytecode for a more
convenient virtual machine.

Your comment seems to be predicated on the misconception that programming a
computer to interpret a more convenient instruction set is some kind of
bizarre or unusual thing to do. In fact, it is not only commonplace, but
absolutely central to our modern concept of "computer".

~~~
abecedarius
Your last paragraph seems unfair to the comment you're responding to. I too
was reminded of SWEET16: they're similar in being very simple interpreted VMs
meant to be hand-coded to squeeze code size in tiny computers. They're also
invoked in about the same way, to be mixed into native assembly code.

If my dim memory of Knuth's article on the early history of compilers is
right, Short Code was meant more for programmer productivity than code size.

------
bluetomcat
Interesting fact: the listings contain comments indicating page numbers in the
form of "# Page [number]". To find the maximum page number, I ran the
following one-liner:

    
    
        $ awk '/# Page / { print $3 }' Apollo-11/*.s | sort -gr | head -1
        1516
    

It is often speculated that in the famous photo, Margaret Hamilton is standing
next to the pile of the complete source code. However, 1516 pages are far from
such a high pile. I wonder, aren't these books just containing different
revisions of the code, or maybe not all of the code has been published?

~~~
trynewideas
Per this interview between Hamilton and Jaime Rubio Hancock
([https://medium.com/@verne/margaret-hamilton-the-engineer-
who...](https://medium.com/@verne/margaret-hamilton-the-engineer-who-took-the-
apollo-to-the-moon-7d550c73d3fa)):

> Q: Was this picture taken during the Apollo project development? When was it
> taken and who took it?

> A: Here is a description of the photo excerpted from an MIT Draper Lab
> document:

> > “Taken by the Draper Lab photographer in 1969 (during Apollo 11). Here,
> Margaret is shown standing beside listings of the software developed by the
> team she was in charge of, the LM and CM on-board flight software team”.

Hamilton again, in this Vox interview
([http://www.vox.com/2015/5/30/8689481/margaret-hamilton-
apoll...](http://www.vox.com/2015/5/30/8689481/margaret-hamilton-apollo-
software)):

> "In this picture, I am standing next to listings of the actual Apollo
> Guidance Computer (AGC) source code," Hamilton says in an email. "To
> clarify, there are no other kinds of printouts, like debugging printouts, or
> logs, or what have you, in the picture."

~~~
trynewideas
There's also the people who reportedly spoke to Ron Hackler about the
photo[1][2], who notes that "they wrote all of the AGC source code on AGC
source coding paper".

Such sheets would look like this: [http://www.eah-
jena.de/~kleine/history/software/IBM360-codin...](http://www.eah-
jena.de/~kleine/history/software/IBM360-codingform.jpg)

And would likely be much less dense than the printouts.

[1] Steve Dolha on Quora: [https://www.quora.com/Was-this-pile-of-code-
written-by-a-sin...](https://www.quora.com/Was-this-pile-of-code-written-by-a-
single-team-of-software-engineers?share=1)

[2] This imgur post: [https://www.quora.com/Was-this-pile-of-code-written-by-
a-sin...](https://www.quora.com/Was-this-pile-of-code-written-by-a-single-
team-of-software-engineers?share=1)

------
EvanAnderson
It's probably worth linking to the prior discussion re: the Github repo
itself.

[https://news.ycombinator.com/item?id=12048945](https://news.ycombinator.com/item?id=12048945)

------
dmix
Apparently Science Channel did an episode on "MIT's work on the Apollo
Guidance Computer" (episode 3):

[https://en.wikipedia.org/wiki/Moon_Machines#Part_3:_the_navi...](https://en.wikipedia.org/wiki/Moon_Machines#Part_3:_the_navigation_computer)

They are available on public torrent sites.

------
utopcell
on a related note, this has passed by HN in the past and it is still
fascinating to watch:
[http://www.firstmenonthemoon.com/](http://www.firstmenonthemoon.com/)

------
bodzo
The Margaret Hamilton picture actually just shows her next to computer
manuals, not code she wrote. This was cleared up in another thread a long time
ago.

~~~
jakub_h
It's not code that she wrote (up to ~350 people worked on the code at one
time) but it's not "computer manuals" either.

