Source Code

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

They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141.

Since only binary dumps (rather than listings) of Comanche 67 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.

046710,000002:                                                                                                  ## Copyright:   Public domain.
046711,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
046712,000004:                                                                                                  ## Purpose:     A section of Comanche revision 067.
046713,000005:                                                                                                  ##              It is part of the reconstructed source code for the flight
046714,000006:                                                                                                  ##              software for the Command Module's (CM) Apollo Guidance Computer
046715,000007:                                                                                                  ##              (AGC) for Apollo 12. No original listings of this program are
046716,000008:                                                                                                  ##              available; instead, this file was created via dissassembly of
046717,000009:                                                                                                  ##              dumps of Comanche 067 core rope modules and comparison with
046718,000010:                                                                                                  ##              other AGC programs.
046719,000011:                                                                                                  ## Assembler:   yaYUL
046720,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
046721,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
046722,000014:                                                                                                  ## Mod history: 2023-08-16 MAS  Created from Comanche 055.
046723,000015: 
046724,000016:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
046725,000017:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
046726,000018: 
046727,000019:    4676                                           BLOCK    02                                    
046728,000020:    4676                                           COUNT    02/BANK                               
046729,000021: 
046730,000022:    4676           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
046731,000023:    4677           50002                           INDEX    Q                                     #  PICK UP CADR.
046732,000024:    4700           30000                           CA       0                                     
046733,000025:    4701           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
046734,000026: 
046735,000027:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
046736,000028: 
046737,000029:    4702           54001        SWCALL             TS       L                                     
046738,000030:    4703           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
046739,000031:    4704           75070                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
046740,000032:    4705           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
046741,000033:    4706           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
046742,000034:    4707           50002                           INDEX    Q                                     
046743,000035:    4710           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
046744,000036: 
046745,000037:    4711           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
046746,000038:    4712           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
046747,000039:    4713           56134                           XCH      BUF2       +1                         
046748,000040:    4714           00133                           TC       BUF2                                  
046749,000041: 
046750,000042:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
046751,000043:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
046752,000044: 
046753,000045:    4715           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
046754,000046:    4716           50000                           INDEX    A                                     #  GET CADR.
046755,000047:    4717           30000                           CA       0                                     
046756,000048: 
046757,000049:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
046758,000050: 
046759,000051:    4720           54004        BANKJUMP           TS       FBANK                                 
046760,000052:    4721           75070                           MASK     LOW10                                 
046761,000053:    4722           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
046762,000054:    4723           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
046763,000055:    4724           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
046764,000056: 
046765,000057:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
046766,000058: 
046767,000059:    4725           35070        MAKECADR           CAF      LOW10                                 
046768,000060:    4726           70133                           MASK     BUF2                                  
046769,000061:    4727           60134                           AD       BUF2       +1                         
046770,000062:    4730           00002                           TC       Q                                     
046771,000063: 
046772,000064:    4731           54135        SUPDACAL           TS       MPTEMP                                
046773,000065:    4732           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
046774,000066:    4733           00006                           EXTEND                                         
046775,000067:    4734           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
046776,000068:    4735           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
046777,000069:    4736           75070                           MASK     LOW10                                 
046778,000070:    4737           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
046779,000071:    4740           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
046780,000072:    4741           00006                           EXTEND                                         
046781,000073:    4742           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
046782,000074:    4743           50001                           INDEX    L                                     
046783,000075:    4744           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
046784,000076:    4745           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
046785,000077:    4746           00006                           EXTEND                                         
046786,000078:    4747           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
046787,000079:    4750           00003                           RELINT                                         
046788,000080:    4751           54004                           TS       FBANK                                 #  RESTORE FBANK.
046789,000081:    4752           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
046790,000082:    4753           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
046791,000083: 
046792,000084:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
046793,000085: 
046794,000086:    4754           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
046795,000087:    4755           50002                           INDEX    Q                                     
046796,000088:    4756           30000                           CAF      0                                     
046797,000089:    4757           24002                           INCR     Q                                     
046798,000090: 
046799,000091:    4760           54001        ISWCALL            TS       L                                     
046800,000092:    4761           22004                           LXCH     FBANK                                 
046801,000093:    4762           75070                           MASK     LOW10                                 
046802,000094:    4763           56002                           XCH      Q                                     
046803,000095:    4764           52073                           DXCH     RUPTREG3                              
046804,000096:    4765           50002                           INDEX    Q                                     
046805,000097:    4766           02000                           TC       10000                                 
046806,000098: 
046807,000099:    4767           56073        ISWRETRN           XCH      RUPTREG4                              
046808,000100:    4770           56004                           XCH      FBANK                                 
046809,000101:    4771           56073                           XCH      RUPTREG4                              
046810,000102:    4772           00072                           TC       RUPTREG3                              
046811,000103: 
046812,000104:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
046813,000105:                                                                                                  #        L       TC      USPRCADR
046814,000106:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
046815,000107:                                                                                                  #                                        RETURN IS TO L+2
046816,000108: 
046817,000109:    4773           54164        USPRCADR           TS       LOC                                   #  SAVE A
046818,000110:    4774           35024                           CA       BIT8                                  
046819,000111:    4775           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
046820,000112:    4776           30006                           CA       BBANK                                 
046821,000113:    4777           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
046822,000114:    5000           50002                           INDEX    Q                                     
046823,000115:    5001           30000                           CA       0                                     
046824,000116:    5002           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
046825,000117:    5003           75070                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
046826,000118:    5004           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
046827,000119:    5005           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
046828,000120:    5006           14723                           TCF      Q+10000                               
046829,000121: 
046830,000122:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
046831,000123: 
046832,000124:                                                                                                  #                                        PSEUDO-FIXED     OCTAL PSEUDO
046833,000125:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS     ADDRESSES
046834,000126:                                                                                                  #  ----------    ------- ------------     ------------     ------------
046835,000127:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
046836,000128:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
046837,000129:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
046838,000130:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
046839,000131:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
046840,000132:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
046841,000133:                                                                                                  #                                                                                THE USER)
046842,000134:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
046843,000135:                                                                                                  #                                                                                THE USER)
046844,000136:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
046845,000137:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
046846,000138: 
046847,000139:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
046848,000140:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
046849,000141:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
046850,000142:                                                                                                  #        ...       ...
046851,000143:                                                                                                  #         .         .
046852,000144:                                                                                                  #         .         .
046853,000145:                                                                                                  #  OR IN THIS FASHION:
046854,000146:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
046855,000147:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
046856,000148:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
046857,000149:                                                                                                  #         .         .                    SUPER100 OCTAL 100
046858,000150:                                                                                                  #         .         .                    SUPER101 OCTAL 120
046859,000151:                                                                                                  #                                        SUPER110 OCTAL 140
046860,000152: 
046861,000153:    5007           00006        SUPERSW            EXTEND                                         
046862,000154:    5010           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
046863,000155:                                                                                                  #  CHANNEL 07
046864,000156:    5011           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
046865,000157:                                                                                                  #        TC SUPERSW
046866,000158: 
046867,000159: 
046868,000160: 

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