Source Code

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

They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141.

Since only binary dumps (rather than listings) of Comanche 67 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.

017285,000002:                                                                                                  ## Copyright:   Public domain.
017286,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
017287,000004:                                                                                                  ## Purpose:     A section of Comanche revision 067.
017288,000005:                                                                                                  ##              It is part of the reconstructed source code for the flight
017289,000006:                                                                                                  ##              software for the Command Module's (CM) Apollo Guidance Computer
017290,000007:                                                                                                  ##              (AGC) for Apollo 12. No original listings of this program are
017291,000008:                                                                                                  ##              available; instead, this file was created via dissassembly of
017292,000009:                                                                                                  ##              dumps of Comanche 067 core rope modules and comparison with
017293,000010:                                                                                                  ##              other AGC programs.
017294,000011:                                                                                                  ## Assembler:   yaYUL
017295,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017296,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017297,000014:                                                                                                  ## Mod history: 2023-08-16 MAS  Created from Comanche 055.
017298,000015: 
017299,000016: 15,2000                                           BANK     15                                    
017300,000017: 22,2000                                           SETLOC   KALCMON1                              
017301,000018: 22,2000                                           BANK                                           
017302,000019: 
017303,000020: 22,2737  E6,1661                                  EBANK=   BCDU                                  
017304,000021: 
017305,000022:                                                                                                  #  DETECTING GIMBAL LOCK
017306,000023: 22,2737  22,2737               LOCSKIRT           EQUALS   WCALC                                 
017307,000024: 22,2737           70740        WCALC              LXC,1    DLOAD*                                
017308,000025: 22,2740           01130                                    RATEINDX                              
017309,000026: 22,2741           04771                                    ARATE,1                               
017310,000027: 22,2742           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017311,000028: 22,2743           44530                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017312,000029:                                                                                                  #  ABOUT COF
017313,000030: 22,2744           74343                           DLOAD*   VXSC                                  
017314,000031: 22,2745           04771                                    ARATE,1                               
017315,000032: 22,2746           03343                                    COF                                   
017316,000033: 22,2747           77721                           MXV                                            
017317,000034: 22,2750           05003                                    QUADROT                               
017318,000035: 22,2751           17311                           STODL    BRATE                                 
017319,000036: 22,2752           03365                                    AM                                    
017320,000037: 22,2753           55605                           DMP      DDV*                                  
017321,000038: 22,2754           05001                                    ANGLTIME                              
017322,000039: 22,2755           04771                                    ARATE,1                               
017323,000040: 22,2756           77661                           SR                                             
017324,000041: 22,2757           20606                                    5                                     
017325,000042: 22,2760           27317                           STOVL    TM                                    
017326,000043: 22,2761           03311                                    BRATE                                 
017327,000044: 22,2762           77761                           VXSC                                           
017328,000045: 22,2763           05025                                    BIASCALE                              
017329,000046: 22,2764           03275                           STORE    BIASTEMP                              #  ATTITUDE ERROR BIAS TO PREVENT OVERSHOOT
017330,000047:                                                                                                  #  IN SYSTEM
017331,000048: 22,2765           77614                           SETGO                                          #  STATE SWITCH CALCMAN2 (43D)
017332,000049: 22,2766           01035                                    CALCMAN2                              #  0(OFF) = BYPASS STARTING PROCEDURE
017333,000050: 22,2767           45032                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
017334,000051: 
017335,000052: 
017336,000053: 22,2770           00044 15053  ARATE              2DEC     .0022222222                            #  = .05 DEG/SEC
017337,000054: 
017338,000055: 22,2772           00221 24255                     2DEC     .0088888889                            #  = .2 DEG/SEC
017339,000056: 
017340,000057: 22,2774           00554 02660                     2DEC     .0222222222                            #  = .5 DEG/SEC
017341,000058: 
017342,000059: 22,2776           02660 13301                     2DEC     .0888888889                            #  = 2 DEG/SEC                $22.5 DEG/SEC
017343,000060: 
017344,000061: 22,3000           00003 04000  ANGLTIME           2DEC     .000190735                            #  = 100B - 19
017345,000062: 
017346,000063:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
017347,000064: 22,3002           03146 14632  QUADROT            2DEC     .1                                    #  ROTATION MATRIX FROM S/C AXES TO CONTROL
017348,000065: 
017349,000066: 22,3004           00000 00000                     2DEC     0          B-28                       #  AXES (X ROT = -7.25 DEG)
017350,000067: 
017351,000068: 22,3006           00000 00000                     2DEC     0          B-28                       
017352,000069: 
017353,000070: 22,3010           00000 00000                     2DEC     0          B-28                       
017354,000071: 
017355,000072: 22,3012           03131 11275                     2DEC     .099200                               #  =(.1)COS7.25
017356,000073: 
017357,000074: 22,3014           77461 47370                     2DEC     -.012620                              #  =-(.1)SIN7.25
017358,000075: 
017359,000076: 22,3016           00000 00000                     2DEC     0          B-28                       
017360,000077: 
017361,000078: 22,3020           00316 30407                     2DEC     .012620                               #  (.1)SIN7.25
017362,000079: 
017363,000080: 22,3022           03131 11275                     2DEC     .099200                               #  (.1)COS7.25
017364,000081: 
017365,000082: 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