Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

053497,000002:                                                                                                  ## Copyright:   Public domain.
053498,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
053499,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
053500,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
053501,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
053502,000007:                                                                                                  ## Assembler:   yaYUL
053503,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
053504,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
053505,000010:                                                                                                  ## Pages:       1249-1258
053506,000011:                                                                                                  ## Mod history: 2009-05-26 RSB  Adapted from the corresponding 
053507,000012:                                                                                                  ##                              Luminary131 file, using page 
053508,000013:                                                                                                  ##                              images from Luminary 1A.
053509,000014:                                                                                                  ##              2016-12-17 RSB  Proofed text comments with octopus/ProoferComments
053510,000015:                                                                                                  ##                              and corrected the errors found.
053511,000016:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
053512,000017:                                                                                                  ##                              Luminary 99 vs Comanche 55.
053513,000018: 
053514,000019:                                                                                                  ## This source code has been transcribed or otherwise adapted from
053515,000020:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
053516,000021:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
053517,000022:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
053518,000023:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
053519,000024:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
053520,000025:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
053521,000026:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
053522,000027:                                                                                                  ## actually created.
053523,000028:                                                                                                  ##
053524,000029:                                                                                                  ## Notations on the hardcopy document read, in part:
053525,000030:                                                                                                  ##
053526,000031:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
053527,000032:                                                                                                  ##      16:27 JULY 14, 1969 
053528,000033: 

Page 1249

053530,000035: 22,3773                                           BANK     22                                    
053531,000036: 23,2000                                           SETLOC   INFLIGHT                              
053532,000037: 23,2000                                           BANK                                           
053533,000038: 
053534,000039: 23,3247  E5,1642                                  EBANK=   XSM                                   
053535,000040: 
053536,000041:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
053537,000042: 
053538,000043:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
053539,000044:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
053540,000045: 
053541,000046:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
053542,000047:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
053543,000048: 
053544,000049: 23,3247                                           COUNT*   $$/INFLT                              
053545,000050: 23,3247           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
053546,000051: 23,3250           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
053547,000052: 23,3251           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
053548,000053: 23,3252           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
053549,000054: 23,3253           06522                                    HI6ZEROS                              
053550,000055: 23,3254           02671                                    XDC        +4                         
053551,000056: 23,3255           55476                           DCOMP    VDEF                                  
053552,000057: 23,3256           77656                           UNIT                                           
053553,000058: 23,3257           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
053554,000059: 23,3260           00027                                    ZPRIME                                
053555,000060: 
053556,000061: 23,3261           77742                           SR1                                            
053557,000062: 23,3262           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
053558,000063: 23,3263           00033                                    ZPRIME     +4                         
053559,000064: 23,3264           77742                           SR1                                            
053560,000065: 23,3265           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
053561,000066: 23,3266           47320                                    ARCTRIG                               
053562,000067: 
053563,000068: 23,3267           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
053564,000069: 23,3270           02667                                    XDC        +2                         
053565,000070: 23,3271           77742                           SR1                                            
053566,000071: 23,3272           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
053567,000072: 23,3273           00027                                    ZPRIME                                
053568,000073: 
053569,000074: 23,3274           65205                           DMP      PDDL                                  
053570,000075: 23,3275           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
053571,000076: 23,3276           00033                                    ZPRIME     +4                         
053572,000077: 
053573,000078: 23,3277           45205                           DMP      DSU                                   
053574,000079: 23,3300           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
053575,000080: 23,3301           77626                           STADR                                          
053576,000081: 23,3302           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
053577,000082: 23,3303           47320                                    ARCTRIG                               

Page 1250

053579,000084: 23,3304           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
053580,000085: 23,3305           00027                                    ZPRIME                                
053581,000086: 23,3306           77641                           DOT                                            
053582,000087: 23,3307           02701                                    ZDC                                   
053583,000088: 23,3310           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
053584,000089: 23,3311           00027                                    ZPRIME                                
053585,000090: 23,3312           77641                           DOT                                            
053586,000091: 23,3313           02673                                    YDC                                   
053587,000092: 23,3314           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
053588,000093: 23,3315           47320                                    ARCTRIG                               
053589,000094: 
053590,000095: 23,3316           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
053591,000096: 23,3317           00051                                    S2                                    
053592,000097: 

Page 1251

053594,000099:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
053595,000100: 
053596,000101:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
053597,000102: 
053598,000103:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
053599,000104:                                                                                                  #  AVAILABLE AT MPAC.
053600,000105: 
053601,000106: 23,3320           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
053602,000107: 23,3321           00023                                    SINTH                                 
053603,000108: 23,3322           50025                           DSU      BMN                                   
053604,000109: 23,3323           07534                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
053605,000110: 23,3324           47333                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
053606,000111: 
053607,000112: 23,3325           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
053608,000113: 23,3326           00021                                    COSTH                                 
053609,000114: 23,3327           75326                           ACOS     SIGN                                  
053610,000115: 23,3330           00023                                    SINTH                                 
053611,000116: 23,3331           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
053612,000117: 23,3332           77616                           RVQ                                            
053613,000118: 
053614,000119: 23,3333           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
053615,000120: 23,3334           00023                                    SINTH                                 
053616,000121: 23,3335           77736                           ASIN                                           
053617,000122: 23,3336           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
053618,000123: 23,3337           00021                                    COSTH                                 
053619,000124: 23,3340           77640                           BMN                                            
053620,000125: 23,3341           47344                                    TRIG2                                 #  IF (135,-135)
053621,000126: 
053622,000127: 23,3342           43545                           DLOAD    RVQ                                   
053623,000128: 23,3343           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
053624,000129: 
053625,000130: 23,3344           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
053626,000131: 23,3345           06520                                    HIDPHALF                              
053627,000132: 23,3346           00023                                    SINTH                                 
053628,000133: 23,3347           77625                           DSU                                            
053629,000134: 23,3350           00025                                    THETA                                 
053630,000135: 23,3351           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
053631,000136: 23,3352           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
053632,000137: 

Page 1252

053634,000139:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
053635,000140:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
053636,000141:                                                                                                  #  FLIGHT SUBROUTINES.
053637,000142: 

Page 1253

053639,000144:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
053640,000145: 
053641,000146:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
053642,000147:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
053643,000148:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
053644,000149: 
053645,000150:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
053646,000151: 
053647,000152: 23,3353           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
053648,000153: 23,3354           00001                                    0                                     
053649,000154: 23,3355           47375                           VLOAD    VXV                                   
053650,000155: 23,3356           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
053651,000156: 23,3357           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
053652,000157: 23,3360           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
053653,000158: 
053654,000159: 23,3361           44041                           DOT      ITA                                   
053655,000160: 23,3362           02701                                    ZNB                                   
053656,000161: 23,3363           00051                                    S2                                    
053657,000162: 23,3364           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
053658,000163: 23,3365           00001                                    0                                     
053659,000164: 23,3366           77641                           DOT                                            
053660,000165: 23,3367           02673                                    YNB                                   
053661,000166: 23,3370           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
053662,000167: 23,3371           47320                                    ARCTRIG                               
053663,000168: 23,3372           26740                           STOVL    OGC                                   
053664,000169: 23,3373           00001                                    0                                     
053665,000170: 
053666,000171: 23,3374           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
053667,000172: 23,3375           02665                                    XNB                                   
053668,000173: 23,3376           02651                                    YSM                                   
053669,000174: 23,3377           77752                           SL1                                            
053670,000175: 23,3400           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
053671,000176: 23,3401           02651                                    YSM                                   
053672,000177: 23,3402           77641                           DOT                                            
053673,000178: 23,3403           02665                                    XNB                                   
053674,000179: 23,3404           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
053675,000180: 23,3405           47320                                    ARCTRIG                               
053676,000181: 23,3406           02744                           STORE    MGC                                   
053677,000182: 
053678,000183: 23,3407           45246                           ABS      DSU                                   
053679,000184: 23,3410           07536                                    .166...                               
053680,000185: 23,3411           77644                           BPL                                            
053681,000186: 23,3412           47431                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
053682,000187: 
053683,000188: 23,3413           50375        CALCGA1            VLOAD    DOT                                   
053684,000189: 23,3414           02657                                    ZSM                                   
053685,000190: 23,3415           00001                                    0                                     
053686,000191: 23,3416           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
053687,000192: 23,3417           02643                                    XSM                                   

Page 1254

053689,000194: 23,3420           45441                           DOT      STADR                                 
053690,000195: 23,3421           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
053691,000196: 23,3422           47320                                    ARCTRIG                               
053692,000197: 
053693,000198: 23,3423           26742                           STOVL    IGC                                   
053694,000199: 23,3424           02740                                    OGC                                   
053695,000200: 23,3425           77634                           RTB                                            
053696,000201: 23,3426           21620                                    V1STO2S                               
053697,000202: 23,3427           34322                           STCALL   THETAD                                
053698,000203: 23,3430           00051                                    S2                                    
053699,000204: 
053700,000205: 23,3431           77776        GIMLOCK1           EXIT                                           
053701,000206: 23,3432           05567                           TC       ALARM                                 
053702,000207: 23,3433           00401                           OCT      00401                                 
053703,000208: 23,3434           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
053704,000209: 23,3435           00056                           ADRES    GLOKFAIL                              
053705,000210: 
053706,000211: 23,3436           06037                           TC       INTPRET                               
053707,000212: 23,3437           77650                           GOTO                                           
053708,000213: 23,3440           47413                                    CALCGA1                               
053709,000214: 

Page 1255

053711,000216:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
053712,000217: 
053713,000218:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
053714,000219:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
053715,000220:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
053716,000221:                                                                                                  #  THE VAC AREA.
053717,000222: 
053718,000223:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
053719,000224:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
053720,000225: 
053721,000226: 23,3441           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
053722,000227: 23,3442           02714                                    STARAD     +6                         
053723,000228: 23,3443           00051                                    S1                                    
053724,000229: 23,3444           02700                                    STARAD     -6                         
053725,000230: 
053726,000231: 23,3445           77601                           SETPD                                          
053727,000232: 23,3446           00001                                    0                                     
053728,000233: 23,3447           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
053729,000234: 23,3450           02723                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
053730,000235: 23,3451           02731                                    STARAD     +18D,1                     
053731,000236: 23,3452           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
053732,000237: 23,3453           06731                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
053733,000238: 23,3454           77773                           VLOAD*                                         
053734,000239: 23,3455           02723                                    STARAD     +12D,1                     
053735,000240: 
053736,000241: 23,3456           76433                           VXV*     VSL1                                  
053737,000242: 23,3457           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
053738,000243: 23,3460           06737                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
053739,000244: 
053740,000245: 23,3461           77700                           TIX,1                                          
053741,000246: 23,3462           47447                                    AXISGEN1                              
053742,000247: 
053743,000248: 23,3463           66160                           AXC,1    SXA,1                                 
053744,000249: 23,3464           00006                                    6                                     
053745,000250: 23,3465           00036                                    30D                                   
053746,000251: 
053747,000252: 23,3466           66370                           AXT,1    SSP                                   
053748,000253: 23,3467           00022                                    18D                                   
053749,000254: 23,3470           00051                                    S1                                    
053750,000255: 23,3471           00006                                    6                                     
053751,000256: 
053752,000257: 23,3472           66374                           AXT,2    SSP                                   
053753,000258: 23,3473           00006                                    6                                     
053754,000259: 23,3474           00052                                    S2                                    
053755,000260: 23,3475           00002                                    2                                     
053756,000261: 
053757,000262: 23,3476           76720        AXISGEN2           XCHX,1   VLOAD*                                
053758,000263: 23,3477           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
053759,000264: 23,3500           00001                                    0,1                                   
053760,000265: 

Page 1256

053762,000267: 23,3501           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
053763,000268: 23,3502           75062                                    STARAD     +6,2                       
053764,000269: 23,3503           00007                                    6,1                                   
053765,000270: 23,3504           77757                           VXSC*                                          
053766,000271: 23,3505           75054                                    STARAD     +12D,2                     
053767,000272: 23,3506           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
053768,000273: 23,3507           00015                                    12D,1                                 
053769,000274: 
053770,000275: 23,3510           53357                           VXSC*    VAD                                   
053771,000276: 23,3511           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
053772,000277: 23,3512           76455                           VAD      VSL1                                  
053773,000278: 23,3513           00031                                    24D                                   
053774,000279: 23,3514           53520                           XCHX,1   UNIT                                  
053775,000280: 23,3515           00036                                    30D                                   
053776,000281: 23,3516           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
053777,000282: 
053778,000283: 23,3517           77700                           TIX,1                                          
053779,000284: 23,3520           47521                                    AXISGEN3                              
053780,000285: 
053781,000286: 23,3521           77704        AXISGEN3           TIX,2                                          
053782,000287: 23,3522           47476                                    AXISGEN2                              
053783,000288: 
053784,000289: 23,3523           77775                           VLOAD                                          
053785,000290: 23,3524           02665                                    XDC                                   
053786,000291: 23,3525           26707                           STOVL    STARAD                                
053787,000292: 23,3526           02673                                    YDC                                   
053788,000293: 23,3527           26715                           STOVL    STARAD     +6                         
053789,000294: 23,3530           02701                                    ZDC                                   
053790,000295: 23,3531           02723                           STORE    STARAD     +12D                       
053791,000296: 
053792,000297: 23,3532           77616                           RVQ                                            
053793,000298: 

Page 1257

053795,000300: 23,3533           05520 26075  QTSN45             2DEC     .1768                                 
053796,000301: 
053797,000302: 23,3535           05252 25253  .166...            2DEC     .1666666667                            
053798,000303: 

Page 1258 Empty page

053801,000306: 

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