[futurebasic] Re: Speaking of Speed...

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Bill Sanford <bsanford@...>
Date: 18 Dec 97 11:16:07 -0600
You might want to try the following code for delays.

It will allow for extremely accurate timing...

If you use a positive number for msCount& the delay is in milliseconds.  
If you use a negative number for msCount& the delay is in microseconds.

Enjoy!!


Bill Sanford
Sanford Communications
Specializing in Broadcast Automation Software for the Mac

'=================================================

LOCAL MODE
LOCAL FN InsXTime(tmTaskPtr&)
  `     MOVE.L    ^tmTaskPtr&,-(SP)               ;QElemPtr
  `     DC.W      $205F,$A458
END FN

'=================================================

LOCAL MODE
LOCAL FN PrimeTime(tmTaskPtr&,count&)
  `     MOVE.L    ^tmTaskPtr&,-(SP)               ;QElemPtr
  `     MOVE.L    ^count&,-(SP)                   ;LONGINT
  `     DC.W      $201F,$205F,$A05A
END FN

'=================================================

LOCAL MODE
LOCAL FN RmvTime(tmTaskPtr&)
  `     MOVE.L    ^tmTaskPtr&,-(SP)               ;QElemPtr
  `     DC.W      $205F,$A059
END FN

'=================================================

CLEAR LOCAL MODE
LOCAL FN DelayMS(msCount&)
  DIM delayTaskRec.24
  _tmUser = 22
  delayTaskRec.tmAddr&     = LINE "DelayTask"
  delayTaskRec.tmCount&    = 0
  delayTaskRec.tmReserved& = 0
  FN InsXTime(@delayTaskRec)
  FN PrimeTime(@delayTaskRec,msCount&)
  DO
  UNTIL delayTaskRec.tmUser%
  FN RmvTime(@delayTaskRec)
  EXIT FN
  "DelayTask"
  `   ADDA.L  #tmUser,A1
  `   MOVE.W  #1,(A1)
  `   RTS
END FN