include	clib.inc
include	stdio.inc
include	string.inc

PPROC	fputs, string:DPTR, fp:DPTR
	MPUSH	si
	push	di
	MMOV	si,word ptr fp+2
	mov	di,word ptr fp
	mov	bx,word ptr string
	MMOV	dx,word ptr string+2
	MPUSH	dx
	push	bx
	call	strlen
	push	ax
	MPUSH	dx
	push	bx
	push	1
	push	ax
	MPUSH	si
	push	di
	MPUSH	si
	push	di
	call	_stbuf
	mov	di,ax
	call	fwrite
	push	di
	MPUSH	si
	mov	si,ax
	push	word ptr fp
	call	_ftbuf
	pop	dx
	xor	ax,ax
	cmp	si,dx
	je	fputs_00
	dec	ax
    fputs_00:
	pop	di
	pop	si
	ret
PEND	fputs

	END
