NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: blablub on January 21, 2011, 05:50:22 PM

Title: jmp short immediate
Post by: blablub 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.
Title: Re: jmp short immediate
Post by: Frank Kotler 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

Title: Re: jmp short immediate
Post by: blablub on January 21, 2011, 11:40:55 PM
Works perfectly, thanks!