Source Code

### FILE="INTER-BANK_COMMUNICATION.agc" ## Copyright: Public domain. ## Filename: INTER-BANK_COMMUNICATION.agc ## Purpose: A section of Luminary revision 210. ## It is part of the source code for the Lunar Module's (LM) ## Apollo Guidance Computer (AGC) for Apollo 15-17. ## This file is intended to be a faithful transcription, except ## that the code format has been changed to conform to the ## requirements of the yaYUL assembler rather than the ## original YUL assembler. ## Reference: pp. 996-999 ## Assembler: yaYUL ## Contact: Ron Burkey . ## Website: www.ibiblio.org/apollo/index.html ## Mod history: 2016-11-17 JL Created from Luminary131 version. ## 2016-12-01 JS Updated from Luminary210 images. ## 2016-12-26 RSB Comment-text proofed using ProoferComments ## and corrected errors found. ## 2017-03-15 RSB Comment-text fixes identified in 5-way ## side-by-side diff of Luminary 69/99/116/131/210. ## 2017-03-17 RSB Comment-text fixes identified in diff'ing ## Luminary 99 vs Comanche 55. ## 2021-05-30 ABS ISWCALLL -> ISWCALL ## Page 996 # THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE # CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED. BLOCK 02 COUNT* $$/BANK BANKCALL DXCH BUF2 # SAVE INCOMING A,L. INDEX Q # PICK UP CADR. CA 0 INCR Q # SO WE RETURN TO THE LOC. AFTER THE CADR. # SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A. SWCALL TS L LXCH FBANK # SWITCH BANKS, SAVING RETURN. MASK LOW10 # GET SUB-ADDRESS OF CADR. XCH Q # A,L NOW CONTAINS DP RETURN. DXCH BUF2 # RESTORING INPUTS IF THIS IS A BANKCALL. INDEX Q TC 10000 # SETTING Q TO SWRETURN. SWRETURN XCH BUF2 +1 # COMES HERE TO RETURN TO CALLER. C(A,L) XCH FBANK # ARE PRESERVED FOR RETURN. XCH BUF2 +1 TC BUF2 # THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY # FOLLOWING THE TC POSTJUMP INSTRUCTION. POSTJUMP XCH Q # SAVE INCOMING C(A). INDEX A # GET CADR. CA 0 # BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A. BANKJUMP TS FBANK MASK LOW10 XCH Q # RESTORING INPUT C(A) IF THIS WAS A Q+10000 INDEX Q # POSTJUMP. PRIO12 TCF 10000 # PRIO12 = TCF 10000 = 12000 ## Page 997 # THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A. MAKECADR CAF LOW10 MASK BUF2 AD BUF2 +1 TC Q SUPDACAL TS MPTEMP XCH FBANK # SET FBANK FOR DATA. EXTEND ROR SUPERBNK # SAVE FBANK IN BITS 15-11, AND XCH MPTEMP # SUPERBANK IN BITS 7-5. MASK LOW10 XCH L # SAVE REL. ADR. IN BANK, FETCH SUPERBITS. INHINT # BECAUSE RUPT DOES NOT SAVE SUPERBANK. EXTEND WRITE SUPERBNK # SET SUPERBANK FOR DATA. INDEX L CA 10000 # PINBALL (FIX MEM DISP) PREVENTS DCA HERE XCH MPTEMP # SAVE 1ST WD, FETCH OLD FBANK AND SBANK. EXTEND WRITE SUPERBNK # RESTORE SUPERBANK. RELINT TS FBANK # RESTORE FBANK. CA MPTEMP # RECOVER FIRST WORD OF DATA. RETURN # 24 WDS. DATACALL 516 MU, SUPDACAL 432 MU ## Page 998 # THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT. IBNKCALL DXCH RUPTREG3 # USES RUPTREG3,4 FOR DP RETURN ADDRESS. INDEX Q CAF 0 INCR Q ISWCALL TS L LXCH FBANK MASK LOW10 XCH Q DXCH RUPTREG3 INDEX Q TC 10000 ISWRETRN XCH RUPTREG4 XCH FBANK XCH RUPTREG4 TC RUPTREG3 # 2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS: # L TC USPRCADR # L+1 CADR INTPRETX INTPRETX IS THE INTERPRETIVE CODING # RETURN IS TO L+2 USPRCADR TS LOC # SAVE A CA BIT8 TS EDOP # EXIT INSTRUCTION TO EDOP CA BBANK TS BANKSET # USER'S BBANK TO BANKSET INDEX Q CA 0 TS FBANK # INTERPRETIVE BANK TO FBANK MASK LOW10 # YIELDS INTERPRETIVE RELATIVE ADDRESS XCH Q # INTERPRETIVE ADDRESS TO Q, FETCHING L+1 XCH LOC # L+1 TO LOC, RETRIEVING ORIGINAL A TCF Q+10000 ## Page 999 # THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.) # # PSEUDO-FIXED OCTAL PSEUDO # SUPERBANK SETTING S-REG. VALUE BANK NUMBERS ADDRESSES # ---------- ------- ------------ ------------ ------------ # SUPERBANK 3 0XX 2000 - 3777 30 - 37 70000 - 107777 (WHERE XX CAN BE ANYTHING AND # WILL USUALLY BE SEEN AS 11) # SUPERBANK 4 100 2000 - 3777 40 - 47 110000 - 127777 (AS FAR AS IT CAN BE SEEN, # ONLY BANKS 40-43 WILL EVER BE # AND ARE PRESENTLY AVAILABLE) # SUPERBANK 5 101 2000 - 3777 50 - 57 130000 - 147777 (PRESENTLY NOT AVAILABLE TO # THE USER) # SUPERBANK 6 110 2000 - 3777 60 - 67 150000 - 167777 (PRESENTLY NOT AVAILABLE TO # THE USER) # *** THIS ROUTINE MAYBE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27. I.E., NO PROGRAM LIVING IN ANY # SUPERBANK SHOULD USE SUPERSW. *** # # SUPERSW MAY BE CALLED IN THIS FASHION: # CAF ABBCON WHERE -- ABBCON BBCON SOMETHIN -- # TCR SUPERSW (THE SUPERBNK BITS ARE IN THE BBCON) # ... ... # . . # . . # # OR IN THIS FASHION: # # CAF SUPERSET WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE # TCR SUPERSW SUPERBANK BIT CONSTANTS: # ... ... SUPER011 OCTAL 60 # . . SUPER100 OCTAL 100 # . . SUPER101 OCTAL 120 # SUPER110 OCTAL 140 SUPERSW EXTEND WRITE SUPERBNK # WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO # CHANNEL 07 TC Q # TC TO INSTRUCTION FOLLOWING # TC SUPERSW

043797,000002:                                                                                                  ## Copyright:   Public domain.
043798,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
043799,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
043800,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
043801,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
043802,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
043803,000008:                                                                                                  ##              that the code format has been changed to conform to the
043804,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
043805,000010:                                                                                                  ##              original YUL assembler.
043806,000011:                                                                                                  ## Reference:   pp. 996-999
043807,000012:                                                                                                  ## Assembler:   yaYUL
043808,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043809,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043810,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
043811,000016:                                                                                                  ##              2016-12-01 JS   Updated from Luminary210 images.
043812,000017:                                                                                                  ##              2016-12-26 RSB  Comment-text proofed using ProoferComments
043813,000018:                                                                                                  ##                              and corrected errors found.
043814,000019:                                                                                                  ##              2017-03-15 RSB  Comment-text fixes identified in 5-way
043815,000020:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
043816,000021:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
043817,000022:                                                                                                  ##                              Luminary 99 vs Comanche 55.
043818,000023:                                                                                                  ##              2021-05-30 ABS  ISWCALLL -> ISWCALL
043819,000024: 

Page 996

043821,000026:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
043822,000027:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
043823,000028: 
043824,000029:    4607                                           BLOCK    02                                    
043825,000030:    4607                                           COUNT*   $$/BANK                               
043826,000031:    4607           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
043827,000032:    4610           50002                           INDEX    Q                                     #  PICK UP CADR.
043828,000033:    4611           30000                           CA       0                                     
043829,000034:    4612           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
043830,000035: 
043831,000036:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
043832,000037: 
043833,000038:    4613           54001        SWCALL             TS       L                                     
043834,000039:    4614           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
043835,000040:    4615           75003                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
043836,000041:    4616           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
043837,000042:    4617           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
043838,000043:    4620           50002                           INDEX    Q                                     
043839,000044:    4621           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
043840,000045: 
043841,000046:    4622           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
043842,000047:    4623           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
043843,000048:    4624           56134                           XCH      BUF2       +1                         
043844,000049:    4625           00133                           TC       BUF2                                  
043845,000050: 
043846,000051:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
043847,000052:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
043848,000053: 
043849,000054:    4626           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
043850,000055:    4627           50000                           INDEX    A                                     #  GET CADR.
043851,000056:    4630           30000                           CA       0                                     
043852,000057: 
043853,000058:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
043854,000059: 
043855,000060:    4631           54004        BANKJUMP           TS       FBANK                                 
043856,000061:    4632           75003                           MASK     LOW10                                 
043857,000062:    4633           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
043858,000063:    4634           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
043859,000064:    4635           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
043860,000065: 

Page 997

043862,000067:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
043863,000068: 
043864,000069:    4636           35003        MAKECADR           CAF      LOW10                                 
043865,000070:    4637           70133                           MASK     BUF2                                  
043866,000071:    4640           60134                           AD       BUF2       +1                         
043867,000072:    4641           00002                           TC       Q                                     
043868,000073: 
043869,000074:    4642           54135        SUPDACAL           TS       MPTEMP                                
043870,000075:    4643           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
043871,000076:    4644           00006                           EXTEND                                         
043872,000077:    4645           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
043873,000078:    4646           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
043874,000079:    4647           75003                           MASK     LOW10                                 
043875,000080:    4650           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
043876,000081:    4651           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
043877,000082:    4652           00006                           EXTEND                                         
043878,000083:    4653           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
043879,000084:    4654           50001                           INDEX    L                                     
043880,000085:    4655           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
043881,000086:    4656           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
043882,000087:    4657           00006                           EXTEND                                         
043883,000088:    4660           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
043884,000089:    4661           00003                           RELINT                                         
043885,000090:    4662           54004                           TS       FBANK                                 #  RESTORE FBANK.
043886,000091:    4663           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
043887,000092:    4664           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
043888,000093: 

Page 998

043890,000095:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
043891,000096: 
043892,000097:    4665           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
043893,000098:    4666           50002                           INDEX    Q                                     
043894,000099:    4667           30000                           CAF      0                                     
043895,000100:    4670           24002                           INCR     Q                                     
043896,000101: 
043897,000102:    4671           54001        ISWCALL            TS       L                                     
043898,000103:    4672           22004                           LXCH     FBANK                                 
043899,000104:    4673           75003                           MASK     LOW10                                 
043900,000105:    4674           56002                           XCH      Q                                     
043901,000106:    4675           52073                           DXCH     RUPTREG3                              
043902,000107:    4676           50002                           INDEX    Q                                     
043903,000108:    4677           02000                           TC       10000                                 
043904,000109: 
043905,000110:    4700           56073        ISWRETRN           XCH      RUPTREG4                              
043906,000111:    4701           56004                           XCH      FBANK                                 
043907,000112:    4702           56073                           XCH      RUPTREG4                              
043908,000113:    4703           00072                           TC       RUPTREG3                              
043909,000114: 
043910,000115:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
043911,000116:                                                                                                  #        L       TC      USPRCADR
043912,000117:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
043913,000118:                                                                                                  #                                        RETURN IS TO L+2
043914,000119: 
043915,000120:    4704           54164        USPRCADR           TS       LOC                                   #  SAVE A
043916,000121:    4705           34735                           CA       BIT8                                  
043917,000122:    4706           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
043918,000123:    4707           30006                           CA       BBANK                                 
043919,000124:    4710           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
043920,000125:    4711           50002                           INDEX    Q                                     
043921,000126:    4712           30000                           CA       0                                     
043922,000127:    4713           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
043923,000128:    4714           75003                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
043924,000129:    4715           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
043925,000130:    4716           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
043926,000131:    4717           14634                           TCF      Q+10000                               
043927,000132: 

Page 999

043929,000134:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
043930,000135: 
043931,000136:                                                                                                  #                                        PSEUDO-FIXED    OCTAL PSEUDO
043932,000137:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS    ADDRESSES
043933,000138:                                                                                                  #  ----------    ------- ------------    ------------    ------------
043934,000139:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
043935,000140:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
043936,000141:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
043937,000142:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
043938,000143:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
043939,000144:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
043940,000145:                                                                                                  #                                                                                THE USER)
043941,000146:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
043942,000147:                                                                                                  #                                                                                THE USER)
043943,000148:                                                                                                  #  *** THIS ROUTINE MAYBE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
043944,000149:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
043945,000150: 
043946,000151:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
043947,000152:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
043948,000153:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
043949,000154:                                                                                                  #        ...       ...
043950,000155:                                                                                                  #         .         .
043951,000156:                                                                                                  #         .         .
043952,000157: 
043953,000158:                                                                                                  #  OR IN THIS FASHION:
043954,000159: 
043955,000160:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
043956,000161:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
043957,000162:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
043958,000163:                                                                                                  #         .         .                    SUPER100 OCTAL 100
043959,000164:                                                                                                  #         .         .                    SUPER101 OCTAL 120
043960,000165:                                                                                                  #                                        SUPER110 OCTAL 140
043961,000166: 
043962,000167:    4720           00006        SUPERSW            EXTEND                                         
043963,000168:    4721           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
043964,000169:                                                                                                  #  CHANNEL 07
043965,000170:    4722           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
043966,000171:                                                                                                  #        TC SUPERSW
043967,000172: 

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