
	SECTION	ReportError,CODE

		
;****************************************************************	
;**** This routine informs the user of an error.             ****
;****                                                        ****
;**** ErrorMessage points to a NULL terminated error message ****
;****************************************************************

ReportError:	TST.L	Message
		BEQ	RE_ErrorToCLI
	
	;Create a Workbench Requestor with the error in it
		MOVE.L	IntBase,A6
		MOVE.L	TaskPtr,A0
		MOVE.L	pr_WindowPtr(A0),A0
		LEA	ReqBodyText,A1
		MOVE.L	#0,A2
		LEA	ReqOkayText,A3
		CLR.L	D0
		CLR.L	D1
		MOVE.L	#640,D2
		MOVE.L	#150,D3
		JSR	_LVOAutoRequest(A6)
		RTS
		
	;Firstly we must find the length of the error message
RE_ErrorToCLI:	MOVE.L	ErrorMessage,A1
FindNull:	TST.B	(A1)+
		BNE	FindNull
		SUB.L	#1,A1
		SUB.L	ErrorMessage,A1
		
	;Store the Pointer & Length on the Stack
		MOVE.L	A1,-(A7)
	
	;Get the Default Output
		MOVE.L	DosBase,A6
		JSR	_LVOOutput(A6)
		MOVE.L	D0,DefaultOutput
		
	;Write the Error message
		MOVE.L	DosBase,A6
		MOVE.L	D0,D1		;File Handle
		MOVE.L	(A7)+,D3	;Text Length
		MOVE.L	ErrorMessage,D2	;Text Start Address
		JSR	_LVOWrite(A6)
		
	;Write a Line Feed too.
		MOVE.L	DosBase,A6
		MOVE.L	DefaultOutput,D1
		MOVE.L	#LineFeed,D2
		MOVE.L	#1,D3
		JSR	_LVOWrite(A6)
		
		RTS
	
		SECTION data,data

DefaultOutput:	DC.L	0		;Text Output Handle for CLI

ReqBodyText:	DC.B	1		;Front Pen
		DC.B	0		;Back Pen
		DC.B	RP_JAM1		;Draw Mode
		DC.W	0,24		;Left Edge/Top Edge
		DC.L	TopazFont	;Font Pointer
		DC.L	ReqNullText	;Text for item
		DC.L	ReqBodyText2	;Next Structure

ReqBodyText2:	DC.B	1		;Front Pen
		DC.B	0		;Back Pen
		DC.B	RP_JAM1		;Draw Mode
		DC.W	0,16		;Left Edge/Top Edge
		DC.L	TopazFont	;Font Pointer
ErrorMessage:	DC.L	0		;Text for item
		DC.L	0		;Next Structure

ReqOkayText:	DC.B	1		;Front Pen
		DC.B	0		;Back Pen
		DC.B	RP_JAM1		;Draw Mode
		DC.W	0,0		;Left Edge/Top Edge
		DC.L	TopazFont	;Font Pointer
		DC.L	ReqOkayTxt	;Text for item
		DC.L	0		;Next Structure

LineFeed:	DC.B	10,0

ReqOkayTxt:	DC.B	"OKAY",0

ReqNullText:	Dc.B	"",0

