Skip to Content
GuidesZX Spectrum NextThe Copper view

The Copper View

The ZX Spectrum Next’s Copper is a tiny coprocessor that writes Next Registers in step with the video beam: a palette colour that changes on line 96, a scroll offset per raster band. It runs a program of up to 1024 two-byte instructions from its own 2K memory, which the Z80 cannot read back, and its mistakes show only as a wrong picture. Klive shows you that program, where the Copper is in it, and where in the frame each instruction acts.

There are two views of the same state: a compact Copper panel in the Machine info activity, and the full Copper List document.

Applies to: ZX Spectrum Next.

Checking a Copper list

Run to the frame

Run the program until the effect should be on screen, then pause it.

Open the Copper List

Use View › Machine Views › Copper List, the Copper panel’s Open Copper List link, or show-copper. Check the list’s summary first: a missing HALT or a WAIT that never matches is flagged there.

Find where it acts

The raster ruler at the right shows the line of every WAIT. Click a tick to select its instruction; the meaning column says which register each MOVE writes and with what value.

Stop on the instruction

Click the gutter of the row to set a Copper breakpoint, or right-click it and choose Run to here. The machine stops when the Copper completes that instruction, and the Next Registers document and the paused screen show its effect. Step Copper moves on one Copper instruction at a time.

The Copper Panel

Open the Machine info activity and expand the Copper header (it sits below Next Memory Mapping):

RowShows
ModeNextReg $62 bits 7-6 as a phrase, for example 11 · loop, restart at (0,0). The tooltip has the register’s full description.
StateStopped, Stopped · list retained, Running, Waiting for line 96, x 64, or Halted at $005.
PCThe Copper’s list address. After a Copper breakpoint, hit $002 beside it names the instruction that stopped the machine.
Write ptrThe CPU’s $60/$63 write pointer, in bytes, and the list index it points to.
Line offsetNextReg $64: which raster line the Copper counts as line 0.
BeamThe beam in the Copper’s own coordinates: the line (cvc, where 0 is the first paper line) and the horizontal position (hc). After a Copper breakpoint, the beam at the hit is shown beside it.

Under the rows, seven decoded instructions around the Copper’s PC: ▶ marks the PC, ● the last hit. The footer summarises the list (6 used · HALT at $005 · 1018 NOP) and turns amber when something looks wrong; its Open Copper List link opens the document.

A soft reset stops the Copper but keeps its memory, exactly as the hardware does, so after a reset the panel still shows the old list, and says Stopped · list retained so it does not look stale. A hard reset clears it.

The Copper List

Open it with the panel’s link, View › Machine Views › Copper List, or the command:

show-copper show-copper $00B ; and reveal list index $00B
The Copper List: one row per instruction, and the raster ruler showing where in the frame each WAIT acts.
The Copper List document with decoded Copper instructions and the raster ruler at the right

Every row is one list instruction:

ColumnShows
guttera Copper breakpoint dot; click to set or remove one
index$00B
wordthe instruction as the Copper reads it, $BE78
mnemonicWAIT, MOVE, NOP or HALT
operands120, 31 for a WAIT (line, horizontal position), $41, $FC for a MOVE (register, value)
meaningline 120 · x 248, or the register’s name and the value written; a palette write carries a colour swatch
sourcethe .copper source line the instruction came from

The row the Copper is executing is marked ▶, the instruction a Copper breakpoint last stopped on is marked ● with the beam position of the hit. The run of empty slots after the list collapses into one 1018 × NOP row; click it to expand.

The toolbar has Follow PC (keep the Copper’s PC in view), Source (the source column), Hex WAIT (WAIT operands in hexadecimal), Step Copper, and the list summary.

What The List Is Checked For

  • No HALT. A list that does not end in a HALT runs on into whatever else is in the Copper’s memory. The assembler cannot know where your list ends, so this is reported here.
  • A WAIT that never matches. A line past the end of the frame, or a horizontal position past the end of the line, is never reached, and the frame’s length depends on the timing mode (50 or 60 Hz), so a list that works at 50 Hz can park the Copper at 60 Hz. Such a WAIT is shown in amber with never matches.
  • A WAIT for an earlier line than the one before it. That is legal, but in a looping mode it waits for the next frame, which is rarely what was meant.

The Raster Ruler

The strip at the right of the list is one frame, top to bottom, in the Copper’s line numbering: the paper (lines 0-191), then the lower border and the blanking interval, then the upper border, which is the end of the Copper’s frame because its line 0 is the first paper line. Each WAIT is a tick at its line (muted when it can never match), and the live beam and the last hit are drawn across it. Hover a tick to name its instruction; click it to select the row. It answers “where in the frame does this list act” at a glance.

The Source Column

When the program was built with the .copper pragma, Klive matches the Copper’s memory against the assembled Copper instructions by their shape (WAIT against WAIT, MOVE to the same register against MOVE), so a list uploaded at an offset, or one whose values the program patches at runtime, still maps to its source. A patched operand is marked * and shown in amber; the tooltip shows the assembled word. Fewer than three matching instructions in a row is never claimed as a match.

Double-click a row, or use Go to source in its context menu, to open the line.

The Row Menu

Right-click a row for Add/Remove breakpoint, Edit breakpoint…, Run to here (run until the Copper completes this instruction, without leaving a breakpoint behind), and Go to source.

Copper Breakpoints

bp-set cu:$00B stops the machine when the Copper completes list instruction $00B: a MOVE when it is issued, a WAIT when it is satisfied. See Copper Breakpoints for the details, including why the Copper may already be past the instruction when the machine stops.

Stepping The Copper

Step Copper (the toolbar button, Debug › Step Copper, or step-copper) runs the machine until the Copper completes its next instruction, whatever its index, and stops at the end of that Z80 instruction.

Several Copper instructions can complete during one Z80 instruction: two MOVEs are only two 28 MHz ticks apart. Step Copper stops on the first of them; the Copper’s PC may show that it has already completed the next one too.

Last updated on