Source Code

This is the source-code for the Apollo 9 Command Module's Guidance Computer. These files were derived originally from the scan from MIT's Dibner Institute's now-discontinued website titled "History of Recent Science and Technology", which in turn was originally created by Gary Neff, though his high-quality scans were unfortunately reduced in legibility when presented online. The markings on the front of the printout imply that it was the original AGC developer Norm Brodeur's copy. A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original AGC developer Fred Martin. The source code was transcribed from those images by Ron Burkey. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

047869,000002:                                                                                                  ## Copyright:   Public domain.
047870,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
047871,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
047872,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
047873,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
047874,000007:                                                                                                  ## Assembler:   yaYUL
047875,000008:                                                                                                  ## Reference:   Starts on p. 1073
047876,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
047877,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo.
047878,000011:                                                                                                  ## Mod history: 08/28/04   RSB  Adapted from corresponding Luminary 131 file.
047879,000012:                                                                                                  ##              2011-05-07 JL   Removed workaround.
047880,000013:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
047881,000014:                                                                                                  ##                              original harcopy, as opposed to the PDF page
047882,000015:                                                                                                  ##                              numbers in 1701.pdf.
047883,000016:                                                                                                  ##              2017-01-14 RSB  Cross-diff'd comment text (not whitespace)
047884,000017:                                                                                                  ##                              vs the already-proofed corresponding Colossus
047885,000018:                                                                                                  ##                              237 and Comanche 55 source-code files
047886,000019:                                                                                                  ##                              and corrected errors found.  After this process,
047887,000020:                                                                                                  ##                              there was no difference between the 3 versions,
047888,000021:                                                                                                  ##                              in terms of comment text.
047889,000022:                                                                                                  ##
047890,000023:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
047891,000024:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
047892,000025:                                                                                                  ## document read, in part:
047893,000026:                                                                                                  ##
047894,000027:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
047895,000028:                                                                                                  ##      2021111-041.  October 28, 1968.  
047896,000029:                                                                                                  ##
047897,000030:                                                                                                  ##      This AGC program shall also be referred to as
047898,000031:                                                                                                  ##                              Colossus 1A
047899,000032:                                                                                                  ##
047900,000033:                                                                                                  ##      Prepared by
047901,000034:                                                                                                  ##                      Massachusetts Institute of Technology
047902,000035:                                                                                                  ##                      75 Cambridge Parkway
047903,000036:                                                                                                  ##                      Cambridge, Massachusetts
047904,000037:                                                                                                  ##      under NASA contract NAS 9-4065.
047905,000038:                                                                                                  ##
047906,000039:                                                                                                  ## Refer directly to the online document mentioned above for further information.
047907,000040:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
047908,000041:                                                                                                  ##
047909,000042:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
047910,000043:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
047911,000044:                                                                                                  ## source file, and then is proofed to incorporate any changes.
047912,000045: 

Page 1073

047914,000047:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
047915,000048:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE TC BANKCALL INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
047916,000049: 
047917,000050:    4555                                           BLOCK    02                                    
047918,000051:    4555                                           COUNT    02/BANK                               
047919,000052: 
047920,000053:    4555           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
047921,000054:    4556           50002                           INDEX    Q                                     #  PICK UP CADR.
047922,000055:    4557           30000                           CA       0                                     
047923,000056:    4560           24002                           INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
047924,000057: 
047925,000058:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
047926,000059: 
047927,000060:    4561           54001        SWCALL             TS       L                                     
047928,000061:    4562           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
047929,000062:    4563           74747                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
047930,000063:    4564           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
047931,000064:    4565           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
047932,000065:    4566           50002                           INDEX    Q                                     
047933,000066:    4567           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
047934,000067: 
047935,000068:    4570           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
047936,000069:    4571           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
047937,000070:    4572           56134                           XCH      BUF2       +1                         
047938,000071:    4573           00133                           TC       BUF2                                  
047939,000072: 
047940,000073:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
047941,000074:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
047942,000075: 
047943,000076:    4574           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
047944,000077:    4575           50000                           INDEX    A                                     #  GET CADR.
047945,000078:    4576           30000                           CA       0                                     
047946,000079: 
047947,000080:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
047948,000081: 
047949,000082:    4577           54004        BANKJUMP           TS       FBANK                                 
047950,000083:    4600           74747                           MASK     LOW10                                 
047951,000084:    4601           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
047952,000085:    4602           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
047953,000086:    4603           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
047954,000087: 

Page 1074

047956,000089:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
047957,000090: 
047958,000091:    4604           34747        MAKECADR           CAF      LOW10                                 
047959,000092:    4605           70133                           MASK     BUF2                                  
047960,000093:    4606           60134                           AD       BUF2       +1                         
047961,000094:    4607           00002                           TC       Q                                     
047962,000095: 
047963,000096:    4610           54135        SUPDACAL           TS       MPTEMP                                
047964,000097:    4611           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
047965,000098:    4612           00006                           EXTEND                                         
047966,000099:    4613           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
047967,000100:    4614           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
047968,000101:    4615           74747                           MASK     LOW10                                 
047969,000102:    4616           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
047970,000103:    4617           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
047971,000104:    4620           00006                           EXTEND                                         
047972,000105:    4621           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
047973,000106:    4622           50001                           INDEX    L                                     
047974,000107:    4623           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
047975,000108:    4624           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
047976,000109:    4625           00006                           EXTEND                                         
047977,000110:    4626           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
047978,000111:    4627           00003                           RELINT                                         
047979,000112:    4630           54004                           TS       FBANK                                 #  RESTORE FBANK.
047980,000113:    4631           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
047981,000114:    4632           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
047982,000115: 

Page 1075

047984,000117:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
047985,000118: 
047986,000119:    4633           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
047987,000120:    4634           50002                           INDEX    Q                                     
047988,000121:    4635           30000                           CAF      0                                     
047989,000122:    4636           24002                           INCR     Q                                     
047990,000123: 
047991,000124:    4637           54001        ISWCALL            TS       L                                     
047992,000125:    4640           22004                           LXCH     FBANK                                 
047993,000126:    4641           74747                           MASK     LOW10                                 
047994,000127:    4642           56002                           XCH      Q                                     
047995,000128:    4643           52073                           DXCH     RUPTREG3                              
047996,000129:    4644           50002                           INDEX    Q                                     
047997,000130:    4645           02000                           TC       10000                                 
047998,000131: 
047999,000132:    4646           56073        ISWRETRN           XCH      RUPTREG4                              
048000,000133:    4647           56004                           XCH      FBANK                                 
048001,000134:    4650           56073                           XCH      RUPTREG4                              
048002,000135:    4651           00072                           TC       RUPTREG3                              
048003,000136: 
048004,000137:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK.  THE CALLING SEQUENCE IS AS FOLLOWS:
048005,000138:                                                                                                  #        L       TC      USPRCADR
048006,000139:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
048007,000140:                                                                                                  #                                        RETURN IS TO L+2
048008,000141: 
048009,000142:    4652           54164        USPRCADR           TS       LOC                                   #  SAVE A
048010,000143:    4653           34703                           CA       BIT8                                  
048011,000144:    4654           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
048012,000145:    4655           30006                           CA       BBANK                                 
048013,000146:    4656           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
048014,000147:    4657           50002                           INDEX    Q                                     
048015,000148:    4660           30000                           CA       0                                     
048016,000149:    4661           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
048017,000150:    4662           74747                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
048018,000151:    4663           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
048019,000152:    4664           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
048020,000153:    4665           14602                           TCF      Q+10000                               
048021,000154: 

Page 1076

048023,000156:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
048024,000157: 
048025,000158:                                                                                                  #                                        PSEUDO-FIXED     OCTAL PSEUDO
048026,000159:                                                                                                  #  SUPERBANK     SETTING S-REG. VALUE    BANK NUMBERS     ADDRESSES
048027,000160:                                                                                                  #  ----------    ------- ------------     ------------     ------------
048028,000161:                                                                                                  #  SUPERBANK 3     0XX    2000 - 3777       30 - 37       70000 - 107777         (WHERE XX CAN BE ANYTHING AND
048029,000162:                                                                                                  #                                                                                WILL USUALLY BE SEEN AS 11)
048030,000163:                                                                                                  #  SUPERBANK 4     100    2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
048031,000164:                                                                                                  #                                                                                ONLY BANKS 40-43 WILL EVER BE
048032,000165:                                                                                                  #                                                                                AND ARE PRESENTLY AVAILABLE)
048033,000166:                                                                                                  #  SUPERBANK 5     101    2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
048034,000167:                                                                                                  #                                                                                THE USER)
048035,000168:                                                                                                  #  SUPERBANK 6     110    2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
048036,000169:                                                                                                  #                                                                                THE USER)
048037,000170:                                                                                                  #  *** THIS ROUTINE MAY BE CALLED BY ANY PROGRAM LOCATED IN BANKS 00 - 27.  I.E., NO PROGRAM LIVING IN ANY
048038,000171:                                                                                                  #  SUPERBANK SHOULD USE SUPERSW. ***
048039,000172: 
048040,000173:                                                                                                  #  SUPERSW MAY BE CALLED IN THIS FASHION:
048041,000174:                                                                                                  #        CAF     ABBCON          WHERE -- ABBCON  BBCON  SOMETHIN --
048042,000175:                                                                                                  #        TCR     SUPERSW         (THE SUPERBNK BITS ARE IN THE BBCON)
048043,000176:                                                                                                  #        ...       ...
048044,000177:                                                                                                  #         .         .
048045,000178:                                                                                                  #         .         .
048046,000179:                                                                                                  #  OR IN THIS FASHION:
048047,000180:                                                                                                  #        CAF     SUPERSET        WHERE SUPERSET IS ONE OF THE FOUR AVAILABLE
048048,000181:                                                                                                  #        TCR     SUPERSW         SUPERBANK BIT CONSTANTS:
048049,000182:                                                                                                  #        ...       ...                   SUPER011 OCTAL  60
048050,000183:                                                                                                  #         .         .                    SUPER100 OCTAL 100
048051,000184:                                                                                                  #         .         .                    SUPER101 OCTAL 120
048052,000185:                                                                                                  #                                        SUPER110 OCTAL 140
048053,000186: 
048054,000187:    4666           00006        SUPERSW            EXTEND                                         
048055,000188:    4667           01007                           WRITE    SUPERBNK                              #  WRITE BITS 7-6-5 OF THE ACCUMULATOR INTO
048056,000189:                                                                                                  #  CHANNEL 07
048057,000190:    4670           00002                           TC       Q                                     #  TC TO INSTRUCTION FOLLOWING
048058,000191:                                                                                                  #        TC SUPERSW
048059,000192: 
048060,000193: 
048061,000194: 

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