16 bit Assembly
Home Site Map Instruction Index
The JMP instruction is used to pass control to a routine or label. Unlike CALL it does not return to the caller if a RET is reached.
The memory address of the destination is supplied in the operand. Alternately the destination can a relative address stated as plus or minus from the current instruction.
This command has 2 parts, Instruction, then either a Register, Immediate value, Label, Routine Name or a memory address.
The 8 bit near jumps can jump up to 127 bytes forward or backward. Forward start at 0 to 79h, backward start from FF to 80h.
Examples show how to call a sub routine at:
000007D4 SubPressAnyKey:
Assembly Sample | Description | 16 bit Machine Code |
---|---|---|
JMP 0x03 | ; Jump forward using an 8 bit relative number | EB 03 |
JMP 0xFD | ; Jump backwards using an 8 bit relative number | EB FD |
JMP 0x07D4 | ; Jump forward using a 16 bit relative number | E9 D4 07 |
JMP SubPressAnyKey | ; Jump forward relative using a Label or Routine name | E9 79 05 |
JMP AX | ; Jump using an absolute 16 bit register | FF E0 |
MOV BX, 0x0020 | ; Assign a memory location | BB 20 00 |
MOV [BX], 0x07D4 | ; Assign a valid sub routine address | C7 07 D4 07 |
JMP [BX] | ; Jump using a direct memory address | FF 27 |