delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/28/13:56:38

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Wed, 28 Jul 2004 20:54:22 +0200
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-Id: <7494-Wed28Jul2004205422+0300-eliz@gnu.org>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
In-reply-to: <354933d6.0407280136.42e3b0e2@posting.google.com>
(gohyongkwang AT hotmail DOT com)
Subject: Re: Interpreting return value from _bios_disk
References: <354933d6 DOT 0407280136 DOT 42e3b0e2 AT posting DOT google DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: gohyongkwang AT hotmail DOT com (Goh, Yong Kwang)
> Newsgroups: comp.os.msdos.djgpp
> Date: 28 Jul 2004 02:36:52 -0700
> 
> the line in the example:
> 
> di.buffer = &record_buffer;
> 
> ought to be changed to:
> 
> di.buffer = record_buffer;
> 
> since record_buffer is declared as: 
> 
> char record_buffer[512];

It's true that it's better to use "di.buffer = record_buffer;" or
"di.buffer = &record_buffer[0];", but the example will work as it is
now, since the C language guarantees that for any array A, &A and
&A[0] give the same result.

> The confusing thing is that it returns an unsigned (integer) which is
> 4 bytes huge in DJGPP and AX is only 16 bits and therefore 2 bytes
> huge. Hence I think the first two bytes are just for padding purpose
> and unused and the last 2 bytes store the actual value of AH and AL
> respectively. Therefore some bit masking and shifting may be necessary
> to parse the AH and AL value.

Is something unclear in the documentation?  I think what you ask is
covered there.

> Is my code and interpretation correct? Just need a confirmation from
> you guys. Initially I was wondering why I kept getting "Disk error"
> with the _bios_disk example because the return value was non-zero.

What return value was that?

> Lastly, I notice that I'm always given the Disk Time Out error AH=0x80
> instead of a Drive not ready error AH=0xAA like DOS does whenever a
> floppy is not present in the drive and my program tries to access the
> non-available floppy disk. DOS reports, "Not ready reading drive A."
> Why is this so?

I think this is because DJGPP programs run in 32-bit protected mode as
DPMI clients, and DPMI rules forbid to abort a real-mode service.

- Raw text -


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