flat assembler
Message board for the users of flat assembler.

 Index > Main > multiplication
Author
joachim_neu

Joined: 22 Dec 2003
Posts: 139
joachim_neu 27 Mar 2004, 10:01
hello, what is wrong at this:

mul 0x0A

it comes allways:

Error: Invalid operand

whats wrong?
27 Mar 2004, 10:01
decard

Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 27 Mar 2004, 10:24
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
27 Mar 2004, 10:24
joachim_neu

Joined: 22 Dec 2003
Posts: 139
joachim_neu 27 Mar 2004, 10:41
i don't understand... doesn't mul multiplicate the AX register with the given parameter of mul?
27 Mar 2004, 10:41
decard

Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 27 Mar 2004, 11:17
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.
27 Mar 2004, 11:17
joachim_neu

Joined: 22 Dec 2003
Posts: 139
joachim_neu 29 Mar 2004, 10:28
oh, so it only multiplicates with a register, ok...
29 Mar 2004, 10:28
aaro

Joined: 21 Jun 2003
Posts: 107
Location: hel.fi
aaro 29 Mar 2004, 10:40
and with memory
29 Mar 2004, 10:40
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum