Source Code
These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3),
the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software
for Apollo 13.
The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments. Since no contemporary listings of Comanche 72/3 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
047020,000002: ## Copyright: Public domain.
047021,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
047022,000004: ## Purpose: A section of Manche72 revision 3.
047023,000005: ## It is part of the reconstructed source code for the final, flown
047024,000006: ## release of the software for the Command Module's (CM) Apollo
047025,000007: ## Guidance Computer (AGC) for Apollo 13. No original listings
047026,000008: ## of this program are available; instead, this file was recreated
047027,000009: ## from a reconstructed copy of Comanche 072. It has been adapted
047028,000010: ## such that the resulting bugger words exactly match those
047029,000011: ## specified for Manche72 revision 3 in NASA drawing 2021153G,
047030,000012: ## which gives relatively high confidence that the reconstruction
047031,000013: ## is correct.
047032,000014: ## Assembler: yaYUL
047033,000015: ## Contact: Ron Burkey <info@sandroid.org>.
047034,000016: ## Website: www.ibiblio.org/apollo/index.html
047035,000017: ## Mod history: 2024-05-19 MAS Created from Comanche 072.
047036,000018:
047037,000019: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047038,000020: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047039,000021:
047040,000022: 4676 BLOCK 02
047041,000023: 4676 COUNT 02/BANK
047042,000024:
047043,000025: 4676 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
047044,000026: 4677 50002 INDEX Q # PICK UP CADR.
047045,000027: 4700 30000 CA 0
047046,000028: 4701 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
047047,000029:
047048,000030: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047049,000031:
047050,000032: 4702 54001 SWCALL TS L
047051,000033: 4703 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
047052,000034: 4704 75070 MASK LOW10 # GET SUB-ADDRESS OF CADR.
047053,000035: 4705 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
047054,000036: 4706 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
047055,000037: 4707 50002 INDEX Q
047056,000038: 4710 02000 TC 10000 # SETTING Q TO SWRETURN.
047057,000039:
047058,000040: 4711 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
047059,000041: 4712 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
047060,000042: 4713 56134 XCH BUF2 +1
047061,000043: 4714 00133 TC BUF2
047062,000044:
047063,000045: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047064,000046: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
047065,000047:
047066,000048: 4715 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
047067,000049: 4716 50000 INDEX A # GET CADR.
047068,000050: 4717 30000 CA 0
047069,000051:
047070,000052: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047071,000053:
047072,000054: 4720 54004 BANKJUMP TS FBANK
047073,000055: 4721 75070 MASK LOW10
047074,000056: 4722 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
047075,000057: 4723 50002 Q+10000 INDEX Q # POSTJUMP.
047076,000058: 4724 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
047077,000059:
047078,000060: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047079,000061:
047080,000062: 4725 35070 MAKECADR CAF LOW10
047081,000063: 4726 70133 MASK BUF2
047082,000064: 4727 60134 AD BUF2 +1
047083,000065: 4730 00002 TC Q
047084,000066:
047085,000067: 4731 54135 SUPDACAL TS MPTEMP
047086,000068: 4732 56004 XCH FBANK # SET FBANK FOR DATA.
047087,000069: 4733 00006 EXTEND
047088,000070: 4734 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
047089,000071: 4735 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
047090,000072: 4736 75070 MASK LOW10
047091,000073: 4737 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047092,000074: 4740 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047093,000075: 4741 00006 EXTEND
047094,000076: 4742 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
047095,000077: 4743 50001 INDEX L
047096,000078: 4744 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047097,000079: 4745 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047098,000080: 4746 00006 EXTEND
047099,000081: 4747 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
047100,000082: 4750 00003 RELINT
047101,000083: 4751 54004 TS FBANK # RESTORE FBANK.
047102,000084: 4752 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
047103,000085: 4753 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047104,000086:
047105,000087: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047106,000088:
047107,000089: 4754 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047108,000090: 4755 50002 INDEX Q
047109,000091: 4756 30000 CAF 0
047110,000092: 4757 24002 INCR Q
047111,000093:
047112,000094: 4760 54001 ISWCALL TS L
047113,000095: 4761 22004 LXCH FBANK
047114,000096: 4762 75070 MASK LOW10
047115,000097: 4763 56002 XCH Q
047116,000098: 4764 52073 DXCH RUPTREG3
047117,000099: 4765 50002 INDEX Q
047118,000100: 4766 02000 TC 10000
047119,000101:
047120,000102: 4767 56073 ISWRETRN XCH RUPTREG4
047121,000103: 4770 56004 XCH FBANK
047122,000104: 4771 56073 XCH RUPTREG4
047123,000105: 4772 00072 TC RUPTREG3
047124,000106:
047125,000107: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
047126,000108: # L TC USPRCADR
047127,000109: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
047128,000110: # RETURN IS TO L+2
047129,000111:
047130,000112: 4773 54164 USPRCADR TS LOC # SAVE A
047131,000113: 4774 35024 CA BIT8
047132,000114: 4775 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
047133,000115: 4776 30006 CA BBANK
047134,000116: 4777 54165 TS BANKSET # USER'S BBANK TO BANKSET
047135,000117: 5000 50002 INDEX Q
047136,000118: 5001 30000 CA 0
047137,000119: 5002 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
047138,000120: 5003 75070 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
047139,000121: 5004 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
047140,000122: 5005 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
047141,000123: 5006 14723 TCF Q+10000
047142,000124:
047143,000125: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
047144,000126:
047145,000127: # PSEUDO-FIXED OCTAL PSEUDO
047146,000128: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
047147,000129: # ---------- ------- ------------ ------------ ------------
047148,000130: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
047149,000131: # WILL USUALLY BE SEEN AS 11)
047150,000132: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
047151,000133: # ONLY BANKS 40-43 WILL EVER BE
047152,000134: # AND ARE PRESENTLY AVAILABLE)
047153,000135: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
047154,000136: # THE USER)
047155,000137: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
047156,000138: # THE USER)
047157,000139: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
047158,000140: # SUPERBANK SHOULD USE SUPERSW. ***
047159,000141:
047160,000142: # SUPERSW MAY BE CALLED IN THIS FASHION:
047161,000143: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
047162,000144: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
047163,000145: # ... ...
047164,000146: # . .
047165,000147: # . .
047166,000148: # OR IN THIS FASHION:
047167,000149: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
047168,000150: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
047169,000151: # ... ... SUPER011 OCTAL 60
047170,000152: # . . SUPER100 OCTAL 100
047171,000153: # . . SUPER101 OCTAL 120
047172,000154: # SUPER110 OCTAL 140
047173,000155:
047174,000156: 5007 00006 SUPERSW EXTEND
047175,000157: 5010 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
047176,000158: # CHANNEL 07
047177,000159: 5011 00002 TC Q # TC TO INSTRUCTION FOLLOWING
047178,000160: # TC SUPERSW
047179,000161:
047180,000162:
047181,000163:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc