Source Code

These source-code files are part of a reconstructed copy of Luminary 96, the original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

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.

013112,000002:                                                                                                  ## Copyright:   Public domain.
013113,000003:                                                                                                  ## Filename:    LEM_GEOMETRY.agc
013114,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
013115,000005:                                                                                                  ##              It is part of the reconstructed source code for the
013116,000006:                                                                                                  ##              original release of the flight software for the Lunar 
013117,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
013118,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
013119,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
013120,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
013121,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
013122,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
013123,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
013124,000014:                                                                                                  ## Reference:   pp. 320-325
013125,000015:                                                                                                  ## Assembler:   yaYUL
013126,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013127,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013128,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
013129,000019: 

Page 320

013131,000021: 23,2041                                           BANK     23                                    
013132,000022: 13,2000                                           SETLOC   LEMGEOM                               
013133,000023: 13,2000                                           BANK                                           
013134,000024: 
013135,000025: 13,2070  30,2000                                  SBANK=   LOWSUPER                              
013136,000026: 13,2070  E5,1642                                  EBANK=   XSM                                   
013137,000027: 
013138,000028:                                                                                                  #  THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013139,000029:                                                                                                  #  THE CONIC R,V AND THE DEVIATIONS R,V.  THE STATE VECTORS ARE CONVERTED TO
013140,000030:                                                                                                  #  METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013141,000031:                                                                                                  #  R-OTHER,V-OTHER FOR DOWNLINK.  THE ROUTINES NAMES ARE SWITCHED IN THE
013142,000032:                                                                                                  #  OTHER VEHICLES COMPUTER.
013143,000033: 
013144,000034:                                                                                                  #  INPUT
013145,000035:                                                                                                  #        STATE VECTOR IN TEMPORARY STORAGE AREA
013146,000036:                                                                                                  #        IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013147,000037:                                                                                                  #                SET X2 TO +2
013148,000038:                                                                                                  #        IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013149,000039:                                                                                                  #                SET X2 TO 0
013150,000040: 
013151,000041:                                                                                                  #  OUTPUT
013152,000042:                                                                                                  #        R(T) IN RN, V(T) IN VN, T IN PIPTIME
013153,000043:                                                                                                  #  OR
013154,000044:                                                                                                  #        R(T) IN R-OTHER, V(T) IN V-OTHER        (T IS DEFINED BY T-OTHER)
013155,000045: 
013156,000046: 13,2070                                           COUNT*   $$/GEOM                               
013157,000047: 13,2070           43414        SVDWN2             BOF      RVQ                                   #  SW=1=AVETOMID DOING W-MATRIX INTEG.
013158,000048: 13,2071           04756                                    AVEMIDSW                              
013159,000049: 13,2072           26073                                    +1                                    
013160,000050: 13,2073           53775                           VLOAD    VSL*                                  
013161,000051: 13,2074           01521                                    TDELTAV                               
013162,000052: 13,2075           57605                                    0          -7,2                       
013163,000053: 13,2076           53655                           VAD      VSL*                                  
013164,000054: 13,2077           01535                                    RCV                                   
013165,000055: 13,2100           57576                                    0,2                                   
013166,000056: 13,2101           25221                           STOVL    RN                                    
013167,000057: 13,2102           01527                                    TNUV                                  
013168,000058: 13,2103           53257                           VSL*     VAD                                   
013169,000059: 13,2104           57602                                    0          -4,2                       
013170,000060: 13,2105           01543                                    VCV                                   
013171,000061: 13,2106           77657                           VSL*                                           
013172,000062: 13,2107           57576                                    0,2                                   
013173,000063: 13,2110           15227                           STODL    VN                                    
013174,000064: 13,2111           01517                                    TET                                   
013175,000065: 13,2112           01235                           STORE    PIPTIME                               
013176,000066: 13,2113           77616                           RVQ                                            

Page 321

013178,000068: 13,2114           53775        SVDWN1             VLOAD    VSL*                                  
013179,000069: 13,2115           01521                                    TDELTAV                               
013180,000070: 13,2116           57605                                    0          -7,2                       
013181,000071: 13,2117           53655                           VAD      VSL*                                  
013182,000072: 13,2120           01535                                    RCV                                   
013183,000073: 13,2121           57576                                    0,2                                   
013184,000074: 13,2122           25720                           STOVL    R-OTHER                               
013185,000075: 13,2123           01527                                    TNUV                                  
013186,000076: 13,2124           53257                           VSL*     VAD                                   
013187,000077: 13,2125           57602                                    0          -4,2                       
013188,000078: 13,2126           01543                                    VCV                                   
013189,000079: 13,2127           77657                           VSL*                                           
013190,000080: 13,2130           57576                                    0,2                                   
013191,000081: 13,2131           01726                           STORE    V-OTHER                               
013192,000082: 13,2132           77616                           RVQ                                            
013193,000083: 

Page 322

013195,000085:                                                                                                  #  THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
013196,000086:                                                                                                  #  GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET.  THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
013197,000087:                                                                                                  #  ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB.  THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
013198,000088:                                                                                                  #  ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2.  MODE
013199,000089:                                                                                                  #  SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
013200,000090: 
013201,000091:                                                                                                  #  THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
013202,000092: 
013203,000093:                                                                                                  #        S(2) = 180 + S(1)
013204,000094:                                                                                                  #        T(2) = 180 - T(1)
013205,000095: 
013206,000096:                                                                                                  #  THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
013207,000097: 
013208,000098: 13,2133           00041        RRANGLES           STORE    32D                                   
013209,000099: 13,2134           57545                           DLOAD    DCOMP                                 #  SINCE WE WILL FIND THE MODE 1 SHAFT
013210,000100: 13,2135           00043                                    34D                                   #  ANGLE LATER, WE CAN FIND THE MODE 1
013211,000101: 13,2136           67401                           SETPD    ASIN                                  #  TRUNNION BY SIMPLY TAKING THE ARCSIN OF
013212,000102: 13,2137           00001                                    0                                     #  THE Y COMPONENT, THE ASIN GIVING AN
013213,000103: 13,2140           44206                           PUSH     BDSU                                  #  ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
013214,000104: 13,2141           24005                                    LODPHALF                              
013215,000105: 13,2142           14005                           STODL    4                                     #  MODE 2 TRUNNION TO 4.
013216,000106: 
013217,000107: 13,2143           24007                                    LO6ZEROS                              
013218,000108: 13,2144           24043                           STOVL    34D                                   #  UNIT THE PROJECTION OF THE VECTOR
013219,000109: 13,2145           00041                                    32D                                   #        IN THE X-Z PLANE
013220,000110: 13,2146           41056                           UNIT     BOVB                                  #  IF OVERFLOW, TARGET VECTOR IS ALONG Y
013221,000111: 13,2147           52421                                    LUNDESCH                              #  CALL FOR MANEUVER UNLESS ON LUNAR SURF
013222,000112: 13,2150           14041                           STODL    32D                                   #  PROJECTION VECTOR.
013223,000113: 13,2151           00041                                    32D                                   
013224,000114: 13,2152           44142                           SR1      STQ                                   
013225,000115: 13,2153           00051                                    S2                                    
013226,000116: 13,2154           14023                           STODL    SINTH                                 #  USE ARCTRIG SINCE SHAFT COULD BE ARB.
013227,000117: 13,2155           00045                                    36D                                   
013228,000118: 13,2156           77742                           SR1                                            
013229,000119: 13,2157           34021                           STCALL   COSTH                                 
013230,000120: 13,2160           47320                                    ARCTRIG                               

Page 323

013232,000122: 13,2161           43206                           PUSH     DAD                                   #  MODE 1 SHAFT TO 2.
013233,000123: 13,2162           24005                                    LODPHALF                              
013234,000124: 13,2163           24007                           STOVL    6                                     
013235,000125: 13,2164           00005                                    4                                     
013236,000126: 13,2165           77634                           RTB                                            #  FIND MODE 2 CDU ANGLES.
013237,000127: 13,2166           21635                                    2V1STO2S                              
013238,000128: 13,2167           25112                           STOVL    MODEB                                 
013239,000129: 13,2170           00001                                    0                                     
013240,000130: 13,2171           77634                           RTB                                            #  MODE 1 ANGLES TO MODE A.
013241,000131: 13,2172           21635                                    2V1STO2S                              
013242,000132: 13,2173           01110                           STORE    MODEA                                 
013243,000133: 13,2174           77776                           EXIT                                           
013244,000134: 
013245,000135: 13,2175           40110                           CS       RADMODES                              #  SWAP MODEA AND MODEB IF RR IN MODE 2.
013246,000136: 13,2176           74740                           MASK     ANTENBIT                              
013247,000137: 13,2177           10000                           CCS      A                                     
013248,000138: 13,2200           12204                           TCF      +4                                    
013249,000139: 
013250,000140: 13,2201           53110                           DXCH     MODEA                                 
013251,000141: 13,2202           53112                           DXCH     MODEB                                 
013252,000142: 13,2203           53110                           DXCH     MODEA                                 
013253,000143: 
013254,000144: 13,2204           06037                           TC       INTPRET                               
013255,000145: 13,2205           77650                           GOTO                                           
013256,000146: 13,2206           00051                                    S2                                    

Page 324

013258,000148:                                                                                                  #  GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
013259,000149:                                                                                                  #  LINE OF SIGHT IN NAV BASE AXES.  THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
013260,000150:                                                                                                  #  -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
013261,000151: 
013262,000152: 23,2000                                           SETLOC   INFLIGHT                              
013263,000153: 23,2000                                           BANK                                           
013264,000154: 
013265,000155: 23,2041                                           COUNT*   $$/GEOM                               
013266,000156: 
013267,000157: 23,2041           47135        RRNB               SLOAD    RTB                                   
013268,000158: 23,2042           03753                                    TANGNB                                
013269,000159: 23,2043           21576                                    CDULOGIC                              
013270,000160: 23,2044           41401                           SETPD    PUSH                                  #  TRUNNION ANGLE TO 0
013271,000161: 23,2045           00001                                    0                                     
013272,000162: 23,2046           57556                           SIN      DCOMP                                 
013273,000163: 23,2047           14043                           STODL    34D                                   #  Y COMPONENT
013274,000164: 
013275,000165: 23,2050           41546                           COS      PUSH                                  #  .5 COS(T) TO 0
013276,000166: 23,2051           47135                           SLOAD    RTB                                   
013277,000167: 23,2052           03754                                    TANGNB     +1                         
013278,000168: 23,2053           21576                                    CDULOGIC                              
013279,000169: 23,2054           71406        RRNB1              PUSH     COS                                   #  SHAFT ANGLE TO 2
013280,000170: 23,2055           72405                           DMP      SL1                                   
013281,000171: 23,2056           00001                                    0                                     
013282,000172: 23,2057           14045                           STODL    36D                                   #  Z COMPONENT
013283,000173: 
013284,000174: 23,2060           41356                           SIN      DMP                                   
013285,000175: 23,2061           77752                           SL1                                            
013286,000176: 23,2062           24041                           STOVL    32D                                   
013287,000177: 23,2063           00041                                    32D                                   
013288,000178: 23,2064           77616                           RVQ                                            
013289,000179: 
013290,000180:                                                                                                  #  THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
013291,000181: 
013292,000182: 23,2065           14025        RRNBMPAC           STODL    20D                                   #  SAVE SHAFT CDU IN 21.
013293,000183: 23,2066           00155                                    MPAC                                  #  SET MODE TO DP.  (THE PRECEEDING STORE
013294,000184:                                                                                                  #  MAY BE DP, TP OR VECTOR.)
013295,000185: 23,2067           40234                           RTB      SETPD                                 
013296,000186: 23,2070           21576                                    CDULOGIC                              
013297,000187: 23,2071           00001                                    0                                     
013298,000188: 23,2072           73406                           PUSH     SIN                                   #  TRUNNION ANGLE TO 0
013299,000189: 23,2073           77676                           DCOMP                                          
013300,000190: 23,2074           14043                           STODL    34D                                   #  Y COMPONENT
013301,000191: 23,2075           41546                           COS      PUSH                                  #  .5COS(T) TO 0
013302,000192: 23,2076           47135                           SLOAD    RTB                                   #  PICK UP CDU'S.
013303,000193: 23,2077           00026                                    21D                                   
013304,000194: 23,2100           21576                                    CDULOGIC                              
013305,000195: 23,2101           77650                           GOTO                                           
013306,000196: 23,2102           46054                                    RRNB1                                 

Page 325
This page has nothing on it.

013309,000199: 
013310,000200: 

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