CMP
COMPARE
CMP
Encoding:
Memory or Register Operand with Register Operand:
I
00111
0 d w I
mod
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:
I
00111
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
register, register 3
-
register, memory
9(13)
+
EA
-
memory, register
9(13)
+EA
-
register, immediate
rif
-
memory, immediate 10(14)+
EA
-
accumulator, immediate
4
-
Bytes CMP Coding Examples
2 CMP
BX,
CX
2-4
CMP
OH,
ALPHA
2-4
CMP [BP + 2],
SI
3-4
CMP BL,
02H
3-6
CMP
[BX].RAOAR
[01],
3420H
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