Source Code
These source-code files are part of a reconstructed copy of Comanche 45, the
second release, though not the final mission release, of the Apollo 10
Command Module (CM) Apollo Guidance Computer (AGC) software. Comanche 45 was
preceded by Comanche 44 and followed by Comanche 45/2 (the flown release). The reconstruction
is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 45, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 44 (itself previously accurately reconstructed). Comanche 44 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 44 and 45. The now-reconstructed Comanche 45 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 tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 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 44. 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. |
060096,000002: ## Copyright: Public domain.
060097,000003: ## Filename: RESTARTS_ROUTINE.agc
060098,000004: ## Purpose: A section of Comanche revision 045.
060099,000005: ## It is part of the reconstructed source code for the
060100,000006: ## second release of the flight software for the Command
060101,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
060102,000008: ## The code has been recreated from a copy of Comanche 055. It
060103,000009: ## has been adapted such that the resulting bugger words
060104,000010: ## exactly match those specified for Comanche 45 in NASA drawing
060105,000011: ## 2021153D, which gives relatively high confidence that the
060106,000012: ## reconstruction is correct.
060107,000013: ## Assembler: yaYUL
060108,000014: ## Contact: Ron Burkey <info@sandroid.org>.
060109,000015: ## Website: www.ibiblio.org/apollo/index.html
060110,000016: ## Mod history: 2020-12-06 MAS Created from Comanche 44.
060111,000017:
Page 1414 |
060113,000019: 01,3520 BANK 01
060114,000020: 01,2000 SETLOC RESTART
060115,000021: 01,2000 BANK
060116,000022:
060117,000023: 01,3520 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
060118,000024:
060119,000025: 01,3520 COUNT 01/RSROU
060120,000026:
060121,000027: 01,3520 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
060122,000028: 01,3521 60000 DOUBLE # SAVE FOR INDEXING
060123,000029: 01,3522 54155 TS TEMP2G
060124,000030:
060125,000031: 01,3523 33762 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
060126,000032: 01,3524 54157 TS TEMPSWCH # TABLE PHASE
060127,000033:
060128,000034: 01,3525 33557 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
060129,000035: 01,3526 54707 TS GOLOC +2 # GROUP AFTER THIS
060130,000036:
060131,000037: 01,3527 30154 CA TEMPPHS
060132,000038: 01,3530 75051 MASK OCT1400
060133,000039: 01,3531 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
060134,000040: 01,3532 13543 TCF ITSAVAR # IT:S A VARIABLE RESTART
060135,000041:
060136,000042: 01,3533 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
060137,000043: 01,3534 10000 CCS A
060138,000044: 01,3535 13643 TCF ITSATBL # NO, ITS A TABLE RESTART
060139,000045:
060140,000046: 01,3536 35066 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
060141,000047: 01,3537 05147 TC FINDVAC # THE DISPLAY RESTART JOB
060142,000048: 01,3540 E3,1400 EBANK= LST1
060143,000049: 01,3540 03261 20063 2CADR INITDSP
060144,000050:
060145,000051: 01,3542 03557 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
060146,000052:
060147,000053: 01,3543 75051 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
060148,000054: 01,3544 10000 CCS A
060149,000055: 01,3545 13614 TCF ITSLIKEB # YES, IT IS TYPE B
060150,000056:
060151,000057: 01,3546 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
060152,000058: 01,3547 50155 NDX TEMP2G
060153,000059: 01,3550 31437 DCA PHSNAME1
060154,000060: 01,3551 52706 DXCH GOLOC
060155,000061:
060156,000062: 01,3552 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
060157,000063: 01,3553 75023 MASK OCT7
060158,000064: 01,3554 67715 AD MINUS2
060159,000065: 01,3555 10000 CCS A
060160,000066: 01,3556 13726 TCF ITSLNGCL # ITS A LONGCALL
060161,000067:
Page 1415 |
060163,000069: 01,3557 04675 RTRNCADR TC SWRETURN # CANT GET HERE
060164,000070: 01,3560 13562 TCF ITSAWAIT
060165,000071:
060166,000072: 01,3561 13627 TCF ITSAJOB # ITS A JOB
060167,000073:
060168,000074: 01,3562 33766 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
060169,000075: 01,3563 54704 TS GOLOC -1
060170,000076:
060171,000077: 01,3564 50155 NDX TEMP2G # DIRECTLY STORED
060172,000078: 01,3565 31054 CA PHSPRDT1
060173,000079: 01,3566 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
060174,000080: 01,3567 24000 INCR A # NO,
060175,000081: 01,3570 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060176,000082:
060177,000083: 01,3571 15500 TCF ITSINDIR # STORED INDIRECTLY
060178,000084:
060179,000085: 01,3572 13612 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
060180,000086:
060181,000087: # ***** THIS MUST BE IN FIXED FIXED *****
060182,000088:
060183,000089: 5500 BLOCK 02
060184,000090: 4000 SETLOC FFTAG2
060185,000091: 4000 BANK
060186,000092:
060187,000093: 5500 COUNT 02/RSROU
060188,000094:
060189,000095: 5500 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
060190,000096: 5501 22006 LXCH BB # SWITCHED ERRASIBLE
060191,000097:
060192,000098: 5502 50000 NDX A # GET THE TIME INDIRECTLY
060193,000099: 5503 30001 CA 1
060194,000100:
060195,000101: 5504 22006 LXCH BB # RESTORE THE BB AND GOLOC
060196,000102: 5505 22706 LXCH GOLOC +1
060197,000103:
060198,000104: 5506 13573 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
060199,000105:
060200,000106: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060201,000107:
060202,000108: 01,3573 BANK 01
060203,000109: 01,2000 SETLOC RESTART
060204,000110: 01,2000 BANK
060205,000111:
060206,000112: 01,3573 COUNT 01/RSROU
060207,000113:
060208,000114: 01,3573 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
060209,000115: 01,3574 54001 TS L # AND SAVE
060210,000116: 01,3575 50155 NDX TEMP2G
060211,000117: 01,3576 41053 CS TBASE1
060212,000118: 01,3577 00006 EXTEND
Page 1416 |
060214,000120: 01,3600 60025 SU TIME1
060215,000121: 01,3601 10000 CCS A
060216,000122: 01,3602 40000 COM
060217,000123: 01,3603 67700 AD OCT37776
060218,000124: 01,3604 65017 AD ONE
060219,000125: 01,3605 60001 AD L
060220,000126: 01,3606 10000 CCS A
060221,000127: 01,3607 35021 CA ZERO
060222,000128: 01,3610 13612 TCF +2
060223,000129: 01,3611 13612 TCF +1
060224,000130: 01,3612 65017 IMEDIATE AD ONE
060225,000131: 01,3613 00704 TC GOLOC -1
060226,000132: 01,3614 33557 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
060227,000133: 01,3615 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
060228,000134:
060229,000135: 01,3616 33763 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
060230,000136: 01,3617 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
060231,000137:
060232,000138: 01,3620 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
060233,000139: 01,3621 76043 MASK OCT177 # PART OF THIS VARIABLE PHASE
060234,000140: 01,3622 54154 TS TEMPPHS
060235,000141:
060236,000142: 01,3623 00006 EXTEND
060237,000143: 01,3624 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
060238,000144: 01,3625 31437 DCA PHSNAME1
060239,000145: 01,3626 52706 DXCH GOLOC
060240,000146:
060241,000147: 01,3627 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
060242,000148: 01,3630 31054 CA PHSPRDT1
060243,000149: 01,3631 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
060244,000150: 01,3632 00006 EXTEND # A FINDVAC OR A NOVAC
060245,000151: 01,3633 63637 BZMF ITSNOVAC
060246,000152:
060247,000153: 01,3634 33765 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
060248,000154: 01,3635 56704 XCH GOLOC -1 # PICK UP PRIO,
060249,000155: 01,3636 00704 TC GOLOC -1 # AND GO
060250,000156:
060251,000157: 01,3637 33767 ITSNOVAC CAF NOVACADR # NEGATIVE,
060252,000158: 01,3640 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
060253,000159: 01,3641 40000 COM # CORRECT PRIO,
060254,000160: 01,3642 00704 TC GOLOC -1 # AND GO
060255,000161:
060256,000162: 01,3643 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
060257,000163: 01,3644 10020 CCS CYR
060258,000164: 01,3645 13646 TCF +1 # IT:S EVEN
060259,000165: 01,3646 13744 TCF ITSEVEN
060260,000166:
060261,000167: 01,3647 33557 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
060262,000168: 01,3650 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
Page 1417 |
060264,000170: 01,3651 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
060265,000171: 01,3652 54021 TS SR # THE RESTART TABLES
060266,000172: 01,3653 60021 AD SR
060267,000173: 01,3654 50155 NDX TEMP2G
060268,000174: 01,3655 62001 AD SIZETAB +1
060269,000175: 01,3656 54156 TS POINTER
060270,000176:
060271,000177: 01,3657 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
060272,000178: 01,3660 50156 NDX POINTER
060273,000179: 01,3661 32002 DCA CADRTAB # GET THE 2CADR
060274,000180:
060275,000181: 01,3662 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
060276,000182:
060277,000183: 01,3663 10000 CCS A # IS IT A JOB OR IS IT TIMED
060278,000184: 01,3664 24000 INCR A # POSITIVE, MUST BE A JOB
060279,000185: 01,3665 13740 TCF ITSAJOB2
060280,000186:
060281,000187: 01,3666 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
060282,000188: 01,3667 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
060283,000189:
060284,000190: 01,3670 33766 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
060285,000191: 01,3671 54704 TS GOLOC -1
060286,000192:
060287,000193: 01,3672 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
060288,000194: 01,3673 75006 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
060289,000195: 01,3674 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
060290,000196: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
060291,000197: # IN IMPORTANCE ANYWAY. BIT 4
060292,000198: 01,3675 13733 TCF ITSWTLST # IT IS A WAITLIST CALL
060293,000199:
060294,000200: 01,3676 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
060295,000201: 01,3677 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
060296,000202:
060297,000203: 01,3700 15507 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
060298,000204:
060299,000205: # ***** THIS MUST BE IN FIXED FIXED *****
060300,000206:
060301,000207: 5507 BLOCK 02
060302,000208: 4000 SETLOC FFTAG2
060303,000209: 4000 BANK
060304,000210:
060305,000211: 5507 COUNT 02/RSROU
060306,000212:
060307,000213: 5507 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
060308,000214: 5510 22006 LXCH BB
060309,000215: 5511 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
060310,000216:
060311,000217: 5512 00006 EXTEND # GET THE DELTA TIME
060312,000218: 5513 50000 NDX A
060313,000219: 5514 30001 DCA 0
Page 1418 |
060315,000221: 5515 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
060316,000222: 5516 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
060317,000223: 5517 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
060318,000224: 5520 13701 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
060319,000225:
060320,000226: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
060321,000227:
060322,000228: 01,3701 BANK 01
060323,000229: 01,2000 SETLOC RESTART
060324,000230: 01,2000 BANK
060325,000231:
060326,000232: 01,3701 COUNT 01/RSROU
060327,000233: 01,3701 53140 ITSLGCL2 DXCH LONGTIME
060328,000234:
060329,000235: 01,3702 00006 EXTEND # CALCULATE TIME LEFT
060330,000236: 01,3703 40025 DCS TIME2
060331,000237: 01,3704 21140 DAS LONGTIME
060332,000238: 01,3705 00006 EXTEND
060333,000239: 01,3706 31136 DCA LONGBASE
060334,000240: 01,3707 21140 DAS LONGTIME
060335,000241:
060336,000242: 01,3710 11137 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
060337,000243: 01,3711 13721 TCF LONGCLCL
060338,000244: 01,3712 13714 TCF +2
060339,000245: 01,3713 13607 TCF IMEDIATE -3
060340,000246: 01,3714 11140 CCS LONGTIME +1
060341,000247: 01,3715 13721 TCF LONGCLCL
060342,000248: 01,3716 13717 NOOP # CAN:T GET HERE *********
060343,000249: 01,3717 13607 TCF IMEDIATE -3
060344,000250: 01,3720 13612 TCF IMEDIATE
060345,000251:
060346,000252: 01,3721 33764 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
060347,000253: 01,3722 54704 TS GOLOC -1
060348,000254:
060349,000255: 01,3723 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
060350,000256: 01,3724 31140 DCA LONGTIME
060351,000257: 01,3725 00704 TC GOLOC -1
060352,000258:
060353,000259: 01,3726 33766 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
060354,000260: 01,3727 54704 TS GOLOC -1
060355,000261:
060356,000262: 01,3730 50155 NDX TEMP2G
060357,000263: 01,3731 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
060358,000264:
060359,000265: 01,3732 15507 TCF ITSLGCL1 # NOW GET THE DELTA TIME
060360,000266:
060361,000267: 01,3733 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
060362,000268: 01,3734 54706 TS GOLOC +1
Page 1419 |
060364,000270: 01,3735 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
060365,000271: 01,3736 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
060366,000272:
060367,000273: 01,3737 13566 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
060368,000274:
060369,000275: 01,3740 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
060370,000276:
060371,000277: 01,3741 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
060372,000278: 01,3742 32000 CA PRDTTAB
060373,000279:
060374,000280: 01,3743 13631 TCF CHKNOVAC
060375,000281:
060376,000282: 01,3744 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
060377,000283: 01,3745 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
060378,000284:
060379,000285: 01,3746 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
060380,000286: 01,3747 32000 CA SIZETAB # THE TABLE
060381,000287: 01,3750 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
060382,000288: 01,3751 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
060383,000289: 01,3752 60154 AD TEMPPHS
060384,000290: 01,3753 54156 TS POINTER
060385,000291:
060386,000292: 01,3754 13657 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
060387,000293:
060388,000294: 01,3755 36214 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
060389,000295: 01,3756 26156 ADS POINTER # THE TABLE
060390,000296:
060391,000297: 01,3757 33557 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
060392,000298: 01,3760 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
060393,000299: # GROUP
060394,000300: 01,3761 13657 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
060395,000301:
060396,000302: 01,3762 0154 TEMPPHS EQUALS MPAC
060397,000303: 01,3762 0155 TEMP2G EQUALS MPAC +1
060398,000304: 01,3762 0156 POINTER EQUALS MPAC +2
060399,000305: 01,3762 0157 TEMPSWCH EQUALS MPAC +3
060400,000306: 01,3762 0705 GOLOC EQUALS VAC5 +20D
060401,000307: 01,3762 7715 MINUS2 EQUALS NEG2
060402,000308: 01,3762 6043 OCT177 EQUALS LOW7
060403,000309:
060404,000310: 01,3762 03755 PHS2CADR GENADR PHSPART2
060405,000311: 01,3763 03533 PRT2CADR GENADR GETPART2
060406,000312: 01,3764 05342 LGCLCADR GENADR LONGCALL
060407,000313: 01,3765 05147 FVACCADR GENADR FINDVAC
060408,000314: 01,3766 05245 WTLTCADR GENADR WAITLIST
060409,000315: 01,3767 05134 NOVACADR GENADR NOVAC
060410,000316:
060411,000317:
060412,000318:
060413,000319:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc