For Programmers: Free Programming Magazines  


Home > Archive > A86 Assembler > July 2007 > Re: newbie: MUL product









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: newbie: MUL product
João Jerónimo

2007-07-09, 9:57 pm

Rob Hoelz wrote:
> Here's some code to move the product in DX:AX to EBX. (I'm a newbie as
> well, so feel free to point out errors in my code)
>
> ; This is using NASM syntax
>
> movzx ebx, dx
> sal ebx, 16
> and eax, 0xffff ; Not sure if this is needed
> or ebx, eax


I usually do as follows:
mov bx, dx
shl ebx, 16
mov bx, ax

Zero extends are usually slower than simple copies, and simple shifts are,
I think, faster than arithmetic shifts.

Besides, my version is only 3 instructions long... :-)

JJ

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com