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.

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

Page 1354

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

Page 1355

058245,000068: 23,3276           00027                                    ZPRIME                                
058246,000069: 23,3277           77641                           DOT                                            
058247,000070: 23,3300           02730                                    ZDC                                   
058248,000071: 23,3301           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
058249,000072: 23,3302           00027                                    ZPRIME                                
058250,000073: 23,3303           77641                           DOT                                            
058251,000074: 23,3304           02722                                    YDC                                   
058252,000075: 23,3305           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
058253,000076: 23,3306           47311                                    ARCTRIG                               
058254,000077: 
058255,000078: 23,3307           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
058256,000079: 23,3310           00051                                    S2                                    
058257,000080: 

Page 1356

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

Page 1357

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

Page 1358

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

Page 1359

058355,000178: 23,3411           45441                           DOT      STADR                                 
058356,000179: 23,3412           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
058357,000180: 23,3413           47311                                    ARCTRIG                               
058358,000181: 
058359,000182: 23,3414           26762                           STOVL    IGC                                   
058360,000183: 23,3415           02760                                    OGC                                   
058361,000184: 23,3416           77634                           RTB                                            
058362,000185: 23,3417           45644                                    V1STO2S                               
058363,000186: 23,3420           35310                           STCALL   THETAD                                
058364,000187: 23,3421           00051                                    S2                                    
058365,000188: 
058366,000189: 23,3422           77776        GIMLOCK1           EXIT                                           
058367,000190: 23,3423           05671                           TC       ALARM                                 
058368,000191: 23,3424           00401                           OCT      00401                                 
058369,000192: 23,3425           05547                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
058370,000193: 23,3426           00056                           ADRES    GLOKFAIL                              
058371,000194: 
058372,000195: 23,3427           06006                           TC       INTPRET                               
058373,000196: 23,3430           77650                           GOTO                                           
058374,000197: 23,3431           47404                                    CALCGA1                               
058375,000198: 

Page 1360

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

Page 1361

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

Page 1362

058462,000285: 23,3524           05520 26075  QTSN45             2DEC     .1768                                 
058463,000286: 23,3526           05252 25253  .166...            2DEC     .1666666667                            
058464,000287: 

Page 1363 Empty page

058467,000290: 
058468,000291: 

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