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.

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

Page 1073

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

Page 1074

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

Page 1075

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

Page 1076

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

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