1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-02 21:54:47 +00:00

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
This commit is contained in:
cpg 2003-08-17 19:56:14 +00:00
parent 88243a0b26
commit 93f1a5b61a

View File

@ -1,60 +1,57 @@
; ;
; Christian Groessler, Dec-2001 ; Christian Groessler, Aug-2003
; ;
; int remove (const char* name); ; int remove (const char* name);
; ;
.include "atari.inc" .include "atari.inc"
.include "errno.inc" .include "errno.inc"
.import findfreeiocb,incsp2,__do_oserror .import findfreeiocb
.import popax,__oserror,__seterrno .importzp tmp2
.importzp tmp1
.ifdef UCASE_FILENAME .ifdef UCASE_FILENAME
.importzp tmp3 .importzp tmp3
.import addysp .import addysp
.import ucase_fn .import ucase_fn
.endif .endif
.export _remove .export __sysremove
.proc _remove .proc __sysremove
pha ; save input parameter
txa
pha
jsr findfreeiocb jsr findfreeiocb
beq iocbok ; we found one beq iocbok ; we found one
jsr incsp2 ; discard stack argument pla
lda #<EMFILE ; "too many open files" pla ; fix up stack
ldx #>EMFILE
seterr: jsr __seterrno
lda #$FF
tax
rts ; return -1
iocbok: ;stx tmp1 ; remember IOCB index lda #TMOF ; too many open files
txa rts
pha
jsr popax iocbok: stx tmp2 ; remember IOCB index
pla
tax
pla ; get argument again
.ifdef UCASE_FILENAME .ifdef UCASE_FILENAME
jsr ucase_fn jsr ucase_fn
bcc ucok1 bcc ucok1
lda #<EINVAL ; file name is too long
ldx #>EINVAL lda #177 ; see oserror.s
jmp seterr rts
ucok1: ucok1:
.endif ; defined UCASE_FILENAME .endif ; defined UCASE_FILENAME
;ldy tmp1 ldy tmp2 ; IOCB index
sta tmp1 sta ICBAL,y ; store pointer to filename
pla
tay
lda tmp1
sty tmp1
sta ICBAL,y
txa txa
sta ICBAH,y sta ICBAH,y
ldx tmp1 tya
tax
lda #DELETE lda #DELETE
sta ICCOM,x sta ICCOM,x
lda #0 lda #0
@ -74,12 +71,9 @@ ucok1:
.endif ; defined UCASE_FILENAME .endif ; defined UCASE_FILENAME
bmi cioerr bmi cioerr
lda #0
ldx #0 rts
stx __oserror cioerr: tya
txa
rts rts
cioerr: jmp __do_oserror .endproc ; __sysremove
.endproc ; _remove