Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | - | 1 | Thu Feb 11 16:56:28 2016 Page 1 |
2 | |||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | 2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g |
||
10 | ----------------------------------------------------- |
||
11 | |||
12 | Input Filename : src\F9\xbuf.asm |
||
13 | Output Filename : obj\F9\xbuf.obj |
||
14 | Listing Has Been Relocated |
||
15 | |||
16 | |||
17 | 2132 .LIST on |
||
18 | 2133 |
||
19 | 2134 F8FF66 .INCLUDE inc\dirp00.inc |
||
20 | 2135 ;---------------------------------------------------------- |
||
21 | 2136 ; DIRP00.ASM |
||
22 | 2137 ; PROGETTO: B1601 |
||
23 | 2138 ; |
||
24 | 2139 ; Variabili in Direct Page $00 |
||
25 | 2140 ;---------------------------------------------------------- |
||
26 | 2141 |
||
27 | 2142 ; sezione COMMON -- questo permette di includere il file in piu' file |
||
28 | 2143 |
||
29 | 2144 .LIST on |
||
30 | 2145 |
||
31 | 2146 DIRP00: .SECTION page0, ref_only, common ;Direct-Page 00 |
||
32 | 2147 |
||
33 | 2148 000000 .ABSOLUTE ;; inizia sempre da $00 |
||
34 | 2149 000000 .ORG 0x00 |
||
35 | 2150 000000 |
||
36 | 2151 000000 0000 JiffyClk .DW ; contatore 10ms 32 bit |
||
37 | 2152 000002 0000 .DW |
||
38 | 2153 000004 SysTmr .DS SYSTMRCNT ; system timer 0 (10ms) |
||
39 | 2154 000008 SysTMF .DS SYSTMRCNT ; flag timer (80 -> start) |
||
40 | 2155 00000C 00 Bnk0Flag .DB ; <7>: flag test RAM banco 0 ok |
||
41 | 2156 ; <6>: flag warm reset |
||
42 | 2157 00000D 00 RTCFlag .DB |
||
43 | 2158 |
||
44 | 2159 00000E atadev .DS 2 ; flag device on ata bus #0 & #1 |
||
45 | 2160 ; <7>: device ready |
||
46 | 2161 ; <6>: compact flash devide (C.F.) |
||
47 | 2162 ; <5>: device identification ok |
||
48 | 2163 ; <4>: MBR loaded |
||
49 | 2164 ; <3>: valid signature in MBR |
||
50 | 2165 ; <2>: first partition found&active |
||
51 | 2166 ; <1>: |
||
52 | 2167 ; <0>: valid partition flag |
||
53 | 2168 |
||
54 | 2169 000010 atasec .DS 8 ; max. user sectors on ata device |
||
55 | 2170 000018 atambr .DS 8 ; data for first partition found in mbr |
||
56 | 2171 ; first 3 bytes for start sector of partition |
||
57 | 2172 ; last byte for partition type |
||
58 | 2173 |
||
59 | 2174 000020 00 fdcdrv .DB ; phisycal drive status (drive #0) |
||
60 | 2175 ; <7>: disk format established in bit 0&1 |
||
61 | 2176 ; <6>: double step seek done |
||
62 | 2177 ; <5>: trust format bit's (set after ok r/w) |
||
63 | Thu Feb 11 16:56:28 2016 Page 2 |
||
64 | |||
65 | |||
66 | |||
67 | |||
68 | 2178 ; <4>: write protect bit (if disk in drive) |
||
69 | 2179 ; <3>: don't care |
||
70 | 2180 ; <2>: don't care |
||
71 | 2181 ; <1>: HD disk if set else DD disk |
||
72 | 2182 ; <0>: CBM format if set else IBM format |
||
73 | 2183 |
||
74 | 2184 000021 00 vdrive .DB ; virtual drive status (ram disk, drive #1) |
||
75 | 2185 ; <7>: disk format established in bit 0&1 |
||
76 | 2186 ; <6>: change disk simulation (after format) |
||
77 | 2187 ; <5>: don't care |
||
78 | 2188 ; <4>: write protect bit (under sw control) |
||
79 | 2189 ; <3>: don't care |
||
80 | 2190 ; <2>: don't care |
||
81 | 2191 ; <1>: HD disk if set else DD disk |
||
82 | 2192 ; <0>: CBM format if set else IBM format |
||
83 | 2193 |
||
84 | 2194 000022 00 fdcctl .DB ; fdc controller status |
||
85 | 2195 ; <7>: drive is attached |
||
86 | 2196 ; <6>: drive need recalibration (restore) |
||
87 | 2197 ; <5>: FDC controller ok |
||
88 | 2198 ; <4>: motor on |
||
89 | 2199 ; <3>: dma is active |
||
90 | 2200 ; <2>: dma chip ok (post routine) |
||
91 | 2201 ; <1>: clock rate (1=HD,0=DD) |
||
92 | 2202 ; <0>: disk ready |
||
93 | 2203 |
||
94 | 2204 000023 00 fdctrk .DB ; fd: current seek track |
||
95 | 2205 000024 00 fdcerr .DB ; fd: last error code |
||
96 | 2206 000025 00 ataerr .DB ; ata: last error code |
||
97 | 2207 000026 00 ataxer .DB ; ata: last extended error code |
||
98 | 2208 |
||
99 | 2209 000027 00 CtrlBrk .DB ; flag CTRL+BREAK (NMI) |
||
100 | 2210 |
||
101 | 2211 000028 0000 MemTop .DW ; top memoria RAM |
||
102 | 2212 00002A 00 .DB ; banco top mem |
||
103 | 2213 |
||
104 | 2214 00002B 00 DflTxtIn .DB ; device di default text input |
||
105 | 2215 00002C 00 DflTxtOut .DB ; device di default text output |
||
106 | 2216 |
||
107 | 2217 00002D COPPtr LP ; long pointer for COP decoding |
||
108 | 2218 000030 00 COPIdx .DB ; COP signature/index |
||
109 | 2219 |
||
110 | 2220 ; variabili utilizzate da ACIA |
||
111 | 2221 000031 00 ACIAFlag .DB |
||
112 | 2222 |
||
113 | 2223 000032 00 ACIArxe_1 .DB ; flag errore 7: errore RX (scarta dato) |
||
114 | 2224 ; 6: overflow buffer RX |
||
115 | 2225 ; 5: disconnessione remota |
||
116 | 2226 ; 2: framing error |
||
117 | 2227 ; 1: parity error |
||
118 | 2228 ; 0: overrun error |
||
119 | 2229 000033 00 ACIArxe_2 .DB |
||
120 | 2230 |
||
121 | 2231 000034 00 ACIAhsk_1 .DB ; handshake 7: handshake attivo |
||
122 | 2232 ; 6: handshake hardware (RTS,CTS) |
||
123 | 2233 000035 00 ACIAhsk_2 .DB |
||
124 | 2234 |
||
125 | Thu Feb 11 16:56:28 2016 Page 3 |
||
126 | |||
127 | |||
128 | |||
129 | |||
130 | 2235 000036 00 ACIAPause_1 .DB ; flag pausa 7: pausa remota (XOFF/RTS=1) |
||
131 | 2236 ; 6: pausa locale (XON/CTS=1) |
||
132 | 2237 000037 00 ACIAPause_2 .DB |
||
133 | 2238 |
||
134 | 2239 000038 00 ACIAdsrt_1 .DB ; status transizioni DSR, CTS, DCD |
||
135 | 2240 ; 7: DSRT, 6: CTST, 5: DCDT |
||
136 | 2241 000039 00 ACIAdsrt_2 .DB |
||
137 | 2242 |
||
138 | 2243 00003A 00 ACIAdsrl_1 .DB ; status livello linee DSR, CTS, DCD, DTR, RTS |
||
139 | 2244 ; 7: DSRLVL, 6: CTSLVL, 5: DCDLVL |
||
140 | 2245 ; 1:DTRLVL, 0:RTSLVL |
||
141 | 2246 00003B 00 ACIAdsrl_2 .DB |
||
142 | 2247 |
||
143 | 2248 00003C 00 ACIArem_1 .DB ; byte OR registro formato per pausa remota |
||
144 | 2249 00003D 00 ACIArem_2 .DB |
||
145 | 2250 |
||
146 | 2251 00003E 00 ACIAmsk_1 .DB ; maschera AND per test disconnessione |
||
147 | 2252 ; $80 per test DSR - $20 per test DCD |
||
148 | 2253 00003F 00 ACIAmsk_2 .DB |
||
149 | 2254 |
||
150 | 2255 000040 00 ACIAcsr_1 .DB ; control status durante IRQ |
||
151 | 2256 000041 00 ACIAcsr_2 .DB |
||
152 | 2257 000042 00 ACIAfr_1 .DB ; copia registro di formato |
||
153 | 2258 000043 00 ACIAfr_2 .DB |
||
154 | 2259 000044 00 ACIAOut_1 .DB ; trasmissione XON/XOFF |
||
155 | 2260 000045 00 ACIAOut_2 .DB |
||
156 | 2261 |
||
157 | 2262 000046 0000 ACIAICnt_1 .DW ; numero bytes in coda RX 1 |
||
158 | 2263 000048 0000 ACIAIHead_1 .DW ; puntatore testa buffer RX 1 |
||
159 | 2264 00004A 0000 ACIAITail_1 .DW ; puntatore coda buffer RX 1 |
||
160 | 2265 00004C 0000 ACIAOCnt_1 .DW ; numero bytes in coda TX 1 |
||
161 | 2266 00004E 0000 ACIAOHead_1 .DW ; puntatore testa buffer TX 1 |
||
162 | 2267 000050 0000 ACIAOTail_1 .DW ; puntatore coda buffer TX 1 |
||
163 | 2268 |
||
164 | 2269 000052 0000 ACIAICnt_2 .DW ; numero bytes in coda RX 2 |
||
165 | 2270 000054 0000 ACIAIHead_2 .DW ; puntatore testa buffer RX 2 |
||
166 | 2271 000056 0000 ACIAITail_2 .DW ; puntatore coda buffer RX 2 |
||
167 | 2272 000058 0000 ACIAOCnt_2 .DW ; numero bytes in coda TX 2 |
||
168 | 2273 00005A 0000 ACIAOHead_2 .DW ; puntatore testa buffer TX 2 |
||
169 | 2274 00005C 0000 ACIAOTail_2 .DW ; puntatore coda buffer TX 2 |
||
170 | 2275 |
||
171 | 2276 ; bios mem |
||
172 | 2277 00005E 0000 nsize .DW ; dimensione blocco da allocare |
||
173 | 2278 ;bsize .DW ; dimensione vera blocco free |
||
174 | 2279 000060 0000 splitsz .DW ; dimensione blocco splittato |
||
175 | 2280 000062 0000 bfree .DW ; puntatore blocco free |
||
176 | 2281 000064 0000 hdrptr .DW ; puntatore header heap |
||
177 | 2282 |
||
178 | 2283 000066 0000 pbrklv .DW ; current break level of current process |
||
179 | 2284 000068 0000 pbrkmin .DW ; minimum breal level of current process |
||
180 | 2285 00006A 0000 pbrkmax .DW ; maximum breal level of current process |
||
181 | 2286 |
||
182 | 2287 00006C 00 ACIATmp .DB |
||
183 | 2288 00006D 00 .DB |
||
184 | 2289 00006E |
||
185 | 2290 ; ata/fdc work var's |
||
186 | 2291 00006E wrktmp .DS $28 |
||
187 | Thu Feb 11 16:56:28 2016 Page 4 |
||
188 | |||
189 | |||
190 | |||
191 | |||
192 | 2292 |
||
193 | 2293 ; logical volume's flag |
||
194 | 2294 ; vol0:phisycal drive, vol1: virtual disk, vol2: ata #0, vol3: ata #1 |
||
195 | 2295 000096 volfg1 .DS 4 ; <7>: ready (fdc drive or ata device) |
||
196 | 2296 ; <6>: valid (fat volume or cbm disk) |
||
197 | 2297 ; <0>: device # |
||
198 | 2298 |
||
199 | 2299 00009A volfg2 .DS 4 ; <7>: ata device (else fdc disk) |
||
200 | 2300 ; <6>: fat volume (else cbm disk) |
||
201 | 2301 ; <1>: fdc only: HD disk if set else DD disk |
||
202 | 2302 |
||
203 | 2303 00009E 0000 xmin .DW |
||
204 | 2304 0000A0 0000 xrov .DW ; next x-mem buffer free index |
||
205 | 2305 0000A2 0000 xcnt .DW ; how much x-mem buffer will allocate |
||
206 | 2306 0000A4 0000 xcls .DW |
||
207 | 2307 0000A6 0000 xsecd .DW |
||
208 | 2308 |
||
209 | 2309 0000A8 0000 xbfree .DW |
||
210 | 2310 0000AA 0000 xbfg .DW |
||
211 | 2311 ;xbmin .DW |
||
212 | 2312 0000AC 0000 xbtmp .DW |
||
213 | 2313 ;xbcnt .DW |
||
214 | 2314 0000AE 0000 xbidx2 .DW |
||
215 | 2315 |
||
216 | 2316 0000B0 00 RTCsec .DB |
||
217 | 2317 0000B1 00 RTCmin .DB |
||
218 | 2318 0000B2 00 RTChour .DB |
||
219 | 2319 0000B3 00 RTCdofw .DB ; day of week |
||
220 | 2320 0000B4 00 RTCday .DB |
||
221 | 2321 0000B5 00 RTCmonth .DB |
||
222 | 2322 0000B6 00 RTCyear .DB |
||
223 | 2323 0000B7 00 RTCctry .DB ; century |
||
224 | 2324 |
||
225 | 2325 0000B8 0000 CTime .DW |
||
226 | 2326 0000BA 0000 CDate .DW |
||
227 | 2327 |
||
228 | 2328 0000BC 00 BiosEnt .DB ; flag accesso a bios setup |
||
229 | 2329 |
||
230 | 2330 0000BC .RELATIVE |
||
231 | 2331 |
||
232 | 2332 .ENDS |
||
233 | 2333 |
||
234 | 2357 .LIST on |
||
235 | 2358 |
||
236 | 2359 ;--------------------------------------------------------------------------- |
||
237 | 2360 |
||
238 | 2361 000010 CDSSIZ .EQU 16 ; Current Directory Structure Size |
||
239 | 2362 000020 CDSMAX .EQU 32 ; Max. subdirectory level |
||
240 | 2363 000008 HCBSIZ .EQU 8 ; Hash Control Block Size |
||
241 | 2364 000100 HCBMAX .EQU 256 ; Max. number of HCB structs |
||
242 | 2365 000800 HCBLIM .EQU (HCBSIZ*HCBMAX) |
||
243 | 2366 000010 DHTSIZ .EQU 16 ; Directory Hash Table Size |
||
244 | 2367 000100 DHTBLK .EQU DHTSIZ*16 ; 16 entry in one DHT |
||
245 | 2368 001000 DHTMAX .EQU (DHTSIZ*HCBMAX) |
||
246 | 2369 |
||
247 | 2370 000B40 XBSTART .EQU $0B40 ; first x-mem buffer |
||
248 | 2371 000FFF XBLST .EQU $0FFF ; last x-mem buffer |
||
249 | Thu Feb 11 16:56:28 2016 Page 5 |
||
250 | |||
251 | |||
252 | |||
253 | |||
254 | 2372 0004C0 XBCNT .EQU XBLST+1-XBSTART ; x-mem buffer's count |
||
255 | 2373 000980 BS .EQU XBCNT*2 ; word array size |
||
256 | 2374 |
||
257 | 2375 ; segment for store buffer array handler |
||
258 | 2376 _XBUF: .SECTION ref_only, common, offset XMEMBUF, range $010000 $01FFFF ;XBUF |
||
259 | 2377 019400 vxcls .DS BS ; cluster/lba low |
||
260 | 2378 019D80 vxsec .DS BS ; sector/lba high + device |
||
261 | 2379 .ENDS |
||
262 | 2380 |
||
263 | 2381 ; Segment for store CDS, HCB, RHT struct's |
||
264 | 2382 _FATS: .SECTION ref_only, common, offset FATSOFS, range FATSST FATSEND ;FAT Struct's |
||
265 | 2383 01C000 _FATS_START .DS 0 |
||
266 | 2384 ; CDS for logical device 0 |
||
267 | 2385 01C000 cds_0 .DS 0 |
||
268 | 2386 01C000 0000 cds_cls .DW ; first cluster of dir. entry |
||
269 | 2387 01C002 0000 cds_idx .DW ; index entry on parent cluster |
||
270 | 2388 01C004 cds_nam .DS 11 ; directory name |
||
271 | 2389 01C00F 00 cds_fill .DB ; unused byte |
||
272 | 2390 01C010 |
||
273 | 2391 01C010 .DS (CDSSIZ*(CDSMAX-1)) |
||
274 | 2392 ; CDS for logical device 1 |
||
275 | 2393 01C200 cds_1 .DS (CDSSIZ*CDSMAX) |
||
276 | 2394 ; CDS for logical device 2 |
||
277 | 2395 01C400 cds_2 .DS (CDSSIZ*CDSMAX) |
||
278 | 2396 ; CDS for logical device 3 |
||
279 | 2397 01C600 cds_3 .DS (CDSSIZ*CDSMAX) |
||
280 | 2398 |
||
281 | 2399 ; HCB struct. |
||
282 | 2400 01C800 hcb_0 .DS 0 ; HCB start |
||
283 | 2401 01C800 0000 hcb_cls .DW ; cluster |
||
284 | 2402 01C802 00 hcb_dev .DB ; device |
||
285 | 2403 01C803 00 hcb_sec .DB ; sector of cluster |
||
286 | 2404 01C804 0000 hcb_prnt .DW ; parent cluster |
||
287 | 2405 01C806 0000 hcb_dhtp .DW ; pointer to DHT struct's |
||
288 | 2406 01C808 .DS (HCBSIZ*(HCBMAX-1)) |
||
289 | 2407 |
||
290 | 2408 ; Root hash Table for 4 logical devices |
||
291 | 2409 01D000 rht_hash0 .DS 512*2 ; hard disk (512 entry max.) |
||
292 | 2410 01D400 rht_hash1 .DS 512*2 |
||
293 | 2411 01D800 rht_hash2 .DS 224*2 ; floppy disk (224 entry max.) |
||
294 | 2412 01D9C0 rht_hash3 .DS 224*2 |
||
295 | 2413 |
||
296 | 2414 01DB80 _FATS_END .DS 0 |
||
297 | 2415 001B80 FATSSIZ .EQU (_FATS_END-_FATS_START) |
||
298 | 2416 .ENDS |
||
299 | 2417 |
||
300 | 2418 _DHTS: .SECTION ref_only, common, offset DHTSST, range DHTSST DHTSEND ;DHT Struct's |
||
301 | 2419 040000 dht_0 .DS 0 |
||
302 | 2420 040000 0000 dht_hash .DW ; hash of file name |
||
303 | 2421 040002 0000 dht_cls .DW ; first cluster of file |
||
304 | 2422 040004 dht_nam .DS 11 ; file name |
||
305 | 2423 04000F 00 dht_attr .DB ; file attribute |
||
306 | 2424 040010 .DS (DHTSIZ*(DHTMAX-1)) |
||
307 | 2425 .ENDS |
||
308 | 2426 |
||
309 | 2427 ;--------------------------------------------------------------------------- |
||
310 | 2428 ; DCB struct (Device Control Block) contain var's related to FAT |
||
311 | Thu Feb 11 16:56:28 2016 Page 6 |
||
312 | |||
313 | |||
314 | |||
315 | |||
316 | 2429 ;--------------------------------------------------------------------------- |
||
317 | 2430 |
||
318 | 2431 F8FF66 STRUCT DCB |
||
319 | 2432 _DCB .SECTION page0,common,ref_only,offset 0 ;DCB Struct |
||
320 | 2433 ;.ABSOLUTE |
||
321 | 2434 ;.ORG 0 |
||
322 | 2435 .MNLIST |
||
323 | 2436 000000 0000 dcb_root .DW ; lba of root dir |
||
324 | 2437 000002 0000 dcb_fat1 .DW ; lba of fat1 table |
||
325 | 2438 000004 0000 dcb_fat2 .DW ; lba of fat2 table |
||
326 | 2439 000006 0000 dcb_cls .DW ; lba of first data cluster |
||
327 | 2440 000008 0000 dcb_max .DW ; max usable cluster + 1 |
||
328 | 2441 00000A 00 dcb_csiz .DB ; cluster size (1,2,4,8,16,32,64) |
||
329 | 2442 00000B 00 dcb_cshf .DB ; cluster shift (0,1,2,3,4,5,6) |
||
330 | 2443 00000C 00 dcb_fsiz .DB ; fat table size (if 0 -> 256) |
||
331 | 2444 00000D 00 dcb_rsiz .DB ; root dir size |
||
332 | 2445 00000E 0000 dcb_rent .DW ; root dir. max. entry |
||
333 | 2446 000010 0000 dcb_rbuf .DW ; root dir cache buffer# |
||
334 | 2447 000012 0000 dcb_fbuf .DW ; fat table cache buffer# |
||
335 | 2448 000014 0000 dcb_free .DW ; count of free cluster's |
||
336 | 2449 000016 0000 dcb_nxt .DW ; next free cluster |
||
337 | 2450 000018 00 dcb_fg1 .DB |
||
338 | 2451 000019 00 dcb_fg2 .DB |
||
339 | 2452 00001A 0000 dcb_rhtp .DW ; pointer to RHT hash table |
||
340 | 2453 00001C 0000 dcb_cdsp .DW ; pointer to CDS struct |
||
341 | 2454 |
||
342 | 2455 ;dcb_cdc .DW ; starting cluster of current directory |
||
343 | 2456 ;dcb_cdp .DW ; parent cluster of c.d. (where is entry) |
||
344 | 2457 ;dcb_cds .DB ; sec. of c.d. entry in parent cluster |
||
345 | 2458 ;dcb_cdx .DB ; index of c.d. entry in parent cluster/sector |
||
346 | 2459 ;dcb_hroot .DW ; hdt root pointer |
||
347 | 2460 ;dcb_hcd .DW ; hdt cur dir pointer |
||
348 | 2461 00001E ESTRUCT DCB |
||
349 | 2462 00001E DCBSIZE .DS 0 |
||
350 | 2463 ;.RELATIVE |
||
351 | 2464 .ENDS |
||
352 | 2465 .MNLIST |
||
353 | 2466 |
||
354 | 2467 ;--------------------------------------------------------------------------- |
||
355 | 2468 ; direct page for DCB var's |
||
356 | 2469 ;--------------------------------------------------------------------------- |
||
357 | 2470 |
||
358 | 2471 DPDCB: .SECTION page0, common, ref_only, offset 0 ;DCB D.P. |
||
359 | 2472 |
||
360 | 2473 000000 fdt_0 .DS DCBSIZE |
||
361 | 2474 00001E fdt_1 .DS DCBSIZE |
||
362 | 2475 00003C fdt_2 .DS DCBSIZE |
||
363 | 2476 00005A fdt_3 .DS DCBSIZE |
||
364 | 2477 |
||
365 | 2478 000078 0000 xbmin .DW ; minimum index |
||
366 | 2479 00007A 0000 xbrov .DW ; next x-mem buffer |
||
367 | 2480 00007C 0000 xbcnt .DW ; how much x-mem buffer will allocate |
||
368 | 2481 00007E 0000 xbcls .DW ; buffer cluster |
||
369 | 2482 000080 0000 xbsec .DW ; buffer sector+device |
||
370 | 2483 |
||
371 | 2484 .ENDS |
||
372 | 2485 |
||
373 | Thu Feb 11 16:56:28 2016 Page 7 |
||
374 | |||
375 | |||
376 | |||
377 | |||
378 | 2486 ;--------------------------------------------------------------------------- |
||
379 | 2487 ; direct page for FAT var's |
||
380 | 2488 ;--------------------------------------------------------------------------- |
||
381 | 2489 |
||
382 | 2490 DPFAT: .SECTION page0, common, ref_only, offset 0 ;FAT D.P. |
||
383 | 2491 |
||
384 | 2492 000000 0000 fat_root .DW ; lba of root dir |
||
385 | 2493 000002 0000 fat_fat1 .DW ; lba of fat1 table |
||
386 | 2494 000004 0000 fat_fat2 .DW ; lba of fat2 table |
||
387 | 2495 000006 0000 fat_cls .DW ; lba of first data cluster |
||
388 | 2496 000008 0000 fat_max .DW ; max usable cluster + 1 |
||
389 | 2497 00000A 00 fat_csiz .DB ; cluster size (1,2,4,8,16,32,64) |
||
390 | 2498 00000B 00 fat_cshf .DB ; cluster shift (0,1,2,3,4,5,6) |
||
391 | 2499 00000C 00 fat_fsiz .DB ; fat table size (if 0 -> 256) |
||
392 | 2500 00000D 00 fat_rsiz .DB ; root dir size |
||
393 | 2501 00000E 0000 fat_rbuf .DW ; root dir cache buffer# |
||
394 | 2502 000010 0000 fat_fbuf .DW ; fat table cache buffer# |
||
395 | 2503 000012 0000 fat_free .DW ; count of free cluster's |
||
396 | 2504 000014 0000 fat_nxt .DW ; next free cluster |
||
397 | 2505 000016 00 fat_fg1 .DB |
||
398 | 2506 000017 00 fat_fg2 .DB |
||
399 | 2507 000018 0000 fat_cdc .DW ; starting cluster of current directory |
||
400 | 2508 00001A 0000 fat_cdp .DW ; parent cluster of c.d. (where is entry) |
||
401 | 2509 00001C 00 fat_cds .DB ; sec. of c.d. entry in parent cluster |
||
402 | 2510 00001D 00 fat_cdx .DB ; index of c.d. entry in parent cluster/sector |
||
403 | 2511 |
||
404 | 2512 ;hdtfree .DW ; hdt free list |
||
405 | 2513 ;hdtp .DW ; cur. HDT pointer |
||
406 | 2514 ;hdtprev .DW ; prev. HDT pointer |
||
407 | 2515 ;hdthip .DW ; the more big pointer |
||
408 | 2516 ;hdthsh .DW ; hash calc |
||
409 | 2517 ;hdtscl .DW ; cluster to search |
||
410 | 2518 ;curcls .DW ; current cluster |
||
411 | 2519 ;parcls .DW ; parent cluster |
||
412 | 2520 ;filcls .DW ; first file cluster |
||
413 | 2521 ;dsecent .DB ; directory sec. entry |
||
414 | 2522 ;didxent .DB ; directory index in sec |
||
415 | 2523 ;curdev .DB ; current logical device |
||
416 | 2524 ;hdtflag .DB ; HDT device+fkag |
||
417 | 2525 |
||
418 | 2526 00001E fcbs .DS 32 ; current file control block |
||
419 | 2527 |
||
420 | 2528 00003E 0000 fhash .DW ; hash of file name |
||
421 | 2529 000040 0000 hcbcls .DW ; cluster to search/store in HCB |
||
422 | 2530 000042 00 hcbdev .DB ; device to search/store in HCB |
||
423 | 2531 000043 00 hcbsec .DB ; sector/cls to search/store in HCB |
||
424 | 2532 000044 0000 hcbprnt .DW ; parent cluster to search/store in HCB |
||
425 | 2533 000046 0000 hcbrov .DW ; next available HCB |
||
426 | 2534 000048 0000 hcbp .DW ; search HCB pointer |
||
427 | 2535 00004A 0000 hcbfp .DW ; HCB of found entry |
||
428 | 2536 00004C 0000 hcbt1 .DW ; HCB temp |
||
429 | 2537 00004E 0000 hcbt2 .DW ; HCB temp |
||
430 | 2538 000050 0000 dhtp .DW ; pointer to DHT struct |
||
431 | 2539 000052 0000 dhtidx .DW ; index of match DHT |
||
432 | 2540 000054 0000 dhtcls .DW ; cluster to store in DHT ($FFFF if lfn entry) |
||
433 | 2541 000056 00 dhtattr .DB ; attribute from matching DHT |
||
434 | 2542 000057 00 btmp .DB ; temp |
||
435 | Thu Feb 11 16:56:28 2016 Page 8 |
||
436 | |||
437 | |||
438 | |||
439 | |||
440 | 2543 000058 0000 delcls .DW ; deleted/empty entry cluster |
||
441 | 2544 00005A 00 deldev .DB ; deleted/empty entry device |
||
442 | 2545 00005B 00 delsec .DB ; deleted/empty entry sector |
||
443 | 2546 00005C 0000 delidx .DW ; deleted/empty entry index |
||
444 | 2547 00005E 0000 deldht .DW ; deleted/empty entry DHT |
||
445 | 2548 |
||
446 | 2549 000060 dirp LP |
||
447 | 2550 |
||
448 | 2551 .ENDS |
||
449 | 2552 |
||
450 | 2553 |
||
451 | 2554 .LIST on |
||
452 | 2555 |
||
453 | 2556 ;--------------------------------------------------------------------------- |
||
454 | 2557 ; code segment -- bank $F9 |
||
455 | 2558 ;--------------------------------------------------------------------------- |
||
456 | 2559 |
||
457 | 2560 .CODEF9 |
||
458 | 2561 |
||
459 | 2562 .LONGA off |
||
460 | 2563 .LONGI off |
||
461 | 2564 |
||
462 | 2565 ; get a new x-mem buffer |
||
463 | 2566 ; param's in register's & stack |
||
464 | 2567 ; in: A=starting sector of cluster |
||
465 | 2568 ; X=logical device |
||
466 | 2569 ; Y=number of buffer's to allocate |
||
467 | 2570 ; SR+3=cluster number (word) |
||
468 | 2571 ; out: SR+3=buffer # (word) |
||
469 | 2572 ; use: all |
||
470 | 2573 F905BB xgetbuf: |
||
471 | 2574 ;lda hdt_next |
||
472 | 2575 F905BB 85 A6 sta xsecd ; save lba high |
||
473 | 2576 F905BD 86 A7 stx xsecd+1 ; save logical device |
||
474 | 2577 F905BF 84 A2 sty xcnt ; buffer's count# |
||
475 | 2578 F905C1 64 A3 stz xcnt+1 |
||
476 | 2579 F905C3 8B phb ; save data bank |
||
477 | 2580 F905C4 A9 01 lda #^vxcls |
||
478 | 2581 F905C6 48 pha |
||
479 | 2582 F905C7 AB plb ; set data bank to array |
||
480 | 2583 F905C8 A9 80 lda #$80 |
||
481 | 2584 F905CA 04 A7 tsb xsecd+1 ; mark as in use |
||
482 | 2585 F905CC CPU16CLC |
||
483 | 2586 F905CC C2 31 rep #(PMFLAG.OR.PXFLAG.OR.PCFLAG) |
||
484 | 2587 .LONGA on |
||
485 | 2588 .LONGI on |
||
486 | 2589 .MNLIST |
||
487 | 2590 F905CE A3 03 lda $03,s |
||
488 | 2591 F905D0 85 A4 sta xcls ; save cluster# |
||
489 | 2592 F905D2 A5 A0 lda xrov ; current first available index |
||
490 | 2593 F905D4 AA tax |
||
491 | 2594 F905D5 A8 tay |
||
492 | 2595 F905D6 65 A2 adc xcnt ; next available index |
||
493 | 2596 F905D8 C9 C0 04 cmp #XBCNT ; over limit? |
||
494 | 2597 F905DB 90 07 bcc ?10 ; no |
||
495 | 2598 F905DD A5 9E lda xmin ; start from beginning |
||
496 | 2599 F905DF AA tax |
||
497 | Thu Feb 11 16:56:28 2016 Page 9 |
||
498 | |||
499 | |||
500 | |||
501 | |||
502 | 2600 F905E0 A8 tay |
||
503 | 2601 F905E1 18 clc |
||
504 | 2602 F905E2 65 A2 adc xcnt |
||
505 | 2603 F905E4 85 A0 ?10: sta xrov ; update next available index |
||
506 | 2604 F905E6 8A txa |
||
507 | 2605 F905E7 0A asl a |
||
508 | 2606 F905E8 AA tax ; array index |
||
509 | 2607 F905E9 98 tya |
||
510 | 2608 F905EA 18 clc |
||
511 | 2609 F905EB 69 40 0B adc #XBSTART |
||
512 | 2610 F905EE 83 03 sta $03,s ; return buffer# |
||
513 | 2611 F905F0 80 2D bra xget |
||
514 | 2612 F905F2 |
||
515 | 2613 ; get a new reserved x-mem buffer for root dir & fat's tables |
||
516 | 2614 ; this routine will be called before to allocate standard buffer's |
||
517 | 2615 ; param's in register's & stack |
||
518 | 2616 ; in: A=lba high |
||
519 | 2617 ; X=logical device |
||
520 | 2618 ; SR+5=number of buffer's to allocate (word) |
||
521 | 2619 ; SR+3=lba low (word) |
||
522 | 2620 ; out: SR+5=buffer # (word) |
||
523 | 2621 ; use: all |
||
524 | 2622 F905F2 xrsvbuf: |
||
525 | 2623 F905F2 85 A6 sta xsecd ; save lba high |
||
526 | 2624 F905F4 86 A7 stx xsecd+1 ; save logical device |
||
527 | 2625 F905F6 8B phb ; save data bank |
||
528 | 2626 F905F7 A9 01 00 lda #^vxcls |
||
529 | 2627 F905FA 48 pha |
||
530 | 2628 F905FB AB plb ; set data bank to array |
||
531 | 2629 F905FC A9 80 00 lda #$80 |
||
532 | 2630 F905FF 04 A7 tsb xsecd+1 ; mark as in use |
||
533 | 2631 F90601 CPU16CLC |
||
534 | 2632 F90601 C2 31 rep #(PMFLAG.OR.PXFLAG.OR.PCFLAG) |
||
535 | 2633 .LONGA on |
||
536 | 2634 .LONGI on |
||
537 | 2635 .MNLIST |
||
538 | 2636 F90603 A3 03 lda $03,s |
||
539 | 2637 F90605 85 A4 sta xcls ; save starting lba |
||
540 | 2638 F90607 A3 05 lda $05,s |
||
541 | 2639 F90609 85 A2 sta xcnt |
||
542 | 2640 F9060B A5 A0 lda xrov ; current first available index |
||
543 | 2641 F9060D AA tax |
||
544 | 2642 F9060E A8 tay |
||
545 | 2643 F9060F 65 A2 adc xcnt ; next available index |
||
546 | 2644 F90611 85 9E sta xmin ; raise min. available index |
||
547 | 2645 F90613 85 A0 sta xrov ; update next available index |
||
548 | 2646 F90615 8A txa |
||
549 | 2647 F90616 0A asl a |
||
550 | 2648 F90617 AA tax ; array index |
||
551 | 2649 F90618 98 tya |
||
552 | 2650 F90619 18 clc |
||
553 | 2651 F9061A 69 40 0B adc #XBSTART |
||
554 | 2652 F9061D 83 05 sta $05,s ; return buffer# |
||
555 | 2653 F9061F xget: |
||
556 | 2654 F9061F A5 A4 lda xcls |
||
557 | 2655 F90621 9D 00 94 sta !vxcls,x ; store starting lba low |
||
558 | 2656 F90624 A5 A6 lda xsecd |
||
559 | Thu Feb 11 16:56:28 2016 Page 10 |
||
560 | |||
561 | |||
562 | |||
563 | |||
564 | 2657 F90626 9D 80 9D sta !vxsec,x ; store lba high + logical device |
||
565 | 2658 F90629 A4 A2 ldy xcnt |
||
566 | 2659 F9062B 88 ?10: dey |
||
567 | 2660 F9062C F0 14 beq ?30 |
||
568 | 2661 F9062E E8 inx |
||
569 | 2662 F9062F E8 inx |
||
570 | 2663 F90630 E6 A4 inc xcls |
||
571 | 2664 F90632 D0 02 bne ?20 |
||
572 | 2665 F90634 E6 A6 inc xsecd |
||
573 | 2666 F90636 A5 A4 ?20: lda xcls |
||
574 | 2667 F90638 9D 00 94 sta !vxcls,x ; store lba low |
||
575 | 2668 F9063B A5 A6 lda xsecd |
||
576 | 2669 F9063D 9D 80 9D sta !vxsec,x ; store lba high + device |
||
577 | 2670 F90640 80 E9 bra ?10 |
||
578 | 2671 F90642 ?30: CPU08 |
||
579 | 2672 F90642 E2 30 sep #(PMFLAG.OR.PXFLAG) |
||
580 | 2673 .LONGA off |
||
581 | 2674 .LONGI off |
||
582 | 2675 .MNLIST |
||
583 | 2676 F90644 60 rts |
||
584 | 2677 |
||
585 | |||
586 | |||
587 | Lines Assembled : 2645 Errors : 0 |
||
588 | |||
589 | |||
590 |