Intel 80286, 80287 manual CMP-Compare Two Operands, Cmp

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 243
Image 243

THE 80286 INSTRUCTION SET

CMP-Compare Two Operands

Opcode

 

Instruction

Clocks

Description

3C

db

 

CMP AL,db

3

Compare immediate byte from AL

3D

dw

 

CMP AX,dw

3

Compare immediate word from AX

80

17

db

CMP

eb,db

3,mem=6

Compare immediate byte from EA byte

38

Ir

 

CMP

eb,rb

2,mem=7

Compare byte register from EA byte

83

17

db

CMP eW,db

3,mem=6

Compare immediate byte from EA word

81

17

dw

CMP eW,dw

3,mem=6

Compare immediate word from EA word

39

Ir

 

CMP eW,rw

2,mem=7

Compare word register from EA word

3A

Ir

 

CMP rb,eb

2,mem=6

Compare EA byte from byte register

38

Ir

 

CMP rW,ew

2,mem=6

Compare EA word from word regisler

FLAGS MODIFIED

Overflow, sign, zero, auxiliary carry, parity, carry

FLAGS UNDEFINED

None

OPERATION

CMP subtracts the second operand from the first operand, but it does not place the result anywhere. Only the flags are changed by this instruction. CMP is usually followed by a conditional jump instruc- tion. See the "]cond" instructions in this chapter for the list of signed and unsigned flag tests provided

by the 80286. '.

If a word operand is compared to an immediate byte value, the byte value is first sign-extended.

PROTECTED MODE EXCEPTIONS

#GP(O) for an illegal memory operand effective address in the CS, DS, or ES segments; #8S(0) for an illegal address in the SS segment.

REAL ADDRESS MODE EXCEPTIONS

Interrupt 13 for a word operand at offset OFFFFH.

8-33

Page 243
Image 243
Intel 80286, 80287 manual CMP-Compare Two Operands, Cmp