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.

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

Page 979

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

Page 980

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

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

043423,000112: 15,3667           01707                                    TEPHEM                                #  TIME OF LAUNCH
043424,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.

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

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

043428,000117: 15,3672           77170                           AXT,1    AXT,2                                 
043429,000118: 15,3673           00000                                    0                                     
043430,000119: 15,3674           00000                                    0                                     
043431,000120: 15,3675           77614                           CLEAR                                          
043432,000121: 15,3676           00274                                    FREEFLAG                              #  SWITCH BIT
043433,000122: 15,3677           77745        POSITA             DLOAD                                          
043434,000123: 15,3700           12004                                    KONMAT     +2                         #  ZEROS
043435,000124: 15,3701           00027                           STORE    GTMP                                  
043436,000125: 15,3702           40745        POSITB             DLOAD    DMP*                                  
043437,000126: 15,3703           00031                                    TIMEP                                 #  T
043438,000127: 15,3704           12050                                    VAL67      +4,1                       #  1/27 OR 1/32 OR 1/365

Page 981

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

Page 982

043491,000180: 15,3767           77745        POSITE             DLOAD                                          
043492,000181: 15,3770           12004                                    KONMAT     +2                         #  ZEROS
043493,000182: 15,3771           00027                           STORE    GTMP                                  
043494,000183: 15,3772           77650                           GOTO                                           
043495,000184: 15,3773           33721                                    POSITD                                
043496,000185: 15,3774           77616        LUNVEL             RVQ                                            #         TO FOOL INTEGRATION
043497,000186: 05,2000                                           SETLOC   EPHEM1                                
043498,000187: 05,2000                                           BANK                                           
043499,000188: 
043500,000189: 05,3430                                           COUNT*   $$/EPHEM                              
043501,000190: 05,3430                        STMP               EQUALS   16D                                   
043502,000191: 
043503,000192: 05,3430                        GTMP               EQUALS   22D                                   
043504,000193: 
043505,000194: 05,3430                        TIMEP              EQUALS   24D                                   
043506,000195: 

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