include	clib.inc
include	errno.inc

PPROC 	oswrite, h:word, b:DPTR, z:word
	MPUSH	ds
	MLDS	dx,b
	mov	bx,h
	mov	cx,z
	mov	ax,4000h
	int	21h
	MPOP	ds
	jc	oswrite_error
	cmp	ax,cx
	jne	oswrite_ersize
    oswrite_end:
	ret
    oswrite_ersize:
	mov	ax,ER_DISK_FULL
    oswrite_error:
	call	@dosmaper
	xor     ax,ax
	jmp	oswrite_end
PEND	oswrite

	END
