Difference between revisions of "Copper"
Line 14: | Line 14: | ||
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 {{NextRegNo|$61}} and {{NextRegNo|$62}}. | 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 {{NextRegNo|$61}} and {{NextRegNo|$62}}. | ||
+ | |||
+ | Update: From TBU .26 this will have increased to 2K so it can store 1024 instructions numbered 0-1023. | ||
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: | 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: |
Revision as of 21:09, 23 February 2018
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).
Update: From TBU .26 this will have increased to 2K so it can store 1024 instructions numbered 0-1023.
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.