?
Solved

Inline ASM help!

Posted on 2004-04-24
3
Medium Priority
?
1,657 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 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

777 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