Source Code

These source-code files are part of a reconstructed copy of Comanche 45, the second release, though not the final mission release, of the Apollo 10 Command Module (CM) Apollo Guidance Computer (AGC) software. Comanche 45 was preceded by Comanche 44 and followed by Comanche 45/2 (the flown release). The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 45, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 44 (itself previously accurately reconstructed). Comanche 44 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 44 and 45. The now-reconstructed Comanche 45 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 tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 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 44. Here's a guide to the Apollo documentation referenced in those annotations:
There is also a detailed commentary about the reconstruction process.

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.

047884,000002:                                                                                                  ## Copyright:   Public domain.
047885,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
047886,000004:                                                                                                  ## Purpose:     A section of Comanche revision 045.
047887,000005:                                                                                                  ##              It is part of the reconstructed source code for the
047888,000006:                                                                                                  ##              second release of the flight software for the Command
047889,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
047890,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
047891,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
047892,000010:                                                                                                  ##              exactly match those specified for Comanche 45 in NASA drawing
047893,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
047894,000012:                                                                                                  ##              reconstruction is correct.
047895,000013:                                                                                                  ## Assembler:   yaYUL
047896,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
047897,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
047898,000016:                                                                                                  ## Mod history: 2020-12-06 MAS  Created from Comanche 44.
047899,000017: 

Page 1103

047901,000019:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047902,000020:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047903,000021: 
047904,000022:    4662                                           BLOCK    02                                    
047905,000023:    4662                                           COUNT    02/BANK                               
047906,000024: 
047907,000025:    4662           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
047908,000026:    4663           50002                           INDEX    Q                                     #  PICK UP CADR.
047909,000027:    4664           30000                           CA       0                                     
047910,000028:    4665           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
047911,000029: 
047912,000030:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047913,000031: 
047914,000032:    4666           54001        SWCALL             TS       L                                     
047915,000033:    4667           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
047916,000034:    4670           75054                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
047917,000035:    4671           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
047918,000036:    4672           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
047919,000037:    4673           50002                           INDEX    Q                                     
047920,000038:    4674           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
047921,000039: 
047922,000040:    4675           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
047923,000041:    4676           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
047924,000042:    4677           56134                           XCH      BUF2       +1                         
047925,000043:    4700           00133                           TC       BUF2                                  
047926,000044: 
047927,000045:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047928,000046:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
047929,000047: 
047930,000048:    4701           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
047931,000049:    4702           50000                           INDEX    A                                     #  GET CADR.
047932,000050:    4703           30000                           CA       0                                     
047933,000051: 
047934,000052:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047935,000053: 
047936,000054:    4704           54004        BANKJUMP           TS       FBANK                                 
047937,000055:    4705           75054                           MASK     LOW10                                 
047938,000056:    4706           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
047939,000057:    4707           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
047940,000058:    4710           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
047941,000059: 

Page 1104

047943,000061:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047944,000062: 
047945,000063:    4711           35054        MAKECADR           CAF      LOW10                                 
047946,000064:    4712           70133                           MASK     BUF2                                  
047947,000065:    4713           60134                           AD       BUF2       +1                         
047948,000066:    4714           00002                           TC       Q                                     
047949,000067: 
047950,000068:    4715           54135        SUPDACAL           TS       MPTEMP                                
047951,000069:    4716           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
047952,000070:    4717           00006                           EXTEND                                         
047953,000071:    4720           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
047954,000072:    4721           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
047955,000073:    4722           75054                           MASK     LOW10                                 
047956,000074:    4723           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047957,000075:    4724           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047958,000076:    4725           00006                           EXTEND                                         
047959,000077:    4726           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
047960,000078:    4727           50001                           INDEX    L                                     
047961,000079:    4730           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047962,000080:    4731           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047963,000081:    4732           00006                           EXTEND                                         
047964,000082:    4733           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
047965,000083:    4734           00003                           RELINT                                         
047966,000084:    4735           54004                           TS       FBANK                                 #  RESTORE FBANK.
047967,000085:    4736           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
047968,000086:    4737           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047969,000087: 

Page 1105

047971,000089:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047972,000090: 
047973,000091:    4740           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047974,000092:    4741           50002                           INDEX    Q                                     
047975,000093:    4742           30000                           CAF      0                                     
047976,000094:    4743           24002                           INCR     Q                                     
047977,000095: 
047978,000096:    4744           54001        ISWCALL            TS       L                                     
047979,000097:    4745           22004                           LXCH     FBANK                                 
047980,000098:    4746           75054                           MASK     LOW10                                 
047981,000099:    4747           56002                           XCH      Q                                     
047982,000100:    4750           52073                           DXCH     RUPTREG3                              
047983,000101:    4751           50002                           INDEX    Q                                     
047984,000102:    4752           02000                           TC       10000                                 
047985,000103: 
047986,000104:    4753           56073        ISWRETRN           XCH      RUPTREG4                              
047987,000105:    4754           56004                           XCH      FBANK                                 
047988,000106:    4755           56073                           XCH      RUPTREG4                              
047989,000107:    4756           00072                           TC       RUPTREG3                              
047990,000108: 
047991,000109:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
047992,000110:                                                                                                  #        L       TC      USPRCADR
047993,000111:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
047994,000112:                                                                                                  #                                        RETURN IS TO L+2
047995,000113: 
047996,000114:    4757           54164        USPRCADR           TS       LOC                                   #  SAVE A
047997,000115:    4760           35010                           CA       BIT8                                  
047998,000116:    4761           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
047999,000117:    4762           30006                           CA       BBANK                                 
048000,000118:    4763           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
048001,000119:    4764           50002                           INDEX    Q                                     
048002,000120:    4765           30000                           CA       0                                     
048003,000121:    4766           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
048004,000122:    4767           75054                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
048005,000123:    4770           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
048006,000124:    4771           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
048007,000125:    4772           14707                           TCF      Q+10000                               
048008,000126: 

Page 1106

048010,000128:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
048011,000129: 
048012,000130:                                                                                                  #                                        PSEUDO-FIXED     OCTAL PSEUDO
048013,000131:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS     ADDRESSES
048014,000132:                                                                                                  #  ----------    ------- ------------     ------------     ------------
048015,000133:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
048016,000134:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
048017,000135:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
048018,000136:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
048019,000137:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
048020,000138:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
048021,000139:                                                                                                  #                                                                                THE USER)
048022,000140:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
048023,000141:                                                                                                  #                                                                                THE USER)
048024,000142:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
048025,000143:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
048026,000144: 
048027,000145:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
048028,000146:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
048029,000147:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
048030,000148:                                                                                                  #        ...       ...
048031,000149:                                                                                                  #         .         .
048032,000150:                                                                                                  #         .         .
048033,000151:                                                                                                  #  OR IN THIS FASHION:
048034,000152:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
048035,000153:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
048036,000154:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
048037,000155:                                                                                                  #         .         .                    SUPER100 OCTAL 100
048038,000156:                                                                                                  #         .         .                    SUPER101 OCTAL 120
048039,000157:                                                                                                  #                                        SUPER110 OCTAL 140
048040,000158: 
048041,000159:    4773           00006        SUPERSW            EXTEND                                         
048042,000160:    4774           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
048043,000161:                                                                                                  #  CHANNEL 07
048044,000162:    4775           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
048045,000163:                                                                                                  #        TC SUPERSW
048046,000164: 
048047,000165: 
048048,000166: 

End of include-file INTER-BANK_COMMUNICATION.agc.  Parent file is MAIN.agc