'===========================================================================
' Subject: VERTICAL RETRACE DELAY             Date: 07-21-95 (16:50)       
'  Author: Kurt Kuzba                         Code: QB, QBasic, PDS        
'  Origin: FidoNet QUIK_BAS Echo            Packet: DATETIME.ABC
'===========================================================================
'Does anybody know how stable this routine might be?
'Would it be necessary to test the scan intervals in a second
'in order to achieve accuracy, or would assumption of 70 scans
'per second be correct in all cases. With a resolution of 70:sec
'we get accuracy to .014285714 seconds, which is quite a bit
'better than the DOS clock at &H46C, with a resolution of 18:sec
'and an accuracy to .054931641 seconds. It would only take two
'seconds to run a test of the number of scans per second.
'Even with a slower video system, with a resolution of 60:sec
'we get accuracy to .016666667 seconds, or .02 with 50:sec.
'I'd like to avoid the routine to read the scans per second, which is
'   scans% = 0
'   begin& = timer
'   WHILE begin& = timer: WEND
'   begin& = timer
'   WHILE begin& = timer
'      WHILE (INP(&H3DA) AND 8): WEND
'      WHILE (INP(&H3DA) AND 8) = 0: WEND
'      scans% = scans% + 1
'   WEND
'but I fear it would be necessary unless the program specified VGA only.
'And does anybody know what is at I/O port 65, and what it is for?

' [=-=]  SCANTIMR.BAS     [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=]
' [=-=]  This program demonstrates a method for using the     [=-=]
' [=-=]  vertical retrace as a program timer.                 [=-=]
' [=-=]  Released to the Public Domain      by    Kurt Kuzba  [=-=]
' [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=]
COLOR 9, 0: CLS
INPUT "Seconds to pause"; s!
PRINT "Pausing for"; INT(s! * 70); "scan intervals."
'PRINT "begin "; TIME$
PRINT "begin "; TIMER         '<-- Added by Carl!
FOR t% = 0 TO INT(s! * 70)
   WHILE (INP(&H3DA) AND 8): WEND
   WHILE (INP(&H3DA) AND 8) = 0: WEND
NEXT
'PRINT "end   "; TIME$
PRINT "end   "; TIMER         '<-- Added by Carl!
'BEEP
WHILE INKEY$ = "": WEND
' [=-=]  SCANTIMR.BAS     [=-=] [=-=] [=-=] [=-=] [=-=] [=-=] [=-=]
