The APPEND.I include file resides on the Kyan Pascal 2.x Utilities Disk 1. It contains one function, APPEND.
function append(var Scr,Dest: pathstring):integer;
var
fullscr,fulldest:pathstring;
begin
append:=0;
add_device(scr,fullscr);
add_device(dest,fulldest);
#a
stx _t
jsr a.iocb
bpl *+5
jmp apexit
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 av1
sty _t+1
jsr a.close
ldy _t+1
jmp apexit
av1 stx _t+1
jsr a.iocb
bpl av2
ldx _t+1
sty _t+1
jsr a.close
ldy _t+1
jmp apexit
av2 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 #9
sta $34a,x
lda #0
sta $34b,x
jsr $e456
bpl aopy
jmp a.done
aopy equ *
ldx _t+1 ;source iocb
lda #$07 ;get char
sta $342,x
lda #0
sta $348,x
sta $349,x
jsr $e456
bmi a.done
pha
ldx _t+2
lda #$0b ;put char
sta $342,x
lda #0
sta $348,x
sta $349,x
pla
jsr $e456
bmi a.done
jmp aopy
a.done equ *
sty _t+3
ldx _t+1
jsr a.close
ldx _t+2
jsr a.close
ldy _t+3
apexit equ *
tya
cmp #$88
bne av3
lda #1
av3 cmp #$3
bne av4
lda #1
av4 ldy #45
sta (_sp),y
jmp ap.end
;
a.iocb equ *
ldx #$10
aopn1 lda $340,x
cmp #$ff
beq aopn2
txa
clc
adc #$10
tax
cpx #$80
bne aopn1
ldy #$81
aopn2 rts
;
a.close equ *
lda #$0C
sta $342,x
jsr $e456
rts
;
ap.end ldx _t
#
END;(* append function *)
No comments:
Post a Comment