Compucolor.org – Virtual Media

Listing of file='CONSOL.MAC;01' on disk='vmedia/forutil_1-sector.ccvf'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	CONSOLE I/O ROUTINES
;
	TITLE CONSOL

;
;	CONSOLE INPUT WITH OPTIONAL TIMEOUT
;
;	CALLING SEQUENCE:
;	   CHR = CI(SECS)    I.E. BYTE FUNCTION
;	CHR, SECS - BYTE
;	IF SECS=0 NO TIMEOUT OCCURS, OTHERWISE, SECS IS THE
;	NUMBER OF SECONDS TO WAIT FOR A RESPONSE.
;
;	RETURNS:
;	   THE CHARACTER TYPED BY THE USER, OR FFH IF A
;	TIMEOUT OCCURED.
;

KEYTST	EQU	0024H
READY	EQU	81FFH

	ENTRY	CI

CI:	MOV	A,L
	ORA	A
	PUSH	PSW
CI10:	LXI	B,28CEH
CI20:	CALL	KEYTST
	JZ	FOUND
	POP	PSW
	PUSH	PSW
	JZ	CI20
	DCX	B
	MOV	A,C
	ORA	B
	JNZ	CI20
	DCR	L
	JNZ	CI10
	MVI	A,0FFH
FOUND:	POP	B
	MOV	B,A
	XRA	A
	STA	READY
	MOV	A,B
	RET

;..............................................................
;
;	CONSOLE OUTPUT ROUTINE
;
;	CALLING SEQUENCE:
;	   CALL CO(CHR)
;	CHR - BYTE
;
;	RETURNS:
;	   NOTHING
;
BASOUT	EQU	0033H

	ENTRY	CO

CO:	MOV	A,M
	CALL	BASOUT
	RET

	END