Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

042731,000002:                                                                                                  ## Copyright:   Public domain.
042732,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042733,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
042734,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
042735,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
042736,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
042737,000008:                                                                                                  ##              that the code format has been changed to conform to the
042738,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
042739,000010:                                                                                                  ##              original YUL assembler.
042740,000011:                                                                                                  ## Reference:   pp. 990-993
042741,000012:                                                                                                  ## Assembler:   yaYUL
042742,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042743,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042744,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
042745,000016:                                                                                                  ##              2017-01-30 RRB  Updated for Luminary 116.
042746,000017:                                                                                                  ##              2017-03-13 RSB  Proofed comment text via 3-way diff vs
042747,000018:                                                                                                  ##                              Luminary 99 and 131.
042748,000019:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
042749,000020:                                                                                                  ##                              Luminary 99 vs Comanche 55.
042750,000021: 

Page 990

042752,000023:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
042753,000024:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
042754,000025: 
042755,000026:    4616                                           BLOCK    02                                    
042756,000027:    4616                                           COUNT*   $$/BANK                               
042757,000028:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
042758,000029:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
042759,000030:    4620           30000                           CA       0                                     
042760,000031:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
042761,000032: 
042762,000033:                                                                                                  #           SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
042763,000034: 
042764,000035:    4622           54001        SWCALL             TS       L                                     
042765,000036:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
042766,000037:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
042767,000038:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
042768,000039:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
042769,000040:    4627           50002                           INDEX    Q                                     
042770,000041:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
042771,000042: 
042772,000043:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
042773,000044:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
042774,000045:    4633           56134                           XCH      BUF2       +1                         
042775,000046:    4634           00133                           TC       BUF2                                  
042776,000047: 
042777,000048:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
042778,000049:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
042779,000050: 
042780,000051:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
042781,000052:    4636           50000                           INDEX    A                                     #  GET CADR.
042782,000053:    4637           30000                           CA       0                                     
042783,000054: 
042784,000055:                                                                                                  #           BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
042785,000056: 
042786,000057:    4640           54004        BANKJUMP           TS       FBANK                                 
042787,000058:    4641           75012                           MASK     LOW10                                 
042788,000059:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
042789,000060:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
042790,000061:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF   10000 = 12000
042791,000062: 

Page 991

042793,000064:                                                                                                  #           THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
042794,000065: 
042795,000066:    4645           35012        MAKECADR           CAF      LOW10                                 
042796,000067:    4646           70133                           MASK     BUF2                                  
042797,000068:    4647           60134                           AD       BUF2       +1                         
042798,000069:    4650           00002                           TC       Q                                     
042799,000070: 
042800,000071:    4651           54135        SUPDACAL           TS       MPTEMP                                
042801,000072:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
042802,000073:    4653           00006                           EXTEND                                         
042803,000074:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
042804,000075:    4655           56135                           XCH      MPTEMP                                #  S UPERBANK IN BITS 7-5.
042805,000076:    4656           75012                           MASK     LOW10                                 
042806,000077:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
042807,000078:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
042808,000079:    4661           00006                           EXTEND                                         
042809,000080:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
042810,000081:    4663           50001                           INDEX    L                                     
042811,000082:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
042812,000083:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
042813,000084:    4666           00006                           EXTEND                                         
042814,000085:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
042815,000086:    4670           00003                           RELINT                                         
042816,000087:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
042817,000088:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
042818,000089:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
042819,000090: 

Page 992

042821,000092:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
042822,000093: 
042823,000094:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
042824,000095:    4675           50002                           INDEX    Q                                     
042825,000096:    4676           30000                           CAF      0                                     
042826,000097:    4677           24002                           INCR     Q                                     
042827,000098: 
042828,000099:    4700           54001        ISWCALLL           TS       L                                     
042829,000100:    4701           22004                           LXCH     FBANK                                 
042830,000101:    4702           75012                           MASK     LOW10                                 
042831,000102:    4703           56002                           XCH      Q                                     
042832,000103:    4704           52073                           DXCH     RUPTREG3                              
042833,000104:    4705           50002                           INDEX    Q                                     
042834,000105:    4706           02000                           TC       10000                                 
042835,000106: 
042836,000107:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
042837,000108:    4710           56004                           XCH      FBANK                                 
042838,000109:    4711           56073                           XCH      RUPTREG4                              
042839,000110:    4712           00072                           TC       RUPTREG3                              
042840,000111: 
042841,000112:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
042842,000113: 
042843,000114:                                                                                                  #        L       TC      USPRCADR
042844,000115:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
042845,000116:                                                                                                  #                                        RETURN IS TO L+2
042846,000117: 
042847,000118:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
042848,000119:    4714           34744                           CA       BIT8                                  
042849,000120:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
042850,000121:    4716           30006                           CA       BBANK                                 
042851,000122:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
042852,000123:    4720           50002                           INDEX    Q                                     
042853,000124:    4721           30000                           CA       0                                     
042854,000125:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
042855,000126:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
042856,000127:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
042857,000128:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
042858,000129:    4726           14643                           TCF      Q+10000                               
042859,000130: 

Page 993

042861,000132:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
042862,000133: 
042863,000134:                                                                                                  #                                        PSEUDO-FIXED      OCTAL PSEUDO
042864,000135:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS      ADDRESSES
042865,000136:                                                                                                  #  ----------    ------- ------------     ------------      ------------
042866,000137:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
042867,000138:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
042868,000139:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
042869,000140:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
042870,000141:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
042871,000142:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
042872,000143:                                                                                                  #                                                                                THE USER)
042873,000144:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
042874,000145:                                                                                                  #                                                                                THE USER)
042875,000146:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
042876,000147:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
042877,000148: 
042878,000149:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
042879,000150:                                                                                                  #        CAF     ABBCON          WHERE  --  ABBCON   BBCON  SOMETHIN  --
042880,000151:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
042881,000152:                                                                                                  #        ...       ...
042882,000153:                                                                                                  #         .         .
042883,000154:                                                                                                  #         .         .
042884,000155:                                                                                                  #  OR IN THIS FASHION:
042885,000156:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
042886,000157:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
042887,000158:                                                                                                  #        ...       ...                                   SUPER011 OCTAL  60
042888,000159:                                                                                                  #         .         .                                    SUPER100 OCTAL 100
042889,000160:                                                                                                  #         .         .                                    SUPER101 OCTAL 120
042890,000161:                                                                                                  #                                                        SUPER110 OCTAL 140
042891,000162: 
042892,000163:    4727           00006        SUPERSW            EXTEND                                         
042893,000164:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
042894,000165:                                                                                                  #  CHANNEL 07
042895,000166:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
042896,000167:                                                                                                  #    TC SUPERSW
042897,000168: 

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