The Amiga has a fantastic co-processor (The Copper) that can control many different areas of the Amiga (like the display and those lovely rainbows).
The copper to me is an extremely complex beast.. not because I can't understand the 3 commands (yes that's right 3 commands
Move, Wait and Skip but because those commands are not used like a normal asm command.
MOVE
the move command can move data into a register. It consists of two words.
The first word contains the address of the destination register (Example $180) and also the MOVE switch bit (bit 0 is set to 0)
The second word contains the data that is to be transferred into the register
Here are a couple of examples
Code:
dc.w $180,$0000 - Background colour to black
dc.w $180,$0f00 - Background colour to red
dc.w $182,$000f - Colour 1 to blue
A breakdown of the 2 word instructions is as follows
Word One
Bit 0 - Always set to 0 (Setting this to 1 changes it to the WAIT instruction)
Bits 8-1 Register destination address
Bits 15-9 Not used, but should be set to 0
Word Two
Bits 15-0 16 bits of data to be transferred (moved) to register destination as specified in the first word.
WAIT
The wait instruction causes the copper to wait until the video beam encounters or is greater than the screen co-ordinates specified in the instruction.
Like the MOVE command 2 Word instructions are used and the 16 bits of each word have specific commands
Word One
Bit 0 - Set this to 1 (if it is left as 0 thje copper treats it as a MOVE instruction)
Bits 15-8 - Vertical beam position (VP)
Bits 7-1 - Horizontal beam position (HP)
Word Two
Bit 0 - Always set to 0
Bit 15 - Blitter finished disable bit (not too sure yet!!) (Normally set to a 1)
Bits 14-8 - Vertical position compare enable bits (VE)
Bits 7-1 - Horizontal position compare enable bits (HE)
The wait instruction is a little more complex than the move instruction as you might need to convert the hex to binary to understand how it is working.
here is an example
Code:
dc.w $9601,$FF00 - Wait for line 150, ignore horizontal counters
Lets break that down into the different bits/sections
First Word
$9601 lets break this down into it's binary form
bits 15-8:
$9=1001
$6=0110
That is the line on the screen ($96 = %1001 0110 = 150dec) (uses bits 15-8)
bits 7-0:
$0 (0000)
$1 (0001)
Now the horizontal beam position only uses bits 7-1 so only 0000 000 is used (position 0 in this case) the last bit in that word is the 1. That signifies we are using the wait command.
Second Word
$FF00
$F=1111 (Bit 15-12 - bit 15 is normally always a 1)
$F=1111 (Bit 11-8 - used with bits 12-14 gives vertical beam compare enable bits)
now this is where I start to lose understanding.. can someone explain a little more how this works (masks beam position etc) and I'll finish this off!!