8-Bit Software Online Conversion

Dictionary Utility Demo - Listing

2REM To run PROCmkmaps first rename or delete the existing map files. 4REM This will cause the program to go there by default when RUN. 10MODE7 20ONERROR VDU26:OSCLI"FX4,0":CLOSE#S% :CLOSE#D%:END 30DIM data%(26) 40: 50REM **** Load Data **** 60E%=OPENIN"MAPMAP" 70IFE%=0:PRINT"Can't find file MAPMAP ":PROChelp:RUN 80FORI%=1 TO 26 90L$="" 100REPEAT:A%=BGET#E%:IFA%<>13:L$=L$+CH R$(A%) 110UNTILA%=13 120data%(I%)=VAL(L$) 130NEXT 140CLOSE#E%:CLS 150: 160L1$=CHR$131+CHR$157+CHR$132 170L2$=CHR$134+CHR$157+CHR$132 180PRINTL2$ 190PRINTL1$"Scrabble Dictionary 2-8 le tters" 200PRINTL2$ 210PROCtext1 220PRINTL2$ 230PRINTL1$"Search for"CHR$135CHR$156" "L1$ 240PRINTL2$ 250: 260REM **** Check Data ***** 270S%=OPENIN"SDIC" 280IFS%=0:CLS:PRINT"Can't find file SD IC":END 290D%=OPENIN"DICMAP" 300IFD%=0:CLS:PRINT"Can't find file DI CMAP":CLOSE#S%:PROChelp:RUN 310*FX4,1 320L%=1:word$="xxxxxxxx":word$="" 330REPEAT 340REPEAT 350VDU26 360VDU28,15,16,25,14 370VDU30:PRINTword$" ";:VDU8 380A%=GET 390IFA%=9:PROCsearch 400UNTILA%<>9 410IFA%>64ANDA%<91 OR A%>96ANDA%<123:w ord$=word$+CHR$(A%) 420IFA%=127:word$=MID$(word$,1,LEN(wor d$)-1) 430VDU30:PRINTword$" ";:VDU8 440IFLEN(word$)>0 AND ASC(word$)>32 AN D VAL(word$)=0:PROCfind 450UNTILFALSE 460END 470: 480DEFPROCsearch 490VDU26 500VDU 31,0,3 510PROCtext2 520VDU28,15,24,25,16 530VDU30 540PROCread`dic 550REPEAT 560A%=GET 570IFA%=138:PROCnext 580IFA%=139:PROCprevious 590UNTILA%=9 600VDU26 610VDU 31,0,3 620PROCtext1 630VDU28,15,16,25,14 640ENDPROC 650: 660DEFPROCnext 670L%=PTR#S%+1 680CLS 690PROCread`dic 700ENDPROC 710: 720DEFPROCprevious 722PTR#S%=L% 730FORI%=1 TO 9 750REPEAT:T%=PTR#S%-2:PTR#S%=T%:A%=BGE T#S%:UNTILA%=13 OR T%=1 770NEXT 780PROCnext 790ENDPROC 800: 810DEFPROCfind 820PROCword 830K%=data%(c1%) 840PROCreadmap 850IFc2%>1:REPEAT:K%=PTR#D%:PROCreadma p:c2%=c2%-1:UNTILc2%=1 OR EOF#D% 860PROCread`dic 870ENDPROC 880: 890DEFPROCword 900c1%=(ASC(word$)OR&20)-96 910IFLEN(word$)<2:c2%=1:ENDPROC 920c2%=(ASC(MID$(word$,2))OR&20)-96 930ENDPROC 940: 950DEFPROCreadmap 960PTR#D%=K% 970L$="" 980REPEAT:A%=BGET#D%:IFA%<>13:L$=L$+CH R$(A%) 990UNTILA%=13 OR EOF#D% 1000L%=VAL(L$) 1010ENDPROC 1020 : 1030DEFPROCread`dic 1040VDU26 1050VDU28,15,24,25,16 1060VDU30 1070PTR#S%=L%-1 1080t%=1 1090CLS 1100REPEAT 1110REPEAT:A%=BGET#S%:VDUA%:UNTILA%=13 OR EOF#S% 1120VDU10 1130t%=t%+1 1140UNTILt%=9 OR EOF#S% 1150ENDPROC 1160: 1170DEFPROCtext1 1180PRINT 1190PRINT" Enter one or two letters int o the "; 1200PRINT" search box, this is in real time "; 1210PRINT" so they may be changed at an ytime. "; 1220PRINT" "; 1230PRINT" Use Tab to search deeper. "; 1240PRINT" "; 1250PRINT" Esc to quit. "; 1260PRINT" "; 1270PRINT" " 1280ENDPROC 1290: 1300DEFPROCtext2 1310PRINT 1320PRINT" Use up,down cursor keys, Tab to return "; 1330PRINT" - - - - Legal two letter wor ds - - - - "; 1340PRINT" aa ad ae ah ai am an ar as a t aw ax ay "; 1350PRINT" ba be bi bo by da de do ef e h el em en "; 1360PRINT" er es et ex fa go ha he hi h o id if is "; 1370PRINT" it jo ka la li lo ma me mi m u my na no "; 1380PRINT" nu od oe of oh om on op or o s ow ox oy "; 1390PRINT" pa pe pi re si so ta ti to u h un up us "; 1400PRINT" ut we wo xi xu ya ye " 1410ENDPROC 1420: 1430DEFPROCtext3 1440PRINT 1450PRINT" This program depends on two data files "; 1460PRINT" DICMAP and MAPMAP to work pr operly. "; 1470PRINT" Should these files become co rrupted or "; 1480PRINT" if you add words to the dict ionary then"; 1490PRINT" you can remake these files f rom here. "; 1500PRINT" "; 1510PRINT" Remake MAP files now? y/n "; 1520PRINT" "; 1530PRINT" " 1540ENDPROC 1550: 1560DEFPROChelp 1570VDU26 1580VDU 31,0,3 1590PROCtext3 1600A$=GET$ 1610IFINSTR("Yy",A$):PROCmkmaps 1620ENDPROC 1630: 1640DEFPROCmkmaps 1650S%=OPENIN"SDIC" 1660PRINT'"working...."' 1670D%=OPENOUT"DICMAP" 1680E%=OPENOUT"MAPMAP" 1690: 1700l1%=0:l2%=0 1710REPEAT 1720a1%=BGET#S% 1730VDU65+l1% 1740N%=PTR#(S%):K%=PTR#D% 1750IFa1%=97+l1%:PROCstore(K%,E%):PROCs tore(N%,D%):l1%=l1%+1:l2%=1 1760a2%=BGET#S% 1770IFa2%>=97+l2%:REPEAT:BPUT#D%,32:PRO Cstore(N%,D%):l2%=l2%+1:UNTILa2%<97+l2% 1780REPEAT:A%=BGET#S%:VDUA%:UNTILA%=13 1790UNTIL EOF#S% 1800CLOSE#S%:CLOSE#D%:CLOSE#E% 1810ENDPROC 1820: 1830DEFPROCstore(n%,f%) 1840P$=STR$(n%) 1850FOR I%=1 TO LEN(P$) 1860BPUT#f%,ASC(MID$(P$,I%,1)) 1870NEXT 1880BPUT#f%,13 1890ENDPROC