Source Code
These source-code files are part of a reconstructed copy of Comanche 44, the
initial release (though not the final mission release) of the Apollo 10
Command Module (CM) Apollo Guidance Computer (AGC) software. Subsequent releases
were Comanche 45 and Comanche 45/2 (the flown release on Apollo 10). The reconstruction
is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 44, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 51 (separately previously reconstructed from an Apollo-era listing of Comanche 55, flown on Apollo 11). Comanche 51 source code was then modified by undoing changes known to have been made between revisions 44 and 51. The now-reconstructed Comanche 44 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 printout, although the source code would likely have different page numbers in a contemporary Comanche 44 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 51. Here's a guide to the Apollo documentation referenced in 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. |
060617,000002: ## Copyright: Public domain.
060618,000003: ## Filename: RESTARTS_ROUTINE.agc
060619,000004: ## Purpose: A section of Comanche revision 044.
060620,000005: ## It is part of the reconstructed source code for the
060621,000006: ## original release of the flight software for the Command
060622,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
060623,000008: ## The code has been recreated from a copy of Comanche 055. It
060624,000009: ## has been adapted such that the resulting bugger words
060625,000010: ## exactly match those specified for Comanche 44 in NASA drawing
060626,000011: ## 2021153D, which gives relatively high confidence that the
060627,000012: ## reconstruction is correct.
060628,000013: ## Assembler: yaYUL
060629,000014: ## Contact: Ron Burkey <info@sandroid.org>.
060630,000015: ## Website: www.ibiblio.org/apollo/index.html
060631,000016: ## Mod history: 2020-12-03 MAS Created from Comanche 51.
060632,000017:
Page 1414 |
060634,000019: 01,3520 BANK 01
060635,000020: 01,2000 SETLOC RESTART
060636,000021: 01,2000 BANK
060637,000022:
060638,000023: 01,3520 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
060639,000024:
060640,000025: 01,3520 COUNT 01/RSROU
060641,000026:
060642,000027: 01,3520 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
060643,000028: 01,3521 60000 DOUBLE # SAVE FOR INDEXING
060644,000029: 01,3522 54155 TS TEMP2G
060645,000030:
060646,000031: 01,3523 33762 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
060647,000032: 01,3524 54157 TS TEMPSWCH # TABLE PHASE
060648,000033:
060649,000034: 01,3525 33557 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
060650,000035: 01,3526 54707 TS GOLOC +2 # GROUP AFTER THIS
060651,000036:
060652,000037: 01,3527 30154 CA TEMPPHS
060653,000038: 01,3530 75051 MASK OCT1400
060654,000039: 01,3531 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
060655,000040: 01,3532 13543 TCF ITSAVAR # IT:S A VARIABLE RESTART
060656,000041:
060657,000042: 01,3533 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
060658,000043: 01,3534 10000 CCS A
060659,000044: 01,3535 13643 TCF ITSATBL # NO, ITS A TABLE RESTART
060660,000045:
060661,000046: 01,3536 35066 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
060662,000047: 01,3537 05147 TC FINDVAC # THE DISPLAY RESTART JOB
060663,000048: 01,3540 E3,1400 EBANK= LST1
060664,000049: 01,3540 03261 20063 2CADR INITDSP
060665,000050:
060666,000051: 01,3542 03557 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
060667,000052:
060668,000053: 01,3543 75051 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
060669,000054: 01,3544 10000 CCS A
060670,000055: 01,3545 13614 TCF ITSLIKEB # YES, IT IS TYPE B
060671,000056:
060672,000057: 01,3546 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
060673,000058: 01,3547 50155 NDX TEMP2G
060674,000059: 01,3550 31437 DCA PHSNAME1
060675,000060: 01,3551 52706 DXCH GOLOC
060676,000061:
060677,000062: 01,3552 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
060678,000063: 01,3553 75023 MASK OCT7
060679,000064: 01,3554 67715 AD MINUS2
060680,000065: 01,3555 10000 CCS A
060681,000066: 01,3556 13726 TCF ITSLNGCL # ITS A LONGCALL
060682,000067:
Page 1415 |
060684,000069: 01,3557 04675 RTRNCADR TC SWRETURN # CANT GET HERE
060685,000070: 01,3560 13562 TCF ITSAWAIT
060686,000071:
060687,000072: 01,3561 13627 TCF ITSAJOB # ITS A JOB
060688,000073:
060689,000074: 01,3562 33766 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
060690,000075: 01,3563 54704 TS GOLOC -1
060691,000076:
060692,000077: 01,3564 50155 NDX TEMP2G # DIRECTLY STORED
060693,000078: 01,3565 31054 CA PHSPRDT1
060694,000079: 01,3566 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
060695,000080: 01,3567 24000 INCR A # NO,
060696,000081: 01,3570 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060697,000082:
060698,000083: 01,3571 15500 TCF ITSINDIR # STORED INDIRECTLY
060699,000084:
060700,000085: 01,3572 13612 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
060701,000086:
060702,000087: # ***** THIS MUST BE IN FIXED FIXED *****
060703,000088:
060704,000089: 5500 BLOCK 02
060705,000090: 4000 SETLOC FFTAG2
060706,000091: 4000 BANK
060707,000092:
060708,000093: 5500 COUNT 02/RSROU
060709,000094:
060710,000095: 5500 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
060711,000096: 5501 22006 LXCH BB # SWITCHED ERRASIBLE
060712,000097:
060713,000098: 5502 50000 NDX A # GET THE TIME INDIRECTLY
060714,000099: 5503 30001 CA 1
060715,000100:
060716,000101: 5504 22006 LXCH BB # RESTORE THE BB AND GOLOC
060717,000102: 5505 22706 LXCH GOLOC +1
060718,000103:
060719,000104: 5506 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060720,000105:
060721,000106: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060722,000107:
060723,000108: 01,3573 BANK 01
060724,000109: 01,2000 SETLOC RESTART
060725,000110: 01,2000 BANK
060726,000111:
060727,000112: 01,3573 COUNT 01/RSROU
060728,000113:
060729,000114: 01,3573 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
060730,000115: 01,3574 54001 TS L # AND SAVE
060731,000116: 01,3575 50155 NDX TEMP2G
060732,000117: 01,3576 41053 CS TBASE1
060733,000118: 01,3577 00006 EXTEND
Page 1416 |
060735,000120: 01,3600 60025 SU TIME1
060736,000121: 01,3601 10000 CCS A
060737,000122: 01,3602 40000 COM
060738,000123: 01,3603 67700 AD OCT37776
060739,000124: 01,3604 65017 AD ONE
060740,000125: 01,3605 60001 AD L
060741,000126: 01,3606 10000 CCS A
060742,000127: 01,3607 35021 CA ZERO
060743,000128: 01,3610 13612 TCF +2
060744,000129: 01,3611 13612 TCF +1
060745,000130: 01,3612 65017 IMEDIATE AD ONE
060746,000131: 01,3613 00704 TC GOLOC -1
060747,000132: 01,3614 33557 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
060748,000133: 01,3615 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
060749,000134:
060750,000135: 01,3616 33763 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
060751,000136: 01,3617 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
060752,000137:
060753,000138: 01,3620 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
060754,000139: 01,3621 76043 MASK OCT177 # PART OF THIS VARIABLE PHASE
060755,000140: 01,3622 54154 TS TEMPPHS
060756,000141:
060757,000142: 01,3623 00006 EXTEND
060758,000143: 01,3624 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
060759,000144: 01,3625 31437 DCA PHSNAME1
060760,000145: 01,3626 52706 DXCH GOLOC
060761,000146:
060762,000147: 01,3627 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
060763,000148: 01,3630 31054 CA PHSPRDT1
060764,000149: 01,3631 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
060765,000150: 01,3632 00006 EXTEND # A FINDVAC OR A NOVAC
060766,000151: 01,3633 63637 BZMF ITSNOVAC
060767,000152:
060768,000153: 01,3634 33765 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
060769,000154: 01,3635 56704 XCH GOLOC -1 # PICK UP PRIO,
060770,000155: 01,3636 00704 TC GOLOC -1 # AND GO
060771,000156:
060772,000157: 01,3637 33767 ITSNOVAC CAF NOVACADR # NEGATIVE,
060773,000158: 01,3640 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
060774,000159: 01,3641 40000 COM # CORRECT PRIO,
060775,000160: 01,3642 00704 TC GOLOC -1 # AND GO
060776,000161:
060777,000162: 01,3643 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
060778,000163: 01,3644 10020 CCS CYR
060779,000164: 01,3645 13646 TCF +1 # IT:S EVEN
060780,000165: 01,3646 13744 TCF ITSEVEN
060781,000166:
060782,000167: 01,3647 33557 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
060783,000168: 01,3650 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
Page 1417 |
060785,000170: 01,3651 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
060786,000171: 01,3652 54021 TS SR # THE RESTART TABLES
060787,000172: 01,3653 60021 AD SR
060788,000173: 01,3654 50155 NDX TEMP2G
060789,000174: 01,3655 62001 AD SIZETAB +1
060790,000175: 01,3656 54156 TS POINTER
060791,000176:
060792,000177: 01,3657 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
060793,000178: 01,3660 50156 NDX POINTER
060794,000179: 01,3661 32002 DCA CADRTAB # GET THE 2CADR
060795,000180:
060796,000181: 01,3662 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
060797,000182:
060798,000183: 01,3663 10000 CCS A # IS IT A JOB OR IS IT TIMED
060799,000184: 01,3664 24000 INCR A # POSITIVE, MUST BE A JOB
060800,000185: 01,3665 13740 TCF ITSAJOB2
060801,000186:
060802,000187: 01,3666 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
060803,000188: 01,3667 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
060804,000189:
060805,000190: 01,3670 33766 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
060806,000191: 01,3671 54704 TS GOLOC -1
060807,000192:
060808,000193: 01,3672 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
060809,000194: 01,3673 75006 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
060810,000195: 01,3674 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
060811,000196: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
060812,000197: # IN IMPORTANCE ANYWAY. BIT 4
060813,000198: 01,3675 13733 TCF ITSWTLST # IT IS A WAITLIST CALL
060814,000199:
060815,000200: 01,3676 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
060816,000201: 01,3677 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
060817,000202:
060818,000203: 01,3700 15507 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
060819,000204:
060820,000205: # ***** THIS MUST BE IN FIXED FIXED *****
060821,000206:
060822,000207: 5507 BLOCK 02
060823,000208: 4000 SETLOC FFTAG2
060824,000209: 4000 BANK
060825,000210:
060826,000211: 5507 COUNT 02/RSROU
060827,000212:
060828,000213: 5507 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
060829,000214: 5510 22006 LXCH BB
060830,000215: 5511 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
060831,000216:
060832,000217: 5512 00006 EXTEND # GET THE DELTA TIME
060833,000218: 5513 50000 NDX A
060834,000219: 5514 30001 DCA 0
Page 1418 |
060836,000221: 5515 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
060837,000222: 5516 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
060838,000223: 5517 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
060839,000224: 5520 13701 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
060840,000225:
060841,000226: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060842,000227:
060843,000228: 01,3701 BANK 01
060844,000229: 01,2000 SETLOC RESTART
060845,000230: 01,2000 BANK
060846,000231:
060847,000232: 01,3701 COUNT 01/RSROU
060848,000233: 01,3701 53140 ITSLGCL2 DXCH LONGTIME
060849,000234:
060850,000235: 01,3702 00006 EXTEND # CALCULATE TIME LEFT
060851,000236: 01,3703 40025 DCS TIME2
060852,000237: 01,3704 21140 DAS LONGTIME
060853,000238: 01,3705 00006 EXTEND
060854,000239: 01,3706 31136 DCA LONGBASE
060855,000240: 01,3707 21140 DAS LONGTIME
060856,000241:
060857,000242: 01,3710 11137 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
060858,000243: 01,3711 13721 TCF LONGCLCL
060859,000244: 01,3712 13714 TCF +2
060860,000245: 01,3713 13607 TCF IMEDIATE -3
060861,000246: 01,3714 11140 CCS LONGTIME +1
060862,000247: 01,3715 13721 TCF LONGCLCL
060863,000248: 01,3716 13717 NOOP # CAN:T GET HERE *********
060864,000249: 01,3717 13607 TCF IMEDIATE -3
060865,000250: 01,3720 13612 TCF IMEDIATE
060866,000251:
060867,000252: 01,3721 33764 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
060868,000253: 01,3722 54704 TS GOLOC -1
060869,000254:
060870,000255: 01,3723 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
060871,000256: 01,3724 31140 DCA LONGTIME
060872,000257: 01,3725 00704 TC GOLOC -1
060873,000258:
060874,000259: 01,3726 33766 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
060875,000260: 01,3727 54704 TS GOLOC -1
060876,000261:
060877,000262: 01,3730 50155 NDX TEMP2G
060878,000263: 01,3731 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
060879,000264:
060880,000265: 01,3732 15507 TCF ITSLGCL1 # NOW GET THE DELTA TIME
060881,000266:
060882,000267: 01,3733 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
060883,000268: 01,3734 54706 TS GOLOC +1
Page 1419 |
060885,000270: 01,3735 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
060886,000271: 01,3736 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
060887,000272:
060888,000273: 01,3737 13566 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
060889,000274:
060890,000275: 01,3740 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
060891,000276:
060892,000277: 01,3741 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
060893,000278: 01,3742 32000 CA PRDTTAB
060894,000279:
060895,000280: 01,3743 13631 TCF CHKNOVAC
060896,000281:
060897,000282: 01,3744 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
060898,000283: 01,3745 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
060899,000284:
060900,000285: 01,3746 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
060901,000286: 01,3747 32000 CA SIZETAB # THE TABLE
060902,000287: 01,3750 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
060903,000288: 01,3751 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
060904,000289: 01,3752 60154 AD TEMPPHS
060905,000290: 01,3753 54156 TS POINTER
060906,000291:
060907,000292: 01,3754 13657 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
060908,000293:
060909,000294: 01,3755 36214 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
060910,000295: 01,3756 26156 ADS POINTER # THE TABLE
060911,000296:
060912,000297: 01,3757 33557 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
060913,000298: 01,3760 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
060914,000299: # GROUP
060915,000300: 01,3761 13657 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
060916,000301:
060917,000302: 01,3762 0154 TEMPPHS EQUALS MPAC
060918,000303: 01,3762 0155 TEMP2G EQUALS MPAC +1
060919,000304: 01,3762 0156 POINTER EQUALS MPAC +2
060920,000305: 01,3762 0157 TEMPSWCH EQUALS MPAC +3
060921,000306: 01,3762 0705 GOLOC EQUALS VAC5 +20D
060922,000307: 01,3762 7715 MINUS2 EQUALS NEG2
060923,000308: 01,3762 6043 OCT177 EQUALS LOW7
060924,000309:
060925,000310: 01,3762 03755 PHS2CADR GENADR PHSPART2
060926,000311: 01,3763 03533 PRT2CADR GENADR GETPART2
060927,000312: 01,3764 05342 LGCLCADR GENADR LONGCALL
060928,000313: 01,3765 05147 FVACCADR GENADR FINDVAC
060929,000314: 01,3766 05245 WTLTCADR GENADR WAITLIST
060930,000315: 01,3767 05134 NOVACADR GENADR NOVAC
060931,000316:
060932,000317:
060933,000318:
060934,000319:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc