Source Code
These source-code files are part of a reconstructed copy of Corona 261, the
final, flown release of the Block I Command Module (CM) Apollo Guidance Computer
(AGC) software for the AS-202 mission.
They have been created via disassembly of binary dumps of the original core rope memory modules actually flown on the mission, part numbers 1003733-171, 1003733-241, 1003733-191, 1003733-211, 1003733-221, and 1003733-241. The source code for the Apollo 4 and 6 software, Solarium 55, was used as a starting point, since it was directly derived from Corona and (at least in theory) only minimally modified. Since only binary dumps (rather than listings) of Corona are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
013243,000002: ## Copyright: Public domain.
013244,000003: ## Filename: LATITUDE-LONGITUDE_SUBROUTINES.agc
013245,000004: ## Purpose: A section of Corona revision 261.
013246,000005: ## It is part of the source code for the Apollo Guidance Computer
013247,000006: ## (AGC) for AS-202. No original listings of this software are
013248,000007: ## available; instead, this file was created via disassembly of
013249,000008: ## the core rope modules actually flown on the mission.
013250,000009: ## Assembler: yaYUL
013251,000010: ## Contact: Ron Burkey <info@sandroid.org>.
013252,000011: ## Website: www.ibiblio.org/apollo/index.html
013253,000012: ## Mod history: 2023-06-19 MAS Created.
013254,000013:
013255,000014: ## MAS 2023: This log section is a part of the MIDCOURSE NAVIGATION GAME, which
013256,000015: ## appears to be a very early implementation of P22, P29, and possibly some other
013257,000016: ## navigation programs. It was deleted in Solarium, and its documentation that
013258,000017: ## mentions it is nearly nonexistent outside of some MIT status reports (from
013259,000018: ## which the name of this log section is taken). Reverse-engineering it is a work
013260,000019: ## in progress; all labels and comments are modern guesses. Double-# comments
013261,000020: ## are annotations to aid in reverse engineering. Any labels that have not yet
013262,000021: ## been given modern names are given placeholders with the pattern UBB,SSSS,
013263,000022: ## where BB,SSSS is the full bank and address of the label.
013264,000023:
013265,000024: 31,6000 BANK 31
013266,000025:
013267,000026: 31,6000 45576 LONGPASS ITA 0
013268,000027: 31,6001 01305 STEPEXIT ## STEPEXIT = return to MNG
013269,000028:
013270,000029: 31,6002 76776 ITC 0
013271,000030: 31,6003 07165 RECTIFY
013272,000031:
013273,000032: 31,6004 76776 ITC 0
013274,000033: 31,6005 06036 KEPLER
013275,000034:
After KEPLER, the pushdown list contains the following: PD +0: unit(RRECT) PD +6: |RRECT| PD +8D: A4 = (|RRECT| * |VRECT|**2 - 1/4) * 4 this is "c_2" in the GSOP -------------------------------- mu PD +10D: ALPHA = (1/4 - (A4 / 4)) / |RRECT| also alpha in the GSOP PD +12D: A1 = (RRECT . VRECT) this is "c_1" in the GSOP --------------- sqrt(mu) |
013286,000045:
013287,000046: 31,6006 41775 VXV 1
013288,000047: 31,6007 74553 AXT,2 UNIT
013289,000048: 31,6010 23435 UNITZ
013290,000049: 31,6011 01101 RRECT
013291,000050: 31,6012 00013 10D ## X2 = 10, setting up for 10 iterations
013292,000051: 31,6013 33221 STORE UNE ## UNE = UNITZ x RRECT
013293,000052:
013294,000053: 31,6014 41775 VXV 1
013295,000054: 31,6015 54553 AST,2 UNIT
013296,000055: 31,6016 23435 UNITZ
013297,000056: 31,6017 01221 UNE
013298,000057: 31,6020 00002 1 ## S2 = 1, also setting up for 10 iterations
013299,000058: 31,6021 33231 STORE UNP ## UNP = UNITZ x UNE
013300,000059:
013301,000060: 31,6022 45175 DMOVE 1
013302,000061: 31,6023 76776 ITC
013303,000062: 31,6024 01147 TET
013304,000063: 31,6025 22176 LAT-LONG ## Get LAT and LONG at current state vector time
013305,000064:
013306,000065: 31,6026 47575 NOLOD 1
013307,000066: 31,6027 65712 BDSU DDV
013308,000067: 31,6030 01257 LONGDES
013309,000068: 31,6031 07474 15/16
013310,000069: 31,6032 33261 STORE DLONG ## DLONG = (LONGDES - LONG)*16/15
013311,000070:
013312,000071: 31,6033 76776 ITC 0
013313,000072: 31,6034 22373 ORBPARM ## Calculate HMAG, ALPHAM, COTGAM
013314,000073:
013315,000074: 31,6035 55175 HOPALONG COS 1
013316,000075: 31,6036 75776 VXSC
013317,000076: 31,6037 01261 DLONG
013318,000077: 31,6040 01221 UNE ## PD +14D = UNE * cos(DLONG)
013319,000078:
013320,000079: 31,6041 57175 SIN 1
013321,000080: 31,6042 75642 VXSC VAD
013322,000081: 31,6043 01261 DLONG
013323,000082: 31,6044 01231 UNP ## PD +14D = UNE*cos(DLONG) + UNP*sin(DLONG)
013324,000083:
013325,000084: 31,6045 41775 VXV 1
013326,000085: 31,6046 41753 VXV UNIT
013327,000086: 31,6047 01107 VRECT
013328,000087: 31,6050 01101 RRECT ## PD +14D = unit((VRECT x RRECT) x (PD+14D))
013329,000088:
013330,000089: 31,6051 73174 UNIT 2
013331,000090: 31,6052 44612 VSLT DOT
013332,000091: 31,6053 70653 DAD SQRT
013333,000092: 31,6054 01101 RRECT
013334,000093: 31,6055 00002 1
013335,000094: 31,6056 77777 -
013336,000095: 31,6057 07506 DP1/2 ## PD +14D = sqrt((unit(RRECT) . (PD+14D)) + 1/2)
013337,000096:
013338,000097: 31,6060 51174 HOP1 DSQ 2 ## Expects to find scalar in PD+14D
013339,000098: 31,6061 65742 BDSU DAD
013340,000099: 31,6062 53176 SQRT
013341,000100: 31,6063 00017 14D
013342,000101: 31,6064 07506 DP1/2
013343,000102: 31,6065 07506 DP1/2 ## PD +16D = sqrt(1 - (PD+14)**2)
013344,000103:
013345,000104: 31,6066 47575 NOLOD 1
013346,000105: 31,6067 55776 DMPR
013347,000106: 31,6070 01255 ALPHAM
013348,000107: 31,6071 32045 STORE VACZ ## VACZ = (PD+16D) * ALPHAM
013349,000108:
013350,000109: 31,6072 55775 DMPR 1
013351,000110: 31,6073 65666 BDSU DMPR
013352,000111: 31,6074 01277 COTGAM
013353,000112: 31,6075 77777 -
013354,000113: 31,6076 77777 -
013355,000114: 31,6077 01275 HMAG
013356,000115: 31,6100 32041 STORE VACX ## VACX = HMAG * ((PD+14D) - (cot(gamma) * (PD+16D)))
013357,000116:
013358,000117: 31,6101 76576 RTB 0
013359,000118: 31,6102 20511 ARCTAN ## PD +14D = atan2(VACZ, VACX)
013360,000119:
013361,000120: 31,6103 76776 ITC 0
013362,000121: 31,6104 22161 PASSTIME ## Get time of flight T in PD +18D, position, and velocity
013363,000122:
013364,000123: 31,6105 73575 LXA,1 1
013365,000124: 31,6106 63535 INCR,1 SXA,1
013366,000125: 31,6107 00070 FIXLOC
013367,000126: 31,6110 00017 14D
013368,000127: 31,6111 00124 PUSHLOC ## Reset PD indicator to 14D
013369,000128:
013370,000129: 31,6112 64774 DMP 2
013371,000130: 31,6113 56631 TSRT ROUND
013372,000131: 31,6114 70776 DAD
013373,000132: 31,6115 00023 18D
013374,000133: 31,6116 07472 EARTHTAB +9D
013375,000134: 31,6117 00005 4
013376,000135: 31,6120 01034 TE
013377,000136: 31,6121 33267 STORE TDEC ## TDEC = TE + T * EARTHTAB
013378,000137:
013379,000138: 31,6122 77576 EXIT 0
013380,000139:
013381,000140: 31,6123 41313 CS FFFLAGS ## Is flag 13 set?
013382,000141: 31,6124 77445 MASK FFLAG13
013383,000142: 31,6125 10000 CCS A
013384,000143: 31,6126 06132 TC +4 ## No: call skip next call
013385,000144:
013386,000145: 31,6127 04000 TC INTPRET ## Flag 13 is set. Call the thing in B-VECTOR
013387,000146: 31,6130 76776 ITC 0
013388,000147: 31,6131 22672 U31,6671 ## In B-VECTOR
013389,000148:
013390,000149: 31,6132 04000 TC INTPRET ## Call LAT-LONG for newly found position
013391,000150: 31,6133 76776 ITC 0
013392,000151: 31,6134 22176 LAT-LONG
013393,000152:
013394,000153: 31,6135 47575 NOLOD 1
013395,000154: 31,6136 65712 BDSU DDV
013396,000155: 31,6137 01257 LONGDES
013397,000156: 31,6140 07474 15/16 ## PD +14D = (LONGDES - LONG)*16/15
013398,000157:
013399,000158: 31,6141 47574 NOLOD 2
013400,000159: 31,6142 65132 ABS DSU
013401,000160: 31,6143 73641 BMN TIX,2 ## Is abs(PD+14D) < 3e-5?
013402,000161: 31,6144 22423 EPSILONG
013403,000162: 31,6145 22150 PASSOUT ## Yes. Skip next call.
013404,000163: 31,6146 22154 NEXTHOP ## Go to U31,6153 if not done iterating.
013405,000164:
013406,000165: 31,6147 72776 PASSOUT STZ 0 ## Result is within bounds. Set NUMBTEMP to 0.
013407,000166: 31,6150 01273 NUMBTEMP
013408,000167:
013409,000168: 31,6151 44576 ITCI 0
013410,000169: 31,6152 01305 STEPEXIT ## Return to caller of LONGPASS
013411,000170:
013412,000171: 31,6153 70776 NEXTHOP DAD 0 ## Result was not within bounds.
013413,000172: 31,6154 01261 DLONG
013414,000173: 31,6155 33261 STORE DLONG ## DLONG = DLONG + (PD+14D) -- popping off of PD
013415,000174:
013416,000175: 31,6156 76776 ITC 0
013417,000176: 31,6157 22036 HOPALONG ## Next iteration.
013418,000177:
013419,000178: 31,6160 47574 PASSTIME NOLOD 2
013420,000179: 31,6161 55666 DMPR DMPR
013421,000180: 31,6162 62776 DDV
013422,000181: 31,6163 00007 6
013423,000182: 31,6164 23401 PI/4.0
013424,000183: 31,6165 01255 ALPHAM
013425,000184: 31,6166 33151 STORE XKEP ## XKEP = (MPAC * |RRECT| * PI/4.0) / ALPHAM
013426,000185:
013427,000186: 31,6167 45576 ITA 0 ## Makes GETRANDV return to caller of PASSTIME
013428,000187: 31,6170 01272 HBRANCH
013429,000188:
013430,000189: 31,6171 76776 ITC 0 ## Calculate time of flight
013431,000190: 31,6172 06146 KTIMEN+1
013432,000191:
013433,000192: 31,6173 76776 ITC 0 ## Get position and velocity at new X
013434,000193: 31,6174 06406 GETRANDV
013435,000194:
013436,000195: 31,6175 47576 LAT-LONG NOLOD 0
013437,000196: 31,6176 33265 STORE LONG ## LONG = TET
013438,000197:
013439,000198: 31,6177 45576 ITA 0
013440,000199: 31,6200 01304 INCORPEX
013441,000200:
013442,000201: 31,6201 72776 STZ 0
013443,000202: 31,6202 00123 OVFIND ## OVFIND = 0
013444,000203:
013445,000204: 31,6203 76776 ITC 0 ## Returns with RCV + TDELTAV in MPAC
013446,000205: 31,6204 22330 GETPOS
013447,000206:
013448,000207: 31,6205 47576 NOLOD 0
013449,000208: 31,6206 33153 STORE ALPHAV ## ALPHAV = RCV + TDELTAV
013450,000209:
013451,000210: 31,6207 51176 DSQ 0
013452,000211: 31,6210 01153 ALPHAV ## PD +0 = ALPHAV[0]**2
013453,000212:
013454,000213: 31,6211 51174 DSQ 2
013455,000214: 31,6212 70653 DAD SQRT
013456,000215: 31,6213 55776 DMPR
013457,000216: 31,6214 01155 ALPHAV +2
013458,000217: 31,6215 77777 - ## Pops off of PD
013459,000218: 31,6216 22421 B2/A2
013460,000219: 31,6217 32041 STORE VACX ## VACX = sqrt(ALPHAV[1]**2 + ALPHAV[0]**2) * B2/A2
013461,000220:
013462,000221: 31,6220 45176 DMOVE 0
013463,000222: 31,6221 01157 ALPHAV +4
013464,000223: 31,6222 32045 STORE VACZ ## VACZ = ALPHAV[2]
013465,000224:
013466,000225: 31,6223 76576 RTB 0
013467,000226: 31,6224 20511 ARCTAN
013468,000227: 31,6225 33263 STORE LAT ## LAT = atan2(VACZ,VACX)
013469,000228:
013470,000229: 31,6226 66774 DSU 2
013471,000230: 31,6227 64716 DMP TSLT
013472,000231: 31,6230 72631 STZ ROUND
013473,000232: 31,6231 01265 LONG
013474,000233: 31,6232 22425 1/100
013475,000234: 31,6233 23403 WEARTH
013476,000235: 31,6234 00004 3
013477,000236: 31,6235 00123 OVFIND ## OVFIND = 0
013478,000237: 31,6236 33161 STORE BETAV ## BETAV[0] = (TET - 1/100)*WEARTH*8
013479,000238:
013480,000239: 31,6237 55176 COS 0
013481,000240: 31,6240 01161 BETAV
013482,000241: 31,6241 33165 STORE BETAV +4 ## BETAV[2] = cos(BETAV[0])
013483,000242:
013484,000243: 31,6242 57176 SIN 0
013485,000244: 31,6243 01161 BETAV
013486,000245: 31,6244 33157 STORE ALPHAV +4 ## ALPHAV[2] = sin(BETAV[0])
013487,000246:
013488,000247: 31,6245 55776 DMPR 0
013489,000248: 31,6246 01153 ALPHAV
013490,000249: 31,6247 01165 BETAV +4 ## PD +0 = ALPHAV[0] * BETAV[2]
013491,000250:
013492,000251: 31,6250 55775 DMPR 1
013493,000252: 31,6251 70776 DAD
013494,000253: 31,6252 01155 ALPHAV +2
013495,000254: 31,6253 01157 ALPHAV +4
013496,000255: 31,6254 32041 STORE VACX ## VACX = (ALPHAV[1] * ALPHAV[2]) + (ALPHAV[0] * BETAV[2])
013497,000256: ## ...popping off of PD list
013498,000257: 31,6255 55776 DMPR 0
013499,000258: 31,6256 01153 ALPHAV
013500,000259: 31,6257 01157 ALPHAV +4 ## PD +0 = ALPHAV[0] * ALPHAV[2]
013501,000260:
013502,000261: 31,6260 55775 DMPR 1
013503,000262: 31,6261 66776 DSU
013504,000263: 31,6262 01155 ALPHAV +2
013505,000264: 31,6263 01165 BETAV +4
013506,000265: 31,6264 32045 STORE VACZ ## VACZ = (ALPHAV[1] * BETAV[2]) - (ALPHAV[0] * ALPHAV[2])
013507,000266: ## ...popping off of PD list
013508,000267: 31,6265 76576 RTB 0
013509,000268: 31,6266 20511 ARCTAN
013510,000269: 31,6267 33265 STORE LONG ## LONG = atan2(VACZ, VACX)
013511,000270:
013512,000271: 31,6270 44576 ITCI 0
013513,000272: 31,6271 01304 INCORPEX
013514,000273:
013515,000274: 31,6272 45576 CALCAZ ITA 0
013516,000275: 31,6273 01303 MIDEXIT
013517,000276:
013518,000277: 31,6274 76776 ITC 0
013519,000278: 31,6275 22330 GETPOS
013520,000279:
013521,000280: 31,6276 47576 NOLOD 0
013522,000281: 31,6277 33153 STORE ALPHAV
013523,000282:
013524,000283: 31,6300 76776 ITC 0
013525,000284: 31,6301 22335 GETVEL
013526,000285:
013527,000286: 31,6302 47576 NOLOD 0
013528,000287: 31,6303 33161 STORE BETAV
013529,000288:
013530,000289: 31,6304 76576 RTB 0
013531,000290: 31,6305 20264 FRESHPD
013532,000291:
013533,000292: 31,6306 41775 VXV 1
013534,000293: 31,6307 41753 VXV UNIT
013535,000294: 31,6310 01153 ALPHAV
013536,000295: 31,6311 23435 UNITZ
013537,000296: 31,6312 01153 ALPHAV
013538,000297:
013539,000298: 31,6313 41773 VXV 3
013540,000299: 31,6314 41753 VXV UNIT
013541,000300: 31,6315 42716 DOT TSLT
013542,000301: 31,6316 61176 ACOS
013543,000302: 31,6317 01153 ALPHAV
013544,000303: 31,6320 01161 BETAV
013545,000304: 31,6321 01153 ALPHAV
013546,000305: 31,6322 77777 -
013547,000306: 31,6323 00002 1
013548,000307: 31,6324 33271 STORE AZ
013549,000308:
013550,000309: 31,6325 44576 ITCI 0
013551,000310: 31,6326 01303 MIDEXIT
013552,000311:
013553,000312: 31,6327 45775 GETPOS VSRT 1
013554,000313: 31,6330 50601 VAD ITCQ
013555,000314: 31,6331 01115 TDELTAV
013556,000315: 31,6332 00013 10D
013557,000316: 31,6333 01131 RCV
013558,000317:
013559,000318: 31,6334 45775 GETVEL VSRT 1
013560,000319: 31,6335 50601 VAD ITCQ
013561,000320: 31,6336 01123 TNUV
013562,000321: 31,6337 00011 8D
013563,000322: 31,6340 01137 VCV
013564,000323:
013565,000324: 31,6341 45576 GETERAD ITA 0
013566,000325: 31,6342 01303 MIDEXIT
013567,000326:
013568,000327: 31,6343 71172 ABVAL 4
013569,000328: 31,6344 63706 TSLT BDDV
013570,000329: 31,6345 51072 DSQ TSRT
013571,000330: 31,6346 65666 BDSU DMPR
013572,000331: 31,6347 65706 BDSU BDDV
013573,000332: 31,6350 01153 ALPHAV
013574,000333: 31,6351 00002 1
013575,000334: 31,6352 01157 ALPHAV +4
013576,000335: 31,6353 00002 1
013577,000336: 31,6354 07506 DP1/2
013578,000337: 31,6355 22415 EE
013579,000338: 31,6356 07506 DP1/2
013580,000339: 31,6357 22417 B2XSC
013581,000340: 31,6360 33237 STORE ERADSQ/4
013582,000341:
013583,000342: 31,6361 47575 NOLOD 1
013584,000343: 31,6362 53176 SQRT
013585,000344: 31,6363 33241 STORE ERAD/2
013586,000345:
013587,000346: 31,6364 44576 ITCI 0
013588,000347: 31,6365 01303 MIDEXIT
013589,000348:
013590,000349: 31,6366 76776 U31,6366 ITC 0 ## B-Vector calls this
013591,000350: 31,6367 22373 ORBPARM
013592,000351:
013593,000352: 31,6370 76776 ITC 0
013594,000353: 31,6371 22061 HOP1
013595,000354:
013596,000355: 31,6372 41775 ORBPARM VXV 1
013597,000356: 31,6373 71116 ABVAL TSLT
013598,000357: 31,6374 01101 RRECT
013599,000358: 31,6375 01107 VRECT
013600,000359: 31,6376 00002 1
013601,000360: 31,6377 33275 STORE HMAG ## HMAG = |RRECT x VRECT|
013602,000361:
013603,000362: 31,6400 53175 SQRT 1
013604,000363: 31,6401 64776 DMP
013605,000364: 31,6402 00013 10D ## ALPHAM = SQRT(ALPHA) * |RRECT|
013606,000365: 31,6403 00007 6
013607,000366: 31,6404 33255 STORE ALPHAM
013608,000367:
013609,000368: 31,6405 42775 DOT 1
013610,000369: 31,6406 62776 DDV
013611,000370: 31,6407 01101 RRECT ## (RRECT . VRECT)
013612,000371: 31,6410 01107 VRECT ## ---------------
013613,000372: 31,6411 01275 HMAG ## |RRECT x VRECT|
013614,000373: 31,6412 33277 STORE COTGAM ## COTGAM = cot(gamma)
013615,000374:
013616,000375: 31,6413 40576 ITCQ 0
013617,000376:
013618,000377: 31,6414 00155 25220 EE 2DEC 6.69342279 E-3
013619,000378: 31,6416 00464 11320 B2XSC 2DEC 0.01881677
013620,000379: 31,6420 37622 12560 B2/A2 2DEC 0.993306577
013621,000380: 31,6422 00000 17565 EPSILONG 2DEC .3 E-4
013622,000381: 31,6424 00243 32703 1/100 2DEC .01
End of include-file LATITUDE-LONGITUDE_SUBROUTINES.agc. Parent file is MAIN.agc