Source Code
These source-code files derive from a printout of Luminary 116 (the Apollo 12
Lunar Module guidance computer program), from the personal library of
original AGC developer Don Eyles, digitally photographed at archive.org,
financially sponsored by Ron Burkey, and transcribed to source code by a
team of volunteers. This colorized, syntax-highlighted form was created
by assembling that transcribed source code. Note that the full page images
are available on the
Virtual AGC project page at archive.org, while reduced-size images
are presented at the VirtualAGC project website. Report or fix any
transcription errors at
the Virtual AGC project code repository. Notations on the program listing read, in part: GAP: ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071 19:09 AUG. 11,1969Note that the date is the date of the printout, not the date of the program revision. |
033260,000002: ## Copyright: Public domain.
033261,000003: ## Filename: THE_LUNAR_LANDING.agc
033262,000004: ## Purpose: A section of Luminary revision 116.
033263,000005: ## It is part of the source code for the Lunar Module's (LM)
033264,000006: ## Apollo Guidance Computer (AGC) for Apollo 12.
033265,000007: ## This file is intended to be a faithful transcription, except
033266,000008: ## that the code format has been changed to conform to the
033267,000009: ## requirements of the yaYUL assembler rather than the
033268,000010: ## original YUL assembler.
033269,000011: ## Reference: pp. 778-785
033270,000012: ## Assembler: yaYUL
033271,000013: ## Contact: Ron Burkey <info@sandroid.org>.
033272,000014: ## Website: www.ibiblio.org/apollo/index.html
033273,000015: ## Mod history: 2017-01-22 MAS Created from Luminary 99.
033274,000016: ## 2017-03-10 HG Transcribed
033275,000017: ## 2017-03-14 RSB Proofed comment text via 3-way diff vs
033276,000018: ## Luminary 99 and 131.
033277,000019: ## 2017-03-16 RSB Comment-text fixes identified in 5-way
033278,000020: ## side-by-side diff of Luminary 69/99/116/131/210.
033279,000021: ## 2017-03-19 HG Fix SELOC operand F2DPS*31 --> F2DPS*34
033280,000022:
Page 778 |
033282,000024: 32,2777 BANK 32
033283,000025: 32,2000 SETLOC F2DPS*32
033284,000026: 32,2000 BANK
033285,000027:
033286,000028: 32,2777 E7,1621 EBANK= E2DPS
033287,000029:
033288,000030: # ****************************************
033289,000031: # P63: THE LUNAR LANDING, BRAKING PHASE
033290,000032: # ****************************************
033291,000033:
033292,000034: 32,2777 COUNT* $$/P63
033293,000035:
033294,000036: 32,2777 05353 P63LM TC PHASCHNG
033295,000037: 32,3000 04024 OCT 04024
Note: The above label (P63LM) has a box in blue pen drawn arround it The two statements above are circled with a blue pen arround them |
033298,000040:
033299,000041: 32,3001 04616 TC BANKCALL # DO IMU STATUS CHECK ROUTINE R02
033300,000042: 32,3002 11236 CADR R02BOTH
033301,000043:
033302,000044: 32,3003 33254 CAF P63ADRES # INITIALIZE WHICH FOR BURNBABY
033303,000045: 32,3004 55455 TS WHICH
033304,000046:
033305,000047: 32,3005 32000 CAF DPSTHRSH # INITIALIZE DVMON
033306,000048: 32,3006 55250 TS DVTHRUSH
033307,000049: 32,3007 34751 CAF FOUR
033308,000050: 32,3010 55515 TS DVCNTR
033309,000051:
033310,000052: 32,3011 44753 CS ONE # INITIALIZE WCHPHASE AND FLPASSO
033311,000053: 32,3012 55346 TS WCHPHASE
033312,000054:
033313,000055: 32,3013 34755 CA ZERO
033314,000056: 32,3014 55623 TS FLPASS0
033315,000057:
033316,000058: 32,3015 44736 CS BIT14
033317,000059: 32,3016 00006 EXTEND
033318,000060: 32,3017 03012 WAND CHAN12 # REMOVE TRACK-ENABLE DISCRETE.
033319,000061:
033320,000062: 32,3020 06042 FLAGORGY TC INTPRET # DIONYSIAN FLAG WAVING
033321,000063: 32,3021 43014 CLEAR CLEAR
033322,000064: 32,3022 02663 NOTHROTL
033323,000065: 32,3023 03271 REDFLAG
033324,000066: 32,3024 43014 CLEAR SET
033325,000067: 32,3025 05660 LRBYPASS
033326,000068: 32,3026 03067 MUNFLAG
033327,000069: 32,3027 43014 CLEAR CLEAR
033328,000070: 32,3030 00266 P25FLAG # TERMINATE P25 IF IT IS RUNNING.
033329,000071: 32,3031 00270 RNDVZFLG # TERMINATE P20 IF IT IS RUNNING
033330,000072:
033331,000073: # ****************************************
033332,000074:
033333,000075: 32,3032 77201 IGNALG SETPD VLOAD # FIRST SET UP INPUTS FOR RP-TO-R:-
033334,000076:
Page 779 |
033336,000078: 32,3033 00001 0 # AT 0D LANDING SITE IN MOON FIXED FRAME
033337,000079: 32,3034 02023 RLS # AT 6D ESTIMATED TIME OF LANDING
033338,000080: 32,3035 41525 PDDL PUSH # MPAC NON-ZERO TO INDICATE LUNAR CASE
033339,000081: 32,3036 02401 TLAND
033340,000082: 32,3037 37625 STCALL TPIP # ALSO SET TPIP FOR FIRST GUIDANCE PASS
033341,000083: 32,3040 55716 RP-TO-R
033342,000084: 32,3041 64312 VSL4 MXV
033343,000085: 32,3042 01734 REFSMMAT
033344,000086: 32,3043 37635 STCALL LAND
033345,000087: 32,3044 71343 GUIDINIT # GUIDINIT INITIALIZES WM AND /LAND/
033346,000088: 32,3045 45345 DLOAD DSU
033347,000089: 32,3046 02401 TLAND
033348,000090: 32,3047 25261 GUIDDURN
033349,000091: 32,3050 34041 STCALL TDEC1 # INTEGRATE STATE FORWARD TO THAT TIME
033350,000092: 32,3051 27060 LEMPREC
033351,000093: 32,3052 77331 SSP VLOAD
033352,000094: 32,3053 03647 NIGNLOOP
033353,000095: 32,3054 00050 40D
033354,000096: 32,3055 06522 UNITX
033355,000097: 32,3056 26575 STOVL CG
033356,000098: 32,3057 06520 UNITY
033357,000099: 32,3060 26603 STOVL CG +6
033358,000100: 32,3061 06516 UNITZ
033359,000101: 32,3062 16611 STODL CG +14
033360,000102: 32,3063 25257 99999CON
033361,000103: 32,3064 27665 STOVL DELTAH # INITIALIZE DELTAH FOR V16N68 DISPLAY
033362,000104: 32,3065 06524 ZEROVECS
033363,000105: 32,3066 17254 STODL UNFC/2 # INITIALIZE TRIM VELOCITY CORRECTION TERM
033364,000106: 32,3067 06524 HI6ZEROS
033365,000107: 32,3070 03643 STORE TTF/8
033366,000108:
033367,000109: 32,3071 77745 IGNALOOP DLOAD
033368,000110: 32,3072 00015 TAT
033369,000111: 32,3073 27561 STOVL PIPTIME1
033370,000112: 32,3074 00017 RATT1
033371,000113: 32,3075 64312 VSL4 MXV
033372,000114: 32,3076 01734 REFSMMAT
033373,000115: 32,3077 37521 STCALL R
033374,000116: 32,3100 67067 MUNGRAV
033375,000117: 32,3101 35236 STCALL GDT/2
033376,000118: 32,3102 62402 ?GUIDSUB # WHICH DELIVERS N PASSES OF GUIDANCE
033377,000119:
033378,000120: # DDUMCALC IS PROGRAMMED AS FOLLOWS:-
033379,000121:
033380,000122: # 2 -
033381,000123: # (RIGNZ - RGU )/16 + 16(RGU )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
033382,000124: # 2 1 0
033383,000125: # DDUM = -------------------------------------------------------------------------------------------
033384,000126: # 10
033385,000127: # 2 (VGU - 16 VGU KIGNX/B4)
033386,000128:
Page 780 |
033388,000130: # 2 0
033389,000131:
033390,000132: # THE NUMERATOR IS SCALED IN METERS AT 2(28). THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10)M/CS.
033391,000133: # THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS. THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
033392,000134: # THERE IS NO DAMPING FACTOR. THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
033393,000135:
033394,000136: 32,3103 55646 DDUMCALC TS NIGNLOOP
033395,000137: 32,3104 06042 TC INTPRET
033396,000138: 32,3105 57345 DLOAD DMPR # FORM DENOMINATOR FIRST
Note: The above operator and operand are separately underlined with a black pen. The corresponding octal opcode in the resulting listing is marked with a box around it in black pen. |
033399,000141: 32,3106 03627 VGU
033400,000142: 32,3107 02501 KIGNX/B4
033401,000143: 32,3110 44232 SL4R BDSU
033402,000144: 32,3111 03633 VGU +4
033403,000145: 32,3112 45325 PDDL DSU
033404,000146: 32,3113 02477 RIGNZ
033405,000147: 32,3114 02633 RGU +4
033406,000148: 32,3115 65222 SR4R PDDL
033407,000149: 32,3116 02631 RGU +2
033408,000150: 32,3117 57316 DSQ DMPR
033409,000151: 32,3120 02503 KIGNY/B8
033410,000152: 32,3121 65232 SL4R PDDL
033411,000153: 32,3122 02627 RGU
033412,000154: 32,3123 57225 DSU DMPR
033413,000155: 32,3124 02475 RIGNX
033414,000156: 32,3125 02501 KIGNX/B4
033415,000157: 32,3126 51515 PDVL ABVAL
033416,000158: 32,3127 03627 VGU
033417,000159: 32,3130 57225 DSU DMPR
033418,000160: 32,3131 02473 VIGN
033419,000161: 32,3132 02505 KIGNV/B4
033420,000162: 32,3133 43215 DAD DAD
033421,000163: 32,3134 56215 DAD DDV
033422,000164: 32,3135 77661 SRR
033423,000165: 32,3136 21613 10D
033424,000166:
033425,000167: 32,3137 43206 PUSH DAD
033426,000168: 32,3140 03561 PIPTIME1
033427,000169: 32,3141 14041 STODL TDEC1 # STORE NEW GUESS FOR NEXT INTEGRATION
033428,000170: 32,3142 45246 ABS DSU
033429,000171: 32,3143 25263 DDUMCRIT
033430,000172: 32,3144 45040 BMN CALL
033431,000173: 32,3145 65164 DDUMGOOD
033432,000174: 32,3146 27412 INTSTALL
033433,000175: 32,3147 43014 SET SET
033434,000176: 32,3150 01473 INTYPFLG
033435,000177: 32,3151 00063 MOONFLAG
033436,000178: 32,3152 77745 DLOAD
033437,000179: 32,3153 03561 PIPTIME1
033438,000180: 32,3154 25517 STOVL TET # HOPEFULLY ?GUIDSUB DID NOT
033439,000181: 32,3155 00017 RATT1 # CLOBBER RATT1 AND VATT1
033440,000182:
Page 781 |
033442,000184: 32,3156 25535 STOVL RCV
033443,000185: 32,3157 00025 VATT1
033444,000186: 32,3160 35543 STCALL VCV
033445,000187: 32,3161 27110 INTEGRVS
033446,000188: 32,3162 77650 GOTO
033447,000189: 32,3163 65071 IGNALOOP
033448,000190:
033449,000191: 32,3164 54335 DDUMGOOD SLOAD SR
033450,000192: 32,3165 03423 ZOOMTIME
033451,000193: 32,3166 20617 14D
033452,000194: 32,3167 77621 BDSU
033453,000195: 32,3170 00041 TDEC1
033454,000196: 32,3171 27442 STOVL TIG # COMPUTE DISTANCE LANDING SITE WILL BE
033455,000197: 32,3172 03527 V # OUT OF LM'S ORBITAL PLANE AT IGNITION:
033456,000198: 32,3173 53435 VXV UNIT # SIGN IS + IF LANDING SITE IS TO THE
033457,000199: 32,3174 03521 R # RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
033458,000200: 32,3175 72441 DOT SL1
033459,000201: 32,3176 03635 LAND
033460,000202: 32,3177 26617 R60INIT STOVL OUTOFPLN # INITIALIZATION FOR CALCMANU
033461,000203: 32,3200 03254 UNFC/2
033462,000204: 32,3201 02621 STORE R60VSAVE # STORE UNFC/2 TEMPORARILY IN R60SAVE
033463,000205: 32,3202 77776 EXIT
033464,000206: # ****************************************
033465,000207:
033466,000208: 32,3203 05353 IGNALGRT TC PHASCHNG # PREVENT REPEATING IGNALG
033467,000209: 32,3204 04024 OCT 04024
033468,000210:
033469,000211: 32,3205 44362 ASTNCLOK CS ASTNDEX
033470,000212: 32,3206 04616 TC BANKCALL
033471,000213: 32,3207 74670 CADR STCLOK2
033472,000214: 32,3210 15155 TCF ENDOFJOB # RETURN IN NEW JOB AND IN EBANK FIVE
033473,000215:
033474,000216: 32,3211 06042 ASTNRET TC INTPRET
033475,000217: 32,3212 47131 SSP RTB # GO PICK UP DISPLAY AT END OF R51:
033476,000218: 32,3213 02747 QMAJ # "PROCEED" WILL DO A FINE ALIGNMENT
033477,000219: 32,3214 65216 FCADR P63SPOT2 # "ENTER" WILL RETURN TO P63SPOT2
033478,000220: 32,3215 31127 R51P63
033479,000221: 32,3216 53575 P63SPOT2 VLOAD UNIT # INITIALIZE KALCMANU FOR BURN ATTITUDE
033480,000222: 32,3217 02621 R60VSAVE
033481,000223: 32,3220 27773 STOVL POINTVSM
033482,000224: 32,3221 06522 UNITX
033483,000225: 32,3222 03765 STORE SCAXIS
033484,000226: 32,3223 77776 EXIT
033485,000227:
033486,000228: 32,3224 35016 CAF EBANK7
033487,000229: 32,3225 54003 TS EBANK
033488,000230:
033489,000231: 32,3226 00004 INHINT
033490,000232: 32,3227 04674 TC IBNKCALL
033491,000233: 32,3230 40143 CADR PFLITEDB
033492,000234:
Page 782 |
033494,000236: 32,3231 00003 RELINT
033495,000237:
033496,000238: 32,3232 04616 TC BANKCALL
033497,000239: 32,3233 54123 CADR R60LEM
033498,000240:
033499,000241: 32,3234 05353 TC PHASCHNG # PREVENT RECALLING R60
033500,000242: 32,3235 04024 OCT 04024
033501,000243:
033502,000244: 32,3236 34746 P63SPOT3 CA BIT6 # IS THE LR ANTENNA IN POSITION 1 YET
033503,000245: 32,3237 00006 EXTEND
033504,000246: 32,3240 02033 RAND CHAN33
033505,000247: 32,3241 00006 EXTEND
033506,000248: 32,3242 13250 BZF P63SPOT4 # BRANCH IF ANTENNA ALREADY IN POSITION 1
033507,000249:
033508,000250: 32,3243 33255 CAF CODE500 # ASTRONAUT: PLEASE CRANK THE
033509,000251: 32,3244 04616 TC BANKCALL # SILLY THING AROUND
033510,000252: 32,3245 20624 CADR GOPERF1
033511,000253: 32,3246 16001 TCF GOTOPOOH # TERMINATE
033512,000254: 32,3247 13236 TCF P63SPOT3 # PROCEED SEE IF HE'S LYING
033513,000255:
033514,000256: 32,3250 04616 P63SPOT4 TC BANKCALL # ENTER INITIALIZE LANDING RADAR
033515,000257: 32,3251 67703 CADR SETPOS1
033516,000258:
033517,000259: 32,3252 04635 TC POSTJUMP # OFF TO SEE THE WIZARD...
033518,000260: 32,3253 74130 CADR BURNBABY
033519,000261:
033520,000262:
033521,000263: # ---------------------------------------
033522,000264:
033523,000265: # CONSTANTS FOR P63LM AND IGNALG
033524,000266:
033525,000267:
033526,000268: 32,3254 02100 P63ADRES GENADR P63TABLE
033527,000269:
033528,000270:
033529,000271: 32,3255 4362 ASTNDEX = MD1 # OCT 25; INDEX FOR CLOKTASK
033530,000272:
033531,000273: 32,3255 00500 CODE500 OCT 00500
033532,000274:
033533,000275:
033534,000276: 32,3256 00035 30373 99999CON 2DEC 30479.7 B-24
033535,000277: 32,3260 00004 01610 GUIDDURN 2DEC +66440 B-28 # GUIDDURN +6.64400314 E+2
033536,000278: 32,3262 00000 00010 DDUMCRIT 2DEC +8 B-28 # CRITERION FOR IGNALG CONVERGENCE
033537,000279:
Page 783 |
033539,000281: # ----------------------------------------
033540,000282:
Page 784 |
033542,000284: # ****************************************
033543,000285: # P68: LANDING CONFIRMATION
033544,000286: # ****************************************
033545,000287:
033546,000288: 34,3271 BANK 34
033547,000289: 34,2000 SETLOC F2DPS*34
033548,000290: 34,2000 BANK
033549,000291:
033550,000292: 34,3271 COUNT* $$/P6567
033551,000293:
033552,000294: 34,3271 05353 LANDJUNK TC PHASCHNG
033553,000295: 34,3272 04024 OCT 04024
033554,000296:
033555,000297: 34,3273 00004 INHINT
033556,000298: 34,3274 04616 TC BANKCALL # ZERO ATTITUDE ERROR
033557,000299: 34,3275 40154 CADR ZATTEROR
033558,000300:
033559,000301: 34,3276 06042 TC INTPRET # TO INTERPRETIVE AS TIME IS NOT CRITICAL
033560,000302: 34,3277 77614 SET # PREVENT RCS JET FIRINGS IF MODE CONT IS
033561,000303: 34,3300 06460 PULSEFLG # IN ATT HOLD
033562,000304: 34,3301 43014 SET CLEAR
033563,000305: 34,3302 04067 SURFFLAG
033564,000306: 34,3303 04666 LETABORT
033565,000307: 34,3304 77214 SET VLOAD
033566,000308: 34,3305 05062 APSFLAG
033567,000309: 34,3306 01220 RN
033568,000310: 34,3307 16032 STODL ALPHAV
033569,000311: 34,3310 01234 PIPTIME
033570,000312: 34,3311 45014 SET CALL
033571,000313: 34,3312 01463 LUNAFLAG
033572,000314: 34,3313 26351 LAT-LONG
033573,000315: 34,3314 77201 SETPD VLOAD # COMPUTE RLS AND STORE IT AWAY
033574,000316: 34,3315 00001 0
033575,000317: 34,3316 01220 RN
033576,000318: 34,3317 65352 VSL2 PDDL
033577,000319: 34,3320 01234 PIPTIME
033578,000320: 34,3321 45006 PUSH CALL
033579,000321: 34,3322 51677 R-TO-RP
033580,000322: 34,3323 02023 STORE RLS
033581,000323: 34,3324 77776 EXIT
033582,000324: 34,3325 33342 CAF V06N43* # ASTRONAUT: NOW LOOK WHERE YOU ENDED UP
033583,000325: 34,3326 04616 TC BANKCALL
033584,000326: 34,3327 20477 CADR GOFLASH
033585,000327: 34,3330 16001 TCF GOTOPOOH # TERMINATE
033586,000328: 34,3331 13333 TCF +2 # PROCEED
033587,000329: 34,3332 13325 TCF -5 # RECYCLE
033588,000330:
033589,000331:
033590,000332: 34,3333 06042 TC INTPRET
033591,000333: 34,3334 77775 VLOAD # INITIALIZE GSAV AND (USING REFMF)
033592,000334:
Page 785 |
033594,000336: 34,3335 06522 UNITX # YNBSAV, ZNBSAV AND ATTFLAG FOR P57
033595,000337: 34,3336 36231 STCALL GSAV
033596,000338: 34,3337 33471 REFMF
033597,000339: 34,3340 77776 EXIT
033598,000340:
033599,000341: 34,3341 16001 TCF GOTOPOOH # ASTRONAUT: PLEASE SELECT P57
033600,000342:
033601,000343:
033602,000344: 34,3342 01453 V06N43* VN 0643
End of include-file THE_LUNAR_LANDING.agc. Parent file is MAIN.agc