-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolume.aii
331 lines (245 loc) · 3.71 KB
/
volume.aii
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
include 'gsos.equ'
include 'minix.equ'
include 'records.equ'
include 'fst.equ'
include 'fst.macros'
include 'M16.Debug'
;
; VolumeGS / Volume call.
;
; check if the disk is ours. create a VCR or mark it active.
;
import id_disk
my_dp record dp.__end
src ds.l 1
dest ds.l 1
length ds.w 1
IF *>=$d4 THEN
AERROR 'dp -- too large.'
ENDIF
endr
import do_file_sys_id
import do_ignore
entry do_block_size
entry do_free_blocks
entry do_total_blocks
entry do_vol_name_0
entry do_vol_name_1
volume procname export
with dp
with dev_parms
with fst_parms
stz tool_error
lda fst_parms.dev1_num
; if no device, find a volume by name...
beq no_dev
jsr id_disk
bcc got_it
cmp #dup_volume
beq dup
sec
rtl
dup
; this is a duplicate volume.
; return the name (and only the name), but also return the error.
lda <call_class
beq dup_0
dup_1
ldy #VolumeRecGS.volName
jsr do_vol_name_1
bcs exit
lda #dup_volume
bra exit
dup_0
ldy #VolumeRec.volName
jsr do_vol_name_0
bcs exit
lda #dup_volume
bra exit
got_it
; init common volume name parameters here...
with my_dp
ldy #vcr.vname.length
lda [my_vcr],y
sta length
lda #vcr.vname.text
clc
adc my_vcr
sta src
lda #0
adc my_vcr+2
sta src+2
endwith
lda <call_class
beq class0
class1
lda [param_blk_ptr] ; pcount
dec a
asl a ; x 2
asl a ; x 4
tax
dispatch volume_dcb_1
lda tool_error
cmp #1
rtl
class0
ldx #volume_dcb_0_size-4
dispatch volume_dcb_0
lda tool_error
exit
cmp #1
rtl
no_dev
lda #unknown_vol
sec
rtl
volume_dcb_0
with VolumeRec
dc.w deviceName, do_ignore
dc.w volName, do_vol_name_0
dc.w totalBlocks, do_total_blocks
dc.w freeBlocks, do_free_blocks
dc.w fileSysID, do_file_sys_id
endwith
volume_dcb_0_size equ *-volume_dcb_0
volume_dcb_1
with VolumeRecGS
dc.w devName, do_ignore
dc.w volName, do_vol_name_1
dc.w totalBlocks, do_total_blocks
dc.w freeBlocks, do_free_blocks
dc.w fileSysID, do_file_sys_id
dc.w blockSize, do_block_size
dc.w characteristics, do_ignore
dc.w deviceID, do_ignore
endwith
endp
do_block_size proc
with dp
with fst_parms
lda #1024
sta [param_blk_ptr],y
rts
endp
do_total_blocks proc
; total blocks = nzones.
; should this ask the driver?
with dp
with fst_parms
phy ; save
ldy #vcr.super.nzones
lda [my_vcr],y
ply
sta [param_blk_ptr],y
iny
iny
lda #0
sta [param_blk_ptr],y
rts
endp
do_free_blocks proc
; load the zmaps and count them up...
; someday.
with fst_parms, dp
phy
ldy #vcr.free_blocks
lda [my_vcr],y
ply
sta [param_blk_ptr],y
iny
iny
lda #0
sta [param_blk_ptr],y
rts
endp
do_vol_name_0 proc
; store the volume name (class 0)
; todo -- error if name > 16 chars? see HFS.
with fst_parms
with dp, my_dp
; length and src are valid.
lda [param_blk_ptr],y
sta dest
iny
iny
lda [param_blk_ptr],y
sta dest+2
; length should be in the range of 1-30.
short m
lda length
sta [dest]
long m
lda dest
clc
adc #1
sta dest
lda dest+2
adc #0
sta dest+2
short m
ldy length
dey
beq done
bmi exit8 ; should never happen.
@loop
lda [src],y
sta [dest],y
dey
bne @loop
done
; uses / as a separator
lda #'/'
sta [dest]
exit8
long m
clc
rts
endp
do_vol_name_1 procname
with fst_parms
with dp, my_dp
lda [param_blk_ptr],y
sta dest
iny
iny
lda [param_blk_ptr],y
sta dest+2
; check the length.
lda [dest]
sec
sbc #4
bmi error
cmp length
; branch after length stored...
lda length
ldy #2
sta [dest],y
; carry still set from cmp
bcc error
lda #4
clc
adc dest
sta dest
lda #0
adc dest+2
sta dest+2
ldy length
beq done
dey
short m
@loop
lda [src],y
sta [dest],y
dey
bpl @loop
long m
done
clc
rts
error
lda #buff_too_small
sta tool_error
sec
rts
endp
end