Source Code

These source-code files are part of a reconstructed copy of Luminary 173, the second (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 178. Changes between revision 173 and 178 were backed out, as described by Luminary memo 167 (revision 1). The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 173 listing would be different.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

013920,000002:                                                                                                  ## Copyright:   Public domain.
013921,000003:                                                                                                  ## Filename:    LEM_GEOMETRY.agc
013922,000004:                                                                                                  ## Purpose:     A section of Luminary revision 173.
013923,000005:                                                                                                  ##              It is part of the reconstructed source code for the second
013924,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
013925,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
013926,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
013927,000009:                                                                                                  ##              Luminary 178, as well as Luminary memo 167 (revision 1).
013928,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
013929,000011:                                                                                                  ##              exactly match those specified for Luminary 173 in NASA
013930,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
013931,000013:                                                                                                  ##              that the reconstruction is correct.
013932,000014:                                                                                                  ## Reference:   pp. 325-330
013933,000015:                                                                                                  ## Assembler:   yaYUL
013934,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013935,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013936,000018:                                                                                                  ## Mod history: 2019-09-18 MAS  Created from Luminary 178.
013937,000019: 

Page 332

013939,000021: 23,2041                                           BANK     23                                    
013940,000022: 13,2000                                           SETLOC   LEMGEOM                               
013941,000023: 13,2000                                           BANK                                           
013942,000024: 
013943,000025: 13,2070  30,2000                                  SBANK=   LOWSUPER                              
013944,000026: 13,2070  E5,1642                                  EBANK=   XSM                                   
013945,000027: 
013946,000028:                                                                                                  #  THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013947,000029:                                                                                                  #  THE CONIC R,V AND THE DEVIATIONSR,V. THE STATE VECTORS ARE CONVERTED TO
013948,000030:                                                                                                  #  METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013949,000031:                                                                                                  #  R-OTHER , V-OTHER FOR DOWNLINK. THE ROUTINES NAMES ARE SWITCHED IN THE
013950,000032:                                                                                                  #  OTHER VEHICLES COMPUTER.
013951,000033: 
013952,000034:                                                                                                  #  INPUT
013953,000035:                                                                                                  #    STATE VECTOR IN TEMPORARY STORAGE AREA
013954,000036:                                                                                                  #    IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013955,000037:                                                                                                  #       SET X2 TO +2
013956,000038:                                                                                                  #    IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013957,000039:                                                                                                  #       SET X2 TO 0
013958,000040: 
013959,000041:                                                                                                  #  OUTPUT
013960,000042:                                                                                                  #    R(T) IN RN, V(T) IN VN, T IN PIPTIME
013961,000043:                                                                                                  #  OR
013962,000044:                                                                                                  #    R(T) IN R-OTHER, V(T) IN V-OTHER   (T IS DEFINED BY T-OTHER)
013963,000045: 
013964,000046: 13,2070                                           COUNT*   $$/GEOM                               
013965,000047: 13,2070           43414        SVDWN2             BOF      RVQ                                   #  SW=1=AVETOMID DOING W-MATRIX INTEG.
013966,000048: 13,2071           04756                                    AVEMIDSW                              
013967,000049: 13,2072           26073                                    +1                                    
013968,000050: 13,2073           53775                           VLOAD    VSL*                                  
013969,000051: 13,2074           01521                                    TDELTAV                               
013970,000052: 13,2075           57605                                    0          -7,2                       
013971,000053: 13,2076           53655                           VAD      VSL*                                  
013972,000054: 13,2077           01535                                    RCV                                   
013973,000055: 13,2100           57576                                    0,2                                   
013974,000056: 13,2101           25220                           STOVL    RN                                    
013975,000057: 13,2102           01527                                    TNUV                                  
013976,000058: 13,2103           53257                           VSL*     VAD                                   
013977,000059: 13,2104           57602                                    0          -4,2                       
013978,000060: 13,2105           01543                                    VCV                                   
013979,000061: 13,2106           77657                           VSL*                                           
013980,000062: 13,2107           57576                                    0,2                                   
013981,000063: 13,2110           15226                           STODL    VN                                    
013982,000064: 13,2111           01517                                    TET                                   
013983,000065: 13,2112           01234                           STORE    PIPTIME                               
013984,000066: 13,2113           77616                           RVQ                                            
013985,000067: 

Page 326

013987,000069: 13,2114           53775        SVDWN1             VLOAD    VSL*                                  
013988,000070: 13,2115           01521                                    TDELTAV                               
013989,000071: 13,2116           57605                                    0          -7,2                       
013990,000072: 13,2117           53655                           VAD      VSL*                                  
013991,000073: 13,2120           01535                                    RCV                                   
013992,000074: 13,2121           57576                                    0,2                                   
013993,000075: 13,2122           25716                           STOVL    R-OTHER                               
013994,000076: 13,2123           01527                                    TNUV                                  
013995,000077: 13,2124           53257                           VSL*     VAD                                   
013996,000078: 13,2125           57602                                    0          -4,2                       
013997,000079: 13,2126           01543                                    VCV                                   
013998,000080: 13,2127           77657                           VSL*                                           
013999,000081: 13,2130           57576                                    0,2                                   
014000,000082: 13,2131           01724                           STORE    V-OTHER                               
014001,000083: 13,2132           77616                           RVQ                                            
014002,000084: 

Page 327

014004,000086:                                                                                                  #           THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
014005,000087:                                                                                                  #  GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET. THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
014006,000088:                                                                                                  #  ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB. THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
014007,000089:                                                                                                  #  ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2. MODE
014008,000090:                                                                                                  #  SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
014009,000091: 
014010,000092:                                                                                                  #           THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
014011,000093: 
014012,000094:                                                                                                  #           S(2) = 180 + S(1)
014013,000095:                                                                                                  #           T(2) = 180 - T(1)
014014,000096: 
014015,000097:                                                                                                  #      THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
014016,000098: 
014017,000099: 13,2133           00041        RRANGLES           STORE    32D                                   
014018,000100: 13,2134           57545                           DLOAD    DCOMP                                 #  SINCE WE WILL FIND THE MODE 1 SHAFT
014019,000101: 13,2135           00043                                    34D                                   #  ANGLE LATER, WE CAN FIND THE MODE 1
014020,000102: 13,2136           67401                           SETPD    ASIN                                  #  TRUNNION BY SIMPLY TAKING THE ARCSIN OF
014021,000103: 13,2137           00001                                    0                                     #  THE Y COMPONENT, THE ASIN GIVING AN
014022,000104: 13,2140           44206                           PUSH     BDSU                                  #  ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
014023,000105: 13,2141           24005                                    LODPHALF                              
014024,000106: 13,2142           14005                           STODL    4                                     #  MODE 2 TRUNNION TO 4.
014025,000107: 
014026,000108: 13,2143           24007                                    LO6ZEROS                              
014027,000109: 13,2144           24043                           STOVL    34D                                   #  UNIT THE PROJECTION OF THE VECTOR
014028,000110: 13,2145           00041                                    32D                                   #    IN THE X-Z PLANE
014029,000111: 13,2146           41056                           UNIT     BOVB                                  #  IF OVERFLOW,TARGET VECTOR IS ALONG Y
014030,000112: 13,2147           52412                                    LUNDESCH                              #  CALL FOR MANEUVER UNLESS ON LUNAR SURF
014031,000113: 13,2150           14041                           STODL    32D                                   #  PROJECTION VECTOR.
014032,000114: 13,2151           00041                                    32D                                   
014033,000115: 13,2152           44142                           SR1      STQ                                   
014034,000116: 13,2153           00051                                    S2                                    
014035,000117: 13,2154           14023                           STODL    SINTH                                 #  USE ARCTRIG SINCE SHAFT COULD BE ARB.
014036,000118: 13,2155           00045                                    36D                                   
014037,000119: 13,2156           77742                           SR1                                            
014038,000120: 13,2157           34021                           STCALL   COSTH                                 
014039,000121: 13,2160           47316                                    ARCTRIG                               
014040,000122: 

Page 328

014042,000124: 13,2161           43206                           PUSH     DAD                                   #  MODE 1 SHAFT TO 2.
014043,000125: 13,2162           24005                                    LODPHALF                              
014044,000126: 13,2163           24007                           STOVL    6                                     
014045,000127: 13,2164           00005                                    4                                     
014046,000128: 13,2165           77634                           RTB                                            #  FIND MODE 2 CDU ANGLES.
014047,000129: 13,2166           21636                                    2V1STO2S                              
014048,000130: 13,2167           25111                           STOVL    MODEB                                 
014049,000131: 13,2170           00001                                    0                                     
014050,000132: 13,2171           77634                           RTB                                            #  MODE 1 ANGLES TO MODE A.
014051,000133: 13,2172           21636                                    2V1STO2S                              
014052,000134: 13,2173           01107                           STORE    MODEA                                 
014053,000135: 13,2174           77776                           EXIT                                           
014054,000136: 
014055,000137: 13,2175           40110                           CS       RADMODES                              #  SWAP MODEA AND MODEB IF RR IN MODE 2.
014056,000138: 13,2176           74740                           MASK     ANTENBIT                              
014057,000139: 13,2177           10000                           CCS      A                                     
014058,000140: 13,2200           12204                           TCF      +4                                    
014059,000141: 
014060,000142: 13,2201           53107                           DXCH     MODEA                                 
014061,000143: 13,2202           53111                           DXCH     MODEB                                 
014062,000144: 13,2203           53107                           DXCH     MODEA                                 
014063,000145: 
014064,000146: 13,2204           06042                           TC       INTPRET                               
014065,000147: 13,2205           77650                           GOTO                                           
014066,000148: 13,2206           00051                                    S2                                    
014067,000149: 

Page 329

014069,000151:                                                                                                  #  GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1,FIND THE ASSOCIATED
014070,000152:                                                                                                  #  LINE OF SIGHT IN NAV BASE AXES.  THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
014071,000153:                                                                                                  #  -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
014072,000154: 
014073,000155: 23,2000                                           SETLOC   INFLIGHT                              
014074,000156: 23,2000                                           BANK                                           
014075,000157: 
014076,000158: 23,2041                                           COUNT*   $$/GEOM                               
014077,000159: 
014078,000160: 23,2041           47135        RRNB               SLOAD    RTB                                   
014079,000161: 23,2042           03753                                    TANGNB                                
014080,000162: 23,2043           21577                                    CDULOGIC                              
014081,000163: 23,2044           41401                           SETPD    PUSH                                  #  TRUNNION ANGLE TO 0
014082,000164: 23,2045           00001                                    0                                     
014083,000165: 23,2046           57556                           SIN      DCOMP                                 
014084,000166: 23,2047           14043                           STODL    34D                                   #  Y COMPONENT
014085,000167: 
014086,000168: 23,2050           41546                           COS      PUSH                                  #  .5 COS(T) TO 0
014087,000169: 23,2051           47135                           SLOAD    RTB                                   
014088,000170: 23,2052           03754                                    TANGNB     +1                         
014089,000171: 23,2053           21577                                    CDULOGIC                              
014090,000172: 23,2054           71406        RRNB1              PUSH     COS                                   #  SHAFT ANGLE TO 2
014091,000173: 23,2055           72405                           DMP      SL1                                   
014092,000174: 23,2056           00001                                    0                                     
014093,000175: 23,2057           14045                           STODL    36D                                   #  Z COMPONENT
014094,000176: 
014095,000177: 23,2060           41356                           SIN      DMP                                   
014096,000178: 23,2061           77752                           SL1                                            
014097,000179: 23,2062           24041                           STOVL    32D                                   
014098,000180: 23,2063           00041                                    32D                                   
014099,000181: 23,2064           77616                           RVQ                                            
014100,000182: 
014101,000183:                                                                                                  #  THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
014102,000184: 
014103,000185: 23,2065           14025        RRNBMPAC           STODL    20D                                   #  SAVE SHAFT CDU IN 21.
014104,000186: 23,2066           00155                                    MPAC                                  #  SET MODE TO DP.  (THE PRECEEDING STORE
014105,000187:                                                                                                  #  MAY BE DP, TP OR VECTOR.)
014106,000188: 23,2067           40234                           RTB      SETPD                                 
014107,000189: 23,2070           21577                                    CDULOGIC                              
014108,000190: 23,2071           00001                                    0                                     
014109,000191: 23,2072           73406                           PUSH     SIN                                   #  TRUNNION ANGLE TO 0
014110,000192: 23,2073           77676                           DCOMP                                          
014111,000193: 23,2074           14043                           STODL    34D                                   #  Y COMPONENT
014112,000194: 23,2075           41546                           COS      PUSH                                  #  .5COS(T) TO 0
014113,000195: 23,2076           47135                           SLOAD    RTB                                   #  PICK UP CDU'S.
014114,000196: 23,2077           00026                                    21D                                   
014115,000197: 23,2100           21577                                    CDULOGIC                              
014116,000198: 23,2101           77650                           GOTO                                           
014117,000199: 23,2102           46054                                    RRNB1                                 

Page 330 Note: This page is empty in the printout of the assembly listing.


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