www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - iasm, call and dolar sign

reply "nazriel" <spam dzfl.pl> writes:
Greetings.

While using D iasm I noticed something interesting.

I was trying to get instruction pointer by using call trick and 
noticed that in opposite to nasm (and probably others assemblers) 
D iasm uses $ as next instruction pointer.

Documentation mentions that dolar sign is usable in Jcc (or jmp 
only? not sure) and call instructions.

It doesn't work.
http://dpaste.dzfl.pl/5c9c3d6b

call $ ; this should jump to next instruction and store RIP on 
stack
        ; if I understand correctly?
pop RAX;

Compiler slaps me with information that $ is bad operand for call 
instruction.

Am I doing something wrong or it is a bug?
Thanks!
Mar 03 2013
parent "nazriel" <spam dzfl.pl> writes:
On Monday, 4 March 2013 at 03:30:30 UTC, nazriel wrote:
 Greetings.

 While using D iasm I noticed something interesting.

 I was trying to get instruction pointer by using call trick and 
 noticed that in opposite to nasm (and probably others 
 assemblers) D iasm uses $ as next instruction pointer.

 Documentation mentions that dolar sign is usable in Jcc (or jmp 
 only? not sure) and call instructions.

 It doesn't work.
 http://dpaste.dzfl.pl/5c9c3d6b

 call $ ; this should jump to next instruction and store RIP on 
 stack
        ; if I understand correctly?
 pop RAX;

 Compiler slaps me with information that $ is bad operand for 
 call instruction.

 Am I doing something wrong or it is a bug?
 Thanks!
Will answer myself :p s/call $/call near ptr $ fixed the thing. Sorry for distributions
Mar 03 2013