+++ /dev/null
-;
-; 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
--- /dev/null
+;
+; 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