Slashdot Mirror


How They Built the Software of Apollo 11

LinuxScribe tips a piece up at Linux.com with inside details on the design and construction of the Apollo 11 code. There are some analogies to open source development but they are slim. MIT drafted the code — to run on the Apollo Guidance Computer, a device with less grunt than an IBM XT — it had 2K of memory and a 1-MHz clock speed. It was an amazing machine for its time. NASA engineers tested, polished, simulated, and refined the code. "The software was programmed on IBM punch cards. They had 80-columns and were 'assembled' to instruction binary on mainframes... and it took hours. ... During the mission, most of the software code couldn't be changed because it was hard-coded into the hardware, like ROM today... But during pre-launch design simulations, problems that came up in the code could sometimes be finessed by... computer engineers using a small amount of erasable memory that was available for the programs. The software used a low-level assembly language and was controlled using pairs or segments of numbers entered into a square-shaped, numeric-only keyboard called a Display and Keyboard Unit... The two-digit codes stood for 'nouns' or 'verbs,' and were used to enter commands or data, such as spacecraft docking angles or time spans for operations." Reader Smark adds, "The Google Code Blog announced today that the Virtual AGC and AGS project has transcribed the Command Module and Lunar Excursion Module code used during the Apollo 11 moon landing. The code is viewable at the VirtualAGC Google Code Page."

44 of 220 comments (clear)

  1. Fake by Yuioup · · Score: 4, Funny

    Wow. They sure went out of their way to fake the moon landing. I bet the source-code is fake too :-P

    Y

    1. Re:Fake by bAdministrator · · Score: 2, Funny

      lol Cheyenne Mountain doesn't exist.

    2. Re:Fake by morgan_greywolf · · Score: 2, Funny

      Wow. They sure went out of their way to fake the moon landing. I bet the source-code is fake too :-PY

      No, they couldn't have written in Python as it wasn't even a gleam in Guido's eye yet.

    3. Re:Fake by MichaelSmith · · Score: 5, Informative

      This is an Apollo DSKY BTW. A Classic command would have been

      [VERB]66[PRO]

      Which loosely translated means give me manual control, I need to land this sucker. If you watch the descent movies you will hear "P66" being called out by the LMP a few minutes before landing. Interesting to note that the 6 is right beside PRO. I wonder if there is a bit of clever UI design in that.

    4. Re:Fake by elrous0 · · Score: 2, Funny

      I sure hope it's not fake code. I'm a time traveling entrepreneur, and I'm going to make a FORTUNE selling this to the Russians in 1965.

      --
      SJW: Someone who has run out of real oppression, and has to fake it.
    5. Re:Fake by commodore64_love · · Score: 5, Informative

      This Apollo computer has specs almost identical to ancient 1970s home technologies like the Atari VCS/2600 game console (1 megahertz, 2K ROM). Or an Atari 400/Commodore VIC-20 computers (1 megahertz, ~8K RAM). That gives you a rough idea of how "weak" the computer inside Apollo truly was.

      --
      "I disapprove of what you say, but I will defend to the death your right to say it." - historian Evelyn Beatrice Hall
    6. Re:Fake by CWRUisTakingMyMoney · · Score: 4, Informative

      Just to be pedantic, it was actually the Commander (Armstrong) who actually flew the LM to the surface, not the misnomered LMP, who mainly monitored things and called out warnings and readings. So if anyone said P66 (which the transcript doesn't indicate literally happened), it was more likely the Commander, who would've entered the program. The transcript has Armstrong saying "I'm going to..." when he goes into P66.

      --
      Those who anthropomorphize science and/or nature already believe in an intelligent designer.
    7. Re:Fake by iocat · · Score: 5, Insightful

      I think you've got the analogy backwards. It actually shows how powerful and capable those early micros were. Kind of embarassing when your multi-gigahertz PC can barely run a word processor, or stalls when trying to display a photo, huh?

      --

      Dude, I think I can see my house from here.

    8. Re:Fake by Demonantis · · Score: 2, Informative

      Your statement is misleading. These beastly machines that we use are expected to be able to do a huge range of operations. The apollo computers were programmed to do a specific set of tasks and calculations. If given enough resources anyone could design a reliable computer that only did word processing or number crunching with amazing reliability.

    9. Re:Fake by commodore64_love · · Score: 3, Insightful

      >>>Kind of embarassing when your multi-gigahertz PC can barely run a word processor, or stalls when trying to display a photo, huh?
      >>>

      No not really. If I tried to run a modern word processor on an Atari or Commodore computer, it wouldn't even fit. And by the time you stripped-out enough code to make it fit, you'd have a plainjane processor with fixed fonts that are bitmapped and not scalable (i.e. no postscript encapsulation). You'd have pixelated printouts not clean professional documents like today's machines produce.

      As for photos, it used to take my Commodore 64 ten minutes to display a simple 320x240 VGA image. If it tried to display one of today's typical 16-million-color photos, first it wouldn't fit into the available memory, and second it probably would take a full day of number-crunching, displaying just one scanline every half hour.

      Even newer machines like PowerPC Macs have trouble with our modern technologies. I tried to watch an AVI movie on my 400 megahertz PPC, and it was like watching slow motion. Modern tasks demand a fast clock.

      --
      "I disapprove of what you say, but I will defend to the death your right to say it." - historian Evelyn Beatrice Hall
    10. Re:Fake by LWATCDR · · Score: 3, Informative

      "That gives you a rough idea of how "weak" the computer inside Apollo truly was."
      Or how strong the programmers where.
      Most of the code in most programs is for things like UI, security, data validation, help systems and so on.
      Very little code is there to do the actual work.
      The Apollo system was built to be used by a few highly trained people. It didn't need a help system.
      I would rather think of how good the programmers where and frankly the hardware people where than compare it to what we have 40 years latter.
      If you want to think about just how far they had come how fast.
      This was built only 42 years before men landed on the moon. http://en.wikipedia.org/wiki/Spirit_of_St._Louis
      I would say holy freaking jump batman for the moon landing!

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    11. Re:Fake by icebike · · Score: 3, Interesting

      Not powerful in any meaningful sense. Just incredibly robust and failure tolerant.

      Some might remember the 1202 alarm when the LEM commander had to take over manual control and land the LEM because, according to the mainstream press, the computer crashed.

      Well, it turns out it was not quite that simple. Human error led to the computer reaching a PLANNED restart point. This restart was essentially instant, dumping tasks it could not handle due to missing data, and picking up where it left off.

      Aldrin, due to the closeness of the landing decided to take over manually as he had trained to do hundreds of times in the simulator.

      But the computer did not fail, it restarted, as programmed, and was back on line long before he even got his hand off the switch.

        http://history.nasa.gov/alsj/a11/a11.1201-pa.html

      --
      Sig Battery depleted. Reverting to safe mode.
  2. Space, Spacecraft *and* Code by MrKaos · · Score: 5, Funny

    I think I just had a geekgasm.

    --
    My ism, it's full of beliefs.
  3. README.txt by Norsefire · · Score: 4, Funny

    For Vista, the following steps may need to be performed manually after installation:

    1.
    2.

    -- README.txt

    Wow, even rocket scientists don't know how to make code work on Vista.

    1. Re:README.txt by K.+S.+Kyosuke · · Score: 2, Funny

      That's because Microsoft tries very hard to convince everyone by developing Visual Studio that programming for Windows isn't rocket science. Which is why rocket scientists can't program for Windows.

      --
      Ezekiel 23:20
  4. Proper Old Skool by Goth+Biker+Babe · · Score: 3, Interesting

    As some one old enough to enter raw hex in to a hex keypad on a machine with an LED display having hand assembled the code in the back of her math exercise book during a math lesson (when I should have been learning stats) this doesn't sound too different.

    1. Re:Proper Old Skool by Norsefire · · Score: 4, Insightful

      Except if you screwed up you didn't cause several people to explode.

    2. Re:Proper Old Skool by MichaelSmith · · Score: 4, Interesting

      It was amazing they did so well on Apollo. The only real guidance screw up was on Apollo 11. Every other landing was spot on. Apollo 12 had been targeted for the middle of surveyor crater and was dead on when Pete Conrad got his first look at the landing sight. He had to fly manually to avoid the target.

    3. Re:Proper Old Skool by morgan_greywolf · · Score: 5, Funny

      As some one old enough to enter raw hex in to a hex keypad on a machine with an LED display having hand assembled the code in the back of her math exercise book during a math lesson (when I should have been learning stats) this doesn't sound too different.

      You kids and yer "raw hex keypads" and "LED readouts." Why, back in my day, we had toggle switches and light bulbs! And we liked it that way! Now you kids get off my law.....hey, wait...you're a girl? You can stay. :)

    4. Re:Proper Old Skool by Stele · · Score: 3, Informative

      I don't believe there was a screw up of computer guidance in Apollo 11. Armstrong landed way off-target because there were large boulders in the way that weren't accounted for properly in the survey photos. This is why they used up almost all of their descent fuel.

    5. Re:Proper Old Skool by Anonymous Coward · · Score: 5, Interesting

      The problem with Apollo 11's guidance wasn't the equpment, it was the moon. Look up MASCONs. Essentially, the moon's density varies from spot to spot and these differences in density changed the gravitational force affecting the LM during its descent. This, in turn, added errors that couldn't be accounted for, pre-flight.

      What they did on subsequent flights was to use radar doppler data on the LM as it came around from the backside of the moon to determine the difference between the expected flight path and the actual flight path. Once they had this data, they updated the LM's guidance computer to correct for this effect.

      One trickiness is that the state vector of the LM was a 6-tuple. Rather than update the state vector, they figured out that they could just update the range to the landing site by updating 1 number.

      Google search for Emil Scheisser. He's the guy who figured this out.

    6. Re:Proper Old Skool by icebrain · · Score: 5, Informative

      They overshot the original intended landing point by about 4 miles because of a timing error--the descent burn started about four seconds late.

      The rocks-and-boulders-and-crater thing you're thinking of was a different issue.

      --
      The meek may inherit the earth, but the strong shall take the stars.
    7. Re:Proper Old Skool by Opportunist · · Score: 3, Informative

      The typical keyboard has more than most computers in the 60s. The average gamer keyboard boasts more processing and storage power than the average computer of the 70s.

      Basically, they flew to the moon on two keyboards and a programmable mouse.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    8. Re:Proper Old Skool by infolation · · Score: 4, Informative

      The LM initially overshot because the crew were distracted by alarms caused by the computer being unable to process all its tasks simultaneously. These alarms, in turn, had been triggered because ground simulations hadn't taken account of hardware powering up in a random order which generated data from two radars instead of one, which overloaded the computer.

      Armstrong's boulder avoidance flying was undertaken after the crew realised they'd overshot the target site by 4 seconds.

      (Unfortunately I find this subject insanely fascinating)

  5. Apollo 15 by MichaelSmith · · Score: 3, Interesting

    ...was the first flight to land in terrain where the descent trajectory had to be designed to avoid high altitude terrain. By that I mean they had to fly over a mountain, then into a valley for the landing.

    The terrain model in the PNGS had five vectors in memory to represent terrain. Back in those days, RAM was expensive.

  6. looking at the code... by circletimessquare · · Score: 2, Funny

    this is clearly a horrible case of bloatware

    --
    intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
  7. 1 MHz != 1000 Hz by Fleetie · · Score: 2, Informative

    "The Apollo's Guidance Computer was a snail-like 1.024 MHz in comparison, and it's external signaling was half that -- actually measured in Hz (1/1000th of 1 MHz, much as 1 MHz is 1/1000 of 1 GHz)." FAIL!

    --
    "Absorbing your worst..."
    1. Re:1 MHz != 1000 Hz by VMaN · · Score: 2, Insightful

      No love for KHz?

    2. Re:1 MHz != 1000 Hz by commodore64_love · · Score: 2, Interesting

      You're wrong. Only RAM or ROM is measured in base 2, due to the innate binary nature of computers (they measure in multiples of 256, 512, 1024, 2048, et cetera). Clock speed is independent of that and measured in base 10 such that 1 megahertz == 1000 hertz.

      Anyway:

      This Apollo computer has specs almost identical to ancient 1970s home technologies like the Atari VCS/2600 (1 megahertz, 2K ROM) or an Atari 400 computer or a Commodore VIC-20 (1 megahertz, ~8K RAM). That gives you a rough idea of how "weak" the computer inside Apollo truly was.

      --
      "I disapprove of what you say, but I will defend to the death your right to say it." - historian Evelyn Beatrice Hall
    3. Re:1 MHz != 1000 Hz by Bakkster · · Score: 2, Informative

      Only RAM or ROM is measured in base 2, due to the innate binary nature of computers (they measure in multiples of 256, 512, 1024, 2048, et cetera). Clock speed is independent of that and measured in base 10 such that 1 megahertz == 1000 hertz.

      Absolutely correct. Hertz is an SI unit. Just as 1km = 1000m, so does 1kHz = 1000Hz.

      http://en.wikipedia.org/wiki/Hertz

      --
      Write your representatives! Repeal the 2nd Law of Thermodynamics!
  8. Amazing by hamburgler007 · · Score: 2, Funny

    When you consider how many shitty programmers there are now who use variable names that take up nearly 2k.

  9. Calculating trajectories for Apollo program by bAdministrator · · Score: 5, Interesting

    http://embedded.com/columns/technicalinsights/218401508?pgno=1

    "Calculating trajectories for Apollo program"
    "Jack Crenshaw describes what he and team members did to research trajectories for the Apollo missions."

  10. Waist deep in snow, uphill both ways by 140Mandak262Jamuna · · Score: 4, Funny

    In those days we had to program the computer the size of a school bus strapped to our backs while trudging through the waist deep snow, for five miles one way, uphill both ways, without mittens while the politicians were whipping us yelling, "you don't want the Ruskies to win, do you?", those were the days boys. Now these young whippersnappers are using laptops with 8 Gigs of RAM and still could not write a simple javascript engine with a just in time debugger without creating a buffer overflow vulnerability while fed very long unicode strings.... bah... now get off my lawn.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  11. Variation on a theme by Half-pint+HAL · · Score: 2, Insightful

    When I wrote my own equivalent program in C= BASIC, you weren't in a lunar module at all -- you were on foot. There was no fuel, but you had a time limit. You'd been poisoned, you see, and you had to get to hospital, quick. Go too slow, you don't reach the hospital in time, die. Go too fast, run into a wall, die.

    I was a very strange child.

    --
    Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
  12. Atari 2600 by CountZer0(QAW) · · Score: 2, Insightful

    Wow essentially man landed on the moon with the computing power of a 2600.

  13. !opensource by NevarMore · · Score: 3, Informative

    Shoehorning a piece of software into an "open source" angle really doesn't do any justice to open source or the software you're writing about.

    Instead of writing about open source software, write about good software that happens to be open source. If there is really good software where we know something about the code, like this Apollo software, then write about that. Discuss the collaborative development the engineers did, talk about the open source clone over at Google Code, but calling this "like opensource but only for NASA" is a massive distraction.

  14. Good Book on the Subject by Anonymous Coward · · Score: 3, Informative

    Journey to the Moon: The History of the Apollo Guidance Computer
    by Eldon C. Hall
    ISBN: 156347185X

    If anyone is ever in the Mountain View area the Computer History Museum has one of them on display.

    Richard Feynman's book 'What Do You Care What Other People Think?' also mentions the software development scheme used for space shuttle hardware in the context of the Rogers Commission report on the Challenger accident.
    ISBN: 0393320928

  15. And you too can play with the code! by arkham6 · · Score: 3, Informative

    1: Download the excellent sim Orbiter:
    http://orbit.medphys.ucl.ac.uk/

    2: Download the Apollo addon NASSP:
    http://nassp.sourceforge.net/wiki/Main_Page

    3: Download the virtual AGC/AGC software:
    http://www.ibiblio.org/apollo/

    4: ?????
    (Literally, spend hours trying to figure out how to fly, how to get into orbit, reading the detailed manuals, etc etc etc)

    5: Profit!

  16. Interesting story on the virtualAGC page by cluke · · Score: 4, Interesting

    Next time you think you have a tight deadline:

    "Final exam (for the advanced student)
    Prior to the descent of Apollo 14's LM to the lunar surface, a short in the LM control panel caused the abort switch to be triggered intermittently. If this actually happened during the landing, an abort would have automatically occurred (meaning that the lower stage of the LM would have been jettisoned and the upper stage would have blasted back into space). No landing would have been possible, and the astronauts would have faced the grave situation of needing rescue by the command module. It was therefore necessary, in the orbit or two before descent, for the some of the software designers to work out a fix for this problem that allowed a software lockout of the abort switch during the initial phase of the descent, but also allowed reenabling the abort switch later in the descent, in case the astronauts needed to use it. They did, in fact, work out such a fix. Your mission, should you choose to accept it, is this: Work out such a fix and send it to me. Remember, your fix can only involve erasable memory, since the core-rope containing the program cannot be altered. The fix needs to be keyed in at the DSKY by the astronauts. You have about 90 minutes to figure it out. Go!"

    http://www.ibiblio.org/apollo/index.html#Final_exam_for_the_advanced_student_

  17. NASA on software development for the space shuttle by Gyske · · Score: 3, Interesting

    A few years ago I read an excellent article on how NASA develops software for the space shuttle. It focuses on the development process. The article is quite long, but well written, informative and entertaining. Read it here: http://www.fastcompany.com/magazine/06/writestuff.html?page=0%2C3

  18. Word != Byte by jspenguin1 · · Score: 2, Interesting

    The Block II AGC had 2,048 WORDS of memory, not 2,048 bytes. A word on the AGC is 15 bits + 1 bit parity. So, the AGC actually has 4 KiB of erasable memory, or 3.75 KiB not counting parity.

    Also, keep in mind that this was just data memory, not program memory. A lot of early 8-bit micros loaded their programs into RAM from cassette or paper tape, so the total memory available for data is reduced.

    The AGC had 36 KWords of read-only program memory which was woven into core-rope memory by the same "little old ladies" that sewed the suits together.

  19. Supergeek Builds Homemade Functional AGC by Anonymous Coward · · Score: 4, Interesting

    This guy wins the ubergeek crown of all time. He actually built a fully functional version of an AGC out of discrete IC chips. Granted, it is not a true AGC clone, since the exact chips could not be procured in 2000-2004, but he did build a functional workalike of the AGC out of individual TTL chips, and wrote two software emulators, and got his modernized hardware reproduction AGC to run actual original AGC machine code software.

  20. ROM by sjames · · Score: 2, Informative

    Just calling it ROM doesn't quite convey the level of tech. It was also known as little old lady memory because it was literally copper wire and ferrite cores woven together by little old ladies.

  21. The will to go back by jmorris42 · · Score: 2, Informative

    > Maybe as a country, we have just lost our 'will' to do things?

    Partly. But it is also rational. Remember why we did it in the first place. We had to beat the 'Godless Commies' to the moon so we were willing to spend whatever it took and men with balls of steel were willing to climb into rushed spacecraft. And we won a major engagement of the Cold War with only three casualties. When the historians finally settle on things it is likely that Kennedy's Apollo and Reagan's Strategic Defense Initiative will be remembered as major contributors (the other two major ones being Reagan's "Focus of Evil" and "Tear Down this Wall" speeches) to the failure of the Soviet Union so it was worth the investment. After we planted the flag the game changed. The stated goal was to land on the moon and return, we had never set a goal of building a moonbase or anything more permanent. It was no longer worth spending such a large percentage of the US Federal budget, the need to take such risk dropped, etc.

    I have long said we went to the moon fifty years before we were ready and because of that we will probably lose another fifty years before returning. Because after the moon landings none of the things we should have been doing to work our way to the moon the 'right' way were/are inspiring enough to sustain the political support needed to do them as big government NASA style jobs. So we will now have to wait until the tech gets developed enough that private industry can do it as part of profitable ventures. And we are seeing the first signs of that finally getting going. But it will be at least fifty years before any of the private ventures can work their way back to the moon.

    And there IS profit to be made 'out there' so go we will. Private companies are already making real coin in the launching business. NASA is trying to outsource suppling the ISS, mostly because they wish they were rid of the white elephant but whatever.

    --
    Democrat delenda est