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.

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

Page 899

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

Page 900

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

Page 901

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

Page 902

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

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