Which instructions will change the sign of the Assembly

Source: Internet
Author: User
Tags mul
http://nannan408.iteye.com/blog/970585

These books have no ready-made answers, they need to be summed up, thanks to BEYOND0769, to make such a good summary. Here are the instructions that will change the flag bit.
(1)
Addition instruction: ADD, ADC, Inc, Xadd except for the CF logo bit, which affects the condition mark bit.
CF, ZF, SF, of
Whether the CF highest bit has a rounding
DF If two operand symbols are the same and the result symbol is opposite of=1, otherwise of=0.

Subtraction instructions: SUB, SBB, DEC, NEG, CMP, Cmpxchg, cmpxchg8b
The first six kinds except dec do not affect the CF mark to affect the sign bit. CMPXHG8B only affects ZF.
CF illustrates the overflow of unsigned number subtraction, and is indeed the borrow of the highest significant bit of meiosis.
The bit indicates an overflow with a signed number
In the unsigned operation, if the meiosis > is meiosis, there is borrow cf=1, otherwise cf=0.
In the case of a two-digit symbol, and the result of the same symbol and meiosis is of=1. otherwise of=0.

Multiplication instruction: MUL, Imul
MUL: If the product is half 0, then the CF and the all bits are 0, otherwise CF and the is 1.
Imul: If the high half is the extension of the lower half sign, the CF bit and the bit are both 0, otherwise they are all 1.

Division instruction: DIV, IDIV has no definition for all conditional bits.

Logical directives: and, or, not, XOR, TEST
Not does not allow immediate numbers, other 4 directives unless the source operand is immediate, at least one operand must be stored in the register. Another operand can use any addressing method.
Not does not affect the flag bit, the remaining 4 kinds of CF, of, set 0,af undefined, SF, ZF, pf position depends.

Location Scan instruction: BSF forward bit scan, BSR reverse bit scan
The source operand can be any type of addressing other than the immediate number, and the destination operand must be a register that affects the ZF bit.

Above from: http://zhidao.baidu.com/question/130863024.html
(2) and then attach a summary of the jump conditions:
Topic:jump Conditions


Opcode Mnemonic Flags Checked Description
----------------------------------------------------------------------------

Size 0010 Jb/jnae cf=1 Jump if below/not above or
Equal (unsigned comparisons)
Size 0011 JAE/JNB cf=0 Jump if above or equal/not
Below (unsigned comparisons)
Size 0110 jbe/jna cf=1 or zf=1 Jump if below or Equal/not
Above (unsigned comparisons)
Size 0111 ja/jnbe cf=0 and zf=0 Jump if above/not below or
Equal (unsigned comparisons)
Size 0100 JE/JZ zf=1 Jump if equal (zero)
Size 0101 jne/jnz zf=0 Jump if not equal (not zero)
Size 1100 Jl/jnge SF <> of Jump if less/not greater or
Equal (signed comparisons)
Size 1101 Jge/jnl sf=of Jump if greater or equal/not
Less (signed comparisons)
Size 1110 jle/jng zf=1 or SF <> of Jump if less or equal/not
Greater (signed comparisons)
Size 1111 Jg/jnle zf=0 and sf=of Jump if greater/not less or
Equal (signed comparisons)
Size 1000 JS sf=1 Jump if sign
Size 1001 Jns sf=0 Jump if not sign
Size 0010 JC cf=1 Jump if carry
Size 0011 JNC cf=0 Jump if not carry
Size 0000 JO of=1 Jump if overflow
Size 0001 jno of=0 Jump if not overflow
Size 1010 JP/JPE pf=1 Jump if parity/parity even
Size 1011 Jnp/jpo pf=0 Jump if no parity/parity odd
----------------------------------------------------------------------------

Note:the size bits are 0111 for short jumps or 1000 for 80386/486
Near jumps.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.