MY PROGRAMS Sun-Moon 2.3a PROGRAM This program calculates the following: -dates marking the Easter and Christmas season -all full and new moons for the period of a year (starting in any month) -the times for sunrise, sunset, moonrise, moonset at any date and any place, -the position, phase, and distance of the Moon from Earth. By default the program starts with the latitude and longitude of Charlotte, NC and the current date, but you have the option to store a different default location in the flash memory. (The name of the file used is "E:geo1".) My sources were: - Basic Programs published in the journal "Astronomical Computing, Sky and Telescope" at www.skypub.com/resources/ software/basic/basic.html, -I checked (and corrected) the full moon calculations against the book "Astronomical Formulae for Calculators" by Jean Meeus -the pages on calendar systems by Peter Meyers at serendipity.magnet.ch/ hermetic/cal_stud.htm -Peter Baum's date algorithms at home.capecod.net/~pbaum/info3.htm -Date of Easter formula from sciastro.astronomy.net/ sci.astro.3.FAQ -Moon phase pictures were provided by Istvn Totka (totka@freemail.hu) Gbor Hetyei ghetyei@uncc.edu BIN_PROG_1 PFILE:BI49YFW2.BAS    = E = E =   0A(2),D(2):0M(3,3) 2Y9=((,4)):M9=((,5,2)):D9=((,2))  U+20 !"E:geo1"Was#1 &a#1,B9:a#1,L9:a#1,H9:"#1:+100 B9=35:L9=-80:H9=5 dP nAQ2,0:`"[1] Dates marking the Easter and Christmas season" x1Q2,1:`"[2] Full and new moons for a year" DQ2,2:`"[3] Rise/set times for the Sun and the Moon this day" %Q2,3:`"[4] Current moonphase" Q2,5:`"[S] Settings" Q121,5:`"[H] Help" Q2,6:`"[Esc] Exit" Q121,6:`"[C] Credits" XA$=(1) V(A$)=27TZ VA$="1"T1000 VA$="2"T2000 VA$="3"T \3000 VA$="4"T)t10000 VA$="s"A$="S"T$8000 VA$="h"A$="H"T!7500 VA$="c"A$="C"T"7800 " +200 Y -P:a"Give a year later than 1582. Year =";Y VY<1583T1010  C=(Y/100)  N=Y-19*(Y/19):K=((C-17)/25)  I=C-(C/4)-((C-K)/3)+19*N+15 $I=I-30*(I/30) .5I=I-(I/28)*(1-(I/28)*(29/(I+1))*((21-N)/11)) 8.J=Y+(Y/4)+I+2-C+(C/4):J=J-7*(J/7):L=I-J B$M=3+((L+40)/44):D=L+28-31*(M/4) L0Y2=Y:M2=M:D2=D:b 86000:J=J+FJ-46:b5000:Y V2P:Q2,0:`"Ash Wednesday:":Q121,0:b0*11000:Y `>Y=Y2:M=M2:D=D2:Q2,1:`"Easter Sunday:":Q121,1:b0*11000:Y jJ=J+95:b5000:Y t+Q2,2:`"Pentecost:":Q121,2:b0*11000:Y ~EJ1=J:M=12:D=25:b 86000:W=J-J1-7*((J-J1)/7):J=J-W-21:b5000:Y 8Q2,3:`"First Sunday of Advent:":Q121,3:b0*11000:Y 9M=12:D=25:Q2,4:`"Christmas Day:":Q121,4:b0*11000:Y b(9000:+100 Y 5P:b <2990:a"Year=";Y:a"Month=";M:XY=Y+(M-1)/12 Db <2990:S1=0:U=0 HY JK0=((Y-1900)*12.3685) LT=(Y-1900)/100 NT2=T*T:T3=T*T*T PJ0=2415020+29*K0 RF0=.0001178*T2-.000000155*T3 TF0=F0+.75933+.53058868*K0 V.F0=F0+0.00033*(166.56+132.87*T-0.009173*T2) XJ0=J0+(F0):F0=F0-(F0) ZM0=K0*29.10535608 \M0=M0-(M0/360)*360+359.2242 ^M0=M0-.0000333*T2 `M0=M0-.00000347*T3 bM1=K0*385.81691806 dM1=M1-(M1/360)*360+306.0253 fM1=M1+.0107306*T2 hM1=M1+.00001236*T3 jB1=K0*390.67050646 lB1=B1-(B1/360)*360+21.2964 nB1=B1-.0016528*T2 pB1=B1-.00000239*T3 r WK9=0R28 tJ=J0+14*K9:F=F0+.76529434*K9 vK=K9/2 xM5=M0+K*29.10535608 yM6=M1+K*385.81691806 zB6=B1+K*390.67050646 {0TP3570 V0=S*(D0)+C*(D0)*(H0)-Z V2=S*(D2)+C*(D2)*(H2)-Z V(V0)=(V2)T3800 V1=S*(D1)+C*(D1)*(H1)-Z  A=2*V2-4*V1+2*V0:B=4*V1-3*V0-V2 D=B*B-4*A*V0:VD<0T3800 $D=(D) .VV0<0V2>0T`"Sunrise at "; 8VV0<0V2>0TM8=1 BVV0>0V2<0T`"Sunset at "; LVV0>0V2<0TW8=1 VE=(-B+D)/(2*A) `VE>1E<0TE=(-B-D)/(2*A) jT3=C0+E+1/120:' tH3=(T3):M3=((T3-H3)*60) ~UU1=(H3/10):U2=H3-10*U1:U3=(M3/10):U4=M3-10*U3:`(U1);(U2);":";(U3);(U4); H7=H0+E*(H2-H0) N7=-(D1)*(H7) D7=C*(D1)-S*(D1)*(H7)  AZ=(N7/D7) VD7<0TAZ=AZ+180 VAZ<0TAZ=AZ+360 VAZ>360TAZ=AZ-360 !`/"####.#";", azimuth ";AZ:/ e ' ' VM8=0W8=0T_3870 "VM8=0T`"No sunrise this date."  !VW8=0T`"No sunset this date."  +3890 VV2<0T`"Sun down all day." (VV2>0T`"Sun up all day." 2e F' H' J' LL=.779072+.00273790931*T NG=.993126+.0027377785*T PL=L-(L):G=G-(G) RL=L*360:G=G*360 TV=.39785*(L) VV=V-.01*(L-G) XV=V+.00333*(L+G) ZV=V-.00021*TT*(L) \U=1-.03349*(G) ^U=U-.00014*(2*L) `U=U+.00008*(L) bW=-.0001-.04129*(2*L) dW=W+.03211*(G) fW=W+.00104*(2*L-G) hW=W-.00035*(2*L+G) jW=W-.00008*TT*(G) n' pS=W/(U-V*V) rA5=L+(S/(1-S*S)) tS=V/(U):D5=(S/(1-S*S)) vR5=1.00021*(U) xe Y T=(J-2451545)+FJ b! 6500:T=T+Z0 Y Y  WI=1R3 b4495:M(I,1)=A5 M(I,2)=D5:M(I,3)=R5:T=T+.5 [ VM(2,1)>M(1,1)T54085 M(2,1)=M(2,1)+360 VM(3,1)>M(2,1)Tf4095 M(3,1)=M(3,1)+360 Z1=90.567-41.685/M(2,3) S=(B5):C=(B5)  Z=(Z1):M8=0:W8=0 A0=M(1,1):D0=M(1,2)  WC0=0R23  P=(C0+1)/24 F0=M(1,1):F1=M(2,1):F2=M(3,1) "b4225:A2=F 'F0=M(1,2):F1=M(2,2):F2=M(3,2) ,b4225:D2=F 1b4280:A0=A2:D0=D2:V0=V2 6[ ; b4450:Y @b(9000:+100 Y A=F1-F0:B=F2-F1-A F=F0+P*(2*A+B*(2*P-1)) e Y L0=T0+C0*K1:L2=L0+K1 VA20To4325 V0=S*(D0)+C*(D0)*(H0)-Z V2=S*(D2)+C*(D2)*(H2)-Z V(V0)=(V2)T4440 V1=S*(D1)+C*(D1)*(H1)-Z  A=2*V2-4*V1+2*V0:B=4*V1-3*V0-V2 D=B*B-4*A*V0:VD<0T4440 D=(D)  VV0<0V2>0T`"Moonrise at "; VV0<0V2>0TM8=1  VV0>0V2<0T`"Moonset at "; VV0>0V2<0TW8=1 E=(-B+D)/(2*A) VE>1E<0TE=(-B-D)/(2*A) !T3=C0+E+1/120:Y &H3=(T3):M3=((T3-H3)*60) +UU1=(H3/10):U2=H3-10*U1:U3=(M3/10):U4=M3-10*U3:`(U1);(U2);":";(U3);(U4); 0H7=H0+E*(H2-H0) 5N7=-(D1)*(H7) :D7=C*(D1)-S*(D1)*(H7) ? A7=(N7/D7) DVD7<0TA7=A7+180 IVA7<0TA7=A7+360 NVA7>360TA7=A7-360 S!`/"####.#";", azimuth ";A7:/ Xe ]Y bY gVM8=0W8=0T4475 l#VM8=0T`"No moonrise this date." q"VW8=0T`"No moonset this date." v +4485 {VV2<0T`"Moon down all day." VV2>0T`"Moon up all day." e Y Y L=.606434+.03660110129*T M=.374897+.03629164709*T F=.259091+.0367481952*T D=.827362+.03386319198*T N=.347343-.00014709391*T G=.993126+.0027377785*T L=L-(L):M=M-(M) F=F-(F):D=D-(D) N=N-(N):G=G-(G) L=L*360:M=M*360:F=F*360 D=D*360:N=N*360:G=G*360 V=.39558*(F+N) V=V+.082*(F) V=V+.03257*(M-F-N) V=V+.01092*(M+F+N) V=V+.00666*(M-F) V=V-.00644*(M+F-2*D+N) V=V-.00331*(F-2*D+N) V=V-.00304*(F-2*D) V=V-.0024*(M-F-2*D-N) V=V+.00226*(M+F) V=V-.00108*(M+F-2*D) V=V-.00079*(F-N) V=V+.00078*(F+2*D+N)  U=1-.10828*(M) U=U-.0188*(M-2*D) U=U-.01479*(2*D) U=U+.00181*(2*M-2*D)  U=U-.00147*(2*M) %U=U-.00105*(2*D-G) *U=U-.00075*(M-2*D+G) /W=.10478*(M) 4W=W-.04105*(2*F+2*N) 9W=W-.0213*(M-2*D) >W=W-.01779*(2*F+N) CW=W+.01774*(N) HW=W+.00987*(2*D) MW=W-.00338*(M-2*F-2*N) RW=W-.00309*(G) WW=W-.0019*(2*F) \W=W-.00144*(M+N) aW=W-.00144*(M-2*F-N) fW=W-.00113*(M+2*F+2*N) kW=W-.00094*(M-2*D+G) pW=W-.00092*(2*M-2*D) uY zY S=W/(U-V*V) A5=L+(S/(1-S*S)) S=V/(U):D5=(S/(1-S*S)) R5=60.40974*(U) e ' TG=0:VJ>2299160TTG=1 0ND=J-1721116.5-TG*2:FJ=ND-(ND):ND=(ND):TY=0 8T1=((ND-1)/146097):TY=TY+TG*T1*400:ND=ND-TG*T1*146097 4T1=(ND/36524.3):TY=TY+TG*T1*100:ND=ND-T1*TG*36524 ,T1=((ND-1)/1461):TY=TY+T1*4:ND=ND-T1*1461 &T1=(ND/365.3):TY=TY+T1:ND=ND-T1*365 #TM=(((5*ND-3)/153))*(5*ND-3) D=ND-TM*30-(0.6*(TM-1)+1)VTM>9TXT1=1vXT1=0 Y=TY+T1:M=TM+3-T1*12 e pY z&TG=0:V10000*Y+100*M+D>15821014TTG=1 VM<3TXT1=1vXT1=0 TY=Y-T1:TM=M-3+T1*12 TJ=TY*365+(TY/4)-TG*(TY/100)+TG*(TY/400)+30*TM+(0.6*(TM-1))+D+1721117.5+2*TG FJ=J-(J):J=(J) e dY i T0=T/36525 nS=24110.5+8640184.813*T0 sS=S+86636.6*Z0+86400*L5 xS=S/86400:S=S-(S) } T0=S*360 e XY b#B5=B9:L5=L9:H=H9:Y=Y9:M=M9:D=D9:e LP V6`"At first run the location is set to Charlotte NC." `7`"You may save your location in the flash memory, by" j&`"using [3] in the Settings menu." t4`"Dates are displayed in ISO format (YYYY-MM-DD)," ~%`"1 BC is year 0, 2 BC is year -1." 3`"At startup the program loads the current date." b(9000:+100 xP:`"Sources:" 7`"www.skypub.com/resources/software/basic/basic.html" 0`"serendipity.magnet.ch/hermetic/cal_stud.htm" &`"home.capecod.net/~pbaum/info3.htm" +`"sciastro.astronomy.net/sci.astro.3.FAQ" 8`"Astronomical Formulae for Calculators by Jean Meeus" #b(9100:VA$="A"A$="a"T100 =P:`"Moon phase pictures: Istvn Totka (totka@freemail.hu)" $b)(9200:VA$="B"A$="a"T"7800  +100 @Y JP:`"Change settings" TAQ2,1:`"[1] Change location and timezone (this session only)" ^0Q2,2:`"[2] Change date (this session only)" h3Q2,3:`"[3] Save current location and timezone" r@Q2,4:`"[4] Reset location and timezone (delete saved data)" |$Q2,6:`"[B] Back to main screen" Q121,6:`"[Esc] Exit"  XA$=(1) V(A$)=27TZ VA$="b"A$="B"T100 VA$="1"T&8500 VA$="2"T'D8600 VA$="3"T'8700 VA$="4"T( 8800  +%8080 !46P:`"Latitude (deg, North positive) [";B9;"]=";:aB9 !>3`"Longitude (deg, East positive) [";L9;"]=";:aL9 !H2`"Local time (hours behind GMT) [";H9;"]=";:aH9 !R +100 ! P:`"Year [";(Y9);"]=";:aY9 !`"Month [";(M9);"]=";:aM9 !`"Day [";(D9);"]=";:aD9 ! +100 !P:`"Saving ..."; "!"E:geo1"Wqs#1 "`#1,B9:`#1,L9:`#1,H9:"#1 "`"done!":b(9000:+100 "`P:`"Erasing saved data... "; "j'<"E:geo1":`"Restoring default ... "; "tB9=35:L9=-80:H9=5 "~`"Done!":b(9000:+100 #(&Q0,6:`"[Press any key to continue]" #2XA$=(1):e #9Q1,6:`"[A] Abort":Q121,6:`"[Any other key] Continue" #XA$=(1):e #8Q1,6:`"[B] Back":Q121,6:`"[Any other key] Continue" #XA$=(1):e '' '