0

I have a very quick question about the assembly language.

I disassembled C code and found that "JNZ short 00958178" I know 'JNZ' operation, but what is "short"???? What "short" does in this command?

Thank you advance.

freddy
  • 463
  • 1
  • 8
  • 20
  • 1
    You can disassemble but not research?? http://stackoverflow.com/questions/5757866/what-does-short-jump-mean-in-assembly-language – Gunner Mar 22 '14 at 05:17
  • Thank you, I could not find that :) – freddy Mar 22 '14 at 06:23
  • 1
    He's doin' research, he's askin' us. :) It just means that the target is nearby. We code `jnz target` and it disassembles as `jnz address_of_target` but if you look at the bytes emitted, it's "distance to target" not the address. If "distance to target" will fit in a signed byte (-128 to +127) it can be "short" (a smaller encoding). A jump to a more distant target is called "near". Go figure. – Frank Kotler Mar 22 '14 at 06:23

1 Answers1

1

It is only usefull for to write "short" for jumping forward in the code, if the destination address is inside of +127 bytes. (But if the target address is outside of this range, then we get an error message from the assembler.)

For jumping backward in the code the assembler allready knows the range between the target address and the jump-instruction and so the assembler use the shortest form of the jump-instruction by default, if it is possible.

Dirk