Source Code
These source-code files are part of a reconstructed copy of Luminary 178, the
final release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 178 listing would be different. 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. |
055336,000002: ## Copyright: Public domain.
055337,000003: ## Filename: RESTARTS_ROUTINE.agc
055338,000004: ## Purpose: A section of Luminary revision 178.
055339,000005: ## It is part of the reconstructed source code for the final
055340,000006: ## release of the flight software for the Lunar Module's
055341,000007: ## (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
055342,000008: ## code has been recreated from copies of Zerlina 56, Luminary
055343,000009: ## 210, and Luminary 131, as well as many Luminary memos.
055344,000010: ## It has been adapted such that the resulting bugger words
055345,000011: ## exactly match those specified for Luminary 178 in NASA
055346,000012: ## drawing 2021152N, which gives relatively high confidence
055347,000013: ## that the reconstruction is correct.
055348,000014: ## Reference: pp. 1292-1297
055349,000015: ## Assembler: yaYUL
055350,000016: ## Contact: Ron Burkey <info@sandroid.org>.
055351,000017: ## Website: www.ibiblio.org/apollo/index.html
055352,000018: ## Mod history: 2019-08-14 MAS Created from Zerlina 56.
055353,000019: ## 2019-09-15 MAS Restored the definition of GOLOC.
055354,000020:
Page 1292 |
055356,000022: 01,3530 BANK 01
055357,000023: 01,2000 SETLOC RESTART
055358,000024: 01,2000 BANK
055359,000025:
055360,000026: 01,3530 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
055361,000027:
055362,000028: 01,3530 COUNT* $$/RSROU
055363,000029: 01,3530 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
055364,000030: 01,3531 60000 DOUBLE # SAVE FOR INDEXING
055365,000031: 01,3532 54155 TS TEMP2G
055366,000032:
055367,000033: 01,3533 33772 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
055368,000034: 01,3534 54157 TS TEMPSWCH # TABLE PHASE
055369,000035:
055370,000036: 01,3535 33567 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
055371,000037: 01,3536 54707 TS GOLOC +2 # GROUP AFTER THIS
055372,000038:
055373,000039: 01,3537 30154 CA TEMPPHS
055374,000040: 01,3540 75007 MASK OCT1400
055375,000041: 01,3541 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
055376,000042: 01,3542 13553 TCF ITSAVAR # IT:S A VARIABLE RESTART
055377,000043:
055378,000044: 01,3543 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
055379,000045: 01,3544 10000 CCS A
055380,000046: 01,3545 13653 TCF ITSATBL # NO, ITS A TABLE RESTART
055381,000047:
055382,000048: 01,3546 35024 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
055383,000049: 01,3547 05105 TC FINDVAC # THE DISPLAY RESTART JOB
055384,000050: 01,3550 E3,1400 EBANK= LST1
055385,000051: 01,3550 03040 20103 2CADR INITDSP
055386,000052:
055387,000053: 01,3552 03567 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
055388,000054:
055389,000055: 01,3553 75007 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
055390,000056: 01,3554 10000 CCS A
055391,000057: 01,3555 13624 TCF ITSLIKEB # YES,IT IS TYPE B
055392,000058:
055393,000059: 01,3556 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
055394,000060: 01,3557 50155 NDX TEMP2G
055395,000061: 01,3560 31437 DCA PHSNAME1
055396,000062: 01,3561 52706 DXCH GOLOC
055397,000063:
055398,000064: 01,3562 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
055399,000065: 01,3563 74757 MASK OCT7
055400,000066: 01,3564 67751 AD MINUS2
055401,000067: 01,3565 10000 CCS A
055402,000068: 01,3566 13736 TCF ITSLNGCL # ITS A LONGCALL
055403,000069:
055404,000070: 01,3567 04631 RTRNCADR TC SWRETURN # CANT GET HERE
055405,000071:
Page 1293 |
055407,000073: 01,3570 13572 TCF ITSAWAIT
055408,000074:
055409,000075: 01,3571 13637 TCF ITSAJOB # ITS A JOB
055410,000076:
055411,000077: 01,3572 34352 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
055412,000078: 01,3573 54704 TS GOLOC -1
055413,000079:
055414,000080: 01,3574 50155 NDX TEMP2G # DIRECTLY STORED
055415,000081: 01,3575 31053 CA PHSPRDT1
055416,000082: 01,3576 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
055417,000083: 01,3577 24000 INCR A # NO,
055418,000084: 01,3600 13603 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
055419,000085:
055420,000086: 01,3601 15447 TCF ITSINDIR # STORED INDIRECTLY
055421,000087:
055422,000088: 01,3602 13622 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
055423,000089:
055424,000090: # ***** THIS MUST BE IN FIXED FIXED *****
055425,000091:
055426,000092: 5447 BLOCK 02
055427,000093: 4000 SETLOC FFTAG2
055428,000094: 4000 BANK
055429,000095:
055430,000096: 5447 COUNT* $$/RSROU
055431,000097: 5447 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
055432,000098: 5450 22006 LXCH BB # SWITCHED ERRASIBLE
055433,000099:
055434,000100: 5451 50000 NDX A # GET THE TIME INDIRECTLY
055435,000101: 5452 30001 CA 1
055436,000102:
055437,000103: 5453 22006 LXCH BB # RESTORE THE BB AND GOLOC
055438,000104: 5454 22706 LXCH GOLOC +1
055439,000105:
055440,000106: 5455 13603 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
055441,000107:
055442,000108: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
055443,000109:
055444,000110: 01,3603 BANK 01
055445,000111: 01,2000 SETLOC RESTART
055446,000112: 01,2000 BANK
055447,000113:
055448,000114: 01,3603 COUNT* $$/RSROU
055449,000115: 01,3603 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
055450,000116: 01,3604 54001 TS L # AND SAVE
055451,000117: 01,3605 50155 NDX TEMP2G
055452,000118: 01,3606 41052 CS TBASE1
055453,000119: 01,3607 00006 EXTEND
055454,000120: 01,3610 60025 SU TIME1
055455,000121: 01,3611 10000 CCS A
055456,000122: 01,3612 40000 COM
055457,000123:
Page 1294 |
055459,000125: 01,3613 67734 AD OCT37776
055460,000126: 01,3614 64753 AD ONE
055461,000127: 01,3615 60001 AD L
055462,000128: 01,3616 10000 CCS A
055463,000129: 01,3617 34755 CA ZERO
055464,000130: 01,3620 13622 TCF +2
055465,000131: 01,3621 13622 TCF +1
055466,000132: 01,3622 64753 IMEDIATE AD ONE
055467,000133: 01,3623 00704 TC GOLOC -1
055468,000134: 01,3624 33567 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
055469,000135: 01,3625 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
055470,000136:
055471,000137: 01,3626 33773 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
055472,000138: 01,3627 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
055473,000139:
055474,000140: 01,3630 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
055475,000141: 01,3631 76077 MASK OCT177 # PART OF THIS VARIABLE PHASE
055476,000142: 01,3632 54154 TS TEMPPHS
055477,000143:
055478,000144: 01,3633 00006 EXTEND
055479,000145: 01,3634 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
055480,000146: 01,3635 31437 DCA PHSNAME1
055481,000147: 01,3636 52706 DXCH GOLOC
055482,000148:
055483,000149: 01,3637 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
055484,000150: 01,3640 31053 CA PHSPRDT1
055485,000151: 01,3641 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
055486,000152: 01,3642 00006 EXTEND # A FINDVAC OR A NOVAC
055487,000153: 01,3643 63647 BZMF ITSNOVAC
055488,000154:
055489,000155: 01,3644 34354 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
055490,000156: 01,3645 56704 XCH GOLOC -1 # PICK UP PRIO,
055491,000157: 01,3646 00704 TC GOLOC -1 # AND GO
055492,000158:
055493,000159: 01,3647 34351 ITSNOVAC CAF NOVACADR # NEGATIVE,
055494,000160: 01,3650 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
055495,000161: 01,3651 40000 COM # CORRECT PRIO,
055496,000162: 01,3652 00704 TC GOLOC -1 # AND GO
055497,000163:
055498,000164: 01,3653 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
055499,000165: 01,3654 10020 CCS CYR
055500,000166: 01,3655 13656 TCF +1 # IT:S EVEN
055501,000167: 01,3656 13754 TCF ITSEVEN
055502,000168:
055503,000169: 01,3657 33567 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
055504,000170: 01,3660 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
055505,000171:
055506,000172: 01,3661 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
055507,000173: 01,3662 54021 TS SR # THE RESTART TABLES
055508,000174: 01,3663 60021 AD SR
055509,000175:
Page 1295 |
055511,000177: 01,3664 50155 NDX TEMP2G
055512,000178: 01,3665 62003 AD SIZETAB +1
055513,000179: 01,3666 54156 TS POINTER
055514,000180:
055515,000181: 01,3667 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
055516,000182: 01,3670 50156 NDX POINTER
055517,000183: 01,3671 32002 DCA CADRTAB # GET THE 2CADR
055518,000184:
055519,000185: 01,3672 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
055520,000186:
055521,000187: 01,3673 10000 CCS A # IS IT A JOB OR IS IT TIMED
055522,000188: 01,3674 24000 INCR A # POSITIVE, MUST BE A JOB
055523,000189: 01,3675 13750 TCF ITSAJOB2
055524,000190:
055525,000191: 01,3676 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
055526,000192: 01,3677 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
055527,000193:
055528,000194: 01,3700 34352 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
055529,000195: 01,3701 54704 TS GOLOC -1
055530,000196:
055531,000197: 01,3702 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
055532,000198: 01,3703 74742 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
055533,000199: 01,3704 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
055534,000200: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
055535,000201: # IN IMPORTANCE ANYWAY. BIT 4
055536,000202: 01,3705 13743 TCF ITSWTLST # IT IS A WAITLIST CALL
055537,000203:
055538,000204: 01,3706 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
055539,000205: 01,3707 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
055540,000206:
055541,000207: 01,3710 15456 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
055542,000208:
055543,000209: # ***** THIS MUST BE IN FIXED FIXED *****
055544,000210:
055545,000211: 5456 BLOCK 02
055546,000212: 4000 SETLOC FFTAG2
055547,000213: 4000 BANK
055548,000214:
055549,000215: 5456 COUNT* $$/RSROU
055550,000216: 5456 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
055551,000217: 5457 22006 LXCH BB
055552,000218: 5460 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
055553,000219:
055554,000220: 5461 00006 EXTEND # GET THE DELTA TIME
055555,000221: 5462 50000 NDX A
055556,000222: 5463 30001 DCA 0
055557,000223:
055558,000224: 5464 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
055559,000225: 5465 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
055560,000226: 5466 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
055561,000227:
Page 1296 |
055563,000229: 5467 13711 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
055564,000230:
055565,000231: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
055566,000232:
055567,000233: 01,3711 BANK 01
055568,000234: 01,2000 SETLOC RESTART
055569,000235: 01,2000 BANK
055570,000236:
055571,000237: 01,3711 COUNT* $$/RSROU
055572,000238: 01,3711 53153 ITSLGCL2 DXCH LONGTIME
055573,000239:
055574,000240: 01,3712 00006 EXTEND # CALCULATE TIME LEFT
055575,000241: 01,3713 40025 DCS TIME2
055576,000242: 01,3714 21153 DAS LONGTIME
055577,000243: 01,3715 00006 EXTEND
055578,000244: 01,3716 31151 DCA LONGBASE
055579,000245: 01,3717 21153 DAS LONGTIME
055580,000246:
055581,000247: 01,3720 11152 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
055582,000248: 01,3721 13731 TCF LONGCLCL
055583,000249: 01,3722 13724 TCF +2
055584,000250: 01,3723 13617 TCF IMEDIATE -3
055585,000251: 01,3724 11153 CCS LONGTIME +1
055586,000252: 01,3725 13731 TCF LONGCLCL
055587,000253: 01,3726 13727 NOOP # CAN:T GET HERE *********
055588,000254: 01,3727 13617 TCF IMEDIATE -3
055589,000255: 01,3730 13622 TCF IMEDIATE
055590,000256:
055591,000257: 01,3731 33774 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
055592,000258: 01,3732 54704 TS GOLOC -1
055593,000259:
055594,000260: 01,3733 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
055595,000261: 01,3734 31153 DCA LONGTIME
055596,000262: 01,3735 00704 TC GOLOC -1
055597,000263:
055598,000264: 01,3736 34352 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
055599,000265: 01,3737 54704 TS GOLOC -1
055600,000266:
055601,000267: 01,3740 50155 NDX TEMP2G
055602,000268: 01,3741 41053 CS PHSPRDT1 # GET THE DELTA T ADDRESS
055603,000269:
055604,000270: 01,3742 15456 TCF ITSLGCL1 # NOW GET THE DELTA TIME
055605,000271:
055606,000272: 01,3743 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
055607,000273: 01,3744 54706 TS GOLOC +1
055608,000274:
055609,000275: 01,3745 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
055610,000276: 01,3746 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
055611,000277:
055612,000278: 01,3747 13576 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
055613,000279:
Page 1297 |
055615,000281: 01,3750 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
055616,000282:
055617,000283: 01,3751 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
055618,000284: 01,3752 32000 CA PRDTTAB
055619,000285:
055620,000286: 01,3753 13641 TCF CHKNOVAC
055621,000287:
055622,000288: 01,3754 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
055623,000289: 01,3755 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
055624,000290:
055625,000291: 01,3756 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
055626,000292: 01,3757 32002 CA SIZETAB # THE TABLE
055627,000293: 01,3760 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
055628,000294: 01,3761 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
055629,000295: 01,3762 60154 AD TEMPPHS
055630,000296: 01,3763 54156 TS POINTER
055631,000297:
055632,000298: 01,3764 13667 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
055633,000299:
055634,000300: 01,3765 36250 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
055635,000301: 01,3766 26156 ADS POINTER # THE TABLE
055636,000302:
055637,000303: 01,3767 33567 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
055638,000304: 01,3770 54707 TS GOLOC +2 # EVEN TABLE , SO AFTER IT GET THE NEXT
055639,000305: # GROUP
055640,000306: 01,3771 13667 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
055641,000307:
055642,000308: 01,3772 0154 TEMPPHS EQUALS MPAC
055643,000309: 01,3772 0155 TEMP2G EQUALS MPAC +1
055644,000310: 01,3772 0156 POINTER EQUALS MPAC +2
055645,000311: 01,3772 0157 TEMPSWCH EQUALS MPAC +3
055646,000312: 01,3772 0705 GOLOC EQUALS VAC5 +20D
055647,000313: 01,3772 7751 MINUS2 EQUALS NEG2
055648,000314: 01,3772 6077 OCT177 EQUALS LOW7
055649,000315:
055650,000316: 01,3772 03765 PHS2CADR GENADR PHSPART2
055651,000317: 01,3773 03543 PRT2CADR GENADR GETPART2
055652,000318: 01,3774 05310 LGCLCADR GENADR LONGCALL
055653,000319: 01,3775 4354 FVACCADR = TCFINDVC
055654,000320: 01,3775 4352 WTLTCADR = TCWAIT
055655,000321: 01,3775 4351 NOVACADR = TCNOVAC
055656,000322:
055657,000323:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc