Source Code

These source-code files are part of a reconstructed copy of Skylark 048, the Block II Command Module (CM) Apollo Guidance Computer (AGC) software for the Skylab-2, Skylab-3, Skylab-4, and Apollo-Soyuz Test Project missions.

They have been created via disassembly of binary dumps of the original core rope memory modules actually flown on Skylab-2, part numbers 2010802-541, 2010802-551, 2010802-561, 2010802-571, 2010802-581, and 2010802-591. Access to these modules was provided by the New Mexico Museum of Space History, who we are much indebted to.

The source code for the Apollo 15, 16, and 17 software, Artemis 072, was used as a starting point. Heavy use was made of TRW 4900.5-244, Programmed Guidance Equations for Skylark Command Module Earth Orbital Program, dated 14 February 1972. This document contains pseudocode of essentially all of Skylark, using original program labels which have been copied for this source reconstruction.

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

017595,000002:                                                                                                  ## Copyright:   Public domain.
017596,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
017597,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
017598,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
017599,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
017600,000007:                                                                                                  ##              this software are available; instead, this file was created via
017601,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
017602,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
017603,000010:                                                                                                  ##              Museum of Space History.
017604,000011:                                                                                                  ## Assembler:   yaYUL
017605,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017606,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017607,000014:                                                                                                  ## Mod history: 2023-09-04 MAS  Created from Artemis 072.
017608,000015:                                                                                                  ##              2024-03-04 MAS  Updated for Skylark 48.
017609,000016: 
017610,000017: 
017611,000018: 22,2000                                           SETLOC   KALCMON1                              
017612,000019: 22,2000                                           BANK                                           
017613,000020: 
017614,000021: 22,2745                                           COUNT*   $$/KALC                               
017615,000022: 22,2745  E6,1712                                  EBANK=   BCDU                                  
017616,000023: 
017617,000024:                                                                                                  #  DETECTING GIMBAL LOCK
017618,000025: 22,2745           46135        LOCSKIRT           SLOAD    BHIZ                                  
017619,000026: 22,2746           03076                                    WHICHDAP                              
017620,000027: 22,2747           45011                                    WCALC                                 
017621,000028: 
017622,000029: 22,2750           41335                           SLOAD    DMP                                   
017623,000030: 22,2751           03074                                    DKRATE                                
017624,000031: 22,2752           05103                                    TUFITDK                               
017625,000032: 22,2753           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017626,000033: 22,2754           44522                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017627,000034:                                                                                                  #  ABOUT COF
017628,000035: 22,2755           41335                           SLOAD    DMP                                   
017629,000036: 22,2756           03074                                    DKRATE                                
017630,000037: 22,2757           05103                                    TUFITDK                               
017631,000038: 22,2760           74206                           PUSH     VXSC                                  
017632,000039: 22,2761           02314                                    COF                                   
017633,000040: 22,2762           77721                           MXV                                            
017634,000041: 22,2763           05057                                    QUADROT                               
017635,000042: 22,2764           17342                           STODL    BRATE                                 
017636,000043: 22,2765           03352                                    AM                                    
017637,000044: 22,2766           56205                           DMP      DDV                                   
017638,000045: 22,2767           05055                                    ANGLTIME                              
017639,000046: 22,2770           77661                           SR                                             
017640,000047: 22,2771           20606                                    5                                     
017641,000048: 22,2772           17350                           STODL    TM                                    
017642,000049: 22,2773           03346                                    BRATE      +4                         
017643,000050: 22,2774           41246                           ABVAL    DMP                                   
017644,000051: 22,2775           03346                                    BRATE      +4                         
017645,000052: 22,2776           51525                           PDDL     ABVAL                                 
017646,000053: 22,2777           03344                                    BRATE      +2                         
017647,000054: 22,3000           65205                           DMP      PDDL                                  
017648,000055: 22,3001           03344                                    BRATE      +2                         
017649,000056: 22,3002           03342                                    BRATE                                 
017650,000057: 22,3003           41246                           ABVAL    DMP                                   
017651,000058: 22,3004           03342                                    BRATE                                 
017652,000059: 22,3005           74266                           VDEF     VXSC                                  
017653,000060: 22,3006           02374                                    1/2ALPHA                              
017654,000061: 22,3007           37326                           STCALL   BIASTEMP                              
017655,000062: 22,3010           45037                                    WCALCOUT                              
017656,000063: 
017657,000064: 22,3011           70740        WCALC              LXC,1    DLOAD*                                
017658,000065: 22,3012           00767                                    RATEINDX                              
017659,000066: 22,3013           05045                                    ARATE,1                               
017660,000067: 22,3014           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017661,000068: 22,3015           44522                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017662,000069:                                                                                                  #  ABOUT COF
017663,000070: 22,3016           74343                           DLOAD*   VXSC                                  
017664,000071: 22,3017           05045                                    ARATE,1                               
017665,000072: 22,3020           02314                                    COF                                   
017666,000073: 22,3021           77721                           MXV                                            
017667,000074: 22,3022           05057                                    QUADROT                               
017668,000075: 22,3023           17342                           STODL    BRATE                                 
017669,000076: 22,3024           03352                                    AM                                    
017670,000077: 22,3025           55605                           DMP      DDV*                                  
017671,000078: 22,3026           05055                                    ANGLTIME                              
017672,000079: 22,3027           05045                                    ARATE,1                               
017673,000080: 22,3030           77661                           SR                                             
017674,000081: 22,3031           20606                                    5                                     
017675,000082: 22,3032           27350                           STOVL    TM                                    
017676,000083: 22,3033           03342                                    BRATE                                 
017677,000084: 22,3034           77761                           VXSC                                           
017678,000085: 22,3035           05101                                    BIASCALE                              
017679,000086: 22,3036           03326                           STORE    BIASTEMP                              #  ATTITUDE ERROR BIAS TO PREVENT OVERSHOOT
017680,000087:                                                                                                  #  IN SYSTEM

The following label name is a guess.

017682,000089: 22,3037           43014        WCALCOUT           BON      SETGO                                 #  STATE SWITCH CALCMAN2 (43D)
017683,000090: 22,3040           00313                                    CYC61FLG                              
017684,000091: 22,3041           71766                                    RCYCLR61                              
017685,000092: 22,3042           01035                                    CALCMAN2                              #  0(OFF) = BYPASS STARTING PROCEDURE
017686,000093: 22,3043           45120                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
017687,000094: 
017688,000095: 
017689,000096: 22,3044           00044 15053  ARATE              2DEC     .0022222222                            #  = .05 DEG/SEC
017690,000097: 22,3046           00221 24255                     2DEC     .0088888889                            #  = .2 DEG/SEC
017691,000098: 22,3050           00554 02660                     2DEC     .0222222222                            #  = .5 DEG/SEC
017692,000099: 22,3052           02660 13301                     2DEC     .0888888889                            #  = 2 DEG/SEC                $22.5 DEG/SEC
017693,000100: 22,3054           00003 04000  ANGLTIME           2DEC     .000190735                            #  = 100B - 19
017694,000101:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
017695,000102: 22,3056           03146 14632  QUADROT            2DEC     .1                                    #  ROTATION MATRIX FROM S/C AXES TO CONTROL
017696,000103: 22,3060           00000 00000                     2DEC     0          B-28                       #  AXES (X ROT = -7.25 DEG)
017697,000104: 22,3062           00000 00000                     2DEC     0          B-28                       
017698,000105: 22,3064           00000 00000                     2DEC     0          B-28                       
017699,000106: 22,3066           03131 11275                     2DEC     .099200                               #  =(.1)COS7.25
017700,000107: 22,3070           77461 47370                     2DEC     -.012620                              #  =-(.1)SIN7.25
017701,000108: 22,3072           00000 00000                     2DEC     0          B-28                       
017702,000109: 22,3074           00316 30407                     2DEC     .012620                               #  (.1)SIN7.25
017703,000110: 22,3076           03131 11275                     2DEC     .099200                               #  (.1)COS7.25
017704,000111: 22,3100           00004 05253  BIASCALE           2DEC     .0002543132                            #  = (450/180)(1/0.6)(1/16384)
017705,000112: 22,3102           12000 00000  TUFITDK            2DEC     0.3125                                

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