<<< Jumps Based on a Value of Zero | Index | Anonymous Labels >>> |
Conditional jumps on the 80386 and 80486 processors cannot reference a label more than 32 kbytes away.
; Jump to target less than 128 bytes away jz target ; If previous operation resulted ; in zero, jump to target
However, if target is too distant, the following sequence is necessary to enable a longer jump. Note this sequence is logically equivalent to the preceding example:
; Jumps to distant targets previously required two steps jnz skip ; If previous operation result is ; NOT zero, jump to "skip" jmp target ; Otherwise, jump to target skip:
By default MASM enables automatic jump expansion facility:
Jump expansion is based on simple workaround:
jne $ + 2 + (length in bytes of the next instruction) jmp NEAR PTR target
See jump_expansion.asm sample program for a complete example.
<<< Jumps Based on a Value of Zero | Index | Anonymous Labels >>> |