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.

041511,000002:                                                                                                  ## Copyright:   Public domain.
041512,000003:                                                                                                  ## Filename:    TVCMASSPROP.agc
041513,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
041514,000005:                                                                                                  ##              It is part of the reconstructed source code for the
041515,000006:                                                                                                  ##              original release of the flight software for the Command
041516,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
041517,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
041518,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
041519,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
041520,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
041521,000012:                                                                                                  ##              reconstruction is correct.
041522,000013:                                                                                                  ## Reference:   pp. 951-955
041523,000014:                                                                                                  ## Assembler:   yaYUL
041524,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
041525,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
041526,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
041527,000018: 

Page 951

041529,000020:                                                                                                  #  PROGRAM NAME....MASSPROP
041530,000021:                                                                                                  #  LOG SECTION....TVCMASSPROP            PROGRAMMER...MELANSON (ENGEL, SCHLUNDT)
041531,000022: 
041532,000023:                                                                                                  #  FUNCTIONAL DESCRIPTION:
041533,000024: 
041534,000025:                                                                                                  #        MASSPROP OPERATES IN TWO MODES: (1) IF LEM MASS OR CONFIGURATION ARE UPDATED (MASSPROP DOES NOT TEST
041535,000026:                                                                                                  #        FOR THIS) THE ENTIRE PROGRAM MUST BE RUN THROUGH, BREAKPOINT VALUES AND DERIVATIVES OF THE OUTPUTS WITH
041536,000027:                                                                                                  #        RESPECT TO CSM MASS BEING CALCULATED PRIOR TO CALCULATION OF THE OUTPUTS.  (2) OTHERWISE, THE OUTPUTS CAN BE
041537,000028:                                                                                                  #        CALCULATED USING PREVIOUSLY COMPUTED BREAKPOINT VALUES AND DERIVATIVES.
041538,000029: 
041539,000030:                                                                                                  #  CALLING SEQUENCES
041540,000031: 
041541,000032:                                                                                                  #        IF LEM MASS OR CONFIGURATION HAS BEEN UPDATED, TRANSFER TO MASSPROP, OTHERWISE TRANSFER TO FIXCW.
041542,000033:                                                                                                  #                L       TC      BANKCALL OR IBNKCALL
041543,000034:                                                                                                  #                L+1     CADR    MASSPROP
041544,000035:                                                                                                  #                        OR
041545,000036:                                                                                                  #                L+1     CADR    FIXCW
041546,000037:                                                                                                  #                L+2     RETURNS VIA Q
041547,000038: 
041548,000039:                                                                                                  #  CALLED   IN PARTICULAR BY DONOUN47 (JOB) AND TVCEXECUTIVE (TASK)
041549,000040: 
041550,000041:                                                                                                  #  JOBS OR TASKS INITIATED - NONE
041551,000042: 
041552,000043:                                                                                                  #  SUBROUTINES CALLED - NONE
041553,000044: 
041554,000045:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
041555,000046: 
041556,000047:                                                                                                  #        LEMMASS MUST CONTAIN LEM MASS SCALED AT B+16 IN KILOGRAMS
041557,000048:                                                                                                  #        CSMMASS MUST CONTAIN CSM MASS SCALED AT B+16 IN KILOGRAMS
041558,000049:                                                                                                  #        DAPDATR1 MUST BE SET TO INDICATE VEHICLE CONFIGURATION.
041559,000050:                                                                                                  #                BITS (15,14,13)  =  ( 0 , 0 , 1 )       LEM OFF
041560,000051:                                                                                                  #                                    ( 0 , 1 , 0 )       LEM ON (ASCNT,DSCNT)
041561,000052:                                                                                                  #                                    ( 1 , 1 , 0 )       LEM ON (ASCNT ONLY)
041562,000053: 
041563,000054:                                                                                                  #  ALARMS - NONE
041564,000055: 
041565,000056:                                                                                                  #  EXIT -   TC   Q
041566,000057: 
041567,000058:                                                                                                  #  OUTPUTS:
041568,000059: 
041569,000060:                                                                                                  #        (1)     IXX, SINGLE PRECISION SCALED AT B+20 IN KG-M SQ.
041570,000061:                                                                                                  #        (2)     IAVG, SINGLE PRECISION SCALED AT B+20 IN KG-M SQ.
041571,000062:                                                                                                  #        (3)     IAVG/TLX, SINGLE PRECISION, SCALED AT B+2 SEC-SQD
041572,000063:                                                                                                  #        
041573,000064:                                                                                                  #        THEY ARE STORED IN CONSECUTIVE REGISTERS IXX0, IXX1, IXX2
041574,000065:                                                                                                  #        CONVERSION FACTOR:  (SLUG-FTSQ) = 0.737562 (KG-MSQ)

Page 952

041576,000067: 
041577,000068:                                                                                                  #  OUTPUTS ARE CALCULATED AS FOLLOWS:
041578,000069: 
041579,000070:                                                                                                  #        (1)     IF LEM DOCKED, LEMMASS IS FIRST ELIMINATED AS A PARAMETER
041580,000071: 
041581,000072:                                                                                                  #                VARST0 = INTVALUE0 + LEMMASS(SLOPEVAL0)         IXX             BREAKPOINT VALUE
041582,000073:                                                                                                  #                VARST1 = INTVALUE1 + LEMMASS(SLOPEVAL1)         IAVG            BREAKPOINT VALUE
041583,000074:                                                                                                  #                VARST2 = INTVALUE2 + LEMMASS(SLOPEVAL2)         IAVG/TLX        BREAKPOINT VALUE
041584,000075: 
041585,000076:                                                                                                  #                VARST3 = INTVALUE3 + LEMMASS(SLOPEVAL3)         IAVG/TLX        SLOPE FOR CSMMASS > 33956 LBS (SPS > 10000 LBS)
041586,000077:                                                                                                  #                VARST4 = INTVALUE4 + LEMMASS(SLOPEVAL4)         IAVG            SLOPE FOR CSMMASS > 33956 LBS (SPS > 10000 LBS)
041587,000078: 
041588,000079:                                                                                                  #                VARST5 = INTVALUE5 + LEMMASS(SLOPEVAL5)         IXX             SLOPE FOR ALL VALUES OF CSMMASS
041589,000080: 
041590,000081:                                                                                                  #                VARST6 = INTVALUE6 + LEMMASS(SLOPEVAL6)         IAVG            SLOPE FOR CSMMASS < 33956 LBS (SPS < 10000 LBS)
041591,000082:                                                                                                  #                VARST7 = INTVALUE7 + LEMMASS(SLOPEVAL7)         IAVG/TLX        SLOPE FOR CSMMASS < 33956 LBS (SPS < 10000 LBS)
041592,000083: 
041593,000084:                                                                                                  #                VARST8 = INTVALUE8 + LEMMASS(SLOPEVAL8)         IAVG            DECREMENT TO BRKPT VALUE WHEN LEM DSCNT STAGE OFF
041594,000085:                                                                                                  #                VARST9 = INTVALUE9 + LEMMASS(SLOPEVAL9)         IAVG/TLX        DECREMENT TO BRKPT VALUE WHEN LEM DSCNT STAGE OFF
041595,000086: 
041596,000087:                                                                                                  #        (2)     IF LEM NOT DOCKED
041597,000088: 
041598,000089:                                                                                                  #                VARST0 = NOLEMVAL0      WHERE THE MEANING AND SCALING OF VARST0
041599,000090:                                                                                                  #                   .          .         TO VARST9 ARE THE SAME AS GIVEN ABOVE
041600,000091:                                                                                                  #                   .          .
041601,000092:                                                                                                  #                   .          .         NOTE... FOR THIS CASE, VARST8,9 HAVE NO
041602,000093:                                                                                                  #                VARST9 = NOLEMVAL9      MEANING (THEY ARE COMPUTED BUT NOT USED)
041603,000094: 
041604,000095:                                                                                                  #        (3)     THE FINAL OUTPUT CALCULATIONS ARE THEN DONE
041605,000096: 
041606,000097:                                                                                                  #                IXX0 = VARST0 + (CSMMASS + NEGBPW)VARST5                IXX
041607,000098: 
041608,000099:                                                                                                  #                IXX1 = VARST1 + (CSMMASS + NEGBPW)VARST(4 OR 6)         IAVG
041609,000100: 
041610,000101:                                                                                                  #                IXX2 = VARST2 + (CSMMASS + NEGBPW)VARST(3 OR 7)         IAVG/TLX
041611,000102: 
041612,000103:                                                                                                  #        THE DATA USED CAME FROM CSM/LM SPACECRAFT OPERATIONAL DATA BOOK.
041613,000104:                                                                                                  #                VOL. 3, NASA DOCUMENT SNA-8-D-027 (MARCH 1968)
041614,000105: 
041615,000106:                                                                                                  #        PERTINENT MASS DATA:            CSM WEIGHT      (FULL)  64100 LBS
041616,000107:                                                                                                  #                                                        (EMPTY) 23956 LBS
041617,000108:                                                                                                  #                                        LEM WEIGHT      (FULL)  32000 LBS
041618,000109:                                                                                                  #                                                        (EMPTY) 14116 LBS
041619,000110: 
041620,000111:                                                                                                  #        (WEIGHTS ARE FROM AMENDMENT #1 (APRIL 24, 1968) TO ABOVE DATA BOOK)

Page 953

041622,000113: 
041623,000114: 25,3774                                           BANK     25                                    
041624,000115: 05,2000                                           SETLOC   DAPMASS                               
041625,000116: 05,2000                                           BANK                                           
041626,000117: 05,3366  E6,1702                                  EBANK=   BZERO                                 
041627,000118: 05,3366                                           COUNT*   $$/MASP                               
041628,000119: 
041629,000120: 05,3366           34334        MASSPROP           CAF      NINE                                  #  MASSPROP USES TVC/RCS INTERUPT TEMPS
041630,000121: 05,3367           55506                           TS       PHI333                                #  SET UP TEN PASSES
041631,000122: 
041632,000123: 05,3370           31466        LEMTEST            CAE      DAPDATR1                              #  DETERMINE LEM STATUS
041633,000124: 05,3371           75003                           MASK     BIT13                                 
041634,000125: 05,3372           00006                           EXTEND                                         
041635,000126: 05,3373           13377                           BZF      LEMYES                                
041636,000127: 
041637,000128: 05,3374           51506        LEMNO              INDEX    PHI333                                #  LEM NOT ATTACHED
041638,000129: 05,3375           33463                           CAF      NOLEMVAL                              
041639,000130: 05,3376           13407                           TCF      STOINST                               
041640,000131: 
041641,000132: 05,3377           31473        LEMYES             CAE      LEMMASS                               #  LEM IS ATTACHED
041642,000133: 05,3400           60000                           DOUBLE                                         
041643,000134: 05,3401           00006                           EXTEND                                         
041644,000135: 05,3402           51506                           INDEX    PHI333                                
041645,000136: 05,3403           73505                           MP       SLOPEVAL                              
041646,000137: 05,3404           20001                           DDOUBL                                         
041647,000138: 05,3405           51506                           INDEX    PHI333                                
041648,000139: 05,3406           63473                           AD       INTVALUE                              
041649,000140: 
041650,000141: 05,3407           51506        STOINST            INDEX    PHI333                                #  STORAGE INST BEGIN HERE
041651,000142: 05,3410           55511                           TS       VARST0                                
041652,000143: 05,3411           11506                           CCS      PHI333                                #  ARE ALL TEN PASSES COMPLETED
041653,000144: 05,3412           13367                           TCF      MASSPROP   +1                         #  NO - GO DECREMENT PHI333
041654,000145: 
041655,000146: 05,3413           11466        DXTEST             CCS      DAPDATR1                              #  IF NEG, BIT15 IS 1, LEM DSCNT STAGE OFF
041656,000147: 05,3414           13422                           TCF      FIXCW                                 
041657,000148: 05,3415           13422                           TCF      FIXCW                                 
041658,000149: 05,3416           53522                           DXCH     VARST0     +8D                        
041659,000150: 05,3417           21513                           DAS      VARST0     +1                         
041660,000151: 05,3420           33520                           CA       DXITFIX                               
041661,000152: 05,3421           27520                           ADS      VARST0     +7                         
041662,000153: 
041663,000154: 05,3422           35016        FIXCW              CAF      BIT2                                  #  COMPUTATION PHASE BEGINS HERE. SET UP
041664,000155: 05,3423           55506                           TS       PHI333                                #  THREE PASSES
041665,000156: 05,3424           55507                           TS       PSI333                                
041666,000157: 
041667,000158: 05,3425           31474                           CAE      CSMMASS                               #  GET DELTA CSM WEIGHT - SIGN DETERMINES
041668,000159: 05,3426           63517                           AD       NEGBPW                                #  SLOPE LOCATIONS.
041669,000160: 05,3427           60000                           DOUBLE                                         
041670,000161: 05,3430           55510                           TS       TEMP333                               

Page 954

041672,000163: 05,3431           00006                           EXTEND                                         
041673,000164: 05,3432           63435                           BZMF     PEGGY                                 #  DETERMINE CORRECT SLOPE
041674,000165: 05,3433           37715                           CAF      NEG2                                  
041675,000166: 05,3434           55506                           TS       PHI333                                
041676,000167: 
041677,000168: 05,3435           51506        PEGGY              INDEX    PHI333                                #  ALL IS READY - CALCULATE OUTPUTS NOW
041678,000169: 05,3436           31516                           CAE      VARST5                                #  GET SLOPE
041679,000170: 05,3437           00006                           EXTEND                                         
041680,000171: 05,3440           71510                           MP       TEMP333                               #  MULT BY DELTA CSM WEIGHT
041681,000172: 05,3441           60000                           DOUBLE                                         
041682,000173: 05,3442           51507                           INDEX    PSI333                                
041683,000174: 05,3443           61511                           AD       VARST0                                #  ADD BREAKPOINT VALUE
041684,000175: 05,3444           51507                           INDEX    PSI333                                
041685,000176: 05,3445           55470                           TS       IXX                                   #  ****** OUTPUTS (IXX0, IXX1, IXX2) ******
041686,000177: 
041687,000178: 05,3446           11507                           CCS      PSI333                                #  BOOKKEEPING - MASSPROP FINISHED OR NOT
041688,000179: 05,3447           13457                           TCF      BOKKEP2                               #  NO - GO TAKE CARE OF INDEXING REGISTERS
041689,000180: 
041690,000181: 05,3450           31466                           CAE      DAPDATR1                              #  UPDATE WEIGHT/G
041691,000182: 05,3451           75002                           MASK     BIT14                                 
041692,000183: 05,3452           10000                           CCS      A                                     
041693,000184: 05,3453           31473                           CA       LEMMASS                               
041694,000185: 05,3454           61474                           AD       CSMMASS                               
041695,000186: 05,3455           55475                           TS       WEIGHT/G                              #  SCALED AT B+16 IN KILOGRAMS
041696,000187: 05,3456           00002        ENDMASSP           TC       Q                                     
041697,000188: 
041698,000189: 05,3457           55507        BOKKEP2            TS       PSI333                                #  REDUCE PSI BY ONE
041699,000190: 05,3460           00006                           EXTEND                                         
041700,000191: 05,3461           27506                           DIM      PHI333                                
041701,000192: 05,3462           13435                           TCF      PEGGY                                 
041702,000193: 

Page 955

041704,000195: 05,3463           00616        NOLEMVAL           DEC      25445      B-20                       
041705,000196: 05,3464           02526                           DEC      87450      B-20                       
041706,000197: 05,3465           02352                           DEC      .30715     B-2                        
041707,000198: 05,3466           01471                           DEC      1.22877    E-5        B+12            
041708,000199: 05,3467           00634                           DEC      1.6096     B-6                        
041709,000200: 05,3470           00612                           DEC      1.54       B-6                        
041710,000201: 05,3471           03706                           DEC      7.77177    B-6                        
041711,000202: 05,3472           04425                           DEC      3.46458    E-5        B+12            
041712,000203: 
041713,000204: 05,3473           00644        INTVALUE           DEC      26850      B-20                       
041714,000205: 05,3474           03710                           DEC      127518     B-20                       
041715,000206: 05,3475           04246                           DEC      .54059     B-2                        
041716,000207: 05,3476           02011                           DEC      .153964    E-4        B+12            
041717,000208: 05,3477           77501                           DEC      -.742923   B-6                        
041718,000209: 05,3500           00612                           DEC      1.5398     B-6                        
041719,000210: 05,3501           04656                           DEC      9.68       B-6                        
041720,000211: 05,3502           10372                           DEC      .647625    E-4        B+12            
041721,000212: 05,3503           77126                           DEC      -27228     B-20                       
041722,000213: 05,3504           76261                           DEC      -.206476   B-2                        
041723,000214: 
041724,000215: 05,3505           00767        SLOPEVAL           DEC      1.96307    B-6                        
041725,000216: 05,3506           15624                           DEC      27.5774    B-6                        
041726,000217: 05,3507           03054                           DEC      2.3548     E-5        B+12            
041727,000218: 05,3510           04532                           DEC      2.1777     E-9        B+26            
041728,000219: 05,3511           10433                           DEC      1.044      E-3        B+8             
041729,000220: 05,3512           00000                           DEC      0          B-14                       
041730,000221: 05,3513           22070                           DEC      2.21068    E-3        B+8             
041731,000222: 05,3514           03204                           DEC      1.5166     E-9        B+26            
041732,000223: 05,3515           77266                           DEC      -1.284     B-6                        
041733,000224: 05,3516           02476                           DEC      2          E-5        B+12            
041734,000225: 
041735,000226: 05,3517           70364        NEGBPW             DEC      -15402.17  B-16                       
041736,000227: 05,3520           75420        DXITFIX            DEC*     -1.88275   E-5        B+12*           
041737,000228: 

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