ZX Spectrum graphic modes

From Wikipedia, the free encyclopedia


ZX Spectrum screen showing the available colours

The ZX Spectrum is generally considered to have limited graphical capabilities in comparison to some other home computers of the same era such as the Commodore 64, largely due to its lack of a dedicated graphics chip. Nevertheless, throughout its commercial life and later activity on the demoscene, various techniques have been developed to provide (or emulate) improvements to the Spectrum's graphical output.

Colour palette[]

The ZX Spectrum (and compatibles) computers uses a variation of the 4-bit RGBI palette philosophy (also used on CGA, Thomson MO5, , Mattel Aquarius, etc.) resulting in 8 basic colours with brightness variations[1].

This results in each of the colours of the 3-bit palette having a basic and bright variant, with the exception of black[1]. The bright half of the palette is generated using the video display's maximum voltage levels for each of the three Red, Green and Blue (RGB) components that a colour uses. The basic half of the palette is displayed by simply reducing these voltages.[2]

In the ZX Spectrum encoding the colour components are in GRB (Green, Red and Blue) order (from most to least significant bit) rather than the more common RGB order. The GRB order has the advantage that the colour numbers become ordered by increasing luminance, so if viewed on black-and-white display the ordered sequence 0 to 7 would form a gradient from black to white. Specifically, blue has a binary weight of 1, red has a weight of 2, and green has a weight of 4. As with any binary number, these weights add up to produce a single decimal number that matches the displayed colour, the effect of which can be seen in the table below (pay special attention to the "binary value" column).

For any value of n from 0 to 7, the following commands can be used to set or alter the screen's colours[1]:

  • BORDER n, the colour for surrounding area outside the main bitmap.
  • PAPER n, the background (pixel bit value of 0) colour for the colour cell to be altered.
  • INK n, the foreground (pixel bit value of 1) colour for the colour cell to be altered.

Furthermore, the BRIGHT command can be used to change the setting of the PAPER and INK commands' "bright" flag (the I in RGBI), giving them access to the entire 15-colour palette. Settings of "0" and "1" turn bright mode off and on (respectively). Since only one bit within a colour attribute byte is used to select the brightness for both foreground and background colours in a colour cell, it is not possible to select both bright and basic colour modes in the same colour cell. The BORDER command does not use a bright flag, thus only the eight basic colours are supported.

Counting from least to most significant bit, an attribute byte dedicates three bits for the foreground colour, three bits for the background colour, one bit for the bright flag, and one bit for the flashing effect (which causes the video display to alternate foreground and background colours periodically)[1].

Colour number Binary value BRIGHT 0 (approximate RGB) BRIGHT 1 (RGB) Colour name
0 000 #000000 #000000 black
1 001 #0000ee #0000FF Blue
2 010 #ee0000 #FF0000 Red
3 011 #ee00ee #FF00FF Magenta
4 100 #00ee00 #00FF00 Green
5 101 #00eeee #00FFFF Cyan
6 110 #eeee00 #FFFF00 Yellow
7 111 #eeeeee #FFFFFF White
  • Some ZX Spectrum clones or NTSC machines might display "bright black" as dark gray.
  • Colours simulated as RGB assume non bright as 85% voltage (0.55 V) and bright as 100% (0.65 V).[2] Each ZX Spectrum model used different voltages for colours, so the values here are only indicative. RGB values shown are an approximation taking into account PAL gamma. Nevertheless viewing on an actual PAL CRT display would give slightly different results, due to variations on analog hardware setup and components. (Related talk pertaining to the acceptability of some dim values that look faint, especially in the late approximation in question.)

Dither and Contrast[]

ZX Spectrum standard palette with 8x8 ordered dithering.
Standard ZX Spectrum palette with dithering, in pixel art

This quite short colour palette has urged the graphic artists (e.g. at ZX-Art) to resort to various dithering techniques; the simplest of which employs ordered patterns, as shown exhaustively in the opposite chart. Dithering also works very well with the original Composite video connection to an analog PAL TV, generating colour mixing along horizontal pixel lines.

Because all colours have full saturation and minimal brightness variations, some combinations have very poor contrast. This can be used to improve the dithering effect mentioned above (making the dither patterns less obvious), but also limits the usage of coloured background in games (character sprites can become hard to see due to low contrast). The table below show this problem - for example, a white game character over a yellow background is almost invisible.

Colour contrast chart (good for flashing colours)
0,00,00 0,00,01 0,00,02 0,00,03 0,00,04 0,00,05 0,00,06 0,00,07
0,01,00 0,01,01 0,01,02 0,01,03 0,01,04 0,01,05 0,01,06 0,01,07
0,02,00 0,02,01 0,02,02 0,02,03 0,02,04 0,02,05 0,02,06 0,02,07
0,03,00 0,03,01 0,03,02 0,03,03 0,03,04 0,03,05 0,03,06 0,03,07
0,04,00 0,04,01 0,04,02 0,04,03 0,04,04 0,04,05 0,04,06 0,04,07
0,05,00 0,05,01 0,05,02 0,05,03 0,05,04 0,05,05 0,05,06 0,05,07
0,06,00 0,06,01 0,06,02 0,06,03 0,06,04 0,06,05 0,06,06 0,06,07
0,07,00 0,07,01 0,07,02 0,07,03 0,07,04 0,07,05 0,07,06 0,07,07
1,00,00 1,00,01 1,00,02 1,00,03 1,00,04 1,00,05 1,00,06 1,00,07
1,01,00 1,01,01 1,01,02 1,01,03 1,01,04 1,01,05 1,01,06 1,01,07
1,02,00 1,02,01 1,02,02 1,02,03 1,02,04 1,02,05 1,02,06 1,02,07
1,03,00 1,03,01 1,03,02 1,03,03 1,03,04 1,03,05 1,03,06 1,03,07
1,04,00 1,04,01 1,04,02 1,04,03 1,04,04 1,04,05 1,04,06 1,04,07
1,05,00 1,05,01 1,05,02 1,05,03 1,05,04 1,05,05 1,05,06 1,05,07
1,06,00 1,06,01 1,06,02 1,06,03 1,06,04 1,06,05 1,06,06 1,06,07
1,07,00 1,07,01 1,07,02 1,07,03 1,07,04 1,07,05 1,07,06 1,07,07

Standard mode[]

Hardware implementation[]

Standard ZX Spectrum screen

The original ZX Spectrum has a screen resolution of 256×192 pixels[3][4]. Colour information is overlaid onto this as a grid of 8×8 pixel regions known as attribute blocks[5][6]; within each attribute block, only two colours may be used out of a palette of 8 (black, blue, red, magenta, green, cyan, yellow and white). Additionally, the entire attribute block may be designated as 'bright', resulting in a total of 15 possible colours (because both bright and dark black is the same colour #000000). In many programs this limitation was evident as attribute clash. A screen in this mode occupies 6.75 KB.

Details:
Pixels: 256 × 192
Attributes: 32 × 24
Colours: 15
Machine: All

Actual resolution over composite video connections[]

TV blur 128×192 ZX Spectrum screen

Due to the limitations of the original Composite video connection to an analogue PAL TV, adjacent pixels were in fact blurred out horizontally. The resulting resolution depended on the quality of the TV set and on the colour combinations used by each particular image, but on most cases was similar to ~128x192.

This effect was used to increase the number of displayed colours on screen by almost all of the graphic designers, using dithering techniques. Close to a total of 64 colours become possible this way. Some emulators provide some sort of "blur" image processing trying to simulate this effect.

Details:
Pixels: ~128 × 192
Attributes: 32 × 24
Colours: ~128 (considering dither and bright/non bright colour variations)
Machine: All, using composite video or RF connections to a TV

Monochrome TVs and monitors[]

ZX Spectrum palette on a monochrome display

By using a monochrome monitor or black and white TV (or reducing the colour settings of a colour TV), it is possible to take advantage of the differences in intensity over the Spectrum's colour range to generate a 15-shade grayscale image at 256×192 resolution.

Details:
Pixels: 256 × 192
Attributes: 32 × 24
Colours: 15 grayscale
Machine: All, using a monochrome TV or monitor

Hicolour (8x1 attributes)[]

Hardware implementation[]

Hicolour ZX Spectrum screen

Several third-party Spectrum clones, including the Timex Sinclair machines[7][8], the Pentagon, the , and the interface support a screen mode in which attribute blocks are 8×1 pixels in size rather than the usual 8×8.[9][10] A screen in this mode takes 12 KB RAM. In the case of the Timex, this mode is activated through the command OUT 255,2[7]. In addition, this screen mode can be generated through the use of the MB-02 disk system's DMA hardware[11] (where the technique is known as Multitech[12]), and is also available as Mode 2 (with a linear byte order) on the SAM Coupé[13].

Details:
Pixels: 256 × 192
Attributes: 32 × 192
colours: 15
Machine: Timex Sinclair models, Pentagon, , SAM Coupé
Interface:

Software implementation[]

"8x1" attributes[]

On other Spectrum models, this effect can be replicated by exploiting the fact that the ULA re-reads the attribute information on every pixel row when generating the video output; it is possible to write a new value to the relevant memory location in between successive lines, and thus cause a different pair of colours to be shown. However, the Spectrum's processor is not fast enough to write to an entire row of attribute bytes in one scanline, so 8×1 attributes can only be achieved over 20 columns.[14] This technique is variously known as Hicolour, Multicolour, FLI, BIFROST*2 or Rainbow Processor mode.[10]

Details:
Pixels: 256 × 192
Attributes: 32 × 192 (limited to a 18x192 area)
Colours: 15
Machine: All (with specific code tailored for each machine's timings)

"8x2" attributes[]

A variation (known as Nirvana+) on this method is to change the complete row of attributes over the course of two scanlines, resulting in 8×2 pixel attribute blocks over the full width of the screen.[15]

Details:
Pixels: 256 × 192
Attributes: 32 × 96
Colours: 15
Machine: All (with specific code tailored for each machine's timings)

"4x1" attributes[]

4×1-attribute ZX Spectrum screen

A special case involves alternating between the two available colours per attribute cell for 4 pixels each, allowing each 4×1 region to be treated as an independently colourable 'pixel' (although the limitation of one brightness level per 8×1 cell is still in effect).

Details:
Pixels: 64 × 192
Attributes: 64 × 192
Colours: 15
Machine: All (with specific code tailored for each machine's timings)

ULAplus[]

ULAplus ZX Spectrum screen

ULAplus is compatible with the standard ZX Spectrum and Timex modes, and adds the ability to redefining of the palette. If only used to slight modify the basic 16 colours, ULAplus software can be displayed on a standard Spectrum. Use of the full 64 colours is incompatible, as it will trigger the "flash" attributes of the original Spectrum.[16]

Details:
Pixels: 256 × 192
Attributes: 32 × 24
Colours: 64 (from 256)
Machine: ZX Spectrum SE, , Chloe 280SE, Chloe 140SE, , zx128u+
Interface:

Interlace/Switched modes[]

Simulated interlaced ZX Spectrum image on a CRT screen

By alternating between two screens on every frame interrupt (50 Hz), it is theoretically possible to simulate a doubling of the vertical display resolution from 192 to 384 lines.

The Timex clones and ZX Spectrum 128K implement a 'shadow' screen area which can be switched into place through the use of a single OUT command, and this is often utilised to rapidly switch between two images for this purpose (although this can also be achieved with a standard block copy, albeit not over the entire screen).

When viewed on a CRT television screen (the standard at the time), the flicker is less noticeable than on a modern monitor. The image is linked to here (warning: the linked image flickers very rapidly, which could potentially cause seizures in people with photosensitive epilepsy).

The technique does not in fact achieve a true interlaced display, as the Spectrum lacks the ability to synchronise with the display hardware at such a low level. Rather, the effect is more akin to anti-aliasing, with certain pixels appearing at half intensity.[10]

Details:
Pixels: 256 × 384
Attributes: 32 × 24
colours: 15

GigaScreen[]

GigaScreen ZX Spectrum screen

The attributes (colours) of an image are alternated at 50 Hz on the screen, taking advantage of the PAL colour system encoding for mixing. This way, the palette is increased to approximately 36 colours.[17] Its possible to switch screen per scanline and thus mix the screens, but this is very CPU intensive and needs exact and steady timings.

For Pentagon machines, a hardware modification is available which directly combines the two alternate screen areas into the video signal, thus eliminating the flicker associated with this method. The MB03+ Ultimate interface and the eLeMeNt ZX computer can display three hardware modes of non-flickering GigaScreen (mixed video RAMs, mixed video frames and autodetection mode).

Furthermore, the gigascreen and hicolour techniques may be employed together to produce even richer-coloured images; this format has been named DithVIDE and BZither, both names referring to the dithering methods employed when converting true-colour images to the format.

Details:
Pixels: 256 × 192
Attributes: 32 × 24
colours: ~36
Machine: All (with flickering); Pentagon, eLeMeNt ZX, MB03+ Ultimate (no flickering)

KeyLayer[]

The MB03+ Ultimate interface and the eLeMeNt ZX computer provide this graphic mode which allows to display image data from the second video RAM at the place of one selected colour in the video RAM no.1. This adds a third colour to an attribute.

Details:
Pixels: 256 × 192
Attributes: 32 × 24, 3 colours per cell
colours: 15
Machine: eLeMeNt ZX
Interface: MB03+ Ultimate

3colour / Multichrome / RGB-3 / Interchrome[]

3colour ZX Spectrum screen

Three separate images, comprising a red, green and blue layer, are displayed on the screen rapidly, one after the other, relying on persistence of vision effects to merge the three layers into a single coloured image. The result is an 8-colour image where each pixel may be coloured independently.[18][19]

This effect is simulated in another image linked to here (warning: the linked image flashes colours very rapidly, which could potentially cause seizures in people with photosensitive epilepsy); the flashing is less noticeable when viewed on a television screen.

Details:
Pixels: 256 × 192
Attributes: 256 × 192
Colours: 8
Machine: All

Compatible machines and interfaces[]

Later ZX Spectrum compatible machines offered extra video modes. These are based on the standard 256x192 mode but incompatible with the original Spectrum.[10] Also interfaces, the and the interface extend the Spectrum��s display to support more colours or/and extra video modes.

Layer 2 (256×192x256)[]

Details:
Pixels: 256 × 192
Attributes: 256 × 192
colours: 256
Machine: ZX Spectrum Next[20]

256×192x16[]

A Sam Coupé mode, where each pixel can one of 16 colours from a 128 colour palette.[10]

Details:
Pixels: 256 × 192
Attributes: 256 × 192
colours: 16 (from 128) per line
Machine: Sam Coupé

384x304x16[]

A mode supported by the Pentagon computer.[21]

Details:
Pixels: 384x304
Attributes: 48 × 38
colours: 16
Machine: Pentagon

16c[]

Video mode where each pixel can have of 16 colours. [22]

Details:
Pixels: 256 × 192
Attributes: 256 × 192
colours: 16
Machine: ATM Turbo, Pentagon

HAM256[]

Details:
Pixels: 256 × 192
Attributes: 32 × 192
colours: 32 per line (from 256)
Machine: ZX Spectrum SE,

Radastan[]

This mode displays 128x96 double sized pixels. Each pixel holds one of sixteen colours. Pixels are stored in linear buffer as 4-bit nibbles (i.e. 2 pixels per byte). The buffer is 6144 bytes long and occupies same memory as 256x192 pixel ram.

Details:
Pixels: 128x96
Attributes: each pixel has separate colour
colours: 16 (from 256)
Machine:

Spectra (+128)[]

The Spectra has 31 display formats. These allow up to 64 unique colours to be shown simultaneously, and at a variety of colour resolutions, with attribute heights of 1, 2, 4 and 8 pixels, and widths of 4 and 8 pixels.[23]

Hi-resolution modes[]

512 × 192 monochrome screen

512×192x2[]

This mode was mainly used to display 64×24 or 85×24 columns text screen and only Timex Sinclair computers and some Russian clones[24] can display it. Two graphics editors support this mode, along with BASIC64 and some CP/M implementations.[10] It also takes 12 KB (12 KiB) RAM.

Details:
Pixels: 512 × 192
Attributes: none
Colours: 2 (Four palettes: Black & White, Blue & Yellow, Red & Cyan, Magenta & Green)
Machine: Timex Sinclair, , , , Pentagon

512×192x4[]

The Sam Coupé has this mode, where each pixel can use one of 4 colours from palette of 128. [10]

Details:
Pixels: 512 × 192
Attributes: 512 × 192
colours: 4 (from 128) per line
Machine: Sam Coupé

512x384x2[]

A mode supported by the Pentagon computer.[21]

Details:
Pixels: 512 × 384
colours: monochrome
Machine: Pentagon, Timex Sinclair 2128

HiRes Colour[]

Pixels are stored in a linear order. Attributes are doubled in the vertical direction, the composition of the attribute is identical to the original ZX Spectrum mode. HiRes indeXedColour can choose 64 colours from 16777216 colours. Two video RAMs can be mixed in both Colour and indeXedColour modes through the Keylayer.

Details:
Pixels: 512*192
Attributes: 64*48
colours: 64 (or 64 indexed)
Machine: ,

Emulated[]

256×192, 256 colours, "256 colour mode", no attributes[]

The SPEC256, EmuZWin and Es.pectrum emulators have a screen mode 256×192 pixels where each pixel can be in one of 256 colours. [10] This is achieved by extending the word size of the emulated Z80 from 8 bits to 64, making eight bits of data available for each pixel; the screen thus takes 48 KB of memory. This mode only exists on the emulator and software graphics must be modified to use it.

Details:
Pixels: 256 × 192
Attributes: 256 × 192
colours: 256

ULAX[]

The ZX ULAX emulator provides 15bit hi-colours.[25]

HGFX Graphics[]

The LnxSpectrum emulator does 256 indexed (24bit) colours at 256*192 resolution [26] expandable to 320*240 or 640*240 in HiRes.[27]

References[]

  1. ^ a b c d "Colours - Sinclair ZX Spectrum Introduction Manual [Page 27] | ManualsLib". www.manualslib.com.
  2. ^ a b "Spectrum Clone Design Blog". www.zxdesign.info.
  3. ^ "Spectrum Clone Design Blog". www.zxdesign.info.
  4. ^ "48K ZX Spectrum Technical Information". worldofspectrum.org.
  5. ^ "L Break Into Program - ZX Spectrum Screen Memory Layout".
  6. ^ "World of Spectrum - Documentation - ZX Spectrum manual - Chapter 24". worldofspectrum.org.
  7. ^ a b "Timex I/O Ports". timex.comboios.info.
  8. ^ "Timex Technical Information". worldofspectrum.org.
  9. ^ Inc, InfoWorld Media Group (19 December 1983). "InfoWorld". InfoWorld Media Group, Inc. – via Google Books.
  10. ^ a b c d e f g h "ZX Spectrum extra graphics modes -- 8bit Projects For Everyone". 8bit.yarek.pl.
  11. ^ https://ci5.speccy.cz/files/mb02.pdf
  12. ^ "MB02+ download". www.128land.com.
  13. ^ https://sam.speccy.cz/systech/sam-coupe_tech-man_v3-0.pdf
  14. ^ "BIFROST*2 ENGINE at Spectrum Computing - Sinclair ZX Spectrum games, software and hardware". Spectrum Computing.
  15. ^ "NIRVANA+ ENGINE at Spectrum Computing - Sinclair ZX Spectrum games, software and hardware". Spectrum Computing.
  16. ^ "ULAplus". sites.google.com.
  17. ^ "GFX ZONE - ZX-Spectrum graphics modes". gfxzone.planet-d.net.
  18. ^ "ZX Prism: 16 Colour "colour-clash free" planar mode and Hardware Gigascreen". 17 July 2014.
  19. ^ "Триколор — SpeccyWiki". speccy.info.
  20. ^ "Video Modes - SpecNext official Wiki".
  21. ^ a b "384x304 — SpeccyWiki".
  22. ^ "16col — SpeccyWiki".
  23. ^ http://www.fruitcake.plus.com/Sinclair/Spectrum/Spectra/Files/Documents/SPECTRA_DisplayModes.pdf
  24. ^ "512x192 — SpeccyWiki".
  25. ^ "ZX ULAX emulator - Spectrum Computing Forums".
  26. ^ "LnxSpectrum HGFX Oxygene" – via vimeo.com.
  27. ^ "lnxspectrum:hgfx [ilnx.cz]". wiki.ilnx.cz.

External links[]

Retrieved from ""