Re: 256 colors in 16

 BBS: Inland Empire Archive
Date: 11-30-92 (21:41)             Number: 382
From: RICH GELDREICH               Refer#: NONE
  To: SCOTT WUNSCH                  Recvd: NO  
Subj: Re: 256 colors in 16           Conf: (2) Quik_Bas
>   If you can do 256 colours in a 16 mode, what's stopping you from
> rushing out and overturning the 256 colour barrier?  i.e. Use that
> technique in a 256 colour mode to get even more colours.  Or does that
> take to much time to produce a steady effect?

    It's a little more complicated than that. The problem is, we can
only reliably change one VGA register after the horizontal retrace on
most machines(snow and other goodies appears when we try to change more
than one). In the 16 color mode, one OUT can change all 16 colors to a
difference palette, but nothing similar can be done in the 256 color
mode.

    On the other hand, there *is* a way to get up to 64^3 colors in
a 256 color mode, reliably, but there will be some flicker. I have used
this technique successfully to view true-color images...

    To get access to 64^3 colors on a normal VGA, three 256 color pages
are required (since 4 320x200x256 pages are available in the 256 color
"undocumented" modes, this is no problem).

    First set palette registers 0-63 to increasing shades of red, set
palette registers 64-127 to increasing shades of blue, and set regs 128
to 191 to increasing shades of green (these form 64 shades of the 3
primary colors).

    Then, set aside page 0 to hold the red pixels of the image, page
1 for the green pixels, and page 2 for the blue pixels. To show then
image, repidly alternate between the three pages in sequence every
vertical retrace. The 3 planes will seem to merge together, and give the
illusion of a color image.

    To set a pixel in this mode, simply set the pixel in plane 0 to the
red component, set the pixel in plane 1 to the green component, and the
pixel in plane 2 to the blue component. This technique allows a true
color image to be displayed on a normal VGA display.

    Each pixel in the red plane varies from 0-63, the pixels in the blue
plane vary from 64-127, and the pixels in the green plane vary from
128-191.

    Rich

--- MsgToss 2.0b
 * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET