Assembly Language StepbyStep Programming with DOS and Linux 2nd Ed [Electronic resources]

Jeff Duntemann

نسخه متنی -صفحه : 166/ 104
نمايش فراداده

JMP Unconditional Jump

Flags affected:

O D I T S Z A P C  OF: Overflow flag  TF: Trap flag AF: Aux carry
F F F F F F F F F  DF: Direction flag SF: Sign flag PF: Parity flag
<none>         IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

JMP <short displacement>
JMP <near label>
JMP <far label>
JMP r16
JMP r32        386+
JMP m16
JMP m32

Examples:

JMP RightCloseBy         ;Plus or minus 128 bytes
JMP InsideMySegment      ;To 16-bit offset from CS
JMP OutsideMySegment     ;To immediate 32-bit address
JMP DX                   ;To 16-bit offset stored in DX register
JMP EAX                  ;To 32-bit offset stored in EAX register
JMP WORD [BX+DI+17]      ;To Near address stored at [BX+DI+17]
JMP DWORD [BX+DI+17]     ;To full 32-bit address stored at [BX+DI+17]

Notes:

JMP transfers control unconditionally to the destination given as the single operand. In addition to defined labels, JMP can transfer control to a 16-bit signed offset from IP (or 32-bit signed offset from EIP) stored in a general-purpose register, or to an address (either Near or Far) stored in memory and accessed through any legal addressing mode. These m16 and m32 forms are useful for creating jump tables in memory, where a jump table is an array of addresses. For example, JMP [BX+DI+17] would transfer control to the 16-bit offset into the code segment found at the based-indexed-displacement address [BX+DI+17].

No flags are affected, and, unlike CALL, no return address is pushed onto the stack.

r8 = AL AH BL BH CL CH DL DH        r16 = AX BX CX DX BP SP SI DI
sr = CS DS SS ES FS GS              r32 = EAX EBX ECX EDX EBP ESP ESI EDI
m8 = 8-bit memory data              m16 = 16-bit memory data
m32 = 32-bit memory data            i8 = 8-bit immediate data
i16 = 16-bit immediate data         i32 = 32-bit immediate data
d8 = 8-bit signed displacement      16 = 16-bit signed displacement
d32 = 32-bit unsigned displacement