JMP Jump Unconditionally Flags: Not altered (*) (*) If task switch JMP destination occurs, all flags are affected Logic if FAR jump CS ← destination_segment endif eIP ← destination_offset
JMP unconditionally transfers control from one code segment location to another. These locations can be within the same code segment (near jump = intra-segment) or in different code segments (far jump = inter-segment).
JMP's implementation varies depending on whether the address is directly specified within the instruction or indirectly through a register or memory operand. A direct JMP includes the destination address as part of the instruction. An indirect JMP gets the destination address through a register or pointer variable. An indirect JMP specifies an absolute address in one of the following ways:
- a register modifies the address of the memory pointer to select a destination address - the program can JMP to a location specified by a general register -- the CPU moves this value into the instruction pointer and resumes execution - the CPU obtains the destination address from a memory operand specified in the instruction
Note JMP does not save a return address on the stack as CALL does.
Opcode Format E9 cw JMP rel16 E9 cd JMP rel32 EA cd JMP ptr16:16 EA cp JMP ptr16:32 EB cb JMP rel8 FF /4 JMP r/m16 FF /4 JMP r/m32 FF /5 JMP m16:16 FF /5 JMP m16:32