Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

015052,000002:                                                                                                  ## Copyright:   Public domain.
015053,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
015054,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
015055,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
015056,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
015057,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
015058,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
015059,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
015060,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
015061,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
015062,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
015063,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
015064,000014:                                                                                                  ##              resulting binary is.
015065,000015:                                                                                                  ## Reference:   p.  366
015066,000016:                                                                                                  ## Assembler:   yaYUL
015067,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015068,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015069,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
015070,000020: 

Page 366

015072,000022: 15,2050                                           BANK     15                                    
015073,000023: 
015074,000024: 22,2000                                           SETLOC   KALCMON1                              
015075,000025: 22,2000                                           BANK                                           
015076,000026: 
015077,000027:                                                                                                  #  DETECTING GIMBAL LOCK
015078,000028: 22,2744  22,2744               LOCSKIRT           EQUALS   NOGIMLOC                              
015079,000029: 
015080,000030: 22,2744           77614        NOGIMLOC           SET                                            
015081,000031: 22,2745           01074                                    CALCMAN3                              
015082,000032: 22,2746           70740        WCALC              LXC,1    DLOAD*                                
015083,000033: 22,2747           01322                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
015084,000034: 22,2750           04772                                    ARATE,1                               #  FROM A LIST OF FOUR
015085,000035: 22,2751           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
015086,000036: 22,2752           44527                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
015087,000037:                                                                                                  #  ABOUT COF
015088,000038: 22,2753           74343                           DLOAD*   VXSC                                  
015089,000039: 22,2754           04772                                    ARATE,1                               
015090,000040: 22,2755           03270                                    COF                                   
015091,000041: 22,2756           17325                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
015092,000042: 22,2757           03335                                    AM                                    
015093,000043: 22,2760           55605                           DMP      DDV*                                  
015094,000044: 22,2761           05002                                    ANGLTIME                              
015095,000045: 22,2762           04772                                    ARATE,1                               
015096,000046: 22,2763           77661                           SR                                             
015097,000047: 22,2764           20606                                    5                                     
015098,000048: 22,2765           03333                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
015099,000049: 22,2766           77614                           SETGO                                          
015100,000050: 22,2767           01035                                    CALCMAN2                              #  0(OFF) = CONTINUE MANEUVER
015101,000051: 22,2770           45010                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
015102,000052: 
015103,000053:                                                                                                  #  THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
015104,000054:                                                                                                  #  LOADING RATEINDX WITH 0, 2, 4, 6, RESPECTIVELY
015105,000055: 
015106,000056: 22,2771           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC                 $ 22.5 DEG/SEC
015107,000057: 22,2773           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC                 $ 22.5 DEG/SEC
015108,000058: 22,2775           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC                 $ 22.5 DEG/SEC
015109,000059: 22,2777           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC                $ 22.5 DEG/SEC
015110,000060: 
015111,000061: 22,3001           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19 FUDGE FACTOR TO CONVERT
015112,000062:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
015113,000063: 
015114,000064: 

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