Thread: Inline Assembly error (invalid operand)??

  1. #1
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533

    Inline Assembly error (invalid operand)??

    I am learning assembly or I should say HLA's version of ASM
    and I am learning TRUE asm with that.
    I am not sure for the syntax of inline asm, but everyway I look at it this should work...

    Code:
    #include <iostream.h>
    int main()
    {
    	int x;
    	__asm{
    		mov		0, eax
    		add		2, eax
    		mov		eax, x
    	}
    	cout<<x<<endl;
    	return 0;
    }
    could someone tell me why it doesn't work?
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I don't know much intel assembly but I do know some. Your destination operand goes on left, source on right.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help using inline assembly for keyboard input
    By sleventeen in forum C Programming
    Replies: 7
    Last Post: 05-10-2009, 01:31 AM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  3. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  4. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  5. inline assembly question
    By DavidP in forum C++ Programming
    Replies: 3
    Last Post: 02-10-2002, 06:14 AM