Help:Test if drive is ready in Turbo C

Patrick Reed reed at usceast.UUCP
Sun May 27 14:44:41 AEST 1990


In article <265ccb97-287comp.lang.c at vpnet.chi.il.us> kji at vpnet.chi.il.us (Ken Isacson) writes:
>
>Can anyone out there suggest some code in TURBO C that would do the 
>following:
>
>  1.  Detect if drive is ready with a disk.
>

[  stuff deleted about int 13 failing to handle the problem  ]

I have been faced with this problem in the past using Turbo C 1.5.
What you need is to establish your own hardware interrupt handler.
Turbo C provides some routines that may help:

harderr - establish a hardware error handler
hardresume - return to DOS from error handler
hardretn - return to application form error handler

Look in your reference manual for an example that covers this very problem.
It's been several years since I worked in this area, but from what I remember
there are a few problems:

1.  From within your error handler routine, you can only use dos calls
    1 through 0x0c, which means printf and the like are out.  This may 
    be ok for you if all you want to do is print a message in a box or
    something and you are sending your output to the video RAM (ie.
    not using the ROM BIOS calls).

2.  I seem to remember having some portability problems.  Having made the
    program detect the door being open on my machine and then testing it
    on some other machines, there seemed to be some inconsistent results.
    
Let me know if any of this helps.

Pat Reed   reed at usceast.cs.scarolina.edu



More information about the Comp.lang.c mailing list