Page 1 of 1

Colours

Posted: Sat Sep 21, 2002 9:08 am
by Whatever5k
I want to print a text on the screen with a different colour than white text on black screen...
For example, red would be nice :)
I know that 0x07 is for white-on-black, but where do I find the bytes for other colours?

Re:Colours

Posted: Sat Sep 21, 2002 10:27 am
by Nils
:D

--->

| cli | back | i | foreground |

cli : ?(clignotement)
back: background color
i : ?(intensit?)
fore: foreground color

Colors:

   000 black
   001 blue
   010 green
   011 cyan
   100 red
   101 magenta
   110 yellow
   111 white

Example:
   0x07 = 0 000 0 111
| |
black |
white

Red on black
    0x04 = 0 000 0 100

Re:Colours

Posted: Sat Sep 21, 2002 10:32 am
by Slasher
Hi, the colors are all encoded in the attribute byte!
B F F F I T T T thats what it looks like.
B bit = 1 will make character blink
F F F = defines the background color
I bit = is the intensisty bit, 1 will make the character bright
T T T = defines the TEXT color.
so as numbers
128 (10000000) is for blink on
0 (00000000) is the 1st background color (black)
16 (00010000) is the 2nd background color(blue)
32 (00100000) is the 3rd backgroung color

and so on they are 8 background colors(0 to 7*16) and 16 text (colors 0 to 15)
0 being Black and 15 being White
so to get what you want, after defining constants for each background color and text color and the blink bit
if you want a blinking white character on a blue background you will have to OR the constants together to get the desired attribute byte
ie
in C code will be
attribute=BLINK |TEXT_WHITE |BACK_BLUE;
in asm
mov ax,BLINK
or ax,TEXT_WHITE
or ax,BACK_BLUE
hope this helps! ;)

Re:Colours

Posted: Sun Sep 22, 2002 4:04 am
by Whatever5k
Thanks

Re:Colours

Posted: Mon Sep 23, 2002 12:41 am
by Pype.Clicker
there's something you can configure in VGA cards to use the "blinking" bit as a "background intensity" bit... but i'm not sure of where it resides in the VGA controllers :(