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. |
042478,000002: ## Copyright: Public domain.
042479,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
042480,000004: ## Purpose: A section of LM131 revision 1.
042481,000005: ## It is part of the reconstructed source code for the final
042482,000006: ## release of the flight software for the Lunar Module's (LM)
042483,000007: ## Apollo Guidance Computer (AGC) for Apollo 13. The code has
042484,000008: ## been reconstructed from a listing of Luminary 131 and a dump
042485,000009: ## of a core rope memory module B5, part number 2010802-171,
042486,000010: ## which is the only module different between LM131 revision 1
042487,000011: ## and Luminary 131. The executable generated from this source
042488,000012: ## has been verified against the module dump, so while the names,
042489,000013: ## comments, and ordering may not be exactly correct, the
042490,000014: ## resulting binary is.
042491,000015: ## Reference: pp. 992-995
042492,000016: ## Assembler: yaYUL
042493,000017: ## Contact: Ron Burkey <info@sandroid.org>.
042494,000018: ## Website: www.ibiblio.org/apollo/index.html
042495,000019: ## Mod history: 2022-10-28 MAS Created from Luminary 131.
042496,000020:
Page 992 |
042498,000022: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042499,000023: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042500,000024:
042501,000025: 4616 BLOCK 02
042502,000026: 4616 COUNT* $$/BANK
042503,000027: 4616 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
042504,000028: 4617 50002 INDEX Q # PICK UP CADR.
042505,000029: 4620 30000 CA 0
042506,000030: 4621 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
042507,000031:
042508,000032: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042509,000033:
042510,000034: 4622 54001 SWCALL TS L
042511,000035: 4623 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
042512,000036: 4624 75012 MASK LOW10 # GET SUB-ADDRESS OF CADR.
042513,000037: 4625 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
042514,000038: 4626 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
042515,000039: 4627 50002 INDEX Q
042516,000040: 4630 02000 TC 10000 # SETTING Q TO SWRETURN.
042517,000041:
042518,000042: 4631 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
042519,000043: 4632 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
042520,000044: 4633 56134 XCH BUF2 +1
042521,000045: 4634 00133 TC BUF2
042522,000046:
042523,000047: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042524,000048: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
042525,000049:
042526,000050: 4635 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
042527,000051: 4636 50000 INDEX A # GET CADR.
042528,000052: 4637 30000 CA 0
042529,000053:
042530,000054: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042531,000055:
042532,000056: 4640 54004 BANKJUMP TS FBANK
042533,000057: 4641 75012 MASK LOW10
042534,000058: 4642 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
042535,000059: 4643 50002 Q+10000 INDEX Q # POSTJUMP.
042536,000060: 4644 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
042537,000061:
Page 993 |
042539,000063: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042540,000064:
042541,000065: 4645 35012 MAKECADR CAF LOW10
042542,000066: 4646 70133 MASK BUF2
042543,000067: 4647 60134 AD BUF2 +1
042544,000068: 4650 00002 TC Q
042545,000069:
042546,000070: 4651 54135 SUPDACAL TS MPTEMP
042547,000071: 4652 56004 XCH FBANK # SET FBANK FOR DATA.
042548,000072: 4653 00006 EXTEND
042549,000073: 4654 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
042550,000074: 4655 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
042551,000075: 4656 75012 MASK LOW10
042552,000076: 4657 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042553,000077: 4660 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042554,000078: 4661 00006 EXTEND
042555,000079: 4662 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
042556,000080: 4663 50001 INDEX L
042557,000081: 4664 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042558,000082: 4665 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042559,000083: 4666 00006 EXTEND
042560,000084: 4667 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
042561,000085: 4670 00003 RELINT
042562,000086: 4671 54004 TS FBANK # RESTORE FBANK.
042563,000087: 4672 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
042564,000088: 4673 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042565,000089:
Page 994 |
042567,000091: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042568,000092:
042569,000093: 4674 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042570,000094: 4675 50002 INDEX Q
042571,000095: 4676 30000 CAF 0
042572,000096: 4677 24002 INCR Q
042573,000097:
042574,000098: 4700 54001 ISWCALL TS L
042575,000099: 4701 22004 LXCH FBANK
042576,000100: 4702 75012 MASK LOW10
042577,000101: 4703 56002 XCH Q
042578,000102: 4704 52073 DXCH RUPTREG3
042579,000103: 4705 50002 INDEX Q
042580,000104: 4706 02000 TC 10000
042581,000105:
042582,000106: 4707 56073 ISWRETRN XCH RUPTREG4
042583,000107: 4710 56004 XCH FBANK
042584,000108: 4711 56073 XCH RUPTREG4
042585,000109: 4712 00072 TC RUPTREG3
042586,000110:
042587,000111: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
042588,000112: # L TC USPRCADR
042589,000113: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
042590,000114: # RETURN IS TO L+2
042591,000115:
042592,000116: 4713 54164 USPRCADR TS LOC # SAVE A
042593,000117: 4714 34744 CA BIT8
042594,000118: 4715 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
042595,000119: 4716 30006 CA BBANK
042596,000120: 4717 54165 TS BANKSET # USER'S BBANK TO BANKSET
042597,000121: 4720 50002 INDEX Q
042598,000122: 4721 30000 CA 0
042599,000123: 4722 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
042600,000124: 4723 75012 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
042601,000125: 4724 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042602,000126: 4725 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
042603,000127: 4726 14643 TCF Q+10000
042604,000128:
Page 995 |
042606,000130: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042607,000131:
042608,000132: # PSEUDO-FIXED OCTAL PSEUDO
042609,000133: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
042610,000134: # ---------- ------- ------------ ------------ ------------
042611,000135: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
042612,000136: # WILL USUALLY BE SEEN AS 11)
042613,000137: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
042614,000138: # ONLY BANKS 40-43 WILL EVER BE
042615,000139: # AND ARE PRESENTLY AVAILABLE)
042616,000140: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
042617,000141: # THE USER)
042618,000142: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
042619,000143: # THE USER)
042620,000144: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
042621,000145: # SUPERBANK SHOULD USE SUPERSW. ***
042622,000146:
042623,000147: # SUPERSW MAY BE CALLED IN THIS FASHION:
042624,000148: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
042625,000149: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
042626,000150: # ... ...
042627,000151: # . .
042628,000152: # . .
042629,000153: # OR IN THIS FASHION:
042630,000154: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042631,000155: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
042632,000156: # ... ... SUPER011 OCTAL 60
042633,000157: # . . SUPER100 OCTAL 100
042634,000158: # . . SUPER101 OCTAL 120
042635,000159: # SUPER110 OCTAL 140
042636,000160:
042637,000161: 4727 00006 SUPERSW EXTEND
042638,000162: 4730 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042639,000163: # CHANNEL 07
042640,000164: 4731 00002 TC Q # TC TO INSTRUCTION FOLLOWING
042641,000165: # TC SUPERSW
042642,000166:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc