]> git.sur5r.net Git - cc65/blob - libsrc/atari/write.s
Don't add a mode when opening files for reading
[cc65] / libsrc / atari / write.s
1 ;
2 ; int __fastcall__ write (int fd, const void* buf, unsigned count);
3 ;
4         .include "atari.inc"
5         .import __rwsetup,__do_oserror,__inviocb,__oserror
6         .export _write
7 _write:
8         jsr     __rwsetup       ; do common setup
9         beq     write9          ; if size 0, it's a no-op
10         cpx     #$FF            ; invalid iocb?
11         beq     _inviocb
12         lda     #PUTCHR
13         sta     ICCOM,x
14         jsr     CIOV
15         bpl     write9
16         jmp     __do_oserror    ; update errno
17
18 write9:
19         lda     ICBLL,x         ; get buf len lo
20         pha
21         lda     ICBLH,x         ; buf len hi
22         tax
23         lda     #0
24         sta     __oserror       ; clear system dependend error code
25         pla
26         rts
27
28 _inviocb:
29         jmp     __inviocb