MOVE Instruction



The instruction MOVE copies a byte, word, or longword from one effective address to another. The flags are set according to the data moved.

ADDRESS METHODS (source): Dn, An, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l

x(PC), x(PC,xr.s), #x

ADDRESS METHODS (for the destination): Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l

The address method An can only be used when the data length is a word or a longword.

FLAGS: X - U
N - S
Z - S
C - 0
V - 0

SYNTAX: MOVE <ea>,<ea>

The instruction MOVEA moves data to an address register (An is, as you may have noticed missing in address methods for the destination). Most assemblers choose MOVEA is you have an address register as an operand.

EXAMPLE CODE:

    MOVE.B    D0,D1       moves the lower 8 bits of D0 to D1, does not change the upper 24 bits of D0 or D1
    MOVE.W   D0,D1       moves the lower 16 bits of D0 to D1, does not change the upper 16 bits of D0 or D1
    MOVE.L    D0,D1        moves all 32 bits of D0 to D1

MOVE to CCR



If you specify CCR as the destination, the lower byte of a word is copied to the flag register (CCR). The flags do are not affected by the result, i.e. if you clear the flag register the Z flag won't be set.

ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l,x(PC), x(PC,xr.s), #x

DATA LENGTH: Word

FLAGS: Set according to the bits of the byte you moved to CCR.

SYNTAX: MOVE <ea>,CCR

EXAMPLE CODE:

     MOVE    D0,CCR        moves the lower 16 bits of D0 into the CCR

MOVE to SR



If you specify SR as the destination, a word is moved to the status register (i.e. the system byte and the flag byte). The instruction requires that the supervisor bit is set. The instruction can be used to change the T-bit (trace), S-bit (supervisor), the interrupt mask and the flags. Note that with Fargo II, to get into supervisor mode, you should use the trap #1.

If you only want to change the flags, you should use MOVE to CCR instead, which also works if you are in user mode.



ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l, x(PC), x(PC,xr.s), #x

DATA LENGTH: Word

FLAGS: Set according to the lower bits in the word you moved to SR.

SYNTAX: MOVE <ea>,SR

EXAMPLE CODE:

   MOVE.W    D0,SR    *Moves the lower word in D0 to the SR

MOVE from SR



This instruction copies the whole status register to an operand with the size of a word. It requires that you are in supervisor mode (the S-bit in SR must be set).

ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l

DATA LENGTH: Word

FLAGS: Unaffected

SYNTAX: MOVE SR,<ea>

EXAMPLE CODE:

   MOVE.W    SR,D0    *Moves the SR into the lower word of D0