Before operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 10000000 | 00000000 | 00000000 | 11111111 |
+----------+----------+----------+----------+
Operation: ADD.B D0, D1
(add byte operands in D0 and D1 and store in D1)
After the operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 10000000 | 00000000 | 00000000 | 11111110 |
+----------+----------+----------+----------+
Flags in PSR:
N = 1
Z = 0
V = 0
C = 1
Before operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 10000000 | 00000000 | 00000000 | 11111111 |
+----------+----------+----------+----------+
Operation: ADD.W D0, D1
(add byte operands in D0 and D1 and store in D1)
After the operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 10000000 | 00000000 | 10000000 | 11111110 |
+----------+----------+----------+----------+
Flags in PSR:
N = 1
Z = 0
V = 1
C = 0
Before operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 10000000 | 00000000 | 00000000 | 11111111 |
+----------+----------+----------+----------+
Operation: ADD.L D0, D1
(add byte operands in D0 and D1 and store in D1)
After the operation:
+----------+----------+----------+----------+
D0 = | 10000000 | 00000000 | 01111111 | 11111111 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
D1 = | 00000000 | 00000000 | 10000000 | 11111110 |
+----------+----------+----------+----------+
Flags in PSR:
N = 0
Z = 0
V = 1
C = 1
|
|
Before operation:
+----------+----------+----------+----------+
D0 = | 00000000 | 00001001 | 10010010 | 10111000 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
A0 = | 00000000 | 00000000 | 00000000 | 00000000 |
+----------+----------+----------+----------+
Operation: MOVE.W D0, A0 (A0 is the destination)
After operation:
+----------+----------+----------+----------+
D0 = | 00000000 | 00001001 | 10010010 | 10111000 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
A0 = | 11111111 | 11111111 | 10010010 | 10111000 |
+----------+----------+----------+----------+
Flags in PSR are unchanged
Note:
|
Before operation:
+----------+----------+----------+----------+
D0 = | 00000000 | 00001001 | 10010010 | 10111000 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
A0 = | 00000000 | 00000001 | 00000000 | 00000000 |
+----------+----------+----------+----------+
Operation: MOVE.L D0, A0
After operation:
+----------+----------+----------+----------+
D0 = | 00000000 | 00001001 | 10010010 | 10111000 |
+----------+----------+----------+----------+
+----------+----------+----------+----------+
A0 = | 00000000 | 00001001 | 10010010 | 10111000 |
+----------+----------+----------+----------+
Flags in PSR are unchanged
|
Memory:
+----------+
| ........ |
Starting +----------+
address: | aaaaaaaa |
+----------+
| bbbbbbbb |
+----------+
| cccccccc |
+----------+
| dddddddd |
+----------+
| ........ |
+----------+
Byte Operand at Starting Address:
+----------+
| aaaaaaaa |
+----------+
Word Operand at Starting Address:
+----------+----------+
| aaaaaaaa | bbbbbbbb |
+----------+----------+
Long Word Operand at Starting Address:
+----------+----------+----------+----------+
| aaaaaaaa | bbbbbbbb | cccccccc | dddddddd |
+----------+----------+----------+----------+
Example:
move.l #-8, d0 Result: d0 = 11111111 11111111 11111111 11111000
move.l d0, 5672 Result in memory:
5672: 11111111
5673: 11111111
5674: 11111111
5675: 11111000
move.b 5672, d1 Will move BYTE at address 5672 (= 11111111)
into (lower 8 bits) of d1
d1 will NOT be equal to -8 !
move.w 5672, d2 Will move WORD at address 5672 (= 11111111 11111111)
into (lower 16 bits) of d1
d2 will NOT be equal to -8 !
move.l 5672, d3 d3 = -8 --- only this instruction will move -8 in a register
|
|
Example:
|
Demo: data-type.s in the demo directory.