Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need to id when a floppy is not in drive...

0 views
Skip to first unread message

Daniel Sill

unread,
Mar 24, 1994, 3:54:24 PM3/24/94
to
hello all,
can someone point me to a C routine to detect if a floppy drive is
ready?

my situation is this: when my program tries to read (or write) to a
floppy disk and the drive is not ready (ie the disk is missing or
the door is not closed) my nice clean display gets cluttered up with
'INT 24 critical error...drive not ready retry,abort,fail ?'

any suggestions would be helpful although i would rather not hook
in my own interrupt...i would rather just test for this condition...

thank you

daniel

--
-------------------->Need a SVGA Graphics Library?<---------------------
- Try SVGACC20.ZIP (MS & Borland C); SVGAPV20.ZIP (MS VBDOS & MS PDS); -
- or SVGAQB20.ZIP (MS QuickBASIC 4.x) -
----------------Daniel A. Sill si...@zoe.as.utexas.edu----------------

Tomi Mikkonen

unread,
Mar 25, 1994, 2:07:47 AM3/25/94
to
Daniel Sill (si...@zoe.as.utexas.edu) wrote:
: hello all,

: can someone point me to a C routine to detect if a floppy drive is
: ready?

: my situation is this: when my program tries to read (or write) to a
: floppy disk and the drive is not ready (ie the disk is missing or
: the door is not closed) my nice clean display gets cluttered up with
: 'INT 24 critical error...drive not ready retry,abort,fail ?'

: any suggestions would be helpful although i would rather not hook
: in my own interrupt...i would rather just test for this condition...

Hi, I think this is something you wanted...

int checkfloppy(int drive)
{
struct REGPACK reg;
unsigned drivebyte, i=0, retvalue;

if(drive=='a') drive='A';
else if(drive=='b') drive='B';
drivebyte=(drive-0x41)&0x7F;

reg.r_ax = 0x00 << 8;
reg.r_dx = drivebyte;
intr(0x13, &reg);

reg.r_flags=1;
while((reg.r_flags & 1) && (i<3)){
i++;
reg.r_flags=0x0000;
reg.r_ax=0x0401;
reg.r_cx=0x0001;
reg.r_dx=drivebyte;
intr(0x13, &reg);
}

if ((reg.r_flags & 1) == 0)
retvalue=1;
else
retvalue=0;

reg.r_ax = 0x00 << 8;
reg.r_dx = drivebyte;
intr(0x13, &reg);

return retvalue;
}

--
+-----------------------------+----------------------------------------+
| Tomi Mikkonen | Espoo-Vantaa Institute of Technology |
| email: tom...@evitech.fi | CSWI Creative SoftWorks Inc.redible |
+-----------------------------+----------------------------------------+
Everybody wants to go to heaven, but nobody wants to die.

0 new messages