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.

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

Page 407

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

Page 408

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

Page 409

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

Page 410

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

Page 411

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

Page 412

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

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