moves

Move address space Privileged68010

Moves a byte, word or long between a register and memory in a selected address space.

Sizes .b .w .l, .w by default68010 and 68020 only: select opt p=68010 before any code or data

XNZVC –––––
  • Changes no flag

Forms

Operands

Rn
A data or address register, d0 to d7 or a0 to a7. More
<ea>
An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With opt p=68020, an allowed d(An,Xn) or d(PC,Xn) mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More

On the 68010 and 68020, each memory access has a three-bit function code: moves reads using sfc and writes using dfc, which movec sets. An operating system can use this to access a user program’s separate address space.

The editor has a single address space, so moves accesses the same bytes as move for every sfc or dfc value. One operand must be a data or address register and the other writable memory. A byte or word loaded into an address register is sign-extended to long. A data-register destination keeps the bits above the selected size unchanged. The flags are unchanged. moves requires supervisor mode and raises a privilege violation in user mode.

opt p=68010
* --- Reach the memory of user data from supervisor code ---
moveq #1, d0 ; function code 1: user data
movec d0, sfc ; moves reads from user data
movec d0, dfc ; and writes to user data
lea buffer, a0
move.w #$1234, d1
moves.w d1, (a0) ; write the word
moves.w (a0), d2 ; read it back: d2 = $1234
bra END

buffer:
    ds.w 1

END: