Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
This code calls my divide by 0 exception handler, and I don't know why.
It's because the DIV instruction divides a 64-bit unsigned integer (in EDX:EAX) by a 32-bit divisor (in ECX in your case). You don't set EDX to zero, so you could be dividing a huge number (e.g. 0xFFFFFFFF00000004) by 2.
Also note that you get a "divide error" exception when the result doesn't fit in 32-bits (which includes "infinity"). If EDX was 2 or larger the result won't fit in 32-bits and...
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.