Source Code
These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3),
the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software
for Apollo 13.
The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments. Since no contemporary listings of Comanche 72/3 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
056611,000002: ## Copyright: Public domain.
056612,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
056613,000004: ## Purpose: A section of Manche72 revision 3.
056614,000005: ## It is part of the reconstructed source code for the final, flown
056615,000006: ## release of the software for the Command Module's (CM) Apollo
056616,000007: ## Guidance Computer (AGC) for Apollo 13. No original listings
056617,000008: ## of this program are available; instead, this file was recreated
056618,000009: ## from a reconstructed copy of Comanche 072. It has been adapted
056619,000010: ## such that the resulting bugger words exactly match those
056620,000011: ## specified for Manche72 revision 3 in NASA drawing 2021153G,
056621,000012: ## which gives relatively high confidence that the reconstruction
056622,000013: ## is correct.
056623,000014: ## Assembler: yaYUL
056624,000015: ## Contact: Ron Burkey <info@sandroid.org>.
056625,000016: ## Website: www.ibiblio.org/apollo/index.html
056626,000017: ## Mod history: 2024-05-19 MAS Created from Comanche 072.
056627,000018:
056628,000019: 22,3510 BANK 22
056629,000020: 23,2000 SETLOC INFLIGHT
056630,000021: 23,2000 BANK
056631,000022:
056632,000023: 23,3207 E5,1671 EBANK= XSM
056633,000024:
056634,000025: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056635,000026:
056636,000027: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
056637,000028: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
056638,000029:
056639,000030: # THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
056640,000031: # MGC, AND OGC RESPECTIVELY.
056641,000032:
056642,000033: 23,3207 COUNT 23/INFLT
056643,000034:
056644,000035: 23,3207 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03, 16D-27D, 34D-37D
056645,000036: 23,3210 00051 S2 # XDC = (XD1 XD2 XD3)
056646,000037: 23,3211 02714 XDC # YDC = (YD1 YD2 YD3)
056647,000038: 23,3212 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
056648,000039: 23,3213 15334 HI6ZEROS
056649,000040: 23,3214 02720 XDC +4
056650,000041: 23,3215 55476 DCOMP VDEF
056651,000042: 23,3216 77656 UNIT
056652,000043: 23,3217 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
056653,000044: 23,3220 00027 ZPRIME
056654,000045:
056655,000046: 23,3221 77742 SR1
056656,000047: 23,3222 14023 STODL SINTH # SIN(IGC) = ZP1
056657,000048: 23,3223 00033 ZPRIME +4
056658,000049: 23,3224 77742 SR1
056659,000050: 23,3225 34021 STCALL COSTH # COS(IGC) = ZP3
056660,000051: 23,3226 47260 ARCTRIG
056661,000052:
056662,000053: 23,3227 16762 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
056663,000054: 23,3230 02716 XDC +2
056664,000055: 23,3231 77742 SR1
056665,000056: 23,3232 14023 STODL SINTH # SIN(MGC) = XD2
056666,000057: 23,3233 00027 ZPRIME
056667,000058:
056668,000059: 23,3234 65205 DMP PDDL
056669,000060: 23,3235 02720 XDC +4 # PD00 = (ZP1)(XD3)
056670,000061: 23,3236 00033 ZPRIME +4
056671,000062:
056672,000063: 23,3237 45205 DMP DSU
056673,000064: 23,3240 02714 XDC # MPAC = (ZP3)(XD1)
056674,000065: 23,3241 77626 STADR
056675,000066: 23,3242 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
056676,000067: 23,3243 47260 ARCTRIG
056677,000068: 23,3244 26764 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
056678,000069: 23,3245 00027 ZPRIME
056679,000070: 23,3246 77641 DOT
056680,000071: 23,3247 02730 ZDC
056681,000072: 23,3250 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
056682,000073: 23,3251 00027 ZPRIME
056683,000074: 23,3252 77641 DOT
056684,000075: 23,3253 02722 YDC
056685,000076: 23,3254 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
056686,000077: 23,3255 47260 ARCTRIG
056687,000078:
056688,000079: 23,3256 36760 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
056689,000080: 23,3257 00051 S2
056690,000081:
056691,000082: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
056692,000083:
056693,000084: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
056694,000085:
056695,000086: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
056696,000087: # AVAILABLE AT MPAC.
056697,000088:
056698,000089: 23,3260 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
056699,000090: 23,3261 00023 SINTH
056700,000091: 23,3262 50025 DSU BMN
056701,000092: 23,3263 07476 QTSN45 # ABS(SIN/4) - SIN(45)/4
056702,000093: 23,3264 47273 TRIG1 # IF (-45,45) OR (135,-135)
056703,000094:
056704,000095: 23,3265 72545 DLOAD SL1 # (45,135) OR (-135,-45)
056705,000096: 23,3266 00021 COSTH
056706,000097: 23,3267 75326 ACOS SIGN
056707,000098: 23,3270 00023 SINTH
056708,000099: 23,3271 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
056709,000100: 23,3272 77616 RVQ
056710,000101:
056711,000102: 23,3273 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
056712,000103: 23,3274 00023 SINTH
056713,000104: 23,3275 77736 ASIN
056714,000105: 23,3276 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
056715,000106: 23,3277 00021 COSTH
056716,000107: 23,3300 77640 BMN
056717,000108: 23,3301 47304 TRIG2 # IF (135,-135)
056718,000109:
056719,000110: 23,3302 43545 DLOAD RVQ
056720,000111: 23,3303 00025 THETA # X = ARCSIN(SIN) (-45,45)
056721,000112:
056722,000113: 23,3304 75345 TRIG2 DLOAD SIGN # (135,-135)
056723,000114: 23,3305 15332 HIDPHALF
056724,000115: 23,3306 00023 SINTH
056725,000116: 23,3307 77625 DSU
056726,000117: 23,3310 00025 THETA
056727,000118: 23,3311 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
056728,000119: 23,3312 77616 RVQ # (+) - (+) OR (-) - (-)
056729,000120:
056730,000121: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
056731,000122: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
056732,000123: # FLIGHT SUBROUTINES.
056733,000124:
056734,000125: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056735,000126:
056736,000127: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
056737,000128: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
056738,000129: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
056739,000130:
056740,000131: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
056741,000132:
056742,000133: 23,3313 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
056743,000134: 23,3314 00001 0
056744,000135: 23,3315 47375 VLOAD VXV
056745,000136: 23,3316 02714 XNB # XNB = OGA (OUTER GIMBAL AXIS)
056746,000137: 23,3317 02700 YSM # YSM = IGA (INNER GIMBAL AXIS)
056747,000138: 23,3320 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
056748,000139:
056749,000140: 23,3321 44041 DOT ITA
056750,000141: 23,3322 02730 ZNB
056751,000142: 23,3323 00051 S2
056752,000143: 23,3324 24021 STOVL COSTH # COS(OG) = MGA . ZNB
056753,000144: 23,3325 00001 0
056754,000145: 23,3326 77641 DOT
056755,000146: 23,3327 02722 YNB
056756,000147: 23,3330 34023 STCALL SINTH # SIN(OG) = MGA . YNB
056757,000148: 23,3331 47260 ARCTRIG
056758,000149: 23,3332 26760 STOVL OGC
056759,000150: 23,3333 00001 0
056760,000151:
056761,000152: 23,3334 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
056762,000153: 23,3335 02714 XNB
056763,000154: 23,3336 02700 YSM
056764,000155: 23,3337 77752 SL1
056765,000156: 23,3340 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
056766,000157: 23,3341 02700 YSM
056767,000158: 23,3342 77641 DOT
056768,000159: 23,3343 02714 XNB
056769,000160: 23,3344 34023 STCALL SINTH # SIN(MG) = IGA . OGA
056770,000161: 23,3345 47260 ARCTRIG
056771,000162: 23,3346 02764 STORE MGC
056772,000163:
056773,000164: 23,3347 45246 ABS DSU
056774,000165: 23,3350 07500 .166...
056775,000166: 23,3351 77644 BPL
056776,000167: 23,3352 47373 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
056777,000168:
056778,000169: 23,3353 50375 CALCGA1 VLOAD DOT
056779,000170: 23,3354 02706 ZSM
056780,000171: 23,3355 00001 0
056781,000172: 23,3356 24021 STOVL COSTH # COS(IG) = ZSM . MGA
056782,000173: 23,3357 02672 XSM
056783,000174: 23,3360 45441 DOT STADR
056784,000175: 23,3361 43754 STCALL SINTH # SIN(IG) = XSM . MGA
056785,000176: 23,3362 47260 ARCTRIG
056786,000177:
056787,000178: 23,3363 26762 STOVL IGC
056788,000179: 23,3364 02760 OGC
056789,000180: 23,3365 43034 RTB BONCLR
056790,000181: 23,3366 45552 V1STO2S
056791,000182: 23,3367 00200 CPHIFLAG
056792,000183: 23,3370 00051 S2
056793,000184: 23,3371 35156 STCALL THETAD
056794,000185: 23,3372 00051 S2
056795,000186:
056796,000187: 23,3373 77776 GIMLOCK1 EXIT
056797,000188: 23,3374 05664 TC ALARM
056798,000189: 23,3375 00401 OCT 00401
056799,000190: 23,3376 05562 TC UPFLAG # GIMBAL LOCK HAS OCCURED
056800,000191: 23,3377 00056 ADRES GLOKFAIL
056801,000192:
056802,000193: 23,3400 06006 TC INTPRET
056803,000194: 23,3401 77650 GOTO
056804,000195: 23,3402 47353 CALCGA1
056805,000196:
056806,000197: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
056807,000198:
056808,000199: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
056809,000200: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
056810,000201: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
056811,000202: # THE VAC AREA.
056812,000203:
056813,000204: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
056814,000205: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
056815,000206:
056816,000207: 23,3403 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D, 34D-37D
056817,000208: 23,3404 02743 STARAD +6
056818,000209: 23,3405 00051 S1
056819,000210: 23,3406 02727 STARAD -6
056820,000211:
056821,000212: 23,3407 77601 SETPD
056822,000213: 23,3410 00001 0
056823,000214: 23,3411 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
056824,000215: 23,3412 02752 STARAD +12D,1 # STARAD +00D UB = S1
056825,000216: 23,3413 02760 STARAD +18D,1
056826,000217: 23,3414 77656 UNIT # 12D VA = UNIT(S1 X S2)
056827,000218: 23,3415 06760 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
056828,000219: 23,3416 77773 VLOAD*
056829,000220: 23,3417 02752 STARAD +12D,1
056830,000221:
056831,000222: 23,3420 76433 VXV* VSL1
056832,000223: 23,3421 02760 STARAD +18D,1 # 18D WA = UA X VA
056833,000224: 23,3422 06766 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
056834,000225:
056835,000226: 23,3423 77700 TIX,1
056836,000227: 23,3424 47411 AXISGEN1
056837,000228:
056838,000229: 23,3425 66160 AXC,1 SXA,1
056839,000230: 23,3426 00006 6
056840,000231: 23,3427 00036 30D
056841,000232:
056842,000233: 23,3430 66370 AXT,1 SSP
056843,000234: 23,3431 00022 18D
056844,000235: 23,3432 00051 S1
056845,000236: 23,3433 00006 6
056846,000237:
056847,000238: 23,3434 66374 AXT,2 SSP
056848,000239: 23,3435 00006 6
056849,000240: 23,3436 00052 S2
056850,000241: 23,3437 00002 2
056851,000242:
056852,000243: 23,3440 76720 AXISGEN2 XCHX,1 VLOAD*
056853,000244: 23,3441 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
056854,000245: 23,3442 00001 0,1
056855,000246:
056856,000247: 23,3443 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
056857,000248: 23,3444 75033 STARAD +6,2
056858,000249: 23,3445 00007 6,1
056859,000250: 23,3446 77757 VXSC*
056860,000251: 23,3447 75025 STARAD +12D,2
056861,000252: 23,3450 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
056862,000253: 23,3451 00015 12D,1
056863,000254:
056864,000255: 23,3452 53357 VXSC* VAD
056865,000256: 23,3453 75017 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
056866,000257: 23,3454 76455 VAD VSL1
056867,000258: 23,3455 00031 24D
056868,000259: 23,3456 53520 XCHX,1 UNIT
056869,000260: 23,3457 00036 30D
056870,000261: 23,3460 06736 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
056871,000262:
056872,000263: 23,3461 77700 TIX,1
056873,000264: 23,3462 47463 AXISGEN3
056874,000265:
056875,000266: 23,3463 77704 AXISGEN3 TIX,2
056876,000267: 23,3464 47440 AXISGEN2
056877,000268:
056878,000269: 23,3465 77775 VLOAD
056879,000270: 23,3466 02714 XDC
056880,000271: 23,3467 26736 STOVL STARAD
056881,000272: 23,3470 02722 YDC
056882,000273: 23,3471 26744 STOVL STARAD +6
056883,000274: 23,3472 02730 ZDC
056884,000275: 23,3473 02752 STORE STARAD +12D
056885,000276:
056886,000277: 23,3474 77616 RVQ
056887,000278:
056888,000279: 23,3475 05520 26075 QTSN45 2DEC .1768
056889,000280: 23,3477 05252 25253 .166... 2DEC .1666666667
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc