Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

053785,000002:                                                                                                  ## Copyright:   Public domain.
053786,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
053787,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
053788,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
053789,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
053790,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
053791,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
053792,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
053793,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
053794,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
053795,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
053796,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
053797,000014:                                                                                                  ## Reference:   pp. 1244-1253
053798,000015:                                                                                                  ## Assembler:   yaYUL
053799,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
053800,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
053801,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
053802,000019: 

Page 1244

053804,000021: 22,3731                                           BANK     22                                    
053805,000022: 23,2000                                           SETLOC   INFLIGHT                              
053806,000023: 23,2000                                           BANK                                           
053807,000024: 
053808,000025: 23,3151  E5,1642                                  EBANK=   XSM                                   
053809,000026: 
053810,000027:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
053811,000028: 
053812,000029:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
053813,000030:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
053814,000031: 
053815,000032:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
053816,000033:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
053817,000034: 
053818,000035: 23,3151                                           COUNT*   $$/INFLT                              
053819,000036: 23,3151           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN  00-03,16D-27D,34D-37D
053820,000037: 23,3152           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
053821,000038: 23,3153           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
053822,000039: 23,3154           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
053823,000040: 23,3155           06424                                    HI6ZEROS                              
053824,000041: 23,3156           02671                                    XDC        +4                         
053825,000042: 23,3157           55476                           DCOMP    VDEF                                  
053826,000043: 23,3160           77656                           UNIT                                           
053827,000044: 23,3161           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
053828,000045: 23,3162           00027                                    ZPRIME                                
053829,000046: 
053830,000047: 23,3163           77742                           SR1                                            
053831,000048: 23,3164           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
053832,000049: 23,3165           00033                                    ZPRIME     +4                         
053833,000050: 23,3166           77742                           SR1                                            
053834,000051: 23,3167           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
053835,000052: 23,3170           47222                                    ARCTRIG                               
053836,000053: 
053837,000054: 23,3171           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
053838,000055: 23,3172           02667                                    XDC        +2                         
053839,000056: 23,3173           77742                           SR1                                            
053840,000057: 23,3174           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
053841,000058: 23,3175           00027                                    ZPRIME                                
053842,000059: 
053843,000060: 23,3176           65205                           DMP      PDDL                                  
053844,000061: 23,3177           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
053845,000062: 23,3200           00033                                    ZPRIME     +4                         
053846,000063: 
053847,000064: 23,3201           45205                           DMP      DSU                                   
053848,000065: 23,3202           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
053849,000066: 23,3203           77626                           STADR                                          
053850,000067: 23,3204           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
053851,000068: 23,3205           47222                                    ARCTRIG                               

Page 1245

053853,000070: 23,3206           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
053854,000071: 23,3207           00027                                    ZPRIME                                
053855,000072: 23,3210           77641                           DOT                                            
053856,000073: 23,3211           02701                                    ZDC                                   
053857,000074: 23,3212           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
053858,000075: 23,3213           00027                                    ZPRIME                                
053859,000076: 23,3214           77641                           DOT                                            
053860,000077: 23,3215           02673                                    YDC                                   
053861,000078: 23,3216           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
053862,000079: 23,3217           47222                                    ARCTRIG                               
053863,000080: 
053864,000081: 23,3220           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
053865,000082: 23,3221           00051                                    S2                                    
053866,000083: 

Page 1246

053868,000085:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
053869,000086: 
053870,000087:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
053871,000088: 
053872,000089:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
053873,000090:                                                                                                  #  AVAILABLE AT MPAC.
053874,000091: 
053875,000092: 23,3222           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
053876,000093: 23,3223           00023                                    SINTH                                 
053877,000094: 23,3224           50025                           DSU      BMN                                   
053878,000095: 23,3225           07440                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
053879,000096: 23,3226           47235                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
053880,000097: 
053881,000098: 23,3227           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
053882,000099: 23,3230           00021                                    COSTH                                 
053883,000100: 23,3231           75326                           ACOS     SIGN                                  
053884,000101: 23,3232           00023                                    SINTH                                 
053885,000102: 23,3233           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
053886,000103: 23,3234           77616                           RVQ                                            
053887,000104: 
053888,000105: 23,3235           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
053889,000106: 23,3236           00023                                    SINTH                                 
053890,000107: 23,3237           77736                           ASIN                                           
053891,000108: 23,3240           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
053892,000109: 23,3241           00021                                    COSTH                                 
053893,000110: 23,3242           77640                           BMN                                            
053894,000111: 23,3243           47246                                    TRIG2                                 #  IF (135,-135)
053895,000112: 
053896,000113: 23,3244           43545                           DLOAD    RVQ                                   
053897,000114: 23,3245           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
053898,000115: 
053899,000116: 23,3246           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
053900,000117: 23,3247           06422                                    HIDPHALF                              
053901,000118: 23,3250           00023                                    SINTH                                 
053902,000119: 23,3251           77625                           DSU                                            
053903,000120: 23,3252           00025                                    THETA                                 
053904,000121: 23,3253           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
053905,000122: 23,3254           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
053906,000123: 

Page 1247

053908,000125:                                                                                                  #      SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
053909,000126:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
053910,000127:                                                                                                  #  FLIGHT SUBROUTINES.
053911,000128: 

Page 1248

053913,000130:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
053914,000131: 
053915,000132:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
053916,000133:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
053917,000134:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
053918,000135: 
053919,000136:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
053920,000137: 
053921,000138: 23,3255           77601        CALCGA             SETPD                                          #  PUSHDOWN  00-05, 16D-21D, 34D-37D
053922,000139: 23,3256           00001                                    0                                     
053923,000140: 23,3257           47375                           VLOAD    VXV                                   
053924,000141: 23,3260           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
053925,000142: 23,3261           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
053926,000143: 23,3262           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
053927,000144: 
053928,000145: 23,3263           44041                           DOT      ITA                                   
053929,000146: 23,3264           02701                                    ZNB                                   
053930,000147: 23,3265           00051                                    S2                                    
053931,000148: 23,3266           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
053932,000149: 23,3267           00001                                    0                                     
053933,000150: 23,3270           77641                           DOT                                            
053934,000151: 23,3271           02673                                    YNB                                   
053935,000152: 23,3272           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
053936,000153: 23,3273           47222                                    ARCTRIG                               
053937,000154: 23,3274           26740                           STOVL    OGC                                   
053938,000155: 23,3275           00001                                    0                                     
053939,000156: 
053940,000157: 23,3276           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
053941,000158: 23,3277           02665                                    XNB                                   
053942,000159: 23,3300           02651                                    YSM                                   
053943,000160: 23,3301           77752                           SL1                                            
053944,000161: 23,3302           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
053945,000162: 23,3303           02651                                    YSM                                   
053946,000163: 23,3304           77641                           DOT                                            
053947,000164: 23,3305           02665                                    XNB                                   
053948,000165: 23,3306           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
053949,000166: 23,3307           47222                                    ARCTRIG                               
053950,000167: 23,3310           02744                           STORE    MGC                                   
053951,000168: 
053952,000169: 23,3311           45246                           ABS      DSU                                   
053953,000170: 23,3312           07442                                    .166...                               
053954,000171: 23,3313           77644                           BPL                                            
053955,000172: 23,3314           47335                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
053956,000173: 
053957,000174: 23,3315           50375        CALCGA1            VLOAD    DOT                                   
053958,000175: 23,3316           02657                                    ZSM                                   
053959,000176: 23,3317           00001                                    0                                     
053960,000177: 23,3320           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
053961,000178: 23,3321           02643                                    XSM                                   

Page 1249

053963,000180: 23,3322           45441                           DOT      STADR                                 
053964,000181: 23,3323           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
053965,000182: 23,3324           47222                                    ARCTRIG                               
053966,000183: 
053967,000184: 23,3325           26742                           STOVL    IGC                                   
053968,000185: 23,3326           02740                                    OGC                                   
053969,000186: 23,3327           43034                           RTB      BONCLR                                
053970,000187: 23,3330           21524                                    V1STO2S                               
053971,000188: 23,3331           00200                                    CPHIFLAG                              
053972,000189: 23,3332           00051                                    S2                                    
053973,000190: 23,3333           34322                           STCALL   THETAD                                
053974,000191: 23,3334           00051                                    S2                                    
053975,000192: 
053976,000193: 23,3335           77776        GIMLOCK1           EXIT                                           
053977,000194: 23,3336           05567                           TC       ALARM                                 
053978,000195: 23,3337           00401                           OCT      00401                                 
053979,000196: 23,3340           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
053980,000197: 23,3341           00056                           ADRES    GLOKFAIL                              
053981,000198: 
053982,000199: 23,3342           06036                           TC       INTPRET                               
053983,000200: 23,3343           77650                           GOTO                                           
053984,000201: 23,3344           47315                                    CALCGA1                               
053985,000202: 

Page 1250

053987,000204:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
053988,000205: 
053989,000206:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
053990,000207:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
053991,000208:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
053992,000209:                                                                                                  #  THE VAC AREA.
053993,000210: 
053994,000211:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
053995,000212:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
053996,000213: 
053997,000214: 23,3345           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D,34D-37D
053998,000215: 23,3346           02714                                    STARAD     +6                         
053999,000216: 23,3347           00051                                    S1                                    
054000,000217: 23,3350           02700                                    STARAD     -6                         
054001,000218: 
054002,000219: 23,3351           77601                           SETPD                                          
054003,000220: 23,3352           00001                                    0                                     
054004,000221: 23,3353           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
054005,000222: 23,3354           02723                                    STARAD     +12D,1                     #         STARAD +00D   UB = S1
054006,000223: 23,3355           02731                                    STARAD     +18D,1                     
054007,000224: 23,3356           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
054008,000225: 23,3357           06731                           STORE    STARAD     +18D,1                     #         STARAD +06D   VB = UNIT(S1 X S2)
054009,000226: 23,3360           77773                           VLOAD*                                         
054010,000227: 23,3361           02723                                    STARAD     +12D,1                     
054011,000228: 
054012,000229: 23,3362           76433                           VXV*     VSL1                                  
054013,000230: 23,3363           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
054014,000231: 23,3364           06737                           STORE    STARAD     +24D,1                     #         STARAD +12D   WB = UB X VB
054015,000232: 
054016,000233: 23,3365           77700                           TIX,1                                          
054017,000234: 23,3366           47353                                    AXISGEN1                              
054018,000235: 
054019,000236: 23,3367           66160                           AXC,1    SXA,1                                 
054020,000237: 23,3370           00006                                    6                                     
054021,000238: 23,3371           00036                                    30D                                   
054022,000239: 
054023,000240: 23,3372           66370                           AXT,1    SSP                                   
054024,000241: 23,3373           00022                                    18D                                   
054025,000242: 23,3374           00051                                    S1                                    
054026,000243: 23,3375           00006                                    6                                     
054027,000244: 
054028,000245: 23,3376           66374                           AXT,2    SSP                                   
054029,000246: 23,3377           00006                                    6                                     
054030,000247: 23,3400           00052                                    S2                                    
054031,000248: 23,3401           00002                                    2                                     
054032,000249: 
054033,000250: 23,3402           76720        AXISGEN2           XCHX,1   VLOAD*                                
054034,000251: 23,3403           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
054035,000252: 23,3404           00001                                    0,1                                   
054036,000253: 

Page 1251

054038,000255: 23,3405           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
054039,000256: 23,3406           75062                                    STARAD     +6,2                       
054040,000257: 23,3407           00007                                    6,1                                   
054041,000258: 23,3410           77757                           VXSC*                                          
054042,000259: 23,3411           75054                                    STARAD     +12D,2                     
054043,000260: 23,3412           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
054044,000261: 23,3413           00015                                    12D,1                                 
054045,000262: 
054046,000263: 23,3414           53357                           VXSC*    VAD                                   
054047,000264: 23,3415           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
054048,000265: 23,3416           76455                           VAD      VSL1                                  
054049,000266: 23,3417           00031                                    24D                                   
054050,000267: 23,3420           53520                           XCHX,1   UNIT                                  
054051,000268: 23,3421           00036                                    30D                                   
054052,000269: 23,3422           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
054053,000270: 
054054,000271: 23,3423           77700                           TIX,1                                          
054055,000272: 23,3424           47425                                    AXISGEN3                              
054056,000273: 
054057,000274: 23,3425           77704        AXISGEN3           TIX,2                                          
054058,000275: 23,3426           47402                                    AXISGEN2                              
054059,000276: 
054060,000277: 23,3427           77775                           VLOAD                                          
054061,000278: 23,3430           02665                                    XDC                                   
054062,000279: 23,3431           26707                           STOVL    STARAD                                
054063,000280: 23,3432           02673                                    YDC                                   
054064,000281: 23,3433           26715                           STOVL    STARAD     +6                         
054065,000282: 23,3434           02701                                    ZDC                                   
054066,000283: 23,3435           02723                           STORE    STARAD     +12D                       
054067,000284: 
054068,000285: 23,3436           77616                           RVQ                                            
054069,000286: 

Page 1252

054071,000288: 23,3437           05520 26075  QTSN45             2DEC     .1768                                 
054072,000289: 
054073,000290: 23,3441           05252 25253  .166...            2DEC     .1666666667                            
054074,000291: 

Page 1253 Empty page

054077,000294: 

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