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.

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

Page 785

035103,000037:                                                                                                  #  LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
035104,000038: 
035105,000039:                                                                                                  #  FUNCTIONAL DESCRIPTION
035106,000040: 
035107,000041:                                                                                                  #        THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
035108,000042:                                                                                                  #        VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
035109,000043:                                                                                                  #        SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
035110,000044: 
035111,000045:                                                                                                  #        THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
035112,000046:                                                                                                  #        A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
035113,000047:                                                                                                  #        DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH.  THEREFORE THE TIME
035114,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.

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

Page 786

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

Page 787

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

Page 788

035266,000200: 26,2202           14005                           STODL    4D                                    #                                        PD- 2
035267,000201: 26,2203           41425                           DSU      PUSH                                  #                                        PD- 4
035268,000202: 26,2204           14216                                    ONEB4                                 
035269,000203: 26,2205           53357                           VXSC*    VAD                                   
035270,000204: 26,2206           02125                                    VECOEM     +54D,1                     
035271,000205: 26,2207           00005                                    4D                                    
035272,000206: 26,2210           72500                           TIX,1    VSL2                                  #  VEM IN METERS/CS X B-7 IN MPAC.
035273,000207: 26,2211           54200                                    VEMA                                  
035274,000208: 26,2212           77616                           RVQ                                            
035275,000209: 26,2213           22000 00000  NINEB4             2DEC     9.0        B-4                        
035276,000210: 
035277,000211: 26,2215           02000 00000  ONEB4              2DEC     1.0        B-4                        
035278,000212: 
035279,000213: 
035280,000214: 

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