MOVE <EA>,<EA> ^ ^ | | | +--- Source operand 2 and Destination +-------- Source operand 1 |
Dn - Data register direct (n = 0, 1, 2, 3, 4, 5, 6, 7) An - Addr register direct (n = 0, 1, 2, 3, 4, 5, 6, 7) N - Memory direct: (N = a constant number (= address in memory))NOTE: labels can be (and are often) used instead of a constant number, because labels are always equated to a constant number by the assembler ! |
|
(1) MOVE.B D1, D0 move byte from D1 into D0 (2) MOVE.B 0, D0 move byte at memory address 0 into D0 (3) MOVE.W 0, D0 move word (short) at memory address 0 into D0 (4) MOVE.L 100, D0 move long word (int) at memory addr 100 into D0 |
MOVE.L A,D0 move the first element of array A (A[0]) ... into D0 ... A: DS.L 10 int A[10] |
Contrast the result with the immediate mode:
MOVE.L #A,D0 move the address of the array A (which is equal to the address of the first element of A (A[0]) in D0 ... ... A: DS.L 10 int A[10] |
000000 203C MOVE.L #A,D0 0000 000C 000006 2039 MOVE.L A,D0 0000 000C 00000C A: DS.L 1 000010 END
|
|
M68000 uses big endian
Example:
move.l #-5, d0 move.l d0, 5672 move.l 5672, d1 d1 = -5 move.w 5672, d2 word operand in d2 = -1 !!! move.b 5672, d3 byte operand in d3 = -1 !!! |
(static) int A, B, C; C = A + B;is equivalent the following in M68000 assembler language:
MOVE.L A,D0 Get value in memory location A into D0 MOVE.L B,D1 Get value in memory location B into D1 ADD.L D0,D1 Now D1 has the sum MOVE.L D1,C Put the sum (D1) in memory location C ... ... A: DS.L 1 B: DS.L 1 C: DS.L 1
NOTE: we put the variables at the END to prevent them from being "fetched and executed as instructions"
move.l A, d0 is correct ... A: dc.l -4But don't be surpised to be the wrong value if you use a different operand size:
move.w A, d0 is INCORRECT !!! ... A: dc.l -4