Source Code

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

The starting point was the source code of Comanche 51 (separately previously reconstructed from an Apollo-era listing of Comanche 55, flown on Apollo 11). Comanche 51 source code was then modified by undoing changes known to have been made between revisions 44 and 51. The now-reconstructed Comanche 44 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 printout, although the source code would likely have different page numbers in a contemporary Comanche 44 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 51. Here's a guide to the Apollo documentation referenced in those annotations:
In most cases, only the titles (rather than the full texts) of PCRs are known. In addition to the explanatory annotations, there is also a step-by-step 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.

019710,000002:                                                                                                  ## Copyright:   Public domain.
019711,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
019712,000004:                                                                                                  ## Purpose:     A section of Comanche revision 044.
019713,000005:                                                                                                  ##              It is part of the reconstructed source code for the
019714,000006:                                                                                                  ##              original release of the flight software for the Command
019715,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
019716,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
019717,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
019718,000010:                                                                                                  ##              exactly match those specified for Comanche 44 in NASA drawing
019719,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
019720,000012:                                                                                                  ##              reconstruction is correct.
019721,000013:                                                                                                  ## Assembler:   yaYUL
019722,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
019723,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
019724,000016:                                                                                                  ## Mod history: 2020-12-03 MAS  Created from Comanche 51.
019725,000017:                                                                                                  ##              2020-12-04 MAS  Removed the SL* 0,2 for P21VEL in P21VSAVE.
019726,000018:                                                                                                  ##              2020-12-11 RSB  Added justification annotations for Mike's
019727,000019:                                                                                                  ##                              reconstruction steps.
019728,000020:                                                                                                  ##              2020-12-13 RSB  Added feedback about the annotations.
019729,000021: 

Page 456

019731,000023:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
019732,000024: 
019733,000025:                                                                                                  #  PROGRAM DESCRIPTION
019734,000026:                                                                                                  #  MOD NO - 1
019735,000027:                                                                                                  #  MOD BY - N. M. NEVILLE
019736,000028:                                                                                                  #  FUNCTIONAL DECRIPTION-
019737,000029: 
019738,000030:                                                                                                  #  TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
019739,000031:                                                                                                  #  THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
019740,000032:                                                                                                  #  CALLING SEQUENCE-
019741,000033: 
019742,000034:                                                                                                  #  ASTRONAUT REQUEST THROUGH DSKY V37E21E
019743,000035:                                                                                                  #  SUBROUTINES CALLED-
019744,000036: 
019745,000037:                                                                                                  #  GOPERF4
019746,000038:                                                                                                  #  GOFLASH
019747,000039:                                                                                                  #  THISPREC
019748,000040:                                                                                                  #  OTHPREC
019749,000041:                                                                                                  #  LAT-LONG
019750,000042:                                                                                                  #  NORMAL EXIT MODES-
019751,000043: 
019752,000044:                                                                                                  #  ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
019753,000045:                                                                                                  #  ALARM OR ABORT EXIT MODES-
019754,000046: 
019755,000047:                                                                                                  #  NONE
019756,000048:                                                                                                  #  OUTPUT-
019757,000049: 
019758,000050:                                                                                                  #  OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
019759,000051:                                                                                                  #  COMPUTED
019760,000052:                                                                                                  #           OPTION CODE  00002
019761,000053:                                                                                                  #           THIS         00001
019762,000054:                                                                                                  #           OTHER                00002
019763,000055:                                                                                                  #  DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS , MINUTES , SECONDS
019764,000056:                                                                                                  #  DECIMAL DISPLAY OF LAT,LONG,ALT
019765,000057:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
019766,000058: 
019767,000059:                                                                                                  #  AX0    2DEC   4.652459653 E-5   RADIANS       %68-69 CONSTANTS"
019768,000060: 
019769,000061:                                                                                                  #  -AY0   2DEC   2.147535898 E-5   RADIANS
019770,000062: 
019771,000063:                                                                                                  #  AZ0    2DEC   .7753206164       REVOLUTIONS
019772,000064:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
019773,000065: 
019774,000066:                                                                                                  #  504LM  2DEC   -2.700340600 E-5  RADIANS
019775,000067: 
019776,000068:                                                                                                  #  504LM _2 2DEC -7.514128400 E-4  RADIANS
019777,000069: 
019778,000070:                                                                                                  #  504LM _4 2DEC _2.553198641 E-4  RADIANS
019779,000071: 
019780,000072:                                                                                                  #  NONE
019781,000073:                                                                                                  #  DEBRIS
019782,000074: 

Page 457

019784,000076:                                                                                                  #  CENTRALS-A,Q,L
019785,000077:                                                                                                  #  OTHER-THOSE USED BY THE ABOVE LISTED SUBROUTINES
019786,000078:                                                                                                  #  SEE LEMPREC, LAT-LONG
019787,000079: 
019788,000080: 33,3776  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
019789,000081: 
019790,000082: 33,3776                                           BANK     33                                    
019791,000083: 37,2000                                           SETLOC   P20S                                  
019792,000084: 37,2000                                           BANK                                           
019793,000085: 
019794,000086: 37,2001  E4,1715                                  EBANK=   P21TIME                               
019795,000087: 37,2001                                           COUNT    24/P21                                
019796,000088: 
019797,000089: 37,2001           35017        PROG21             CAF      ONE                                   
019798,000090: 37,2002           55132                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
019799,000091: 37,2003           35016                           CAF      BIT2                                  #   OPTION 2
019800,000092: 37,2004           04662                           TC       BANKCALL                              
019801,000093: 37,2005           21055                           CADR     GOPERF4                               
019802,000094: 37,2006           04106                           TC       GOTOPOOH                              #  TERMINATE
019803,000095: 37,2007           02011                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
019804,000096: 37,2010           02003                           TC       -5                                    #  R2 LOADED THROUGH DSKY
019805,000097: 37,2011           32151        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
019806,000098: 37,2012           04662                           TC       BANKCALL                              
019807,000099: 37,2013           20720                           CADR     GOFLASH                               
019808,000100: 37,2014           04106                           TC       GOTOPOOH                              #  TERM
019809,000101: 37,2015           02017                           TC       +2                                    #  PROCEED VALUES OK
019810,000102: 37,2016           02011                           TC       -5                                    #  TIME LOADED THROUGH DSKY
019811,000103: 37,2017           06006                           TC       INTPRET                               
019812,000104: 37,2020           77745                           DLOAD                                          
019813,000105: 37,2021           01046                                    DSPTEM1                               
019814,000106: 37,2022           34041                           STCALL   TDEC1                                 #  INTEG TO TIME SPECIFIED IN TDEC
019815,000107: 37,2023           27442                                    INTSTALL                              
019816,000108: 37,2024           43014                           BON      SET                                   
019817,000109: 37,2025           01303                                    P21FLAG                               
019818,000110: 37,2026           76044                                    P21CONT                               #  ON...RECYCLE USING BASE VECTOR
019819,000111: 37,2027           01474                                    VINTFLAG                              #  OFF..1ST PASS CALC BASE VECTOR
019820,000112: 37,2030           70535                           SLOAD    SR1                                   
019821,000113: 37,2031           01133                                    OPTION2                               
019822,000114: 37,2032           43030                           BHIZ     CLEAR                                 
019823,000115: 37,2033           76035                                    +2                                    #  ZERO..THIS VEHICLE (CM)
019824,000116: 37,2034           01674                                    VINTFLAG                              #  ONE...OTHER VEHICLE(LM)
019825,000117: 37,2035           43014                           CLEAR    CLEAR                                 
019826,000118: 37,2036           01676                                    DIM0FLAG                              
019827,000119: 37,2037           01673                                    INTYPFLG                              #  PRECISION
019828,000120: 37,2040           77624                           CALL                                           
019829,000121: 37,2041           27162                                    INTEGRV                               #  CALCULATE
019830,000122: 37,2042           77650                           GOTO                                           #  .AND
019831,000123: 37,2043           76065                                    P21VSAVE                              #  ..SAVE BASE VECTOR
019832,000124: 37,2044           77775        P21CONT            VLOAD                                          #  RECYCLE..INTEG FROM BASE VECTOR                       
019833,000125: 37,2045           03605                                    P21BASER                              

Page 458

019835,000127: 37,2046           25535                           STOVL    RCV                                   #  ..POS
019836,000128: 37,2047           03613                                    P21BASEV                              
019837,000129: 37,2050           15543                           STODL    VCV                                   #  ..VEL
019838,000130: 37,2051           02316                                    P21TIME                               
019839,000131: 37,2052           01517                           STORE    TET                                   #  ..TIME
019840,000132: 37,2053           43014                           CLEAR    CLEAR                                 
019841,000133: 37,2054           01676                                    DIM0FLAG                              
019842,000134: 37,2055           00263                                    MOONFLAG                              
019843,000135: 37,2056           53135                           SLOAD    BZE                                   
019844,000136: 37,2057           03604                                    P21ORIG                               
019845,000137: 37,2060           76063                                    +3                                    #  ZERO = EARTH
019846,000138: 37,2061           77614                           SET                                            #  ...2 = MOON
019847,000139: 37,2062           00063                                    MOONFLAG                              
019848,000140: 37,2063           77624                           CALL                                           
019849,000141: 37,2064           27135                                    INTEGRVS                              
019850,000142: 37,2065           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
019851,000143: 37,2066           00015                                    TAT                                   
019852,000144: 37,2067           26316                           STOVL    P21TIME                               #  ..TIME
019853,000145: 37,2070           00017                                    RATT1                                 
019854,000146: 37,2071           27605                           STOVL    P21BASER                              #  ..POS B-29 OR B-27
019855,000147: 37,2072           00025                                    VATT1                                 
019856,000148: 37,2073           03613                           STORE    P21BASEV                              #  ..VEL B-7  OR B-5

Reconstruction: This change, from
   ABVAL   SL*
           0,2
to simply ABVAL, is justified by Programmed Guidance Equations for Colossus 2, p. ORVN-3. (The indicated change, from Comanche 45/2 to Comanche 55, is that an absolute value is taken, shifted right by two bits, and then stored, so the only actual change in the code is the shift, with the the absolute value and storage remain unchanged. The change bars refer to changes in the document rather than changes in the code.)

019869,000161: 37,2074           77646                           ABVAL                                          
019870,000162: 37,2075           27623                           STOVL    P21VEL                                #  /VEL/ FOR N73 DSP
019871,000163: 37,2076           00001                                    RATT                                  
019872,000164: 37,2077           50256                           UNIT     DOT                                   
019873,000165: 37,2100           00007                                    VATT                                  #  U(R).(V)
019874,000166: 37,2101           67471                           DDV      ASIN                                  #  U(R).U(V)
019875,000167: 37,2102           03623                                    P21VEL                                
019876,000168: 37,2103           03625                           STORE    P21GAM                                #  SIN-1 U(R).U(V), -90 TO +90
019877,000169: 37,2104           43134                           SXA,2    SET                                   
019878,000170: 37,2105           03603                                    P21ORIG                               #  0 = EARTH  2 = MOON
019879,000171: 37,2106           01063                                    P21FLAG                               
019880,000172: 37,2107           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
019881,000173: 37,2110           01663                                    LUNAFLAG                              
019882,000174: 37,2111           00050                                    X2                                    
019883,000175: 37,2112           43054                           BZE      SET                                   
019884,000176: 37,2113           76115                                    +2                                    #  0 = EARTH
019885,000177: 37,2114           01463                                    LUNAFLAG                              
019886,000178: 37,2115           77775                           VLOAD                                          
019887,000179: 37,2116           00001                                    RATT                                  
019888,000180: 37,2117           16152                           STODL    ALPHAV                                
019889,000181: 37,2120           00015                                    TAT                                   
019890,000182: 37,2121           45014                           CLEAR    CALL                                  
019891,000183: 37,2122           00662                                    ERADFLAG                              
019892,000184: 37,2123           26370                                    LAT-LONG                              
019893,000185: 37,2124           77605                           DMP                                            #  MPAC = ALT, METERS B-29
019894,000186: 37,2125           36153                                    K.01                                  
019895,000187: 37,2126           03621                           STORE    P21ALT                                #  ALT/100 FOR N73 DSP

Page 459

019897,000189: 37,2127           77776                           EXIT                                           
019898,000190: 37,2130           32150                           CAF      V06N43                                #  DISPLAY LAT,LONG,ALT
019899,000191: 37,2131           04662                           TC       BANKCALL                              #  LAT,LONG = REVS B0 BOTH EARTH/MOON
019900,000192: 37,2132           20720                           CADR     GOFLASH                               #  ALT = METERS B-29  BOTH EARTH/MOON
019901,000193: 37,2133           04106                           TC       GOTOPOOH                              #  TERM
019902,000194: 37,2134           04106                           TC       GOTOPOOH                              
019903,000195: 37,2135           06006                           TC       INTPRET                               #  V32E RECYCLE
019904,000196: 37,2136           43345                           DLOAD    DAD                                   
019905,000197: 37,2137           02316                                    P21TIME                               
019906,000198: 37,2140           36145                                    600SEC                                #  600 SECONDS OR 10 MIN
019907,000199: 37,2141           01046                           STORE    DSPTEM1                               
019908,000200: 37,2142           77634                           RTB                                            
019909,000201: 37,2143           76011                                    P21PROG1                              
019910,000202: 
019911,000203: 37,2144           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
019912,000204: 
019913,000205: 37,2146           00001        P21ONENN           OCT      00001                                 #  NEEDED TO DETERMINE VEHICLE
019914,000206: 37,2147           00000                           OCT      00000                                 #  TO BE INTEGRATED
019915,000207: 37,2150           01453        V06N43             VN       00643                                 
019916,000208: 37,2151           01442        V6N34              VN       00634                                 
019917,000209: 37,2152           00243 32703  K.01               2DEC     .01                                   
019918,000210: 

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