want to display on the top layer. This process, especially where it involves moving graphics, is very processor-intensive and can slow down the computer, resulting in a not-so-fluid experience of movement. The ZX Spectrum Next addresses this very specific issue with the introduction of priority colours. These apply only to Layer 2 palettes and are defined by setting the 8th bit of the secondary byte of each palette entry to 1.

Setting any palette entry's priority bit will ensure that this colour will always print on top of everything else. In case you would need the same colour to exist in a layer below the topmost you will need to define the same colour again but on a different index using the LAYER PALETTE command.

We will revisit this topic further below, when we reach the palette manipulation commands.

More on the LAYER command

In Chapter 14 as well as in the previous sections of this chapter we saw repeated mentions and usage of the LAYER command. By now, you should have enough grasp of the mechanics behind the ZX Spectrum Next's colour and graphic system to examine it in a little more detail. We will further expand on its usage every time a functionality we haven't yet discussed is introduced (as in the PALETTE section that follows shortly) but for now let's head back to the beginning of Chapter 14 and re-iterate the possible graphic modes in conjunction with LAYER which is used to change between them.

First of all and given what we've learned in terms of colour, it's helpful to conceptualise the graphic system in a slightly different manner than what the LAYER command organises them in. These layers are grouped together in terms of functionality and memory addresses they use, namely: The ULA modes (Layer 0 and all Layer 1 modes), Layer 2 and the Sprite System (which we will examine in more detail in Chapter 17 – Time and Motion). This can get a bit confusing as LoRes (Layer 1,0) and Layer 2 use the same colour storage and display system so it's better to completely disregard this and instead imagine four different screens laying on top of one another with programmable priorities and potential transparency. In simple words that means that you can select whichever screen you want to appear on top and in which order. This means putting a priority onto the memory space that holds the data for the graphics and displaying this above everything else. This is achieved with the

LAYER OVER order

command, where order is one of the following:

0 Sprites over Layer 2 over ULA (Layer 1) – the default
1 Layer 2 over Sprites over ULA (Layer 1)
2 Sprites over ULA (Layer 1) over Layer 2
3 Layer 2 over ULA (Layer 1) over Sprites
4 ULA (Layer 1) over Sprites over Layer 2
5 ULA (Layer 1) over Layer 2 over Sprites
6 Sprites over (Layer 2 + ULA combined) – colours clamped to 7
7 Sprites over (Layer 2 + ULA combined) – colours clamped to (0,7)

The last two ordinals enable one of the two colour blending modes allowing for some very interesting lighting/shading effects.

This (as we will see in Chapter 22 – IN, OUT and the Next Registers) directly affects the Sprite and Layer System Register (Register 21) and in the same order as the LAYER OVER command.


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.