Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

015195,000002:                                                                                                  ## Copyright:   Public domain.
015196,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
015197,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
015198,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
015199,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
015200,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
015201,000008:                                                                                                  ##              that the code format has been changed to conform to the
015202,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
015203,000010:                                                                                                  ##              original YUL assembler.
015204,000011:                                                                                                  ## Reference:   p. 366
015205,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
015206,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
015207,000014:                                                                                                  ## Mod history: 05/11/03 RSB.   Began transcribing.
015208,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
015209,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
015210,000017:                                                                                                  ##                              original harcopy, as opposed to the PDF page
015211,000018:                                                                                                  ##                              numbers in 1701.pdf.
015212,000019:                                                                                                  ##              2017-02-23 RSB  Proofed comment text using octopus/ProoferComments.
015213,000020:                                                                                                  ##              2017-08-22 RSB  Fixed comment-text typo identified in ZERLINA 56.
015214,000021: 

Page 366

015216,000023: 15,2050                                           BANK     15                                    
015217,000024: 
015218,000025: 22,2000                                           SETLOC   KALCMON1                              
015219,000026: 22,2000                                           BANK                                           
015220,000027: 
015221,000028:                                                                                                  #  DETECTING GIMBAL LOCK
015222,000029: 22,2744  22,2744               LOCSKIRT           EQUALS   NOGIMLOC                              
015223,000030: 
015224,000031: 22,2744           77614        NOGIMLOC           SET                                            
015225,000032: 22,2745           01074                                    CALCMAN3                              
015226,000033: 22,2746           70740        WCALC              LXC,1    DLOAD*                                
015227,000034: 22,2747           01322                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
015228,000035: 22,2750           04772                                    ARATE,1                               #  FROM A LIST OF FOUR
015229,000036: 22,2751           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
015230,000037: 22,2752           44527                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
015231,000038:                                                                                                  #  ABOUT COF
015232,000039: 22,2753           74343                           DLOAD*   VXSC                                  
015233,000040: 22,2754           04772                                    ARATE,1                               
015234,000041: 22,2755           03270                                    COF                                   
015235,000042: 22,2756           17325                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
015236,000043: 22,2757           03335                                    AM                                    
015237,000044: 22,2760           55605                           DMP      DDV*                                  
015238,000045: 22,2761           05002                                    ANGLTIME                              
015239,000046: 22,2762           04772                                    ARATE,1                               
015240,000047: 22,2763           77661                           SR                                             
015241,000048: 22,2764           20606                                    5                                     
015242,000049: 22,2765           03333                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
015243,000050: 22,2766           77614                           SETGO                                          
015244,000051: 22,2767           01035                                    CALCMAN2                              #  0(OFF) = CONTINUE MANEUVER
015245,000052: 22,2770           45010                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
015246,000053: 
015247,000054:                                                                                                  #  THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
015248,000055:                                                                                                  #  LOADING RATEINDX WITH 0, 2, 4, 6, RESPECTIVELY
015249,000056: 
015250,000057: 22,2771           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC                 $ 22.5 DEG/SEC
015251,000058: 22,2773           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC                 $ 22.5 DEG/SEC
015252,000059: 22,2775           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC                 $ 22.5 DEG/SEC
015253,000060: 22,2777           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC                $ 22.5 DEG/SEC
015254,000061: 
015255,000062: 22,3001           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19 FUDGE FACTOR TO CONVERT
015256,000063:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
015257,000064: 
015258,000065: 

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