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.

053967,000002:                                                                                                  ## Copyright:   Public domain.
053968,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
053969,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
053970,000005:                                                                                                  ##              It is part of the source code for the original release
053971,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
053972,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
053973,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
053974,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
053975,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
053976,000011:                                                                                                  ##              that the code format has been changed to conform to the
053977,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
053978,000013:                                                                                                  ##              original YUL assembler.
053979,000014:                                                                                                  ## Reference:   pp. 1244-1253
053980,000015:                                                                                                  ## Assembler:   yaYUL
053981,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
053982,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
053983,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
053984,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
053985,000020:                                                                                                  ##              2017-01-16 RRB  Updated for Luminary 69.
053986,000021:                                                                                                  ##              2017-01-21 HG   Add missing interpretive operation BONCLR
053987,000022:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
053988,000023:                                                                                                  ##                              but no errors found.
053989,000024:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
053990,000025:                                                                                                  ##                              Luminary 99 vs Comanche 55.
053991,000026: 

Page 1244

053993,000028: 22,3731                                           BANK     22                                    
053994,000029: 23,2000                                           SETLOC   INFLIGHT                              
053995,000030: 23,2000                                           BANK                                           
053996,000031: 
053997,000032: 23,3151  E5,1642                                  EBANK=   XSM                                   
053998,000033: 
053999,000034:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054000,000035: 
054001,000036:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
054002,000037:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
054003,000038: 
054004,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,
054005,000040:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
054006,000041: 
054007,000042: 23,3151                                           COUNT*   $$/INFLT                              
054008,000043: 23,3151           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN  00-03,16D-27D,34D-37D
054009,000044: 23,3152           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
054010,000045: 23,3153           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
054011,000046: 23,3154           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
054012,000047: 23,3155           06424                                    HI6ZEROS                              
054013,000048: 23,3156           02671                                    XDC        +4                         
054014,000049: 23,3157           55476                           DCOMP    VDEF                                  
054015,000050: 23,3160           77656                           UNIT                                           
054016,000051: 23,3161           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
054017,000052: 23,3162           00027                                    ZPRIME                                
054018,000053: 
054019,000054: 23,3163           77742                           SR1                                            
054020,000055: 23,3164           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
054021,000056: 23,3165           00033                                    ZPRIME     +4                         
054022,000057: 23,3166           77742                           SR1                                            
054023,000058: 23,3167           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
054024,000059: 23,3170           47222                                    ARCTRIG                               
054025,000060: 
054026,000061: 23,3171           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
054027,000062: 23,3172           02667                                    XDC        +2                         
054028,000063: 23,3173           77742                           SR1                                            
054029,000064: 23,3174           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
054030,000065: 23,3175           00027                                    ZPRIME                                
054031,000066: 
054032,000067: 23,3176           65205                           DMP      PDDL                                  
054033,000068: 23,3177           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
054034,000069: 23,3200           00033                                    ZPRIME     +4                         
054035,000070: 
054036,000071: 23,3201           45205                           DMP      DSU                                   
054037,000072: 23,3202           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
054038,000073: 23,3203           77626                           STADR                                          
054039,000074: 23,3204           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
054040,000075: 23,3205           47222                                    ARCTRIG                               

Page 1245

054042,000077: 23,3206           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
054043,000078: 23,3207           00027                                    ZPRIME                                
054044,000079: 23,3210           77641                           DOT                                            
054045,000080: 23,3211           02701                                    ZDC                                   
054046,000081: 23,3212           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
054047,000082: 23,3213           00027                                    ZPRIME                                
054048,000083: 23,3214           77641                           DOT                                            
054049,000084: 23,3215           02673                                    YDC                                   
054050,000085: 23,3216           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
054051,000086: 23,3217           47222                                    ARCTRIG                               
054052,000087: 
054053,000088: 23,3220           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
054054,000089: 23,3221           00051                                    S2                                    
054055,000090: 

Page 1246

054057,000092:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
054058,000093: 
054059,000094:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
054060,000095: 
054061,000096:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
054062,000097:                                                                                                  #  AVAILABLE AT MPAC.
054063,000098: 
054064,000099: 23,3222           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
054065,000100: 23,3223           00023                                    SINTH                                 
054066,000101: 23,3224           50025                           DSU      BMN                                   
054067,000102: 23,3225           07440                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
054068,000103: 23,3226           47235                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
054069,000104: 
054070,000105: 23,3227           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
054071,000106: 23,3230           00021                                    COSTH                                 
054072,000107: 23,3231           75326                           ACOS     SIGN                                  
054073,000108: 23,3232           00023                                    SINTH                                 
054074,000109: 23,3233           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
054075,000110: 23,3234           77616                           RVQ                                            
054076,000111: 
054077,000112: 23,3235           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
054078,000113: 23,3236           00023                                    SINTH                                 
054079,000114: 23,3237           77736                           ASIN                                           
054080,000115: 23,3240           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
054081,000116: 23,3241           00021                                    COSTH                                 
054082,000117: 23,3242           77640                           BMN                                            
054083,000118: 23,3243           47246                                    TRIG2                                 #  IF (135,-135)
054084,000119: 
054085,000120: 23,3244           43545                           DLOAD    RVQ                                   
054086,000121: 23,3245           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
054087,000122: 
054088,000123: 23,3246           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
054089,000124: 23,3247           06422                                    HIDPHALF                              
054090,000125: 23,3250           00023                                    SINTH                                 
054091,000126: 23,3251           77625                           DSU                                            
054092,000127: 23,3252           00025                                    THETA                                 
054093,000128: 23,3253           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
054094,000129: 23,3254           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
054095,000130: 

Page 1247

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

Page 1248

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

Page 1249

054152,000187: 23,3322           45441                           DOT      STADR                                 
054153,000188: 23,3323           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
054154,000189: 23,3324           47222                                    ARCTRIG                               
054155,000190: 
054156,000191: 23,3325           26742                           STOVL    IGC                                   
054157,000192: 23,3326           02740                                    OGC                                   
054158,000193: 23,3327           43034                           RTB      BONCLR                                
054159,000194: 23,3330           21524                                    V1STO2S                               
054160,000195: 23,3331           00200                                    CPHIFLAG                              
054161,000196: 23,3332           00051                                    S2                                    
054162,000197: 23,3333           34322                           STCALL   THETAD                                
054163,000198: 23,3334           00051                                    S2                                    
054164,000199: 
054165,000200: 23,3335           77776        GIMLOCK1           EXIT                                           
054166,000201: 23,3336           05567                           TC       ALARM                                 
054167,000202: 23,3337           00401                           OCT      00401                                 
054168,000203: 23,3340           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
054169,000204: 23,3341           00056                           ADRES    GLOKFAIL                              
054170,000205: 
054171,000206: 23,3342           06036                           TC       INTPRET                               
054172,000207: 23,3343           77650                           GOTO                                           
054173,000208: 23,3344           47315                                    CALCGA1                               
054174,000209: 

Page 1250

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

Page 1251

054227,000262: 23,3405           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
054228,000263: 23,3406           75062                                    STARAD     +6,2                       
054229,000264: 23,3407           00007                                    6,1                                   
054230,000265: 23,3410           77757                           VXSC*                                          
054231,000266: 23,3411           75054                                    STARAD     +12D,2                     
054232,000267: 23,3412           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
054233,000268: 23,3413           00015                                    12D,1                                 
054234,000269: 
054235,000270: 23,3414           53357                           VXSC*    VAD                                   
054236,000271: 23,3415           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
054237,000272: 23,3416           76455                           VAD      VSL1                                  
054238,000273: 23,3417           00031                                    24D                                   
054239,000274: 23,3420           53520                           XCHX,1   UNIT                                  
054240,000275: 23,3421           00036                                    30D                                   
054241,000276: 23,3422           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
054242,000277: 
054243,000278: 23,3423           77700                           TIX,1                                          
054244,000279: 23,3424           47425                                    AXISGEN3                              
054245,000280: 
054246,000281: 23,3425           77704        AXISGEN3           TIX,2                                          
054247,000282: 23,3426           47402                                    AXISGEN2                              
054248,000283: 
054249,000284: 23,3427           77775                           VLOAD                                          
054250,000285: 23,3430           02665                                    XDC                                   
054251,000286: 23,3431           26707                           STOVL    STARAD                                
054252,000287: 23,3432           02673                                    YDC                                   
054253,000288: 23,3433           26715                           STOVL    STARAD     +6                         
054254,000289: 23,3434           02701                                    ZDC                                   
054255,000290: 23,3435           02723                           STORE    STARAD     +12D                       
054256,000291: 
054257,000292: 23,3436           77616                           RVQ                                            
054258,000293: 

Page 1252

054260,000295: 23,3437           05520 26075  QTSN45             2DEC     .1768                                 
054261,000296: 
054262,000297: 23,3441           05252 25253  .166...            2DEC     .1666666667                            
054263,000298: 

Page 1253 Empty page

054266,000301: 

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