Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
;;
2
;; Copyright (c) 2016 Marco Granati <mg@unet.bz>
3
;;
4
;; Permission to use, copy, modify, and distribute this software for any
5
;; purpose with or without fee is hereby granted, provided that the above
6
;; copyright notice and this permission notice appear in all copies.
7
;;
8
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
;;
16
 
17
;; name: tossys.inc
18
;; rev.: 2016/02/09
19
;; o.s. 65C816 version v1.0
20
 
21
.LIST on
22
 
23
;---------------------------------------------------------------------------
24
 
25
HPLMAX		.EQU	32		; Max. subdirectory level
26
 
27
BCBCNT		.EQU	$200		; BCB's struct's count #
28
BCBXBNK		.EQU	$0C00		; starting BCB x-mem buffer #
29
DMACNT		.EQU	64
30
 
31
FAT0X		.EQU	$E0		; x-mem bank for fat table of ata #0
32
FAT1X		.EQU	$F0		; x-mem bank for fat table of ata #1
33
 
34
	.INCLUDE INC\LDT.INC
35
 
36
;---------------------------------------------------------------------------
37
; Hierarchical Path List (HPL) -- 16 bit offset's
38
;---------------------------------------------------------------------------
39
 
40
 LSTRUCT	HPL
41
hpl_cls		.DW		; parent cluster
42
hpl_ix		.DW		; entry index in parent cluster
43
hpl_fcb		.DS	11	; fcb name
44
hpl_lst		.DB		; unused
45
 ESTRUCT	HPL
46
 
47
;---------------------------------------------------------------------------
48
; Buffer Control Block (BCB) -- 16 bit offset's
49
;---------------------------------------------------------------------------
50
 
51
 LSTRUCT	BCB
52
bcb_next	.DW			; next logical linked BCB
53
bcb_drv		.DB			; logical drive
54
bcb_sec		.DB			; sector offset
55
bcb_cls		.DW			; cluster
56
bcb_lba		.DW			; sector lba address
57
bcb_lbah	.DW			; lba high
58
bcb_head	.EQU	bcb_lbah	; floppy head
59
bcb_buf		.DW			; x-mem buffer number
60
bcb_trk		.EQU	bcb_buf		; floppy track(low) & sector(hi)
61
bcb_ptr		.DW			; buffer pointer
62
bcb_xbnk	.DW			; buffer pointer hi & x-mem bank
63
bcb_dma		.EQU	bcb_xbnk	; buffer pointer hi & dma buffer
64
 ESTRUCT	BCB
65
 
66
;---------------------------------------------------------------------------
67
; hash Control Block (BCB) -- 16 bit offset's
68
;---------------------------------------------------------------------------
69
 
70
 LSTRUCT	HCB
71
hcb_next	.DW		; pointer to next HCB
72
hcb_cls		.DW		; cluster number
73
hcb_seq		.DW		; sequence number + logical drive number
74
hcb_cnt		.DW		; number of hashed entries
75
hcb_data	.DS	0	; hash buffer data
76
 ESTRUCT	HCB
77
 
78
;---------------------------------------------------------------------------
79
; TOS Working Segment
80
;---------------------------------------------------------------------------
81
 
82
WKB		.EQU	.SEG.TOSSEG	; TOS working bank
83
 
84
TS		.SET	TOSSEG
85
TE		.SET	TOSSEG + $FFFF
86
TO0		.SET	$018C00
87
TO1		.SET	TOSWKM
88
 
89
.comment @
90
_TOS0:	.SECTION ref_only, common, offset TO0, range TS TE ;FAT Struct's
91
_TOS0_START	.DS	0
92
 
93
_pbr0		.DS	512
94
_pbr1		.DS	512
95
_pbr2		.DS	512
96
_pbr3		.DS	512
97
 
98
_TOS0_END	.DS	0
99
TOS0SIZ		.EQU	(_TOS0_END - _TOS0_START)
100
.ENDS
101
@
102
 
103
_TOS1:	.SECTION ref_only, common, offset TO1, range TS TE ;FAT Struct's
104
_TOS1_START	.DS	0
105
 
106
; current working directory HPL
107
cwdl0		.DS	(HPLSIZE*HPLMAX)
108
cwdl1		.DS	(HPLSIZE*HPLMAX)
109
cwdl2		.DS	(HPLSIZE*HPLMAX)
110
cwdl3		.DS	(HPLSIZE*HPLMAX)
111
 
112
; current building path HPL
113
cbpl		.DS	(HPLSIZE*HPLMAX)
114
HPL_CLS		.EQU	hpl_cls+cbpl
115
HPL_IX		.EQU	hpl_ix+cbpl
116
HPL_FCB		.EQU	hpl_fcb+cbpl
117
 
118
; BCB list's
119
bcbstart	.DS	(BCBCNT*BCBSIZE)
120
bcbend		.DS	0
121
dmastart	.DS	(DMACNT*BCBSIZE)
122
dmaend		.DS	0
123
dma0s		.DS	(17*BCBSIZE)
124
dma1s		.DS	(17*BCBSIZE)
125
 
126
_TOS1_END	.DS	0
127
TOS1SIZ		.EQU	(_TOS1_END - _TOS1_START)
128
.ENDS
129
 
130
;---------------------------------------------------------------------------
131
; HCB Segment
132
;---------------------------------------------------------------------------
133
 
134
HCBBNK		.EQU	.SEG.HCBSEG
135
HS		.SET	HCBSEG
136
HE		.SET	HCBSEG + $FFFF
137
HO		.SET	HCBSEG
138
 
139
_HCBS:	.SECTION ref_only, common, offset HO, range HS HE	;HCB's List
140
hcb_bnk		.DS	8
141
hcbstart	.DS	0
142
.ENDS
143
 
144
;.comment @
145
;---------------------------------------------------------------------------
146
; direct page for LDT var's
147
;---------------------------------------------------------------------------
148
 
149
; P0OS
150
DPOS:	.SECTION page0, common, ref_only, offset 0	;OS Main D.P.
151
 
152
;sysbuf		.DS	2	; floppy track 0 cache buffer
153
defhsec		.DB		; default hidden sector's in fdisk
154
		.DB
155
cmdstk		.DW		; saved stack on TOS command's
156
bpath		.DS	80
157
 
158
bpath1		.DS	0
159
.ENDS
160
;@
161
 
162
; P0LDT
163
DPLDT:	.SECTION page0, common, ref_only, offset 0	;LDT D.P.
164
 
165
ldt0		.DS	LDTSIZE
166
ldt1		.DS	LDTSIZE
167
ldt2		.DS	LDTSIZE
168
ldt3		.DS	LDTSIZE
169
ldt4		.DS	LDTSIZE
170
 
171
ldtp		.DS	6	; pointer to LDT's in DPLDT page
172
 
173
sysbuf		.DS	4	; floppy track 0 cache buffer
174
 
175
.ENDS
176
 
177
;---------------------------------------------------------------------------
178
; direct page for FAT var's
179
;---------------------------------------------------------------------------
180
 
181
; P0FAT
182
DPFAT:	.SECTION page0, common, ref_only, offset 0	;FAT D.P.
183
 
184
ostos		.DW		; saved top of stack
185
ioerr		.DB		; i/o error
186
ioerr2		.DB		; extended i/o error
187
hcbroot		.DW		; HCB struct's list
188
hcblst		.DW		; the last one HCB
189
hsiz		.DB		; how many sector's an HCB can hold
190
hlog2		.DB		; shift count related to hsiz
191
bcbroot		.DW		; BCB buffer's list
192
bcblst		.DW		; the last one BCB
193
dmaroot		.DW		; dma BCB buffer's list
194
dmalst		.DW		; the last one dma BCB
195
dmabcb		.DW		; BCB list for floppy root, cluster#2,#3&#4
196
fspt		.DB		; sector per track (floppy)
197
pdrive		.DB		; phisycal drive number
198
bplvl		.DB		; subdir level while build path
199
defdrv		.DB		; default drive
200
 
201
; the first block of ldt_ var's is copied from the LDT struct
202
ldtfg1		.DB		; logical volume flag's
203
				; <7>: device ready (fdc drive or ata device)
204
				; <6>: if=1->HD/CF else->FD
205
				; <0>: phisycal device number
206
 
207
ldtfg2		.DB		; <7>: valid volume (fat volume or cbm disk)
208
				; <6>: if=1->FAT else->CBM (FD only)
209
				; <5>: disk format checked
210
				; <1:0>: disk format (fdc only)
211
 
212
ldtfp		LP		; fat table buffer long pointer
213
ldtfbuf		.DB		; fat table: x-mem base bank/dma buffer
214
 
215
ldtroot		.DW		; lba of root dir
216
ldtfat1		.DW		; lba of fat1 table
217
ldtfat2		.DW		; lba of fat2 table
218
ldtcls		.DW		; lba of first data cluster
219
ldtmax		.DW		; max usable cluster + 1
220
ldtcsiz		.DB		; cluster size (1,2,4,8,16,32,64)
221
ldtcshf		.DB		; cluster shift (0,1,2,3,4,5,6)
222
ldtfsiz		.DB		; fat table size (if 0 -> 256)
223
ldtrsiz		.DB		; root dir. size (sector's)
224
ldtrent		.DW		; root dir. max. entries
225
ldtcent		.DW		; max. entries in dir. cluster
226
ldteoc		.DW		; end of cluster chain marker
227
ldtmcls		.DB		; mask for clust. module: 00,01,03,07,0F,1F,3F
228
ldtfmt		.DB		; floppy disk format (0,1,2, FF if ata device)
229
ldtcdlp		.DW		; current working dir list pointer
230
ldtcdcls	.DW		; current working dir start cluster
231
ldtfree		.DW		; count of free cluster's
232
ldtnxt		.DW		; next free cluster
233
ldtcdlvl	.DB		; current working dir level count
234
ldtpbr		LP		; long pointer to PBR cache buffer
235
 
236
chdcls		.DW		; last accessed chained dir. cluster
237
clsofs		.DW		; cluster's offset from start of chain
238
 
239
; not change order of the 2 following var's: will be accessed as 16 bit var
240
entofs		.DB		; entry offset from start of sector
241
secofs		.DB		; sector's offset from start of cluster
242
 
243
dircls		.DW		; directory cluster
244
dcnt		.DW		; directory entry counter
245
lba		.DW		; lba sector address
246
lbah		.DW		; lba is 24 bit's only
247
xbuf		.DW		; x-mem buffer transfer number
248
 
249
fhead		.EQU	lbah	; fd head
250
ftrack		.EQU	xbuf	; fd track
251
fsec		.EQU	xbuf+1	; fd sector
252
 
253
dfcbtyp		.DB		; FCB type to search
254
dfcbatt		.DB		; attribute of found FCB
255
 
256
curdrv		.DB		; current logical drive
257
fcbs		.DS	11	; file control block name
258
 
259
;dcmask		.DW		; mask to start of cluster
260
				; FFF0, FFE0, FFC0, FF80, FF00, FE00
261
 
262
fcbp		.DW		; FCB buffer long pointer
263
		.DW		; low=fcbp+2, high=x-mem bank or dma buffer
264
dmabuf		.EQU	fcbp+3	; dma buffer #
265
xmbank		.EQU	fcbp+3	; x-mem bank #
266
 
267
; temp area
268
hcbseq		.DB
269
hcbdrv		.DB
270
bcbcls		.DW
271
bcbdrv		.DB
272
bcbsec		.DB
273
 
274
thash		.DW
275
hcbrec	.EQU	thash
276
wtmp	.EQU	thash
277
 
278
hlast		.DW
279
hcbcls		.DW
280
hcbx		.DW
281
hcby		.DW
282
tmpp	.EQU	hlast	; temp. long pointer
283
tmpx	.EQU	hcbx
284
wild	.EQU	hcbx+1
285
fsiz	.EQU	hcby
286
fptr	.EQU	hcby+1
287
ldrv	.EQU	hcbx
288
tmpldt	.EQU	hcbx+1
289
 
290
fhash		.DW
291
fcbofs		.DW
292
bcbload		.DB
293
xstart		.DB
294
xend		.DB
295
seccnt		.DB
296
maxseq		.DB
297
dsiz		.DB
298
 
299
haswld		.DB
300
strix		.DB
301
pathp		LP		; long pointer to path string
302
 
303
; TEMP
304
quot		.DW
305
dvsor		.DW
306
troot		.DW
307
tlst		.DW
308
bdmask		.DW
309
bcmask		.DW
310
 
311
hcbuse		.DB
312
 
313
.ENDS
314
 
315
.LIST off