]> git.sur5r.net Git - cc65/blob - libsrc/atari/sysrmdir.s
remove unused import sreg
[cc65] / libsrc / atari / sysrmdir.s
1 ;
2 ; Stefan Haubenthal, 2005-12-24
3 ; Christian Groessler, 2013-07-16
4 ;
5 ; unsigned char __fastcall__ _sysrmdir (const char* name);
6 ;
7 ; for SpartaDOS and MyDOS
8 ;
9
10         .include        "atari.inc"
11         .include        "errno.inc"
12         .export         __sysrmdir
13         .import         __sysremove
14         .import         __dos_type
15         .import         ucase_fn
16         .import         findfreeiocb
17         .import         addysp
18         .importzp       tmp3
19         .importzp       tmp4
20
21 .proc   __sysrmdir
22
23         pha
24         lda     __dos_type
25         beq     not_impl                ; AtariDOS
26         cmp     #OSADOS+1
27         bcc     do_sparta               ; OS/A and SpartaDOS
28         pla
29         jmp     __sysremove             ; MyDOS and others (TODO: check XDOS)
30
31 not_impl:
32         pla
33         lda     #NVALID
34         rts
35
36 iocberr:
37         pla                             ; cleanup stack
38         pla
39         lda     #TMOF
40         rts
41
42 do_sparta:
43         txa
44         pha
45         jsr     findfreeiocb
46         bne     iocberr                 ; no IOCB available
47
48         stx     tmp4                    ; remember IOCB
49         pla
50         tax
51         pla
52
53 .ifdef  UCASE_FILENAME
54
55         jsr     ucase_fn
56         bcc     ucok1
57
58         lda     #183                    ; see oserror.s
59         rts
60 ucok1:
61
62 .endif  ; defined UCASE_FILENAME
63
64         ldy     tmp4                    ; IOCB index
65         sta     ICBAL,y                 ; store pointer to filename
66         txa
67         sta     ICBAH,y
68         tya
69         tax
70         lda     #RMDIR
71         sta     ICCOM,x
72         lda     #0
73         sta     ICAX1,x
74         lda     #0
75         sta     ICAX2,x
76         sta     ICBLL,x
77         sta     ICBLH,x
78         jsr     CIOV
79
80 .ifdef  UCASE_FILENAME
81         tya
82         pha
83         ldy     tmp3                    ; get size
84         jsr     addysp                  ; free used space on the stack
85         pla
86         tay
87 .endif  ; defined UCASE_FILENAME
88
89         bmi     cioerr
90         lda     #0
91         rts
92
93 cioerr: tya
94         rts
95
96 .endproc        ; __sysrmdir