home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 March
/
1986-03.d64
/
cataloger
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
111 lines
5 print"[147]"
10 dimb$(800):ifpeek(794)<>74then30
20 poke53281,15:poke53280,15:kb=198:ro=214:goto60
30 ifpeek(794)<>189then50
40 (NULL) 0,16:(NULL) 4,16:kb=208:ro=235:printchr$(27)"m":goto60
50 ro=205:kb=239:poke65301,241:poke65305,241:poke2025,255
60 s$=" ":c=0:open15,8,15:d$=""
70 print"[147] choose one of the following [146]"
80 printspc(5)"1. catalog a set of disks"
90 printspc(5)"2. see all file names"
100 printspc(5)"3. print all file names"
110 printspc(5)"4. sort names alphabetically"
120 printspc(5)"5. create a sequential file"
130 printspc(5)"6. create a program file"
140 printspc(5)"7. load an old file"
150 printspc(5)"8. delete a disk"
160 printspc(5)"9. start new file"
170 printspc(12)" press q to quit[146]"
180 pokekb,0:waitkb,1:geta$:ifa$="q"thenclose15:print"[147]":end
190 ifa$<"1"ora$>"9"then180
200 onval(a$)gosub210,510,520,640,730,740,850,940,1040:goto70
210 f$="disk":gosub1050:ifdn$="q"thenreturn
220 print"[147]"spc(20-len(dn$)/2)dn$""
230 close2:open2,8,0,"$":gosub390:ifa$="q"thenreturn
240 x=4:nf=0:ifexthen220
250 b$(c)="":fl=-1:gosub310:x=2:get#2,ln$
260 get#2,hn$:nm=asc(ln$+chr$(0))+256*asc(hn$+chr$(0)):printspc(5)nm;
270 get#2,a$:ifa$=""then320
280 ifa$=chr$(34)thenfl=-fl
290 iffl=1thenb$(c)=b$(c)+a$
300 printa$;:goto270
310 fora=1tox:get#2,a$:next:return
320 ifb$(c)=""thenclose2:gosub480:ifa$<>"q"then210
330 ifb$(c)=""thenreturn
340 print:nm$=str$(nm)
350 b$(c)=right$(b$(c),len(b$(c))-1)
360 b$(c)=b$(c)+left$(s$,19-len(b$(c))-len(nm$))+nm$+" "+dn$
370 ifnf=1thenc=c+1:ifc=800then1080
380 nf=1:goto250
390 rf=0:ex=0:a$="":input#15,en,m$,t,s
400 ifen<20thenreturn
410 print""d$:fora=1to5:print" ":next
420 ex=1:print:print""d$en;m$;t;s:ifen<>63then470
430 rf=1:print" do you want to replace the file? (y/n)"
440 geta$:ifa$="n"thenreturn
450 ifa$<>"y"then440
460 ex=0:print#15,"s"+dn$:return
470 close2
480 print:print" press any key to continue q to quit[146]":pokekb,0:waitkb,1
490 geta$:return
500 print:print" press any key to continue":pokekb,0:waitkb,1:return
510 dv=3:sa=0:sp=1:dn$="":nm=0:goto550
520 print"[147]"d$"press [m] to return to the menu any other key to print"
530 pokekb,0:waitkb,1:geta$:ifa$="m"then70
540 dv=4:sp=20:sa=0:dn$="":nm=0
550 ifc<=0thenprint"[147]"d$spc(10)"no files in memory":goto500
560 ifnmthengosub1050:dn$="0:"+dn$+",s,w"
570 close2:open2,dv,sa,dn$:gosub390:ifa$="q"thenreturn
580 ifrfandex=0then570
590 ifrfthen560
600 ifexthen570
610 print"[147]":fora=0toc:print#2,spc(sp)b$(a)
620 ifpeek(ro)=21thengosub500:print"[147]"
630 next:close2:gosub500:return
640 ifc<=0thenprint"[147]"d$spc(10)"no files in memory":goto500
650 d=c-1:m=d:print"[147]"d$spc(15)"sorting...."
660 m=int(m/2):ifm=0thenreturn
670 j=0:k=d-m
680 i=j
690 l=i+m
700 ifb$(i)>b$(l)thent$=b$(i):b$(i)=b$(l):b$(l)=t$:i=i-m:ifi>0then690
710 j=j+1:ifj>kthen660
720 goto680
730 dv=8:sp=5:sa=2:f$="file":nm=1:dn$=dn$+",s,w":goto550
740 gosub1050:dn$="0:"+dn$:ifdn$="0:q"thenreturn
750 close2:open2,8,2,dn$+",p,w":gosub390:ifa$="q"thenreturn
760 ifrfandex=0then750
770 ifrfthen740
780 ifexthen750
790 print#2,chr$(1)chr$(8);:fora=0toc-1
800 print#2,chr$(4)chr$(4);:ln=100+a
810 hb=int(ln/256):lb=ln-hb*256:print#2,chr$(lb)chr$(hb);
820 print#2,chr$(34)b$(a)chr$(34)chr$(0);
830 nexta:print#2,chr$(0)chr$(0);
840 close2:return
850 f$="file":gosub1050:ifdn$="q"thenreturn
860 open2,8,2,"0:"+dn$+",s,r":gosub390:ifexthen850
870 fl=-1:b$(c)="":fora=1to5:get#2,a$:next
880 get#2,a$:ifa$=chr$(13)then910
890 b$(c)=b$(c)+a$
900 goto880
910 ifstthenclose2:return
920 c=c+1:ifc=800then1080
930 goto870
940 f$="disk":gosub1050:ifdn$="q"thenreturn
950 print"[147]"d$spc(14)"deleting":en=0
960 fl=0:fora=0toc-1
970 ifmid$(b$(a),22,16)=dn$andfl=0thenfl=1:sn=a
980 ifmid$(b$(a),22,16)<>dn$andfl=1thenen=a:a=c
990 next:iffl=0thenprint""spc(12)"file not found":goto1030
1000 ifen=0thenen=c+1:goto1020
1010 fora=sntoc-(en-sn):b$(a)=b$(en+a-sn):next
1020 c=c-(en-sn):print""spc(14)"deleted"
1030 gosub500:c=c-(c<0):return
1040 c=0:return
1050 print"[147] put disk in drive and enter "f$" name"
1060 print" (up to 16 characters) q to quit[146]"
1070 poke19,1:input" ";dn$:poke19,0:dn$=left$(dn$,16):return
1080 print"[147]"d$"the master directory is full. save the present file and ";
1090 print"start a new directory.":gosub500:return