App. F: Copper Lists

The Amiga co-processor

While AMOS Professional allows you to harness the power of the Amiga with the greatest of ease, it has to perform a great deal of work behind the scenes when manipulating entire screens at great speed. The source of much of this power is a special hardware chip called the "co- processor", or copper.

The copper is in effect a simple micro-processor, with its own separate programs, and its own unique memory registers. It supports only three instructions, MOVE, WAIT and SKIP, and these commands insert values into the computer's hardware registers at certain points on the display, which change the way pictures are drawn on the screen.

These hardware registers hold the values that determine the precise appearance of the display, such as its size and position, as well as the number of colours. For example, all the colour values used by AMOS Professional screens are held in the colour registers from $180 to $1BE. Because the appearance of every line displayed on your screen is controlled by the copper, a massive number of special effects can be created by changing these registers during a program, using a list of instructions known as the "copper list".

The Copper List

The copper list is executed automatically, fifty times every second, at the same time that the screen is re-drawn. This is how the AMOS Professional RAINBOW commands work, waiting for a rainbow line to appear on screen and then immediately poking a new value into the selected colour register. This causes dramatic colour changes, depending on the position of the line in the display.

Exactly the same process can be applied to the rest of the display system, and by placing the appropriate value into certain hardware registers at exactly the right moment, the position, type and size of the display can be changed at will! Unfortunately, the copper list is notoriously difficult to manipulate, and many competent programmers have failed to master its mysteries.

Although the copper is automatically managed by AMOS Professional, you cannot expect the system to teach you everything about the inner workings of the Amiga's hardware. Indeed, Francois Lionet has written AMOS Professional to save you the years of hard work and experience needed to gain such expert knowledge. However, for those expert programmers who insist on meddling with the copper directly, AMOS Professional includes a powerful trap- door into the realms of the co-processor. This allows advanced programmers to generate astounding effects, and also allows novices to send their displays berserk and crash their computers. You have been warned!

Accessing the Copper

COPPER OFF

instruction: turn off the standard copper list
Copper Off

If you ignore the warning in the last paragraph and use this instruction, the automatic copper generation that forms the backbone of the AMOS Professional system is turned off. From now on, you are on your own!

You should now understand that AMOS Professional actually holds two separate copper lists in memory, and the principle is very similar to the logical and physical screens of the DOUBLE BUFFER system.

The logical copper list is the list being created from AMOS Professional Basic, and it is completely invisible. The physical list holds the copper instructions that are generating the current TV display. It cannot be accessed from AMOS Professional at all, as this would corrupt the display completely. As a default, these copper lists are limited to 12k in length, which is the equivalent to approximately six thousand instructions. This limit may be increased using an option from the Interpreter set-up dialogue box.

Copper lists can be defined in one of three ways:

The first method is to enter the copper list using a combination of the COP MOVE and COP WAIT instructions, from AMOS Professional Basic.

The second way is to find the address of the logical copper list, using COP LOGIC. This can then be manipulated directly using DEEK and DOKE, allowing minor modifications to be made to the existing screen without having to generate a completely new copper list at all. This is perfect for the creation of rainbow effects.

The third alternative is for assembly language buffs. Copper lists can be generated using machine code, and as before, the current address is available via the COP LOGIC function. Note that this address will change during the course of a program, and it must be entered every time the machine code routine is called.