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.

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

Page 365

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

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