Solved

Inline ASM help!

Posted on 2004-04-24
3
1,655 Views
Last Modified: 2012-08-13
hey,

I'm trying to use a little bit of inline asm to fill an integer value, at the moment i have:

int i;
__asm mov i, dword ptr ss:[ebp-0x1C]

but i get this error:

error C2415: improper operand type

i'm not sure how vc++ wants me to format the asm, as i've never really used it before, and i've been looking on MSDN but can't really find any specific information about how to write inline asm.

thanks.
0
Comment
Question by:clocKwize
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 10908127
One of mov parameters must be register, it's impossible to move from memory to memory directly:

__asm
{
    mov EAX, dword ptr ss:[ebp-0x1C]
    mov i, EAX
}
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10908161
This is introduction to Assembly for C++ programmers:

http://www.microsoft.com/msj/0298/hood0298.aspx

Inline Assembly may be used in any C/C++ function, it can use local variables and function parameters, since theit address is known at compile time.
0
 

Expert Comment

by:bisquic
ID: 11046550
It's not possible to use asm in managed C++ though, correct?
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question