From 93f1a5b61aa336aa4eabbc4d3cdb5ba4b6ff1acc Mon Sep 17 00:00:00 2001 From: cpg Date: Sun, 17 Aug 2003 19:56:14 +0000 Subject: [PATCH] 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 --- libsrc/atari/{remove.s => sysremove.s} | 64 ++++++++++++-------------- 1 file changed, 29 insertions(+), 35 deletions(-) rename libsrc/atari/{remove.s => sysremove.s} (51%) diff --git a/libsrc/atari/remove.s b/libsrc/atari/sysremove.s similarity index 51% rename from libsrc/atari/remove.s rename to libsrc/atari/sysremove.s index 826cb81c6..423f34092 100644 --- a/libsrc/atari/remove.s +++ b/libsrc/atari/sysremove.s @@ -1,60 +1,57 @@ ; -; Christian Groessler, Dec-2001 +; Christian Groessler, Aug-2003 ; ; int remove (const char* name); ; .include "atari.inc" .include "errno.inc" - .import findfreeiocb,incsp2,__do_oserror - .import popax,__oserror,__seterrno - .importzp tmp1 + .import findfreeiocb + .importzp tmp2 .ifdef UCASE_FILENAME .importzp tmp3 .import addysp .import ucase_fn .endif - .export _remove + .export __sysremove -.proc _remove +.proc __sysremove + + pha ; save input parameter + txa + pha jsr findfreeiocb beq iocbok ; we found one - jsr incsp2 ; discard stack argument - lda #EMFILE -seterr: jsr __seterrno - lda #$FF - tax - rts ; return -1 + pla + pla ; fix up stack -iocbok: ;stx tmp1 ; remember IOCB index - txa - pha - jsr popax + 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 #EINVAL - jmp seterr + + lda #177 ; see oserror.s + rts ucok1: .endif ; defined UCASE_FILENAME - ;ldy tmp1 - sta tmp1 - pla - tay - lda tmp1 - sty tmp1 - sta ICBAL,y + ldy tmp2 ; IOCB index + sta ICBAL,y ; store pointer to filename txa sta ICBAH,y - ldx tmp1 + tya + tax lda #DELETE sta ICCOM,x lda #0 @@ -74,12 +71,9 @@ ucok1: .endif ; defined UCASE_FILENAME bmi cioerr - - ldx #0 - stx __oserror - txa + lda #0 + rts +cioerr: tya rts -cioerr: jmp __do_oserror - -.endproc ; _remove +.endproc ; __sysremove -- 2.39.5