Hey, i'm currently buggering around with asm and registering lua functions but my asm is wrong. I could really do with a hand sorting it out.
Basically I am trying to create a function inside wow which stores a value in a predetermined area of memory.
e.g. something analogous to:
Code:int MyVar; void MyFunc(int i) { MyVar = i; }
My current LUA function looks like this
Once regestered I can call the function fine.Code:Asm.AddLine("push ebp"); Asm.AddLine("mov ebp, esp"); Asm.AddLine("sub esp, 0xC0"); Asm.AddLine("push ebx"); Asm.AddLine("push esi"); Asm.AddLine("push edi"); Asm.AddLine("lea edi, [ebp-0xC0]"); Asm.AddLine("mov ecx, 0x30"); Asm.AddLine("mov eax, 0x0CCCCCCCC"); Asm.AddLine("rep stosd"); Asm.AddLine("mov eax, [ebp+0x8]"); Asm.AddLine("mov [" + pMyVar + "], eax"); Asm.AddLine("pop edi"); Asm.AddLine("pop esi"); Asm.AddLine("pop ebx"); Asm.AddLine("mov esp, ebp"); Asm.AddLine("pop ebp"); Asm.AddLine("retn");
/console MyFunc 1 //set MyVar to 1
But it's not actually storing the variable as I would like it to.
Instead it seems to be storing a new location in MyVar:
0x012A2168;
This appears to store the last thing typed into the console i.e.
"MyFunc"
Can anyone spot the error in my asm?
Thanks very much.