www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/15/22:20:36

Xref: news2.mv.net comp.os.msdos.djgpp:2748
From: u7711501 AT bicmos DOT ee DOT nctu DOT edu DOT tw (Jih-Shin Ho)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting drives
Date: 15 Apr 1996 17:15:59 GMT
Organization: Computer Center, National Chiao-Tung University, Taiwan
Lines: 36
Message-ID: <4ku08f$mej@ccnews.nctu.edu.tw>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960407084756 DOT 22284J-100000 AT is> <4kkbrm$1rk AT news DOT manawatu DOT gen DOT nz> <4kmuvu$ndp AT ccnews DOT nctu DOT edu DOT tw> <4kt7k5$mr3 AT news DOT manawatu DOT gen DOT nz>
NNTP-Posting-Host: bicmos2.ee.nctu.edu.tw
NNTP-Posting-User: u7711501
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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(&regs,&regs);
: >    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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019