Source Code

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

The starting point was the source code of Comanche 45 (itself previously accurately reconstructed). Comanche 45 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 45 and 45/2. The now-reconstructed Comanche 45/2 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:
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.

047784,000002:                                                                                                  ## Copyright:   Public domain.
047785,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
047786,000004:                                                                                                  ## Purpose:     A section of Manche45 revision 2.
047787,000005:                                                                                                  ##              It is part of the reconstructed source code for the
047788,000006:                                                                                                  ##              final, flown release of the flight software for the Command
047789,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
047790,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
047791,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
047792,000010:                                                                                                  ##              exactly match those specified for Manche 45/2 in NASA drawing
047793,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
047794,000012:                                                                                                  ##              reconstruction is correct.
047795,000013:                                                                                                  ## Assembler:   yaYUL
047796,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
047797,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
047798,000016:                                                                                                  ## Mod history: 2020-12-24 MAS  Created from Comanche 45.
047799,000017: 

Page 1103

047801,000019:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047802,000020:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047803,000021: 
047804,000022:    4662                                           BLOCK    02                                    
047805,000023:    4662                                           COUNT    02/BANK                               
047806,000024: 
047807,000025:    4662           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
047808,000026:    4663           50002                           INDEX    Q                                     #  PICK UP CADR.
047809,000027:    4664           30000                           CA       0                                     
047810,000028:    4665           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
047811,000029: 
047812,000030:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047813,000031: 
047814,000032:    4666           54001        SWCALL             TS       L                                     
047815,000033:    4667           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
047816,000034:    4670           75054                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
047817,000035:    4671           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
047818,000036:    4672           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
047819,000037:    4673           50002                           INDEX    Q                                     
047820,000038:    4674           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
047821,000039: 
047822,000040:    4675           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
047823,000041:    4676           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
047824,000042:    4677           56134                           XCH      BUF2       +1                         
047825,000043:    4700           00133                           TC       BUF2                                  
047826,000044: 
047827,000045:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047828,000046:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
047829,000047: 
047830,000048:    4701           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
047831,000049:    4702           50000                           INDEX    A                                     #  GET CADR.
047832,000050:    4703           30000                           CA       0                                     
047833,000051: 
047834,000052:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047835,000053: 
047836,000054:    4704           54004        BANKJUMP           TS       FBANK                                 
047837,000055:    4705           75054                           MASK     LOW10                                 
047838,000056:    4706           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
047839,000057:    4707           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
047840,000058:    4710           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
047841,000059: 

Page 1104

047843,000061:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047844,000062: 
047845,000063:    4711           35054        MAKECADR           CAF      LOW10                                 
047846,000064:    4712           70133                           MASK     BUF2                                  
047847,000065:    4713           60134                           AD       BUF2       +1                         
047848,000066:    4714           00002                           TC       Q                                     
047849,000067: 
047850,000068:    4715           54135        SUPDACAL           TS       MPTEMP                                
047851,000069:    4716           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
047852,000070:    4717           00006                           EXTEND                                         
047853,000071:    4720           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
047854,000072:    4721           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
047855,000073:    4722           75054                           MASK     LOW10                                 
047856,000074:    4723           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047857,000075:    4724           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047858,000076:    4725           00006                           EXTEND                                         
047859,000077:    4726           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
047860,000078:    4727           50001                           INDEX    L                                     
047861,000079:    4730           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047862,000080:    4731           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047863,000081:    4732           00006                           EXTEND                                         
047864,000082:    4733           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
047865,000083:    4734           00003                           RELINT                                         
047866,000084:    4735           54004                           TS       FBANK                                 #  RESTORE FBANK.
047867,000085:    4736           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
047868,000086:    4737           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047869,000087: 

Page 1105

047871,000089:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047872,000090: 
047873,000091:    4740           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047874,000092:    4741           50002                           INDEX    Q                                     
047875,000093:    4742           30000                           CAF      0                                     
047876,000094:    4743           24002                           INCR     Q                                     
047877,000095: 
047878,000096:    4744           54001        ISWCALL            TS       L                                     
047879,000097:    4745           22004                           LXCH     FBANK                                 
047880,000098:    4746           75054                           MASK     LOW10                                 
047881,000099:    4747           56002                           XCH      Q                                     
047882,000100:    4750           52073                           DXCH     RUPTREG3                              
047883,000101:    4751           50002                           INDEX    Q                                     
047884,000102:    4752           02000                           TC       10000                                 
047885,000103: 
047886,000104:    4753           56073        ISWRETRN           XCH      RUPTREG4                              
047887,000105:    4754           56004                           XCH      FBANK                                 
047888,000106:    4755           56073                           XCH      RUPTREG4                              
047889,000107:    4756           00072                           TC       RUPTREG3                              
047890,000108: 
047891,000109:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
047892,000110:                                                                                                  #        L       TC      USPRCADR
047893,000111:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
047894,000112:                                                                                                  #                                        RETURN IS TO L+2
047895,000113: 
047896,000114:    4757           54164        USPRCADR           TS       LOC                                   #  SAVE A
047897,000115:    4760           35010                           CA       BIT8                                  
047898,000116:    4761           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
047899,000117:    4762           30006                           CA       BBANK                                 
047900,000118:    4763           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
047901,000119:    4764           50002                           INDEX    Q                                     
047902,000120:    4765           30000                           CA       0                                     
047903,000121:    4766           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
047904,000122:    4767           75054                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
047905,000123:    4770           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
047906,000124:    4771           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
047907,000125:    4772           14707                           TCF      Q+10000                               
047908,000126: 

Page 1106

047910,000128:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
047911,000129: 
047912,000130:                                                                                                  #                                        PSEUDO-FIXED     OCTAL PSEUDO
047913,000131:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS     ADDRESSES
047914,000132:                                                                                                  #  ----------    ------- ------------     ------------     ------------
047915,000133:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
047916,000134:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
047917,000135:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
047918,000136:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
047919,000137:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
047920,000138:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
047921,000139:                                                                                                  #                                                                                THE USER)
047922,000140:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
047923,000141:                                                                                                  #                                                                                THE USER)
047924,000142:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
047925,000143:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
047926,000144: 
047927,000145:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
047928,000146:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
047929,000147:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
047930,000148:                                                                                                  #        ...       ...
047931,000149:                                                                                                  #         .         .
047932,000150:                                                                                                  #         .         .
047933,000151:                                                                                                  #  OR IN THIS FASHION:
047934,000152:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
047935,000153:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
047936,000154:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
047937,000155:                                                                                                  #         .         .                    SUPER100 OCTAL 100
047938,000156:                                                                                                  #         .         .                    SUPER101 OCTAL 120
047939,000157:                                                                                                  #                                        SUPER110 OCTAL 140
047940,000158: 
047941,000159:    4773           00006        SUPERSW            EXTEND                                         
047942,000160:    4774           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
047943,000161:                                                                                                  #  CHANNEL 07
047944,000162:    4775           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
047945,000163:                                                                                                  #        TC SUPERSW
047946,000164: 
047947,000165: 
047948,000166: 

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