Implementation Details
5-48
5.10 Implementation Details
This section is C– – specific.
5.10.1 Comparisons
We use the CMP instruction for both signed and unsigned comparisons. The
two integers a and b to be compared are in A0 and A0~.
CMP A0,A0~ : A0 contains a, A0~ contains b
A0 A0~ ACO AZ ANEG
5 0 1 0 0
51100
05001
15001
00110
55110
FFFF 0 1 0 1
0 FFFF 0 0 0
FFFF FFFF 1 1 0
FFFF FFFE 1 0 0
FFFE
FFFF 0 0 1
Signed comparison of a and b. (a is in A0, b is in A0~)
Assembly Test Condition
_eq a = b AEQ
_ne a != b !AEQ
_lt a < b ALZ
_le a <= b !AGT
_ge a >= b !ALZ
_gt
a > b AGT