VGA Ignoring Text Colour Attribute
Posted: Fri Jan 30, 2009 11:00 am
Hi,
I have only just started playing with VGA, but have just come up with a question (more for information - I have solved the bug).
I originally found the problem when I was installing a new 256 byte text mode font to VGA plane 2. I saved registers SC2, SC4, GC4, GC5 and GC6, switched to plane 2, wrote the font and restored the registers. My mistake was that I then manually switched back to plane 0 (didn't need to because I had already restored the necessary VGA registers).
On Bochs, everything worked fine - 16 colour text mode with odd/even bytes representing text and attributes as expeced. However, on VirtualBox, all my text came out grey on black.
My first thought was that my manual plane switch had obliterated the Odd/Even disable bit in SC4. The only catch with this was that my plane switching routine only messes with GC4 and SC2, so that shouldn't happen. Also, the text displayed formatted correctly, and I would expect that if the planes were not switching automatically, I'd get colour codes displayed as characters - that didn't happen. Obviously removing the manual switch to plane 0 removed the bug.
So, could someone who knows about VGA tell me what was happening? I know that VGA emulations are often broken, but which emulator/VM acted correctly - Bochs or VirtualBox? Unfortunately, I haven't had a chance to try this on actual hardware yet, but I'll give that a go when I can.
Cheers,
Adam
I have only just started playing with VGA, but have just come up with a question (more for information - I have solved the bug).
I originally found the problem when I was installing a new 256 byte text mode font to VGA plane 2. I saved registers SC2, SC4, GC4, GC5 and GC6, switched to plane 2, wrote the font and restored the registers. My mistake was that I then manually switched back to plane 0 (didn't need to because I had already restored the necessary VGA registers).
On Bochs, everything worked fine - 16 colour text mode with odd/even bytes representing text and attributes as expeced. However, on VirtualBox, all my text came out grey on black.
My first thought was that my manual plane switch had obliterated the Odd/Even disable bit in SC4. The only catch with this was that my plane switching routine only messes with GC4 and SC2, so that shouldn't happen. Also, the text displayed formatted correctly, and I would expect that if the planes were not switching automatically, I'd get colour codes displayed as characters - that didn't happen. Obviously removing the manual switch to plane 0 removed the bug.
So, could someone who knows about VGA tell me what was happening? I know that VGA emulations are often broken, but which emulator/VM acted correctly - Bochs or VirtualBox? Unfortunately, I haven't had a chance to try this on actual hardware yet, but I'll give that a go when I can.
Cheers,
Adam