Reputation: 2628
I'm stuck with this. I'm self studying assenbler and translating some basics instructions. But i can't with this one.
Can anyone help me, please?
int
secuencia ( int n, EXPRESION * * o )
{
int a, i;
for ( i = 0; i < n; i++ ){
a = evaluarExpresion( *o );
// Im trying to do this: o++;
__asm {
mov eax,dword ptr [o]
mov ecx,dword ptr [eax]
inc [ecx]
}
}
return a ;
}
I wrote the inside for and works, but still don't know how to increment O
int
secuencia ( int n, EXPRESION * * o )
{
int a, i;
for ( i = 0; i < n; i++ ){
__asm {
mov eax,dword ptr [o]
mov ecx,dword ptr [eax]
push ebp
mov ebp, esp
push ecx
call evaluarExpresion
mov esp, ebp
pop ebp
mov a, eax
}
o++;
}
return a ;
}
Upvotes: 0
Views: 11983
Reputation: 900
mov esi, o
add esi, 4 //increment is here
Line1 : We move your o pointer to the esi register. Line2: We increment your o pointer
or
mov eax, o
mov esi, [eax]
add esi, 4
I don't understand perfectly what you are trying to do but I hope it helped!
Upvotes: 1
Reputation: 49089
There are two options:
Either:
o
from memory into a register (eax, for example)or
Try to use both methods.
Upvotes: 1