> NGRCalc 1.03  S 28-Feb-1997 v1.00 Program written by Len Killip, G0APZ, for his own interest. ( 2O 15-Oct-1999 v1.01 JGH: Tidied output slightly, QUITs on exit if possible, <0 windows not defined FN 18-Apr-2009 v1.02 JGH: UTM grid for Channel Islands, command line access PA 25-Jun-2009 v1.03 JGH: Works in interactive mode on Windows Z d Len's original comments n ----------------------- xD This program converts National Grid References to latitude and I longitude, and calculates the deviation between true north and grid north.  E Also the reverse, lat and long to easting and northing and NGR. 1 Also the bearing and distance between NGRs. C The "mathematical engine" is derived from the Ordnance Survey < "Geodetic Information Paper No 1: 2/1996 (Version 2.0) C 10 and 8 figure as well as 6 figure NGRs may be entered. Also A Eastings and Northings (to nearest millimetre if desired!). G Using OS worked examples, eastings and northings entered directly A to the nearest millimetre(!) result agrees to within 0.0004 H seconds lat. and is exact to four decimal places of seconds long. B (Exact to four decimal places in both cases using BASIC VI). F Deviation checks correct at sheet corners, and exact at Caister. D Bearings checked on p19 Fram to Caister 7.488 seconds v. 7.487 F Caister to Fram 10.833 seconds v. 10.832. I'll settle for these! ": Scale factor for mid-point of that line also checks. ,: 62A$=OS_GetEnv:ver$="1.03": os%=32 *FLOAT 64 @ A$<>"":cmd(A$):exit(0) J8 os%=32:ș "ShowWindow",@hwnd%,3:_setfocus(@hwnd%) T: ^ 27+128 h border r error |: constants_OSGB :  repeat=   choice1 repeat<>  :  choice1 4:'15)"GRID REFERENCE CONVERTOR"'15)24,"=")' !18)"CURRENT GRID: ";grid$'' ?5)"(A) CONVERT GRID REFERENCE TO LATITUDE AND LONGITUDE"' 65)"(B) BEARING AND DISTANCE BETWEEN TWO POINTS"' ?5)"(C) CONVERT LATITUDE AND LONGITUDE TO GRID REFERENCE"' !5)"(D) SELECT A BASE GRID"' 5)"(E) EXIT"' &5)"Press a key:"; 0Ȏ answer("ABCDE") : 1 Dlatlongrepeat= Nȕ latlongrepeat= X :'' b latlong l v 2 bdrepeat= ȕ bdrepeat=  :'' _bd   3  lltongr= ȕ lltongr=  :''  _lltongr   4 choosegrid  5  :quit%=: quit%=  quit%:Ș   * 4 >: Hchoosegrid R''5)"SELECT GRID:"' \05)"(A) OSGB - Great Britain & Isle of Man" f5)"(B) ITM - Ireland" p$5)"(C) UTM - Channel Islands" z'5)"Press a key:"; Ȏ answer("ABCD")  1:constants_OSGB  2:constants_ITM  3:constants_UTM & 4:constants_OSI: Hidden option   :  latlong  choice2  :''  10)"GRID REFERENCE: "G$' _Mvrho(E,N)  _toll  _C_EN $output(lambda,phi,C):lldisplay $< '10) "Do you want another Lat Long calculation? Y/N"; .& answer("YN")<>1 latlongrepeat= 8 B: L _bd V 20)"FIRST POSITION"' ` choice2 j E1=E:N1=N t_Mvrho(E1,N1):y1%=y:F1=F ~ _toll  _C_EN  20)"SECOND POSITION"'  choice2  E2=E:N2=N _Mvrho(E2,N2):y2%=y:F2=F  _toll  Ȏ N2  N1  alpha=/2  alpha=((E2-E1)/(N2-N1))   Ȏ E2   E1  alpha=0  ( N2N1 Falpha=alpha+2* P Z d%Nm=(N1+N2)/2:q=N1-N2:Em=(E1+E2)/2 n y1%<0 y2%<0 xalphasplit  _converge  _distance _bd_output 6 15)"Another bearing/dist calculation? Key Y/N"; ! answer("YN")<>1 bdrepeat=  : _lltongr 7 15)"Enter latitude north in form deg, min, sec"' 6 15)deg%, min%,sec':degN=deg%:minN=min%:secN=sec 7 15)"Enter longitude in form deg, min, sec, E/W"' ; 15)deg%, min%, sec,ew$':degE=deg%:minE=min%:secE=sec 4_lltoEN::''15)"Easting= ";E;" Northing= ";N' = 15) "Latitude "; degN; " Degs "; minN; " Mins "; secN; " " Secs North"' ,> 15) "Longitude "; degE; " Degs "; minE; " Mins "; secE; 6 " Secs "; ew$' @_ENtongr(E,N) J_ngrdisplay T ^: h _lltoEN r7 On entry, degN, minN, secN = latitude north |< degE, minE, secE, ew$ = longitude west/east +phi=convert(degN,minN,secN):phi=(phi) (v=A(phi):rho=B(phi):itasqd=v/rho-1 6lambda=convert(degE, minE, secE):lambda=(lambda) Lew$=ew$,1): ew$="W" ew$="w" lambda=-lambda:ew$="West" ew$="East" P=lambda-lambda0:phip=phi M=M(b,n,phip,phi0)  I=M+N0 II=(v/2)*(phi)*(phi) 8III=(v/24)*(phi)*((phi))^3*(5-((phi))^2+9*itasqd) @IIIA=(v/720)*(phi)*((phi)^5)*(61-58*((phi)^2)+((phi)^4)) N=I+P^2*II+P^4*III+P^6*IIIA IV=v*(phi) )V=(v/6)*((phi))^3*(v/rho-((phi)^2)) VI=(v/120) * ((phi)^5) EVI=VI*(5-18*((phi)^2)+((phi)^4)+14*itasqd-58*((phi)^2)*itasqd) E=E0+P*IV+P^3*V+P^5*VI & 0: :_ENtongr(E,N) Dgrid$="ITM":E=E+100000 N E<0:E=E+.1: IF E<0 E=E-1 X N<0:N=N+.1: IF N<0 N=N-1 ben_string(E) l east$=en$ ven_string(N) north$=en$ : grid_letters : ,easting$=east$,5): northing$=north$,5)  E<0 (easting$=(1000000-(east$,2))),5)   N<0 )northing$=(500000-(north$,2))),5)  !NGR$=A$+B$+easting$+northing$  :  _ngrdisplay 6 15)"10-digit National Grid Reference is ";NGR$'  curtail(easting$) *easting$=en$ 4curtail(northing$) >northing$=en$ H!NGR$=A$+B$+easting$+northing$ R5 15)"6-digit National Grid Reference is ";NGR$' \D 15)"4-digit National Grid Reference is ";NGR$,4);NGR$,6,2)' f: p: '15)"Another lat/long to NGR calculation? Key Y/N"; z:  answer("YN")<>1 lltongr=  : curtail(EN$) en%=((EN$)/100) en$="0000"+(en%),3)  :  choice2 $ 15)"DO YOU WISH TO ENTER AS"' , 15)"(A) NATIONAL GRID REFERENCE, OR"' & 15)"(B) EASTING AND NORTHING?"'  15)"KEY A OR B"' Ȏ answer("AB")  1 ? 2)"Enter the NGR, with grid letters, in 10, 8, 6 or 4 "; $ "numeral form "' . 15) G$' 8ngr B 2 L: 10) "ENTER FULL EASTING AND NORTHING, IN FORM E,N"' VF 5 ) "(six or seven figures in each, plus decimals if need be)"' ` 20) E,N' jG$=E+","+N t ~ : - This puts NGR into easting and northing ngr  ( G$ 1)=1:G$="I"+G$ $ G$,1)>"`":G$=(G$-32)+G$,2) constants_OSGB  G$,1)="I":constants_ITM  G$,1)="W":constants_UTM : X% = ((G$) - 2) / 2 Y% = 10^(5-X%) !X$ = G$, 1): Y$ = G$, 2, 1) 1E = (G$, 3, X%)) * Y%: N = (G$, X%)) * Y%  G$,1)="W" %a%=G$,2,1)&DF:a%="A":a%="W" !N=N+(a%-32)*100000:E=E+500000 ( 2_div(X$,500000,2,4) <_div(Y$,100000,0,5) F G$,1)="I" P( grid$="OSI":E=E-500000:N=N-1000000 Z' grid$="ITM":E=E-100000:N=N-500000 d n x:  : @ columns count from 0 to 4 from left, rows 1 to 5 from top. _div(Q$,m%,c%,r%) 0a%=((Q$) &DF)-("A")+5: a%>13 a%=a%-1 row%=a% 5: column%=a% 5 *E=E+(column%-c%)*m% : N=N+(r%-row%)*m%  : NݤA(phip)=a/(1-esqd*((phip))^2) : rad of curv of lat at lat phip KݤB(phip)=v*(1-esqd)/(1-esqd*((phip))^2) : same for long at lat phip : ݤM(b,n,phip,phi0)=b*(((1+n+(5/4)*n^2+(5/4)*n^3)*(phip-phi0))-((3*n+3*n^2+(21/8)*n^3)*(phip-phi0)*(phip+phi0))+(((15/8)*n^2+(15/8)*n^3)*(2*(phip-phi0))*(2*(phip+phi0)))-((35/24)*n^3*(3*(phip-phi0))*(3*(phip+phi0)))) tmp=b * (((1+n+(5/4)*n^2+(5/4)*n^3)*(phip-phi0))-((3*n+3*n^2+(21/8)*n^3)*(phip-phi0)*(phip+phi0))+(((15/8)*n^2+(15/8)*n^3)*(2*(phip-phi0))*(2*(phip+phi0)))-((35/24)*n^3*(3*(phip-phi0))*(3*(phip+phi0)))) =tmp : "J This takes easting and northing, does iteration for M, returns phip, , v, rho, y, and itasqd. 6: @_Mvrho(E,N) J y=E-E0 Tphip=(N-N0)/a+phi0 ^M=M(b,n,phip,phi0) h rphin=(N-N0-M)/a+phip | phip=phin M=M(b,n,phip,phi0)  (N-N0-M)<.0015 : v=A(phip) rho=B(phip) itasqd=v/rho-1 _F  : G This contains equations leading to phi, lambda. For equation IX I D need to divide (720*rho*v^5) by v^2 to get within range, which I multiplies IX by v^2. So then divide IX by v^2. Similarly for XIIA; I v^7 outside number range. In XIIA reduce v^7 to v^3 and divide XIIA  by v^4 :  _toll &VII=(phip)/(2*rho*v) 0IVIII=((phip)/(24*rho*v^3))*(5+3*(phip)^2+itasqd-9*(phip)^2*itasqd) :>IX= ((phip)/(720*rho*v^3))*(61+90*(phip)^2+45*(phip)^4) D IX=IX/v^2 N$phi=phip-y^2*VII+y^4*VIII-y^6*IX XX=1/(v*(phip)) b.XI=1/(6*v^3*(phip))*(v/rho+2*((phip))^2) l?XII=(1/(120*v^5*(phip)))*(5+28*((phip))^2+24*((phip))^4) vUXIIA=(1/(5040*v^3*(phip)))*(61+662*((phip))^2+1320*((phip))^4+720*((phip))^6) XIIA=XIIA/v^4 2lambda=lambda0+y*X-y^3*XI+y^5*XII-y^5*XIIA*y^2 P=lambda-lambda0  : G This derives deviation (C) between true north and grid north from C phi and lambda (PROC_toll) and itasqd (PROC_Mvrho). When C is - negative, true N is East of grid north. _C XIII=(phi) 7XIV=(((phi)*((phi))^2)/3)*(1+3*itasqd+2*itasqd^2) .XV=(((phi)*((phi))^4)/15)*(2-((phi))^2) #C=(P*(XIII)+P^3*(XIV)+P^5*(XV))  : - This derives deviation (C) from E and N _C_EN *XVI=(phip)/v 48XVII=(phip)/(3*v^3)*(1+(phip)^2-itasqd-2*itasqd^2) >6XVIII=(phip)/(15*v^5)*(2+5*(phip)^2+3*(phip)^4) HC=y*XVI-y^3*XVII+y^5*XVIII R \: foutput(lambda,phi,C) p lambda=(lambda): phi=(phi) zew$ = "East" * lambda <=0:ew$="West":lambda=-lambda degminsec(phi) degN=deg: minN=min: secN=sec degminsec(lambda) degE=deg: minE=min: secE=sec  : lldisplay D 10) "The Latitude is "; degN; " Degs "; minN; " Mins "; secN;  " Secs North"' E 10) "The Longitude is "; degE; " Degs "; minE; " Mins "; secE;  " Secs "; ew$' C=(C) % C>0 C$="West" C$="East": C=-C degminsec(C) W 10) "True North is ";deg " Degs ";min " Mins ";sec;" Secs ";C$;" of grid North"' $( 10) "easting= ";E;" northing=";N' . 8: B_bd_output LG=(alpha) Vdegminsec(G) `numplace(sec," ") j sec=num t= 15)"Grid bearing is ";deg" deg ";min" min ";sec" sec"' ~) C<0 alpha<=(C) alpha=alpha+2* TBg=(alpha+C-convangle) degminsec(TBg) numplace(sec," ")  sec=num > 15)"True bearing is ";deg;" deg ";min" min ";sec" sec"' numplace(s," ")  s=num * 15)"Grid distance is ";s;" metres"' numplace(dist," ")  dist=num - 15)"True distance is ";dist;" metres"'  20)"Print vars? Y/N"; ! answer("YN")=1 _variables   :  error (! =17 : REPORT:PRINT:END 23 IF ERL<>1240 THEN REPORT:PRINT" at line ";ERL < F 13)"Press any key"; P Z d: n4 This draws yellow border, with blue background x border 119,0,4,0,0;19,3,3,0,0; : select yellow/blue + 0,0: 0,959: 1279,959 : draw border ! 1279,0: 0,0 : draw border . VDU 28,4,58,78,4 :REM set up text window 8 VDU 24,10;10;1269;949; :REM set up graphics window  : ݤanswer(alternatives$)  *FX 15,1  "A%=alternatives$, ( &DF))  A%>0 =A% : ; converts decimal degrees to degrees, minutes, seconds degminsec(theta) "6ang=theta*3600+0.0005 : sec=(ang*1000)60000 /1000 ,+deg=ang 60 : min=deg 60 : deg=deg 60 6 @: J6 removes last j$ sig figs.Pass space string to j$ Tnumplace(Y,j$) ^ num$=(Y) h num$)=j$ rnum=(num$) | : O Corrects for convergence as in navigation,and checks with OS calc page 18 _converge f=2*y1%+y2% _Mvrho(E1,Nm) XXIII=1/(6*rho*v) convangle=(f*q*XXIII)  : I Case when E1 and E2 opposite sides central meridian. Nc is point of  crossing central meridian alphasplit ratio=((y1%)/(E2-E1)) Nc=N1+ratio*(N2-N1)  Nm1=(Nc+N1)/2: Nm2=(Nc+N2)/2 Nm=Nm1: y2%=0: q=N1-Nc &_converge 0convangle1=convangle :"Nm=Nm2:y1%=0:y2%=E2-E0:q=Nc-N2 D_converge Nconvangle2=convangle X#convangle=convangle1+convangle2 b l: v_F XXI=1/(2*rho*v) $XXII=(1-4*itasqd)/(24*rho^2*v^2) F=F0*(1+y^2*XXI+y^4*XXII)  : / s is grid distance; dist is True distance _distance s=((E2-E1)^2+(N2-N1)^2) _Mvrho(Em,Nm):Fm=F X=(1/6)*(1/F1+4/Fm+1/F2)  F=1/X  dist=s/F  :  _variables  "F= ";F  "phip= ";phip * "v= ";v 4"rho= ";rho >"itasqd= ";itasqd H "M= ";M R "y= ";y \"VII= ";VII f"VIII= ";VIII p"IX= ";IX z "X= ";X "XI= ";XI "XII= ";XII "XIIA= ";XIIA "XIII= ";XIII "XIV= ";XIV "XV= ";XV "XXI= ";XXI "XXII= ";XXII "XXIII= ";XXIII  : 0ݤconvert(deg,min,sec)=(min*60+sec)/3600+deg : grid_letters  grid$="OSGB" )first_letter(east$,north$) :A$=(a%) $)second_letter(east$,north$):B$=(a%) . 8 B grid$="OSI" L0first_letter(east$,north$) :A$=(a%):A$="I" V)second_letter(east$,north$):B$=(a%) ` j t grid$="ITM" ~0first_letter(east$,north$) :A$=(a%):A$="I" )second_letter(east$,north$):B$=(a%)    grid$="UTM" A$=(north$,1)+34) B$=(north$,2)+32) ! B$>"V":B$=(north$,2)+10) north$=north$,2)   A$="?":B$="?"  :  first_letter(E$,N$) column=0:row=0 column_row(E$) ( E<0 2column=init 5 + 2 < Fcolumn=init 5 + 3 P Zcolumn_row(N$) d N<0 n row=4 x row=3-init 5  read_letter  : second_letter(E$,N$) column_row(E$)  E<0 column=5+init 5  column=1+init 5  column_row(N$)  N<0 init=init+.1:N=N-.1  èN,2)<>"00":init=init-.1 "row= -init 5 , 6row=4-init 5 @ Jread_letter T ^: hC "column_row" returns the initial one or two numbers, with "-" r if present, as "init". |: column_row(EN$) neg$=EN$,1)  M%=(EN$)  neg$="-"  M% =8 left(EN$,3)   M% =7 left(EN$,2)    M%=7 left(EN$,2)   M%=6 left(EN$,1) & 0 : D: NB Preserves leading zeros, and repositions "-" when necessary. Xen_string(EN) bEN$=(((EN+0.5)*10/10)) l L%=(EN$) v EN<0  L%=L%-1  neg$="-"  L%>7 EN$=EN$,7) en$="0000000"+EN$,7)  EN$=EN$,L%) en$="000000"+EN$,6)  en$=("-"+en$)   EN>=0  L%>6 en$="0000000"+EN$,7)   en$="000000"+EN$,6)   * 4 >: Hleft(x$,y) R (x$)<0 y=2 \init=(x$,y)) f p: zread_letter a%=5*row+column  a%<9 a%=a%-1  a%=a%+65  : constants_OSGB 8E0=400000: N0=-100000 : grid coords of True origin 3phi0=(49) : latitude of True origin =lambda0=(-2) : longitude of True origin (West -) 7F0=0.9996012717 : scale on central meridian Da=6375020.481 : semi-major axis in metres scaled by F0 9b=6353722.490 : semi-minor similarly scaled /esqd=0.006670539762 : e is eccentricity Dn=(a-b)/(a+b) : 0.001673220250 : REM n is (a-b)/(a+b) east%=0:grid$="OSGB"  $: .constants_OSI 88E0=200000: N0=250000 : grid coords of True origin B3phi0=(53.50) : latitude of True origin L=lambda0=(-8) : longitude of True origin (West -) V7F0=1.000035 : scale on central meridian `Da=6377563.395906615 : semi-major axis in metres scaled by F0 j9b=6356256.908205645 : semi-minor similarly scaled t/esqd=0.00667054015 : e is eccentricity ~.n=(a-b)/(a+b) : n is (a-b)/(a+b) east%=0:grid$="OSI"  : constants_ITM 8E0=600000: N0=750000 : grid coords of True origin 3phi0=(53.50) : latitude of True origin =lambda0=(-8) : longitude of True origin (West -) 7F0=0.999820 : scale on central meridian Da=6376988.93534 : semi-major axis in metres scaled by F0 9b=6355608.0987234548 : semi-minor similarly scaled /esqd=0.00669438002301 : e is eccentricity .n=(a-b)/(a+b) : n is (a-b)/(a+b) east%=0:grid$="ITM"   : constants_UTM (:E0=500000: N0=0 : grid coords of True origin 25phi0=(0) : latitude of True origin "@" G$=cl("",0):comment$=A$ ngr _Mvrho(E,N):_toll:_C_EN "output(lambda,phi,C) ,. comment$<>"": comment$;(16-comment$); 6" ;degN;",";minN;",";secN;" "; @. ;degE;",";minE;",";secE;",";ew$,1);" "; J T ^$ cl("-osgb",0):constants_OSGB h" cl("-osi",0):constants_OSI r" cl("-itm",0):constants_ITM |" cl("-utm",0):constants_UTM .lat$=cl("",0):long$=cl("",0):comment$=A$ 1degN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) 1minN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) 1secN=lat$:A%=lat$+",",","):lat$=lat$,A%+1) : 5degE=long$:A%=long$+",",","):long$=long$,A%+1) 5minE=long$:A%=long$+",",","):long$=long$,A%+1) 5secE=long$:A%=long$+",",","):long$=long$,A%+1)  ew$=long$ : _lltoEN:_ENtongr(E,N) : GL$=NGR$,2):NGR$=NGR$,3) . comment$<>"": comment$;(16-comment$);  GL$;NGR$;" "; " GL$;NGR$,4);NGR$,6,4);" "; &" GL$;NGR$,3);NGR$,6,3);" "; 0" GL$;NGR$,2);NGR$,6,2);" "; :" GL$;NGR$,1);NGR$,6,1);" "; D GL$;" "; N ;east$;" ";north$;" "; X b l: v :  input in%=(in$):in%=0:  ::A$=#in%:#in% A$<>""  A$<>"" A$,1)<>"#":line #in%:#in%:in%=0: : Jsyntax:"Syntax: NGRCalc [-i infile] [-help]":  help 9"NGRCalc ";ver$" - Convert National Grid References" 4" NGRCalc [-osgb -osi -itm -utm]" L" Converts comma-seperated latitude and longitude to grid reference" ;" -osgb - Use OSGB (Great Britain) grid (default)" ," -osi - Use OSI (old Irish) grid"  ," -itm - Use ITM (new Irish) grid" 2" -utm - Use UTM (Channel Islands) grid"  <" Outputs space-seperated string of grid references" *" Examples:" 4," Command: NGRCalc 50,0,0 3,0,0,W" >F" Output: SY2834011644 SY28341164 SY283116 SY2811 SY21 SY " H-" Command: NGRCalc 49,15,0 2,5,0,W" RF" Output: XD9393627793 XD93932779 XD939277 XD9327 XD92 XD " \2" Command: NGRCalc 49,15,0 2,5,0,w -utm" fF" Output: WV6674157944 WV66745794 WV667579 WV6657 WV65 WV " p z" NGRCalc " <" Converts grid reference to latitude and longitude" " Examples:" "" Command: NGRCalc NZ9011" ." Output: 54,29,10.375 0.36,38.071,W" "" Command: NGRCalc IN0050" #" Output: 53,30,0 8,0,0,W"  : # > BLib.ProgEnv 1.04 09Jan2007 :ݤOS_GetEnv:A$,A%:X%=1:os%=((&FFF4)&FF00)256:X%-1 Jos%=32:>&FFFF:ș"GetModuleFileName",0,X%,255:A$=$$X%:run$=A$:=@cmd$ os%=32:A$=$&100 {A$=0:>&7FFF:run$=$&8100:ș"OS_GetEnv"A$,,A%:ș"OS_WriteEnv","",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ 2A$=0:?(P-3):A$=$&600 A$=0:A$=$(-&300) 7A%=A$+" "," "):run$=A$,A%-1):run$<>"":=A$,A%+1) bY%=X%256:A%=9:?X%=0:X%!1=X%+16:X%!16=0:&FFD1:A%=X%+16:!A%?A%+A%?2<>8:A%?(A%+1)=13:=$(A%+1) $="" .&os(A$):A$=42:A$ A$<>"":A$ 8 B@exit(A%):"FX1,"+A%:quit$=quit$:A$=quit$:quit$="":os(A$) Los%=32:Ș A% Vos%<6: *Quit ` j: t# > BLib.CmdLine 1.00 09Aug1998 ~Hݤcl(l$,n%):l$="":A%=A$+" "," "):l$=A$,A%-1):A$=s(A$,A%+1)):=l$ l$=32 A$<>"":A$=" "+A$ bA%=A$,l$):l$="":A%>0n%>0:l$=A$,A$+" "," ",A%+1)+1):A$,A%,1)<>" ":l$=l$,l$+" "," ")-1) qA%:A$,A%,1)=" ":A$=A$,2+(A$<>32),A%-2-(A%=1)) A%:A$=A$,A%-1)+A$,A$+" "," ",A$+" "," ",A%)+l$)+1) "A$=s(A$):n%:=s(l$) =A%<>0 /ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " +A$,1)=" ":A$=A$,A$-1):A$,1)<>" " =A$ :  > TextIO Win_TextIO 0ș "GetStdHandle",-10 @hfile%(1):*INPUT 13 1ș "GetStdHandle",-11 @hfile%(2):*OUTPUT 14 $ș "SetConsoleMode",@hfile%(1),0   : ! > BLib.Close 1.00 09Aug1998 (Close_All:*EXEC 2"in%=in%:in%:A%=in%:in%=0:#A% <'out%=out%:out%:A%=out%:out%=0:#A% F P: Z WINLIB5.BBC Version 1.5 d _setfocus(H%) n K%,M%,O%,P% x P% 30  [OPT 2 *.K% push H% : call "SetFocus" : ret 16 2.M% cmp dword [esp+8],&500 : jz K% : jmp [^O%] ] 'ș "GetWindowLong", @hwnd%, -4 O% &ș "SetWindowLong", @hwnd%, -4, M% (ș "SendMessage", @hwnd%, &500, 0, 0 &ș "SetWindowLong", @hwnd%, -4, O% ș "Sleep", 0