3 INSTRUCTION SET

CP XH,i

Compare immediate data i with XH

Source Format:

CP XH,i

 

 

 

 

 

 

 

Operation:

XH - i3 to i0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

OP-Code:

1

0

1

0

0

1

0

0

i3

i2

i1

i0

A40H to A4FH

 

MSB

 

 

 

 

 

LSB

Type:

IV

 

 

 

 

 

 

 

Clock Cycles:

7

 

 

 

 

 

 

 

 

 

 

 

 

Flag:

C – Set if XH < i3 to i0; otherwise, reset.

 

Z – Set if XH = i3 to i0; otherwise, reset.

 

D – Not affected

 

 

 

 

 

 

 

 

I – Not affected

 

 

 

 

 

 

 

Description: Compares immediate data i to XH by subtracting i from the contents of XH. XH remains unchanged.

1.When Z = 0 and C = 0 then i < XH

2.When Z = 1 and C = 0 then i = XH

3.When Z = 0 and C = 1 then i > XH

Example:

 

CP XH,2

 

 

CP XH,4

 

CP XH,9

 

XH register

0100

 

0100

 

0100

 

0100

 

C flag

1

 

0

 

0

 

1

 

Z flag

0

 

0

 

1

 

0

CP XL,i

Compare immediate data i with XL

 

Source Format:

CP XL,i

 

 

 

 

 

 

 

 

Operation:

XL - i3 to i0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

OP-Code:

1

 

0

1

0

0

1

0

1

i3

i2

i1

i0

 

A50H to A5FH

 

MSB

 

 

 

 

 

LSB

 

Type:

IV

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Clock Cycles:

7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flag:

C – Set if XL < i3 to i0; otherwise, reset.

 

 

Z – Set if XL = i3 to i0; otherwise, reset.

 

 

D – Not affected

 

 

 

 

 

 

 

 

 

I

– Not affected

 

 

 

 

 

 

 

 

Description: Compares immediate data i to XL by subtracting i from the contents of XL. XL remains unchanged.

1.When Z = 0 and C = 0 then i < XL

2.When Z = 1 and C = 0 then i = XL

3.When Z = 0 and C = 1 then i > XL

Example:

 

CP XL,7

 

 

CP XL,9

 

CP XL,0AH

 

XL register

1001

 

1001

 

1001

 

1001

 

C flag

0

 

0

 

0

 

1

 

Z flag

0

 

0

 

1

 

0

36

EPSON

S1C6200/6200A CORE CPU MANUAL