The RENAME.I include file resides on the Kyan Pascal 2.x Utilities Disk 1.
- function rename(var oldname,newname:pathstring):integer;
Source Code
function rename(var oldname,newname:pathstring):integer;
var
temp,fullname:pathstring;
begin
rename:=0;
add_device(oldname,fullname);
temp:=' ';
#a
stx rnxsav
pla
lda #5
clc
adc _sp
sta _t
lda #0
adc _sp+1
sta _t+1
ldy #$ff
rnloop equ *
iny
lda (_t),y
cmp #32
beq rmove
cpy #19
bne rnloop
ldy #$a5
jmp rleave
rnxsav db 0
rmove lda #',
sta (_t),y
iny
tya
clc
adc _t
sta _t+2
lda #0
adc _t+1
sta _t+3
ldy #47
lda (_sp),y
sta _t+4
iny
lda (_sp),y
sta _t+5
ldy #1
lda (_t+4),y
cmp #':
bne rnext
ldy #$a5
jmp rleave
rnext iny
lda (_t+4),y
cmp #':
bne rgo
ldy #$a5
jmp rleave
rgo ldy #20
rmlop lda (_t+4),y
sta (_t+2),y
dey
bpl rmlop
ldx #$10
ropn1 lda $340,x
cmp #$ff
beq ropn2
txa
clc
adc #$10
tax
cpx #$80
bne ropn1
ldy #$81
jmp rleave
ropn2 lda #$20 ;rename command
sta $342,x
lda _t
sta $344,x
lda _t+1
sta $345,x
jsr $e456
rleave tya
ldy #45
sta (_sp),y
ldx rnxsav
#
end;
No comments:
Post a Comment