]> git.sur5r.net Git - cc65/blob - libsrc/atari/close.s
Don't add a mode when opening files for reading
[cc65] / libsrc / atari / close.s
1 ;
2 ; Christian Groessler, May-2000
3 ;
4 ; int __fastcall__ close(int fd);
5 ;
6
7         .include "atari.inc"
8         .export _close
9         .import __do_oserror,popax,__oserror
10         .import fdtoiocb_down,__inviocb
11
12 .proc   _close
13         jsr     fdtoiocb_down           ; get iocb index into X and decr. usage count
14         bmi     inverr
15         bne     ok                      ; not last one -> don't close yet
16         lda     #CLOSE
17         sta     ICCOM,x
18         jsr     CIOV
19         bmi     closerr
20 ok:     ldx     #0
21         stx     __oserror               ; clear system specific error code
22         txa
23         rts
24
25 inverr: jmp     __inviocb
26 closerr:jmp     __do_oserror
27
28 .endproc
29