🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #5097

Re: How to detect media changed or drive ready on floppy?

#5097
From: Steve Chanin
Date: Sat, 09 Mar 1991 21:40
33 lines
1848 bytes
In <1991Mar7.155516.9877@mck-csc.mckinsey.com>, Jeffrey Weiss asks:

   Can you tell if the drive is ready (i.e., media inserted and door closed)?
   I know there is a DOS function call where you can detect "media ready" for
   a handle, but I'd like to check before I open a file on the diskette.  Can
   you get a handle for the device itself?

why don't you use the harderr/hardretn functions in the MSC runtime
libraries to take over Interrupt 0x24 briefly.  Once you've done this,
just try to open/read a file on the drive, if there is no disk ready,
your error routines will get called, you can return a 3 to fail the
operation and no one will be the wiser (i.e. no abort, retry, fail
message will appear).

EX (in pseudo-C)
--
old_handler = _getvect(0x24)
_harderr(your_handler);
while (open("a:...",...))
   { printf("Please insert disk XXX in drive A\nPresss RETURN when ready");
     scanf(fred,"%S"); }
_setvect(old_hander)


Steve

P.S. - Say hi to Joe Tang for me and give him my email address.
--
===============================================================================
DOMAIN: sbchanin@oracle.com                                  Oracle Corporation
USMAIL: Steven Chanin, 400 Oracle Parkway, Redwood Shores, CA 94065
PHONE : (415) 506-2864
Technical Details
Message-ID: <SCHANIN.91Mar9134042@mailseq.oracle.com>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!fernwood!oracle!news
References: <1991Mar7.155516.9877@mck-csc.mckinsey.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!fernwood!oracle!news
From: schanin@oracle.com (Steve Chanin)
Newsgroups: comp.os.msdos.programmer
Subject: Re: How to detect media changed or drive ready on floppy?
Message-ID: <SCHANIN.91Mar9134042@mailseq.oracle.com>
Date: 9 Mar 91 21:40:36 GMT
References: <1991Mar7.155516.9877@mck-csc.mckinsey.com>
Sender: news@oracle.com
Reply-To: schanin@oracle.com
Organization: Oracle Corp., Belmont CA
Lines: 33
In-reply-to: jw@mck-csc.mckinsey.com's message of 7 Mar 91 15:55:16 GMT