Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. 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 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.

047100,000002:                                                                                                  ## Copyright:   Public domain.
047101,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
047102,000004:                                                                                                  ## Purpose:     A section of Comanche revision 072.
047103,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
047104,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
047105,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
047106,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
047107,000009:                                                                                                  ##              from a printout of Comanche 055, binary dumps of a set of
047108,000010:                                                                                                  ##              Comanche 067 rope modules, and changelogs between Comanche 067
047109,000011:                                                                                                  ##              and 072. It has been adapted such that the resulting bugger words
047110,000012:                                                                                                  ##              exactly match those specified for Comanche 072 in NASA drawing
047111,000013:                                                                                                  ##              2021153G, which gives relatively high confidence that the
047112,000014:                                                                                                  ##              reconstruction is correct.
047113,000015:                                                                                                  ## Assembler:   yaYUL
047114,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
047115,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
047116,000018:                                                                                                  ## Mod history: 2024-05-13 MAS  Created from Comanche 067.
047117,000019: 
047118,000020:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047119,000021:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047120,000022: 
047121,000023:    4676                                           BLOCK    02                                    
047122,000024:    4676                                           COUNT    02/BANK                               
047123,000025: 
047124,000026:    4676           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
047125,000027:    4677           50002                           INDEX    Q                                     #  PICK UP CADR.
047126,000028:    4700           30000                           CA       0                                     
047127,000029:    4701           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
047128,000030: 
047129,000031:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047130,000032: 
047131,000033:    4702           54001        SWCALL             TS       L                                     
047132,000034:    4703           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
047133,000035:    4704           75070                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
047134,000036:    4705           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
047135,000037:    4706           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
047136,000038:    4707           50002                           INDEX    Q                                     
047137,000039:    4710           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
047138,000040: 
047139,000041:    4711           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
047140,000042:    4712           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
047141,000043:    4713           56134                           XCH      BUF2       +1                         
047142,000044:    4714           00133                           TC       BUF2                                  
047143,000045: 
047144,000046:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047145,000047:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
047146,000048: 
047147,000049:    4715           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
047148,000050:    4716           50000                           INDEX    A                                     #  GET CADR.
047149,000051:    4717           30000                           CA       0                                     
047150,000052: 
047151,000053:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047152,000054: 
047153,000055:    4720           54004        BANKJUMP           TS       FBANK                                 
047154,000056:    4721           75070                           MASK     LOW10                                 
047155,000057:    4722           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
047156,000058:    4723           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
047157,000059:    4724           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
047158,000060: 
047159,000061:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047160,000062: 
047161,000063:    4725           35070        MAKECADR           CAF      LOW10                                 
047162,000064:    4726           70133                           MASK     BUF2                                  
047163,000065:    4727           60134                           AD       BUF2       +1                         
047164,000066:    4730           00002                           TC       Q                                     
047165,000067: 
047166,000068:    4731           54135        SUPDACAL           TS       MPTEMP                                
047167,000069:    4732           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
047168,000070:    4733           00006                           EXTEND                                         
047169,000071:    4734           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
047170,000072:    4735           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
047171,000073:    4736           75070                           MASK     LOW10                                 
047172,000074:    4737           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047173,000075:    4740           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047174,000076:    4741           00006                           EXTEND                                         
047175,000077:    4742           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
047176,000078:    4743           50001                           INDEX    L                                     
047177,000079:    4744           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047178,000080:    4745           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047179,000081:    4746           00006                           EXTEND                                         
047180,000082:    4747           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
047181,000083:    4750           00003                           RELINT                                         
047182,000084:    4751           54004                           TS       FBANK                                 #  RESTORE FBANK.
047183,000085:    4752           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
047184,000086:    4753           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047185,000087: 
047186,000088:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047187,000089: 
047188,000090:    4754           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047189,000091:    4755           50002                           INDEX    Q                                     
047190,000092:    4756           30000                           CAF      0                                     
047191,000093:    4757           24002                           INCR     Q                                     
047192,000094: 
047193,000095:    4760           54001        ISWCALL            TS       L                                     
047194,000096:    4761           22004                           LXCH     FBANK                                 
047195,000097:    4762           75070                           MASK     LOW10                                 
047196,000098:    4763           56002                           XCH      Q                                     
047197,000099:    4764           52073                           DXCH     RUPTREG3                              
047198,000100:    4765           50002                           INDEX    Q                                     
047199,000101:    4766           02000                           TC       10000                                 
047200,000102: 
047201,000103:    4767           56073        ISWRETRN           XCH      RUPTREG4                              
047202,000104:    4770           56004                           XCH      FBANK                                 
047203,000105:    4771           56073                           XCH      RUPTREG4                              
047204,000106:    4772           00072                           TC       RUPTREG3                              
047205,000107: 
047206,000108:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
047207,000109:                                                                                                  #        L       TC      USPRCADR
047208,000110:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
047209,000111:                                                                                                  #                                        RETURN IS TO L+2
047210,000112: 
047211,000113:    4773           54164        USPRCADR           TS       LOC                                   #  SAVE A
047212,000114:    4774           35024                           CA       BIT8                                  
047213,000115:    4775           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
047214,000116:    4776           30006                           CA       BBANK                                 
047215,000117:    4777           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
047216,000118:    5000           50002                           INDEX    Q                                     
047217,000119:    5001           30000                           CA       0                                     
047218,000120:    5002           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
047219,000121:    5003           75070                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
047220,000122:    5004           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
047221,000123:    5005           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
047222,000124:    5006           14723                           TCF      Q+10000                               
047223,000125: 
047224,000126:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
047225,000127: 
047226,000128:                                                                                                  #                                        PSEUDO-FIXED     OCTAL PSEUDO
047227,000129:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS     ADDRESSES
047228,000130:                                                                                                  #  ----------    ------- ------------     ------------     ------------
047229,000131:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
047230,000132:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
047231,000133:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
047232,000134:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
047233,000135:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
047234,000136:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
047235,000137:                                                                                                  #                                                                                THE USER)
047236,000138:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
047237,000139:                                                                                                  #                                                                                THE USER)
047238,000140:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
047239,000141:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
047240,000142: 
047241,000143:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
047242,000144:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
047243,000145:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
047244,000146:                                                                                                  #        ...       ...
047245,000147:                                                                                                  #         .         .
047246,000148:                                                                                                  #         .         .
047247,000149:                                                                                                  #  OR IN THIS FASHION:
047248,000150:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
047249,000151:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
047250,000152:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
047251,000153:                                                                                                  #         .         .                    SUPER100 OCTAL 100
047252,000154:                                                                                                  #         .         .                    SUPER101 OCTAL 120
047253,000155:                                                                                                  #                                        SUPER110 OCTAL 140
047254,000156: 
047255,000157:    5007           00006        SUPERSW            EXTEND                                         
047256,000158:    5010           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
047257,000159:                                                                                                  #  CHANNEL 07
047258,000160:    5011           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
047259,000161:                                                                                                  #        TC SUPERSW
047260,000162: 
047261,000163: 
047262,000164: 

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