KS57C2308/P2308/C2316/P2316SAM47 INSTRUCTION SET

CPSE — Compare and Skip if Equal

CPSE

dst,src

 

 

 

 

 

 

 

 

Operation:

Operand

Operation Summary

Bytes

Cycles

 

 

 

 

 

 

R,#im

Compare and skip if register equals #im

2

2 + S

 

 

 

 

 

 

@HL,#im

Compare and skip if indirect data memory equals #im

2

2 + S

 

 

 

 

 

 

A,R

Compare and skip if A equals R

2

2 + S

 

 

 

 

 

 

A,@HL

Compare and skip if A equals indirect data memory

1

1 + S

 

 

 

 

 

 

EA,@HL

Compare and skip if EA equals indirect data memory

2

2 + S

 

 

 

 

 

 

EA,RR

Compare and skip if EA equals RR

2

2 + 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

1

1

0

 

1

1

 

0

0

1

Skip if R = im

 

 

 

 

 

 

 

 

 

 

 

 

 

d3

d2

d1

 

d0

0

 

r2

r1

r0

 

 

 

 

 

 

 

 

 

 

 

 

 

@HL,#im

1

1

0

 

1

1

 

1

0

1

Skip if (HL) = im

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

1

 

1

d3

 

d2

d1

d0

 

 

 

 

 

 

 

 

 

 

 

 

 

A,R

1

1

0

 

1

1

 

1

0

1

Skip if A = R

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

1

 

0

1

 

r2

r1

r0

 

 

 

 

 

 

 

 

 

 

 

 

 

A,@HL

0

0

1

 

1

1

 

0

0

0

Skip if A = (HL)

 

 

 

 

 

 

 

 

 

 

 

 

EA,@HL

1

1

0

 

1

1

 

1

0

0

Skip if A = (HL), E = (HL+1)

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

 

0

1

 

0

0

1

 

 

 

 

 

 

 

 

 

 

 

 

 

EA,RR

1

1

0

 

1

1

 

1

0

0

Skip if EA = RR

 

 

 

 

 

 

 

 

 

 

 

 

 

1

1

1

 

0

1

 

r2

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”.

5-49

Page 123
Image 123
Samsung KS57C2308 manual Cpse Compare and Skip if Equal, Cpse EA,HL RET