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.

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

Page 376

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

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