Dereference pointer in inline assembly

G

Guest

Could anyone please tell me if there is a syntax to dereference a pointer in
inline assembly? Something like:

int *a = ...;
__asm mov eax, *a; // move dword from location pointed to by a

I could do:

__asm mov edx, a;
__asm mov eax, [edx];

but it would help me if I could do it in one step.

Thank you.
 
G

Guest

Euphilos said:
Could anyone please tell me if there is a syntax to dereference a pointer in
inline assembly? Something like:

int *a = ...;
__asm mov eax, *a; // move dword from location pointed to by a

I could do:

__asm mov edx, a;
__asm mov eax, [edx];

but it would help me if I could do it in one step.

No, because the x86 instruction set does not have such operation.
When you use inline asm, you use the native cpu instructions.

--PA
 
B

Ben Voigt

Euphilos said:
Could anyone please tell me if there is a syntax to dereference a pointer
in
inline assembly? Something like:

int *a = ...;
__asm mov eax, *a; // move dword from location pointed to by a

I could do:

__asm mov edx, a;
__asm mov eax, [edx];

Just for grins, what does __asm mov eax, [a]; do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top