Slashdot Mirror


Assembly Code That Took America to the Moon Now Published On GitHub (qz.com)

An anonymous Slashdot reader writes: "The code that took America to the moon was just published to GitHub, and it's like a 1960s time capsule," reports Quartz. Two lines of code include the comment "# TEMPORARY, I HOPE HOPE HOPE," and there's also a quote from Shakespeare's play Henry VI. In addition, the keyboard and display system program is named PINBALL_GAME_BUTTONS_AND_LIGHT, and "There's also code that appears to instruct an astronaut to 'crank the silly thing around.'"

A former NASA intern uploaded the thousands of lines of assembly code to GitHub, working from a 2003 transcription made from scans inherited by MIT from a Colorado airplane pilot, and developers are already using GitHub to submit funny issue tickets for the 40-year-old code -- for example, "Extension pack for picking up Matt Damon". Another issue complains that "A customer has had a fairly serious problem with stirring the cryogenic tanks with a circuit fault present." Because this issue succinctly describes the Apollo 13 mission in 1970, the issue has been marked "closed".

74 comments

  1. Mrs MIT Engineer was the God by Anonymous Coward · · Score: 1

    I think This is the most amazing example of software being developed by a non-company ever.

    Margaret Hamilton ran the show.

    1. Re: Mrs MIT Engineer was the God by Anonymous Coward · · Score: 0

      Oh, and just to clarify, I'm her kid. So I'm a little biased!!!

    2. Re: Mrs MIT Engineer was the God by Anonymous Coward · · Score: 0

      Wow! Maybe you could tell us a story about her?

    3. Re:Mrs MIT Engineer was the God by Anonymous Coward · · Score: 0

      I absolutely LOVED her in the Wizard of Oz! AND all the coffee commercials too.

  2. Slashdotted; code copied here by Anonymous Coward · · Score: 0


    roswell db "...." ; contents redacted
            mov cx, 16777215
            mov di, offset mediabuf
            mov si, offset roswell
            cld
            rep movsb

  3. Link error by hattable · · Score: 1

    "Extension pack for picking up Matt Damon" is not a link real link

    --
    OMG facts!
    1. Re:Link error by Anonymous Coward · · Score: 0

      Oh man, that made me laugh so hard it hurt. I mean, even the code seems legit.

  4. "special version of the assembly programming lang" by Anonymous Coward · · Score: 1

    Ah yes, the assembly programming language.

  5. Note All the Comments by Anonymous Coward · · Score: 0

    Commented code is good code.

  6. development environment? by 4wdloop · · Score: 2

    What did they use to develop the software? And even more interesting how did they test it? The must have had some simulators, probably both software and hardware based?

    --
    4wdloop
    1. Re:development environment? by Anonymous Coward · · Score: 0

      Defiantly no IDE back then, just text editor as you can see from the ASCII artwork in the comments.

    2. Re:development environment? by Anonymous Coward · · Score: 1

      Switches, keypads, and real programmers.

      Not the girly crap we have today.

      if a programmer freaks out at the lack of an IDE or libraries, they really are not high level programmers, but more code monleys.

    3. Re: development environment? by The+Other+White+Meat · · Score: 1, Troll

      Calling it 'girly crap' is both offensive and ignorant. Many of the people who operated and programmed those systems were WOMEN.

      --

      --- Generation X: The first generation to have SIG lines inferior to their parents... ---
    4. Re:development environment? by angel'o'sphere · · Score: 2

      They did not even have version controll at that time!

      The main reason to develop source code control software came from the fact that the Apollo developers fucked up so often. No pun intended. They worked with back ups etc. and often stuff got lossed or mixed together wrongly.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    5. Re:development environment? by Anonymous Coward · · Score: 1

      Well it's easy to fuck something up when you are the one doing the shit for the first time. Unless you are aware of some previous effort to send and return people from the moon. It's not like they could just access some open source libraries and copy the work done by others. The Apollo program was a very high risk endeavor. So risky that any similar effort today would never happen because any failure or loss of life would only start the witch hunt looking to place the blame on someone. The government and general public should STFU and let those willing to accept the risks get on with it.

    6. Re:development environment? by plaukas+pyragely · · Score: 1

      Most of the time it was probably ed-like editor via teletype terminal.

    7. Re:development environment? by dwywit · · Score: 1

      IIRC it was tested in a mission emulator on an IBM 360.

      I wasn't actually "recalling" real events there - I was recalling what I read on the NASA history pages.

      --
      They sentenced me to twenty years of boredom
    8. Re: development environment? by Anonymous Coward · · Score: 1

      Geez get over it. I doubt it was meant as a slight and if you room to that way it's your problem n

    9. Re:development environment? by batkiwi · · Score: 2

      I think you have the terminology 100% backwards.

      You are not really a LOW level programmer if you freak out with no IDE or libraries. If you're writing the sort of code presented here I'd say you can easily call yourself a Systems Engineer or Software Engineer (unlike 99% of the people who call themselves a Software Engineer).

      However, if you feel the need to write assembly, use code quirks to eek out 1% more performance, and write your own libraries then you have no place in modern high level software development, excepting if you're writing drivers, video games, or embedded code. Anyone doing that sort of BS is likely very smart, but is also a liability to any non-toy project.

    10. Re:development environment? by thinkwaitfast · · Score: 2
      It's not always about 1% more performance. For a lot of specialized MCU's, there is no other language. Assembly is not that difficult and for control systems, I've never seen complex code. It's always:

      start: ;; start of frame

      if overrun == 1 ; check for frame overrun

      goto frame_err

      overrun = 1

      read value1 ; read all data at start of 10ms frame

      read value 2

      ...

      read valuen

      output1 = 2*value1

      ...

      outputn = 4.17*valuen

      write output1, output2, ..., outputn

      wait for interrupt

      read radaltswitch

      if radaltswitch == 1

      call procradalt

      overrun = 0 ; clear frame dirty bit

      for(;;) ; wait for interrupt to return to start:

      Not much optimization to be done. Not a difficult piece of software, even in assembly

    11. Re:development environment? by Anonymous Coward · · Score: 0

      "if a programmer freaks out at the lack of an IDE or libraries, they really are not high level programmers, but more code monkeys."

      And then, for extra laughs, put stackoverflow in your firewall's deny rules and watch them squirm.

    12. Re:development environment? by Anonymous Coward · · Score: 0

      "You are not really a LOW level programmer if you freak out with no IDE or libraries. If you're writing the sort of code presented here I'd say you can easily call yourself a Systems Engineer or Software Engineer (unlike 99% of the people who call themselves a Software Engineer)."

      ^low-skilled programmer who's feeling butthurt. Go copy paste some more code other people wrote for you and let the real coders talk dear sir.

    13. Re:development environment? by Anonymous Coward · · Score: 0

      They had an actual Apollo Guidance Computer to run it on, and they likely looked for signals coming out on the proper wires that would be hooked up to other parts of the spacecraft. Oscilloscopes and such.

    14. Re:development environment? by MachineShedFred · · Score: 1

      Don't worry, they had a witch hunt in the 1960s when they lost 3 astronauts in the Apollo 1 fire, complete with Congress critters trying to put the brakes on the whole thing.

      --
      Slashdot still doesnâ(TM)t support Unicode after it was added to the HTML standard in 1997.
    15. Re:development environment? by charlesj68 · · Score: 1

      My Dad worked on the Ranging Radar for the Lunar Excursion Module, so I've heard some stories.

      Data input was punched cards (duh).

      Tests included sticking a unit on the front of a missile and launching across White Sands Missile Range, then comparing the telemetry data returned with a known track mapped across a digitized re-creation of the range. Along the way they discovered the errors in the digitization when the results began claiming that the missile was travelling underground.

      One of his research projects was to work out how to apply a new-fangled algorithm to the problem, Fast Fourier Transforms.

  7. Idiots. Idiots everywhere. by Anonymous Coward · · Score: 5, Insightful

    Unfortunately, with the amount of coverage that this is getting in the geek sphere, the Dunning-Kruger Effect is in full force. So far, just today, I've seen:

    - Someone trying to look into the code who had apparently never encountered a .s file before, and
    - Some (judging by his name) Indian guy who had apparently never heard of the term "attitude" in relation to flight control, and submitted a pull request to change it to "altitude".

    Idiots. Idiots everywhere.

    1. Re:Idiots. Idiots everywhere. by theurge14 · · Score: 3, Funny

      We'll never get into space with that kind of attitude!

    2. Re:Idiots. Idiots everywhere. by Anonymous Coward · · Score: 0

      Nor with that kind of altitude.

    3. Re:Idiots. Idiots everywhere. by pjabardo · · Score: 1

      Earth's gravity well doesn't help. A little altitude goes a long way...

    4. Re:Idiots. Idiots everywhere. by Aighearach · · Score: 1

      A little altitude goes a long way...

      At the wrong attitude, it better go a long way! Are we there yet?!

    5. Re:Idiots. Idiots everywhere. by thinkwaitfast · · Score: 2

      This code has been available for a long time. I downloaded it and got it to run in the simulator about ten years ago. I think I probably even read about it first here on slashdot. It was on some guy's website. He even built a copy of the original hardware.

    6. Re:Idiots. Idiots everywhere. by thinkwaitfast · · Score: 1

      Not really. You need a lot of altitude. Acceleration from gravity is about 60% that on the surface as far out as geosynchronous orbit.

    7. Re:Idiots. Idiots everywhere. by ausekilis · · Score: 1

      I think you mean "altitude" ;-)

  8. Well.. by Ecuador · · Score: 1

    If the first & second AC was the same and legitimate, he sure as hell has regretted not signing-in right about now!

    --
    Violence is the last refuge of the incompetent. Polar Scope Align for iOS
    1. Re:Well.. by Anonymous Coward · · Score: 0

      It sounds like the first, second, AND fourth were all the same person, and with a great story to boot.

    2. Re:Well.. by Anonymous Coward · · Score: 0

      Lots of great stuff gets buried with the slashdot moderation system. You can't have it both ways.

  9. good code too by phantomfive · · Score: 3, Informative

    The mathematical sections tend to be better, well defined, well commented, and well-written code.

    --
    "First they came for the slanderers and i said nothing."
    1. Re:good code too by alphatel · · Score: 1

      Not to mention TIG incrementals and P00H routines

      --
      When the foot seeks the place of the head, the line is crossed. Know your place. Keep your place. Be a shoe.
    2. Re:good code too by Lumpy · · Score: 3, Interesting

      And remember they did ALL OF THIS with integer only math and NO freaking math libraries.

      Want to drive a fre grad programmer nuts? have him convert celcius to Farenheit and Kelvin with 4 decimal places of accuracy using only integer math on an 8 bit micro, no you can not use ANY libraries at all, and you need to do it in less than 6 lines of code.

      Most shit themselves.

      --
      Do not look at laser with remaining good eye.
    3. Re:good code too by angel'o'sphere · · Score: 2

      Actually likely not 'integer' but fixed point math.

      The first time I saw one creating a table with 360 entries one byte big and storing precalculated sinues values in that table (remember: 1 byte big, so 127 means '1' and 128 means '-1' and the other values are 'fractions' between -1 and +1) I told myself: WTF! That was on an 6502 around 1985 in a small math library used in a game.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:good code too by phantomfive · · Score: 2

      and you need to do it in less than 6 lines of code.

      Is that possible?

      --
      "First they came for the slanderers and i said nothing."
    5. Re:good code too by Anonymous Coward · · Score: 2, Insightful

      That is, indeed, a WTF; you only need to store 45 degrees, the rest can be trivially calculated from that. Also, this means you could store the precalculated table as 16-bit (or even 32-bit) integers, yielding much more accurate results, and still save space.

      This isn't really uncommon in embedded systems.

    6. Re: good code too by Anonymous Coward · · Score: 0

      You could use a lookup table. Convert your Celsius value to an integer index and then read back the value. That was the secret of code optimization back then when CPU'S didn't even have floating point units.

    7. Re: good code too by batkiwi · · Score: 2

      A lookup table is the solution I'd use for that sort of problem, but if you're counting the lookup table as 1 line of code then you're sort of going against the spirit of the challenge.

    8. Re:good code too by Aighearach · · Score: 1

      convert celcius to Farenheit and Kelvin with 4 decimal places of accuracy using only integer math on an 8 bit micro, no you can not use ANY libraries at all

      This is why the world loves gcc and libc :) It isn't that hard with just the "standard library," but it sure is without any library! That first little bit of help is the most valuable.

    9. Re:good code too by ncc74656 · · Score: 2

      Want to drive a fre grad programmer nuts? have him convert celcius to Farenheit and Kelvin with 4 decimal places of accuracy using only integer math on an 8 bit micro, no you can not use ANY libraries at all, and you need to do it in less than 6 lines of code.

      Depends on the architecture. Try doing that in less than 6 lines when you don't have multiply or divide instructions in the CPU. You might not necessarily need to code up general-purpose multiply and divide routines (especially if you're dealing with constants...multiply by 9 with three left shifts and an add, for instance), but I suspect there are few (if any) 8-bit architectures that will do what you want within your constraints. The 6502 certainly won't.

      --
      20 January 2017: the End of an Error.
    10. Re:good code too by Anonymous Coward · · Score: 2, Insightful

      Lame. A full circle is 256 entries, not 360.
      Allows you to add angles together without boundary check and you can easily mirror angles.
      There is no real reason to stick with 360 degrees circles, if necessary you can step up to 512.

    11. Re:good code too by eulernet · · Score: 1

      you need to do it in less than 6 lines of code

      This is easy !
      For such short sequences of code, you can use SuperOptimization:
      https://en.wikipedia.org/wiki/...
      I remember reading that a sequence of 7 assembly opcodes required a few weeks of computation.

    12. Re:good code too by Anonymous Coward · · Score: 1

      Storing one octant is simply a memory-speed trade off, especially on 1980s 8-but home computer with no memory cache architecture.

      Storing the full circle allows faster lookup. Without knowing the design and constraints of the system, e.g. Available memory versus frequency of table lookups, it's not really fair to say that storing full circle is "WTF".

    13. Re:good code too by thinkwaitfast · · Score: 1

      Scaled integer math is still very common. I still use it regularly, especially with angle formats. My favorite job ever was writing a 56bit integer math package. Had to keep the precision of a 429bus after numerous operations. I never checked, but it was probably higher precision than IEEE754. Since the range of the numbers was known, some of the mantissa bits could be used for the characteristic part and it was very fast, even on low end hardware.

    14. Re:good code too by thinkwaitfast · · Score: 2

      It's commonly called scaled integer. Except with angles, then it's SAF, for scaled angle format. Wraparound @360 is handled very cleanly.

    15. Re:good code too by thinkwaitfast · · Score: 2

      I worked on a system with about a dozen different angle formats, depending on who was using the data...SAF8, SAF11, SAF13,...

    16. Re:good code too by dargaud · · Score: 1

      There's no such thing as a temperature measurement to 4 decimal places (2 at the very most, 1 is still quite optimistic). And if you have such size constraints, why the fuck would you waste it on primitive units like Fahrenheit ?!?

      --
      Non-Linux Penguins ?
    17. Re:good code too by Anonymous Coward · · Score: 0

      Because the requirements were either written by an idiot or taken from a more general requirement by a contracts lawyer who didn't realize they weren't applicable when it comes to temperature.

    18. Re:good code too by Anonymous Coward · · Score: 0

      And you failed the test.... Next applicant...

  10. Funny bugs, etc, are nice, but ... by davidwr · · Score: 1

    ... historical code like this also needs to exist in a "curated" version, where the only "changes" are those made by a responsible curator, with the changes consisting only of comments.

    I'd fork it myself but the honor of being the "keeper of the curated version" really should be someone with a connection to the project or, better yet, an organization like NASA, a museum, a retired-NASA-employee-association, university, or similar organization that will have the funds, manpower, and interest to keep this going for the long haul.

    Also, separately from the above, paper, original-media or modern-copy-on-same-type-of-media (if available and feasible), and modern-electronic-copies of all of the code should be given to the National Archives, NASA archives, or some similar agency.

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
    1. Re:Funny bugs, etc, are nice, but ... by TangoMargarine · · Score: 1

      Why are they accepting modifications at all? The code is never going to be actually used again anywhere, is it?

      --
      Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
  11. Related: Lunar Module paper source listing by jbdigriz · · Score: 2
  12. Ah, that explains ... by davidwr · · Score: 1
    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  13. Interview Dijkstra on lunar lander code by Anonymous Coward · · Score: 0

    Look at this interview with Edsger Dijkstra (section after ~14:30).
    A nasty bug was found just in time or else the eagle would never have landed in tranquility base.
    A small bug for a programmer, a big bug for mankind.
    Maybe we can now find other bugsðYS

    https://youtu.be/RCCigccBzIU
    Hans Beers

  14. sad really by Anonymous Coward · · Score: 0

    Integer and fixed-point math was how we used to do nearly everything in the 70s and early 80s when performance mattered. There were no FPUs, most CPU chips did not even have multiply or divide instructions. Anything resource- or performance-constrained was coded "on the metal" in assembly.

    When I first wrote bootloader code I coded in actual 1s and 0s (machine code) and manually burned it into PROMS, which felt really advanced over the earlier stuff of hard-wiring tiny ferrite torus bits into magnet wire grids or soldering diodes into grids of perf board. When you have to spend time soldering/wiring each bit, or you have to throw out a several dollar one-time-programmable PROM chip any time you make an error, you learn to understand the hardware at the bit-level and minimize your errors in a real hurry, since errors are painful and expensive.

    Young coders today who paste together megabytes of code other people have uploaded onto github/freshmeat/etc using mixes of languages on GHz+ 64bit processors, multi-terabyte drives, and using beautiful 24-bit color IDEs on massive flat-panel screens would be in tears, and despite a veneer of seemingly solid knowledge often seem to not even know how microprocessors actually work, and how to control actual hardware.

    Hey, you kids, git off my lawn! (smile)

  15. Is it an ITAR violation to post the source by Anonymous Coward · · Score: 0

    Is it not an ITAR violation to post the source?

    1. Re:Is it an ITAR violation to post the source by Anonymous Coward · · Score: 0

      If it is an issue after all these years, the bug seems likely to be in ITAR administration, not the disclosure.

      "We came in peace for all mankind" might be a starting point for sorting it out.

  16. i found it by gzuckier · · Score: 1

    print "HELLO MOON";

    --
    Star Trek transporters are just 3d printers.
  17. moon.c by Anonymous Coward · · Score: 0

    /* snippet from moon.c */
    for (i=0; i < 3; i++)
          puts("c moon");
    puts("are we");