summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-14 12:43:50 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-14 12:43:50 -0700
commit37173ab394082a5102d04f78ca1b920a9f34b265 (patch)
treedbef2eb85352509a9be962cafbe2ad53b7023b93
parent739265499ec8fa1fde1e7ad56ec1e1f01b6a630d (diff)
downloadsyslinux-37173ab394082a5102d04f78ca1b920a9f34b265.tar.gz
getc: add "readc" function to do block reads
Add "readc" function to do block reads. Currently it just does a loop around "call getc/stosb".
-rw-r--r--core/getc.inc20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/getc.inc b/core/getc.inc
index b36115ca..ec8dab2a 100644
--- a/core/getc.inc
+++ b/core/getc.inc
@@ -151,6 +151,26 @@ getc:
stc
jmp .ret
+;
+; This is similar to getc, except that we read up to CX bytes and
+; store them in ES:DI. Eventually this could get optimized...
+;
+; On return, CX and DI are adjusted by the number of bytes actually read.
+;
+readc:
+ push ax
+.loop:
+ call getc
+ jc .out
+ stosb
+ loop .loop
+.out:
+ pop ax
+ ret
+
+;
+; close: close the top of the getc stack
+;
close:
push bx
push si