Source Code

These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3), the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72/3 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.

017416,000002:                                                                                                  ## Copyright:   Public domain.
017417,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
017418,000004:                                                                                                  ## Purpose:     A section of Manche72 revision 3.
017419,000005:                                                                                                  ##              It is part of the reconstructed source code for the final, flown
017420,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
017421,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
017422,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
017423,000009:                                                                                                  ##              from a reconstructed copy of Comanche 072. It has been adapted
017424,000010:                                                                                                  ##              such that the resulting bugger words exactly match those
017425,000011:                                                                                                  ##              specified for Manche72 revision 3 in NASA drawing 2021153G,
017426,000012:                                                                                                  ##              which gives relatively high confidence that the reconstruction
017427,000013:                                                                                                  ##              is correct.
017428,000014:                                                                                                  ## Assembler:   yaYUL
017429,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017430,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017431,000017:                                                                                                  ## Mod history: 2024-05-19 MAS  Created from Comanche 072.
017432,000018: 
017433,000019: 15,2000                                           BANK     15                                    
017434,000020: 22,2000                                           SETLOC   KALCMON1                              
017435,000021: 22,2000                                           BANK                                           
017436,000022: 
017437,000023: 22,2737  E6,1661                                  EBANK=   BCDU                                  
017438,000024: 
017439,000025:                                                                                                  #  DETECTING GIMBAL LOCK
017440,000026: 22,2737  22,2737               LOCSKIRT           EQUALS   WCALC                                 
017441,000027: 22,2737           70740        WCALC              LXC,1    DLOAD*                                
017442,000028: 22,2740           01130                                    RATEINDX                              
017443,000029: 22,2741           04771                                    ARATE,1                               
017444,000030: 22,2742           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017445,000031: 22,2743           44530                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017446,000032:                                                                                                  #  ABOUT COF
017447,000033: 22,2744           74343                           DLOAD*   VXSC                                  
017448,000034: 22,2745           04771                                    ARATE,1                               
017449,000035: 22,2746           03343                                    COF                                   
017450,000036: 22,2747           77721                           MXV                                            
017451,000037: 22,2750           05003                                    QUADROT                               
017452,000038: 22,2751           17311                           STODL    BRATE                                 
017453,000039: 22,2752           03365                                    AM                                    
017454,000040: 22,2753           55605                           DMP      DDV*                                  
017455,000041: 22,2754           05001                                    ANGLTIME                              
017456,000042: 22,2755           04771                                    ARATE,1                               
017457,000043: 22,2756           77661                           SR                                             
017458,000044: 22,2757           20606                                    5                                     
017459,000045: 22,2760           27317                           STOVL    TM                                    
017460,000046: 22,2761           03311                                    BRATE                                 
017461,000047: 22,2762           77761                           VXSC                                           
017462,000048: 22,2763           05025                                    BIASCALE                              
017463,000049: 22,2764           03275                           STORE    BIASTEMP                              #  ATTITUDE ERROR BIAS TO PREVENT OVERSHOOT
017464,000050:                                                                                                  #  IN SYSTEM
017465,000051: 22,2765           77614                           SETGO                                          #  STATE SWITCH CALCMAN2 (43D)
017466,000052: 22,2766           01035                                    CALCMAN2                              #  0(OFF) = BYPASS STARTING PROCEDURE
017467,000053: 22,2767           45032                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
017468,000054: 
017469,000055: 
017470,000056: 22,2770           00044 15053  ARATE              2DEC     .0022222222                            #  = .05 DEG/SEC
017471,000057: 
017472,000058: 22,2772           00221 24255                     2DEC     .0088888889                            #  = .2 DEG/SEC
017473,000059: 
017474,000060: 22,2774           00554 02660                     2DEC     .0222222222                            #  = .5 DEG/SEC
017475,000061: 
017476,000062: 22,2776           02660 13301                     2DEC     .0888888889                            #  = 2 DEG/SEC                $22.5 DEG/SEC
017477,000063: 
017478,000064: 22,3000           00003 04000  ANGLTIME           2DEC     .000190735                            #  = 100B - 19
017479,000065: 
017480,000066:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
017481,000067: 22,3002           03146 14632  QUADROT            2DEC     .1                                    #  ROTATION MATRIX FROM S/C AXES TO CONTROL
017482,000068: 
017483,000069: 22,3004           00000 00000                     2DEC     0          B-28                       #  AXES (X ROT = -7.25 DEG)
017484,000070: 
017485,000071: 22,3006           00000 00000                     2DEC     0          B-28                       
017486,000072: 
017487,000073: 22,3010           00000 00000                     2DEC     0          B-28                       
017488,000074: 
017489,000075: 22,3012           03131 11275                     2DEC     .099200                               #  =(.1)COS7.25
017490,000076: 
017491,000077: 22,3014           77461 47370                     2DEC     -.012620                              #  =-(.1)SIN7.25
017492,000078: 
017493,000079: 22,3016           00000 00000                     2DEC     0          B-28                       
017494,000080: 
017495,000081: 22,3020           00316 30407                     2DEC     .012620                               #  (.1)SIN7.25
017496,000082: 
017497,000083: 22,3022           03131 11275                     2DEC     .099200                               #  (.1)COS7.25
017498,000084: 
017499,000085: 22,3024           00004 05253  BIASCALE           2DEC     .0002543132                            #  = (450/180)(1/0.6)(1/16384)

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