Jump to content

LM source code article


John FX

Recommended Posts

I didn't see it linked or mentioned in the article (or linked to in another post here on the forums), but the same source has appeared on GitHub, recently scanned:

https://github.com/chrislgarry/Apollo-11

Some absolutely snarky code in there, such as in THE_LUNAR_LANDING.agc:

Quote

 CAF CODE500 # ASTRONAUT: PLEASE CRANK THE
 TC BANKCALL # SILLY THING AROUND

And more than a few "This should never happen" bits. 

Edited by Cydonian Monk
Link to comment
Share on other sites

16 hours ago, Cydonian Monk said:

I didn't see it linked or mentioned in the article (or linked to in another post here on the forums), but the same source has appeared on GitHub, recently scanned:

https://github.com/chrislgarry/Apollo-11

Some absolutely snarky code in there, such as in THE_LUNAR_LANDING.agc:

And more than a few "This should never happen" bits. 

I can't vouch for the accuracy, but in his monumental Apollo 11 KSP-recreation, Bob Fitch has a lot to say about this computer crashing a few times before landing: https://www.youtube.com/watch?v=_4GG_ZyXvJw

Note that this was apparently due to a switch being in the wrong position.  The poor computer simply didn't have the RAM (which wasn't the typical "core" ram but something much lighter.  DRAM had just been invented and way too unproven, and I suspect that SRAM-on-a-chip wasn't ready either).

Link to comment
Share on other sites

29 minutes ago, wumpus said:

Note that this was apparently due to a switch being in the wrong position.  The poor computer simply didn't have the RAM (which wasn't the typical "core" ram but something much lighter).

AGC used Magnetic-Core RAM, though as you say of a lighter build (I don't recall the specific details offhand). I built some of that from scratch way back in the dusty years of the late 90s..... Not to the grade of the AGC core, of course, and nowhere near as many bits.

It's amusing that the next line after "Please crank the silly thing around" is "See if he's lying." (Though I'm not sure if that's really the next line executed... some strange OPs that don't agree with the assembly I know.) Whatever trained-chimpanzee stunt the landing routine was having the astronauts do at that point clearly depended on something being in the right position. 

I'm at work and can't rewatch @Felbourn's video, but I'm assuming this was a different AGC crash and not the 1201/1202 errors? Those would occur no matter what the pilots did, as they were the result of an interface timing design flaw with one of the radar packages. Turning off the radar package in question would've prevented the issue (which would've gone against the checklist procedure!), but it shouldn't have happened in the first place. 

Link to comment
Share on other sites

had has had more that a few good agc related posts. its certainly worth reading.

On 7/8/2016 at 7:43 AM, Cydonian Monk said:

AGC used Magnetic-Core RAM, though as you say of a lighter build (I don't recall the specific details offhand). I built some of that from scratch way back in the dusty years of the late 90s..... Not to the grade of the AGC core, of course, and nowhere near as many bits.

It's amusing that the next line after "Please crank the silly thing around" is "See if he's lying." (Though I'm not sure if that's really the next line executed... some strange OPs that don't agree with the assembly I know.) Whatever trained-chimpanzee stunt the landing routine was having the astronauts do at that point clearly depended on something being in the right position. 

I'm at work and can't rewatch @Felbourn's video, but I'm assuming this was a different AGC crash and not the 1201/1202 errors? Those would occur no matter what the pilots did, as they were the result of an interface timing design flaw with one of the radar packages. Turning off the radar package in question would've prevented the issue (which would've gone against the checklist procedure!), but it shouldn't have happened in the first place. 

core ram. the rom was core rope memory, sometimes called lol memory, because it was woven together one bit at a time by little old ladies.

Link to comment
Share on other sites

10 hours ago, Nuke said:

had has had more that a few good agc related posts. its certainly worth reading.

core ram. the rom was core rope memory, sometimes called lol memory, because it was woven together one bit at a time by little old ladies.

Regular core ram was woven a bit at a time the same way.  Not sure why rope core was so much lighter.

Link to comment
Share on other sites

2 hours ago, Diche Bach said:

What language is that most like? Assembly?

It's an assembly language of some sort (dubbed AGC Assembly by the team), but I'm not familiar enough with early assembly or this project in particular to know if it's any specific variation of Assembly or something the team at MIT cooked up from scratch. (I suspect this was all developed from scratch.) It reads a bit like some of the custom peripheral assembly I've seen over the years. 

Edit: Part of the reason I suspect this was mostly developed from scratch is the team would also need to write the "assembly instructions" for how to turn their higher-level AGC code into specific physical windings in the core ROM. That's easier to do (and validate (and verify)) if you control everything. Logically there's only one real way to skin any specific cat. 

Edited by Cydonian Monk
Link to comment
Share on other sites

3 minutes ago, Diche Bach said:

My mentor tells me that C++ somehow gets turned into that stuff . . . 

I have no idea what your development environment is, but in Linux/UNIX you can use a debugging tool to work backwards from the compiled binaries to assembly code. You can write a simple C++ program, compile it, then disassemble it to see how the C++ gets interpreted. Good way to "feel around" the code if you're interested in assembly at all. 

(My debugger of choice is 'gdb' which uses the 'disassemble' command to break down individual functions.)

Link to comment
Share on other sites

no longer coding here since more than 25 years "life is strange® brought me on some others stuff"... but 25 years ago i was using hexa ... mostly solve everithing ... while it's a bit painfull to read ...

Edited by WinkAllKerb''
Link to comment
Share on other sites

4 minutes ago, Cydonian Monk said:

I have no idea what your development environment is, but in Linux/UNIX you can use a debugging tool to work backwards from the compiled binaries to assembly code. You can write a simple C++ program, compile it, then disassemble it to see how the C++ gets interpreted. Good way to "feel around" the code if you're interested in assembly at all. 

(My debugger of choice is 'gdb' which uses the 'disassemble' command to break down individual functions.)

Good to know. When you say "debugger" is this something that goes beyond the "D" part of IDE in say, Visual Studio 2015?

I've been on a procrastination binge since end of spring semester, but I need to break the cycle and get back to working on the elementary data structures stuff he is walking me through.

Link to comment
Share on other sites

9 minutes ago, Diche Bach said:

When you say "debugger" is this something that goes beyond the "D" part of IDE in say, Visual Studio 2015?

Yes and no. Most of the debuggers in IDEs will abstract the code that's being executed back to the original source and skip all of the Assembly level stuff. Yet if they have a debugger they will have some method of diassembling compiled code. I've not used the Visual Studio debuggers, but I'd imagine they have a way to also show disassembled code... might require some digging to find it. (Because Borland Turbo Pascal had it in 1995, so surely 20 years later the best-in-class IDE must also.... May be a bad assumption on my part.)

 

And debugging the AGC was easy: They would eject the ROM card in question, pull out the moth that was stuck inside, and then reinsert it. :P

Edited by Cydonian Monk
Link to comment
Share on other sites

I bet you're right! Much like all Microsoft productivity applications, the layers of functionality are thick and what is under the surface can easily be ignored. I've found the most intimidating thing about programming, is the tremendous number of switches, toggles, bells and whistles in the IDE! But once you figure out how to do some basics, you can always keep adding small additional bits! I even found a user-made package that is a prototype to compile Java in Visual Studio, but I think it is incomplete as yet.

Link to comment
Share on other sites

6 hours ago, Diche Bach said:

My mentor tells me that C++ somehow gets turned into that stuff . . . I think I'll just keep focusing on the C++ and/or Java part(s) for right now :wink:

asm is really just machine code thats been formatted for human readability. this is why every architecture has its own flavor of asm.

Edited by Nuke
Link to comment
Share on other sites

An assembly is, in fact, a language with syntax and mnemonics. The Assembler translates the human readable text into object code. It's closer to the hardware then c but it keeps programmers from calculating addresses or jumps on their own.

Assembler is fast enough for most time critical applications (microcontrollers in everything) and the programs are small without any overhead (not the biggest factor today). Some processor may have specific instruction sets.

I can't assemble, though it could be fun to learn it.

btw: the Microsoft assembler is still maintained i read, and of course linuxers could use the assembler of the gcc-family.

https://en.wikibooks.org/wiki/X86_Assembly

 

Link to comment
Share on other sites

19 hours ago, Cydonian Monk said:

It's an assembly language of some sort (dubbed AGC Assembly by the team), but I'm not familiar enough with early assembly or this project in particular to know if it's any specific variation of Assembly or something the team at MIT cooked up from scratch.

It's an AGC specific instruction set. Composed in-house, and almost certainly heavily influenced by the fact that an AGC instruction word used only 3 bits for the opcode (although the Block 1 architecture did some weird tricks to run with 11 instructions instead of 8).

The full instruction set, interrupts, registers and IO channels is listed online. But I really like that whole book, The Apollo Guidance Computer: Architecture and Operation by Frank O'Brien, for an accessible and thorough walk through of the hardware and software of the AGC. It's a great way to add context to the source code.

Edited by stibbons
Link to comment
Share on other sites

6 hours ago, Green Baron said:

An assembly is, in fact, a language with syntax and mnemonics. The Assembler translates the human readable text into object code. It's closer to the hardware then c but it keeps programmers from calculating addresses or jumps on their own.

Assembler is fast enough for most time critical applications (microcontrollers in everything) and the programs are small without any overhead (not the biggest factor today). Some processor may have specific instruction sets.

I can't assemble, though it could be fun to learn it.

btw: the Microsoft assembler is still maintained i read, and of course linuxers could use the assembler of the gcc-family.

https://en.wikibooks.org/wiki/X86_Assembly

 

Remember learning assembly back in the 1980s, used it a few times too to write to the vga card, this was just an small fragment of the code. 
Far less used today as cpu are far faster and we have much more memory, it also has low portability 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...