[comp.os.msdos.programmer] Removing disks

jlee@smylex.UUCP (Jeff Lee) (06/18/91)

I wish to write a "MacPuke"-type TSR for PC's with Sound Blasters.  
Unfortunately, the program depends on detecting when a disk is removed from
the drive, and so far I have been unable to do this.

Do PC floppy drives generate a hardware interrupt when the disk is removed?
If so, how can I distinguish them from other disk interrupts?

                                                advTHANKSance,
                                                Jeff


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Jeff Lee                           UUCP: uhasun!smylex!jlee
                                Internet: jlee%smylex.uucp@uhasun.hartford.edu
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

jrusso@wpi.WPI.EDU (Jeffrey K Russo) (06/18/91)

In article <JNEWS-2@smylex.UUCP> jlee@smylex.UUCP (Jeff Lee) writes:
>I wish to write a "MacPuke"-type TSR for PC's with Sound Blasters.  
>Unfortunately, the program depends on detecting when a disk is removed from
>the drive, and so far I have been unable to do this.
>
>Do PC floppy drives generate a hardware interrupt when the disk is removed?
>If so, how can I distinguish them from other disk interrupts?

I think most PC drives are mechanical (read: hand-operated) in the way they
release their disks. There isn't any way for the computer to know when the
disk has been removed other than attempting to read it.

There may be some "electrically" operated 3.5" drives out there (I've never
run across any though) but I doubt this would be possible with a 5.25".

If anyone can prove me wrong I'd definately like to hear from them as I'd
be interested in this information too.

Jeff

	       --------------------------------------
		Jeff Russo	(jrusso@wpi.wpi.edu)
		Worcester Polytechnic Institute
		Worcester, MA  01609
	       --------------------------------------

"The surest sign that intelligent life exists elsewhere in the
 universe is that none of it has tried to contact us." -- Calvin

dmillar@sandstorm.Berkeley.EDU (Derek Millar) (06/18/91)

In article <1991Jun17.222559.23301@wpi.WPI.EDU> jrusso@wpi.WPI.EDU (Jeffrey K Russo) writes:
>In article <JNEWS-2@smylex.UUCP> jlee@smylex.UUCP (Jeff Lee) writes:
>>Do PC floppy drives generate a hardware interrupt when the disk is removed?
>>If so, how can I distinguish them from other disk interrupts?
>
>I think most PC drives are mechanical (read: hand-operated) in the way they
>release their disks. There isn't any way for the computer to know when the
>disk has been removed other than attempting to read it.
>
>If anyone can prove me wrong I'd definately like to hear from them as I'd
>be interested in this information too.
>
>Jeff
>
Wrong.  There are two BIOS functions that relate to this:

int 13h function 15h : returns disk type (not available, disk change not
			detectable, disk change detectable, hard disk)

int 13h function 16h : checks to see if the disk has been changed.

These functions are available on PC/XT (BIOS date 1/10/86 +), PC XT 286, PC AT,
and PS/2 line (and, I would imagine, on most other BIOSs).  Look 'em up.

	   - Derek Millar

jrusso@wpi.WPI.EDU (Jeffrey K Russo) (06/18/91)

In article <1991Jun18.072906.23779@agate.berkeley.edu> dmillar@sandstorm.Berkeley.EDU (Derek Millar) writes:
>Wrong.  There are two BIOS functions that relate to this:
>
>int 13h function 15h : returns disk type (not available, disk change not
>			detectable, disk change detectable, hard disk)
>
>int 13h function 16h : checks to see if the disk has been changed.
>
>These functions are available on PC/XT (BIOS date 1/10/86 +), PC XT 286, PC AT,
>and PS/2 line (and, I would imagine, on most other BIOSs).  Look 'em up.
>
>	   - Derek Millar

Those functions say when the disk has been changed, the original poster
                                           -------
wanted to know when the disk has been removed.
                                      -------

Jeff

davison@dec15.cs.monash.edu.au (06/19/91)

In <1991Jun17.222559.23301@wpi.WPI.EDU> jrusso@wpi.WPI.EDU (Jeffrey K Russo) writes:

>In article <JNEWS-2@smylex.UUCP> jlee@smylex.UUCP (Jeff Lee) writes:
>>I wish to write a "MacPuke"-type TSR for PC's with Sound Blasters.  
>>Unfortunately, the program depends on detecting when a disk is removed from
>>the drive, and so far I have been unable to do this.
>>
>>Do PC floppy drives generate a hardware interrupt when the disk is removed?
>>If so, how can I distinguish them from other disk interrupts?

>I think most PC drives are mechanical (read: hand-operated) in the way they
>release their disks. There isn't any way for the computer to know when the
>disk has been removed other than attempting to read it.

>There may be some "electrically" operated 3.5" drives out there (I've never
>run across any though) but I doubt this would be possible with a 5.25".

>If anyone can prove me wrong I'd definately like to hear from them as I'd
>be interested in this information too.

I've just had some problems with my 3.5" drive, and the advice was to check that
a jumper on the drive was enabling the "disk change" signal. There must be
some way to monitor this signal, since it seems to tell DOS to clear it's 
buffers (at least for 3.5" drives...)
	
		If you get it working, mail me with some details
			
		Regards,
				Andrew
	
    /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~)
   / The simple things in life are often the best....              /
  /                               (davison@bruce.cs.monash.edu.au)/
 (_______________________________________________________________/

noesis@ucscb.UCSC.EDU (60276000) (06/19/91)

most 5.25 & i believe all 3.5" drives of late (say 1988 or later) have a 
disk-change signal, though it is somewhat awkward. When a disk is changed, 
the next operation (read or write) will return an Error 06: diskette
removed or changed. most disk i/o routines are programmed to simply repeat
the command but a floppy write-delay cache could use to inform the user
that the cache must be flushed or something

noesis

jnelson@plains.NoDak.edu (Jim Nelson) (06/24/91)

In article <JNEWS-2@smylex.UUCP> jlee@smylex.UUCP (Jeff Lee) writes:
>I wish to write a "MacPuke"-type TSR for PC's with Sound Blasters.  
>Unfortunately, the program depends on detecting when a disk is removed from
>the drive, and so far I have been unable to do this.

It would seem that there has to be some way to do it.  Fastback is seems to
be able to tell when you have changed the disk when backing up/restoring.
It beeps at you when the disk is full, you open the drive door, replace the
disk, close the drive door, and it starts writing again.  No "Press Enter to
Continue" message.

I don't know how they do it, but I surmise that it is possible.

-- 
.sig?  What .sig?  Ohhhh, *THIS* .sig.

	Jim, in the Land of the Lost. 
disclaimer:  These are just opinions.  If you want 'em, you can have 'em.

ralf+@cs.cmu.edu (Ralf Brown) (06/24/91)

In article <10927@plains.NoDak.edu> jnelson@plains.NoDak.edu (Jim Nelson) writes:
}It would seem that there has to be some way to do it.  Fastback is seems to
}be able to tell when you have changed the disk when backing up/restoring.
}It beeps at you when the disk is full, you open the drive door, replace the
}disk, close the drive door, and it starts writing again.  No "Press Enter to
}Continue" message.

It is possible to ask the floppy disk controller chip for the state of the
write-protect signal.  If you ask often enough, you will see the write-
protect go true when the disk is removed, and then go true again when a
new disk is inserted.  This won't work on a write-protected disk though,
since the write-protect never goes false while the disk is in the drive.


-- 
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/53
BITnet: RALF%CS.CMU.EDU@CARNEGIE   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | It isn't what we don't know that gives us trouble, it's
I claim something?| what we know that ain't so.  --Will Rogers