Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional 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 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

056179,000002:                                                                                                  ## Copyright:   Public domain.
056180,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
056181,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
056182,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
056183,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
056184,000007:                                                                                                  ## Assembler:   yaYUL
056185,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
056186,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
056187,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
056188,000011:                                                                                                  ## Mod history: 2011-04-17 JL   Adapted from corresponding Colossus 249 file.
056189,000012:                                                                                                  ##              2017-01-01 RSB  Proofed comment text using octopus/ProoferComments,
056190,000013:                                                                                                  ##                              and fixed errors found.
056191,000014: 

Page 1319

056193,000016: 22,3505                                           BANK     22                                    
056194,000017: 23,2000                                           SETLOC   INFLIGHT                              
056195,000018: 23,2000                                           BANK                                           
056196,000019: 
056197,000020: 23,3140  E5,1671                                  EBANK=   XSM                                   
056198,000021: 
056199,000022: 
056200,000023:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056201,000024: 
056202,000025:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
056203,000026:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
056204,000027: 
056205,000028:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
056206,000029:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
056207,000030: 
056208,000031: 23,3140                                           COUNT    23/INFLT                              
056209,000032: 
056210,000033: 23,3140           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN  00-03,16D-27D,34D-37D
056211,000034: 23,3141           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
056212,000035: 23,3142           02714                                    XDC                                   #  YDC = (YD1 YD2 YD3)
056213,000036: 23,3143           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
056214,000037: 23,3144           15332                                    HI6ZEROS                              
056215,000038: 23,3145           02720                                    XDC        +4                         
056216,000039: 23,3146           55476                           DCOMP    VDEF                                  
056217,000040: 23,3147           77656                           UNIT                                           
056218,000041: 23,3150           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
056219,000042: 23,3151           00027                                    ZPRIME                                
056220,000043: 
056221,000044: 23,3152           77742                           SR1                                            
056222,000045: 23,3153           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
056223,000046: 23,3154           00033                                    ZPRIME     +4                         
056224,000047: 23,3155           77742                           SR1                                            
056225,000048: 23,3156           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
056226,000049: 23,3157           47211                                    ARCTRIG                               
056227,000050: 
056228,000051: 23,3160           16762                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
056229,000052: 23,3161           02716                                    XDC        +2                         
056230,000053: 23,3162           77742                           SR1                                            
056231,000054: 23,3163           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
056232,000055: 23,3164           00027                                    ZPRIME                                
056233,000056: 
056234,000057: 23,3165           65205                           DMP      PDDL                                  
056235,000058: 23,3166           02720                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
056236,000059: 23,3167           00033                                    ZPRIME     +4                         
056237,000060: 
056238,000061: 23,3170           45205                           DMP      DSU                                   
056239,000062: 23,3171           02714                                    XDC                                   #  MPAC = (ZP3)(XD1)
056240,000063: 23,3172           77626                           STADR                                          
056241,000064: 23,3173           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
056242,000065: 23,3174           47211                                    ARCTRIG                               

Page 1320

056244,000067: 23,3175           26764                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
056245,000068: 23,3176           00027                                    ZPRIME                                
056246,000069: 23,3177           77641                           DOT                                            
056247,000070: 23,3200           02730                                    ZDC                                   
056248,000071: 23,3201           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
056249,000072: 23,3202           00027                                    ZPRIME                                
056250,000073: 23,3203           77641                           DOT                                            
056251,000074: 23,3204           02722                                    YDC                                   
056252,000075: 23,3205           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
056253,000076: 23,3206           47211                                    ARCTRIG                               
056254,000077: 
056255,000078: 23,3207           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
056256,000079: 23,3210           00051                                    S2                                    
056257,000080: 

Page 1321

056259,000082:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
056260,000083: 
056261,000084:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
056262,000085: 
056263,000086:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
056264,000087:                                                                                                  #  AVAILABLE AT MPAC.
056265,000088: 
056266,000089: 
056267,000090: 23,3211           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
056268,000091: 23,3212           00023                                    SINTH                                 
056269,000092: 23,3213           50025                           DSU      BMN                                   
056270,000093: 23,3214           07427                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
056271,000094: 23,3215           47224                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
056272,000095: 
056273,000096: 
056274,000097: 23,3216           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
056275,000098: 23,3217           00021                                    COSTH                                 
056276,000099: 23,3220           75326                           ACOS     SIGN                                  
056277,000100: 23,3221           00023                                    SINTH                                 
056278,000101: 23,3222           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
056279,000102: 23,3223           77616                           RVQ                                            
056280,000103: 
056281,000104: 
056282,000105: 23,3224           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
056283,000106: 23,3225           00023                                    SINTH                                 
056284,000107: 23,3226           77736                           ASIN                                           
056285,000108: 23,3227           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
056286,000109: 23,3230           00021                                    COSTH                                 
056287,000110: 23,3231           77640                           BMN                                            
056288,000111: 23,3232           47235                                    TRIG2                                 #  IF (135,-135)
056289,000112: 
056290,000113: 23,3233           43545                           DLOAD    RVQ                                   
056291,000114: 23,3234           00025                                    THETA                                 #  X = ARCSIN(SIN)    (-45,45)
056292,000115: 
056293,000116: 
056294,000117: 23,3235           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
056295,000118: 23,3236           15330                                    HIDPHALF                              
056296,000119: 23,3237           00023                                    SINTH                                 
056297,000120: 23,3240           77625                           DSU                                            
056298,000121: 23,3241           00025                                    THETA                                 
056299,000122: 23,3242           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
056300,000123: 23,3243           77616                           RVQ                                            #                   (+) - (+) OR (-) - (-)
056301,000124: 

Page 1322

056303,000126:                                                                                                  #      SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
056304,000127:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
056305,000128:                                                                                                  #  FLIGHT SUBROUTINES.
056306,000129: 

Page 1323

056308,000131:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056309,000132: 
056310,000133:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
056311,000134:                                                                                                  #  VECTORS ARE STORED AT XNB,YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
056312,000135:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
056313,000136: 
056314,000137:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
056315,000138: 
056316,000139: 23,3244           77601        CALCGA             SETPD                                          #  PUSHDOWN  00-05, 16D-21D, 34D-37D
056317,000140: 23,3245           00001                                    0                                     
056318,000141: 23,3246           47375                           VLOAD    VXV                                   
056319,000142: 23,3247           02714                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
056320,000143: 23,3250           02700                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
056321,000144: 23,3251           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
056322,000145: 
056323,000146: 23,3252           44041                           DOT      ITA                                   
056324,000147: 23,3253           02730                                    ZNB                                   
056325,000148: 23,3254           00051                                    S2                                    
056326,000149: 23,3255           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
056327,000150: 23,3256           00001                                    0                                     
056328,000151: 23,3257           77641                           DOT                                            
056329,000152: 23,3260           02722                                    YNB                                   
056330,000153: 23,3261           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
056331,000154: 23,3262           47211                                    ARCTRIG                               
056332,000155: 23,3263           26760                           STOVL    OGC                                   
056333,000156: 23,3264           00001                                    0                                     
056334,000157: 
056335,000158: 23,3265           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
056336,000159: 23,3266           02714                                    XNB                                   
056337,000160: 23,3267           02700                                    YSM                                   
056338,000161: 23,3270           77752                           SL1                                            
056339,000162: 23,3271           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
056340,000163: 23,3272           02700                                    YSM                                   
056341,000164: 23,3273           77641                           DOT                                            
056342,000165: 23,3274           02714                                    XNB                                   
056343,000166: 23,3275           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
056344,000167: 23,3276           47211                                    ARCTRIG                               
056345,000168: 23,3277           02764                           STORE    MGC                                   
056346,000169: 
056347,000170: 23,3300           45246                           ABS      DSU                                   
056348,000171: 23,3301           07431                                    .166...                               
056349,000172: 23,3302           77644                           BPL                                            
056350,000173: 23,3303           47324                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
056351,000174: 
056352,000175: 23,3304           50375        CALCGA1            VLOAD    DOT                                   
056353,000176: 23,3305           02706                                    ZSM                                   
056354,000177: 23,3306           00001                                    0                                     
056355,000178: 23,3307           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
056356,000179: 23,3310           02672                                    XSM                                   

Page 1324

056358,000181: 23,3311           45441                           DOT      STADR                                 
056359,000182: 23,3312           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
056360,000183: 23,3313           47211                                    ARCTRIG                               
056361,000184: 
056362,000185: 23,3314           26762                           STOVL    IGC                                   
056363,000186: 23,3315           02760                                    OGC                                   
056364,000187: 23,3316           43034                           RTB      BONCLR                                
056365,000188: 23,3317           45547                                    V1STO2S                               
056366,000189: 23,3320           00200                                    CPHIFLAG                              
056367,000190: 23,3321           00051                                    S2                                    
056368,000191: 23,3322           35156                           STCALL   THETAD                                
056369,000192: 23,3323           00051                                    S2                                    
056370,000193: 
056371,000194: 23,3324           77776        GIMLOCK1           EXIT                                           
056372,000195: 23,3325           05537                           TC       ALARM                                 
056373,000196: 23,3326           00401                           OCT      00401                                 
056374,000197: 23,3327           05435                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
056375,000198: 23,3330           00056                           ADRES    GLOKFAIL                              
056376,000199: 
056377,000200: 23,3331           06006                           TC       INTPRET                               
056378,000201: 23,3332           77650                           GOTO                                           
056379,000202: 23,3333           47304                                    CALCGA1                               
056380,000203: 

Page 1325

056382,000205:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
056383,000206: 
056384,000207:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
056385,000208:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
056386,000209:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
056387,000210:                                                                                                  #  THE VAC AREA.
056388,000211: 
056389,000212:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
056390,000213:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
056391,000214: 
056392,000215: 
056393,000216: 23,3334           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN  00-30D,34D-37D
056394,000217: 23,3335           02743                                    STARAD     +6                         
056395,000218: 23,3336           00051                                    S1                                    
056396,000219: 23,3337           02727                                    STARAD     -6                         
056397,000220: 
056398,000221: 23,3340           77601                           SETPD                                          
056399,000222: 23,3341           00001                                    0                                     
056400,000223: 23,3342           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
056401,000224: 23,3343           02752                                    STARAD     +12D,1                     #         STARAD +00D   UB = S1
056402,000225: 23,3344           02760                                    STARAD     +18D,1                     
056403,000226: 23,3345           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
056404,000227: 23,3346           06760                           STORE    STARAD     +18D,1                     #         STARAD +06D   VB = UNIT(S1 X S2)
056405,000228: 23,3347           77773                           VLOAD*                                         
056406,000229: 23,3350           02752                                    STARAD     +12D,1                     
056407,000230: 
056408,000231: 23,3351           76433                           VXV*     VSL1                                  
056409,000232: 23,3352           02760                                    STARAD     +18D,1                     #  18D   WA = UA X VA
056410,000233: 23,3353           06766                           STORE    STARAD     +24D,1                     #         STARAD +12D   WB = UB X VB
056411,000234: 
056412,000235: 23,3354           77700                           TIX,1                                          
056413,000236: 23,3355           47342                                    AXISGEN1                              
056414,000237: 
056415,000238: 23,3356           66160                           AXC,1    SXA,1                                 
056416,000239: 23,3357           00006                                    6                                     
056417,000240: 23,3360           00036                                    30D                                   
056418,000241: 
056419,000242: 23,3361           66370                           AXT,1    SSP                                   
056420,000243: 23,3362           00022                                    18D                                   
056421,000244: 23,3363           00051                                    S1                                    
056422,000245: 23,3364           00006                                    6                                     
056423,000246: 
056424,000247: 23,3365           66374                           AXT,2    SSP                                   
056425,000248: 23,3366           00006                                    6                                     
056426,000249: 23,3367           00052                                    S2                                    
056427,000250: 23,3370           00002                                    2                                     
056428,000251: 
056429,000252: 23,3371           76720        AXISGEN2           XCHX,1   VLOAD*                                
056430,000253: 23,3372           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4   X1=-6 X2=+2
056431,000254: 23,3373           00001                                    0,1                                   

Page 1326

056433,000256: 23,3374           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)   J=(UA)(UB3)
056434,000257: 23,3375           75033                                    STARAD     +6,2                       
056435,000258: 23,3376           00007                                    6,1                                   
056436,000259: 23,3377           77757                           VXSC*                                          
056437,000260: 23,3400           75025                                    STARAD     +12D,2                     
056438,000261: 23,3401           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)   J=(VA)(VB3)
056439,000262: 23,3402           00015                                    12D,1                                 
056440,000263: 
056441,000264: 23,3403           53357                           VXSC*    VAD                                   
056442,000265: 23,3404           75017                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)   J=(WA)(WB3)
056443,000266: 23,3405           76455                           VAD      VSL1                                  
056444,000267: 23,3406           00031                                    24D                                   
056445,000268: 23,3407           53520                           XCHX,1   UNIT                                  
056446,000269: 23,3410           00036                                    30D                                   
056447,000270: 23,3411           06736                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K   ZDC = L+J+K
056448,000271: 
056449,000272: 23,3412           77700                           TIX,1                                          
056450,000273: 23,3413           47414                                    AXISGEN3                              
056451,000274: 
056452,000275: 23,3414           77704        AXISGEN3           TIX,2                                          
056453,000276: 23,3415           47371                                    AXISGEN2                              
056454,000277: 
056455,000278: 23,3416           77775                           VLOAD                                          
056456,000279: 23,3417           02714                                    XDC                                   
056457,000280: 23,3420           26736                           STOVL    STARAD                                
056458,000281: 23,3421           02722                                    YDC                                   
056459,000282: 23,3422           26744                           STOVL    STARAD     +6                         
056460,000283: 23,3423           02730                                    ZDC                                   
056461,000284: 23,3424           02752                           STORE    STARAD     +12D                       
056462,000285: 
056463,000286: 23,3425           77616                           RVQ                                            
056464,000287: 

Page 1327

056466,000289: 23,3426           05520 26075  QTSN45             2DEC     .1768                                 
056467,000290: 23,3430           05252 25253  .166...            2DEC     .1666666667                            
056468,000291: 

Page 1328 Empty page.


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