Source Code

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

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

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

Page 320

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

Page 321

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

Page 322

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

Page 323

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

Page 324

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

Page 325
This page has nothing on it.

013629,000213: 
013630,000214: 

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