;	kmaygetchar.a - KMayGetChar implementation using ROM routines
;	$VER: kmaygetchar.a 37.1 (10.5.96)
;	Copyright © 1996 Michael Letowski
;
;	37.1 (10.5.96) - initial version

	include	"exec/funcdef.i"
	include	"exec/exec_lib.i"

	xdef	_KMayGetChar
	xdef	@KMayGetChar

; Some aliases

	xdef	KMayGetChar

	section	text,code


******* debug.lib/KMayGetChar ***********************************************
*
*   NAME
*       KMayGetChar -- get a character from debugging console if present,
*                      but don't wait. (V37)
*
*   SYNOPSIS
*       flagchar = KMayGetChar()
*       D0
*
*       LONG KMayGetChar(VOID);
*
*   FUNCTION
*       Checks the status of the debugging console (defaults to the serial
*       port at 9600 baud). Returns either -1, saying that there is no
*       character present, or whatever character was waiting.
*
*   RESULT
*       char - a character that arrived from console, or -1 if there was
*              no char waiting.
*
*   NOTES
*       @KMayGetChar and KMayGetChar are identical assembly interfaces.
*       _KGetChar is the C interface.
*
*****************************************************************************
*
* _KMayGetChar(void)
* @KMayGetChar(void)
*
_KMayGetChar:
@KMayGetChar:
KMayGetChar:
	move.l	a6,-(sp)			; Save a6
	move.l	(4).w,a6			; Load a6 with SysBase
	jsr	_LVORawMayGetChar(a6)		; Get char, no matter if available
	move.l	(sp)+,a6			; Restore a6
	rts					; Return d0

	end
