When you have a value stored in a "variable" ie

is it possible to move that data from one variabel to another with a single operand


mov MyOtherVar, MyVar

I get errors when I try this
I have to do one of two things
push MyVar
pop MyOtherVar


mov eax,MyVar
mov MyOtherVar,eax

is there any other way to do this and what is the fastest way? I see the push/pop thing used alot, especially when moving data to structures ie.
push MyVar
pop MyStruct.MyOtherVar

Posted on 2001-12-31 21:39:58 by Rockinronstar
The x86 does provide the MOVSB MOVSW and MOVSD instructions for memory to memory moves. They are usually used with the REP prefix. Unfortunately, they are normally pretty slow. PUSH/POP is almost always faster.

MASM32 comes with an optimization guide by Agner Fog. It has a section on moving blocks of data.


Oops, now that I think about it, I'm not sure if Agner's guide comes with MASM32. If not, you can get it here:

Posted on 2002-01-01 00:31:46 by S/390