Source Code

These source-code files are part of a reconstructed copy of Comanche 67, the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 12.

They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141.

Since only binary dumps (rather than listings) of Comanche 67 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

033547,000002:                                                                                                  ## Copyright:   Public domain.
033548,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
033549,000004:                                                                                                  ## Purpose:     A section of Comanche revision 067.
033550,000005:                                                                                                  ##              It is part of the reconstructed source code for the flight
033551,000006:                                                                                                  ##              software for the Command Module's (CM) Apollo Guidance Computer
033552,000007:                                                                                                  ##              (AGC) for Apollo 12. No original listings of this program are
033553,000008:                                                                                                  ##              available; instead, this file was created via dissassembly of
033554,000009:                                                                                                  ##              dumps of Comanche 067 core rope modules and comparison with
033555,000010:                                                                                                  ##              other AGC programs.
033556,000011:                                                                                                  ## Assembler:   yaYUL
033557,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033558,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033559,000014:                                                                                                  ## Mod history: 2023-08-16 MAS  Created from Comanche 055.
033560,000015: 
033561,000016:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
033562,000017: 
033563,000018:                                                                                                  #  FUNCTIONAL DESCRIPTION
033564,000019: 
033565,000020:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
033566,000021:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
033567,000022:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
033568,000023: 
033569,000024:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
033570,000025:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
033571,000026:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
033572,000027:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
033573,000028: 
033574,000029:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
033575,000030: 
033576,000031:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
033577,000032: 
033578,000033:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
033579,000034: 
033580,000035:                                                                                                  #        SOLPOS COMPUTES THE POSITION VECTOR OF THE SUN.
033581,000036: 
033582,000037:                                                                                                  #  CALLING SEQUENCE
033583,000038: 
033584,000039:                                                                                                  #        DLOAD   CALL
033585,000040:                                                                                                  #                TIME            GROUND ELAPSED TIME
033586,000041:                                                                                                  #                SUBROUTINE      LSPOS OR LUNPOS OR LUNVEL OR SOLPOS
033587,000042: 
033588,000043:                                                                                                  #  INPUT
033589,000044: 
033590,000045:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
033591,000046: 
033592,000047:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
033593,000048:                                                                                                  #        POSITION POLYNOMIAL IS VALID IN CS X B-42.
033594,000049: 
033595,000050:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
033596,000051:                                                                                                  #        LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
033597,000052: 
033598,000053:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
033599,000054:                                                                                                  #        TIMEMO IN METERS X B-38.
033600,000055: 
033601,000056:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
033602,000057:                                                                                                  #        TIMEMO IN METERS/CS X B-9.
033603,000058:                                                                                                  #  
033604,000059:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
033605,000060:                                                                                                  #        REV/CS X B+26.
033606,000061: 
033607,000062:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
033608,000063:                                                                                                  #        ERASABLE DATA LOAD.
033609,000064: 
033610,000065:                                                                                                  #  OUTPUT - LSPOS
033611,000066: 
033612,000067:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE
033613,000068:                                                                                                  #        TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
033614,000069: 
033615,000070:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
033616,000071:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
033617,000072: 
033618,000073:                                                                                                  #  OUTPUT - LUNPOS
033619,000074: 
033620,000075:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
033621,000076:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
033622,000077: 
033623,000078:                                                                                                  #  OUTPUT - LUNVEL
033624,000079: 
033625,000080:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
033626,000081:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
033627,000082: 
033628,000083:                                                                                                  #  OUTPUT - SOLPOS
033629,000084: 
033630,000085:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH
033631,000086:                                                                                                  #        AT TIME INPUT BY THE USER IN METERS X B-38.
033632,000087: 
033633,000088:                                                                                                  #  SUBROUTINES USED
033634,000089: 
033635,000090:                                                                                                  #        NONE
033636,000091: 
033637,000092:                                                                                                  #  REMARKS
033638,000093: 
033639,000094:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
033640,000095:                                                                                                  #        OF COMPUTATIONS.
033641,000096: 
033642,000097:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
033643,000098: 
033644,000099:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
033645,000100:                                                                                                  #        THESE SUBROUTINES.
033646,000101: 
033647,000102:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
033648,000103:                                                                                                  #        THE USER.
033649,000104: 
033650,000105: 36,2466                                           BANK     36                                    
033651,000106: 26,2000                                           SETLOC   EPHEM                                 
033652,000107: 26,2000                                           BANK                                           
033653,000108: 
033654,000109: 26,2110                                           COUNT*   $$/EPHEM                              
033655,000110: 26,2110  E7,1777                                  EBANK=   END-E7                                
033656,000111: 26,2110           77774        LSPOS              AXT,2                                          #  COMPUTES POSITION VECTORS OF BOTH THE
033657,000112: 26,2111           54161                                    RESA                                  #  SUN AND THE MOON.  THE POSITION VECTOR
033658,000113: 26,2112           52170                           AXT,1    GOTO                                  #  OF THE SUN IS STORED IN 2D OF THE VAC
033659,000114: 26,2113           54143                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
033660,000115: 26,2114           54126                                    LSTIME                                #  IS STORED IN MPAC.
033661,000116: 26,2115           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
033662,000117: 26,2116           54162                                    REM                                   #  AND STORES IT IN MPAC.
033663,000118: 26,2117           54126                                    LSTIME                                
033664,000119: 26,2120           52170        LUNVEL             AXT,1    GOTO                                  #  COMPUTES THE VELOCITY VECTOR OF THE MOON
033665,000120: 26,2121           54173                                    VEM                                   #  AND STORES IT IN MPAC.
033666,000121: 26,2122           54126                                    LSTIME                                
033667,000122: 26,2123           76020        SOLPOS             STQ      AXT,1                                 #  COMPUTES THE POSITION VECTOR OF THE SUN
033668,000123: 26,2124           00047                                    X2                                    #  AND STORES IT IN MPAC.
033669,000124: 26,2125           54143                                    RES                                   
033670,000125: 26,2126           54201        LSTIME             SETPD    SR                                    
033671,000126: 26,2127           00001                                    0D                                    
033672,000127: 26,2130           20617                                    14D                                   
033673,000128: 26,2131           57571                           TAD      DCOMP                                 
033674,000129: 26,2132           01707                                    TEPHEM                                
033675,000130: 26,2133           57571                           TAD      DCOMP                                 
033676,000131: 26,2134           02034                                    TIMEMO                                
033677,000132: 26,2135           66261                           SL       SSP                                   
033678,000133: 26,2136           20221                                    16D                                   
033679,000134: 26,2137           00051                                    S1                                    
033680,000135: 26,2140           00006                                    6D                                    
033681,000136: 26,2141           77650                           GOTO                                           
033682,000137: 26,2142           00046                                    X1                                    
033683,000138: 26,2143           41206        RES                PUSH     DMP                                   #                                        PD- 2
033684,000139: 26,2144           02147                                    OMEGAES                               
033685,000140: 26,2145           71406                           PUSH     COS                                   #                                        PD- 4
033686,000141: 26,2146           65361                           VXSC     PDDL                                  #                                        PD- 8
033687,000142: 26,2147           02133                                    RESO                                  
033688,000143: 26,2150           63356                           SIN      PDVL                                  #                                        PD-10
033689,000144: 26,2151           02133                                    RESO                                  
033690,000145: 26,2152           53406                           PUSH     UNIT                                  #                                        PD-16
033691,000146: 26,2153           53435                           VXV      UNIT                                  
033692,000147: 26,2154           02141                                    VESO                                  
033693,000148: 26,2155           76435                           VXV      VSL1                                  #                                        PD-10
033694,000149: 26,2156           53361                           VXSC     VAD                                   #                                        PD-02
033695,000150: 26,2157           52172                           VSL1     GOTO                                  #  RES IN METERS X B-38 IN MPAC.
033696,000151: 26,2160           00047                                    X2                                    
033697,000152: 26,2161           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC.    PD- 0
033698,000153: 26,2162           63370        REM                AXT,1    PDVL                                  #                                        PD- 2
033699,000154: 26,2163           00066                                    54D                                   
033700,000155: 26,2164           02037                                    VECOEM                                
033701,000156: 26,2165           52761        REMA               VXSC     VAD*                                  
033702,000157: 26,2166           00001                                    0D                                    
033703,000158: 26,2167           02133                                    VECOEM     +60D,1                     
033704,000159: 26,2170           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
033705,000160: 26,2171           54165                                    REMA                                  
033706,000161: 26,2172           77616                           RVQ                                            
033707,000162: 26,2173           65370        VEM                AXT,1    PDDL                                  #                                        PD- 2
033708,000163: 26,2174           00060                                    48D                                   
033709,000164: 26,2175           14214                                    NINEB4                                
033710,000165: 26,2176           74206                           PUSH     VXSC                                  #                                        PD- 4
033711,000166: 26,2177           02037                                    VECOEM                                
033712,000167: 26,2200           77761        VEMA               VXSC                                           
033713,000168: 26,2201           00001                                    0D                                    
033714,000169: 26,2202           14005                           STODL    4D                                    #                                        PD- 2
033715,000170: 26,2203           41425                           DSU      PUSH                                  #                                        PD- 4
033716,000171: 26,2204           14216                                    ONEB4                                 
033717,000172: 26,2205           53357                           VXSC*    VAD                                   
033718,000173: 26,2206           02125                                    VECOEM     +54D,1                     
033719,000174: 26,2207           00005                                    4D                                    
033720,000175: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
033721,000176: 26,2211           54200                                    VEMA                                  
033722,000177: 26,2212           77616                           RVQ                                            
033723,000178: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
033724,000179: 
033725,000180: 26,2215           02000 00000  ONEB4              2DEC     1.0        B-4                        
033726,000181: 
033727,000182: 
033728,000183: 

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