		SUBTITLE	"< Systerm Error display routine. >"
		NEWPAGE
		scope

		ORG	zspace.SYSERROR$
			
;	System error display routine
;	The NOP is provided so an intercept routine vector
;	may be patched in during program development

SVCERR		LD	A,43			;SVC error
		NOP	
SYSERR		AND	3Fh			;Strip excess bits
		LD	HL,ERRNUM		;Pack error number
		CALL	zHEX8			;into message
		LD	HL,SYSERR$
		CALL	zLOGOT			;Log the error & ABORT
		LD	SP,STACK$		;reset stack
zABORT		LD	HL,-1
zEXIT		LD	A,93h			;Exit to DOS
		RST	40
POPERR		POP	HL			;Pop extended error
zERROR		PUSH	AF			;Save the error code
		LD	A,96h			;Display the error number
		RST	40
SYSERR$		DB	"Error "
ERRNUM		DB	"xxH",CR.asc

