-
Notifications
You must be signed in to change notification settings - Fork 84
/
rename
203 lines (203 loc) · 2.51 KB
/
rename
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
.PAGE 'COPY'
; COPY FILE(S) TO ONE FILE
;
COPY ;FILENAMES, OPTIMIZE
JSR LOOKUP ;LOOK IP ALL FILES
LDA F2CNT
CMP #3
BCC COP10
;
LDA FILDAT
CMP FILDAT+1
BNE COP10
;
LDA FILENT
CMP FILENT+1
BNE COP10
;
JSR CHKIN ;CONCAT
LDA #1
STA F2PTR
JSR OPIRFL
;
JSR TYPFIL
BEQ COP01
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 ;CHECK FILES FOR EXISTENCE
.SKIP
LDA FILDAT
AND #1
STA DRVNUM
JSR OPNIWR ;OPEN INTERNAL WRITE CHNL
JSR ADDFIL ;ADD TO DIRECTORY
LDX F1CNT
.SKIP
CY10 STX F2PTR ;SET UP READ FILE
JSR OPIRFL
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 CHANNEL, FILE
;
OPIRFL
LDX F2PTR
LDA FILDAT,X
AND #1
STA DRVNUM
LDA #18
STA TRACK
LDA FILENT,X
AND #$1F
STA SECTOR
JSR OPNIRD
LDX F2PTR
LDA FILENT,X
AND #$E0
ORA #2
JSR SETPNT
LDX F2PTR
LDA FILDAT,X
AND #TYPMSK
LSR A
STA TYPE
;
LDA #0
STA REC
JSR OPREAD
LDY #1
JSR TYPFIL
BEQ OPIR10
INY
OPIR10
TYA
JMP SETPNT
;
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
;
.PAGE 'RENAME'
; RENAME FILE NAME IN DIRECTORY
RENAME JSR ALLDRS ;SET BOTH DRIVE #'S
LDA FILDAT+1
AND #1
STA FILDAT+1
CMP FILDAT
BEQ RN10 ;SAME DRIVE #'S
ORA #$80 ;CHECK BOTH DRIVES FOR NAME
RN10 STA FILDAT
JSR LOOKUP ;LOOK UP BOTH NAMES
JSR CHKIO ;CHECK FOR EXISTENCE
LDA FILDAT+1
AND #1
STA DRVNUM
LDA FILENT+1
PHA
AND #$1F
STA SECTOR
;*** POSIBLE BUG *********
; ?????JOBNUM????????
JSR RDAB ;READ DIRECTORY SECTOR
JSR WATJOB
PLA
AND #$E0 ;SET SECTOR INDEX
ORA #5 ;...+5
JSR SETPNT
JSR GETACT
TAY
LDX FILTBL
LDA #16
JSR TRNAME ;TRANSFER NAME
JSR WRTOUT ;WRITE SECTOR OUT
JSR WATJOB
JMP ENDCMD
.SKIP
.SKIP
; CHECK I/O FILE FOR EXIST
CHKIN
LDA FILDAT+1 ;1ST FILE BEARS TYPE
AND #TYPMSK
LSR A
STA TYPE
;
LDX F2CNT
CK10 DEX
CPX F1CNT
BCC CK20
LDA FILTRK,X
AND #$7F
BNE CK10
LDA #FLNTFD ;INPUT FILE NOT FOUND
JMP CMDERR
CK20
RTS
;
CHKIO
JSR CHKIN
CK25 LDA FILTRK,X
AND #$7F
BEQ CK30
LDA #FLEXST
JMP CMDERR
CK30 DEX
BPL CK25
RTS
.SKIP
.END