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