ok I have used div before without errors and I looked around and seen examples of it being useed, Its not exactly rocket science; I thought.

div ecx

My app is crashing, i traced it to that command
it takes me to NT's exception dispatcher.

mov ebx,pMemory
mov ecx,FileSizeU
@@:
cmp BYTE PTR ,0
jnz NO0
inc eax
NO0:
inc ebx
dec ecx
jnz @b
mov ecx,00000003h
div ecx
mov Total,eax

why oh why oh why

HELP!!!!!!!!!!!!!:confused: :confused:

i tried div (ram var)
div cl
div cx

all same problem

idiv == same issue
Posted on 2002-10-24 18:53:24 by dionysus
Looks to me like you forgot to clear EDX before the DIV. Remember, when you divide by a 32 bit number, the dividend is the 64 bit number in EDX:EAX.

:)
Posted on 2002-10-24 20:14:55 by S/390
Maybe it's not div, but some memory protection fault. Check pMemory...
Posted on 2002-10-25 01:52:46 by Vaxon

Looks to me like you forgot to clear EDX before the DIV. Remember, when you divide by a 32 bit number, the dividend is the 64 bit number in EDX:EAX.

:)


I had the same problem before, XOR out EDX before you attempt to execute the divide instruction or else you will get an integer overflow.
Posted on 2002-10-25 16:40:45 by x86asm
cdq for idiv
Posted on 2002-10-25 16:55:10 by stryker