Source Code
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release
of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97.
A bug (which had been around since at least Apollo 10, Luminary 69) was
discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute
revision into Rev 1,
which is what actually flew rather than
the Rev 0 presented here. A hardcopy of Rev 0 is known to
exist — it belonged to AGC developer Allan Klumpp for many years — but
unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus
the code you see here had been reconstructed (we believe accurately) rather than
transcribed. The first step of the reconstruction of the Rev 0 source code was
the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection.
The process of reverting the active portion of the source code (i.e., other than
program comments) from Rev 1 to Rev 0 was very minor, consisting
only of moving the position of the STARTSB1 label in
FRESH START AND RESTART. Allan had previously given
us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums
identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read,
in part:GAP: ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051 A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here. |
056999,000002: ## Copyright: Public domain.
057000,000003: ## Filename: RESTARTS_ROUTINE.agc
057001,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
057002,000005: ## otherwise known as Luminary Rev 99, the third release
057003,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
057004,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
057005,000008: ## placement of a single label. The corrections shown here have
057006,000009: ## been verified to have the same bank checksums as AGC developer
057007,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
057008,000011: ## to be accurate. This file is intended to be a faithful
057009,000012: ## recreation, except that the code format has been changed to
057010,000013: ## conform to the requirements of the yaYUL assembler rather than
057011,000014: ## the original YUL assembler.
057012,000015: ##
057013,000016: ## Assembler: yaYUL
057014,000017: ## Contact: Onno Hommes <ohommes@cmu.edu>.
057015,000018: ## Website: www.ibiblio.org/apollo.
057016,000019: ## Pages: 1303-1309
057017,000020: ## Mod history: 2009-05-27 OH Transcribed from page images.
057018,000021: ## 2016-12-18 RSB Proofed text comments with octopus/ProoferComments
057019,000022: ## and corrected the errors found.
057020,000023: ## 2017-03-14 RSB Comment-text fixes noted in proofing Luminary 116.
057021,000024: ## 2017-03-16 RSB Comment-text fixes identified in 5-way
057022,000025: ## side-by-side diff of Luminary 69/99/116/131/210.
057023,000026: ## 2017-08-01 MAS Created from LMY99 Rev 1.
057024,000027:
057025,000028: ## This source code has been transcribed or otherwise adapted from
057026,000029: ## digitized images of a hardcopy from the MIT Museum. The digitization
057027,000030: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
057028,000031: ## the Museum. Many thanks to both. The images (with suitable reduction
057029,000032: ## in storage size and consequent reduction in image quality as well) are
057030,000033: ## available online at www.ibiblio.org/apollo. If for some reason you
057031,000034: ## find that the images are illegible, contact me at info@sandroid.org
057032,000035: ## about getting access to the (much) higher-quality images which Paul
057033,000036: ## actually created.
057034,000037: ##
057035,000038: ## The code has been modified to match LMY99 Revision 0, otherwise
057036,000039: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
057037,000040: ## the listing from which it was transcribed. It has been verified to
057038,000041: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
057039,000042: ## of Luminary Revision 99 (for which we do not have scans).
057040,000043: ##
057041,000044: ## Notations on Allan Klumpp's listing read, in part:
057042,000045: ##
057043,000046: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
057044,000047:
Page 1303 |
057046,000049: 01,3526 BANK 01
057047,000050: 01,2000 SETLOC RESTART
057048,000051: 01,2000 BANK
057049,000052:
057050,000053: 01,3526 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
057051,000054:
057052,000055: 01,3526 COUNT* $$/RSROU
057053,000056: 01,3526 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
057054,000057: 01,3527 60000 DOUBLE # SAVE FOR INDEXING
057055,000058: 01,3530 54155 TS TEMP2G
057056,000059:
057057,000060: 01,3531 33770 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
057058,000061: 01,3532 54157 TS TEMPSWCH # TABLE PHASE
057059,000062:
057060,000063: 01,3533 33565 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
057061,000064: 01,3534 54707 TS GOLOC +2 # GROUP AFTER THIS
057062,000065:
057063,000066: 01,3535 30154 CA TEMPPHS
057064,000067: 01,3536 75007 MASK OCT1400
057065,000068: 01,3537 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
057066,000069: 01,3540 13551 TCF ITSAVAR # IT:S A VARIABLE RESTART
057067,000070:
057068,000071: 01,3541 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
057069,000072: 01,3542 10000 CCS A
057070,000073: 01,3543 13651 TCF ITSATBL # NO, ITS A TABLE RESTART
057071,000074:
057072,000075: 01,3544 35024 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
057073,000076: 01,3545 05105 TC FINDVAC # THE DISPLAY RESTART JOB
057074,000077: 01,3546 E3,1400 EBANK= LST1
057075,000078: 01,3546 03037 20103 2CADR INITDSP
057076,000079:
057077,000080: 01,3550 03565 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
057078,000081:
057079,000082: 01,3551 75007 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
057080,000083: 01,3552 10000 CCS A
057081,000084: 01,3553 13622 TCF ITSLIKEB # YES, IT IS TYPE B
057082,000085:
057083,000086: 01,3554 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
057084,000087: 01,3555 50155 NDX TEMP2G
057085,000088: 01,3556 31437 DCA PHSNAME1
057086,000089: 01,3557 52706 DXCH GOLOC
057087,000090:
057088,000091: 01,3560 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
057089,000092: 01,3561 74757 MASK OCT7
057090,000093: 01,3562 67746 AD MINUS2
057091,000094: 01,3563 10000 CCS A
057092,000095: 01,3564 13734 TCF ITSLNGCL # ITS A LONGCALL
057093,000096:
057094,000097: 01,3565 04631 RTRNCADR TC SWRETURN # CANT GET HERE
Page 1304 |
057096,000099: 01,3566 13570 TCF ITSAWAIT
057097,000100:
057098,000101: 01,3567 13635 TCF ITSAJOB # ITS A JOB
057099,000102:
057100,000103: 01,3570 33774 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
057101,000104: 01,3571 54704 TS GOLOC -1
057102,000105:
057103,000106: 01,3572 50155 NDX TEMP2G # DIRECTLY STORED
057104,000107: 01,3573 31054 CA PHSPRDT1
057105,000108: 01,3574 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
057106,000109: 01,3575 24000 INCR A # NO,
057107,000110: 01,3576 13601 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
057108,000111:
057109,000112: 01,3577 15436 TCF ITSINDIR # STORED INDIRECTLY
057110,000113:
057111,000114: 01,3600 13620 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
057112,000115:
057113,000116: # ***** THIS MUST BE IN FIXED FIXED *****
057114,000117:
057115,000118: 5436 BLOCK 02
057116,000119: 4000 SETLOC FFTAG2
057117,000120: 4000 BANK
057118,000121:
057119,000122: 5436 COUNT* $$/RSROU
057120,000123: 5436 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
057121,000124: 5437 22006 LXCH BB # SWITCHED ERRASIBLE
057122,000125:
057123,000126: 5440 50000 NDX A # GET THE TIME INDIRECTLY
057124,000127: 5441 30001 CA 1
057125,000128:
057126,000129: 5442 22006 LXCH BB # RESTORE THE BB AND GOLOC
057127,000130: 5443 22706 LXCH GOLOC +1
057128,000131:
057129,000132: 5444 13601 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
057130,000133:
057131,000134: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
057132,000135:
057133,000136: 01,3601 BANK 01
057134,000137: 01,2000 SETLOC RESTART
057135,000138: 01,2000 BANK
057136,000139:
057137,000140: 01,3601 COUNT* $$/RSROU
057138,000141: 01,3601 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
057139,000142: 01,3602 54001 TS L # AND SAVE
057140,000143: 01,3603 50155 NDX TEMP2G
057141,000144: 01,3604 41053 CS TBASE1
057142,000145: 01,3605 00006 EXTEND
057143,000146: 01,3606 60025 SU TIME1
057144,000147: 01,3607 10000 CCS A
057145,000148: 01,3610 40000 COM
Page 1305 |
057147,000150: 01,3611 67731 AD OCT37776
057148,000151: 01,3612 64753 AD ONE
057149,000152: 01,3613 60001 AD L
057150,000153: 01,3614 10000 CCS A
057151,000154: 01,3615 34755 CA ZERO
057152,000155: 01,3616 13620 TCF +2
057153,000156: 01,3617 13620 TCF +1
057154,000157: 01,3620 64753 IMEDIATE AD ONE
057155,000158: 01,3621 00704 TC GOLOC -1
057156,000159: 01,3622 33565 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
057157,000160: 01,3623 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
057158,000161:
057159,000162: 01,3624 33771 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
057160,000163: 01,3625 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
057161,000164:
057162,000165: 01,3626 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
057163,000166: 01,3627 76074 MASK OCT177 # PART OF THIS VARIABLE PHASE
057164,000167: 01,3630 54154 TS TEMPPHS
057165,000168:
057166,000169: 01,3631 00006 EXTEND
057167,000170: 01,3632 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
057168,000171: 01,3633 31437 DCA PHSNAME1
057169,000172: 01,3634 52706 DXCH GOLOC
057170,000173:
057171,000174: 01,3635 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
057172,000175: 01,3636 31054 CA PHSPRDT1
057173,000176: 01,3637 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
057174,000177: 01,3640 00006 EXTEND # A FINDVAC OR A NOVAC
057175,000178: 01,3641 63645 BZMF ITSNOVAC
057176,000179:
057177,000180: 01,3642 33773 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
057178,000181: 01,3643 56704 XCH GOLOC -1 # PICK UP PRIO,
057179,000182: 01,3644 00704 TC GOLOC -1 # AND GO
057180,000183:
057181,000184: 01,3645 33775 ITSNOVAC CAF NOVACADR # NEGATIVE,
057182,000185: 01,3646 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
057183,000186: 01,3647 40000 COM # CORRECT PRIO,
057184,000187: 01,3650 00704 TC GOLOC -1 # AND GO
057185,000188:
057186,000189: 01,3651 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
057187,000190: 01,3652 10020 CCS CYR
057188,000191: 01,3653 13654 TCF +1 # IT:S EVEN
057189,000192: 01,3654 13752 TCF ITSEVEN
057190,000193:
057191,000194: 01,3655 33565 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
057192,000195: 01,3656 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
057193,000196:
057194,000197: 01,3657 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
057195,000198: 01,3660 54021 TS SR # THE RESTART TABLES
057196,000199: 01,3661 60021 AD SR
Page 1306 |
057198,000201: 01,3662 50155 NDX TEMP2G
057199,000202: 01,3663 62003 AD SIZETAB +1
057200,000203: 01,3664 54156 TS POINTER
057201,000204:
057202,000205: 01,3665 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
057203,000206: 01,3666 50156 NDX POINTER
057204,000207: 01,3667 32002 DCA CADRTAB # GET THE 2CADR
057205,000208:
057206,000209: 01,3670 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
057207,000210:
057208,000211: 01,3671 10000 CCS A # IS IT A JOB OR IS IT TIMED
057209,000212: 01,3672 24000 INCR A # POSITIVE, MUST BE A JOB
057210,000213: 01,3673 13746 TCF ITSAJOB2
057211,000214:
057212,000215: 01,3674 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
057213,000216: 01,3675 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
057214,000217:
057215,000218: 01,3676 33774 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
057216,000219: 01,3677 54704 TS GOLOC -1
057217,000220:
057218,000221: 01,3700 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
057219,000222: 01,3701 74742 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
057220,000223: 01,3702 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
057221,000224: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
057222,000225: # IN IMPORTANCE ANYWAY. BIT 4
057223,000226: 01,3703 13741 TCF ITSWTLST # IT IS A WAITLIST CALL
057224,000227:
057225,000228: 01,3704 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
057226,000229: 01,3705 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
057227,000230:
057228,000231: 01,3706 15445 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
057229,000232:
057230,000233: # ***** THIS MUST BE IN FIXED FIXED *****
057231,000234:
057232,000235: 5445 BLOCK 02
057233,000236: 4000 SETLOC FFTAG2
057234,000237: 4000 BANK
057235,000238:
057236,000239: 5445 COUNT* $$/RSROU
057237,000240: 5445 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
057238,000241: 5446 22006 LXCH BB
057239,000242: 5447 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
057240,000243:
057241,000244: 5450 00006 EXTEND # GET THE DELTA TIME
057242,000245: 5451 50000 NDX A
057243,000246: 5452 30001 DCA 0
057244,000247:
057245,000248: 5453 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
057246,000249: 5454 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
057247,000250: 5455 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
Page 1307 |
057249,000252: 5456 13707 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
057250,000253:
057251,000254: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
057252,000255:
057253,000256: 01,3707 BANK 01
057254,000257: 01,2000 SETLOC RESTART
057255,000258: 01,2000 BANK
057256,000259:
057257,000260: 01,3707 COUNT* $$/RSROU
057258,000261: 01,3707 53154 ITSLGCL2 DXCH LONGTIME
057259,000262:
057260,000263: 01,3710 00006 EXTEND # CALCULATE TIME LEFT
057261,000264: 01,3711 40025 DCS TIME2
057262,000265: 01,3712 21154 DAS LONGTIME
057263,000266: 01,3713 00006 EXTEND
057264,000267: 01,3714 31152 DCA LONGBASE
057265,000268: 01,3715 21154 DAS LONGTIME
057266,000269:
057267,000270: 01,3716 11153 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
057268,000271: 01,3717 13727 TCF LONGCLCL
057269,000272: 01,3720 13722 TCF +2
057270,000273: 01,3721 13615 TCF IMEDIATE -3
057271,000274: 01,3722 11154 CCS LONGTIME +1
057272,000275: 01,3723 13727 TCF LONGCLCL
057273,000276: 01,3724 13725 NOOP # CAN:T GET HERE *********
057274,000277: 01,3725 13615 TCF IMEDIATE -3
057275,000278: 01,3726 13620 TCF IMEDIATE
057276,000279:
057277,000280: 01,3727 33772 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
057278,000281: 01,3730 54704 TS GOLOC -1
057279,000282:
057280,000283: 01,3731 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
057281,000284: 01,3732 31154 DCA LONGTIME
057282,000285: 01,3733 00704 TC GOLOC -1
057283,000286:
057284,000287: 01,3734 33774 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
057285,000288: 01,3735 54704 TS GOLOC -1
057286,000289:
057287,000290: 01,3736 50155 NDX TEMP2G
057288,000291: 01,3737 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
057289,000292:
057290,000293: 01,3740 15445 TCF ITSLGCL1 # NOW GET THE DELTA TIME
057291,000294:
057292,000295: 01,3741 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
057293,000296: 01,3742 54706 TS GOLOC +1
057294,000297:
057295,000298: 01,3743 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
057296,000299: 01,3744 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
057297,000300:
057298,000301: 01,3745 13574 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
057299,000302:
Page 1308 |
057301,000304: 01,3746 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
057302,000305:
057303,000306: 01,3747 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
057304,000307: 01,3750 32000 CA PRDTTAB
057305,000308:
057306,000309: 01,3751 13637 TCF CHKNOVAC
057307,000310:
057308,000311: 01,3752 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
057309,000312: 01,3753 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
057310,000313:
057311,000314: 01,3754 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
057312,000315: 01,3755 32002 CA SIZETAB # THE TABLE
057313,000316: 01,3756 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
057314,000317: 01,3757 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
057315,000318: 01,3760 60154 AD TEMPPHS
057316,000319: 01,3761 54156 TS POINTER
057317,000320:
057318,000321: 01,3762 13665 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
057319,000322:
057320,000323: 01,3763 36245 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
057321,000324: 01,3764 26156 ADS POINTER # THE TABLE
057322,000325:
057323,000326: 01,3765 33565 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
057324,000327: 01,3766 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
057325,000328: # GROUP
057326,000329: 01,3767 13665 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
057327,000330:
057328,000331: 01,3770 0154 TEMPPHS EQUALS MPAC
057329,000332: 01,3770 0155 TEMP2G EQUALS MPAC +1
057330,000333: 01,3770 0156 POINTER EQUALS MPAC +2
057331,000334: 01,3770 0157 TEMPSWCH EQUALS MPAC +3
057332,000335: 01,3770 0705 GOLOC EQUALS VAC5 +20D
057333,000336: 01,3770 7746 MINUS2 EQUALS NEG2
057334,000337: 01,3770 6074 OCT177 EQUALS LOW7
057335,000338:
057336,000339: 01,3770 03763 PHS2CADR GENADR PHSPART2
057337,000340: 01,3771 03541 PRT2CADR GENADR GETPART2
057338,000341: 01,3772 05277 LGCLCADR GENADR LONGCALL
057339,000342: 01,3773 05105 FVACCADR GENADR FINDVAC
057340,000343: 01,3774 05203 WTLTCADR GENADR WAITLIST
057341,000344: 01,3775 05072 NOVACADR GENADR NOVAC
057342,000345:
057343,000346:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc