83
edits
(ZX Spectrum video mode, display file layout, stub mentions of timex and ulaplus) |
m (Cat: Video) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Video]] | |||
The '''video modes''' of a computer are the ways in which it can produce a display. A vanilla ZX Spectrum has only one video mode, a 256x192 resolution with 15 colours in attribute cells. Some versions such as the Timex machines added other modes, as do some hardware modifications such as the ULAplus. | The '''video modes''' of a computer are the ways in which it can produce a display. A vanilla ZX Spectrum has only one video mode, a 256x192 resolution with 15 colours in attribute cells. Some versions such as the Timex machines added other modes, as do some hardware modifications such as the ULAplus. | ||
== ZX Spectrum Video Mode == | == ZX Spectrum Video Mode == | ||
The display is actually quite strangely made: | The display is actually quite strangely made: | ||
* First there's the pixel data; this just has a single bit for each pixel. Also it's laid out quite oddly; see below. | * First there's the pixel data; this just has a single bit for each pixel. Also it's laid out quite oddly; see below. | ||
Line 12: | Line 12: | ||
=== Display file layout === | === Display file layout === | ||
The pixel data appear starting at address 4000h (16384); the screen is divided vertically into thirds, then lines modulo 8, then rows (blocks of 8 lines). This might become clearer if you look at how the address lines are 'jumbled': if we write L4-L0 for the bits of the Line number (0-23), P2-P0 for the bits of the Pixel row within the line (0-7), and C4-C0 for the bits of the Column number (0-31), we get the following... | The pixel data appear starting at address 4000h (16384); the screen is divided vertically into thirds, then lines modulo 8, then rows (blocks of 8 lines). This might become clearer if you look at how the address lines are 'jumbled': if we write L4-L0 for the bits of the Line number (0-23), P2-P0 for the bits of the Pixel row within the line (0-7), and C4-C0 for the bits of the Column number (0-31), we get the following... | ||
{| border="1" cellpadding="3" | |||
Alternatively, in C, dataByteHigh=0x40|(line&0x18)|(pixelrow%8), dataByteLow=((line&0x7)<<5)|column. | |(msb)|||| '''0''' || '''1''' || '''0''' ||L4||L3||P2||P1||P0|| ||L2||L1||L0||C4||C3||C2||C1||C0||||(lsb) | ||
|} | |||
Alternatively, in C, | |||
dataByteHigh=0x40|(line&0x18)|(pixelrow%8), dataByteLow=((line&0x7)<<5)|column. | |||
Then, the byte at this address contains 8 bits, which are the pixel data for the relevant row of 8 pixels. | Then, the byte at this address contains 8 bits, which are the pixel data for the relevant row of 8 pixels. | ||
The attribute bytes are arranged slightly more sanely, as they don't have the pixel row in there... | The attribute bytes are arranged slightly more sanely, as they don't have the pixel row in there... | ||
{| border="1" cellpadding="3" | |||
In C again, attrByteHigh=0x58|(line>>3), attrByteLow=dataByteLow. | |(msb)|||| '''0''' || '''1''' || '''0''' || '''1''' || '''1''' || '''0''' ||L4||L3||||L2||L1||L0||C4||C3||C2||C1||C0||||(lsb) | ||
|} | |||
In C again, | |||
attrByteHigh=0x58|(line>>3), attrByteLow=dataByteLow. | |||
One way to make this clearer (or not...) is to run a program which sequentially fills in the screen RAM, like the following: | |||
10 FOR a=16384 TO 23295 | |||
20 POKE a,255 | |||
30 NEXT a | |||
Watching the order in which the screen is filled should make it clear how the screen RAM works. | |||
=== Attribute Byte === | === Attribute Byte === | ||
Each attribute byte sets the colours for a whole 8x8 cell (this is the origin of the Spectrum's infamous 'colour clash', since it only allows two colours within each cell). The attribute is laid out as follows: | Each attribute byte sets the colours for a whole 8x8 cell (this is the origin of the Spectrum's infamous 'colour clash', since it only allows two colours within each cell). The attribute is laid out as follows: | ||
(msb)|Flash|Bright|Paper-G|Paper-R|Paper-B|Ink-G|Ink-R|Ink-B|(lsb) | {| border=1 cellpadding=2 | ||
|(msb)||||Flash||Bright||Paper-G||Paper-R||Paper-B||Ink-G||Ink-R||Ink-B||||(lsb) | |||
|} | |||
== Timex == | == Timex == | ||
Line 27: | Line 43: | ||
== ULAplus == | == ULAplus == | ||
{{Main|ZX Spectrum 64 Colour Mode}} | |||
The [[ULAplus]], a plug-in replacement for [[the Spectrum ULA]], provides a paletted 64 colour mode in addition to the usual 16 colour mode. The display file layout is the same except that attribute bytes are interpreted differently. |
edits