Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

014493,000002:                                                                                                  ## Copyright:   Public domain.
014494,000003:                                                                                                  ## Filename:    LEM_GEOMETRY.agc
014495,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
014496,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
014497,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
014498,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
014499,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
014500,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
014501,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
014502,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
014503,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
014504,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
014505,000014:                                                                                                  ## Reference:   pp. 334-338
014506,000015:                                                                                                  ## Assembler:   yaYUL
014507,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
014508,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
014509,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
014510,000019:                                                                                                  ##              2021-05-30 ABS  Replaced use of ANTENBIT with BIT12 to match
014511,000020:                                                                                                  ##                              Luminary 69.
014512,000021: 

Page 334

014514,000023: 23,2041                                           BANK     23                                    
014515,000024: 13,2000                                           SETLOC   LEMGEOM                               
014516,000025: 13,2000                                           BANK                                           
014517,000026: 
014518,000027: 13,2070  30,2000                                  SBANK=   LOWSUPER                              
014519,000028: 13,2070  E5,1642                                  EBANK=   XSM                                   
014520,000029: 
014521,000030:                                                                                                  #  THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
014522,000031:                                                                                                  #  THE CONIC R,V AND THE DEVIATIONSR,V. THE STATE VECTORS ARE CONVERTED TO
014523,000032:                                                                                                  #  METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
014524,000033:                                                                                                  #  R-OTHER , V-OTHER FOR DOWNLINK. THE ROUTINES NAMES ARE SWITCHED IN THE
014525,000034:                                                                                                  #  OTHER VEHICLES COMPUTER.
014526,000035: 
014527,000036:                                                                                                  #  INPUT
014528,000037:                                                                                                  #    STATE VECTOR IN TEMPORARY STORAGE AREA
014529,000038:                                                                                                  #    IF STATE VECTOR IS SCALED POS B27 AND VEL B5
014530,000039:                                                                                                  #       SET X2 TO +2
014531,000040:                                                                                                  #    IF STATE VECTOR IS SCALED POS B29 AND VEL B7
014532,000041:                                                                                                  #       SET X2 TO 0
014533,000042: 
014534,000043:                                                                                                  #  OUTPUT
014535,000044:                                                                                                  #    R(T) IN RN, V(T) IN VN, T IN PIPTIME
014536,000045:                                                                                                  #  OR
014537,000046:                                                                                                  #    R(T) IN R-OTHER, V(T) IN V-OTHER   (T IS DEFINED BY T-OTHER)
014538,000047: 
014539,000048: 13,2070                                           COUNT*   $$/GEOM                               
014540,000049: 13,2070           43414        SVDWN2             BOF      RVQ                                   #  SW=1=AVETOMID DOING W-MATRIX INTEG.
014541,000050: 13,2071           04756                                    AVEMIDSW                              
014542,000051: 13,2072           26073                                    +1                                    
014543,000052: 13,2073           53775                           VLOAD    VSL*                                  
014544,000053: 13,2074           01521                                    TDELTAV                               
014545,000054: 13,2075           57605                                    0          -7,2                       
014546,000055: 13,2076           53655                           VAD      VSL*                                  
014547,000056: 13,2077           01535                                    RCV                                   
014548,000057: 13,2100           57576                                    0,2                                   
014549,000058: 13,2101           25221                           STOVL    RN                                    
014550,000059: 13,2102           01527                                    TNUV                                  
014551,000060: 13,2103           53257                           VSL*     VAD                                   
014552,000061: 13,2104           57602                                    0          -4,2                       
014553,000062: 13,2105           01543                                    VCV                                   
014554,000063: 13,2106           77657                           VSL*                                           
014555,000064: 13,2107           57576                                    0,2                                   
014556,000065: 13,2110           15227                           STODL    VN                                    
014557,000066: 13,2111           01517                                    TET                                   
014558,000067: 13,2112           01235                           STORE    PIPTIME                               
014559,000068: 13,2113           77616                           RVQ                                            

Page 335

014561,000070: 13,2114           53775        SVDWN1             VLOAD    VSL*                                  
014562,000071: 13,2115           01521                                    TDELTAV                               
014563,000072: 13,2116           57605                                    0          -7,2                       
014564,000073: 13,2117           53655                           VAD      VSL*                                  
014565,000074: 13,2120           01535                                    RCV                                   
014566,000075: 13,2121           57576                                    0,2                                   
014567,000076: 13,2122           25720                           STOVL    R-OTHER                               
014568,000077: 13,2123           01527                                    TNUV                                  
014569,000078: 13,2124           53257                           VSL*     VAD                                   
014570,000079: 13,2125           57602                                    0          -4,2                       
014571,000080: 13,2126           01543                                    VCV                                   
014572,000081: 13,2127           77657                           VSL*                                           
014573,000082: 13,2130           57576                                    0,2                                   
014574,000083: 13,2131           01726                           STORE    V-OTHER                               
014575,000084: 13,2132           77616                           RVQ                                            
014576,000085: 

Page 336

014578,000087:                                                                                                  #           THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
014579,000088:                                                                                                  #  GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET. THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
014580,000089:                                                                                                  #  ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB. THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
014581,000090:                                                                                                  #  ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2. MODE
014582,000091:                                                                                                  #  SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
014583,000092: 
014584,000093:                                                                                                  #           THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
014585,000094: 
014586,000095:                                                                                                  #           S(2) = 180 + S(1)
014587,000096:                                                                                                  #           T(2) = 180 - T(1)
014588,000097: 
014589,000098:                                                                                                  #      THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
014590,000099: 
014591,000100: 13,2133           00041        RRANGLES           STORE    32D                                   
014592,000101: 13,2134           57545                           DLOAD    DCOMP                                 #  SINCE WE WILL FIND THE MODE 1 SHAFT
014593,000102: 13,2135           00043                                    34D                                   #  ANGLE LATER, WE CAN FIND THE MODE 1
014594,000103: 13,2136           67401                           SETPD    ASIN                                  #  TRUNNION BY SIMPLY TAKING THE ARCSIN OF
014595,000104: 13,2137           00001                                    0                                     #  THE Y COMPONENT, THE ASIN GIVING AN
014596,000105: 13,2140           44206                           PUSH     BDSU                                  #  ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
014597,000106: 13,2141           22273                                    LODPHALF                              
014598,000107: 13,2142           14005                           STODL    4                                     #  MODE 2 TRUNNION TO 4.
014599,000108: 
014600,000109: 13,2143           22275                                    LO6ZEROS                              
014601,000110: 13,2144           24043                           STOVL    34D                                   #  UNIT THE PROJECTION OF THE VECTOR
014602,000111: 13,2145           00041                                    32D                                   #    IN THE X-Z PLANE
014603,000112: 13,2146           41056                           UNIT     BOVB                                  #  IF OVERFLOW, TARGET VECTOR IS ALONG Y
014604,000113: 13,2147           52421                                    LUNDESCH                              #  CALL FOR MANEUVER UNLESS ON LUNAR SURF
014605,000114: 13,2150           14041                           STODL    32D                                   #  PROJECTION VECTOR.
014606,000115: 13,2151           00041                                    32D                                   
014607,000116: 13,2152           44142                           SR1      STQ                                   
014608,000117: 13,2153           00051                                    S2                                    
014609,000118: 13,2154           14023                           STODL    SINTH                                 #  USE ARCTRIG SINCE SHAFT COULD BE ARB.
014610,000119: 13,2155           00045                                    36D                                   
014611,000120: 13,2156           77742                           SR1                                            
014612,000121: 13,2157           34021                           STCALL   COSTH                                 
014613,000122: 13,2160           47222                                    ARCTRIG                               

Page 337

014615,000124: 13,2161           43206                           PUSH     DAD                                   #  MODE 1 SHAFT TO 2.
014616,000125: 13,2162           22273                                    LODPHALF                              
014617,000126: 13,2163           24007                           STOVL    6                                     
014618,000127: 13,2164           00005                                    4                                     
014619,000128: 13,2165           77634                           RTB                                            #  FIND MODE 2 CDU ANGLES.
014620,000129: 13,2166           21541                                    2V1STO2S                              
014621,000130: 13,2167           25112                           STOVL    MODEB                                 
014622,000131: 13,2170           00001                                    0                                     
014623,000132: 13,2171           77634                           RTB                                            #  MODE 1 ANGLES TO MODE A.
014624,000133: 13,2172           21541                                    2V1STO2S                              
014625,000134: 13,2173           01110                           STORE    MODEA                                 
014626,000135: 13,2174           77776                           EXIT                                           
014627,000136: 
014628,000137: 13,2175           40110                           CS       RADMODES                              #  SWAP MODEA AND MODEB IF RR IN MODE 2.
014629,000138: 13,2176           74740                           MASK     BIT12                                 
014630,000139: 13,2177           10000                           CCS      A                                     
014631,000140: 13,2200           12204                           TCF      +4                                    
014632,000141: 
014633,000142: 13,2201           53110                           DXCH     MODEA                                 
014634,000143: 13,2202           53112                           DXCH     MODEB                                 
014635,000144: 13,2203           53110                           DXCH     MODEA                                 
014636,000145: 
014637,000146: 13,2204           06036                           TC       INTPRET                               
014638,000147: 13,2205           77650                           GOTO                                           
014639,000148: 13,2206           00051                                    S2                                    

Page 338

014641,000150:                                                                                                  #  GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
014642,000151:                                                                                                  #  LINE OF SIGHT IN NAV BASE AXES.  THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
014643,000152:                                                                                                  #  -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
014644,000153: 
014645,000154: 23,2000                                           SETLOC   INFLIGHT                              
014646,000155: 23,2000                                           BANK                                           
014647,000156: 
014648,000157: 23,2041                                           COUNT*   $$/GEOM                               
014649,000158: 
014650,000159: 23,2041           47135        RRNB               SLOAD    RTB                                   
014651,000160: 23,2042           03751                                    TANGNB                                
014652,000161: 23,2043           21465                                    CDULOGIC                              
014653,000162: 23,2044           41401                           SETPD    PUSH                                  #  TRUNNION ANGLE TO 0
014654,000163: 23,2045           00001                                    0                                     
014655,000164: 23,2046           57556                           SIN      DCOMP                                 
014656,000165: 23,2047           14043                           STODL    34D                                   #  Y COMPONENT
014657,000166: 
014658,000167: 23,2050           41546                           COS      PUSH                                  #  .5 COS(T) TO 0
014659,000168: 23,2051           47135                           SLOAD    RTB                                   
014660,000169: 23,2052           03752                                    TANGNB     +1                         
014661,000170: 23,2053           21465                                    CDULOGIC                              
014662,000171: 23,2054           71406                           PUSH     COS                                   #  SHAFT ANGLE TO 2
014663,000172: 23,2055           72405                           DMP      SL1                                   
014664,000173: 23,2056           00001                                    0                                     
014665,000174: 23,2057           14045                           STODL    36D                                   #  Z COMPONENT
014666,000175: 
014667,000176: 23,2060           41356                           SIN      DMP                                   
014668,000177: 23,2061           77752                           SL1                                            
014669,000178: 23,2062           24041                           STOVL    32D                                   
014670,000179: 23,2063           00041                                    32D                                   
014671,000180: 23,2064           77616                           RVQ                                            

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