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.

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

Page 789

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

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

Page 790

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

Page 791

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

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