Source Code
These source-code files are part of a reconstructed copy of Comanche 45, the
second release, though not the final mission release, of the Apollo 10
Command Module (CM) Apollo Guidance Computer (AGC) software. Comanche 45 was
preceded by Comanche 44 and followed by Comanche 45/2 (the flown release). The reconstruction
is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 45, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 44 (itself previously accurately reconstructed). Comanche 44 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 44 and 45. The now-reconstructed Comanche 45 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 44. Here's a guide to the Apollo documentation referenced in those annotations:
Comments expected to have been present in 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. |
057673,000002: ## Copyright: Public domain.
057674,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
057675,000004: ## Purpose: A section of Comanche revision 045.
057676,000005: ## It is part of the reconstructed source code for the
057677,000006: ## second release of the flight software for the Command
057678,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
057679,000008: ## The code has been recreated from a copy of Comanche 055. It
057680,000009: ## has been adapted such that the resulting bugger words
057681,000010: ## exactly match those specified for Comanche 45 in NASA drawing
057682,000011: ## 2021153D, which gives relatively high confidence that the
057683,000012: ## reconstruction is correct.
057684,000013: ## Assembler: yaYUL
057685,000014: ## Contact: Ron Burkey <info@sandroid.org>.
057686,000015: ## Website: www.ibiblio.org/apollo/index.html
057687,000016: ## Mod history: 2020-12-06 MAS Created from Comanche 44.
057688,000017:
Page 1355 |
057690,000019: 22,3510 BANK 22
057691,000020: 23,2000 SETLOC INFLIGHT
057692,000021: 23,2000 BANK
057693,000022:
057694,000023: 23,3205 E5,1671 EBANK= XSM
057695,000024:
057696,000025: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
057697,000026:
057698,000027: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
057699,000028: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
057700,000029:
057701,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,
057702,000031: # MGC, AND OGC RESPECTIVELY.
057703,000032:
057704,000033: 23,3205 COUNT 23/INFLT
057705,000034:
057706,000035: 23,3205 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03, 16D-27D, 34D-37D
057707,000036: 23,3206 00051 S2 # XDC = (XD1 XD2 XD3)
057708,000037: 23,3207 02714 XDC # YDC = (YD1 YD2 YD3)
057709,000038: 23,3210 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
057710,000039: 23,3211 15335 HI6ZEROS
057711,000040: 23,3212 02720 XDC +4
057712,000041: 23,3213 55476 DCOMP VDEF
057713,000042: 23,3214 77656 UNIT
057714,000043: 23,3215 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
057715,000044: 23,3216 00027 ZPRIME
057716,000045:
057717,000046: 23,3217 77742 SR1
057718,000047: 23,3220 14023 STODL SINTH # SIN(IGC) = ZP1
057719,000048: 23,3221 00033 ZPRIME +4
057720,000049: 23,3222 77742 SR1
057721,000050: 23,3223 34021 STCALL COSTH # COS(IGC) = ZP3
057722,000051: 23,3224 47256 ARCTRIG
057723,000052:
057724,000053: 23,3225 16762 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
057725,000054: 23,3226 02716 XDC +2
057726,000055: 23,3227 77742 SR1
057727,000056: 23,3230 14023 STODL SINTH # SIN(MGC) = XD2
057728,000057: 23,3231 00027 ZPRIME
057729,000058:
057730,000059: 23,3232 65205 DMP PDDL
057731,000060: 23,3233 02720 XDC +4 # PD00 = (ZP1)(XD3)
057732,000061: 23,3234 00033 ZPRIME +4
057733,000062:
057734,000063: 23,3235 45205 DMP DSU
057735,000064: 23,3236 02714 XDC # MPAC = (ZP3)(XD1)
057736,000065: 23,3237 77626 STADR
057737,000066: 23,3240 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
057738,000067: 23,3241 47256 ARCTRIG
Page 1356 |
057740,000069: 23,3242 26764 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
057741,000070: 23,3243 00027 ZPRIME
057742,000071: 23,3244 77641 DOT
057743,000072: 23,3245 02730 ZDC
057744,000073: 23,3246 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
057745,000074: 23,3247 00027 ZPRIME
057746,000075: 23,3250 77641 DOT
057747,000076: 23,3251 02722 YDC
057748,000077: 23,3252 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
057749,000078: 23,3253 47256 ARCTRIG
057750,000079:
057751,000080: 23,3254 36760 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
057752,000081: 23,3255 00051 S2
057753,000082:
Page 1357 |
057755,000084: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
057756,000085:
057757,000086: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
057758,000087:
057759,000088: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
057760,000089: # AVAILABLE AT MPAC.
057761,000090:
057762,000091: 23,3256 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
057763,000092: 23,3257 00023 SINTH
057764,000093: 23,3260 50025 DSU BMN
057765,000094: 23,3261 07474 QTSN45 # ABS(SIN/4) - SIN(45)/4
057766,000095: 23,3262 47271 TRIG1 # IF (-45,45) OR (135,-135)
057767,000096:
057768,000097: 23,3263 72545 DLOAD SL1 # (45,135) OR (-135,-45)
057769,000098: 23,3264 00021 COSTH
057770,000099: 23,3265 75326 ACOS SIGN
057771,000100: 23,3266 00023 SINTH
057772,000101: 23,3267 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
057773,000102: 23,3270 77616 RVQ
057774,000103:
057775,000104: 23,3271 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
057776,000105: 23,3272 00023 SINTH
057777,000106: 23,3273 77736 ASIN
057778,000107: 23,3274 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
057779,000108: 23,3275 00021 COSTH
057780,000109: 23,3276 77640 BMN
057781,000110: 23,3277 47302 TRIG2 # IF (135,-135)
057782,000111:
057783,000112: 23,3300 43545 DLOAD RVQ
057784,000113: 23,3301 00025 THETA # X = ARCSIN(SIN) (-45,45)
057785,000114:
057786,000115: 23,3302 75345 TRIG2 DLOAD SIGN # (135,-135)
057787,000116: 23,3303 15333 HIDPHALF
057788,000117: 23,3304 00023 SINTH
057789,000118: 23,3305 77625 DSU
057790,000119: 23,3306 00025 THETA
057791,000120: 23,3307 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
057792,000121: 23,3310 77616 RVQ # (+) - (+) OR (-) - (-)
057793,000122:
Page 1358 |
057795,000124: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
057796,000125: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
057797,000126: # FLIGHT SUBROUTINES.
057798,000127:
Page 1359 |
057800,000129: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
057801,000130:
057802,000131: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
057803,000132: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
057804,000133: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
057805,000134:
057806,000135: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
057807,000136:
057808,000137: 23,3311 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
057809,000138: 23,3312 00001 0
057810,000139: 23,3313 47375 VLOAD VXV
057811,000140: 23,3314 02714 XNB # XNB = OGA (OUTER GIMBAL AXIS)
057812,000141: 23,3315 02700 YSM # YSM = IGA (INNER GIMBAL AXIS)
057813,000142: 23,3316 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
057814,000143:
057815,000144: 23,3317 44041 DOT ITA
057816,000145: 23,3320 02730 ZNB
057817,000146: 23,3321 00051 S2
057818,000147: 23,3322 24021 STOVL COSTH # COS(OG) = MGA . ZNB
057819,000148: 23,3323 00001 0
057820,000149: 23,3324 77641 DOT
057821,000150: 23,3325 02722 YNB
057822,000151: 23,3326 34023 STCALL SINTH # SIN(OG) = MGA . YNB
057823,000152: 23,3327 47256 ARCTRIG
057824,000153: 23,3330 26760 STOVL OGC
057825,000154: 23,3331 00001 0
057826,000155:
057827,000156: 23,3332 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
057828,000157: 23,3333 02714 XNB
057829,000158: 23,3334 02700 YSM
057830,000159: 23,3335 77752 SL1
057831,000160: 23,3336 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
057832,000161: 23,3337 02700 YSM
057833,000162: 23,3340 77641 DOT
057834,000163: 23,3341 02714 XNB
057835,000164: 23,3342 34023 STCALL SINTH # SIN(MG) = IGA . OGA
057836,000165: 23,3343 47256 ARCTRIG
057837,000166: 23,3344 02764 STORE MGC
057838,000167:
057839,000168: 23,3345 45246 ABS DSU
057840,000169: 23,3346 07476 .166...
057841,000170: 23,3347 77644 BPL
057842,000171: 23,3350 47371 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
057843,000172:
057844,000173: 23,3351 50375 CALCGA1 VLOAD DOT
057845,000174: 23,3352 02706 ZSM
057846,000175: 23,3353 00001 0
057847,000176: 23,3354 24021 STOVL COSTH # COS(IG) = ZSM . MGA
057848,000177: 23,3355 02672 XSM
Page 1360 |
057850,000179: 23,3356 45441 DOT STADR
057851,000180: 23,3357 43754 STCALL SINTH # SIN(IG) = XSM . MGA
057852,000181: 23,3360 47256 ARCTRIG
057853,000182:
057854,000183: 23,3361 26762 STOVL IGC
057855,000184: 23,3362 02760 OGC
057856,000185: 23,3363 43034 RTB BONCLR
057857,000186: 23,3364 45552 V1STO2S
057858,000187: 23,3365 00200 CPHIFLAG
057859,000188: 23,3366 00051 S2
057860,000189: 23,3367 35156 STCALL THETAD
057861,000190: 23,3370 00051 S2
057862,000191:
057863,000192: 23,3371 77776 GIMLOCK1 EXIT
057864,000193: 23,3372 05650 TC ALARM
057865,000194: 23,3373 00401 OCT 00401
057866,000195: 23,3374 05546 TC UPFLAG # GIMBAL LOCK HAS OCCURED
057867,000196: 23,3375 00056 ADRES GLOKFAIL
057868,000197:
057869,000198: 23,3376 06006 TC INTPRET
057870,000199: 23,3377 77650 GOTO
057871,000200: 23,3400 47351 CALCGA1
057872,000201:
Page 1361 |
057874,000203: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
057875,000204:
057876,000205: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
057877,000206: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
057878,000207: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
057879,000208: # THE VAC AREA.
057880,000209:
057881,000210: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
057882,000211: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
057883,000212:
057884,000213: 23,3401 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D, 34D-37D
057885,000214: 23,3402 02743 STARAD +6
057886,000215: 23,3403 00051 S1
057887,000216: 23,3404 02727 STARAD -6
057888,000217:
057889,000218: 23,3405 77601 SETPD
057890,000219: 23,3406 00001 0
057891,000220: 23,3407 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
057892,000221: 23,3410 02752 STARAD +12D,1 # STARAD +00D UB = S1
057893,000222: 23,3411 02760 STARAD +18D,1
057894,000223: 23,3412 77656 UNIT # 12D VA = UNIT(S1 X S2)
057895,000224: 23,3413 06760 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
057896,000225: 23,3414 77773 VLOAD*
057897,000226: 23,3415 02752 STARAD +12D,1
057898,000227:
057899,000228: 23,3416 76433 VXV* VSL1
057900,000229: 23,3417 02760 STARAD +18D,1 # 18D WA = UA X VA
057901,000230: 23,3420 06766 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
057902,000231:
057903,000232: 23,3421 77700 TIX,1
057904,000233: 23,3422 47407 AXISGEN1
057905,000234:
057906,000235: 23,3423 66160 AXC,1 SXA,1
057907,000236: 23,3424 00006 6
057908,000237: 23,3425 00036 30D
057909,000238:
057910,000239: 23,3426 66370 AXT,1 SSP
057911,000240: 23,3427 00022 18D
057912,000241: 23,3430 00051 S1
057913,000242: 23,3431 00006 6
057914,000243:
057915,000244: 23,3432 66374 AXT,2 SSP
057916,000245: 23,3433 00006 6
057917,000246: 23,3434 00052 S2
057918,000247: 23,3435 00002 2
057919,000248:
057920,000249: 23,3436 76720 AXISGEN2 XCHX,1 VLOAD*
057921,000250: 23,3437 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
057922,000251: 23,3440 00001 0,1
057923,000252:
Page 1362 |
057925,000254: 23,3441 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
057926,000255: 23,3442 75033 STARAD +6,2
057927,000256: 23,3443 00007 6,1
057928,000257: 23,3444 77757 VXSC*
057929,000258: 23,3445 75025 STARAD +12D,2
057930,000259: 23,3446 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
057931,000260: 23,3447 00015 12D,1
057932,000261:
057933,000262: 23,3450 53357 VXSC* VAD
057934,000263: 23,3451 75017 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
057935,000264: 23,3452 76455 VAD VSL1
057936,000265: 23,3453 00031 24D
057937,000266: 23,3454 53520 XCHX,1 UNIT
057938,000267: 23,3455 00036 30D
057939,000268: 23,3456 06736 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
057940,000269:
057941,000270: 23,3457 77700 TIX,1
057942,000271: 23,3460 47461 AXISGEN3
057943,000272:
057944,000273: 23,3461 77704 AXISGEN3 TIX,2
057945,000274: 23,3462 47436 AXISGEN2
057946,000275:
057947,000276: 23,3463 77775 VLOAD
057948,000277: 23,3464 02714 XDC
057949,000278: 23,3465 26736 STOVL STARAD
057950,000279: 23,3466 02722 YDC
057951,000280: 23,3467 26744 STOVL STARAD +6
057952,000281: 23,3470 02730 ZDC
057953,000282: 23,3471 02752 STORE STARAD +12D
057954,000283:
057955,000284: 23,3472 77616 RVQ
057956,000285:
Page 1363 |
057958,000287: 23,3473 05520 26075 QTSN45 2DEC .1768
057959,000288: 23,3475 05252 25253 .166... 2DEC .1666666667
057960,000289:
Page 1364 This page is empty. |
057963,000292:
057964,000293:
057965,000294:
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc