A.5.130 JMP: Jump
JMP imm ; E9 rw/rd [8086]
JMP SHORT imm ; EB rb [8086]
JMP imm:imm16 ; o16 EA iw iw [8086]
JMP imm:imm32 ; o32 EA id iw [386]
JMP FAR mem ; o16 FF /5 [8086]
JMP FAR mem32 ; o32 FF /5 [386]
JMP r/m16 ; o16 FF /4 [8086]
JMP r/m32 ; o32 FF /4 [386]
JMP jumps to a given address. The address may be specified as an
absolute segment and offset, or as a relative jump within the current
segment.
JMP SHORT imm has a maximum range of 128 bytes, since the displacement
is specified as only 8 bits, but takes up less code space. Recent
versions of NASM automatically generate a JMP SHORT for you when the
target is in range and known during assembling (ie, before linking).
Specifying the SHORT keyword explicitly will cause an error if the jump
target is out of range. Specifying a STRICT NEAR qualifier forces NASM
to assemble a near jump, even if the target is in range of a short jump.
You can choose between the two immediate far jump forms (JMP imm:imm)
by the use of the WORD and DWORD keywords: JMP WORD 0x1234:0x5678 or
JMP DWORD 0x1234:0x56789abc.
The JMP FAR mem forms execute a far jump by loading the destination
address out of memory. The address loaded consists of 16 or 32 bits
of offset (depending on the operand size), and 16 bits of segment.
The operand size may be overridden using JMP WORD FAR mem or
JMP DWORD FAR mem.
The JMP r/m forms execute a near jump (within the same segment),
loading the destination address out of memory or out of a register. The
keyword NEAR may be specified, for clarity, in these forms, but is not
necessary. Again, operand size can be overridden using JMP WORD mem or
JMP DWORD mem.
As a convenience, NASM does not require you to jump to a far symbol by
coding the cumbersome JMP SEG routine:routine, but instead allows the
easier synonym JMP FAR routine.