From: "A.Appleyard" To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Thu, 11 May 1995 12:09:27 BST Subject: Re: Checking for disk in drive morphine AT server DOT cs DOT jhu DOT edu (Michael Phelps) wrote (Subject: Re: Checking for disk in drive):- > DJ recommended to "Try to read the first sector with BIOS (retry if > error==6). If that fails, the disk isn't in the drive.". I tried this > method, using what I could get from the Info about the _go32 calls and Ralf > Brown's interrupt list. I have managed (at least, in a crude way) to figure > out if a disk is in the drive or not:- Phelps tried this:- AH = 0x02; /* BIOS disk read */ AL = 0x01; /* read one sector */ BX = (int)disk_buffer; /* pointer to buffer???? */ CH = 0x00; /* track zero?? */ CL = 0x00; /* sector zero?? */ DH = 0x00; /* head zero?? */ DL = 0x00; /* drive A?? */ ES = _go32_my_ds(); /* fill in DS */ call interrupt 0x13 He found by trial and error that:- > ...the number of sectors read ... is always zero. ... 0x80 (disk time out) > is the result if there is no disk in the drive, and 0x06 is the result from > the first trial after inserting a valid disk, and 0x02 for all subsequent > reads (that is, assuming you keep the disk in). So I guess this routine > can't tell the difference between a good disk in the drive or a bad disk. `PC Interrupts' by Ralf Brown & Jim Kyle says that, on exit:- CARRY = 0 for OK, 1 for error; AH = 2 for "address mark not found", 6 for "disk changed (floppy)", 0x80 for "timeout (not ready)". All 3 of my interrupt books say that the buffer address should be input in ES:BX; but Phelps seems to have input it in DS:BX. Perhaps that is why he got AH=2 error exits and why always he always had zero sectors read.