Use delta timing.
In your main loop put something like..
Just as an example but you should be able to get the idea.
Function DeltaTiming(period) If (MilliSecs() > (delta_timer + period)) Then delta_timer=MilliSecs() ; 'reset' the timer Return(True); End If Return(False); End Function
In your main loop put something like..
Global delta_timer = MilliSecs(); While( Not KeyHit(1)) If(DeltaTiming(25)) Then UpdateControl(); UpdateGraphics(); End If Wend
Just as an example but you should be able to get the idea.