When my program goes to 'div X2' it throws an expeption "integer overflow". X2 is a word value (0x00000002 in this case).
...
mov bx, WORD PTR [eax]
xor eax, eax
mov ax, bx
div X2
mov ecx, pEchoBuffer
mov WORD PTR [ecx+esi],ax
...
What is wrong? :)
Thanks in advance,
Peter
do a
xor edx,edx
beforehand. It overflows because you're dividing a large 64-bit value (probably edx>1) by the small 32-bit value.
You were right Ultrano, the value of edx was much more > 1 :)
But it still didn`t work.
I solved the problem by replacing
div X2
with
div WORD PTR X2
Now it works :D