Download H8 5XX Programming

Transcript
2.2.13 CMP
(1) CMP:G (CoMPare, General format)
CoMPare
CMP:G
<Operation>
Set CCR according to result of (EAd) – #IMM
Set CCR according to result of Rd – (EAs)
<Condition Code>
N
Z
V
C
↕
↕
↕
↕
<Assembly-Language Format>
N: Set to "1" when the result is negative;
otherwise cleared to "0."
Z: Set to "1" when the result is zero;
otherwise cleared to "0."
V: Set to "1" if an overflow occurs;
otherwise cleared to "0."
C: Set to "1" if a borrow occurs;
otherwise cleared to "0."
CMP:G #xx,<EAd>
CMP:G <EAs>,Rd
(Example)
(1)
(2)
CMP:G.B #H'AA,@–R3
CMP.B #H'AA,@–R3*
<Operand Size>
Byte
Word
<Description>
This instruction subtracts the source operand from the destination operand and sets or clears the
condition code (CCR) according to the result. It does not alter the destination operand.
The CMP instruction also has short formats (CMP:E and CMP:I) that can be used to compare a
general register with immediate data.
<Instruction Format>
CMP #xx,<EAd>
CMP <EAs>,Rd
*
EA
0 0 0 0 0 1 00
data*
EA
0 0 0 0 0 1 01
data (H)*
EA
01 11 0 r r r
data (L)*
The length of the immediate data depends on the size (Sz) specified for the first operation code:
one byte when Sz = 0; one word when Sz = 1.