why i've got exception when i try to dinamicly set timer time-out value:

.if TimerWorking==FALSE
mov TimerWorking, TRUE
mov eax, TimeTemp
mov ecx, HowManyTimes
.if (eax>0) && HowManyTimes>0
div ecx
.if eax<60
mov eax, 60
mul SecInMilSec
invoke SetTimer, hWnd, 2, eax, offset AnotherTimerProc

I use this .if conditional in my first timer procedure. Everything is woking fine if i wrote this procedure without div instruction.
What is wrong?
Posted on 2002-02-12 18:56:43 by dJed_mRaz
This is a common problem when you don't clear EDX register.
You have to remember DIV operates on EDX:EAX
Posted on 2002-02-12 19:05:18 by bitRAKE
There Has been many disussions regarding the use of the DIV op-code. I encourage you to use the search engine and look up some of them... as well one of them i "preserved" on my web-page, as i thought it got to the point quick and simple :)


Long story short, dont forget the EDX:EAX pair. This is the equivalent number being divided when the divisor is a 32 bit number.

Good luck..

(( EDIT: you beat me by a minute BitRake.. :grin: ))
Posted on 2002-02-12 19:06:35 by NaN