Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

016266,000002:                                                                                                  ## Copyright:   Public domain.
016267,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
016268,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
016269,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
016270,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
016271,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
016272,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
016273,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
016274,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
016275,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
016276,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
016277,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
016278,000014:                                                                                                  ## Reference:   p.  377
016279,000015:                                                                                                  ## Assembler:   yaYUL
016280,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
016281,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
016282,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
016283,000019: 

Page 377

016285,000021: 15,2050                                           BANK     15                                    
016286,000022: 
016287,000023: 22,2000                                           SETLOC   KALCMON1                              
016288,000024: 22,2000                                           BANK                                           
016289,000025: 
016290,000026:                                                                                                  #  DETECTING GIMBAL LOCK
016291,000027: 22,2744  22,2744               LOCSKIRT           EQUALS   NOGIMLOC                              
016292,000028: 
016293,000029: 22,2744           77614        NOGIMLOC           SET                                            
016294,000030: 22,2745           01074                                    CALCMAN3                              
016295,000031: 22,2746           70740        WCALC              LXC,1    DLOAD*                                
016296,000032: 22,2747           01325                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
016297,000033: 22,2750           04772                                    ARATE,1                               #  FROM A LIST OF FOUR
016298,000034: 22,2751           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
016299,000035: 22,2752           44527                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
016300,000036:                                                                                                  #  ABOUT COF
016301,000037: 22,2753           74343                           DLOAD*   VXSC                                  
016302,000038: 22,2754           04772                                    ARATE,1                               
016303,000039: 22,2755           03267                                    COF                                   
016304,000040: 22,2756           17324                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
016305,000041: 22,2757           03334                                    AM                                    
016306,000042: 22,2760           55605                           DMP      DDV*                                  
016307,000043: 22,2761           05002                                    ANGLTIME                              
016308,000044: 22,2762           04772                                    ARATE,1                               
016309,000045: 22,2763           77661                           SR                                             
016310,000046: 22,2764           20606                                    5                                     
016311,000047: 22,2765           03332                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
016312,000048: 22,2766           77614                           SETGO                                          
016313,000049: 22,2767           01035                                    CALCMAN2                              #  0(OFF) = CONTINUE MANEUVER
016314,000050: 22,2770           45010                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
016315,000051: 
016316,000052:                                                                                                  #  THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
016317,000053:                                                                                                  #  LOADING RATEINDX WITH 0, 2, 4, 6, RESPECTIVELY
016318,000054: 
016319,000055: 22,2771           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC         $ 22.5 DEG/SEC
016320,000056: 
016321,000057: 22,2773           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC         $ 22.5 DEG/SEC
016322,000058: 
016323,000059: 22,2775           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC         $ 22.5 DEG/SEC
016324,000060: 
016325,000061: 22,2777           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC        $ 22.5 DEG/SEC
016326,000062: 
016327,000063: 22,3001           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19 FUDGE FACTOR TO CONVERT
016328,000064:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
016329,000065: 
016330,000066: 

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