2 * Marc 'BlackJack' Rintsch, 19.03.2001
4 * int cbm_read(unsigned char lfn, void* buffer, unsigned int size);
9 extern unsigned char _oserror;
11 int cbm_read(unsigned char lfn, void* buffer, unsigned int size)
13 static unsigned int bytesread;
14 static unsigned char tmp;
16 /* if we can't change to the inputchannel #lfn then return an error */
17 if (_oserror = cbm_k_chkin(lfn)) return -1;
21 while (bytesread<size && !cbm_k_readst()) {
24 /* the kernal routine BASIN sets ST to EOF if the end of file
25 * is reached the first time, then we have store tmp.
26 * every subsequent call returns EOF and READ ERROR in ST, then
27 * we have to exit the loop here immidiatly. */
28 if (cbm_k_readst() & 0xBF) break;
30 ((unsigned char*)buffer)[bytesread++] = tmp;