Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

032362,000002:                                                                                                  ## Copyright:   Public domain.
032363,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
032364,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
032365,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
032366,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
032367,000007:                                                                                                  ## Assembler:   yaYUL
032368,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
032369,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
032370,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
032371,000011:                                                                                                  ## Mod history: 2011-02-27 JL   Adapted from corresponding Colossus 249 file.
032372,000012:                                                                                                  ##              2016-12-31 RSB  Proofed comment text using octopus/ProoferComments,
032373,000013:                                                                                                  ##                              and corrected errors found.
032374,000014: 

Page 736

032376,000016:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
032377,000017: 
032378,000018:                                                                                                  #  FUNCTIONAL DESCRIPTION
032379,000019: 
032380,000020:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
032381,000021:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
032382,000022:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
032383,000023: 
032384,000024:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
032385,000025:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
032386,000026:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
032387,000027:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
032388,000028: 
032389,000029:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
032390,000030: 
032391,000031:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
032392,000032: 
032393,000033:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
032394,000034: 
032395,000035:                                                                                                  #        SOLPOS COMPUTES THE POSITION VECTOR OF THE SUN.
032396,000036: 
032397,000037:                                                                                                  #  CALLING SEQUENCE
032398,000038: 
032399,000039:                                                                                                  #        DLOAD  CALL
032400,000040:                                                                                                  #               TIME               GROUND ELAPSED TIME
032401,000041:                                                                                                  #               SUBROUTINE         LSPOS OR LUNPOS OR LUNVEL OR SOLPOS
032402,000042: 
032403,000043:                                                                                                  #  INPUT
032404,000044: 
032405,000045:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
032406,000046: 
032407,000047:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
032408,000048:                                                                                                  #           POSITION POLYNOMIAL IS VALID IN CS X B-42.
032409,000049: 
032410,000050:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
032411,000051:                                                                                                  #           LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
032412,000052: 
032413,000053:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
032414,000054:                                                                                                  #           TIMEMO IN METERS X B-38.
032415,000055: 
032416,000056:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
032417,000057:                                                                                                  #           TIMEMO IN METERS/CS X B-9.
032418,000058: 
032419,000059:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
032420,000060:                                                                                                  #           REV/CS X B+26.
032421,000061: 
032422,000062:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
032423,000063:                                                                                                  #        ERASABLE DATA LOAD.
032424,000064: 
032425,000065:                                                                                                  #  OUTPUT - LSPOS

Page 737

032427,000067:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE
032428,000068:                                                                                                  #           TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
032429,000069: 
032430,000070:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
032431,000071:                                                                                                  #           EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
032432,000072: 
032433,000073:                                                                                                  #  OUTPUT - LUNPOS
032434,000074: 
032435,000075:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
032436,000076:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
032437,000077: 
032438,000078:                                                                                                  #  OUTPUT - LUNVEL
032439,000079: 
032440,000080:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
032441,000081:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
032442,000082: 
032443,000083:                                                                                                  #  OUTPUT - SOLPOS
032444,000084: 
032445,000085:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH
032446,000086:                                                                                                  #        AT TIME INPUT BY THE USER IN METERS X B-38.
032447,000087: 
032448,000088:                                                                                                  #  SUBROUTINES USED
032449,000089: 
032450,000090:                                                                                                  #        NONE
032451,000091: 
032452,000092:                                                                                                  #  REMARKS
032453,000093: 
032454,000094:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
032455,000095:                                                                                                  #        OF COMPUTATIONS.
032456,000096: 
032457,000097:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
032458,000098:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
032459,000099:                                                                                                  #        THESE SUBROUTINES.
032460,000100:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
032461,000101:                                                                                                  #        THE USER.
032462,000102: 
032463,000103: 36,2502                                           BANK     36                                    
032464,000104: 26,2000                                           SETLOC   EPHEM                                 
032465,000105: 26,2000                                           BANK                                           
032466,000106: 
032467,000107: 26,2110                                           COUNT*   $$/EPHEM                              
032468,000108: 26,2110  0003777                                  EBANK=   END-E7                                
032469,000109: 26,2110           77774        LSPOS              AXT,2                                          #  COMPUTES POSITION VECTORS OF BOTH THE
032470,000110: 26,2111           54161                                    RESA                                  #  SUN AND THE MOON.  THE POSITION VECTOR
032471,000111: 26,2112           52170                           AXT,1    GOTO                                  #  OF THE SUN IS STORED IN 2D OF THE VAC
032472,000112: 26,2113           54143                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
032473,000113: 26,2114           54126                                    LSTIME                                #  IS STORED IN MPAC.
032474,000114: 26,2115           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
032475,000115: 26,2116           54162                                    REM                                   #  AND STORES IT IN MPAC.
032476,000116: 26,2117           54126                                    LSTIME                                

Page 738

032478,000118: 26,2120           52170        LUNVEL             AXT,1    GOTO                                  #  COMPUTES THE VELOCITY VECTOR OF THE MOON
032479,000119: 26,2121           54173                                    VEM                                   #  AND STORES IT IN MPAC.
032480,000120: 26,2122           54126                                    LSTIME                                
032481,000121: 26,2123           76020        SOLPOS             STQ      AXT,1                                 #  COMPUTES THE POSITION VECTOR OF THE SUN
032482,000122: 26,2124           00047                                    X2                                    #  AND STORES IT IN MPAC.
032483,000123: 26,2125           54143                                    RES                                   
032484,000124: 26,2126           54201        LSTIME             SETPD    SR                                    
032485,000125: 26,2127           00001                                    0D                                    
032486,000126: 26,2130           20617                                    14D                                   
032487,000127: 26,2131           57571                           TAD      DCOMP                                 
032488,000128: 26,2132           01707                                    TEPHEM                                
032489,000129: 26,2133           57571                           TAD      DCOMP                                 
032490,000130: 26,2134           02034                                    TIMEMO                                
032491,000131: 26,2135           66261                           SL       SSP                                   
032492,000132: 26,2136           20221                                    16D                                   
032493,000133: 26,2137           00051                                    S1                                    
032494,000134: 26,2140           00006                                    6D                                    
032495,000135: 26,2141           77650                           GOTO                                           
032496,000136: 26,2142           00046                                    X1                                    
032497,000137: 26,2143           41206        RES                PUSH     DMP                                   #                                     PD- 2
032498,000138: 26,2144           02147                                    OMEGAES                               
032499,000139: 26,2145           71406                           PUSH     COS                                   #                                     PD- 4
032500,000140: 26,2146           65361                           VXSC     PDDL                                  #                                     PD- 8
032501,000141: 26,2147           02133                                    RESO                                  
032502,000142: 26,2150           63356                           SIN      PDVL                                  #                                     PD-10
032503,000143: 26,2151           02133                                    RESO                                  
032504,000144: 26,2152           53406                           PUSH     UNIT                                  #                                     PD-16
032505,000145: 26,2153           53435                           VXV      UNIT                                  
032506,000146: 26,2154           02141                                    VESO                                  
032507,000147: 26,2155           76435                           VXV      VSL1                                  #                                     PD-10
032508,000148: 26,2156           53361                           VXSC     VAD                                   #                                     PD-02
032509,000149: 26,2157           52172                           VSL1     GOTO                                  #  RES IN METERS X B-38 IN MPAC.
032510,000150: 26,2160           00047                                    X2                                    
032511,000151: 26,2161           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC. PD- 0
032512,000152: 26,2162           63370        REM                AXT,1    PDVL                                  #                                     PD- 2
032513,000153: 26,2163           00066                                    54D                                   
032514,000154: 26,2164           02037                                    VECOEM                                
032515,000155: 26,2165           52761        REMA               VXSC     VAD*                                  
032516,000156: 26,2166           00001                                    0D                                    
032517,000157: 26,2167           02133                                    VECOEM     +60D,1                     
032518,000158: 26,2170           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
032519,000159: 26,2171           54165                                    REMA                                  
032520,000160: 26,2172           77616                           RVQ                                            
032521,000161: 26,2173           65370        VEM                AXT,1    PDDL                                  #                                     PD- 2
032522,000162: 26,2174           00060                                    48D                                   
032523,000163: 26,2175           14214                                    NINEB4                                
032524,000164: 26,2176           74206                           PUSH     VXSC                                  #                                     PD- 4
032525,000165: 26,2177           02037                                    VECOEM                                
032526,000166: 26,2200           77761        VEMA               VXSC                                           
032527,000167: 26,2201           00001                                    0D                                    

Page 739

032529,000169: 26,2202           14005                           STODL    4D                                    #                                     PD- 2
032530,000170: 26,2203           41425                           DSU      PUSH                                  #                                     PD- 4
032531,000171: 26,2204           14216                                    ONEB4                                 
032532,000172: 26,2205           53357                           VXSC*    VAD                                   
032533,000173: 26,2206           02125                                    VECOEM     +54D,1                     
032534,000174: 26,2207           00005                                    4D                                    
032535,000175: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
032536,000176: 26,2211           54200                                    VEMA                                  
032537,000177: 26,2212           77616                           RVQ                                            
032538,000178: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
032539,000179: 26,2215           02000 00000  ONEB4              2DEC     1.0        B-4                        

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