BBS: Inland Empire Archive
Date: 07-10-92 (05:51) Number: 148
From: RICH GELDREICH Refer#: NONE
To: PHIL HODGES Recvd: NO
Subj: Re:svga! Conf: (2) Quik_Bas
> Hey, I have a question! I can't figure out how to cycle the bloody
> palette in VGA. I try PALETTE 200, 150 and I get an error. I tried
> figuring out the crypic formulae in the on-line help, and it just
> confused me more! Why can't you just go PALETTE 200, 175 ? How do you
> translate color 175 into ColorNum& ?? What is the meaning of Life, the
> Universe and Everything?! What color would a space chameleon turn?
> Where's my thing? Did Rube Goldberg really design the Macintosh?
> Seriously, though...
There's really nothing "bloody" about the VGA's palette. It's just
a little more complicated...
On the VGA, you've got three primary colors, red, green, and blue.
For each color you can control the intensity, from 0-63. By mixing up
these primary colors in the correct amounts, you can get any color you
QB's nifty little formula is something like:
palette index, (red+green*256&+blue*65536&)
The reason why you have to multiply the green value by 256 and the
blue value by 65536 is simple. QB needs each of the RGB values in one,
easy to handle number(a long integer). A long integer has got 4 bytes,
or 32 bits. The red value goes in the first 8 bits(that's why it isn't
multiplied by anything). The green value goes in the next byte, or 8
bits over(what's 2 to the 8 power? 256!). The blue value goes over
to the next byte, or 16 bits over(2 to the 16th power is 65536).
Actually, that formula can be rewritten to:
palette index, (red or green*256& or blue*65536&)
But forget that, I've probably confused you enough as it is!
There's another way to change the palletes on the VGA(although it's
"naughty"!). It's much, much quicker than using the PALETTE statement.
OUT &h3c7, index:OUT &h3c8, index
OUT &h3c9, Red
OUT &h3c9, Green
OUT &h3c9, Blue
That goes directly to the VGA. It runs circles around QB and the
BIOS. Of course, there are people that don't like this way of doing
things. Well, they can go stuff there faces in a toilet because I for
one don't give a damn!
Hope that helps,
--- RBBSMAIL 17.2A
* Origin: Computer Co-Op RBBS HST, 609-784-9404 Voorhees
NJ (RBBS-PC 1:266/29)