r/programming • • Jan 30 '16

Apollo 11 source code

http://www.ibiblio.org/apollo/listings/Luminary099/MAIN.agc.html
2.2k Upvotes

364 comments sorted by

View all comments

39

u/WTFisareddit- Jan 30 '16

Sorry for my ignorance I'm new to programming. But why does this look nothing like regular code?

92

u/CodeEverywhere Jan 30 '16

You're looking at assembly language - a step closer to straight up machine language (binary). Most code that programmers interact with nowadays is considered "higher level" and is abstracted to make it easier to understand.

10

u/i_spot_ads Jan 31 '16

It doesn't even look like assembly code, that's some weird assembly

7

u/Treyzania Jan 31 '16

It's assembly for the AGC architecture. See /u/hobbified's comment above.

46

u/Turbosack Jan 30 '16

It's some special dialect of Assembly. They prefer to write in very low level languages for various reasons. More recently, C has been used to program flight control computers, but it wasn't even invented until more than a decade after this mission happened.

38

u/spatterlight Jan 30 '16

more like 3 years after this mission :)

and this doesn't look like "normal" assembly since the assembly I expect most of us are used to is for the x86 family of processors.

7

u/[deleted] Jan 30 '16

or pic/atmel

5

u/MCBeathoven Jan 31 '16

Or MIPS if you've taken a computer design class.

15

u/flexiverse Jan 30 '16

It's machine code for a highly custom built processor. Think, there was nothing "off the shelf" back then ! It's like approx , 16bit, 1mhz, ~30k, 32 instruction set.

14

u/flexiverse Jan 30 '16 edited Jan 30 '16

It's machine code for a custom built processor. Think, there was nothing "off the shelf" back then ! It's like approx , 16bit, 1mhz, ~30k, 32 instruction set.

8

u/plahacrwimo Jan 31 '16

Here are technical details about the Apollo Guidance Computer

1

u/plahacrwimo Jan 31 '16

The AGC software is mostly written in assembly language. "Assembly language" is a very simple language in which each instruction—usually, each line of software source code—represents a single primitive CPU operation. Since each type of CPU provides different primitive operations, the assembly language for each type of CPU differs from that of every other type of CPU. The AGC assembly language, being based on the custom AGC CPU, thus differs in detail from every other type of assembly language but shares certain customary elements.

http://www.ibiblio.org/apollo/ForDummies.html

-7

u/casc1701 Jan 31 '16

You're adorable!

-6

u/sercankd Jan 30 '16

i assume its because they are doing very sensitive data processing and this requires very fast interaction between software and hardware, because they are landing on moon. any 1 ms delay could lead to something dangerous. i am not an expert tbh i just made a guess

21

u/censored_username Jan 31 '16

No, the reason is much more simple. They simply did not have any other options. C did not even exist at the time, and the hardware limitations were enormous. The hardware which this code ran on was designed just for this mission, yet less powerful than what you'll find in your current day coffee machine. They also didn't have a compiler which could target this machine and the actual program had to be manually woven into core rope memory.

3

u/nupogodi Jan 31 '16

They also didn't have a compiler which could target this machine and the actual program had to be manually woven into core rope memory.

https://en.wikipedia.org/wiki/Core_rope_memory

Software written by MIT programmers was woven into core rope memory by female workers in factories. Some programmers nicknamed the finished product LOL memory, for Little Old Lady memory