Source Code
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release
of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97.
A bug (which had been around since at least Apollo 10, Luminary 69) was
discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute
revision into Rev 1,
which is what actually flew rather than
the Rev 0 presented here. A hardcopy of Rev 0 is known to
exist — it belonged to AGC developer Allan Klumpp for many years — but
unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus
the code you see here had been reconstructed (we believe accurately) rather than
transcribed. The first step of the reconstruction of the Rev 0 source code was
the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection.
The process of reverting the active portion of the source code (i.e., other than
program comments) from Rev 1 to Rev 0 was very minor, consisting
only of moving the position of the STARTSB1 label in
FRESH START AND RESTART. Allan had previously given
us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums
identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read,
in part:GAP: ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051 A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here. |
054501,000002: ## Copyright: Public domain.
054502,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
054503,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
054504,000005: ## otherwise known as Luminary Rev 99, the third release
054505,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
054506,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
054507,000008: ## placement of a single label. The corrections shown here have
054508,000009: ## been verified to have the same bank checksums as AGC developer
054509,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
054510,000011: ## to be accurate. This file is intended to be a faithful
054511,000012: ## recreation, except that the code format has been changed to
054512,000013: ## conform to the requirements of the yaYUL assembler rather than
054513,000014: ## the original YUL assembler.
054514,000015: ##
054515,000016: ## Assembler: yaYUL
054516,000017: ## Contact: Ron Burkey <info@sandroid.org>.
054517,000018: ## Website: www.ibiblio.org/apollo.
054518,000019: ## Pages: 1249-1258
054519,000020: ## Mod history: 2009-05-26 RSB Adapted from the corresponding
054520,000021: ## Luminary131 file, using page
054521,000022: ## images from Luminary 1A.
054522,000023: ## 2016-12-17 RSB Proofed text comments with octopus/ProoferComments
054523,000024: ## and corrected the errors found.
054524,000025: ## 2017-03-17 RSB Comment-text fixes identified in diff'ing
054525,000026: ## Luminary 99 vs Comanche 55.
054526,000027: ## 2017-08-01 MAS Created from LMY99 Rev 1.
054527,000028:
054528,000029: ## This source code has been transcribed or otherwise adapted from
054529,000030: ## digitized images of a hardcopy from the MIT Museum. The digitization
054530,000031: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
054531,000032: ## the Museum. Many thanks to both. The images (with suitable reduction
054532,000033: ## in storage size and consequent reduction in image quality as well) are
054533,000034: ## available online at www.ibiblio.org/apollo. If for some reason you
054534,000035: ## find that the images are illegible, contact me at info@sandroid.org
054535,000036: ## about getting access to the (much) higher-quality images which Paul
054536,000037: ## actually created.
054537,000038: ##
054538,000039: ## The code has been modified to match LMY99 Revision 0, otherwise
054539,000040: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
054540,000041: ## the listing from which it was transcribed. It has been verified to
054541,000042: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
054542,000043: ## of Luminary Revision 99 (for which we do not have scans).
054543,000044: ##
054544,000045: ## Notations on Allan Klumpp's listing read, in part:
054545,000046: ##
054546,000047: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
054547,000048:
Page 1249 |
054549,000050: 22,3773 BANK 22
054550,000051: 23,2000 SETLOC INFLIGHT
054551,000052: 23,2000 BANK
054552,000053:
054553,000054: 23,3247 E5,1642 EBANK= XSM
054554,000055:
054555,000056: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054556,000057:
054557,000058: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
054558,000059: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
054559,000060:
054560,000061: # THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
054561,000062: # MGC, AND OGC RESPECTIVELY.
054562,000063:
054563,000064: 23,3247 COUNT* $$/INFLT
054564,000065: 23,3247 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03, 16D-27D, 34D-37D
054565,000066: 23,3250 00051 S2 # XDC = (XD1 XD2 XD3)
054566,000067: 23,3251 02665 XDC # YDC = (YD1 YD2 YD3)
054567,000068: 23,3252 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
054568,000069: 23,3253 06522 HI6ZEROS
054569,000070: 23,3254 02671 XDC +4
054570,000071: 23,3255 55476 DCOMP VDEF
054571,000072: 23,3256 77656 UNIT
054572,000073: 23,3257 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
054573,000074: 23,3260 00027 ZPRIME
054574,000075:
054575,000076: 23,3261 77742 SR1
054576,000077: 23,3262 14023 STODL SINTH # SIN(IGC) = ZP1
054577,000078: 23,3263 00033 ZPRIME +4
054578,000079: 23,3264 77742 SR1
054579,000080: 23,3265 34021 STCALL COSTH # COS(IGC) = ZP3
054580,000081: 23,3266 47320 ARCTRIG
054581,000082:
054582,000083: 23,3267 16742 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
054583,000084: 23,3270 02667 XDC +2
054584,000085: 23,3271 77742 SR1
054585,000086: 23,3272 14023 STODL SINTH # SIN(MGC) = XD2
054586,000087: 23,3273 00027 ZPRIME
054587,000088:
054588,000089: 23,3274 65205 DMP PDDL
054589,000090: 23,3275 02671 XDC +4 # PD00 = (ZP1)(XD3)
054590,000091: 23,3276 00033 ZPRIME +4
054591,000092:
054592,000093: 23,3277 45205 DMP DSU
054593,000094: 23,3300 02665 XDC # MPAC = (ZP3)(XD1)
054594,000095: 23,3301 77626 STADR
054595,000096: 23,3302 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
054596,000097: 23,3303 47320 ARCTRIG
Page 1250 |
054598,000099: 23,3304 26744 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
054599,000100: 23,3305 00027 ZPRIME
054600,000101: 23,3306 77641 DOT
054601,000102: 23,3307 02701 ZDC
054602,000103: 23,3310 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
054603,000104: 23,3311 00027 ZPRIME
054604,000105: 23,3312 77641 DOT
054605,000106: 23,3313 02673 YDC
054606,000107: 23,3314 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
054607,000108: 23,3315 47320 ARCTRIG
054608,000109:
054609,000110: 23,3316 36740 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
054610,000111: 23,3317 00051 S2
054611,000112:
Page 1251 |
054613,000114: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
054614,000115:
054615,000116: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
054616,000117:
054617,000118: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
054618,000119: # AVAILABLE AT MPAC.
054619,000120:
054620,000121: 23,3320 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
054621,000122: 23,3321 00023 SINTH
054622,000123: 23,3322 50025 DSU BMN
054623,000124: 23,3323 07534 QTSN45 # ABS(SIN/4) - SIN(45)/4
054624,000125: 23,3324 47333 TRIG1 # IF (-45,45) OR (135,-135)
054625,000126:
054626,000127: 23,3325 72545 DLOAD SL1 # (45,135) OR (-135,-45)
054627,000128: 23,3326 00021 COSTH
054628,000129: 23,3327 75326 ACOS SIGN
054629,000130: 23,3330 00023 SINTH
054630,000131: 23,3331 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
054631,000132: 23,3332 77616 RVQ
054632,000133:
054633,000134: 23,3333 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
054634,000135: 23,3334 00023 SINTH
054635,000136: 23,3335 77736 ASIN
054636,000137: 23,3336 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
054637,000138: 23,3337 00021 COSTH
054638,000139: 23,3340 77640 BMN
054639,000140: 23,3341 47344 TRIG2 # IF (135,-135)
054640,000141:
054641,000142: 23,3342 43545 DLOAD RVQ
054642,000143: 23,3343 00025 THETA # X = ARCSIN(SIN) (-45,45)
054643,000144:
054644,000145: 23,3344 75345 TRIG2 DLOAD SIGN # (135,-135)
054645,000146: 23,3345 06520 HIDPHALF
054646,000147: 23,3346 00023 SINTH
054647,000148: 23,3347 77625 DSU
054648,000149: 23,3350 00025 THETA
054649,000150: 23,3351 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
054650,000151: 23,3352 77616 RVQ # (+) - (+) OR (-) - (-)
054651,000152:
Page 1252 |
054653,000154: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
054654,000155: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
054655,000156: # FLIGHT SUBROUTINES.
054656,000157:
Page 1253 |
054658,000159: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054659,000160:
054660,000161: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
054661,000162: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
054662,000163: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
054663,000164:
054664,000165: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
054665,000166:
054666,000167: 23,3353 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
054667,000168: 23,3354 00001 0
054668,000169: 23,3355 47375 VLOAD VXV
054669,000170: 23,3356 02665 XNB # XNB = OGA (OUTER GIMBAL AXIS)
054670,000171: 23,3357 02651 YSM # YSM = IGA (INNER GIMBAL AXIS)
054671,000172: 23,3360 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
054672,000173:
054673,000174: 23,3361 44041 DOT ITA
054674,000175: 23,3362 02701 ZNB
054675,000176: 23,3363 00051 S2
054676,000177: 23,3364 24021 STOVL COSTH # COS(OG) = MGA . ZNB
054677,000178: 23,3365 00001 0
054678,000179: 23,3366 77641 DOT
054679,000180: 23,3367 02673 YNB
054680,000181: 23,3370 34023 STCALL SINTH # SIN(OG) = MGA . YNB
054681,000182: 23,3371 47320 ARCTRIG
054682,000183: 23,3372 26740 STOVL OGC
054683,000184: 23,3373 00001 0
054684,000185:
054685,000186: 23,3374 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
054686,000187: 23,3375 02665 XNB
054687,000188: 23,3376 02651 YSM
054688,000189: 23,3377 77752 SL1
054689,000190: 23,3400 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
054690,000191: 23,3401 02651 YSM
054691,000192: 23,3402 77641 DOT
054692,000193: 23,3403 02665 XNB
054693,000194: 23,3404 34023 STCALL SINTH # SIN(MG) = IGA . OGA
054694,000195: 23,3405 47320 ARCTRIG
054695,000196: 23,3406 02744 STORE MGC
054696,000197:
054697,000198: 23,3407 45246 ABS DSU
054698,000199: 23,3410 07536 .166...
054699,000200: 23,3411 77644 BPL
054700,000201: 23,3412 47431 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
054701,000202:
054702,000203: 23,3413 50375 CALCGA1 VLOAD DOT
054703,000204: 23,3414 02657 ZSM
054704,000205: 23,3415 00001 0
054705,000206: 23,3416 24021 STOVL COSTH # COS(IG) = ZSM . MGA
054706,000207: 23,3417 02643 XSM
Page 1254 |
054708,000209: 23,3420 45441 DOT STADR
054709,000210: 23,3421 43754 STCALL SINTH # SIN(IG) = XSM . MGA
054710,000211: 23,3422 47320 ARCTRIG
054711,000212:
054712,000213: 23,3423 26742 STOVL IGC
054713,000214: 23,3424 02740 OGC
054714,000215: 23,3425 77634 RTB
054715,000216: 23,3426 21620 V1STO2S
054716,000217: 23,3427 34322 STCALL THETAD
054717,000218: 23,3430 00051 S2
054718,000219:
054719,000220: 23,3431 77776 GIMLOCK1 EXIT
054720,000221: 23,3432 05567 TC ALARM
054721,000222: 23,3433 00401 OCT 00401
054722,000223: 23,3434 05504 TC UPFLAG # GIMBAL LOCK HAS OCCURED
054723,000224: 23,3435 00056 ADRES GLOKFAIL
054724,000225:
054725,000226: 23,3436 06037 TC INTPRET
054726,000227: 23,3437 77650 GOTO
054727,000228: 23,3440 47413 CALCGA1
054728,000229:
Page 1255 |
054730,000231: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
054731,000232:
054732,000233: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
054733,000234: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
054734,000235: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
054735,000236: # THE VAC AREA.
054736,000237:
054737,000238: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
054738,000239: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
054739,000240:
054740,000241: 23,3441 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D, 34D-37D
054741,000242: 23,3442 02714 STARAD +6
054742,000243: 23,3443 00051 S1
054743,000244: 23,3444 02700 STARAD -6
054744,000245:
054745,000246: 23,3445 77601 SETPD
054746,000247: 23,3446 00001 0
054747,000248: 23,3447 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
054748,000249: 23,3450 02723 STARAD +12D,1 # STARAD +00D UB = S1
054749,000250: 23,3451 02731 STARAD +18D,1
054750,000251: 23,3452 77656 UNIT # 12D VA = UNIT(S1 X S2)
054751,000252: 23,3453 06731 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
054752,000253: 23,3454 77773 VLOAD*
054753,000254: 23,3455 02723 STARAD +12D,1
054754,000255:
054755,000256: 23,3456 76433 VXV* VSL1
054756,000257: 23,3457 02731 STARAD +18D,1 # 18D WA = UA X VA
054757,000258: 23,3460 06737 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
054758,000259:
054759,000260: 23,3461 77700 TIX,1
054760,000261: 23,3462 47447 AXISGEN1
054761,000262:
054762,000263: 23,3463 66160 AXC,1 SXA,1
054763,000264: 23,3464 00006 6
054764,000265: 23,3465 00036 30D
054765,000266:
054766,000267: 23,3466 66370 AXT,1 SSP
054767,000268: 23,3467 00022 18D
054768,000269: 23,3470 00051 S1
054769,000270: 23,3471 00006 6
054770,000271:
054771,000272: 23,3472 66374 AXT,2 SSP
054772,000273: 23,3473 00006 6
054773,000274: 23,3474 00052 S2
054774,000275: 23,3475 00002 2
054775,000276:
054776,000277: 23,3476 76720 AXISGEN2 XCHX,1 VLOAD*
054777,000278: 23,3477 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
054778,000279: 23,3500 00001 0,1
054779,000280:
Page 1256 |
054781,000282: 23,3501 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
054782,000283: 23,3502 75062 STARAD +6,2
054783,000284: 23,3503 00007 6,1
054784,000285: 23,3504 77757 VXSC*
054785,000286: 23,3505 75054 STARAD +12D,2
054786,000287: 23,3506 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
054787,000288: 23,3507 00015 12D,1
054788,000289:
054789,000290: 23,3510 53357 VXSC* VAD
054790,000291: 23,3511 75046 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
054791,000292: 23,3512 76455 VAD VSL1
054792,000293: 23,3513 00031 24D
054793,000294: 23,3514 53520 XCHX,1 UNIT
054794,000295: 23,3515 00036 30D
054795,000296: 23,3516 06707 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
054796,000297:
054797,000298: 23,3517 77700 TIX,1
054798,000299: 23,3520 47521 AXISGEN3
054799,000300:
054800,000301: 23,3521 77704 AXISGEN3 TIX,2
054801,000302: 23,3522 47476 AXISGEN2
054802,000303:
054803,000304: 23,3523 77775 VLOAD
054804,000305: 23,3524 02665 XDC
054805,000306: 23,3525 26707 STOVL STARAD
054806,000307: 23,3526 02673 YDC
054807,000308: 23,3527 26715 STOVL STARAD +6
054808,000309: 23,3530 02701 ZDC
054809,000310: 23,3531 02723 STORE STARAD +12D
054810,000311:
054811,000312: 23,3532 77616 RVQ
054812,000313:
Page 1257 |
054814,000315: 23,3533 05520 26075 QTSN45 2DEC .1768
054815,000316:
054816,000317: 23,3535 05252 25253 .166... 2DEC .1666666667
054817,000318:
Page 1258 Empty page |
054820,000321:
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc