include	clib.inc
include	iost.inc

	public	ogetc

_TEXT	SEGMENT

ogetc	PROC
	mov	ax,STDI.ios_i
	cmp	ax,STDI.ios_c
	je	ogetc_read
    ogetc_do:
	inc	STDI.ios_i
	les	bx,STDI
	add	bx,ax		; es:0 == zero flag set
	inc	ax
	mov	ah,0
	mov	al,es:[bx]
	ret
    ogetc_read:
	push	cx
	push	dx
	call	ofread
	pop	dx
	pop	cx
	mov	ax,STDI.ios_i
	jnz	ogetc_do
	mov	ax,-1
	ret
ogetc	ENDP

_TEXT	ENDS

	END
