Source Code

These source-code files are part of a reconstructed copy of Artemis 071, the first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

034976,000002:                                                                                                  ## Copyright:   Public domain.
034977,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
034978,000004:                                                                                                  ## Purpose:     A section of Artemis revision 071.
034979,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
034980,000006:                                                                                                  ##              release of the flight software for the Command Module's
034981,000007:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
034982,000008:                                                                                                  ##              17. The code has been recreated from a copy of Artemis 072.
034983,000009:                                                                                                  ##              It has been adapted such that the resulting bugger words
034984,000010:                                                                                                  ##              exactly match those specified for Artemis 071 in NASA
034985,000011:                                                                                                  ##              drawing 2021154-, which gives relatively high confidence
034986,000012:                                                                                                  ##              that the reconstruction is correct.
034987,000013:                                                                                                  ## Reference:   789
034988,000014:                                                                                                  ## Assembler:   yaYUL
034989,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
034990,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
034991,000017:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Artemis 072.
034992,000018: 

Page 789

034994,000020: 
034995,000021:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
034996,000022: 
034997,000023:                                                                                                  #  FUNCTIONAL DESCRIPTION
034998,000024: 
034999,000025:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
035000,000026:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
035001,000027:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
035002,000028: 
035003,000029:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
035004,000030:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
035005,000031:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
035006,000032:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.
035007,000033:                                                                                                  #  

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.

035015,000041: 
035016,000042:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
035017,000043: 
035018,000044:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
035019,000045: 
035020,000046:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
035021,000047: 
035022,000048:                                                                                                  #  CALLING SEQUENCE
035023,000049: 
035024,000050:                                                                                                  #        DLOAD   CALL
035025,000051:                                                                                                  #                TIME            GROUND ELAPSED TIME
035026,000052:                                                                                                  #                SUBROUTINE      LSPOS OR LUNPOS OR LUNVEL
035027,000053: 
035028,000054:                                                                                                  #  INPUT
035029,000055: 
035030,000056:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
035031,000057: 
035032,000058:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
035033,000059:                                                                                                  #           POSITION POLYNOMIAL IS VALID IN CS X B-42.
035034,000060: 
035035,000061:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
035036,000062:                                                                                                  #           LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
035037,000063: 
035038,000064:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035039,000065:                                                                                                  #           TIMEMO IN METERS X B-38.
035040,000066: 
035041,000067:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035042,000068:                                                                                                  #           TIMEMO IN METERS/CS X B-9.
035043,000069:                                                                                                  #  
035044,000070:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
035045,000071:                                                                                                  #           REV/CS X B+26.
035046,000072: 
035047,000073:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
035048,000074:                                                                                                  #        ERASABLE DATA LOAD.
035049,000075: 
035050,000076:                                                                                                  #  OUTPUT - LSPOS
035051,000077: 
035052,000078:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE

Page 790

035054,000080:                                                                                                  #           TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
035055,000081: 
035056,000082:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035057,000083:                                                                                                  #           EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
035058,000084: 
035059,000085:                                                                                                  #  OUTPUT - LUNPOS
035060,000086: 
035061,000087:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035062,000088:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
035063,000089: 
035064,000090:                                                                                                  #  OUTPUT - LUNVEL
035065,000091: 
035066,000092:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
035067,000093:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
035068,000094: 
035069,000095:                                                                                                  #  SUBROUTINES USED
035070,000096: 
035071,000097:                                                                                                  #        NONE
035072,000098: 
035073,000099:                                                                                                  #  REMARKS
035074,000100: 
035075,000101:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
035076,000102:                                                                                                  #        OF COMPUTATIONS.
035077,000103: 
035078,000104:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
035079,000105:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
035080,000106:                                                                                                  #        THESE SUBROUTINES.
035081,000107:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
035082,000108:                                                                                                  #        THE USER.
035083,000109: 
035084,000110: 26,2000                                           SETLOC   EPHEM                                 
035085,000111: 26,2000                                           BANK                                           
035086,000112: 
035087,000113: 26,2136                                           COUNT*   $$/EPHEM                              
035088,000114: 26,2136  0003777                                  EBANK=   WHOCARES                              
035089,000115: 26,2136           52170        LSPOS              AXT,1    GOTO                                  
035090,000116: 26,2137           54163                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
035091,000117: 26,2140           54146                                    LSTIME                                #  IS STORED IN MPAC.
035092,000118: 26,2141           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
035093,000119: 26,2142           54201                                    REM                                   #  AND STORES IT IN MPAC.
035094,000120: 26,2143           54146                                    LSTIME                                
035095,000121: 26,2144           77770        LUNVEL             AXT,1                                          
035096,000122: 26,2145           54212                                    VEM                                   #  AND STORES IT IN MPAC.
035097,000123: 26,2146           54201        LSTIME             SETPD    SR                                    
035098,000124: 26,2147           00001                                    0D                                    
035099,000125: 26,2150           20617                                    14D                                   
035100,000126: 26,2151           57571                           TAD      DCOMP                                 
035101,000127: 26,2152           01707                                    TEPHEM                                
035102,000128: 26,2153           57571                           TAD      DCOMP                                 
035103,000129: 26,2154           02034                                    TIMEMO                                

Page 791

035105,000131: 26,2155           66261                           SL       SSP                                   
035106,000132: 26,2156           20221                                    16D                                   
035107,000133: 26,2157           00051                                    S1                                    
035108,000134: 26,2160           00006                                    6D                                    
035109,000135: 26,2161           77650                           GOTO                                           
035110,000136: 26,2162           00046                                    X1                                    
035111,000137: 26,2163           41206        RES                PUSH     DMP                                   #                                        PD- 2
035112,000138: 26,2164           02147                                    OMEGAES                               
035113,000139: 26,2165           71406                           PUSH     COS                                   #                                        PD- 4
035114,000140: 26,2166           65361                           VXSC     PDDL                                  #                                        PD- 8
035115,000141: 26,2167           02133                                    RESO                                  
035116,000142: 26,2170           63356                           SIN      PDVL                                  #                                        PD-10
035117,000143: 26,2171           02133                                    RESO                                  
035118,000144: 26,2172           53406                           PUSH     UNIT                                  #                                        PD-16
035119,000145: 26,2173           53435                           VXV      UNIT                                  
035120,000146: 26,2174           02141                                    VESO                                  
035121,000147: 26,2175           76435                           VXV      VSL1                                  #                                        PD-10
035122,000148: 26,2176           53361                           VXSC     VAD                                   #                                        PD-02
035123,000149: 26,2177           77772                           VSL1                                           
035124,000150: 26,2200           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC.    PD- 0
035125,000151: 26,2201           63370        REM                AXT,1    PDVL                                  #                                        PD- 2
035126,000152: 26,2202           00066                                    54D                                   
035127,000153: 26,2203           02037                                    VECOEM                                
035128,000154: 26,2204           52761        REMA               VXSC     VAD*                                  
035129,000155: 26,2205           00001                                    0D                                    
035130,000156: 26,2206           02133                                    VECOEM     +60D,1                     
035131,000157: 26,2207           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
035132,000158: 26,2210           54204                                    REMA                                  
035133,000159: 26,2211           77616                           RVQ                                            
035134,000160: 26,2212           65370        VEM                AXT,1    PDDL                                  #                                        PD- 2
035135,000161: 26,2213           00060                                    48D                                   
035136,000162: 26,2214           14233                                    NINEB4                                
035137,000163: 26,2215           74206                           PUSH     VXSC                                  #                                        PD- 4
035138,000164: 26,2216           02037                                    VECOEM                                
035139,000165: 26,2217           77761        VEMA               VXSC                                           
035140,000166: 26,2220           00001                                    0D                                    
035141,000167: 26,2221           14005                           STODL    4D                                    #                                        PD- 2
035142,000168: 26,2222           41425                           DSU      PUSH                                  #                                        PD- 4
035143,000169: 26,2223           31771                                    ONEB4                                 
035144,000170: 26,2224           53357                           VXSC*    VAD                                   
035145,000171: 26,2225           02125                                    VECOEM     +54D,1                     
035146,000172: 26,2226           00005                                    4D                                    
035147,000173: 26,2227           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
035148,000174: 26,2230           54217                                    VEMA                                  
035149,000175: 26,2231           77616                           RVQ                                            
035150,000176: 26,2232           22000 00000  NINEB4             2DEC     9.0        B-4                        
035151,000177: 26,2234  34,3770               ONEB4              EQUALS   DP2(-4)                               #  1 B-4
035152,000178: 

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