Can you still use inp and out in 32bit protected mode?

DOS specific questions.
Post Reply
SMC
Posts: 33
Joined: Feb 22, 2012 4:05

Can you still use inp and out in 32bit protected mode?

Post by SMC »

I'm trying to make a vsync funtion in dos.

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
Imortis
Moderator
Posts: 1980
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Can you still use inp and out in 32bit protected mode?

Post by Imortis »

freeBASIC already has this. See the docs on ScreenSync
SMC
Posts: 33
Joined: Feb 22, 2012 4:05

Re: Can you still use inp and out in 32bit protected mode?

Post by SMC »

Thanks, I thought it had a vsync routine, but I forgot what it was called and was looking in the wrong places.
Post Reply