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.

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

Page 1073

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

Page 1074

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

Page 1075

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

Page 1076

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

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