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.

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

Page 789

035124,000018: 
035125,000019:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
035126,000020: 
035127,000021:                                                                                                  #  FUNCTIONAL DESCRIPTION
035128,000022: 
035129,000023:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
035130,000024:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
035131,000025:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
035132,000026: 
035133,000027:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
035134,000028:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
035135,000029:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
035136,000030:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
035137,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.

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

Page 790

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

Page 791

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

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