;
; SYSLIB Module Name:  SCST
; Author:  Richard Conn
; SYSLIB Version Number:  2.0
; Module Version Number:  1.0
; Module Entry Points:
;	CST
; Module External References:
;	None
;

;
;  CST --
;	CONSOLE STATUS ROUTINE
;	INPUT STATUS OF CON: IN REG A
;	RDA IF 0, NOT RDA IF 1
;
PUTRG	MACRO
	PUSH	B	; SAVE BC, DE, HL
	PUSH	D
	PUSH	H
	ENDM
GETRG	MACRO
	POP	H	; RESTORE HL, DE, BC
	POP	D
	POP	B
	ENDM

CST::
	PUTRG		; SAVE REGISTERS
	LHLD	JTABL	; GET ADDRESS OF JUMP TABLE
	MVI	L,CS$OFF	; CONSOLE STATUS ADR
CST1:	LXI	D,CST1R	; SET UP RET ADR
	PUSH	D	; ... ON STACK
	PCHL		; RUN ROUTINE
CST1R:	CMA		; FLIP FLAGS
	ANI	1	; SET FLAGS -- 0 MEANS RDA
	GETRG		; RESTORE REGISTERS
	RET

BOOT	EQU	0	; CP/M BOOT ADDRESS
JTABL	EQU	BOOT+1	; CP/M JUMP TABLE ADDRESS
CS$OFF	EQU	6	; CONSOLE STATUS OFFSET

	END
