Source Code

These source-code files were obtained by digitally photographing an Artemis 72 (Apollo 15-17 Command Module) program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Photography was by Ron Burkey, and transcription was performed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images may be 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 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971
Note that the date is the date of the printout, not the date of the program revision.

058165,000002:                                                                                                  ## Copyright:   Public domain.
058166,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
058167,000004:                                                                                                  ## Purpose:     Part of the source code for Artemis (i.e., Colossus 3),
058168,000005:                                                                                                  ##              build 072.  This is for the Command Module's (CM)
058169,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for
058170,000007:                                                                                                  ##              Apollo 15-17.
058171,000008:                                                                                                  ## Assembler:   yaYUL
058172,000009:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
058173,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058174,000011:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Artemis072/
058175,000012:                                                                                                  ## Mod history: 2009-08-20 JL   Adapted from corresponding Comanche 055 file.
058176,000013:                                                                                                  ##              2010-02-20 RSB  Un-##'d this header.
058177,000014:                                                                                                  ##              2017-02-05 RSB  Proofed comment text by diff'ing vs Comanche 55
058178,000015:                                                                                                  ##                              and corrected errors found.
058179,000016: 

Page 1354

058181,000018: 
058182,000019: 23,2000                                           SETLOC   INFLIGHT                              
058183,000020: 23,2000                                           BANK                                           
058184,000021: 
058185,000022: 23,3240  E5,1671                                  EBANK=   XSM                                   
058186,000023: 
058187,000024:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
058188,000025: 
058189,000026:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
058190,000027:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
058191,000028: 
058192,000029:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
058193,000030:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
058194,000031: 
058195,000032: 23,3240                                           COUNT*   $$/INFLT                              
058196,000033: 23,3240           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03,16D-27D,34D-37D
058197,000034: 23,3241           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
058198,000035: 23,3242           02714                                    XDC                                   #  YDC = (YD1 YD2 YD3)
058199,000036: 23,3243           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
058200,000037: 23,3244           15336                                    HI6ZEROS                              
058201,000038: 23,3245           02720                                    XDC        +4                         
058202,000039: 23,3246           55476                           DCOMP    VDEF                                  
058203,000040: 23,3247           77656                           UNIT                                           
058204,000041: 23,3250           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
058205,000042: 23,3251           00027                                    ZPRIME                                
058206,000043: 
058207,000044: 23,3252           77742                           SR1                                            
058208,000045: 23,3253           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
058209,000046: 23,3254           00033                                    ZPRIME     +4                         
058210,000047: 23,3255           77742                           SR1                                            
058211,000048: 23,3256           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
058212,000049: 23,3257           47311                                    ARCTRIG                               
058213,000050: 
058214,000051: 23,3260           16762                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
058215,000052: 23,3261           02716                                    XDC        +2                         
058216,000053: 23,3262           77742                           SR1                                            
058217,000054: 23,3263           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
058218,000055: 23,3264           00027                                    ZPRIME                                
058219,000056: 
058220,000057: 23,3265           65205                           DMP      PDDL                                  
058221,000058: 23,3266           02720                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
058222,000059: 23,3267           00033                                    ZPRIME     +4                         
058223,000060: 
058224,000061: 23,3270           45205                           DMP      DSU                                   
058225,000062: 23,3271           02714                                    XDC                                   #  MPAC = (ZP3)(XD1)
058226,000063: 23,3272           77626                           STADR                                          
058227,000064: 23,3273           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
058228,000065: 23,3274           47311                                    ARCTRIG                               
058229,000066: 23,3275           26764                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.

Page 1355

058231,000068: 23,3276           00027                                    ZPRIME                                
058232,000069: 23,3277           77641                           DOT                                            
058233,000070: 23,3300           02730                                    ZDC                                   
058234,000071: 23,3301           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
058235,000072: 23,3302           00027                                    ZPRIME                                
058236,000073: 23,3303           77641                           DOT                                            
058237,000074: 23,3304           02722                                    YDC                                   
058238,000075: 23,3305           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
058239,000076: 23,3306           47311                                    ARCTRIG                               
058240,000077: 
058241,000078: 23,3307           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
058242,000079: 23,3310           00051                                    S2                                    
058243,000080: 

Page 1356

058245,000082: 
058246,000083:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
058247,000084: 
058248,000085:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
058249,000086: 
058250,000087:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
058251,000088:                                                                                                  #  AVAILABLE AT MPAC.
058252,000089: 
058253,000090: 23,3311           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
058254,000091: 23,3312           00023                                    SINTH                                 
058255,000092: 23,3313           50025                           DSU      BMN                                   
058256,000093: 23,3314           07525                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
058257,000094: 23,3315           47324                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
058258,000095: 
058259,000096: 23,3316           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
058260,000097: 23,3317           00021                                    COSTH                                 
058261,000098: 23,3320           75326                           ACOS     SIGN                                  
058262,000099: 23,3321           00023                                    SINTH                                 
058263,000100: 23,3322           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
058264,000101: 23,3323           77616                           RVQ                                            
058265,000102: 
058266,000103: 23,3324           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
058267,000104: 23,3325           00023                                    SINTH                                 
058268,000105: 23,3326           77736                           ASIN                                           
058269,000106: 23,3327           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
058270,000107: 23,3330           00021                                    COSTH                                 
058271,000108: 23,3331           77640                           BMN                                            
058272,000109: 23,3332           47335                                    TRIG2                                 #  IF (135,-135)
058273,000110: 
058274,000111: 23,3333           43545                           DLOAD    RVQ                                   
058275,000112: 23,3334           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
058276,000113: 
058277,000114: 23,3335           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
058278,000115: 23,3336           15334                                    HIDPHALF                              
058279,000116: 23,3337           00023                                    SINTH                                 
058280,000117: 23,3340           77625                           DSU                                            
058281,000118: 23,3341           00025                                    THETA                                 
058282,000119: 23,3342           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
058283,000120: 23,3343           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
058284,000121: 

Page 1357

058286,000123:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
058287,000124:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
058288,000125:                                                                                                  #  FLIGHT SUBROUTINES.
058289,000126: 

Page 1358

058291,000128:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
058292,000129: 
058293,000130:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
058294,000131:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
058295,000132:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
058296,000133: 
058297,000134:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
058298,000135: 
058299,000136: 23,3344           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
058300,000137: 23,3345           00001                                    0                                     
058301,000138: 23,3346           47375                           VLOAD    VXV                                   
058302,000139: 23,3347           02714                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
058303,000140: 23,3350           02700                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
058304,000141: 23,3351           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
058305,000142: 
058306,000143: 23,3352           44041                           DOT      ITA                                   
058307,000144: 23,3353           02730                                    ZNB                                   
058308,000145: 23,3354           00051                                    S2                                    
058309,000146: 23,3355           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
058310,000147: 23,3356           00001                                    0                                     
058311,000148: 23,3357           77641                           DOT                                            
058312,000149: 23,3360           02722                                    YNB                                   
058313,000150: 23,3361           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
058314,000151: 23,3362           47311                                    ARCTRIG                               
058315,000152: 23,3363           26760                           STOVL    OGC                                   
058316,000153: 23,3364           00001                                    0                                     
058317,000154: 
058318,000155: 23,3365           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
058319,000156: 23,3366           02714                                    XNB                                   
058320,000157: 23,3367           02700                                    YSM                                   
058321,000158: 23,3370           77752                           SL1                                            
058322,000159: 23,3371           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
058323,000160: 23,3372           02700                                    YSM                                   
058324,000161: 23,3373           77641                           DOT                                            
058325,000162: 23,3374           02714                                    XNB                                   
058326,000163: 23,3375           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
058327,000164: 23,3376           47311                                    ARCTRIG                               
058328,000165: 23,3377           02764                           STORE    MGC                                   
058329,000166: 
058330,000167: 23,3400           45246                           ABS      DSU                                   
058331,000168: 23,3401           07527                                    .166...                               
058332,000169: 23,3402           77644                           BPL                                            
058333,000170: 23,3403           47422                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
058334,000171: 
058335,000172: 23,3404           50375        CALCGA1            VLOAD    DOT                                   
058336,000173: 23,3405           02706                                    ZSM                                   
058337,000174: 23,3406           00001                                    0                                     
058338,000175: 23,3407           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
058339,000176: 23,3410           02672                                    XSM                                   

Page 1359

058341,000178: 23,3411           45441                           DOT      STADR                                 
058342,000179: 23,3412           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
058343,000180: 23,3413           47311                                    ARCTRIG                               
058344,000181: 
058345,000182: 23,3414           26762                           STOVL    IGC                                   
058346,000183: 23,3415           02760                                    OGC                                   
058347,000184: 23,3416           77634                           RTB                                            
058348,000185: 23,3417           45644                                    V1STO2S                               
058349,000186: 23,3420           35310                           STCALL   THETAD                                
058350,000187: 23,3421           00051                                    S2                                    
058351,000188: 
058352,000189: 23,3422           77776        GIMLOCK1           EXIT                                           
058353,000190: 23,3423           05671                           TC       ALARM                                 
058354,000191: 23,3424           00401                           OCT      00401                                 
058355,000192: 23,3425           05547                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
058356,000193: 23,3426           00056                           ADRES    GLOKFAIL                              
058357,000194: 
058358,000195: 23,3427           06006                           TC       INTPRET                               
058359,000196: 23,3430           77650                           GOTO                                           
058360,000197: 23,3431           47404                                    CALCGA1                               
058361,000198: 

Page 1360

058363,000200: 
058364,000201:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
058365,000202: 
058366,000203:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
058367,000204:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
058368,000205:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
058369,000206:                                                                                                  #  THE VAC AREA.
058370,000207: 
058371,000208:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
058372,000209:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
058373,000210: 
058374,000211: 23,3432           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D,34D-37D
058375,000212: 23,3433           02743                                    STARAD     +6                         
058376,000213: 23,3434           00051                                    S1                                    
058377,000214: 23,3435           02727                                    STARAD     -6                         
058378,000215: 
058379,000216: 23,3436           77601                           SETPD                                          
058380,000217: 23,3437           00001                                    0                                     
058381,000218: 23,3440           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
058382,000219: 23,3441           02752                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
058383,000220: 23,3442           02760                                    STARAD     +18D,1                     
058384,000221: 23,3443           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
058385,000222: 23,3444           06760                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
058386,000223: 23,3445           77773                           VLOAD*                                         
058387,000224: 23,3446           02752                                    STARAD     +12D,1                     
058388,000225: 
058389,000226: 23,3447           76433                           VXV*     VSL1                                  
058390,000227: 23,3450           02760                                    STARAD     +18D,1                     #  18D   WA = UA X VA
058391,000228: 23,3451           06766                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
058392,000229: 
058393,000230: 23,3452           77700                           TIX,1                                          
058394,000231: 23,3453           47440                                    AXISGEN1                              
058395,000232: 
058396,000233: 23,3454           66160                           AXC,1    SXA,1                                 
058397,000234: 23,3455           00006                                    6                                     
058398,000235: 23,3456           00036                                    30D                                   
058399,000236: 
058400,000237: 23,3457           66370                           AXT,1    SSP                                   
058401,000238: 23,3460           00022                                    18D                                   
058402,000239: 23,3461           00051                                    S1                                    
058403,000240: 23,3462           00006                                    6                                     
058404,000241: 
058405,000242: 23,3463           66374                           AXT,2    SSP                                   
058406,000243: 23,3464           00006                                    6                                     
058407,000244: 23,3465           00052                                    S2                                    
058408,000245: 23,3466           00002                                    2                                     
058409,000246: 
058410,000247: 23,3467           76720        AXISGEN2           XCHX,1   VLOAD*                                
058411,000248: 23,3470           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
058412,000249: 23,3471           00001                                    0,1                                   
058413,000250: 

Page 1361

058415,000252: 23,3472           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
058416,000253: 23,3473           75033                                    STARAD     +6,2                       
058417,000254: 23,3474           00007                                    6,1                                   
058418,000255: 23,3475           77757                           VXSC*                                          
058419,000256: 23,3476           75025                                    STARAD     +12D,2                     
058420,000257: 23,3477           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
058421,000258: 23,3500           00015                                    12D,1                                 
058422,000259: 
058423,000260: 23,3501           53357                           VXSC*    VAD                                   
058424,000261: 23,3502           75017                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
058425,000262: 23,3503           76455                           VAD      VSL1                                  
058426,000263: 23,3504           00031                                    24D                                   
058427,000264: 23,3505           53520                           XCHX,1   UNIT                                  
058428,000265: 23,3506           00036                                    30D                                   
058429,000266: 23,3507           06736                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
058430,000267: 
058431,000268: 23,3510           77700                           TIX,1                                          
058432,000269: 23,3511           47512                                    AXISGEN3                              
058433,000270: 
058434,000271: 23,3512           77704        AXISGEN3           TIX,2                                          
058435,000272: 23,3513           47467                                    AXISGEN2                              
058436,000273: 
058437,000274: 23,3514           77775                           VLOAD                                          
058438,000275: 23,3515           02714                                    XDC                                   
058439,000276: 23,3516           26736                           STOVL    STARAD                                
058440,000277: 23,3517           02722                                    YDC                                   
058441,000278: 23,3520           26744                           STOVL    STARAD     +6                         
058442,000279: 23,3521           02730                                    ZDC                                   
058443,000280: 23,3522           02752                           STORE    STARAD     +12D                       
058444,000281: 
058445,000282: 23,3523           77616                           RVQ                                            
058446,000283: 

Page 1362

058448,000285: 23,3524           05520 26075  QTSN45             2DEC     .1768                                 
058449,000286: 23,3526           05252 25253  .166...            2DEC     .1666666667                            
058450,000287: 

Page 1363 Empty page

058453,000290: 
058454,000291: 

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