Code: Select all
''vsync with freebasic
Declare Sub vsync()
Screen 13
SetMouse ,,0
Dim count as Integer
Dim seconds as Integer
Do
Do
count = count + 1
vsync
Loop Until count = 70 ''only counts to 33 because vsync tested twice
seconds = seconds + 1
Locate 1, 1
Print Space(20)
Locate 1, 1
Print "seconds: "; seconds
count = 0
Loop Until Inkey <> ""
''Works best with screen 13
Sub vsync()
''wait for vsync then return
const STATUS = &H3DA
const MASK = &H8
''first test
Do
If Inkey = Chr(27) Then End
Loop While (Inp(STATUS) And MASK) = &H0
''second test, ensures you process at the start of a vertical trace
Do
If Inkey = Chr(27) Then End
Loop While (Inp(STATUS) And MASK) = MASK
End Sub