Source Code

These source-code files are part of a reconstructed copy of Luminary 98, a development version of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memo 85, using asterisks indicating changed lines in the listing as a guide. While no listing of this version is known to exist, nor are the memory-bank checksums available, the reconstruction is believed to be correct because it was an an intermediate step in reconstructing Luminary 97 whose reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152G. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 98 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

041875,000002:                                                                                                  ## Copyright:   Public domain.
041876,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
041877,000004:                                                                                                  ## Purpose:     A section of Luminary revision 98.
041878,000005:                                                                                                  ##              It is part of the reconstructed source code for the a
041879,000006:                                                                                                  ##              development version of the flight software for the Lunar 
041880,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
041881,000008:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
041882,000009:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
041883,000010:                                                                                                  ##              the listing and Luminary Memo #85, which lists changes between
041884,000011:                                                                                                  ##              Luminary 98 and 99.
041885,000012:                                                                                                  ## Reference:   pp. 984-987
041886,000013:                                                                                                  ## Assembler:   yaYUL
041887,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
041888,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
041889,000016:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
041890,000017: 

Page 984

041892,000019:                                                                                                  #  NAME - LSPOS - LOCATE SUN AND MOON                    DATE - 25 OCT 67
041893,000020:                                                                                                  #  MOD NO. 1
041894,000021:                                                                                                  #  MOD BY NEVILLE                                        ASSEMBLY SUNDANCE
041895,000022: 
041896,000023:                                                                                                  #  FUNCTIONAL DESCRIPTION
041897,000024: 
041898,000025:                                                                                                  #         COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
041899,000026:                                                                                                  #  LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
041900,000027:                                                                                                  #  SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
041901,000028:                                                                                                  #  THE POSITION VECTOR OF THE SUN IS
041902,000029:                                                                                                  #        -
041903,000030:                                                                                                  #        S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
041904,000031: 
041905,000032:                                                                                                  #        LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
041906,000033:                                                                                                  #                 0    R     0                     1
041907,000034:                                                                                                  #        LOS  (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
041908,000035:                                                                                                  #           0
041909,000036:                                                                                                  #        LOS  (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
041910,000037:                                                                                                  #           R
041911,000038: 
041912,000039:                                                                                                  #  LOS  AND LOS  ARE STORED AS LOSC AND LOSR IN RATESP.
041913,000040:                                                                                                  #     0        R
041914,000041:                                                                                                  #  COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
041915,000042: 
041916,000043:                                                                                                  #  T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
041917,000044: 
041918,000045:                                                                                                  #  C  AND C  ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION.  THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
041919,000046:                                                                                                  #   0      1                               2  2 1/2
041920,000047:                                                                                                  #  C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C )   *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
041921,000048:                                                                                                  #   0         1                            0  1                                   1  0
041922,000049: 
041923,000050:                                                                                                  #  THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
041924,000051:                                                                                                  #  MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
041925,000052:                                                                                                  #  ORBIT.  THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT.  THE FOURTH ANGLE IS THE LONGITUDE
041926,000053:                                                                                                  #  OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT.  LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
041927,000054: 
041928,000055:                                                                                                  #  THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
041929,000056:                                                                                                  #        -
041930,000057:                                                                                                  #        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))
041931,000058: 
041932,000059:                                                                                                  #  WHERE
041933,000060:                                                                                                  #        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
041934,000061:                                                                                                  #               0    R     0                    1                     0               1
041935,000062:                                                                                                  #        LON=LON +LON
041936,000063:                                                                                                  #               0    R
041937,000064:                                                                                                  #  A , A , B  AND B  ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE).  COS(OBL), SIN(OBL)*SIN(IM),
041938,000065:                                                                                                  #   0   1   0      1
041939,000066:                                                                                                  #  SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY.  LOM , LOM , LON , LON                                   
041940,000067:                                                                                                  #  ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP.                                         0     R     0     R
041941,000068:                                                                                                  #  THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN).  ALL CONSTANTS ARE UPDATED BY YEAR.
041942,000069: 
041943,000070:                                                                                                  #  CALLING SEQUENCE

Page 985

041945,000072:                                                                                                  #        CALL LSPOS.  RETURN IS VIA CPRET.
041946,000073: 
041947,000074:                                                                                                  #  ALARMS OR ABORTS
041948,000075:                                                                                                  #        NONE
041949,000076: 
041950,000077:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
041951,000078:                                                                                                  #        TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
041952,000079:                                                                                                  #        TO ZERO).  TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
041953,000080: 
041954,000081:                                                                                                  #        TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
041955,000082: 
041956,000083:                                                                                                  #  OUTPUT
041957,000084:                                                                                                  #        UNIT POSITIONAL VECTOR OF SUN IN VSUN.  (SCALED B-1)
041958,000085:                                                                                                  #        UNIT POSITIONAL VECTOR OF MOON IN VMOON.  (SCALED B-1)
041959,000086: 
041960,000087:                                                                                                  #  SUBROUTINES USED
041961,000088:                                                                                                  #        NONE
041962,000089: 
041963,000090:                                                                                                  #  DEBRIS
041964,000091:                                                                                                  #        CURRENT CORE SET, WORK AREA AND FREEFLAG
041965,000092: 
041966,000093: 04,3027                                           BANK     04                                    
041967,000094: 15,2000                                           SETLOC   EPHEM                                 
041968,000095: 15,2000                                           BANK                                           
041969,000096: 
041970,000097: 15,3664  E5,1714                                  EBANK=   VSUN                                  
041971,000098: 15,3664                                           COUNT*   $$/EPHEM                              
041972,000099: 15,3664  15,3664               LUNPOS             EQUALS   LSPOS                                 
041973,000100: 
041974,000101: 15,3664           54201        LSPOS              SETPD    SR                                    
041975,000102: 15,3665           00001                                    0                                     
041976,000103: 15,3666           20617                                    14D                                   #  TP
041977,000104: 15,3667           56371                           TAD      DDV                                   

The hand-written notation "in centisec B 42" appears to the right.

041979,000106: 15,3670           01707                                    TEPHEM                                #  TIME OF LAUNCH
041980,000107: 15,3671           12024                                    CSTODAY                               #  24 HOURS-8640000 CENTI-SECS/DAY B-33

The hand-written notation "@ B 9 = 512 days" appears to the right.

041982,000109: 15,3672           00031                           STORE    TIMEP                                 #  T IN DAYS

The hand-written notation "∴ granularity ≈ 0.164 sec" appears to the right.

041984,000111: 15,3673           77170                           AXT,1    AXT,2                                 
041985,000112: 15,3674           00000                                    0                                     
041986,000113: 15,3675           00000                                    0                                     
041987,000114: 15,3676           77614                           CLEAR                                          
041988,000115: 15,3677           00274                                    FREEFLAG                              #  SWITCH BIT
041989,000116: 15,3700           77745        POSITA             DLOAD                                          
041990,000117: 15,3701           12004                                    KONMAT     +2                         #  ZEROS
041991,000118: 15,3702           00027                           STORE    GTMP                                  
041992,000119: 15,3703           40745        POSITB             DLOAD    DMP*                                  
041993,000120: 15,3704           00031                                    TIMEP                                 #  T
041994,000121: 15,3705           12050                                    VAL67      +4,1                       #  1/27 OR 1/32 OR 1/365

Page 986

041996,000123: 15,3706           42661                           SL       DAD*                                  
041997,000124: 15,3707           20211                                    8D                                    
041998,000125: 15,3710           12046                                    VAL67      +2,1                       #  AARG
041999,000126: 15,3711           40756                           SIN      DMP*                                  #  SIN(T/27+PHI) OR T/32 OR T/365
042000,000127: 15,3712           12044                                    VAL67,1                               #  (A0**2+A1**2)**1/2 SIN(X+PHIA)
042001,000128: 15,3713           62015                           DAD      INCR,1                                #  PLUS
042002,000129: 15,3714           00027                                    GTMP                                  #  (B0**2+B1**2)**1/2 SIN(X+PHIB)
042003,000130: 15,3715           77771                           DEC      -6         B-14                       
042004,000131: 15,3716           00027                           STORE    GTMP                                  #  OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
042005,000132: 15,3717           77614                           BOFSET                                         
042006,000133: 15,3720           00054                                    FREEFLAG                              
042007,000134: 15,3721           33703                                    POSITB                                
042008,000135: 15,3722           40745        POSITD             DLOAD    DMP*                                  
042009,000136: 15,3723           00031                                    TIMEP                                 #  T
042010,000137: 15,3724           65747                                    RATESP,2                              #  LOMR,LOSR,LONR
042011,000138: 15,3725           42661                           SL       DAD*                                  
042012,000139: 15,3726           20206                                    5D                                    
042013,000140: 15,3727           65741                                    RATESP     +6,2                       #  LOMO,LOSO,LONO
042014,000141: 15,3730           77625                           DSU                                            
042015,000142: 15,3731           00027                                    GTMP                                  
042016,000143: 15,3732           10021                           STORE    STMP,2                                #  LOM,LOS,LON
042017,000144: 15,3733           63135                           SLOAD    INCR,2                                
042018,000145: 15,3734           00050                                    X2                                    
042019,000146: 15,3735           77775                           DEC      -2         B-14                       
042020,000147: 15,3736           53015                           DAD      BZE                                   
042021,000148: 15,3737           12026                                    RCB-13                                #  PLUS 2
042022,000149: 15,3740           33770                                    POSITE                                #  2ND
042023,000150: 15,3741           77644                           BPL                                            
042024,000151: 15,3742           33700                                    POSITA                                #  1ST
042025,000152: 15,3743           45345        POSITF             DLOAD    DSU                                   #  3RD
042026,000153: 15,3744           00021                                    STMP                                  #  LOM
042027,000154: 15,3745           00025                                    STMP       +4                         #  LON
042028,000155: 15,3746           65356                           SIN      PDDL                                  #  SIN(LOM-LON)
042029,000156: 15,3747           00021                                    STMP                                  
042030,000157: 15,3750           65356                           SIN      PDDL                                  #  SIN LOM
042031,000158: 15,3751           00021                                    STMP                                  
042032,000159: 15,3752           55546                           COS      VDEF                                  #  COS LOM
042033,000160: 15,3753           53521                           MXV      UNIT                                  
042034,000161: 15,3754           12002                                    KONMAT                                #  K1,K2,K3,K4,
042035,000162: 15,3755           02723                           STORE    VMOON                                 
042036,000163: 15,3756           65345                           DLOAD    PDDL                                  
042037,000164: 15,3757           12004                                    KONMAT     +2                         #  ZERO
042038,000165: 15,3760           00023                                    STMP       +2                         
042039,000166: 15,3761           65356                           SIN      PDDL                                  #  SIN LOS
042040,000167: 15,3762           00023                                    STMP       +2                         
042041,000168: 15,3763           55546                           COS      VDEF                                  #  COS LOS
042042,000169: 15,3764           53521                           MXV      UNIT                                  
042043,000170: 15,3765           12002                                    KONMAT                                
042044,000171: 15,3766           02715                           STORE    VSUN                                  
042045,000172: 15,3767           77616                           RVQ                                            

Page 987

042047,000174: 15,3770           77745        POSITE             DLOAD                                          
042048,000175: 15,3771           12004                                    KONMAT     +2                         #  ZEROS
042049,000176: 15,3772           00027                           STORE    GTMP                                  
042050,000177: 15,3773           77650                           GOTO                                           
042051,000178: 15,3774           33722                                    POSITD                                
042052,000179: 15,3775           77616        LUNVEL             RVQ                                            #         TO FOOL INTEGRATION
042053,000180: 05,2000                                           SETLOC   EPHEM1                                
042054,000181: 05,2000                                           BANK                                           
042055,000182: 
042056,000183: 05,3506                                           COUNT*   $$/EPHEM                              
042057,000184: 05,3506                        STMP               EQUALS   16D                                   
042058,000185: 05,3506                        GTMP               EQUALS   22D                                   
042059,000186: 05,3506                        TIMEP              EQUALS   24D                                   
042060,000187: 

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