Source Code

These source-code files are part of a reconstructed copy of Luminary 163, the first (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 163 listing would be different.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

042830,000002:                                                                                                  ## Copyright:   Public domain.
042831,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042832,000004:                                                                                                  ## Purpose:     A section of Luminary revision 163.
042833,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
042834,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
042835,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
042836,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
042837,000009:                                                                                                  ##              Luminary 173, as well as Luminary memos 157 amd 158.
042838,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
042839,000011:                                                                                                  ##              exactly match those specified for Luminary 163 in NASA
042840,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
042841,000013:                                                                                                  ##              that the reconstruction is correct.
042842,000014:                                                                                                  ## Reference:   pp. 989-992
042843,000015:                                                                                                  ## Assembler:   yaYUL
042844,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042845,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042846,000018:                                                                                                  ## Mod history: 2019-08-21 MAS  Created from Luminary 173.
042847,000019:                                                                                                  ##              2021-05-30 ABS  ISWCALLL -> ISWCALL
042848,000020: 

Page 989

042850,000022:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042851,000023:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE  TC BANKCALL  INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042852,000024: 
042853,000025:    4616                                           BLOCK    02                                    
042854,000026:    4616                                           COUNT*   $$/BANK                               
042855,000027:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
042856,000028:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
042857,000029:    4620           30000                           CA       0                                     
042858,000030:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
042859,000031: 
042860,000032:                                                                                                  #           SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042861,000033: 
042862,000034:    4622           54001        SWCALL             TS       L                                     
042863,000035:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
042864,000036:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
042865,000037:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
042866,000038:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
042867,000039:    4627           50002                           INDEX    Q                                     
042868,000040:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
042869,000041: 
042870,000042:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
042871,000043:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
042872,000044:    4633           56134                           XCH      BUF2       +1                         
042873,000045:    4634           00133                           TC       BUF2                                  
042874,000046: 
042875,000047:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042876,000048:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
042877,000049: 
042878,000050:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
042879,000051:    4636           50000                           INDEX    A                                     #  GET CADR.
042880,000052:    4637           30000                           CA       0                                     
042881,000053: 
042882,000054:                                                                                                  #           BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042883,000055: 
042884,000056:    4640           54004        BANKJUMP           TS       FBANK                                 
042885,000057:    4641           75012                           MASK     LOW10                                 
042886,000058:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
042887,000059:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
042888,000060:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF   10000 = 12000
042889,000061: 

Page 990

042891,000063:                                                                                                  #           THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042892,000064: 
042893,000065:    4645           35012        MAKECADR           CAF      LOW10                                 
042894,000066:    4646           70133                           MASK     BUF2                                  
042895,000067:    4647           60134                           AD       BUF2       +1                         
042896,000068:    4650           00002                           TC       Q                                     
042897,000069: 
042898,000070: 
042899,000071:    4651           54135        SUPDACAL           TS       MPTEMP                                
042900,000072:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
042901,000073:    4653           00006                           EXTEND                                         
042902,000074:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
042903,000075:    4655           56135                           XCH      MPTEMP                                #   SUPERBANK IN BITS  7-5.
042904,000076:    4656           75012                           MASK     LOW10                                 
042905,000077:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042906,000078:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042907,000079:    4661           00006                           EXTEND                                         
042908,000080:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
042909,000081:    4663           50001                           INDEX    L                                     
042910,000082:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042911,000083:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042912,000084:    4666           00006                           EXTEND                                         
042913,000085:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
042914,000086:    4670           00003                           RELINT                                         
042915,000087:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
042916,000088:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
042917,000089:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042918,000090: 

Page 991

042920,000092:                                                                                                  #           THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042921,000093: 
042922,000094:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042923,000095:    4675           50002                           INDEX    Q                                     
042924,000096:    4676           30000                           CAF      0                                     
042925,000097:    4677           24002                           INCR     Q                                     
042926,000098: 
042927,000099:    4700           54001        ISWCALL            TS       L                                     
042928,000100:    4701           22004                           LXCH     FBANK                                 
042929,000101:    4702           75012                           MASK     LOW10                                 
042930,000102:    4703           56002                           XCH      Q                                     
042931,000103:    4704           52073                           DXCH     RUPTREG3                              
042932,000104:    4705           50002                           INDEX    Q                                     
042933,000105:    4706           02000                           TC       10000                                 
042934,000106: 
042935,000107:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
042936,000108:    4710           56004                           XCH      FBANK                                 
042937,000109:    4711           56073                           XCH      RUPTREG4                              
042938,000110:    4712           00072                           TC       RUPTREG3                              
042939,000111: 
042940,000112:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
042941,000113: 
042942,000114:                                                                                                  #                                          L        TC     USPRCADR
042943,000115:                                                                                                  #                                          L+1      CADR   INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
042944,000116:                                                                                                  #                                                                          RETURN IS TO L+2
042945,000117: 
042946,000118: 
042947,000119:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
042948,000120:    4714           34744                           CA       BIT8                                  
042949,000121:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
042950,000122:    4716           30006                           CA       BBANK                                 
042951,000123:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
042952,000124:    4720           50002                           INDEX    Q                                     
042953,000125:    4721           30000                           CA       0                                     
042954,000126:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
042955,000127:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
042956,000128:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042957,000129:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
042958,000130:    4726           14643                           TCF      Q+10000                               
042959,000131: 

Page 992

042961,000133:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042962,000134:                                                                                                  #                                            PSEUDO-FIXED     OCTAL PSEUDO
042963,000135:                                                                                                  #  SUPERBANK     SETTING     S-REG. VALUE    BANK NUMBERS     ADDRESSES
042964,000136:                                                                                                  #  ----------    -------     ------------    ------------      ------------
042965,000137: 
042966,000138:                                                                                                  #  SUPERBANK 3     0XX       2000 - 3777        30 - 37       70000 - 107777   (WHERE XX CAN BE ANYTHING AND
042967,000139:                                                                                                  #                                                                              WILL USUALLY BE SEEN AS 11)
042968,000140:                                                                                                  #  SUPERBANK 4     100       2000 - 3777        40 - 47       110000 - 127777  (AS FAR AS IT CAN BE SEEN,
042969,000141:                                                                                                  #                                                                              ONLY BANKS 40-43 WILL EVER BE
042970,000142:                                                                                                  #                                                                              AND ARE PRESENTLY AVAILABLE)
042971,000143:                                                                                                  #  SUPERBANK 5     101       2000 - 3777        50 - 57       130000 - 147777  (PRESENTLY NOT AVAILABLE TO
042972,000144:                                                                                                  #                                                                              THE USER)
042973,000145:                                                                                                  #  SUPERBANK 6     110       2000 - 3777        60 - 67       150000 - 167777  (PRESENTLY NOT AVAILABLE TO
042974,000146:                                                                                                  #                                                                              THE USER)
042975,000147:                                                                                                  #  ***  THIS ROUTINE MAYBE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
042976,000148:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW.  ***
042977,000149: 
042978,000150:                                                                                                  #  SUPERSW MAYBE CALLED IN THIS FASHION:
042979,000151: 
042980,000152:                                                                                                  #           CAF    ABBCON          WHERE  --  ABBCON   BBCON  SOMETHIN  --
042981,000153:                                                                                                  #           TCR    SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
042982,000154:                                                                                                  #           ...      ...
042983,000155:                                                                                                  #            .        .
042984,000156:                                                                                                  #            .        .
042985,000157: 
042986,000158:                                                                                                  #  OR IN THIS FASHION :
042987,000159: 
042988,000160:                                                                                                  #           CAF    SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042989,000161:                                                                                                  #           TCR    SUPERSW         SUPERBANK BIT CONSTANTS:
042990,000162:                                                                                                  #           ...      ...                                   SUPER011 OCTAL  60
042991,000163:                                                                                                  #            .        .                                    SUPER100 OCTAL 100
042992,000164:                                                                                                  #            .        .                                    SUPER101 OCTAL 120
042993,000165:                                                                                                  #                                                          SUPER110 OCTAL 140
042994,000166: 
042995,000167:    4727           00006        SUPERSW            EXTEND                                         
042996,000168:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042997,000169:                                                                                                  #  CHANNEL 07
042998,000170:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
042999,000171:                                                                                                  #    TC  SUPERSW
043000,000172: 

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