Page 1 of 1
Background colour codes
Posted: Tue Feb 07, 2012 7:02 pm
by Stijn
Hi,
I used the table at
http://en.wikipedia.org/wiki/BIOS_color_attributes as a reference for text colour.
When I tried to use it for the background colour, I found out that there are some differences. So I made up an image, top row is text colour and bottom row is background colour.
Is there a reference somewhere describing the background colours?
In case it matters, the code switches to mode 0x12 (VGA 640x480 with 16 colours).
Re: Background colour codes
Posted: Wed Feb 08, 2012 12:11 am
by Combuster
There's a problem with that - there are 16 colours possible in that mode and your image lists more than 16 colours. Therefore your observations are not correct.
Please demonstrate how you got those results, maybe we can figure out what went wrong.
Re: Background colour codes
Posted: Wed Feb 08, 2012 8:00 am
by brain
Stijn wrote:Hi,
I used the table at
http://en.wikipedia.org/wiki/BIOS_color_attributes as a reference for text colour.
When I tried to use it for the background colour, I found out that there are some differences. So I made up an image, top row is text colour and bottom row is background colour.
Is there a reference somewhere describing the background colours?
In case it matters, the code switches to mode 0x12 (VGA 640x480 with 16 colours).
Arent these colour attributes for text modes only, as opposed to the 640x480 graphics mode you said you selected? ... that is unless you have your own code that maps the behaviour of a text mode screen onto a graphical interface in which case how the colours appear would be entirely up to you...
Re: Background colour codes
Posted: Wed Feb 08, 2012 11:40 am
by Stijn
I've commented my code and put it up at
http://pastebin.com/uj1uKjLu
If you require more comments just let me know.
I got the results displayed in the colour chart by trying all colours one by one, taking screenshots and copying the colour.
Re: Background colour codes
Posted: Wed Feb 08, 2012 1:30 pm
by Combuster
Since I haven't been using bios interrupts in graphics modes much (mainly because they are epicly slow), I modified the code a bit to render all foreground colours to check the actual effect - which is that that BIOS call simply replaces colour zero with a new colour. Which means that you lose black for a different colour, in several cases a duplicate of one of the other fifteen colours.
It's an effective way of changing colours, but it's usually not what you want.
You can find your colours back in the
EGA palette as 0-7 and 16-23.
Re: Background colour codes
Posted: Wed Feb 08, 2012 3:41 pm
by Stijn
I've done the modification you said and can see the effect it has now.
Thanks for the explanation.