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.

050170,000002:                                                                                                  ## Copyright:   Public domain.
050171,000003:                                                                                                  ## Filename:    PLANETARY_INERTIAL_ORIENTATION.agc
050172,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
050173,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
050174,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
050175,000007:                                                                                                  ##              this software are available; instead, this file was created via
050176,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
050177,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
050178,000010:                                                                                                  ##              Museum of Space History.
050179,000011:                                                                                                  ## Assembler:   yaYUL
050180,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
050181,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
050182,000014:                                                                                                  ## Mod history: 2023-09-04 MAS  Created from Artemis 072.
050183,000015:                                                                                                  ##              2024-03-05 MAS  Updated for Skylark 48.
050184,000016: 
050185,000017:                                                                                                  #  ..... RP-TO-R SUBROUTINE .....
050186,000018:                                                                                                  #  SUBROUTINE TO CONVERT RP (VECTOR IN PLANETARY COORDINATE SYSTEM, EITHER
050187,000019:                                                                                                  #  EARTH-FIXED OR MOON-FIXED) TO R (SAME VECTOR IN THE BASIC REF. SYSTEM)
050188,000020: 
050189,000021:                                                                                                  #        R = MT(T) * (RP + LP X RP)      MT = M MATRIX TRANSPOSE
050190,000022: 
050191,000023:                                                                                                  #  CALLING SEQUENCE
050192,000024:                                                                                                  #        L       CALL
050193,000025:                                                                                                  #        L+1             RP-TO-R
050194,000026: 
050195,000027:                                                                                                  #  SUBROUTINES USED
050196,000028:                                                                                                  #        EARTHMX, MOONMX, EARTHL
050197,000029: 
050198,000030:                                                                                                  #        ITEMS AVAILABLE FROM LAUNCH DATA
050199,000031:                                                                                                  #                504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL, EXPRESSED
050200,000032:                                                                                                  #                IN THE MOON-FIXED COORD. SYSTEM         RADIANS  B0
050201,000033: 
050202,000034:                                                                                                  #        ITEMS NECESSARY FOR SUBR. USED (SEE DESCRIPTION OF SUBR.)
050203,000035: 
050204,000036:                                                                                                  #  INPUT
050205,000037:                                                                                                  #        MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
050206,000038:                                                                                                  #        0-5D = RP VECTOR
050207,000039:                                                                                                  #        6-7D = TIME
050208,000040: 
050209,000041:                                                                                                  #  OUTPUT
050210,000042:                                                                                                  #        MPAC = R VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
050211,000043: 
050212,000044: 26,2000                                           SETLOC   PLANTIN                               
050213,000045: 26,2000                                           BANK                                           
050214,000046: 
050215,000047: 26,3213                                           COUNT*   $$/LUROT                              
050216,000048: 
050217,000049: 26,3213           45020        RP-TO-R            STQ      CALL                                  
050218,000050: 26,3214           00050                                    RPREXIT                               
050219,000051: 26,3215           55264                                    EARTHMX                               #  M MATRIX B-1
050220,000052:                                                                                                  #  AND L VECTOR RADIANS B0
050221,000053: 26,3216           61375                           VLOAD    VXM                                   
050222,000054: 26,3217           00001                                    504RPR                                
050223,000055: 26,3220           00025                                    MMATRIX                               #  MPAC=R=MT(T)*(RP+LPXRP)
050224,000056: 26,3221           52105                           VXM      GOTO                                  
050225,000057: 26,3222           02015                                    LMATRIX                               
050226,000058: 26,3223           55234                                    RPRPXXXX                              #  RESET PUSHLOC TO 0 BEFORE EXITING
050227,000059: 
050228,000060:                                                                                                  #  ..... R-TO-RP SUBROUTINE .....
050229,000061:                                                                                                  #  SUBROUTINE TO CONVERT R (VECTOR IN REFERENCE COORD. SYSTEM) TO RP
050230,000062:                                                                                                  #  (VECTOR IN PLANETARY COORD SYSTEM) EITHER EARTH-FIXED OR MOON-FIXED
050231,000063: 
050232,000064:                                                                                                  #        RP = M(T) * (R - L X R)
050233,000065: 
050234,000066:                                                                                                  #  CALLING SEQUENCE
050235,000067:                                                                                                  #        L       CALL
050236,000068:                                                                                                  #        L+1             R-TO-RP
050237,000069: 
050238,000070:                                                                                                  #  SUBROUTINES USED
050239,000071:                                                                                                  #        EARTHMX, MOONMX, EARTHL
050240,000072: 
050241,000073:                                                                                                  #  INPUT
050242,000074:                                                                                                  #        MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
050243,000075:                                                                                                  #        0-5D = R VECTOR
050244,000076:                                                                                                  #        6-7D = TIME
050245,000077: 
050246,000078:                                                                                                  #        ITEMS AVAILABLE FROM LAUNCH DATA
050247,000079:                                                                                                  #                504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL, EXPRESSED
050248,000080:                                                                                                  #                IN THE MOON-FIXED COORD. SYSTEM   RADIANS B0
050249,000081: 
050250,000082:                                                                                                  #        ITEMS NECESSARY FOR SUBROUTINES USED (SEE DESCRIPTION OF SUBR.)
050251,000083: 
050252,000084:                                                                                                  #  OUTPUT
050253,000085:                                                                                                  #        MPAC = RP VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
050254,000086: 
050255,000087: 26,3224           45020        R-TO-RP            STQ      CALL                                  
050256,000088: 26,3225           00050                                    RPREXIT                               
050257,000089: 26,3226           55264                                    EARTHMX                               
050258,000090: 26,3227           64375                           VLOAD    MXV                                   
050259,000091: 26,3230           00001                                    504RPR                                
050260,000092: 26,3231           02015                                    LMATRIX                               
050261,000093: 26,3232           77721                           MXV                                            #  M(T)*(R-LXR)  B-2
050262,000094: 26,3233           00025                                    MMATRIX                               
050263,000095: 26,3234           40372        RPRPXXXX           VSL1     SETPD                                 
050264,000096: 26,3235           00001                                    0D                                    
050265,000097: 26,3236           77650                           GOTO                                           
050266,000098: 26,3237           00050                                    RPREXIT                               
050267,000099: 
050268,000100:                                                                                                  #  COMPUTE X=X0+(XDOT)(T+T0)
050269,000101:                                                                                                  #  8-9D= XO (REVS B-0), PUSHLOC SET AT 12D
050270,000102:                                                                                                  #  10-11D=XDOT (REVS/CSEC) SCALED B+23 FOR WEARTH,B+28 FOR NODDOT AND BDOT
050271,000103:                                                                                                  #                        AND B+27 FOR FDOT
050272,000104:                                                                                                  #  X1=DIFFERENCE IN 23 AND SCALING OF XDOT, =0 FOR WEARTH, 5 FOR NODDOT AND
050273,000105:                                                                                                  #                                        BDOT AND 4 FOR FDOT
050274,000106:                                                                                                  #  6-7D=T (CSEC B-28), TIMSUBO= (CSEC B-42 TRIPLE PREC.)
050275,000107: 
050276,000108: 26,3240           54345        NEWANGLE           DLOAD    SR                                    #  ENTER PD 12D
050277,000109: 26,3241           00007                                    6D                                    
050278,000110: 26,3242           20617                                    14D                                   
050279,000111: 26,3243           72371                           TAD      TLOAD                                 #  CHANGE MODE TO TP
050280,000112: 26,3244           01701                                    TIMSUBO                               
050281,000113: 26,3245           00155                                    MPAC                                  
050282,000114: 26,3246           14017                           STODL    TIMSUBM                               #  T+T0 CSEC B-42
050283,000115: 26,3247           00020                                    TIMSUBM    +1                         
050284,000116: 26,3250           77605                           DMP                                            #  PD 10D  MULT BY XDOT IN 10-11D
050285,000117: 26,3251           43257                           SL*      DAD                                   #  PD 8D   ADD XO IN 8-9D AFTER SHIFTING
050286,000118: 26,3252           20206                                    5,1                                   #          SUCH THAT SCALING IS B-0
050287,000119: 26,3253           67206                           PUSH     SLOAD                                 #  PD 10D SAVE PARTIAL (X0+XDOT*T) IN 8-9D
050288,000120: 26,3254           00017                                    TIMSUBM                               
050289,000121: 26,3255           41261                           SL       DMP                                   
050290,000122: 26,3256           20212                                    9D                                    
050291,000123: 26,3257           00013                                    10D                                   #  XDOT
050292,000124: 26,3260           43257                           SL*      DAD                                   #  PD 8D   SHIFT SUCH THAT THIS PART OF X
050293,000125: 26,3261           20213                                    10D,1                                 #          IS SCALED REVS/CSEC B-0
050294,000126: 26,3262           43400        HERE               BOV      RVQ                                   #  TURN OFF OVERFLOW IF SET BY SHIFT
050295,000127: 26,3263           55262                                    HERE                                  #        INSTRUCTION BEFORE EXITING
050296,000128:                                                                                                  #  MPAC=X=X0+(XDOT)(T+T0)  REVS B0
050297,000129: 
050298,000130:                                                                                                  #  ..... EARTHMX SUBROUTINE .....
050299,000131:                                                                                                  #  SUBROUTINE TO COMPUTE THE TRANSFORMATION MATRIX M FOR THE EARTH
050300,000132: 
050301,000133:                                                                                                  #  CALLING SEQUENCE
050302,000134:                                                                                                  #        L       CALL
050303,000135:                                                                                                  #        L+1             EARTHMX
050304,000136: 
050305,000137:                                                                                                  #  SUBROUTINES USED
050306,000138:                                                                                                  #        NEWANGLE
050307,000139: 
050308,000140:                                                                                                  #  INPUT
050309,000141:                                                                                                  #        INPUT AVAILABLE FROM LAUNCH DATA        AZO  REVS B-0
050310,000142:                                                                                                  #                                                TEPHEM  CSEC B-42
050311,000143:                                                                                                  #        6-7D= TIME CSEC B-28
050312,000144: 
050313,000145:                                                                                                  #  OUTPUT
050314,000146:                                                                                                  #        MMATRIX= 3X3 M MATRIX B-1   (STORED IN VAC AREA)
050315,000147: 
050316,000148: 26,3264           40220        EARTHMX            STQ      SETPD                                 #  SET 8-9D=AZO
050317,000149: 26,3265           00051                                    EARTHMXX                              
050318,000150: 26,3266           00011                                    8D                                    #  10-11D=WEARTH
050319,000151: 26,3267           77770                           AXT,1                                          #  FOR SL 5, AND SL 10  IN NEWANGLE
050320,000152: 26,3270           00000                                    0                                     
050321,000153: 26,3271           65345                           DLOAD    PDDL                                  #    LEAVING PD SET AT 12D FOR NEWANGLE
050322,000154: 26,3272           02037                                    AZO                                   
050323,000155: 26,3273           15317                                    WEARTH                                
050324,000156: 26,3274           45006                           PUSH     CALL                                  
050325,000157: 26,3275           55240                                    NEWANGLE                              
050326,000158: 26,3276           41401                           SETPD    PUSH                                  #  18-19D=504AZ
050327,000159: 26,3277           00023                                    18D                                   #                     COS(AZ) SIN(AZ) 0
050328,000160: 26,3300           65346                           COS      PDDL                                  #  20-37D=  MMATRIX= -SIN(AZ) COS(AZ) 0 B-1
050329,000161: 26,3301           00023                                    504AZ                                 #                      0       0      1
050330,000162: 26,3302           65356                           SIN      PDDL                                  
050331,000163: 26,3303           15204                                    HI6ZEROS                              
050332,000164: 26,3304           73525                           PDDL     SIN                                   
050333,000165: 26,3305           00023                                    504AZ                                 
050334,000166: 26,3306           65276                           DCOMP    PDDL                                  
050335,000167: 26,3307           00023                                    504AZ                                 
050336,000168: 26,3310           63346                           COS      PDVL                                  
050337,000169: 26,3311           15204                                    HI6ZEROS                              
050338,000170: 26,3312           41525                           PDDL     PUSH                                  
050339,000171: 26,3313           15202                                    HIDPHALF                              
050340,000172: 26,3314           77650                           GOTO                                           
050341,000173: 26,3315           00051                                    EARTHMXX                              
050342,000174:                                                                                                  #  CONSTANTS AND ERASABLE ASSIGNMENTS
050343,000175: 
050344,000176: 26,3316  06,3723               1B1                =        DP1/2                                 #  1  SCALED B-1
050345,000177: 26,3316  0000050               RPREXIT            =        S1                                    #  R-TO-RP AND RP-TO-R SUBR EXIT
050346,000178: 26,3316  0000051               EARTHMXX           =        S2                                    #  EARTHMX,MOONMX SUBR. EXITS
050347,000179: 26,3316                        504RPR             =        0D                                    #  6 REGS  R OR RP VECTOR
050348,000180: 26,3316                        504AZ              =        18D                                   #  2      AZ
050349,000181: 26,3316                        TIMSUBM            =        14D                                   #  3       TIME SUB M (MOON) T+T0 IN GETAZ
050350,000182: 26,3316                        MMATRIX            =        20D                                   #  18      M MATRIX
050351,000183: 26,3316           37116 32631  WEARTH             2DEC*    +1.160576171 E-7        B23*            #  REV/CS.

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