Source Code

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

The starting point was the source code of Comanche 45 (itself previously accurately reconstructed). Comanche 45 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 45 and 45/2. The now-reconstructed Comanche 45/2 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:
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.

019553,000002:                                                                                                  ## Copyright:   Public domain.
019554,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
019555,000004:                                                                                                  ## Purpose:     A section of Manche45 revision 2.
019556,000005:                                                                                                  ##              It is part of the reconstructed source code for the
019557,000006:                                                                                                  ##              final, flown release of the flight software for the Command
019558,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
019559,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
019560,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
019561,000010:                                                                                                  ##              exactly match those specified for Manche 45/2 in NASA drawing
019562,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
019563,000012:                                                                                                  ##              reconstruction is correct.
019564,000013:                                                                                                  ## Assembler:   yaYUL
019565,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
019566,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
019567,000016:                                                                                                  ## Mod history: 2020-12-24 MAS  Created from Comanche 45.
019568,000017: 

Page 456

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

Page 457

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

Page 458

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

Page 459

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

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