
Chapter 5. Application instructions
5-16
5.3
Comparison instructions
5.3.1
CMP, CMPP, DCMP, DCMPP
CMP
(Compare)
FUN(50) CMP
FUN(52) DCMP
FUN(51) CMPP
FUN(53) DCMPP
Applicable
CPU
All CPUs
Available Device
Flag
Instructions
M
P
K
L
F
T
C
S
D
#D Integer
Steps
Error
(F110)
Zero
(F111)
Carry
(F112)
O O O O O O O
O
O
O
CMP(P)
DCMP(P)
O O O O O
O
O
O
O
O
5 / 9
O
1) Functions
-
Compares contents of two devices specified at [ S1 ] and [ S2 ].
-
After comparing, set corresponding flag among F120 ~ F125.
F120
F121
F122
F123
F124
F125
Flag
<
≤
=
>
≥
≠
>
0
0
0
1
1
1
<
1
1
0
0
0
1
=
0
1
1
0
1
0
-
Above flags indicate the result of CMP instruction executed at last.
-
The error flag (F110) is set when [ S1 ] or [ S2 ] specified as #D format is over device range. The
instruction at which error occurred is not executed.
Operand setting
S1
CMP
CMPP
DCMP
DCMPP
Data to be compared
S2
S1
S1
S2
S2
S1
S2
S1
S2
S1
S2
S1
S2