ZX Spectrum Next Copper

Overview

The Spectrum Next Wiki lists all the information, but the main points are

It is a programmable system that can cause the Next to alter various Next registers on specific raster lines on the display. Its commands are

  • Wait for a raster line and horizontal position

  • Write a value to a Next register

  • Perform a no-op

  • Halt

These commands are composed into what we’ll call a “copper list” which is nothing more than an array of 16 bit integers. This copper list is then uploaded to special RAM in the Next’s FPGA that the copper uses. We can write a coppper list that is 1024 commands long.

There are no looping or branching instructions and no concept of reading data. This means often complex copper lists are long sequences of instructions. If you want to draw a gradient background where every single row is a different colour, your copper list will need to contain 192 lines of instructions. You could write a piece of code that the Next runs at startup to generate this if RAM usage is more important than the startup of your code.

The Next’s manual has some brief information on pages 173-176 and the most useful piece of info is the diagram of how the copper treats the screen. A more detailed explanation can be found in ZX Spectrum Next Assembly Developer Guide on page 105.

This might not initially sound that useful and the hardest part about learning to use the copper is simply working out what it can be used for. It’s influenced by a similar system in the Amiga and ideas about its usage can be found there.

The main power it gives a programmer is the ability to change the operation of the Next very precisely based on which part of the screen is being drawn. It operates independently to the CPU and runs at 28MHz.

The documentation is quite short so below are some ideas that it could be used for

Drawing in the screen border

By being creative with the colouring of the screen border and remapping colour palette entries, it’s possible to draw lines and basic patterns in the screen border. The trick is to set the border to a colour you’re not using (I use 16) and to then use the copper to remap that colour to something else at different screen locations to make stripes, etc.

Parallax Scrolling

The Next has registers to scroll the screen both horizontally and vertically. Using the copper to do this allows different parts of the screen to scroll at different rates - or to not scroll at all. It is quite easy to have a game with a scrolling playfield background but for the score/lives status area to remain still.

To do this the copper list needs updating each frame which is explained below.