Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on slrpnk.net
programmer_humor·Programmer HumorbyRose

Probably the most sweat-inducing user input verification code in history.

This is the code in the Apollo Guidance Computer for Apollo 11.

It's part of the LUMINARY sofware, which ran on the AGC on the Lunar Module. It's meant to check if the landing radar is pointed toward the lunar surface - because the LM went through several orientations, the landing radar could be pointed to the front or the side or down. You're landing on the Moon. Point it down.

Point is, you have to verify user input. Even if your users are the most meticulous and highly trained individuals in history. You have to see if they're lying. So you get to the BURNBABY.

Browse the code in GitHub - this code is in THE_LUNAR_LANDING.agc

View original on slrpnk.net
295

36 replies

midwest.social

I know people hate AI, but I fed the OP pic to Claude and asked it to explain the code and maybe gice modern comparisons to something like Python.


This is AGC (Apollo Guidance Computer) assembly code from the lunar module's landing radar routines. Let me walk through it:


P63SPOT3 — "Is the antenna in position yet?"

CA   BIT6
EXTEND
RAND CHAN33
EXTEND
BZF  P63SPOT4

Reads a hardware channel (CHAN33) to check the state of the landing radar antenna. BZF means "Branch if Zero" — if the antenna bit is already set, skip ahead.

if radar_channel_33 & BIT6 == 0:
    goto("P63SPOT4")

"Nope, not there yet — bug the astronaut"

CAF  CODE500
TC   BANKCALL
CADR GOPERF1

Loads error code 500 and calls GOPERF1 — this triggers a crew alert, literally asking the astronaut to manually crank the antenna into position. The comment says it all: "PLEASE CRANK THE SILLY THING AROUND"

display_alert(code=500, message="Antenna not in position, please fix manually")
await_crew_response()

"Did they fix it or bail?"

TCF  GOTOPOOH  # TERMINATE
TCF  P63SPOT3  # PROCEED — SEE IF HE'S LYING

Two possible outcomes: crew hits terminate (GOTOPOOH — yes, really), or hits proceed and the code loops back to P63SPOT3 to check again. "See if he's lying" is the actual comment, meaning: verify they actually moved it.

if crew_pressed == "terminate":
    goto("GOTOPOOH")
else:
    goto("P63SPOT3")  # trust but verify

P63SPOT4 — "Okay, antenna's good, initialize radar"

TC   BANKCALL
CADR SETPOS1

Calls SETPOS1 to initialize the landing radar into position 1.

bankcall(SETPOS1)  # configure radar for landing approach

"And we're off"

TC   POSTJUMP
CADR BURNBABY

BURNBABY. That's the actual name of the burn routine. Jumps to the powered descent initiation — the engine ignition sequence for landing.

goto("BURNBABY")  # 🔥 start the descent burn

The whole thing is basically: check hardware → nag human if needed → loop until fixed → initialize systems → light the engine. Written by people with a great sense of humor under enormous pressure, in 4KB of RAM.

12

So, Claude was given the explanation on its training data. Not hugely surprising.

0

I know what P00 is, that's program 00 or the root process of the computer. Terminating the subprocess hands control back to P00, which is why the processor is instructed to GOTOP00H (the H might indicate the point where the subrutine was called; presumably because the CPU lacks a hardware-implemented "return from subrutine" instruction)

Strange that the AI did not elaborate on this, that's one of the best known parts of the Apollo software...

4
fedia.io

Sanitizing user input for the Moon landings.

Meanwhile in 2026, ask AI to change an authentication phone number and it says, "Sure thing!" And is ABLE to do it.

65
Bananskalreply
nord.pub

I don't understand what this comment is meant to convey. Could you explain a bit further?

11
ggtdbzreply
lemmy.dbzer0.com

The first one insisted to make sure one of the most competent human beings who ever existed oriented a thing downward in order to not die during a very well-rehearsed procedure.

The second one is a reference to social media companies “outsourcing” support to chatbots with no intelligence and plenty of control, allowing people to prompt said chatbots into giving them other people’s accounts.

9
Bananskalreply
nord.pub

I knew I should've waited until I hadn't just woken up before trying to understand the comment. 😆

4
Rhaedasreply
fedia.io

I'll take the blame, I shortened the statements maybe a bit too much, assuming the references would work. But they were explained well by the other replies.

I was learning in the 90s from lessons on AOL how to sanitize inputs and salt passwords along with HTML 1.0. It baffles me how corporations let stupid things happen now.

4

No worries! Once I got the meaning, the brevity makes it funnier. 😆

Yeah, it's pretty baffling... One of my two life mottos is "hard hard could it be!"

2
Rosereply
slrpnk.net

GOTOPOOH was actually jargon for Program 00 (Hex), which was (I think?) the AGC's normal idle routine.

BURNBABY was an alias for BURN_BABY_BURN which was the lunar descent burn sequence. Or something. I wouldn't have named it that.

41
sp3ctr4lreply
lemmy.dbzer0.com

P00H is hilarious.

Poop.

The end of all food, yet also, the beginning of all food.

Poop is the true neutral ground state from whence all emerges and all returns to.

... genuienly an incredible name for the idle loop, I am in awe.

I did not think Maggie Hamilton could be more legendary, but somehow, she is. Damn.

15
mercanoreply
lemmy.world

It’s also something we left on the moon. Bags and bags of it, along with empty food containers and their moonwalking backpacks. It’s not like it’s worth it to haul it back to orbit.

13

So this is what the Seminal Theory is about. It's not a meteor or some shit that crashed into the earth from far away.

It was just actual shit left behind by visitors. That's us. We're alien shit.

7
sp3ctr4lreply
lemmy.dbzer0.com

I wonder if that shit is something approximating a fossil, currently.

Presumably the radiation would have killed all the fecal bacteria pretty quickly... hell ... would the plastic bags have degraded as well?

5
mercanoreply
lemmy.world

It has been exposed to 336 hours of continuous unfiltered sunlight each lunar day for the past 40+ years. That’s can’t be good for the plastic. The poo is probably dedicated, but I don’t think it’d be fossilized, in the sense of biological material replaced with stone, I don’t think the moon is geologically active enough for that to happen.

9
sp3ctr4lreply
lemmy.dbzer0.com

Is there... a word... for... 'exposed to the void of space for a prolonged period of time'?

Yeah I know fossilized isn't the right word, as thats generally a process that requires water... but i dont know how to say 'space fossilized'.

Dehydrated and Irradiated ... ?

7

i would say, if it's exposed to a vacuum, all the water evaporates, so it becomes extremely dry, like rocks

probably dessicates more than the mummies in egypt.

1
mkwtreply
lemmy.world

I think the poop bags were mainly stowed into lockers on the sides of the descent module. They're not just piled up on the ground.

Edit: Correction. This research suggests that the procedure was to "jettison" the "waste receptacle," containing any sealed poop bags, food wrappers, and other trash. "Jettison" definitely sounds more like tossing stuff out the door.

I also want to point out that maybe 96 bags were provisioned and left. But almost certainly most of those remained empty. Pooping into a bag in the LM in close proximity to your colleague is not an easy or pleasant experience. Astronauts had access to lomotil and they were conditioned on what NASA called a "low residue diet" for the entire duration of the flight and pre-flight quarantine. The early flights were on the surface for less than 24 hours. So there was a lot of opportunity and incentive to just avoid having a bowel movement on the moon.

There's also a radio transcript from Apollo 16 that suggests that, on that flight, this material was transferred off the returning LM back onto CM and presumably returned to Earth.

3

brb, jettisoning my recycling into the mobile external containment vessel, prior to scheduled rendevouz.

1

PLEASE CRANK THE SILLY THING AROUND should not be as hilarious as it is

28

Is this KOS-related?

Edit: nope, a real language, not Kerbal Operating System.

6

For those wondering about a serious answer, TC was Transfer Control (in most modern ISAs it's called JMP/JUMP) and TCF was Transfer Control to a Subroutine (equivalent to JSR/CALL).

2

You reached the end