Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Stilgar

PLAYPAL and VGA technical question

Recommended Posts

Unofficial Doom Specs, describing the PLAYPAL lump:

There are 14 palettes here, each is 768 bytes = 256 rgb triples. That is, the first three bytes of a palette are the red, green, and blue portions of color 0. And so on. Note that the values use the full range (0..255), while standard VGA digital-analog converters use values 0-63.

I've read the same about the VGA color range elsewhere, too... so my question is, did the original engine use some video mode that supported a full 0-255 range for the RGB color components, or did it crush the values down to an 0-63 range before using them? If it crushed the values to the 0-63 range, what was the reason for storing them in an 0-255 range?

Share this post


Link to post

According to the specifications a full 0-255 range for any component colour isn't possible - I expect the two least significant digits for each colour was ignored by the D-A converters. The use of 8-bit colour values is simply a matter of convenience. While in theory you could fit VGA colour data into 25% less RAM - having to bit-shift the data before it could be displayed would slow things down.

Share this post


Link to post

From what I can tell, a plain VGA reads each entry in the color table as three bytes -- except each individual color component is in the range 0-63 (6-bits, with the two most significant ones zeroed). So Doom has to shift the entries in its palettes right by two bits before sending them to the VGA.

Did the NeXT systems that id used have a 24-bit DAC? I suppose in the interest of making the game portable to both that and DOS (and whatever other systems they might have had in mind while creating it), and since it was going to take up one byte per component anyways, it was easiest to just store it full-range...

Share this post


Link to post
CODOR said:

So Doom has to shift the entries in its palettes right by two bits before sending them to the VGA.

VGA has a built-in Barrel Shifter - probably for that very purpose.

Did the NeXT systems that id used have a 24-bit DAC?

Depends on the model/s they were using. The NeXTstation Color's integrated video has a 12-bit colour palette + 4-bit alpha. The more expensive NeXT Cube accepts an optional 32-bit colour card which cost nearly as much as a workstation.

Share this post


Link to post

GreyGhost said:
VGA has a built-in Barrel Shifter - probably for that very purpose.

Does that operate on data being sent to the DAC register, too? I thought it was only on data sent to the framebuffer, but seeing that it's been over a decade since I've played around with programming a VGA (and at that point I wasn't even this advanced into it) I can't be certain...

The NeXTstation Color's integrated video has a 12-bit colour palette + 4-bit alpha. The more expensive NeXT Cube accepts an optional 32-bit colour card which cost nearly as much as a workstation.

Ah... I remember something about it using 12-bit colour now. According to Wikipedia, Carmack had a Cube, but it doesn't say what video card it used. There's the following snippet of text included with the NeXT port of Doom (which unfortunately isn't credited anywhere that I can see):

Someone at id wrote:
There is built in support for two-bit gray, eight-bit gray, and twelve-bit rgb bitmaps. I did not include twenty-four-bit color support, because the blit rate on a NeXT DIMENSION is really not sufficient for the game. You can run it on a dimmension in either the twelve-bit-color (default) mode, or manually set it down to two-bit gray where it plays at an ok rate. (Doom -NXWindowDepthLimit TwoBitGray from the command line). When I get a twenty-four-bit HP system, I will write the native code. :-)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×