'===========================================================================
' Subject: TEST KEYBOARD BUFFER FOR CHAR      Date: 08-19-97 (09:59)       
'  Author: Kerry S. Goodin                    Code: QB, PDS                
'  Origin: medvrsys@venus.net               Packet: KEYBOARD.ABC
'===========================================================================
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' -----Instat.bas----                                                      '
' Function to test the keyboard buffer to see if a character is present.   '
'                                                                          '
' ( A key has been pressed).                                               '
' It will not read the character but will return -1 if there is a          '
' character or 0 is there is not a character in the buffer thus leaving    '
' the buffer undisturbed.  This mimics the same function in PowerBasic(c)  '
' but for QB 4.5.                                                          '
' Written by: Kerry S. Goodin, D.D.S.                                      '
'                                                                          '
' USE AT YOUR OWN RISK.                                                    '
'                                                                          '
'note: start QB with the /L QB switch                                      '
'                                                                          '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

DEFINT A-Z
DECLARE FUNCTION instat ()

'$INCLUDE: 'c:\qb45\qb.bi'

DIM SHARED inRegs AS RegType, outRegs AS RegType

FUNCTION instat
	inRegs.ax = &HB00
	CALL INTERRUPT(&H21, inRegs, outRegs)
	IF (outRegs.ax AND &HFF) <> 0 THEN
		instat = -1
	ELSE
		instat = 0
	END IF
END FUNCTION
