Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Colossus 249 (Apollo 9) source code to agree with the images from the printout. 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:

	GAP:  ASSEMBLE REVISION 055 OF AGC PROGRAM COMANCHE BY NASA 2021113-051
	10:28 APR.  1,1969
Note that the date is the date of the printout, not the date of the program revision.

059073,000002:                                                                                                  ## Copyright:   Public domain.
059074,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
059075,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus 2A, AKA Comanche 055.
059076,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
059077,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
059078,000007:                                                                                                  ## Assembler:   yaYUL
059079,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059080,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
059081,000010:                                                                                                  ## Pages:       1355-1364
059082,000011:                                                                                                  ## Mod history: 2009-05-14 RSB  Adapted from the Colossus249/ file of the
059083,000012:                                                                                                  ##                              same name, using Comanche055 page images.
059084,000013:                                                                                                  ##              2016-12-22 RSB  Proofed comment text using octopus/ProoferComments
059085,000014:                                                                                                  ##                              and corrected the errors found.
059086,000015:                                                                                                  ##
059087,000016:                                                                                                  ## This source code has been transcribed or otherwise adapted from digitized
059088,000017:                                                                                                  ## images of a hardcopy from the MIT Museum.  The digitization was performed
059089,000018:                                                                                                  ## by Paul Fjeld, and arranged for by Deborah Douglas of the Museum.  Many
059090,000019:                                                                                                  ## thanks to both.  The images (with suitable reduction in storage size and
059091,000020:                                                                                                  ## consequent reduction in image quality as well) are available online at
059092,000021:                                                                                                  ## www.ibiblio.org/apollo.  If for some reason you find that the images are
059093,000022:                                                                                                  ## illegible, contact me at info@sandroid.org about getting access to the 
059094,000023:                                                                                                  ## (much) higher-quality images which Paul actually created.
059095,000024:                                                                                                  ##
059096,000025:                                                                                                  ## Notations on the hardcopy document read, in part:
059097,000026:                                                                                                  ##
059098,000027:                                                                                                  ##      Assemble revision 055 of AGC program Comanche by NASA
059099,000028:                                                                                                  ##      2021113-051.  10:28 APR. 1, 1969  
059100,000029:                                                                                                  ##
059101,000030:                                                                                                  ##      This AGC program shall also be referred to as
059102,000031:                                                                                                  ##                      Colossus 2A
059103,000032: 

Page 1355

059105,000034: 22,3510                                           BANK     22                                    
059106,000035: 23,2000                                           SETLOC   INFLIGHT                              
059107,000036: 23,2000                                           BANK                                           
059108,000037: 
059109,000038: 23,3205  E5,1671                                  EBANK=   XSM                                   
059110,000039: 
059111,000040:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
059112,000041: 
059113,000042:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
059114,000043:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
059115,000044: 
059116,000045:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
059117,000046:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
059118,000047: 
059119,000048: 23,3205                                           COUNT    23/INFLT                              
059120,000049: 
059121,000050: 23,3205           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
059122,000051: 23,3206           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
059123,000052: 23,3207           02714                                    XDC                                   #  YDC = (YD1 YD2 YD3)
059124,000053: 23,3210           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
059125,000054: 23,3211           15335                                    HI6ZEROS                              
059126,000055: 23,3212           02720                                    XDC        +4                         
059127,000056: 23,3213           55476                           DCOMP    VDEF                                  
059128,000057: 23,3214           77656                           UNIT                                           
059129,000058: 23,3215           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
059130,000059: 23,3216           00027                                    ZPRIME                                
059131,000060: 
059132,000061: 23,3217           77742                           SR1                                            
059133,000062: 23,3220           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
059134,000063: 23,3221           00033                                    ZPRIME     +4                         
059135,000064: 23,3222           77742                           SR1                                            
059136,000065: 23,3223           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
059137,000066: 23,3224           47256                                    ARCTRIG                               
059138,000067: 
059139,000068: 23,3225           16762                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
059140,000069: 23,3226           02716                                    XDC        +2                         
059141,000070: 23,3227           77742                           SR1                                            
059142,000071: 23,3230           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
059143,000072: 23,3231           00027                                    ZPRIME                                
059144,000073: 
059145,000074: 23,3232           65205                           DMP      PDDL                                  
059146,000075: 23,3233           02720                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
059147,000076: 23,3234           00033                                    ZPRIME     +4                         
059148,000077: 
059149,000078: 23,3235           45205                           DMP      DSU                                   
059150,000079: 23,3236           02714                                    XDC                                   #  MPAC = (ZP3)(XD1)
059151,000080: 23,3237           77626                           STADR                                          
059152,000081: 23,3240           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
059153,000082: 23,3241           47256                                    ARCTRIG                               

Page 1356

059155,000084: 23,3242           26764                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
059156,000085: 23,3243           00027                                    ZPRIME                                
059157,000086: 23,3244           77641                           DOT                                            
059158,000087: 23,3245           02730                                    ZDC                                   
059159,000088: 23,3246           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
059160,000089: 23,3247           00027                                    ZPRIME                                
059161,000090: 23,3250           77641                           DOT                                            
059162,000091: 23,3251           02722                                    YDC                                   
059163,000092: 23,3252           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
059164,000093: 23,3253           47256                                    ARCTRIG                               
059165,000094: 
059166,000095: 23,3254           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
059167,000096: 23,3255           00051                                    S2                                    
059168,000097: 

Page 1357

059170,000099:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
059171,000100: 
059172,000101:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
059173,000102: 
059174,000103:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
059175,000104:                                                                                                  #  AVAILABLE AT MPAC.
059176,000105: 
059177,000106: 23,3256           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
059178,000107: 23,3257           00023                                    SINTH                                 
059179,000108: 23,3260           50025                           DSU      BMN                                   
059180,000109: 23,3261           07474                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
059181,000110: 23,3262           47271                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
059182,000111: 
059183,000112: 23,3263           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
059184,000113: 23,3264           00021                                    COSTH                                 
059185,000114: 23,3265           75326                           ACOS     SIGN                                  
059186,000115: 23,3266           00023                                    SINTH                                 
059187,000116: 23,3267           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
059188,000117: 23,3270           77616                           RVQ                                            
059189,000118: 
059190,000119: 23,3271           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
059191,000120: 23,3272           00023                                    SINTH                                 
059192,000121: 23,3273           77736                           ASIN                                           
059193,000122: 23,3274           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
059194,000123: 23,3275           00021                                    COSTH                                 
059195,000124: 23,3276           77640                           BMN                                            
059196,000125: 23,3277           47302                                    TRIG2                                 #  IF (135,-135)
059197,000126: 
059198,000127: 23,3300           43545                           DLOAD    RVQ                                   
059199,000128: 23,3301           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
059200,000129: 
059201,000130: 23,3302           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
059202,000131: 23,3303           15333                                    HIDPHALF                              
059203,000132: 23,3304           00023                                    SINTH                                 
059204,000133: 23,3305           77625                           DSU                                            
059205,000134: 23,3306           00025                                    THETA                                 
059206,000135: 23,3307           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
059207,000136: 23,3310           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
059208,000137: 

Page 1358

059210,000139:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
059211,000140:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
059212,000141:                                                                                                  #  FLIGHT SUBROUTINES.
059213,000142: 

Page 1359

059215,000144:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
059216,000145: 
059217,000146:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
059218,000147:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
059219,000148:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
059220,000149: 
059221,000150:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
059222,000151: 
059223,000152: 23,3311           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
059224,000153: 23,3312           00001                                    0                                     
059225,000154: 23,3313           47375                           VLOAD    VXV                                   
059226,000155: 23,3314           02714                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
059227,000156: 23,3315           02700                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
059228,000157: 23,3316           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
059229,000158: 
059230,000159: 23,3317           44041                           DOT      ITA                                   
059231,000160: 23,3320           02730                                    ZNB                                   
059232,000161: 23,3321           00051                                    S2                                    
059233,000162: 23,3322           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
059234,000163: 23,3323           00001                                    0                                     
059235,000164: 23,3324           77641                           DOT                                            
059236,000165: 23,3325           02722                                    YNB                                   
059237,000166: 23,3326           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
059238,000167: 23,3327           47256                                    ARCTRIG                               
059239,000168: 23,3330           26760                           STOVL    OGC                                   
059240,000169: 23,3331           00001                                    0                                     
059241,000170: 
059242,000171: 23,3332           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
059243,000172: 23,3333           02714                                    XNB                                   
059244,000173: 23,3334           02700                                    YSM                                   
059245,000174: 23,3335           77752                           SL1                                            
059246,000175: 23,3336           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
059247,000176: 23,3337           02700                                    YSM                                   
059248,000177: 23,3340           77641                           DOT                                            
059249,000178: 23,3341           02714                                    XNB                                   
059250,000179: 23,3342           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
059251,000180: 23,3343           47256                                    ARCTRIG                               
059252,000181: 23,3344           02764                           STORE    MGC                                   
059253,000182: 
059254,000183: 23,3345           45246                           ABS      DSU                                   
059255,000184: 23,3346           07476                                    .166...                               
059256,000185: 23,3347           77644                           BPL                                            
059257,000186: 23,3350           47371                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
059258,000187: 
059259,000188: 23,3351           50375        CALCGA1            VLOAD    DOT                                   
059260,000189: 23,3352           02706                                    ZSM                                   
059261,000190: 23,3353           00001                                    0                                     
059262,000191: 23,3354           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
059263,000192: 23,3355           02672                                    XSM                                   

Page 1360

059265,000194: 23,3356           45441                           DOT      STADR                                 
059266,000195: 23,3357           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
059267,000196: 23,3360           47256                                    ARCTRIG                               
059268,000197: 
059269,000198: 23,3361           26762                           STOVL    IGC                                   
059270,000199: 23,3362           02760                                    OGC                                   
059271,000200: 23,3363           43034                           RTB      BONCLR                                
059272,000201: 23,3364           45552                                    V1STO2S                               
059273,000202: 23,3365           00200                                    CPHIFLAG                              
059274,000203: 23,3366           00051                                    S2                                    
059275,000204: 23,3367           35156                           STCALL   THETAD                                
059276,000205: 23,3370           00051                                    S2                                    
059277,000206: 
059278,000207: 23,3371           77776        GIMLOCK1           EXIT                                           
059279,000208: 23,3372           05650                           TC       ALARM                                 
059280,000209: 23,3373           00401                           OCT      00401                                 
059281,000210: 23,3374           05546                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
059282,000211: 23,3375           00056                           ADRES    GLOKFAIL                              
059283,000212: 
059284,000213: 23,3376           06006                           TC       INTPRET                               
059285,000214: 23,3377           77650                           GOTO                                           
059286,000215: 23,3400           47351                                    CALCGA1                               
059287,000216: 

Page 1361

059289,000218:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
059290,000219: 
059291,000220:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
059292,000221:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
059293,000222:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
059294,000223:                                                                                                  #  THE VAC AREA.
059295,000224: 
059296,000225:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
059297,000226:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
059298,000227: 
059299,000228: 23,3401           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
059300,000229: 23,3402           02743                                    STARAD     +6                         
059301,000230: 23,3403           00051                                    S1                                    
059302,000231: 23,3404           02727                                    STARAD     -6                         
059303,000232: 
059304,000233: 23,3405           77601                           SETPD                                          
059305,000234: 23,3406           00001                                    0                                     
059306,000235: 23,3407           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
059307,000236: 23,3410           02752                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
059308,000237: 23,3411           02760                                    STARAD     +18D,1                     
059309,000238: 23,3412           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
059310,000239: 23,3413           06760                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
059311,000240: 23,3414           77773                           VLOAD*                                         
059312,000241: 23,3415           02752                                    STARAD     +12D,1                     
059313,000242: 
059314,000243: 23,3416           76433                           VXV*     VSL1                                  
059315,000244: 23,3417           02760                                    STARAD     +18D,1                     #  18D   WA = UA X VA
059316,000245: 23,3420           06766                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
059317,000246: 
059318,000247: 23,3421           77700                           TIX,1                                          
059319,000248: 23,3422           47407                                    AXISGEN1                              
059320,000249: 
059321,000250: 23,3423           66160                           AXC,1    SXA,1                                 
059322,000251: 23,3424           00006                                    6                                     
059323,000252: 23,3425           00036                                    30D                                   
059324,000253: 
059325,000254: 23,3426           66370                           AXT,1    SSP                                   
059326,000255: 23,3427           00022                                    18D                                   
059327,000256: 23,3430           00051                                    S1                                    
059328,000257: 23,3431           00006                                    6                                     
059329,000258: 
059330,000259: 23,3432           66374                           AXT,2    SSP                                   
059331,000260: 23,3433           00006                                    6                                     
059332,000261: 23,3434           00052                                    S2                                    
059333,000262: 23,3435           00002                                    2                                     
059334,000263: 
059335,000264: 23,3436           76720        AXISGEN2           XCHX,1   VLOAD*                                
059336,000265: 23,3437           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
059337,000266: 23,3440           00001                                    0,1                                   
059338,000267: 

Page 1362

059340,000269: 23,3441           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
059341,000270: 23,3442           75033                                    STARAD     +6,2                       
059342,000271: 23,3443           00007                                    6,1                                   
059343,000272: 23,3444           77757                           VXSC*                                          
059344,000273: 23,3445           75025                                    STARAD     +12D,2                     
059345,000274: 23,3446           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
059346,000275: 23,3447           00015                                    12D,1                                 
059347,000276: 
059348,000277: 23,3450           53357                           VXSC*    VAD                                   
059349,000278: 23,3451           75017                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
059350,000279: 23,3452           76455                           VAD      VSL1                                  
059351,000280: 23,3453           00031                                    24D                                   
059352,000281: 23,3454           53520                           XCHX,1   UNIT                                  
059353,000282: 23,3455           00036                                    30D                                   
059354,000283: 23,3456           06736                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
059355,000284: 
059356,000285: 23,3457           77700                           TIX,1                                          
059357,000286: 23,3460           47461                                    AXISGEN3                              
059358,000287: 
059359,000288: 23,3461           77704        AXISGEN3           TIX,2                                          
059360,000289: 23,3462           47436                                    AXISGEN2                              
059361,000290: 
059362,000291: 23,3463           77775                           VLOAD                                          
059363,000292: 23,3464           02714                                    XDC                                   
059364,000293: 23,3465           26736                           STOVL    STARAD                                
059365,000294: 23,3466           02722                                    YDC                                   
059366,000295: 23,3467           26744                           STOVL    STARAD     +6                         
059367,000296: 23,3470           02730                                    ZDC                                   
059368,000297: 23,3471           02752                           STORE    STARAD     +12D                       
059369,000298: 
059370,000299: 23,3472           77616                           RVQ                                            
059371,000300: 

Page 1363

059373,000302: 23,3473           05520 26075  QTSN45             2DEC     .1768                                 
059374,000303: 23,3475           05252 25253  .166...            2DEC     .1666666667                            
059375,000304: 

Page 1364 This page is empty.

059378,000307: 
059379,000308: 
059380,000309: 

End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc.  Parent file is MAIN.agc