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.

033313,000002:                                                                                                  ## Copyright:   Public domain.
033314,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
033315,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
033316,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
033317,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
033318,000007:                                                                                                  ##              this software are available; instead, this file was created via
033319,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
033320,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
033321,000010:                                                                                                  ##              Museum of Space History.
033322,000011:                                                                                                  ## Assembler:   yaYUL
033323,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
033324,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
033325,000014:                                                                                                  ## Mod history: 2024-02-19 MAS  Created from Luminary 131.
033326,000015:                                                                                                  ##              2024-03-04 MAS  Updated for Skylark 48.
033327,000016: 
033328,000017:                                                                                                  #  NAME - LSPOS - LOCATE SUN AND MOON                    DATE - 25 OCT 67
033329,000018:                                                                                                  #  MOD NO.1
033330,000019:                                                                                                  #  MOD BY NEVILLE                                        ASSEMBLY SUNDANCE
033331,000020: 
033332,000021:                                                                                                  #  FUNCTIONAL DESCRIPTION
033333,000022: 
033334,000023:                                                                                                  #  COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM.  THE SUN VECTOR S IS
033335,000024:                                                                                                  #  LOCATED VIA TWO ANGLES.  THE FIRST ANGLE (OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
033336,000025:                                                                                                  #  SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
033337,000026:                                                                                                  #  THE POSITION VECTOR OF THE SUN IS
033338,000027:                                                                                                  #        -
033339,000028:                                                                                                  #        S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
033340,000029: 
033341,000030:                                                                                                  #        LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
033342,000031:                                                                                                  #                 0    R     0                     1
033343,000032:                                                                                                  #        LOS  (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
033344,000033:                                                                                                  #           0
033345,000034:                                                                                                  #        LOS  (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
033346,000035:                                                                                                  #           R
033347,000036: 
033348,000037:                                                                                                  #  LOS  AND LOS  ARE STORED AS LOSC AND LOSR IN RATESP.
033349,000038:                                                                                                  #     0        R
033350,000039:                                                                                                  #  COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
033351,000040: 
033352,000041:                                                                                                  #  T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
033353,000042: 
033354,000043:                                                                                                  #  C  AND C  ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION.  THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
033355,000044:                                                                                                  #   0      1                               2  2 1/2
033356,000045:                                                                                                  #  C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C )   *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
033357,000046:                                                                                                  #   0         1                            0  1                                   1  0
033358,000047: 
033359,000048:                                                                                                  #  THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
033360,000049:                                                                                                  #  MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
033361,000050:                                                                                                  #  ORBIT.  THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT.  THE FOURTH ANGLE IS THE LONGITUDE
033362,000051:                                                                                                  #  OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT.  LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
033363,000052: 
033364,000053:                                                                                                  #  THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
033365,000054:                                                                                                  #        -
033366,000055:                                                                                                  #        M=(COS(LOM), COS(OBL)*SIN(LOM)-SIN(OBL)*SIN(IM)*SIN(LOM-LON), SIN(OBL)*SIN(LOM)+COS(OBL)*SIN(IM)*SIN(LOM-LON))
033367,000056: 
033368,000057:                                                                                                  #  WHERE
033369,000058:                                                                                                  #        LOM=LOM +LOM *T-(A *SIN 2PI*T/27.5545+A *COS(2PI*T/27.5545)+B *SIN 2PI*T/32+B *COS(2PI*T/32)), AND
033370,000059:                                                                                                  #               0    R     0                    1                     0               1
033371,000060:                                                                                                  #        LON=LON +LON
033372,000061:                                                                                                  #               0    R
033373,000062:                                                                                                  #  A , A , B  AND B  ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE).  COS(OBL), SIN(OBL)*SIN(IM),
033374,000063:                                                                                                  #   0   1   0      1
033375,000064:                                                                                                  #  SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3  AND K4, RESPECTIVELY.  LOM , LOM , LON , LON
033376,000065:                                                                                                  #  ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP.                                          0     R     0     R
033377,000066: 
033378,000067:                                                                                                  #  THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN).  ALL CONSTANTS ARE UPDATED BY YEAR.
033379,000068: 
033380,000069:                                                                                                  #  CALLING SEQUENCE
033381,000070:                                                                                                  #        CALL LSPOS.  RETURN IS VIA CPRET.
033382,000071: 
033383,000072:                                                                                                  #  ALARMS OR ABORTS
033384,000073:                                                                                                  #        NONE
033385,000074: 
033386,000075:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
033387,000076:                                                                                                  #        TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
033388,000077:                                                                                                  #        TO ZERO).  TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
033389,000078: 
033390,000079:                                                                                                  #        TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
033391,000080: 
033392,000081:                                                                                                  #  OUTPUT
033393,000082:                                                                                                  #        UNIT POSITIONAL VECTOR OF SUN IN VSUN.  (SCALED B-1)
033394,000083:                                                                                                  #        UNIT POSITIONAL VECTOR OF MOON IN VMOON.  (SCALED B-1)
033395,000084: 
033396,000085:                                                                                                  #  SUBROUTINES USED
033397,000086:                                                                                                  #        NONE
033398,000087: 
033399,000088:                                                                                                  #  DEBRIS
033400,000089:                                                                                                  #        CURRENT CORE SET, WORK AREA AND FREEFLAG
033401,000090: 
033402,000091: 04,3206                                           BANK     04                                    
033403,000092: 26,2000                                           SETLOC   EPHEM                                 
033404,000093: 26,2000                                           BANK                                           
033405,000094: 
033406,000095: 26,2034  E5,1724                                  EBANK=   VSUN                                  
033407,000096: 26,2034                                           COUNT*   $$/EPHEM                              
033408,000097: 
033409,000098: 26,2034           54201        LSPOS              SETPD    SR                                    
033410,000099: 26,2035           00001                                    0                                     
033411,000100: 26,2036           20617                                    14D                                   #  TP
033412,000101: 26,2037           56371                           TAD      DDV                                   
033413,000102: 26,2040           01701                                    TEPHEM                                #  TIME OF LAUNCH
033414,000103: 26,2041           14076                                    CSTODAY                               #  24 HOURS-8640000 CENTI-SECS/DAY B-33
033415,000104: 26,2042           41206                           PUSH     DMP                                   #  T IN DAYS
033416,000105: 26,2043           14074                                    KOMEGAC                               
033417,000106: 26,2044           43261                           SL       DAD                                   
033418,000107: 26,2045           20212                                    9D                                    
033419,000108: 26,2046           02013                                    CARG                                  
033420,000109: 26,2047           41356                           SIN      DMP                                   
033421,000110: 26,2050           02011                                    CMOD                                  
033422,000111: 26,2051           77725                           PDDL                                           
033423,000112: 26,2052           54205                           DMP      SL                                    
033424,000113: 26,2053           14072                                    LOSR                                  
033425,000114: 26,2054           20207                                    6                                     
033426,000115: 26,2055           45215                           DAD      DSU                                   
033427,000116: 26,2056           02007                                    LOSO                                  
033428,000117: 26,2057           73406                           PUSH     SIN                                   
033429,000118: 26,2060           41206                           PUSH     DMP                                   
033430,000119: 26,2061           14102                                    KONMAT3                               
033431,000120: 26,2062           65352                           SL1      PDDL                                  
033432,000121: 26,2063           72405                           DMP      SL1                                   
033433,000122: 26,2064           14100                                    KONMAT1                               
033434,000123: 26,2065           71525                           PDDL     COS                                   
033435,000124: 26,2066           00001                                    0                                     
033436,000125: 26,2067           53466                           VDEF     UNIT                                  
033437,000126: 26,2070           43406                           PUSH     RVQ                                   
033438,000127: 
033439,000128: 26,2071           01315 26267  LOSR               2DEC*    .00273780317 B+4*                       
033440,000129: 26,2073           00131 26612  KOMEGAC            2DEC*    .00273777859 B+1*                       
033441,000130: 26,2075           00040 36540  CSTODAY            2DEC     8640000    B-32                       
033442,000131: 26,2077           16533 32024  KONMAT1            2DEC*    .91745773  B-1*                       
033443,000132: 26,2101           06273 01466  KONMAT3            2DEC*    .397833274 B-1*                       

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