Author Topic: jmp short immediate  (Read 17350 times)

Offline blablub

  • Jr. Member
  • *
  • Posts: 2
jmp short immediate
« on: January 21, 2011, 05:50:22 PM »
Hi,
I was wondering how to use jmp short immediate correctly. Basically what I want to get is "EB 03" but "jmp short 3" gives "error : coff: invalid relocation size" (technically I'm using YASM).

Thanks in advance.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: jmp short immediate
« Reply #1 on: January 21, 2011, 09:02:38 PM »
jmp short immediate is a tricky one! We write "jmp target", and it disassembles as "jmp target", but if you look at the encoding, the operand is "distance to target" (signed - a signed byte in the case of "short"). The easiest thing for you to do is:

Code: [Select]
db 0EBh, 3

...if that's really what you want to do...

Best,
Frank


Offline blablub

  • Jr. Member
  • *
  • Posts: 2
Re: jmp short immediate
« Reply #2 on: January 21, 2011, 11:40:55 PM »
Works perfectly, thanks!