Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

042760,000002:                                                                                                  ## Copyright:   Public domain.
042761,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042762,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
042763,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
042764,000006:                                                                                                  ##              although several more revisions would follow. It has been
042765,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
042766,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
042767,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
042768,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
042769,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
042770,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
042771,000013:                                                                                                  ##              rather than the original YUL assembler.
042772,000014:                                                                                                  ## Reference:   pp. 992-995
042773,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042774,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042775,000017:                                                                                                  ## Mod history: 05/30/03 RSB.   Began transcribing.
042776,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
042777,000019:                                                                                                  ##              2011-05-07 JL   Removed workaround.
042778,000020:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
042779,000021:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
042780,000022:                                                                                                  ##                              numbers in 1701.pdf.
042781,000023:                                                                                                  ##              2017-02-26 RSB  Proofed comment text using octopus/ProoferComments.
042782,000024:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
042783,000025:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
042784,000026:                                                                                                  ##                              Luminary 99 vs Comanche 55.
042785,000027:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
042786,000028:                                                                                                  ##              2021-05-30 ABS  ISWCALLL -> ISWCALL
042787,000029: 

Page 992

042789,000031:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042790,000032:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042791,000033: 
042792,000034:    4616                                           BLOCK    02                                    
042793,000035:    4616                                           COUNT*   $$/BANK                               
042794,000036:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
042795,000037:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
042796,000038:    4620           30000                           CA       0                                     
042797,000039:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
042798,000040: 
042799,000041:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042800,000042: 
042801,000043:    4622           54001        SWCALL             TS       L                                     
042802,000044:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
042803,000045:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
042804,000046:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
042805,000047:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
042806,000048:    4627           50002                           INDEX    Q                                     
042807,000049:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
042808,000050: 
042809,000051:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
042810,000052:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
042811,000053:    4633           56134                           XCH      BUF2       +1                         
042812,000054:    4634           00133                           TC       BUF2                                  
042813,000055: 
042814,000056:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042815,000057:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
042816,000058: 
042817,000059:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
042818,000060:    4636           50000                           INDEX    A                                     #  GET CADR.
042819,000061:    4637           30000                           CA       0                                     
042820,000062: 
042821,000063:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042822,000064: 
042823,000065:    4640           54004        BANKJUMP           TS       FBANK                                 
042824,000066:    4641           75012                           MASK     LOW10                                 
042825,000067:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
042826,000068:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
042827,000069:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
042828,000070: 

Page 993

042830,000072:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042831,000073: 
042832,000074:    4645           35012        MAKECADR           CAF      LOW10                                 
042833,000075:    4646           70133                           MASK     BUF2                                  
042834,000076:    4647           60134                           AD       BUF2       +1                         
042835,000077:    4650           00002                           TC       Q                                     
042836,000078: 
042837,000079:    4651           54135        SUPDACAL           TS       MPTEMP                                
042838,000080:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
042839,000081:    4653           00006                           EXTEND                                         
042840,000082:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
042841,000083:    4655           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
042842,000084:    4656           75012                           MASK     LOW10                                 
042843,000085:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042844,000086:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042845,000087:    4661           00006                           EXTEND                                         
042846,000088:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
042847,000089:    4663           50001                           INDEX    L                                     
042848,000090:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042849,000091:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042850,000092:    4666           00006                           EXTEND                                         
042851,000093:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
042852,000094:    4670           00003                           RELINT                                         
042853,000095:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
042854,000096:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
042855,000097:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042856,000098: 

Page 994

042858,000100:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042859,000101: 
042860,000102:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042861,000103:    4675           50002                           INDEX    Q                                     
042862,000104:    4676           30000                           CAF      0                                     
042863,000105:    4677           24002                           INCR     Q                                     
042864,000106: 
042865,000107:    4700           54001        ISWCALL            TS       L                                     
042866,000108:    4701           22004                           LXCH     FBANK                                 
042867,000109:    4702           75012                           MASK     LOW10                                 
042868,000110:    4703           56002                           XCH      Q                                     
042869,000111:    4704           52073                           DXCH     RUPTREG3                              
042870,000112:    4705           50002                           INDEX    Q                                     
042871,000113:    4706           02000                           TC       10000                                 
042872,000114: 
042873,000115:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
042874,000116:    4710           56004                           XCH      FBANK                                 
042875,000117:    4711           56073                           XCH      RUPTREG4                              
042876,000118:    4712           00072                           TC       RUPTREG3                              
042877,000119: 
042878,000120:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
042879,000121:                                                                                                  #        L       TC      USPRCADR
042880,000122:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
042881,000123:                                                                                                  #                                        RETURN IS TO L+2
042882,000124: 
042883,000125:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
042884,000126:    4714           34744                           CA       BIT8                                  
042885,000127:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
042886,000128:    4716           30006                           CA       BBANK                                 
042887,000129:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
042888,000130:    4720           50002                           INDEX    Q                                     
042889,000131:    4721           30000                           CA       0                                     
042890,000132:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
042891,000133:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
042892,000134:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042893,000135:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
042894,000136:    4726           14643                           TCF      Q+10000                               
042895,000137: 

Page 995

042897,000139:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042898,000140: 
042899,000141:                                                                                                  #                                        PSEUDO-FIXED    OCTAL PSEUDO
042900,000142:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS    ADDRESSES
042901,000143:                                                                                                  #  ----------    ------- ------------     ------------    ------------
042902,000144:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
042903,000145:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
042904,000146:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
042905,000147:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
042906,000148:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
042907,000149:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
042908,000150:                                                                                                  #                                                                                THE USER)
042909,000151:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
042910,000152:                                                                                                  #                                                                                THE USER)
042911,000153:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
042912,000154:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
042913,000155: 
042914,000156:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
042915,000157:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
042916,000158:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
042917,000159:                                                                                                  #        ...       ...
042918,000160:                                                                                                  #         .         .
042919,000161:                                                                                                  #         .         .
042920,000162:                                                                                                  #  OR IN THIS FASHION:
042921,000163:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042922,000164:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
042923,000165:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
042924,000166:                                                                                                  #         .         .                    SUPER100 OCTAL 100
042925,000167:                                                                                                  #         .         .                    SUPER101 OCTAL 120
042926,000168:                                                                                                  #                                        SUPER110 OCTAL 140
042927,000169: 
042928,000170:    4727           00006        SUPERSW            EXTEND                                         
042929,000171:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042930,000172:                                                                                                  #  CHANNEL 07
042931,000173:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
042932,000174:                                                                                                  #        TC SUPERSW
042933,000175: 

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