Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
;; cbm-fs
2
 
3
VIECMAX		.EQU	$1000
4
 
5
mxfils		.EQU	5	; max # filenames in cmd string
6
cmdlen		.EQU	96	; length of command buffer (+ terminator #0)
7
fntlen		.EQU	97	; length of canonical file name table
8
nbsiz		.EQU	27	; nambuf text size
9
dirlen		.EQU	24	; directory length used
10
maxfd		.EQU	8	; max # file descriptors
11
intfd		.EQU	maxfd+2	; internal # file descriptors
12
mxchnls		.EQU	15	; max # data channels
13
irdfd		.EQU	maxfd	; internal fd for read file
14
iwrfd		.EQU	maxfd+1	; internal fd for write file
15
 
16
bindx		.EQU	16	; bam offset index
17
bamsiz		.EQU	6	; # bytes/track in bam
18
numsec		.EQU	40	; number of logical sectors (blocks)
19
phisec		.EQU	10	; number of phisycal sectors / track
20
dirtrk		.EQU	40	; system logical track
21
dirst		.EQU	3	; starting directory sector
22
maxtrk		.EQU	81	; max. logical track + 1
23
startrk		.EQU	1	; logical starting track
24
 
25
; max. available blocks's #
26
maxblks		.EQU	(numsec*(maxtrk-1)-numsec)
27
 
28
dskvern		.EQU	$44	; disk version number
29
dosvern		.EQU	$33	; dos version number
30
subvern		.EQU	$8D	; disk sub-version number header ofs. 29 & 30
31
iobyte		.EQU	$C0	; default bam i/o byte
32
 
33
MAXDOSDRV	.EQU	4	; dos drives are 0..3
34
 
35
;deltyp		.EQU	0	; deleted type
36
seqtyp		.EQU	1	; sequential type
37
prgtyp		.EQU	2	; program type
38
usrtyp		.EQU	3	; user type
39
reltyp		.EQU	4	; relative type
40
partyp		.EQU	5	; partition type
41
exetyp		.EQU	6	; new executable type
42
typmsk		.EQU	7	; mask for type bits
43
 
44
; internal use: open function's
45
rdmode		.EQU	0	; open read mode
46
wtmode		.EQU	1	; open write mode
47
apmode		.EQU	2	; open append mode
48
mdmode		.EQU	3	; open modify mode
49
lddir		.EQU	3	; load directory
50
seqdir		.EQU	4	; open dir as seq. file
51
damode		.EQU	5	; open direct access type
52
 
53
; error codes
54
rdtrk		.EQU	20	; track read error
55
badfmt		.EQU	21	; bad disk format (or unformatted disk)
56
wrtrk		.EQU	22	; track write error
57
rdsec		.EQU	24	; read error
58
wrsec		.EQU	25	; write error
59
wpon		.EQU	26	; write protect on
60
badid		.EQU	29	; disk id mismatch
61
badsyn		.EQU	30	; general syntax
62
badcmd		.EQU	31	; invalid command
63
longln		.EQU	32	; long line
64
badfn		.EQU	33	; invalid filname
65
nofile		.EQU	34	; no file given
66
baddrv		.EQU	35	; illegal drive number
67
badchn		.EQU	36	; illegal channel number
68
nullln		.EQU	37	; empty command string
69
notsam		.EQU	39	; cannot rename across drives
70
flock		.EQU	40	; locked file
71
fsplt		.EQU	41	; write file not closed
72
bnotm		.EQU	42	; unmatch blocks count
73
invlnk		.EQU	43	; invalid file link
74
badlst		.EQU	44	; wrong index in last block
75
filopn		.EQU	60	; file open
76
filnop		.EQU	61	; file not open
77
flntfd		.EQU	62	; file not found
78
flexst		.EQU	63	; file exists
79
mistyp		.EQU	64	; file type mismatch
80
badts		.EQU	66	; illegal track or sector
81
systs		.EQU	67	; illegal system t or s
82
wrfil		.EQU	68	; write only file
83
rdfil		.EQU	69	; read only file
84
nochnl		.EQU	70	; no channel available
85
direrr		.EQU	71	; directory error
86
dskful		.EQU	72	; disk full
87
cbmv2		.EQU	73	; cbm emulator version
88
nodriv		.EQU	74	; drive not ready
89
opnchn		.EQU	75	; channel is open
90
nolinx		.EQU	76	; no logical index available
91
fmter		.EQU	77	; format error
92
ibmfmt		.EQU	78	; ibm-formatted disk
93
syterr		.EQU	79	; system track read error
94
dirlnk		.EQU	80	; corrupted directory link
95
bamcnt		.EQU	81	; corrupted bam
96
badcat		.EQU	82	; recursive concat
97
badtlk		.EQU	83	; invalid talk command
98
badlsn		.EQU	84	; invalid listen command
99
 
100
; sezione COMMON -- questo permette di includere il file in piu' file
101
 
102
DPCBMFS: .SECTION page0, ref_only, common
103
	.ABSOLUTE		;; inizia sempre da $00
104
	.ORG	0x00
105
 
106
zpstart		.EQU	$
107
 
108
delsec		.DS	2	; sector of 1st avail entry
109
delind		.DS	2	; index of 1st avail entry
110
dirsec		.DS	2	; directory sector of last not empty entry
111
index		.DS	2	; index of last not empty entry
112
track		.DB		; current track
113
sector		.DB		; current sector
114
dirp		LP		; long pointer to directory entry
115
nxtsec		.DB		; next sector in dir link
116
type		.DB		; active file type
117
mode		.DB		; active file mode
118
typflg		.DB		; match by type flag
119
patflg		.DB		; pattern presence flag
120
f1cnt		.DB		; file stream 1 count
121
f2cnt		.DB		; file stream total count
122
f1ptr		.DB		; file stream 1 pointer
123
f2ptr		.DB		; file stream 2 pointer
124
entfnd		.DB		; dir-entry found flag ($FF = not found)
125
found		.DB		; flag found in file stream
126
tgflg		.DB		; drive toggle flag
127
				; <7>: search both drives
128
				; <6>: drvnum was toggled
129
 
130
drvnum		.DB		; current drive
131
 
132
filtbl		.DS	mxfils	; filename pointer
133
tmpxxx		.DB		; extra byte for filtbl/tmp byte
134
filtrk		.DS	mxfils	; 1st link/track
135
filsec		.DS	mxfils	;    /sector
136
entsec		.DS	mxfils	; sector of directory entry
137
entind		.DS	mxfils	; index of directory entry
138
fildrv		.DS	mxfils	; default flag, drive #
139
pattyp		.DS	mxfils	; pattern,replace,closed-flags,type
140
 
141
dpsave		.EQU	$ - zpstart
142
 
143
;----------------------
144
 
145
tlp		LP		; tmp long pointer
146
cmdsiz		.DB		; cmd string size
147
char		.DB		; tmp store char
148
image		.DB		; file stream image
149
 
150
qfmt		.EQU	cmdsiz	; quick format flag
151
idch1		.EQU	char	; ID format char 1
152
idch2		.EQU	image	; ID format char 2
153
opntm		.EQU	char	; <7>: open type in parameter
154
				; <6>: open mode in parameter
155
 
156
; virtual iec -----------------------------------------
157
sa		.DB		; persistent second addr. virtual iec
158
viecbuf		.DB		; virtual iec buffered data
159
viecsiz		.DW
160
viecndx		.DW
161
vieclp		LP
162
viecfg		.DB		; virtual iec flag
163
				; <7>: active talk/listen
164
				; <6>: talk (listen if 0)
165
 
166
vcmdix		.DB		; index to command string
167
vbufnum		.DB		; viec buffer #
168
vcmdsiz		.DB		; size of virtuasl iec buffer (channel 15)
169
veof		.DB		; eof flag
170
 
171
;-----------------------------------------------------
172
chnl		.DB		; channel param
173
cmdnum		.DB		; command #
174
bchn		.DB		; block-op channel
175
subcmd		.DB		; blk subcommand # or open type cmd
176
 
177
lsterr		.DB		; last error
178
 
179
lindx		.DB		; logical index (internal file descriptor)
180
linuse		.DB		; lindx use flags (1=free, 0=busy)
181
lintab		.DS	mxchnls	; lindx table ($FF = free)
182
				; <7>: write type fd
183
				; <6>: direct access type fd
184
				; <5>: directory load type fd
185
				; <3>: drive
186
				; <2:0> = logical index
187
 
188
drvfg		.DS	2	; drive flag
189
				; <7>: cbm formatted disk
190
				; <6>: valid format in bit 1,0
191
				; <5>: flag verify in bam iobyte
192
				; <4>: flag write protect on
193
				; <3>: flag new version
194
				;
195
				; <1:0>	00 DD ibm format
196
				;	01 DD cbm format
197
				;	10 HD ibm format
198
				;	11 HD cbm format (not used)
199
 
200
ndbf		.DW		; # of disk blocks free drive 0
201
		.DW		; # of disk blocks free drive 1
202
 
203
sysbuf		.DS	2	; DMA buffer # of system track cache
204
trkbuf		.DS	2	; DMA buffer # of data track cache
205
wrtbuf		.DS	2	; DMA buffer # of write buffer cache
206
dirofs		.DS	2	; directory cache buffer high pointer (dma)
207
dirbnk		.DS	2	; directory cache buffer bank (dma)
208
trkofs		.DS	2	; track cache buffer high pointer (dma)
209
trkbnk		.DS	2	; track cache buffer bank (dma)
210
wrtofs		.DS	2	; write cache pointer
211
wrtbnk		.DS	2
212
tcache		.DS	2	; current track in cache (0 invalidate cache)
213
wcache		.DS	2	; current track in write cache (0 inv. cache)
214
 
215
wbam		.DS	2	; dirty bam flag
216
 
217
bsize		.DW		; size of buffer while read/write op
218
btrf		.DW		; count of transf. bytes
219
ntot		.EQU	bsize	; free block's counter while check file system
220
bcnt		.EQU	btrf	; block's count while chech file system
221
 
222
bufp		LP		; long pointer to read data buffer (cache)
223
bmpnt		LP		; bam long pointer
224
wbuf		LP		; long pointer to write data buffer
225
 
226
tmp0		.DB		; temp. byte
227
wtmp		.DW		; tmp word
228
 
229
fdst		.DS	maxfd	; fd status
230
				; <7>: ready
231
				; <6>: eof flag
232
				; <0>: drive
233
dsec		.DS	maxfd	; sector of dir entry
234
dind		.DS	maxfd	; index of dir entry
235
ftrk		.DS	maxfd	; current file track (hi dir ptr for dir list)
236
fsec		.DS	maxfd	; current file sector (rdlst for dir list)
237
fdptr		.DS	maxfd	; file buffer pointer
238
fdblk		.DS	maxfd	; current file block # count
239
		.DS	maxfd	; dir. ptr for dir list
240
fdlst		.DS	maxfd	; local buffer last byte ptr
241
fdix		.DS	maxfd	; local buffer pointer
242
 
243
 
244
wrop		.DB		; flag write-op
245
data		.DB		; buffered byte
246
rddrv		.DB		; drive # to read (buffered operation)
247
rdidx		.DB		; pointer to read buffer (buffered operation)
248
rdlst		.DB		; pointer to last byte (buffered operation)
249
rdeof		.DB		; eof condition (buffered operation)
250
wrdrv		.DB		; drive # to write (buffered operation)
251
wridx		.DB		; pointer to write buffer (buffered operation)
252
wsec		.DB		; last dirty sector in write cache
253
wfirst		.DB		; first dirty sector in write cache
254
wcnt		.DW		; block's # of write file (buffered operation)
255
 
256
pdrv		.DB		; used by disk access routines: drive #
257
pside		.DB		; side #
258
psec		.DB		; start sector #
259
pcnt		.DB		; sector(s) count #
260
pbuf		.DB		; dma buffer #
261
 
262
dblfd		.DB		; double index lindx
263
trap		.DB		; flag error trap
264
cmdtrap		.DB		; no error if command string is empty
265
 
266
	.RELATIVE
267
	.ENDS
268
 
269
; CBM FS work area
270
CBMFSW:	.SECTION common, ref_only
271
	.ABSOLUTE
272
	.ORG	CBMFSW_START
273
 
274
cmdbuf		.DS	cmdlen	; command buffer
275
		.DB		; for terminator '0'
276
fntab		.DS	fntlen	; room for one dos filename (80) + one cbm...
277
				; filename (17) or for 5 cbm file names (85)
278
 
279
nambuf		.DS	nbsiz	; directory buffer
280
nambuf2		.DS	19	; buffer for store quoted file name
281
 
282
dskser		.LWORD		; serial in new version
283
		.LWORD
284
 
285
tos		.DW		; saved stack pointer
286
etrk		.DB		; save track & sector for fmterr function
287
esec		.DB
288
dskid1		.DS	2	; disk id 1
289
dskid2		.DS	2	; disk id 2
290
 
291
	.RELATIVE
292
	.ENDS
293
 
294
CBMVIEC: .SECTION common, ref_only
295
	.ABSOLUTE
296
	.ORG	CBMVIEC_START
297
 
298
vixtab		.DS	16
299
vsiztab		.DS	16
300
vftab		.DS	16
301
vopnsa		.DB		; SA for open command
302
		.DB
303
vieccmd		.DS	cmdlen
304
		.DB
305
 
306
 
307
	.RELATIVE
308
	.ENDS