home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 3 #2
/
Commodore_Disk_User_Vol.3_2_1989_-.d64
/
quikword
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
14KB
|
543 lines
10 goto 20
20 l=l+1
50 if l=1 then load "top.exe",8,1
60 poke 2049+6,54
100 rem -------------------------------
101 rem quikword basic environment
102 rem expandable word processor.
103 rem (c) 1989 argus specialist
104 rem publications including ram
105 rem basic interpreter & new
106 rem extension keywords.
107 rem -------------------------------
110 poke 650,255 : poke 1,54
120 poke 50592,234 : rem correct line.input# routine
125 poke 50477,3 : rem corr to line
130 (NULL) 51,24573 : (NULL) 55,24573 : poke 24574,141
140 (NULL) 785,51084 : rem usr jmp
145 :
150 rem -------------------------------
160 rem define text pointers
170 rem -------------------------------
180 ts = 24575 : te = 40959
190 sptr = 51073 : eof = 51075 : ins = 51077 : hme = 51079 : csr = 51081
192 bs = ts : be = ts
194 c$ = "" : c = 0 : n = 0 : in$ = ""
196 h(0)=ts : is = te : ss = 15
197 dev = 8 : f$ = ""
198 :
200 rem -------------------------------
210 rem define cda strings
220 rem -------------------------------
230 c0$="[158][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
240 c1$="[158]command "
250 c2$="[158] "
260 c3$="[158]csr eof ins hme "
270 c4$="can't, "
280 c5$="no block" : c6$="stack full"
282 c7$="save as " : c8$="dump screen as "
283 cf$="[158]l/a/s/d/e/v/c/n/o?"
284 cb$="[158]s/e/c/m/d/f?"
285 ct$="[158]t/w/c/s/e/f/r/n/p/l?"
290 poke 51108,134 : rem usr1 matches [f2]
295 :
300 rem -------------------------------
310 rem initialise buffer & screen
320 rem -------------------------------
330 if (NULL)(eof)=0 then:(NULL) ts,(te-ts),141
340 (NULL) 53280,2313 : (NULL) 55296,120,7 : (NULL) (55296+120),880,1
350 (NULL) csr,0
360 (NULL) sptr,ts : (NULL) 251,ts : (NULL) 253,ts : (NULL) ins,0 : (NULL) hme,0
370 if peek(51083)=0 then file$="intro" : gosub 2750 : gosub 700
380 :
400 rem *******************************
410 rem main sys command module
420 rem *******************************
430 cc$="[158]f/s/h/u/d/r/i/b?"
440 print chr$(14);
450 print ""; c2$; c3$; c0$; : (NULL) 0,23 : print file$;
460 :
470 sys 51253
480 c = usr(x)
490 :
500 if c = 133 then 610
510 if c = 3 then end
520 if c = 148 then gosub 3700
525 if c = 20 then gosub 3800
530 if c = 19 then gosub 3900
540 if c = 134 then gosub 5600
590 :
600 goto 470
610 print ""; c1$; : (NULL) 0,8 : print cc$;
620 gosub 900
630 for n=1 to len(cc$)
640 if c$=mid$(cc$,n,1) then 660
650 next n
655 gosub 6950
660 on n gosub 0,2600,0,3400,0,4000,0,3500,0,3600,0,700,0,4100,0,4300
670 goto 450
680 :
700 rem *******************************
710 rem reformat from ts to eof
720 rem *******************************
730 (NULL) 53,ts : (NULL) 251,ts+(NULL)(eof)
740 sys 50986 : n = ts+(NULL)(eof) : (NULL) n+1, is-n-1, 141 : return
750 :
800 rem *******************************
810 rem dummy subroutine
820 rem for undefined 'on' statements
830 rem *******************************
840 return
850 :
900 rem *******************************
910 rem get key character, any purpose
920 rem *******************************
930 get c$ : if c$="" then 930
940 c = asc(c$) : return
950 :
1000 rem ******************************
1010 rem get & display disk directory
1020 rem module
1030 rem ******************************
1040 print"[147][158]";:poke785,93:poke786,207:rem set-up usr jump
1050 open 15,dev,15,"":print#15,"i"
1055 open3,dev,0,"$*=s"
1060 get#3,x$ : get#3,x$ : a=1
1070 poke781,3:sys53125:print
1075 print"---------------------------------------"
1080 gosub 2000 : gosub 2200
1085 if k$<>"x" then 1090
1086 (NULL)
1087 goto 1120
1090 ifk$<>"m" then 1120
1100 print"";:gosub 2540
1110 print"[147][158]";file$ : goto 1075
1120 close 3:(NULL).input#15,err$
1122 print#15,"u9":close 15
1125 if k$<>"x" then gosub 2500
1130 return
1140 :
2000 rem ******************************
2010 rem get in directory names
2020 rem ******************************
2030 poke781,3:rem x reg. = chnl no.
2040 sys53125 : rem call getdir
2050 if a=0 then a=1:print:goto 2070
2060 a=0:printtab(20)"";
2070 if st<>0 then 2100 : rem eof
2080 getk$:if k$="s" then 2100
2085 t=t+a:ift>=22thent=0:return
2090 goto 2040 : rem do next line
2100 return
2110 :
2200 rem ******************************
2210 rem do highlights
2220 rem ******************************
2230 sk=1104:sc=sk:tv=0:tb=0:k$=""
2240 sys65484 : rem reset default i/o
2250 gosub 2400: rem call invert
2260 ifx=32andtv>0thentv=0:goto2330
2270 getk$:ifk$=""then2270
2275 if k$="x" then return
2280 if(k$=""ork$="[157]")andtb=0thentb=20:goto2330
2290 if(k$=""ork$="[157]")andtb=20thentb=0
2300 ifk$=""thentv=tv+40:iftv>880thentv=0
2310 ifk$="[145]"thentv=tv-40:iftv<0thentv=880
2320 ifk$=chr$(13)ork$="m" then return
2330 gosub 2400:sc=sk+tv+tb:goto2250
2340 :
2400 rem ******************************
2410 rem inverse filename
2420 rem ******************************
2430 x=usr(sc) : return
2440 :
2500 rem ******************************
2510 rem extract filename into file$
2520 rem ******************************
2530 poke783,0:poke782,tb:poke781,(tv/40)+2:sys65520:rem plot to screen
2540 poke631,13:poke198,1:open2,0:input#2,file$:close2
2550 forn=16to1step-1:ifmid$(fi$,n,1)=" "then:nextn
2560 file$=left$(file$,n)
2580 return
2590 :
2600 rem ******************************
2610 rem disk file handling module
2620 rem ******************************
2635 (NULL) 0,0 : print c2$;
2640 (NULL) 0,0 : print "[158]file "; cf$;
2650 gosub 900
2660 for n = 1 to len(cf$)
2670 if c$=mid$(cf$,n,1) then 2690
2680 next n
2685 gosub 6950
2690 on n gosub 0,2700,0,2800,0,2900,0,5400,0,5300,0,3300,0,3100,0,3200,0,6900
2693 (NULL) 785,51084 : rem usr jmp
2695 (NULL) 55296,120,7 : (NULL) (55296+120),880,1 : gosub 700 : return
2696 :
2700 rem ******************************
2710 rem load text file
2720 rem ******************************
2740 gosub 1000
2750 (NULL) 253,ts : poke 51083,0
2760 open 2,dev,2, file$ : sys 51638,2
2770 close 2 : (NULL) sptr,ts : (NULL) eof,((NULL)(253)-ts)-1 : (NULL) 253,ts
2780 return
2790 :
2800 rem ******************************
2810 rem append text file
2820 rem ******************************
2830 c$=file$
2840 gosub 1000
2850 (NULL) 253,(ts+(NULL)(eof)) : poke 51083,0
2860 open 2,dev,2, file$ : sys 51638,2
2865 file$=c$
2870 goto 2770
2880 :
2900 rem ******************************
2910 rem save text file as seq
2920 rem ******************************
2923 (NULL) 0,0 : print c2$;
2925 (NULL) 1,0 : print c2$;
2930 (NULL) 0,0 : print c7$;
2940 if len(file$) > 0 then 2960
2945 (NULL).input files$
2950 gosub 2550 : goto 2970 : rem use last part of "extract" to "crunch" file$
2960 print file$;
2970 open 15,dev,15
2975 c$ = file$+",w,s"
2977 open 2,dev,2, c$ : poke 51083,1
2980 (NULL).input#15,err$ : if val(err$)=63 then gosub 3000
2985 n = (NULL)(253) : (NULL) 253,ts : (NULL) 251,(ts+(NULL)(eof))
2990 sys 51638,2 : close 2 : close 15 : (NULL) 253,n : return
2995 :
3000 rem ******************************
3010 rem auto delete existing file
3020 rem ******************************
3030 err$ = "s0:"+file$
3040 close 2 : print#15,err$ : (NULL).input#15,err$
3050 open 2,dev,2, c$ : return
3060 :
3100 rem ******************************
3110 rem clear text and reset as new
3120 rem ******************************
3130 (NULL) 0,0 : print c2$;
3140 (NULL) 0,0 : print "clear text & reset (y/n) ?"; : gosub 6950
3150 gosub 900 : if c$<>"y" then return
3180 (NULL) eof,0 : run
3190 :
3200 rem ******************************
3210 rem create disk file name
3220 rem ******************************
3230 (NULL) 0,0 : print c2$; c2$;
3240 (NULL) 0,0 : print "[158]name "; file$; : (NULL) 0,5 : (NULL).input files$
3250 gosub 2550 : return
3260 :
3300 rem ******************************
3310 rem view file and preserve file$
3320 rem ******************************
3330 c$ = file$ : gosub 1000 : file$ = c$ : return
3340 :
3400 rem ******************************
3410 rem ask scroll value
3420 rem ******************************
3430 (NULL) 0,0 : print c2$;
3440 (NULL) 0,0 : print "[158]scroll"; ss
3450 (NULL) 0,7 : (NULL).input in$
3460 ss = val(in$)
3470 if ss <=0 then ss = 15
3480 return
3490 :
3500 rem ******************************
3510 rem scroll screen up by scl
3520 rem ******************************
3530 (NULL) 253,(NULL)(sptr)
3540 for n = 1 to ss
3550 sys 51437 : if (NULL)(253)<=ts then 3590
3560 next n
3570 sys 51437 : sys 51408
3580 (NULL) sptr,(NULL)(253) : return
3590 (NULL) sptr,ts : (NULL) 253,ts : return
3600 rem ******************************
3610 rem scroll screen down by scl
3620 rem ******************************
3630 (NULL) 253,(NULL)(sptr)
3640 for n = 1 to ss
3650 sys 51408 : if (NULL)(253)>=(ts+(NULL)(eof)) then 3670
3660 next n
3670 (NULL) sptr,(NULL)(253) : return
3680 :
3700 rem ******************************
3710 rem insert single character
3720 rem ******************************
3725 n = (NULL)(253) : nl = (NULL)(eof)-(NULL)(csr)
3730 (NULL) n, n-1, nl
3740 poke n, 32 : (NULL) eof,(NULL)(eof)+1 : return
3750 :
3800 rem ******************************
3810 rem delete single character
3820 rem ******************************
3830 n = (NULL)(253) : nl = (NULL)(eof)-(NULL)(csr)
3835 if n<=ts then return
3840 (NULL) n-1, n, nl+2
3850 (NULL) eof,(NULL)(eof)-1
3860 (NULL) 253,(NULL)(253)-1 : return
3870 :
3900 rem ******************************
3910 rem pull home stack & perform hme
3920 rem ******************************
3930 n = (NULL)(hme) : (NULL) sptr,h(n) : (NULL) 253,h(n)
3940 n = n - 1 : if n<0 then n = 0
3950 (NULL) hme,n : return
3960 :
4000 rem ******************************
4010 rem push home stack with scn. addr
4020 rem ******************************
4030 n = (NULL)(hme) : n=n+1 : if n<=10 then 4050
4035 gosub 6950
4040 (NULL) 0,0 : print c2$; : (NULL) 0,0 : print c4$; c6$; : gosub 900 : return
4050 (NULL) hme,n : h(n)=(NULL)(sptr) : return
4060 :
4100 rem ******************************
4110 rem toggle insert mode -
4120 rem move text from cursor to eof
4130 rem ******************************
4140 if (NULL)(ins) > 0 then 4190
4150 n = (NULL)(253) : il = (ts+(NULL)(eof)) - n : is = te - il
4160 (NULL) is, n-1, il : (NULL) n, is-n, 141
4170 (NULL) eof, n-ts : (NULL) ins, 1 : return
4180 rem ------------------------------
4190 n = ts+(NULL)(eof) : (NULL) n, is+1, il : (NULL) eof, (NULL)(eof)+il
4200 (NULL) ins, 0 : is = te : gosub 700 : return
4210 :
4300 rem ******************************
4310 rem block command module
4320 rem ******************************
4330 cx$="[158]s/e/c/m/d/f?"
4340 (NULL) 0,0 : print c2$; : (NULL) 0,0 : print "block "; cb$;
4350 gosub 900
4360 for n = 1 to len(cb$)
4370 if c$ = mid$(cb$,n,1) then 4390
4380 next n
4385 gosub 6950
4390 on n gosub 0,4500,0,4600,0,4900,0,5000,0,4800,0,5200
4400 return
4410 :
4500 rem ******************************
4510 rem define block start
4520 rem ******************************
4530 bs = (NULL)(253) : return
4540 :
4600 rem ******************************
4610 rem define block end
4620 rem ******************************
4630 be = (NULL)(253) : return
4640 :
4700 rem ******************************
4710 rem check block defined ok
4715 rem abort operation if not
4720 rem ******************************
4730 if (bs>=ts and be<=te) and bs < be then return
4735 gosub 6950
4740 (NULL) 0,0 : print c2$; : (NULL) 0,0 : print c4$; c5$; : gosub 900
4750 (NULL)
4760 return
4770 :
4800 rem ******************************
4810 rem delete defined block
4820 rem ******************************
4823 gosub 4700
4825 n = ts+(NULL)(eof) : l = be-bs
4830 (NULL) bs, be, n-be
4840 (NULL) n-l, l, 141
4850 (NULL) eof, ((NULL)(eof)-l)
4860 bs = ts : be = ts
4865 if (NULL)(csr)>(NULL)(eof) then:(NULL) 253, ts+(NULL)(eof)
4867 return
4870 :
4900 rem ******************************
4910 rem copy defined block
4920 rem ******************************
4930 gosub 4700
4940 n = ts+(NULL)(eof) : l = be-bs
4950 c = (NULL)(253)
4960 (NULL) is-l, bs-1, l
4970 (NULL) (c+l)-1, c-1, n-c
4975 (NULL) c, (is+1)-l, l
4980 (NULL) eof, (NULL)(eof)+l
4990 return
4995 :
5000 rem ******************************
5010 rem move defined block
5020 rem ******************************
5030 gosub 4700
5040 n = ts+(NULL)(eof) : l = be-bs
5050 c = (NULL)(253)
5060 (NULL) is-l, bs-1, l
5070 if c>=be then:(NULL) bs, be, c-be
5080 if c<=bs then:(NULL)(c+l)-1,c-1,bs-c
5090 if c>=be then:(NULL) c-l,(is+1)-l,l
5095 if c<=bs then:(NULL) c, (is+1)-l, l
5100 bs = ts : be = ts
5110 return
5120 :
5200 rem ******************************
5210 rem file or save defined block
5220 rem ******************************
5230 gosub 4700
5240 ts = bs : x = (NULL)(eof)
5250 b$ = file$ : file$ = ""
5260 (NULL) eof, be-bs-1
5270 gosub 2900
5280 ts = 24575 : (NULL) eof, x
5290 bs = ts : be = ts : file$ = b$
5292 return
5295 :
5300 rem ******************************
5310 rem erase disk file module
5320 rem ******************************
5330 c$ = file$ : gosub 1000
5340 open 15,dev,15
5350 x$ = "s0:"+files$
5360 print#15, x$
5370 (NULL).input#15, err$
5380 close 15 : file$ = c$ : return
5390 :
5400 rem ******************************
5410 rem dump screen to disk as prg
5420 rem ******************************
5430 (NULL) 0,0 : print c2$; c2$;
5440 (NULL) 0,0 : print c8$;
5450 c$ = file$ : (NULL).input file$
5460 gosub 2550
5470 open 15,8,15 : x$ = "s0:"+file$
5480 (NULL) file$, 8, 2, 1144, 2024 : (NULL).input#15, err$
5490 if val(err$) = 63 then print#15, x$ : goto 5480
5500 close 15 : file$ = c$ : return
5510 :
5600 rem ******************************
5610 rem text command module
5620 rem ******************************
5630 (NULL) 0,0 : print c2$; : (NULL) 0,0 : print "text "; ct$;
5640 gosub 900
5650 for n = 1 to len(ct$)
5660 if c$ = mid$(ct$,n,1) then 5680
5670 next n
5675 gosub 6950
5680 if n=20 then gosub 6800 : goto 5690
5685 on n gosub 0,5800,0,5900,0,6000,0,6400,0,6100,0,6200,0,6500,0,6600,0,6700
5690 (NULL)
5700 goto 450
5710 :
5800 rem ******************************
5810 rem transpose two characters
5820 rem ******************************
5830 n = (NULL)(253) : c = peek(n)
5840 poke n, peek(n+1) : poke n+1,c
5850 return
5860 :
5900 rem ******************************
5910 rem delete word from cursor on
5920 rem ******************************
5930 bs = (NULL)(253) : n = bs
5940 c = peek(n)
5950 if c=32 or c=13 or c=141 then 5970
5960 n=n+1 : goto 5940
5970 be=n+1 : gosub 4825 : return
5980 :
6000 rem ******************************
6010 rem change case of single char.
6020 rem ******************************
6030 n = (NULL)(253) : c = peek(n)
6040 if c>=193 and c<=218 then 6060
6045 if c>=65 and c<=90 then 6070
6050 (NULL) 253,(NULL)(253)+1 : return
6060 c=c-128 : poke n,c : goto 6050
6070 c=c+128 : poke n,c : goto 6050
6080 :
6100 rem ******************************
6110 rem perform go to end of file
6120 rem ******************************
6130 n = ts+(NULL)(eof)
6140 (NULL) 253,n
6150 for x = 1 to 21 : sys 51437
6155 if (NULL)(253)<=ts then:(NULL) 253,ts : goto 6160
6156 next x
6160 sys 51408 : (NULL) sptr,(NULL)(253) : (NULL) 253,n : return
6170 :
6200 rem ******************************
6210 rem find or search control module
6220 rem ******************************
6230 (NULL) 0,0 : print " ";
6235 print " ";
6240 (NULL) 0,0 : print "find "; match$;
6250 (NULL) 0,5 : (NULL).input match$
6251 for n=75 to 1 step-1
6252 if mid$(ma$,n,1)=" " then:next n
6253 ma$=left$(ma$,n)
6254 x=(NULL)((NULL)(ma$)+1)
6255 for n=0 to peek((NULL)(ma$))
6256 if peek(x+n)>90 then poke x+n,peek(x+n)+96
6257 next n
6260 poke (NULL)(f$),len(ma$)
6270 for n = (NULL)(253) to (ts+(NULL)(eof))-1
6280 (NULL)((NULL)(f$)+1), n
6282 if f$ = ma$ then 6330
6285 get c$ : if c$="x" then 6340
6290 next n
6295 goto 6340
6330 poke 212,0
6340 goto 6140
6350 :
6400 rem ******************************
6410 rem go to start of text file
6415 rem ******************************
6420 (NULL)253,ts : (NULL) sptr,ts : return
6430 :
6500 rem ******************************
6510 rem reset match$ for find to ""
6520 rem ******************************
6530 match$ = "" : return
6540 :
6600 rem ******************************
6610 rem go to next word
6620 rem ******************************
6630 n = (NULL)(253)
6640 c = peek(n) : n=n+1
6650 if c=32 then:(NULL) 253,n : return
6660 goto 6640
6670 :
6700 rem ******************************
6710 rem go to previous word
6720 rem ******************************
6730 n = (NULL)(253)
6740 c = peek(n) : n=n-1
6750 if c=32 then 6770
6760 goto 6740
6770 c = peek(n) : n=n-1
6780 if c=32 then:(NULL) 253,n+2 : return
6790 goto 6770
6795 :
6800 rem ******************************
6810 rem delete line module
6820 rem ******************************
6830 n = (NULL)(253) : bs = n
6840 if peek(n) = 141 or peek(n) = 13 then 6860
6850 n = n+1 : goto 6840
6860 n = n+1 : be = n : gosub 4825 : return
6870 :
6900 rem ******************************
6910 rem change to other disk drive
6920 rem ******************************
6930 if dev = 8 then dev = 9 : return
6940 dev = 8 : return
6945 :
6950 rem ******************************
6951 rem sound bleep module
6952 rem ******************************
6953 poke 54296,15 : poke 54277,15
6954 poke 54276,17 : poke 54273,63 : poke 54272,75
6955 for t = 0 to 70 : next t
6956 poke 54276,0 : poke 54273,0 : poke 54272,0
6957 return
6958 :