Solved

Inline ASM help!

Posted on 2004-04-24
3
1,648 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now