The Magic of the Amiga Copper

Hey Amiga fans! Ever looked at a stunning Amiga demo or game and wondered how they pulled off those amazing color effects? You know the ones – the vibrant, multi-colored skies that seem to defy the Amiga's color limits, or a screen that's split into different color palettes? The secret, my friends, often lies in one of the Amiga's most unique and powerful hardware features: the Copper.

What in the World is a Copper?

In the heart of the Amiga's custom chipset lies a special co-processor called the Copper. Think of it as a tiny, dedicated graphics programmer that works alongside the main CPU. While the CPU is busy running the game's logic or your Workbench applications, the Copper is tirelessly manipulating the display hardware.

The Copper's job is simple but powerful: it can change the contents of the Amiga's hardware registers at very specific moments in time. This is key. It's all about timing. The Amiga generates its display by drawing the screen line by line, from top to bottom. The Copper can be programmed to "watch" for a specific screen line and, at the precise moment the video beam reaches that line, it can zap a new value into a hardware register.

The Magic of Copper Lists

So, how do you tell the Copper what to do? You create a Copper list, which is just a simple program for the Copper to follow. This list is a series of instructions that the Copper executes in sync with the screen drawing.

A Copper list is made up of just three basic instructions:

By combining these simple instructions, you can create some truly amazing effects.

A photorealistic image of the Amiga's Agnus custom chip, which contains the Copper co-processor, sitting on a circuit board.

Your First Copper List: A Hands-On Tutorial

Reading about it is one thing, but making it happen is where the real fun is! This tutorial will get our hands dirty with some 68k assembly to talk directly to the hardware.

The Real Deal: A Two-Color Screen in Assembly

This assembly program will create a screen that is white on the top half and blue on the bottom half. It's a fundamental technique that demonstrates the core Copper list concept.

The Tools:

You'll need an assembler. A great option for cross-compiling from your Mac is vasm. You can install it easily using Homebrew (`brew install vasm`).

The Code (split_screen.asm):

;-----------------------------------------------------
; A simple Copper List example in 68k Assembly
; Splits the screen into two colors.
;-----------------------------------------------------

CHIPMEM         equ     $000000     ; Start of Chip RAM
CUSTOM          equ     $DFF000     ; Base address of custom chips

;--- Custom Chip Registers
INTENA          equ     CUSTOM+$9A
DMACON          equ     CUSTOM+$96
COP1LCH         equ     CUSTOM+$80  ; Copper list pointer (high word)
COP1LCL         equ     CUSTOM+$82  ; Copper list pointer (low word)
COPLOC          equ     CUSTOM+$80  ; For 32-bit access
COLOR00         equ     CUSTOM+$180 ; Background color

;--- Program Start
start:
    ; --- Wait for vertical blank to safely take over ---
.waitvb
    move.l  $4,a6             ; Execbase in a6
    move.w  $DFF006,d0        ; VPOSR
    and.w   #$7F00,d0
    cmp.w   #$2C00,d0         ; Wait until end of display
    bne.s   .waitvb

    ; --- Kill the OS ---
    move.w  #$4000,INTENA(a5)   ; Disable interrupts
    move.w  #$7FFF,DMACON(a5)   ; Disable all DMA

    ; --- Set up our copper list ---
    lea     my_copper_list(pc),a0 ; Get address of our list
    move.l  a0,COPLOC(a5)       ; Point the hardware to our copper list
    move.w  #$8200,DMACON(a5)   ; Enable DMA for Copper only

    ; --- Infinite loop ---
forever:
    bra.s   forever

; --- Our Copper List ---
; It MUST be in Chip RAM, but since our whole program is tiny
; and loaded into Chip RAM, we are fine.
my_copper_list:
    ; Top half of the screen
    dc.w    COLOR00, $FFF       ; MOVE white into background color register

    ; Wait until scanline 100 ($64)
    dc.w    $6401, $FFFE        ; WAIT for vertical position 100

    ; Bottom half of the screen
    dc.w    COLOR00, $00F       ; MOVE blue into background color register

    ; End of list
    dc.w    $FFFF, $FFFE        ; Wait for an impossible position to end

How to Assemble and Test It on Your Mac:

  1. Assemble: Open Terminal, navigate to where you saved the `.asm` file, and run the vasm command: `vasmm68k_mot -Fhunk -o split_screen split_screen.asm`
  2. Set up Emulator: We'll use FS-UAE. Create a folder on your Mac (e.g., `~/Amiga/Work`). In the FS-UAE settings, go to the "Hard Drives" tab and add this folder as a hard drive. Give it a device name like `DH0` and a volume label like `Work`.
  3. Run in Emulator:
    • Start FS-UAE with a basic Amiga 500 config and your `Work` folder mounted. You'll likely need a Workbench disk in `DF0:` to boot from.
    • Once Workbench loads, you'll see your `Work` drive on the desktop. Open it, and you should see your `split_screen` executable.
    • Open the Shell or CLI from the System drawer on your Workbench disk.
    • Type `Work:split_screen` and press Enter.
  4. See the result: Your emulator screen should now show the top half white and the bottom half blue! To exit, you'll need to reset the emulator (using the menu in FS-UAE or vAmiga).

AMOS to the Rescue

If diving into 68k assembly seems a bit daunting, don't worry! The legendary AMOS Professional made playing with the Copper incredibly accessible. You can create a classic rainbow effect with just a few lines of code.

The Code:

' -- Our First AMOS Copper Rainbow --

' Hide the mouse pointer and set up a screen
Curs Off
Screen Open 0, 320, 200, 16, Lowres
Palette 0, 0, 0, 0 ' Make sure background is black

' Loop through the screen lines
For Y = 0 To 199
    ' Wait for the beam to get to the start of line Y
    Cop Wait 0, Y
    
    ' Create a colour value based on the line number
    R = (Y And 15)
    G = ((Y/16) And 15)
    B = ((Y/32) And 15)
    Colour = (R * $111) + (G * $11) + B
    
    ' Move the new colour into the background colour register ($DFF180)
    Cop Move $180, Colour
Next Y

' An empty loop to keep our program running
Do
Loop

How to Test It:

  1. Get AMOS: You can find AMOS Professional ADF (floppy disk image) files online.
  2. Use an Emulator: The easiest way to run this is with a Mac-based Amiga emulator like FS-UAE or vAmiga. Set up a basic Amiga 500 configuration with at least 1MB of Chip RAM.
  3. Load and Run: Insert the AMOS disk ADF into the virtual floppy drive (DF0:). Boot the emulator. Once you're in the AMOS editor, type in the code above and press F10 (or your Mac's equivalent) or click "Run" from the menu. You should see a beautiful, flowing rainbow of colours filling the screen!

Where to See the Copper in Action

To truly appreciate the power of the Copper, you need to see it in action. Fire up your emulator and check out some of these classics:

The Copper is a testament to the forward-thinking design of the Amiga. It's a feature that gave developers a huge amount of creative freedom and is a big reason why Amiga graphics have such a unique and timeless appeal. So next time you see a beautiful gradient sky or a clever screen effect on your Amiga, you'll know that the little co-processor that could, the Copper, is hard at work.