include	clib.inc
include	io.inc
include	iost.inc
include	errno.inc

PPROC	openfile, fname:dword, mode:word, action:word
	invoke	osopen, fname, _A_NORMAL, mode, action
	cmp	ax,-1
	je	openfile_err
    openfile_end:
	ret
    openfile_err:
	mov	dx,word ptr fname+2
	mov	ax,word ptr fname
	call	eropen
	jmp	openfile_end
PEND	openfile

	END
