In: Computer Science
(b) Determine whether the JMP instruction are SHORT, NEAR, or FAR jump. Explain your answer.
assuming your question pertains to the x86 architecture
A SHORT
jump is a relative jump to a particular
offset from the current instruction pointer address. A
LONG
jump uses a larger offset value, and so can jump
further away from the current instruction pointer address. Both of
these jump types are usually relative - that is, the
operand is an offset from the current instruction pointer (though
in assembly source, you normally provide the target label - the
assembler or linker then computes the offset). Neither of them jump
to a different code segment, so they are both 'near' jumps.
A FAR
jump specifies both a segment and offset,
which are both absolute in the sense that they specify the
required code segment and instruction pointer, rather than an
offset relative to the current code segment / instruction
pointer.
(Note that it is also possible to perform an indirect absolute jump, where you specify an operand that holds the absolute address that you wish to jump to. In this case the jump can either be near or far - i.e. it can include or not include the required code segment).
If you don't specify the jump 'distance', it is up to the assembler whether you get a short, long or far jump. Most modern assemblers are "two-pass" and will use a short jump if possible, or a long or far jump otherwise - the latter only if required.