From 787ca6a9dd43ffcd35bc6eed833903dce4fab1cb Mon Sep 17 00:00:00 2001 From: mrintsch Date: Wed, 21 Mar 2001 20:59:27 +0000 Subject: [PATCH] completed and testet cbm_read() git-svn-id: svn://svn.cc65.org/cc65/trunk@639 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/cbm.h | 6 +++++- libsrc/cbm/Makefile | 2 +- libsrc/cbm/cbm_read.c | 9 +++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/cbm.h b/include/cbm.h index 80ad0de0b..b26673e1c 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -130,8 +130,12 @@ void __fastcall__ cbm_close (unsigned char lfn); /* Closes a file */ int cbm_read(unsigned char lfn, void* buffer, unsigned int size); +/* Reads up to "size" bytes from a file to "buffer". + * Returns the number of actually read bytes, 0 if there are no bytes left (EOF) + * or -1 in case of an error. _oserror contains an errorcode then (see table below). + */ -/* Errorcodes of load, save, open functions: +/* Errorcodes of cbm_* I/O functions: * * errorcode BASIC error * 1 = too many files diff --git a/libsrc/cbm/Makefile b/libsrc/cbm/Makefile index 3a184fe70..5bc350402 100644 --- a/libsrc/cbm/Makefile +++ b/libsrc/cbm/Makefile @@ -23,5 +23,5 @@ S_OBJS = ctype.o getenv.o gotoxy.o gotox.o gotoy.o where.o\ all: $(C_OBJS) $(S_OBJS) clean: - @rm -f *~ $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS) + @rm -f *~ *.bck $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) diff --git a/libsrc/cbm/cbm_read.c b/libsrc/cbm/cbm_read.c index ce83bc91e..1efd203a6 100644 --- a/libsrc/cbm/cbm_read.c +++ b/libsrc/cbm/cbm_read.c @@ -1,3 +1,8 @@ +/* + * Marc 'BlackJack' Rintsch, 19.03.2001 + * + * int cbm_read(unsigned char lfn, void* buffer, unsigned int size); + */ #include @@ -12,9 +17,9 @@ int cbm_read(unsigned char lfn, void* buffer, unsigned int size) bytesread = 0; - while (bytesread