Inline assembler errors

P

Protoman

I'm getting errors saying there's too many memory refrences for add and
mov; here's the code:

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
int i=0;
asm("mov eax,i");
asm("add eax,12");
asm("mov i,eax");
cout << "The value of i is: " << i;
system("PAUSE");
return 0;
}

I'm using Dev-Cpp; can you help me on this? Thanks!!!
 
G

Guest

int i=0;

__asm mov eax, i;

__asm add eax, 12;

__asm mov i, eax;

std::cout << "The value of i is: " << i;

this way works fine for me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top