Can someone explain in Engl开发者_高级运维ish what a relative jump is in assembler?
It is an OP code whose operand will cause execution to jump to an address relative to the current address. The value of the operand is an offset.
Suppose the relative jump instruction is held in address 0x0005 and has an operand of 3. Then execution will jump to address 0x0008. If the operand is -3, execution will jump to address 0x0002.
A relative jump differs from an absolute or long jump in that the instruction does not encode the entire target address to where execution will continue.
Rather, it encodes a portion of the address or an offset from the current instruction pointer, depending on the architecture. This saves program memory space and in non-pipelined architectures it will also execute slightly faster. The limitation is that you can only jump shorter distances.
For current instruction relative jumps, the range is often a signed offset of the storage size used to encode the address. For example, if an 8-bit opcode and 8-bit offset is used, then the jump range would be typically -126 to +129 from the jump instruction. The asymmetry is due to the fact that the offset is added to the instruction pointer, which at the time of the addition points to the next instruction instead of the current one.
Jump to address relative to (with respect to) the current address (address of this relative jump instruction).
You need to specify the "by how much?" part in the operand.
Instead of executing the next instruction, it increments the code cursor by the value given to it. Then the execution continues
精彩评论