movec

Move control register Privileged68010

Copies a control register to a data or address register, or copies a data or address register to a control register.

Size .l68010 and 68020 only: select opt p=68010 before any code or data

XNZVC –––––
  • Changes no flag

Forms

Operands

Rc
A control register: on the 68010 vbr, the vector base register, where the vector table starts; sfc or dfc, the source or destination function code; or usp, the user stack pointer. The 68020 adds msp and isp, its master and interrupt stack pointers, and cacr and caar, its cache registers. More
Rn
A data or address register, d0 to d7 or a0 to a7. More

On the 68010, it accesses vbr (vector base), sfc and dfc (function codes), and usp (user stack pointer). After movec d0, vbr, exception vectors are read from VBR + 4 × the vector number. See the 68010 vector table. The transfer is always long, preserves the flags and requires supervisor mode.

The 68020 adds msp and isp, the master and interrupt stack pointers. In supervisor mode, the M bit of sr selects which one is a7. Initialize msp with movec before setting M. It starts at zero. See master and interrupt stacks.

The 68020 also adds cacr and caar, the cache control and cache address registers. The editor does not simulate a cache. cacr retains only bits 0 and 1 of a written value. caar retains all 32 bits.

opt p=68010
* --- Move the vector table to $8000 ---
move.l #div_zero, $8000+5*4 ; vector 5 of the new table
move.l #$8000, d0
movec d0, vbr ; from now on, vectors are read at $8000
moveq #0, d1
divu d1, d0 ; division by zero: the handler at $8014 runs
movec vbr, d2 ; read it back: d2 = $8000
bra END

div_zero:
    moveq #-1, d0
    rte

END: