Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

013484,000002:                                                                                                  ## Copyright:   Public domain.
013485,000003:                                                                                                  ## Filename:    LEM_GEOMETRY.agc
013486,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
013487,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
013488,000006:                                                                                                  ##              although several more revisions would follow. It has been
013489,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
013490,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
013491,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
013492,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
013493,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
013494,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
013495,000013:                                                                                                  ##              rather than the original YUL assembler.
013496,000014:                                                                                                  ## Reference:   pp. 322-327
013497,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013498,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013499,000017:                                                                                                  ## Mod history: 05/10/03 RSB.   Began transcribing.
013500,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
013501,000019:                                                                                                  ##              2010-08-24 JL   Fixed page 330 number.
013502,000020:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
013503,000021:                                                                                                  ##                              original harcopy, as opposed to the PDF page
013504,000022:                                                                                                  ##                              numbers in 1701.pdf.
013505,000023:                                                                                                  ##              2017-02-23 RSB  Proofed comment text using octopus/ProoferComments.
013506,000024:                                                                                                  ##              2017-03-07 RSB  Fixed comment-text error noted while proofing
013507,000025:                                                                                                  ##                              Luminary 116.
013508,000026:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
013509,000027: 

Page 322

013511,000029: 23,2041                                           BANK     23                                    
013512,000030: 13,2000                                           SETLOC   LEMGEOM                               
013513,000031: 13,2000                                           BANK                                           
013514,000032: 
013515,000033: 13,2070  30,2000                                  SBANK=   LOWSUPER                              
013516,000034: 13,2070  E5,1642                                  EBANK=   XSM                                   
013517,000035: 
013518,000036:                                                                                                  #  THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013519,000037:                                                                                                  #  THE CONIC R,V AND THE DEVIATIONS R,V.  THE STATE VECTORS ARE CONVERTED TO
013520,000038:                                                                                                  #  METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013521,000039:                                                                                                  #  R-OTHER,V-OTHER FOR DOWNLINK.  THE ROUTINES NAMES ARE SWITCHED IN THE
013522,000040:                                                                                                  #  OTHER VEHICLES COMPUTER.
013523,000041: 
013524,000042:                                                                                                  #  INPUT
013525,000043:                                                                                                  #        STATE VECTOR IN TEMPORARY STORAGE AREA
013526,000044:                                                                                                  #        IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013527,000045:                                                                                                  #                SET X2 TO +2
013528,000046:                                                                                                  #        IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013529,000047:                                                                                                  #                SET X2 TO 0
013530,000048: 
013531,000049:                                                                                                  #  OUTPUT
013532,000050:                                                                                                  #        R(T) IN RN, V(T) IN VN, T IN PIPTIME
013533,000051:                                                                                                  #  OR
013534,000052:                                                                                                  #        R(T) IN R-OTHER, V(T) IN V-OTHER        (T IS DEFINED BY T-OTHER)
013535,000053: 
013536,000054: 13,2070                                           COUNT*   $$/GEOM                               
013537,000055: 13,2070           43414        SVDWN2             BOF      RVQ                                   #  SW=1=AVETOMID DOING W-MATRIX INTEG.
013538,000056: 13,2071           04756                                    AVEMIDSW                              
013539,000057: 13,2072           26073                                    +1                                    
013540,000058: 13,2073           53775                           VLOAD    VSL*                                  
013541,000059: 13,2074           01521                                    TDELTAV                               
013542,000060: 13,2075           57605                                    0          -7,2                       
013543,000061: 13,2076           53655                           VAD      VSL*                                  
013544,000062: 13,2077           01535                                    RCV                                   
013545,000063: 13,2100           57576                                    0,2                                   
013546,000064: 13,2101           25220                           STOVL    RN                                    
013547,000065: 13,2102           01527                                    TNUV                                  
013548,000066: 13,2103           53257                           VSL*     VAD                                   
013549,000067: 13,2104           57602                                    0          -4,2                       
013550,000068: 13,2105           01543                                    VCV                                   
013551,000069: 13,2106           77657                           VSL*                                           
013552,000070: 13,2107           57576                                    0,2                                   
013553,000071: 13,2110           15226                           STODL    VN                                    
013554,000072: 13,2111           01517                                    TET                                   
013555,000073: 13,2112           01234                           STORE    PIPTIME                               
013556,000074: 13,2113           77616                           RVQ                                            

Page 323

013558,000076: 13,2114           53775        SVDWN1             VLOAD    VSL*                                  
013559,000077: 13,2115           01521                                    TDELTAV                               
013560,000078: 13,2116           57605                                    0          -7,2                       
013561,000079: 13,2117           53655                           VAD      VSL*                                  
013562,000080: 13,2120           01535                                    RCV                                   
013563,000081: 13,2121           57576                                    0,2                                   
013564,000082: 13,2122           25720                           STOVL    R-OTHER                               
013565,000083: 13,2123           01527                                    TNUV                                  
013566,000084: 13,2124           53257                           VSL*     VAD                                   
013567,000085: 13,2125           57602                                    0          -4,2                       
013568,000086: 13,2126           01543                                    VCV                                   
013569,000087: 13,2127           77657                           VSL*                                           
013570,000088: 13,2130           57576                                    0,2                                   
013571,000089: 13,2131           01726                           STORE    V-OTHER                               
013572,000090: 13,2132           77616                           RVQ                                            
013573,000091: 

Page 324

013575,000093:                                                                                                  #  THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
013576,000094:                                                                                                  #  GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET.  THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
013577,000095:                                                                                                  #  ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB.  THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
013578,000096:                                                                                                  #  ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2.  MODE
013579,000097:                                                                                                  #  SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
013580,000098: 
013581,000099:                                                                                                  #  THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
013582,000100: 
013583,000101:                                                                                                  #        S(2) = 180 + S(1)
013584,000102:                                                                                                  #        T(2) = 180 - T(1)
013585,000103: 
013586,000104:                                                                                                  #  THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
013587,000105: 
013588,000106: 13,2133           00041        RRANGLES           STORE    32D                                   
013589,000107: 13,2134           57545                           DLOAD    DCOMP                                 #  SINCE WE WILL FIND THE MODE 1 SHAFT
013590,000108: 13,2135           00043                                    34D                                   #  ANGLE LATER, WE CAN FIND THE MODE 1
013591,000109: 13,2136           67401                           SETPD    ASIN                                  #  TRUNNION BY SIMPLY TAKING THE ARCSIN OF
013592,000110: 13,2137           00001                                    0                                     #  THE Y COMPONENT, THE ASIN GIVING AN
013593,000111: 13,2140           44206                           PUSH     BDSU                                  #  ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
013594,000112: 13,2141           24005                                    LODPHALF                              
013595,000113: 13,2142           14005                           STODL    4                                     #  MODE 2 TRUNNION TO 4.
013596,000114: 13,2143           24007                                    LO6ZEROS                              
013597,000115: 13,2144           24043                           STOVL    34D                                   #  UNIT THE PROJECTION OF THE VECTOR
013598,000116: 13,2145           00041                                    32D                                   #        IN THE X-Z PLANE
013599,000117: 13,2146           41056                           UNIT     BOVB                                  #  IF OVERFLOW, TARGET VECTOR IS ALONG Y
013600,000118: 13,2147           52432                                    LUNDESCH                              #  CALL FOR MANEUVER UNLESS ON LUNAR SURF
013601,000119: 13,2150           14041                           STODL    32D                                   #  PROJECTION VECTOR.
013602,000120: 13,2151           00041                                    32D                                   
013603,000121: 13,2152           44142                           SR1      STQ                                   
013604,000122: 13,2153           00051                                    S2                                    
013605,000123: 13,2154           14023                           STODL    SINTH                                 #  USE ARCTRIG SINCE SHAFT COULD BE ARB.
013606,000124: 13,2155           00045                                    36D                                   
013607,000125: 13,2156           77742                           SR1                                            
013608,000126: 13,2157           34021                           STCALL   COSTH                                 
013609,000127: 13,2160           47322                                    ARCTRIG                               

Page 325

013611,000129: 13,2161           43206                           PUSH     DAD                                   #  MODE 1 SHAFT TO 2.
013612,000130: 13,2162           24005                                    LODPHALF                              
013613,000131: 13,2163           24007                           STOVL    6                                     
013614,000132: 13,2164           00005                                    4                                     
013615,000133: 13,2165           77634                           RTB                                            #  FIND MODE 2 CDU ANGLES.
013616,000134: 13,2166           21636                                    2V1STO2S                              
013617,000135: 13,2167           25111                           STOVL    MODEB                                 
013618,000136: 13,2170           00001                                    0                                     
013619,000137: 13,2171           77634                           RTB                                            #  MODE 1 ANGLES TO MODE A.
013620,000138: 13,2172           21636                                    2V1STO2S                              
013621,000139: 13,2173           01107                           STORE    MODEA                                 
013622,000140: 13,2174           77776                           EXIT                                           
013623,000141: 
013624,000142: 13,2175           40110                           CS       RADMODES                              #  SWAP MODEA AND MODEB IF RR IN MODE 2.
013625,000143: 13,2176           74740                           MASK     ANTENBIT                              
013626,000144: 13,2177           10000                           CCS      A                                     
013627,000145: 13,2200           12204                           TCF      +4                                    
013628,000146: 
013629,000147: 13,2201           53107                           DXCH     MODEA                                 
013630,000148: 13,2202           53111                           DXCH     MODEB                                 
013631,000149: 13,2203           53107                           DXCH     MODEA                                 
013632,000150: 
013633,000151: 13,2204           06042                           TC       INTPRET                               
013634,000152: 13,2205           77650                           GOTO                                           
013635,000153: 13,2206           00051                                    S2                                    

Page 326

013637,000155:                                                                                                  #  GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
013638,000156:                                                                                                  #  LINE OF SIGHT IN NAV BASE AXES.  THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
013639,000157:                                                                                                  #  -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
013640,000158: 
013641,000159: 23,2000                                           SETLOC   INFLIGHT                              
013642,000160: 23,2000                                           BANK                                           
013643,000161: 
013644,000162: 23,2041                                           COUNT*   $$/GEOM                               
013645,000163: 
013646,000164: 23,2041           47135        RRNB               SLOAD    RTB                                   
013647,000165: 23,2042           03753                                    TANGNB                                
013648,000166: 23,2043           21577                                    CDULOGIC                              
013649,000167: 23,2044           41401                           SETPD    PUSH                                  #  TRUNNION ANGLE TO 0
013650,000168: 23,2045           00001                                    0                                     
013651,000169: 23,2046           57556                           SIN      DCOMP                                 
013652,000170: 23,2047           14043                           STODL    34D                                   #  Y COMPONENT
013653,000171: 
013654,000172: 23,2050           41546                           COS      PUSH                                  #  .5 COS(T) TO 0
013655,000173: 23,2051           47135                           SLOAD    RTB                                   
013656,000174: 23,2052           03754                                    TANGNB     +1                         
013657,000175: 23,2053           21577                                    CDULOGIC                              
013658,000176: 23,2054           71406        RRNB1              PUSH     COS                                   #  SHAFT ANGLE TO 2
013659,000177: 23,2055           72405                           DMP      SL1                                   
013660,000178: 23,2056           00001                                    0                                     
013661,000179: 23,2057           14045                           STODL    36D                                   #  Z COMPONENT
013662,000180: 
013663,000181: 23,2060           41356                           SIN      DMP                                   
013664,000182: 23,2061           77752                           SL1                                            
013665,000183: 23,2062           24041                           STOVL    32D                                   
013666,000184: 23,2063           00041                                    32D                                   
013667,000185: 23,2064           77616                           RVQ                                            
013668,000186: 
013669,000187:                                                                                                  #  THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
013670,000188: 
013671,000189: 23,2065           14025        RRNBMPAC           STODL    20D                                   #  SAVE SHAFT CDU IN 21.
013672,000190: 23,2066           00155                                    MPAC                                  #  SET MODE TO DP.  (THE PRECEEDING STORE
013673,000191:                                                                                                  #  MAY BE DP, TP OR VECTOR.)
013674,000192: 23,2067           40234                           RTB      SETPD                                 
013675,000193: 23,2070           21577                                    CDULOGIC                              
013676,000194: 23,2071           00001                                    0                                     
013677,000195: 23,2072           73406                           PUSH     SIN                                   #  TRUNNION ANGLE TO 0
013678,000196: 23,2073           77676                           DCOMP                                          
013679,000197: 23,2074           14043                           STODL    34D                                   #  Y COMPONENT
013680,000198: 23,2075           41546                           COS      PUSH                                  #  .5COS(T) TO 0
013681,000199: 23,2076           47135                           SLOAD    RTB                                   #  PICK UP CDU'S.
013682,000200: 23,2077           00026                                    21D                                   
013683,000201: 23,2100           21577                                    CDULOGIC                              
013684,000202: 23,2101           77650                           GOTO                                           
013685,000203: 23,2102           46054                                    RRNB1                                 

Page 327
This page has nothing on it.

013688,000206: 
013689,000207: 

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