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

;
;  POUT -- 
;	PUNCH OUTPUT ROUTINE
;	OUTPUT CHAR IN REG A ON PUN:
;	AFFECT NO REGISTERS OR FLAGS
;
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

POUT::
	PUSH	PSW	; SAVE REG A AND FLAGS
	PUTRG		; SAVE REGISTERS
	MOV	C,A	; CHAR IN C
	LHLD	JTABL	; GET ADDRESS OF JUMP TABLE
	MVI	L,P$OFF	; PUNCH OUTPUT ADR
	LXI	D,PRET	; SET UP RET ADR
	PUSH	D	; ... ON STACK
	PCHL
PRET:	GETRG		; RESTORE REGISTERS
	POP	PSW	; RESTORE REG A AND FLAGS
	RET

BOOT	EQU	0	; CP/M BOOT ADDRESS
JTABL	EQU	BOOT+1	; CP/M JUMP TABLE ADDRESS
P$OFF	EQU	12H	; PUNCH OUTPUT OFFSET

	END
