Source Code
These source-code files are part of a reconstructed copy of Comanche 51, the
initial release (though not the final mission release) of the Apollo 11
Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final
release was Comanche 55. The reconstruction is believed to be exactly accurate,
but in the absence of an actual Apollo-era listing of Comanche 51, some
explanation of the reconstruction process is needed to insure confidence in
that accuracy.
The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 55. Here's a guide to some of the Apollo documentation relevant to those annotations:
Comments expected to have been present in 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. |
034322,000002: ## Copyright: Public domain.
034323,000003: ## Filename: LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
034324,000004: ## Purpose: A section of Comanche revision 051.
034325,000005: ## It is part of the reconstructed source code for the
034326,000006: ## original release of the flight software for the Command
034327,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
034328,000008: ## The code has been recreated from a copy of Comanche 055. It
034329,000009: ## has been adapted such that the resulting bugger words
034330,000010: ## exactly match those specified for Comanche 51 in NASA drawing
034331,000011: ## 2021153D, which gives relatively high confidence that the
034332,000012: ## reconstruction is correct.
034333,000013: ## Reference: pp. 785-788
034334,000014: ## Assembler: yaYUL
034335,000015: ## Contact: Ron Burkey <info@sandroid.org>.
034336,000016: ## Website: www.ibiblio.org/apollo/index.html
034337,000017: ## Mod history: 2019-07-30 MAS Created from Comanche 55.
034338,000018:
Page 785 |
034340,000020: # LUNAR AND SOLAR EPHEMERIDES SUBROUTINES
034341,000021:
034342,000022: # FUNCTIONAL DESCRIPTION
034343,000023:
034344,000024: # THESE SUBROUTINES ARE USED TO DETERMINE THE POSITION AND VELOCITY
034345,000025: # VECTORS OF THE SUN AND THE MOON RELATIVE TO THE EARTH AT THE
034346,000026: # SPECIFIED GROUND ELAPSED TIME INPUT BY THE USER.
034347,000027:
034348,000028: # THE POSITION OF THE MOON IS STORED IN THE COMPUTER IN THE FORM OF
034349,000029: # A NINTH DEGREE POLYNOMIAL APPROXIMATION WHICH IS VALID OVER A 15
034350,000030: # DAY INTERVAL BEGINNING SHORTLY BEFORE LAUNCH. THEREFORE THE TIME
034351,000031: # 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. |
034359,000039:
034360,000040: # LSPOS COMPUTES THE POSITION VECTORS OF THE SUN AND THE MOON.
034361,000041:
034362,000042: # LUNPOS COMPUTES THE POSITION VECTOR OF THE MOON.
034363,000043:
034364,000044: # LUNVEL COMPUTES THE VELOCITY VECTOR OF THE MOON.
034365,000045:
034366,000046: # SOLPOS COMPUTES THE POSITION VECTOR OF THE SUN.
034367,000047:
034368,000048: # CALLING SEQUENCE
034369,000049:
034370,000050: # DLOAD CALL
034371,000051: # TIME GROUND ELAPSED TIME
034372,000052: # SUBROUTINE LSPOS OR LUNPOS OR LUNVEL OR SOLPOS
034373,000053:
034374,000054: # INPUT
034375,000055:
034376,000056: # 1) SPECIFIED GROUND ELAPSED TIME IN CS X B-28 LOADED IN MPAC.
034377,000057:
034378,000058: # 2) TIMEMO - TIME AT THE CENTER OF THE RANGE OVER WHICH THE LUNAR
034379,000059: # POSITION POLYNOMIAL IS VALID IN CS X B-42.
034380,000060:
034381,000061: # 3) VECOEM - VECTOR COEFFICIENTS OF THE LUNAR POSITION POLYNOMIAL
034382,000062: # LOADED IN DESCENDING SEQUENCE IN METERS/CS**N X B-2
034383,000063:
034384,000064: # 4) RESO - POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH AT
034385,000065: # TIMEMO IN METERS X B-38.
034386,000066:
034387,000067: # 5) VESO - VELOCITY VECTOR OF THE SUN RELATIVE TO THE EARTH AT
034388,000068: # TIMEMO IN METERS/CS X B-9.
034389,000069: #
034390,000070: # 6) OMEGAES - ANGULAR VELOCITY OF THE VECTOR RESO AT TIMEMO IN
034391,000071: # REV/CS X B+26.
034392,000072:
034393,000073: # ALL EXCEPT THE FIRST INPUT ARE INCLUDED IN THE PRE-LAUNCH
034394,000074: # ERASABLE DATA LOAD.
034395,000075:
034396,000076: # OUTPUT - LSPOS
Page 786 |
034398,000078:
034399,000079: # 1) 2D OF VAC AREA CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE
034400,000080: # TO THE EARTH AT TIME INPUT BY THE USER IN METERS X B-38.
034401,000081:
034402,000082: # 2) MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
034403,000083: # EARTH AT TIME INPUT BY THE USER IN METERS X B-29.
034404,000084:
034405,000085: # OUTPUT - LUNPOS
034406,000086:
034407,000087: # MPAC CONTAINS THE POSITION VECTOR OF THE MOON RELATIVE TO THE
034408,000088: # EARTH AT THE TIME INPUT BY USER IN METERS X B-29.
034409,000089:
034410,000090: # OUTPUT - LUNVEL
034411,000091:
034412,000092: # MPAC CONTAINS THE VELOCITY VECTOR OF THE MOON RELATIVE TO THE
034413,000093: # EARTH AT TIME INPUT BY THE USER IN METERS/CS X B-7.
034414,000094:
034415,000095: # OUTPUT - SOLPOS
034416,000096:
034417,000097: # MPAC CONTAINS THE POSITION VECTOR OF THE SUN RELATIVE TO THE EARTH
034418,000098: # AT TIME INPUT BY THE USER IN METERS X B-38.
034419,000099:
034420,000100: # SUBROUTINES USED
034421,000101:
034422,000102: # NONE
034423,000103:
034424,000104: # REMARKS
034425,000105:
034426,000106: # THE VAC AREA IS USED FOR STORAGE OF INTERMEDIATE AND FINAL RESULTS
034427,000107: # OF COMPUTATIONS.
034428,000108:
034429,000109: # S1, X1 AND X2 ARE USED BY THESE SUBROUTINES.
034430,000110:
034431,000111: # PRELAUNCH ERASABLE DATA LOAD ARE ONLY ERASABLE STORAGE USED BY
034432,000112: # THESE SUBROUTINES.
034433,000113:
034434,000114: # RESTARTS DURING OPERATION OF THESE SUBROUTINES MUST BE HANDLED BY
034435,000115: # THE USER.
034436,000116:
034437,000117: 36,2466 BANK 36
034438,000118: 26,2000 SETLOC EPHEM
034439,000119: 26,2000 BANK
034440,000120:
034441,000121: 26,2110 COUNT* $$/EPHEM
034442,000122: 26,2110 E7,1777 EBANK= END-E7
034443,000123: 26,2110 77774 LSPOS AXT,2 # COMPUTES POSITION VECTORS OF BOTH THE
034444,000124: 26,2111 54161 RESA # SUN AND THE MOON. THE POSITION VECTOR
034445,000125: 26,2112 52170 AXT,1 GOTO # OF THE SUN IS STORED IN 2D OF THE VAC
034446,000126: 26,2113 54143 RES # AREA. THE POSITION VECTOR OF THE MOON
034447,000127: 26,2114 54126 LSTIME # IS STORED IN MPAC.
034448,000128: 26,2115 52170 LUNPOS AXT,1 GOTO # COMPUTES THE POSITION VECTOR OF THE MOON
034449,000129: 26,2116 54162 REM # AND STORES IT IN MPAC.
034450,000130: 26,2117 54126 LSTIME
Page 787 |
034452,000132: 26,2120 52170 LUNVEL AXT,1 GOTO # COMPUTES THE VELOCITY VECTOR OF THE MOON
034453,000133: 26,2121 54173 VEM # AND STORES IT IN MPAC.
034454,000134: 26,2122 54126 LSTIME
034455,000135: 26,2123 76020 SOLPOS STQ AXT,1 # COMPUTES THE POSITION VECTOR OF THE SUN
034456,000136: 26,2124 00047 X2 # AND STORES IT IN MPAC.
034457,000137: 26,2125 54143 RES
034458,000138: 26,2126 54201 LSTIME SETPD SR
034459,000139: 26,2127 00001 0D
034460,000140: 26,2130 20617 14D
034461,000141: 26,2131 57571 TAD DCOMP
034462,000142: 26,2132 01707 TEPHEM
034463,000143: 26,2133 57571 TAD DCOMP
034464,000144: 26,2134 02034 TIMEMO
034465,000145: 26,2135 66261 SL SSP
034466,000146: 26,2136 20221 16D
034467,000147: 26,2137 00051 S1
034468,000148: 26,2140 00006 6D
034469,000149: 26,2141 77650 GOTO
034470,000150: 26,2142 00046 X1
034471,000151: 26,2143 41206 RES PUSH DMP # PD- 2
034472,000152: 26,2144 02147 OMEGAES
034473,000153: 26,2145 71406 PUSH COS # PD- 4
034474,000154: 26,2146 65361 VXSC PDDL # PD- 8
034475,000155: 26,2147 02133 RESO
034476,000156: 26,2150 63356 SIN PDVL # PD-10
034477,000157: 26,2151 02133 RESO
034478,000158: 26,2152 53406 PUSH UNIT # PD-16
034479,000159: 26,2153 53435 VXV UNIT
034480,000160: 26,2154 02141 VESO
034481,000161: 26,2155 76435 VXV VSL1 # PD-10
034482,000162: 26,2156 53361 VXSC VAD # PD-02
034483,000163: 26,2157 52172 VSL1 GOTO # RES IN METERS X B-38 IN MPAC.
034484,000164: 26,2160 00047 X2
034485,000165: 26,2161 14003 RESA STODL 2D # RES IN METERS X B-38 IN 2D OF VAC. PD- 0
034486,000166: 26,2162 63370 REM AXT,1 PDVL # PD- 2
034487,000167: 26,2163 00066 54D
034488,000168: 26,2164 02037 VECOEM
034489,000169: 26,2165 52761 REMA VXSC VAD*
034490,000170: 26,2166 00001 0D
034491,000171: 26,2167 02133 VECOEM +60D,1
034492,000172: 26,2170 72500 TIX,1 VSL2 # REM IN METERS X B-29 IN MPAC.
034493,000173: 26,2171 54165 REMA
034494,000174: 26,2172 77616 RVQ
034495,000175: 26,2173 65370 VEM AXT,1 PDDL # PD- 2
034496,000176: 26,2174 00060 48D
034497,000177: 26,2175 14214 NINEB4
034498,000178: 26,2176 74206 PUSH VXSC # PD- 4
034499,000179: 26,2177 02037 VECOEM
034500,000180: 26,2200 77761 VEMA VXSC
034501,000181: 26,2201 00001 0D
Page 788 |
034503,000183: 26,2202 14005 STODL 4D # PD- 2
034504,000184: 26,2203 41425 DSU PUSH # PD- 4
034505,000185: 26,2204 14216 ONEB4
034506,000186: 26,2205 53357 VXSC* VAD
034507,000187: 26,2206 02125 VECOEM +54D,1
034508,000188: 26,2207 00005 4D
034509,000189: 26,2210 72500 TIX,1 VSL2 # VEM IN METERS/CS X B-7 IN MPAC.
034510,000190: 26,2211 54200 VEMA
034511,000191: 26,2212 77616 RVQ
034512,000192: 26,2213 22000 00000 NINEB4 2DEC 9.0 B-4
034513,000193:
034514,000194: 26,2215 02000 00000 ONEB4 2DEC 1.0 B-4
034515,000195:
034516,000196:
034517,000197:
End of include-file LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc. Parent file is MAIN.agc