Source Code

These source-code files are part of a reconstructed copy of Comanche 51, the initial release (though not the final mission release) of the Apollo 11 Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final release was Comanche 55. The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 51, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 listing.

Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 55. Here's a guide to some of the Apollo documentation relevant to those annotations:
Among documentation not actually referenced in the annotations, there is a short writeup about the reconstruction process in our software repository that may be helpful in understanding it from a different perspective. There's also a handy table that lists what the number of memory-words should be for each routine in Comanche 51, which could make a nice double-check; however, we've not performed that double-check ourselves.

Comments expected to have been present in the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC Project's GitHub repository.

041252,000002:                                                                                                  ## Copyright:   Public domain.
041253,000003:                                                                                                  ## Filename:    TVCEXECUTIVE.agc
041254,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
041255,000005:                                                                                                  ##              It is part of the reconstructed source code for the
041256,000006:                                                                                                  ##              original release of the flight software for the Command
041257,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
041258,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
041259,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
041260,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
041261,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
041262,000012:                                                                                                  ##              reconstruction is correct.
041263,000013:                                                                                                  ## Reference:   pp. 945-950
041264,000014:                                                                                                  ## Assembler:   yaYUL
041265,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
041266,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
041267,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
041268,000018: 

Page 945

041270,000020:                                                                                                  #  PROGRAM NAME....      TVCEXECUTIVE, CONSISTING OF TVCEXEC, NEEDLEUP, VARGAINS
041271,000021:                                                                                                  #                        1SHOTCHK, REPCHEK, CG.CORR, COPYCYCLES, ETC.
041272,000022:                                                                                                  #  LOG SECTION...        TVCEXECUTIVE            SUBROUTINE...DAPCSM
041273,000023:                                                                                                  #  MODIFIED BY SCHLUNDT                          21 OCTOBER 1968
041274,000024: 
041275,000025:                                                                                                  #  FUNCTIONAL DESCRIPTION....
041276,000026:                                                                                                  #       *A SELF-PERPETUATING WAITLIST TASK AT 1/2 SECOND INTERVALS WHICH:
041277,000027:                                                                                                  #        PREPARES THE ROLL DAP WITH OGA (CDUX)
041278,000028:                                                                                                  #        PREPARES THE ROLL FDAI NEEDLE (FLY-TO  OGA ERROR)
041279,000029:                                                                                                  #        PREPARES THE ROLL PHASE PLANE  OGAERR  (FLY-FROM  OGA ERROR)
041280,000030:                                                                                                  #        PREPARES THE TVC ROLLDAP TASK WAITLIST CALL (3 CS DELAY)
041281,000031:                                                                                                  #        UPDATES THE NEEDLES DISPLAY
041282,000032:                                                                                                  #        UPDATES VEHICLE MASS AND CALLS MASSPROP TO UPDATE INERTIA DATA
041283,000033:                                                                                                  #        UPDATES PITCH, YAW, AND ROLL DAP GAINS FROM MASSPROP DATA
041284,000034:                                                                                                  #        PERFORMS ONE-SHOT CORRECTION FOR TMC LOOP 0-3 SEC AFTER IGNITION
041285,000035:                                                                                                  #        PERFORMS REPETITIVE UPDATES FOR TMC LOOP AFTER THE ONE-SHOT CORR.
041286,000036: 
041287,000037:                                                                                                  #  CALLING SEQUENCE....
041288,000038:                                                                                                  #       *TVCEXEC CALLED AS A WAITLIST TASK, IN PARTICULAR BY TVCINIT4 AND BY
041289,000039:                                                                                                  #        ITSELF, BOTH AT 1/2 SECOND INTERVALS
041290,000040: 
041291,000041:                                                                                                  #  NORMAL EXIT MODE.... TASKOVER
041292,000042: 
041293,000043:                                                                                                  #  ALARM OR ABORT EXIT MODES.... NONE
041294,000044: 
041295,000045:                                                                                                  #  SUBROUTINES CALLED....NEEDLER, S40.15, MASSPROP, TASKOVER, IBNKCALL
041296,000046: 
041297,000047:                                                                                                  #  OTHER INTERFACES....
041298,000048:                                                                                                  #       *TVCRESTART PACKAGE FOR RESTARTS
041299,000049:                                                                                                  #       *PITCHDAP, YAWDAP FOR VARIABLE GAINS AND ENGINE TRIM ANGLES
041300,000050: 
041301,000051:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED....
041302,000052:                                                                                                  #       *SEE TVCDAPON....TVCINIT4
041303,000053:                                                                                                  #       *VARK AND 1/CONACC (S40.15 OF TVCINITIALIZE)
041304,000054:                                                                                                  #       *PAD LOAD EREPFRAC
041305,000055:                                                                                                  #       *BITS 15,14 OF FLAGWRD6 (T5 BITS)
041306,000056:                                                                                                  #       *TVCEXPHS FOR RESTARTS
041307,000057:                                                                                                  #       *ENGINE-ON BIT (11.13) FOR RESTARTS
041308,000058:                                                                                                  #       *CDUX, OGAD
041309,000059: 
041310,000060:                                                                                                  #  OUTPUT....
041311,000061:                                                                                                  #       *ROLL DAP OGANOW, FDAI NEEDLE (AK). AND PHASE PLANE OGAERR
041312,000062:                                                                                                  #       *VARIABLE GAINS FOR PITCH/YAW AND ROLL TVC DAPS
041313,000063:                                                                                                  #       *SINGLE-SHOT AND REPETITIVE CORRECTIONS TO ENGINE TRIM ANGLES
041314,000064:                                                                                                  #        PACTOFF AND YACTOFF
041315,000065: 
041316,000066:                                                                                                  #  DEBRIS....    MUCH, BUT SHAREABLE WITH RCS/ENTRY, ALL IN EBANK6
041317,000067: 

Page 946

041319,000069: 16,2720                                           BANK     16                                    
041320,000070: 16,2000                                           SETLOC   DAPROLL                               
041321,000071: 16,2000                                           BANK                                           
041322,000072: 16,2720  E6,1702                                  EBANK=   BZERO                                 
041323,000073: 16,2720                                           COUNT*   $$/TVCX                               
041324,000074: 
041325,000075: 16,2720           40102        TVCEXEC            CS       FLAGWRD6                              #  CHECK FOR TERMINATION (BITS 15,14 READ
041326,000076: 16,2721           74105                           MASK     OCT60000                              #        10 FROM TVCDAPON TO RCSDAPON)
041327,000077: 16,2722           00006                           EXTEND                                         
041328,000078: 16,2723           63134                           BZMF     TVCEXFIN                              #  TERMINATE
041329,000079: 
041330,000080: 16,2724           35036                           CAF      .5SEC                                 #  W.L. CALL TO PERPETUATE TVCEXEC
041331,000081: 16,2725           05245                           TC       WAITLIST                              
041332,000082: 16,2726  E6,1702                                  EBANK=   BZERO                                 
041333,000083: 16,2726           02720 34066                     2CADR    TVCEXEC                               
041334,000084: 
041335,000085: 16,2730           30032        ROLLPREP           CAE      CDUX                                  #  UPDATE ROLL LADDERS (NO NEED TO RESTART-
041336,000086: 16,2731           57662                           XCH      OGANOW                                #        PROTECT, SINCE ROLL DAPS RE-START)
041337,000087: 16,2732           57663                           XCH      OGAPAST                               
041338,000088: 
041339,000089: 16,2733           31450                           CAE      OGAD                                  #  PREPARE ROLL FDAI NEEDLE WITH FLY-TO
041340,000090: 16,2734           00006                           EXTEND                                         #        ERROR (COMMAND - MEASURED)
041341,000091: 16,2735           21662                           MSU      OGANOW                                
041342,000092: 16,2736           55476                           TS       AK                                    #  FLY-TO OGA ERROR, SC.AT B-1 REVS
041343,000093: 
041344,000094: 16,2737           00006                           EXTEND                                         #  PREPARE ROLL DAP PHASE PLANE OGAERR
041345,000095: 16,2740           77705                           MP       -BIT14                                
041346,000096: 16,2741           55664                           TS       OGAERR                                #  PHASE-PLANE (FLY-FROM) OGAERROR,
041347,000097:                                                                                                  #        SC.AT B+0 REVS
041348,000098: 
041349,000099: 16,2742           36214                           CAF      THREE                                 #  SET UP ROLL DAP TASK (ALLOW SOME TIME)
041350,000100: 16,2743           05245                           TC       WAITLIST                              
041351,000101: 16,2744  E6,1702                                  EBANK=   BZERO                                 
041352,000102: 16,2744           03272 34066                     2CADR    ROLLDAP                               
041353,000103: 
041354,000104: 16,2746           04740        NEEDLEUP           TC       IBNKCALL                              #  DO A NEEDLES UPDATE (RETURNS AFTER CADR)
041355,000105: 16,2747           42420                           CADR     NEEDLER                               #        (NEEDLES RESTARTS ITSELF)
041356,000106: 
041357,000107: 16,2750           35003        VARGAINS           CAF      BIT13                                 #  CHECK ENGINE-ON BIT TO INHIBIT VARIABLE
041358,000108: 16,2751           00006                           EXTEND                                         #        GAINS AND MASS IF ENGINE OFF
041359,000109: 16,2752           02011                           RAND     DSALMOUT                              #  CHANNEL 11
041360,000110: 16,2753           10000                           CCS      A                                     
041361,000111: 16,2754           12760                           TCF      +4                                    #        ON, SO OK TO UPDATE GAINS AND MASS
041362,000112: 16,2755           35016                 +5        CAF      TWO                                   #        OFF, SO BYPASS MASS/GAIN UPDATES,
041363,000113: 16,2756           55651                           TS       TVCEXPHS                              #                ALSO ENTRY FROM CCS BELOW WITH
041364,000114: 16,2757           13011                           TCF      1SHOTCHK                              #                VCNTR = -0 (V97 R40 ENGFAIL)
041365,000115: 16,2760           11643                           CCS      VCNTR                                 #        TEST FOR GAIN UPDATE TIME
041366,000116: 16,2761           12765                           TCF      +4                                    #                NOT YET

Page 947

041368,000118: 16,2762           12771                           TCF      GAINCHNG                              #                NOW
041369,000119: 16,2763           12763                           TCF      +0                                    #                NOT USED
041370,000120: 16,2764           12755                           TCF      VARGAINS   +5                         #                NO, LOTHRUST (S40.8 R40)
041371,000121: 
041372,000122: 16,2765           55653                 +4        TS       VCNTRTMP                              #        PROTECT VCNTR AND
041373,000123: 16,2766           31474                           CAE      CSMMASS                               #        CSMMASS DURING AN IMPULSIVE BURN
041374,000124: 16,2767           55652                           TS       MASSTMP                               
041375,000125: 16,2770           13002                           TCF      EXECCOPY                              
041376,000126: 
041377,000127: 16,2771           04740        GAINCHNG           TC       IBNKCALL                              #  UPDATE IXX, IAVG, IAVG/TLX
041378,000128: 16,2772           13422                           CADR     FIXCW                                 #  MASSPROP ENTRY (ALREADY INITIALIZED)
041379,000129: 16,2773           04740                           TC       IBNKCALL                              #  UPDATE 1/CONACC, VARK
041380,000130: 16,2774           36462                           CADR     S40.15                                #        (S40.15 IS IN TVCINITIALIZE)
041381,000131: 16,2775           41637                           CS       TENMDOT                               #  UPDATE MASS FOR NEXT 10 SEC. OF BURN
041382,000132: 16,2776           61474                           AD       CSMMASS                               
041383,000133: 16,2777           55652                           TS       MASSTMP                               #  KG B+16
041384,000134: 
041385,000135: 16,3000           34374                           CAF      NINETEEN                              #  RESET THE VARIABLE-GAIN UPDATE COUNTER
041386,000136: 16,3001           55653                           TS       VCNTRTMP                              
041387,000137: 
041388,000138: 16,3002           25651        EXECCOPY           INCR     TVCEXPHS                              #  RESTART-PROTECT THE COPYCYCLE         (1)
041389,000139: 
041390,000140: 16,3003           31652                           CAE      MASSTMP                               #  CSMMASS KG B+16
041391,000141: 16,3004           55474                           TS       CSMMASS                               
041392,000142: 
041393,000143: 16,3005           31653                           CAE      VCNTRTMP                              #  VCNTR
041394,000144: 16,3006           55643                           TS       VCNTR                                 
041395,000145: 16,3007           55444                           TS       V97VCNTR                              #  FOR ENGFAIL (R41) MASS UPDATES AT SPSOFF
041396,000146: 
041397,000147: 16,3010           25651                           INCR     TVCEXPHS                              #  COPYCYCLE OVER                        (2)
041398,000148: 
041399,000149: 16,3011           11447        1SHOTCHK           CCS      CNTR                                  #  CHECK TIME FOR ONE-SHOT OR REPCORR
041400,000150: 16,3012           13016                           TCF      +4                                    #        NOT YET
041401,000151: 16,3013           13031                           TCF      1SHOTOK                               #        NOW
041402,000152: 16,3014           13022                           TCF      REPCHEK                               #        ONE-SHOT OVER, ON TO REPCORR
041403,000153: 16,3015           13031                           TCF      1SHOTOK                               #        NOW (ONE-SHOT ONLY, NO REPCORR)
041404,000154: 
041405,000155: 16,3016           55676                 +4        TS       CNTRTMP                               #  COUNT DOWN
041406,000156: 16,3017           36211                           CAF      SIX                                   #  SETUP TVCEXPHS FOR ENTRY AT CNTRCOPY
041407,000157: 16,3020           55651                           TS       TVCEXPHS                              
041408,000158: 16,3021           13132                           TCF      CNTRCOPY                              
041409,000159: 
041410,000160: 16,3022           31642        REPCHEK            CAE      REPFRAC                               #  CHECK FOR REPETITIVE UPDATES
041411,000161: 16,3023           00006                           EXTEND                                         
041412,000162: 16,3024           63134                           BZMF     TVCEXFIN                              #        NO,  OVER-AND-OUT
041413,000163: 16,3025           55446                           TS       TEMPDAP    +1                         #        YES, SET UP CORRECTION FRACTION
041414,000164: 16,3026           35015                           CAF      FOUR                                  #  SET UP TVCEXPHS FOR ENTRY AT CORSETUP
041415,000165: 16,3027           55651                           TS       TVCEXPHS                              
041416,000166: 16,3030           13043                           TCF      CORSETUP                              

Page 948

041418,000168: 16,3031           35003        1SHOTOK            CAF      BIT13                                 #  CHECK ENGINE-ON BIT, NOT PERMITTING
041419,000169: 16,3032           00006                           EXTEND                                         #        ONE-SHOT DURING ENGINE-SHUTDOWN
041420,000170: 16,3033           02011                           RAND     DSALMOUT                              
041421,000171: 16,3034           10000                           CCS      A                                     
041422,000172: 16,3035           13037                           TCF      +2                                    #        ONE-SHOT OK
041423,000173: 16,3036           13134                           TCF      TVCEXFIN                              #        NO, TERMINATE
041424,000174: 
041425,000175: 16,3037           25651                           INCR     TVCEXPHS                              #                                        (3)
041426,000176: 
041427,000177: 16,3040           33137        TEMPSET            CAF      FCORFRAC                              #        SET UP CORRECTION FRACTION
041428,000178: 16,3041           55446                           TS       TEMPDAP    +1                         
041429,000179: 
041430,000180: 16,3042           25651                           INCR     TVCEXPHS                              #  ENTRY FROM REPCHEK AT NEXT LOCATION   (4)
041431,000181: 
041432,000182: 16,3043           31466        CORSETUP           CAE      DAPDATR1                              #  CHECK FOR LEM-OFF/ON
041433,000183: 16,3044           75003                           MASK     BIT13                                 #  (NOTE, SHOWS LEM-OFF)
041434,000184: 16,3045           00006                           EXTEND                                         
041435,000185: 16,3046           13050                           BZF      +2                                    #  LEM IS ON,  PICK UP   TEMPDAP+1
041436,000186: 16,3047           31446                           CAE      TEMPDAP    +1                         #  LEM IS OFF, PICK UP 2(TEMPDAP+1)
041437,000187: 16,3050           61446                           AD       TEMPDAP    +1                         
041438,000188: 16,3051           55445                           TS       TEMPDAP                               #  CG.CORR USES TEMPDAP
041439,000189: 
041440,000190: 16,3052           37716                           CAF      NEGONE                                #  SET UP FOR CNTR = -1 (ONE-SHOT DONE)
041441,000191: 16,3053           55676                           TS       CNTRTMP                               #        (COPYCYCLE AT .CNTRCOPY.)
041442,000192: 
041443,000193: 16,3054           00006        CG.CORR            EXTEND                                         #  PITCH TMC LOOP
041444,000194: 16,3055           31606                           DCA      PDELOFF                               
041445,000195: 16,3056           53673                           DXCH     PACTTMP                               
041446,000196: 16,3057           00006                           EXTEND                                         
041447,000197: 16,3060           41606                           DCS      PDELOFF                               
041448,000198: 16,3061           20001                           DDOUBL                                         
041449,000199: 16,3062           20001                           DDOUBL                                         
041450,000200: 16,3063           53612                           DXCH     TTMP1                                 
041451,000201: 16,3064           00006                           EXTEND                                         
041452,000202: 16,3065           31602                           DCA      DELPBAR                               
041453,000203: 16,3066           20001                           DDOUBL                                         
041454,000204: 16,3067           20001                           DDOUBL                                         
041455,000205: 16,3070           21612                           DAS      TTMP1                                 
041456,000206: 16,3071           00006                           EXTEND                                         
041457,000207: 16,3072           31612                           DCA      TTMP1                                 
041458,000208: 16,3073           00006                           EXTEND                                         
041459,000209: 16,3074           71445                           MP       TEMPDAP                               
041460,000210: 16,3075           21673                           DAS      PACTTMP                               
041461,000211: 
041462,000212: 16,3076           00006                           EXTEND                                         #  YAW TMC LOOP
041463,000213: 16,3077           31610                           DCA      YDELOFF                               
041464,000214: 16,3100           53675                           DXCH     YACTTMP                               
041465,000215: 16,3101           00006                           EXTEND                                         
041466,000216: 16,3102           41610                           DCS      YDELOFF                               
041467,000217: 16,3103           20001                           DDOUBL                                         

Page 949

041469,000219: 16,3104           20001                           DDOUBL                                         
041470,000220: 16,3105           53612                           DXCH     TTMP1                                 
041471,000221: 16,3106           00006                           EXTEND                                         
041472,000222: 16,3107           31604                           DCA      DELYBAR                               
041473,000223: 16,3110           20001                           DDOUBL                                         
041474,000224: 16,3111           20001                           DDOUBL                                         
041475,000225: 16,3112           21612                           DAS      TTMP1                                 
041476,000226: 16,3113           00006                           EXTEND                                         
041477,000227: 16,3114           31612                           DCA      TTMP1                                 
041478,000228: 16,3115           00006                           EXTEND                                         
041479,000229: 16,3116           71445                           MP       TEMPDAP                               
041480,000230: 16,3117           21675                           DAS      YACTTMP                               
041481,000231: 
041482,000232: 16,3120           25651        CORCOPY            INCR     TVCEXPHS                              #  RESTART PROTECT THE COPYCYCLE         (5)
041483,000233: 
041484,000234: 16,3121           00006                           EXTEND                                         #  TRIM-ESTIMATES, AND
041485,000235: 16,3122           31673                           DCA      PACTTMP                               
041486,000236: 16,3123           55423                           TS       PACTOFF                               #        TRIMS
041487,000237: 16,3124           53606                           DXCH     PDELOFF                               
041488,000238: 
041489,000239: 16,3125           00006                           EXTEND                                         
041490,000240: 16,3126           31675                           DCA      YACTTMP                               
041491,000241: 16,3127           55424                           TS       YACTOFF                               
041492,000242: 16,3130           53610                           DXCH     YDELOFF                               
041493,000243: 
041494,000244: 16,3131           25651                           INCR     TVCEXPHS                              #  ENTRY FROM 1SHOTCHK AT NEXT LOCATION  (6)
041495,000245: 
041496,000246: 16,3132           31676        CNTRCOPY           CAE      CNTRTMP                               #  UPDATE CNTR (RESTARTS OK, FOLLOWS CPYCY)
041497,000247: 16,3133           55447                           TS       CNTR                                  
041498,000248: 
041499,000249: 16,3134           35021        TVCEXFIN           CAF      ZERO                                  #  RESET TVCEXPHS
041500,000250: 16,3135           55651                           TS       TVCEXPHS                              
041501,000251: 16,3136           15324                           TCF      TASKOVER                              #  TVCEXECUTIVE FINISHED
041502,000252: 
041503,000253: 16,3137           10000        FCORFRAC           OCT      10000                                 #  ONE-SHOT CORRECTION FRACTION  
041504,000254: 

Page 950 This page is empty.

041507,000257: 
041508,000258: 

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