Source Code

These source-code files are part of a reconstructed copy of Comanche 45, the second release, though not the final mission release, of the Apollo 10 Command Module (CM) Apollo Guidance Computer (AGC) software. Comanche 45 was preceded by Comanche 44 and followed by Comanche 45/2 (the flown release). The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 45, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 44 (itself previously accurately reconstructed). Comanche 44 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 44 and 45. The now-reconstructed Comanche 45 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 tend to match those in the Comanche 55, the most-similar revision of Comanche for which we have access to an actual non-reconstructed hardcopy; the source code would likely have different page numbers in a contemporary Comanche 45 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 44. Here's a guide to the Apollo documentation referenced in those annotations:
There is also a detailed commentary about the reconstruction process.

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.

019539,000002:                                                                                                  ## Copyright:   Public domain.
019540,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
019541,000004:                                                                                                  ## Purpose:     A section of Comanche revision 045.
019542,000005:                                                                                                  ##              It is part of the reconstructed source code for the
019543,000006:                                                                                                  ##              second release of the flight software for the Command
019544,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
019545,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
019546,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
019547,000010:                                                                                                  ##              exactly match those specified for Comanche 45 in NASA drawing
019548,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
019549,000012:                                                                                                  ##              reconstruction is correct.
019550,000013:                                                                                                  ## Assembler:   yaYUL
019551,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
019552,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
019553,000016:                                                                                                  ## Mod history: 2020-12-06 MAS  Created from Comanche 44.
019554,000017: 

Page 456

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

Page 457

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

Page 458

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

Page 459

019710,000173: 37,2127           77776                           EXIT                                           
019711,000174: 37,2130           32150                           CAF      V06N43                                #  DISPLAY LAT,LONG,ALT
019712,000175: 37,2131           04662                           TC       BANKCALL                              #  LAT,LONG = REVS B0 BOTH EARTH/MOON
019713,000176: 37,2132           20720                           CADR     GOFLASH                               #  ALT = METERS B-29  BOTH EARTH/MOON
019714,000177: 37,2133           04106                           TC       GOTOPOOH                              #  TERM
019715,000178: 37,2134           04106                           TC       GOTOPOOH                              
019716,000179: 37,2135           06006                           TC       INTPRET                               #  V32E RECYCLE
019717,000180: 37,2136           43345                           DLOAD    DAD                                   
019718,000181: 37,2137           02316                                    P21TIME                               
019719,000182: 37,2140           36145                                    600SEC                                #  600 SECONDS OR 10 MIN
019720,000183: 37,2141           01046                           STORE    DSPTEM1                               
019721,000184: 37,2142           77634                           RTB                                            
019722,000185: 37,2143           76011                                    P21PROG1                              
019723,000186: 
019724,000187: 37,2144           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
019725,000188: 
019726,000189: 37,2146           00001        P21ONENN           OCT      00001                                 #  NEEDED TO DETERMINE VEHICLE
019727,000190: 37,2147           00000                           OCT      00000                                 #  TO BE INTEGRATED
019728,000191: 37,2150           01453        V06N43             VN       00643                                 
019729,000192: 37,2151           01442        V6N34              VN       00634                                 
019730,000193: 37,2152           00243 32703  K.01               2DEC     .01                                   
019731,000194: 

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