Difference between revisions of "Copper"

From SpecNext official Wiki
Jump to: navigation, search
(Created page with "The '''Copper''' is a simple programmed system which allows certain Next Registers to be altered automatically at certain scanline positions. "Copp...")
 
Line 22: Line 22:
 
| %00 || STOP, copper does nothing
 
| %00 || STOP, copper does nothing
 
|-
 
|-
| %01 || START, then stop at end of stream and don't loop
+
| %01 || START, then never reset
 
|-
 
|-
 
| %10 || START, loop continuously
 
| %10 || START, loop continuously
 
|-
 
|-
| %11 || START, stop at end of stream, loop at next VBlank
+
| %11 || START, then reset at next VBlank
 
|}
 
|}
 +
 +
If you are using one of the resetting modes (%01) (%11) then you can mark the "end" of the copper program by waiting for a line higher than 311. Since these lines will never be reached, the copper will essentially halt until reset.

Revision as of 15:28, 13 October 2017

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 never reset
%10 START, loop continuously
%11 START, then reset at next VBlank

If you are using one of the resetting modes (%01) (%11) then you can mark the "end" of the copper program by waiting for a line higher than 311. Since these lines will never be reached, the copper will essentially halt until reset.