Mail Archives: djgpp/1996/04/15/22:20:36
Malcolm Taylor (malcolm AT manawatu DOT gen DOT nz) wrote:
: u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw (Jih-Shin Ho) wrote:
: >This is what I write to detect disk drive (physical and virtual):
: > for (i = 0; i < 26; ++i) {
: > regs.x.ax = 0x4409; /* get drive flags */
: > regs.h.bl = i + 1; /* 1-based dos drive */
: > intdos(®s,®s);
: > if (!regs.x.cflag) printf("%c ",'A' + i);
:
: Does this catch cd-rom drives, remapped Floppies (ie a floppy drive
: that is mapped as B: even though it is A:)?
The above code can detect all drives that DOS understands. For example,
network drive. You can consult the DOS programming manual for the explanation
of function 0x44.
: The question I had was about detecting whether the disk was in the
: drive. It seems that some DPMI providers will give GP faults if you
: try to use a DOS call on an empty drive (ie to see if it is empty).
: The only way of detecting a ready CD-ROM drive that I know of (using
: int 0x2f) may also cause a crash.
: It seems that reading a sector with the BIOS is the only way to get
: around this (on floppies).
0x4409 DOS function call doesn't touch disk drive. It uses (I am not sure) the
internal data structure in DOS kernel for the detection.
--
Jih-Shin Ho, National Chiao Tung University
u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw
DISPLAY -- universal image/movie viewer, converter, and indexer for DOS.
Package name : disp???a.zip, disp???b.zip. ??? is version number.
Official site : NCTUCCCA.edu.tw:/PC/graphics/disp.
Other site : oak.oakland.edu:/SimTel/msdos/graphics.
WWW page : http://bicmos.ee.nctu.edu.tw/
- Raw text -