home *** CD-ROM | disk | FTP | other *** search
- '***********************************************************************
-
- ' HELP *** HELP *** HELP
-
- 'DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!!
- '***********************************************************************
-
- 'this function does the same as DSKREADY.COM ( see PC Magazine
- ' Vol 7:6 Mar 29,88)
- ' it is supposed to check the disk drive and not be fouled up by
- 'Abort,retry,fail etc. Be EXTREMELY CAREFUL that the interrupt number
- 'does not get changed to 26H or the results will be disastrous!!
- 'Interestingly floppies formatted according to Corefast's proprietary
- 'scheme (for more efficient backups) return an error code of 8.
- '----------- Dave Topps -------- ( 12/11/90 )
-
- 'This version has been written to more thoroughly debug the codes returned.
-
- 'Well this is very strange indeed. When first run, this function returns
- '"Drive problem" without even accessing the drive. Running it a second time
- 'sometimes gives the correct return.
-
- 'Running this function as it stands with public variables produces the
- 'CERROR 439 "Invalid memory record" on reaching the line
- 'MEMFREE $dta_buff
- 'Interestingly when you try to trace the variables, upon INTERRUPT 0x25
- 'all the variables are cleared from the debugger. So according to the debugger
- 'the variable $dta_buff does not exist after INTERRUPT 0x25 and so it's no
- 'wonder that MEMFREE cannot clear it.
- 'More alarming is that after that, there seems to be some sort of internal
- 'memory error because after that Smart produces errors such as "Unable to
- 'read project file" or "Insufficient memory".( {^F1} at that point shows
- '178k free memory).
- 'THERE IS SOMETHING DANGEROUSLY WRONG HERE WHICH NEEDS TO BE FIXED.
-
- 'Is there a problem with the stack or something which clobbers the registers
- 'when executing Int 0x25 ?
-
- ' ALL SUGGESTIONS WELCOME.
- '******************************************************************
-
- 'GLOBAL $drive, _dskchk(), $drv
- PUBLIC $drive, _dskchk(), $drv
- PUBLIC $dta_buff, $flags, $ax_reg,
-
- MAIN
- SCREEN PRINT 10 10 14 1 "Choose drive to check:"
- SCREEN PROMPT 10 35 12 50 FGPLEASING BGPLEASING "A B C D E F G" $drive
- IF $drive = 0
- 'Esc was used
- STOP
- END IF
- $drive = $drive -1 'decrement value
- _dskchk( $drive)
- END MAIN
-
- FUNCTION _dskchk( $drv)
- 'LOCAL $dta_buff, $flags, $ax_reg,
- SETREG( AX, $drv ) ' 0= a: 1 = b:
- SETREG( CX,0x0001)
- SETREG( DX,0x0000)
- MEMALLOC $dta_buff SIZE 512
- SETREG( DS, DOSSEG( $dta_buff ))
- SETREG( BX, DOSOFFSET( $dta_buff ))
- INTERRUPT 0x25
- $flags = GETREG( FLAGS )
- ' 0th bit is the carry flag ( set if operation failed)
- $ax_reg = GETREG(AX)
- IF BITAND( $flags, 1 )
- 'carry flag ( 0th bit ) was set
- CASE BITAND( $ax_reg, 0x00FF)
- WHEN 2
- SCREEN PRINT 25 1 14 1 "Drive door open"
- WHEN 8
- SCREEN PRINT 25 1 14 1 "Corefast disk"
- WHEN 12
- SCREEN PRINT 25 1 14 1 "Unformatted disk"
- OTHERWISE
- SCREEN PRINT 25 1 14 1 "Other drive problem"
- END CASE
- MESSAGE "Drive problem"
- ELSE
- MESSAGE "Drive OK"
- END IF
- MEMFREE $dta_buff
- END FUNCTION
-