Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

016388,000002:                                                                                                  ## Copyright:   Public domain.
016389,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
016390,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
016391,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
016392,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
016393,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
016394,000008:                                                                                                  ##              that the code format has been changed to conform to the
016395,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
016396,000010:                                                                                                  ##              original YUL assembler.
016397,000011:                                                                                                  ## Reference:   p. 376
016398,000012:                                                                                                  ## Assembler:   yaYUL
016399,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
016400,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
016401,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
016402,000016:                                                                                                  ##              2016-11-24 HG   Transcribed
016403,000017:                                                                                                  ##              2016-12-23 RSB  Proofed comment text with octopus/ProoferComments
016404,000018:                                                                                                  ##                              but no errors found.
016405,000019:                                                                                                  ##              2017-08-22 RSB  Fixed comment-text typo identified in ZERLINA 56.
016406,000020: 

Page 376

016408,000022: 15,2162                                           BANK     15                                    
016409,000023: 
016410,000024: 22,2000                                           SETLOC   KALCMON1                              
016411,000025: 22,2000                                           BANK                                           
016412,000026: 
016413,000027: 
016414,000028:                                                                                                  #  DETECTING GIMBAL LOCK
016415,000029: 22,2744  22,2744               LOCSKIRT           EQUALS   NOGIMLOC                              
016416,000030: 
016417,000031: 22,2744           77614        NOGIMLOC           SET                                            
016418,000032: 22,2745           01074                                    CALCMAN3                              
016419,000033: 22,2746           70740        WCALC              LXC,1    DLOAD*                                
016420,000034: 22,2747           01322                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
016421,000035: 22,2750           04772                                    ARATE,1                               #  FROM A LIST OF FOUR
016422,000036: 22,2751           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
016423,000037: 22,2752           44527                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
016424,000038:                                                                                                  #  ABOUT COF
016425,000039: 22,2753           74343                           DLOAD*   VXSC                                  
016426,000040: 22,2754           04772                                    ARATE,1                               
016427,000041: 22,2755           03270                                    COF                                   
016428,000042: 22,2756           17325                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
016429,000043: 22,2757           03335                                    AM                                    
016430,000044: 22,2760           55605                           DMP      DDV*                                  
016431,000045: 22,2761           05002                                    ANGLTIME                              
016432,000046: 22,2762           04772                                    ARATE,1                               
016433,000047: 22,2763           77661                           SR                                             
016434,000048: 22,2764           20606                                    5                                     
016435,000049: 22,2765           03333                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
016436,000050: 22,2766           77614                           SETGO                                          
016437,000051: 22,2767           01035                                    CALCMAN2                              #  0(OFF) = CONTINUE MANEUVER
016438,000052: 22,2770           45010                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
016439,000053:                                                                                                  #           THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
016440,000054:                                                                                                  #           LOADING RATEINDX WITH 0,2,4,6, RESPECTIVELY
016441,000055: 
016442,000056: 
016443,000057: 22,2771           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC       $ 22.5 DEG/SEC
016444,000058: 22,2773           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC       $ 22.5 DEG/SEC
016445,000059: 22,2775           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC       $ 22.5 DEG/SEC
016446,000060: 22,2777           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC      $ 22.5 DEG/SEC
016447,000061: 
016448,000062: 22,3001           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19     FUDGE FACTOR TO CONVERT
016449,000063:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME

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