Skip to content
Game 0 Unit 2 of 19 1 hr learning time

MOVE Is the Verb

Meet the 68000's workhorse. Where 8-bit machines had separate load and store, the 68000 has one instruction — MOVE — that carries a value from almost anywhere to almost anywhere. Use it to drive the colour from the CPU.

11% of Meet The Machine

Last time the colour was baked into the Copper list. This time the CPU puts it there — so let's meet the instruction that does almost all the work on a 68000.

If you've used an 8-bit chip, you learned two instructions for shuffling values about: a load (fetch into a register) and a store (write back out). The 6502 even had three loads, one per register. The 68000 sweeps all of that into one verb: MOVE. It carries a value from a source to a destination, and the source and destination can be almost anything — a number, a register, a place in memory:

  • move.w #$00f0,d0 — an immediate number into a register (# means "the number itself")
  • move.w d0,d1 — one register into another
  • move.w d0,colourval — a register into memory
  • move.w colourval,d0memory back into a register

One instruction, every direction. Learn MOVE and you can already read most of what a 68000 program does.

What you'll see by the end

The Amiga screen filled with solid green.
Green — but the point is how it got there: the CPU moved the value into a register, then into the Copper's colour slot.

A green screen. The colour isn't the point this time; how it arrived is. The CPU moved $00f0 into a register, then moved that register into the slot the Copper reads for its colour. Two MOVEs, and the screen followed.

The harness has a slot now

The harness is Unit 1's, with one change: the Copper's colour is no longer a fixed number — it's a labelled slot, colourval, that the CPU writes into. (The Copper re-reads its list every frame, so whatever the CPU leaves in that slot is what paints the screen.) Your job is to put a colour there.

;──────────────────────────────────────────────────────────────
; Meet the Machine (Amiga) - Unit 2: MOVE Is the Verb
;
; Same harness as Unit 1 — but now the colour the Copper shows is one the CPU
; writes into the list. The YOUR CODE block uses MOVE, the 68000's workhorse,
; to put a value into a register and then into memory. Whatever colour you
; leave in the Copper's colour slot is what fills the screen.
;──────────────────────────────────────────────────────────────

CUSTOM      equ $dff000

DMACON      equ $096
INTENA      equ $09a
INTREQ      equ $09c
COP1LC      equ $080
COPJMP1     equ $088
BPLCON0     equ $100
COLOR00     equ $180

            section code,code_c

start:
            lea     CUSTOM,a5
            move.w  #$7fff,INTENA(a5)
            move.w  #$7fff,INTREQ(a5)
            move.w  #$7fff,DMACON(a5)
            lea     copperlist,a0
            move.l  a0,COP1LC(a5)
            move.w  d0,COPJMP1(a5)
            move.w  #$8280,DMACON(a5)

            ; ----------------------------------------------- YOUR CODE START
            move.w  #$00f0,d0           ; immediate -> register: green into d0
            move.w  d0,colourval        ; register -> memory: d0 into the slot
            ; ------------------------------------------------- YOUR CODE END

forever:
            bra.s   forever

;──────────────────────────────────────────────────────────────
; The Copper list. Its colour word is a labelled slot the CPU fills in.
;──────────────────────────────────────────────────────────────
copperlist:
            dc.w    BPLCON0,$0200       ; 0 bitplanes - show only the background
            dc.w    COLOR00             ; the register the Copper writes...
colourval:
            dc.w    $0000               ; ...with this value (the CPU sets it)
            dc.w    $ffff,$fffe         ; end of the Copper list

Read the two lines in the YOUR CODE block:

move.w  #$00f0,d0       ; immediate -> register: green into d0
move.w  d0,colourval    ; register -> memory: d0 into the slot

The first MOVE loads a value; the second stores it. On an 8-bit chip those were different instructions. Here they're the same instruction, pointed different ways — that's the whole idea of MOVE. The .w on the end means "move a word" (16 bits); we meet sizes properly next unit.

d0 is one of the data registersd0 through d7, eight of them, far more elbow room than an 8-bit chip's two or three. We'll meet the whole register file in Unit 4; for now, d0 is just a handy place to hold a value on its way through.

Assemble, master, and run

make

A green screen — the colour the CPU moved into the slot.

Try this: a different colour

Change #$00f0 to another $0RGB colour — $0f00 red, $000f blue, $0ff0 yellow — then make and run. You're changing the value the first MOVE loads; the second MOVE carries whatever it is to the screen.

Try this: skip the register

You don't need the register here — MOVE can go straight from an immediate to memory. Replace the two lines with one:

    move.w  #$00f0,colourval    ; immediate -> memory, in a single MOVE

Same green screen. We used d0 to make the "register → memory" step visible, but MOVE is happy to carry a value all the way in one go. (Open the register view and run the two-line version step by step to watch d0 take the value, then hand it on.)

If it doesn't work

  • vasm errors on a move line. Check the size suffix (move.w, not move) and the comma between source and destination. The order is source, destination — left to right, the value flows rightward.
  • The screen is black. The colour never reached the slot — make sure the second MOVE's destination is colourval, the label on the Copper's colour word.
  • The colour is wrong. Check the $0RGB value in the first MOVE. The harness shows exactly what lands in colourval.

What you've learnt

The 68000 has one verb for shuffling values: MOVE, source then destination, carrying a value between immediates, registers and memory — no separate load and store. And it has roomy data registers d0d7 to hold values along the way.

What's next

That .w we kept tacking on is doing real work. Next — Bytes, Words and Longs — we meet the idea that makes the 68000 a 16/32-bit machine: a value can be a byte, a word, or a long, and you choose the size every time you move one.