;
; SYSLIB Module Name:  SCPOUT
; Author:  Richard Conn
; SYSLIB Version Number:  2.0
; Module Version Number:  1.0
; Module Entry Points:
;	CPOUT
; Module External References:
;	POUT
;

;
;  CPOUT --
;	PUNCH OUTPUT ROUTINE WITH CONTROL CHARACTER PROCESSING
;	OUTPUT CHAR IN REG A ON PUN:
;	AFFECT NO REGISTERS OR FLAGS
;
	EXT	POUT

CPOUT::
	CPI	' '	; CHECK FOR LESS THAN <SP>
	JNC	POUT	; PROCESS NORMALLY IF EQUAL OR GREATER
;  TRAP OUT <NULL>, <BEL>, <BS>, <LF>, <CR>
	CPI	NULL	; <NULL>
	JZ	POUT
	CPI	BEL	; <BEL>
	JZ	POUT
	CPI	BS	; <BS>
	JZ	POUT
	CPI	LF	; <LF>
	JZ	POUT
	CPI	CR	; <CR>
	JZ	POUT
;  PRINT AS CTRL-CHAR
	PUSH	PSW	; SAVE A
	PUSH	PSW
	MVI	A,'^'	; PRINT UP ARROW
	CALL	POUT
	POP	PSW	; GET CHAR
	ADI	40H	; CONVERT TO CHAR
	CALL	POUT
	POP	PSW	; RESTORE A
	RET

;
;  ASCII SPECIAL CHARACTER EQUATES
;
NULL	EQU	 0	; NULL
BEL	EQU	 7	; BELL
BS	EQU	 8	; BACKSPACE
TAB	EQU	 9	; TAB
LF	EQU	10	; LINE FEED
CR	EQU	13	; CARRIAGE RETURN
CTRLR	EQU	'R'-40H	; CTRL-R
CTRLU	EQU	'U'-40H	; CTRL-U
CTRLX	EQU	'X'-40H	; CTRL-X
DEL	EQU	7FH	; DELETE CHAR

	END
