home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 March / 1986-03.d64 / cataloger (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  111 lines

  1. 5 print"[147]"
  2. 10 dimb$(800):ifpeek(794)<>74then30
  3. 20 poke53281,15:poke53280,15:kb=198:ro=214:goto60
  4. 30 ifpeek(794)<>189then50
  5. 40 (NULL) 0,16:(NULL) 4,16:kb=208:ro=235:printchr$(27)"m":goto60
  6. 50 ro=205:kb=239:poke65301,241:poke65305,241:poke2025,255
  7. 60 s$="                    ":c=0:open15,8,15:d$=""
  8. 70 print"[147]      choose one of the following       [146]"
  9. 80 printspc(5)"1. catalog a set of disks"
  10. 90 printspc(5)"2. see all file names"
  11. 100 printspc(5)"3. print all file names"
  12. 110 printspc(5)"4. sort names alphabetically"
  13. 120 printspc(5)"5. create a sequential file"
  14. 130 printspc(5)"6. create a program file"
  15. 140 printspc(5)"7. load an old file"
  16. 150 printspc(5)"8. delete a disk"
  17. 160 printspc(5)"9. start new file"
  18. 170 printspc(12)" press q to quit[146]"
  19. 180 pokekb,0:waitkb,1:geta$:ifa$="q"thenclose15:print"[147]":end
  20. 190 ifa$<"1"ora$>"9"then180
  21. 200 onval(a$)gosub210,510,520,640,730,740,850,940,1040:goto70
  22. 210 f$="disk":gosub1050:ifdn$="q"thenreturn
  23. 220 print"[147]"spc(20-len(dn$)/2)dn$""
  24. 230 close2:open2,8,0,"$":gosub390:ifa$="q"thenreturn
  25. 240 x=4:nf=0:ifexthen220
  26. 250 b$(c)="":fl=-1:gosub310:x=2:get#2,ln$
  27. 260 get#2,hn$:nm=asc(ln$+chr$(0))+256*asc(hn$+chr$(0)):printspc(5)nm;
  28. 270 get#2,a$:ifa$=""then320
  29. 280 ifa$=chr$(34)thenfl=-fl
  30. 290 iffl=1thenb$(c)=b$(c)+a$
  31. 300 printa$;:goto270
  32. 310 fora=1tox:get#2,a$:next:return
  33. 320 ifb$(c)=""thenclose2:gosub480:ifa$<>"q"then210
  34. 330 ifb$(c)=""thenreturn
  35. 340 print:nm$=str$(nm)
  36. 350 b$(c)=right$(b$(c),len(b$(c))-1)
  37. 360 b$(c)=b$(c)+left$(s$,19-len(b$(c))-len(nm$))+nm$+"  "+dn$
  38. 370 ifnf=1thenc=c+1:ifc=800then1080
  39. 380 nf=1:goto250
  40. 390 rf=0:ex=0:a$="":input#15,en,m$,t,s
  41. 400 ifen<20thenreturn
  42. 410 print""d$:fora=1to5:print"                                   ":next
  43. 420 ex=1:print:print""d$en;m$;t;s:ifen<>63then470
  44. 430 rf=1:print" do you want to replace the file? (y/n)"
  45. 440 geta$:ifa$="n"thenreturn
  46. 450 ifa$<>"y"then440
  47. 460 ex=0:print#15,"s"+dn$:return
  48. 470 close2
  49. 480 print:print"  press any key to continue q to quit[146]":pokekb,0:waitkb,1
  50. 490 geta$:return
  51. 500 print:print"      press any key to continue":pokekb,0:waitkb,1:return
  52. 510 dv=3:sa=0:sp=1:dn$="":nm=0:goto550
  53. 520 print"[147]"d$"press [m] to return to the menu any     other key to print"
  54. 530 pokekb,0:waitkb,1:geta$:ifa$="m"then70
  55. 540 dv=4:sp=20:sa=0:dn$="":nm=0
  56. 550 ifc<=0thenprint"[147]"d$spc(10)"no files in memory":goto500
  57. 560 ifnmthengosub1050:dn$="0:"+dn$+",s,w"
  58. 570 close2:open2,dv,sa,dn$:gosub390:ifa$="q"thenreturn
  59. 580 ifrfandex=0then570
  60. 590 ifrfthen560
  61. 600 ifexthen570
  62. 610 print"[147]":fora=0toc:print#2,spc(sp)b$(a)
  63. 620 ifpeek(ro)=21thengosub500:print"[147]"
  64. 630 next:close2:gosub500:return
  65. 640 ifc<=0thenprint"[147]"d$spc(10)"no files in memory":goto500
  66. 650 d=c-1:m=d:print"[147]"d$spc(15)"sorting...."
  67. 660 m=int(m/2):ifm=0thenreturn
  68. 670 j=0:k=d-m
  69. 680 i=j
  70. 690 l=i+m
  71. 700 ifb$(i)>b$(l)thent$=b$(i):b$(i)=b$(l):b$(l)=t$:i=i-m:ifi>0then690
  72. 710 j=j+1:ifj>kthen660
  73. 720 goto680
  74. 730 dv=8:sp=5:sa=2:f$="file":nm=1:dn$=dn$+",s,w":goto550
  75. 740 gosub1050:dn$="0:"+dn$:ifdn$="0:q"thenreturn
  76. 750 close2:open2,8,2,dn$+",p,w":gosub390:ifa$="q"thenreturn
  77. 760 ifrfandex=0then750
  78. 770 ifrfthen740
  79. 780 ifexthen750
  80. 790 print#2,chr$(1)chr$(8);:fora=0toc-1
  81. 800 print#2,chr$(4)chr$(4);:ln=100+a
  82. 810 hb=int(ln/256):lb=ln-hb*256:print#2,chr$(lb)chr$(hb);
  83. 820 print#2,chr$(34)b$(a)chr$(34)chr$(0);
  84. 830 nexta:print#2,chr$(0)chr$(0);
  85. 840 close2:return
  86. 850 f$="file":gosub1050:ifdn$="q"thenreturn
  87. 860 open2,8,2,"0:"+dn$+",s,r":gosub390:ifexthen850
  88. 870 fl=-1:b$(c)="":fora=1to5:get#2,a$:next
  89. 880 get#2,a$:ifa$=chr$(13)then910
  90. 890 b$(c)=b$(c)+a$
  91. 900 goto880
  92. 910 ifstthenclose2:return
  93. 920 c=c+1:ifc=800then1080
  94. 930 goto870
  95. 940 f$="disk":gosub1050:ifdn$="q"thenreturn
  96. 950 print"[147]"d$spc(14)"deleting":en=0
  97. 960 fl=0:fora=0toc-1
  98. 970 ifmid$(b$(a),22,16)=dn$andfl=0thenfl=1:sn=a
  99. 980 ifmid$(b$(a),22,16)<>dn$andfl=1thenen=a:a=c
  100. 990 next:iffl=0thenprint""spc(12)"file not found":goto1030
  101. 1000 ifen=0thenen=c+1:goto1020
  102. 1010 fora=sntoc-(en-sn):b$(a)=b$(en+a-sn):next
  103. 1020 c=c-(en-sn):print""spc(14)"deleted"
  104. 1030 gosub500:c=c-(c<0):return
  105. 1040 c=0:return
  106. 1050 print"[147] put disk in drive and enter "f$" name"
  107. 1060 print" (up to 16 characters) q to quit[146]"
  108. 1070 poke19,1:input" ";dn$:poke19,0:dn$=left$(dn$,16):return
  109. 1080 print"[147]"d$"the master directory is full.  save the present file and ";
  110. 1090 print"start a new directory.":gosub500:return
  111.