There are many conditional transfer instructions, which are easy to confuse. Here is a record for future use.
1. Transfer according to the setting of individual condition flags
instruction | English | meaning | Format | Test conditions |
---|---|---|---|---|
JZ/JE | jump if zero/equal | The result is zero/equal and then transfer | JZ/JE OPR | ZF=1 |
JNZ/JNE | jump if not zero/equal | If the result is not zero/if not equal, it will be transferred | JNZ/JNE OPR | ZF=0 |
JS | jump if sign | If the result is negative, the transfer | JS OPR | SF=1 |
JNS | jump if not sign | The result is a regular transfer | JNS OPR | SF=0 |
JO | jump if overflow | Overflow transfer | JO OPR | OF=1 |
JNO | jump if not overflow | If it does not overflow, it will be transferred | JNO OPR | OF=0 |
JP/JPE | jump if parity/parity even | The odd and even bit is 1 transfer | JP/JPE OPR | PF=1 |
JNP/JNPE | jump if not parity/parity even | If the odd bit is 0, the transfer will be made | JNP/JNPE OPR | PF=0 |
JB/JNAE/JC | jump if below/not above、not equal/carry | Below/not higher than or not equal to/carry is 1 and transfer | JB/JNAE/JC OPR | CF=1 |
JNB/JAE/JNC | jump if not below/ above、equal/not carry | If not below/higher or equal to/carry is zero, transfer | JNB/JAE/JNC OPR | CF=0 |
Suitable for testing a certain | The result of a single operation and based on it | Different characteristics generate program branches | Different treatments | Condition |
2. Compare two unsigned numbers and transfer according to the comparison results
instruction | English | meaning | Format | Test conditions | Equivalent to |
---|---|---|---|---|---|
JB/JNAE/JC | jump if below/not above、not equal/carry | Below/not higher than or not equal to/carry is 1 and transfer | JB/JNAE/JC OPR | CF=1 | < |
JNB/JAE/JNC | jump if not below/ above、equal/not carry | If not below/higher or equal to/carry is zero, transfer | JNB/JAE/JNC OPR | CF=0 | ≥ |
JBE/JNA | jump if below/equal、not above | Less than/equal to or not higher than | JBE/JNA OPR | CF and ZF=1 | ≤ |
JNBE/JA | jump if not below/not equal、above | No less than/not equal to, and higher than, then transfer | JNBE/JA OPR | CF and ZF=0 | > |
3. Compare two signed numbers and transfer them according to the results of the comparison
instruction | English | meaning | Format | Test conditions | Equivalent to |
---|---|---|---|---|---|
JL/JNGE | jump if less、not greater/equal | Less than, not greater than/not equal to transfer | JL/JNGE OPR | SF Exclusive Or CF=1 | < |
JNL/JGE | jump if not less、greater/equal | Transfer if not less than or greater than/equal | JNL/JGE OPR | SF Exclusive Or CF=0 | ≥ |
JLE/JNG | jump if less/equal、not greater | Less than/equal to or not greater than | JLE/JNG OPR | (SF Exclusive Or CF) and ZF=1 | ≤ |
JNLE/JG | jump if not less/not equal、 greater | Not less than/not equal to or greater than | JNLE/JG OPR | (SF Exclusive Or CF) and ZF=0 | > |
4. Test that the value of CX or ECX is 0, then the transfer instruction is transferred.
1. LCXZ (jump if CX register is zero) If the content of the CX register is zero, it will be transferred.
Format: JCXZ OPR
Test conditions: (CX) = 0
2. LECXZ (jump if ECX register is zero) If the content of the ECX register is zero, it will be transferred.
Format: JECXZ OPR (386 and its successor models are available)
Test conditions: (ECX) = 0
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.