Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

042517,000002:                                                                                                  ## Copyright:   Public domain.
042518,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042519,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
042520,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
042521,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
042522,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
042523,000008:                                                                                                  ##              that the code format has been changed to conform to the
042524,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
042525,000010:                                                                                                  ##              original YUL assembler.
042526,000011:                                                                                                  ## Reference:   pp. 992-995
042527,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042528,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042529,000014:                                                                                                  ## Mod history: 05/30/03 RSB.   Began transcribing.
042530,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
042531,000016:                                                                                                  ##              2011-05-07 JL   Removed workaround.
042532,000017:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
042533,000018:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
042534,000019:                                                                                                  ##                              numbers in 1701.pdf.
042535,000020:                                                                                                  ##              2017-02-26 RSB  Proofed comment text using octopus/ProoferComments.
042536,000021:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
042537,000022:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
042538,000023:                                                                                                  ##                              Luminary 99 vs Comanche 55.
042539,000024: 

Page 992

042541,000026:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042542,000027:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042543,000028: 
042544,000029:    4616                                           BLOCK    02                                    
042545,000030:    4616                                           COUNT*   $$/BANK                               
042546,000031:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
042547,000032:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
042548,000033:    4620           30000                           CA       0                                     
042549,000034:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
042550,000035: 
042551,000036:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042552,000037: 
042553,000038:    4622           54001        SWCALL             TS       L                                     
042554,000039:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
042555,000040:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
042556,000041:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
042557,000042:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
042558,000043:    4627           50002                           INDEX    Q                                     
042559,000044:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
042560,000045: 
042561,000046:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
042562,000047:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
042563,000048:    4633           56134                           XCH      BUF2       +1                         
042564,000049:    4634           00133                           TC       BUF2                                  
042565,000050: 
042566,000051:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042567,000052:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
042568,000053: 
042569,000054:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
042570,000055:    4636           50000                           INDEX    A                                     #  GET CADR.
042571,000056:    4637           30000                           CA       0                                     
042572,000057: 
042573,000058:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042574,000059: 
042575,000060:    4640           54004        BANKJUMP           TS       FBANK                                 
042576,000061:    4641           75012                           MASK     LOW10                                 
042577,000062:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
042578,000063:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
042579,000064:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
042580,000065: 

Page 993

042582,000067:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042583,000068: 
042584,000069:    4645           35012        MAKECADR           CAF      LOW10                                 
042585,000070:    4646           70133                           MASK     BUF2                                  
042586,000071:    4647           60134                           AD       BUF2       +1                         
042587,000072:    4650           00002                           TC       Q                                     
042588,000073: 
042589,000074:    4651           54135        SUPDACAL           TS       MPTEMP                                
042590,000075:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
042591,000076:    4653           00006                           EXTEND                                         
042592,000077:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
042593,000078:    4655           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
042594,000079:    4656           75012                           MASK     LOW10                                 
042595,000080:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042596,000081:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042597,000082:    4661           00006                           EXTEND                                         
042598,000083:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
042599,000084:    4663           50001                           INDEX    L                                     
042600,000085:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042601,000086:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042602,000087:    4666           00006                           EXTEND                                         
042603,000088:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
042604,000089:    4670           00003                           RELINT                                         
042605,000090:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
042606,000091:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
042607,000092:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042608,000093: 

Page 994

042610,000095:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042611,000096: 
042612,000097:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042613,000098:    4675           50002                           INDEX    Q                                     
042614,000099:    4676           30000                           CAF      0                                     
042615,000100:    4677           24002                           INCR     Q                                     
042616,000101: 
042617,000102:    4700           54001        ISWCALLL           TS       L                                     
042618,000103:    4701           22004                           LXCH     FBANK                                 
042619,000104:    4702           75012                           MASK     LOW10                                 
042620,000105:    4703           56002                           XCH      Q                                     
042621,000106:    4704           52073                           DXCH     RUPTREG3                              
042622,000107:    4705           50002                           INDEX    Q                                     
042623,000108:    4706           02000                           TC       10000                                 
042624,000109: 
042625,000110:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
042626,000111:    4710           56004                           XCH      FBANK                                 
042627,000112:    4711           56073                           XCH      RUPTREG4                              
042628,000113:    4712           00072                           TC       RUPTREG3                              
042629,000114: 
042630,000115:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
042631,000116:                                                                                                  #        L       TC      USPRCADR
042632,000117:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
042633,000118:                                                                                                  #                                        RETURN IS TO L+2
042634,000119: 
042635,000120:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
042636,000121:    4714           34744                           CA       BIT8                                  
042637,000122:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
042638,000123:    4716           30006                           CA       BBANK                                 
042639,000124:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
042640,000125:    4720           50002                           INDEX    Q                                     
042641,000126:    4721           30000                           CA       0                                     
042642,000127:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
042643,000128:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
042644,000129:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042645,000130:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
042646,000131:    4726           14643                           TCF      Q+10000                               
042647,000132: 

Page 995

042649,000134:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042650,000135: 
042651,000136:                                                                                                  #                                        PSEUDO-FIXED    OCTAL PSEUDO
042652,000137:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS    ADDRESSES
042653,000138:                                                                                                  #  ----------    ------- ------------     ------------    ------------
042654,000139:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
042655,000140:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
042656,000141:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
042657,000142:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
042658,000143:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
042659,000144:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
042660,000145:                                                                                                  #                                                                                THE USER)
042661,000146:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
042662,000147:                                                                                                  #                                                                                THE USER)
042663,000148:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
042664,000149:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
042665,000150: 
042666,000151:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
042667,000152:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
042668,000153:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
042669,000154:                                                                                                  #        ...       ...
042670,000155:                                                                                                  #         .         .
042671,000156:                                                                                                  #         .         .
042672,000157:                                                                                                  #  OR IN THIS FASHION:
042673,000158:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042674,000159:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
042675,000160:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
042676,000161:                                                                                                  #         .         .                    SUPER100 OCTAL 100
042677,000162:                                                                                                  #         .         .                    SUPER101 OCTAL 120
042678,000163:                                                                                                  #                                        SUPER110 OCTAL 140
042679,000164: 
042680,000165:    4727           00006        SUPERSW            EXTEND                                         
042681,000166:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042682,000167:                                                                                                  #  CHANNEL 07
042683,000168:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
042684,000169:                                                                                                  #        TC SUPERSW
042685,000170: 

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