summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-12 15:48:25 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-12 15:48:25 -0800
commitc9e35f37217f25f1f576754df464a8ec0d6d22fe (patch)
treef7448dfe918207f0f2429112fd5846be9a0d7f22
parent2ad6602fb7401b415b058f5dcf70f377b9113412 (diff)
downloadsyslinux-c9e35f37217f25f1f576754df464a8ec0d6d22fe.tar.gz
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.
-rw-r--r--getc.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/getc.inc b/getc.inc
index 4a9d2433..275c0fab 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