The COPY.I include file resides on the Kyan Pascal 2.x Utilities Disk 1. It contains one function:
- function copy(var Scr,Dest: pathstring):integer;
Source Code
function copy(var Scr,Dest: pathstring):integer;
var
fullscr,fulldest:pathstring;
begin
copy:=0;
add_device(scr,fullscr);
add_device(dest,fulldest);
#a
stx _t
jsr c.iocb
bpl *+5
jmp cpexit
lda #3
sta $342,x
clc
lda #25
adc _sp
sta $344,x
lda #0
adc _sp+1
sta $345,x
lda #4
sta $34a,x
lda #0
sta $34b,x
jsr $e456
bpl cv1
sty _t+1
jsr c.close
ldy _t+1
jmp cpexit
cv1 stx _t+1
jsr c.iocb
bpl cv2
ldx _t+1
sty _t+1
jsr c.close
ldy _t+1
jmp cpexit
cv2 stx _t+2
lda #3
sta $342,x
clc
lda #5
adc _sp
sta $344,x
lda #0
adc _sp+1
sta $345,x
lda #8
sta $34a,x
lda #0
sta $34b,x
jsr $e456
bpl copy
jmp c.done
copy equ *
ldx _t+1 ;source iocb
lda #$07 ;get char
sta $342,x
lda #0
sta $348,x
sta $349,x
jsr $e456
bmi c.done
pha
ldx _t+2
lda #$0b ;put char
sta $342,x
lda #0
sta $348,x
sta $349,x
pla
jsr $e456
bmi c.done
jmp copy
c.done equ *
sty _t+3
ldx _t+1
jsr c.close
ldx _t+2
jsr c.close
ldy _t+3
cpexit equ *
tya
cmp #$88
bne cv3
lda #1
cv3 cmp #$3
bne cv4
lda #1
cv4 ldy #45
sta (_sp),y
jmp cp.end
;
c.iocb equ *
ldx #$10
copn1 lda $340,x
cmp #$ff
beq copn2
txa
clc
adc #$10
tax
cpx #$80
bne copn1
ldy #$81
copn2 rts
;
c.close equ *
lda #$0C
sta $342,x
jsr $e456
rts
;
cp.end ldx _t
#
END;(* Copy function *)
No comments:
Post a Comment