Source Code

These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

013379,000002:                                                                                                  ## Copyright:   Public domain.
013380,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
013381,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
013382,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
013383,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
013384,000007:                                                                                                  ##              No original listings of this program are available;
013385,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
013386,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
013387,000010:                                                                                                  ## Assembler:   yaYUL
013388,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013389,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013390,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
013391,000014: 
013392,000015:                                                                                                  ## Sundance 302
013393,000016: 15,2000                                           BANK     15                                    
013394,000017: 
013395,000018: 22,2000                                           SETLOC   KALCMON1                              
013396,000019: 22,2000                                           BANK                                           
013397,000020: 
013398,000021:                                                                                                  #  DETECTING GIMBAL LOCK
013399,000022: 22,2740  22,2740               LOCSKIRT           EQUALS   NOGIMLOC                              
013400,000023: 
013401,000024: 22,2740           77614        NOGIMLOC           SET                                            
013402,000025: 22,2741           01074                                    CALCMAN3                              
013403,000026: 22,2742           70740        WCALC              LXC,1    DLOAD*                                
013404,000027: 22,2743           01331                                    RATEINDX                              #  CHOOSE THE DESIRED MANEUVER RATE
013405,000028: 22,2744           04766                                    ARATE,1                               #  FROM A LIST OF FOUR
013406,000029: 22,2745           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
013407,000030: 22,2746           44523                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
013408,000031:                                                                                                  #  ABOUT COF
013409,000032: 22,2747           74343                           DLOAD*   VXSC                                  
013410,000033: 22,2750           04766                                    ARATE,1                               
013411,000034: 22,2751           03266                                    COF                                   
013412,000035: 22,2752           17323                           STODL    BRATE                                 #  COMPONENT MANEUVER RATES 45 DEG/SEC
013413,000036: 22,2753           03333                                    AM                                    
013414,000037: 22,2754           55605                           DMP      DDV*                                  
013415,000038: 22,2755           04776                                    ANGLTIME                              
013416,000039: 22,2756           04766                                    ARATE,1                               
013417,000040: 22,2757           77661                           SR                                             
013418,000041: 22,2760           20606                                    5                                     
013419,000042: 22,2761           03331                           STORE    TM                                    #  MANEUVER EXECUTION TIME SCALED AS T2
013420,000043: 22,2762           77614                           SETGO                                          
013421,000044: 22,2763           01035                                    CALCMAN2                              #  0(OFF) = CONTINUE MANEUVER
013422,000045: 22,2764           45004                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
013423,000046: 
013424,000047:                                                                                                  #  THE FOUR SELECTABLE FREE FALL MANEUVER RATES SELECTED BY
013425,000048:                                                                                                  #  LOADING RATEINDX WITH 0, 2, 4, 6, RESPECTIVELY
013426,000049: 
013427,000050: 22,2765           00221 24255  ARATE              2DEC     .0088888888                            #  = 0.2 DEG/SEC         $ 22.5 DEG/SEC
013428,000051: 
013429,000052: 22,2767           00554 02660                     2DEC     .0222222222                            #  = 0.5 DEG/SEC         $ 22.5 DEG/SEC
013430,000053: 
013431,000054: 22,2771           02660 13301                     2DEC     .0888888888                            #  = 2.0 DEG/SEC         $ 22.5 DEG/SEC
013432,000055: 
013433,000056: 22,2773           16161 30707                     2DEC     .4444444444                            #  = 10.0 DEG/SEC        $ 22.5 DEG/SEC
013434,000057: 
013435,000058: 22,2775           00003 04000  ANGLTIME           2DEC     .0001907349                            #  = 100B-19 FUDGE FACTOR TO CONVERT
013436,000059:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
013437,000060: 
013438,000061: 

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