jmp

8086 and later

Jump Unconditionally

jmp imm64 {abs} | jmp imm8 {short} | jmp imm | jmp imm16 {near} | jmp imm32 {near} | jmp r/m16 {near} | jmp r/m32 {near} | jmp r/m64 {near} | jmp imm16 {far} | jmp imm32 {far} | jmp imm16:imm16 | jmp imm32:imm32 | jmp imm16:imm16 {far} | jmp imm32:imm32 {far} | jmp imm16:imm32 | jmp imm16:imm32 {far} | jmp mem16 {far} | jmp mem32 {far} | jmp mem64 {far}

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. NASM does not choose when to generate JMP SHORT for you: you must explicitly code SHORT every time you want a short jump.

You can choose between the two immediate far jump forms (\c{JMP imm:imm}) by the use of the WORD and DWORD keywords: \c{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 \c{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.

The JMP r/m forms given above are near calls; NASM will accept the NEAR keyword (e.g. JMP NEAR [address]), even though it is not strictly necessary.

Loading...

Forms

Every form of jmp the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
jmp imm64 {abs}x86-64apxlong
jmp imm8 {short}8086
jmp imm8086
jmp imm16 {near}8086nolong
jmp imm32 {near}386
jmp r/m16 {near}8086nolong
jmp r/m32 {near}386nolong
jmp r/m64 {near}x86-64long
jmp imm16 {far}8086nolong
jmp imm32 {far}386nolong
jmp imm16:imm168086nolong
jmp imm32:imm32386nolong
jmp imm16:imm16 {far}8086nolong
jmp imm32:imm32 {far}386nolong
jmp imm16:imm32386nolong
jmp imm16:imm32 {far}386nolong
jmp mem16 {far}8086nolong
jmp mem32 {far}386
jmp mem64 {far}386long