Added comments to cbm.h.
load/save returns oserror code. Added open/close and read (which is not tested yet). git-svn-id: svn://svn.cc65.org/cc65/trunk@637 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
24
libsrc/cbm/cbm_read.c
Normal file
24
libsrc/cbm/cbm_read.c
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#include <cbm.h>
|
||||
|
||||
extern unsigned char _oserror;
|
||||
|
||||
int cbm_read(unsigned char lfn, void* buffer, unsigned int size)
|
||||
{
|
||||
static unsigned int bytesread;
|
||||
static unsigned char tmp;
|
||||
|
||||
if (_oserror = cbm_k_chkin(lfn)) return -1;
|
||||
|
||||
bytesread = 0;
|
||||
|
||||
while (bytesread<size) {
|
||||
tmp = cbm_k_basin();
|
||||
if (cbm_k_readst()) break;
|
||||
((unsigned char*)buffer)[bytesread++] = tmp;
|
||||
}
|
||||
|
||||
cbm_k_clrch();
|
||||
|
||||
return bytesread;
|
||||
}
|
||||
Reference in New Issue
Block a user