In the following code snippet, the EB F2 instruction is causing execution to jump back up to the line indicated by the arrow. How is this the case given that there is no address supplied to EB and the jmp is less than F2 away in terms of address distance? These two locations are 0xC from each other.
1 Answer
from google starmans realm
quoting relevant info
These are also known as SHORT Relative Jumps. Programs using only Relative
Jump instructions can be relocated anywhere in memory without having to
change the machine code for the Jumps. The first byte of a SHORT Jump is
always EB and the second is a relative offset from 00h to 7Fh for Forward
jumps, and from 80h to FFh for Reverse (or Backward) jumps. [Note: The
offset count always begins at the byte immediately after the JMP
instruction for any type of Relative Jump!]
so eb 01 to eb 7f jumps forward
eb fe to eb 80 jumpf backward
so current instruction is at 0x172b066 adding the opcode length 2 the current instruction ends at xxxx68 or the next instruction starts at 0xxxxx68 0xf2 == -0xe (read about twos complement notation)
0xxxxx68 - 0xe = 0xxxxx5A