delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/11/13/22:17:35

From: NoEmailAds AT execpc DOT com (Chris Giese)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Raw disk access
Date: Thu, 14 Nov 2002 03:03:59 GMT
Organization: PROPULSION GROUP
References: <aqrp5n$2pn4$1 AT gavrilo DOT mtu DOT ru>
X-Newsreader: Forte Free Agent 1.21/32.243
Lines: 34
Message-ID: <3dd312c9$0$1412$272ea4a1@news.execpc.com>
NNTP-Posting-Host: 83269e13.news.execpc.com
X-Trace: DXC=;34GQ`Z=mRZOP8EnbO4]BZH AT OeEe<m4?_0ICGTaT\Bl]=EV;d7?Dn`]5A>0>f_hmHWlD=NV0VOVDUNWlnk6KW=:T^bZB]W<3Ec\
X-Complaints-To: abuse AT execpc DOT com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Michail Pishchagin <mailfrom AT mail DOT ru> wrote:

>Is it okay to use _bios_disk function for reading? Does it support reading
>sectors beyound 1024 cylinder at least on modern BIOSes?

_bios_disk() and biosdisk() use INT 13h AH=02h. All three functions
have the same limitations. You can access a disk up to 8 Gbytes if
the BIOS supports CHS translation, but only ~500 Mbytes if not
(this is the same thing as the 1024 cylinder limit).

If you need to access disks larger than 8 Gbytes, get this file:
        http://my.execpc.com/~geezer/osd/disks/diskio.zip
and look at function lba_biosdisk() in file DJGPP.C
To use this LBA function, both the drive and the BIOS must support LBA.

>And is there some elegant way to determine how many physical hard drives are
>installed on computer?

The byte at address 0475h contains the number of hard drives
detected by the BIOS:
	num_hds = _farpeekb(_dos_ds, 0x475);

The number of floppy drives detected by the BIOS can be had
from the Installed Equipment word at address 0410h:
	num_fds = _farpeekw(_dos_ds, 0x410);
	if(num_fds & 0x0001)
		num_fds = ((num_fds / 64) & 3) + 1;
	else
		num_fds = 0;

-- 
geezer@    | http://www.execpc.com/~geezer
execpc.com | http://www.execpc.com/~geezer/osd

- Raw text -


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