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.

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

Page 1249

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

Page 1250

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

Page 1251

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

Page 1252

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

Page 1253

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

Page 1254

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

Page 1255

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

Page 1256

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

Page 1257

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

Page 1258 Empty page

053820,000306: 

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