I am just starting to learn ASM. I have chosen to use masm32. I do not fully understand how to use the mul and imul instructions. The part I am having trouble with is how to access the result. When the result is in two registers how do you get the result?

Thanks
~laz
Posted on 2007-09-13 18:31:14 by lazman
mov ecx, 98765432h  ;2557891634
mov eax, 7
mul ecx  ; multiplies ecx by eax

result is 42B3C4D5Eh in held in the register pair edx:eax
which are the high and low 32 bit parts of a 64 bit result
edx = 4
eax = 2B3C4D5Eh
Posted on 2007-09-13 19:22:15 by dsouza123

I am just starting to learn ASM. I have chosen to use masm32. I do not fully understand how to use the mul and imul instructions. The part I am having trouble with is how to access the result. When the result is in two registers how do you get the result?

Thanks
~laz


Whether or not MASM32 promotes such an image, it is not designed to support beginners to assembly language.

What you would really need, is to grab a book/PDF like AoA and start reading.
Posted on 2007-09-13 19:25:48 by SpooK

mov ecx, 98765432h  ;2557891634
mov eax, 7
mul ecx  ; multiplies ecx by eax

result is 42B3C4D5Eh in held in the register pair edx:eax
which are the high and low 32 bit parts of a 64 bit result
edx = 4
eax = 2B3C4D5Eh


Ok, but how do I get that into a memory address?

mov addr, edx:eax

This syntax does not work.

Thanks
~laz
Posted on 2007-09-13 20:10:49 by lazman
mov , eax
mov , edx

If you are just interested in the 32-bit result then just use the first instruction.
Posted on 2007-09-13 20:19:28 by LocoDelAssembly
AHHH I see now!

I'm such a doof!

Thanks much
~laz
Posted on 2007-09-13 21:14:08 by lazman
Another kodak moment - it clicks, another memory :)
Posted on 2007-09-16 08:06:46 by Homer