`*NAME IARU_locator d 7: 12: 7: l_initialize p_screen_1 t_screen_3 x |_get_input . (iaru$)=6 _iaru_globe _globe_iaru _show_results    _initialize 2 Declare the working storage for the program.  2lat$="dd.mmss":long$="ddd.mmss":iaru$="..nn.."  B letter1$(24):letter1$(1)="A":letter1$(2)="B":letter1$(3)="C" Cletter1$(4)="D":letter1$(5)="E":letter1$(6)="F":letter1$(7)="G" Eletter1$(8)="H":letter1$(9)="I":letter1$(10)="J":letter1$(11)="K" Gletter1$(12)="L":letter1$(13)="M":letter1$(14)="N":letter1$(15)="O" Gletter1$(16)="P":letter1$(17)="Q":letter1$(18)="R":letter1$(19)="S" Gletter1$(20)="T":letter1$(21)="U":letter1$(22)="V":letter1$(23)="W" letter1$(24)="X"  B number1$(10):number1$(1)="0":number1$(2)="1":number1$(3)="2" Cnumber1$(4)="3":number1$(5)="4":number1$(6)="5":number1$(7)="6" 4number1$(8)="7":number1$(9)="8":number1$(10)="9"  neg1%=-1    _screen_0   12  + Define the Z88 screen for other uses.  ' 3,0);"I A R U L O C A T O R "; ) " C O N V E R S I O N "; % 1,138,61,64,7,8,17,18,18,17,8,7 % 1,138,61,65,56,4,50,2,2,50,4,56  1,50,63,64,1,50,63,65  " 1991, L.J.DEVANEY.";  " version 1.00";  82,7);"ESC to exit";  $ , _screen_1 0 4_screen_0 8 7< Define the Z88 screen for the initial commentary. @ D 1,50,43,84 ?H 1,2);"THIS PROGRAM ACCEPTS AN IARU LOCATOR AND RETURNS"; 3L " THE GLOBAL CO-ORDINATES CORRESPONDING TO "; ?P 1,3);"IT. BECAUSE OF THE NATURE OF THE LOCATOR THE MAX"; 3T "IMUM ERROR IS 5' IN LONGITUDE AND 2.5' IN "; ?X 1,4);"LATITUDE. GLOBAL CO-ORDINATES ARE ALSO CONVERTED"; 3\ " TO AN IARU LOCATOR WHEN APPROPRIATE. DO "; ?` 1,5);"REMEMBER THAT LONGITUDE IS A MAXIMUM OF 180 DEGR"; 3d "EES AND LATITUDE A MAXIMUM OF 90 DEGREES. "; h l 1,50,45,84 p )t 1,7);"Press a key to continue - "; x (0)=-1 | a$ a$=    _screen_2 _screen_0 1 3,2);" IARU Latitude Longitude "; 1 3,3);"locator dd ? mm ss ddd ? mm ss"; A 1,7);" "; & " |";   _screen_3  _screen_0  6 Define the Z88 screen for the second commentary.   1,50,43,84 ? 1,2);"THE OFFICIALLY PUBLISHED ALGORITHM HAS TWO ERROR"; 3 "S IN IT. THE LONGITUDE 180E HAS TO BE "; ? 1,3);"REPRESENTED BY 'A0A', USED BECAUSE IT IS ADJACEN"; 3 "T TO 180W. THE LATITUDE 90N HAS TO BE "; ? 1,4);"REPRESENTED BY 'R9X' BECAUSE IT IS AN END POINT "; 3 "AND 'S0A' IS NOT ALLOWED. "; ? 1,5);"** ** ALL LETTERS ARE TO BE ENTERED IN UPPER CAS";  "E ** **";   1,50,45,84  ) 1,7);"Press a key to continue - ";  (0)=-1  a$ a$=    _get_input  _screen_2  !$ Ask for the input data. ( /, lupe%,a$,b$,c$,f$,d1%,m1%,s1%,d2%,m2%,s2% %0lupe%=1:a$="......":b$=".":c$="." '4d1%=0:m1%=0:s1%=0:d2%=0:m2%=0:s2%=0 8 < (0)=-1 6@ 4,5);""a$;13,5);""d1%;16,5);""b$;18,5);""m1% ,D 21,5);""s1%;26,5);""d2%;30,5);""c$ H 32,5);""m2%;35,5);""s2% AL 1,7);" "; &P " |"; T_strip_blanks AX PRINT TAB(50,2);" "; A\ PRINT TAB(50,3);" "; A` PRINT TAB(50,4);" "; Ad PRINT TAB(50,5);" "; 5h PRINT TAB(50,2);"a$=";a$;", b$=";b$;", c$=";c$; ;l PRINT TAB(50,3);"d1%=";d1%;", m1%=";m1%;", s1%=";s1%; ;p PRINT TAB(50,4);"d2%=";d2%;", m2%=";m2%;", s2%=";s2%; t lupe%<>0 (0)=-1 x lupe%<>0 80,7);:f$= | lupe%=0 iaru$=a$ . lupe%=0 a$=(100+d1%):lat$=a$,2,2)+b$ 0 lupe%=0 a$=(100+m1%):lat$=lat$+a$,2,2) 0 lupe%=0 a$=(100+s1%):lat$=lat$+a$,2,2) 0 lupe%=0 a$=(1000+d2%):long$=a$,2,3)+c$ 2 lupe%=0 a$=(100+m2%):long$=long$+a$,2,2) 2 lupe%=0 a$=(100+s2%):long$=long$+a$,2,2) lupe%=0 : PRINT TAB(50,5);iaru$+" -- "+lat$+" -- "+long$+"..";  REPEAT UNTIL INKEY(0)=-1  PRINT TAB(80,7);:f$=GET$   _show_results  _screen_2  ) Show the results of the conversion.  & a$,b$,c$,d1%,m1%,s1%,d2%,m2%,s2% 'a$=lat$,3,1):b$=long$,4,1):c$="." (d1%=(lat$,1,2)):d2%=(long$,1,3)) (m1%=(lat$,4,2)):m2%=(long$,5,2)) (s1%=(lat$,6,2)):s2%=(long$,7,2)) 2 4,5);iaru$;13,5);d1%;16,5);a$;18,5);m1%; 1 21,5);s1%;26,5);d2%;30,5);b$;32,5);m2%;  35,5);s2%;  (0)=-1  80,7);:c$=   _iaru_error_1 < 1,7);"Locator length error - must be six characters";   _iaru_error_2 6 1,7);"All input data are wrong - please retry";   _iaru_error_3 ? 1,7);"Is the latitude input incorrect ? - please retry";  ( _iaru_error_4 @, 1,7);"Is the longitude input incorrect ? - please retry"; 0 8 _iaru_error_5 @< 1,7);"The initial two letters of a locator are limited "; @ "to A - R."; D L _iaru_error_6 @P 1,7);"The middle two characters of a locator are limite"; T "d to 0 - 9."; X ` _iaru_error_7 @d 1,7);"The last two characters of a locator are limited "; h "to A - X."; l t _iaru_error_8 @x 1,7);"The latitude is incorrect! Please retry. "; |  _iaru_error_9 @ 1,7);"The longitude is incorrect! Please retry. ";   _strip_blanks  r%,s%,t%,u%,v$,w$,x$ w$="WwEe":x$="NnSs" r%=(a$):v$=".":u%=r%  s%=r% 1 -1 v$=a$,s%,1) & (v$>"@") (v$<"[") u%=s%:s%=0 & (v$>"`") (v$<"{") u%=s%:s%=0 & (v$>"/") (v$<":") u%=s%:s%=0 # (s%<2) (r%>u%) a$=a$,u%)  s%  u%>6 _iaru_error_1: t%=x$,b$)  t%=0 b$="." t%=w$,c$)  t%=0 c$="." t%=1  (u%<>6) _iaru_test_2  t%=0  (u%=6) _iaru_test_3  t%=0  (u%<>6) _iaru_test_4  t%=0 lupe%=0   _iaru_test_2 t%=0:iaru$="":u%=0  4,5);" "; , (b$=".") (c$=".") _iaru_error_2: - (b$=".") (c$<>".") _iaru_error_3: - (b$<>".") (c$=".") _iaru_error_4:  (b$="n") b$="N"  (b$="s") b$="S"  (c$="e") c$="E"  (c$="w") c$="W" $t%=1 ( 0 _iaru_test_3 ,4t%=0:d1%=0:m1%=0:s1%=0:d2%=0:m2%=0:s2%=0 +8 10,5);" "; 0< xlupe%,xa$,xb$,xc$,xe$,xf$,xw%,xx%,xy%,xz% *@xa$=a$,1,1):xb$=a$,2,1):xc$=a$,3,1) *Dxd$=a$,4,1):xe$=a$,5,1):xf$=a$,6,1) %Hxw%=0:xx%=0:xy%=0:xz%=0:xlupe%=24 L (P xa$=letter1$(xlupe%) xw%=xlupe% 'T xe$=letter1$(xlupe%) xx%=xlupe% 'X xb$=letter1$(xlupe%) xy%=xlupe% '\ xf$=letter1$(xlupe%) xz%=xlupe% `xlupe%=xlupe%-1 d xlupe%=0 +h (xw%<1) (xw%>18) _iaru_error_5: +l (xx%<1) (xx%>24) _iaru_error_7: +p (xy%<1) (xy%>18) _iaru_error_5: +t (xz%<1) (xz%>24) _iaru_error_7: x |xw%=(xc$):xx%=(xd$) * (xw%<0) (xw%>9) _iaru_error_6: * (xx%<0) (xx%>9) _iaru_error_6: - (xw%=0) (xc$<>"0") _iaru_error_6: - (xx%=0) (xd$<>"0") _iaru_error_6:  t%=1   _iaru_test_4 t%=0 + (d1%<0) (d1%>90) _iaru_error_8: , (d2%<0) (d2%>180) _iaru_error_9: + (m1%<0) (m1%>59) _iaru_error_8: + (m2%<0) (m2%>59) _iaru_error_9: + (s1%<0) (s1%>59) _iaru_error_8: + (s2%<0) (s2%>59) _iaru_error_9:  2 (d1%=90) ((m1%+s1%)<>0) _iaru_error_8: 3 (d2%=180) ((m2%+s2%)<>0) _iaru_error_9: t%=1   _iaru_globe  9 Convert IARU coordinates to latitude and longitude. > The results are rlong EAST and rlat NORTH, with negative 5 numbers indicating WEST and SOUTH respectively.  1 lupe%,a$,b$,c$,e$,f$,w%,x%,y%,z%,rlong,rlat 0a$=iaru$,1,1):b$=iaru$,2,1):c$=iaru$,3,1) 0d$=iaru$,4,1):e$=iaru$,5,1):f$=iaru$,6,1) w%=0:x%=0:y%=0:z%=0:lupe%=24  % a$=letter1$(lupe%) w%=lupe%-1 % e$=letter1$(lupe%) x%=lupe%-1 % b$=letter1$(lupe%) y%=lupe%-1 % f$=letter1$(lupe%) z%=lupe%-1 lupe%=lupe%-1  lupe%=0  ' rlong=(20*w%)+(2*(c$))+(x%/12)-180 !$rlat=(10*y%)+(d$)+(z%/24)-90 ( 1, rlong<0 rlong=rlong*neg1%:a$="W" a$="E" 0w%=(rlong) 4rlong=(rlong-w%)*60 8x%=(rlong) 59 x%=x%+1:y%=0 H x%>59 w%=w%+1:x%=0 Ld$=(y%) P y%<10 d$="0"+d$ Tc$=(x%) X x%<10 c$="0"+c$ \b$=(w%) ` w%<10 b$="0"+b$ d w%<100 b$="0"+b$ hlong$=b$+a$+c$+d$ l .p rlat<0 rlat=rlat*neg1%:a$="S" a$="N" tw%=(rlat) xrlat=(rlat-w%)*60 |x%=(rlat) rlat=(rlat-x%)*60 y%=(rlat+0.5)  y%>59 x%=x%+1:y%=0  x%>59 w%=w%+1:x%=0 d$=(y%)  y%<10 d$="0"+d$ c$=(x%)  x%<10 c$="0"+c$ b$=(w%)  w%<10 b$="0"+b$ lat$=b$+a$+c$+d$   _globe_iaru  9 Convert latitude and longitude to IARU coordinates. F The result is the six character group ABCDEF where the < characters A, C and E are for logitude and B, D and F  are for latitude.  . d%,m%,s%,a$,b$,c$,d$,e$,f$,g$,x%,y%,z%,x $g$=long$,4,1):d%=(long$,1,3)) 'm%=(long$,5,2)):s%=(long$,7,2)) x%=(60*d%+m%)*60+s%  g$="W" x%=x%*neg1% %x%=648000+x%:x=x%/72000:y%=(x)+1 & y%>18 a$="A" a$=letter1$(y%) ,z%=x%-((y%-1)*72000):x=z%/7200:x%=(x)+1 c$=number1$(x%) *y%=z%-((x%-1)*7200):x=y%/300:z%=(x)+1 e$=letter1$(z%)  "g$=lat$,3,1):d%=(lat$,1,2)) %m%=(lat$,4,2)):s%=(lat$,6,2)) x%=(60*d%+m%)*60+s%  g$="S" x%=x%*neg1% %x%=324000+x%:x=x%/36000:y%=(x)+1 b$=letter1$(y%) ,z%=x%-((y%-1)*36000):x=z%/3600:x%=(x)+1 d$=number1$(x%) * y%=z%-((x%-1)*3600):x=y%/150:z%=(x)+1 $f$=letter1$(z%) ( #, b$="S" b$="R":d$="9":f$="X" 0 4iaru$=a$+b$+c$+d$+e$+f$ 8