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.

040042,000002:                                                                                                  ## Copyright:   Public domain.
040043,000003:                                                                                                  ## Filename:    TVCINITIALIZE.agc
040044,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
040045,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
040046,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
040047,000007:                                                                                                  ## Assembler:   yaYUL
040048,000008:                                                                                                  ## Reference:   pp. 899-902.
040049,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
040050,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
040051,000011:                                                                                                  ## Mod history: 08/22/04 RSB.   Transcribed.
040052,000012:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
040053,000013:                                                                                                  ##              2010-10-24 JL   Indentation fixes.
040054,000014:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
040055,000015:                                                                                                  ##                              original harcopy, as opposed to the PDF page
040056,000016:                                                                                                  ##                              numbers in 1701.pdf.
040057,000017:                                                                                                  ##              2017-01-20 RSB  Cross-diff'd comment text (not whitespace)
040058,000018:                                                                                                  ##                              vs the already-proofed corresponding Colossus
040059,000019:                                                                                                  ##                              237 and Comanche 55 source-code files
040060,000020:                                                                                                  ##                              and corrected errors found.
040061,000021:                                                                                                  ##
040062,000022:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
040063,000023:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
040064,000024:                                                                                                  ## document read, in part:
040065,000025:                                                                                                  ##
040066,000026:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
040067,000027:                                                                                                  ##      2021111-041.  October 28, 1968.  
040068,000028:                                                                                                  ##
040069,000029:                                                                                                  ##      This AGC program shall also be referred to as
040070,000030:                                                                                                  ##                              Colossus 1A
040071,000031:                                                                                                  ##
040072,000032:                                                                                                  ##      Prepared by
040073,000033:                                                                                                  ##                      Massachusetts Institute of Technology
040074,000034:                                                                                                  ##                      75 Cambridge Parkway
040075,000035:                                                                                                  ##                      Cambridge, Massachusetts
040076,000036:                                                                                                  ##      under NASA contract NAS 9-4065.
040077,000037:                                                                                                  ##
040078,000038:                                                                                                  ## Refer directly to the online document mentioned above for further information.
040079,000039:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
040080,000040:                                                                                                  ##
040081,000041:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
040082,000042:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
040083,000043:                                                                                                  ## source file, and then is proofed to incorporate any changes.
040084,000044: 

Page 899

040086,000046:                                                                                                  #  NAME          TVCDAPON (TVC DAP INITIALIZATION AND STARTUP CALL)
040087,000047:                                                                                                  #  MOD NO 3                                      DATE 8 JUNE, 1967
040088,000048:                                                                                                  #  MOD BY ENGEL                                  LOG SECTION P40-P47
040089,000049: 
040090,000050:                                                                                                  #  FUNCTIONAL DESCRIPTION
040091,000051:                                                                                                  #        PERFORMS TVCDAP INITIALIZATION (GAINS, TIMING PARAMETERS, FILTER VARIABLES, ETC.)
040092,000052:                                                                                                  #        COMPUTES STEERING (S40.8) GAIN KPRIMEDT, AND ZEROES PASTDELV,+1 VARIABLE
040093,000053:                                                                                                  #        MAKES INITIALIZATION CALL TO ..NEEDLER.. FOR TVC DAP NEEDLES-SETUP
040094,000054:                                                                                                  #        PERFORMS INITIALIZATION FOR ROLL DAP
040095,000055:                                                                                                  #        CALLS TVCEXECUTIVE AT TVCEXEC, VIA WAITLIST
040096,000056:                                                                                                  #        CALLS TVCDAP CDU-RATE INITIALIZATION PKG AT DAPINIT VIA T5
040097,000057:                                                                                                  #        MRCLEAN AND TVCINIT4 ARE POSSIBLE TVC-RESTART ENTRIES
040098,000058: 
040099,000059:                                                                                                  #  CALLING SEQUENCE-  T5LOC=2CADR(TVCDAPON,EBANK=BZERO), T5=.6SECT5
040100,000060:                                                                                                  #        IN PARTICULAR, CALLED BY ..IGNOVER..
040101,000061: 
040102,000062:                                                                                                  #  NORMAL EXIT MODE
040103,000063:                                                                                                  #        TCF     RESUME
040104,000064: 
040105,000065:                                                                                                  #  SUBROUTINES CALLED
040106,000066:                                                                                                  #        NEEDLER, MASSPROP
040107,000067: 
040108,000068:                                                                                                  #  ALARM OR ABORT EXIT MODES
040109,000069:                                                                                                  #        NONE
040110,000070: 
040111,000071:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
040112,000072:                                                                                                  #        CSMMASS, LEMMASS, DAPDATR1 (FOR MASSPROP SUBROUTINE)
040113,000073:                                                                                                  #        TVC PAD LOADS (SEE LEVEL III DAP AND/OR P40 TESTS)
040114,000074:                                                                                                  #        PACTOFF, YACTOFF, CDUX
040115,000075:                                                                                                  #        TVCPHASE, T5BITS OF FLAGWRD6, FOR RESTART PROTECTION (SEE IGNOVER)
040116,000076: 
040117,000077:                                                                                                  #  OUTPUT
040118,000078:                                                                                                  #        ALL TVC AND ROLL DAP ERASABLES, FLAGWRD6 (BITS 13,14), T5, WAITLIST
040119,000079: 
040120,000080:                                                                                                  #  DEBRIS
040121,000081:                                                                                                  #        NONE
040122,000082: 
040123,000083: 31,3766                                           COUNT*   $$/INIT                               
040124,000084: 17,2030                                           BANK     17                                    
040125,000085: 17,2000                                           SETLOC   DAPS7                                 
040126,000086: 17,2000                                           BANK                                           
040127,000087: 
040128,000088: 17,2030  E6,1742                                  EBANK=   BZERO                                 
040129,000089: 
040130,000090: 17,2030           22016        TVCDAPON           LXCH     BANKRUPT                              #  T5 RUPT ARRIVAL (CALL BY DOTVCON - P40)
040131,000091: 17,2031           00006                           EXTEND                                         #  SAVE Q REQUIRED IN RESTARTS (MRCLEAN AND
040132,000092: 17,2032           22012                           QXCH     QRUPT                                 #        TVCINIT4 ARE ENTRIES)
040133,000093: 17,2033           32205        MRCLEAN            CAF      NZERO                                 #  NUMBER TO ZERO, LESS ONE  (MUST BE ODD)
040134,000094:                                                                                                  #        TVC RESTARTS ENTER HERE  (NEW BANK)
040135,000095: 17,2034           10000                 +1        CCS      A                                     
040136,000096: 17,2035           55447                           TS       CNTR                                  
040137,000097: 17,2036           34714                           CAF      ZERO                                  
040138,000098: 17,2037           54001                           TS       L                                     
040139,000099: 17,2040           51447                           INDEX    CNTR                                  
040140,000100: 17,2041           53530                           DXCH     OMEGAYC                               #  FIRST (LAST) TWO LOCATIONS
040141,000101: 17,2042           11447                           CCS      CNTR                                  
040142,000102: 17,2043           12034                           TCF      MRCLEAN    +1                         

Page 900

040144,000104: 17,2044           00006                           EXTEND                                         #  SET UP ANOTHER T5 RUPT TO CONTINUE
040145,000105: 17,2045           32212                           DCA      INITLOC2                              #        INITIALIZATION AT TVCINIT1
040146,000106: 17,2046           53313                           DXCH     T5LOC                                 #  THE PHSCHK2 ENTRY (REDOTVC) AT TVCDAPON
040147,000107: 17,2047           34672                           CAF      POSMAX                                #        +3 IS IN ANOTHER BANK.  MUST RESET
040148,000108: 17,2050           54030                           TS       TIME5                                 #        BBCON TOO (FULL 2CADR), FOR THAT
040149,000109: 17,2051           15222        ENDMRC             TCF      RESUME                                #        ENTRY.
040150,000110: 
040151,000111: 17,2052           22016        TVCINIT1           LXCH     BANKRUPT                              
040152,000112: 17,2053           00006                           EXTEND                                         
040153,000113: 17,2054           22012                           QXCH     QRUPT                                 
040154,000114: 
040155,000115: 17,2055           04633                           TC       IBNKCALL                              #  UPDATE IXX, IAVG/TLX FOR DAP GAINS (R03
040156,000116: 17,2056           13207                           CADR     MASSPROP                              #        OR NOUNS 46 AND 47 MUST BE CORRECT)
040157,000117: 
040158,000118: 17,2057           30110                           CAE      EMDOT                                 #  SPS FLOW RATE, SC.AT B+3 KG/CS
040159,000119: 17,2060           00006                           EXTEND                                         
040160,000120: 17,2061           72206                           MP       ONETHOU                               
040161,000121: 17,2062           55647                           TS       TENMDOT                               #  10-SEC MASS LOSS B+16 KG
040162,000122: 17,2063           40000                           COM                                            
040163,000123: 17,2064           61474                           AD       CSMMASS                               
040164,000124: 17,2065           55662                           TS       MASSTMP                               #  DECREMENT FOR FIRST 10 SEC OF BURN
040165,000125: 
040166,000126: 17,2066           31466                           CAE      DAPDATR1                              #  CHECK LEM-ON/OFF
040167,000127: 17,2067           74675                           MASK     BIT14                                 
040168,000128: 17,2070           10000                           CCS      A                                     
040169,000129: 17,2071           34712                           CAF      BIT1                                  #  LEM-ON (BIT1)
040170,000130: 17,2072           55447                           TS       CNTR                                  #  LEM-OFF (ZERO)
040171,000131: 
040172,000132: 17,2073           51447                           INDEX    CNTR                                  #  PICK UP LM-OFF,-ON KTLX/I
040173,000133: 17,2074           31416                           CAE      EKTLX/I                               
040174,000134: 17,2075           55646                           TS       KTLX/I                                
040175,000135: 
040176,000136: 17,2076           04633                           TC       IBNKCALL                              #  COMPUTE 1/CONACC, VARK
040177,000137: 17,2077           35145                           CADR     S40.15                                
040178,000138: 
040179,000139: 17,2100           31420        TVCINIT2           CAE      ETVCDT/2                              #  LEM-ON VALUE (PAD-LOAD, CS / 2)
040180,000140: 17,2101           54001                           TS       L                                     
040181,000141: 17,2102           34711                           CAF      BIT2                                  #  LEM-OFF VALUE (4CS / 2)
040182,000142: 17,2103           51447                           INDEX    CNTR                                  
040183,000143: 17,2104           30000                           CAE      A                                     
040184,000144: 17,2105           55644                           TS       KPRIMEDT                              #  (TEMP STORE)
040185,000145: 
040186,000146: 17,2106           40000                           COM                                            #  PREPARE T5TVCDT
040187,000147: 17,2107           64672                           AD       POSMAX                                
040188,000148: 17,2110           64712                           AD       BIT1                                  
040189,000149: 17,2111           55635                           TS       T5TVCDT                               
040190,000150: 
040191,000151: 17,2112           44674                           CS       BIT15                                 #  RESET SWTOVER FLAG
040192,000152: 17,2113           70105                           MASK     FLAGWRD9                              
040193,000153: 17,2114           54105                           TS       FLAGWRD9                              

Page 901

040195,000155: 17,2115           51447                           INDEX    CNTR                                  #  PICK UP LEM-OFF,-ON KPRIME
040196,000156: 17,2116           31413                           CAE      EKPRIME                               
040197,000157: 17,2117           00006                           EXTEND                                         
040198,000158: 17,2120           71644                           MP       KPRIMEDT                              #  (TVCDT/2, SC.AT B+14 CS)
040199,000159: 17,2121           22000                           LXCH     A                                     #        SC.AT PI/8      (DIMENSIONLESS)
040200,000160: 17,2122           53645                           DXCH     KPRIMEDT                              
040201,000161: 
040202,000162: 17,2123           51447                           INDEX    CNTR                                  #  PICK UP LEM-OFF,-ON REPFRAC
040203,000163: 17,2124           31423                           CAE      EREPFRAC                              
040204,000164: 17,2125           55652                           TS       REPFRAC                               
040205,000165: 
040206,000166: 17,2126           37716                           CAF      NEGONE                                #  PREVENT STROKE TEST UNTIL CALLED
040207,000167: 17,2127           55664                           TS       STRKTIME                              
040208,000168: 
040209,000169: 17,2130           34374                           CAF      NINETEEN                              #  SET VCNTR FOR VARIABLE-GAIN UPDATES IN
040210,000170: 17,2131           55653                           TS       VCNTR                                 #        10 SECONDS (TVCEXEC 1/2 SEC RATE)
040211,000171: 17,2132           55444                           TS       V97VCNTR                              #  FOR ENGFAIL (R41) LOGIC
040212,000172: 
040213,000173: 17,2133           31421                           CAE      ETSWITCH                              #  PREPARE SWITCHOVER COUNTER
040214,000174: 17,2134           54001                           TS       L                                     
040215,000175: 17,2135           60000                           DOUBLE                                         #  (COUNTER DECREMENTS EVERY 1/2 SEC)
040216,000176: 17,2136           22000                           LXCH     A                                     #  LEM-OFF IN A, LEM-ON IN L
040217,000177: 17,2137           51447                           INDEX    CNTR                                  
040218,000178: 17,2140           30000                           CAE      A                                     
040219,000179: 17,2141           67716                           AD       NEGONE                                
040220,000180: 17,2142           55447                           TS       CNTR                                  #  CNTR = 2(SWITCHOVER TIME, SEC) -1
040221,000181: 17,2143           31425        TVCINIT3           CAE      PACTOFF                               #  TRIM VALUES TO TRIM-TRACKERS, OUTPUT
040222,000182: 17,2144           55625                           TS       PDELOFF                               #        TRACKERS, OFFSET-UPDATES, AND
040223,000183: 17,2145           55631                           TS       PCMD                                  #        OFFSET-TRACKER FILTERS
040224,000184: 17,2146           55621                           TS       DELPBAR                               #        NOTE, LO-ORDER DELOFF, DELBAR ZEROED
040225,000185: 
040226,000186: 17,2147           31426                           CAE      YACTOFF                               
040227,000187: 17,2150           55627                           TS       YDELOFF                               
040228,000188: 17,2151           55632                           TS       YCMD                                  
040229,000189: 17,2152           55623                           TS       DELYBAR                               
040230,000190: 
040231,000191: 17,2153           41501        NEEDLEIN           CS       RCSFLAGS                              #  SET BIT 3 FOR INITIALIZATION PASS AND GO
040232,000192: 17,2154           74710                           MASK     BIT3                                  #        TO NEEDLER.  WILL CLEAR FOR TVC DAP
040233,000193: 17,2155           27501                           ADS      RCSFLAGS                              #        (RETURNS AFTER CADR)
040234,000194: 17,2156           04633                           TC       IBNKCALL                              
040235,000195: 17,2157           42404                           CADR     NEEDLER                               
040236,000196: 
040237,000197: 17,2160           34714        TVCINIT4           CAF      ZERO                                  #  SET TVCPHASE TO INDICATE TVCDAPON-THRU-
040238,000198: 17,2161           55654                           TS       TVCPHASE                              #        NEEDLEIN INITIALIZATION FINISHED.
040239,000199:                                                                                                  #        (POSSIBLE TVC-RESTART ENTRY)
040240,000200: 
040241,000201: 17,2162           30032                           CAE      CDUX                                  #  PREPARE ROLL DAP LADDERS
040242,000202: 17,2163           55672                           TS       OGANOW                                

Page 902

040244,000204:                                                                                                  #  ROLL DAPS RE-START UPON A RESTART, BUT
040245,000205:                                                                                                  #        RETAIN ORIGINAL OGAD (IGNOVER CDUX)
040246,000206: 
040247,000207: 17,2164           34676                           CAF      BIT13                                 #  IF ENGINE IS ALREADY OFF, ENGINOFF HAS
040248,000208: 17,2165           00006                           EXTEND                                         #        ALREADY ESTABLISHED THE POST-BURN
040249,000209: 17,2166           02011                           RAND     DSALMOUT                              #        CSMMASS (MASSBACK DOES IT).  DONT
040250,000210: 17,2167           00006                           EXTEND                                         #        TOUCH CSMMASS.  IF ENGINE IS ON,
040251,000211: 17,2170           12173                           BZF      +3                                    #        THEN ITS OK TO DO THE COPYCYCLE
040252,000212:                                                                                                  #        EVEN BURNS LESS THAN 0.4 SEC ARE AOK
040253,000213: 
040254,000214: 17,2171           31662                           CAE      MASSTMP                               #  COPYCYCLE
040255,000215: 17,2172           55474                           TS       CSMMASS                               
040256,000216: 
040257,000217: 17,2173           34731                 +3        CAF      .5SEC                                 #  CALL TVCEXECUTIVE (ROLLDAP CALL, ETC)
040258,000218: 17,2174           05140                           TC       WAITLIST                              
040259,000219: 17,2175  E6,1742                                  EBANK=   BZERO                                 
040260,000220: 17,2175           02660 34066                     2CADR    TVCEXEC                               
040261,000221: 
040262,000222: 17,2177           00006                           EXTEND                                         #  CALL FOR DAPINIT
040263,000223: 17,2200           32210                           DCA      DAPINIT5                              
040264,000224: 17,2201           53313                           DXCH     T5LOC                                 
040265,000225: 17,2202           31635                           CAE      T5TVCDT                               #  (ALLOW TIME FOR RESTART COMPUTATIONS)
040266,000226: 17,2203           54030                           TS       TIME5                                 
040267,000227: 
040268,000228: 17,2204           15222        ENDTVCIN           TCF      RESUME                                
040269,000229: 17,2205           00101        NZERO              DEC      65         B-14                       #  MUST BE ODD FOR MRCLEAN
040270,000230: 
040271,000231: 17,2206     4374               NINETEEN           =        VD1                                   
040272,000232: 
040273,000233: 17,2206           03720        ONETHOU            DEC      1000       B-13                       #  KG/CS B3 TO KG/10SEC B16 CONVERSION
040274,000234: 
040275,000235: 17,2207  E6,1742                                  EBANK=   BZERO                                 
040276,000236: 17,2207           03111 40066  DAPINIT5           2CADR    DAPINIT                               
040277,000237: 
040278,000238: 17,2211  E6,1742                                  EBANK=   BZERO                                 
040279,000239: 17,2211           02052 36066  INITLOC2           2CADR    TVCINIT1                              
040280,000240: 

End of include-file TVCINITIALIZE.agc.  Parent file is MAIN.agc