flat assembler
Message board for the users of flat assembler.

Index > Main > multiplication

Author
Thread Post new topic Reply to topic
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello, what is wrong at this:

mul 0x0A

it comes allways:

Error: Invalid operand

whats wrong?
Post 27 Mar 2004, 10:01
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
mul can only take register, or memory argument. You should write for example:
Code:
mov ebx,0x0a
mul ebx    

or
Code:
mul [my_variable]
    

regards
Post 27 Mar 2004, 10:24
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
i don't understand... doesn't mul multiplicate the AX register with the given parameter of mul?
Post 27 Mar 2004, 10:41
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
yes, it does. It multiplies the accumulator (which is AX or EAX - it depends on your parameter's size) by the given parameter. But this given parameter cannot be just a number (like in your example). It ahs to be some register or memory address. So, in your case (with 16 bit code) you sould try something like:
Code:
mov bx,0x0A
mul bx    

and it will multiply AX by BX. BX holds value of 0x0A, so it will calculate AX*0x0A.
Post 27 Mar 2004, 11:17
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
oh, so it only multiplicates with a register, ok...
Post 29 Mar 2004, 10:28
View user's profile Send private message Visit poster's website Reply with quote
aaro



Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro
and with memory
Post 29 Mar 2004, 10:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.