Source Code
These source-code files are part of a reconstructed copy of Comanche 44, the
initial release (though not the final mission release) of the Apollo 10
Command Module (CM) Apollo Guidance Computer (AGC) software. Subsequent releases
were Comanche 45 and Comanche 45/2 (the flown release on Apollo 10). The reconstruction
is believed to be exactly accurate, but in the absence of an actual Apollo-era
listing of Comanche 44, some explanation of the reconstruction process is needed
to insure confidence in that accuracy.
The starting point was the source code of Comanche 51 (separately previously reconstructed from an Apollo-era listing of Comanche 55, flown on Apollo 11). Comanche 51 source code was then modified by undoing changes known to have been made between revisions 44 and 51. The now-reconstructed Comanche 44 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 printout, although the source code would likely have different page numbers in a contemporary Comanche 44 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 51. Here's a guide to the Apollo documentation referenced in those annotations:
Comments expected to have been present in 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. |
048385,000002: ## Copyright: Public domain.
048386,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
048387,000004: ## Purpose: A section of Comanche revision 044.
048388,000005: ## It is part of the reconstructed source code for the
048389,000006: ## original release of the flight software for the Command
048390,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
048391,000008: ## The code has been recreated from a copy of Comanche 055. It
048392,000009: ## has been adapted such that the resulting bugger words
048393,000010: ## exactly match those specified for Comanche 44 in NASA drawing
048394,000011: ## 2021153D, which gives relatively high confidence that the
048395,000012: ## reconstruction is correct.
048396,000013: ## Assembler: yaYUL
048397,000014: ## Contact: Ron Burkey <info@sandroid.org>.
048398,000015: ## Website: www.ibiblio.org/apollo/index.html
048399,000016: ## Mod history: 2020-12-03 MAS Created from Comanche 51.
048400,000017:
Page 1103 |
048402,000019: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
048403,000020: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
048404,000021:
048405,000022: 4662 BLOCK 02
048406,000023: 4662 COUNT 02/BANK
048407,000024:
048408,000025: 4662 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
048409,000026: 4663 50002 INDEX Q # PICK UP CADR.
048410,000027: 4664 30000 CA 0
048411,000028: 4665 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
048412,000029:
048413,000030: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
048414,000031:
048415,000032: 4666 54001 SWCALL TS L
048416,000033: 4667 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
048417,000034: 4670 75054 MASK LOW10 # GET SUB-ADDRESS OF CADR.
048418,000035: 4671 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
048419,000036: 4672 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
048420,000037: 4673 50002 INDEX Q
048421,000038: 4674 02000 TC 10000 # SETTING Q TO SWRETURN.
048422,000039:
048423,000040: 4675 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
048424,000041: 4676 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
048425,000042: 4677 56134 XCH BUF2 +1
048426,000043: 4700 00133 TC BUF2
048427,000044:
048428,000045: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
048429,000046: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
048430,000047:
048431,000048: 4701 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
048432,000049: 4702 50000 INDEX A # GET CADR.
048433,000050: 4703 30000 CA 0
048434,000051:
048435,000052: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
048436,000053:
048437,000054: 4704 54004 BANKJUMP TS FBANK
048438,000055: 4705 75054 MASK LOW10
048439,000056: 4706 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
048440,000057: 4707 50002 Q+10000 INDEX Q # POSTJUMP.
048441,000058: 4710 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
048442,000059:
Page 1104 |
048444,000061: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
048445,000062:
048446,000063: 4711 35054 MAKECADR CAF LOW10
048447,000064: 4712 70133 MASK BUF2
048448,000065: 4713 60134 AD BUF2 +1
048449,000066: 4714 00002 TC Q
048450,000067:
048451,000068: 4715 54135 SUPDACAL TS MPTEMP
048452,000069: 4716 56004 XCH FBANK # SET FBANK FOR DATA.
048453,000070: 4717 00006 EXTEND
048454,000071: 4720 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
048455,000072: 4721 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
048456,000073: 4722 75054 MASK LOW10
048457,000074: 4723 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
048458,000075: 4724 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
048459,000076: 4725 00006 EXTEND
048460,000077: 4726 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
048461,000078: 4727 50001 INDEX L
048462,000079: 4730 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
048463,000080: 4731 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
048464,000081: 4732 00006 EXTEND
048465,000082: 4733 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
048466,000083: 4734 00003 RELINT
048467,000084: 4735 54004 TS FBANK # RESTORE FBANK.
048468,000085: 4736 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
048469,000086: 4737 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
048470,000087:
Page 1105 |
048472,000089: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
048473,000090:
048474,000091: 4740 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
048475,000092: 4741 50002 INDEX Q
048476,000093: 4742 30000 CAF 0
048477,000094: 4743 24002 INCR Q
048478,000095:
048479,000096: 4744 54001 ISWCALL TS L
048480,000097: 4745 22004 LXCH FBANK
048481,000098: 4746 75054 MASK LOW10
048482,000099: 4747 56002 XCH Q
048483,000100: 4750 52073 DXCH RUPTREG3
048484,000101: 4751 50002 INDEX Q
048485,000102: 4752 02000 TC 10000
048486,000103:
048487,000104: 4753 56073 ISWRETRN XCH RUPTREG4
048488,000105: 4754 56004 XCH FBANK
048489,000106: 4755 56073 XCH RUPTREG4
048490,000107: 4756 00072 TC RUPTREG3
048491,000108:
048492,000109: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
048493,000110: # L TC USPRCADR
048494,000111: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
048495,000112: # RETURN IS TO L+2
048496,000113:
048497,000114: 4757 54164 USPRCADR TS LOC # SAVE A
048498,000115: 4760 35010 CA BIT8
048499,000116: 4761 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
048500,000117: 4762 30006 CA BBANK
048501,000118: 4763 54165 TS BANKSET # USER'S BBANK TO BANKSET
048502,000119: 4764 50002 INDEX Q
048503,000120: 4765 30000 CA 0
048504,000121: 4766 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
048505,000122: 4767 75054 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
048506,000123: 4770 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
048507,000124: 4771 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
048508,000125: 4772 14707 TCF Q+10000
048509,000126:
Page 1106 |
048511,000128: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
048512,000129:
048513,000130: # PSEUDO-FIXED OCTAL PSEUDO
048514,000131: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
048515,000132: # ---------- ------- ------------ ------------ ------------
048516,000133: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
048517,000134: # WILL USUALLY BE SEEN AS 11)
048518,000135: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
048519,000136: # ONLY BANKS 40-43 WILL EVER BE
048520,000137: # AND ARE PRESENTLY AVAILABLE)
048521,000138: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
048522,000139: # THE USER)
048523,000140: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
048524,000141: # THE USER)
048525,000142: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
048526,000143: # SUPERBANK SHOULD USE SUPERSW. ***
048527,000144:
048528,000145: # SUPERSW MAY BE CALLED IN THIS FASHION:
048529,000146: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
048530,000147: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
048531,000148: # ... ...
048532,000149: # . .
048533,000150: # . .
048534,000151: # OR IN THIS FASHION:
048535,000152: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
048536,000153: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
048537,000154: # ... ... SUPER011 OCTAL 60
048538,000155: # . . SUPER100 OCTAL 100
048539,000156: # . . SUPER101 OCTAL 120
048540,000157: # SUPER110 OCTAL 140
048541,000158:
048542,000159: 4773 00006 SUPERSW EXTEND
048543,000160: 4774 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
048544,000161: # CHANNEL 07
048545,000162: 4775 00002 TC Q # TC TO INSTRUCTION FOLLOWING
048546,000163: # TC SUPERSW
048547,000164:
048548,000165:
048549,000166:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc