Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

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

0 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Daniel Sill

ungelesen,
24.03.1994, 15:54:2424.03.94
an
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

ungelesen,
25.03.1994, 02:07:4725.03.94
an
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 neue Nachrichten