Source Code

These source-code files are part of a reconstructed copy of Luminary 96, the original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing.

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.

042608,000002:                                                                                                  ## Copyright:   Public domain.
042609,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042610,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
042611,000005:                                                                                                  ##              It is part of the reconstructed source code for the
042612,000006:                                                                                                  ##              original release of the flight software for the Lunar 
042613,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
042614,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
042615,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
042616,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
042617,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
042618,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
042619,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
042620,000014:                                                                                                  ## Reference:   pp. 998-1001
042621,000015:                                                                                                  ## Assembler:   yaYUL
042622,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042623,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042624,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
042625,000019: 

Page 998

042627,000021:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042628,000022:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042629,000023: 
042630,000024:    4616                                           BLOCK    02                                    
042631,000025:    4616                                           COUNT*   $$/BANK                               
042632,000026:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
042633,000027:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
042634,000028:    4620           30000                           CA       0                                     
042635,000029:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
042636,000030: 
042637,000031:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042638,000032: 
042639,000033:    4622           54001        SWCALL             TS       L                                     
042640,000034:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
042641,000035:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
042642,000036:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
042643,000037:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
042644,000038:    4627           50002                           INDEX    Q                                     
042645,000039:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
042646,000040: 
042647,000041:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
042648,000042:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
042649,000043:    4633           56134                           XCH      BUF2       +1                         
042650,000044:    4634           00133                           TC       BUF2                                  
042651,000045: 
042652,000046:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042653,000047:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
042654,000048: 
042655,000049:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
042656,000050:    4636           50000                           INDEX    A                                     #  GET CADR.
042657,000051:    4637           30000                           CA       0                                     
042658,000052: 
042659,000053:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042660,000054: 
042661,000055:    4640           54004        BANKJUMP           TS       FBANK                                 
042662,000056:    4641           75012                           MASK     LOW10                                 
042663,000057:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
042664,000058:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
042665,000059:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
042666,000060: 

Page 999

042668,000062:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042669,000063: 
042670,000064:    4645           35012        MAKECADR           CAF      LOW10                                 
042671,000065:    4646           70133                           MASK     BUF2                                  
042672,000066:    4647           60134                           AD       BUF2       +1                         
042673,000067:    4650           00002                           TC       Q                                     
042674,000068: 
042675,000069:    4651           54135        SUPDACAL           TS       MPTEMP                                
042676,000070:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
042677,000071:    4653           00006                           EXTEND                                         
042678,000072:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
042679,000073:    4655           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
042680,000074:    4656           75012                           MASK     LOW10                                 
042681,000075:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042682,000076:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042683,000077:    4661           00006                           EXTEND                                         
042684,000078:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
042685,000079:    4663           50001                           INDEX    L                                     
042686,000080:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042687,000081:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042688,000082:    4666           00006                           EXTEND                                         
042689,000083:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
042690,000084:    4670           00003                           RELINT                                         
042691,000085:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
042692,000086:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
042693,000087:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042694,000088: 

Page 1000

042696,000090:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042697,000091: 
042698,000092:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042699,000093:    4675           50002                           INDEX    Q                                     
042700,000094:    4676           30000                           CAF      0                                     
042701,000095:    4677           24002                           INCR     Q                                     
042702,000096: 
042703,000097:    4700           54001        ISWCALLL           TS       L                                     
042704,000098:    4701           22004                           LXCH     FBANK                                 
042705,000099:    4702           75012                           MASK     LOW10                                 
042706,000100:    4703           56002                           XCH      Q                                     
042707,000101:    4704           52073                           DXCH     RUPTREG3                              
042708,000102:    4705           50002                           INDEX    Q                                     
042709,000103:    4706           02000                           TC       10000                                 
042710,000104: 
042711,000105:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
042712,000106:    4710           56004                           XCH      FBANK                                 
042713,000107:    4711           56073                           XCH      RUPTREG4                              
042714,000108:    4712           00072                           TC       RUPTREG3                              
042715,000109: 
042716,000110:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
042717,000111:                                                                                                  #        L       TC      USPRCADR
042718,000112:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
042719,000113:                                                                                                  #                                        RETURN IS TO L+2
042720,000114: 
042721,000115:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
042722,000116:    4714           34744                           CA       BIT8                                  
042723,000117:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
042724,000118:    4716           30006                           CA       BBANK                                 
042725,000119:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
042726,000120:    4720           50002                           INDEX    Q                                     
042727,000121:    4721           30000                           CA       0                                     
042728,000122:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
042729,000123:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
042730,000124:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042731,000125:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
042732,000126:    4726           14643                           TCF      Q+10000                               
042733,000127: 

Page 1001

042735,000129:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042736,000130: 
042737,000131:                                                                                                  #                                        PSEUDO-FIXED      OCTAL PSEUDO
042738,000132:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS      ADDRESSES
042739,000133:                                                                                                  #  ----------    ------- ------------     ------------      ------------
042740,000134:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
042741,000135:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
042742,000136:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
042743,000137:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
042744,000138:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
042745,000139:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
042746,000140:                                                                                                  #                                                                                THE USER)
042747,000141:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
042748,000142:                                                                                                  #                                                                                THE USER)
042749,000143:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
042750,000144:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
042751,000145: 
042752,000146:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
042753,000147:                                                                                                  #        CAF     ABBCON          WHERE  --  ABBCON   BBCON  SOMETHIN -- 
042754,000148:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
042755,000149:                                                                                                  #        ...       ...
042756,000150:                                                                                                  #         .         .
042757,000151:                                                                                                  #         .         .
042758,000152:                                                                                                  #  OR IN THIS FASHION:
042759,000153:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042760,000154:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
042761,000155:                                                                                                  #        ...       ...                                   SUPER011 OCTAL  60
042762,000156:                                                                                                  #         .         .                                    SUPER100 OCTAL 100
042763,000157:                                                                                                  #         .         .                                    SUPER101 OCTAL 120
042764,000158:                                                                                                  #                                                        SUPER110 OCTAL 140
042765,000159: 
042766,000160:    4727           00006        SUPERSW            EXTEND                                         
042767,000161:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042768,000162:                                                                                                  #  CHANNEL 07
042769,000163:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
042770,000164:                                                                                                  #        TC SUPERSW
042771,000165: 

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