2 ; Christian Groessler, Apr-2000
4 ; int __fastcall__ read(int fd,void *buf,int count)
8 .import __rwsetup,__do_oserror,__inviocb,__oserror
11 _read: jsr __rwsetup ; do common setup for read and write
12 beq done ; if size 0, it's a no-op
13 cpx #$FF ; invalid iocb?
15 lda #GETCHR ; iocb command code
19 cpy #EOFERR ; eof is treated specially
21 jmp __do_oserror ; update errno
23 done: lda ICBLL,x ; buf len lo
25 lda ICBLH,x ; get buf len hi
28 sta __oserror ; clear system dependend error code