Source Code
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
033218,000002: ## Copyright: Public domain.
033219,000003: ## Filename: THE_LUNAR_LANDING.agc
033220,000004: ## Purpose: A section of Luminary 1C, revision 131.
033221,000005: ## It is part of the source code for the Lunar Module's (LM)
033222,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
033223,000007: ## This file is intended to be a faithful transcription, except
033224,000008: ## that the code format has been changed to conform to the
033225,000009: ## requirements of the yaYUL assembler rather than the
033226,000010: ## original YUL assembler.
033227,000011: ## Reference: pp. 780-787
033228,000012: ## Contact: Ron Burkey <info@sandroid.org>.
033229,000013: ## Website: www.ibiblio.org/apollo/index.html
033230,000014: ## Mod history: 05/25/03 RSB. Began transcribing.
033231,000015: ## 05/14/05 RSB Corrected website reference above.
033232,000016: ## 2017-01-06 RSB Page numbers now agree with those on the
033233,000017: ## original hardcopy, as opposed to the PDF page
033234,000018: ## numbers in 1701.pdf.
033235,000019: ## 2017-02-25 RSB Proofed comment text using octopus/ProoferComments.
033236,000020: ## 2017-03-01 RSB Fixed lingering typos.
033237,000021: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
033238,000022: ## 2017-03-16 RSB Comment-text fixes identified in 5-way
033239,000023: ## side-by-side diff of Luminary 69/99/116/131/210.
033240,000024:
Page 780 |
033242,000026: 32,3000 BANK 32
033243,000027: 32,2000 SETLOC F2DPS*32
033244,000028: 32,2000 BANK
033245,000029:
033246,000030: 32,3000 E7,1621 EBANK= E2DPS
033247,000031:
033248,000032: # ****************************************
033249,000033: # P63: THE LUNAR LANDING, BRAKING PHASE
033250,000034: # ****************************************
033251,000035:
033252,000036: 32,3000 COUNT* $$/P63
033253,000037:
033254,000038: 32,3000 05353 P63LM TC PHASCHNG
033255,000039: 32,3001 04024 OCT 04024
033256,000040:
033257,000041: 32,3002 04616 TC BANKCALL # DO IMU STATUS CHECK ROUTINE R02
033258,000042: 32,3003 11233 CADR R02BOTH
033259,000043:
033260,000044: 32,3004 33255 CAF P63ADRES # INITIALIZE WHICH FOR BURNBABY
033261,000045: 32,3005 55455 TS WHICH
033262,000046:
033263,000047: 32,3006 32000 CAF DPSTHRSH # INITIALIZE DVMON
033264,000048: 32,3007 55250 TS DVTHRUSH
033265,000049: 32,3010 34751 CAF FOUR
033266,000050: 32,3011 55515 TS DVCNTR
033267,000051:
033268,000052: 32,3012 44753 CS ONE # INITIALIZE WCHPHASE AND FLPASSO
033269,000053: 32,3013 55346 TS WCHPHASE
033270,000054:
033271,000055: 32,3014 34755 CA ZERO
033272,000056: 32,3015 55623 TS FLPASS0
033273,000057:
033274,000058: 32,3016 44736 CS BIT14
033275,000059: 32,3017 00006 EXTEND
033276,000060: 32,3020 03012 WAND CHAN12 # REMOVE TRACK-ENABLE DISCRETE.
033277,000061:
033278,000062: 32,3021 06042 FLAGORGY TC INTPRET # DIONYSIAN FLAG WAVING
033279,000063: 32,3022 43014 CLEAR CLEAR
033280,000064: 32,3023 02663 NOTHROTL
033281,000065: 32,3024 03271 REDFLAG
033282,000066: 32,3025 43014 CLEAR SET
033283,000067: 32,3026 05660 LRBYPASS
033284,000068: 32,3027 03067 MUNFLAG
033285,000069: 32,3030 43014 CLEAR CLEAR
033286,000070: 32,3031 00266 P25FLAG # TERMINATE P25 IF IT IS RUNNING.
033287,000071: 32,3032 00270 RNDVZFLG # TERMINATE P20 IF IT IS RUNNING
033288,000072:
033289,000073: # ****************************************
033290,000074:
033291,000075: 32,3033 77201 IGNALG SETPD VLOAD # FIRST SET UP INPUTS FOR RP-TO-R:-
Page 781 |
033293,000077: 32,3034 00001 0 # AT 0D LANDING SITE IN MOON FIXED FRAME
033294,000078: 32,3035 02023 RLS # AT 6D ESTIMATED TIME OF LANDING
033295,000079: 32,3036 41525 PDDL PUSH # MPAC NON-ZERO TO INDICATE LUNAR CASE
033296,000080: 32,3037 02401 TLAND
033297,000081: 32,3040 37625 STCALL TPIP # ALSO SET TPIP FOR FIRST GUIDANCE PASS
033298,000082: 32,3041 55716 RP-TO-R
033299,000083: 32,3042 64312 VSL4 MXV
033300,000084: 32,3043 01734 REFSMMAT
033301,000085: 32,3044 37635 STCALL LAND
033302,000086: 32,3045 71343 GUIDINIT # GUIDINIT INITIALIZES WM AND /LAND/
033303,000087: 32,3046 45345 DLOAD DSU
033304,000088: 32,3047 02401 TLAND
033305,000089: 32,3050 25262 GUIDDURN
033306,000090: 32,3051 34041 STCALL TDEC1 # INTEGRATE STATE FORWARD TO THAT TIME
033307,000091: 32,3052 27056 LEMPREC
033308,000092: 32,3053 77331 SSP VLOAD
033309,000093: 32,3054 03647 NIGNLOOP
033310,000094: 32,3055 00050 40D
033311,000095: 32,3056 06522 UNITX
033312,000096: 32,3057 26575 STOVL CG
033313,000097: 32,3060 06520 UNITY
033314,000098: 32,3061 26603 STOVL CG +6
033315,000099: 32,3062 06516 UNITZ
033316,000100: 32,3063 16611 STODL CG +14
033317,000101: 32,3064 25260 99999CON
033318,000102: 32,3065 27665 STOVL DELTAH # INITIALIZE DELTAH FOR V16N68 DISPLAY
033319,000103: 32,3066 06524 ZEROVECS
033320,000104: 32,3067 17253 STODL UNFC/2 # INITIALIZE TRIM VELOCITY CORRECTION TERM
033321,000105: 32,3070 06524 HI6ZEROS
033322,000106: 32,3071 03643 STORE TTF/8
033323,000107:
033324,000108: 32,3072 77745 IGNALOOP DLOAD
033325,000109: 32,3073 00015 TAT
033326,000110: 32,3074 27561 STOVL PIPTIME1
033327,000111: 32,3075 00017 RATT1
033328,000112: 32,3076 64312 VSL4 MXV
033329,000113: 32,3077 01734 REFSMMAT
033330,000114: 32,3100 37521 STCALL R
033331,000115: 32,3101 67067 MUNGRAV
033332,000116: 32,3102 35236 STCALL GDT/2
033333,000117: 32,3103 62415 ?GUIDSUB # WHICH DELIVERS N PASSES OF GUIDANCE
033334,000118:
033335,000119: # DDUMCALC IS PROGRAMMED AS FOLLOWS:-
033336,000120: # 2 -
033337,000121: # (RIGNZ - RGU )/16 + 16(RGU )KIGNY/B8 + (RGU - RIGNX)KIGNX/B4 + (ABVAL(VGU) - VIGN)KIGNV/B4
033338,000122: # 2 1 0
033339,000123: # DDUM = -------------------------------------------------------------------------------------------
033340,000124: # 10
033341,000125: # 2 (VGU - 16 VGU KIGNX/B4)
Page 782 |
033343,000127: # 2 0
033344,000128: # THE NUMERATOR IS SCALED IN METERS AT 2(28). THE DENOMINATOR IS A VELOCITY IN UNITS OF 2(10) M/CS.
033345,000129: # THE QUOTIENT IS THUS A TIME IN UNITS OF 2(18) CENTISECONDS. THE FINAL SHIFT RESCALES TO UNITS OF 2(28) CS.
033346,000130: # THERE IS NO DAMPING FACTOR. THE CONSTANTS KIGNX/B4, KIGNY/B8 AND KIGNV/B4 ARE ALL NEGATIVE IN SIGN.
033347,000131:
033348,000132: 32,3104 55646 DDUMCALC TS NIGNLOOP
033349,000133: 32,3105 06042 TC INTPRET
033350,000134: 32,3106 57345 DLOAD DMPR # FORM DENOMINATOR FIRST
033351,000135: 32,3107 03627 VGU
033352,000136: 32,3110 02501 KIGNX/B4
033353,000137: 32,3111 44232 SL4R BDSU
033354,000138: 32,3112 03633 VGU +4
033355,000139: 32,3113 45325 PDDL DSU
033356,000140: 32,3114 02477 RIGNZ
033357,000141: 32,3115 02633 RGU +4
033358,000142: 32,3116 65222 SR4R PDDL
033359,000143: 32,3117 02631 RGU +2
033360,000144: 32,3120 57316 DSQ DMPR
033361,000145: 32,3121 02503 KIGNY/B8
033362,000146: 32,3122 65232 SL4R PDDL
033363,000147: 32,3123 02627 RGU
033364,000148: 32,3124 57225 DSU DMPR
033365,000149: 32,3125 02475 RIGNX
033366,000150: 32,3126 02501 KIGNX/B4
033367,000151: 32,3127 51515 PDVL ABVAL
033368,000152: 32,3130 03627 VGU
033369,000153: 32,3131 57225 DSU DMPR
033370,000154: 32,3132 02473 VIGN
033371,000155: 32,3133 02505 KIGNV/B4
033372,000156: 32,3134 43215 DAD DAD
033373,000157: 32,3135 56215 DAD DDV
033374,000158: 32,3136 77661 SRR
033375,000159: 32,3137 21613 10D
033376,000160:
033377,000161: 32,3140 43206 PUSH DAD
033378,000162: 32,3141 03561 PIPTIME1
033379,000163: 32,3142 14041 STODL TDEC1 # STORE NEW GUESS FOR NEXT INTEGRATION
033380,000164: 32,3143 45246 ABS DSU
033381,000165: 32,3144 25264 DDUMCRIT
033382,000166: 32,3145 45040 BMN CALL
033383,000167: 32,3146 65165 DDUMGOOD
033384,000168: 32,3147 27410 INTSTALL
033385,000169: 32,3150 43014 SET SET
033386,000170: 32,3151 01473 INTYPFLG
033387,000171: 32,3152 00063 MOONFLAG
033388,000172: 32,3153 77745 DLOAD
033389,000173: 32,3154 03561 PIPTIME1
033390,000174: 32,3155 25517 STOVL TET # HOPEFULLY ?GUIDSUB DID NOT
033391,000175: 32,3156 00017 RATT1 # CLOBBER RATT1 AND VATT1
Page 783 |
033393,000177: 32,3157 25535 STOVL RCV
033394,000178: 32,3160 00025 VATT1
033395,000179: 32,3161 35543 STCALL VCV
033396,000180: 32,3162 27106 INTEGRVS
033397,000181: 32,3163 77650 GOTO
033398,000182: 32,3164 65072 IGNALOOP
033399,000183:
033400,000184: 32,3165 54335 DDUMGOOD SLOAD SR
033401,000185: 32,3166 03423 ZOOMTIME
033402,000186: 32,3167 20617 14D
033403,000187: 32,3170 77621 BDSU
033404,000188: 32,3171 00041 TDEC1
033405,000189: 32,3172 27442 STOVL TIG # COMPUTE DISTANCE LANDING SITE WILL BE
033406,000190: 32,3173 03527 V # OUT OF LM'S ORBITAL PLANE AT IGNITION:
033407,000191: 32,3174 53435 VXV UNIT # SIGN IS + IF LANDING SITE IS TO THE
033408,000192: 32,3175 03521 R # RIGHT, NORTH; - IF TO THE LEFT, SOUTH.
033409,000193: 32,3176 72441 DOT SL1
033410,000194: 32,3177 03635 LAND
033411,000195: 32,3200 26617 R60INIT STOVL OUTOFPLN # INITIALIZATION FOR CALCMANU
033412,000196: 32,3201 03253 UNFC/2
033413,000197: 32,3202 02621 STORE R60VSAVE # STORE UNFC/2 TEMPORARILY IN R60SAVE
033414,000198: 32,3203 77776 EXIT
033415,000199: # ****************************************
033416,000200:
033417,000201: 32,3204 05353 IGNALGRT TC PHASCHNG # PREVENT REPEATING IGNALG
033418,000202: 32,3205 04024 OCT 04024
033419,000203:
033420,000204: 32,3206 44362 ASTNCLOK CS ASTNDEX
033421,000205: 32,3207 04616 TC BANKCALL
033422,000206: 32,3210 74670 CADR STCLOK2
033423,000207: 32,3211 15155 TCF ENDOFJOB # RETURN IN NEW JOB AND IN EBANK FIVE
033424,000208:
033425,000209: 32,3212 06042 ASTNRET TC INTPRET
033426,000210: 32,3213 47131 SSP RTB # GO PICK UP DISPLAY AT END OF R51:
033427,000211: 32,3214 02747 QMAJ # "PROCEED" WILL DO A FINE ALIGNMENT
033428,000212: 32,3215 65217 FCADR P63SPOT2 # "ENTER" WILL RETURN TO P63SPOT2
033429,000213: 32,3216 31127 R51P63
033430,000214: 32,3217 53575 P63SPOT2 VLOAD UNIT # INITIALIZE KALCMANU FOR BURN ATTITUDE
033431,000215: 32,3220 02621 R60VSAVE
033432,000216: 32,3221 27773 STOVL POINTVSM
033433,000217: 32,3222 06522 UNITX
033434,000218: 32,3223 03765 STORE SCAXIS
033435,000219: 32,3224 77776 EXIT
033436,000220:
033437,000221: 32,3225 35016 CAF EBANK7
033438,000222: 32,3226 54003 TS EBANK
033439,000223:
033440,000224: 32,3227 00004 INHINT
033441,000225: 32,3230 04674 TC IBNKCALL
033442,000226: 32,3231 40143 CADR PFLITEDB
Page 784 |
033444,000228: 32,3232 00003 RELINT
033445,000229:
033446,000230: 32,3233 04616 TC BANKCALL
033447,000231: 32,3234 54123 CADR R60LEM
033448,000232:
033449,000233: 32,3235 05353 TC PHASCHNG # PREVENT RECALLING R60
033450,000234: 32,3236 04024 OCT 04024
033451,000235:
033452,000236: 32,3237 34746 P63SPOT3 CA BIT6 # IS THE LR ANTENNA IN POSITION 1 YET
033453,000237: 32,3240 00006 EXTEND
033454,000238: 32,3241 02033 RAND CHAN33
033455,000239: 32,3242 00006 EXTEND
033456,000240: 32,3243 13251 BZF P63SPOT4 # BRANCH IF ANTENNA ALREADY IN POSITION 1
033457,000241:
033458,000242: 32,3244 33256 CAF CODE500 # ASTRONAUT: PLEASE CRANK THE
033459,000243: 32,3245 04616 TC BANKCALL # SILLY THING AROUND
033460,000244: 32,3246 20624 CADR GOPERF1
033461,000245: 32,3247 16001 TCF GOTOPOOH # TERMINATE
033462,000246: 32,3250 13237 TCF P63SPOT3 # PROCEED SEE IF HE'S LYING
033463,000247:
033464,000248: 32,3251 04616 P63SPOT4 TC BANKCALL # ENTER INITIALIZE LANDING RADAR
033465,000249: 32,3252 67701 CADR SETPOS1
033466,000250:
033467,000251: 32,3253 04635 TC POSTJUMP # OFF TO SEE THE WIZARD ...
033468,000252: 32,3254 74130 CADR BURNBABY
033469,000253:
033470,000254: # ----------------------------------------
033471,000255:
033472,000256: # CONSTANTS FOR P63LM AND IGNALG
033473,000257:
033474,000258: 32,3255 02100 P63ADRES GENADR P63TABLE
033475,000259:
033476,000260: 32,3256 4362 ASTNDEX = MD1 # OCT 25; INDEX FOR CLOKTASK
033477,000261:
033478,000262: 32,3256 00500 CODE500 OCT 00500
033479,000263:
033480,000264: 32,3257 00035 30373 99999CON 2DEC 30479.7 B-24
033481,000265:
033482,000266: 32,3261 00004 01610 GUIDDURN 2DEC +66440 B-28 # GUIDDURN +6.64400314 E+2
033483,000267: 32,3263 00000 00010 DDUMCRIT 2DEC +8 B-28 # CRITERION FOR IGNALG CONVERGENCE
033484,000268:
Page 785 |
033486,000270: # ----------------------------------------
033487,000271:
Page 786 |
033489,000273: # ****************************************
033490,000274: # P68: LANDING CONFIRMATION
033491,000275: # ****************************************
033492,000276:
033493,000277: 34,3271 BANK 34
033494,000278: 34,2000 SETLOC F2DPS*34
033495,000279: 34,2000 BANK
033496,000280:
033497,000281: 34,3271 COUNT* $$/P6567
033498,000282:
033499,000283: 34,3271 05353 LANDJUNK TC PHASCHNG
033500,000284: 34,3272 04024 OCT 04024
033501,000285:
033502,000286: 34,3273 00004 INHINT
033503,000287: 34,3274 04616 TC BANKCALL # ZERO ATTITUDE ERROR
033504,000288: 34,3275 40154 CADR ZATTEROR
033505,000289:
033506,000290: 34,3276 06042 TC INTPRET # TO INTERPRETIVE AS TIME IS NOT CRITICAL
033507,000291: 34,3277 77614 SET # PREVENT RCS JET FIRINGS IF MODE CONT IS
033508,000292: 34,3300 06460 PULSEFLG # IN ATT HOLD
033509,000293: 34,3301 43014 SET CLEAR
033510,000294: 34,3302 04067 SURFFLAG
033511,000295: 34,3303 04666 LETABORT
033512,000296: 34,3304 77214 SET VLOAD
033513,000297: 34,3305 05062 APSFLAG
033514,000298: 34,3306 01220 RN
033515,000299: 34,3307 16032 STODL ALPHAV
033516,000300: 34,3310 01234 PIPTIME
033517,000301: 34,3311 45014 SET CALL
033518,000302: 34,3312 01463 LUNAFLAG
033519,000303: 34,3313 26347 LAT-LONG
033520,000304: 34,3314 77201 SETPD VLOAD # COMPUTE RLS AND STORE IT AWAY
033521,000305: 34,3315 00001 0
033522,000306: 34,3316 01220 RN
033523,000307: 34,3317 65352 VSL2 PDDL
033524,000308: 34,3320 01234 PIPTIME
033525,000309: 34,3321 45006 PUSH CALL
033526,000310: 34,3322 51700 R-TO-RP
033527,000311: 34,3323 02023 STORE RLS
033528,000312: 34,3324 77776 EXIT
033529,000313: 34,3325 33342 CAF V06N43* # ASTRONAUT: NOW LOOK WHERE YOU ENDED UP
033530,000314: 34,3326 04616 TC BANKCALL
033531,000315: 34,3327 20477 CADR GOFLASH
033532,000316: 34,3330 16001 TCF GOTOPOOH # TERMINATE
033533,000317: 34,3331 13333 TCF +2 # PROCEED
033534,000318: 34,3332 13325 TCF -5 # RECYCLE
033535,000319:
033536,000320: 34,3333 06042 TC INTPRET
033537,000321: 34,3334 77775 VLOAD # INITIALIZE GSAV AND (USING REFMF)
Page 787 |
033539,000323: 34,3335 06522 UNITX # YNBSAV, ZNBSAV AND ATTFLAG FOR P57
033540,000324: 34,3336 36231 STCALL GSAV
033541,000325: 34,3337 33471 REFMF
033542,000326: 34,3340 77776 EXIT
033543,000327:
033544,000328: 34,3341 16001 TCF GOTOPOOH # ASTRONAUT: PLEASE SELECT P57
033545,000329:
033546,000330: 34,3342 01453 V06N43* VN 0643
033547,000331:
End of include-file THE_LUNAR_LANDING.agc. Parent file is MAIN.agc