	model	large compiler_text,pascal
	include	compiler.inc

	.data?

ErrorMem	dw	?

	.code	compiler_text

	public	SetErrHandler
	public	IdentError
	public	ParamError
	public	ParamError2
	public	CompileError
	public	Error

SetErrHandler	proc	near
	mov	ErrorHandler,ax
	xor	ax,ax
	mov	ErrorNum,ax
	mov	ErrorPar,ax
	mov	ErrorPos,ax
	Invoke	MarkMem
	mov	ErrorMem,bx
	pop	ax
	mov	ErrorSP,sp
	mov	ErrorBP,bp
	jmp	ax
SetErrHandler	endp

IdentError	proc	near
	lea	di,IdentBuf
	push	ds
	pop	es
ParamError	label	near
	lea	si,FileNameBuf
	mov	ErrorPar,si
	push	ax
	Invoke	Pas2C
	pop	ax
	jmp	short CompileError
ParamError2	label	near
	mov	si,dx
	lea	di,FileNameBuf
	mov	ErrorPar,di
	push	ax
	Invoke	CopyDSCStr
	pop	ax
CompileError	label	near
Error	label	far
	mov	ErrorNum,ax
	mov	sp,ErrorSP
	mov	bp,ErrorBP
	mov	bx,ErrorMem
	Invoke	ReleaseMem
	Invoke	CloseAll
	jmp	ErrorHandler
IdentError	endp

	end
