masm division overflow

Posted by Help I'm in college on Stack Overflow See other posts from Stack Overflow or by Help I'm in college
Published on 2010-02-13T00:21:05Z Indexed on 2010/05/22 1:30 UTC
Read the original article Hit count: 402

Filed under:
|
|

I'm trying divide two numbers in assembly. I'm working out of the Irvine assembly for intel computers book and I can't make division work for the life of me.

Here's my code

.code
main PROC
    call division
    exit
main ENDP

division PROC
    mov eax, 4
    mov ebx, 2
    div ebx
    call WriteDec
    ret
divison ENDP

END main

Where WriteDec should write whatever number is in the eax register (should be set to the quotient after the division call). Instead everytime I run it visual studio crashes (the program does compile however).

© Stack Overflow or respective owner

Related posts about assembly

Related posts about x86