Professional Documents
Culture Documents
Jump instructions
Prepared by:
Group 4
(cmp)
Instruction
The Compare
compare (cmp) instruction is
identical to the sub instruction
with
one crucial semantic difference does
not retain the difference it computers
(does not stores the results); it just sets
the condition code bits in the flag
register.
The syntax for the cmp instruction
similar to that sub instruction
--------------------------------------------------------------- cmp ( LeftOperand, RightOperand );
----------------------------------------------------------
-------------cmp( ax, bx );
--------------------------------------------------------------This
instruction
performs
the
computation
AX BX and sets the
flags depending upon the result of the
computation.
ZF zero flag is set if and only if AX = BX.
The only time where AX BX produces
zero 0 result.
CF carry flag is set after a compare
operation if subtracting BX from AX
requires a borrow. (this only occurs when
DESCRIPTION
CONDITION
jc
Jump if carry
Carry = 1
jnc
Jump if no carry
Carry = 0
jz
Jump if zero
Zero = 1
jnz
Zero = 0
js
Jump if sign
Sign = 1
jns
Sign = 0
jo
Jump if overflow
Overflow = 1
jno
Jump if no overflow
Overflow = 0
jp
Jump if parity
Parity = 1
jpe
Parity = 1
jnp
Jump if no parity
Parity = 0
jpo
Parity = 0
DESCRIPTION
CONDITION
ja
Carry = 0, Zero
=0
jnbe
Carry = 0, Zero
=0
jae
Carry = 0
jnb
Carry = 0
jb
Carry = 1
jnae
Carry = 1
jbe
Carry = 1
jna
Carry = 1
je
Zero = 1
jne
Zero = 0
DESCRIPTION
CONDITION
jg
Sign =
Overflow , Zero
=0
jnle
Sign =
Overflow , Zero
=0
jge
Sign =
Overflow
jnl
Sign =
Overflow
jl
Sign <>
Overflow
jnge
Sign <>
Overflow
jle
Sign <>
Overflow , Zero
=1