A.5.128 Jcc: Conditional Branch
Jcc imm ; 70+cc rb [8086]
Jcc NEAR imm ; 0F 80+cc rw/rd [386]
Jcc NEAR imm ; 70+(cc^1) 03 E9 rw [8086]
The conditional jump instructions execute a near (same segment) jump if
and only if their conditions are satisfied. For example, JNZ jumps only
if the zero flag is not set.
The ordinary form of the instructions has only a 128-byte range. The
single-instruction NEAR form is a 386 extension to the instruction set,
and can span the full size of a segment. When CPU is set to 386, NASM
will automatically choose the single-instruction NEAR form when the jump
exceeds the SHORT range.
When CPU is set to below 386 (any of 286, 186, 8086), recent versions of
NASM will generate two instructions to work around the range limitation.
The first instruction will be a short conditional jump of the opposite
condition code as the one desired. This first jump will (if taken) jump
to behind the second instruction, which is an unconditional near jump.
(Only the 16-bit variant is shown for this, because 32-bit assembly
means that the single-instruction form is available.)
You can override the choice of jump instruction using an explicit
SHORT keyword, which will cause an error if the jump target is out of
range. Also, an explicit STRICT NEAR qualifier makes NASM always use
the single-instruction near jump, even if not needed. (If CPU is set to
below 386, this will result in an error.) There is no way to force the
work around pair of instructions; if you want these unconditionally, you
have to code them manually.
For details of the condition codes, see section A.2.2.