Using 16 bit registers for the address parameters is definitely not going to work. It's only going to use half the address so whenever those pointers gets dereferenced they could be anywhere.
All of these:
lea bx, posParte1
lea cx, posParte2
lea dx, posSalida
should be:
lea ebx, posParte1
lea ecx, posParte2
lea edx, posSalida
And obviously the push
ops below should use the 32 bit registers too.
Update:
Just noticed something else. You are setting your salida
parameter to NULL, when assumedly you wanted to set posSalida
to zero. This line:
mov salida, 0
should probably have been:
mov posSalida, 0
Update 2:
Also worth mentioning that the ecx register is not guaranteed to be preserved across function calls. So it's quite possible that by the time you return from the first call to copiarMuestreo
, the ecx that you set to the address of posParte2
is no longer correct.
Probably the best solution to that would be to initialise ecx only after the first call to copiarMuestreo
, since it's not needed until the second call.