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