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.

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

Page 736

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

Page 737

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

Page 738

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

Page 739

032536,000169: 26,2202           14005                           STODL    4D                                    #                                     PD- 2
032537,000170: 26,2203           41425                           DSU      PUSH                                  #                                     PD- 4
032538,000171: 26,2204           14216                                    ONEB4                                 
032539,000172: 26,2205           53357                           VXSC*    VAD                                   
032540,000173: 26,2206           02125                                    VECOEM     +54D,1                     
032541,000174: 26,2207           00005                                    4D                                    
032542,000175: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
032543,000176: 26,2211           54200                                    VEMA                                  
032544,000177: 26,2212           77616                           RVQ                                            
032545,000178: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
032546,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