home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug139.arc
/
MOONTIMZ.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
17KB
|
514 lines
1 REM
2 REM PROGRAM MOONRISE
3 REM
5 DEF FNRAD(W) = 1.745329252E-2 * W
DEF FNDEG(W) = 5.729577951E1 * W
DEF FNASN(W) = ATN(W/(SQR(1-W*W)+1E-20))
DEF FNACS(W) = 1.570796327-FNASN(W)
DIM FLAG(9)
FLAG(0) = 0 : FLGA = 0
10 PRINT CHR$(26)
13 PRINT "* * * * * * * * * * * * * * * * MOON";\
"TIMZ * * * * * * * * * * * * * * * *"
14 PRINT "* ";\
" *"
15 PRINT "* SHOWS TIME AND DIRECTIO";\
"N OF MOONRISE AND MOONSET *"
16 PRINT "* ";\
" *"
17 PRINT "* SET FOR PEMBROOKE, NSW -|- LONGITUDE";\
" 152.45.00 E, LATITUDE 31.24.00 S *"
18 PRINT "* ";\
" *"
19 PRINT "* copyrigh";\
"t, 1990 *"
20 PRINT "* Terry";\
" Hill *"
21 PRINT "* (065) 8";\
"5 9264 *"
22 PRINT "* ";\
" *"
31 PRINT "* * * * * * * * * * * * * * * * * * * * *";\
" * * * * * * * * * * * * * * * * * * *"
32 PRINT
33 PRINT "MOONTIMZ shows the time of the Moon's rising and";\
" setting for a given day. The "
34 PRINT "time of rising is calculated first, and then the";\
" time of setting. If Moonset is"
35 PRINT "EARLIER than Moonrise, the Moonset is at that ti";\
"me on the FOLLOWING day. "
36 PRINT "Comparison with an ephemeris can be confusing at";\
" first. Times are accurate"
37 PRINT "to within a minute or two. Azimuth bearings are e";\
"ast of North. "
38 PRINT "Local mean time is used - for daylight saving ";\
"either adjust the time zone or"
39 PRINT "calculate mentally. Input is terminated with a <CR>.";\
"If you make an error, use"
40 PRINT "<BACKSPACE> and reinput before typing <CR>."
41 PRINT "You can review and alter the input before the ";\
" calculation is made."
42 PRINT
43 LONG$ = "+152.75"
44 LAT$ = "-31.40"
45 ZONE$ = "+10"
46 PLACE$ = "PEMBROOKE, NSW"
LONG = VAL(LONG$)
LAT = VAL(LAT$)
ZONE = VAL(ZONE$)
50 INPUT "CHANGE LOCATION (Y/N) ";YES$
51 IF YES$ = "N" OR YES$ = "n" THEN GOTO 90
FLAG(9) = 0
52 INPUT "NEW LOCATION (14 chars max) : "; PLACE$
53 INPUT "NEW LONGITUDE (+/-ddd,mm,ss) : "; XD,XM,XS
54 GOSUB 1035
55 LONG = X
56 INPUT "NEW LATITUDE (+/-dd,mm,ss) : "; XD,XM,XS
57 GOSUB 1035
58 LAT = X
59 INPUT "NEW TIME ZONE (+/-hh,mm,ss) : "; XD,XM,XS
60 GOSUB 1035
61 ZONE = X
90 LOCN$ = PLACE$
91 PRINT CHR$(26)
92 PRINT "LOCATION : ";LOCN$;TAB(40);"TIME ZONE : ";ZONE
93 PRINT "LONGITUDE : ";LONG;TAB(40);"LATITUDE : ";LAT
94 PRINT
IF FLGA = 0 THEN GOTO 111 REM BYPASSES TEST ON FIRST PASS
INPUT "New Date (Y/N) "; AN$
IF AN$ = "N" OR AN$ = "n" THEN GOTO 127
FLAG(1) = 0 : FLAG(5) = 0 : FLAG(6) = 0 : FLAG(3) = 0
101 REM
102 REM INPUT DATA
103 REM
111 INPUT "1 YEAR (yyyy) : "; YR
113 INPUT "2 MONTH (mm) : "; MN
115 INPUT "3 DAY (dd) : "; DYA
120 PRINT
121 INPUT "ENTER 4 TO RUN OR 1..3 TO ALTER INPUT "; ANS
123 IF ANS <1 OR ANS >9 THEN GOTO 121
125 ON ANS GOTO 111,113,115,127
127 FLGA = 1
DY = DYA - (ZONE / 24)
155 PHI = FNRAD(LAT)
175 PRINT CHR$(26)
PRINT "LOCATION : ";LOCN$;TAB(40);"TIME ZONE : ";ZONE
PRINT "LONGITUDE : ";LONG;TAB(40);"LATITUDE : ";LAT
PRINT "DATE : "; YR; MN; DYA; " LMT"
PRINT "Sorry, but this can be a big job even for a BEE!"
180 GOSUB 6400
185 IF ERR1 NE 0 THEN GOTO 230
190 PRINT "Local Time of moonrise: "; HSR; MSR
195 IF ERR4 = 1 THEN PRINT "** POSSIBLE ERROR **"
200 PRINT " and moonset: "; HSS; MSS
205 IF ERR5 = 1 THEN PRINT "** POSSIBLE ERROR **"
210 AZR0 = FNDEG(AZR0) : AZS0 = FNDEG(AZS0)
215 PRINT "Azimuths (deg) are"
220 PRINT "Azimuth of rising: "; AZR0; " deg."
225 PRINT " and setting: "; AZS0; " deg."
230 PRINT
235 INPUT "Again (Y/N) "; AN$
240 IF AN$ = "N" OR AN$ = "n" THEN STOP
65 GOTO 50
997 REM
998 REM Subroutine MINSEC
999 REM
1000 IF SW1 = -1 THEN GOTO 1035
1005 SN = SGN(X): XP = ABS(X): XD = INT(XP)
1010 A = (XP - XD)*60: XM = INT(A)
1015 XS = INT((A - XM)*600 + 0.5) /10
1020 S$ = "+"
1025 IF SN = -1 THEN S$ = "-"
1030 RETURN
1035 SN = +1
1040 IF XD<0 OR XM<0 OR XS<0 THEN SN = -1
1045 XD1 = ABS(XD): XM1 = ABS(XM): XS1 = ABS(XS)
1050 X = ((((XS1/60) + XM1) /60) +XD1) *SN
1055 RETURN
1097 REM
1098 REM SUBROUTINE JULDAY
1099 REM
1100 IF FLAG(1) = 1 THEN GOTO 1170
1110 MN1 = MN: YR1 = YR: FLAG(1) = 1: B = 0
1115 IF YR1 < 0 THEN YR1 = YR1 + 1
1120 IF MN < 3 THEN MN1 = MN + 12: YR1 = YR1 - 1
1125 IF YR < 1582 THEN GOTO 1145
1130 IF YR = 1582 AND MN < 10 THEN GOTO 1145
1135 IF YR = 1582 AND MN = 10 AND DY < 15 THEN GOTO 1145
1140 A = INT(YR1/100): B = 2 - A + INT(A/4)
1145 IF YR1 < 0 THEN GOTO 1155
1150 C = INT(365.25*YR1) - 694025.0 :GOTO 1160
1155 C = INT((365.25*YR1) - 0.75) - 694025.0
1160 D = INT(30.6001*(MN1+1))
1165 DJD = B + C + D + DY - 0.5
1170 RETURN
1297 REM
1298 REM Subroutine GTIME
1299 REM
1300 IF FLAG(3)=1 THEN GOTO 1340
1305 XMN=MN: XDY=DY: FLAG(3)=1
1310 FLAG(1)=0: GOSUB 1100: XDJD=DJD
1315 MN=1: DY=0: FLAG(1)=0
1320 GOSUB 1100: T=DJD/36525
1325 R=6.6460656+(5.1262E-2+(T*2.581E-5))*T
1330 R1=2400*(T-((YR-1900)/100)): B=24-R-R1
1335 T0=((XDJD-DJD)*6.57098E-2)-B
1340 IF SW2=1 THEN GOTO 1365
1345 IF T0<0 THEN T0=T0+24
1350 GTM=TIM-T0
1355 IF GTM<0 THEN GTM=GTM+24
1360 GTM=GTM*9.972695677E-1: GOTO 1380
1365 GTM=(TIM*1.002737908)+T0
1370 IF GTM>24 THEN GTM=GTM-24
1375 IF GTM<0 THEN GTM=GTM+24
1380 X=GTM: SW1=1: GOSUB 1000
1385 HS=XD: MS=XM: SS=XS
1390 MN=XMN: DY=XDY: DJD=XDJD
1395 RETURN
1697 REM
1698 REM subroutine OBLIQ
1699 REM
1700 IF FLAG(5)=1 THEN RETURN
1705 FLAG(5)=1
1710 GOSUB 1100: T=DJD/36525
1715 C=(((-1.81E-3*T)+5.9E-3)*T+4.6845E1)*T
1720 EPS=2.345229444E1-(C/3600)
1725 EPSR=EPS*1.745329252E-2
1730 RETURN
1797 REM
1798 REM Subroutine EQECL
1799 REM
1800 IF FLAG(7)=1 THEN GOTO 1830
1810 PI=3.1415926535: TPI=2*PI: FLAG(7)=1
1815 IF FLAG(6)=0 THEN DEPS=0
1820 GOSUB 1700: EPS1=FNRAD(EPS+DEPS)
1825 SEPS=SIN(EPS1): CEPS=COS(EPS1)
1830 CY=COS(Y): SY=SIN(Y)
1835 IF ABS(CY)<1E-20 THEN CY=1E-20
1840 TY=SY/CY: CX=COS(X): SX=SIN(X)
1845 SQ=(SY*CEPS)-(CY*SEPS*SX*SW3)
1850 Q=FNASN(SQ): A=(SX*CEPS)+(TY*SEPS*SW3)
1855 P=ATN(A/CX)
1860 IF CX<0 THEN P=P+PI
1865 IF P>TPI THEN P=P-TPI
1870 IF P<0 THEN P=P+TPI
1875 RETURN
2097 REM
2098 REM SUBROUTINE RISET
2099 REM
2100 IF FLAG(9) = 1 THEN GOTO 2125
2115 CPHI = COS(PHI) : SPHI = SIN(PHI)
2120 TPI = 6.283185308 : FLAG(9) = 1
2125 CY = COS(Y) : A = CY * CPHI
2130 IF ABS(A) < 1E-10 THEN GOTO 2260
2135 CPSI = SPHI / CY
2140 IF CPSI > 1 THEN CPSI = 1
2145 IF CPSI < -1 THEN CPSI = -1
2150 PSI = FNACS(CPSI) : SPSI = SIN(PSI)
2155 DH = DIS * SPSI : Y1 = Y + (DIS * CPSI)
2160 SY = SIN(Y1) : TY = TAN(Y1)
2165 CH = (-1 * SPHI * TY) / CPHI
2170 IF CH < -1 THEN GOTO 2240
2175 IF CH > 1 THEN GOTO 2250
2180 ERR1 = 0 : H = FNACS(CH)
2185 H = (H + DH) * 3.819718634
2190 LSTR = 24 + X - H : LSTS = X + H
2195 CAZR = SY / CPHI : AZR = FNACS(CAZR)
2200 AZS = TPI - AZR : B = LSTR : C = 24 : GOSUB 2225
2205 LSTR = B : B = LSTS : GOSUB 2225 : LSTS = B
2210 B = AZR : C = TPI : GOSUB 2225 : AZR = B
2215 B = AZS : GOSUB 2225 : AZS = B
2220 RETURN
2225 IF B < 0 THEN B = B + C
2230 IF B > C THEN B = B - C
2235 RETURN
2240 ERR1 = -1 : PRINT "** circumpolar **"
2245 RETURN
2250 ERR1 = 1 : PRINT "** never rises **"
2255 RETURN
2260 ERR1 = 2 : PRINT "** IMPOSSIBLE CALCULATION **"
2265 RETURN
2697 REM
2698 REM Subroutine NUTAT
2699 REM
2700 IF FLAG(6) = 1 THEN RETURN
2710 FLAG(6) = 1 : FLAG(7) = 0
2715 GOSUB 1100 : T = DJD / 36525 : T2 = T * T
2720 A = 1.000021358E2 * T : B = 360 * (A - INT(A))
2725 LS = 2.796967E2 + 3.03E-4 * T2 + B
2730 A = 1.336855231E3 * T : B = 360 * (A - INT(A))
2735 LD = 2.704342E2 - 1.133E-3 * T2 + B
2740 A = 9.999736056E1 * T : B= 360 * (A - INT(A))
2745 MS = 3.584758E2 - 1.5E-4 * T2 + B
2750 A = 1.325552359E7 * T : B = 360 * (A - INT(A))
2755 MD = 2.961046E2 + 9.192E-3 * T2 + B
2760 A = 5.372616667 * T : B = 360 * (A - INT(A))
2765 NM = 2.591833E2 + 2.078E-3 * T2 -B
2770 TLS = 2 * FNRAD(LS) : NM = FNRAD(NM)
2775 TNM = 2 * FNRAD(NM) : MS = FNRAD(MS)
2780 TLD = 2 * FNRAD(LD) : MD = FNRAD(MD)
2785 DPSI=(-17.2327-1.737E-2*T)*SIN(NM)\
+(-1.2729-1.3E-4*T)*SIN(TLS)\
+2.088E-1*SIN(TNM)-2.037E-1*SIN(TLD)\
+(1.261E-1-3.1E-4*T)*SIN(MS)\
+6.75E-2*SIN(MD)\
-(4.97E-2-1.2E-4*T)*SIN(TLS+MS)\
-3.42E-2*SIN(TLD-NM)-2.61E-2*SIN(TLD+MD)\
+2.14E-2*SIN(TLS-MS)\
-1.49E-2*SIN(TLS-TLD+MD)\
+1.24E-2*SIN(TLS-NM)+1.14E-2*SIN(TLD-MD)
2790 DEPS=(9.21+9.1E-4*T)*COS(NM)\
+(5.522E-1-2.9E-4*T)*COS(TLS)\
-9.04E-2*COS(TNM)+8.84E-2*COS(TLD)\
+2.16E-2*COS(TLS+MS)+1.83E-2*COS(TLD-NM)\
+1.3E-2*COS(TLD+MD)-9.3E-3*COS(TLS-MS)\
-6.6E-3*COS(TLS-NM)
2795 DPSI = DPSI / 3600 : DEPS = DEPS / 3600
2800 RETURN
5997 REM
5998 REM Subroutine MOON
5999 REM
6000 GOSUB 1100 : T = DJD / 36525 : T2 = T * T
6010 M1 = 2.732158213E1 : M2 = 3.652596407E2
6015 M3 = 2.755455094E1 : M4 = 2.953058868E1
6020 M5 = 2.721222039E1 : M6 = 6.798363307E3
6025 M1 = DJD / M1 : M2 = DJD / M2 : M3 = DJD / M3
6030 M4 = DJD / M4 : M5 = DJD / M5 : M6 = DJD / M6
6035 M1 = 360 * (M1 - INT(M1)) : M2 = 360 * (M2 - INT(M2))
6040 M3 = 360 * (M3 - INT(M3)) : M4 = 360 * (M4 - INT(M4))
6045 M5 = 360 * (M5 - INT(M5)) : M6 = 360 * (M6 - INT(M6))
6050 LD = 2.70434164E2 + M1 - (1.133E-3 - 1.9E-6 * T) *T2
6055 MS = 3.58475833E2 + M2 - (1.5E-4 + 3.3E-6 * T) * T2
6060 MD = 2.96104608E2 + M3 + (9.192E-3 + 1.44E-5 * T) * T2
6065 DE = 3.50737486E2 + M4 - (1.436E-3 - 1.9E-6 * T) * T2
6070 F = 11.250889 + M5 - (3.211E-3 + 3E-7 * T) * T2
6075 N = 2.59183275E2 - M6 + (2.078E-3 + 2.2E-5 * T) * T2
6080 A = FNRAD(51.2 + 20.2 * T) : SA = SIN(A)
6085 SN = SIN(FNRAD(N))
6090 B = 346.56 + (132.87 - 9.1731E-3 * T) * T
6100 SB = 3.964E-3 * SIN(FNRAD(B))
6105 C = FNRAD(N + 275.05 - 2.3 * T) : SC = SIN(C)
6110 LD = LD + 2.33E-4 * SA + SB + 1.964E-3 * SN
6115 MS = MS - 1.778E-3 * SA
6120 MD = MD + 8.17E-4 * SA + SB + 2.541E-3 * SN
6125 F = F + SB - 2.4691E-2 * SN - 4.328E-3 * SC
6130 DE = DE + 2.011E-3 * SA + SB + 1.964E-3 * SN
6135 E = 1 - (2.495E-3 + 7.52E-6 *T) * T : E2 = E * E
6140 LD = FNRAD(LD) : MS = FNRAD(MS) : N = FNRAD(N)
6145 DE = FNRAD(DE) : F = FNRAD(F) : MD = FNRAD(MD)
6150 L = 6.28875 * SIN(MD) + 1.274018 * SIN(2 * DE - MD)\
+ 6.58309E-1 * SIN(2 * DE)\
+ 2.13616E-1 * SIN(2 * MD)\
- E * 1.85596E-1 * SIN(MS)\
- 1.14336E-1 * SIN(2 * F)\
+ 5.8793E-2 * SIN(2 * (DE - MD))\
+ 5.7212E-2 * E * SIN(2 * DE - MS - MD)\
+ 5.332E-2 * SIN(2 * DE + MD)\
+ 4.5874E-2 * E * SIN(2 * DE - MS)\
+ 4.1024E-2 * E * SIN(MD - MS)\
- 3.4718E-2 * SIN(DE) - E * 3.0465E-2 * SIN(MS + MD)\
+ 1.5326E-2 * SIN(2 * (DE - F))\
- 1.2528E-2 * SIN(2 * F + MD)\
- 1.098E-2 * SIN(2 * F - MD)\
+ 1.0674E-2 * SIN(4 * DE - MD)\
+ 1.0034E-2 * SIN(3 * MD)\
+ 8.548E-3 * SIN(4 * DE - 2 * MD)\
- E * 7.91E-3 * SIN(MS - MD + 2 * DE)\
- E * 6.783E-3 * SIN(2 * DE + MS)\
+ 5.162E-3 * SIN(MD - DE) + E * 5E-3 * SIN(MS + DE)\
+ 3.862E-3 * SIN(4 * DE)\
+ E * 4.049E-3 * SIN(MD - MS + 2 * DE)\
+ 3.996E-3 * SIN(2 * (MD + DE))\
+ 3.665E-3 * SIN(2 * DE - 3 * MD)\
+ E * 2.695E-3 * SIN(2 * MD - MS)\
+ 2.602E-3 * SIN(MD - 2 * (F + DE))\
+ E * 2.396E-3 * SIN(2 * (DE - MD) - MS)\
- 2.349E-3 * SIN(MD + DE)\
+ E2 * 2.249E-3 * SIN(2 * (DE - MS))\
- E * 2.125E-3 * SIN(2 * MD + MS)\
- E2 * 2.079E-3 * SIN(2 * MS)\
+ E2 * 2.059E-3 * SIN(2 * (DE - MS) - MD)\
- 1.773E-3 * SIN(MD + 2 * (DE - F))\
- 1.595E-3 * SIN(2 * (F + DE))\
+ E * 1.22E-3 * SIN(4 * DE - MS - MD)\
- 1.11E-3 * SIN(2 * (MD + F))\
+ 8.92E-4 * SIN(MD - 3 * DE)\
- E * 8.11E-4 * SIN(MS + MD + 2 * DE)\
+ E * 7.61E-4 * SIN(4 * DE - MS - 2 * MD)\
+ E2 * 7.04E-4 * SIN(MD - 2 * (MS + DE))\
+ E * 6.93E-4 * SIN(MS - 2 * (MD - DE))\
+ E * 5.98E-4 * SIN(2 * (DE - F) - MS)\
+ 5.5E-4 * SIN(MD + 4 * DE) + 5.38E-4 * SIN(4 * MD)\
+ E * 5.21E-4 * SIN(4 * DE - MS)\
+ 4.86E-4 * SIN(2 * MD - DE)\
+ E2 * 7.17E-4 * SIN(MD - 2 * MS)
6160 LAM = LD + FNRAD(L) : TPI = 6.283185308
6165 IF LAM < 0 THEN LAM = LAM + TPI : GO TO 6165
6170 IF LAM > TPI THEN LAM = LAM - TPI : GO TO 6170
6175 G = 5.128189 * SIN(F) + 2.80606E-1 * SIN(MD + F)\
+ 2.77693E-1 * SIN(MD - F)\
+ 1.73238E-1 * SIN(2 * DE - F)\
+ 5.5413E-2 * SIN(2 * DE + F - MD)\
+ 4.6272E-2 * SIN(2 * DE - F - MD)\
+ 3.2573E-2 * SIN(2 * DE + F)\
+ 1.7198E-2 * SIN(2 * MD + F)\
+ 9.267E-3 * SIN(2 * DE + MD - F)\
+ 8.823E-3 * SIN(2 * MD - F)\
+ E * 8.247E-3 * SIN(2 * DE - MS - F)\
+ 4.323E-3 * SIN(2 * (DE - MD) - F)\
+ 4.2E-3 * SIN(2 * DE + F + MD)\
+ E * 3.372E-3 * SIN(F - MS - 2 * DE)\
+ E * 2.472E-3 * SIN(2 * DE + F - MS - MD)\
+ E * 2.222E-3 * SIN(2 * DE + F - MS)\
+ E * 2.072E-3 * SIN(2 * DE - F - MS - MD)\
+ E * 1.877E-3 * SIN(F - MS + MD)\
+ 1.828E-3 * SIN(4 * DE - F - MD)\
- E * 1.803E-3 * SIN(F + MS) - 1.75E-3 * SIN(3 * F)\
+ E * 1.57E-3 * SIN(MD - MS - F)\
- 1.487E-3 * SIN(F + DE)\
- E * 1.481E-3 * SIN(F + MS + MD)\
+ E * 1.417E-3 * SIN(F - MS - MD)\
+ E * 1.35E-3 * SIN(F - MS) + 1.33E-3 * SIN(F - DE)\
+ 1.106E-3 * SIN(F + 3 * MD) + 1.02E-3 * SIN(4 * DE - F)\
+ 8.33E-4 * SIN(F + 4 * DE - MD)\
+ 7.81E-4 * SIN(MD - 3 * F)\
+ 6.7E-4 * SIN(F + 4 * DE - 2 * MD)\
+ 6.06E-4 * SIN(2 * DE - 3 * F)\
+ 5.97E-4 * SIN(2 * (DE + MD) - F)\
+ E * 4.92E-4 * SIN(2 * DE + MD - MS - F)\
+ 4.5E-4 * SIN(2 * (MD - DE) - F)\
+ 4.39E-4 * SIN(3 * MD - F)\
+ 4.23E-4 * SIN(F + 2 * (DE + MD))\
+ 4.22E-4 * SIN(2 * DE - F - 3 * MD)\
- E * 3.67E-4 * SIN(MS + F + 2 * DE - MD)\
- E * 3.53E-4 * SIN(MS + F + 2 * DE)\
+ 3.31E-4 * SIN(F + 4 * DE)\
+ E * 3.17E-4 * SIN(2 * DE + F - MS + MD)\
+ E2 * 3.06E-4 * SIN(2 * (DE - MS) - F)\
- 2.83E-4 * SIN(MD + 3 * F)
6185 W1 = 4.664E-4 * COS(N) : W2 = 7.54E-5 * COS(C)
6190 BET = FNRAD(G) * (1 - W1 - W2)
6195 HP = 9.50724E-1 + 5.1818E-2 * COS(MD)\
+ 9.531E-3 * COS(2 * DE - MD)\
+ 7.843E-3 * COS(2 * DE) + 2.824E-3 * COS(2 * MD)\
+ 8.57E-4 * COS(2 * DE + MD)\
+ E * 5.33E-4 * COS(2 * DE - MS)\
+ E * 4.01E-4 * COS(2 * DE - MD - MS)\
+ E * 3.2E-4 * COS(MD - MS) - 2.71E-4 * COS(DE)\
- E * 2.64E-4 * COS(MS + MD)\
- 1.98E-4 * COS(2 * F - MD) + 1.73E-4 * COS(3 * MD)\
+ 1.67E-4 * COS(4 * DE - MD) - E * 1.11E-4 * COS(MS)\
+ 1.03E-4 * COS(4 * DE - 2 * MD)\
- 8.4E-5 * COS(2 * MD - 2 * DE)\
- E * 8.3E-5 * COS(2 * DE + MS)\
+ 7.9E-5 * COS(2 * DE + 2 * MD) + 7.2E-5 * COS(4 * DE)\
+ E * 6.4E-5 * COS(2 * DE - MS + MD)\
- E * 6.3E-5 * COS(2 * DE + MS - MD)\
+ E * 4.1E-5 * COS(MS + DE)\
+ E * 3.5E-5 * COS(2 * MD - MS)\
- 3.3E-5 * COS(3 * MD - 2 * DE) - 3E-5 * COS(MD + DE)\
- 2.9E-5 * COS(2 * (F - DE))\
- E * 2.9E-5 * COS(2 * MD + MS)\
+ E2 * 2.6E-5 * COS(2 * (DE - MS))\
- 2.3E-5 * COS(2 * (F - DE) + MD)\
+ E * 1.9E-5 * COS(4 * DE - MS - MD)
6205 HP = FNRAD(HP)
6210 RETURN
6397 REM
6398 REM Subroutine MOONRS
6399 REM
6400 DY0 = DY : MN0 = MN : YR0 = YR : DY = DY0 + 0.5
6415 GOSUB 6530
6420 IF ERR1 NE 0 THEN RETURN
6425 PASS = 0 : AL = LNG / 15
6430 TR = LSTR - AL : TS = LSTS - AL : GOSUB 6565
6435 ERR4 = 0 : ERR5 = 0
6440 DY = DY0 : PASS = PASS + 1
6445 TIM = TR : SW2 = -1 : GOSUB 1300
6450 IF GTM > 23.5 OR GTM < 0.5 THEN ERR4 = 1
6455 GTMR = GTM : TIM = TS : GOSUB 1300
6460 IF GTM > 23.5 OR GTM < 0.5 THEN ERR5 = 1
6465 GTMS = GTM : DJD0 = DJD
6470 DJD = DJD0 + GTMR / 24 : GOSUB 6530
6475 IF ERR1 NE 0 THEN RETURN
6480 AZR0 = AZR : TR = LSTR - AL
6485 DJD = DJD0 + GTMS / 24 : GOSUB 6530
6490 IF ERR1 NE 0 THEN RETURN
6495 AZS0 = AZS : TS = LSTS - AL : GOSUB 6565
6500 IF PASS < 2 THEN GOTO 6440
6505 DY = DY0 : TIM = TR + 8.333E-3 : GOSUB 1300
6510 HSR = HS : MSR = MS
6515 TIM = TS + 8.333E-3 : GOSUB 1300
6520 HSS = HS : MSS = MS
6525 RETURN
6530 GOSUB 6000 : GOSUB 2700
6535 TH = 2.7249E-1 * SIN(HP) : HT = 0
6540 DIS = TH + 9.8902E-3 - HP
6545 X = FNRAD(DPSI) + LAM : Y = BET
6550 SW3 = -1 : GOSUB 1800
6555 X = FNDEG(P / 15) : Y = Q : GOSUB 2100
6560 RETURN
6565 IF TR < 0 THEN TR = TR + 24
6570 IF TR > 24 THEN TR = TR - 24
6575 IF TS < 0 THEN TS = TS + 24
6580 IF TS > 24 THEN TS = TS - 24
6585 RETURN