;CP/M PROGRAM TO CLEAR SCREEN AND HOME CURSOR (SETUP FOR ^Z)
;
;COPYRIGHT (C) 1985 BY ERNEST SPENCER OF JACKSON, MS.
;
;*** THIS PROGRAM MAY BE USED FREELY BY THE CP/M USER COMMUNITY FOR
;NON-COMMERCIAL PURPOSES - ERNEST SPENCER - 06/06/85 ***
;
;ASSEMBLE WITH ASM.COM
;
;USE WITH ANY CP/M COMPUTER BY CHANGING THE CLEAR EQUATE TO
;THAT COMPUTER'S CLEAR SCREEN & HOME CURSOR ASCII CHARACTER CODE.
;
;RETURNS TO CP/M PROMPT WITHOUT DOING A WARM BOOT.
;
;WORKS WITH ANY SIZE CP/M SYSTEM SINCE IT INITIALLY DETERMINES
;PROMPT AREA OF CCP BY SAVING ITS ADDRESS ON STACK AND
;THEN RETURNS TO IT WHEN THROUGH INSTEAD OF DOING WARM BOOT.
;
	ORG	100H	;BEGINNING OF TPA FOR STANDARD CP/M
;
CONOUT	EQU	02H	;SYSTEM CALL TO OUTPUT A CHAR. TO CONSOLE
CLEAR	EQU	026	;CLEAR SCREEN CHAR. (^Z FOR KAYPRO 4)
ENTRY	EQU	05H	;CP/M ENTRY POINT
;
START:	LXI	H,0	;ZERO HL REGISTER
	DAD	SP	;GET OLD CP/M CCP PROMPT STACK POINTER
	SHLD	STACK	;SAVE IT
	LXI	SP,STACK;SET NEW STACK POINTER
;
	MVI	E,CLEAR	;LOAD CLEAR SCREEN CHAR. INTO E REG.
	MVI	C,CONOUT;LOAD SYSTEM CALL TO OUTPUT A CHAR.
	CALL	ENTRY	;CALL CP/M TO OUTPUT CLEAR CODE & CLEAR SCREEN
;
EXIT:	LHLD	STACK	;GET OLD CP/M CCP PROMPT STACK
	SPHL		;RESTORE OLD STACK POINTER
	RET		;RETURN TO CCP & DO PROMPT W/O WARM BOOT
;
	DS	2	;ROOM FOR 1 LEVEL STACK PLUS OLD STACK
STACK	DS	2	;OLD CP/M STACK SAVED HERE
;
	END
CP & DO PROMPT W/O WAR