Source Code
These source-code files are part of a reconstructed copy of Luminary 97, the
second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer
(AGC) software. It was created to fix two incorrect ephemeris constants in
Luminary 96, as described by anomaly report LNY-59.
The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 97 listing. Comments from 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. |
055007,000002: ## Copyright: Public domain.
055008,000003: ## Filename: RESTARTS_ROUTINE.agc
055009,000004: ## Purpose: A section of Luminary revision 97.
055010,000005: ## It is part of the reconstructed source code for the
055011,000006: ## second release of the flight software for the Lunar
055012,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
055013,000008: ## It was created to fix two incorrect ephemeris constants in
055014,000009: ## Luminary 96, as described by anomaly report LNY-59.
055015,000010: ## The code has been recreated from a copy of Luminary 99
055016,000011: ## revision 001, using asterisks indicating changed lines in
055017,000012: ## the listing and Luminary Memos #83 and #85, which list
055018,000013: ## changes between Luminary 97 and 98, and 98 and 99. The
055019,000014: ## code has been adapted such that the resulting bugger words
055020,000015: ## exactly match those specified for Luminary 97 in NASA drawing
055021,000016: ## 2021152D, which gives relatively high confidence that the
055022,000017: ## reconstruction is correct.
055023,000018: ## Reference: pp. 1303-1308
055024,000019: ## Assembler: yaYUL
055025,000020: ## Contact: Ron Burkey <info@sandroid.org>.
055026,000021: ## Website: www.ibiblio.org/apollo/index.html
055027,000022: ## Mod history: 2019-07-28 MAS Created from Luminary 99.
055028,000023:
Page 1303 |
055030,000025: 01,3526 BANK 01
055031,000026: 01,2000 SETLOC RESTART
055032,000027: 01,2000 BANK
055033,000028:
055034,000029: 01,3526 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
055035,000030:
055036,000031: 01,3526 COUNT* $$/RSROU
055037,000032: 01,3526 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
055038,000033: 01,3527 60000 DOUBLE # SAVE FOR INDEXING
055039,000034: 01,3530 54155 TS TEMP2G
055040,000035:
055041,000036: 01,3531 33770 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
055042,000037: 01,3532 54157 TS TEMPSWCH # TABLE PHASE
055043,000038:
055044,000039: 01,3533 33565 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
055045,000040: 01,3534 54707 TS GOLOC +2 # GROUP AFTER THIS
055046,000041:
055047,000042: 01,3535 30154 CA TEMPPHS
055048,000043: 01,3536 75007 MASK OCT1400
055049,000044: 01,3537 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
055050,000045: 01,3540 13551 TCF ITSAVAR # IT:S A VARIABLE RESTART
055051,000046:
055052,000047: 01,3541 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
055053,000048: 01,3542 10000 CCS A
055054,000049: 01,3543 13651 TCF ITSATBL # NO, ITS A TABLE RESTART
055055,000050:
055056,000051: 01,3544 35024 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
055057,000052: 01,3545 05105 TC FINDVAC # THE DISPLAY RESTART JOB
055058,000053: 01,3546 E3,1400 EBANK= LST1
055059,000054: 01,3546 03037 20103 2CADR INITDSP
055060,000055:
055061,000056: 01,3550 03565 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
055062,000057:
055063,000058: 01,3551 75007 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
055064,000059: 01,3552 10000 CCS A
055065,000060: 01,3553 13622 TCF ITSLIKEB # YES, IT IS TYPE B
055066,000061:
055067,000062: 01,3554 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
055068,000063: 01,3555 50155 NDX TEMP2G
055069,000064: 01,3556 31437 DCA PHSNAME1
055070,000065: 01,3557 52706 DXCH GOLOC
055071,000066:
055072,000067: 01,3560 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
055073,000068: 01,3561 74757 MASK OCT7
055074,000069: 01,3562 67746 AD MINUS2
055075,000070: 01,3563 10000 CCS A
055076,000071: 01,3564 13734 TCF ITSLNGCL # ITS A LONGCALL
055077,000072:
055078,000073: 01,3565 04631 RTRNCADR TC SWRETURN # CANT GET HERE
Page 1304 |
055080,000075: 01,3566 13570 TCF ITSAWAIT
055081,000076:
055082,000077: 01,3567 13635 TCF ITSAJOB # ITS A JOB
055083,000078:
055084,000079: 01,3570 33774 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
055085,000080: 01,3571 54704 TS GOLOC -1
055086,000081:
055087,000082: 01,3572 50155 NDX TEMP2G # DIRECTLY STORED
055088,000083: 01,3573 31054 CA PHSPRDT1
055089,000084: 01,3574 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
055090,000085: 01,3575 24000 INCR A # NO,
055091,000086: 01,3576 13601 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
055092,000087:
055093,000088: 01,3577 15436 TCF ITSINDIR # STORED INDIRECTLY
055094,000089:
055095,000090: 01,3600 13620 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
055096,000091:
055097,000092: # ***** THIS MUST BE IN FIXED FIXED *****
055098,000093:
055099,000094: 5436 BLOCK 02
055100,000095: 4000 SETLOC FFTAG2
055101,000096: 4000 BANK
055102,000097:
055103,000098: 5436 COUNT* $$/RSROU
055104,000099: 5436 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
055105,000100: 5437 22006 LXCH BB # SWITCHED ERRASIBLE
055106,000101:
055107,000102: 5440 50000 NDX A # GET THE TIME INDIRECTLY
055108,000103: 5441 30001 CA 1
055109,000104:
055110,000105: 5442 22006 LXCH BB # RESTORE THE BB AND GOLOC
055111,000106: 5443 22706 LXCH GOLOC +1
055112,000107:
055113,000108: 5444 13601 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
055114,000109:
055115,000110: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
055116,000111:
055117,000112: 01,3601 BANK 01
055118,000113: 01,2000 SETLOC RESTART
055119,000114: 01,2000 BANK
055120,000115:
055121,000116: 01,3601 COUNT* $$/RSROU
055122,000117: 01,3601 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
055123,000118: 01,3602 54001 TS L # AND SAVE
055124,000119: 01,3603 50155 NDX TEMP2G
055125,000120: 01,3604 41053 CS TBASE1
055126,000121: 01,3605 00006 EXTEND
055127,000122: 01,3606 60025 SU TIME1
055128,000123: 01,3607 10000 CCS A
055129,000124: 01,3610 40000 COM
Page 1305 |
055131,000126: 01,3611 67731 AD OCT37776
055132,000127: 01,3612 64753 AD ONE
055133,000128: 01,3613 60001 AD L
055134,000129: 01,3614 10000 CCS A
055135,000130: 01,3615 34755 CA ZERO
055136,000131: 01,3616 13620 TCF +2
055137,000132: 01,3617 13620 TCF +1
055138,000133: 01,3620 64753 IMEDIATE AD ONE
055139,000134: 01,3621 00704 TC GOLOC -1
055140,000135: 01,3622 33565 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
055141,000136: 01,3623 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
055142,000137:
055143,000138: 01,3624 33771 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
055144,000139: 01,3625 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
055145,000140:
055146,000141: 01,3626 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
055147,000142: 01,3627 76074 MASK OCT177 # PART OF THIS VARIABLE PHASE
055148,000143: 01,3630 54154 TS TEMPPHS
055149,000144:
055150,000145: 01,3631 00006 EXTEND
055151,000146: 01,3632 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
055152,000147: 01,3633 31437 DCA PHSNAME1
055153,000148: 01,3634 52706 DXCH GOLOC
055154,000149:
055155,000150: 01,3635 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
055156,000151: 01,3636 31054 CA PHSPRDT1
055157,000152: 01,3637 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
055158,000153: 01,3640 00006 EXTEND # A FINDVAC OR A NOVAC
055159,000154: 01,3641 63645 BZMF ITSNOVAC
055160,000155:
055161,000156: 01,3642 33773 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
055162,000157: 01,3643 56704 XCH GOLOC -1 # PICK UP PRIO,
055163,000158: 01,3644 00704 TC GOLOC -1 # AND GO
055164,000159:
055165,000160: 01,3645 33775 ITSNOVAC CAF NOVACADR # NEGATIVE,
055166,000161: 01,3646 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
055167,000162: 01,3647 40000 COM # CORRECT PRIO,
055168,000163: 01,3650 00704 TC GOLOC -1 # AND GO
055169,000164:
055170,000165: 01,3651 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
055171,000166: 01,3652 10020 CCS CYR
055172,000167: 01,3653 13654 TCF +1 # IT:S EVEN
055173,000168: 01,3654 13752 TCF ITSEVEN
055174,000169:
055175,000170: 01,3655 33565 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
055176,000171: 01,3656 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
055177,000172:
055178,000173: 01,3657 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
055179,000174: 01,3660 54021 TS SR # THE RESTART TABLES
055180,000175: 01,3661 60021 AD SR
Page 1306 |
055182,000177: 01,3662 50155 NDX TEMP2G
055183,000178: 01,3663 62003 AD SIZETAB +1
055184,000179: 01,3664 54156 TS POINTER
055185,000180:
055186,000181: 01,3665 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
055187,000182: 01,3666 50156 NDX POINTER
055188,000183: 01,3667 32002 DCA CADRTAB # GET THE 2CADR
055189,000184:
055190,000185: 01,3670 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
055191,000186:
055192,000187: 01,3671 10000 CCS A # IS IT A JOB OR IS IT TIMED
055193,000188: 01,3672 24000 INCR A # POSITIVE, MUST BE A JOB
055194,000189: 01,3673 13746 TCF ITSAJOB2
055195,000190:
055196,000191: 01,3674 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
055197,000192: 01,3675 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
055198,000193:
055199,000194: 01,3676 33774 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
055200,000195: 01,3677 54704 TS GOLOC -1
055201,000196:
055202,000197: 01,3700 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
055203,000198: 01,3701 74742 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
055204,000199: 01,3702 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
055205,000200: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
055206,000201: # IN IMPORTANCE ANYWAY. BIT 4
055207,000202: 01,3703 13741 TCF ITSWTLST # IT IS A WAITLIST CALL
055208,000203:
055209,000204: 01,3704 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
055210,000205: 01,3705 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
055211,000206:
055212,000207: 01,3706 15445 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
055213,000208:
055214,000209: # ***** THIS MUST BE IN FIXED FIXED *****
055215,000210:
055216,000211: 5445 BLOCK 02
055217,000212: 4000 SETLOC FFTAG2
055218,000213: 4000 BANK
055219,000214:
055220,000215: 5445 COUNT* $$/RSROU
055221,000216: 5445 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
055222,000217: 5446 22006 LXCH BB
055223,000218: 5447 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
055224,000219:
055225,000220: 5450 00006 EXTEND # GET THE DELTA TIME
055226,000221: 5451 50000 NDX A
055227,000222: 5452 30001 DCA 0
055228,000223:
055229,000224: 5453 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
055230,000225: 5454 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
055231,000226: 5455 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
Page 1307 |
055233,000228: 5456 13707 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
055234,000229:
055235,000230: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
055236,000231:
055237,000232: 01,3707 BANK 01
055238,000233: 01,2000 SETLOC RESTART
055239,000234: 01,2000 BANK
055240,000235:
055241,000236: 01,3707 COUNT* $$/RSROU
055242,000237: 01,3707 53154 ITSLGCL2 DXCH LONGTIME
055243,000238:
055244,000239: 01,3710 00006 EXTEND # CALCULATE TIME LEFT
055245,000240: 01,3711 40025 DCS TIME2
055246,000241: 01,3712 21154 DAS LONGTIME
055247,000242: 01,3713 00006 EXTEND
055248,000243: 01,3714 31152 DCA LONGBASE
055249,000244: 01,3715 21154 DAS LONGTIME
055250,000245:
055251,000246: 01,3716 11153 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
055252,000247: 01,3717 13727 TCF LONGCLCL
055253,000248: 01,3720 13722 TCF +2
055254,000249: 01,3721 13615 TCF IMEDIATE -3
055255,000250: 01,3722 11154 CCS LONGTIME +1
055256,000251: 01,3723 13727 TCF LONGCLCL
055257,000252: 01,3724 13725 NOOP # CAN:T GET HERE *********
055258,000253: 01,3725 13615 TCF IMEDIATE -3
055259,000254: 01,3726 13620 TCF IMEDIATE
055260,000255:
055261,000256: 01,3727 33772 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
055262,000257: 01,3730 54704 TS GOLOC -1
055263,000258:
055264,000259: 01,3731 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
055265,000260: 01,3732 31154 DCA LONGTIME
055266,000261: 01,3733 00704 TC GOLOC -1
055267,000262:
055268,000263: 01,3734 33774 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
055269,000264: 01,3735 54704 TS GOLOC -1
055270,000265:
055271,000266: 01,3736 50155 NDX TEMP2G
055272,000267: 01,3737 41054 CS PHSPRDT1 # GET THE DELTA T ADDRESS
055273,000268:
055274,000269: 01,3740 15445 TCF ITSLGCL1 # NOW GET THE DELTA TIME
055275,000270:
055276,000271: 01,3741 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
055277,000272: 01,3742 54706 TS GOLOC +1
055278,000273:
055279,000274: 01,3743 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
055280,000275: 01,3744 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
055281,000276:
055282,000277: 01,3745 13574 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
055283,000278:
Page 1308 |
055285,000280: 01,3746 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
055286,000281:
055287,000282: 01,3747 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
055288,000283: 01,3750 32000 CA PRDTTAB
055289,000284:
055290,000285: 01,3751 13637 TCF CHKNOVAC
055291,000286:
055292,000287: 01,3752 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
055293,000288: 01,3753 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
055294,000289:
055295,000290: 01,3754 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
055296,000291: 01,3755 32002 CA SIZETAB # THE TABLE
055297,000292: 01,3756 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
055298,000293: 01,3757 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
055299,000294: 01,3760 60154 AD TEMPPHS
055300,000295: 01,3761 54156 TS POINTER
055301,000296:
055302,000297: 01,3762 13665 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
055303,000298:
055304,000299: 01,3763 36245 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
055305,000300: 01,3764 26156 ADS POINTER # THE TABLE
055306,000301:
055307,000302: 01,3765 33565 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
055308,000303: 01,3766 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
055309,000304: # GROUP
055310,000305: 01,3767 13665 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
055311,000306:
055312,000307: 01,3770 0154 TEMPPHS EQUALS MPAC
055313,000308: 01,3770 0155 TEMP2G EQUALS MPAC +1
055314,000309: 01,3770 0156 POINTER EQUALS MPAC +2
055315,000310: 01,3770 0157 TEMPSWCH EQUALS MPAC +3
055316,000311: 01,3770 0705 GOLOC EQUALS VAC5 +20D
055317,000312: 01,3770 7746 MINUS2 EQUALS NEG2
055318,000313: 01,3770 6074 OCT177 EQUALS LOW7
055319,000314:
055320,000315: 01,3770 03763 PHS2CADR GENADR PHSPART2
055321,000316: 01,3771 03541 PRT2CADR GENADR GETPART2
055322,000317: 01,3772 05277 LGCLCADR GENADR LONGCALL
055323,000318: 01,3773 05105 FVACCADR GENADR FINDVAC
055324,000319: 01,3774 05203 WTLTCADR GENADR WAITLIST
055325,000320: 01,3775 05072 NOVACADR GENADR NOVAC
055326,000321:
055327,000322:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc