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
Solved

Inline ASM help!

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

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

Suggested Solutions

Title # Comments Views Activity
Instantiating a .NET COM library in MFC 4 138
VC++ 6.0 issue 3 74
creating a static library using third party libs 2 65
Threading Question in Visual C 1 57
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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