]> git.sur5r.net Git - cc65/blob - libsrc/atari/sysremove.s
Fixed _textcolor definition.
[cc65] / libsrc / atari / sysremove.s
1 ;
2 ; Christian Groessler, Aug-2003
3 ;
4 ; int remove (const char* name);
5 ;
6
7         .include "atari.inc"
8         .include "errno.inc"
9         .import findfreeiocb
10         .importzp tmp4
11 .ifdef  UCASE_FILENAME
12         .importzp tmp3
13         .import addysp
14         .import ucase_fn
15 .ifdef  DEFAULT_DEVICE
16         .importzp tmp2
17 .endif
18 .endif
19         .export __sysremove
20
21 .proc   __sysremove
22
23         pha                     ; save input parameter
24         txa
25         pha
26
27         jsr     findfreeiocb
28         beq     iocbok          ; we found one
29
30         pla
31         pla                     ; fix up stack
32
33         lda     #TMOF           ; too many open files
34         rts
35
36 iocbok: stx     tmp4            ; remember IOCB index
37         pla
38         tax
39         pla                     ; get argument again
40
41 .ifdef  UCASE_FILENAME
42
43 .ifdef  DEFAULT_DEVICE
44         ldy     #$80
45         sty     tmp2            ; set flag for ucase_fn
46 .endif
47         jsr     ucase_fn
48         bcc     ucok1
49
50         lda     #183            ; see oserror.s
51         rts
52 ucok1:
53
54 .endif  ; defined UCASE_FILENAME
55
56         ldy     tmp4            ; IOCB index
57         sta     ICBAL,y         ; store pointer to filename
58         txa
59         sta     ICBAH,y
60         tya
61         tax
62         lda     #DELETE
63         sta     ICCOM,x
64         lda     #0
65         sta     ICAX1,x
66         sta     ICAX2,x
67         sta     ICBLL,x
68         sta     ICBLH,x
69         jsr     CIOV
70
71 .ifdef  UCASE_FILENAME
72         tya
73         pha
74         ldy     tmp3            ; get size
75         jsr     addysp          ; free used space on the stack
76         pla
77         tay
78 .endif  ; defined UCASE_FILENAME
79
80         bmi     cioerr
81         lda     #0
82         rts
83 cioerr: tya
84         rts
85
86 .endproc        ; __sysremove