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