MUL instruction help
        Posted  
        
            by 
                Tanner Babcock
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Tanner Babcock
        
        
        
        Published on 2010-12-25T04:09:15Z
        Indexed on 
            2010/12/25
            5:54 UTC
        
        
        Read the original article
        Hit count: 476
        
I've read a few tutorials and examples, but I cannot wrap my head around how the MUL instruction works. I've used ADD and SUB without problems. So apparently this instruction multiplies its operand by the value in a register. What register (eax, ebp, esp, etc.) is multiplied by the first operand? And what register is the result stored in, so I can move it to the stack? Sorry, I'm just learning x86 assembly.
When I try to compile this line...
mull    $9
I get, "Error: suffix or operands invalid for 'mul'". Can anyone help me out? Thanks.
EDIT: OK Madhur, I replaced "mull" with "mul" and I'm still getting the same error. Here's the whole source.
.globl _main
_main:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $8, %esp
    movl    $7, %eax
    mul     $9
    movl    %eax, (%esp)
    call    _putchar
    xorl    %eax, %eax
    leave
    ret
© Stack Overflow or respective owner