Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

053990,000002:                                                                                                  ## Copyright:   Public domain.
053991,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
053992,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
053993,000005:                                                                                                  ##              It is part of the source code for the original release
053994,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
053995,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
053996,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
053997,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
053998,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
053999,000011:                                                                                                  ##              that the code format has been changed to conform to the
054000,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
054001,000013:                                                                                                  ##              original YUL assembler.
054002,000014:                                                                                                  ## Reference:   pp. 1244-1253
054003,000015:                                                                                                  ## Assembler:   yaYUL
054004,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
054005,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
054006,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
054007,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
054008,000020:                                                                                                  ##              2017-01-16 RRB  Updated for Luminary 69.
054009,000021:                                                                                                  ##              2017-01-21 HG   Add missing interpretive operation BONCLR
054010,000022:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
054011,000023:                                                                                                  ##                              but no errors found.
054012,000024:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
054013,000025:                                                                                                  ##                              Luminary 99 vs Comanche 55.
054014,000026: 

Page 1244

054016,000028: 22,3731                                           BANK     22                                    
054017,000029: 23,2000                                           SETLOC   INFLIGHT                              
054018,000030: 23,2000                                           BANK                                           
054019,000031: 
054020,000032: 23,3151  E5,1642                                  EBANK=   XSM                                   
054021,000033: 
054022,000034:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054023,000035: 
054024,000036:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
054025,000037:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
054026,000038: 
054027,000039:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
054028,000040:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
054029,000041: 
054030,000042: 23,3151                                           COUNT*   $$/INFLT                              
054031,000043: 23,3151           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN  00-03,16D-27D,34D-37D
054032,000044: 23,3152           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
054033,000045: 23,3153           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
054034,000046: 23,3154           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
054035,000047: 23,3155           06424                                    HI6ZEROS                              
054036,000048: 23,3156           02671                                    XDC        +4                         
054037,000049: 23,3157           55476                           DCOMP    VDEF                                  
054038,000050: 23,3160           77656                           UNIT                                           
054039,000051: 23,3161           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
054040,000052: 23,3162           00027                                    ZPRIME                                
054041,000053: 
054042,000054: 23,3163           77742                           SR1                                            
054043,000055: 23,3164           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
054044,000056: 23,3165           00033                                    ZPRIME     +4                         
054045,000057: 23,3166           77742                           SR1                                            
054046,000058: 23,3167           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
054047,000059: 23,3170           47222                                    ARCTRIG                               
054048,000060: 
054049,000061: 23,3171           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
054050,000062: 23,3172           02667                                    XDC        +2                         
054051,000063: 23,3173           77742                           SR1                                            
054052,000064: 23,3174           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
054053,000065: 23,3175           00027                                    ZPRIME                                
054054,000066: 
054055,000067: 23,3176           65205                           DMP      PDDL                                  
054056,000068: 23,3177           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
054057,000069: 23,3200           00033                                    ZPRIME     +4                         
054058,000070: 
054059,000071: 23,3201           45205                           DMP      DSU                                   
054060,000072: 23,3202           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
054061,000073: 23,3203           77626                           STADR                                          
054062,000074: 23,3204           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
054063,000075: 23,3205           47222                                    ARCTRIG                               

Page 1245

054065,000077: 23,3206           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
054066,000078: 23,3207           00027                                    ZPRIME                                
054067,000079: 23,3210           77641                           DOT                                            
054068,000080: 23,3211           02701                                    ZDC                                   
054069,000081: 23,3212           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
054070,000082: 23,3213           00027                                    ZPRIME                                
054071,000083: 23,3214           77641                           DOT                                            
054072,000084: 23,3215           02673                                    YDC                                   
054073,000085: 23,3216           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
054074,000086: 23,3217           47222                                    ARCTRIG                               
054075,000087: 
054076,000088: 23,3220           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
054077,000089: 23,3221           00051                                    S2                                    
054078,000090: 

Page 1246

054080,000092:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
054081,000093: 
054082,000094:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
054083,000095: 
054084,000096:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
054085,000097:                                                                                                  #  AVAILABLE AT MPAC.
054086,000098: 
054087,000099: 23,3222           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
054088,000100: 23,3223           00023                                    SINTH                                 
054089,000101: 23,3224           50025                           DSU      BMN                                   
054090,000102: 23,3225           07440                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
054091,000103: 23,3226           47235                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
054092,000104: 
054093,000105: 23,3227           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
054094,000106: 23,3230           00021                                    COSTH                                 
054095,000107: 23,3231           75326                           ACOS     SIGN                                  
054096,000108: 23,3232           00023                                    SINTH                                 
054097,000109: 23,3233           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
054098,000110: 23,3234           77616                           RVQ                                            
054099,000111: 
054100,000112: 23,3235           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
054101,000113: 23,3236           00023                                    SINTH                                 
054102,000114: 23,3237           77736                           ASIN                                           
054103,000115: 23,3240           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
054104,000116: 23,3241           00021                                    COSTH                                 
054105,000117: 23,3242           77640                           BMN                                            
054106,000118: 23,3243           47246                                    TRIG2                                 #  IF (135,-135)
054107,000119: 
054108,000120: 23,3244           43545                           DLOAD    RVQ                                   
054109,000121: 23,3245           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
054110,000122: 
054111,000123: 23,3246           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
054112,000124: 23,3247           06422                                    HIDPHALF                              
054113,000125: 23,3250           00023                                    SINTH                                 
054114,000126: 23,3251           77625                           DSU                                            
054115,000127: 23,3252           00025                                    THETA                                 
054116,000128: 23,3253           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
054117,000129: 23,3254           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
054118,000130: 

Page 1247

054120,000132:                                                                                                  #      SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
054121,000133:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
054122,000134:                                                                                                  #  FLIGHT SUBROUTINES.
054123,000135: 

Page 1248

054125,000137:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054126,000138: 
054127,000139:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
054128,000140:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
054129,000141:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
054130,000142: 
054131,000143:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
054132,000144: 
054133,000145: 23,3255           77601        CALCGA             SETPD                                          #  PUSHDOWN  00-05, 16D-21D, 34D-37D
054134,000146: 23,3256           00001                                    0                                     
054135,000147: 23,3257           47375                           VLOAD    VXV                                   
054136,000148: 23,3260           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
054137,000149: 23,3261           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
054138,000150: 23,3262           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
054139,000151: 
054140,000152: 23,3263           44041                           DOT      ITA                                   
054141,000153: 23,3264           02701                                    ZNB                                   
054142,000154: 23,3265           00051                                    S2                                    
054143,000155: 23,3266           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
054144,000156: 23,3267           00001                                    0                                     
054145,000157: 23,3270           77641                           DOT                                            
054146,000158: 23,3271           02673                                    YNB                                   
054147,000159: 23,3272           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
054148,000160: 23,3273           47222                                    ARCTRIG                               
054149,000161: 23,3274           26740                           STOVL    OGC                                   
054150,000162: 23,3275           00001                                    0                                     
054151,000163: 
054152,000164: 23,3276           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
054153,000165: 23,3277           02665                                    XNB                                   
054154,000166: 23,3300           02651                                    YSM                                   
054155,000167: 23,3301           77752                           SL1                                            
054156,000168: 23,3302           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
054157,000169: 23,3303           02651                                    YSM                                   
054158,000170: 23,3304           77641                           DOT                                            
054159,000171: 23,3305           02665                                    XNB                                   
054160,000172: 23,3306           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
054161,000173: 23,3307           47222                                    ARCTRIG                               
054162,000174: 23,3310           02744                           STORE    MGC                                   
054163,000175: 
054164,000176: 23,3311           45246                           ABS      DSU                                   
054165,000177: 23,3312           07442                                    .166...                               
054166,000178: 23,3313           77644                           BPL                                            
054167,000179: 23,3314           47335                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
054168,000180: 
054169,000181: 23,3315           50375        CALCGA1            VLOAD    DOT                                   
054170,000182: 23,3316           02657                                    ZSM                                   
054171,000183: 23,3317           00001                                    0                                     
054172,000184: 23,3320           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
054173,000185: 23,3321           02643                                    XSM                                   

Page 1249

054175,000187: 23,3322           45441                           DOT      STADR                                 
054176,000188: 23,3323           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
054177,000189: 23,3324           47222                                    ARCTRIG                               
054178,000190: 
054179,000191: 23,3325           26742                           STOVL    IGC                                   
054180,000192: 23,3326           02740                                    OGC                                   
054181,000193: 23,3327           43034                           RTB      BONCLR                                
054182,000194: 23,3330           21524                                    V1STO2S                               
054183,000195: 23,3331           00200                                    CPHIFLAG                              
054184,000196: 23,3332           00051                                    S2                                    
054185,000197: 23,3333           34322                           STCALL   THETAD                                
054186,000198: 23,3334           00051                                    S2                                    
054187,000199: 
054188,000200: 23,3335           77776        GIMLOCK1           EXIT                                           
054189,000201: 23,3336           05567                           TC       ALARM                                 
054190,000202: 23,3337           00401                           OCT      00401                                 
054191,000203: 23,3340           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
054192,000204: 23,3341           00056                           ADRES    GLOKFAIL                              
054193,000205: 
054194,000206: 23,3342           06036                           TC       INTPRET                               
054195,000207: 23,3343           77650                           GOTO                                           
054196,000208: 23,3344           47315                                    CALCGA1                               
054197,000209: 

Page 1250

054199,000211:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
054200,000212: 
054201,000213:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
054202,000214:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
054203,000215:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
054204,000216:                                                                                                  #  THE VAC AREA.
054205,000217: 
054206,000218:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
054207,000219:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
054208,000220: 
054209,000221: 23,3345           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D,34D-37D
054210,000222: 23,3346           02714                                    STARAD     +6                         
054211,000223: 23,3347           00051                                    S1                                    
054212,000224: 23,3350           02700                                    STARAD     -6                         
054213,000225: 
054214,000226: 23,3351           77601                           SETPD                                          
054215,000227: 23,3352           00001                                    0                                     
054216,000228: 23,3353           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
054217,000229: 23,3354           02723                                    STARAD     +12D,1                     #         STARAD +00D   UB = S1
054218,000230: 23,3355           02731                                    STARAD     +18D,1                     
054219,000231: 23,3356           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
054220,000232: 23,3357           06731                           STORE    STARAD     +18D,1                     #         STARAD +06D   VB = UNIT(S1 X S2)
054221,000233: 23,3360           77773                           VLOAD*                                         
054222,000234: 23,3361           02723                                    STARAD     +12D,1                     
054223,000235: 
054224,000236: 23,3362           76433                           VXV*     VSL1                                  
054225,000237: 23,3363           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
054226,000238: 23,3364           06737                           STORE    STARAD     +24D,1                     #         STARAD +12D   WB = UB X VB
054227,000239: 
054228,000240: 23,3365           77700                           TIX,1                                          
054229,000241: 23,3366           47353                                    AXISGEN1                              
054230,000242: 
054231,000243: 23,3367           66160                           AXC,1    SXA,1                                 
054232,000244: 23,3370           00006                                    6                                     
054233,000245: 23,3371           00036                                    30D                                   
054234,000246: 
054235,000247: 23,3372           66370                           AXT,1    SSP                                   
054236,000248: 23,3373           00022                                    18D                                   
054237,000249: 23,3374           00051                                    S1                                    
054238,000250: 23,3375           00006                                    6                                     
054239,000251: 
054240,000252: 23,3376           66374                           AXT,2    SSP                                   
054241,000253: 23,3377           00006                                    6                                     
054242,000254: 23,3400           00052                                    S2                                    
054243,000255: 23,3401           00002                                    2                                     
054244,000256: 
054245,000257: 23,3402           76720        AXISGEN2           XCHX,1   VLOAD*                                
054246,000258: 23,3403           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
054247,000259: 23,3404           00001                                    0,1                                   
054248,000260: 

Page 1251

054250,000262: 23,3405           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
054251,000263: 23,3406           75062                                    STARAD     +6,2                       
054252,000264: 23,3407           00007                                    6,1                                   
054253,000265: 23,3410           77757                           VXSC*                                          
054254,000266: 23,3411           75054                                    STARAD     +12D,2                     
054255,000267: 23,3412           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
054256,000268: 23,3413           00015                                    12D,1                                 
054257,000269: 
054258,000270: 23,3414           53357                           VXSC*    VAD                                   
054259,000271: 23,3415           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
054260,000272: 23,3416           76455                           VAD      VSL1                                  
054261,000273: 23,3417           00031                                    24D                                   
054262,000274: 23,3420           53520                           XCHX,1   UNIT                                  
054263,000275: 23,3421           00036                                    30D                                   
054264,000276: 23,3422           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
054265,000277: 
054266,000278: 23,3423           77700                           TIX,1                                          
054267,000279: 23,3424           47425                                    AXISGEN3                              
054268,000280: 
054269,000281: 23,3425           77704        AXISGEN3           TIX,2                                          
054270,000282: 23,3426           47402                                    AXISGEN2                              
054271,000283: 
054272,000284: 23,3427           77775                           VLOAD                                          
054273,000285: 23,3430           02665                                    XDC                                   
054274,000286: 23,3431           26707                           STOVL    STARAD                                
054275,000287: 23,3432           02673                                    YDC                                   
054276,000288: 23,3433           26715                           STOVL    STARAD     +6                         
054277,000289: 23,3434           02701                                    ZDC                                   
054278,000290: 23,3435           02723                           STORE    STARAD     +12D                       
054279,000291: 
054280,000292: 23,3436           77616                           RVQ                                            
054281,000293: 

Page 1252

054283,000295: 23,3437           05520 26075  QTSN45             2DEC     .1768                                 
054284,000296: 
054285,000297: 23,3441           05252 25253  .166...            2DEC     .1666666667                            
054286,000298: 

Page 1253 Empty page

054289,000301: 

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