home *** CD-ROM | disk | FTP | other *** search
/ Nibble Magazine / nib28a.dsk / AUGUST.1986 / PRODOS.CATALOG.bas < prev    next >
BASIC Source File  |  2023-02-26  |  8KB  |  191 lines

  1. 10  REM  **********************
  2. 20  REM  *                    *
  3. 30  REM  *   PRODOS.CATALOG   *
  4. 40  REM  *   BY RON NOCKET    *
  5. 50  REM  * COPYRIGHT (C) 1986 *
  6. 60  REM  * BY MICROSPARC, INC *
  7. 70  REM  * CONCORD, MA  01742 *
  8. 80  REM  *                    *
  9. 90  REM  **********************
  10. 100  REM 
  11. 110  LET D$ =  CHR$(4)
  12. 120  PRINT D$;"PR#3"
  13. 130  PRINT 
  14. 140  ONERR  GOTO 1010: REM  SET UP ERROR TRAPS
  15. 150  REM  --MAIN PROGRAM
  16. 160  TEXT : HOME : PRINT "EXPANDED PRODOS CATALOG": PRINT "Copyright 1986 by MicroSPARC, Inc."
  17. 170  VTAB 4: PRINT "This program will reveal all of the files that are on a ProDOS-formatted disk.  It will show all of the files including even those that have been saved under   various subdirectories."
  18. 180  PRINT 
  19. 190  PRINT "Please indicate how the disk is to be located:"
  20. 200  VTAB 10: CALL  -958
  21. 210  HTAB 7: PRINT "1)  Disk Drive 1"
  22. 220  PRINT 
  23. 230  HTAB 7: PRINT "2)  Disk Drive 2"
  24. 240  PRINT 
  25. 250  HTAB 7: PRINT "3)  By Volume or Partial Pathname"
  26. 260  PRINT 
  27. 270  HTAB 7: PRINT "4)  Exit This Program"
  28. 280  VTAB 18
  29. 290  PRINT "Please enter a number (1, 2, 3, or 4) -> ";: GET DN$: IF DN$ > CHR$(48)  THEN  PRINT DN$
  30. 300  IF DN$ < >"1"  AND DN$ < >"2"  AND DN$ < >"3"  AND DN$ < >"4"  THEN  GOTO 200
  31. 310  IF DN$ = "4"  THEN  TEXT : HOME : END 
  32. 320  IF DN$ = "3"  THEN  GOTO 350
  33. 330  IF DN$ = ""  OR DN$ = "1"  THEN  PRINT  CHR$(4);"PREFIX,D1": PRINT  CHR$(4);"PREFIX": INPUT "";DN$: LET CPFX$ = DN$: LET DN$ =  LEFT$(DN$,( LEN(DN$) -1)): GOTO 380
  34. 340  IF DN$ = "2"  THEN  PRINT  CHR$(4);"PREFIX,D2": PRINT D$"PREFIX": INPUT "";DN$: LET CPFX$ = DN$: LET DN$ =  LEFT$(DN$,( LEN(DN$) -1)): GOTO 380
  35. 350  VTAB 8: CALL  -958: VTAB 12
  36. 360  INPUT "Please enter the volume or partial pathname -> ";DN$
  37. 370  IF  LEFT$(DN$,1) < >"/"  THEN DN$ = "/" +DN$
  38. 380  VTAB 8: CALL  -958
  39. 390  PRINT "Do you want this listing on the printer? (Y/N) -> ";: GET PF$: PRINT PF$
  40. 400  IF PF$ = "Y"  OR PF$ = "y"  THEN  GOSUB 910: GOTO 450
  41. 410  IF PF$ = "N"  OR PF$ = "n"  THEN  GOTO 440
  42. 420  IF PF$ =  CHR$(13)  THEN PF$ = "N": GOTO 440
  43. 430  GOTO 380
  44. 440  HOME 
  45. 450  LET L = 1:NL = 1
  46. 460  LET PPN$ = DN$: REM  --PARTIAL PATHNAME
  47. 470  GOSUB 630
  48. 480  LET DF(NL) = S: REM  --NUMBER OF DIRECTORIES FOUND IN THIS LEVEL
  49. 490  LET NL = NL +1
  50. 500  LET SS = S: LET S = 0
  51. 510  FOR Z = 1 TO SS
  52. 520  IF DIR$(NL -1,Z) = ""  THEN  GOTO 580
  53. 530  IF NL > = 3  THEN  LET PPN$ = PPN$(NL -1,Z) +"/" +DIR$(NL -1,Z): GOTO 550
  54. 540  LET PPN$ = DN$ +"/" +DIR$(NL -1,Z): REM  --PARTIAL PATHNAME
  55. 550  GOSUB 630
  56. 560  NEXT 
  57. 570  GOTO 480
  58. 580  IF PF$ = "N"  OR PF$ = "n"  THEN  GOTO 620
  59. 590  PRINT  CHR$(12): REM  --FORM FEED
  60. 600  PRINT D$;"PR#0"
  61. 610  VTAB 12: CALL  -868: LET A$ = " Press <RETURN> to return to the menu ": HTAB 20 - LEN(A$)/2: PRINT A$;: GET R$: PRINT R$: RUN 
  62. 620  PRINT : PRINT : VTAB 22: LET A$ = " Press <RETURN> to return to the menu": INVERSE : POKE  -16368,0: GOSUB 1810: NORMAL : RUN 
  63. 630  REM  --READ THE DIRECTORIES
  64. 640  PRINT D$;"OPEN ";PPN$;",TDIR"
  65. 650  PRINT D$;"READ ";PPN$
  66. 660  PRINT 
  67. 670  PRINT PPN$
  68. 680  PRINT 
  69. 690  LET M = 1
  70. 700  INPUT L1$: REM  --READ NAME
  71. 710  INPUT L2$: PRINT L2$: REM  --READ TITLE
  72. 720  INPUT L3$: PRINT L3$: REM  --READ BLANK LINE
  73. 730  INPUT L4$: PRINT L4$: REM  --READ FILES
  74. 740  IF  MID$ (L4$,18,3) = "DIR"  THEN  LET S = S +1: LET DIR$(NL,S) =  MID$ (L4$,2,15): LET PPN$(NL,S) = PPN$: GOSUB 860
  75. 750  LET TB =  VAL( MID$ (L4$,24,5))
  76. 760  LET BT = BT +TB
  77. 770  IF L4$ < >""  THEN  LET M = M +1: GOTO 730
  78. 780  INPUT L5$
  79. 790  LET BL = BL +BT
  80. 800  LET BR =  VAL( MID$ (L5$,15,3))
  81. 810  PRINT M -1;" Files Listed, ";BT;" Blocks This List, ";BL;" Total Blocks Listed, ";BR;" Blocks Free"
  82. 820  LET BT = 0
  83. 830  PRINT D$;"CLOSE ";PPN$
  84. 840  PRINT 
  85. 850  RETURN 
  86. 860  REM  --REMOVE SPACES AT END OF DIRECTORY NAME
  87. 870  FOR Q = 1 TO 15
  88. 880  IF  MID$ (DIR$(NL,S),Q,1) = " "  THEN  LET DIR$(NL,S) =  MID$ (DIR$(NL,S),1,Q -1): LET Q = 15: GOTO 890
  89. 890  NEXT 
  90. 900  RETURN 
  91. 910  REM  --PRINTER ROUTINE
  92. 920  HOME 
  93. 930  PRINT  CHR$(21)
  94. 940  VTAB 12
  95. 950  HTAB 16
  96. 960  FLASH : PRINT " PRINTING ": NORMAL 
  97. 970  PRINT D$;"PR#1"
  98. 980  PRINT  CHR$(9);"80N"
  99. 990  PRINT  CHR$(9);"60P"
  100. 1000  RETURN 
  101. 1010  REM  --ERROR HANDLER
  102. 1020  LET EN =  PEEK(222): PRINT D$"PR#3"
  103. 1030  IF EN = 6  OR EN = 7  THEN  GOSUB 1120: GOTO 1120
  104. 1040  IF EN = 8  THEN  GOSUB 1190: GOTO 1120
  105. 1050  IF EN = 3  THEN  GOSUB 1190: GOTO 1120
  106. 1060  IF EN = 12  THEN  PRINT  CHR$(4);"CLOSE": GOTO 1120
  107. 1070  IF EN = 13  THEN  GOSUB 1910: GOTO 1120
  108. 1080  IF EN = 16  THEN  GOSUB 1540: GOTO 1120
  109. 1090  IF EN = 20  THEN  GOSUB 1380: GOTO 1120
  110. 1100  PRINT "Error # ";EN;" occurred in line "; PEEK(218) + PEEK(219) *256: GOSUB 1780: GOTO 1120
  111. 1120  GOTO 140
  112. 1130  ONERR  GOTO 1720
  113. 1140  PRINT D$;"PREFIX": INPUT CPFX$
  114. 1150  HOME : VTAB 4: PRINT "Sorry, but I cannot find the path that you indicated.  Please check the": PRINT "following and try again:"
  115. 1160  VTAB 8: PRINT "1)  Check your spelling of the pathname - you spelled it": PRINT PPN$: VTAB 12: PRINT "2)  Check that the partial pathname you chose works with the current prefix": PRINT "    which is ";CPFX$
  116. 1170  GOSUB 1770
  117. 1180  RETURN 
  118. 1190  REM  --ERROR I/O ERROR
  119. 1200  HOME 
  120. 1210  VTAB 4
  121. 1220  PRINT "I am having difficulty with reading the disk in Drive ";DN$
  122. 1230  PRINT 
  123. 1240  PRINT "Please check each of the following until the problem is corrected:"
  124. 1250  VTAB 8
  125. 1260  HTAB 7: PRINT "1)  The door in Drive ";DN$;" is open - close it!"
  126. 1270  PRINT 
  127. 1280  HTAB 7: PRINT "2)  There is no disk in Drive ";DN$;" - put one in."
  128. 1290  PRINT 
  129. 1300  HTAB 7: PRINT "3)  The disk is not formatted or is in a format other than ProDOS.": PRINT "    This program only works with properly formatted ProDOS disks."
  130. 1310  PRINT 
  131. 1320  HTAB 7: PRINT "4)  Try reseating the disk by taking it out and then putting it": PRINT "    back into the drive."
  132. 1330  IF DN$ = "1"  THEN  GOTO 1360
  133. 1340  PRINT 
  134. 1350  HTAB 7: PRINT "5)  Is there a Drive ";DN$;" in your system?"
  135. 1360  GOSUB 1770
  136. 1370  RETURN 
  137. 1380  REM  --ERROR - FILE BUSY
  138. 1390  HOME 
  139. 1400  VTAB 4
  140. 1410  PRINT "That catalog directory file is already open.  It must be closed before it can beaccessed again."
  141. 1420  PRINT 
  142. 1430  PRINT "I will close the file now.  Please try again!"
  143. 1440  PRINT D$;"CLOSE"
  144. 1450  GOSUB 1770
  145. 1460  RETURN 
  146. 1470  REM  --CONTROL-C ATTEMPTED
  147. 1480  PRINT D$;"CLOSE"
  148. 1490  HOME : VTAB 4
  149. 1500  PRINT "A CONTROL-C interrupt has been detected - do you really want to halt the": PRINT "program?": PRINT : PRINT : PRINT "Please answer Yes or No (Y/N) -> ";: GET R$: PRINT R$
  150. 1510  IF R$ = "Y"  OR R$ = "y"  THEN  PRINT  CHR$(12); CHR$(21): PRINT  CHR$(4);"CLOSE": VTAB 12: HTAB 18: PRINT "BYE!": VTAB 22: END 
  151. 1520  IF R$ = "N"  OR R$ = "n"  THEN  GOTO 140
  152. 1530  GOTO 1490
  153. 1540  REM  --ERROR - SYNTAX
  154. 1550  HOME : VTAB 2
  155. 1560  LET A$ = "The file/pathname that you entered was": GOSUB 1870
  156. 1570  PRINT 
  157. 1580  LET A$ = " " +DN$ +" ": INVERSE : GOSUB 1870: NORMAL 
  158. 1590  PRINT : PRINT 
  159. 1600  PRINT "Compare your path/filename above with the rules for naming path/filenames that  appear below.  Your path/filename MUST agree with these rules:"
  160. 1610  PRINT : PRINT 
  161. 1620  HTAB 7: PRINT "1)  The first character of the filename MUST be a letter."
  162. 1630  PRINT 
  163. 1640  HTAB 7: PRINT "2)  The maximum length of a filename is 15 characters."
  164. 1650  PRINT 
  165. 1660  HTAB 7: PRINT "3)  Only letters, digits, and periods are allowable as characters in a": PRINT "    ProDOS filename.  All others (including spaces) are illegal."
  166. 1670  PRINT 
  167. 1680  HTAB 7: PRINT "4)  The maximum length of a pathname is 64 characters including the": PRINT "    slashes."
  168. 1690  PRINT : PRINT : PRINT 
  169. 1700  GOSUB 1770
  170. 1710  RETURN 
  171. 1720  REM  --ERROR - UNABLE TO SET PREFIX
  172. 1730  IF  PEEK(222) = 8  THEN  HOME : VTAB 4: PRINT "Unable to set prefix for the current disk - a disk drive door must be open or   else you have a faulty or non-ProDOS disk in the drive.  Please correct the"
  173. 1740  IF  PEEK(222) = 8  THEN  PRINT "situation before trying again."
  174. 1750  GOSUB 1770
  175. 1760  POKE 216,0: RUN 
  176. 1770  REM  --PRESS <RETURN>
  177. 1780  POKE  -16368,0: REM  --CLEAR KEYBOARD STROBE
  178. 1790  VTAB 22
  179. 1800  LET A$ = "  Press <RETURN> to continue."
  180. 1810  HTAB 40 - LEN(A$)/2
  181. 1820  INVERSE 
  182. 1830  PRINT A$;
  183. 1840  NORMAL 
  184. 1850  GET R$: PRINT R$
  185. 1860  RETURN 
  186. 1870  REM  --CENTER A STRING
  187. 1880  HTAB 40 - LEN(A$)/2
  188. 1890  PRINT A$
  189. 1900  RETURN 
  190. 1910  HOME : VTAB 8: PRINT DN$;" is not a directory.": PRINT "It cannot be cataloged."
  191. 1920  GOSUB 1780: RETURN