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. ## 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 ISWCALLL 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

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

Page 996

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

Page 997

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

Page 998

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

Page 999

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

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