Source Code

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

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. 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 178 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.

042991,000002:                                                                                                  ## Copyright:   Public domain.
042992,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
042993,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
042994,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
042995,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
042996,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
042997,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
042998,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
042999,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
043000,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
043001,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
043002,000013:                                                                                                  ##              that the reconstruction is correct.
043003,000014:                                                                                                  ## Reference:   pp. 989-992
043004,000015:                                                                                                  ## Assembler:   yaYUL
043005,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043006,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043007,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
043008,000019:                                                                                                  ##              2021-05-30 ABS  ISWCALLL -> ISWCALL
043009,000020: 

Page 989

043011,000022:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
043012,000023:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE  TC BANKCALL  INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
043013,000024: 
043014,000025:    4616                                           BLOCK    02                                    
043015,000026:    4616                                           COUNT*   $$/BANK                               
043016,000027:    4616           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
043017,000028:    4617           50002                           INDEX    Q                                     #  PICK UP CADR.
043018,000029:    4620           30000                           CA       0                                     
043019,000030:    4621           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
043020,000031: 
043021,000032:                                                                                                  #           SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
043022,000033: 
043023,000034:    4622           54001        SWCALL             TS       L                                     
043024,000035:    4623           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
043025,000036:    4624           75012                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
043026,000037:    4625           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
043027,000038:    4626           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
043028,000039:    4627           50002                           INDEX    Q                                     
043029,000040:    4630           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
043030,000041: 
043031,000042:    4631           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
043032,000043:    4632           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
043033,000044:    4633           56134                           XCH      BUF2       +1                         
043034,000045:    4634           00133                           TC       BUF2                                  
043035,000046: 
043036,000047:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
043037,000048:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
043038,000049: 
043039,000050:    4635           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
043040,000051:    4636           50000                           INDEX    A                                     #  GET CADR.
043041,000052:    4637           30000                           CA       0                                     
043042,000053: 
043043,000054:                                                                                                  #           BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
043044,000055: 
043045,000056:    4640           54004        BANKJUMP           TS       FBANK                                 
043046,000057:    4641           75012                           MASK     LOW10                                 
043047,000058:    4642           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
043048,000059:    4643           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
043049,000060:    4644           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF   10000 = 12000
043050,000061: 

Page 990

043052,000063:                                                                                                  #           THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
043053,000064: 
043054,000065:    4645           35012        MAKECADR           CAF      LOW10                                 
043055,000066:    4646           70133                           MASK     BUF2                                  
043056,000067:    4647           60134                           AD       BUF2       +1                         
043057,000068:    4650           00002                           TC       Q                                     
043058,000069: 
043059,000070: 
043060,000071:    4651           54135        SUPDACAL           TS       MPTEMP                                
043061,000072:    4652           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
043062,000073:    4653           00006                           EXTEND                                         
043063,000074:    4654           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
043064,000075:    4655           56135                           XCH      MPTEMP                                #   SUPERBANK IN BITS  7-5.
043065,000076:    4656           75012                           MASK     LOW10                                 
043066,000077:    4657           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
043067,000078:    4660           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
043068,000079:    4661           00006                           EXTEND                                         
043069,000080:    4662           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
043070,000081:    4663           50001                           INDEX    L                                     
043071,000082:    4664           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
043072,000083:    4665           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
043073,000084:    4666           00006                           EXTEND                                         
043074,000085:    4667           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
043075,000086:    4670           00003                           RELINT                                         
043076,000087:    4671           54004                           TS       FBANK                                 #  RESTORE FBANK.
043077,000088:    4672           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
043078,000089:    4673           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
043079,000090: 

Page 991

043081,000092:                                                                                                  #           THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
043082,000093: 
043083,000094:    4674           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
043084,000095:    4675           50002                           INDEX    Q                                     
043085,000096:    4676           30000                           CAF      0                                     
043086,000097:    4677           24002                           INCR     Q                                     
043087,000098: 
043088,000099:    4700           54001        ISWCALL            TS       L                                     
043089,000100:    4701           22004                           LXCH     FBANK                                 
043090,000101:    4702           75012                           MASK     LOW10                                 
043091,000102:    4703           56002                           XCH      Q                                     
043092,000103:    4704           52073                           DXCH     RUPTREG3                              
043093,000104:    4705           50002                           INDEX    Q                                     
043094,000105:    4706           02000                           TC       10000                                 
043095,000106: 
043096,000107:    4707           56073        ISWRETRN           XCH      RUPTREG4                              
043097,000108:    4710           56004                           XCH      FBANK                                 
043098,000109:    4711           56073                           XCH      RUPTREG4                              
043099,000110:    4712           00072                           TC       RUPTREG3                              
043100,000111: 
043101,000112:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
043102,000113: 
043103,000114:                                                                                                  #                                          L        TC     USPRCADR
043104,000115:                                                                                                  #                                          L+1      CADR   INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
043105,000116:                                                                                                  #                                                                          RETURN IS TO L+2
043106,000117: 
043107,000118: 
043108,000119:    4713           54164        USPRCADR           TS       LOC                                   #  SAVE A
043109,000120:    4714           34744                           CA       BIT8                                  
043110,000121:    4715           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
043111,000122:    4716           30006                           CA       BBANK                                 
043112,000123:    4717           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
043113,000124:    4720           50002                           INDEX    Q                                     
043114,000125:    4721           30000                           CA       0                                     
043115,000126:    4722           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
043116,000127:    4723           75012                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
043117,000128:    4724           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
043118,000129:    4725           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
043119,000130:    4726           14643                           TCF      Q+10000                               
043120,000131: 

Page 992

043122,000133:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07. (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
043123,000134:                                                                                                  #                                            PSEUDO-FIXED     OCTAL PSEUDO
043124,000135:                                                                                                  #  SUPERBANK     SETTING     S-REG. VALUE    BANK NUMBERS     ADDRESSES
043125,000136:                                                                                                  #  ----------    -------     ------------    ------------      ------------
043126,000137: 
043127,000138:                                                                                                  #  SUPERBANK 3     0XX       2000 - 3777        30 - 37       70000 - 107777   (WHERE XX CAN BE ANYTHING AND
043128,000139:                                                                                                  #                                                                              WILL USUALLY BE SEEN AS 11)
043129,000140:                                                                                                  #  SUPERBANK 4     100       2000 - 3777        40 - 47       110000 - 127777  (AS FAR AS IT CAN BE SEEN,
043130,000141:                                                                                                  #                                                                              ONLY BANKS 40-43 WILL EVER BE
043131,000142:                                                                                                  #                                                                              AND ARE PRESENTLY AVAILABLE)
043132,000143:                                                                                                  #  SUPERBANK 5     101       2000 - 3777        50 - 57       130000 - 147777  (PRESENTLY NOT AVAILABLE TO
043133,000144:                                                                                                  #                                                                              THE USER)
043134,000145:                                                                                                  #  SUPERBANK 6     110       2000 - 3777        60 - 67       150000 - 167777  (PRESENTLY NOT AVAILABLE TO
043135,000146:                                                                                                  #                                                                              THE USER)
043136,000147:                                                                                                  #  ***  THIS ROUTINE MAYBE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
043137,000148:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW.  ***
043138,000149: 
043139,000150:                                                                                                  #  SUPERSW MAYBE CALLED IN THIS FASHION:
043140,000151: 
043141,000152:                                                                                                  #           CAF    ABBCON          WHERE  --  ABBCON   BBCON  SOMETHIN  --
043142,000153:                                                                                                  #           TCR    SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
043143,000154:                                                                                                  #           ...      ...
043144,000155:                                                                                                  #            .        .
043145,000156:                                                                                                  #            .        .
043146,000157: 
043147,000158:                                                                                                  #  OR IN THIS FASHION :
043148,000159: 
043149,000160:                                                                                                  #           CAF    SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
043150,000161:                                                                                                  #           TCR    SUPERSW         SUPERBANK BIT CONSTANTS:
043151,000162:                                                                                                  #           ...      ...                                   SUPER011 OCTAL  60
043152,000163:                                                                                                  #            .        .                                    SUPER100 OCTAL 100
043153,000164:                                                                                                  #            .        .                                    SUPER101 OCTAL 120
043154,000165:                                                                                                  #                                                          SUPER110 OCTAL 140
043155,000166: 
043156,000167:    4727           00006        SUPERSW            EXTEND                                         
043157,000168:    4730           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
043158,000169:                                                                                                  #  CHANNEL 07
043159,000170:    4731           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
043160,000171:                                                                                                  #    TC  SUPERSW
043161,000172: 

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