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.

019561,000002:                                                                                                  ## Copyright:   Public domain.
019562,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
019563,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
019564,000005:                                                                                                  ##              It is part of the reconstructed source code for the
019565,000006:                                                                                                  ##              original release of the flight software for the Command
019566,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
019567,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
019568,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
019569,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
019570,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
019571,000012:                                                                                                  ##              reconstruction is correct.
019572,000013:                                                                                                  ## Reference:   pp. 456-459
019573,000014:                                                                                                  ## Assembler:   yaYUL
019574,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
019575,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
019576,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
019577,000018: 

Page 456

019579,000020:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
019580,000021: 
019581,000022:                                                                                                  #  PROGRAM DESCRIPTION
019582,000023:                                                                                                  #  MOD NO - 1
019583,000024:                                                                                                  #  MOD BY - N. M. NEVILLE
019584,000025:                                                                                                  #  FUNCTIONAL DECRIPTION-
019585,000026: 
019586,000027:                                                                                                  #  TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
019587,000028:                                                                                                  #  THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
019588,000029:                                                                                                  #  CALLING SEQUENCE-
019589,000030: 
019590,000031:                                                                                                  #  ASTRONAUT REQUEST THROUGH DSKY V37E21E
019591,000032:                                                                                                  #  SUBROUTINES CALLED-
019592,000033: 
019593,000034:                                                                                                  #  GOPERF4
019594,000035:                                                                                                  #  GOFLASH
019595,000036:                                                                                                  #  THISPREC
019596,000037:                                                                                                  #  OTHPREC
019597,000038:                                                                                                  #  LAT-LONG
019598,000039:                                                                                                  #  NORMAL EXIT MODES-
019599,000040: 
019600,000041:                                                                                                  #  ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
019601,000042:                                                                                                  #  ALARM OR ABORT EXIT MODES-
019602,000043: 
019603,000044:                                                                                                  #  NONE
019604,000045:                                                                                                  #  OUTPUT-
019605,000046: 
019606,000047:                                                                                                  #  OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
019607,000048:                                                                                                  #  COMPUTED
019608,000049:                                                                                                  #           OPTION CODE  00002
019609,000050:                                                                                                  #           THIS         00001
019610,000051:                                                                                                  #           OTHER                00002
019611,000052:                                                                                                  #  DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS , MINUTES , SECONDS
019612,000053:                                                                                                  #  DECIMAL DISPLAY OF LAT,LONG,ALT
019613,000054:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
019614,000055: 
019615,000056:                                                                                                  #  AX0    2DEC   4.652459653 E-5   RADIANS       %68-69 CONSTANTS"
019616,000057: 
019617,000058:                                                                                                  #  -AY0   2DEC   2.147535898 E-5   RADIANS
019618,000059: 
019619,000060:                                                                                                  #  AZ0    2DEC   .7753206164       REVOLUTIONS
019620,000061:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
019621,000062: 
019622,000063:                                                                                                  #  504LM  2DEC   -2.700340600 E-5  RADIANS
019623,000064: 
019624,000065:                                                                                                  #  504LM _2 2DEC -7.514128400 E-4  RADIANS
019625,000066: 
019626,000067:                                                                                                  #  504LM _4 2DEC _2.553198641 E-4  RADIANS
019627,000068: 
019628,000069:                                                                                                  #  NONE
019629,000070:                                                                                                  #  DEBRIS
019630,000071: 

Page 457

019632,000073:                                                                                                  #  CENTRALS-A,Q,L
019633,000074:                                                                                                  #  OTHER-THOSE USED BY THE ABOVE LISTED SUBROUTINES
019634,000075:                                                                                                  #  SEE LEMPREC, LAT-LONG
019635,000076: 
019636,000077: 33,3776  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
019637,000078: 
019638,000079: 33,3776                                           BANK     33                                    
019639,000080: 37,2000                                           SETLOC   P20S                                  
019640,000081: 37,2000                                           BANK                                           
019641,000082: 
019642,000083: 37,2001  E4,1715                                  EBANK=   P21TIME                               
019643,000084: 37,2001                                           COUNT    24/P21                                
019644,000085: 
019645,000086: 37,2001           35017        PROG21             CAF      ONE                                   
019646,000087: 37,2002           55132                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
019647,000088: 37,2003           35016                           CAF      BIT2                                  #   OPTION 2
019648,000089: 37,2004           04662                           TC       BANKCALL                              
019649,000090: 37,2005           21055                           CADR     GOPERF4                               
019650,000091: 37,2006           04106                           TC       GOTOPOOH                              #  TERMINATE
019651,000092: 37,2007           02011                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
019652,000093: 37,2010           02003                           TC       -5                                    #  R2 LOADED THROUGH DSKY
019653,000094: 37,2011           32152        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
019654,000095: 37,2012           04662                           TC       BANKCALL                              
019655,000096: 37,2013           20720                           CADR     GOFLASH                               
019656,000097: 37,2014           04106                           TC       GOTOPOOH                              #  TERM
019657,000098: 37,2015           02017                           TC       +2                                    #  PROCEED VALUES OK
019658,000099: 37,2016           02011                           TC       -5                                    #  TIME LOADED THROUGH DSKY
019659,000100: 37,2017           06006                           TC       INTPRET                               
019660,000101: 37,2020           77745                           DLOAD                                          
019661,000102: 37,2021           01046                                    DSPTEM1                               
019662,000103: 37,2022           34041                           STCALL   TDEC1                                 #  INTEG TO TIME SPECIFIED IN TDEC
019663,000104: 37,2023           27442                                    INTSTALL                              
019664,000105: 37,2024           43014                           BON      SET                                   
019665,000106: 37,2025           01303                                    P21FLAG                               
019666,000107: 37,2026           76044                                    P21CONT                               #  ON...RECYCLE USING BASE VECTOR
019667,000108: 37,2027           01474                                    VINTFLAG                              #  OFF..1ST PASS CALC BASE VECTOR
019668,000109: 37,2030           70535                           SLOAD    SR1                                   
019669,000110: 37,2031           01133                                    OPTION2                               
019670,000111: 37,2032           43030                           BHIZ     CLEAR                                 
019671,000112: 37,2033           76035                                    +2                                    #  ZERO..THIS VEHICLE (CM)
019672,000113: 37,2034           01674                                    VINTFLAG                              #  ONE...OTHER VEHICLE(LM)
019673,000114: 37,2035           43014                           CLEAR    CLEAR                                 
019674,000115: 37,2036           01676                                    DIM0FLAG                              
019675,000116: 37,2037           01673                                    INTYPFLG                              #  PRECISION
019676,000117: 37,2040           77624                           CALL                                           
019677,000118: 37,2041           27162                                    INTEGRV                               #  CALCULATE
019678,000119: 37,2042           77650                           GOTO                                           #  .AND
019679,000120: 37,2043           76065                                    P21VSAVE                              #  ..SAVE BASE VECTOR
019680,000121: 37,2044           77775        P21CONT            VLOAD                                          #  RECYCLE..INTEG FROM BASE VECTOR                       
019681,000122: 37,2045           03605                                    P21BASER                              

Page 458

019683,000124: 37,2046           25535                           STOVL    RCV                                   #  ..POS
019684,000125: 37,2047           03613                                    P21BASEV                              
019685,000126: 37,2050           15543                           STODL    VCV                                   #  ..VEL
019686,000127: 37,2051           02316                                    P21TIME                               
019687,000128: 37,2052           01517                           STORE    TET                                   #  ..TIME
019688,000129: 37,2053           43014                           CLEAR    CLEAR                                 
019689,000130: 37,2054           01676                                    DIM0FLAG                              
019690,000131: 37,2055           00263                                    MOONFLAG                              
019691,000132: 37,2056           53135                           SLOAD    BZE                                   
019692,000133: 37,2057           03604                                    P21ORIG                               
019693,000134: 37,2060           76063                                    +3                                    #  ZERO = EARTH
019694,000135: 37,2061           77614                           SET                                            #  ...2 = MOON
019695,000136: 37,2062           00063                                    MOONFLAG                              
019696,000137: 37,2063           77624                           CALL                                           
019697,000138: 37,2064           27135                                    INTEGRVS                              
019698,000139: 37,2065           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
019699,000140: 37,2066           00015                                    TAT                                   
019700,000141: 37,2067           26316                           STOVL    P21TIME                               #  ..TIME
019701,000142: 37,2070           00017                                    RATT1                                 
019702,000143: 37,2071           27605                           STOVL    P21BASER                              #  ..POS B-29 OR B-27
019703,000144: 37,2072           00025                                    VATT1                                 
019704,000145: 37,2073           03613                           STORE    P21BASEV                              #  ..VEL B-7  OR B-5
019705,000146: 37,2074           53646                           ABVAL    SL*                                   
019706,000147: 37,2075           57576                                    0,2                                   
019707,000148: 37,2076           27623                           STOVL    P21VEL                                #  /VEL/ FOR N73 DSP
019708,000149: 37,2077           00001                                    RATT                                  
019709,000150: 37,2100           50256                           UNIT     DOT                                   
019710,000151: 37,2101           00007                                    VATT                                  #  U(R).(V)
019711,000152: 37,2102           67471                           DDV      ASIN                                  #  U(R).U(V)
019712,000153: 37,2103           03623                                    P21VEL                                
019713,000154: 37,2104           03625                           STORE    P21GAM                                #  SIN-1 U(R).U(V), -90 TO +90
019714,000155: 37,2105           43134                           SXA,2    SET                                   
019715,000156: 37,2106           03603                                    P21ORIG                               #  0 = EARTH  2 = MOON
019716,000157: 37,2107           01063                                    P21FLAG                               
019717,000158: 37,2110           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
019718,000159: 37,2111           01663                                    LUNAFLAG                              
019719,000160: 37,2112           00050                                    X2                                    
019720,000161: 37,2113           43054                           BZE      SET                                   
019721,000162: 37,2114           76116                                    +2                                    #  0 = EARTH
019722,000163: 37,2115           01463                                    LUNAFLAG                              
019723,000164: 37,2116           77775                           VLOAD                                          
019724,000165: 37,2117           00001                                    RATT                                  
019725,000166: 37,2120           16152                           STODL    ALPHAV                                
019726,000167: 37,2121           00015                                    TAT                                   
019727,000168: 37,2122           45014                           CLEAR    CALL                                  
019728,000169: 37,2123           00662                                    ERADFLAG                              
019729,000170: 37,2124           26370                                    LAT-LONG                              
019730,000171: 37,2125           77605                           DMP                                            #  MPAC = ALT, METERS B-29
019731,000172: 37,2126           36154                                    K.01                                  
019732,000173: 37,2127           03621                           STORE    P21ALT                                #  ALT/100 FOR N73 DSP

Page 459

019734,000175: 37,2130           77776                           EXIT                                           
019735,000176: 37,2131           32151                           CAF      V06N43                                #  DISPLAY LAT,LONG,ALT
019736,000177: 37,2132           04662                           TC       BANKCALL                              #  LAT,LONG = REVS B0 BOTH EARTH/MOON
019737,000178: 37,2133           20720                           CADR     GOFLASH                               #  ALT = METERS B-29  BOTH EARTH/MOON
019738,000179: 37,2134           04106                           TC       GOTOPOOH                              #  TERM
019739,000180: 37,2135           04106                           TC       GOTOPOOH                              
019740,000181: 37,2136           06006                           TC       INTPRET                               #  V32E RECYCLE
019741,000182: 37,2137           43345                           DLOAD    DAD                                   
019742,000183: 37,2140           02316                                    P21TIME                               
019743,000184: 37,2141           36146                                    600SEC                                #  600 SECONDS OR 10 MIN
019744,000185: 37,2142           01046                           STORE    DSPTEM1                               
019745,000186: 37,2143           77634                           RTB                                            
019746,000187: 37,2144           76011                                    P21PROG1                              
019747,000188: 
019748,000189: 37,2145           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
019749,000190: 
019750,000191: 37,2147           00001        P21ONENN           OCT      00001                                 #  NEEDED TO DETERMINE VEHICLE
019751,000192: 37,2150           00000                           OCT      00000                                 #  TO BE INTEGRATED
019752,000193: 37,2151           01453        V06N43             VN       00643                                 
019753,000194: 37,2152           01442        V6N34              VN       00634                                 
019754,000195: 37,2153           00243 32703  K.01               2DEC     .01                                   
019755,000196: 

End of include-file GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc.  Parent file is MAIN.agc