News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

How to divide signed numbers?

Started by kejt, January 27, 2013, 06:24:11 AM

Previous topic - Next topic

kejt

Hi,
I have some problems with dividing signed number.

include /masm32/include/masm32rt.inc

.data?
stop db ?
.data

.code
start:
xor edx, edx
mov eax, -10
mov ebx, 2
idiv ebx

print str$(eax)

push 1
push offset stop
call StdIn

push 0
call ExitProcess

end start


in the result i get 2147483643. It should be -5. What I'm doing wrong?

jj2007

                        ; xor                edx, edx
                        mov                eax, -10
                        cdq

->\masm32\help\Opcodes.chm  ;)

kejt