Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

042099,000002:                                                                                                  ## Copyright:   Public domain.
042100,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
042101,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
042102,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
042103,000006:                                                                                                  ##              although several more revisions would follow. It has been
042104,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
042105,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
042106,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
042107,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
042108,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
042109,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
042110,000013:                                                                                                  ##              rather than the original YUL assembler.
042111,000014:                                                                                                  ## Reference:   pp. 978-981
042112,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042113,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042114,000017:                                                                                                  ## Mod history: 05/29/03 RSB.   Began transcribing.
042115,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
042116,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
042117,000020:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
042118,000021:                                                                                                  ##                              numbers in 1701.pdf.
042119,000022:                                                                                                  ##              2017-02-26 RSB  Proofed comment text using octopus/ProoferComments.
042120,000023:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
042121,000024:                                                                                                  ##              2017-08-26 MAS  Fixed comment-text errors found while transcribing Zerlina 56.
042122,000025:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
042123,000026: 

Page 978

042125,000028:                                                                                                  #  NAME - LSPOS - LOCATE SUN AND MOON                    DATE - 25 OCT 67
042126,000029:                                                                                                  #  MOD NO.1
042127,000030:                                                                                                  #  MOD BY NEVILLE                                        ASSEMBLY SUNDANCE
042128,000031: 
042129,000032:                                                                                                  #  FUNCTIONAL DESCRIPTION
042130,000033: 
042131,000034:                                                                                                  #  COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM.  THE SUN VECTOR S IS
042132,000035:                                                                                                  #  LOCATED VIA TWO ANGLES.  THE FIRST ANGLE (OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
042133,000036:                                                                                                  #  SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
042134,000037:                                                                                                  #  THE POSITION VECTOR OF THE SUN IS
042135,000038:                                                                                                  #        -
042136,000039:                                                                                                  #        S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
042137,000040: 
042138,000041:                                                                                                  #        LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
042139,000042:                                                                                                  #                 0    R     0                     1
042140,000043:                                                                                                  #        LOS  (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
042141,000044:                                                                                                  #           0
042142,000045:                                                                                                  #        LOS  (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
042143,000046:                                                                                                  #           R
042144,000047: 
042145,000048:                                                                                                  #  LOS  AND LOS  ARE STORED AS LOSC AND LOSR IN RATESP.
042146,000049:                                                                                                  #     0        R
042147,000050:                                                                                                  #  COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
042148,000051: 
042149,000052:                                                                                                  #  T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
042150,000053: 
042151,000054:                                                                                                  #  C  AND C  ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION.  THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
042152,000055:                                                                                                  #   0      1                               2  2 1/2
042153,000056:                                                                                                  #  C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C )   *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
042154,000057:                                                                                                  #   0         1                            0  1                                   1  0
042155,000058: 
042156,000059:                                                                                                  #  THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
042157,000060:                                                                                                  #  MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
042158,000061:                                                                                                  #  ORBIT.  THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT.  THE FOURTH ANGLE IS THE LONGITUDE
042159,000062:                                                                                                  #  OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT.  LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
042160,000063: 
042161,000064:                                                                                                  #  THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
042162,000065:                                                                                                  #        -
042163,000066:                                                                                                  #        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))
042164,000067: 
042165,000068:                                                                                                  #  WHERE
042166,000069:                                                                                                  #        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
042167,000070:                                                                                                  #               0    R     0                    1                     0               1
042168,000071:                                                                                                  #        LON=LON +LON
042169,000072:                                                                                                  #               0    R
042170,000073:                                                                                                  #  A , A , B  AND B  ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE).  COS(OBL), SIN(OBL)*SIN(IM),
042171,000074:                                                                                                  #   0   1   0      1
042172,000075:                                                                                                  #  SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3  AND K4, RESPECTIVELY.  LOM , LOM , LON , LON
042173,000076:                                                                                                  #  ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP.                                          0     R     0     R
042174,000077: 
042175,000078:                                                                                                  #  THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN).  ALL CONSTANTS ARE UPDATED BY YEAR.
042176,000079: 
042177,000080:                                                                                                  #  CALLING SEQUENCE

Page 979

042179,000082:                                                                                                  #        CALL LSPOS.  RETURN IS VIA CPRET.
042180,000083: 
042181,000084:                                                                                                  #  ALARMS OR ABORTS
042182,000085:                                                                                                  #        NONE
042183,000086: 
042184,000087:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
042185,000088:                                                                                                  #        TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
042186,000089:                                                                                                  #        TO ZERO).  TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
042187,000090: 
042188,000091:                                                                                                  #        TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
042189,000092: 
042190,000093:                                                                                                  #  OUTPUT
042191,000094:                                                                                                  #        UNIT POSITIONAL VECTOR OF SUN IN VSUN.  (SCALED B-1)
042192,000095:                                                                                                  #        UNIT POSITIONAL VECTOR OF MOON IN VMOON.  (SCALED B-1)
042193,000096: 
042194,000097:                                                                                                  #  SUBROUTINES USED
042195,000098:                                                                                                  #        NONE
042196,000099: 
042197,000100:                                                                                                  #  DEBRIS
042198,000101:                                                                                                  #        CURRENT CORE SET, WORK AREA AND FREEFLAG
042199,000102: 
042200,000103: 04,2773                                           BANK     04                                    
042201,000104: 15,2000                                           SETLOC   EPHEM                                 
042202,000105: 15,2000                                           BANK                                           
042203,000106: 
042204,000107: 15,3647  E5,1714                                  EBANK=   VSUN                                  
042205,000108: 15,3647                                           COUNT*   $$/EPHEM                              
042206,000109: 15,3647  15,3647               LUNPOS             EQUALS   LSPOS                                 
042207,000110: 
042208,000111: 15,3647           54201        LSPOS              SETPD    SR                                    
042209,000112: 15,3650           00001                                    0                                     
042210,000113: 15,3651           20617                                    14D                                   #  TP
042211,000114: 15,3652           56371                           TAD      DDV                                   
042212,000115: 15,3653           01707                                    TEPHEM                                #  TIME OF LAUNCH
042213,000116: 15,3654           12024                                    CSTODAY                               #  24 HOURS-8640000 CENTI-SECS/DAY B-33
042214,000117: 15,3655           00031                           STORE    TIMEP                                 #  T IN DAYS
042215,000118: 15,3656           77170                           AXT,1    AXT,2                                 
042216,000119: 15,3657           00000                                    0                                     
042217,000120: 15,3660           00000                                    0                                     
042218,000121: 15,3661           77614                           CLEAR                                          
042219,000122: 15,3662           00274                                    FREEFLAG                              #  SWITCH BIT
042220,000123: 15,3663           77745        POSITA             DLOAD                                          
042221,000124: 15,3664           12004                                    KONMAT     +2                         #  ZEROS
042222,000125: 15,3665           00027                           STORE    GTMP                                  
042223,000126: 15,3666           40745        POSITB             DLOAD    DMP*                                  
042224,000127: 15,3667           00031                                    TIMEP                                 #  T
042225,000128: 15,3670           12050                                    VAL67      +4,1                       #  1/27 OR 1/32 OR 1/365

Page 980

042227,000130: 15,3671           42661                           SL       DAD*                                  
042228,000131: 15,3672           20211                                    8D                                    
042229,000132: 15,3673           12046                                    VAL67      +2,1                       #  AARG
042230,000133: 15,3674           40756                           SIN      DMP*                                  #  SIN(T/27+PHI) OR T/32 OR T/365
042231,000134: 15,3675           12044                                    VAL67,1                               #  (A0**2+A1**2)**1/2 SIN(X+PHIA)
042232,000135: 15,3676           62015                           DAD      INCR,1                                #  PLUS
042233,000136: 15,3677           00027                                    GTMP                                  #  (B0**2+B1**2)**1/2 SIN(X+PHIB)
042234,000137: 15,3700           77771                           DEC      -6         B-14                       
042235,000138: 15,3701           00027                           STORE    GTMP                                  #  OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
042236,000139: 15,3702           77614                           BOFSET                                         
042237,000140: 15,3703           00054                                    FREEFLAG                              
042238,000141: 15,3704           33666                                    POSITB                                
042239,000142: 15,3705           40745        POSITD             DLOAD    DMP*                                  
042240,000143: 15,3706           00031                                    TIMEP                                 #  T
042241,000144: 15,3707           65747                                    RATESP,2                              #  LOMR,LOSR,LONR
042242,000145: 15,3710           42661                           SL       DAD*                                  
042243,000146: 15,3711           20206                                    5D                                    
042244,000147: 15,3712           65741                                    RATESP     +6,2                       #  LOMO,LOSO,LONO
042245,000148: 15,3713           77625                           DSU                                            
042246,000149: 15,3714           00027                                    GTMP                                  
042247,000150: 15,3715           10021                           STORE    STMP,2                                #  LOM,LOS,LON
042248,000151: 15,3716           63135                           SLOAD    INCR,2                                
042249,000152: 15,3717           00050                                    X2                                    
042250,000153: 15,3720           77775                           DEC      -2         B-14                       
042251,000154: 15,3721           53015                           DAD      BZE                                   
042252,000155: 15,3722           12026                                    RCB-13                                #  PLUS 2
042253,000156: 15,3723           33753                                    POSITE                                #  2ND
042254,000157: 15,3724           77644                           BPL                                            
042255,000158: 15,3725           33663                                    POSITA                                #  1ST
042256,000159: 15,3726           45345        POSITF             DLOAD    DSU                                   #  3RD
042257,000160: 15,3727           00021                                    STMP                                  #  LOM
042258,000161: 15,3730           00025                                    STMP       +4                         #  LON
042259,000162: 15,3731           65356                           SIN      PDDL                                  #  SIN(LOM-LON)
042260,000163: 15,3732           00021                                    STMP                                  
042261,000164: 15,3733           65356                           SIN      PDDL                                  #  SIN LOM
042262,000165: 15,3734           00021                                    STMP                                  
042263,000166: 15,3735           55546                           COS      VDEF                                  #  COS LOM
042264,000167: 15,3736           53521                           MXV      UNIT                                  
042265,000168: 15,3737           12002                                    KONMAT                                #  K1,K2,K3,K4,
042266,000169: 15,3740           02723                           STORE    VMOON                                 
042267,000170: 15,3741           65345                           DLOAD    PDDL                                  
042268,000171: 15,3742           12004                                    KONMAT     +2                         #  ZERO
042269,000172: 15,3743           00023                                    STMP       +2                         
042270,000173: 15,3744           65356                           SIN      PDDL                                  #  SIN LOS
042271,000174: 15,3745           00023                                    STMP       +2                         
042272,000175: 15,3746           55546                           COS      VDEF                                  #  COS LOS
042273,000176: 15,3747           53521                           MXV      UNIT                                  
042274,000177: 15,3750           12002                                    KONMAT                                
042275,000178: 15,3751           02715                           STORE    VSUN                                  
042276,000179: 15,3752           77616                           RVQ                                            

Page 981

042278,000181: 15,3753           77745        POSITE             DLOAD                                          
042279,000182: 15,3754           12004                                    KONMAT     +2                         #  ZEROS
042280,000183: 15,3755           00027                           STORE    GTMP                                  
042281,000184: 15,3756           77650                           GOTO                                           
042282,000185: 15,3757           33705                                    POSITD                                
042283,000186: 05,2000                                           SETLOC   EPHEM1                                
042284,000187: 05,2000                                           BANK                                           
042285,000188: 
042286,000189: 05,3505                                           COUNT*   $$/EPHEM                              
042287,000190: 05,3505                        STMP               EQUALS   16D                                   
042288,000191: 05,3505                        GTMP               EQUALS   22D                                   
042289,000192: 05,3505                        TIMEP              EQUALS   24D                                   
042290,000193: 

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