Copper

From SpecNext official Wiki
Revision as of 15:22, 13 October 2017 by wiki>Hyphz (Created page with "The '''Copper''' is a simple programmed system which allows certain Next Registers to be altered automatically at certain scanline positions. "Copp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Copper is a simple programmed system which allows certain Next Registers to be altered automatically at certain scanline positions.

"Copper" is a strangulation of "co-processor" and is a term taken from the Amiga which had a similar function. The copper on the Spectrum Next is not associated with the Raspberry Pi 'coprocessor'.

A program is uploaded to the Copper by sending it, byte by byte, to Copper Data ($60). Each Copper instruction is 16 bits wide and there are only 2 opcodes, so only a single bit in an instruction determines the operation. The two operations are:

Opcode Bit pattern Effect
WAIT %1hhhhhhv %vvvvvvvv Wait for raster line v (0-311) and horizontal position h*8 (h is 0-55)
MOVE %0rrrrrrr %vvvvvvvv Write value v to Next register r

The copper's program storage is 1k big; since each instruction is 2 bytes it can store exactly 512 instructions, numbered 0-511. The copper is controlled by a word accessed through Next Registers Copper Control Low Byte ($61) and Copper Control High Byte ($62).

The copper control word has the structure: %cc00000i %iiiiiiii. I is the instruction index (0-511), and c is used to set the behavior mode of the copper, as follows:

C bits Effect
%00 STOP, copper does nothing
%01 START, then stop at end of stream and don't loop
%10 START, loop continuously
%11 START, stop at end of stream, loop at next VBlank