newbie: MUL product



I posted this at CLAX, but it wasn't showing up, so I'll try here.

Hello,

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.

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.

Many thanks for your input!

TITLE MULPract (mul.asm)
INCLUDE Irvine32.inc

..data
val1 WORD 2000h
val2 WORD 0100h

..code
main PROC
mov ax, val1
mul val2
;mov ebx, dx:ax ;<== doesn't work
shl edx, 16 ;<== this works but requires 2 instructions
mov dx, ax ; --- shl then mov
exit
main ENDP
END main

--
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
.



Relevant Pages

  • Re: code optimisation
    ... > mov ebx,-1 ... > xor eax,eax ... zeroed again in loop3. ... > shl edx, 16 ...
    (alt.lang.asm)
  • Re: SHL Is Replaced!!
    ... Bryan Parkoff wrote: ... > shl edx, 08H ... mov dh, 0x20 is functionally equivalent. ...
    (comp.lang.asm.x86)