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.

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

Page 1355

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

Page 1356

059172,000084: 23,3242           26764                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
059173,000085: 23,3243           00027                                    ZPRIME                                
059174,000086: 23,3244           77641                           DOT                                            
059175,000087: 23,3245           02730                                    ZDC                                   
059176,000088: 23,3246           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
059177,000089: 23,3247           00027                                    ZPRIME                                
059178,000090: 23,3250           77641                           DOT                                            
059179,000091: 23,3251           02722                                    YDC                                   
059180,000092: 23,3252           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
059181,000093: 23,3253           47256                                    ARCTRIG                               
059182,000094: 
059183,000095: 23,3254           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
059184,000096: 23,3255           00051                                    S2                                    
059185,000097: 

Page 1357

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

Page 1358

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

Page 1359

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

Page 1360

059282,000194: 23,3356           45441                           DOT      STADR                                 
059283,000195: 23,3357           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
059284,000196: 23,3360           47256                                    ARCTRIG                               
059285,000197: 
059286,000198: 23,3361           26762                           STOVL    IGC                                   
059287,000199: 23,3362           02760                                    OGC                                   
059288,000200: 23,3363           43034                           RTB      BONCLR                                
059289,000201: 23,3364           45552                                    V1STO2S                               
059290,000202: 23,3365           00200                                    CPHIFLAG                              
059291,000203: 23,3366           00051                                    S2                                    
059292,000204: 23,3367           35156                           STCALL   THETAD                                
059293,000205: 23,3370           00051                                    S2                                    
059294,000206: 
059295,000207: 23,3371           77776        GIMLOCK1           EXIT                                           
059296,000208: 23,3372           05650                           TC       ALARM                                 
059297,000209: 23,3373           00401                           OCT      00401                                 
059298,000210: 23,3374           05546                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
059299,000211: 23,3375           00056                           ADRES    GLOKFAIL                              
059300,000212: 
059301,000213: 23,3376           06006                           TC       INTPRET                               
059302,000214: 23,3377           77650                           GOTO                                           
059303,000215: 23,3400           47351                                    CALCGA1                               
059304,000216: 

Page 1361

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

Page 1362

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

Page 1363

059390,000302: 23,3473           05520 26075  QTSN45             2DEC     .1768                                 
059391,000303: 23,3475           05252 25253  .166...            2DEC     .1666666667                            
059392,000304: 

Page 1364 This page is empty.

059395,000307: 
059396,000308: 
059397,000309: 

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