delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/18/07:57:58

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trying to find VESA mode numbers
Date: Sat, 17 May 1997 20:56:22 +0100
Organization: None
Distribution: world
Message-ID: <kVbaRFAm1gfzEwpo@talula.demon.co.uk>
References: <337C8E9E DOT 1D80 AT cs DOT purdue DOT edu>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Cory Bloyd writes:
> I'm trying to create a run-of-the-mill VESA mode finding function to
>match screen dimension requests with actual mode numbers.  
>Unfortunately, the vbeInfo.VideoModePtr doesn't seem to be pointing
>at anything resembling a list of video modes.

It looks like you've run into an obscure 'feature' of some VESA
implementations which took me _forever_ to figure out the first time I
encountered it! In some cases, the GetModeInfo call can overwrite the
list of mode numbers, as some crazy people decided to write VESA drivers
that reuse a single block of memory for whatever data they are asked to
return to you. So after calling the GetVesaInfo routine, you need to
copy the mode list into some memory of your own before calling any other
VESA routines.

This caused some nasty bugs in older versions of Allegro, but didn't
always show up even with VESA drivers that overwrite their buffers, as
I'd go off chasing through garbage looking for a mode number, eventually
hit a 0xFFFF, realise that the mode wasn't there, and fall back on the
defaults of 0x101 for 640x480, etc, so it would end up working despite
reading a load of garbage beforehand. Ah the joys of defensive
programming :-)


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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