www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/05/12:03:50

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 980105104520 DOT 14443F-100000 AT is> <68q9oq$1hj$1 AT news DOT tm DOT net DOT my>
NNTP-Posting-Host: facilityk-dns.human.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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. 

<snip>
>   unsigned char errorCode ;   /* Error code returned from bios disk call */
<snip>

>        /* 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.

- Raw text -


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