Source Code
These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3),
the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software
for Apollo 13.
The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments. Since no contemporary listings of Comanche 72/3 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. |
058976,000002: ## Copyright: Public domain.
058977,000003: ## Filename: RESTARTS_ROUTINE.agc
058978,000004: ## Purpose: A section of Manche72 revision 3.
058979,000005: ## It is part of the reconstructed source code for the final, flown
058980,000006: ## release of the software for the Command Module's (CM) Apollo
058981,000007: ## Guidance Computer (AGC) for Apollo 13. No original listings
058982,000008: ## of this program are available; instead, this file was recreated
058983,000009: ## from a reconstructed copy of Comanche 072. It has been adapted
058984,000010: ## such that the resulting bugger words exactly match those
058985,000011: ## specified for Manche72 revision 3 in NASA drawing 2021153G,
058986,000012: ## which gives relatively high confidence that the reconstruction
058987,000013: ## is correct.
058988,000014: ## Assembler: yaYUL
058989,000015: ## Contact: Ron Burkey <info@sandroid.org>.
058990,000016: ## Website: www.ibiblio.org/apollo/index.html
058991,000017: ## Mod history: 2024-05-19 MAS Created from Comanche 072.
058992,000018:
058993,000019: 01,3520 BANK 01
058994,000020: 01,2000 SETLOC RESTART
058995,000021: 01,2000 BANK
058996,000022:
058997,000023: 01,3520 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
058998,000024:
058999,000025: 01,3520 COUNT 01/RSROU
059000,000026:
059001,000027: 01,3520 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
059002,000028: 01,3521 60000 DOUBLE # SAVE FOR INDEXING
059003,000029: 01,3522 54155 TS TEMP2G
059004,000030:
059005,000031: 01,3523 33762 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
059006,000032: 01,3524 54157 TS TEMPSWCH # TABLE PHASE
059007,000033:
059008,000034: 01,3525 33557 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
059009,000035: 01,3526 54707 TS GOLOC +2 # GROUP AFTER THIS
059010,000036:
059011,000037: 01,3527 30154 CA TEMPPHS
059012,000038: 01,3530 75065 MASK OCT1400
059013,000039: 01,3531 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
059014,000040: 01,3532 13543 TCF ITSAVAR # IT:S A VARIABLE RESTART
059015,000041:
059016,000042: 01,3533 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
059017,000043: 01,3534 10000 CCS A
059018,000044: 01,3535 13643 TCF ITSATBL # NO, ITS A TABLE RESTART
059019,000045:
059020,000046: 01,3536 35102 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
059021,000047: 01,3537 05163 TC FINDVAC # THE DISPLAY RESTART JOB
059022,000048: 01,3540 E3,1400 EBANK= LST1
059023,000049: 01,3540 03261 20063 2CADR INITDSP
059024,000050:
059025,000051: 01,3542 03557 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
059026,000052:
059027,000053: 01,3543 75065 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
059028,000054: 01,3544 10000 CCS A
059029,000055: 01,3545 13614 TCF ITSLIKEB # YES, IT IS TYPE B
059030,000056:
059031,000057: 01,3546 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
059032,000058: 01,3547 50155 NDX TEMP2G
059033,000059: 01,3550 31437 DCA PHSNAME1
059034,000060: 01,3551 52706 DXCH GOLOC
059035,000061:
059036,000062: 01,3552 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
059037,000063: 01,3553 75037 MASK OCT7
059038,000064: 01,3554 67715 AD MINUS2
059039,000065: 01,3555 10000 CCS A
059040,000066: 01,3556 13726 TCF ITSLNGCL # ITS A LONGCALL
059041,000067:
059042,000068: 01,3557 04711 RTRNCADR TC SWRETURN # CANT GET HERE
059043,000069: 01,3560 13562 TCF ITSAWAIT
059044,000070:
059045,000071: 01,3561 13627 TCF ITSAJOB # ITS A JOB
059046,000072:
059047,000073: 01,3562 33766 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
059048,000074: 01,3563 54704 TS GOLOC -1
059049,000075:
059050,000076: 01,3564 50155 NDX TEMP2G # DIRECTLY STORED
059051,000077: 01,3565 31054 CA PHSPRDT1
059052,000078: 01,3566 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
059053,000079: 01,3567 24000 INCR A # NO,
059054,000080: 01,3570 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
059055,000081:
059056,000082: 01,3571 15514 TCF ITSINDIR # STORED INDIRECTLY
059057,000083:
059058,000084: 01,3572 13612 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
059059,000085:
059060,000086: # ***** THIS MUST BE IN FIXED FIXED *****
059061,000087:
059062,000088: 5514 BLOCK 02
059063,000089: 4000 SETLOC FFTAG2
059064,000090: 4000 BANK
059065,000091:
059066,000092: 5514 COUNT 02/RSROU
059067,000093:
059068,000094: 5514 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
059069,000095: 5515 22006 LXCH BB # SWITCHED ERRASIBLE
059070,000096:
059071,000097: 5516 50000 NDX A # GET THE TIME INDIRECTLY
059072,000098: 5517 30001 CA 1
059073,000099:
059074,000100: 5520 22006 LXCH BB # RESTORE THE BB AND GOLOC
059075,000101: 5521 22706 LXCH GOLOC +1
059076,000102:
059077,000103: 5522 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
059078,000104:
059079,000105: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
059080,000106:
059081,000107: 01,3573 BANK 01
059082,000108: 01,2000 SETLOC RESTART
059083,000109: 01,2000 BANK
059084,000110:
059085,000111: 01,3573 COUNT 01/RSROU
059086,000112:
059087,000113: 01,3573 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
059088,000114: 01,3574 54001 TS L # AND SAVE
059089,000115: 01,3575 50155 NDX TEMP2G
059090,000116: 01,3576 41053 CS TBASE1
059091,000117: 01,3577 00006 EXTEND
059092,000118: 01,3600 60025 SU TIME1
059093,000119: 01,3601 10000 CCS A
059094,000120: 01,3602 40000 COM
059095,000121: 01,3603 67700 AD OCT37776
059096,000122: 01,3604 65033 AD ONE
059097,000123: 01,3605 60001 AD L
059098,000124: 01,3606 10000 CCS A
059099,000125: 01,3607 35035 CA ZERO
059100,000126: 01,3610 13612 TCF +2
059101,000127: 01,3611 13612 TCF +1
059102,000128: 01,3612 65033 IMEDIATE AD ONE
059103,000129: 01,3613 00704 TC GOLOC -1
059104,000130: 01,3614 33557 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
059105,000131: 01,3615 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
059106,000132:
059107,000133: 01,3616 33763 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
059108,000134: 01,3617 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
059109,000135:
059110,000136: 01,3620 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
059111,000137: 01,3621 76043 MASK OCT177 # PART OF THIS VARIABLE PHASE
059112,000138: 01,3622 54154 TS TEMPPHS
059113,000139:
059114,000140: 01,3623 00006 EXTEND
059115,000141: 01,3624 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
059116,000142: 01,3625 31437 DCA PHSNAME1
059117,000143: 01,3626 52706 DXCH GOLOC
059118,000144:
059119,000145: 01,3627 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
059120,000146: 01,3630 31054 CA PHSPRDT1
059121,000147: 01,3631 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
059122,000148: 01,3632 00006 EXTEND # A FINDVAC OR A NOVAC
059123,000149: 01,3633 63637 BZMF ITSNOVAC
059124,000150:
059125,000151: 01,3634 33765 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
059126,000152: 01,3635 56704 XCH GOLOC -1 # PICK UP PRIO,
059127,000153: 01,3636 00704 TC GOLOC -1 # AND GO
059128,000154:
059129,000155: 01,3637 33767 ITSNOVAC CAF NOVACADR # NEGATIVE,
059130,000156: 01,3640 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
059131,000157: 01,3641 40000 COM # CORRECT PRIO,
059132,000158: 01,3642 00704 TC GOLOC -1 # AND GO
059133,000159:
059134,000160: 01,3643 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
059135,000161: 01,3644 10020 CCS CYR
059136,000162: 01,3645 13646 TCF +1 # IT:S EVEN
059137,000163: 01,3646 13744 TCF ITSEVEN
059138,000164:
059139,000165: 01,3647 33557 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
059140,000166: 01,3650 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
059141,000167: 01,3651 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
059142,000168: 01,3652 54021 TS SR # THE RESTART TABLES
059143,000169: 01,3653 60021 AD SR
059144,000170: 01,3654 50155 NDX TEMP2G
059145,000171: 01,3655 62001 AD SIZETAB +1
059146,000172: 01,3656 54156 TS POINTER
059147,000173:
059148,000174: 01,3657 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
059149,000175: 01,3660 50156 NDX POINTER
059150,000176: 01,3661 32002 DCA CADRTAB # GET THE 2CADR
059151,000177:
059152,000178: 01,3662 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
059153,000179:
059154,000180: 01,3663 10000 CCS A # IS IT A JOB OR IS IT TIMED
059155,000181: 01,3664 24000 INCR A # POSITIVE, MUST BE A JOB
059156,000182: 01,3665 13740 TCF ITSAJOB2
059157,000183:
059158,000184: 01,3666 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
059159,000185: 01,3667 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
059160,000186:
059161,000187: 01,3670 33766 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
059162,000188: 01,3671 54704 TS GOLOC -1
059163,000189:
059164,000190: 01,3672 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
059165,000191: 01,3673 75022 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
059166,000192: 01,3674 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
059167,000193: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
059168,000194: # IN IMPORTANCE ANYWAY. BIT 4
059169,000195: 01,3675 13733 TCF ITSWTLST # IT IS A WAITLIST CALL
059170,000196:
059171,000197: 01,3676 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
059172,000198: 01,3677 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
059173,000199:
059174,000200: 01,3700 15523 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
059175,000201:
059176,000202: # ***** THIS MUST BE IN FIXED FIXED *****
059177,000203:
059178,000204: 5523 BLOCK 02
059179,000205: 4000 SETLOC FFTAG2
059180,000206: 4000 BANK
059181,000207:
059182,000208: 5523 COUNT 02/RSROU
059183,000209:
059184,000210: 5523 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
059185,000211: 5524 22006 LXCH BB
059186,000212: 5525 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
059187,000213:
059188,000214: 5526 00006 EXTEND # GET THE DELTA TIME
059189,000215: 5527 50000 NDX A
059190,000216: 5530 30001 DCA 0
059191,000217: 5531 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
059192,000218: 5532 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
059193,000219: 5533 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
059194,000220: 5534 13701 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
059195,000221:
059196,000222: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
059197,000223:
059198,000224: 01,3701 BANK 01
059199,000225: 01,2000 SETLOC RESTART
059200,000226: 01,2000 BANK
059201,000227:
059202,000228: 01,3701 COUNT 01/RSROU
059203,000229: 01,3701 53140 ITSLGCL2 DXCH LONGTIME
059204,000230:
059205,000231: 01,3702 00006 EXTEND # CALCULATE TIME LEFT
059206,000232: 01,3703 40025 DCS TIME2
059207,000233: 01,3704 21140 DAS LONGTIME
059208,000234: 01,3705 00006 EXTEND
059209,000235: 01,3706 31136 DCA LONGBASE
059210,000236: 01,3707 21140 DAS LONGTIME
059211,000237:
059212,000238: 01,3710 11137 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
059213,000239: 01,3711 13721 TCF LONGCLCL
059214,000240: 01,3712 13714 TCF +2
059215,000241: 01,3713 13607 TCF IMEDIATE -3
059216,000242: 01,3714 11140 CCS LONGTIME +1
059217,000243: 01,3715 13721 TCF LONGCLCL
059218,000244: 01,3716 13717 NOOP # CAN:T GET HERE *********
059219,000245: 01,3717 13607 TCF IMEDIATE -3
059220,000246: 01,3720 13612 TCF IMEDIATE
059221,000247:
059222,000248: 01,3721 33764 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
059223,000249: 01,3722 54704 TS GOLOC -1
059224,000250:
059225,000251: 01,3723 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
059226,000252: 01,3724 31140 DCA LONGTIME
059227,000253: 01,3725 00704 TC GOLOC -1
059228,000254:
059229,000255: 01,3726 33766 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
059230,000256: 01,3727 54704 TS GOLOC -1
059231,000257:
059232,000258: 01,3730 50155 NDX TEMP2G
059233,000259: 01,3731 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
059234,000260:
059235,000261: 01,3732 15523 TCF ITSLGCL1 # NOW GET THE DELTA TIME
059236,000262:
059237,000263: 01,3733 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
059238,000264: 01,3734 54706 TS GOLOC +1
059239,000265: 01,3735 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
059240,000266: 01,3736 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
059241,000267:
059242,000268: 01,3737 13566 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
059243,000269:
059244,000270: 01,3740 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
059245,000271:
059246,000272: 01,3741 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
059247,000273: 01,3742 32000 CA PRDTTAB
059248,000274:
059249,000275: 01,3743 13631 TCF CHKNOVAC
059250,000276:
059251,000277: 01,3744 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
059252,000278: 01,3745 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
059253,000279:
059254,000280: 01,3746 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
059255,000281: 01,3747 32000 CA SIZETAB # THE TABLE
059256,000282: 01,3750 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
059257,000283: 01,3751 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
059258,000284: 01,3752 60154 AD TEMPPHS
059259,000285: 01,3753 54156 TS POINTER
059260,000286:
059261,000287: 01,3754 13657 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
059262,000288:
059263,000289: 01,3755 36214 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
059264,000290: 01,3756 26156 ADS POINTER # THE TABLE
059265,000291:
059266,000292: 01,3757 33557 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
059267,000293: 01,3760 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
059268,000294: # GROUP
059269,000295: 01,3761 13657 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
059270,000296:
059271,000297: 01,3762 0154 TEMPPHS EQUALS MPAC
059272,000298: 01,3762 0155 TEMP2G EQUALS MPAC +1
059273,000299: 01,3762 0156 POINTER EQUALS MPAC +2
059274,000300: 01,3762 0157 TEMPSWCH EQUALS MPAC +3
059275,000301: 01,3762 0705 GOLOC EQUALS VAC5 +20D
059276,000302: 01,3762 7715 MINUS2 EQUALS NEG2
059277,000303: 01,3762 6043 OCT177 EQUALS LOW7
059278,000304:
059279,000305: 01,3762 03755 PHS2CADR GENADR PHSPART2
059280,000306: 01,3763 03533 PRT2CADR GENADR GETPART2
059281,000307: 01,3764 05356 LGCLCADR GENADR LONGCALL
059282,000308: 01,3765 05163 FVACCADR GENADR FINDVAC
059283,000309: 01,3766 05261 WTLTCADR GENADR WAITLIST
059284,000310: 01,3767 05150 NOVACADR GENADR NOVAC
059285,000311:
059286,000312:
059287,000313:
059288,000314:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc