Source Code

This is the source-code for the Apollo 9 Command Module's Guidance Computer. These files were derived originally from the scan from MIT's Dibner Institute's now-discontinued website titled "History of Recent Science and Technology", which in turn was originally created by Gary Neff, though his high-quality scans were unfortunately reduced in legibility when presented online. The markings on the front of the printout imply that it was the original AGC developer Norm Brodeur's copy. A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original AGC developer Fred Martin. The source code was transcribed from those images by Ron Burkey. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

017963,000002:                                                                                                  ## Copyright:   Public domain.
017964,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
017965,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
017966,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
017967,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
017968,000007:                                                                                                  ## Assembler:   yaYUL
017969,000008:                                                                                                  ## Reference:   pp. 407-412.
017970,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017971,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo.
017972,000011:                                                                                                  ## Mod history: 08/10/04 RSB.   Began adapting from corresponding Luminary131
017973,000012:                                                                                                  ##                              source file.
017974,000013:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
017975,000014:                                                                                                  ##                              original harcopy, as opposed to the PDF page
017976,000015:                                                                                                  ##                              numbers in 1701.pdf.
017977,000016:                                                                                                  ##              2017-01-15 RSB  Cross-diff'd comment text (not whitespace)
017978,000017:                                                                                                  ##                              vs the already-proofed corresponding Colossus
017979,000018:                                                                                                  ##                              237 and Comanche 55 source-code files
017980,000019:                                                                                                  ##                              and corrected errors found.  No differences
017981,000020:                                                                                                  ##                              remained afterward.
017982,000021:                                                                                                  ##              2017-01-28 RSB  WTIH -> WITH.
017983,000022:                                                                                                  ##
017984,000023:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
017985,000024:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
017986,000025:                                                                                                  ## document read, in part:
017987,000026:                                                                                                  ##
017988,000027:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
017989,000028:                                                                                                  ##      2021111-041.  October 28, 1968.  
017990,000029:                                                                                                  ##
017991,000030:                                                                                                  ##      This AGC program shall also be referred to as
017992,000031:                                                                                                  ##                              Colossus 1A
017993,000032:                                                                                                  ##
017994,000033:                                                                                                  ##      Prepared by
017995,000034:                                                                                                  ##                      Massachusetts Institute of Technology
017996,000035:                                                                                                  ##                      75 Cambridge Parkway
017997,000036:                                                                                                  ##                      Cambridge, Massachusetts
017998,000037:                                                                                                  ##      under NASA contract NAS 9-4065.
017999,000038:                                                                                                  ##
018000,000039:                                                                                                  ## Refer directly to the online document mentioned above for further information.
018001,000040:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
018002,000041:                                                                                                  ##
018003,000042:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
018004,000043:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
018005,000044:                                                                                                  ## source file, and then is proofed to incorporate any changes.
018006,000045: 

Page 407

018008,000047:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
018009,000048: 
018010,000049:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
018011,000050: 
018012,000051: 15,2000                                           BANK     15                                    
018013,000052: 22,2000                                           SETLOC   KALCMON1                              
018014,000053: 22,2000                                           BANK                                           
018015,000054: 
018016,000055: 22,3027  E6,1661                                  EBANK=   BCDU                                  
018017,000056: 
018018,000057: 22,3027                                           COUNT    22/KALC                               
018019,000058: 
018020,000059: 22,3027           41332        NEWDELHI           CS       HOLDFLAG                              #  SEE IF MANEUVER HAS BEEN INTERRUPTED
018021,000060: 22,3030           00006                           EXTEND                                         #  BY ASTRONAUT
018022,000061: 22,3031           62725                           BZMF     NOGO       -2                         #  IF SO, TERMINATE KALCMANU
018023,000062: 22,3032           06006        NEWANGL            TC       INTPRET                               
018024,000063: 22,3033           75160                           AXC,1    AXC,2                                 
018025,000064: 22,3034           03320                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
018026,000065: 22,3035           03425                                    DEL                                   #  STABLE MEMBER AXES
018027,000066: 22,3036           77624                           CALL                                           
018028,000067: 22,3037           44304                                    MXM3                                  
018029,000068: 22,3040           45575                           VLOAD    STADR                                 
018030,000069: 22,3041           50442                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
018031,000070: 22,3042           77626                           STADR                                          
018032,000071: 22,3043           50450                           STOVL    MIS        +6D                        
018033,000072: 22,3044           77626                           STADR                                          
018034,000073: 22,3045           74456                           STORE    MIS                                   
018035,000074: 22,3046           45160                           AXC,1    CALL                                  
018036,000075: 22,3047           03320                                    MIS                                   
018037,000076: 22,3050           44655                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
018038,000077: 22,3051           77634                           RTB                                            
018039,000078: 22,3052           45547                                    V1STO2S                               
018040,000079: 22,3053           03267                           STORE    NCDU                                  #  NEW CDU ANGLES
018041,000080: 22,3054           77414                           BONCLR   EXIT                                  
018042,000081: 22,3055           01215                                    CALCMAN2                              
018043,000082: 22,3056           45142                                    MANUSTAT                              #  TO START MANEUVER
018044,000083: 22,3057           34711                           CAF      TWO                                   #        +0 OTHERWISE
018045,000084: 22,3060           55664        INCRDCDU           TS       KSPNDX                                
018046,000085: 22,3061           60000                           DOUBLE                                         
018047,000086: 22,3062           55665                           TS       KSPNDX     +1                         
018048,000087: 22,3063           51664                           INDEX    KSPNDX                                
018049,000088: 22,3064           31666                           CA       NCDU                                  #  NEW DESIRED CDU ANGLES
018050,000089: 22,3065           00006                           EXTEND                                         
018051,000090: 22,3066           51664                           INDEX    KSPNDX                                
018052,000091: 22,3067           21661                           MSU      BCDU                                  #  INITIAL S/C ANGLE OR PREVIOUS DESIRED
018053,000092: 22,3070           00006                           EXTEND                                         #  CDU ANGLES
018054,000093: 22,3071           73141                           MP       DT/TAU                                
018055,000094: 22,3072           51665                           INDEX    KDPNDX                                
018056,000095: 22,3073           53576                           DXCH     DELCDUX                               #  ANGLE INCREMENTS TO BE ADDED TO

Page 408

018058,000097: 22,3074           51664                           INDEX    KSPNDX                                #  DCDU EVERY TENTH SEC
018059,000098: 22,3075           31666                           CA       NCDU                                  #  BY LEM DAP
018060,000099: 22,3076           51664                           INDEX    KSPNDX                                
018061,000100: 22,3077           57661                           XCH      BCDU                                  
018062,000101: 22,3100           51665                           INDEX    KSPNDX     +1                         
018063,000102: 22,3101           55646                           TS       CDUXD                                 
018064,000103: 22,3102           11664                           CCS      KSPNDX                                
018065,000104: 22,3103           13060                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
018066,000105: 
018067,000106: 22,3104           00003                           RELINT                                         
018068,000107: 
018069,000108:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
018070,000109: 
018071,000110: 22,3105           03115        TMANUCHK           TC       TIMECHK                               
018072,000111: 22,3106           13206                           TCF      CONTMANU                              
018073,000112: 22,3107           34712                           CAF      ONE                                   
018074,000113: 22,3110           05140        MANUSTAL           TC       WAITLIST                              
018075,000114: 22,3111  E6,1661                                  EBANK=   BCDU                                  
018076,000115: 22,3111           03232 44106                     2CADR    MANUSTOP                              
018077,000116: 
018078,000117: 22,3113           00003                           RELINT                                         
018079,000118: 22,3114           15112                           TCF      ENDOFJOB                              
018080,000119: 
018081,000120: 22,3115           00006        TIMECHK            EXTEND                                         
018082,000121: 22,3116           40025                           DCS      TIME2                                 
018083,000122: 22,3117           53673                           DXCH     TTEMP                                 
018084,000123: 22,3120           00006                           EXTEND                                         
018085,000124: 22,3121           31717                           DCA      TM                                    
018086,000125: 22,3122           21673                           DAS      TTEMP                                 
018087,000126: 22,3123           11672                           CCS      TTEMP                                 
018088,000127: 22,3124           00002                           TC       Q                                     
018089,000128: 22,3125           13127                           TCF      +2                                    
018090,000129: 22,3126           13137                           TCF      2NDRETRN                              
018091,000130: 22,3127           11673                           CCS      TTEMP      +1                         
018092,000131: 22,3130           00002                           TC       Q                                     
018093,000132: 22,3131           13133                           TCF      MANUOFF                               
018094,000133: 22,3132           40000                           COM                                            
018095,000134: 22,3133           63205        MANUOFF            AD       ONESEC     +1                         
018096,000135: 22,3134           00006                           EXTEND                                         
018097,000136: 22,3135           63137                           BZMF     2NDRETRN                              
018098,000137: 22,3136           24002                           INCR     Q                                     
018099,000138: 22,3137           24002        2NDRETRN           INCR     Q                                     
018100,000139: 22,3140           00002                           TC       Q                                     
018101,000140: 
018102,000141: 22,3141           03146        DT/TAU             DEC      .1                                    
018103,000142: 
018104,000143: 22,3142           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE
018105,000144: 22,3143           00006                           EXTEND                                         #  FOR AUTOMATIC MANEUVERS
018106,000145: 22,3144           30025                           DCA      TIME2                                 
018107,000146: 22,3145           21717                           DAS      TM                                    #  TM+T0         MANEUVER COMPLETION TIME
018108,000147: 22,3146           00006                           EXTEND                                         

Page 409

018110,000149: 22,3147           43205                           DCS      ONESEC                                
018111,000150: 22,3150           21717                           DAS      TM                                    #  (TM+T0)-1
018112,000151: 22,3151           00004                           INHINT                                         
018113,000152: 22,3152           44712                           CS       ONE                                   #  ENABLE AUTOPILOT TO PERFORM
018114,000153: 22,3153           55332                           TS       HOLDFLAG                              #  AUTOMATIC MANEUVERS
018115,000154: 22,3154           41130                           CS       RATEINDX                              #  SEE IF MANEUVERING AT HIGH RATE
018116,000155: 22,3155           66211                           AD       SIX                                   
018117,000156: 22,3156           00006                           EXTEND                                         
018118,000157: 22,3157           63161                           BZMF     HIGHGAIN                              
018119,000158: 22,3160           13164                           TCF      +4                                    
018120,000159: 22,3161           41501        HIGHGAIN           CS       RCSFLAGS                              #  IF SO, SET HIGH RATE FLAG (BIT 15 OF
018121,000160: 22,3162           74674                           MASK     BIT15                                 #  RCSFLAGS)
018122,000161: 22,3163           27501                           ADS      RCSFLAGS                              
018123,000162: 22,3164           53711                           DXCH     BRATE                                 #  X-AXIS MANEUVER RATE
018124,000163: 22,3165           53526                           DXCH     WBODY                                 
018125,000164: 22,3166           53713                           DXCH     BRATE      +2                         #  Y-AXIS MANEUVER RATE
018126,000165: 22,3167           53530                           DXCH     WBODY1                                
018127,000166: 22,3170           53715                           DXCH     BRATE      +4                         #  Z-AXIS MANEUVER RATE
018128,000167: 22,3171           53532                           DXCH     WBODY2                                
018129,000168: 22,3172           31675                           CA       BIASTEMP   +1                         #  INSERT ATTITUDE ERROR BIASES
018130,000169: 22,3173           55564                           TS       BIAS                                  #  INTO AUTOPILOT
018131,000170: 22,3174           31677                           CA       BIASTEMP   +3                         
018132,000171: 22,3175           55565                           TS       BIAS1                                 
018133,000172: 22,3176           31701                           CA       BIASTEMP   +5                         
018134,000173: 22,3177           55566                           TS       BIAS2                                 
018135,000174: 22,3200           30025                           CA       TIME1                                 
018136,000175: 22,3201           63205                           AD       ONESEC     +1                         
018137,000176: 22,3202           57671                           XCH      NEXTIME                               
018138,000177: 22,3203           13057                           TCF      INCRDCDU   -1                         
018139,000178: 
018140,000179: 22,3204           00000        ONESEC             DEC      0          B-14                       
018141,000180: 22,3205           00144                           DEC      100        B-14                       
018142,000181: 
018143,000182: 22,3206           00004        CONTMANU           INHINT                                         
018144,000183: 22,3207           40025                           CS       TIME1                                 #  CONTINUE WITH UPDATE PROCESS
018145,000184: 22,3210           61671                           AD       NEXTIME                               
018146,000185: 22,3211           10000                           CCS      A                                     
018147,000186: 22,3212           64712                           AD       ONE                                   
018148,000187: 22,3213           13216                           TCF      MANUCALL                              
018149,000188: 22,3214           64674                           AD       NEGMAX                                
018150,000189: 22,3215           40000                           COM                                            
018151,000190: 22,3216           05140        MANUCALL           TC       WAITLIST                              
018152,000191: 22,3217  E6,1661                                  EBANK=   BCDU                                  
018153,000192: 22,3217           03225 44106                     2CADR    UPDTCALL                              
018154,000193: 22,3221           00003                           RELINT                                         
018155,000194: 22,3222           33205                           CAF      ONESEC     +1                         #  INCREMENT TIME FOR NEXT UPDATE
018156,000195: 22,3223           27671                           ADS      NEXTIME                               
018157,000196: 22,3224           15112                           TCF      ENDOFJOB                              

Page 410

018159,000198: 
018160,000199: 22,3225           37663        UPDTCALL           CAF      PRIO26                                #  CALL FOR UPDATE
018161,000200: 22,3226           05042                           TC       FINDVAC                               #  OF STEERING COMMANDS
018162,000201: 22,3227  E6,1661                                  EBANK=   BCDU                                  
018163,000202: 22,3227           03027 44106                     2CADR    NEWDELHI                              
018164,000203: 
018165,000204: 22,3231           05213                           TC       TASKOVER                              
018166,000205: 

Page 411

018168,000207:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
018169,000208: 
018170,000209: 22,3232           03256        MANUSTOP           TC       STOPYZ                                
018171,000210: 22,3233           03303                           TC       LOADYZ                                
018172,000211: 
018173,000212: 22,3234           31155        ENDROLL            CA       CPHI                                  
018174,000213: 22,3235           55646                           TS       CDUXD                                 #  SET CDUXD TO THE COMMANDED OUTER GIMBAL
018175,000214: 22,3236           03245                           TC       STOPRATE                              
018176,000215: 22,3237           31327        ENDMANU            CA       ATTPRIO                               #  RESTORE USERS PRIORITY
018177,000216: 22,3240           54063                           TS       NEWPRIO                               
018178,000217: 
018179,000218: 22,3241           34714                           CA       ZERO                                  #  ZERO ATTCADR
018180,000219: 22,3242           53326                           DXCH     ATTCADR                               
018181,000220: 
018182,000221: 22,3243           05053                           TC       SPVAC                                 #  RETURN TO USER OF GOMANUR
018183,000222: 
018184,000223: 22,3244           05213                           TC       TASKOVER                              
018185,000224: 
018186,000225: 22,3245           34714        STOPRATE           CAF      ZERO                                  
018187,000226: 22,3246           55575                           TS       DELCDUX                               
018188,000227: 22,3247           55576                           TS       DELCDUX    +1                         #  ZERO ROLL INCREMENTAL ANGLES
018189,000228: 22,3250           55525                           TS       WBODY                                 #  RATE
018190,000229: 22,3251           55526                           TS       WBODY      +1                         
018191,000230: 22,3252           55564                           TS       BIAS                                  #  BIAS
018192,000231: 
018193,000232: 22,3253           44674                           CS       BIT15                                 #  MAKE SURE HIGH RATE FLAG (BIT 15 OF
018194,000233: 22,3254           71501                           MASK     RCSFLAGS                              #  RCSFLAGS) IS RESET.
018195,000234: 22,3255           55501                           TS       RCSFLAGS                              
018196,000235: 
018197,000236: 22,3256           34714        STOPYZ             CAF      ZERO                                  
018198,000237: 22,3257           55577                           TS       DELCDUY                               #  ZERO PITCH, YAW
018199,000238: 22,3260           55600                           TS       DELCDUY    +1                         #  INCREMENTAL ANGLES
018200,000239: 22,3261           55601                           TS       DELCDUZ                               
018201,000240: 22,3262           55602                           TS       DELCDUZ    +1                         
018202,000241: 22,3263           55527                           TS       WBODY1                                #  RATES
018203,000242: 22,3264           55530                           TS       WBODY1     +1                         
018204,000243: 22,3265           55531                           TS       WBODY2                                
018205,000244: 22,3266           55532                           TS       WBODY2     +1                         
018206,000245: 22,3267           55565                           TS       BIAS1                                 #  BIASES
018207,000246: 22,3270           55566                           TS       BIAS2                                 
018208,000247: 22,3271           00002                           TC       Q                                     
018209,000248: 
018210,000249: 22,3272           30032        ZEROERROR           CA       CDUX                                  #  PICK UP CDU ANGLES AND STORE IN
018211,000250: 22,3273           55646                           TS       CDUXD                                 #  CDU DESIRED
018212,000251: 22,3274           30033                           CA       CDUY                                  
018213,000252: 22,3275           55650                           TS       CDUYD                                 
018214,000253: 22,3276           30034                           CA       CDUZ                                  
018215,000254: 22,3277           55652                           TS       CDUZD                                 
018216,000255: 22,3300           00002                           TC       Q                                     
018217,000256: 

Page 412

018219,000258: 22,3301           31155        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
018220,000259: 22,3302           55646                           TS       CDUXD                                 #  COMMAND ANGLES
018221,000260: 22,3303           31156        LOADYZ             CA       CTHETA                                
018222,000261: 22,3304           55650                           TS       CDUYD                                 
018223,000262: 22,3305           31157                           CA       CPSI                                  
018224,000263: 22,3306           55652                           TS       CDUZD                                 
018225,000264: 22,3307           00002                           TC       Q                                     
018226,000265: 

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