Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. 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 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.

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