<<< IRET Return from Interrupt     Index     JCXZ Jump If CX = 0 >>>


J? Jump on Condition

Flags affected:

        O D I T S Z A P C  OF: Overflow flag  TF: Trap flag AF: Aux carry
        F F F F F F F F F  DF: Direction flag SF: Sign flag PF: Parity flag
            <none>         IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

                     Descriptions                                 Jump if flags are
        JA/JNBE d   (Jump If Above/Jump If Not Below or Equal)    CF=0 AND ZF=0
        JAE/JNB d   (Jump If Above or Equal/Jump If Not Below)    CF=0
        JB/JNAE d   (Jump If Below/Jump If Not Above or Equal)    CF=1
        JBE/JNA d   (Jump If Below or Equal/Jump If Not Above)    CF=1 OR ZF=1
        JE/JZ   d   (Jump If Equal/Jump If Zero)                  ZF=1
        JNE/JNZ d   (Jump If Not Equal/Jump If Not Zero)          ZF=0
        JG/JNLE d   (Jump If Greater/Jump If Not Less or Equal)   ZF=0 OR SF=OF
        JGE/JNL d   (Jump If Greater or Equal/Jump If Not Less)   SF=OF
        JL/JNGE d   (Jump If Less/Jump If Not Greater or Equal)   SFOF
        JLE/JNG d   (Jump If Less or Equal/Jump If Not Greater)   ZF=1 OR SFOF
        JC      d   (Jump If Carry flag set)                      CF=1
        JNC     d   (Jump If Carry flag Not set)                  CF=0
        JO      d   (Jump If Overflow flag set)                   OF=1
        JNO     d   (Jump If Overflow flag Not set)               OF=0
        JP/JPE  d   (Jump If PF set/Jump if Parity Even)          PF=1
        JNP/JPO d   (Jump If PF Not set/Jump if Parity Odd)       PF=0
        JS      d   (Jump If Sign flag set)                       SF=1
        JNS     d   (Jump If Sign flag Not set)                   SF=0

        d without NEAR = 8-bit signed displacement; use NEAR before d to specify
        segment-wide displacement.

Examples:

        JB HalfSplit        ;Jumps if CF=1
        JLE TooLow          ;Jumps if either ZF=1 or SFOF
        JG NEAR WayOut      ;Jumps if greater to 16-bit displacement
                            ; in real mode or 32-bit displacement in
                            ; 32-bit protected mode.

Notes:

By default all these instructions make a short jump (127 bytes forward or 128 bytes back) if some condition is true, or fall through if the condition is not true. The conditions all involve flags, and the flag conditions in question are given to the right of the mnemonic and its description.

The mnemonics incorporating "above" or "below" are for use after unsigned comparisons, whereas the mnemonics incorporating "less" or "greater" are for use after signed comparisons. "Equal" and "Zero" may be used after unsigned or signed comparisons.

NASM allows use of the segmentwide form by inserting the NEAR keyword after the instruction mnemonic. In real mode this allows the use of a 16-bit signed displacement, and in 32-bit protected mode this allows the use of a 32-bit signed displacement. Use of NEAR is only supported with 386 and newer CPUs.

        r8 = AL AH BL BH CL CH DL DH        r16 = AX BX CX DX BP SP SI DI
        sr = CS DS SS ES FS GS              r32 = EAX EBX ECX EDX EBP ESP ESI EDI
        m8 = 8-bit memory data              m16 = 16-bit memory data
        m32 = 32-bit memory data            i8 = 8-bit immediate data
        i16 = 16-bit immediate data         i32 = 32-bit immediate data
        d8 = 8-bit signed displacement      d16 = 16-bit signed displacement
        d32 = 32-bit unsigned displacement


<<< IRET Return from Interrupt     Index     JCXZ Jump If CX = 0 >>>