home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / DSKCHK3.ZIP / DSKCHK3.PF3
Encoding:
Text File  |  1990-12-05  |  3.1 KB  |  88 lines

  1. '***********************************************************************
  2.  
  3. ' HELP *** HELP *** HELP
  4.  
  5. 'DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! 
  6. '***********************************************************************
  7.  
  8. 'this function does the same as DSKREADY.COM ( see PC Magazine
  9. ' Vol 7:6 Mar 29,88)
  10. ' it is supposed to check the disk drive and not be fouled up by
  11. 'Abort,retry,fail etc. Be EXTREMELY CAREFUL that the interrupt number
  12. 'does not get changed to 26H or the results will be disastrous!!
  13. 'Interestingly floppies formatted according to Corefast's proprietary
  14. 'scheme (for more efficient backups) return an error code of 8.
  15. '----------- Dave Topps -------- ( 12/11/90 )
  16.  
  17. 'This version has been written to more thoroughly debug the codes returned.
  18.  
  19. 'Well this is very strange indeed. When first run, this function returns
  20. '"Drive problem" without even accessing the drive. Running it a second time
  21. 'sometimes gives the correct return. 
  22.  
  23. 'Running this function as it stands with public variables produces the
  24. 'CERROR 439 "Invalid memory record" on reaching the line
  25. 'MEMFREE $dta_buff
  26. 'Interestingly when you try to trace the variables, upon INTERRUPT 0x25
  27. 'all the variables are cleared from the debugger. So according to the debugger
  28. 'the variable $dta_buff does not exist after INTERRUPT 0x25 and so it's no
  29. 'wonder that MEMFREE cannot clear it.
  30. 'More alarming is that after that, there seems to be some sort of internal
  31. 'memory error because after that Smart produces errors such as "Unable to
  32. 'read project file" or "Insufficient memory".( {^F1} at that point shows
  33. '178k free memory).
  34. 'THERE IS SOMETHING DANGEROUSLY WRONG HERE WHICH NEEDS TO BE FIXED.
  35.  
  36. 'Is there a problem with the stack or something which clobbers the registers
  37. 'when executing Int 0x25 ?
  38.  
  39. ' ALL SUGGESTIONS WELCOME.
  40. '******************************************************************
  41.  
  42. 'GLOBAL $drive, _dskchk(), $drv
  43. PUBLIC $drive, _dskchk(), $drv
  44. PUBLIC $dta_buff, $flags, $ax_reg,
  45.  
  46. MAIN
  47. SCREEN PRINT 10 10 14 1 "Choose drive to check:"
  48. SCREEN PROMPT 10 35 12 50 FGPLEASING BGPLEASING "A B C D E F G" $drive
  49. IF $drive = 0
  50.      'Esc was used
  51.      STOP
  52. END IF
  53. $drive = $drive -1       'decrement value
  54. _dskchk( $drive)
  55. END MAIN
  56.  
  57. FUNCTION _dskchk( $drv)
  58. 'LOCAL $dta_buff, $flags, $ax_reg,
  59. SETREG( AX, $drv )       ' 0= a: 1 = b:
  60. SETREG( CX,0x0001)
  61. SETREG( DX,0x0000)
  62. MEMALLOC $dta_buff SIZE 512
  63. SETREG( DS, DOSSEG( $dta_buff ))
  64. SETREG( BX, DOSOFFSET( $dta_buff ))
  65. INTERRUPT 0x25
  66. $flags = GETREG( FLAGS )
  67. ' 0th bit is the carry flag ( set if operation failed)
  68. $ax_reg = GETREG(AX)
  69. IF BITAND( $flags, 1 )
  70.         'carry flag ( 0th bit ) was set
  71.      CASE BITAND( $ax_reg, 0x00FF)
  72.           WHEN 2
  73.                SCREEN PRINT 25 1 14 1 "Drive door open"
  74.           WHEN 8
  75.                SCREEN PRINT 25 1 14 1 "Corefast disk"
  76.           WHEN 12
  77.                SCREEN PRINT 25 1 14 1 "Unformatted disk"
  78.           OTHERWISE
  79.                SCREEN PRINT 25 1 14 1 "Other drive problem"
  80.      END CASE
  81.         MESSAGE "Drive problem"
  82. ELSE
  83.         MESSAGE "Drive OK"
  84. END IF
  85. MEMFREE $dta_buff
  86. END FUNCTION
  87.  
  88.