]> git.sur5r.net Git - cc65/commitdiff
renamed remove.s to sysremove.s and adapted it for common/remove.s
authorcpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 17 Aug 2003 19:56:14 +0000 (19:56 +0000)
committercpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 17 Aug 2003 19:56:14 +0000 (19:56 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2354 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/atari/remove.s [deleted file]
libsrc/atari/sysremove.s [new file with mode: 0644]

diff --git a/libsrc/atari/remove.s b/libsrc/atari/remove.s
deleted file mode 100644 (file)
index 826cb81..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-;
-; Christian Groessler, Dec-2001
-;
-; int remove (const char* name);
-;
-
-       .include "atari.inc"
-       .include "errno.inc"
-       .import findfreeiocb,incsp2,__do_oserror
-       .import popax,__oserror,__seterrno
-       .importzp tmp1
-.ifdef UCASE_FILENAME
-       .importzp tmp3
-       .import addysp
-       .import ucase_fn
-.endif
-       .export _remove
-
-.proc  _remove
-
-       jsr     findfreeiocb
-       beq     iocbok          ; we found one
-
-       jsr     incsp2          ; discard stack argument
-       lda     #<EMFILE        ; "too many open files"
-       ldx     #>EMFILE
-seterr:        jsr     __seterrno
-       lda     #$FF
-       tax
-       rts                     ; return -1
-
-iocbok:        ;stx    tmp1            ; remember IOCB index
-       txa
-       pha
-       jsr     popax
-
-.ifdef UCASE_FILENAME
-
-       jsr     ucase_fn
-       bcc     ucok1
-       lda     #<EINVAL        ; file name is too long
-       ldx     #>EINVAL
-       jmp     seterr
-ucok1:
-
-.endif ; defined UCASE_FILENAME
-
-       ;ldy    tmp1
-       sta     tmp1
-       pla
-       tay
-       lda     tmp1
-       sty     tmp1
-       sta     ICBAL,y
-       txa
-       sta     ICBAH,y
-       ldx     tmp1
-       lda     #DELETE
-       sta     ICCOM,x
-       lda     #0
-       sta     ICAX1,x
-       sta     ICAX2,x
-       sta     ICBLL,x
-       sta     ICBLH,x
-       jsr     CIOV
-
-.ifdef UCASE_FILENAME
-       tya
-       pha
-       ldy     tmp3            ; get size
-       jsr     addysp          ; free used space on the stack
-       pla
-       tay
-.endif ; defined UCASE_FILENAME
-
-       bmi     cioerr
-
-       ldx     #0
-       stx     __oserror
-       txa
-       rts
-
-cioerr:        jmp     __do_oserror
-
-.endproc       ; _remove
diff --git a/libsrc/atari/sysremove.s b/libsrc/atari/sysremove.s
new file mode 100644 (file)
index 0000000..423f340
--- /dev/null
@@ -0,0 +1,79 @@
+;
+; Christian Groessler, Aug-2003
+;
+; int remove (const char* name);
+;
+
+       .include "atari.inc"
+       .include "errno.inc"
+       .import findfreeiocb
+       .importzp tmp2
+.ifdef UCASE_FILENAME
+       .importzp tmp3
+       .import addysp
+       .import ucase_fn
+.endif
+       .export __sysremove
+
+.proc  __sysremove
+
+       pha                     ; save input parameter
+       txa
+       pha
+
+       jsr     findfreeiocb
+       beq     iocbok          ; we found one
+
+       pla
+       pla                     ; fix up stack
+
+       lda     #TMOF           ; too many open files
+       rts
+
+iocbok:        stx     tmp2            ; remember IOCB index
+       pla
+       tax
+       pla                     ; get argument again
+
+.ifdef UCASE_FILENAME
+
+       jsr     ucase_fn
+       bcc     ucok1
+
+       lda     #177            ; see oserror.s
+       rts
+ucok1:
+
+.endif ; defined UCASE_FILENAME
+
+       ldy     tmp2            ; IOCB index
+       sta     ICBAL,y         ; store pointer to filename
+       txa
+       sta     ICBAH,y
+       tya
+       tax
+       lda     #DELETE
+       sta     ICCOM,x
+       lda     #0
+       sta     ICAX1,x
+       sta     ICAX2,x
+       sta     ICBLL,x
+       sta     ICBLH,x
+       jsr     CIOV
+
+.ifdef UCASE_FILENAME
+       tya
+       pha
+       ldy     tmp3            ; get size
+       jsr     addysp          ; free used space on the stack
+       pla
+       tay
+.endif ; defined UCASE_FILENAME
+
+       bmi     cioerr
+       lda     #0
+       rts
+cioerr:        tya
+       rts
+
+.endproc       ; __sysremove