3. Instructions
262
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Flags
Note In CS1D CPU Units for Duplex Systems, CS1 CPU Units, and CJ1 CPU Units, these are turned OFF.
z
The following table shows the status of the Arithmetic Flags after execution of CMP(020).
*A status of “---” indicates that the Flag may be ON or OFF.
z
The following table shows the status of the Arithmetic Flags after execution of CMPL(060)
.
*A status of “---” indicates that the Flag may be ON or OFF.
Function
z CMP
CMP(020) compares the unsigned binary data in S
1
and S
2
and outputs the result to Arithmetic Flags
(the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and Not Equal
Flags) in the Auxiliary Area.
z CMPL
CMPL(060) compares the unsigned binary data in S
1
+1, S
1
and S
2
+1, S
2
and outputs the result to
Arithmetic Flags (the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and
Not Equal Flags) in the Auxiliary Area.
Name
CX-Programmer
label
Operation
CMP CMPL
Error Flag ER Unchanged (See note.) Unchanged (See note.)
Greater Than Flag > • ON if S
1
> S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
> S
2
+1, S
2
.
• OFF in all other cases.
Greater Than or Equal Flag > = • ON if S
1
≥ S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
≥ S
2
+1, S
2
.
• OFF in all other cases.
Equal Flag = • ON if S
1
= S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
= S
2
+1, S
2
.
• OFF in all other cases.
Not Equal Flag = • ON if S
1
≠ S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
≠ S
2
+1, S
2
.
• OFF in all other cases.
Less Than Flag < • ON if S
1
< S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
< S
2
+1, S
2
.
• OFF in all other cases.
Less Than or Equal Flag < = • ON if S
1
≤ S
2
.
• OFF in all other cases.
•ON if S
1
+1, S
1
≤ S
2
+1, S
2
.
• OFF in all other cases.
Negative Flag N Unchanged (See note.) Unchanged (See note.)
CMP(020) Result
Flag status
> > = = < = < < >
S
1
> S
2
ON ON OFF OFF OFF ON
S
1
= S
2
OFFONONONOFFOFF
S
1
< S
2
OFF OFF OFF ON ON ON
CMPL(060) Result
Flag status
> > = = < = < < >
S
1
+1, S
1
> S
2
+1, S
2
ON ON OFF OFF OFF ON
S
1
+1, S
1
= S
2
+1, S
2
OFFONONONOFFOFF
S
1
+1, S
1
< S
2
+1, S
2
OFF OFF OFF ON ON ON
S1 S2
(>, >=, =, <=, <, <>)
Unsigned binary
comparison
Arithmetic Flags
S1S1+1 S2S2+1
(>, >=, =, <=, <, <>)
Unsigned binary
comparison
Arithmetic Flags