473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dereference pointer in inline assembly

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.
Oct 4 '06 #1
3 4656
"Euphilos" wrote:
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

Oct 4 '06 #2

"Euphilos" <eu******@community.nospamwrote in message
news:E8**********************************@microsof t.com...
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?
>
but it would help me if I could do it in one step.

Thank you.

Oct 10 '06 #3
Just for grins, what does __asm mov eax, [a]; do?
It does the same as __asm mov eax, a; (i.e. mov eax, [ebp + a_offset]).
Oct 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: TuxC0d3 | last post by:
Hi! I'm diving into the some more ++ specific aspects of c++ (and finally accepting that c++ is more than "a plus added to c" :), so that means using namespaces, templates, std::strings, lists,...
9
by: mailtogops | last post by:
Hi, I have this question in mind for many years.. C++ class provides encapsulation which encapsulate its members and member function. class Experiment { private:
23
by: bluejack | last post by:
Ahoy... before I go off scouring particular platforms for specialized answers, I thought I would see if there is a portable C answer to this question: I want a function pointer that, when...
30
by: somenath | last post by:
Hi All, I have one doubt regarding pointer .I have one small code as mentioned bellow . #include<stdio.h> #include<stdlib.h> int main (void) { int *p; int *ptr= malloc(sizeof(int *));
2
by: andrey.vul | last post by:
code: #include <iostream> #include <vector> #include <stdexcept> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring>
9
by: Srinu | last post by:
Hi All, We know the following facts, 1. A two dimentional arrays in C is stored similar to a single dimentional array. 2. * is the dereference operator that gives value at address denoted by...
17
by: Tony Jackson | last post by:
Hi I'm quite new to C programming - I have more of a Java background: maybe someone here can advise me. I'm nearly finishing a little program but it has some hard-to-find bugs that basically...
26
by: =?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Do you think we can reach any kind of consensus on whether the following code's behaviour is undefined by the Standard? int my_array; int const *const pend = *(&my_array + 1); Considering...
98
by: Micheal Smith | last post by:
I recently read an article containing numerous gripes about common C practices. One of them contained a gripe about the use of the sizeof operator as an argument to malloc calls. The supposed...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.