Source Code

These source-code files were obtained by digitally photographing an Artemis 72 (Apollo 15-17 Command Module) program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Photography was by Ron Burkey, and transcription was performed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images may be 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 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971
Note that the date is the date of the printout, not the date of the program revision.

035115,000002:                                                                                                  ## Copyright:   Public domain.
035116,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
035117,000004:                                                                                                  ## Purpose:     Part of the source code for Artemis (i.e., Colossus 3),
035118,000005:                                                                                                  ##              build 072.  This is for the Command Module's (CM)
035119,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for
035120,000007:                                                                                                  ##              Apollo 15-17.
035121,000008:                                                                                                  ## Assembler:   yaYUL
035122,000009:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
035123,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
035124,000011:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Artemis072/
035125,000012:                                                                                                  ## Mod history: 2009-08-11 JL   Adapted from corresponding Comanche 055 file.
035126,000013:                                                                                                  ##              2010-02-20 RSB  Un-##'d this header.
035127,000014:                                                                                                  ##              2017-02-05 RSB  Proofed comment text by diff'ing vs Comanche 55
035128,000015:                                                                                                  ##                              and corrected errors found.
035129,000016: 

Page 789

035131,000018: 
035132,000019:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
035133,000020: 
035134,000021:                                                                                                  #  FUNCTIONAL DESCRIPTION
035135,000022: 
035136,000023:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
035137,000024:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
035138,000025:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
035139,000026: 
035140,000027:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
035141,000028:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
035142,000029:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
035143,000030:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
035144,000031:                                                                                                  #  

The 9th-degree polynomial spoken of here is a pad load, meaning that it is not actually hardcoded into the software. Additional information about calculating the polynomial can be found on the Orbiter NASSP wiki, as well as information about calculation of the solar ephemerides.

035152,000039: 
035153,000040:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
035154,000041: 
035155,000042:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
035156,000043: 
035157,000044:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
035158,000045: 
035159,000046:                                                                                                  #  CALLING SEQUENCE
035160,000047: 
035161,000048:                                                                                                  #        DLOAD   CALL
035162,000049:                                                                                                  #                TIME            GROUND ELAPSED TIME
035163,000050:                                                                                                  #                SUBROUTINE      LSPOS OR LUNPOS OR LUNVEL
035164,000051: 
035165,000052:                                                                                                  #  INPUT
035166,000053: 
035167,000054:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
035168,000055: 
035169,000056:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
035170,000057:                                                                                                  #           POSITION POLYNOMIAL IS VALID IN CS X B-42.
035171,000058: 
035172,000059:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
035173,000060:                                                                                                  #           LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
035174,000061: 
035175,000062:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035176,000063:                                                                                                  #           TIMEMO IN METERS X B-38.
035177,000064: 
035178,000065:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035179,000066:                                                                                                  #           TIMEMO IN METERS/CS X B-9.
035180,000067:                                                                                                  #  
035181,000068:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
035182,000069:                                                                                                  #           REV/CS X B+26.
035183,000070: 
035184,000071:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
035185,000072:                                                                                                  #        ERASABLE DATA LOAD.
035186,000073: 
035187,000074:                                                                                                  #  OUTPUT - LSPOS
035188,000075: 
035189,000076:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE

Page 790

035191,000078:                                                                                                  #           TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
035192,000079: 
035193,000080:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035194,000081:                                                                                                  #           EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
035195,000082: 
035196,000083:                                                                                                  #  OUTPUT - LUNPOS
035197,000084: 
035198,000085:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035199,000086:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
035200,000087: 
035201,000088:                                                                                                  #  OUTPUT - LUNVEL
035202,000089: 
035203,000090:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
035204,000091:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
035205,000092: 
035206,000093:                                                                                                  #  SUBROUTINES USED
035207,000094: 
035208,000095:                                                                                                  #        NONE
035209,000096: 
035210,000097:                                                                                                  #  REMARKS
035211,000098: 
035212,000099:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
035213,000100:                                                                                                  #        OF COMPUTATIONS.
035214,000101: 
035215,000102:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
035216,000103:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
035217,000104:                                                                                                  #        THESE SUBROUTINES.
035218,000105:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
035219,000106:                                                                                                  #        THE USER.
035220,000107: 
035221,000108: 26,2000                                           SETLOC   EPHEM                                 
035222,000109: 26,2000                                           BANK                                           
035223,000110: 
035224,000111: 26,2136                                           COUNT*   $$/EPHEM                              
035225,000112: 26,2136  0003777                                  EBANK=   WHOCARES                              
035226,000113: 26,2136           52170        LSPOS              AXT,1    GOTO                                  
035227,000114: 26,2137           54163                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
035228,000115: 26,2140           54146                                    LSTIME                                #  IS STORED IN MPAC.
035229,000116: 26,2141           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
035230,000117: 26,2142           54201                                    REM                                   #  AND STORES IT IN MPAC.
035231,000118: 26,2143           54146                                    LSTIME                                
035232,000119: 26,2144           77770        LUNVEL             AXT,1                                          
035233,000120: 26,2145           54212                                    VEM                                   #  AND STORES IT IN MPAC.
035234,000121: 26,2146           54201        LSTIME             SETPD    SR                                    
035235,000122: 26,2147           00001                                    0D                                    
035236,000123: 26,2150           20617                                    14D                                   
035237,000124: 26,2151           57571                           TAD      DCOMP                                 
035238,000125: 26,2152           01707                                    TEPHEM                                
035239,000126: 26,2153           57571                           TAD      DCOMP                                 
035240,000127: 26,2154           02034                                    TIMEMO                                

Page 791

035242,000129: 26,2155           66261                           SL       SSP                                   
035243,000130: 26,2156           20221                                    16D                                   
035244,000131: 26,2157           00051                                    S1                                    
035245,000132: 26,2160           00006                                    6D                                    
035246,000133: 26,2161           77650                           GOTO                                           
035247,000134: 26,2162           00046                                    X1                                    
035248,000135: 26,2163           41206        RES                PUSH     DMP                                   #                                        PD- 2
035249,000136: 26,2164           02147                                    OMEGAES                               
035250,000137: 26,2165           71406                           PUSH     COS                                   #                                        PD- 4
035251,000138: 26,2166           65361                           VXSC     PDDL                                  #                                        PD- 8
035252,000139: 26,2167           02133                                    RESO                                  
035253,000140: 26,2170           63356                           SIN      PDVL                                  #                                        PD-10
035254,000141: 26,2171           02133                                    RESO                                  
035255,000142: 26,2172           53406                           PUSH     UNIT                                  #                                        PD-16
035256,000143: 26,2173           53435                           VXV      UNIT                                  
035257,000144: 26,2174           02141                                    VESO                                  
035258,000145: 26,2175           76435                           VXV      VSL1                                  #                                        PD-10
035259,000146: 26,2176           53361                           VXSC     VAD                                   #                                        PD-02
035260,000147: 26,2177           77772                           VSL1                                           
035261,000148: 26,2200           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC.    PD- 0
035262,000149: 26,2201           63370        REM                AXT,1    PDVL                                  #                                        PD- 2
035263,000150: 26,2202           00066                                    54D                                   
035264,000151: 26,2203           02037                                    VECOEM                                
035265,000152: 26,2204           52761        REMA               VXSC     VAD*                                  
035266,000153: 26,2205           00001                                    0D                                    
035267,000154: 26,2206           02133                                    VECOEM     +60D,1                     
035268,000155: 26,2207           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
035269,000156: 26,2210           54204                                    REMA                                  
035270,000157: 26,2211           77616                           RVQ                                            
035271,000158: 26,2212           65370        VEM                AXT,1    PDDL                                  #                                        PD- 2
035272,000159: 26,2213           00060                                    48D                                   
035273,000160: 26,2214           14233                                    NINEB4                                
035274,000161: 26,2215           74206                           PUSH     VXSC                                  #                                        PD- 4
035275,000162: 26,2216           02037                                    VECOEM                                
035276,000163: 26,2217           77761        VEMA               VXSC                                           
035277,000164: 26,2220           00001                                    0D                                    
035278,000165: 26,2221           14005                           STODL    4D                                    #                                        PD- 2
035279,000166: 26,2222           41425                           DSU      PUSH                                  #                                        PD- 4
035280,000167: 26,2223           31771                                    ONEB4                                 
035281,000168: 26,2224           53357                           VXSC*    VAD                                   
035282,000169: 26,2225           02125                                    VECOEM     +54D,1                     
035283,000170: 26,2226           00005                                    4D                                    
035284,000171: 26,2227           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
035285,000172: 26,2230           54217                                    VEMA                                  
035286,000173: 26,2231           77616                           RVQ                                            
035287,000174: 26,2232           22000 00000  NINEB4             2DEC     9.0        B-4                        
035288,000175: 26,2234  34,3770               ONEB4              EQUALS   DP2(-4)                               #  1 B-4
035289,000176: 

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