set_palette and devg-vga...

I was wondering if either of the set_palette functions (mode or misc)
behave differently for the vga graphics driver. I get different results
when I set the palette in vga versus when I set it for the devg-rage
driver. Anyone have any ideas? Is there a way to programmatically
determine the size of the palette?

thanks
Charlie

Charlie_Surface@oti.com wrote:

I was wondering if either of the set_palette functions (mode or misc)
behave differently for the vga graphics driver. I get different results
when I set the palette in vga versus when I set it for the devg-rage
driver. Anyone have any ideas? Is there a way to programmatically
determine the size of the palette?

The driver sets it in the num_colors member of the mode_info_t
structure, when get_modeinfo is called. For 8-bits per pixels
palette mode, it is 256 with most drivers. However, VGA 640x480
is really a 4-bits-per pixel mode. Hence only the first 16
palette entries will be valid. The vga driver keeps an 8-bpp
shadow of the frame buffer in system ram. It is much more
efficent to render into this than into 4-bpp planar vga memory
directly.

The 4 most-significant bits of each pixel in the shadow buffer will
be ignored, since only palette indices 0-0xf are valid. There is
a lot of rather complicated palette-matching code in io-graphics
which allows 16-color mode to work even as well as it does with
Photon :wink:

Dave

Thanks for the reply. That helps a lot. My next question is how do I
know that I’m really dealing with a special case here? Is this an
isolated case, or are there other drivers which are part of this
masquerade? If vga is the only one, I can special case this in the code,
but if there are others, it would be nice to have a programmatic way of
determining this.

Thanks
Charlie

Charlie_Surface@oti.com wrote:

Thanks for the reply. That helps a lot. My next question is how do I
know that I’m really dealing with a special case here? Is this an
isolated case, or are there other drivers which are part of this
masquerade? If vga is the only one, I can special case this in the code,
but if there are others, it would be nice to have a programmatic way of
determining this.

Right now, the vga is the only one, but there’s no guarantee that there
won’t be more in the future. However, from your point of view, the
only thing that is different between the vga driver and an
8-bits-per-pixel palette mode with another driver, is that there
are less palette entries. So all you have to do is respect the num_colors
entry returned in the mode_info_t struct.

Dave