Source Code
These source-code files are part of a reconstructed copy of Luminary 96, the
original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. |
052366,000002: ## Copyright: Public domain.
052367,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
052368,000004: ## Purpose: A section of Luminary revision 96.
052369,000005: ## It is part of the reconstructed source code for the
052370,000006: ## original release of the flight software for the Lunar
052371,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
052372,000008: ## The code has been recreated from a previously reconstructed
052373,000009: ## copy of Luminary 97 by undoing changes described in anomaly
052374,000010: ## report LNY-59. The code has been adapted such that the
052375,000011: ## resulting bugger words exactly match those specified for
052376,000012: ## Luminary 96 in NASA drawing 2021152D, which gives relatively
052377,000013: ## high confidence that the reconstruction is correct.
052378,000014: ## Reference: pp. 1249-1258
052379,000015: ## Assembler: yaYUL
052380,000016: ## Contact: Ron Burkey <info@sandroid.org>.
052381,000017: ## Website: www.ibiblio.org/apollo/index.html
052382,000018: ## Mod history: 2019-08-04 MAS Created from Luminary 97.
052383,000019:
Page 1249 |
052385,000021: 22,3773 BANK 22
052386,000022: 23,2000 SETLOC INFLIGHT
052387,000023: 23,2000 BANK
052388,000024:
052389,000025: 23,3247 E5,1642 EBANK= XSM
052390,000026:
052391,000027: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052392,000028:
052393,000029: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
052394,000030: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
052395,000031:
052396,000032: # THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
052397,000033: # MGC, AND OGC RESPECTIVELY.
052398,000034:
052399,000035: 23,3247 COUNT* $$/INFLT
052400,000036: 23,3247 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03, 16D-27D, 34D-37D
052401,000037: 23,3250 00051 S2 # XDC = (XD1 XD2 XD3)
052402,000038: 23,3251 02665 XDC # YDC = (YD1 YD2 YD3)
052403,000039: 23,3252 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
052404,000040: 23,3253 06522 HI6ZEROS
052405,000041: 23,3254 02671 XDC +4
052406,000042: 23,3255 55476 DCOMP VDEF
052407,000043: 23,3256 77656 UNIT
052408,000044: 23,3257 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
052409,000045: 23,3260 00027 ZPRIME
052410,000046:
052411,000047: 23,3261 77742 SR1
052412,000048: 23,3262 14023 STODL SINTH # SIN(IGC) = ZP1
052413,000049: 23,3263 00033 ZPRIME +4
052414,000050: 23,3264 77742 SR1
052415,000051: 23,3265 34021 STCALL COSTH # COS(IGC) = ZP3
052416,000052: 23,3266 47320 ARCTRIG
052417,000053:
052418,000054: 23,3267 16742 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
052419,000055: 23,3270 02667 XDC +2
052420,000056: 23,3271 77742 SR1
052421,000057: 23,3272 14023 STODL SINTH # SIN(MGC) = XD2
052422,000058: 23,3273 00027 ZPRIME
052423,000059:
052424,000060: 23,3274 65205 DMP PDDL
052425,000061: 23,3275 02671 XDC +4 # PD00 = (ZP1)(XD3)
052426,000062: 23,3276 00033 ZPRIME +4
052427,000063:
052428,000064: 23,3277 45205 DMP DSU
052429,000065: 23,3300 02665 XDC # MPAC = (ZP3)(XD1)
052430,000066: 23,3301 77626 STADR
052431,000067: 23,3302 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
052432,000068: 23,3303 47320 ARCTRIG
Page 1250 |
052434,000070: 23,3304 26744 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
052435,000071: 23,3305 00027 ZPRIME
052436,000072: 23,3306 77641 DOT
052437,000073: 23,3307 02701 ZDC
052438,000074: 23,3310 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
052439,000075: 23,3311 00027 ZPRIME
052440,000076: 23,3312 77641 DOT
052441,000077: 23,3313 02673 YDC
052442,000078: 23,3314 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
052443,000079: 23,3315 47320 ARCTRIG
052444,000080:
052445,000081: 23,3316 36740 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
052446,000082: 23,3317 00051 S2
052447,000083:
Page 1251 |
052449,000085: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
052450,000086:
052451,000087: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
052452,000088:
052453,000089: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
052454,000090: # AVAILABLE AT MPAC.
052455,000091:
052456,000092: 23,3320 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
052457,000093: 23,3321 00023 SINTH
052458,000094: 23,3322 50025 DSU BMN
052459,000095: 23,3323 07534 QTSN45 # ABS(SIN/4) - SIN(45)/4
052460,000096: 23,3324 47333 TRIG1 # IF (-45,45) OR (135,-135)
052461,000097:
052462,000098: 23,3325 72545 DLOAD SL1 # (45,135) OR (-135,-45)
052463,000099: 23,3326 00021 COSTH
052464,000100: 23,3327 75326 ACOS SIGN
052465,000101: 23,3330 00023 SINTH
052466,000102: 23,3331 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
052467,000103: 23,3332 77616 RVQ
052468,000104:
052469,000105: 23,3333 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
052470,000106: 23,3334 00023 SINTH
052471,000107: 23,3335 77736 ASIN
052472,000108: 23,3336 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
052473,000109: 23,3337 00021 COSTH
052474,000110: 23,3340 77640 BMN
052475,000111: 23,3341 47344 TRIG2 # IF (135,-135)
052476,000112:
052477,000113: 23,3342 43545 DLOAD RVQ
052478,000114: 23,3343 00025 THETA # X = ARCSIN(SIN) (-45,45)
052479,000115:
052480,000116: 23,3344 75345 TRIG2 DLOAD SIGN # (135,-135)
052481,000117: 23,3345 06520 HIDPHALF
052482,000118: 23,3346 00023 SINTH
052483,000119: 23,3347 77625 DSU
052484,000120: 23,3350 00025 THETA
052485,000121: 23,3351 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
052486,000122: 23,3352 77616 RVQ # (+) - (+) OR (-) - (-)
052487,000123:
Page 1252 |
052489,000125: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
052490,000126: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
052491,000127: # FLIGHT SUBROUTINES.
052492,000128:
Page 1253 |
052494,000130: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052495,000131:
052496,000132: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
052497,000133: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
052498,000134: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
052499,000135:
052500,000136: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
052501,000137:
052502,000138: 23,3353 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
052503,000139: 23,3354 00001 0
052504,000140: 23,3355 47375 VLOAD VXV
052505,000141: 23,3356 02665 XNB # XNB = OGA (OUTER GIMBAL AXIS)
052506,000142: 23,3357 02651 YSM # YSM = IGA (INNER GIMBAL AXIS)
052507,000143: 23,3360 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
052508,000144:
052509,000145: 23,3361 44041 DOT ITA
052510,000146: 23,3362 02701 ZNB
052511,000147: 23,3363 00051 S2
052512,000148: 23,3364 24021 STOVL COSTH # COS(OG) = MGA . ZNB
052513,000149: 23,3365 00001 0
052514,000150: 23,3366 77641 DOT
052515,000151: 23,3367 02673 YNB
052516,000152: 23,3370 34023 STCALL SINTH # SIN(OG) = MGA . YNB
052517,000153: 23,3371 47320 ARCTRIG
052518,000154: 23,3372 26740 STOVL OGC
052519,000155: 23,3373 00001 0
052520,000156:
052521,000157: 23,3374 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
052522,000158: 23,3375 02665 XNB
052523,000159: 23,3376 02651 YSM
052524,000160: 23,3377 77752 SL1
052525,000161: 23,3400 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
052526,000162: 23,3401 02651 YSM
052527,000163: 23,3402 77641 DOT
052528,000164: 23,3403 02665 XNB
052529,000165: 23,3404 34023 STCALL SINTH # SIN(MG) = IGA . OGA
052530,000166: 23,3405 47320 ARCTRIG
052531,000167: 23,3406 02744 STORE MGC
052532,000168:
052533,000169: 23,3407 45246 ABS DSU
052534,000170: 23,3410 07536 .166...
052535,000171: 23,3411 77644 BPL
052536,000172: 23,3412 47431 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
052537,000173:
052538,000174: 23,3413 50375 CALCGA1 VLOAD DOT
052539,000175: 23,3414 02657 ZSM
052540,000176: 23,3415 00001 0
052541,000177: 23,3416 24021 STOVL COSTH # COS(IG) = ZSM . MGA
052542,000178: 23,3417 02643 XSM
Page 1254 |
052544,000180: 23,3420 45441 DOT STADR
052545,000181: 23,3421 43754 STCALL SINTH # SIN(IG) = XSM . MGA
052546,000182: 23,3422 47320 ARCTRIG
052547,000183:
052548,000184: 23,3423 26742 STOVL IGC
052549,000185: 23,3424 02740 OGC
052550,000186: 23,3425 77634 RTB
052551,000187: 23,3426 21620 V1STO2S
052552,000188: 23,3427 34322 STCALL THETAD
052553,000189: 23,3430 00051 S2
052554,000190:
052555,000191: 23,3431 77776 GIMLOCK1 EXIT
052556,000192: 23,3432 05567 TC ALARM
052557,000193: 23,3433 00401 OCT 00401
052558,000194: 23,3434 05504 TC UPFLAG # GIMBAL LOCK HAS OCCURED
052559,000195: 23,3435 00056 ADRES GLOKFAIL
052560,000196:
052561,000197: 23,3436 06037 TC INTPRET
052562,000198: 23,3437 77650 GOTO
052563,000199: 23,3440 47413 CALCGA1
052564,000200:
Page 1255 |
052566,000202: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
052567,000203:
052568,000204: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
052569,000205: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
052570,000206: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
052571,000207: # THE VAC AREA.
052572,000208:
052573,000209: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
052574,000210: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
052575,000211:
052576,000212: 23,3441 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D, 34D-37D
052577,000213: 23,3442 02714 STARAD +6
052578,000214: 23,3443 00051 S1
052579,000215: 23,3444 02700 STARAD -6
052580,000216:
052581,000217: 23,3445 77601 SETPD
052582,000218: 23,3446 00001 0
052583,000219: 23,3447 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
052584,000220: 23,3450 02723 STARAD +12D,1 # STARAD +00D UB = S1
052585,000221: 23,3451 02731 STARAD +18D,1
052586,000222: 23,3452 77656 UNIT # 12D VA = UNIT(S1 X S2)
052587,000223: 23,3453 06731 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
052588,000224: 23,3454 77773 VLOAD*
052589,000225: 23,3455 02723 STARAD +12D,1
052590,000226:
052591,000227: 23,3456 76433 VXV* VSL1
052592,000228: 23,3457 02731 STARAD +18D,1 # 18D WA = UA X VA
052593,000229: 23,3460 06737 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
052594,000230:
052595,000231: 23,3461 77700 TIX,1
052596,000232: 23,3462 47447 AXISGEN1
052597,000233:
052598,000234: 23,3463 66160 AXC,1 SXA,1
052599,000235: 23,3464 00006 6
052600,000236: 23,3465 00036 30D
052601,000237:
052602,000238: 23,3466 66370 AXT,1 SSP
052603,000239: 23,3467 00022 18D
052604,000240: 23,3470 00051 S1
052605,000241: 23,3471 00006 6
052606,000242:
052607,000243: 23,3472 66374 AXT,2 SSP
052608,000244: 23,3473 00006 6
052609,000245: 23,3474 00052 S2
052610,000246: 23,3475 00002 2
052611,000247:
052612,000248: 23,3476 76720 AXISGEN2 XCHX,1 VLOAD*
052613,000249: 23,3477 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
052614,000250: 23,3500 00001 0,1
052615,000251:
Page 1256 |
052617,000253: 23,3501 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
052618,000254: 23,3502 75062 STARAD +6,2
052619,000255: 23,3503 00007 6,1
052620,000256: 23,3504 77757 VXSC*
052621,000257: 23,3505 75054 STARAD +12D,2
052622,000258: 23,3506 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
052623,000259: 23,3507 00015 12D,1
052624,000260:
052625,000261: 23,3510 53357 VXSC* VAD
052626,000262: 23,3511 75046 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
052627,000263: 23,3512 76455 VAD VSL1
052628,000264: 23,3513 00031 24D
052629,000265: 23,3514 53520 XCHX,1 UNIT
052630,000266: 23,3515 00036 30D
052631,000267: 23,3516 06707 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
052632,000268:
052633,000269: 23,3517 77700 TIX,1
052634,000270: 23,3520 47521 AXISGEN3
052635,000271:
052636,000272: 23,3521 77704 AXISGEN3 TIX,2
052637,000273: 23,3522 47476 AXISGEN2
052638,000274:
052639,000275: 23,3523 77775 VLOAD
052640,000276: 23,3524 02665 XDC
052641,000277: 23,3525 26707 STOVL STARAD
052642,000278: 23,3526 02673 YDC
052643,000279: 23,3527 26715 STOVL STARAD +6
052644,000280: 23,3530 02701 ZDC
052645,000281: 23,3531 02723 STORE STARAD +12D
052646,000282:
052647,000283: 23,3532 77616 RVQ
052648,000284:
Page 1257 |
052650,000286: 23,3533 05520 26075 QTSN45 2DEC .1768
052651,000287:
052652,000288: 23,3535 05252 25253 .166... 2DEC .1666666667
052653,000289:
Page 1258 Empty page |
052656,000292:
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc