Source Code

These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3), the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72/3 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

017502,000002:                                                                                                  ## Copyright:   Public domain.
017503,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
017504,000004:                                                                                                  ## Purpose:     A section of Manche72 revision 3.
017505,000005:                                                                                                  ##              It is part of the reconstructed source code for the final, flown
017506,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
017507,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
017508,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
017509,000009:                                                                                                  ##              from a reconstructed copy of Comanche 072. It has been adapted
017510,000010:                                                                                                  ##              such that the resulting bugger words exactly match those
017511,000011:                                                                                                  ##              specified for Manche72 revision 3 in NASA drawing 2021153G,
017512,000012:                                                                                                  ##              which gives relatively high confidence that the reconstruction
017513,000013:                                                                                                  ##              is correct.
017514,000014:                                                                                                  ## Assembler:   yaYUL
017515,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017516,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017517,000017:                                                                                                  ## Mod history: 2024-05-19 MAS  Created from Comanche 072.
017518,000018: 
017519,000019:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
017520,000020: 
017521,000021:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
017522,000022: 
017523,000023: 15,2000                                           BANK     15                                    
017524,000024: 
017525,000025: 22,2000                                           SETLOC   KALCMON1                              
017526,000026: 22,2000                                           BANK                                           
017527,000027: 
017528,000028: 22,3026  E6,1661                                  EBANK=   BCDU                                  
017529,000029: 
017530,000030: 22,3026                                           COUNT    22/KALC                               
017531,000031: 
017532,000032: 22,3026           41332        NEWDELHI           CS       HOLDFLAG                              #  SEE IF MANEUVER HAS BEEN INTERRUPTED
017533,000033: 22,3027           00006                           EXTEND                                         #  BY ASTRONAUT
017534,000034: 22,3030           62726                           BZMF     NOGO       -2                         #  IF SO, TERMINATE KALCMANU
017535,000035: 22,3031           06006        NEWANGL            TC       INTPRET                               
017536,000036: 22,3032           75160                           AXC,1    AXC,2                                 
017537,000037: 22,3033           03320                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
017538,000038: 22,3034           03425                                    DEL                                   #  STABLE MEMBER AXES
017539,000039: 22,3035           77624                           CALL                                           
017540,000040: 22,3036           44304                                    MXM3                                  
017541,000041: 22,3037           45575                           VLOAD    STADR                                 
017542,000042: 22,3040           50442                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
017543,000043: 22,3041           77626                           STADR                                          
017544,000044: 22,3042           50450                           STOVL    MIS        +6D                        
017545,000045: 22,3043           77626                           STADR                                          
017546,000046: 22,3044           74456                           STORE    MIS                                   
017547,000047: 22,3045           45160                           AXC,1    CALL                                  
017548,000048: 22,3046           03320                                    MIS                                   
017549,000049: 22,3047           44655                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
017550,000050: 22,3050           77634                           RTB                                            
017551,000051: 22,3051           45552                                    V1STO2S                               
017552,000052: 22,3052           03267                           STORE    NCDU                                  #  NEW CDU ANGLES
017553,000053: 22,3053           77414                           BONCLR   EXIT                                  
017554,000054: 22,3054           01215                                    CALCMAN2                              
017555,000055: 22,3055           40065                                    MANUSTAT                              #  TO START MANEUVER
017556,000056: 22,3056           35032                           CAF      TWO                                   #           +0 OTHERWISE
017557,000057: 22,3057           55664        INCRDCDU           TS       KSPNDX                                
017558,000058: 22,3060           60000                           DOUBLE                                         
017559,000059: 22,3061           55665                           TS       KDPNDX                                
017560,000060: 22,3062           51664                           INDEX    KSPNDX                                
017561,000061: 22,3063           31666                           CA       NCDU                                  #  NEW DESIRED CDU ANGLES
017562,000062: 22,3064           00006                           EXTEND                                         
017563,000063: 22,3065           51664                           INDEX    KSPNDX                                
017564,000064: 22,3066           21661                           MSU      BCDU                                  #  INITIAL S/C ANGLE OR PREVIOUS DESIRED
017565,000065: 22,3067           00006                           EXTEND                                         #  CDU ANGLES
017566,000066: 22,3070           73002                           MP       QUADROT                               
017567,000067: 22,3071           51665                           INDEX    KDPNDX                                
017568,000068: 22,3072           53576                           DXCH     DELCDUX                               #  ANGLE INCREMENTS TO BE ADDED TO
017569,000069: 22,3073           51664                           INDEX    KSPNDX                                #  DCDU EVERY TENTH SEC
017570,000070: 22,3074           31666                           CA       NCDU                                  #  BY LEM DAP
017571,000071: 22,3075           51664                           INDEX    KSPNDX                                
017572,000072: 22,3076           57661                           XCH      BCDU                                  
017573,000073: 22,3077           51665                           INDEX    KDPNDX                                
017574,000074: 22,3100           55646                           TS       CDUXD                                 
017575,000075: 22,3101           11664                           CCS      KSPNDX                                
017576,000076: 22,3102           13057                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
017577,000077: 
017578,000078: 22,3103           00003                           RELINT                                         
017579,000079:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
017580,000080: 
017581,000081: 22,3104           03115        TMANUCHK           TC       TIMECHK                               
017582,000082: 22,3105           04715                           TC       POSTJUMP                              
017583,000083: 22,3106           40131                           CADR     CONTMANU                              
017584,000084: 
017585,000085: 22,3107           35033                           CAF      ONE                                   
017586,000086: 22,3110           05261        MANUSTAL           TC       WAITLIST                              
017587,000087: 22,3111  E6,1661                                  EBANK=   BCDU                                  
017588,000088: 22,3111           02012 42066                     2CADR    MANUSTOP                              
017589,000089: 
017590,000090: 22,3113           00003                           RELINT                                         
017591,000091: 22,3114           15233                           TCF      ENDOFJOB                              
017592,000092: 
017593,000093: 
017594,000094: 22,3115           00006        TIMECHK            EXTEND                                         
017595,000095: 22,3116           40025                           DCS      TIME2                                 
017596,000096: 22,3117           53673                           DXCH     TTEMP                                 
017597,000097: 22,3120           00006                           EXTEND                                         
017598,000098: 22,3121           31717                           DCA      TM                                    
017599,000099: 22,3122           21673                           DAS      TTEMP                                 
017600,000100: 22,3123           11672                           CCS      TTEMP                                 
017601,000101: 22,3124           00002                           TC       Q                                     
017602,000102: 22,3125           13127                           TCF      +2                                    
017603,000103: 22,3126           13137                           TCF      2NDRETRN                              
017604,000104: 22,3127           11673                           CCS      TTEMP      +1                         
017605,000105: 22,3130           00002                           TC       Q                                     
017606,000106: 22,3131           13133                           TCF      MANUOFF                               
017607,000107: 22,3132           40000                           COM                                            
017608,000108: 22,3133           65055        MANUOFF            AD       1SEC                                  
017609,000109: 22,3134           00006                           EXTEND                                         
017610,000110: 22,3135           63137                           BZMF     2NDRETRN                              
017611,000111: 22,3136           24002                           INCR     Q                                     
017612,000112: 22,3137           24002        2NDRETRN           INCR     Q                                     
017613,000113: 22,3140           24002                           INCR     Q                                     
017614,000114: 22,3141           00002                           TC       Q                                     
017615,000115: 
017616,000116: 20,2000                                           SETLOC   MANUSTUF                              
017617,000117: 20,2000                                           BANK                                           
017618,000118: 20,2065           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE
017619,000119: 20,2066           00006                           EXTEND                                         #  FOR AUTOMATIC MANEUVERS
017620,000120: 20,2067           30025                           DCA      TIME2                                 
017621,000121: 20,2070           21717                           DAS      TM                                    #  TM+T0    MANEUVER COMPLETION TIME
017622,000122: 20,2071           45055                           CS       1SEC                                  
017623,000123: 20,2072           54001                           TS       L                                     
017624,000124: 20,2073           45035                           CS       ZERO                                  
017625,000125: 20,2074           21717                           DAS      TM                                    #  (TM+T0)-1
017626,000126: 20,2075           00004                           INHINT                                         
017627,000127: 20,2076           45033                           CS       ONE                                   #  ENABLE AUTOPILOT TO PERFORM
017628,000128: 20,2077           55332                           TS       HOLDFLAG                              #  AUTOMATIC MANEUVERS
017629,000129: 20,2100           41130                           CS       RATEINDX                              #  SEE IF MANEUVERING AT HIGH RATE
017630,000130: 20,2101           66211                           AD       SIX                                   
017631,000131: 20,2102           00006                           EXTEND                                         
017632,000132: 20,2103           62105                           BZMF     HIGHGAIN                              
017633,000133: 20,2104           12110                           TCF      +4                                    
017634,000134: 20,2105           41501        HIGHGAIN           CS       RCSFLAGS                              #  IF SO, SET HIGH RATE FLAG (BIT 15 OF
017635,000135: 20,2106           75015                           MASK     BIT15                                 #  RCSFLAGS)
017636,000136: 20,2107           27501                           ADS      RCSFLAGS                              
017637,000137: 20,2110           53711                           DXCH     BRATE                                 #  X-AXIS MANEUVER RATE
017638,000138: 20,2111           53526                           DXCH     WBODY                                 
017639,000139: 20,2112           53713                           DXCH     BRATE      +2                         #  Y-AXIS MANEUVER RATE
017640,000140: 20,2113           53530                           DXCH     WBODY1                                
017641,000141: 20,2114           53715                           DXCH     BRATE      +4                         #  Z-AXIS MANEUVER RATE
017642,000142: 20,2115           53532                           DXCH     WBODY2                                
017643,000143: 20,2116           31675                           CA       BIASTEMP   +1                         #  INSERT ATTITUDE ERROR BIASES
017644,000144: 20,2117           55564                           TS       BIAS                                  #  INTO AUTOPILOT
017645,000145: 20,2120           31677                           CA       BIASTEMP   +3                         
017646,000146: 20,2121           55565                           TS       BIAS1                                 
017647,000147: 20,2122           31701                           CA       BIASTEMP   +5                         
017648,000148: 20,2123           55566                           TS       BIAS2                                 
017649,000149: 20,2124           30025                           CA       TIME1                                 
017650,000150: 20,2125           65055                           AD       1SEC                                  
017651,000151: 20,2126           57671                           XCH      NEXTIME                               
017652,000152: 20,2127           04715                           TC       POSTJUMP                              
017653,000153: 20,2130           45056                           CADR     INCRDCDU   -1                         
017654,000154: 
017655,000155: 20,2131           00004        CONTMANU           INHINT                                         #  CONTINUE WITH UPDATE PROCESS
017656,000156: 20,2132           40025                           CS       TIME1                                 
017657,000157: 20,2133           61671                           AD       NEXTIME                               
017658,000158: 20,2134           10000                           CCS      A                                     
017659,000159: 20,2135           65033                           AD       ONE                                   
017660,000160: 20,2136           12141                           TCF      MANUCALL                              
017661,000161: 20,2137           65015                           AD       NEGMAX                                
017662,000162: 20,2140           40000                           COM                                            
017663,000163: 20,2141           05261        MANUCALL           TC       WAITLIST                              
017664,000164: 20,2142  E6,1661                                  EBANK=   BCDU                                  
017665,000165: 20,2142           02150 40066                     2CADR    UPDTCALL                              
017666,000166: 
017667,000167: 20,2144           00003                           RELINT                                         
017668,000168: 20,2145           35055                           CAF      1SEC                                  #  INCREMENT TIME FOR NEXT UPDATE
017669,000169: 20,2146           27671                           ADS      NEXTIME                               
017670,000170: 20,2147           15233                           TCF      ENDOFJOB                              
017671,000171: 
017672,000172: 
017673,000173: 20,2150           37663        UPDTCALL           CAF      PRIO26                                #  CALL FOR UPDATE
017674,000174: 20,2151           05163                           TC       FINDVAC                               #  OF STEERING COMMANDS
017675,000175: 20,2152  E6,1661                                  EBANK=   BCDU                                  
017676,000176: 20,2152           03026 44066                     2CADR    NEWDELHI                              
017677,000177: 
017678,000178: 20,2154           05340                           TC       TASKOVER                              
017679,000179: 
017680,000180:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
017681,000181: 
017682,000182: 21,2000                                           SETLOC   KALCMON3                              
017683,000183: 21,2000                                           BANK                                           
017684,000184: 
017685,000185: 21,2012           04537        MANUSTOP           TC       STOPYZ                                
017686,000186: 21,2013           04754                           TC       IBNKCALL                              
017687,000187: 21,2014           45144                           CADR     LOADYZ                                
017688,000188: 
017689,000189: 21,2015           31155        ENDROLL            CA       CPHI                                  
017690,000190: 21,2016           55646                           TS       CDUXD                                 #  SET CDUXD TO THE COMMANDED OUTER GIMBAL
017691,000191: 21,2017           04526                           TC       STOPRATE                              
017692,000192: 21,2020           31327        ENDMANU            CA       ATTPRIO                               #  RESTORE USERS PRIORITY
017693,000193: 21,2021           54063                           TS       NEWPRIO                               
017694,000194: 
017695,000195: 21,2022           35035                           CA       ZERO                                  #  ZERO ATTCADR
017696,000196: 21,2023           53326                           DXCH     ATTCADR                               
017697,000197: 
017698,000198: 21,2024           05174                           TC       SPVAC                                 #  RETURN TO USER OF GOMANUR
017699,000199: 
017700,000200: 21,2025           05340                           TC       TASKOVER                              
017701,000201: 
017702,000202:    4000                                           SETLOC   STOPRAT                               
017703,000203:    4000                                           BANK                                           
017704,000204:    4526           35035        STOPRATE           CAF      ZERO                                  
017705,000205:    4527           55575                           TS       DELCDUX                               
017706,000206:    4530           55576                           TS       DELCDUX    +1                         #  ZERO ROLL INCREMENTAL ANGLES
017707,000207:    4531           55525                           TS       WBODY                                 #  RATE
017708,000208:    4532           55526                           TS       WBODY      +1                         
017709,000209:    4533           55564                           TS       BIAS                                  #  BIAS
017710,000210: 
017711,000211:    4534           45015                           CS       BIT15                                 #  MAKE SURE HIGH RATE FLAG (BIT 15 OF
017712,000212:    4535           71501                           MASK     RCSFLAGS                              #  RCSFLAGS) IS RESET.
017713,000213:    4536           55501                           TS       RCSFLAGS                              
017714,000214: 
017715,000215:    4537           35035        STOPYZ             CAF      ZERO                                  
017716,000216:    4540           55577                           TS       DELCDUY                               #  ZERO PITCH, YAW
017717,000217:    4541           55600                           TS       DELCDUY    +1                         #  INCREMENTAL ANGLES
017718,000218:    4542           55601                           TS       DELCDUZ                               
017719,000219:    4543           55602                           TS       DELCDUZ    +1                         
017720,000220:    4544           55527                           TS       WBODY1                                #  RATES
017721,000221:    4545           55530                           TS       WBODY1     +1                         
017722,000222:    4546           55531                           TS       WBODY2                                
017723,000223:    4547           55532                           TS       WBODY2     +1                         
017724,000224:    4550           55565                           TS       BIAS1                                 #  BIASES
017725,000225:    4551           55566                           TS       BIAS2                                 
017726,000226:    4552           00002                           TC       Q                                     
017727,000227: 
017728,000228: 20,2000                                           SETLOC   MANUSTUF                              
017729,000229: 20,2000                                           BANK                                           
017730,000230: 
017731,000231: 20,2155           30032        ZEROEROR           CA       CDUX                                  #  PICK UP CDU ANGLES AND STORE IN
017732,000232: 20,2156           55646                           TS       CDUXD                                 #  CDU DESIRED
017733,000233: 20,2157           30033                           CA       CDUY                                  
017734,000234: 20,2160           55650                           TS       CDUYD                                 
017735,000235: 20,2161           30034                           CA       CDUZ                                  
017736,000236: 20,2162           55652                           TS       CDUZD                                 
017737,000237: 20,2163           00002                           TC       Q                                     
017738,000238: 
017739,000239: 22,2000                                           SETLOC   KALCMON1                              
017740,000240: 22,2000                                           BANK                                           
017741,000241: 
017742,000242: 22,3142           31155        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
017743,000243: 22,3143           55646                           TS       CDUXD                                 #  COMMAND ANGLES
017744,000244: 22,3144           31156        LOADYZ             CA       CTHETA                                
017745,000245: 22,3145           55650                           TS       CDUYD                                 
017746,000246: 22,3146           31157                           CA       CPSI                                  
017747,000247: 22,3147           55652                           TS       CDUZD                                 
017748,000248: 22,3150           00002                           TC       Q                                     

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