include	clib.inc
include	iost.inc

	public	oputc

_TEXT	SEGMENT

oputc	PROC
	push	bx
	mov	bx,STDO.ios_i
	cmp	bx,STDO.ios_size
	je	oputc_flush
    oputc_ok:
	les	bx,STDO
	add	bx,STDO.ios_i
	inc	STDO.ios_i
	mov	es:[bx],al
	mov	ax,1
    oputc_eof:
	pop	bx
	ret
    oputc_flush:
	push	cx
	push	dx
	push	ax
	call	oflush
	pop	ax
	pop	dx
	pop	cx
	jnz	oputc_ok
	xor	ax,ax
	jmp	oputc_eof
oputc	ENDP

_TEXT	ENDS

	END
