Source Code
These source-code files are part of a reconstructed copy of LM131 revision 1,
the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 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. |
054513,000002: ## Copyright: Public domain.
054514,000003: ## Filename: RESTARTS_ROUTINE.agc
054515,000004: ## Purpose: A section of LM131 revision 1.
054516,000005: ## It is part of the reconstructed source code for the final
054517,000006: ## release of the flight software for the Lunar Module's (LM)
054518,000007: ## Apollo Guidance Computer (AGC) for Apollo 13. The code has
054519,000008: ## been reconstructed from a listing of Luminary 131 and a dump
054520,000009: ## of a core rope memory module B5, part number 2010802-171,
054521,000010: ## which is the only module different between LM131 revision 1
054522,000011: ## and Luminary 131. The executable generated from this source
054523,000012: ## has been verified against the module dump, so while the names,
054524,000013: ## comments, and ordering may not be exactly correct, the
054525,000014: ## resulting binary is.
054526,000015: ## Reference: pp. 1295-1300
054527,000016: ## Assembler: yaYUL
054528,000017: ## Contact: Ron Burkey <info@sandroid.org>.
054529,000018: ## Website: www.ibiblio.org/apollo/index.html
054530,000019: ## Mod history: 2022-10-28 MAS Created from Luminary 131.
054531,000020:
Page 1295 |
054533,000022: 01,3527 BANK 01
054534,000023: 01,2000 SETLOC RESTART
054535,000024: 01,2000 BANK
054536,000025:
054537,000026: 01,3527 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
054538,000027:
054539,000028: 01,3527 COUNT* $$/RSROU
054540,000029: 01,3527 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
054541,000030: 01,3530 60000 DOUBLE # SAVE FOR INDEXING
054542,000031: 01,3531 54155 TS TEMP2G
054543,000032:
054544,000033: 01,3532 33771 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
054545,000034: 01,3533 54157 TS TEMPSWCH # TABLE PHASE
054546,000035:
054547,000036: 01,3534 33566 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
054548,000037: 01,3535 54707 TS GOLOC +2 # GROUP AFTER THIS
054549,000038:
054550,000039: 01,3536 30154 CA TEMPPHS
054551,000040: 01,3537 75007 MASK OCT1400
054552,000041: 01,3540 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
054553,000042: 01,3541 13552 TCF ITSAVAR # IT:S A VARIABLE RESTART
054554,000043:
054555,000044: 01,3542 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
054556,000045: 01,3543 10000 CCS A
054557,000046: 01,3544 13652 TCF ITSATBL # NO, ITS A TABLE RESTART
054558,000047:
054559,000048: 01,3545 35024 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
054560,000049: 01,3546 05105 TC FINDVAC # THE DISPLAY RESTART JOB
054561,000050: 01,3547 E3,1400 EBANK= LST1
054562,000051: 01,3547 03040 20103 2CADR INITDSP
054563,000052:
054564,000053: 01,3551 03566 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
054565,000054:
054566,000055: 01,3552 75007 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
054567,000056: 01,3553 10000 CCS A
054568,000057: 01,3554 13623 TCF ITSLIKEB # YES, IT IS TYPE B
054569,000058:
054570,000059: 01,3555 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
054571,000060: 01,3556 50155 NDX TEMP2G
054572,000061: 01,3557 31437 DCA PHSNAME1
054573,000062: 01,3560 52706 DXCH GOLOC
054574,000063:
054575,000064: 01,3561 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
054576,000065: 01,3562 74757 MASK OCT7
054577,000066: 01,3563 67751 AD MINUS2
054578,000067: 01,3564 10000 CCS A
054579,000068: 01,3565 13735 TCF ITSLNGCL # ITS A LONGCALL
054580,000069:
054581,000070: 01,3566 04631 RTRNCADR TC SWRETURN # CANT GET HERE
Page 1296 |
054583,000072: 01,3567 13571 TCF ITSAWAIT
054584,000073:
054585,000074: 01,3570 13636 TCF ITSAJOB # ITS A JOB
054586,000075:
054587,000076: 01,3571 33775 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
054588,000077: 01,3572 54704 TS GOLOC -1
054589,000078:
054590,000079: 01,3573 50155 NDX TEMP2G # DIRECTLY STORED
054591,000080: 01,3574 31053 CA PHSPRDT1
054592,000081: 01,3575 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
054593,000082: 01,3576 24000 INCR A # NO,
054594,000083: 01,3577 13602 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
054595,000084:
054596,000085: 01,3600 15436 TCF ITSINDIR # STORED INDIRECTLY
054597,000086:
054598,000087: 01,3601 13621 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
054599,000088:
054600,000089: # ***** THIS MUST BE IN FIXED FIXED *****
054601,000090:
054602,000091: 5436 BLOCK 02
054603,000092: 4000 SETLOC FFTAG2
054604,000093: 4000 BANK
054605,000094:
054606,000095: 5436 COUNT* $$/RSROU
054607,000096: 5436 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
054608,000097: 5437 22006 LXCH BB # SWITCHED ERRASIBLE
054609,000098:
054610,000099: 5440 50000 NDX A # GET THE TIME INDIRECTLY
054611,000100: 5441 30001 CA 1
054612,000101:
054613,000102: 5442 22006 LXCH BB # RESTORE THE BB AND GOLOC
054614,000103: 5443 22706 LXCH GOLOC +1
054615,000104:
054616,000105: 5444 13602 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
054617,000106:
054618,000107: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
054619,000108:
054620,000109: 01,3602 BANK 01
054621,000110: 01,2000 SETLOC RESTART
054622,000111: 01,2000 BANK
054623,000112:
054624,000113: 01,3602 COUNT* $$/RSROU
054625,000114: 01,3602 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
054626,000115: 01,3603 54001 TS L # AND SAVE
054627,000116: 01,3604 50155 NDX TEMP2G
054628,000117: 01,3605 41052 CS TBASE1
054629,000118: 01,3606 00006 EXTEND
054630,000119: 01,3607 60025 SU TIME1
054631,000120: 01,3610 10000 CCS A
054632,000121: 01,3611 40000 COM
Page 1297 |
054634,000123: 01,3612 67734 AD OCT37776
054635,000124: 01,3613 64753 AD ONE
054636,000125: 01,3614 60001 AD L
054637,000126: 01,3615 10000 CCS A
054638,000127: 01,3616 34755 CA ZERO
054639,000128: 01,3617 13621 TCF +2
054640,000129: 01,3620 13621 TCF +1
054641,000130: 01,3621 64753 IMEDIATE AD ONE
054642,000131: 01,3622 00704 TC GOLOC -1
054643,000132: 01,3623 33566 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
054644,000133: 01,3624 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
054645,000134:
054646,000135: 01,3625 33772 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
054647,000136: 01,3626 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
054648,000137:
054649,000138: 01,3627 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
054650,000139: 01,3630 76077 MASK OCT177 # PART OF THIS VARIABLE PHASE
054651,000140: 01,3631 54154 TS TEMPPHS
054652,000141:
054653,000142: 01,3632 00006 EXTEND
054654,000143: 01,3633 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
054655,000144: 01,3634 31437 DCA PHSNAME1
054656,000145: 01,3635 52706 DXCH GOLOC
054657,000146:
054658,000147: 01,3636 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
054659,000148: 01,3637 31053 CA PHSPRDT1
054660,000149: 01,3640 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
054661,000150: 01,3641 00006 EXTEND # A FINDVAC OR A NOVAC
054662,000151: 01,3642 63646 BZMF ITSNOVAC
054663,000152:
054664,000153: 01,3643 33774 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
054665,000154: 01,3644 56704 XCH GOLOC -1 # PICK UP PRIO,
054666,000155: 01,3645 00704 TC GOLOC -1 # AND GO
054667,000156:
054668,000157: 01,3646 33776 ITSNOVAC CAF NOVACADR # NEGATIVE,
054669,000158: 01,3647 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
054670,000159: 01,3650 40000 COM # CORRECT PRIO,
054671,000160: 01,3651 00704 TC GOLOC -1 # AND GO
054672,000161:
054673,000162: 01,3652 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
054674,000163: 01,3653 10020 CCS CYR
054675,000164: 01,3654 13655 TCF +1 # IT:S EVEN
054676,000165: 01,3655 13753 TCF ITSEVEN
054677,000166:
054678,000167: 01,3656 33566 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
054679,000168: 01,3657 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
054680,000169:
054681,000170: 01,3660 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
054682,000171: 01,3661 54021 TS SR # THE RESTART TABLES
054683,000172: 01,3662 60021 AD SR
Page 1298 |
054685,000174: 01,3663 50155 NDX TEMP2G
054686,000175: 01,3664 62003 AD SIZETAB +1
054687,000176: 01,3665 54156 TS POINTER
054688,000177:
054689,000178: 01,3666 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
054690,000179: 01,3667 50156 NDX POINTER
054691,000180: 01,3670 32002 DCA CADRTAB # GET THE 2CADR
054692,000181:
054693,000182: 01,3671 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
054694,000183:
054695,000184: 01,3672 10000 CCS A # IS IT A JOB OR IS IT TIMED
054696,000185: 01,3673 24000 INCR A # POSITIVE, MUST BE A JOB
054697,000186: 01,3674 13747 TCF ITSAJOB2
054698,000187:
054699,000188: 01,3675 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
054700,000189: 01,3676 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
054701,000190:
054702,000191: 01,3677 33775 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
054703,000192: 01,3700 54704 TS GOLOC -1
054704,000193:
054705,000194: 01,3701 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
054706,000195: 01,3702 74742 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
054707,000196: 01,3703 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
054708,000197: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
054709,000198: # IN IMPORTANCE ANYWAY. BIT 4
054710,000199: 01,3704 13742 TCF ITSWTLST # IT IS A WAITLIST CALL
054711,000200:
054712,000201: 01,3705 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
054713,000202: 01,3706 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
054714,000203:
054715,000204: 01,3707 15445 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
054716,000205:
054717,000206: # ***** THIS MUST BE IN FIXED FIXED *****
054718,000207:
054719,000208: 5445 BLOCK 02
054720,000209: 4000 SETLOC FFTAG2
054721,000210: 4000 BANK
054722,000211:
054723,000212: 5445 COUNT* $$/RSROU
054724,000213: 5445 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
054725,000214: 5446 22006 LXCH BB
054726,000215: 5447 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
054727,000216:
054728,000217: 5450 00006 EXTEND # GET THE DELTA TIME
054729,000218: 5451 50000 NDX A
054730,000219: 5452 30001 DCA 0
054731,000220:
054732,000221: 5453 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
054733,000222: 5454 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
054734,000223: 5455 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
Page 1299 |
054736,000225: 5456 13710 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
054737,000226:
054738,000227: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
054739,000228:
054740,000229: 01,3710 BANK 01
054741,000230: 01,2000 SETLOC RESTART
054742,000231: 01,2000 BANK
054743,000232:
054744,000233: 01,3710 COUNT* $$/RSROU
054745,000234: 01,3710 53153 ITSLGCL2 DXCH LONGTIME
054746,000235:
054747,000236: 01,3711 00006 EXTEND # CALCULATE TIME LEFT
054748,000237: 01,3712 40025 DCS TIME2
054749,000238: 01,3713 21153 DAS LONGTIME
054750,000239: 01,3714 00006 EXTEND
054751,000240: 01,3715 31151 DCA LONGBASE
054752,000241: 01,3716 21153 DAS LONGTIME
054753,000242:
054754,000243: 01,3717 11152 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
054755,000244: 01,3720 13730 TCF LONGCLCL
054756,000245: 01,3721 13723 TCF +2
054757,000246: 01,3722 13616 TCF IMEDIATE -3
054758,000247: 01,3723 11153 CCS LONGTIME +1
054759,000248: 01,3724 13730 TCF LONGCLCL
054760,000249: 01,3725 13726 NOOP # CAN:T GET HERE *********
054761,000250: 01,3726 13616 TCF IMEDIATE -3
054762,000251: 01,3727 13621 TCF IMEDIATE
054763,000252:
054764,000253: 01,3730 33773 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
054765,000254: 01,3731 54704 TS GOLOC -1
054766,000255:
054767,000256: 01,3732 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
054768,000257: 01,3733 31153 DCA LONGTIME
054769,000258: 01,3734 00704 TC GOLOC -1
054770,000259:
054771,000260: 01,3735 33775 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
054772,000261: 01,3736 54704 TS GOLOC -1
054773,000262:
054774,000263: 01,3737 50155 NDX TEMP2G
054775,000264: 01,3740 41053 CS PHSPRDT1 # GET THE DELTA T ADDRESS
054776,000265:
054777,000266: 01,3741 15445 TCF ITSLGCL1 # NOW GET THE DELTA TIME
054778,000267:
054779,000268: 01,3742 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
054780,000269: 01,3743 54706 TS GOLOC +1
054781,000270:
054782,000271: 01,3744 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
054783,000272: 01,3745 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
054784,000273:
054785,000274: 01,3746 13575 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
054786,000275:
Page 1300 |
054788,000277: 01,3747 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
054789,000278:
054790,000279: 01,3750 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
054791,000280: 01,3751 32000 CA PRDTTAB
054792,000281:
054793,000282: 01,3752 13640 TCF CHKNOVAC
054794,000283:
054795,000284: 01,3753 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
054796,000285: 01,3754 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
054797,000286:
054798,000287: 01,3755 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
054799,000288: 01,3756 32002 CA SIZETAB # THE TABLE
054800,000289: 01,3757 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
054801,000290: 01,3760 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
054802,000291: 01,3761 60154 AD TEMPPHS
054803,000292: 01,3762 54156 TS POINTER
054804,000293:
054805,000294: 01,3763 13666 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
054806,000295:
054807,000296: 01,3764 36250 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
054808,000297: 01,3765 26156 ADS POINTER # THE TABLE
054809,000298:
054810,000299: 01,3766 33566 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
054811,000300: 01,3767 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
054812,000301: # GROUP
054813,000302: 01,3770 13666 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
054814,000303:
054815,000304: 01,3771 0154 TEMPPHS EQUALS MPAC
054816,000305: 01,3771 0155 TEMP2G EQUALS MPAC +1
054817,000306: 01,3771 0156 POINTER EQUALS MPAC +2
054818,000307: 01,3771 0157 TEMPSWCH EQUALS MPAC +3
054819,000308: 01,3771 0705 GOLOC EQUALS VAC5 +20D
054820,000309: 01,3771 7751 MINUS2 EQUALS NEG2
054821,000310: 01,3771 6077 OCT177 EQUALS LOW7
054822,000311:
054823,000312: 01,3771 03764 PHS2CADR GENADR PHSPART2
054824,000313: 01,3772 03542 PRT2CADR GENADR GETPART2
054825,000314: 01,3773 05277 LGCLCADR GENADR LONGCALL
054826,000315: 01,3774 05105 FVACCADR GENADR FINDVAC
054827,000316: 01,3775 05203 WTLTCADR GENADR WAITLIST
054828,000317: 01,3776 05072 NOVACADR GENADR NOVAC
054829,000318:
054830,000319:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc