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.

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

Page 407

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

Page 408

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

Page 409

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

Page 410

018151,000198: 
018152,000199: 22,3225           37663        UPDTCALL           CAF      PRIO26                                #  CALL FOR UPDATE
018153,000200: 22,3226           05042                           TC       FINDVAC                               #  OF STEERING COMMANDS
018154,000201: 22,3227  E6,1661                                  EBANK=   BCDU                                  
018155,000202: 22,3227           03027 44106                     2CADR    NEWDELHI                              
018156,000203: 
018157,000204: 22,3231           05213                           TC       TASKOVER                              
018158,000205: 

Page 411

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

Page 412

018211,000258: 22,3301           31155        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
018212,000259: 22,3302           55646                           TS       CDUXD                                 #  COMMAND ANGLES
018213,000260: 22,3303           31156        LOADYZ             CA       CTHETA                                
018214,000261: 22,3304           55650                           TS       CDUYD                                 
018215,000262: 22,3305           31157                           CA       CPSI                                  
018216,000263: 22,3306           55652                           TS       CDUZD                                 
018217,000264: 22,3307           00002                           TC       Q                                     
018218,000265: 

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