Mail Archives: djgpp/1997/10/23/19:18:26
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, ®s, ®s, &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, ®s);
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 -