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.

017860,000002:                                                                                                  ## Copyright:   Public domain.
017861,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
017862,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
017863,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
017864,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
017865,000007:                                                                                                  ## Assembler:   yaYUL
017866,000008:                                                                                                  ## Reference:   pp. 405-406.
017867,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017868,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo.
017869,000011:                                                                                                  ## Mod history: 08/10/04 RSB.   Began transcribing.
017870,000012:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
017871,000013:                                                                                                  ##                              original harcopy, as opposed to the PDF page
017872,000014:                                                                                                  ##                              numbers in 1701.pdf.
017873,000015:                                                                                                  ##              2017-01-14 RSB  Cross-diff'd comment text (not whitespace)
017874,000016:                                                                                                  ##                              vs the already-proofed corresponding Colossus
017875,000017:                                                                                                  ##                              237 and Comanche 55 source-code files
017876,000018:                                                                                                  ##                              and corrected errors found.
017877,000019:                                                                                                  ##
017878,000020:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
017879,000021:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
017880,000022:                                                                                                  ## document read, in part:
017881,000023:                                                                                                  ##
017882,000024:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
017883,000025:                                                                                                  ##      2021111-041.  October 28, 1968.  
017884,000026:                                                                                                  ##
017885,000027:                                                                                                  ##      This AGC program shall also be referred to as
017886,000028:                                                                                                  ##                              Colossus 1A
017887,000029:                                                                                                  ##
017888,000030:                                                                                                  ##      Prepared by
017889,000031:                                                                                                  ##                      Massachusetts Institute of Technology
017890,000032:                                                                                                  ##                      75 Cambridge Parkway
017891,000033:                                                                                                  ##                      Cambridge, Massachusetts
017892,000034:                                                                                                  ##      under NASA contract NAS 9-4065.
017893,000035:                                                                                                  ##
017894,000036:                                                                                                  ## Refer directly to the online document mentioned above for further information.
017895,000037:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
017896,000038:                                                                                                  ##
017897,000039:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
017898,000040:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
017899,000041:                                                                                                  ## source file, and then is proofed to incorporate any changes.
017900,000042: 

Page 405

017902,000044: 15,2000                                           BANK     15                                    
017903,000045: 
017904,000046: 22,2000                                           SETLOC   KALCMON1                              
017905,000047: 22,2000                                           BANK                                           
017906,000048: 
017907,000049: 22,2736  E6,1661                                  EBANK=   BCDU                                  
017908,000050: 
017909,000051:                                                                                                  #  DETECTING GIMBAL LOCK
017910,000052: 22,2736  22,2736               LOCSKIRT           EQUALS   NOGIMLOC                              
017911,000053: 
017912,000054: 22,2736           77614        NOGIMLOC           SET                                            
017913,000055: 22,2737           01074                                    CALCMAN3                              
017914,000056: 22,2740           70740        WCALC              LXC,1    DLOAD*                                
017915,000057: 22,2741           01130                                    RATEINDX                              
017916,000058: 22,2742           04772                                    ARATE,1                               
017917,000059: 22,2743           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017918,000060: 22,2744           44530                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017919,000061:                                                                                                  #  ABOUT COF
017920,000062: 22,2745           74343                           DLOAD*   VXSC                                  
017921,000063: 22,2746           04772                                    ARATE,1                               
017922,000064: 22,2747           03343                                    COF                                   
017923,000065: 22,2750           77721                           MXV                                            
017924,000066: 22,2751           05004                                    QUADROT                               
017925,000067: 
017926,000068: 22,2752           17311                           STODL    BRATE                                 
017927,000069: 22,2753           03365                                    AM                                    
017928,000070: 22,2754           55605                           DMP      DDV*                                  
017929,000071: 22,2755           05002                                    ANGLTIME                              
017930,000072: 22,2756           04772                                    ARATE,1                               
017931,000073: 22,2757           77661                           SR                                             
017932,000074: 22,2760           20606                                    5                                     
017933,000075: 22,2761           27317                           STOVL    TM                                    
017934,000076: 22,2762           03311                                    BRATE                                 
017935,000077: 22,2763           77761                           VXSC                                           
017936,000078: 22,2764           05026                                    BIASCALE                              
017937,000079: 22,2765           03275                           STORE    BIASTEMP                              #  ATTITUDE ERROR BIAS TO PREVENT OVERSHOOT
017938,000080:                                                                                                  #  IN SYSTEM
017939,000081: 22,2766           77614                           SETGO                                          #  STATE SWITCH CALCMAN2 (43D)
017940,000082: 22,2767           01035                                    CALCMAN2                              #  0(OFF) = BYPASS STARTING PROCEDURE
017941,000083: 22,2770           45033                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
017942,000084: 
017943,000085: 22,2771           00044 15053  ARATE              2DEC     .0022222222                            #  = .05 DEG/SEC
017944,000086: 22,2773           00221 24255                     2DEC     .0088888889                            #  = .2 DEG/SEC
017945,000087: 22,2775           00554 02660                     2DEC     .0222222222                            #  = .5 DEG/SEC
017946,000088: 22,2777           05540 26603                     2DEC     .1777777777                            #  = 4 DEG/SEC           $ 22.5 DEG/SEC
017947,000089: 
017948,000090: 22,3001           00003 04000  ANGLTIME           2DEC     .000190735                            #  = 100B-19 
017949,000091:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME

Page 406

017951,000093: 22,3003           03146 14632  QUADROT            2DEC     .1                                    #  ROTATION MATRIX FROM S/C AXES TO CONTROL
017952,000094: 22,3005           00000 00000                     2DEC     0          B-28                       #  AXES (X ROT = -7.25 DEG)
017953,000095: 22,3007           00000 00000                     2DEC     0          B-28                       
017954,000096: 22,3011           00000 00000                     2DEC     0          B-28                       
017955,000097: 22,3013           03131 11275                     2DEC     .099200                               #  = (.1)COS7.25
017956,000098: 22,3015           77461 47370                     2DEC     -.012620                              #  =-(.1)SIN7.25
017957,000099: 22,3017           00000 00000                     2DEC     0          B-28                       
017958,000100: 22,3021           00316 30407                     2DEC     .012620                               #  (.1)SIN7.25
017959,000101: 22,3023           03131 11275                     2DEC     .099200                               #  (.1)COS7.25
017960,000102: 22,3025           00004 05253  BIASCALE           2DEC     .0002543132                            #  = (450/180)(1/0.6)(1/16384)
017961,000103: 
017962,000104: 

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