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.

017772,000002:                                                                                                  ## Copyright:   Public domain.
017773,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
017774,000004:                                                                                                  ## Purpose:     A section of Manche45 revision 2.
017775,000005:                                                                                                  ##              It is part of the reconstructed source code for the
017776,000006:                                                                                                  ##              final, flown release of the flight software for the Command
017777,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
017778,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
017779,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
017780,000010:                                                                                                  ##              exactly match those specified for Manche 45/2 in NASA drawing
017781,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
017782,000012:                                                                                                  ##              reconstruction is correct.
017783,000013:                                                                                                  ## Assembler:   yaYUL
017784,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017785,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017786,000016:                                                                                                  ## Mod history: 2020-12-24 MAS  Created from Comanche 45.
017787,000017:                                                                                                  ##              2021-05-30 ABS  ZEROERROR -> ZEROEROR
017788,000018: 

Page 414

017790,000020:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
017791,000021: 
017792,000022:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
017793,000023: 
017794,000024: 15,2000                                           BANK     15                                    
017795,000025: 
017796,000026: 22,2000                                           SETLOC   KALCMON1                              
017797,000027: 22,2000                                           BANK                                           
017798,000028: 
017799,000029: 22,3026  E6,1661                                  EBANK=   BCDU                                  
017800,000030: 
017801,000031: 22,3026                                           COUNT    22/KALC                               
017802,000032: 
017803,000033: 22,3026           41332        NEWDELHI           CS       HOLDFLAG                              #  SEE IF MANEUVER HAS BEEN INTERRUPTED
017804,000034: 22,3027           00006                           EXTEND                                         #  BY ASTRONAUT
017805,000035: 22,3030           62726                           BZMF     NOGO       -2                         #  IF SO, TERMINATE KALCMANU
017806,000036: 22,3031           06006        NEWANGL            TC       INTPRET                               
017807,000037: 22,3032           75160                           AXC,1    AXC,2                                 
017808,000038: 22,3033           03320                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
017809,000039: 22,3034           03425                                    DEL                                   #  STABLE MEMBER AXES
017810,000040: 22,3035           77624                           CALL                                           
017811,000041: 22,3036           44304                                    MXM3                                  
017812,000042: 22,3037           45575                           VLOAD    STADR                                 
017813,000043: 22,3040           50442                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
017814,000044: 22,3041           77626                           STADR                                          
017815,000045: 22,3042           50450                           STOVL    MIS        +6D                        
017816,000046: 22,3043           77626                           STADR                                          
017817,000047: 22,3044           74456                           STORE    MIS                                   
017818,000048: 22,3045           45160                           AXC,1    CALL                                  
017819,000049: 22,3046           03320                                    MIS                                   
017820,000050: 22,3047           44655                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
017821,000051: 22,3050           77634                           RTB                                            
017822,000052: 22,3051           45552                                    V1STO2S                               
017823,000053: 22,3052           03267                           STORE    NCDU                                  #  NEW CDU ANGLES
017824,000054: 22,3053           77414                           BONCLR   EXIT                                  
017825,000055: 22,3054           01215                                    CALCMAN2                              
017826,000056: 22,3055           40065                                    MANUSTAT                              #  TO START MANEUVER
017827,000057: 22,3056           35016                           CAF      TWO                                   #           +0 OTHERWISE
017828,000058: 22,3057           55664        INCRDCDU           TS       KSPNDX                                
017829,000059: 22,3060           60000                           DOUBLE                                         
017830,000060: 22,3061           55665                           TS       KDPNDX                                
017831,000061: 22,3062           51664                           INDEX    KSPNDX                                
017832,000062: 22,3063           31666                           CA       NCDU                                  #  NEW DESIRED CDU ANGLES
017833,000063: 22,3064           00006                           EXTEND                                         
017834,000064: 22,3065           51664                           INDEX    KSPNDX                                
017835,000065: 22,3066           21661                           MSU      BCDU                                  #  INITIAL S/C ANGLE OR PREVIOUS DESIRED
017836,000066: 22,3067           00006                           EXTEND                                         #  CDU ANGLES
017837,000067: 22,3070           73002                           MP       QUADROT                               
017838,000068: 22,3071           51665                           INDEX    KDPNDX                                
017839,000069: 22,3072           53576                           DXCH     DELCDUX                               #  ANGLE INCREMENTS TO BE ADDED TO

Page 415

017841,000071: 22,3073           51664                           INDEX    KSPNDX                                #  DCDU EVERY TENTH SEC
017842,000072: 22,3074           31666                           CA       NCDU                                  #  BY LEM DAP
017843,000073: 22,3075           51664                           INDEX    KSPNDX                                
017844,000074: 22,3076           57661                           XCH      BCDU                                  
017845,000075: 22,3077           51665                           INDEX    KDPNDX                                
017846,000076: 22,3100           55646                           TS       CDUXD                                 
017847,000077: 22,3101           11664                           CCS      KSPNDX                                
017848,000078: 22,3102           13057                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
017849,000079: 
017850,000080: 22,3103           00003                           RELINT                                         
017851,000081:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
017852,000082: 
017853,000083: 22,3104           03115        TMANUCHK           TC       TIMECHK                               
017854,000084: 22,3105           04701                           TC       POSTJUMP                              
017855,000085: 22,3106           40131                           CADR     CONTMANU                              
017856,000086: 
017857,000087: 22,3107           35017                           CAF      ONE                                   
017858,000088: 22,3110           05245        MANUSTAL           TC       WAITLIST                              
017859,000089: 22,3111  E6,1661                                  EBANK=   BCDU                                  
017860,000090: 22,3111           02000 42066                     2CADR    MANUSTOP                              
017861,000091: 
017862,000092: 22,3113           00003                           RELINT                                         
017863,000093: 22,3114           15217                           TCF      ENDOFJOB                              
017864,000094: 
017865,000095: 
017866,000096: 22,3115           00006        TIMECHK            EXTEND                                         
017867,000097: 22,3116           40025                           DCS      TIME2                                 
017868,000098: 22,3117           53673                           DXCH     TTEMP                                 
017869,000099: 22,3120           00006                           EXTEND                                         
017870,000100: 22,3121           31717                           DCA      TM                                    
017871,000101: 22,3122           21673                           DAS      TTEMP                                 
017872,000102: 22,3123           11672                           CCS      TTEMP                                 
017873,000103: 22,3124           00002                           TC       Q                                     
017874,000104: 22,3125           13127                           TCF      +2                                    
017875,000105: 22,3126           13137                           TCF      2NDRETRN                              
017876,000106: 22,3127           11673                           CCS      TTEMP      +1                         
017877,000107: 22,3130           00002                           TC       Q                                     
017878,000108: 22,3131           13133                           TCF      MANUOFF                               
017879,000109: 22,3132           40000                           COM                                            
017880,000110: 22,3133           65041        MANUOFF            AD       1SEC                                  
017881,000111: 22,3134           00006                           EXTEND                                         
017882,000112: 22,3135           63137                           BZMF     2NDRETRN                              
017883,000113: 22,3136           24002                           INCR     Q                                     
017884,000114: 22,3137           24002        2NDRETRN           INCR     Q                                     
017885,000115: 22,3140           24002                           INCR     Q                                     
017886,000116: 22,3141           00002                           TC       Q                                     
017887,000117: 
017888,000118: 20,2000                                           SETLOC   MANUSTUF                              
017889,000119: 20,2000                                           BANK                                           

Page 416

017891,000121: 20,2065           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE
017892,000122: 20,2066           00006                           EXTEND                                         #  FOR AUTOMATIC MANEUVERS
017893,000123: 20,2067           30025                           DCA      TIME2                                 
017894,000124: 20,2070           21717                           DAS      TM                                    #  TM+T0    MANEUVER COMPLETION TIME
017895,000125: 20,2071           45041                           CS       1SEC                                  
017896,000126: 20,2072           54001                           TS       L                                     
017897,000127: 20,2073           45021                           CS       ZERO                                  
017898,000128: 20,2074           21717                           DAS      TM                                    #  (TM+T0)-1
017899,000129: 20,2075           00004                           INHINT                                         
017900,000130: 20,2076           45017                           CS       ONE                                   #  ENABLE AUTOPILOT TO PERFORM
017901,000131: 20,2077           55332                           TS       HOLDFLAG                              #  AUTOMATIC MANEUVERS
017902,000132: 20,2100           41130                           CS       RATEINDX                              #  SEE IF MANEUVERING AT HIGH RATE
017903,000133: 20,2101           66211                           AD       SIX                                   
017904,000134: 20,2102           00006                           EXTEND                                         
017905,000135: 20,2103           62105                           BZMF     HIGHGAIN                              
017906,000136: 20,2104           12110                           TCF      +4                                    
017907,000137: 20,2105           41501        HIGHGAIN           CS       RCSFLAGS                              #  IF SO, SET HIGH RATE FLAG (BIT 15 OF
017908,000138: 20,2106           75001                           MASK     BIT15                                 #  RCSFLAGS)
017909,000139: 20,2107           27501                           ADS      RCSFLAGS                              
017910,000140: 20,2110           53711                           DXCH     BRATE                                 #  X-AXIS MANEUVER RATE
017911,000141: 20,2111           53526                           DXCH     WBODY                                 
017912,000142: 20,2112           53713                           DXCH     BRATE      +2                         #  Y-AXIS MANEUVER RATE
017913,000143: 20,2113           53530                           DXCH     WBODY1                                
017914,000144: 20,2114           53715                           DXCH     BRATE      +4                         #  Z-AXIS MANEUVER RATE
017915,000145: 20,2115           53532                           DXCH     WBODY2                                
017916,000146: 20,2116           31675                           CA       BIASTEMP   +1                         #  INSERT ATTITUDE ERROR BIASES
017917,000147: 20,2117           55564                           TS       BIAS                                  #  INTO AUTOPILOT
017918,000148: 20,2120           31677                           CA       BIASTEMP   +3                         
017919,000149: 20,2121           55565                           TS       BIAS1                                 
017920,000150: 20,2122           31701                           CA       BIASTEMP   +5                         
017921,000151: 20,2123           55566                           TS       BIAS2                                 
017922,000152: 20,2124           30025                           CA       TIME1                                 
017923,000153: 20,2125           65041                           AD       1SEC                                  
017924,000154: 20,2126           57671                           XCH      NEXTIME                               
017925,000155: 20,2127           04701                           TC       POSTJUMP                              
017926,000156: 20,2130           45056                           CADR     INCRDCDU   -1                         
017927,000157: 
017928,000158: 20,2131           00004        CONTMANU           INHINT                                         #  CONTINUE WITH UPDATE PROCESS
017929,000159: 20,2132           40025                           CS       TIME1                                 
017930,000160: 20,2133           61671                           AD       NEXTIME                               
017931,000161: 20,2134           10000                           CCS      A                                     
017932,000162: 20,2135           65017                           AD       ONE                                   
017933,000163: 20,2136           12141                           TCF      MANUCALL                              
017934,000164: 20,2137           65001                           AD       NEGMAX                                
017935,000165: 20,2140           40000                           COM                                            
017936,000166: 20,2141           05245        MANUCALL           TC       WAITLIST                              
017937,000167: 20,2142  E6,1661                                  EBANK=   BCDU                                  
017938,000168: 20,2142           02150 40066                     2CADR    UPDTCALL                              
017939,000169: 
017940,000170: 20,2144           00003                           RELINT                                         

Page 417

017942,000172: 20,2145           35041                           CAF      1SEC                                  #  INCREMENT TIME FOR NEXT UPDATE
017943,000173: 20,2146           27671                           ADS      NEXTIME                               
017944,000174: 20,2147           15217                           TCF      ENDOFJOB                              
017945,000175: 
017946,000176: 
017947,000177: 20,2150           37663        UPDTCALL           CAF      PRIO26                                #  CALL FOR UPDATE
017948,000178: 20,2151           05147                           TC       FINDVAC                               #  OF STEERING COMMANDS
017949,000179: 20,2152  E6,1661                                  EBANK=   BCDU                                  
017950,000180: 20,2152           03026 44066                     2CADR    NEWDELHI                              
017951,000181: 
017952,000182: 20,2154           05324                           TC       TASKOVER                              
017953,000183: 

Page 418

017955,000185:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
017956,000186: 
017957,000187: 21,2000                                           SETLOC   KALCMON3                              
017958,000188: 21,2000                                           BANK                                           
017959,000189: 
017960,000190: 21,2000           04537        MANUSTOP           TC       STOPYZ                                
017961,000191: 21,2001           04740                           TC       IBNKCALL                              
017962,000192: 21,2002           45144                           CADR     LOADYZ                                
017963,000193: 
017964,000194: 21,2003           31155        ENDROLL            CA       CPHI                                  
017965,000195: 21,2004           55646                           TS       CDUXD                                 #  SET CDUXD TO THE COMMANDED OUTER GIMBAL
017966,000196: 21,2005           04526                           TC       STOPRATE                              
017967,000197: 21,2006           31327        ENDMANU            CA       ATTPRIO                               #  RESTORE USERS PRIORITY
017968,000198: 21,2007           54063                           TS       NEWPRIO                               
017969,000199: 
017970,000200: 21,2010           35021                           CA       ZERO                                  #  ZERO ATTCADR
017971,000201: 21,2011           53326                           DXCH     ATTCADR                               
017972,000202: 
017973,000203: 21,2012           05160                           TC       SPVAC                                 #  RETURN TO USER OF GOMANUR
017974,000204: 
017975,000205: 21,2013           05324                           TC       TASKOVER                              
017976,000206: 
017977,000207:    4000                                           SETLOC   STOPRAT                               
017978,000208:    4000                                           BANK                                           
017979,000209:    4526           35021        STOPRATE           CAF      ZERO                                  
017980,000210:    4527           55575                           TS       DELCDUX                               
017981,000211:    4530           55576                           TS       DELCDUX    +1                         #  ZERO ROLL INCREMENTAL ANGLES
017982,000212:    4531           55525                           TS       WBODY                                 #  RATE
017983,000213:    4532           55526                           TS       WBODY      +1                         
017984,000214:    4533           55564                           TS       BIAS                                  #  BIAS
017985,000215: 
017986,000216:    4534           45001                           CS       BIT15                                 #  MAKE SURE HIGH RATE FLAG (BIT 15 OF
017987,000217:    4535           71501                           MASK     RCSFLAGS                              #  RCSFLAGS) IS RESET.
017988,000218:    4536           55501                           TS       RCSFLAGS                              
017989,000219: 
017990,000220:    4537           35021        STOPYZ             CAF      ZERO                                  
017991,000221:    4540           55577                           TS       DELCDUY                               #  ZERO PITCH, YAW
017992,000222:    4541           55600                           TS       DELCDUY    +1                         #  INCREMENTAL ANGLES
017993,000223:    4542           55601                           TS       DELCDUZ                               
017994,000224:    4543           55602                           TS       DELCDUZ    +1                         
017995,000225:    4544           55527                           TS       WBODY1                                #  RATES
017996,000226:    4545           55530                           TS       WBODY1     +1                         
017997,000227:    4546           55531                           TS       WBODY2                                
017998,000228:    4547           55532                           TS       WBODY2     +1                         
017999,000229:    4550           55565                           TS       BIAS1                                 #  BIASES
018000,000230:    4551           55566                           TS       BIAS2                                 
018001,000231:    4552           00002                           TC       Q                                     
018002,000232: 
018003,000233: 20,2000                                           SETLOC   MANUSTUF                              
018004,000234: 20,2000                                           BANK                                           
018005,000235: 

Page 419

018007,000237: 20,2155           30032        ZEROEROR           CA       CDUX                                  #  PICK UP CDU ANGLES AND STORE IN
018008,000238: 20,2156           55646                           TS       CDUXD                                 #  CDU DESIRED
018009,000239: 20,2157           30033                           CA       CDUY                                  
018010,000240: 20,2160           55650                           TS       CDUYD                                 
018011,000241: 20,2161           30034                           CA       CDUZ                                  
018012,000242: 20,2162           55652                           TS       CDUZD                                 
018013,000243: 20,2163           00002                           TC       Q                                     
018014,000244: 
018015,000245: 22,2000                                           SETLOC   KALCMON1                              
018016,000246: 22,2000                                           BANK                                           
018017,000247: 
018018,000248: 22,3142           31155        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
018019,000249: 22,3143           55646                           TS       CDUXD                                 #  COMMAND ANGLES
018020,000250: 22,3144           31156        LOADYZ             CA       CTHETA                                
018021,000251: 22,3145           55650                           TS       CDUYD                                 
018022,000252: 22,3146           31157                           CA       CPSI                                  
018023,000253: 22,3147           55652                           TS       CDUZD                                 
018024,000254: 22,3150           00002                           TC       Q                                     

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