Margaret Hamilton, NASA’s lead developer for Apollo program, stands next to all the code she wrote by hand that took humanity to the moon in 1969
Margaret Hamilton, NASA’s lead developer for Apollo program, stands next to all the code she wrote by hand that took humanity to the moon in 1969
It’s written in assembly. You can check out the source code on GitHub.
Oh that’s so hardcore
The other big notable thing for assembly is that it isn’t portable. Assembly is very different for every processor architecture, unlike something like C where you may have to make some adjustments between an x86 vs ARM proc, in assembly you’re basically rewriting it from scratch
Also, this is an obscure assembly variant specifically for the computers in the Apollo mission. Not sure about the specifications on that, maybe there is a handbook, but I doubt it.
Rewriting the code to x86 or anything seems improbable since you’d pretty much have to guess what the instructions are actually doing.
For people unfamiliar with assembly, it’s one step up from raw 1s and 0s. Just vaguely human readable abbreviations for given sets of 1s and 0s. There are no built in loops or if statements, you have to build all that shit yourself from scratch every time you want to use one. And there’s exactly one built in variable you can use called the register
Nitpicks:
Assembly is a very significant step above “raw 1s and 0s” as it usually provides ways to conceptualize opcodes, registers, and even memory.
Similarly, there basically ARE “loops” if you understand those are actually conditionals and jump statements. It takes a bit of time to read that but they are there. Same with conditionals/if statements. Any time you see a label (the blurb of text at the start of a line), that is for the purpose of branching/looping/invoking.
Variable wise: I forget how big the register file on those was (I wouldn’t be overly surprised if there really is only one for compute purposes, with the rest being reserved for what would be associated with the OS), but you still have the stack. Which is what is happening in a lot of modern code anyway.
Which is why the comparison to Fortran is pretty apt. Since… early Fortran is very much just a thin layer of paint to help conceptualize writing code in assembly and to have some semblance of portability. Whereas “modern” fortran (definitely 90s, arguably also 77) is just a horribly designed language that is the worst of all worlds.
A lot of the younglings tend to view assembly as hell on earth. And they are right. But mostly because they were taught in the context of more CISC-like architectures or dealing with the hell that is x86 assembly. Often times as an elective or a one week lesson after they spent years doing python. Spend time with simpler (generally RISC) architectures and you rapidly grow to understand why C and Fortran are so “low level” and can get a good understanding of what it means to “code in assembly”… and why nobody should have to anymore.
A friend and I decided, over drinks and gaming, that the best comparison is to watch the obligatory “cooking youtuber makes ramen from scratch” episode. Even they’ll acknowledge it was NOT worth the effort. And it was a LOT of effort. But it is still fundamentally the same as cooking anything else and mostly just boils down to being very labor and time intensive.
Admittedly, the last time I touched real Assembly was 20 years ago.
There’s a couple Zachtronics games, TIS-100 and Shenzhen I/O, both that use a limited form of Assembly, that are probably filling in the gaps in my memory.
I soooo wish IBM had gone with the Motorola 68000 family instead of the Intel 8086 family of chips for the PC. It had a far, far nicer instruction set.