2005-08-31 20:11:45 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 15.04.2005
|
|
|
|
;
|
|
|
|
; unsigned char __fastcall__ _sysrename (const char* oldname, const char* newname);
|
|
|
|
;
|
|
|
|
|
|
|
|
.export __sysrename
|
2013-05-09 11:56:54 +00:00
|
|
|
.import pushname, popname
|
|
|
|
.import popax
|
2005-08-31 20:11:45 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "mli.inc"
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
__sysrename:
|
2013-05-09 11:56:54 +00:00
|
|
|
; Save newname
|
|
|
|
sta ptr2
|
|
|
|
stx ptr2+1
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Get and push oldname
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr popax
|
|
|
|
jsr pushname
|
|
|
|
bne oserr1
|
2005-08-31 20:11:45 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
; Save pushed oldname
|
|
|
|
lda sp
|
|
|
|
ldx sp+1
|
|
|
|
sta ptr3
|
|
|
|
stx ptr3+1
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Restore and push newname
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ptr2
|
|
|
|
ldx ptr2+1
|
|
|
|
jsr pushname
|
|
|
|
bne oserr2
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Restore and set pushed oldname
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ptr3
|
|
|
|
ldx ptr3+1
|
|
|
|
sta mliparam + MLI::RENAME::PATHNAME
|
|
|
|
stx mliparam + MLI::RENAME::PATHNAME+1
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Set pushed newname
|
2013-05-09 11:56:54 +00:00
|
|
|
lda sp
|
|
|
|
ldx sp+1
|
|
|
|
sta mliparam + MLI::RENAME::NEW_PATHNAME
|
|
|
|
stx mliparam + MLI::RENAME::NEW_PATHNAME+1
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Rename file
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #RENAME_CALL
|
|
|
|
ldx #RENAME_COUNT
|
|
|
|
jsr callmli
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Cleanup newname
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr popname ; Preserves A
|
2005-08-31 20:11:45 +00:00
|
|
|
|
|
|
|
; Cleanup oldname
|
2013-05-09 11:56:54 +00:00
|
|
|
oserr2: jmp popname ; Preserves A
|
2005-08-31 20:11:45 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
oserr1: rts
|