mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
787ca6a9dd
git-svn-id: svn://svn.cc65.org/cc65/trunk@639 b7a2c559-68d2-44c3-8de9-860c34a00d81
30 lines
619 B
C
30 lines
619 B
C
/*
|
|
* Marc 'BlackJack' Rintsch, 19.03.2001
|
|
*
|
|
* int cbm_read(unsigned char lfn, void* buffer, unsigned int size);
|
|
*/
|
|
|
|
#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 && !cbm_k_readst()) {
|
|
tmp = cbm_k_basin();
|
|
if (cbm_k_readst() & 0xBF) break;
|
|
((unsigned char*)buffer)[bytesread++] = tmp;
|
|
}
|
|
|
|
cbm_k_clrch();
|
|
|
|
return bytesread;
|
|
}
|