Assembly - How to multiply/divide a constant by another constant in assembly?
So, I have an assembly function, which is called in C. It compiles and gives me no warnings, but when I try to run it, it gives me a segmentation fault. I think it's because I can't move a constant into a register, but to use the mul/div command it requires a value to be in EAX register. How can I multiply or divide two constants in Assembly? Here's the code so far... .section .data .global n .equ A, 50 .equ B, 5 .section .text .global loop_function loop_function: # prologue pushl %ebp # save previous stack frame pointer movl %esp, %ebp # the stack frame pointer for sum function # beginning