mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 02:30:44 +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:
parent
88243a0b26
commit
93f1a5b61a
@ -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 ; "too many open files"
|
||||
ldx #>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 ; file name is too long
|
||||
ldx #>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
|
Loading…
x
Reference in New Issue
Block a user