From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with function biosdisk() ... unexplained ! Date: Mon, 05 Jan 1998 10:14:21 -0600 Organization: Cornell University Lines: 55 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <34B106DD.6185@cornell.edu> References: <68q9oq$1hj$1 AT news DOT tm DOT net DOT my> <34B104C6 DOT 66DA AT cornell DOT edu> 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 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