Mail Archives: djgpp/1998/01/05/12:03:50
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 -