Is it possible to multiply by an immediate with mul in x86 Assembly?

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: enter image description here

Another question: Can I multiply using memory location directly? Example:

mov si,100
mul [si],5


Read more here: https://stackoverflow.com/questions/20499141/is-it-possible-to-multiply-by-an-immediate-with-mul-in-x86-assembly

Content Attribution

This content was originally published by user2192774 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: