Attribute Clash - Causes

Causes

Attribute clash on the ZX Spectrum was caused by its idiosyncratic display memory layout, designed in such a way as to minimise memory use of the frame buffer, and optimise for text display instead of graphics. Rather than limit the color palette to conserve memory, Sinclair's design stored pixel bitmap and color information in separate areas of memory. While the bitmap specified the state of individual pixels (either on or off), the color information (or "attributes") corresponded to the text character matrix — 24 rows of 32 columns — with one byte per 8x8 pixel character cell. This byte encoded two 3-bit values, known as INK (foreground color) and PAPER (background color) after the BASIC instructions used to define the color values. Two other binary values were included in an attribute; a BRIGHT bit indicating one of two brightness levels for the two colors, and a FLASH bit, which, when set, caused the two colors to be swapped at regular intervals. This scheme provided 15 different colors: the eight combinations of red, green and blue at two brightness levels (except for black, which appeared the same at both brightness). Thus, each 8x8 pixel block could only contain 2 colors from the 15 available, which must both be from either the BRIGHT or non-BRIGHT halves of the palette. Trying to add a third color in an 8x8 pixel area would result in the three colors being reduced to two by the ZX Spectrum.

The ZX Spectrum used 6144 bytes for pixel information, with one byte representing a row of eight pixels, and 768 bytes used for the color attributes, thus giving a total of 6912 bytes for the entire graphics display, a relatively small total for a computer of the Spectrum's era with "color" capabilities. This graphics architecture was retained right through to Sinclair and Amstrad's later redesigns of the Spectrum, up until Amstrad's final model, the ZX Spectrum +3, despite subsequent models having contained 128 kB of RAM, reducing the need to save memory in this manner. The architecture was retained to prevent loss of backwards compatibility.

Attributes were used by a variety of other computers and consoles, including the Commodore 64, the MSX and NES, although the size of the attribute blocks and the number of colors per block varied. However, with the use of hardware sprites and scrolling, attribute clash could be avoided.

The Thomson MO5 and TO7 microcomputers, the Oric 1, the MSX 1 architecture, and other systems based on the Texas Instruments TMS9918 Video Display Controller display a very similar constraint: for each group of eight pixels horizontally, only two colors out of 16 are available. giving a similar but less severe effect than with the Spectrum. The MSX 1 did not have just one single color attribute byte available for a whole 8x8 pixel area, as was the case with the Sinclair Spectrum, but eight, one attribute byte for each 8×1 pixel area. Thus, while the Spectrum was limited to one color pair for a square area of 8x8 pixels, the MSX 1 was only limited to one color pair for a "line" of eight adjacent pixels. In addition MSX1 could use sprites which were not bound to any attribute clash problems (although MSX 1 sprites did have their own limitations).

In practice this technical advantage often did not help MSX 1 systems to produce better pictures. The problem for the MSX 1 was that many European software companies who converted Spectrum games to MSX 1 ignored all the improvements the MSX 1 had over the Spectrum, and thus the resulting MSX 1 versions had the same amount of attribute clash as the original Spectrum games. To ease conversion, the software developers simply copied the single attribute byte value of the Spectrum to all eight corresponding attribute bytes of the MSX 1. For the same reason, the software companies also ignored the sprite capabilities of the MSX 1, and because the video display capabilities were otherwise quite similar (256×192 resolution, 16 colors), both systems produced virtually identical displays for the same game. In contrast, Japanese MSX 1 games did use all the capabilities of MSX 1, often resulting in better looking games.

Read more about this topic:  Attribute Clash