Re: console color code location?

Rick Hohensee (humbubba@smarty.smart.net)
Mon, 1 Nov 1999 23:46:36 -0500 (EST)


thus schprechtz Al Elia <aelia@intrinsiq.com>

>I've tried using setterm...it doesn't take (permanently anyway). In
>FreeBSD, you can set teh default colors in the syscons.c (defaults are
>FG_LIGHTGREY || BG_BLACK....I set them to FG_WHITE || BG BLACK) file and
>recompile the kernel, so that all programs use those colors by
>default. I'm assuming that this is set somewhere in the console driver
>code in linux, but I have thus far been unsuccessful in finding where.
>
>On Mon, 1 Nov 1999, Guest section DW wrote:>
>
>:
>:> I'm a FreeBSD guy who's new to Linux...and I need to be able to compile my
>:> kernel with specific colors (bright white text on a black background).
>:> Anywone know where/how this is done in the linux kernel source?
>:
>:But the console colors are set by the user, possibly using setterm,
>:or some other utility. There is no need to do anything at compile time.
>:(Is that otherwise in FreeBSD? I can hardly imagine.)
>:

It's hard to tell what you want here, as is often the case with these
issues and facilities, so lets just drop right down to the metal.

The VGA video RAMDAC palette is at 0x3c8 in write mode and 0x03c7 in
read mode. To write a palette color, you write it's color index to 0x3c8,
and then sequentially write 3 bytes to 0x3c9, one byte each for red, green
and blue, in that order. When the index is loaded into 0x3c8, successive
writes to 0x3c9 are rotated into the appropriate R G and B internally. The
6 LEAST significant bits of each data byte are what goes to the DAC for that
color index.

At least, that's what I get from the docs I'm looking at. I've been looking
at CRT controller stuff recently, but not palette stuff.

You can stick something that does this in init/main.c I think. There's a
VGA palette manipulator in ../contrib in the SVGATextMode package, if I recall
where I got it, and you can bang on this stuff from userland via something
that can lseek /dev/port. I use Mr. Paysan's GForth, although pforth beckons.

from a 90-column stock-VGA 28.322mhz vt...

Rick Hohensee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/