Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, 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 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

015260,000002:                                                                                                  ## Copyright:   Public domain.
015261,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
015262,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
015263,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
015264,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
015265,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
015266,000008:                                                                                                  ##              that the code format has been changed to conform to the
015267,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
015268,000010:                                                                                                  ##              original YUL assembler.
015269,000011:                                                                                                  ## Reference:   p.  365
015270,000012:                                                                                                  ## Assembler:   yaYUL
015271,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015272,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015273,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
015274,000016:                                                                                                  ##              2017-02-28 f0n  Modified per scan 0365.jpg
015275,000017:                                                                                                  ##              2017-03-01 MAS  Removed some outdated/extra comments.
015276,000018:                                                                                                  ##              2017-03-01 RSB  Proofed comment text by diff vs Luminary 131
015277,000019:                                                                                                  ##                              but no errors found.
015278,000020: 

Page 365

015280,000022: 15,2050                                           BANK     15                                    
015281,000023: 
015282,000024: 22,2000                                           SETLOC   KALCMON1                              
015283,000025: 22,2000                                           BANK                                           
015284,000026: 
015285,000027:                                                                                                  #  DETECTING GIMBAL LOCK
015286,000028: 22,2744  22,2744               LOCSKIRT           EQUALS   NOGIMLOC                              
015287,000029: 
015288,000030: 22,2744           77614        NOGIMLOC           SET                                            
015289,000031: 22,2745           01074                                    CALCMAN3                              
015290,000032: 22,2746           70740        WCALC              LXC,1    DLOAD*                                
015291,000033: 22,2747           01322                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
015292,000034: 22,2750           04772                                    ARATE,1                               #  FROM A LIST OF FOUR
015293,000035: 22,2751           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
015294,000036: 22,2752           44527                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
015295,000037:                                                                                                  #  ABOUT COF
015296,000038: 22,2753           74343                           DLOAD*   VXSC                                  
015297,000039: 22,2754           04772                                    ARATE,1                               
015298,000040: 22,2755           03271                                    COF                                   
015299,000041: 22,2756           17326                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
015300,000042: 22,2757           03336                                    AM                                    
015301,000043: 22,2760           55605                           DMP      DDV*                                  
015302,000044: 22,2761           05002                                    ANGLTIME                              
015303,000045: 22,2762           04772                                    ARATE,1                               
015304,000046: 22,2763           77661                           SR                                             
015305,000047: 22,2764           20606                                    5                                     
015306,000048: 22,2765           03334                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
015307,000049: 22,2766           77614                           SETGO                                          
015308,000050: 22,2767           01035                                    CALCMAN2                              #  D(OFF) = CONTINUE MANEUVER
015309,000051: 22,2770           45010                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
015310,000052: 
015311,000053:                                                                                                  #  THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
015312,000054:                                                                                                  #  LOADING RATEINDX WITH 0, 2, 4, 6, RESPECTIVELY
015313,000055: 
015314,000056: 22,2771           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC         $ 22.5 DEG/SEC
015315,000057: 
015316,000058: 22,2773           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC         $ 22.5 DEG/SEC
015317,000059: 
015318,000060: 22,2775           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC         $ 22.5 DEG/SEC
015319,000061: 
015320,000062: 22,2777           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC        $ 22.5 DEG/SEC
015321,000063: 
015322,000064: 22,3001           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19 FUDGE FACTOR TO CONVERT
015323,000065:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME

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