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.

061969,000002:                                                                                                  ## Copyright:   Public domain.
061970,000003:                                                                                                  ## Filename:    KEYRUPT_UPRUPT.agc
061971,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
061972,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
061973,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
061974,000007:                                                                                                  ## Assembler:   yaYUL
061975,000008:                                                                                                  ## Reference:   Starts on p. 1417
061976,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
061977,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo.
061978,000011:                                                                                                  ## Mod history: 08/30/04 RSB.   Adapted from corresponding Luminary131 file.
061979,000012:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
061980,000013:                                                                                                  ##                              original harcopy, as opposed to the PDF page
061981,000014:                                                                                                  ##                              numbers in 1701.pdf.
061982,000015:                                                                                                  ##              2017-01-15 RSB  Cross-diff'd comment text (not whitespace)
061983,000016:                                                                                                  ##                              vs the already-proofed corresponding Colossus
061984,000017:                                                                                                  ##                              237 and Comanche 55 source-code files
061985,000018:                                                                                                  ##                              and corrected errors found. There were no
061986,000019:                                                                                                  ##                              differences between the comment text in the 
061987,000020:                                                                                                  ##                              different versions after these corrections.
061988,000021:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
061989,000022:                                                                                                  ##              2021-05-30 ABS  UPCK -> UPOK
061990,000023:                                                                                                  ##
061991,000024:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
061992,000025:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
061993,000026:                                                                                                  ## document read, in part:
061994,000027:                                                                                                  ##
061995,000028:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
061996,000029:                                                                                                  ##      2021111-041.  October 28, 1968.  
061997,000030:                                                                                                  ##
061998,000031:                                                                                                  ##      This AGC program shall also be referred to as
061999,000032:                                                                                                  ##                              Colossus 1A
062000,000033:                                                                                                  ##
062001,000034:                                                                                                  ##      Prepared by
062002,000035:                                                                                                  ##                      Massachusetts Institute of Technology
062003,000036:                                                                                                  ##                      75 Cambridge Parkway
062004,000037:                                                                                                  ##                      Cambridge, Massachusetts
062005,000038:                                                                                                  ##      under NASA contract NAS 9-4065.
062006,000039:                                                                                                  ##
062007,000040:                                                                                                  ## Refer directly to the online document mentioned above for further information.
062008,000041:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
062009,000042:                                                                                                  ##
062010,000043:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
062011,000044:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
062012,000045:                                                                                                  ## source file, and then is proofed to incorporate any changes.
062013,000046: 

Page 1417

062015,000048: 14,3744                                           BANK     14                                    
062016,000049: 07,2000                                           SETLOC   KEYRUPT                               
062017,000050: 07,2000                                           BANK                                           
062018,000051: 07,3613                                           COUNT*   $$/KEYUP                              
062019,000052: 
062020,000053: 07,3613           54016        KEYRUPT1           TS       BANKRUPT                              
062021,000054: 07,3614           56002                           XCH      Q                                     
062022,000055: 07,3615           54012                           TS       QRUPT                                 
062023,000056: 07,3616           04414                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
062024,000057: 07,3617           34362                           CAF      LOW5                                  
062025,000058: 07,3620           00006                           EXTEND                                         
062026,000059: 07,3621           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
062027,000060: 07,3622           54073        KEYCOM             TS       RUPTREG4                              
062028,000061: 07,3623           40101                           CS       FLAGWRD5                              
062029,000062: 07,3624           74674                           MASK     BIT15                                 
062030,000063: 07,3625           26101                           ADS      FLAGWRD5                              
062031,000064: 
062032,000065: 07,3626           34371        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
062033,000066: 07,3627           05027                           TC       NOVAC                                 
062034,000067: 07,3630     0777                                  EBANK=   DSPCOUNT                              
062035,000068: 07,3630           02000 60101                     2CADR    CHARIN                                
062036,000069: 
062037,000070: 07,3632           30073                           CA       RUPTREG4                              
062038,000071: 07,3633           50064                           INDEX    LOCCTR                                
062039,000072: 07,3634           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
062040,000073: 07,3635           05222                           TC       RESUME                                
062041,000074: 

Page 1418

062043,000076:                                                                                                  #  UPRUPT PROGRAM
062044,000077: 
062045,000078: 07,3636           54016        UPRUPT             TS       BANKRUPT                              
062046,000079: 07,3637           56002                           XCH      Q                                     
062047,000080: 07,3640           54012                           TS       QRUPT                                 
062048,000081: 07,3641           04414                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
062049,000082: 07,3642           34714                           CAF      ZERO                                  
062050,000083: 07,3643           56045                           XCH      INLINK                                
062051,000084: 07,3644           54073                           TS       KEYTEMP1                              
062052,000085: 07,3645           34710                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
062053,000086: 07,3646           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
062054,000087: 07,3647           05011                           WOR      DSALMOUT                              
062055,000088: 07,3650           34362        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
062056,000089: 07,3651           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
062057,000090: 07,3652           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
062058,000091: 07,3653           00006                           EXTEND                                         
062059,000092: 07,3654           74701                           MP       BIT10                                 #  SHIFT RIGHT 5
062060,000093: 07,3655           54734                           TS       KEYTEMP2                              
062061,000094: 07,3656           74362                           MASK     LOW5                                  #  MID 5
062062,000095: 07,3657           63713                           AD       HI10                                  
062063,000096: 07,3660           03710                           TC       UPTEST                                
062064,000097: 07,3661           34701                           CAF      BIT10                                 
062065,000098: 07,3662           00006                           EXTEND                                         
062066,000099: 07,3663           70734                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
062067,000100: 07,3664           74362                           MASK     LOW5                                  #  HIGH 5
062068,000101: 07,3665           40000                           COM                                            
062069,000102: 07,3666           03710                           TC       UPTEST                                
062070,000103: 
062071,000104: 07,3667           43716        UPOK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
062072,000105: 07,3670           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
062073,000106: 07,3671           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
062074,000107: 07,3672           13700                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
062075,000108: 
062076,000109: 07,3673           34707                           CAF      BIT4                                  #  TEST UPLOCKFL FOR 0 OR 1.
062077,000110: 07,3674           70103                           MASK     FLAGWRD7                              
062078,000111: 07,3675           10000                           CCS      A                                     
062079,000112: 07,3676           05222                           TC       RESUME                                #  UPLOCKFL = 1
062080,000113: 07,3677           03626                           TC       ACCEPTUP                              #  UPLOCKFL = 0
062081,000114: 
062082,000115: 07,3700           44707        CLUPLOCK           CS       BIT4                                  #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF
062083,000116: 07,3701           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
062084,000117: 07,3702           54103                           TS       FLAGWRD7                              
062085,000118: 07,3703           03626                           TC       ACCEPTUP                              
062086,000119: 
062087,000120:                                                                                                  #  CODE IS BAD
062088,000121: 07,3704           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
062089,000122: 07,3705           74707                           MASK     BIT4                                  #  (BY SETTING UPLOCKFL = 1) UNTIL
062090,000123: 07,3706           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
062091,000124: 07,3707           05222                           TC       RESUME                                
062092,000125: 07,3710           60073        UPTEST             AD       KEYTEMP1                              

Page 1419

062094,000127: 07,3711           10000                           CCS      A                                     
062095,000128: 07,3712           03704                           TC       TMFAIL2                               
062096,000129: 07,3713           77740        HI10               OCT      77740                                 
062097,000130: 07,3714           03704                           TC       TMFAIL2                               
062098,000131: 07,3715           00002                           TC       Q                                     
062099,000132: 
062100,000133: 07,3716           00022        ELRCODE            OCT      22                                    
062101,000134: 
062102,000135:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
062103,000136:                                                                                                  #        1.      VBRELDSP
062104,000137:                                                                                                  #        2.      ERROR RESET
062105,000138:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
062106,000139:                                                                                                  #                                    -
062107,000140:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
062108,000141:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
062109,000142:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
062110,000143:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
062111,000144:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
062112,000145:                                                                                                  #  FAILURE)
062113,000146: 
062114,000147:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.
062115,000148: 
062116,000149: 

End of include-file KEYRUPT,_UPRUPT.agc.  Parent file is MAIN.agc