CHAPTER 4: INSTRUCTION SET

CMP %r,%r’

Compare r reg. with r’ reg.

1 cycle

Function: r - r’

Subtracts the content of the r’ register (A or B) from the content of the r register (A or B). It changes the flags (Z and C), but does not change the content of the register.

Code:

Mnemonic

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

 

 

LSB

 

 

CMP %A,%A

 

 

1

 

1

1

 

1

 

0

0

1

1

1

X

0

0

 

0

1E70H, (1E78H)

 

CMP %A,%B

 

 

1

 

1

1

 

1

 

0

0

1

1

1

X

0

1

 

0

1E72H, (1E7AH)

 

CMP %B,%A

 

 

1

 

1

1

 

1

 

0

0

1

1

1

X

1

0

 

0

1E74H, (1E7CH)

 

CMP %B,%B

 

 

1

 

1

1

 

1

 

0

0

1

1

1

X

1

1

 

0

1E76H, (1E7EH)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flags:

E

 

I

 

C

 

 

Z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(r

r’)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(r = r’)

 

 

 

 

 

 

 

 

 

 

 

Mode:

Src: Register direct

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dst: Register direct

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Extended addressing: Invalid

 

 

 

 

 

 

 

 

 

 

 

 

 

CMP %r,imm4

Compare r reg. with immediate data imm4

1 cycle

Function: r - imm4

Subtracts the 4-bit immediate data imm4 from the content of the r register (A or B). It changes the flags (Z and C), but does not change the content of the register.

Code:

Mnemonic

 

 

 

MSB

 

 

 

 

 

 

 

 

 

 

LSB

 

 

CMP %A,imm4

 

 

1

 

1

1

1

0

0

1

0

0

i3

i2

i1

i0

1E40H–1E4FH

 

CMP %B,imm4

 

 

1

 

1

1

1

0

0

1

0

1

i3

i2

i1

i0

1E50H–1E5FH

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flags:

E

 

I

 

C

 

 

Z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Mode:

Src: Immediate data

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dst: Register direct

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Extended addressing: Invalid

 

 

 

 

 

 

 

 

 

 

 

84

EPSON

S1C63000 CORE CPU MANUAL