-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathcopy.src
184 lines (156 loc) · 4.1 KB
/
copy.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
.messg "copy"
.subttl "copy"
.page
; dskcpy check for type
; and parses special case
dskcpy lda #00 ; kill bam
sta bam1
lda #lxint
sta linuse ; free all lindxs
jsr prscln ; find ":"
bne dsk10
jmp cmer ; bad cmnd error, cx=x not allowed
dsk10 jsr tc30 ; normal parse
jsr alldrs ; put drv's in filtbl
lda image ; get parse image
and #%01010101 ; val for patt copy
bne dsk30 ; must be concat or normal
ldx filtbl ; chk for *
lda cmdbuf,x
cmp #'*
bne dsk30
dsk20 lda #badsyn ; syntax error
jmp cmderr
dsk30 lda image ; chk for normal
and #%11011001
bne dsk20
.page
; copy file(s) to one file
copy jsr lookup ; look ip all files
lda f2cnt
cmp #3
bcc cop10
lda fildrv
cmp fildrv+1
bne cop10
lda entind
cmp entind+1
bne cop10
lda entsec
cmp entsec+1
bne cop10
jsr chkin ; concat
lda #1
sta f2ptr
jsr opirfl
jsr typfil
bcs cop01 ; greater than or equal to relative...
cmp #prgtyp
bne cop05
cop01 lda #mistyp
jsr cmderr
cop05 lda #iwsa
sta sa
lda lintab+irsa
sta lintab+iwsa
lda #$ff
sta lintab+irsa
jsr append
ldx #2
jsr cy10
jmp endcmd
cop10 jsr cy
jmp endcmd
cy jsr chkio ; ck fil for existence
jsr opniwr ; open internal write chnl
jsr addfil ; add to directory
ldx f1cnt
cy10 stx f2ptr ; set up read file
jsr opirfl
lda #irsa ; add for rel copy
sta sa
jsr fndrch
jsr typfil
bne cy10a ; not rel
jsr cyext
.page
cy10a lda #eoisnd
sta eoiflg
jmp cy20
cy15 jsr pibyte
cy20 jsr gibyte
lda #lrf
jsr tstflg
beq cy15
jsr typfil
beq cy30
jsr pibyte
cy30 ldx f2ptr
inx
cpx f2cnt
bcc cy10 ; more files to copy
lda #iwsa
sta sa
jmp clschn ; close copy chnl, file
opirfl ldx f2ptr
lda dirtrk
sta track
lda entsec,x
sta sector
jsr opnird
ldx f2ptr
lda entind,x
jsr setpnt
ldx f2ptr
lda pattyp,x
and #typmsk
sta type
lda #0
sta rec
jsr opread
ldy #1
jsr typfil
beq opir10
iny
opir10 tya
jmp setpnt
.page
gibyte lda #irsa
sta sa
gcbyte jsr gbyte
sta data
ldx lindx
lda chnrdy,x
and #eoisnd
sta eoiflg
bne gib20
jsr typfil
beq gib20
lda #lrf
jsr setflg
gib20 rts
cyext jsr ssend ; copy rel rec's
jsr hugerel ; humugo?
bne cyext1 ; br, nope
lda grpnum ; save grpnum
pha
cyext1
lda ssind
pha
lda ssnum
pha
lda #iwsa
sta sa
jsr fndwch
jsr adrels
sta relptr
pla
sta ssnum
pla
sta ssind
jsr hugerel
bne cyext2
pla
sta grpnum ; restore group number
cyext2
jmp addr1