;==============================================
; PROGRAM TITLE:  CONSOLE STATUS
; WRITTEN BY:	  Raymond E. Penley
; DATE WRITTEN:   July 1981
;
; RETURNS:
;    TRUE - IF CHAR IS WAITING. KEY HAS BEEN PRESSED.
;    FALSE - IF NO CHAR IS WAITING. NO KEY PRESSED.
;
; CALL AS:
;    function constat: boolean;
;
	NAME CONSTAT
	ENTRY CONSTAT
;
CONSTAT:
	; save these regs when leaving for unfriendly territory.
	push	x
	push	y
	;
	; CP/M constat function call
	; accumulator lsb = 1 if char in waiting
	;
	mvi	c,11	; CP/M constat function
	call	5	; call CP/M entry point
	;
	; restore our regs.
	;
	pop	y
	pop	x
	;
	ani 1		; lsb set?
	jrnz finish	; YES, char in waiting
	;
	; NO char in waiting
	; Pascal/Z boolean functions returning carry clear = false.
	; In all cases the accum must be clear upon return.
	;
	xra	a	; zero accum/clear carry
	ret
	;
finish: ; char in waiting
	; return carry set = true
	xra	a
	stc
	ret
	;
	;

	xra	a	; zero accum/clear carry
	ret
	;
finish: