delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/02:56:00

Date: Tue, 22 Oct 1996 08:24:48 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jon Slaughter <lobo AT iamerica DOT net>
Cc: djgpp AT delorie DOT com
Subject: Re: protected mode -> real mode help.
In-Reply-To: <326AB9FD.6CDF@iamerica.net>
Message-Id: <Pine.SUN.3.91.961022082208.2800N-100000@is>
Mime-Version: 1.0

On Sun, 20 Oct 1996, Jon Slaughter wrote:

> void read_sector(byte *buf)
> {
> 	__dpmi_regs r;
>         byte *buffer;
>         dosmemget(__tb, 512, &buffer);
>         r.x.ax = 0x0201;
>         r.x.cx = (track << 8) + sector;
>         r.x.dx = (head << 8) + drive;
>         r.x.es = __tb / 16;
>         r.x.bx = __tb && 0x0f;
>         __dpmi_int(0x13, &r);
> 
> }

`dosmemget' is a function which fetches the data from the transfer buffer 
to your buffer.  Why in the world do you call it *before* issuing Int 13h 
which brings the data into the transfer buffer?  You should call it 
*after* the interrupt.

And just FIY, the DJGPP C library already includes a function called 
`biosdisk' that does all that for you.  Look it up in the library docs.

- Raw text -


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