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.

013425,000002:                                                                                                  ## Copyright:   Public domain.
013426,000003:                                                                                                  ## Filename:    LEM_GEOMETRY.agc
013427,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
013428,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
013429,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
013430,000007:                                                                                                  ## Assembler:   yaYUL
013431,000008:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013432,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
013433,000010:                                                                                                  ## Pages:       320-325
013434,000011:                                                                                                  ## Mod history: 2009-05-16 RSB  Adapted from the corresponding 
013435,000012:                                                                                                  ##                              Luminary131 file, using page 
013436,000013:                                                                                                  ##                              images from Luminary 1A.
013437,000014:                                                                                                  ##              2016-12-13 RSB  Proofed text comments with octopus/ProoferComments
013438,000015:                                                                                                  ##                              and corrected the errors found.
013439,000016:                                                                                                  ##              2017-03-07 RSB  Fixed comment-text error noticed while proofing
013440,000017:                                                                                                  ##                              Luminary 116.
013441,000018:                                                                                                  ##
013442,000019:                                                                                                  ## This source code has been transcribed or otherwise adapted from
013443,000020:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
013444,000021:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
013445,000022:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
013446,000023:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
013447,000024:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
013448,000025:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
013449,000026:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
013450,000027:                                                                                                  ## actually created.
013451,000028:                                                                                                  ##
013452,000029:                                                                                                  ## Notations on the hardcopy document read, in part:
013453,000030:                                                                                                  ##
013454,000031:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
013455,000032:                                                                                                  ##      16:27 JULY 14, 1969 
013456,000033: 

Page 320

013458,000035: 23,2041                                           BANK     23                                    
013459,000036: 13,2000                                           SETLOC   LEMGEOM                               
013460,000037: 13,2000                                           BANK                                           
013461,000038: 
013462,000039: 13,2070  30,2000                                  SBANK=   LOWSUPER                              
013463,000040: 13,2070  E5,1642                                  EBANK=   XSM                                   
013464,000041: 
013465,000042:                                                                                                  #  THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013466,000043:                                                                                                  #  THE CONIC R,V AND THE DEVIATIONS R,V.  THE STATE VECTORS ARE CONVERTED TO
013467,000044:                                                                                                  #  METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013468,000045:                                                                                                  #  R-OTHER,V-OTHER FOR DOWNLINK.  THE ROUTINES NAMES ARE SWITCHED IN THE
013469,000046:                                                                                                  #  OTHER VEHICLES COMPUTER.
013470,000047: 
013471,000048:                                                                                                  #  INPUT
013472,000049:                                                                                                  #        STATE VECTOR IN TEMPORARY STORAGE AREA
013473,000050:                                                                                                  #        IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013474,000051:                                                                                                  #                SET X2 TO +2
013475,000052:                                                                                                  #        IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013476,000053:                                                                                                  #                SET X2 TO 0
013477,000054: 
013478,000055:                                                                                                  #  OUTPUT
013479,000056:                                                                                                  #        R(T) IN RN, V(T) IN VN, T IN PIPTIME
013480,000057:                                                                                                  #  OR
013481,000058:                                                                                                  #        R(T) IN R-OTHER, V(T) IN V-OTHER        (T IS DEFINED BY T-OTHER)
013482,000059: 
013483,000060: 13,2070                                           COUNT*   $$/GEOM                               
013484,000061: 13,2070           43414        SVDWN2             BOF      RVQ                                   #  SW=1=AVETOMID DOING W-MATRIX INTEG.
013485,000062: 13,2071           04756                                    AVEMIDSW                              
013486,000063: 13,2072           26073                                    +1                                    
013487,000064: 13,2073           53775                           VLOAD    VSL*                                  
013488,000065: 13,2074           01521                                    TDELTAV                               
013489,000066: 13,2075           57605                                    0          -7,2                       
013490,000067: 13,2076           53655                           VAD      VSL*                                  
013491,000068: 13,2077           01535                                    RCV                                   
013492,000069: 13,2100           57576                                    0,2                                   
013493,000070: 13,2101           25221                           STOVL    RN                                    
013494,000071: 13,2102           01527                                    TNUV                                  
013495,000072: 13,2103           53257                           VSL*     VAD                                   
013496,000073: 13,2104           57602                                    0          -4,2                       
013497,000074: 13,2105           01543                                    VCV                                   
013498,000075: 13,2106           77657                           VSL*                                           
013499,000076: 13,2107           57576                                    0,2                                   
013500,000077: 13,2110           15227                           STODL    VN                                    
013501,000078: 13,2111           01517                                    TET                                   
013502,000079: 13,2112           01235                           STORE    PIPTIME                               
013503,000080: 13,2113           77616                           RVQ                                            

Page 321

013505,000082: 13,2114           53775        SVDWN1             VLOAD    VSL*                                  
013506,000083: 13,2115           01521                                    TDELTAV                               
013507,000084: 13,2116           57605                                    0          -7,2                       
013508,000085: 13,2117           53655                           VAD      VSL*                                  
013509,000086: 13,2120           01535                                    RCV                                   
013510,000087: 13,2121           57576                                    0,2                                   
013511,000088: 13,2122           25720                           STOVL    R-OTHER                               
013512,000089: 13,2123           01527                                    TNUV                                  
013513,000090: 13,2124           53257                           VSL*     VAD                                   
013514,000091: 13,2125           57602                                    0          -4,2                       
013515,000092: 13,2126           01543                                    VCV                                   
013516,000093: 13,2127           77657                           VSL*                                           
013517,000094: 13,2130           57576                                    0,2                                   
013518,000095: 13,2131           01726                           STORE    V-OTHER                               
013519,000096: 13,2132           77616                           RVQ                                            
013520,000097: 

Page 322

013522,000099:                                                                                                  #  THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
013523,000100:                                                                                                  #  GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET.  THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
013524,000101:                                                                                                  #  ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB.  THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
013525,000102:                                                                                                  #  ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2.  MODE
013526,000103:                                                                                                  #  SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
013527,000104: 
013528,000105:                                                                                                  #  THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
013529,000106: 
013530,000107:                                                                                                  #        S(2) = 180 + S(1)
013531,000108:                                                                                                  #        T(2) = 180 - T(1)
013532,000109: 
013533,000110:                                                                                                  #  THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
013534,000111: 
013535,000112: 13,2133           00041        RRANGLES           STORE    32D                                   
013536,000113: 13,2134           57545                           DLOAD    DCOMP                                 #  SINCE WE WILL FIND THE MODE 1 SHAFT
013537,000114: 13,2135           00043                                    34D                                   #  ANGLE LATER, WE CAN FIND THE MODE 1
013538,000115: 13,2136           67401                           SETPD    ASIN                                  #  TRUNNION BY SIMPLY TAKING THE ARCSIN OF
013539,000116: 13,2137           00001                                    0                                     #  THE Y COMPONENT, THE ASIN GIVING AN
013540,000117: 13,2140           44206                           PUSH     BDSU                                  #  ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
013541,000118: 13,2141           24005                                    LODPHALF                              
013542,000119: 13,2142           14005                           STODL    4                                     #  MODE 2 TRUNNION TO 4.
013543,000120: 
013544,000121: 13,2143           24007                                    LO6ZEROS                              
013545,000122: 13,2144           24043                           STOVL    34D                                   #  UNIT THE PROJECTION OF THE VECTOR
013546,000123: 13,2145           00041                                    32D                                   #        IN THE X-Z PLANE
013547,000124: 13,2146           41056                           UNIT     BOVB                                  #  IF OVERFLOW, TARGET VECTOR IS ALONG Y
013548,000125: 13,2147           52421                                    LUNDESCH                              #  CALL FOR MANEUVER UNLESS ON LUNAR SURF
013549,000126: 13,2150           14041                           STODL    32D                                   #  PROJECTION VECTOR.
013550,000127: 13,2151           00041                                    32D                                   
013551,000128: 13,2152           44142                           SR1      STQ                                   
013552,000129: 13,2153           00051                                    S2                                    
013553,000130: 13,2154           14023                           STODL    SINTH                                 #  USE ARCTRIG SINCE SHAFT COULD BE ARB.
013554,000131: 13,2155           00045                                    36D                                   
013555,000132: 13,2156           77742                           SR1                                            
013556,000133: 13,2157           34021                           STCALL   COSTH                                 
013557,000134: 13,2160           47320                                    ARCTRIG                               

Page 323

013559,000136: 13,2161           43206                           PUSH     DAD                                   #  MODE 1 SHAFT TO 2.
013560,000137: 13,2162           24005                                    LODPHALF                              
013561,000138: 13,2163           24007                           STOVL    6                                     
013562,000139: 13,2164           00005                                    4                                     
013563,000140: 13,2165           77634                           RTB                                            #  FIND MODE 2 CDU ANGLES.
013564,000141: 13,2166           21635                                    2V1STO2S                              
013565,000142: 13,2167           25112                           STOVL    MODEB                                 
013566,000143: 13,2170           00001                                    0                                     
013567,000144: 13,2171           77634                           RTB                                            #  MODE 1 ANGLES TO MODE A.
013568,000145: 13,2172           21635                                    2V1STO2S                              
013569,000146: 13,2173           01110                           STORE    MODEA                                 
013570,000147: 13,2174           77776                           EXIT                                           
013571,000148: 
013572,000149: 13,2175           40110                           CS       RADMODES                              #  SWAP MODEA AND MODEB IF RR IN MODE 2.
013573,000150: 13,2176           74740                           MASK     ANTENBIT                              
013574,000151: 13,2177           10000                           CCS      A                                     
013575,000152: 13,2200           12204                           TCF      +4                                    
013576,000153: 
013577,000154: 13,2201           53110                           DXCH     MODEA                                 
013578,000155: 13,2202           53112                           DXCH     MODEB                                 
013579,000156: 13,2203           53110                           DXCH     MODEA                                 
013580,000157: 
013581,000158: 13,2204           06037                           TC       INTPRET                               
013582,000159: 13,2205           77650                           GOTO                                           
013583,000160: 13,2206           00051                                    S2                                    

Page 324

013585,000162:                                                                                                  #  GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
013586,000163:                                                                                                  #  LINE OF SIGHT IN NAV BASE AXES.  THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
013587,000164:                                                                                                  #  -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
013588,000165: 
013589,000166: 23,2000                                           SETLOC   INFLIGHT                              
013590,000167: 23,2000                                           BANK                                           
013591,000168: 
013592,000169: 23,2041                                           COUNT*   $$/GEOM                               
013593,000170: 
013594,000171: 23,2041           47135        RRNB               SLOAD    RTB                                   
013595,000172: 23,2042           03753                                    TANGNB                                
013596,000173: 23,2043           21576                                    CDULOGIC                              
013597,000174: 23,2044           41401                           SETPD    PUSH                                  #  TRUNNION ANGLE TO 0
013598,000175: 23,2045           00001                                    0                                     
013599,000176: 23,2046           57556                           SIN      DCOMP                                 
013600,000177: 23,2047           14043                           STODL    34D                                   #  Y COMPONENT
013601,000178: 
013602,000179: 23,2050           41546                           COS      PUSH                                  #  .5 COS(T) TO 0
013603,000180: 23,2051           47135                           SLOAD    RTB                                   
013604,000181: 23,2052           03754                                    TANGNB     +1                         
013605,000182: 23,2053           21576                                    CDULOGIC                              
013606,000183: 23,2054           71406        RRNB1              PUSH     COS                                   #  SHAFT ANGLE TO 2
013607,000184: 23,2055           72405                           DMP      SL1                                   
013608,000185: 23,2056           00001                                    0                                     
013609,000186: 23,2057           14045                           STODL    36D                                   #  Z COMPONENT
013610,000187: 
013611,000188: 23,2060           41356                           SIN      DMP                                   
013612,000189: 23,2061           77752                           SL1                                            
013613,000190: 23,2062           24041                           STOVL    32D                                   
013614,000191: 23,2063           00041                                    32D                                   
013615,000192: 23,2064           77616                           RVQ                                            
013616,000193: 
013617,000194:                                                                                                  #  THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
013618,000195: 
013619,000196: 23,2065           14025        RRNBMPAC           STODL    20D                                   #  SAVE SHAFT CDU IN 21.
013620,000197: 23,2066           00155                                    MPAC                                  #  SET MODE TO DP.  (THE PRECEEDING STORE
013621,000198:                                                                                                  #  MAY BE DP, TP OR VECTOR.)
013622,000199: 23,2067           40234                           RTB      SETPD                                 
013623,000200: 23,2070           21576                                    CDULOGIC                              
013624,000201: 23,2071           00001                                    0                                     
013625,000202: 23,2072           73406                           PUSH     SIN                                   #  TRUNNION ANGLE TO 0
013626,000203: 23,2073           77676                           DCOMP                                          
013627,000204: 23,2074           14043                           STODL    34D                                   #  Y COMPONENT
013628,000205: 23,2075           41546                           COS      PUSH                                  #  .5COS(T) TO 0
013629,000206: 23,2076           47135                           SLOAD    RTB                                   #  PICK UP CDU'S.
013630,000207: 23,2077           00026                                    21D                                   
013631,000208: 23,2100           21576                                    CDULOGIC                              
013632,000209: 23,2101           77650                           GOTO                                           
013633,000210: 23,2102           46054                                    RRNB1                                 

Page 325
This page has nothing on it.

013636,000213: 
013637,000214: 

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