From c9e35f37217f25f1f576754df464a8ec0d6d22fe Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 12 Feb 2008 15:48:25 -0800 Subject: [PATCH] getc: don't clobber AH; return CF=1, AL=0 on end of file Don't clobber AH when calling getc; when returning with CF=1 (EOF), always return with AL=0. --- getc.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/getc.inc b/getc.inc index 4a9d243..275c0fa 100644 --- a/getc.inc +++ b/getc.inc @@ -100,8 +100,9 @@ getc: and bx,bx jnz .have_unget - mov ax,real_mode_seg ; Borrow the real_mode_seg - mov es,ax + mov si,real_mode_seg ; Borrow the real_mode_seg + mov es,si + .got_data: sub word [di+gc_bufbytes],1 jc .get_data ; Was it zero already? @@ -154,6 +155,7 @@ getc: ; to read the file. mov [di+gc_bufbytes],cx popad + xor al,al ; Return a predictable zero stc jmp .ret -- 2.7.4