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.

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

Page 405

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

Page 406

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

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