Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Previously posted by me here - https://news.ycombinator.com/item?id=46182669 - but didn't get any interest, not complaiing, good that it got noticed this time.by stmw
- To see the code in action (and learn many good things about Apollo computer) please watch this: https://www.youtube.com/watch?v=B1J2RMorJXM&pp=ygUPYXBvbGxvI...
- Great to see the AGC assembly code and knowing that Apollo 11 is coded purely in assembly. Not sure if it has any compiler. Also found https://github.com/virtualagc/virtualagc while searching for compiler.
- > knowing that Apollo 11 is coded purely in assembly
Of course. According to Wikipedia, it was introduced in 1966, so it's development must have been started earlier. Also according to Wikipedia higher-level languages like Fortran and Cobol were introduced in 1957/58. They were a cutting-edge technology of the era.
So programmers of the day would have been comfortable with assembly, and the inefficiency and novelty of higher-level languages would have probably been a bad fit for the application.
> Not sure if it has any compiler.
What you're looking for is an assembler.
by palmotea - Part of the AGC ROMs implemented a virtual machine for things like matrix multiplication. So, a higher level of abstraction was available but it was still very much coded in its own assembly language.by pistate
- The assembler you're looking for, is called YUL. [0]
You can find much of that code here [1], but unless you have a Honeywell, it isn't much help. yaYUL is a modern remake, and can assemble most of the Apollo code.
[0] https://www.ibiblio.org/apollo/Documents/agcis_13_yul.pdf
by shakna - Really cool to see this digitized and archived, it's such an important piece of history and really one of the earliest digital ic bases computers.by corvad
- I have been collecting Autonetics artifacts off ebay for decades. What I find interesting about this time period is that Autonetics made 3 different efforts for digital inertial guidance. The first version used vacuum tubes and was never commpleted. The second version used the new discrete components developed by Sprague Electric. This version went into production. Autonetics then set about exploring the lithographic process to shrink the discrete component version into an IC based system. Autonetics essentially built the same computer using 3 different circuit construction methods. Here are some pictures of pieces of all 3 systems. The IC's are from about 1967.
One of the 2 nerds in the photo is Richard Stallman next to the Autonetics D-17B. An early inertial guidance system distributed to universities to study as real time computers after decommissioning.
There are also the hard disks(which the D-17B used as a clock) and gyroscopes that served as inputs.
by detourdog - I think I read somewhere around here the code could be run today on something as low powered as the chip that runs the USB charger for an iphone
So yeah I'd like to see that lol
by ck2 - Even that's probably way overkill.
- Yes, 140W USB-C Power Adapter (A3607) has CYPD3135 controller which is based on 32-bit, 48-MHz Cortex M0 CPU with 2 times more RAM (8KB), 128 KB flash and around 500 to 1000 times higher performance.by trq01758
- Ostensibly the ability to run the old lunar navigation code explains where many of these chargers disappeared to.by lostmsu
- Clicking around the code, it mentions a page with images... even more clicking around got me to this page/image: https://www.ibiblio.org/apollo/Block1.html#DSKY / https://www.ibiblio.org/apollo/Block1ControlPanelDSKY.jpg
Damn, a control panel to input values, probably straight to the CPU. I guess the astronauts didn't have to learn assembly, but imagine a programmer having to recite all the raw code (I guess the commands (verbs) are numeric as well) to debug something, all the way at the moon.
by netsharc - The funniest thing is that DSKY was, IIRC, a "temporary solution" that became the norm, and despite all the platitudes today it was apparently hated by astronauts.by p_l
- The DSKY was the main input system for the AGC, and commands were inputted using the verb/noun system. Verb says what you want to do, and Noun says what you want to do that verb to.
For example, "Verb 35 Enter" lights every single segment and light on the DSKY, to make sure they're all working. "Verb 16 Noun 17 Enter" displays the IMU measurements, "Verb 16 Noun 36 Enter" displays the current time and "Verb 16 Noun 43 Enter" displays the current GPS lat/long. Verb 16 indicates to display something as decimal, and the noun indicates what to display.
Other commands could be used to input data, or set what program the AGC was running, for example if you wanted to change the current running program to 67, that would be "Verb 37 Enter 67 Enter"
by voidUpdate - For a superb video explaining what the AGC did and what WENT WRONG during the moon landing including the error codes:l, see: https://youtu.be/B1J2RMorJXM?si=Ad1UYojAtee2ktr3by soferio
- More here (linked in the repo):
Original scans (featuring Margaret Hamilton!)
The Virtual AGC Project Spaceborne Computer Systems
https://www.ibiblio.org/apollo/
The purpose of this project is to provide the original flight software and emulations of the onboard guidance computers flown in historical spacecraft, so that the flight software can be run on computers commonly available to the public today. The particular emphasis is on the Apollo Guidance Computer (AGC) flown in lunar missions in the 1960's and 1970's.
Wikipedia on the hardware:
by mellosouls - https://github.com/chrislgarry/Apollo-11/blob/master/Comanch...
I feel like "BEWARE"... is, given the context, what we would now likely call "load-bearing"
(edit: formatting)COMPTGO EXTEND # USED TO COMPUTE TTOGO QXCH PHSPRDT6 # ** GROUP 6 TEMPORARY USED .. BEWARE **by buredoranna - For an terrific AGC deep dive, I can’t recommend Marc’s restoration videos enough. The work they did was incredible:
https://youtube.com/playlist?list=PL-_93BVApb59FWrLZfdlisi_x...
by BinaryRage - and Master Ken and co...by _joel
- This remains to be my go-to example for how YouTube can be a remarkably effective and valuable platform for the kind of enthusiast whose interests have exceeded the bounds of typical documentaries and media produced for the general public.
It’s sadly getting more difficult to surface these kinds of examples, as we’re seeing a lot of lowest common denominators and slop-py channels run by people who only want to be YouTube content mills, rather than people who have expertise to share and who learned to leverage YouTube as a means to those ends.
by nativeit - Not sure in which video (pretty sure it was one of Marc's videos) it was mentioned, but what I found particularly interesting is that they restored the source code by just cherry picking patches documented elsewhere until the output matched the documented checksums...by preisschild
- Happy 10-year anniversary to this repo being shared on HN.
Most significant discussion: https://news.ycombinator.com/item?id=12048945, 652 points, 145 comments on July 7, 2016
All previous submissions: https://news.ycombinator.com/from?site=github.com/chrislgarr...
by starkparker - Thanks! Here are the two past submissions with comments:
Apollo 11 Guidance Computer source code for the command and lunar modules - https://news.ycombinator.com/item?id=22367416 - Feb 2020 (30 comments)
Apollo 11 Guidance Computer source code - https://news.ycombinator.com/item?id=12048945 - July 2016 (145 comments)
by tomhow - This is such an interesting peek into the engineering of these sort of systems with very constrained resources at the time. Like any random file you open contains little pragmatic design decisions like this
https://github.com/chrislgarry/Apollo-11/blob/master/Comanch...
# THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF # A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15 # DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH. THEREFORE THE TIME # INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
Better be back home in 15 days! ;)
by wim - And I'm scared to hardcode some negligible config value that will never changeby sthuck
- Given the constant launch delays how could they justify hard coding a 15 day window like this?
- The LM landing algorithm was also based on a polynomial, with "time-to-go" as the variable. Problems would occur if that variable went negative.by sehugg
- The Apollo program set a requirement for a fourteen day mission from the beginning. None of the missions lasted that long; the longest was Apollo 17 at 12 and a half days.
The Space Shuttle flight software used an interpolating polynomial for the solar ephemeris, with coefficients that were valid 10+ years (I've forgotten the exact number). The solar position was an input to the atmosphere model used to compute on-orbit drag, which itself was itself an interpolating function for data generated by a model with higher fidelity. I could go on. The pattern of using interpolation formulas to save memory and CPU cycles was (is) a common one.
People would be surprised by the amount of data required for on-board guidance and navigation software. Some of it is non-mission specific, but much of it must be generated for each mission. During the Shuttle era, these parameters were called I-Loads (for Initialization, of course) and were a separate memory load from the flight software itself.