Forum archive
Question about your timer routine
- Hi Ken,
I just wanted to know, when you initalize your timer routine, does to delay(), function work after that? Look the DSP needs about 100 miliseconds to reset itself. Re: Question about your timer routine
I never used the delay() function in DOS programming, so I'm not sure. If the C library function uses IRQ0 for timing, then I would expect it to finish sooner than desired. Typically, I would set the timer to interrupt at a rate of 120Hz or 240Hz.- So, how do you make delay like the delay() function?
- I use the counter from my timer interrupt handler. For example:
//volatile long totalclock; //<-- incremented in timer handler at a rate of TIMERINTSPERSECOND Hertz
void bdelay (long time_ms)
{
long waitlcock;
waitclock = totalclock + (time_ms*TIMERINTSPERSECOND)/1000;
while (totalclock < waitclock);
} - Another thing Ken, is the totalclock ideal for timing? Like you have a title screen that lasts for 15 seconds or so.
- y
- All right, I wanted to know how to use it, say a weapon that goes up or down, I want to time it using totalclock, so that it is timed like other Build Engine games. I never tried to do this, so can you write exactly how to do it?
- The solution to this does not require specific knowledge of the Build Engine. Go find a math tutorial and do it yourself.