Re: newbie: MUL product
- From: Brian <stringchopperREMOVEALLCAPS@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 13:13:22 -0400
On Thu, 29 Mar 2007 18:08:14 +0200, "Wolfgang Kern" <nowhere@xxxxxxxx>
wrote:
Hi Brian,
I posted this at CLAX, but it wasn't showing up, so I'll try here.
Assume a few hours delay in CLAX, it's a moderated group.
I'm a newbie using MASM on a P4 Intel processor. My tutorial says
that if I multiply AX by a 16 bit register or memory operand, the
product is DX:AX. How do I reference DX:AX if I want to store the
product in memory or to a 32 bit register?
I tried "mov ebx, dx:ax" but that doesn't work.
The CPU hasn't got this opportunity.
I can put the value in edx like this:
shl edx, 16
mov dx, ax
but I'm not sure if there is a simpler way, or a way to get to the
32-bit product with just one instruction.
The way you do it is just fine,
also the SHLD instruction is not designed for this,
as it needs Zero-extend eax,ax and edx,dx first.
But look at the other IMUL instructions which work like:
anyreg32 = anyreg32 * anyreg/mem32
ie: IMUL eax,ebx,ecx
or the immediate operand IMUL forms:
anyreg32=anyreg/mem32 * SXimm8/imm32
ie: IMUL eax,ebx,-09
perhaps this fits your goal better
(unfortunately no unsigned MUL in this forms)
You can also follow Herbert's advice
and perform a 32 by 32 bit MUL instead
Thanks Wolfgang. Also, you had corrected me in another post about my
confusion with ENDians. Is this a scenario where endian order
matters? If so, would you mind explaining how that works? When
thinking of endian order, do I need to be concerned only about 4 bytes
at a time - (ie, position every 4 bytes correctly -
ABCDEF, CDEFGA <==> CDEFGA, ABCDEF.
Or, do I need to position every byte
(ex: AB, CD, EF <===> EF, CD, AB)
I ask this in regard to Intel Pentium processor. Does the operating
system have anything to do with Endian order, or is Endian order
entirely dependent on a processor?
--
thanks,
Brian
To the best of my knowledge, I have:
1) asked a question specifically related to this newsgroup
2) not used my email to request answers be sent there
3) not top-posted
4) not used bad grammar that would make me appear more stupider
.
- References:
- newbie: MUL product
- From: Brian
- Re: newbie: MUL product
- From: Wolfgang Kern
- newbie: MUL product
- Prev by Date: Re: 3D ROM
- Next by Date: Re: newbie: MUL product
- Previous by thread: Re: newbie: MUL product
- Next by thread: Re: newbie: MUL product
- Index(es):