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
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

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

Page 1249

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

Page 1250

053596,000084: 23,3304           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
053597,000085: 23,3305           00027                                    ZPRIME                                
053598,000086: 23,3306           77641                           DOT                                            
053599,000087: 23,3307           02701                                    ZDC                                   
053600,000088: 23,3310           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
053601,000089: 23,3311           00027                                    ZPRIME                                
053602,000090: 23,3312           77641                           DOT                                            
053603,000091: 23,3313           02673                                    YDC                                   
053604,000092: 23,3314           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
053605,000093: 23,3315           47320                                    ARCTRIG                               
053606,000094: 
053607,000095: 23,3316           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
053608,000096: 23,3317           00051                                    S2                                    
053609,000097: 

Page 1251

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

Page 1252

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

Page 1253

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

Page 1254

053706,000194: 23,3420           45441                           DOT      STADR                                 
053707,000195: 23,3421           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
053708,000196: 23,3422           47320                                    ARCTRIG                               
053709,000197: 
053710,000198: 23,3423           26742                           STOVL    IGC                                   
053711,000199: 23,3424           02740                                    OGC                                   
053712,000200: 23,3425           77634                           RTB                                            
053713,000201: 23,3426           21620                                    V1STO2S                               
053714,000202: 23,3427           34322                           STCALL   THETAD                                
053715,000203: 23,3430           00051                                    S2                                    
053716,000204: 
053717,000205: 23,3431           77776        GIMLOCK1           EXIT                                           
053718,000206: 23,3432           05567                           TC       ALARM                                 
053719,000207: 23,3433           00401                           OCT      00401                                 
053720,000208: 23,3434           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
053721,000209: 23,3435           00056                           ADRES    GLOKFAIL                              
053722,000210: 
053723,000211: 23,3436           06037                           TC       INTPRET                               
053724,000212: 23,3437           77650                           GOTO                                           
053725,000213: 23,3440           47413                                    CALCGA1                               
053726,000214: 

Page 1255

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

Page 1256

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

Page 1257

053812,000300: 23,3533           05520 26075  QTSN45             2DEC     .1768                                 
053813,000301: 
053814,000302: 23,3535           05252 25253  .166...            2DEC     .1666666667                            
053815,000303: 

Page 1258 Empty page

053818,000306: 

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