I can't seem to crack the mul and div opcodes. I'm programming for Linux so the material I found through google - which goes on about DOS - is pretty useless.
All I want to do is write a function in assembly and link it into a C program. Here's the assembly:
intDiv:
; hmm
ret
As far as I know, I need to load AL with what I want to multiply/divide by, then 'mul [esp+4]' (for example) to get the result in EAX?
It's annoying.
*edit*
Ooops that post was crap.
What I can't seem to get right is mov'ing the values around.
intMul:
mov al, [esp+4]
mul [esp+8]
ret
That just doesn't assemble. Do I need to use SP instead of ESP because I'm working with 32bit registers? Well technically I'm not because it's AL that need the value. Meh.
Why couldn't it just be 'mul , ' ? Intel have a fantastic way of doing things weirdly.