cdonts
cdonts

Reputation: 9631

Copy ASM data to C++ variable

I'm trying to store the values (int) of EBP+8and EBP+12 in two C++ variables. This is my code:

int a;
int b;

__asm {
    MOV &a, [EBP+12]
    MOV &b, [EBP+8]
}

But this is throwing some syntax errors. Which is the proper way to achieve this?

Upvotes: 1

Views: 826

Answers (1)

cdonts
cdonts

Reputation: 9631

I didn't remember that, as Michael said, I can't MOV directly from memory to memory. So I solved this by doing:

MOV EAX, [EBP+12]
MOV a, EAX

Upvotes: 1

Related Questions