8-Bit Software Online Conversion
:2.$.DicWipe - Listing
10REM DICWIPE
20REM Dictionary wipe program
30REM For B/B+/E/M/C (with discs)
40REM by Alan Blundell
50REM (c) 1989
60:
70PROCinit
80REPEAT
90PROCgetspec
100PROClistwords
110PRINT '"Remove word(s)? (y/n) : ";
120key$=FNgetkey
130IF key$="Y" PRINT "Yes" ELSE PRINT
"No"
140IF key$="Y" PROCremovewords
150UNTIL 0
160END
170:
180DEFPROCinit
190maxunits%=28
200DIM dictbuf% maxunits%*256
210DIM index% 211
220DIM block% 12
230DIM wordbuf% 100
240osgbpb=&FFD1
250PROCasm
260ON ERROR PROCerror:END
270handle%=OPENUP("Diction")
280IF handle%=0 PRINT '''"No dictionar
y!":END
290PROCgbpb(3,handle%,index%,212,0)
300oldletter%=-1
310ENDPROC
320:
330DEFPROCgetspec
340REPEAT
350CLS
360PRINT TAB(8,10)"Press ESCAPE to exi
t."
370PROCcursor(1)
380INPUT TAB(0,0)"Spec. of word(s) : "
spec$
390PROCcursor(0)
400PRINT TAB(8,10) SPC(21) TAB(0,2);
410letter%=ASC(spec$)-65
420UNTIL letter%>=0 AND letter%<26
430spec$=RIGHT$(spec$,LEN(spec$)-1)
440IF letter%<>oldletter% PROCloaddict
(letter%):oldletter%=letter%
450ENDPROC
460:
470DEFPROClistwords
480pointer%=dictbuf%
490REPEAT
500found%=FNfindword(pointer%,dicttop%
,spec$)
510pointer%=!buffptr%
520IF found%=1 PRINT CHR$(letter%+65);
$pointer%
530IF found%=1 pointer%=pointer%+LEN($
pointer%)+1
540UNTIL found%=0
550ENDPROC
560:
570DEFPROCremovewords
580pointer%=dictbuf%
590REPEAT
600found%=FNfindword(pointer%,dicttop%
,spec$)
610pointer%=!buffptr%
620IF found%=1 PROCremove(pointer%)
630UNTIL found%=0
640PROCsavedict
650index%!(letter%*8+4)=dictlen%
660PROCgbpb(1,handle%,index%,212,0)
670ENDPROC
680:
690DEFPROCremove(pointer%)
700length%=LEN($pointer%)+1
710IF pointer%+length%=dicttop% GOTO 7
60
720!source%=pointer%+length%
730!dest%=pointer%
740!len%=dicttop%-pointer%-length%
750CALL move
760dicttop%=dicttop%-length%
770dictlen%=dictlen%-length%
780ENDPROC
790:
800DEFPROCloaddict(letter%)
810A%=3
820fileptr%=index%!(letter%*8)
830dictsize%=index%!((letter%+1)*8)-fi
leptr%
840dictlen%=index%!(letter%*8+4)
850dicttop%=dictbuf%+dictlen%
860PROCgbpb(A%,handle%,dictbuf%,dictsi
ze%,fileptr%)
870ENDPROC
880:
890DEFPROCsavedict
900A%=1
910PROCgbpb(A%,handle%,dictbuf%,dictsi
ze%,fileptr%)
920ENDPROC
930:
940DEFPROCasm
950DIM code% &B0
960source%=&70
970dest%=&72
980len%=&74
990buffptr%=&70
1000buffend%=&74
1010searchptr%=&76
1020result%=&78
1030temp%=&78
1040FOR pass = 0 TO 2 STEP 2
1050P%=code%
1060[
1070OPT pass
1080.move
1090½--------
1100SEC
1110LDA dest%
1120SBC source%
1130TAX
1140LDA dest%+1
1150SBC source%+1
1160TAY
1170TXA
1180CMP len%
1190TYA
1200SBC len%+1
1210BCS moveleft
1220BCC moveright
1230.moveleft
1240LDY #0
1250LDX len%+1
1260BEQ mlskip
1270.mlloop
1280LDA (source%),Y
1290STA (dest%),Y
1300INY
1310BNE mlloop
1320INC source%+1
1330INC dest%+1
1340DEX
1350BNE mlloop
1360.mlskip
1370LDX len%
1380BEQ moveout
1390.mlloop2
1400LDA (source%),Y
1410STA (dest%),Y
1420INY
1430DEX
1440BNE mlloop2
1450.moveout
1460RTS
1470
1480.moveright
1490CLC
1500LDA len%+1
1510PHA
1520ADC source%+1
1530STA source%+1
1540CLC
1550PLA
1560ADC dest%+1
1570STA dest%+1
1580LDY len%
1590BEQ mrskip
1600.mrloop
1610DEY
1620LDA (source%),Y
1630STA (dest%),Y
1640CPY #0
1650BNE mrloop
1660.mrskip
1670LDX len%+1
1680BEQ moveout
1690.mrloop2
1700DEC source%+1
1710DEC dest%+1
1720.mrloop3
1730DEY
1740LDA (source%),Y
1750STA (dest%),Y
1760CPY #0
1770BNE mrloop3
1780DEX
1790BNE mrloop2
1800RTS
1810½
1820.search
1830LDY #255
1840.sloop
1850INY
1860LDA (searchptr%),Y
1870CMP #13
1880BEQ foundword
1890CMP #ASC"#"
1900BEQ sloop
1910CMP #ASC"*"
1920BEQ multi
1930CMP (buffptr%),Y
1940BEQ sloop
1950BNE nextword
1960.foundword
1970LDA (buffptr%),Y
1980CMP #13
1990BNE nextword
2000.multi
2010LDY #1
2020STY result%
2030RTS
2040.nextword
2050INY
2060LDA (buffptr%),Y
2070CMP #13
2080BNE nextword
2090INY
2100STY temp%
2110LDY #255
2120CLC
2130LDA buffptr%
2140ADC temp%
2150STA buffptr%
2160LDA buffptr%+1
2170ADC #0
2180STA buffptr%+1
2190CMP buffend%+1
2200BCC sloop
2210LDA buffptr%
2220CMP buffend%
2230BCC sloop
2240LDY #0
2250STY result%
2260RTS
2270]
2280NEXT
2290ENDPROC
2300:
2310DEFFNfindword(buf%,top%,word$)
2320IF buf%=top% !buffptr%=buf%:=0
2330!buffptr%=buf%
2340!buffend%=top%
2350!searchptr%=wordbuf%
2360$wordbuf%=word$
2370CALL search
2380=?result%
2390:
2400DEFFNgetkey
2410LOCAL key%
2420PROCcursor(1)
2430*FX 21 0
2440key%=GET
2450PROCcursor(0)
2460=CHR$(key% AND 223)
2470:
2480DEFPROCcursor(on%)
2490VDU 23,1,on%;0;0;0;
2500ENDPROC
2510:
2520DEFPROCgbpb(A%,handle%,address%,siz
e%,fileptr%)
2530X%=block% MOD 256
2540Y%=block% DIV 256
2550block%?0=handle%
2560block%!1=address%
2570block%!5=size%
2580block%!9=fileptr%
2590CALL osgbpb
2600ENDPROC
2610:
2620DEFPROCerror
2630CLOSE #0
2640IF ERR=17 CHAIN "Spell"
2650PRINT '''
2660REPORT
2670PRINT
2680ENDPROC