Source Code
These source-code files are part of a reconstructed copy of Luminary 173, the
second (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance
Computer (AGC) software.
The reconstruction began with reconstructed source code for Luminary 178. Changes between revision 173 and 178 were backed out, as described by Luminary memo 167 (revision 1). The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 173 listing would be different. 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. |
052888,000002: ## Copyright: Public domain.
052889,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
052890,000004: ## Purpose: A section of Luminary revision 173.
052891,000005: ## It is part of the reconstructed source code for the second
052892,000006: ## (unflown) release of the flight software for the Lunar
052893,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
052894,000008: ## The code has been recreated from a reconstructed copy of
052895,000009: ## Luminary 178, as well as Luminary memo 167 (revision 1).
052896,000010: ## It has been adapted such that the resulting bugger words
052897,000011: ## exactly match those specified for Luminary 173 in NASA
052898,000012: ## drawing 2021152N, which gives relatively high confidence
052899,000013: ## that the reconstruction is correct.
052900,000014: ## Reference: pp. 1238-1247
052901,000015: ## Assembler: yaYUL
052902,000016: ## Contact: Ron Burkey <info@sandroid.org>.
052903,000017: ## Website: www.ibiblio.org/apollo/index.html
052904,000018: ## Mod history: 2019-09-18 MAS Created from Luminary 178.
052905,000019:
Page 1238 |
052907,000021: 22,3772 BANK 22
052908,000022: 23,2000 SETLOC INFLIGHT
052909,000023: 23,2000 BANK
052910,000024:
052911,000025: 23,3245 E5,1642 EBANK= XSM
052912,000026:
052913,000027: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052914,000028:
052915,000029: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
052916,000030: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
052917,000031:
052918,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,
052919,000033: # MGC, AND OGC RESPECTIVELY.
052920,000034:
052921,000035: 23,3245 COUNT* $$/INFLT
052922,000036: 23,3245 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03,16D-27D,34D-37D
052923,000037: 23,3246 00051 S2 # XDC = (XD1 XD2 XD3)
052924,000038: 23,3247 02665 XDC # YDC = (YD1 YD2 YD3)
052925,000039: 23,3250 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
052926,000040: 23,3251 06520 HI6ZEROS
052927,000041: 23,3252 02671 XDC +4
052928,000042: 23,3253 55476 DCOMP VDEF
052929,000043: 23,3254 77656 UNIT
052930,000044: 23,3255 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
052931,000045: 23,3256 00027 ZPRIME
052932,000046:
052933,000047: 23,3257 77742 SR1
052934,000048: 23,3260 14023 STODL SINTH # SIN(IGC) = ZP1
052935,000049: 23,3261 00033 ZPRIME +4
052936,000050: 23,3262 77742 SR1
052937,000051: 23,3263 34021 STCALL COSTH # COS(IGC) = ZP3
052938,000052: 23,3264 47316 ARCTRIG
052939,000053:
052940,000054: 23,3265 16742 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
052941,000055: 23,3266 02667 XDC +2
052942,000056: 23,3267 77742 SR1
052943,000057: 23,3270 14023 STODL SINTH # SIN(MGC) = XD2
052944,000058: 23,3271 00027 ZPRIME
052945,000059:
052946,000060: 23,3272 65205 DMP PDDL
052947,000061: 23,3273 02671 XDC +4 # PD00 = (ZP1)(XD3)
052948,000062: 23,3274 00033 ZPRIME +4
052949,000063:
052950,000064: 23,3275 45205 DMP DSU
052951,000065: 23,3276 02665 XDC # MPAC = (ZP3)(XD1)
052952,000066: 23,3277 77626 STADR
052953,000067: 23,3300 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
052954,000068: 23,3301 47316 ARCTRIG
Page 1239 |
052956,000070: 23,3302 26744 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
052957,000071: 23,3303 00027 ZPRIME
052958,000072: 23,3304 77641 DOT
052959,000073: 23,3305 02701 ZDC
052960,000074: 23,3306 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
052961,000075: 23,3307 00027 ZPRIME
052962,000076: 23,3310 77641 DOT
052963,000077: 23,3311 02673 YDC
052964,000078: 23,3312 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
052965,000079: 23,3313 47316 ARCTRIG
052966,000080:
052967,000081: 23,3314 36740 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
052968,000082: 23,3315 00051 S2
052969,000083:
Page 1240 |
052971,000085: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
052972,000086:
052973,000087: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
052974,000088:
052975,000089: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
052976,000090: # AVAILABLE AT MPAC.
052977,000091:
052978,000092: 23,3316 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
052979,000093: 23,3317 00023 SINTH
052980,000094: 23,3320 50025 DSU BMN
052981,000095: 23,3321 07532 QTSN45 # ABS(SIN/4) - SIN(45)/4
052982,000096: 23,3322 47331 TRIG1 # IF (-45,45) OR (135,-135)
052983,000097:
052984,000098: 23,3323 72545 DLOAD SL1 # (45,135) OR (-135,-45)
052985,000099: 23,3324 00021 COSTH
052986,000100: 23,3325 75326 ACOS SIGN
052987,000101: 23,3326 00023 SINTH
052988,000102: 23,3327 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
052989,000103: 23,3330 77616 RVQ
052990,000104:
052991,000105: 23,3331 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
052992,000106: 23,3332 00023 SINTH
052993,000107: 23,3333 77736 ASIN
052994,000108: 23,3334 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
052995,000109: 23,3335 00021 COSTH
052996,000110: 23,3336 77640 BMN
052997,000111: 23,3337 47342 TRIG2 # IF (135,-135)
052998,000112:
052999,000113: 23,3340 43545 DLOAD RVQ
053000,000114: 23,3341 00025 THETA # X = ARCSIN(SIN) (-45,45)
053001,000115:
053002,000116: 23,3342 75345 TRIG2 DLOAD SIGN # (135,-135)
053003,000117: 23,3343 06516 HIDPHALF
053004,000118: 23,3344 00023 SINTH
053005,000119: 23,3345 77625 DSU
053006,000120: 23,3346 00025 THETA
053007,000121: 23,3347 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
053008,000122: 23,3350 77616 RVQ # (+) - (+) OR (-) - (-)
053009,000123:
Page 1241 |
053011,000125: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
053012,000126: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
053013,000127: # FLIGHT SUBROUTINES.
053014,000128:
Page 1242 |
053016,000130: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
053017,000131:
053018,000132: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
053019,000133: # VECTORS ARE STORED AT XNB,YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
053020,000134: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
053021,000135:
053022,000136: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
053023,000137:
053024,000138: 23,3351 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
053025,000139: 23,3352 00001 0
053026,000140: 23,3353 47375 VLOAD VXV
053027,000141: 23,3354 02665 XNB # XNB = OGA (OUTER GIMBAL AXIS)
053028,000142: 23,3355 02651 YSM # YSM = IGA (INNER GIMBAL AXIS)
053029,000143: 23,3356 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
053030,000144:
053031,000145: 23,3357 44041 DOT ITA
053032,000146: 23,3360 02701 ZNB
053033,000147: 23,3361 00051 S2
053034,000148: 23,3362 24021 STOVL COSTH # COS(OG) = MGA . ZNB
053035,000149: 23,3363 00001 0
053036,000150: 23,3364 77641 DOT
053037,000151: 23,3365 02673 YNB
053038,000152: 23,3366 34023 STCALL SINTH # SIN(OG) = MGA . YNB
053039,000153: 23,3367 47316 ARCTRIG
053040,000154: 23,3370 26740 STOVL OGC
053041,000155: 23,3371 00001 0
053042,000156:
053043,000157: 23,3372 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
053044,000158: 23,3373 02665 XNB
053045,000159: 23,3374 02651 YSM
053046,000160: 23,3375 77752 SL1
053047,000161: 23,3376 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
053048,000162: 23,3377 02651 YSM
053049,000163: 23,3400 77641 DOT
053050,000164: 23,3401 02665 XNB
053051,000165: 23,3402 34023 STCALL SINTH # SIN(MG) = IGA . OGA
053052,000166: 23,3403 47316 ARCTRIG
053053,000167: 23,3404 02744 STORE MGC
053054,000168:
053055,000169: 23,3405 45246 ABS DSU
053056,000170: 23,3406 07534 .166...
053057,000171: 23,3407 77644 BPL
053058,000172: 23,3410 47427 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
053059,000173:
053060,000174: 23,3411 50375 CALCGA1 VLOAD DOT
053061,000175: 23,3412 02657 ZSM
053062,000176: 23,3413 00001 0
053063,000177: 23,3414 24021 STOVL COSTH # COS(IG) = ZSM . MGA
053064,000178: 23,3415 02643 XSM
Page 1243 |
053066,000180: 23,3416 45441 DOT STADR
053067,000181: 23,3417 43754 STCALL SINTH # SIN(IG) = XSM . MGA
053068,000182: 23,3420 47316 ARCTRIG
053069,000183:
053070,000184: 23,3421 26742 STOVL IGC
053071,000185: 23,3422 02740 OGC
053072,000186: 23,3423 77634 RTB
053073,000187: 23,3424 21621 V1STO2S
053074,000188: 23,3425 34322 STCALL THETAD
053075,000189: 23,3426 00051 S2
053076,000190:
053077,000191: 23,3427 77776 GIMLOCK1 EXIT
053078,000192: 23,3430 05600 TC ALARM
053079,000193: 23,3431 00401 OCT 00401
053080,000194: 23,3432 05515 TC UPFLAG # GIMBAL LOCK HAS OCCURED
053081,000195: 23,3433 00056 ADRES GLOKFAIL
053082,000196:
053083,000197: 23,3434 06042 TC INTPRET
053084,000198: 23,3435 77650 GOTO
053085,000199: 23,3436 47411 CALCGA1
053086,000200:
Page 1244 |
053088,000202: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
053089,000203:
053090,000204: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
053091,000205: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
053092,000206: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
053093,000207: # THE VAC AREA.
053094,000208:
053095,000209: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
053096,000210: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
053097,000211:
053098,000212: 23,3437 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D,34D-37D
053099,000213: 23,3440 02714 STARAD +6
053100,000214: 23,3441 00051 S1
053101,000215: 23,3442 02700 STARAD -6
053102,000216:
053103,000217: 23,3443 77601 SETPD
053104,000218: 23,3444 00001 0
053105,000219: 23,3445 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
053106,000220: 23,3446 02723 STARAD +12D,1 # STARAD +00D UB = S1
053107,000221: 23,3447 02731 STARAD +18D,1
053108,000222: 23,3450 77656 UNIT # 12D VA = UNIT(S1 X S2)
053109,000223: 23,3451 06731 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
053110,000224: 23,3452 77773 VLOAD*
053111,000225: 23,3453 02723 STARAD +12D,1
053112,000226:
053113,000227: 23,3454 76433 VXV* VSL1
053114,000228: 23,3455 02731 STARAD +18D,1 # 18D WA = UA X VA
053115,000229: 23,3456 06737 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
053116,000230:
053117,000231: 23,3457 77700 TIX,1
053118,000232: 23,3460 47445 AXISGEN1
053119,000233:
053120,000234: 23,3461 66160 AXC,1 SXA,1
053121,000235: 23,3462 00006 6
053122,000236: 23,3463 00036 30D
053123,000237:
053124,000238: 23,3464 66370 AXT,1 SSP
053125,000239: 23,3465 00022 18D
053126,000240: 23,3466 00051 S1
053127,000241: 23,3467 00006 6
053128,000242:
053129,000243: 23,3470 66374 AXT,2 SSP
053130,000244: 23,3471 00006 6
053131,000245: 23,3472 00052 S2
053132,000246: 23,3473 00002 2
053133,000247:
053134,000248: 23,3474 76720 AXISGEN2 XCHX,1 VLOAD*
053135,000249: 23,3475 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
053136,000250: 23,3476 00001 0,1
053137,000251:
Page 1245 |
053139,000253: 23,3477 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
053140,000254: 23,3500 75062 STARAD +6,2
053141,000255: 23,3501 00007 6,1
053142,000256: 23,3502 77757 VXSC*
053143,000257: 23,3503 75054 STARAD +12D,2
053144,000258: 23,3504 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
053145,000259: 23,3505 00015 12D,1
053146,000260:
053147,000261: 23,3506 53357 VXSC* VAD
053148,000262: 23,3507 75046 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
053149,000263: 23,3510 76455 VAD VSL1
053150,000264: 23,3511 00031 24D
053151,000265: 23,3512 53520 XCHX,1 UNIT
053152,000266: 23,3513 00036 30D
053153,000267: 23,3514 06707 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
053154,000268:
053155,000269: 23,3515 77700 TIX,1
053156,000270: 23,3516 47517 AXISGEN3
053157,000271:
053158,000272: 23,3517 77704 AXISGEN3 TIX,2
053159,000273: 23,3520 47474 AXISGEN2
053160,000274:
053161,000275: 23,3521 77775 VLOAD
053162,000276: 23,3522 02665 XDC
053163,000277: 23,3523 26707 STOVL STARAD
053164,000278: 23,3524 02673 YDC
053165,000279: 23,3525 26715 STOVL STARAD +6
053166,000280: 23,3526 02701 ZDC
053167,000281: 23,3527 02723 STORE STARAD +12D
053168,000282:
053169,000283: 23,3530 77616 RVQ
053170,000284:
Page 1246 |
053172,000286: 23,3531 05520 26075 QTSN45 2DEC .1768
053173,000287: 23,3533 05252 25253 .166... 2DEC .1666666667
053174,000288:
Page 1247 There is no source code on this page of the original assembly listing. |
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc