From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with function biosdisk() ... unexplained ! Date: Mon, 05 Jan 1998 10:05:26 -0600 Organization: Cornell University Lines: 49 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <34B104C6.66DA@cornell.edu> References: <68q9oq$1hj$1 AT news DOT tm DOT net DOT my> NNTP-Posting-Host: facilityk-dns.human.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Mr. Lin wrote: > > Hi , > > I was experimenting with the calls biosdisk() and _bios_disk() from > DJGPP 2.0 It seems like both of these calls gives different return > values and I can't seem to explain it. > unsigned char errorCode ; /* Error code returned from bios disk call */ > /* The error code returned from this call is 1 */ > errorCode = _bios_disk(0x02,&diskInfo) ; > > */ if you look at the documentation for _bios_disk (info libc alpha _bios_disk), you will see that it is declared as: : unsigned _bios_disk(unsigned cmd, struct diskinfo_t *di) that is, the return type is unsigned int rather than unsigned char. the same page explains the meaning of the return value: : Return value of AX register. The meaning of high-order byte (AH): so, only the value of the high order byte is meaningful. i presume, when you put the return value in a byte rather than a 32 bit word, you only get the contents of the AL register. compare this to the docs on biosdisk: : int biosdisk(int cmd, int drive, int head, int track, int sector, int nsects, void *buffer); : Return Value : ------------ : The value of AH returned by the BIOS. and the reason for the difference is explained. > Could it be a bug ?? it helps to look at one's own code first, and check it against the documentation before jumping into conclusions on such issues. i don't know the reason for the difference between the two functions, though. -- Sinan.