delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/23/19:18:26

From: Martijn Klingens <klingens AT dutccis DOT ct DOT tudelft DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: int86x problems
Date: Thu, 23 Oct 1997 21:44:18 +0100
Organization: Delft University of Technology
Lines: 45
Message-ID: <344FB722.E9617F6E@dutccis.ct.tudelft.nl>
References: <a167cd$11c32 DOT 138 AT news DOT alberni DOT net>
Reply-To: spaze AT dds DOT nl
NNTP-Posting-Host: ct111n191.ct.tudelft.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

wolfman AT cedar DOT alberni DOT net wrote:

> (...)
> 
> Later on, I try to get the vesa information like this:
> 
> union REGS regs;
> struct SREGS sregs;
> 
> regs.w.ax = 0x4F02;
> regs.w.di = (unsigned short)&vesainfo;
> 
> int386x(0x10, &regs, &regs, &sregs);

It seems like you have just started protected mode coding. What you are
doing is trying to read realmode data (vesa does support protected mode,
but you are using realmode calls to vesa. And that's the whole problem,
because vesa doesn't understand the address you are sending to it. You
say 'di = the low word of the protected mode offset of vesainfo', but
what you want to say is 'es:di = the realmode address of vesainfo'.
unfortunately, this is not too easy to do, because you'll have to make
sure that vesainfo is below the 1 Mb boundary (above it, it is
impossible to access vesainfo from realmode), but there is a trick: you
can use djgpp's internal buffer which is used for transfers to and from
realmode, and use this buffer. The new code will be something like this:
__dpmi_regs	regs;
if (!(sizeof (vesainfo) < _go32_info_block.size_of_transfer_buffer))) {
	regs.x.ax = 0x4F00;			// why did you use 0x4F02 by the way??
	regs.x.di = __tb & 0x0F			// djgpp's infoblock's offset
	regs.x.es = (__tb >> 4) & 0xFFFF;	// and the segment
	dosmemput (&vesainfo, sizeof (vesainfo), __tb);	// make sure the block
is correct!
	__dpmi_int (0x10, &regs);
	dosmemget (__tb, sizeof (vesainfo), &vesainfo);
} else {
	printf ("Error: Buffer too small!!!!\n\7");
	exit (0xFF);
}
// etc.

For more information, please take a look at
http://www.execulink.com/~pweeks/chapter.html

Hope you'll find this enough,
Martijn Klingens

- Raw text -


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