Source Code
![]() |
This is the source-code for the Apollo 9 Command Module's Guidance Computer.
These files were derived originally from the scan from MIT's Dibner Institute's
now-discontinued website titled "History of Recent Science and Technology", which
in turn was originally created by Gary Neff, though his high-quality scans were
unfortunately reduced in legibility when presented online.
The markings on the front of the
printout imply that it was the original AGC developer Norm Brodeur's copy.
A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original
AGC developer Fred Martin. The source code was transcribed from
those images by Ron Burkey. Note that the page images
presented online are of reduced quality, and that higher-quality images
are available. Report any conversion errors or legibility
problems in page images to info@sandroid.org.
Notations on the program listing read, in part:ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041 20'35 OCT. 28,1968Note that the date is the date of the printout, not the date of the program revision. |
057925,000002: ## Copyright: Public domain.
057926,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
057927,000004: ## Purpose: Part of the source code for Colossus, build 249.
057928,000005: ## It is part of the source code for the Command Module's (CM)
057929,000006: ## Apollo Guidance Computer (AGC), for Apollo 9.
057930,000007: ## Assembler: yaYUL
057931,000008: ## Reference: Starts on p. 1323
057932,000009: ## Contact: Ron Burkey <info@sandroid.org>.
057933,000010: ## Website: www.ibiblio.org/apollo.
057934,000011: ## Mod history: 08/29/04 RSB. Adapted from corresponding Luminary131 file.
057935,000012: ## 2017-01-06 RSB Page numbers now agree with those on the
057936,000013: ## original harcopy, as opposed to the PDF page
057937,000014: ## numbers in 1701.pdf.
057938,000015: ## 2017-01-14 RSB Cross-diff'd comment text (not whitespace)
057939,000016: ## vs the already-proofed corresponding Colossus
057940,000017: ## 237 and Comanche 55 source-code files
057941,000018: ## and corrected errors found. After corrections,
057942,000019: ## there were no text-comment differences between
057943,000020: ## the different versions.
057944,000021: ##
057945,000022: ## The contents of the "Colossus249" files, in general, are transcribed
057946,000023: ## from a scanned copy of the program listing. Notations on this
057947,000024: ## document read, in part:
057948,000025: ##
057949,000026: ## Assemble revision 249 of AGC program Colossus by NASA
057950,000027: ## 2021111-041. October 28, 1968.
057951,000028: ##
057952,000029: ## This AGC program shall also be referred to as
057953,000030: ## Colossus 1A
057954,000031: ##
057955,000032: ## Prepared by
057956,000033: ## Massachusetts Institute of Technology
057957,000034: ## 75 Cambridge Parkway
057958,000035: ## Cambridge, Massachusetts
057959,000036: ## under NASA contract NAS 9-4065.
057960,000037: ##
057961,000038: ## Refer directly to the online document mentioned above for further information.
057962,000039: ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
057963,000040: ##
057964,000041: ## In some cases, where the source code for Luminary 131 overlaps that of
057965,000042: ## Colossus 249, this code is instead copied from the corresponding Luminary 131
057966,000043: ## source file, and then is proofed to incorporate any changes.
057967,000044:
![]() |
Page 1323 |
057969,000046: 22,3505 BANK 22
057970,000047: 23,2000 SETLOC INFLIGHT
057971,000048: 23,2000 BANK
057972,000049:
057973,000050: 23,3140 E5,1671 EBANK= XSM
057974,000051:
057975,000052: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
057976,000053:
057977,000054: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
057978,000055: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
057979,000056:
057980,000057: # THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
057981,000058: # MGC, AND OGC RESPECTIVELY.
057982,000059:
057983,000060: 23,3140 COUNT 23/INFLT
057984,000061:
057985,000062: 23,3140 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03, 16D-27D, 34D-37D
057986,000063: 23,3141 00051 S2 # XDC = (XD1 XD2 XD3)
057987,000064: 23,3142 02714 XDC # YDC = (YD1 YD2 YD3)
057988,000065: 23,3143 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
057989,000066: 23,3144 15332 HI6ZEROS
057990,000067: 23,3145 02720 XDC +4
057991,000068: 23,3146 55476 DCOMP VDEF
057992,000069: 23,3147 77656 UNIT
057993,000070: 23,3150 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
057994,000071: 23,3151 00027 ZPRIME
057995,000072:
057996,000073: 23,3152 77742 SR1
057997,000074: 23,3153 14023 STODL SINTH # SIN(IGC) = ZP1
057998,000075: 23,3154 00033 ZPRIME +4
057999,000076: 23,3155 77742 SR1
058000,000077: 23,3156 34021 STCALL COSTH # COS(IGC) = ZP3
058001,000078: 23,3157 47211 ARCTRIG
058002,000079:
058003,000080: 23,3160 16762 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
058004,000081: 23,3161 02716 XDC +2
058005,000082: 23,3162 77742 SR1
058006,000083: 23,3163 14023 STODL SINTH # SIN(MGC) = XD2
058007,000084: 23,3164 00027 ZPRIME
058008,000085:
058009,000086: 23,3165 65205 DMP PDDL
058010,000087: 23,3166 02720 XDC +4 # PD00 = (ZP1)(XD3)
058011,000088: 23,3167 00033 ZPRIME +4
058012,000089:
058013,000090: 23,3170 45205 DMP DSU
058014,000091: 23,3171 02714 XDC # MPAC = (ZP3)(XD1)
058015,000092: 23,3172 77626 STADR
058016,000093: 23,3173 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
058017,000094: 23,3174 47211 ARCTRIG
![]() |
Page 1324 |
058019,000096: 23,3175 26764 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
058020,000097: 23,3176 00027 ZPRIME
058021,000098: 23,3177 77641 DOT
058022,000099: 23,3200 02730 ZDC
058023,000100: 23,3201 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
058024,000101: 23,3202 00027 ZPRIME
058025,000102: 23,3203 77641 DOT
058026,000103: 23,3204 02722 YDC
058027,000104: 23,3205 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
058028,000105: 23,3206 47211 ARCTRIG
058029,000106:
058030,000107: 23,3207 36760 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
058031,000108: 23,3210 00051 S2
058032,000109:
![]() |
Page 1325 |
058034,000111: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
058035,000112:
058036,000113: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
058037,000114:
058038,000115: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
058039,000116: # AVAILABLE AT MPAC.
058040,000117:
058041,000118: 23,3211 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
058042,000119: 23,3212 00023 SINTH
058043,000120: 23,3213 50025 DSU BMN
058044,000121: 23,3214 07427 QTSN45 # ABS(SIN/4) - SIN(45)/4
058045,000122: 23,3215 47224 TRIG1 # IF (-45,45) OR (135,-135)
058046,000123:
058047,000124: 23,3216 72545 DLOAD SL1 # (45,135) OR (-135,-45)
058048,000125: 23,3217 00021 COSTH
058049,000126: 23,3220 75326 ACOS SIGN
058050,000127: 23,3221 00023 SINTH
058051,000128: 23,3222 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
058052,000129: 23,3223 77616 RVQ
058053,000130:
058054,000131: 23,3224 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
058055,000132: 23,3225 00023 SINTH
058056,000133: 23,3226 77736 ASIN
058057,000134: 23,3227 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
058058,000135: 23,3230 00021 COSTH
058059,000136: 23,3231 77640 BMN
058060,000137: 23,3232 47235 TRIG2 # IF (135,-135)
058061,000138:
058062,000139: 23,3233 43545 DLOAD RVQ
058063,000140: 23,3234 00025 THETA # X = ARCSIN(SIN) (-45,45)
058064,000141:
058065,000142: 23,3235 75345 TRIG2 DLOAD SIGN # (135,-135)
058066,000143: 23,3236 15330 HIDPHALF
058067,000144: 23,3237 00023 SINTH
058068,000145: 23,3240 77625 DSU
058069,000146: 23,3241 00025 THETA
058070,000147: 23,3242 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
058071,000148: 23,3243 77616 RVQ # (+) - (+) OR (-) - (-)
058072,000149:
![]() |
Page 1326 |
058074,000151: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
058075,000152: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
058076,000153: # FLIGHT SUBROUTINES.
058077,000154:
![]() |
Page 1327 |
058079,000156: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
058080,000157:
058081,000158: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
058082,000159: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
058083,000160: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
058084,000161:
058085,000162: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
058086,000163:
058087,000164: 23,3244 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
058088,000165: 23,3245 00001 0
058089,000166: 23,3246 47375 VLOAD VXV
058090,000167: 23,3247 02714 XNB # XNB = OGA (OUTER GIMBAL AXIS)
058091,000168: 23,3250 02700 YSM # YSM = IGA (INNER GIMBAL AXIS)
058092,000169: 23,3251 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
058093,000170:
058094,000171: 23,3252 44041 DOT ITA
058095,000172: 23,3253 02730 ZNB
058096,000173: 23,3254 00051 S2
058097,000174: 23,3255 24021 STOVL COSTH # COS(OG) = MGA . ZNB
058098,000175: 23,3256 00001 0
058099,000176: 23,3257 77641 DOT
058100,000177: 23,3260 02722 YNB
058101,000178: 23,3261 34023 STCALL SINTH # SIN(OG) = MGA . YNB
058102,000179: 23,3262 47211 ARCTRIG
058103,000180: 23,3263 26760 STOVL OGC
058104,000181: 23,3264 00001 0
058105,000182:
058106,000183: 23,3265 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
058107,000184: 23,3266 02714 XNB
058108,000185: 23,3267 02700 YSM
058109,000186: 23,3270 77752 SL1
058110,000187: 23,3271 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
058111,000188: 23,3272 02700 YSM
058112,000189: 23,3273 77641 DOT
058113,000190: 23,3274 02714 XNB
058114,000191: 23,3275 34023 STCALL SINTH # SIN(MG) = IGA . OGA
058115,000192: 23,3276 47211 ARCTRIG
058116,000193: 23,3277 02764 STORE MGC
058117,000194:
058118,000195: 23,3300 45246 ABS DSU
058119,000196: 23,3301 07431 .166...
058120,000197: 23,3302 77644 BPL
058121,000198: 23,3303 47324 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
058122,000199:
058123,000200: 23,3304 50375 CALCGA1 VLOAD DOT
058124,000201: 23,3305 02706 ZSM
058125,000202: 23,3306 00001 0
058126,000203: 23,3307 24021 STOVL COSTH # COS(IG) = ZSM . MGA
058127,000204: 23,3310 02672 XSM
![]() |
Page 1328 |
058129,000206: 23,3311 45441 DOT STADR
058130,000207: 23,3312 43754 STCALL SINTH # SIN(IG) = XSM . MGA
058131,000208: 23,3313 47211 ARCTRIG
058132,000209:
058133,000210: 23,3314 26762 STOVL IGC
058134,000211: 23,3315 02760 OGC
058135,000212: 23,3316 43034 RTB BONCLR
058136,000213: 23,3317 45547 V1STO2S
058137,000214: 23,3320 00200 CPHIFLAG
058138,000215: 23,3321 00051 S2
058139,000216: 23,3322 35156 STCALL THETAD
058140,000217: 23,3323 00051 S2
058141,000218:
058142,000219: 23,3324 77776 GIMLOCK1 EXIT
058143,000220: 23,3325 05537 TC ALARM
058144,000221: 23,3326 00401 OCT 00401
058145,000222: 23,3327 05435 TC UPFLAG # GIMBAL LOCK HAS OCCURED
058146,000223: 23,3330 00056 ADRES GLOKFAIL
058147,000224:
058148,000225: 23,3331 06006 TC INTPRET
058149,000226: 23,3332 77650 GOTO
058150,000227: 23,3333 47304 CALCGA1
058151,000228:
![]() |
Page 1329 |
058153,000230: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
058154,000231:
058155,000232: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
058156,000233: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
058157,000234: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
058158,000235: # THE VAC AREA.
058159,000236:
058160,000237: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
058161,000238: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
058162,000239:
058163,000240: 23,3334 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D, 34D-37D
058164,000241: 23,3335 02743 STARAD +6
058165,000242: 23,3336 00051 S1
058166,000243: 23,3337 02727 STARAD -6
058167,000244:
058168,000245: 23,3340 77601 SETPD
058169,000246: 23,3341 00001 0
058170,000247: 23,3342 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
058171,000248: 23,3343 02752 STARAD +12D,1 # STARAD +00D UB = S1
058172,000249: 23,3344 02760 STARAD +18D,1
058173,000250: 23,3345 77656 UNIT # 12D VA = UNIT(S1 X S2)
058174,000251: 23,3346 06760 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
058175,000252: 23,3347 77773 VLOAD*
058176,000253: 23,3350 02752 STARAD +12D,1
058177,000254:
058178,000255: 23,3351 76433 VXV* VSL1
058179,000256: 23,3352 02760 STARAD +18D,1 # 18D WA = UA X VA
058180,000257: 23,3353 06766 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
058181,000258:
058182,000259: 23,3354 77700 TIX,1
058183,000260: 23,3355 47342 AXISGEN1
058184,000261:
058185,000262: 23,3356 66160 AXC,1 SXA,1
058186,000263: 23,3357 00006 6
058187,000264: 23,3360 00036 30D
058188,000265:
058189,000266: 23,3361 66370 AXT,1 SSP
058190,000267: 23,3362 00022 18D
058191,000268: 23,3363 00051 S1
058192,000269: 23,3364 00006 6
058193,000270:
058194,000271: 23,3365 66374 AXT,2 SSP
058195,000272: 23,3366 00006 6
058196,000273: 23,3367 00052 S2
058197,000274: 23,3370 00002 2
058198,000275:
058199,000276: 23,3371 76720 AXISGEN2 XCHX,1 VLOAD*
058200,000277: 23,3372 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
058201,000278: 23,3373 00001 0,1
058202,000279:
![]() |
Page 1330 |
058204,000281: 23,3374 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
058205,000282: 23,3375 75033 STARAD +6,2
058206,000283: 23,3376 00007 6,1
058207,000284: 23,3377 77757 VXSC*
058208,000285: 23,3400 75025 STARAD +12D,2
058209,000286: 23,3401 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
058210,000287: 23,3402 00015 12D,1
058211,000288:
058212,000289: 23,3403 53357 VXSC* VAD
058213,000290: 23,3404 75017 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
058214,000291: 23,3405 76455 VAD VSL1
058215,000292: 23,3406 00031 24D
058216,000293: 23,3407 53520 XCHX,1 UNIT
058217,000294: 23,3410 00036 30D
058218,000295: 23,3411 06736 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
058219,000296:
058220,000297: 23,3412 77700 TIX,1
058221,000298: 23,3413 47414 AXISGEN3
058222,000299:
058223,000300: 23,3414 77704 AXISGEN3 TIX,2
058224,000301: 23,3415 47371 AXISGEN2
058225,000302:
058226,000303: 23,3416 77775 VLOAD
058227,000304: 23,3417 02714 XDC
058228,000305: 23,3420 26736 STOVL STARAD
058229,000306: 23,3421 02722 YDC
058230,000307: 23,3422 26744 STOVL STARAD +6
058231,000308: 23,3423 02730 ZDC
058232,000309: 23,3424 02752 STORE STARAD +12D
058233,000310:
058234,000311: 23,3425 77616 RVQ
058235,000312:
![]() |
Page 1331 |
058237,000314: 23,3426 05520 26075 QTSN45 2DEC .1768
058238,000315: 23,3430 05252 25253 .166... 2DEC .1666666667
058239,000316:
![]() |
Page 1332 There is no source code on this page of the original assembly listing. —RSB 2004 |
058242,000319:
058243,000320:
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc