DaniVaja
DaniVaja

Reputation: 211

I get a different result with mul instruction in assembly

I have this set of instructions in assembly.

   mov ax,0055h
   mov bx,11AAh
   mul al
   xchg ax,bx
   not ax
   neg bx

I don't understand the mul instruction in third line.If I do 0055h*11AAh I get 5DD72 but it's not correct because with a program I get in AX 1C39.How ? What's the procedure?

I know that AX and BX are 16 bit registers and my result should be on 32 bit and the result is on DX:AX

Upvotes: 0

Views: 370

Answers (1)

Timothy Baldwin
Timothy Baldwin

Reputation: 3675

The single argument form of mul will multiply the argument with al/ax/eax/rax depending on the operand size and store the result in ax/dx:ax/edx:eax/rdx:rax accordingly.

mul al will multiply al with al and store the result in ax. You want mul bx.

Upvotes: 4

Related Questions