Mail Archives: djgpp/1998/01/05/12:03:48
A. Sinan Unur wrote:
> 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.
on second thought, i think there is a bug in the documentation for
_bios_disk. if you look at the examnple given:
char record_buffer[512];
struct diskinfo_t di;
di.drive = 0x80;
di.head = 0;
di.track = 0;
di.sector = 0;
di.nsectors = 1;
di.buffer = &record_buffer;
if ( _bios_disk(_DISK_READ, &di) )
puts("Disk error.");
and compare it to the docs:
`_DISK_READ'
Reads one or more disk sectors into memory. This service uses all
fields of the structure pointed to by DISKINFO. If no error
occurs, the function returns 0 in the high-order byte and the
number of sectors read in the low-order byte. If there is an
error, the high-order byte (AH) will contain a set of status
flags, as defined below under Return Value.
clearly, the example will print "Disk error." for a successful read
because the function returns AX which indicates the number of sectors
read in AL.
Should this be entered in the bug reports database, or is that only for
code?
-- Sinan
- Raw text -