ArticleslgStudy

computer science

Attribute clash

Attribute clash is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Attribute clash rather than just read about it. In short: Attribute clash (also known as colour clash or bleeding) is a display artifact caused by limits in the graphics circuitry of some colour 8-bit home computers, most notably the ZX Spectrum, where it meant that only two colours could be used in any 8×8 tile of pixels. The effect was also noticeable on MSX software and in some Commodore 64 titles.

Attribute clash — main illustration
Attribute clash — illustration

Key takeaways

  • Attribute clash belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Attribute clash to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Attribute clash from memory before moving on to harder problems.

Reference excerpt

Attribute clash (also known as colour clash or bleeding) is a display artifact caused by limits in the graphics circuitry of some colour 8-bit home computers, most notably the ZX Spectrum, where it meant that only two colours could be used in any 8×8 tile of pixels. The effect was also noticeable on MSX software and in some Commodore 64 titles. There are workarounds to prevent this limit from becoming apparent.

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 colour palette to conserve memory, Sinclair's design stored pixel bitmap and colour information in separate areas of memory. While the bitmap specified the state of individual pixels (either on or off), the colour information (or "attributes") corresponded to the text character matrix—24 rows of 32 columns—with one byte per 8×8 pixel character cell. This byte encoded two 3-bit values, known as INK (foreground colour) and PAPER (background colour) after the BASIC instructions used to define the colour values. Two other binary values were included in an attribute; a BRIGHT bit indicating one of two brightness levels for the two colours, and a FLASH bit, which, when set, caused the two colours to be swapped at regular intervals. This scheme provided 15 different colours: the eight combinations of red, green and blue at two brightness levels (except for black, which appeared the same at both brightness). Thus, each 8×8 pixel block could only contain 2 colours from the 15 available, which must both be from either the BRIGHT or non-BRIGHT halves of the palette. Trying to add a third colour in an 8×8 pixel area would overwrite one of the previous colours. The ZX Spectrum used 6144 bytes for the bitmap, with one byte representing eight pixels, and used 768 bytes for the colour attributes. This gives a total of 6912 bytes for the entire graphics display, a relatively small total for a computer of the Spectrum's era with "colour" 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 KiB of RAM, reducing the need to save memory in this manner. The architecture was retained to prevent loss of backward 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 colours per block varied. However, with the use of hardware sprites, 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 colours 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 colour attribute byte available for a whole 8×8 pixel area, as was the case with the Sinclair Spectrum, but eight, with one attribute byte for each 8×1 pixel group. Thus, while the Spectrum was limited to one colour pair for a square area of 8×8 pixels, the MSX 1 was only limited to one colour 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, such as being monochrome).

Effects

To avoid attribute clash, static graphic displays had to be constructed with care. Finely detailed colour graphics were impossible, as colour could only be applied in 8×8 pixel blocks. Careful design could achieve impressive results, as could synchronising colour changes to the refresh rate of the display—usually a television set. However, animated displays were more difficult—a distinct drawback in a machine whose primary use was playing video games. If just one pixel in an 8×8 block was recoloured because a moving part of the display touched it, the entire block would change colour. Thus detailed moving graphics caused large ugly fringes of rapidly changing colours to follow them around.

Workarounds Early software simply ignored the problem. Later, the standard workaround was to use colour for static display elements—such as a decorative border around the edges of the screen, which might include score displays and so on, or some form of instrumentation—with a smaller central monochrome area containing all the animated graphics. This also made graphics faster, as less of the screen had to be updated—both a smaller region, plus only changing pixel information and leaving the colour area untouched. Some Spectrum software, such as FTL's Light Force, used extremely careful graphics design to achieve full-colour moving graphics, essentially by limiting both the design of the onscreen elements and their paths of motion to 8×8 colour resolution boundaries. The moving elements were thus relatively large and rather blocky or squarish, and their movement was constrained, but this was not visually obvious and the sight of moving full-colour graphics was hugely impressive to Spectrum owners. No mainstream developers were able to find a suitable all-round fix for the attribute clash problem, instead preferring to use the monochrome graphics method when fast, clear graphics were needed, and full-colour graphics when the situation permitted. It was possible by paying careful attention to timing to modify the attribute area of RAM at certain specific times as the display was drawn - let the display hardware draw one line of the display, then change the attribute RAM before the next line is drawn to give the effect of different attributes for each individual line. These changes had to be done in software and were time-consuming to program, meaning that this technique was usually limited to special effects. This technique was also very popular in the demoscene.

… excerpt ends here. Continue reading the full article.

Illustrations

Attribute clash: The effect of attribute clash on MSX 1 systems when using the 256×192 Highres mode of MSX 1 (in this example blocks of 8×1 pixels share the same foreground colour, so the effect is similar to a ZX Spectrum)
The effect of attribute clash on MSX 1 systems when using the 256×192 Highres mode of MSX 1 (in this example blocks of 8×1 pixels share the same foreground colour, so the effect is similar to a ZX Spectrum)
Attribute clash: Laser Squad on the ZX Spectrum, dividing the game area into differently coloured blocks
Laser Squad on the ZX Spectrum, dividing the game area into differently coloured blocks

Worked examples

Example 1 — a first encounter with Attribute clash

Start with the simplest possible case. Write down what Attribute clash claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Attribute clash before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Attribute clash ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Attribute clash

In research
Attribute clash appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Attribute clash in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Attribute clash is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer graphic artifacts, ZX Spectrum, so understanding it makes those chapters shorter.
In everyday life
Look for Attribute clash outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Attribute clash” →

How to study Attribute clash in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Attribute clash means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Attribute clash out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Attribute clash in simple terms?

Attribute clash (also known as colour clash or bleeding) is a display artifact caused by limits in the graphics circuitry of some colour 8-bit home computers, most notably the ZX Spectrum, where it meant that only two colours could be used in any 8×8 tile of pixels. The effect was also noticeable o…

Why does Attribute clash matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Attribute clash?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Attribute clash.

Tags

  • Computer graphic artifacts
  • ZX Spectrum

Keep exploring