Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

043331,000002:                                                                                                  ## Copyright:   Public domain.
043332,000003:                                                                                                  ## Filename:    LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
043333,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
043334,000005:                                                                                                  ##              It is part of the source code for the original release
043335,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
043336,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
043337,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
043338,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
043339,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
043340,000011:                                                                                                  ##              that the code format has been changed to conform to the
043341,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
043342,000013:                                                                                                  ##              original YUL assembler.
043343,000014:                                                                                                  ## Reference:   pp. 979-982
043344,000015:                                                                                                  ## Assembler:   yaYUL
043345,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
043346,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
043347,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
043348,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
043349,000020:                                                                                                  ##              2017-01-04 RRB  Updated for Luminary 69. Notes on handwritted notations in Luminary 99
043350,000021:                                                                                                  ##                              were retained and marked as being from Lum99.
043351,000022:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
043352,000023:                                                                                                  ##                              and fixed errors found.
043353,000024:                                                                                                  ##              2017-08-26 MAS  Fixed comment-text errors found while transcribing Zerlina 56.
043354,000025: 

Page 979

043356,000027:                                                                                                  #  NAME - LSPOS  - LOCATE SUN AND MOON                   DATE - 25 OCT 67
043357,000028:                                                                                                  #  MOD NO.1
043358,000029:                                                                                                  #  MOD BY NEVILLE                                        ASSEMBLY SUNDANCE
043359,000030: 
043360,000031:                                                                                                  #  FUNCTIONAL DESCRIPTION
043361,000032: 
043362,000033:                                                                                                  #         COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
043363,000034:                                                                                                  #  LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
043364,000035:                                                                                                  #  SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
043365,000036:                                                                                                  #  THE POSITION VECTOR OF THE SUN IS
043366,000037:                                                                                                  #        -
043367,000038:                                                                                                  #        S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
043368,000039: 
043369,000040:                                                                                                  #        LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
043370,000041:                                                                                                  #                 0    R     0                     1
043371,000042:                                                                                                  #        LOS  (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
043372,000043:                                                                                                  #           0
043373,000044:                                                                                                  #        LOS  (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
043374,000045:                                                                                                  #           R
043375,000046: 
043376,000047:                                                                                                  #  LOS  AND LOS  ARE STORED AS LOSC AND LOSR IN RATESP.
043377,000048:                                                                                                  #     0        R
043378,000049:                                                                                                  #  COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
043379,000050:                                                                                                  #  T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
043380,000051:                                                                                                  #  C  AND C  ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION.  THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
043381,000052:                                                                                                  #   0      1                               2  2 1/2
043382,000053:                                                                                                  #  C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C )   *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
043383,000054:                                                                                                  #   0         1                            0  1                                   1  0
043384,000055: 
043385,000056:                                                                                                  #  THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
043386,000057:                                                                                                  #  MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
043387,000058:                                                                                                  #  ORBIT.  THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT.  THE FOURTH ANGLE IS THE LONGITUDE
043388,000059:                                                                                                  #  OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT.  LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
043389,000060: 
043390,000061:                                                                                                  #  THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
043391,000062:                                                                                                  #        -
043392,000063:                                                                                                  #        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))
043393,000064: 
043394,000065:                                                                                                  #  WHERE
043395,000066:                                                                                                  #        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
043396,000067:                                                                                                  #               0    R     0                    1                     0               1
043397,000068:                                                                                                  #        LON=LON +LON
043398,000069:                                                                                                  #               0    R
043399,000070:                                                                                                  #  A , A , B  AND B  ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE).  COS(OBL), SIN(OBL)*SIN(IM),
043400,000071:                                                                                                  #   0   1   0      1
043401,000072:                                                                                                  #  SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY.  LOM , LOM , LON , LON                                   
043402,000073:                                                                                                  #  ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP.                                         0     R     0     R
043403,000074:                                                                                                  #  THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN).  ALL CONSTANTS ARE UPDATED BY YEAR.
043404,000075: 
043405,000076:                                                                                                  #  CALLING SEQUENCE

Page 980

043407,000078:                                                                                                  #        CALL LSPOS.  RETURN IS VIA CPRET.
043408,000079: 
043409,000080:                                                                                                  #  ALARMS OR ABORTS
043410,000081:                                                                                                  #        NONE
043411,000082: 
043412,000083:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
043413,000084:                                                                                                  #        TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
043414,000085:                                                                                                  #        TO ZERO).  TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
043415,000086: 
043416,000087:                                                                                                  #        TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
043417,000088: 
043418,000089:                                                                                                  #  OUTPUT
043419,000090:                                                                                                  #        UNIT POSITIONAL VECTOR OF SUN IN VSUN.  (SCALED B-1)
043420,000091:                                                                                                  #        UNIT POSITIONAL VECTOR OF MOON IN VMOON.  (SCALED B-1)
043421,000092: 
043422,000093:                                                                                                  #  SUBROUTINES USED
043423,000094:                                                                                                  #        NONE
043424,000095: 
043425,000096:                                                                                                  #  DEBRIS
043426,000097:                                                                                                  #        CURRENT CORE SET, WORK AREA AND FREEFLAG
043427,000098: 
043428,000099: 04,2750                                           BANK     04                                    
043429,000100: 15,2000                                           SETLOC   EPHEM                                 
043430,000101: 15,2000                                           BANK                                           
043431,000102: 
043432,000103: 15,3663  E5,1714                                  EBANK=   VSUN                                  
043433,000104: 15,3663                                           COUNT*   $$/EPHEM                              
043434,000105: 15,3663  15,3663               LUNPOS             EQUALS   LSPOS                                 
043435,000106: 
043436,000107: 15,3663           54201        LSPOS              SETPD    SR                                    
043437,000108: 15,3664           00001                                    0                                     
043438,000109: 15,3665           20617                                    14D                                   #  TP
043439,000110: 15,3666           56371                           TAD      DDV                                   

In Lum99, the hand-written notation "in centisec B 42" appears to the right.

043441,000112: 15,3667           01707                                    TEPHEM                                #  TIME OF LAUNCH
043442,000113: 15,3670           12024                                    CSTODAY                               #  24 HOURS-8640000 CENTI-SECS/DAY B-33

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

043444,000115: 15,3671           00031                           STORE    TIMEP                                 #  T IN DAYS

In Lum99, the hand-written notation "∴ granularity ≈ 0.164 sec" appears to the right.

043446,000117: 15,3672           77170                           AXT,1    AXT,2                                 
043447,000118: 15,3673           00000                                    0                                     
043448,000119: 15,3674           00000                                    0                                     
043449,000120: 15,3675           77614                           CLEAR                                          
043450,000121: 15,3676           00274                                    FREEFLAG                              #  SWITCH BIT
043451,000122: 15,3677           77745        POSITA             DLOAD                                          
043452,000123: 15,3700           12004                                    KONMAT     +2                         #  ZEROS
043453,000124: 15,3701           00027                           STORE    GTMP                                  
043454,000125: 15,3702           40745        POSITB             DLOAD    DMP*                                  
043455,000126: 15,3703           00031                                    TIMEP                                 #  T
043456,000127: 15,3704           12050                                    VAL67      +4,1                       #  1/27 OR 1/32 OR 1/365

Page 981

043458,000129: 15,3705           42661                           SL       DAD*                                  
043459,000130: 15,3706           20211                                    8D                                    
043460,000131: 15,3707           12046                                    VAL67      +2,1                       #  AARG
043461,000132: 15,3710           40756                           SIN      DMP*                                  #  SIN(T/27+PHI) OR T/32 OR T/365
043462,000133: 15,3711           12044                                    VAL67,1                               #  (A0**2+A1**2)**1/2 SIN(X+PHIA)
043463,000134: 15,3712           62015                           DAD      INCR,1                                #  PLUS
043464,000135: 15,3713           00027                                    GTMP                                  #  (B0**2+B1**2)**1/2 SIN(X+PHIB)
043465,000136: 15,3714           77771                           DEC      -6         B-14                       
043466,000137: 15,3715           00027                           STORE    GTMP                                  #  OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
043467,000138: 15,3716           77614                           BOFSET                                         
043468,000139: 15,3717           00054                                    FREEFLAG                              
043469,000140: 15,3720           33702                                    POSITB                                
043470,000141: 15,3721           40745        POSITD             DLOAD    DMP*                                  
043471,000142: 15,3722           00031                                    TIMEP                                 #  T
043472,000143: 15,3723           65747                                    RATESP,2                              #  LOMR,LOSR,LONR
043473,000144: 15,3724           42661                           SL       DAD*                                  
043474,000145: 15,3725           20206                                    5D                                    
043475,000146: 15,3726           65741                                    RATESP     +6,2                       #  LOMO,LOSO,LONO
043476,000147: 15,3727           77625                           DSU                                            
043477,000148: 15,3730           00027                                    GTMP                                  
043478,000149: 15,3731           10021                           STORE    STMP,2                                #  LOM,LOS,LON
043479,000150: 15,3732           63135                           SLOAD    INCR,2                                
043480,000151: 15,3733           00050                                    X2                                    
043481,000152: 15,3734           77775                           DEC      -2         B-14                       
043482,000153: 15,3735           53015                           DAD      BZE                                   
043483,000154: 15,3736           12026                                    RCB-13                                #  PLUS 2
043484,000155: 15,3737           33767                                    POSITE                                #  2ND
043485,000156: 15,3740           77644                           BPL                                            
043486,000157: 15,3741           33677                                    POSITA                                #  1ST
043487,000158: 15,3742           45345        POSITF             DLOAD    DSU                                   #  3RD
043488,000159: 15,3743           00021                                    STMP                                  #  LOM
043489,000160: 15,3744           00025                                    STMP       +4                         #  LON
043490,000161: 15,3745           65356                           SIN      PDDL                                  #  SIN(LOM-LON)
043491,000162: 15,3746           00021                                    STMP                                  
043492,000163: 15,3747           65356                           SIN      PDDL                                  #  SIN LOM
043493,000164: 15,3750           00021                                    STMP                                  
043494,000165: 15,3751           55546                           COS      VDEF                                  #  COS LOM
043495,000166: 15,3752           53521                           MXV      UNIT                                  
043496,000167: 15,3753           12002                                    KONMAT                                #  K1,K2,K3,K4,
043497,000168: 15,3754           02723                           STORE    VMOON                                 
043498,000169: 15,3755           65345                           DLOAD    PDDL                                  
043499,000170: 15,3756           12004                                    KONMAT     +2                         #  ZERO
043500,000171: 15,3757           00023                                    STMP       +2                         
043501,000172: 15,3760           65356                           SIN      PDDL                                  #  SIN LOS
043502,000173: 15,3761           00023                                    STMP       +2                         
043503,000174: 15,3762           55546                           COS      VDEF                                  #  COS LOS
043504,000175: 15,3763           53521                           MXV      UNIT                                  
043505,000176: 15,3764           12002                                    KONMAT                                
043506,000177: 15,3765           02715                           STORE    VSUN                                  
043507,000178: 15,3766           77616                           RVQ                                            

Page 982

043509,000180: 15,3767           77745        POSITE             DLOAD                                          
043510,000181: 15,3770           12004                                    KONMAT     +2                         #  ZEROS
043511,000182: 15,3771           00027                           STORE    GTMP                                  
043512,000183: 15,3772           77650                           GOTO                                           
043513,000184: 15,3773           33721                                    POSITD                                
043514,000185: 15,3774           77616        LUNVEL             RVQ                                            #         TO FOOL INTEGRATION
043515,000186: 05,2000                                           SETLOC   EPHEM1                                
043516,000187: 05,2000                                           BANK                                           
043517,000188: 
043518,000189: 05,3430                                           COUNT*   $$/EPHEM                              
043519,000190: 05,3430                        STMP               EQUALS   16D                                   
043520,000191: 
043521,000192: 05,3430                        GTMP               EQUALS   22D                                   
043522,000193: 
043523,000194: 05,3430                        TIMEP              EQUALS   24D                                   
043524,000195: 

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