From 37173ab394082a5102d04f78ca1b920a9f34b265 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 14 Jul 2008 12:43:50 -0700 Subject: [PATCH] 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". --- core/getc.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/getc.inc b/core/getc.inc index b36115c..ec8dab2 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 -- 2.7.4