I am learning assembly for x86 using DosBox emulator. I am trying to perform multiplication. I do not get how it works. When I write the following code:
mov al, 3
mul 2
I get an error. Although, in the reference I am using, it says in multiplication, it assumes AX is always the place holder, therefore, if I write:
mul, 2
It multiplies al
value by 2. But it does not work with me.
When I try the following:
mov al, 3
mul al,2
int 3
I get result 9 in ax. See this picture for clarification:
Another question: Can I multiply using memory location directly? Example:
mov si,100
mul [si],5
mul al, 2
seems to be incorrectly accepted by MS-DOS DEBUG and treated as if you enteredmul al
(multiplies implicit byte operandal
by explicit operandal
and store in implicit destinationax
). – Nussmul
, but there immediateimul
in 186 and newer. See problem in understanding mul & imul instructions of Assembly language . There's no memory-destinationmul
orimul
even on the newest CPUs, only memory-source. There isimul cx, [si], 5
if you want, though, on 186 and newer. – Edh