[SeaBIOS] [PATCH 2/2] vgabios: implement read char in graphics mode

Paolo Bonzini pbonzini at redhat.com
Fri Jan 2 09:36:13 CET 2015



On 02/01/2015 04:40, Kevin O'Connor wrote:
> > I couldn't find documentation for what to return as the attribute, but
> > experimenting with DOSBox suggests 0 (and GWBasic accepts it).
>
> Just for reference, for the "cbvga" text mode emulation, I grab the
> background attribute by assuming the lower right pixel of the cell is
> the background, and then assume the foreground attribute is the
> background attribute xor'd with 0x7 (see gfx_write_char()).  I'm not
> sure if that hack applies here though.  :-)

No, it doesn't.  http://www.ctyme.com/intr/rb-0098.htm says AH is only
defined in text mode, so it's probably safer to return zero.

Actually, it even says "only characters drawn with white foreground
pixels are matched by the pattern-comparison routine".  I can tweak the
patch to only match color (1 << vga_bpp) - 1, or to add a comment that
we extend the behavior.

> Any reason not to just "return gfx_read_char(vmode_g, cp);" here and
> have gfx_read_char() return a struct carattr?

No reason.

Paolo



More information about the SeaBIOS mailing list