8-Bit Software Online Conversion

OSMap 2 - Listing

10: 20: 30: 40REM" THIS PROGRAM BY NEIL TAYLOR WAS IN ISSUE 39 OF 8-BIT SOFTWARE 50: 60REM" CHANGED TO BBC BASIC IN ISSUE 40 8BS BY D PRITCHARD JONES 3PM 70REM" 'TARTEDUP' WITH MAP, COLOUR AND REF.NOs.ETC. BY ROY DICKENS 20G 80ON ERROR PROCerr:END 90MODE7 100VDU23,1,0;0;0;0; 110PROCfirstpage 120PROCpressSpace 130PROCmes2 140PROCpressSpace 150PROCmes1 160PROCpressSpace 170CLEAR 180PROCin 190PROCrefno 200VDU23,1,1;0;0;0; 210PROCfirstno 220PROCsecondno 230CLS 240PROCtheworks 250PROCmap 260PROCletters 270PROCprintmiles 280PROCagain 290END 300DEFPROCin 310DIM P$(16) 320CLS 330number$="0123456789" 340letter1$="NTS" 350letter2$="ABCDEFGHIJKLMNOPQURSTUVWX YZ" 360A$="SVSQ NQNLNFNAHVHQHLSWSRS MSGSBNWNRNMNGNBHWHRHMSXSSSNSHSCNXNSNNNHN CHXHSHNSYSTSOSJSDNYNTNONJNDHYHTHOSZSUSPS KSENZNUNPNKNEHZHUHPTVTQTLTFTAOVOQOLOFOAJ VJQJL TRTMTG" 370ENDPROC 380REM" ..NEIL TAYLOR K3T STARTED IT ALL WITH THIS NEXT BIT. THANKS NEIL.. AND... 390REM" ..DERRICK PRITCHARD JONES 3PM CHANGED THIS BIT TO BBC BASIC. THANKS DERRICK 400DEF PROCtheworks 410B$=inpL1$+inpL2$+inpN1$+inpL3$+inpL 4$+inpN2$ 420 C$=LEFT$(B$,2) 430 PROCnc 440 M=N:D=C:C$=MID$(B$,9,2) 450 PROCnc 460 V=ABS((M-N)*500+VAL MID$(B$,6,3)-V AL RIGHT$(B$,3)) 470 H=ABS((C-D)*1000+VAL MID$(B$,11,3) -VAL MID$(B$,3,3)) 480 X=SQR(V^2+H^2)*.06214 490 @%=&2020A 500 PRINT 510REM PRINT; X;" Miles from ";inpL1$+ inpL2$+inpN1$;" to ";inpL3$+inpL4$+inpN2 $ 520REM PRINT "Range is ";1.1123*X;" to ";1.3186*X;" miles" 530REMPRINT "Average estimate = ";1.24 05*X;" miles" 540ENDPROC 550REM" ..AND THIS BIT.. 560DEF PROCnc 570 N=INSTR(A$,C$):IF N=0 PRINT"INVALI D MAP REFERENCE. TRY AGAIN":T=TIME:REPEA T UNTIL TIME>T+200:GOTO150 580 C=N DIV 26+1 590 N=N MOD 26 600ENDPROC 610REM" .............................. 620DEF PROCrefno 630PROCdh(1,1,1,"A few National Grid r ef. numbers") 640PROCdh(1,3,0,"E&OE.") 650PRINT' 660FOR loops%=1TO16 670READ P$(loops%) 680PRINTCHR$(134)P$(loops%) 690NEXT loops% 700PROCdh(3,23,0,"Please press space t o continue >>> ") 710PROCpressSpace 720ENDPROC 730DEF PROCfirstno 740CLS 750PROCdh(1,1,1,"To find the distance from 'A' to 'B'") 760PROCdh(1,3,0,"two grid ref. numbers (obtained from") 770PROCdh(1,4,0," your map) are requir ed.") 780PROCdh(2,5,0,"FIRST GRID REFERENCE" ) 790PROCdh(2,6,0,"(example SP822381)") 800PRINTTAB(0,7)CHR$(131)"Note:-" 810PRINTTAB(0,8)CHR$(131)"First letter will be N, T or S." 820PRINTTAB(0,10);CHR$(134);"Type the first (one) letter "; 830inpL1$=FN`gpi(1,1,letter1$) 840IF LEN(inpL1$)<1 GOTO820 850PRINTTAB(0,10);CHR$(134);"and now t he second letter ";inpL1$;" "; 860inpL2$=FN`gpi(1,1,letter2$) 870IF LEN(inpL2$)<1 GOTO850 880PRINTTAB(0,10);CHR$(134);"and the s ix figures "inpL1$+inpL2$;" "; 890inpN1$=FN`gpi(6,0,number$) 900IF LEN(inpN1$)<6 GOTO880 910PRINTTAB(0,12);CHR$(131);" Is this correct Y/N? "; 920IF FNyesno="Y"THEN PRINT TAB(24,12) "Yes"ELSE PRINT TAB(24,12)"No ":PRINTTAB (0,12);STRING$(30," "):PROCfirstno 930ENDPROC 940DEF PROCsecondno 950PRINTTAB(0,14)CHR$(147);STRING$(35, CHR$(172)) 960PRINTTAB(0,20);STRING$(36," ") 970PROCdh(2,16,0,"SECOND GRID REFERENC E") 980PROCdh(2,17,0,"(example SO700435) " ) 990PRINTTAB(0,18);CHR$(131);"Note:-" 1000PRINTTAB(0,19);CHR$(131);"First let ter will be N, T or S." 1010PRINTTAB(0,21)CHR$(134);"Type the f irst (one) letter "; 1020inpL3$=FN`gpi(1,1,letter1$) 1030IF LEN(inpL3$)<1 GOTO1010 1040PRINTTAB(0,21);CHR$(134);"and now t he second letter ";inpL3$;" "; 1050inpL4$=FN`gpi(1,1,letter2$) 1060IF LEN(inpL4$)<1 GOTO 1040 1070PRINTTAB(0,21);CHR$(134);"and the s ix figures "inpL3$+inpL4$;" "; 1080inpN2$=FN`gpi(6,0,number$) 1090IF LEN(inpN2$)<6 GOTO1070 1100PRINTTAB(1,23);CHR$(131);"Is this c orrect Y/N? "; 1110IF FNyesno="Y"THEN PRINT TAB(24,23) "Yes"ELSE PRINT TAB(24,23)"No ":PRINTTAB (0,23);STRING$(30," "):PROCsecondno 1120ENDPROC 1130DEFFN`gpi(len,effect,valid$) 1140LOCALa$,b 1150a$="" 1160PRINTSTRING$(len,".");STRING$(len+1 ,CHR$(8));" ";:*FX15,1 1170b=GET:IF b=13 THEN =a$ 1180IF b=127 AND a$=""THEN 1170 1190IF b=127 a$=LEFT$(a$,LEN(a$)-1):PRI NTCHR$b;".";CHR$(8);:GOTO 1170 1200IF effect=0 THEN 1230 1210IF effect=1 b=b AND 223 ELSE b=bOR3 2 1220IF effect=3 AND (RIGHT$(a$,1)=" " O R a$="") b=b AND 223 1230IF LEN(a$)=len OR INSTR(valid$,CHR$ b)=0 VDU7:GOTO1170 1240PRINTCHR$b;:a$=a$+CHR$b:GOTO1170 1250DEF FNyesno 1260LOCAL key$ 1270REPEAT 1280key$=CHR$(GET AND &DF) 1290UNTIL INSTR("YN",key$) 1300=key$ 1310DEF PROCmap 1320PRINTCHR$146" p< `tt||4 " 1330PRINTCHR$146" / j$x¶¶¶w " 1340PRINTCHR$146" p x¶¶¶¶w÷¾¶% " 1350PRINTCHR$146" k4j¶¶¶¶¶¶¶¶7 " 1360PRINTCHR$146" (?+¶¶¶¶¶¶?! " 1370PRINTCHR$146" ` z¶¶¶¶¶¶w " 1380PRINTCHR$146" £x'¶¶¶¶¶wc " 1390PRINTCHR$146" %"`÷¶¶¶¶¶¾ " 1400PRINTCHR$146" `÷¶¶¶¶¶¶4 " 1410PRINTCHR$146" jk/¶¶¶¶¶¶4 " 1420PRINTCHR$146" *¶¶¶¶¶¶¶|0" 1430PRINTCHR$146" MAP *!j¶¶¶¶¶¶?/ " 1440PRINTCHR$146" NOT | *¶¶¶¶¶¶¶|0" 1450PRINTCHR$146" TO x|÷÷¶¶¶¶¶¶¶?" 1460PRINTCHR$146" SCALE!j¶¶¶¶¶¶¶¶¶¾x¶¾" 1470PRINTCHR$146" z¶¶¶¶¶¶¶¶¶¶¶¶¶5 " 1480PRINTCHR$146" |÷¶¶¶¶¶¶¶¶¶¶¶¶¶7 " 1490PRINTCHR$146" " */'¼¶¶¶¶¶¶¶¶sp0 " 1500PRINTCHR$146" x|¶¶¶¶¶¶¶¶¶¶¶'! " 1510PRINTCHR$146" z¶¶¶¶¶//a3£+/! " 1520PRINTCHR$146" (+%+/££! " 1530ENDPROC 1540DEF PROCprintmiles 1550@%=&2000A 1560PRINTTAB(20,3)CHR$(131);"Distance b etween" 1570PRINTTAB(17,4)CHR$(131);inpL1$+inpL 2$+inpN1$;" and ";inpL3$+inpL4$+inpN2$ 1580PRINTTAB(22,5)CHR$(131);"= ";X;" mi les" 1590REM********************** 1600REM"CHANGE 1.1123*X AND/OR 1.3186*X SHOWN BELOW IF YOU WISH 1610 1620PRINTTAB(24,7)CHR$(131);"Range is " 1630PRINTTAB(20,8)CHR$(131);1.1123*X;" to ";1.3186*X;" miles" 1640PRINTTAB(20,10)CHR$(131);"Average e stimate" 1650REM*********************** 1660REM"CHANGE 1.2405*X SHOWN BELOW IF YOU WISH 1670 1680PRINTTAB(22,11)CHR$(131);"= "1.2405 *X;" miles" 1690ENDPROC 1700DEF PROCletters 1710IF inpL1$+inpL2$="SU"ORinpL3$+inpL4 $="SU":PROCgrid("S","U",14,18) 1720IF inpL1$+inpL2$="SS"ORinpL3$+inpL4 $="SS":PROCgrid("S","S",8,18) 1730IF inpL1$+inpL2$="ST"ORinpL3$+inpL4 $="ST":PROCgrid("S","T",10,18) 1740IF inpL1$+inpL2$="TQ"ORinpL3$+inpL4 $="TQ":PROCgrid("T","Q",17,18) 1750IF inpL1$+inpL2$="TR"ORinpL3$+inpL4 $="TR":PROCgrid("T","R",20,18) 1760IF inpL1$+inpL2$="SW"ORinpL3$+inpL4 $="SW":PROCgrid("S","W",5,20) 1770IF inpL1$+inpL2$="SX"ORinpL3$+inpL4 $="SX":PROCgrid("S","X",8,20) 1780IF inpL1$+inpL2$="SY"ORinpL3$+inpL4 $="SY":PROCgrid("S","Y",10,20) 1790IF inpL1$+inpL2$="SZ"ORinpL3$+inpL4 $="SZ":PROCgrid("S","Z",14,20) 1800IF inpL1$+inpL2$="TV"ORinpL3$+inpL4 $="TV":PROCgrid("T","V",17,20) 1810IF inpL1$+inpL2$="SM"ORinpL3$+inpL4 $="SM":PROCgrid("S","M",5,16) 1820IF inpL1$+inpL2$="SN"ORinpL3$+inpL4 $="SN":PROCgrid("S","N",8,16) 1830IF inpL1$+inpL2$="SO"ORinpL3$+inpL4 $="SO":PROCgrid("S","O",10,16) 1840IF inpL1$+inpL2$="SP"ORinpL3$+inpL4 $="SP":PROCgrid("S","P",14,16) 1850IF inpL1$+inpL2$="TL"ORinpL3$+inpL4 $="TL":PROCgrid("T","L",17,16) 1860IF inpL1$+inpL2$="TM"ORinpL3$+inpL4 $="TM":PROCgrid("T","M",20,16) 1870IF inpL1$+inpL2$="SH"ORinpL3$+inpL4 $="SH":PROCgrid("S","H",8,14) 1880IF inpL1$+inpL2$="SJ"ORinpL3$+inpL4 $="SJ":PROCgrid("S","J",10,14) 1890IF inpL1$+inpL2$="SK"ORinpL3$+inpL4 $="SK":PROCgrid("S","K",14,14) 1900IF inpL1$+inpL2$="TF"ORinpL3$+inpL4 $="TF":PROCgrid("T","F",17,14) 1910IF inpL1$+inpL2$="TG"ORinpL3$+inpL4 $="TG":PROCgrid("T","G",20,14) 1920IF inpL1$+inpL2$="SD"ORinpL3$+inpL4 $="SD":PROCgrid("S","D",9,11) 1930IF inpL1$+inpL2$="SE"ORinpL3$+inpL4 $="SE":PROCgrid("S","E",12,11) 1940IF inpL1$+inpL2$="TA"ORinpL3$+inpL4 $="TA":PROCgrid("T","A",15,11) 1950IF inpL1$+inpL2$="NZ"ORinpL3$+inpL4 $="NZ":PROCgrid("N","Z",12,9) 1960IF inpL1$+inpL2$="NY"ORinpL3$+inpL4 $="NY":PROCgrid("N","Y",9,9) 1970IF inpL1$+inpL2$="NX"ORinpL3$+inpL4 $="NX":PROCgrid("N","X",6,9) 1980IF inpL1$+inpL2$="NU"ORinpL3$+inpL4 $="NU":PROCgrid("N","U",12,7) 1990IF inpL1$+inpL2$="NT"ORinpL3$+inpL4 $="NT":PROCgrid("N","T",9,7) 2000IF inpL1$+inpL2$="NS"ORinpL3$+inpL4 $="NS":PROCgrid("N","S",6,7) 2010IF inpL1$+inpL2$="NR"ORinpL3$+inpL4 $="NR":PROCgrid("N","R",3,7) 2020IF inpL1$+inpL2$="NO"ORinpL3$+inpL4 $="NO":PROCgrid("N","O",10,5) 2030IF inpL1$+inpL2$="NN"ORinpL3$+inpL4 $="NN":PROCgrid("N","N",7,5) 2040IF inpL1$+inpL2$="NM"ORinpL3$+inpL4 $="NM":PROCgrid("N","M",4,5) 2050IF inpL1$+inpL2$="NJ"ORinpL3$+inpL4 $="NJ":PROCgrid("N","J",11,3) 2060IF inpL1$+inpL2$="NH"ORinpL3$+inpL4 $="NH":PROCgrid("N","H",8,3) 2070IF inpL1$+inpL2$="NG"ORinpL3$+inpL4 $="NG":PROCgrid("N","G",5,3) 2080IF inpL1$+inpL2$="ND"ORinpL3$+inpL4 $="ND":PROCgrid("N","D",11,1) 2090IF inpL1$+inpL2$="NC"ORinpL3$+inpL4 $="NC":PROCgrid("N","C",8,1) 2100ENDPROC 2110DEF PROCgrid(R$,D$,a,b) 2120PRINT TAB(a,b)CHR$(129)R$CHR$(146) 2130PRINT TAB(a,b+1)CHR$(129)D$CHR$(146 ) 2140ENDPROC 2150DEF PROCagain 2160PRINTTAB(0,23);CHR$(134);" Would yo u like another go. Y/N? "; 2170IF FNyesno="Y"THEN GOTO170 ELSE CLS : PRINT TAB(0,10)"BYE FROM ROY, HAVE A P LEASANT JOURNEY":@%=&90A:END 2180ENDPROC 2190DEF PROCerr 2200IF ERR<> 17 THEN REPORT:PRINT" at l ine ";ERL:ENDPROC 2210IF ERR=17 CLS:PROCagain:ENDPROC 2220DEF PROCmes1 2230CLS 2240PROCdh(1,3,1,"Message from Neil Tay lor (K3T)") 2250PROCdh(1,5,0,"(abridged from 8BS is sue 39)") 2260PROCdh(6,7,0,"* Notes about DEF PRO Cprintmiles *") 2265PROCdh(6,8,0,"(Lines 1630 and 1680. )") 2270PROCdh(6,9,0,"The listing contains my own figures") 2280PROCdh(6,10,0,"for the min. and max . percentage inc-") 2290PROCdh(6,11,0,"reases (likely range ).It also contains") 2300PROCdh(6,12,0,"the mean average fro m all my recorded ") 2310PROCdh(6,13,0,"journeys.I suggest u sing these figures") 2320PROCdh(6,14,0,"as a starting point but your own geog-") 2330PROCdh(6,15,0,"aphical location and choice of roads is") 2340PROCdh(6,16,0,"bound to yield diffe rent results.") 2350PROCdh(6,17,0,"If the program is us ed intelligently as") 2360PROCdh(6,18,0,"a guestimation aid t hen with a bit of ") 2370PROCdh(6,19,0,"experience you will be surprised by how") 2380PROCdh(6,20,0,"much utility it can actually have.") 2390PROCdh(3,22,0,"Please press space t o continue >>> ") 2400ENDPROC 2410DEF PROCmes2 2420CLS 2430PROCdh(1,0,1,"The National Grid") 2440PROCdh(3,2,0,"(Example ref.no. SP82 2381") 2450PROCdh(6,3,0,"Most road atlases hav e the national") 2460PROCdh(6,4,0,"grid. Great Britain i s divided into 100") 2470PROCdh(6,5,0,"kilometre grid square s, each of which ") 2480PROCdh(6,6,0,"is identified by a se t of 2 letters.") 2490PROCdh(6,7,0,"These squares are fur ther sub-divided") 2500PROCdh(6,8,0,"into smaller squares by grid lines") 2510PROCdh(6,9,0,"spaced 10 kilometres apart, each of ") 2520PROCdh(6,10,0,"which is numbered fr om 0 to 9 in a") 2530PROCdh(6,11,0,"easterly or northerl y direction.This") 2540PROCdh(6,12,0,"will give the first and fourth figure.") 2550PROCdh(3,13,0,"Example SP 8.. 3..") 2560PROCdh(6,14,0,"The 10 squares need to be divided into") 2570PROCdh(6,15,0,"further 10x10 square s to give the ") 2580PROCdh(6,16,0,"second and fifth fig ure.") 2590PROCdh(3,17,0,"Example SP 82. 38.") 2600PROCdh(6,18,0,"It is easier to gues s the third and ") 2610PROCdh(6,19,0,"sixth figure as you would be using a") 2620PROCdh(6,20,0," 1:50 000 map for th ese. Read across") 2630PROCdh(6,21,0,"the BOTTOM FIRST and THEN UP THE SIDE.") 2640PROCdh(5,22,0,"(Along the corridor and up the stairs)") 2650PROCdh(3,23,0,"Please press space t o continue >>> ") 2660ENDPROC 2670DEF PROCfirstpage 2680CLS 2690PRINT' 2700PROCdh(1,1,1,"Mileage from OS maps" ) 2710PROCdh(1,3,0,"by Roy Dickens") 2720PROCdh(1,5,0,"Based on a program 'O SMAP' submitted ") 2730PROCdh(1,6,0,"by Neil Taylor (8-BIT issue 39)") 2740PROCdh(2,9,1,"Using the Ordnance Su rvey Nat.Grid") 2750PROCdh(2,11,1,"this program may hel p you to measure") 2760PROCdh(2,13,1,"the mileage between two points.") 2770PROCdh(6,16,0,"May I thank Mr N Tay lor (K3T) for the") 2780PROCdh(6,17,0,"'core' of this progr am.") 2790PROCdh(6,19,0,"Also Mr D Pritchard- Jones for his help") 2800PROCdh(6,20,0,"by changing the 'cor e' into BBC Basic.") 2810PROCdh(3,23,0,"Please press space t o continue >>> ") 2820ENDPROC 2830DEF PROCdh(C%,L%,D%,A$) 2840IF D% A$=CHR$(141)+A$ 2850X%=(40-LENA$)DIV 2-1 2860FORY%=L%TOL%+D%:PRINTTAB(X%,Y%);CHR $(128+C%);A$:NEXT 2870ENDPROC 2880DEF PROCpressSpace 2890*FX15,0 2900REPEAT 2910UNTIL GET=32 2920ENDPROC 2930: 2940: 2950DATA Aberdeen NJ930050.Accring/n SD750280 2960DATA Basingst/k SU630510. Bristol ST580720 2970DATA Billericay TQ670940. Bolton SD710080 2980DATA Clacton TM170150.Crawcrook NZ130630 2990DATA Eaglescli/eNZ420150. Flitwick TL030350 3000DATA Hedon TA180280. Halifax SE080250 3010DATA Lincoln SK970710.Liverpool SJ350910 3020DATA Lytham S/A SD340270. Leeds SE300340 3030DATA Nelson La. SD870370.Notting/m SK570410 3040DATA Plymouth SX470550. Penrith NY510300 3050DATA Rushden SP950660. Romford TQ510880 3060DATA Selby SE610320.Sheffield SK350870 3070DATA Skegness TF560630.St.Albans TL150070 3080DATA Southamp/n SU420120. Swansea SS650930 3090DATA Stoke on T SJ870450.Sunderland NZ390570 3100DATA Thetford TL870830. Wickford TQ750930