Source Code
This is the source-code for the Apollo 9 Command Module's Guidance Computer.
These files were derived originally from the scan from MIT's Dibner Institute's
now-discontinued website titled "History of Recent Science and Technology", which
in turn was originally created by Gary Neff, though his high-quality scans were
unfortunately reduced in legibility when presented online.
The markings on the front of the
printout imply that it was the original AGC developer Norm Brodeur's copy.
A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original
AGC developer Fred Martin. The source code was transcribed from
those images by Ron Burkey. 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:ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041 20'35 OCT. 28,1968Note that the date is the date of the printout, not the date of the program revision. |
060534,000002: ## Copyright: Public domain.
060535,000003: ## Filename: RESTARTS_ROUTINE.agc
060536,000004: ## Purpose: Part of the source code for Colossus, build 249.
060537,000005: ## It is part of the source code for the Command Module's (CM)
060538,000006: ## Apollo Guidance Computer (AGC), for Apollo 9.
060539,000007: ## Assembler: yaYUL
060540,000008: ## Reference: Starts on p. 1382
060541,000009: ## Contact: Ron Burkey <info@sandroid.org>.
060542,000010: ## Website: www.ibiblio.org/apollo.
060543,000011: ## Mod history: 08/30/04 RSB. Adapted from corresponding Luminary131 file.
060544,000012: ## 2010-10-24 JL Added missing # in comment.
060545,000013: ## 2017-01-06 RSB Page numbers now agree with those on the
060546,000014: ## original harcopy, as opposed to the PDF page
060547,000015: ## numbers in 1701.pdf.
060548,000016: ## 2017-01-18 RSB Cross-diff'd comment text (not whitespace)
060549,000017: ## vs the already-proofed corresponding Colossus
060550,000018: ## 237 and Comanche 55 source-code files
060551,000019: ## and corrected errors found.
060552,000020: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
060553,000021:
060554,000022: ## The contents of the "Colossus249" files, in general, are transcribed
060555,000023: ## from a scanned copy of the program listing. Notations on this
060556,000024: ## document read, in part:
060557,000025: ##
060558,000026: ## Assemble revision 249 of AGC program Colossus by NASA
060559,000027: ## 2021111-041. October 28, 1968.
060560,000028: ##
060561,000029: ## This AGC program shall also be referred to as
060562,000030: ## Colossus 1A
060563,000031: ##
060564,000032: ## Prepared by
060565,000033: ## Massachusetts Institute of Technology
060566,000034: ## 75 Cambridge Parkway
060567,000035: ## Cambridge, Massachusetts
060568,000036: ## under NASA contract NAS 9-4065.
060569,000037: ##
060570,000038: ## Refer directly to the online document mentioned above for further information.
060571,000039: ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
060572,000040: ##
060573,000041: ## In some cases, where the source code for Luminary 131 overlaps that of
060574,000042: ## Colossus 249, this code is instead copied from the corresponding Luminary 131
060575,000043: ## source file, and then is proofed to incorporate any changes.
060576,000044: ## source file, and then is proofed to incorporate any changes.
060577,000045:
Page 1382 |
060579,000047: 01,3520 BANK 01
060580,000048: 01,2000 SETLOC RESTART
060581,000049: 01,2000 BANK
060582,000050:
060583,000051: 01,3520 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
060584,000052:
060585,000053: 01,3520 COUNT 01/RSROU
060586,000054:
060587,000055: 01,3520 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
060588,000056: 01,3521 60000 DOUBLE # SAVE FOR INDEXING
060589,000057: 01,3522 54155 TS TEMP2G
060590,000058:
060591,000059: 01,3523 33762 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
060592,000060: 01,3524 54157 TS TEMPSWCH # TABLE PHASE
060593,000061:
060594,000062: 01,3525 33557 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
060595,000063: 01,3526 54707 TS GOLOC +2 # GROUP AFTER THIS
060596,000064:
060597,000065: 01,3527 30154 CA TEMPPHS
060598,000066: 01,3530 74744 MASK OCT1400
060599,000067: 01,3531 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
060600,000068: 01,3532 13543 TCF ITSAVAR # IT:S A VARIABLE RESTART
060601,000069:
060602,000070: 01,3533 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
060603,000071: 01,3534 10000 CCS A
060604,000072: 01,3535 13643 TCF ITSATBL # NO, ITS A TABLE RESTART
060605,000073:
060606,000074: 01,3536 34761 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
060607,000075: 01,3537 05042 TC FINDVAC # THE DISPLAY RESTART JOB
060608,000076: 01,3540 E3,1400 EBANK= LST1
060609,000077: 01,3540 03165 20103 2CADR INITDSP
060610,000078:
060611,000079: 01,3542 03557 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
060612,000080:
060613,000081: 01,3543 74744 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
060614,000082: 01,3544 10000 CCS A
060615,000083: 01,3545 13614 TCF ITSLIKEB # YES, IT IS TYPE B
060616,000084:
060617,000085: 01,3546 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
060618,000086: 01,3547 50155 NDX TEMP2G
060619,000087: 01,3550 31437 DCA PHSNAME1
060620,000088: 01,3551 52706 DXCH GOLOC
060621,000089:
060622,000090: 01,3552 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
060623,000091: 01,3553 74716 MASK OCT7
060624,000092: 01,3554 67715 AD MINUS2
060625,000093: 01,3555 10000 CCS A
060626,000094: 01,3556 13726 TCF ITSLNGCL # ITS A LONGCALL
060627,000095:
Page 1383 |
060629,000097: 01,3557 04570 RTRNCADR TC SWRETURN # CANT GET HERE
060630,000098: 01,3560 13562 TCF ITSAWAIT
060631,000099:
060632,000100: 01,3561 13627 TCF ITSAJOB # ITS A JOB
060633,000101:
060634,000102: 01,3562 33766 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
060635,000103: 01,3563 54704 TS GOLOC -1
060636,000104:
060637,000105: 01,3564 50155 NDX TEMP2G # DIRECTLY STORED
060638,000106: 01,3565 31054 CA PHSPRDT1
060639,000107: 01,3566 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
060640,000108: 01,3567 24000 INCR A # NO,
060641,000109: 01,3570 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060642,000110:
060643,000111: 01,3571 15367 TCF ITSINDIR # STORED INDIRECTLY
060644,000112:
060645,000113: 01,3572 13612 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
060646,000114:
060647,000115: # ***** THIS MUST BE IN FIXED FIXED *****
060648,000116:
060649,000117: 5367 BLOCK 02
060650,000118: 4000 SETLOC FFTAG2
060651,000119: 4000 BANK
060652,000120:
060653,000121: 5367 COUNT 02/RSROU
060654,000122:
060655,000123: 5367 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
060656,000124: 5370 22006 LXCH BB # SWITCHED ERRASIBLE
060657,000125:
060658,000126: 5371 50000 NDX A # GET THE TIME INDIRECTLY
060659,000127: 5372 30001 CA 1
060660,000128:
060661,000129: 5373 22006 LXCH BB # RESTORE THE BB AND GOLOC
060662,000130: 5374 22706 LXCH GOLOC +1
060663,000131:
060664,000132: 5375 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060665,000133:
060666,000134: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060667,000135:
060668,000136: 01,3573 BANK 01
060669,000137: 01,2000 SETLOC RESTART
060670,000138: 01,2000 BANK
060671,000139:
060672,000140: 01,3573 COUNT 01/RSROU
060673,000141:
060674,000142: 01,3573 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
060675,000143: 01,3574 54001 TS L # AND SAVE
060676,000144: 01,3575 50155 NDX TEMP2G
060677,000145: 01,3576 41053 CS TBASE1
060678,000146: 01,3577 00006 EXTEND
Page 1384 |
060680,000148: 01,3600 60025 SU TIME1
060681,000149: 01,3601 10000 CCS A
060682,000150: 01,3602 40000 COM
060683,000151: 01,3603 67700 AD OCT37776
060684,000152: 01,3604 64712 AD ONE
060685,000153: 01,3605 60001 AD L
060686,000154: 01,3606 10000 CCS A
060687,000155: 01,3607 34714 CA ZERO
060688,000156: 01,3610 13612 TCF +2
060689,000157: 01,3611 13612 TCF +1
060690,000158: 01,3612 64712 IMEDIATE AD ONE
060691,000159: 01,3613 00704 TC GOLOC -1
060692,000160: 01,3614 33557 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
060693,000161: 01,3615 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
060694,000162:
060695,000163: 01,3616 33763 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
060696,000164: 01,3617 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
060697,000165:
060698,000166: 01,3620 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
060699,000167: 01,3621 76043 MASK OCT177 # PART OF THIS VARIABLE PHASE
060700,000168: 01,3622 54154 TS TEMPPHS
060701,000169:
060702,000170: 01,3623 00006 EXTEND
060703,000171: 01,3624 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
060704,000172: 01,3625 31437 DCA PHSNAME1
060705,000173: 01,3626 52706 DXCH GOLOC
060706,000174:
060707,000175: 01,3627 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
060708,000176: 01,3630 31054 CA PHSPRDT1
060709,000177: 01,3631 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
060710,000178: 01,3632 00006 EXTEND # A FINDVAC OR A NOVAC
060711,000179: 01,3633 63637 BZMF ITSNOVAC
060712,000180:
060713,000181: 01,3634 33765 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
060714,000182: 01,3635 56704 XCH GOLOC -1 # PICK UP PRIO,
060715,000183: 01,3636 00704 TC GOLOC -1 # AND GO
060716,000184:
060717,000185: 01,3637 33767 ITSNOVAC CAF NOVACADR # NEGATIVE,
060718,000186: 01,3640 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
060719,000187: 01,3641 40000 COM # CORRECT PRIO,
060720,000188: 01,3642 00704 TC GOLOC -1 # AND GO
060721,000189:
060722,000190: 01,3643 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
060723,000191: 01,3644 10020 CCS CYR
060724,000192: 01,3645 13646 TCF +1 # IT:S EVEN
060725,000193: 01,3646 13744 TCF ITSEVEN
060726,000194:
060727,000195: 01,3647 33557 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
060728,000196: 01,3650 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
Page 1385 |
060730,000198: 01,3651 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
060731,000199: 01,3652 54021 TS SR # THE RESTART TABLES
060732,000200: 01,3653 60021 AD SR
060733,000201: 01,3654 50155 NDX TEMP2G
060734,000202: 01,3655 62001 AD SIZETAB +1
060735,000203: 01,3656 54156 TS POINTER
060736,000204:
060737,000205: 01,3657 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
060738,000206: 01,3660 50156 NDX POINTER
060739,000207: 01,3661 32002 DCA CADRTAB # GET THE 2CADR
060740,000208:
060741,000209: 01,3662 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
060742,000210:
060743,000211: 01,3663 10000 CCS A # IS IT A JOB OR IS IT TIMED
060744,000212: 01,3664 24000 INCR A # POSITIVE, MUST BE A JOB
060745,000213: 01,3665 13740 TCF ITSAJOB2
060746,000214:
060747,000215: 01,3666 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
060748,000216: 01,3667 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
060749,000217:
060750,000218: 01,3670 33766 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
060751,000219: 01,3671 54704 TS GOLOC -1
060752,000220:
060753,000221: 01,3672 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
060754,000222: 01,3673 74701 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
060755,000223: 01,3674 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
060756,000224: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
060757,000225: # IN IMPORTANCE ANYWAY. BIT 4
060758,000226: 01,3675 13733 TCF ITSWTLST # IT IS A WAITLIST CALL
060759,000227:
060760,000228: 01,3676 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
060761,000229: 01,3677 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
060762,000230:
060763,000231: 01,3700 15376 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
060764,000232:
060765,000233: # ***** THIS MUST BE IN FIXED FIXED *****
060766,000234:
060767,000235: 5376 BLOCK 02
060768,000236: 4000 SETLOC FFTAG2
060769,000237: 4000 BANK
060770,000238:
060771,000239: 5376 COUNT 02/RSROU
060772,000240:
060773,000241: 5376 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
060774,000242: 5377 22006 LXCH BB
060775,000243: 5400 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
060776,000244:
060777,000245: 5401 00006 EXTEND # GET THE DELTA TIME
060778,000246: 5402 50000 NDX A
060779,000247: 5403 30001 DCA 0
Page 1386 |
060781,000249: 5404 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
060782,000250: 5405 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
060783,000251: 5406 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
060784,000252: 5407 13701 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
060785,000253:
060786,000254: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060787,000255:
060788,000256: 01,3701 BANK 01
060789,000257: 01,2000 SETLOC RESTART
060790,000258: 01,2000 BANK
060791,000259:
060792,000260: 01,3701 COUNT 01/RSROU
060793,000261: 01,3701 53140 ITSLGCL2 DXCH LONGTIME
060794,000262:
060795,000263: 01,3702 00006 EXTEND # CALCULATE TIME LEFT
060796,000264: 01,3703 40025 DCS TIME2
060797,000265: 01,3704 21140 DAS LONGTIME
060798,000266: 01,3705 00006 EXTEND
060799,000267: 01,3706 31136 DCA LONGBASE
060800,000268: 01,3707 21140 DAS LONGTIME
060801,000269:
060802,000270: 01,3710 11137 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
060803,000271: 01,3711 13721 TCF LONGCLCL
060804,000272: 01,3712 13714 TCF +2
060805,000273: 01,3713 13607 TCF IMEDIATE -3
060806,000274: 01,3714 11140 CCS LONGTIME +1
060807,000275: 01,3715 13721 TCF LONGCLCL
060808,000276: 01,3716 13717 NOOP # CAN:T GET HERE *********
060809,000277: 01,3717 13607 TCF IMEDIATE -3
060810,000278: 01,3720 13612 TCF IMEDIATE
060811,000279:
060812,000280: 01,3721 33764 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
060813,000281: 01,3722 54704 TS GOLOC -1
060814,000282:
060815,000283: 01,3723 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
060816,000284: 01,3724 31140 DCA LONGTIME
060817,000285: 01,3725 00704 TC GOLOC -1
060818,000286:
060819,000287: 01,3726 33766 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
060820,000288: 01,3727 54704 TS GOLOC -1
060821,000289:
060822,000290: 01,3730 50155 NDX TEMP2G
060823,000291: 01,3731 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
060824,000292:
060825,000293: 01,3732 15376 TCF ITSLGCL1 # NOW GET THE DELTA TIME
060826,000294:
060827,000295: 01,3733 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
060828,000296: 01,3734 54706 TS GOLOC +1
Page 1387 |
060830,000298: 01,3735 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
060831,000299: 01,3736 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
060832,000300:
060833,000301: 01,3737 13566 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
060834,000302:
060835,000303: 01,3740 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
060836,000304:
060837,000305: 01,3741 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
060838,000306: 01,3742 32000 CA PRDTTAB
060839,000307:
060840,000308: 01,3743 13631 TCF CHKNOVAC
060841,000309:
060842,000310: 01,3744 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
060843,000311: 01,3745 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
060844,000312:
060845,000313: 01,3746 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
060846,000314: 01,3747 32000 CA SIZETAB # THE TABLE
060847,000315: 01,3750 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
060848,000316: 01,3751 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
060849,000317: 01,3752 60154 AD TEMPPHS
060850,000318: 01,3753 54156 TS POINTER
060851,000319:
060852,000320: 01,3754 13657 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
060853,000321:
060854,000322: 01,3755 36214 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
060855,000323: 01,3756 26156 ADS POINTER # THE TABLE
060856,000324:
060857,000325: 01,3757 33557 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
060858,000326: 01,3760 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
060859,000327: # GROUP
060860,000328: 01,3761 13657 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
060861,000329:
060862,000330: 01,3762 0154 TEMPPHS EQUALS MPAC
060863,000331: 01,3762 0155 TEMP2G EQUALS MPAC +1
060864,000332: 01,3762 0156 POINTER EQUALS MPAC +2
060865,000333: 01,3762 0157 TEMPSWCH EQUALS MPAC +3
060866,000334: 01,3762 0705 GOLOC EQUALS VAC5 +20D
060867,000335: 01,3762 7715 MINUS2 EQUALS NEG2
060868,000336: 01,3762 6043 OCT177 EQUALS LOW7
060869,000337:
060870,000338: 01,3762 03755 PHS2CADR GENADR PHSPART2
060871,000339: 01,3763 03533 PRT2CADR GENADR GETPART2
060872,000340: 01,3764 05231 LGCLCADR GENADR LONGCALL
060873,000341: 01,3765 05042 FVACCADR GENADR FINDVAC
060874,000342: 01,3766 05140 WTLTCADR GENADR WAITLIST
060875,000343: 01,3767 05027 NOVACADR GENADR NOVAC
060876,000344:
060877,000345:
060878,000346:
060879,000347:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc