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.

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

Page 405

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

Page 406

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

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