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.

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

Page 1319

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

Page 1320

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

Page 1321

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

Page 1322

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

Page 1323

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

Page 1324

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

Page 1325

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

Page 1326

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

Page 1327

056475,000289: 23,3426           05520 26075  QTSN45             2DEC     .1768                                 
056476,000290: 23,3430           05252 25253  .166...            2DEC     .1666666667                            
056477,000291: 

Page 1328 Empty page.


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