Source Code
These source-code files are part of a reconstructed copy of Comanche 51, the
initial release (though not the final mission release) of the Apollo 11
Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final
release was Comanche 55. The reconstruction is believed to be exactly accurate,
but in the absence of an actual Apollo-era listing of Comanche 51, some
explanation of the reconstruction process is needed to insure confidence in
that accuracy.
The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 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 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 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 55. Here's a guide to some of the Apollo documentation relevant to 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. |
047852,000002: ## Copyright: Public domain.
047853,000003: ## Filename: INTER-BANK_COMMUNICATION.agc
047854,000004: ## Purpose: A section of Comanche revision 051.
047855,000005: ## It is part of the reconstructed source code for the
047856,000006: ## original release of the flight software for the Command
047857,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
047858,000008: ## The code has been recreated from a copy of Comanche 055. It
047859,000009: ## has been adapted such that the resulting bugger words
047860,000010: ## exactly match those specified for Comanche 51 in NASA drawing
047861,000011: ## 2021153D, which gives relatively high confidence that the
047862,000012: ## reconstruction is correct.
047863,000013: ## Reference: pp. 1103-1106
047864,000014: ## Assembler: yaYUL
047865,000015: ## Contact: Ron Burkey <info@sandroid.org>.
047866,000016: ## Website: www.ibiblio.org/apollo/index.html
047867,000017: ## Mod history: 2019-07-30 MAS Created from Comanche 55.
047868,000018:
Page 1103 |
047870,000020: # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047871,000021: # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047872,000022:
047873,000023: 4662 BLOCK 02
047874,000024: 4662 COUNT 02/BANK
047875,000025:
047876,000026: 4662 52134 BANKCALL DXCH BUF2 # SAVE INCOMING A,L.
047877,000027: 4663 50002 INDEX Q # PICK UP CADR.
047878,000028: 4664 30000 CA 0
047879,000029: 4665 24002 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR.
047880,000030:
047881,000031: # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047882,000032:
047883,000033: 4666 54001 SWCALL TS L
047884,000034: 4667 22004 LXCH FBANK # SWITCH BANKS, SAVING RETURN.
047885,000035: 4670 75054 MASK LOW10 # GET SUB-ADDRESS OF CADR.
047886,000036: 4671 56002 XCH Q # A,L NOW CONTAINS DP RETURN.
047887,000037: 4672 52134 DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL.
047888,000038: 4673 50002 INDEX Q
047889,000039: 4674 02000 TC 10000 # SETTING Q TO SWRETURN.
047890,000040:
047891,000041: 4675 56134 SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L)
047892,000042: 4676 56004 XCH FBANK # ARE PRESERVED FOR RETURN.
047893,000043: 4677 56134 XCH BUF2 +1
047894,000044: 4700 00133 TC BUF2
047895,000045:
047896,000046: # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047897,000047: # FOLLOWING THE TC POSTJUMP INSTRUCTION.
047898,000048:
047899,000049: 4701 56002 POSTJUMP XCH Q # SAVE INCOMING C(A).
047900,000050: 4702 50000 INDEX A # GET CADR.
047901,000051: 4703 30000 CA 0
047902,000052:
047903,000053: # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047904,000054:
047905,000055: 4704 54004 BANKJUMP TS FBANK
047906,000056: 4705 75054 MASK LOW10
047907,000057: 4706 56002 XCH Q # RESTORING INPUT C(A) IF THIS WAS A
047908,000058: 4707 50002 Q+10000 INDEX Q # POSTJUMP.
047909,000059: 4710 12000 PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000
047910,000060:
Page 1104 |
047912,000062: # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047913,000063:
047914,000064: 4711 35054 MAKECADR CAF LOW10
047915,000065: 4712 70133 MASK BUF2
047916,000066: 4713 60134 AD BUF2 +1
047917,000067: 4714 00002 TC Q
047918,000068:
047919,000069: 4715 54135 SUPDACAL TS MPTEMP
047920,000070: 4716 56004 XCH FBANK # SET FBANK FOR DATA.
047921,000071: 4717 00006 EXTEND
047922,000072: 4720 04007 ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND
047923,000073: 4721 56135 XCH MPTEMP # SUPERBANK IN BITS 7-5.
047924,000074: 4722 75054 MASK LOW10
047925,000075: 4723 56001 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047926,000076: 4724 00004 INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047927,000077: 4725 00006 EXTEND
047928,000078: 4726 01007 WRITE SUPERBNK # SET SUPERBANK FOR DATA.
047929,000079: 4727 50001 INDEX L
047930,000080: 4730 32000 CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047931,000081: 4731 56135 XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047932,000082: 4732 00006 EXTEND
047933,000083: 4733 01007 WRITE SUPERBNK # RESTORE SUPERBANK.
047934,000084: 4734 00003 RELINT
047935,000085: 4735 54004 TS FBANK # RESTORE FBANK.
047936,000086: 4736 30135 CA MPTEMP # RECOVER FIRST WORD OF DATA.
047937,000087: 4737 00002 RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047938,000088:
Page 1105 |
047940,000090: # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047941,000091:
047942,000092: 4740 52073 IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047943,000093: 4741 50002 INDEX Q
047944,000094: 4742 30000 CAF 0
047945,000095: 4743 24002 INCR Q
047946,000096:
047947,000097: 4744 54001 ISWCALL TS L
047948,000098: 4745 22004 LXCH FBANK
047949,000099: 4746 75054 MASK LOW10
047950,000100: 4747 56002 XCH Q
047951,000101: 4750 52073 DXCH RUPTREG3
047952,000102: 4751 50002 INDEX Q
047953,000103: 4752 02000 TC 10000
047954,000104:
047955,000105: 4753 56073 ISWRETRN XCH RUPTREG4
047956,000106: 4754 56004 XCH FBANK
047957,000107: 4755 56073 XCH RUPTREG4
047958,000108: 4756 00072 TC RUPTREG3
047959,000109:
047960,000110: # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
047961,000111: # L TC USPRCADR
047962,000112: # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING
047963,000113: # RETURN IS TO L+2
047964,000114:
047965,000115: 4757 54164 USPRCADR TS LOC # SAVE A
047966,000116: 4760 35010 CA BIT8
047967,000117: 4761 54023 TS EDOP # EXIT INSTRUCTION TO EDOP
047968,000118: 4762 30006 CA BBANK
047969,000119: 4763 54165 TS BANKSET # USER'S BBANK TO BANKSET
047970,000120: 4764 50002 INDEX Q
047971,000121: 4765 30000 CA 0
047972,000122: 4766 54004 TS FBANK # INTERPRETIVE BANK TO FBANK
047973,000123: 4767 75054 MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS
047974,000124: 4770 56002 XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1
047975,000125: 4771 56164 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A
047976,000126: 4772 14707 TCF Q+10000
047977,000127:
Page 1106 |
047979,000129: # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
047980,000130:
047981,000131: # PSEUDO-FIXED OCTAL PSEUDO
047982,000132: # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES
047983,000133: # ---------- ------- ------------ ------------ ------------
047984,000134: # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND
047985,000135: # WILL USUALLY BE SEEN AS 11)
047986,000136: # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN,
047987,000137: # ONLY BANKS 40-43 WILL EVER BE
047988,000138: # AND ARE PRESENTLY AVAILABLE)
047989,000139: # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO
047990,000140: # THE USER)
047991,000141: # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO
047992,000142: # THE USER)
047993,000143: # *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY
047994,000144: # SUPERBANK SHOULD USE SUPERSW. ***
047995,000145:
047996,000146: # SUPERSW MAY BE CALLED IN THIS FASHION:
047997,000147: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN --
047998,000148: # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON)
047999,000149: # ... ...
048000,000150: # . .
048001,000151: # . .
048002,000152: # OR IN THIS FASHION:
048003,000153: # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
048004,000154: # TCR SUPERSW SUPERBANK BIT CONSTANTS:
048005,000155: # ... ... SUPER011 OCTAL 60
048006,000156: # . . SUPER100 OCTAL 100
048007,000157: # . . SUPER101 OCTAL 120
048008,000158: # SUPER110 OCTAL 140
048009,000159:
048010,000160: 4773 00006 SUPERSW EXTEND
048011,000161: 4774 01007 WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
048012,000162: # CHANNEL 07
048013,000163: 4775 00002 TC Q # TC TO INSTRUCTION FOLLOWING
048014,000164: # TC SUPERSW
048015,000165:
048016,000166:
048017,000167:
End of include-file INTER-BANK_COMMUNICATION.agc. Parent file is MAIN.agc