NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: florian on September 01, 2011, 08:00:49 PM
-
Hi
I was wondering how to use relative calls.
If I assemble this:
section .text
global _main
_main:
mov eax, 2
call xy
xy:
pop eax
It gets translated with a fixed address:
00000000 66B802000000 mov eax,0x2
00000006 E80000 call word 0x9
00000009 6658 pop eax
-
We write "call xy", and it gets disassembled as "call (address of) xy", but if you look at the actual encoding, it's "call" (e8) distance (plus or minus) to xy (0000, in this case).
Best,
Frank
-
Hmmm so I actualy already got what I wanted and I was just to stupid to see it :D
thank you for your help anyway :)
-
It's not an obvious thing!
Best,
Frank