Source Code

This is an attempt to recreate Luminary 99 Rev 2, otherwise known as LUM99R2, from Luminary 99 Rev 1 and ephemeris data from Luminary 116. The differences are confined to the last 10-12 lines of the CONTROLLED CONSTANTS. Luminary 99 Rev 1 source-code was transcribed from a printout in the MIT Museum, while Luminary 116 source code was transcribed from a printout belonging to Don Eyles. AGC developer James Kernan, the "rope mother" for the Apollo 11 Lunar Module's AGC, explains as follows: "At the last minute, Dan Lickly, our chief engineer, appeared with ephemerides updates and it took two tries to get it right. The result was that we created Lum99 Revision 1 and Lum99 Revision 2." It is suspected that the former is what's in the MIT Museum, and the latter is what we are trying to recreate here. As for which revision actually flew in Apollo 11, all of the other available surviving evidence points to Rev 1 rather than to Rev 2, so we're just not sure!

052532,000002:                                                                                                  ## Copyright:   Public domain.
052533,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
052534,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
052535,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
052536,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
052537,000007:                                                                                                  ## Assembler:   yaYUL
052538,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
052539,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
052540,000010:                                                                                                  ## Pages:       1249-1258
052541,000011:                                                                                                  ## Mod history: 2009-05-26 RSB  Adapted from the corresponding 
052542,000012:                                                                                                  ##                              Luminary131 file, using page 
052543,000013:                                                                                                  ##                              images from Luminary 1A.
052544,000014:                                                                                                  ##              2016-12-17 RSB  Proofed text comments with octopus/ProoferComments
052545,000015:                                                                                                  ##                              and corrected the errors found.
052546,000016:                                                                                                  ##              2017-03-03 RSB  Snapshot of Luminary 99 Rev 1. 
052547,000017:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
052548,000018:                                                                                                  ##                              Luminary 99 vs Comanche 55.
052549,000019: 

Page 1249

052551,000021: 22,3773                                           BANK     22                                    
052552,000022: 23,2000                                           SETLOC   INFLIGHT                              
052553,000023: 23,2000                                           BANK                                           
052554,000024: 
052555,000025: 23,3247  E5,1642                                  EBANK=   XSM                                   
052556,000026: 
052557,000027:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052558,000028: 
052559,000029:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
052560,000030:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
052561,000031: 
052562,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,
052563,000033:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
052564,000034: 
052565,000035: 23,3247                                           COUNT*   $$/INFLT                              
052566,000036: 23,3247           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
052567,000037: 23,3250           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
052568,000038: 23,3251           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
052569,000039: 23,3252           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
052570,000040: 23,3253           06522                                    HI6ZEROS                              
052571,000041: 23,3254           02671                                    XDC        +4                         
052572,000042: 23,3255           55476                           DCOMP    VDEF                                  
052573,000043: 23,3256           77656                           UNIT                                           
052574,000044: 23,3257           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
052575,000045: 23,3260           00027                                    ZPRIME                                
052576,000046: 
052577,000047: 23,3261           77742                           SR1                                            
052578,000048: 23,3262           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
052579,000049: 23,3263           00033                                    ZPRIME     +4                         
052580,000050: 23,3264           77742                           SR1                                            
052581,000051: 23,3265           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
052582,000052: 23,3266           47320                                    ARCTRIG                               
052583,000053: 
052584,000054: 23,3267           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
052585,000055: 23,3270           02667                                    XDC        +2                         
052586,000056: 23,3271           77742                           SR1                                            
052587,000057: 23,3272           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
052588,000058: 23,3273           00027                                    ZPRIME                                
052589,000059: 
052590,000060: 23,3274           65205                           DMP      PDDL                                  
052591,000061: 23,3275           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
052592,000062: 23,3276           00033                                    ZPRIME     +4                         
052593,000063: 
052594,000064: 23,3277           45205                           DMP      DSU                                   
052595,000065: 23,3300           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
052596,000066: 23,3301           77626                           STADR                                          
052597,000067: 23,3302           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
052598,000068: 23,3303           47320                                    ARCTRIG                               

Page 1250

052600,000070: 23,3304           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
052601,000071: 23,3305           00027                                    ZPRIME                                
052602,000072: 23,3306           77641                           DOT                                            
052603,000073: 23,3307           02701                                    ZDC                                   
052604,000074: 23,3310           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
052605,000075: 23,3311           00027                                    ZPRIME                                
052606,000076: 23,3312           77641                           DOT                                            
052607,000077: 23,3313           02673                                    YDC                                   
052608,000078: 23,3314           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
052609,000079: 23,3315           47320                                    ARCTRIG                               
052610,000080: 
052611,000081: 23,3316           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
052612,000082: 23,3317           00051                                    S2                                    
052613,000083: 

Page 1251

052615,000085:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
052616,000086: 
052617,000087:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
052618,000088: 
052619,000089:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
052620,000090:                                                                                                  #  AVAILABLE AT MPAC.
052621,000091: 
052622,000092: 23,3320           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
052623,000093: 23,3321           00023                                    SINTH                                 
052624,000094: 23,3322           50025                           DSU      BMN                                   
052625,000095: 23,3323           07534                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
052626,000096: 23,3324           47333                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
052627,000097: 
052628,000098: 23,3325           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
052629,000099: 23,3326           00021                                    COSTH                                 
052630,000100: 23,3327           75326                           ACOS     SIGN                                  
052631,000101: 23,3330           00023                                    SINTH                                 
052632,000102: 23,3331           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
052633,000103: 23,3332           77616                           RVQ                                            
052634,000104: 
052635,000105: 23,3333           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
052636,000106: 23,3334           00023                                    SINTH                                 
052637,000107: 23,3335           77736                           ASIN                                           
052638,000108: 23,3336           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
052639,000109: 23,3337           00021                                    COSTH                                 
052640,000110: 23,3340           77640                           BMN                                            
052641,000111: 23,3341           47344                                    TRIG2                                 #  IF (135,-135)
052642,000112: 
052643,000113: 23,3342           43545                           DLOAD    RVQ                                   
052644,000114: 23,3343           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
052645,000115: 
052646,000116: 23,3344           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
052647,000117: 23,3345           06520                                    HIDPHALF                              
052648,000118: 23,3346           00023                                    SINTH                                 
052649,000119: 23,3347           77625                           DSU                                            
052650,000120: 23,3350           00025                                    THETA                                 
052651,000121: 23,3351           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
052652,000122: 23,3352           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
052653,000123: 

Page 1252

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

Page 1253

052660,000130:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052661,000131: 
052662,000132:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
052663,000133:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
052664,000134:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
052665,000135: 
052666,000136:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
052667,000137: 
052668,000138: 23,3353           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
052669,000139: 23,3354           00001                                    0                                     
052670,000140: 23,3355           47375                           VLOAD    VXV                                   
052671,000141: 23,3356           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
052672,000142: 23,3357           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
052673,000143: 23,3360           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
052674,000144: 
052675,000145: 23,3361           44041                           DOT      ITA                                   
052676,000146: 23,3362           02701                                    ZNB                                   
052677,000147: 23,3363           00051                                    S2                                    
052678,000148: 23,3364           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
052679,000149: 23,3365           00001                                    0                                     
052680,000150: 23,3366           77641                           DOT                                            
052681,000151: 23,3367           02673                                    YNB                                   
052682,000152: 23,3370           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
052683,000153: 23,3371           47320                                    ARCTRIG                               
052684,000154: 23,3372           26740                           STOVL    OGC                                   
052685,000155: 23,3373           00001                                    0                                     
052686,000156: 
052687,000157: 23,3374           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
052688,000158: 23,3375           02665                                    XNB                                   
052689,000159: 23,3376           02651                                    YSM                                   
052690,000160: 23,3377           77752                           SL1                                            
052691,000161: 23,3400           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
052692,000162: 23,3401           02651                                    YSM                                   
052693,000163: 23,3402           77641                           DOT                                            
052694,000164: 23,3403           02665                                    XNB                                   
052695,000165: 23,3404           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
052696,000166: 23,3405           47320                                    ARCTRIG                               
052697,000167: 23,3406           02744                           STORE    MGC                                   
052698,000168: 
052699,000169: 23,3407           45246                           ABS      DSU                                   
052700,000170: 23,3410           07536                                    .166...                               
052701,000171: 23,3411           77644                           BPL                                            
052702,000172: 23,3412           47431                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
052703,000173: 
052704,000174: 23,3413           50375        CALCGA1            VLOAD    DOT                                   
052705,000175: 23,3414           02657                                    ZSM                                   
052706,000176: 23,3415           00001                                    0                                     
052707,000177: 23,3416           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
052708,000178: 23,3417           02643                                    XSM                                   

Page 1254

052710,000180: 23,3420           45441                           DOT      STADR                                 
052711,000181: 23,3421           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
052712,000182: 23,3422           47320                                    ARCTRIG                               
052713,000183: 
052714,000184: 23,3423           26742                           STOVL    IGC                                   
052715,000185: 23,3424           02740                                    OGC                                   
052716,000186: 23,3425           77634                           RTB                                            
052717,000187: 23,3426           21620                                    V1STO2S                               
052718,000188: 23,3427           34322                           STCALL   THETAD                                
052719,000189: 23,3430           00051                                    S2                                    
052720,000190: 
052721,000191: 23,3431           77776        GIMLOCK1           EXIT                                           
052722,000192: 23,3432           05567                           TC       ALARM                                 
052723,000193: 23,3433           00401                           OCT      00401                                 
052724,000194: 23,3434           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
052725,000195: 23,3435           00056                           ADRES    GLOKFAIL                              
052726,000196: 
052727,000197: 23,3436           06037                           TC       INTPRET                               
052728,000198: 23,3437           77650                           GOTO                                           
052729,000199: 23,3440           47413                                    CALCGA1                               
052730,000200: 

Page 1255

052732,000202:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
052733,000203: 
052734,000204:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
052735,000205:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
052736,000206:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
052737,000207:                                                                                                  #  THE VAC AREA.
052738,000208: 
052739,000209:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
052740,000210:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
052741,000211: 
052742,000212: 23,3441           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
052743,000213: 23,3442           02714                                    STARAD     +6                         
052744,000214: 23,3443           00051                                    S1                                    
052745,000215: 23,3444           02700                                    STARAD     -6                         
052746,000216: 
052747,000217: 23,3445           77601                           SETPD                                          
052748,000218: 23,3446           00001                                    0                                     
052749,000219: 23,3447           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
052750,000220: 23,3450           02723                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
052751,000221: 23,3451           02731                                    STARAD     +18D,1                     
052752,000222: 23,3452           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
052753,000223: 23,3453           06731                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
052754,000224: 23,3454           77773                           VLOAD*                                         
052755,000225: 23,3455           02723                                    STARAD     +12D,1                     
052756,000226: 
052757,000227: 23,3456           76433                           VXV*     VSL1                                  
052758,000228: 23,3457           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
052759,000229: 23,3460           06737                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
052760,000230: 
052761,000231: 23,3461           77700                           TIX,1                                          
052762,000232: 23,3462           47447                                    AXISGEN1                              
052763,000233: 
052764,000234: 23,3463           66160                           AXC,1    SXA,1                                 
052765,000235: 23,3464           00006                                    6                                     
052766,000236: 23,3465           00036                                    30D                                   
052767,000237: 
052768,000238: 23,3466           66370                           AXT,1    SSP                                   
052769,000239: 23,3467           00022                                    18D                                   
052770,000240: 23,3470           00051                                    S1                                    
052771,000241: 23,3471           00006                                    6                                     
052772,000242: 
052773,000243: 23,3472           66374                           AXT,2    SSP                                   
052774,000244: 23,3473           00006                                    6                                     
052775,000245: 23,3474           00052                                    S2                                    
052776,000246: 23,3475           00002                                    2                                     
052777,000247: 
052778,000248: 23,3476           76720        AXISGEN2           XCHX,1   VLOAD*                                
052779,000249: 23,3477           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
052780,000250: 23,3500           00001                                    0,1                                   
052781,000251: 

Page 1256

052783,000253: 23,3501           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
052784,000254: 23,3502           75062                                    STARAD     +6,2                       
052785,000255: 23,3503           00007                                    6,1                                   
052786,000256: 23,3504           77757                           VXSC*                                          
052787,000257: 23,3505           75054                                    STARAD     +12D,2                     
052788,000258: 23,3506           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
052789,000259: 23,3507           00015                                    12D,1                                 
052790,000260: 
052791,000261: 23,3510           53357                           VXSC*    VAD                                   
052792,000262: 23,3511           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
052793,000263: 23,3512           76455                           VAD      VSL1                                  
052794,000264: 23,3513           00031                                    24D                                   
052795,000265: 23,3514           53520                           XCHX,1   UNIT                                  
052796,000266: 23,3515           00036                                    30D                                   
052797,000267: 23,3516           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
052798,000268: 
052799,000269: 23,3517           77700                           TIX,1                                          
052800,000270: 23,3520           47521                                    AXISGEN3                              
052801,000271: 
052802,000272: 23,3521           77704        AXISGEN3           TIX,2                                          
052803,000273: 23,3522           47476                                    AXISGEN2                              
052804,000274: 
052805,000275: 23,3523           77775                           VLOAD                                          
052806,000276: 23,3524           02665                                    XDC                                   
052807,000277: 23,3525           26707                           STOVL    STARAD                                
052808,000278: 23,3526           02673                                    YDC                                   
052809,000279: 23,3527           26715                           STOVL    STARAD     +6                         
052810,000280: 23,3530           02701                                    ZDC                                   
052811,000281: 23,3531           02723                           STORE    STARAD     +12D                       
052812,000282: 
052813,000283: 23,3532           77616                           RVQ                                            
052814,000284: 

Page 1257

052816,000286: 23,3533           05520 26075  QTSN45             2DEC     .1768                                 
052817,000287: 
052818,000288: 23,3535           05252 25253  .166...            2DEC     .1666666667                            
052819,000289: 

Page 1258 Empty page

052822,000292: 

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