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,1969Note that the date is the date of the printout, not the date of the program revision. |
053804,000002: ## Copyright: Public domain.
053805,000003: ## Filename: LATITUDE_LONGITUDE_SUBROUTINES.agc
053806,000004: ## Purpose: Part of the source code for Colossus 2A, AKA Comanche 055.
053807,000005: ## It is part of the source code for the Command Module's (CM)
053808,000006: ## Apollo Guidance Computer (AGC), for Apollo 11.
053809,000007: ## Assembler: yaYUL
053810,000008: ## Contact: Ron Burkey <info@sandroid.org>.
053811,000009: ## Website: www.ibiblio.org/apollo.
053812,000010: ## Pages: 1236-1242
053813,000011: ## Mod history: 2009-05-14 RSB Adapted from the Colossus249/ file of the
053814,000012: ## same name, using Comanche055 page images.
053815,000013: ## 2010-08-20 JL Fixed indentation of RVQ opcode on line 180.
053816,000014: ## 2016-12-21 RSB Proofed comment text using octopus/ProoferComments
053817,000015: ## and corrected the errors found.
053818,000016: ## 2017-02-05 RSB Back-ported comment corrections
053819,000017: ## identified while proofing Artemis 072.
053820,000018: ## 2017-03-15 RSB Comment-text fixes identified in 5-way
053821,000019: ## side-by-side diff of Luminary 69/99/116/131/210.
053822,000020:
053823,000021: ## This source code has been transcribed or otherwise adapted from digitized
053824,000022: ## images of a hardcopy from the MIT Museum. The digitization was performed
053825,000023: ## by Paul Fjeld, and arranged for by Deborah Douglas of the Museum. Many
053826,000024: ## thanks to both. The images (with suitable reduction in storage size and
053827,000025: ## consequent reduction in image quality as well) are available online at
053828,000026: ## www.ibiblio.org/apollo. If for some reason you find that the images are
053829,000027: ## illegible, contact me at info@sandroid.org about getting access to the
053830,000028: ## (much) higher-quality images which Paul actually created.
053831,000029: ##
053832,000030: ## Notations on the hardcopy document read, in part:
053833,000031: ##
053834,000032: ## Assemble revision 055 of AGC program Comanche by NASA
053835,000033: ## 2021113-051. 10:28 APR. 1, 1969
053836,000034: ##
053837,000035: ## This AGC program shall also be referred to as
053838,000036: ## Colossus 2A
053839,000037:
Page 1236 |
053841,000039: # SUBROUTINE TO CONVERT RAD VECTOR AT GIVEN TIME TO LAT,LONG AND ALT
053842,000040:
053843,000041: # CALLING SEQUENCE
053844,000042: # L-1 CALL
053845,000043: # L LAT-LONG
053846,000044:
053847,000045: # SUBROUTINES USED
053848,000046: # R-TO-RP, ARCTAN, SETGAMMA, SETRE
053849,000047:
053850,000048: # ERASABLE INIT. REQ.
053851,000049: # AXO, -AYO, AZO, TEPHEM (SET AT LAUNCH TIME)
053852,000050: # ALPHAV = POSITION VECTOR METERS B-29
053853,000051: # MPAC -- TIME (CSECS B-28)
053854,000052: # ERADFLAG =1, TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
053855,000053: # LUNAFLAG=0 FOR EARTH, 1 FOR MOON
053856,000054:
053857,000055: # OUTPUT
053858,000056: # LATITUDE IN LAT (REVS. B-0)
053859,000057: # LONGITUDE IN LONG (REVS. B-0)
053860,000058: # ALTITUDE IN ALT METERS B-29
053861,000059:
053862,000060: 30,3750 BANK 30
053863,000061: 13,2000 SETLOC LATLONG
053864,000062: 13,2000 BANK
053865,000063:
053866,000064: 13,2370 COUNT 13/LT-LG
053867,000065:
053868,000066: 13,2370 E4,1551 EBANK= ALPHAV
053869,000067: 13,2370 40220 LAT-LONG STQ SETPD
053870,000068: 13,2371 02242 INCORPEX
053871,000069: 13,2372 00001 0D
053872,000070: 13,2373 24007 STOVL 6D # SAVE TIME IN 6-7D FOR R-TO-RP
053873,000071: 13,2374 02152 ALPHAV
053874,000072: 13,2375 51406 PUSH ABVAL # 0-5D= R FOR R-TO-RP
053875,000073: 13,2376 16310 STODL ALPHAM # ABS. VALUE OF R FOR ALT FORMULA BELOW
053876,000074: 13,2377 11566 ZEROVEC # SET MPAC=0 FOR EARTH, NON-ZERO FOR MOON
053877,000075: 13,2400 71414 BOFF COS # USE COS(0) TO GET NON-ZERO IN MPAC
053878,000076: 13,2401 01743 LUNAFLAG # 0=EARTH, 1=MOON
053879,000077: 13,2402 26403 CALLRTRP
053880,000078: 13,2403 77624 CALLRTRP CALL
053881,000079: 13,2404 55371 R-TO-RP # RP VECTOR CONVERTED FROM R B-29
053882,000080: 13,2405 77656 UNIT # UNIT RP B-1
053883,000081: 13,2406 36152 STCALL ALPHAV # U2= 1/2 SINL FOR SETRE SUBR BELOW
053884,000082: 13,2407 26571 SETGAMMA # SET GAMMA=B2/A2 FOR EARTH, =1 FOR MOON
053885,000083: 13,2410 77624 CALL # SCALED B-1
053886,000084: 13,2411 26601 SETRE # CALC RE METERS B-29
053887,000085: 13,2412 63545 DLOAD DSQ
053888,000086: 13,2413 02152 ALPHAV
053889,000087: 13,2414 63525 PDDL DSQ
053890,000088: 13,2415 02154 ALPHAV +2
Page 1237 |
053892,000090: 13,2416 75415 DAD SQRT
053893,000091: 13,2417 76405 DMP SL1R
053894,000092: 13,2420 00011 GAMRP
053895,000093: 13,2421 14021 STODL COSTH # COS(LAT) B-1
053896,000094: 13,2422 02156 ALPHAV +4
053897,000095: 13,2423 34023 STCALL SINTH # SIN(LAT) B-1
053898,000096: 13,2424 26531 ARCTAN
053899,000097: 13,2425 15104 STODL LAT # LAT B0
053900,000098: 13,2426 02152 ALPHAV
053901,000099: 13,2427 14021 STODL COSTH # COS(LONG) B-1
053902,000100: 13,2430 02154 ALPHAV +2
053903,000101: 13,2431 34023 STCALL SINTH # SIN(LONG) B-1
053904,000102: 13,2432 26531 ARCTAN
053905,000103: 13,2433 15106 STODL LONG # LONG. REVS B-0 IN RANGE -1/2 TO 1/2
053906,000104: 13,2434 02310 ALPHAM
053907,000105: 13,2435 77625 DSU # ALT= R-RE METERS B-29
053908,000106: 13,2436 02241 ERADM
053909,000107: 13,2437 35110 STCALL ALT # EXIT WITH ALT METERS B-29
053910,000108: 13,2440 02242 INCORPEX
Page 1238 |
053912,000110: # SUBROUTINE TO CONVERT LAT,LONG,ALT AT GIVEN TIME TO RADIUS VECTOR
053913,000111:
053914,000112: # CALLING SEQUENCE
053915,000113: # L-1 CALL
053916,000114: # L LALOTORV
053917,000115:
053918,000116: # SUBROUTINES USED
053919,000117: # SETGAMMA, SETRE, RP-TO-R
053920,000118:
053921,000119: # ERASABLE INIT. REQ.
053922,000120: # AXO, AYO, AZO, TEPHEM SET AT LAUNCH TIME
053923,000121: # LAT -- LATITUDE (REVS B0)
053924,000122: # LONG -- LONGITUDE (REVS B0)
053925,000123: # ALT -- ALTITUDE (METERS) B-29
053926,000124: # MPAC -- TIME (CSECS B-28)
053927,000125: # ERADFLAG =1 TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
053928,000126: # LUNAFLAG=0 FOR EARTH, 1 FOR MOON
053929,000127:
053930,000128: # OUTPUT
053931,000129: # R-VECTOR IN ALPHAV (METERS B-29)
053932,000130:
053933,000131: 13,2441 40220 LALOTORV STQ SETPD # LAT,LONG,ALT TO R VECTOR
053934,000132: 13,2442 02242 INCORPEX
053935,000133: 13,2443 00001 0D
053936,000134: 13,2444 34007 STCALL 6D # 6-7D = TIME FOR RP-TO-R
053937,000135: 13,2445 26571 SETGAMMA # GAMMA = B2/A2 FOR EARTH, 1 FOR MOON B-1
053938,000136: 13,2446 73545 DLOAD SIN # COS(LONG)COS(LAT) IN MPAC
053939,000137: 13,2447 01104 LAT # UNIT RP = SIN(LONG)COS(LAT) 2-3D
053940,000138: 13,2450 65275 DMPR PDDL # PD 2 GAMMA*SIN(LAT) 0-1D
053941,000139: 13,2451 00011 GAMRP
053942,000140: 13,2452 01104 LAT # 0-1D = GAMMA*SIN(LAT) B-2
053943,000141: 13,2453 65346 COS PDDL # PD4 2-3D= COS(LAT) B-1 TEMPORARILY
053944,000142: 13,2454 01106 LONG
053945,000143: 13,2455 57356 SIN DMPR # PD 2
053946,000144: 13,2456 71525 PDDL COS # PD 4 2-3D= SIN(LONG)COS(LAT) B-2
053947,000145: 13,2457 01104 LAT
053948,000146: 13,2460 71525 PDDL COS # PD 6 4-5D= COS(LAT) B-1 TEMPORARILY
053949,000147: 13,2461 01106 LONG
053950,000148: 13,2462 55475 DMPR VDEF # PD4 MPAC = COS(LONG)COS(LAT) B-2
053951,000149: 13,2463 41456 UNIT PUSH # 0-5D = UNIT RP FOR RP-TO-R SUBR.
053952,000150: 13,2464 36152 STCALL ALPHAV # ALPHAV +4= SINL FOR SETRE SUBR.
053953,000151: 13,2465 26601 SETRE # RE METERS B-29
053954,000152: 13,2466 43145 DLOAD BOFF # SET MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
053955,000153: 13,2467 11566 ZEROVEC
053956,000154: 13,2470 01743 LUNAFLAG
053957,000155: 13,2471 26473 CALLRPRT
053958,000156: 13,2472 77746 COS # USE COS(0) TO GET NON-ZERO IN MPAC
053959,000157: 13,2473 77624 CALLRPRT CALL
053960,000158: 13,2474 55344 RP-TO-R # EXIT WITH UNIT R VECTOR IN MPAC
053961,000159: 13,2475 16152 STODL ALPHAV
053962,000160: 13,2476 02241 ERADM
Page 1239 |
053964,000162: 13,2477 74215 DAD VXSC # (RE + ALT)(UNIT R) METERS B-30
053965,000163: 13,2500 01110 ALT
053966,000164: 13,2501 02152 ALPHAV
053967,000165: 13,2502 77772 VSL1 # R METERS B-29
053968,000166: 13,2503 36152 STCALL ALPHAV # EXIT WITH R IN METERS B-29
053969,000167: 13,2504 02242 INCORPEX
053970,000168:
053971,000169: # SUBROUTINE TO COMPUTE EARTH RADIUS
053972,000170:
053973,000171: # INPUT
053974,000172: # 1/2 SIN LAT IN ALPHAV +4
053975,000173:
053976,000174: # OUTPUT
053977,000175: # EARTH RADIUS IN ERADM AND MPAC (METERS B-29)
053978,000176:
053979,000177: 13,2505 63545 GETERAD DLOAD DSQ
053980,000178: 13,2506 02156 ALPHAV +4 # SIN**2(L)
053981,000179: 13,2507 44352 SL1 BDSU
053982,000180: 13,2510 11564 DP1/2 # COS**2(L)
053983,000181: 13,2511 44275 DMPR BDSU
053984,000182: 13,2512 26526 EE
053985,000183: 13,2513 11564 DP1/2
053986,000184: 13,2514 75465 BDDV SQRT
053987,000185: 13,2515 26522 B2XSC
053988,000186: 13,2516 77622 SR4R
053989,000187: 13,2517 02241 STORE ERADM
053990,000188: 13,2520 77616 RVQ
053991,000189:
053992,000190: # THE FOLLOWING CONSTANTS WERE COMPUTED WITH A=6378166, B=6356784 METERS
053993,000191: # B2XSC = B**2 SCALED B-51
053994,000192: # B2/A2 = B**2/A**2 SCALED B-1
053995,000193: # EE = (1-B**2/A**2) SCALED B-0
053996,000194:
053997,000195: 13,2521 00446 00305 B2XSC 2DEC .0179450689 # B**2 SCALED B-51
053998,000196:
053999,000197: 13,2523 04,3563 DP1/2 = XUNIT
054000,000198: 13,2523 17711 05254 B2/A2 2DEC .9933064884 B-1 # GAMMA= B**2/A**2 B-1
054001,000199:
054002,000200: 13,2525 00155 25250 EE 2DEC 6.6935116 E-3 # (1-B**2/A**2) B-0
054003,000201:
054004,000202: 13,2527 00302 17755 ERAD 2DEC 6373338 B-29 # PAD RADIUS
054005,000203:
Page 1240 |
054007,000205: # ARCTAN SUBROUTINE
054008,000206:
054009,000207: # CALLING SEQUENCE
054010,000208: # SIN THETA IN SINTH B-1
054011,000209: # COS THETA IN COSTH B-1
054012,000210: # CALL ARCTAN
054013,000211:
054014,000212: # OUTPUT
054015,000213: # ARCTAN THETA IN MPAC AND THETA B-0 IN RANGE -1/2 TO +1/2
054016,000214:
054017,000215: 13,2531 77600 ARCTAN BOV
054018,000216: 13,2532 26533 CLROVFLW
054019,000217: 13,2533 63545 CLROVFLW DLOAD DSQ
054020,000218: 13,2534 00023 SINTH
054021,000219: 13,2535 63525 PDDL DSQ
054022,000220: 13,2536 00021 COSTH
054023,000221: 13,2537 77615 DAD
054024,000222: 13,2540 75454 BZE SQRT
054025,000223: 13,2541 26557 ARCTANXX # ATAN=0/0 SET THETA=0
054026,000224: 13,2542 40065 BDDV BOV
054027,000225: 13,2543 00023 SINTH
054028,000226: 13,2544 26564 ATAN=90
054029,000227: 13,2545 67542 SR1 ASIN
054030,000228: 13,2546 00025 STORE THETA
054031,000229: 13,2547 50125 PDDL BMN
054032,000230: 13,2550 00021 COSTH
054033,000231: 13,2551 26553 NEGCOS
054034,000232: 13,2552 43545 DLOAD RVQ
054035,000233: 13,2553 57545 NEGCOS DLOAD DCOMP
054036,000234: 13,2554 43244 BPL DAD
054037,000235: 13,2555 26561 NEGOUT
054038,000236: 13,2556 11564 DP1/2
054039,000237: 13,2557 00025 ARCTANXX STORE THETA
054040,000238: 13,2560 77616 RVQ
054041,000239:
054042,000240: 13,2561 52025 NEGOUT DSU GOTO
054043,000241: 13,2562 11564 DP1/2
054044,000242: 13,2563 26557 ARCTANXX
054045,000243: 13,2564 75345 ATAN=90 DLOAD SIGN
054046,000244: 13,2565 11612 LODP1/4
054047,000245: 13,2566 00023 SINTH
054048,000246: 13,2567 00025 STORE THETA
054049,000247: 13,2570 77616 RVQ
054050,000248:
054051,000249: 13,2571 04,3565 2DZERO = DPZERO
054052,000250:
Page 1241 |
054054,000252: # ..... SETGAMMA SUBROUTINE .....
054055,000253: # SUBROUTINE TO SET GAMMA FOR THE LAT-LONG AND LALOTORV SUBROUTINES
054056,000254:
054057,000255: # GAMMA = B**2/A**2 FOR EARTH (B-1)
054058,000256: # GAMMA = 1 FOR MOON (B-1)
054059,000257:
054060,000258: # CALLING SEQUENCE
054061,000259: # L CALL
054062,000260: # L+1 SETGAMMA
054063,000261:
054064,000262: # INPUT
054065,000263: # LUNAFLAG=0 FOR EARTH, =1 FOR MOON
054066,000264:
054067,000265: # OUTPUT
054068,000266: # GAMMA IN GAMRP (B-1)
054069,000267:
054070,000268: 13,2571 43145 SETGAMMA DLOAD BOFF # BRANCH FOR EARTH
054071,000269: 13,2572 26524 B2/A2 # EARTH GAMMA
054072,000270: 13,2573 01743 LUNAFLAG
054073,000271: 13,2574 26577 SETGMEX
054074,000272: 13,2575 77735 SLOAD
054075,000273: 13,2576 11564 1B1 # MOON GAMMA
054076,000274: 13,2577 00011 SETGMEX STORE GAMRP
054077,000275: 13,2600 77616 RVQ
054078,000276: 13,2601 GAMRP = 8D
054079,000277:
Page 1242 |
054081,000279: # ..... SETRE SUBROUTINE .....
054082,000280: # SUBROUTINE TO SET RE (EARTH OR MOON RADIUS)
054083,000281:
054084,000282: # RE = RM FOR MOON
054085,000283: # RE = RREF FOR FIXED EARTH RADIUS OR COMPUTED RF FOR FISCHER ELLIPSOID
054086,000284:
054087,000285: # CALLING SEQUENCE
054088,000286: # L CALL
054089,000287: # L+1 SETRE
054090,000288:
054091,000289: # SUBROUTINES USED
054092,000290: # GETERAD
054093,000291:
054094,000292: # INPUT
054095,000293: # ERADFLAG = 0 FOR FIXED RE, 1 FOR COMPUTED RE
054096,000294: # ALPHAV +4 = 1/2 SINL IF GETERAD IS CALLED
054097,000295: # LUNAFLAG = 0 FOR EARTH, =1 FOR MOON
054098,000296:
054099,000297: # OUTPUT
054100,000298: # ERADM = 504RM FOR MOON (METERS B-29)
054101,000299: # ERADM = ERAD OR COMPUTED RF FOR EARTH (METERS B-29)
054102,000300:
054103,000301: 13,2601 71220 SETRE STQ DLOAD
054104,000302: 13,2602 00051 SETREX
054105,000303: 13,2603 26626 504RM
054106,000304: 13,2604 71214 BON DLOAD # BRANCH FOR MOON
054107,000305: 13,2605 01703 LUNAFLAG
054108,000306: 13,2606 26616 TSTRLSRM
054109,000307: 13,2607 26530 ERAD
054110,000308: 13,2610 45014 BOFF CALL # ERADFLAG=0 FOR FIXED RE, 1 FOR COMPUTED
054111,000309: 13,2611 00742 ERADFLAG
054112,000310: 13,2612 26614 SETRXX
054113,000311: 13,2613 26505 GETERAD
054114,000312: 13,2614 36241 SETRXX STCALL ERADM # EXIT WITH RE OR RM METERS B-29
054115,000313: 13,2615 00051 SETREX
054116,000314: 13,2616 77214 TSTRLSRM BON VLOAD # ERADFLAG=0, SET R0=RLS
054117,000315: 13,2617 00702 ERADFLAG # =1 R0=RM
054118,000316: 13,2620 26614 SETRXX
054119,000317: 13,2621 02026 RLS
054120,000318: 13,2622 64446 ABVAL SR2R # SCALE FROM B-27 TO B-29
054121,000319: 13,2623 77650 GOTO
054122,000320: 13,2624 26614 SETRXX
054123,000321: 13,2625 0000051 SETREX = S2
054124,000322: 13,2625 00065 01265 504RM 2DEC 1738090 B-29 # METERS B-29 (MOON RADIUS)
054125,000323:
054126,000324:
054127,000325:
054128,000326:
End of include-file LATITUDE_LONGITUDE_SUBROUTINES.agc. Parent file is MAIN.agc