Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

039095,000002:                                                                                                  ## Copyright:   Public domain.
039096,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
039097,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
039098,000005:                                                                                                  ##              as closely as possible with available information. Sundance
039099,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
039100,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
039101,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
039102,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
039103,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
039104,000011:                                                                                                  ##              or the Sundance GSOPs.
039105,000012:                                                                                                  ## Assembler:   yaYUL
039106,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
039107,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
039108,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
039109,000016:                                                                                                  ##              2021-05-30 ABS  ISWCALLL -> ISWCALL
039110,000017: 
039111,000018: 
039112,000019: 
039113,000020:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
039114,000021:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
039115,000022: 
039116,000023:    4655                                           BLOCK    02                                    
039117,000024:    4655                                           COUNT*   $$/BANK                               
039118,000025:    4655           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
039119,000026:    4656           50002                           INDEX    Q                                     #  PICK UP CADR.
039120,000027:    4657           30000                           CA       0                                     
039121,000028:    4660           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
039122,000029: 
039123,000030:                                                                                                  #            SWCALL IS IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
039124,000031: 
039125,000032:    4661           54001        SWCALL             TS       L                                     
039126,000033:    4662           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
039127,000034:    4663           75062                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
039128,000035:    4664           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
039129,000036:    4665           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
039130,000037:    4666           50002                           INDEX    Q                                     
039131,000038:    4667           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
039132,000039: 
039133,000040:    4670           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
039134,000041:    4671           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
039135,000042:    4672           56134                           XCH      BUF2       +1                         
039136,000043:    4673           00133                           TC       BUF2                                  
039137,000044: 
039138,000045:                                                                                                  #           THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
039139,000046:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
039140,000047: 
039141,000048:    4674           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
039142,000049:    4675           50000                           INDEX    A                                     #  GET CADR.
039143,000050:    4676           30000                           CA       0                                     
039144,000051: 
039145,000052:                                                                                                  #            BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
039146,000053: 
039147,000054:    4677           54004        BANKJUMP           TS       FBANK                                 
039148,000055:    4700           75062                           MASK     LOW10                                 
039149,000056:    4701           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
039150,000057:    4702           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
039151,000058:    4703           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
039152,000059: 
039153,000060:                                                                                                  #            THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
039154,000061: 
039155,000062:    4704           35062        MAKECADR           CAF      LOW10                                 
039156,000063:    4705           70133                           MASK     BUF2                                  
039157,000064:    4706           60134                           AD       BUF2       +1                         
039158,000065:    4707           00002                           TC       Q                                     
039159,000066: 
039160,000067:                                                                                                  #           THE FOLLOWING ROUTINE OBTAINS THE ONE WORD AT THE ADDRESS ARRIVING IN A, AND LEAVES IT IN A.  ENTER
039161,000068:                                                                                                  #  WITH THE CADR IN A, AT DATACALL WITH JUNK IN L IF NOT SWITCHING SUPERBANKS, OTHERWISE AT SUPDACAL WITH SUPERBANK
039162,000069:                                                                                                  #  BITS IN BITS 7-5 IN L (BITS 15-8 AND 4-1 MAY BE JUNK).  DEBRIS = MTEMP.  INHINTS FOR ABOUT 165 MUSEC.
039163,000070: 
039164,000071:    4710           54001        DATACALL           TS       L                                     #  SAVE CADR (SOLE INPUT HERE).
039165,000072:    4711           00006                           EXTEND                                         
039166,000073:    4712           00007                           READ     SUPERBNK                              #  THIS PROLOGUE MAKES SUPERSWITCH VACUOUS.
039167,000074:    4713           56001                           XCH      L                                     #  CADR IN A, SUPERBITS IN L.
039168,000075: 
039169,000076:    4714           54135        SUPDACAL           TS       MPTEMP                                
039170,000077:    4715           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
039171,000078:    4716           00006                           EXTEND                                         
039172,000079:    4717           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
039173,000080:    4720           56135                           XCH      MPTEMP                                #   SUPERBANK IN BITS 7-5.
039174,000081:    4721           75062                           MASK     LOW10                                 
039175,000082:    4722           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
039176,000083:    4723           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
039177,000084:    4724           00006                           EXTEND                                         
039178,000085:    4725           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
039179,000086:    4726           50001                           INDEX    L                                     
039180,000087:    4727           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
039181,000088:    4730           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
039182,000089:    4731           00006                           EXTEND                                         
039183,000090:    4732           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
039184,000091:    4733           00003                           RELINT                                         
039185,000092:    4734           54004                           TS       FBANK                                 #  RESTORE FBANK.
039186,000093:    4735           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
039187,000094:    4736           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
039188,000095: 
039189,000096:                                                                                                  #           THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
039190,000097: 
039191,000098:    4737           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
039192,000099:    4740           50002                           INDEX    Q                                     
039193,000100:    4741           30000                           CAF      0                                     
039194,000101:    4742           24002                           INCR     Q                                     
039195,000102: 
039196,000103:    4743           54001        ISWCALL            TS       L                                     
039197,000104:    4744           22004                           LXCH     FBANK                                 
039198,000105:    4745           75062                           MASK     LOW10                                 
039199,000106:    4746           56002                           XCH      Q                                     
039200,000107:    4747           52073                           DXCH     RUPTREG3                              
039201,000108:    4750           50002                           INDEX    Q                                     
039202,000109:    4751           02000                           TC       10000                                 
039203,000110: 
039204,000111:    4752           56073        ISWRETRN           XCH      RUPTREG4                              
039205,000112:    4753           56004                           XCH      FBANK                                 
039206,000113:    4754           56073                           XCH      RUPTREG4                              
039207,000114:    4755           00072                           TC       RUPTREG3                              
039208,000115: 
039209,000116:                                                                                                  #           THE FOLLOWING SUBROUTINES PROVIDE TO THE BASIC PROGRAMMER ENTRY INTO AND RETURN FROM ANY INTERPRETIVE
039210,000117:                                                                                                  #  CODING WHICH DOES NOT USE THE ENTERING CONTENTS OF Q AND WHICH RETURNS VIA DANZIG. C(A) AND C(L) ARE SAVED.
039211,000118: 
039212,000119:                                                                                                  #  USER'S RESPONSIBILITY TO FILL IN ADVANCE THE APPROPRIATE OPERAND AND ADDRESS REGISTERS USED BY THE
039213,000120:                                                                                                  #  INTERPRETIVE CODING SUCH AS MPAC, BUF, ADDRWD, ETC.; AND TO CONFIRM THAT THE INTERPRETIVE CODING MEETS THE
039214,000121:                                                                                                  #  ABOVE RESTRICTIONS WITH RESPECT TO Q AND DANZIG.
039215,000122: 
039216,000123:                                                                                                  #  USEPRET AND USPRCADR MUST NOT BE USED IN INTERRUPT.
039217,000124: 
039218,000125:                                                                                                  #  1. USEPRET ACCESSES INTERPRETIVE CODING WHICH CAN BE ENTERED WITHOUT CHANGING FBANK.
039219,000126:                                                                                                  #     THE CALLING SEQUENCE IS AS FOLLOWS:
039220,000127: 
039221,000128:                                                                                                  #                                          L         TC     USEPRET
039222,000129:                                                                                                  #                                          L+1       TC,TCF INTPRETX       TC,TCF MEANS TC OR TCF
039223,000130:                                                                                                  #                                                                          INTPRETX IS THE INTERPRETIVE CODING
039224,000131:                                                                                                  #                                                                          RETURN IS TO L+2
039225,000132: 
039226,000133:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
039227,000134:                                                                                                  #        L       TC      USPRCADR
039228,000135:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
039229,000136:                                                                                                  #                                        RETURN IS TO L+2
039230,000137: 
039231,000138:    4756           56002        USEPRET            XCH      Q                                     #  FETCH Q, SAVING A
039232,000139:    4757           54164                           TS       LOC                                   #  L+1 TO LOC
039233,000140:    4760           30006                           CA       BBANK                                 
039234,000141:    4761           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
039235,000142:    4762           35017                           CA       BIT8                                  
039236,000143:    4763           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
039237,000144:    4764           30002                           CA       Q                                     #  RETRIEVE ORIGINAL A
039238,000145:    4765           00164                           TC       LOC                                   
039239,000146: 
039240,000147:    4766           54164        USPRCADR           TS       LOC                                   #  SAVE A
039241,000148:    4767           35017                           CA       BIT8                                  
039242,000149:    4770           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
039243,000150:    4771           30006                           CA       BBANK                                 
039244,000151:    4772           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
039245,000152:    4773           50002                           INDEX    Q                                     
039246,000153:    4774           30000                           CA       0                                     
039247,000154:    4775           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
039248,000155:    4776           75062                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
039249,000156:    4777           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
039250,000157:    5000           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
039251,000158:    5001           14702                           TCF      Q+10000                               
039252,000159: 
039253,000160:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
039254,000161: 
039255,000162:                                                                                                  #                                        PSEUDO-FIXED      OCTAL PSEUDO
039256,000163:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS      ADDRESSES
039257,000164:                                                                                                  #  ----------    ------- ------------     ------------      ------------
039258,000165:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
039259,000166:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
039260,000167:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
039261,000168:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
039262,000169:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
039263,000170:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
039264,000171:                                                                                                  #                                                                                THE USER)
039265,000172:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
039266,000173:                                                                                                  #                                                                                THE USER)
039267,000174:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
039268,000175:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
039269,000176: 
039270,000177:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
039271,000178:                                                                                                  #        CAF     ABBCON          WHERE   -- ABBCON   BBCON  SOMETHIN  --
039272,000179:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
039273,000180:                                                                                                  #        ...       ...
039274,000181:                                                                                                  #         .         .
039275,000182:                                                                                                  #         .         .
039276,000183:                                                                                                  #  OR IN THIS FASHION:
039277,000184:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
039278,000185:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
039279,000186:                                                                                                  #        ...       ...                                   SUPER011 OCTAL  60
039280,000187:                                                                                                  #         .         .                                    SUPER100 OCTAL 100
039281,000188:                                                                                                  #         .         .                                    SUPER101 OCTAL 120
039282,000189:                                                                                                  #                                                        SUPER110 OCTAL 140
039283,000190: 
039284,000191:    5002           00006        SUPERSW            EXTEND                                         
039285,000192:    5003           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
039286,000193:                                                                                                  #  CHANNEL 07
039287,000194:    5004           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
039288,000195:                                                                                                  #   TC SUPERSW
039289,000196: 

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