CMP COMPARE

CMP

Encoding:

Memory or Register Operand with Register Operand:

I00111 0 d w Imod reg rIm I

if d = 1 then LSRC = REG, RSRC = EA else LSRC = EA, RSRC = REG

Immediate Operand with Memory or Register Operand:

11 00000 s w I mod 111 rIm I

data

Idata if s:w=o11

LSRC= EA, RSRC = data

Immediate Operand with Accumulator:

I00111 1 0 w I

data

I data if w=1

if w = 0 then LSRC = AL, RSRC = data else LSRC = AX, RSRC = data

CMP Operands

Clocks*

Transfers

Bytes

CMP Coding Examples

register, register

3

-

2

CMP BX, CX

register, memory

9(13) + EA

-

2-4

CMP OH, ALPHA

memory, register

9(13) +EA

-

2-4

CMP [BP + 2], SI

register, immediate

rif

-

3-4

CMP BL, 02H

memory, immediate

10(14)+ EA

-

3-6

CMP [BX].RAOAR [01],

 

 

 

 

3420H

accumulator, immediate

4

-

2-3

CMP AL, 00010000B

*b(w): where b denotes the number of clock cycles for byte operands and w denotes the number of clock cycles for word operands.

2-67

Page 102
Image 102
Intel 210200-002 manual CMP Compare, Immediate Operand with Accumulator