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.

017758,000002:                                                                                                  ## Copyright:   Public domain.
017759,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
017760,000004:                                                                                                  ## Purpose:     A section of Comanche revision 045.
017761,000005:                                                                                                  ##              It is part of the reconstructed source code for the
017762,000006:                                                                                                  ##              second release of the flight software for the Command
017763,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
017764,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
017765,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
017766,000010:                                                                                                  ##              exactly match those specified for Comanche 45 in NASA drawing
017767,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
017768,000012:                                                                                                  ##              reconstruction is correct.
017769,000013:                                                                                                  ## Assembler:   yaYUL
017770,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017771,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017772,000016:                                                                                                  ## Mod history: 2020-12-06 MAS  Created from Comanche 44.
017773,000017:                                                                                                  ##              2021-05-30 ABS  ZEROERROR -> ZEROEROR
017774,000018: 

Page 414

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

Page 415

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

Page 416

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

Page 417

017928,000172: 20,2145           35041                           CAF      1SEC                                  #  INCREMENT TIME FOR NEXT UPDATE
017929,000173: 20,2146           27671                           ADS      NEXTIME                               
017930,000174: 20,2147           15217                           TCF      ENDOFJOB                              
017931,000175: 
017932,000176: 
017933,000177: 20,2150           37663        UPDTCALL           CAF      PRIO26                                #  CALL FOR UPDATE
017934,000178: 20,2151           05147                           TC       FINDVAC                               #  OF STEERING COMMANDS
017935,000179: 20,2152  E6,1661                                  EBANK=   BCDU                                  
017936,000180: 20,2152           03026 44066                     2CADR    NEWDELHI                              
017937,000181: 
017938,000182: 20,2154           05324                           TC       TASKOVER                              
017939,000183: 

Page 418

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

Page 419

017993,000237: 20,2155           30032        ZEROEROR           CA       CDUX                                  #  PICK UP CDU ANGLES AND STORE IN
017994,000238: 20,2156           55646                           TS       CDUXD                                 #  CDU DESIRED
017995,000239: 20,2157           30033                           CA       CDUY                                  
017996,000240: 20,2160           55650                           TS       CDUYD                                 
017997,000241: 20,2161           30034                           CA       CDUZ                                  
017998,000242: 20,2162           55652                           TS       CDUZD                                 
017999,000243: 20,2163           00002                           TC       Q                                     
018000,000244: 
018001,000245: 22,2000                                           SETLOC   KALCMON1                              
018002,000246: 22,2000                                           BANK                                           
018003,000247: 
018004,000248: 22,3142           31155        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
018005,000249: 22,3143           55646                           TS       CDUXD                                 #  COMMAND ANGLES
018006,000250: 22,3144           31156        LOADYZ             CA       CTHETA                                
018007,000251: 22,3145           55650                           TS       CDUYD                                 
018008,000252: 22,3146           31157                           CA       CPSI                                  
018009,000253: 22,3147           55652                           TS       CDUZD                                 
018010,000254: 22,3150           00002                           TC       Q                                     

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