'===========================================================================
' Subject: program delaying routine           Date: 03-16-03 (  :  )       
'  Author: Mario LaRosa                       Code: QB, PDS                
'  Origin: ESmemberNEMESIS@aol.com          Packet: DATETIME.ABC
'===========================================================================
'''
' Qdelay v1.1, a pure QB, program delaying routine.
'
' Brought to you by... MARIO SOFT.
'
' (C)opyright 2002
'
' Contact me at ESmemberNEMESIS@aol.com
' If you have any questions or comments concerning these routines.
'
' THIS PROGRAM MAY BE DISTRIBUTED FREELY AS PUBLIC DOMAIN SOFTWARE
' AS LONG AS ANY PART OF THIS FILE IS NOT ALTERED IN ANY WAY.
' IF YOU DO WISH TO USE THESE ROUTINES IN YOUR OWN PROGRAMS
' THEN PLEASE GIVE CREDIT TO THE AUTHOR... Mario LaRosa.
'
'''
'                         
'$DYNAMIC
'
DEFINT A-Z
'
DECLARE SUB QDELAY (seconds!)
'
SCREEN 0
COLOR 7
CLS
'
QDELAY 0                        'Always calibrate routine first.
'                          
DO: LOOP UNTIL TIMER <> TIMER
'
DO
 '
 t! = TIMER
 '
 QDELAY 1 / 2                   'Delay approx. 1/2 seconds.
 '
 PRINT TIMER - t!; " seconds"
 '
LOOP UNTIL LEN(INKEY$)
'
SYSTEM
'
TIMERinterrupt:
 sys& = clc&: clc& = &H7FFFFFFE
RETURN
'

REM $STATIC
SUB QDELAY (seconds!) STATIC
 '
 SHARED sys&, clc&
 '
 IF seconds! THEN
  '
  del& = sys& * seconds!
  '
  FOR clc& = 1 TO del&: NEXT
  '
 ELSE
  '
  ON TIMER(1) GOSUB TIMERinterrupt
  '
  DO: LOOP UNTIL TIMER <> TIMER
  '
  TIMER ON
  '
  FOR clc& = 1 TO &H7FFFFFFE: NEXT
  '
  TIMER OFF
  '
 END IF
 '
END SUB


