KS57C2308/P2308/C2316/P2316 SAM47 INSTRUCTION SET
5-49
CPSE Compare and Skip if Equal
CPSE dst,src
Operation: Operand Operation Summary Bytes Cycles
R,#im Compare and skip if register equals #im 22 + S
@HL,#im Compare and skip if indirect data memory equals #im 22 + S
A,R Compare and skip if A equals R 22 + S
A,@HL Compare and skip if A equals indirect data memory 11 + S
EA,@HL Compare and skip if EA equals indirect data memory 22 + S
EA,RR Compare and skip if EA equals RR 22 + S
Description: CPSE compares the source operand (subtracts it from) the destination operand, and skips the
next instruction if the values are equal. Neither operand is affected by the comparison.
Operand Binary Code Operation Notation
R,#im 11011001Skip if R = im
d3 d2 d1 d0 0 r2 r1 r0
@HL,#im 11011101Skip if (HL) = im
0 1 1 1 d3 d2 d1 d0
A,R 11011101Skip if A = R
01101r2 r1 r0
A,@HL 00111000Skip if A = (HL)
EA,@HL 11011100Skip if A = (HL), E = (HL+1)
00001001
EA,RR 11011100Skip if EA = RR
11101r2 r1 0
Example: The extended accumulator contains the value 34H and register pair HL contains 56H. The
second instruction (RET) in the instruction sequence
CPSE EA,HL
RET
is not skipped. That is, the subroutine returns since the result of the comparison is “not equal”.