From: cpg Date: Sun, 17 Aug 2003 19:56:14 +0000 (+0000) Subject: renamed remove.s to sysremove.s and adapted it for common/remove.s X-Git-Tag: V2.12.0~1385 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=93f1a5b61aa336aa4eabbc4d3cdb5ba4b6ff1acc;p=cc65 renamed remove.s to sysremove.s and adapted it for common/remove.s git-svn-id: svn://svn.cc65.org/cc65/trunk@2354 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atari/remove.s b/libsrc/atari/remove.s deleted file mode 100644 index 826cb81c6..000000000 --- a/libsrc/atari/remove.s +++ /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 -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 - 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 index 000000000..423f34092 --- /dev/null +++ b/libsrc/atari/sysremove.s @@ -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