Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
D5 11A2B3C4D
D5 11A2B3C4D
CLR.W D5
CLR.L D5
D5 1A2B0000
D5 00000000
Absolute long
XXXXXX
Immediate
#XXX
Data register
direct
Address register
direct
Address register
indirect (ARI)
ARI with postincrement
ARI with predecrement
ARI with
displacement
ARI with index
Dn
An
(An)
(An)+
-(An)
d(An)
d(An,Rn)
d(PC)
d(PC,Rn)
PC Rel with
displacement
PC Rel with
index
Allowed
op. size
Allowed modes/classes
Source
Destination
CCR bits
N Z V C X
EXG Rx,Ry
L only
Dn or An
Dn or An
- - - - -
CLR <ea>
B, W, L
Data alt
0 1 0 0 -
LEA <ea>,An
L only
Control
An
- - - - -
MOVE <ea>,<ea>
B, W, L
All
Data alt
* * 0 0 -
MOVE <ea>,CCR
W only
Data
CCR
* * * * *
MOVE <ea>,SR
W only
Data
SR
* * * * *
MOVE SR,<ea>
W only
SR
Data alt
- - - - -
Move An.USP
L only
An
USP
- - - - -
MOVE USP,An
L only
USP
An
- - - - -
MOVEA <ea>,An
W,L
All
An
- - - - -
MOVEM list,<ea>
W, L
Dn list
- - - - -
MOVEM <ea>,list
W, L
Control or (An)+
Dn list
- - - - -
MOVEP Dx,d(Av)
W,L
Dn
d(An)
- - - - -
MOVEP d(Ax),Dy
W,L
d(An)
Dn
- - - - -
MOVEQ #<data>,Dn
L only
Imm
Dn
* * 0 0 -
SWAP Dn
Wonly
Dn
* * 0 0 -
The test instruction (TST) subtracts 0 from the value of the operand.
This instruction is used to update CCR bits N and Z to reflect the value of
the operand, whether it is positive or negative, 0 or non-0. The related
instruction, test and set (TAS), operates only on a byte-sized operand in a
similar fashion but it also sets the highest bit in the operand byte. The test
and set operation is indivisible and may not be interrupted. It is used to
synchronize the operations of a multi-processor system.
Extend (EXT) sign extends the value of the operand in a designated
data register from 8 to 16 bits (.W) or from 16 to 32 bits (.L). This
instruction converts an 8-bit signed number into a 16-bit signed number
or a 16-bit signed number into a 32-bit signed number by copying the
sign bit from the original number into every extended bit position.
The instructions "arithmetic shift left" and "arithmetic shift right" can
be used to perform simple multiply and divide operations. Arithmetic
shift left (ASL) shifts the pattern in the destination to the left while
bringing 0s to the right end. The last bit shifted out shifts into the carry
and the extend flags.
Each bit-shift to the left doubles the weight of each position in the
original binary number, so the effect of this instruction is to multiply the
destination value by an integer power of 2.
Arithmetic shift right (ASR) shifts the pattern right while bringing a
copy of bit 7 (the sign bit) into the leftmost position. This operation
results in dividing the value by an integer power of 2 while preserving
the sign.
Decimal arithmetic is supported by two instructions, add and subtract
decimal extended (ABCD and SBCD). These instructions add or
subtract the (single-byte only) operands along with the extend bit, as in
the case of the extended binary operations. However, both operands
must be valid eight-bit BCD numbers and the BCD result is stored in the
destination location.
The sign of a single-byte BCD operand may be changed with the
instruction NBCD, negate decimal extended. The sign of the destination
operand is changed by subtracting it and the extend bit from 0 and
storing the result in the destination location.
Two versions each of the multiply and divide instructions provide
both signed and unsigned operations, word size only. The multiply
instructions (MULS and MULU) multiply two 16-bit operands and load
the 32-bit product into a destination data register. The divide instructions
(DIVS and DIVU) divide the 32-bit destination operand by the 16-bit
source operand and load the quotient into the lower half of a destination
data register and the remainder into the upper half.
Dn
? * *
ABCD -(Ax),-(Ay)
ADD <ea>,Dn
ADD Dn,<ea>
ADDA <ea>,An
ADDI #<data>,<ea>
ADDQ ^<data>,<ea>
ADDX Dx,Dy
ADDX -(Ax),-(Ay)
ASd Dx,Dy
ASd #<data>,Dn
ASd <ea>
CMP <ea>,Dn
CMPA <ea>,An
CMPI #<data>,<ea>
CMPM (Ax)+,(Ay)+
DIVS <ea>,Dn
DIVU <ea>,Dn
EXTDn
MULS <ea>,Dn
MULU <ea>,Dn
NBCD <ea>
NEG <ea>
NEGX <ea>
SBCD Dx,Dy
SBCD -(Ax),-(Ay)
SUB <ea>,Dn
SUB Dn, <ea>
SUBA <ea>,An
SUBI #<data>,<ea>
SUBQ #<data>,<ea>
SUBX Dx, Dy
SUBX -(Ax),-(Ay)
TAS <ea>
TST <ea>
-(An)
All
Dn
All
Imm
Imm
Dn
-(An)
Dn
Imm
All
All
Imm
(An)+
Data
Data
Data
Data
Dn
-(An)
All
Dn
All
Imm
Imm
Dn
-(An)
-(An)
Dn
Alt mem
An
Data alt
Alt
Dn
-(An)
Dn
Dn
Mem alt
Dn
An
Data alt
(An)+
Dn
Dn
Dn
Dn
Dn
Data alt
Data alt
Data alt
Dn
-(An)
Dn
Alt mem
An
Data alt
Alt
Dn
-(An)
Data alt
Data alt
?
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
?
*
*
?
?
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
?
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
0
0
0
?
*
*
?
?
*
*
*
*
*
*
0
0
B only
B, W, L
B, W, L
W, L
B, W, L
B, W, L
B, W, L
B, W, L
B, W, L
B, W, L
Wonly
B, W, L
W, L
B, W, L
B, W, L
Wonly
Wonly
W, L
Wonly
Wonly
B only
B, W, L
B, W, L
B only
B only
B, W, L
B, W, L
W, L
B, W, L
B, W, L
B,W,L
B,W,L
B only
B,W,L
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
0
0
0
0
0
*
*
*
*
*
*
*
*
*
*
*
0
0
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
The logic shift and rotate instructions are similar in format to the
arithmetic shift instructions. They shift the bits in the destination pattern
and the X and C bits in the CCR.
The logic shift left instruction (LSL) shifts the pattern left while
bringing a 0 in from the right. The bits shifted out from the most
significant position go to both the carry and the extend flags. The logic
shift right instruction (LSR) shifts the pattern right while bringing a 0 in
from the left. The rightmost bits shift into the carry and the extend.
The rotate left instruction (ROL) shifts the pattern left while bringing
the most significant bit into the carry and also back into the least
significant position, thus rotating the target data pattern.
The rotate with extend instructions (ROXL and ROXR) include the
extend bit in the rotation of the pattern, thus rotating a 9-, 17- or 33- bit
pattern. In other respects, including the shifting of the end bit into the
carry, these instructions are identical to the rotate instructions.
Four instructions allow the programmer to focus on an individual bit
in the destination operand. The instructions are: test a bit and clear it
(BCLR); test a bit and set it (BSET); test a bit and change it (BCHG),
which complements the bit; and test a bit (BTST), which leaves the bit
unchanged.
10
CCR bits
N Z V C
* * 0 0
* * 0 0
* * 0 0
* * * *
* * * *
- * - - * - - * - * - * * 0 0
* * 0 0
* * * *
* * * *
* * 0 *
* * 0 *
* * 0 *
* * 0 0
* * 0 0
* * 0 0
* * 0 0
* * * *
* * * *
* * 0 *
* * 0 *
* * 0 *
* * 0 *
* * 0 *
* * 0 *
X
*
*
*
*
*
*
*
*
*
*
*
*
11
12
Word description
Do if:
carry bit is clear
carry bit is set
equal (to 0)
false (never do it)
greater than or equal
greater than
higher than
less than or equal
lower than or the same
less than
minus
not equal (to 0)
plus
true (always do it)
no overflow
overflow
Test
C=0
C=1
s = m (Z = 1)
always false
m > s (signed)
m > s (signed)
m > s (unsigned)
m < s (signed)
m < s (unsigned)
m < s (signed)
N=1
m s (Z = 0)
N=0
always true
V=0
V=1