2001-12-09 21:53:11 +00:00
|
|
|
;
|
2003-08-17 19:56:14 +00:00
|
|
|
; Christian Groessler, Aug-2003
|
2001-12-09 21:53:11 +00:00
|
|
|
;
|
|
|
|
; int remove (const char* name);
|
|
|
|
;
|
|
|
|
|
|
|
|
.include "atari.inc"
|
2002-04-21 14:19:16 +00:00
|
|
|
.include "errno.inc"
|
2003-08-17 19:56:14 +00:00
|
|
|
.import findfreeiocb
|
|
|
|
.importzp tmp2
|
2001-12-09 21:53:11 +00:00
|
|
|
.ifdef UCASE_FILENAME
|
2001-12-27 20:37:52 +00:00
|
|
|
.importzp tmp3
|
|
|
|
.import addysp
|
|
|
|
.import ucase_fn
|
2001-12-09 21:53:11 +00:00
|
|
|
.endif
|
2003-08-17 19:56:14 +00:00
|
|
|
.export __sysremove
|
2001-12-09 21:53:11 +00:00
|
|
|
|
2003-08-17 19:56:14 +00:00
|
|
|
.proc __sysremove
|
|
|
|
|
|
|
|
pha ; save input parameter
|
|
|
|
txa
|
|
|
|
pha
|
2001-12-09 21:53:11 +00:00
|
|
|
|
|
|
|
jsr findfreeiocb
|
|
|
|
beq iocbok ; we found one
|
|
|
|
|
2003-08-17 19:56:14 +00:00
|
|
|
pla
|
|
|
|
pla ; fix up stack
|
2001-12-09 21:53:11 +00:00
|
|
|
|
2003-08-17 19:56:14 +00:00
|
|
|
lda #TMOF ; too many open files
|
|
|
|
rts
|
|
|
|
|
|
|
|
iocbok: stx tmp2 ; remember IOCB index
|
|
|
|
pla
|
|
|
|
tax
|
|
|
|
pla ; get argument again
|
2001-12-09 21:53:11 +00:00
|
|
|
|
|
|
|
.ifdef UCASE_FILENAME
|
|
|
|
|
2001-12-27 20:37:52 +00:00
|
|
|
jsr ucase_fn
|
|
|
|
bcc ucok1
|
2003-08-17 19:56:14 +00:00
|
|
|
|
|
|
|
lda #177 ; see oserror.s
|
|
|
|
rts
|
2001-12-27 20:37:52 +00:00
|
|
|
ucok1:
|
2001-12-09 21:53:11 +00:00
|
|
|
|
|
|
|
.endif ; defined UCASE_FILENAME
|
|
|
|
|
2003-08-17 19:56:14 +00:00
|
|
|
ldy tmp2 ; IOCB index
|
|
|
|
sta ICBAL,y ; store pointer to filename
|
2001-12-09 21:53:11 +00:00
|
|
|
txa
|
|
|
|
sta ICBAH,y
|
2003-08-17 19:56:14 +00:00
|
|
|
tya
|
|
|
|
tax
|
2001-12-09 21:53:11 +00:00
|
|
|
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
|
2003-08-17 19:56:14 +00:00
|
|
|
lda #0
|
|
|
|
rts
|
|
|
|
cioerr: tya
|
2001-12-09 21:53:11 +00:00
|
|
|
rts
|
|
|
|
|
2003-08-17 19:56:14 +00:00
|
|
|
.endproc ; __sysremove
|