Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Colossus 249 (Apollo 9) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality 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 055 OF AGC PROGRAM COMANCHE BY NASA 2021113-051
	10:28 APR.  1,1969
Note that the date is the date of the printout, not the date of the program revision.

035056,000002:                                                                                                  ## Copyright:    Public domain.
035057,000003:                                                                                                  ## Filename:     LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
035058,000004:                                                                                                  ## Purpose:      Part of the source code for Comanche, build 055. It
035059,000005:                                                                                                  ##               is part of the source code for the Command Module's
035060,000006:                                                                                                  ##               (CM) Apollo Guidance Computer (AGC), Apollo 11.
035061,000007:                                                                                                  ## Assembler:    yaYUL
035062,000008:                                                                                                  ## Reference:    pp. 785-788
035063,000009:                                                                                                  ## Contact:      Ron Burkey <info@sandroid.org>
035064,000010:                                                                                                  ## Website:      http://www.ibiblio.org/apollo.
035065,000011:                                                                                                  ## Mod history:  2009-05-12 RSB Adapted from Colossus249 file of the same
035066,000012:                                                                                                  ##                              name and Comanche 055 page images.
035067,000013:                                                                                                  ##               2009-07-26 RSB Added annotations related to computation
035068,000014:                                                                                                  ##                              of the ephemeral(?) polynomials.
035069,000015:                                                                                                  ##               2016-12-11 RSB Proofed comments with octopus/ProoferComments
035070,000016:                                                                                                  ##                              and fixed the errors found.
035071,000017:                                                                                                  ##
035072,000018:                                                                                                  ## The contents of the "Comanche055" files, in general, are transcribed 
035073,000019:                                                                                                  ## from scanned documents. 
035074,000020:                                                                                                  ##
035075,000021:                                                                                                  ##       Assemble revision 055 of AGC program Comanche by NASA
035076,000022:                                                                                                  ##       2021113-051.  April 1, 1969.  
035077,000023:                                                                                                  ##
035078,000024:                                                                                                  ##       This AGC program shall also be referred to as Colossus 2A
035079,000025:                                                                                                  ##
035080,000026:                                                                                                  ##       Prepared by
035081,000027:                                                                                                  ##                       Massachusetts Institute of Technology
035082,000028:                                                                                                  ##                       75 Cambridge Parkway
035083,000029:                                                                                                  ##                       Cambridge, Massachusetts
035084,000030:                                                                                                  ##
035085,000031:                                                                                                  ##       under NASA contract NAS 9-4065.
035086,000032:                                                                                                  ##
035087,000033:                                                                                                  ## Refer directly to the online document mentioned above for further
035088,000034:                                                                                                  ## information.  Please report any errors to info@sandroid.org.
035089,000035: 

Page 785

035091,000037:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
035092,000038: 
035093,000039:                                                                                                  #  FUNCTIONAL DESCRIPTION
035094,000040: 
035095,000041:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
035096,000042:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
035097,000043:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
035098,000044: 
035099,000045:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
035100,000046:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
035101,000047:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
035102,000048:                                                                                                  #        INPUT BY THE USER SHOULD FALL WITHIN THIS 15 DAY INTERVAL.

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.

035110,000056: 
035111,000057:                                                                                                  #        LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
035112,000058: 
035113,000059:                                                                                                  #        LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
035114,000060: 
035115,000061:                                                                                                  #        LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
035116,000062: 
035117,000063:                                                                                                  #        SOLPOS COMPUTES THE POSITION VECTOR OF THE SUN.
035118,000064: 
035119,000065:                                                                                                  #  CALLING SEQUENCE
035120,000066: 
035121,000067:                                                                                                  #        DLOAD   CALL
035122,000068:                                                                                                  #                TIME            GROUND ELAPSED TIME
035123,000069:                                                                                                  #                SUBROUTINE      LSPOS OR LUNPOS OR LUNVEL OR SOLPOS
035124,000070: 
035125,000071:                                                                                                  #  INPUT
035126,000072: 
035127,000073:                                                                                                  #        1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
035128,000074: 
035129,000075:                                                                                                  #        2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
035130,000076:                                                                                                  #        POSITION POLYNOMIAL IS VALID IN CS X B-42.
035131,000077: 
035132,000078:                                                                                                  #        3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
035133,000079:                                                                                                  #        LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
035134,000080: 
035135,000081:                                                                                                  #        4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035136,000082:                                                                                                  #        TIMEMO IN METERS X B-38.
035137,000083: 
035138,000084:                                                                                                  #        5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
035139,000085:                                                                                                  #        TIMEMO IN METERS/CS X B-9.
035140,000086:                                                                                                  #  
035141,000087:                                                                                                  #        6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
035142,000088:                                                                                                  #        REV/CS X B+26.
035143,000089: 
035144,000090:                                                                                                  #        ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
035145,000091:                                                                                                  #        ERASABLE DATA LOAD.
035146,000092: 
035147,000093:                                                                                                  #  OUTPUT - LSPOS

Page 786

035149,000095: 
035150,000096:                                                                                                  #        1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE
035151,000097:                                                                                                  #        TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
035152,000098: 
035153,000099:                                                                                                  #        2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035154,000100:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
035155,000101: 
035156,000102:                                                                                                  #  OUTPUT - LUNPOS
035157,000103: 
035158,000104:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
035159,000105:                                                                                                  #        EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
035160,000106: 
035161,000107:                                                                                                  #  OUTPUT - LUNVEL
035162,000108: 
035163,000109:                                                                                                  #        MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
035164,000110:                                                                                                  #        EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
035165,000111: 
035166,000112:                                                                                                  #  OUTPUT - SOLPOS
035167,000113: 
035168,000114:                                                                                                  #        MPAC CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH
035169,000115:                                                                                                  #        AT TIME INPUT BY THE USER IN METERS X B-38.
035170,000116: 
035171,000117:                                                                                                  #  SUBROUTINES USED
035172,000118: 
035173,000119:                                                                                                  #        NONE
035174,000120: 
035175,000121:                                                                                                  #  REMARKS
035176,000122: 
035177,000123:                                                                                                  #        THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
035178,000124:                                                                                                  #        OF COMPUTATIONS.
035179,000125: 
035180,000126:                                                                                                  #        S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
035181,000127: 
035182,000128:                                                                                                  #        PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
035183,000129:                                                                                                  #        THESE SUBROUTINES.
035184,000130: 
035185,000131:                                                                                                  #        RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
035186,000132:                                                                                                  #        THE USER.
035187,000133: 
035188,000134: 36,2466                                           BANK     36                                    
035189,000135: 26,2000                                           SETLOC   EPHEM                                 
035190,000136: 26,2000                                           BANK                                           
035191,000137: 
035192,000138: 26,2110                                           COUNT*   $$/EPHEM                              
035193,000139: 26,2110  E7,1777                                  EBANK=   END-E7                                
035194,000140: 26,2110           77774        LSPOS              AXT,2                                          #  COMPUTES POSITION VECTORS OF BOTH THE
035195,000141: 26,2111           54161                                    RESA                                  #  SUN AND THE MOON.  THE POSITION VECTOR
035196,000142: 26,2112           52170                           AXT,1    GOTO                                  #  OF THE SUN IS STORED IN 2D OF THE VAC
035197,000143: 26,2113           54143                                    RES                                   #  AREA.  THE POSITION VECTOR OF THE MOON
035198,000144: 26,2114           54126                                    LSTIME                                #  IS STORED IN MPAC.
035199,000145: 26,2115           52170        LUNPOS             AXT,1    GOTO                                  #  COMPUTES THE POSITION VECTOR OF THE MOON
035200,000146: 26,2116           54162                                    REM                                   #  AND STORES IT IN MPAC.
035201,000147: 26,2117           54126                                    LSTIME                                

Page 787

035203,000149: 26,2120           52170        LUNVEL             AXT,1    GOTO                                  #  COMPUTES THE VELOCITY VECTOR OF THE MOON
035204,000150: 26,2121           54173                                    VEM                                   #  AND STORES IT IN MPAC.
035205,000151: 26,2122           54126                                    LSTIME                                
035206,000152: 26,2123           76020        SOLPOS             STQ      AXT,1                                 #  COMPUTES THE POSITION VECTOR OF THE SUN
035207,000153: 26,2124           00047                                    X2                                    #  AND STORES IT IN MPAC.
035208,000154: 26,2125           54143                                    RES                                   
035209,000155: 26,2126           54201        LSTIME             SETPD    SR                                    
035210,000156: 26,2127           00001                                    0D                                    
035211,000157: 26,2130           20617                                    14D                                   
035212,000158: 26,2131           57571                           TAD      DCOMP                                 
035213,000159: 26,2132           01707                                    TEPHEM                                
035214,000160: 26,2133           57571                           TAD      DCOMP                                 
035215,000161: 26,2134           02034                                    TIMEMO                                
035216,000162: 26,2135           66261                           SL       SSP                                   
035217,000163: 26,2136           20221                                    16D                                   
035218,000164: 26,2137           00051                                    S1                                    
035219,000165: 26,2140           00006                                    6D                                    
035220,000166: 26,2141           77650                           GOTO                                           
035221,000167: 26,2142           00046                                    X1                                    
035222,000168: 26,2143           41206        RES                PUSH     DMP                                   #                                        PD- 2
035223,000169: 26,2144           02147                                    OMEGAES                               
035224,000170: 26,2145           71406                           PUSH     COS                                   #                                        PD- 4
035225,000171: 26,2146           65361                           VXSC     PDDL                                  #                                        PD- 8
035226,000172: 26,2147           02133                                    RESO                                  
035227,000173: 26,2150           63356                           SIN      PDVL                                  #                                        PD-10
035228,000174: 26,2151           02133                                    RESO                                  
035229,000175: 26,2152           53406                           PUSH     UNIT                                  #                                        PD-16
035230,000176: 26,2153           53435                           VXV      UNIT                                  
035231,000177: 26,2154           02141                                    VESO                                  
035232,000178: 26,2155           76435                           VXV      VSL1                                  #                                        PD-10
035233,000179: 26,2156           53361                           VXSC     VAD                                   #                                        PD-02
035234,000180: 26,2157           52172                           VSL1     GOTO                                  #  RES IN METERS X B-38 IN MPAC.
035235,000181: 26,2160           00047                                    X2                                    
035236,000182: 26,2161           14003        RESA               STODL    2D                                    #  RES IN METERS X B-38 IN 2D OF VAC.    PD- 0
035237,000183: 26,2162           63370        REM                AXT,1    PDVL                                  #                                        PD- 2
035238,000184: 26,2163           00066                                    54D                                   
035239,000185: 26,2164           02037                                    VECOEM                                
035240,000186: 26,2165           52761        REMA               VXSC     VAD*                                  
035241,000187: 26,2166           00001                                    0D                                    
035242,000188: 26,2167           02133                                    VECOEM     +60D,1                     
035243,000189: 26,2170           72500                           TIX,1    VSL2                                  #  REM IN METERS X B-29 IN MPAC.
035244,000190: 26,2171           54165                                    REMA                                  
035245,000191: 26,2172           77616                           RVQ                                            
035246,000192: 26,2173           65370        VEM                AXT,1    PDDL                                  #                                        PD- 2
035247,000193: 26,2174           00060                                    48D                                   
035248,000194: 26,2175           14214                                    NINEB4                                
035249,000195: 26,2176           74206                           PUSH     VXSC                                  #                                        PD- 4
035250,000196: 26,2177           02037                                    VECOEM                                
035251,000197: 26,2200           77761        VEMA               VXSC                                           
035252,000198: 26,2201           00001                                    0D                                    

Page 788

035254,000200: 26,2202           14005                           STODL    4D                                    #                                        PD- 2
035255,000201: 26,2203           41425                           DSU      PUSH                                  #                                        PD- 4
035256,000202: 26,2204           14216                                    ONEB4                                 
035257,000203: 26,2205           53357                           VXSC*    VAD                                   
035258,000204: 26,2206           02125                                    VECOEM     +54D,1                     
035259,000205: 26,2207           00005                                    4D                                    
035260,000206: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
035261,000207: 26,2211           54200                                    VEMA                                  
035262,000208: 26,2212           77616                           RVQ                                            
035263,000209: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
035264,000210: 
035265,000211: 26,2215           02000 00000  ONEB4              2DEC     1.0        B-4                        
035266,000212: 
035267,000213: 
035268,000214: 

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