From 1f88a38e2e1f03951160491ea75364f39fec1286 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 27 Jun 2022 17:59:21 -0500 Subject: [PATCH] Clear the EOF flag on successful calls to ungetc(). This is specified by the C standards. --- stdio.asm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdio.asm b/stdio.asm index 6f81bbf..6fe66b5 100644 --- a/stdio.asm +++ b/stdio.asm @@ -3194,8 +3194,11 @@ char equ 1 character to return and #$00FF sta [stream],Y sta char -rts long M - creturn 2:char + ldy #FILE_flag clear the EOF flag + lda [stream],Y + and #$FFFF-_IOEOF + sta [stream],Y +rts creturn 2:char end ****************************************************************