2 ; common iocb setup routine for read, write
3 ; expects __fastcall__ parameters (int fd, void *buf, int count)
8 .import incsp4,ldax0sp,ldaxysp
9 .import __errno,__oserror
17 stx tmp3 ; remember size
20 jsr fdtoiocb ; convert to iocb
23 cpx #$80 ; iocb must be 0...7
30 jsr ldax0sp ; get buf addr
38 ora ICBLH,x ; return with Z if length was 0
41 iocberr:jsr incsp4 ; pop args
42 ldx #$FF ; indicate error + clear ZF
47 ; this routine updates errno. do a JMP here right after calling
48 ; CIOV. we expect status in Y.
50 .export __do_oserror,__seterrno,__inviocb
52 sty __oserror ; save os dependent error code
64 ; sets EINVAL error code and returns -1
71 jmp retminus ; return -1