Advertisement
LBASIC

TESTDISK.BAS

Jun 5th, 2023
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 1.25 KB | None | 0 0
  1. '_|_|_|   TESTDISK.BAS
  2. '_|_|_|   This program demonstrates testing disk ready condition.
  3. '_|_|_|   Tested with CD ROM, floppy, IDE fixed disk.
  4. '_|_|_|   Tested under DOS 5.0, WIN'95, DOS 7 (WIN'95 DOS).
  5. '_|_|_|   No warrantee or guarantee is given or implied.
  6. '_|_|_|   Released   PUBLIC DOMAIN   by Kurt Kuzba.  (12/13/96)
  7. ON ERROR GOTO Oops
  8. DO
  9.    COLOR 11, 0
  10.    PRINT CHR$(13)
  11.    PRINT "This routine will test presence of a disk drive."
  12.    PRINT "Enter ESC to exit this program, or enter"
  13.    PRINT "the letter of the drive to be tested => ";
  14.    DO: k$ = UCASE$(INKEY$)
  15.    LOOP WHILE (k$ <> CHR$(27)) AND (k$ < "A") OR (k$ > "Z")
  16.    IF k$ <> CHR$(27) THEN
  17.       PRINT k$
  18.       Disk.ERROR.DATA = 0
  19.       tst% = FREEFILE
  20.       IF tst% = 0 THEN
  21.          PRINT "No file handles available."
  22.          END
  23.       END IF
  24.       OPEN k$ + ":\TESTDISK.NUL" FOR INPUT AS tst%
  25.       SELECT CASE Disk.ERROR.DATA
  26.          CASE 53: COLOR 15, 1: CLOSE tst%
  27.             PRINT " Drive is ready for access. ";
  28.          CASE ELSE: COLOR 14, 4: PRINT " Drive is not ready. ";
  29.             PRINT "["; LTRIM$(STR$(Disk.ERROR.DATA)); "]";
  30.       END SELECT
  31.    END IF
  32. LOOP WHILE k$ <> CHR$(27)
  33. SYSTEM
  34. Oops:
  35.    Disk.ERROR.DATA = ERR: RESUME NEXT
  36. '_|_|_|   end   TESTDISK.BAS
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement