include	clib.inc
include	stdio.inc

CPROC	fprintf, file:DPTR, format:DPTR, argptr:DPTR
	push	si
	push	di
	lea	si,argptr
	mov	di,word ptr file
	MMOV	ax,word ptr file+2
	MPUSH	ax
	MPUSH	ax
	push	di
	call	_stbuf
	MPOP	dx
	push	ax
	MPUSH	dx
	push	di
	MPUSH	dx
	push	di
	MPUSH	word ptr format+2
	push	word ptr format
	MPUSH	ss
	push	si
	call	_output
	mov	si,ax
	call	_ftbuf
	mov	ax,si
	pop	di
	pop	si
	ret
PEND	fprintf

	END
