[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Inline ASM help!

Posted on 2004-04-24
3
Medium Priority
?
1,667 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses

872 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