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.

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

Page 365

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

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