include	clib.inc
include	stdio.inc

PPROC	fgetc, FP:DPTR
	MLES	bx,FP
	assert	bx,0,jne,"fgetc"
	dec	es:[bx.iob_cnt]
	jl	fgetc_01
	inc	word ptr es:[bx]
	les	bx,es:[bx]
	dec	bx
	mov	al,es:[bx]
	mov	ah,0
    fgetc_00:
	ret
    fgetc_01:
	push	es
	push	bx
	call	_filebuf
	jmp	fgetc_00
PEND	fgetc

	END
