287
Comparison Instructions
Section 5-19
Precautions
Placing other instructions between CPS(––) and the operation which
accesses the EQ, LE, and GR flags may change the status of these flags. Be
sure to access them before the desired status is changed.
Flags
ER:
Indirectly addressed EM/DM word is non-existent.
(Content of
*
EM/
*
DM word is not BCD, or the EM/DM area boundary
has been exceeded.)
EQ:
ON if Cp1 equals Cp2.
LE:
ON if Cp1 is less than Cp2.
GR:
ON if Cp1 is greater than Cp2.
Example
In the following example, the content of 102 is greater than that of DM 0020,
so 10000 is turned ON and the other bits, 10001 and 10002, are turned OFF.
5-19-7 DOUBLE SIGNED BINARY COMPARE – CPSL(––)
Comparison result
Flag status
GR (SR 25505)
EQ (SR 25506)
LE (SR 25507)
Cp1 < Cp2
0
0
1
Cp1 = Cp2
0
1
0
Cp1 > Cp2
1
0
0
CPS(
−−
)
DM 0020
102
00500
25505
10000
25507
10002
TR
0
25506
10001
Greater Than
Equal
Less Than
000
Address
Instruction
Operands
00000
LD
00500
00001
OUT
TR
0
00002
CPS(
−−
)
102
DM
0020
000
00003
AND
25505
00004
OUT
10000
00005
LD
TR
0
00006
AND
25506
00007
OUT
10001
00008
LD
TR
0
00009
AND
25507
00010
OUT
10002
Cp2: DM 0020
A
E
3
5
>
Cp1: 102
6
F
A
4
(28,580 decimal)
(
−
20,939 decimal)
Cp1
:
First compare word
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Cp2
:
Second compare word
IR, SR, AR, DM, EM, HR, TIM/CNT, LR, #
Ladder Symbols
Operand Data Areas
CPSL(
−−
)
Cp1
Cp2
000
000
Not used. Set to 000.