-
Notifications
You must be signed in to change notification settings - Fork 459
Description
Is your feature request related to a problem? Please describe.
The "8-bit" mode bit in the attribute controller is set for 256-color mode, clear for others.
It appears to set a mode in hardware where every even pixel is repeated twice over the odd pixel.
The reason appears to be how VGA hardware implements 256-color mode from what appears to be a pixel pipeline that is 4 bits wide.
The 4-bit path makes sense if you think about how the video mode is first expanded to a CGA-like 16-color palette, then expanded through the attribute controller to a 6-bit (64 color) palette, then finally to the 8-bit (256 color) palette of the VGA.
All non-256-color modes can be represented as 4-bit color indices, including text mode.
256-color mode appears to be built on top of that such that two nibbles handled at a time and shifted through per pixel through an 8-bit register that directly drives the DAC. This mode is enabled by the SH256 bit. Clearing SH256 triggers the hardware into the VGA planar mode immediately.
256-color mode can be thought of as a 4-bit 640 "pixel" wide mode, in which 8-bit bytes are shifted from video RAM one nibble at a time (based on Paradise SVGA hardware which faithfully emulates the behavior, A = (A << 4) + newnibble). This is hidden by the 8BIT bit which instructs the hardware to hold the previous (valid) pixel while the register is in this halfway state. Clearing 8BIT while in 256-color mode reveals this behavior.
The hardware appears to at least have the normal 8 bits fully loaded for the first pixel on the row (1 of 640), after which this half-nibble-shifting behavior appears when 8BIT=0.
If you print text in 320x200x256-color mode using color index 0x0F (0x0F 0x0F 0x0F 0x0F), and then turn off 8BIT, you will see what looks like 640x200x256-color mode with the 8-bit pixels displayed as if (0x0F 0xF0 0x0F 0xF0 0x0F 0xF0 0x0F 0xF0).
If 320x200x256-color mode had pixels (0x3F 0x3F 0x3F 0x3F) it would appear as if (0x3F 0xF3 0x3F 0xF3 ...).
So far original IBM PS/2 VGA hardware is confirmed to do this, as well as Paradise/Western Digital SVGA hardware.
If you do this on a Tseng ET4000, the hardware will shrink the display horizontally, showing black or invalid data on the right hand half as the hardware is not designed to do that. It will not show this half-shift behavior.