[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
ATM Alt-Azimuth Code LONG
Enclosed you will find the code for Altitude and Azimuth calculations. It is
written in a simple Basic used by a Tandy PC-7 Pocket Computer. It was
written into 3 program areas of which 2 are accessed as GOSUB routines. I
had to go back and get the code for the whole Earth. I had shortcut some of
my inputs account I tend to stay in the same hemisphere.
All the GOTOs aren't very elegant, but it works on this little machine. No
doubt you can touch it up.
ALTZ-P0W.TXT
Main program routine for whole world
10 PRINT "Alt-Azim"
20 PRINT "LONGITUDE"
30 X=1:GOSUB #8
40 Y=T
50 PRINT "LATITUDE"
60 X=2:GOSUB #8
70 L=T
80 PRINT "UT DATE"
90 INPUT "YEAR",K
100 INPUT "MONTH",M
110 INPUT "DAY",I
120 Z=367*K-INT((7*(K+INT((M+9)/12))/4))
130 Z=Z+INT(275*M/9)+I+1721013.5 Julian Date for 0hr UT
140 Z=(Z-2451545)/36525 Julian Century
from J2000
150 PRINT "STAR RA"
160 X=3:GOSUB #8
170 E=T*15
180 PRINT "STARDECL"
190 X=2:GOSUB #8
200 F=T
210 PRINT "UT TIME"
220 X=3:GOSUB #8
230 U=T
240 V=6.697374560000004+(2400.051336*Z)
250 V=V+(2.58622E-05*Z^2)+(1.002737909*U) Greenwich Mean Sidereal Time
260 IF V>=24 THEN V=V-24:GOTO 260
270 IF V<=0 THEN V=V+24:GOTO 270
280 J=V+Y/15:J=J*15 Local Apparent
Sidereal Time
290 IF J>=24 THEN J=J-24:GOTO 290
300 IF J<=0 THEN J=J+24:GOTO 300
310 GOSUB #9
320 GOTO 150
altz-p8.txt
P8 on PC7 GOSUB 8 for WHOLE WORLD
100 REM INPUTS
110 ON X GOTO 120,170,250
120 PRINT "E or W?";
130 A$= KEY$
140 IF A$="E" THEN S=1:GOTO 220
150 IF A$="W" THEN S=-1:GOTO 220
160 GOTO 130
170 PRINT "+ or - ?";
180 A$= KEY$
190 IF A$="+" THEN S=1:GOTO 220
200 IF A$="-" THEN S=-1:GOTO 220
210 GOTO 180
220 PRINT
230 INPUT "Degrees",D
240 GOTO 270
250 S=1
260 INPUT "Hours",D
270 INPUT "Minutes",O
280 T=S*(D+O/60):X=0:S=0:A=0:D=0:O=0
290 RETURN
altz-p9.txt
Gosub #9 for altaz
120 J=J*15
130 IF E=J THEN IF L=F THEN N=90:P=0:GOTO 240
140 IF E=J THEN IF L<F THEN P=0:N=90-(F-L):GOTO 240
150 IF E=J THEN IF L>F THEN P=180:N=90-(L-F):GOTO 240
160 IF E-J=180 THEN P=0:N=L-(90-F):GOTO 240
170 IF J-E=180 THEN P=0:N=L-(90-F):GOTO 240
180 K=J-E:IF ABSK <2E-5 THEN J=E: GOTO 130
190 M=SINF* SINL+ COSF * COSL* COSK:N=ASNM
200 O=( SINF-( SINL*M))/( COSL* COSN):P=ASCO
210 IF J>E THEN IF J<=E+180 THEN P=360-P
220 IF E=>J+180 THEN P=360-P
230 SET F2
240 PRINT "AZM=";P;"`"
250 PRINT "ALT=";N;"`"
260 SET N
270 RETURN
SET is a command for a display specific to this computer
ABS is Absolute value
SIN is sin ASN is inverse sin
COS is cosine ACS is inverse Cosine
"IF (statement) THEN IF (statement) THEN" is same as
"IF (statement)AND (statement) THEN"
I hope this helps , I would like to see any improvements
Virgil Johnson
Raider of the Lost Dark