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
|
2003-11-14 22:37:17 +00:00
|
|
|
.importzp tmp4
|
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
|
|
|
|
|
2003-11-14 22:37:17 +00:00
|
|
|
iocbok: stx tmp4 ; remember IOCB index
|
2003-08-17 19:56:14 +00:00
|
|
|
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
|
|
|
|
2012-01-26 12:12:34 +00:00
|
|
|
lda #183 ; see oserror.s
|
2003-08-17 19:56:14 +00:00
|
|
|
rts
|
2001-12-27 20:37:52 +00:00
|
|
|
ucok1:
|
2001-12-09 21:53:11 +00:00
|
|
|
|
|
|
|
.endif ; defined UCASE_FILENAME
|
|
|
|
|
2003-11-14 22:37:17 +00:00
|
|
|
ldy tmp4 ; IOCB index
|
2003-08-17 19:56:14 +00:00
|
|
|
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
|