Rev 171 | Rev 256 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
72 | diamond | 1 | ; System function 70 - files with long names (LFN) |
71 | diamond | 2 | ; diamond, 2006 |
3 | |||
4 | iglobal |
||
5 | ; in this table names must be in lowercase |
||
6 | rootdirs: |
||
75 | diamond | 7 | db 2,'rd' |
8 | dd fs_OnRamdisk |
||
9 | dd fs_NextRamdisk |
||
10 | db 7,'ramdisk' |
||
11 | dd fs_OnRamdisk |
||
12 | dd fs_NextRamdisk |
||
13 | db 2,'fd' |
||
14 | dd fs_OnFloppy |
||
15 | dd fs_NextFloppy |
||
16 | db 10,'floppydisk' |
||
17 | dd fs_OnFloppy |
||
18 | dd fs_NextFloppy |
||
19 | db 3,'hd0' |
||
20 | dd fs_OnHd0 |
||
21 | dd fs_NextHd0 |
||
22 | db 3,'hd1' |
||
23 | dd fs_OnHd1 |
||
24 | dd fs_NextHd1 |
||
25 | db 3,'hd2' |
||
26 | dd fs_OnHd2 |
||
27 | dd fs_NextHd2 |
||
28 | db 3,'hd3' |
||
29 | dd fs_OnHd3 |
||
30 | dd fs_NextHd3 |
||
87 | mario79 | 31 | ;********************************************** |
32 | db 3,'cd0' |
||
33 | dd fs_OnCd0 |
||
34 | dd fs_NextCd |
||
35 | db 3,'cd1' |
||
36 | dd fs_OnCd1 |
||
37 | dd fs_NextCd |
||
38 | db 3,'cd2' |
||
39 | dd fs_OnCd2 |
||
40 | dd fs_NextCd |
||
41 | db 3,'cd3' |
||
42 | dd fs_OnCd3 |
||
43 | dd fs_NextCd |
||
237 | serge | 44 | ;*********************************************** |
75 | diamond | 45 | db 0 |
46 | |||
87 | mario79 | 47 | |
75 | diamond | 48 | virtual_root_query: |
49 | dd fs_HasRamdisk |
||
78 | diamond | 50 | db 'rd',0 |
75 | diamond | 51 | dd fs_HasFloppy |
78 | diamond | 52 | db 'fd',0 |
75 | diamond | 53 | dd fs_HasHd0 |
78 | diamond | 54 | db 'hd0',0 |
75 | diamond | 55 | dd fs_HasHd1 |
78 | diamond | 56 | db 'hd1',0 |
75 | diamond | 57 | dd fs_HasHd2 |
78 | diamond | 58 | db 'hd2',0 |
75 | diamond | 59 | dd fs_HasHd3 |
78 | diamond | 60 | db 'hd3',0 |
87 | mario79 | 61 | ;********************************************** |
62 | dd fs_HasCd0 |
||
63 | db 'cd0',0 |
||
64 | dd fs_HasCd1 |
||
65 | db 'cd1',0 |
||
66 | dd fs_HasCd2 |
||
67 | db 'cd2',0 |
||
68 | dd fs_HasCd3 |
||
69 | db 'cd3',0 |
||
70 | ;********************************************** |
||
75 | diamond | 71 | dd 0 |
71 | diamond | 72 | endg |
73 | |||
74 | file_system_lfn: |
||
75 | ; in: eax->fileinfo block |
||
76 | ; operation codes: |
||
72 | diamond | 77 | ; 0 : read file |
75 | diamond | 78 | ; 1 : read folder |
83 | diamond | 79 | ; 2 : create/rewrite file |
133 | diamond | 80 | ; 3 : write/append to file |
81 | ; 4 : set end of file |
||
86 | diamond | 82 | ; 5 : get file/directory attributes structure |
83 | ; 6 : set file/directory attributes structure |
||
91 | diamond | 84 | ; 7 : start application |
171 | diamond | 85 | ; 8 : delete file |
86 | diamond | 86 | ; 9 : create directory - not implemented yet |
71 | diamond | 87 | |
75 | diamond | 88 | add eax, std_application_base_address |
71 | diamond | 89 | ; parse file name |
75 | diamond | 90 | xchg ebx, eax |
91 | lea esi, [ebx+20] |
||
91 | diamond | 92 | mov ebp, esi ; for 'start app' function full path must be known |
75 | diamond | 93 | lodsb |
84 | diamond | 94 | test al, al |
95 | jnz @f |
||
96 | mov esi, [esi] |
||
97 | add esi, std_application_base_address |
||
91 | diamond | 98 | mov ebp, esi |
84 | diamond | 99 | lodsb |
100 | @@: |
||
237 | serge | 101 | cmp dword [ebx], 7 |
102 | jne @F |
||
103 | mov edx, [ebx+4] |
||
104 | mov ebx, [ebx+8] |
||
105 | test ebx, ebx |
||
106 | jz .l1 |
||
107 | add ebx, new_app_base |
||
108 | .l1: |
||
109 | call fs_execute ; ebp, ebx, edx |
||
110 | mov [esp+36], eax |
||
111 | ret |
||
112 | @@: |
||
75 | diamond | 113 | cmp al, '/' |
114 | jz @f |
||
71 | diamond | 115 | .notfound: |
75 | diamond | 116 | mov dword [esp+36], 5 ; file not found |
117 | ret |
||
71 | diamond | 118 | @@: |
75 | diamond | 119 | cmp byte [esi], 0 |
120 | jz .rootdir |
||
121 | mov edi, rootdirs-8 |
||
122 | xor ecx, ecx |
||
123 | push esi |
||
71 | diamond | 124 | .scan1: |
75 | diamond | 125 | pop esi |
126 | add edi, ecx |
||
127 | scasd |
||
128 | scasd |
||
129 | mov cl, byte [edi] |
||
130 | jecxz .notfound |
||
131 | inc edi |
||
132 | push esi |
||
71 | diamond | 133 | @@: |
75 | diamond | 134 | lodsb |
135 | or al, 20h |
||
136 | scasb |
||
137 | loopz @b |
||
138 | jnz .scan1 |
||
139 | lodsb |
||
140 | cmp al, '/' |
||
141 | jz .found1 |
||
142 | test al, al |
||
143 | jnz .scan1 |
||
144 | pop eax |
||
71 | diamond | 145 | ; directory /xxx |
146 | .maindir: |
||
75 | diamond | 147 | cmp dword [ebx], 1 |
148 | jnz .access_denied |
||
149 | xor eax, eax |
||
150 | mov ebp, [ebx+12] |
||
151 | mov edx, [ebx+16] |
||
152 | add edx, std_application_base_address |
||
78 | diamond | 153 | push dword [ebx+4] ; first block |
154 | mov ebx, [ebx+8] ; flags |
||
75 | diamond | 155 | mov esi, [edi+4] |
78 | diamond | 156 | ; ebx=flags, [esp]=first block, ebp=number of blocks, edx=return area, esi='Next' handler |
75 | diamond | 157 | mov edi, edx |
158 | mov ecx, 32/4 |
||
159 | rep stosd |
||
160 | mov byte [edx], 1 ; version |
||
161 | .maindir_loop: |
||
162 | call esi |
||
163 | jc .maindir_done |
||
164 | inc dword [edx+8] |
||
78 | diamond | 165 | dec dword [esp] |
75 | diamond | 166 | jns .maindir_loop |
167 | dec ebp |
||
168 | js .maindir_loop |
||
169 | inc dword [edx+4] |
||
170 | mov dword [edi], 0x10 ; attributes: folder |
||
171 | mov dword [edi+4], 1 ; name type: UNICODE |
||
172 | push eax |
||
173 | xor eax, eax |
||
174 | add edi, 8 |
||
175 | mov ecx, 40/4-2 |
||
176 | rep stosd |
||
177 | pop eax |
||
178 | push eax edx |
||
179 | ; convert number in eax to decimal UNICODE string |
||
180 | push edi |
||
181 | push -'0' |
||
182 | mov cl, 10 |
||
183 | @@: |
||
184 | xor edx, edx |
||
185 | div ecx |
||
186 | push edx |
||
187 | test eax, eax |
||
188 | jnz @b |
||
189 | @@: |
||
190 | pop eax |
||
191 | add al, '0' |
||
78 | diamond | 192 | stosb |
193 | test bl, 1 ; UNICODE name? |
||
194 | jz .ansi2 |
||
195 | mov byte [edi], 0 |
||
196 | inc edi |
||
197 | .ansi2: |
||
198 | test al, al |
||
75 | diamond | 199 | jnz @b |
200 | mov byte [edi-1], 0 |
||
201 | pop edi |
||
78 | diamond | 202 | ; UNICODE name length is 520 bytes, ANSI - 264 |
75 | diamond | 203 | add edi, 520 |
78 | diamond | 204 | test bl, 1 |
205 | jnz @f |
||
206 | sub edi, 520-264 |
||
207 | @@: |
||
75 | diamond | 208 | pop edx eax |
209 | jmp .maindir_loop |
||
210 | .maindir_done: |
||
78 | diamond | 211 | pop eax |
212 | mov ebx, [edx+4] |
||
75 | diamond | 213 | xor eax, eax |
214 | dec ebp |
||
215 | js @f |
||
216 | mov al, ERROR_END_OF_FILE |
||
217 | @@: |
||
218 | mov [esp+36], eax |
||
219 | mov [esp+24], ebx |
||
220 | ret |
||
71 | diamond | 221 | ; directory / |
222 | .rootdir: |
||
75 | diamond | 223 | cmp dword [ebx], 1 ; read folder? |
224 | jz .readroot |
||
225 | .access_denied: |
||
226 | mov dword [esp+36], 10 ; access denied |
||
227 | ret |
||
71 | diamond | 228 | |
75 | diamond | 229 | .readroot: |
230 | ; virtual root folder - special handler |
||
231 | mov esi, virtual_root_query |
||
232 | mov ebp, [ebx+12] |
||
233 | mov edx, [ebx+16] |
||
234 | add edx, std_application_base_address |
||
78 | diamond | 235 | push dword [ebx+4] ; first block |
236 | mov ebx, [ebx+8] ; flags |
||
75 | diamond | 237 | xor eax, eax |
78 | diamond | 238 | ; eax=0, [esp]=first block, ebx=flags, ebp=number of blocks, edx=return area |
75 | diamond | 239 | mov edi, edx |
240 | mov ecx, 32/4 |
||
241 | rep stosd |
||
242 | mov byte [edx], 1 ; version |
||
243 | .readroot_loop: |
||
244 | cmp dword [esi], eax |
||
245 | jz .readroot_done |
||
246 | call dword [esi] |
||
247 | add esi, 4 |
||
248 | test eax, eax |
||
249 | jnz @f |
||
250 | .readroot_next: |
||
251 | or ecx, -1 |
||
252 | xchg esi, edi |
||
78 | diamond | 253 | repnz scasb |
75 | diamond | 254 | xchg esi, edi |
255 | jmp .readroot_loop |
||
256 | @@: |
||
257 | xor eax, eax |
||
258 | inc dword [edx+8] |
||
78 | diamond | 259 | dec dword [esp] |
75 | diamond | 260 | jns .readroot_next |
261 | dec ebp |
||
262 | js .readroot_next |
||
263 | inc dword [edx+4] |
||
264 | mov dword [edi], 0x10 ; attributes: folder |
||
265 | mov dword [edi+4], 1 ; name type: UNICODE |
||
266 | add edi, 8 |
||
267 | mov ecx, 40/4-2 |
||
268 | rep stosd |
||
269 | push edi |
||
270 | @@: |
||
78 | diamond | 271 | lodsb |
272 | stosb |
||
273 | test bl, 1 |
||
274 | jz .ansi |
||
275 | mov byte [edi], 0 |
||
276 | inc edi |
||
277 | .ansi: |
||
75 | diamond | 278 | test eax, eax |
279 | jnz @b |
||
280 | pop edi |
||
281 | add edi, 520 |
||
78 | diamond | 282 | test bl, 1 |
283 | jnz .readroot_loop |
||
284 | sub edi, 520-264 |
||
75 | diamond | 285 | jmp .readroot_loop |
286 | .readroot_done: |
||
78 | diamond | 287 | pop eax |
288 | mov ebx, [edx+4] |
||
75 | diamond | 289 | xor eax, eax |
290 | dec ebp |
||
291 | js @f |
||
292 | mov al, ERROR_END_OF_FILE |
||
293 | @@: |
||
294 | mov [esp+36], eax |
||
295 | mov [esp+24], ebx |
||
296 | ret |
||
297 | |||
71 | diamond | 298 | .found1: |
75 | diamond | 299 | pop eax |
300 | cmp byte [esi], 0 |
||
301 | jz .maindir |
||
71 | diamond | 302 | ; read partition number |
75 | diamond | 303 | xor ecx, ecx |
304 | xor eax, eax |
||
71 | diamond | 305 | @@: |
75 | diamond | 306 | lodsb |
307 | cmp al, '/' |
||
308 | jz .done1 |
||
309 | test al, al |
||
310 | jz .done1 |
||
311 | sub al, '0' |
||
312 | cmp al, 9 |
||
313 | ja .notfound |
||
314 | imul ecx, 10 |
||
315 | add ecx, eax |
||
316 | jmp @b |
||
71 | diamond | 317 | .done1: |
75 | diamond | 318 | test ecx, ecx |
319 | jz .notfound |
||
320 | test al, al |
||
321 | jnz @f |
||
322 | dec esi |
||
71 | diamond | 323 | @@: |
75 | diamond | 324 | ; now [edi] contains handler address, ecx - partition number, |
325 | ; esi points to ASCIIZ string - rest of name |
||
326 | jmp dword [edi] |
||
71 | diamond | 327 | |
328 | ; handlers for devices |
||
75 | diamond | 329 | ; in: ecx = 0 => query virtual directory /xxx |
71 | diamond | 330 | ; in: ecx = partition number |
331 | ; esi -> relative (for device) name |
||
332 | ; ebx -> fileinfo |
||
333 | ; out: [esp+36]=image of eax, [esp+24]=image of ebx |
||
334 | |||
335 | fs_OnRamdisk: |
||
75 | diamond | 336 | cmp ecx, 1 |
337 | jnz file_system_lfn.notfound |
||
338 | mov eax, [ebx] |
||
83 | diamond | 339 | cmp eax, fs_NumRamdiskServices |
340 | jae .not_impl |
||
75 | diamond | 341 | mov ecx, [ebx+12] |
342 | mov edx, [ebx+16] |
||
343 | add edx, std_application_base_address |
||
344 | add ebx, 4 |
||
345 | call dword [fs_RamdiskServices + eax*4] |
||
346 | mov [esp+36], eax |
||
347 | mov [esp+24], ebx |
||
348 | ret |
||
71 | diamond | 349 | .not_impl: |
75 | diamond | 350 | mov dword [esp+36], 2 ; not implemented |
351 | ret |
||
71 | diamond | 352 | |
86 | diamond | 353 | fs_NotImplemented: |
354 | mov eax, 2 |
||
355 | ret |
||
356 | |||
71 | diamond | 357 | fs_RamdiskServices: |
75 | diamond | 358 | dd fs_RamdiskRead |
359 | dd fs_RamdiskReadFolder |
||
83 | diamond | 360 | dd fs_RamdiskRewrite |
131 | diamond | 361 | dd fs_RamdiskWrite |
133 | diamond | 362 | dd fs_RamdiskSetFileEnd |
86 | diamond | 363 | dd fs_RamdiskGetFileInfo |
364 | dd fs_RamdiskSetFileInfo |
||
91 | diamond | 365 | dd fs_RamdiskExecute |
171 | diamond | 366 | dd fs_RamdiskDelete |
83 | diamond | 367 | fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4 |
71 | diamond | 368 | |
369 | fs_OnFloppy: |
||
75 | diamond | 370 | cmp ecx, 2 |
371 | ja file_system_lfn.notfound |
||
372 | mov eax, [ebx] |
||
83 | diamond | 373 | cmp eax, fs_NumFloppyServices |
374 | jae fs_OnRamdisk.not_impl |
||
75 | diamond | 375 | call reserve_flp |
376 | mov [flp_number], cl |
||
377 | mov ecx, [ebx+12] |
||
378 | mov edx, [ebx+16] |
||
379 | add edx, std_application_base_address |
||
380 | add ebx, 4 |
||
381 | call dword [fs_FloppyServices + eax*4] |
||
382 | and [flp_status], 0 |
||
383 | mov [esp+36], eax |
||
384 | mov [esp+24], ebx |
||
385 | ret |
||
71 | diamond | 386 | |
387 | fs_FloppyServices: |
||
75 | diamond | 388 | dd fs_FloppyRead |
389 | dd fs_FloppyReadFolder |
||
83 | diamond | 390 | dd fs_FloppyRewrite |
131 | diamond | 391 | dd fs_FloppyWrite |
133 | diamond | 392 | dd fs_FloppySetFileEnd |
86 | diamond | 393 | dd fs_FloppyGetFileInfo |
394 | dd fs_FloppySetFileInfo |
||
91 | diamond | 395 | dd fs_FloppyExecute |
171 | diamond | 396 | dd fs_FloppyDelete |
83 | diamond | 397 | fs_NumFloppyServices = ($ - fs_FloppyServices)/4 |
71 | diamond | 398 | |
399 | fs_OnHd0: |
||
75 | diamond | 400 | call reserve_hd1 |
401 | mov [hdbase], 0x1F0 |
||
402 | mov [hdid], 0 |
||
403 | push 1 |
||
404 | jmp fs_OnHd |
||
71 | diamond | 405 | fs_OnHd1: |
75 | diamond | 406 | call reserve_hd1 |
407 | mov [hdbase], 0x1F0 |
||
408 | mov [hdid], 0x10 |
||
409 | push 2 |
||
410 | jmp fs_OnHd |
||
71 | diamond | 411 | fs_OnHd2: |
75 | diamond | 412 | call reserve_hd1 |
413 | mov [hdbase], 0x170 |
||
414 | mov [hdid], 0 |
||
415 | push 3 |
||
416 | jmp fs_OnHd |
||
71 | diamond | 417 | fs_OnHd3: |
75 | diamond | 418 | call reserve_hd1 |
419 | mov [hdbase], 0x170 |
||
420 | mov [hdid], 0x10 |
||
421 | push 4 |
||
71 | diamond | 422 | fs_OnHd: |
95 | mario79 | 423 | call reserve_hd_channel |
75 | diamond | 424 | pop eax |
425 | mov [hdpos], eax |
||
426 | cmp ecx, 0x100 |
||
427 | jae .nf |
||
428 | cmp cl, [0x40001+eax] |
||
429 | jbe @f |
||
430 | .nf: |
||
95 | mario79 | 431 | call free_hd_channel |
75 | diamond | 432 | and [hd1_status], 0 |
433 | mov dword [esp+36], 5 ; not found |
||
434 | ret |
||
71 | diamond | 435 | @@: |
75 | diamond | 436 | mov [fat32part], ecx |
437 | push ebx esi |
||
438 | call choice_necessity_partition_1 |
||
439 | pop esi ebx |
||
440 | mov ecx, [ebx+12] |
||
441 | mov edx, [ebx+16] |
||
442 | add edx, std_application_base_address |
||
443 | mov eax, [ebx] |
||
83 | diamond | 444 | cmp eax, fs_NumHdServices |
445 | jae .not_impl |
||
75 | diamond | 446 | add ebx, 4 |
447 | call dword [fs_HdServices + eax*4] |
||
95 | mario79 | 448 | call free_hd_channel |
75 | diamond | 449 | and [hd1_status], 0 |
450 | mov [esp+36], eax |
||
451 | mov [esp+24], ebx |
||
452 | ret |
||
453 | .not_impl: |
||
95 | mario79 | 454 | call free_hd_channel |
75 | diamond | 455 | and [hd1_status], 0 |
456 | mov dword [esp+36], 2 ; not implemented |
||
457 | ret |
||
71 | diamond | 458 | |
459 | fs_HdServices: |
||
75 | diamond | 460 | dd fs_HdRead |
461 | dd fs_HdReadFolder |
||
83 | diamond | 462 | dd fs_HdRewrite |
131 | diamond | 463 | dd fs_HdWrite |
133 | diamond | 464 | dd fs_HdSetFileEnd |
86 | diamond | 465 | dd fs_HdGetFileInfo |
466 | dd fs_HdSetFileInfo |
||
91 | diamond | 467 | dd fs_HdExecute |
171 | diamond | 468 | dd fs_HdDelete |
83 | diamond | 469 | fs_NumHdServices = ($ - fs_HdServices)/4 |
75 | diamond | 470 | |
87 | mario79 | 471 | ;******************************************************* |
472 | fs_OnCd0: |
||
473 | call reserve_cd |
||
474 | mov [ChannelNumber],1 |
||
475 | mov [DiskNumber],0 |
||
476 | push 6 |
||
477 | jmp fs_OnCd |
||
478 | fs_OnCd1: |
||
479 | call reserve_cd |
||
480 | mov [ChannelNumber],1 |
||
481 | mov [DiskNumber],1 |
||
482 | push 4 |
||
483 | jmp fs_OnCd |
||
484 | fs_OnCd2: |
||
485 | call reserve_cd |
||
486 | mov [ChannelNumber],2 |
||
487 | mov [DiskNumber],0 |
||
488 | push 2 |
||
489 | jmp fs_OnCd |
||
490 | fs_OnCd3: |
||
491 | call reserve_cd |
||
492 | mov [ChannelNumber],2 |
||
493 | mov [DiskNumber],1 |
||
494 | push 0 |
||
495 | fs_OnCd: |
||
95 | mario79 | 496 | call reserve_cd_channel |
87 | mario79 | 497 | pop eax |
498 | mov [hdpos], eax |
||
499 | cmp ecx, 0x100 |
||
500 | jae .nf |
||
133 | diamond | 501 | push ecx ebx |
87 | mario79 | 502 | mov cl,al |
503 | mov bl,[0x40001] |
||
504 | shr bl,cl |
||
505 | test bl,2 |
||
133 | diamond | 506 | pop ebx ecx |
87 | mario79 | 507 | |
508 | jnz @f |
||
509 | .nf: |
||
95 | mario79 | 510 | call free_cd_channel |
87 | mario79 | 511 | and [cd_status], 0 |
512 | mov dword [esp+36], 5 ; not found |
||
513 | ret |
||
514 | @@: |
||
515 | mov ecx, [ebx+12] |
||
516 | mov edx, [ebx+16] |
||
517 | add edx, std_application_base_address |
||
518 | mov eax, [ebx] |
||
90 | mario79 | 519 | cmp eax,fs_NumCdServices |
520 | jae .not_impl |
||
87 | mario79 | 521 | add ebx, 4 |
522 | call dword [fs_CdServices + eax*4] |
||
95 | mario79 | 523 | call free_cd_channel |
87 | mario79 | 524 | and [cd_status], 0 |
525 | mov [esp+36], eax |
||
526 | mov [esp+24], ebx |
||
527 | ret |
||
528 | .not_impl: |
||
95 | mario79 | 529 | call free_cd_channel |
89 | diamond | 530 | and [cd_status], 0 |
87 | mario79 | 531 | mov dword [esp+36], 2 ; not implemented |
532 | ret |
||
533 | |||
534 | fs_CdServices: |
||
535 | dd fs_CdRead |
||
536 | dd fs_CdReadFolder |
||
90 | mario79 | 537 | dd fs_NotImplemented |
538 | dd fs_NotImplemented |
||
539 | dd fs_NotImplemented |
||
540 | dd fs_CdGetFileInfo |
||
541 | dd fs_NotImplemented |
||
94 | mario79 | 542 | dd fs_CdExecute |
90 | mario79 | 543 | fs_NumCdServices = ($ - fs_CdServices)/4 |
544 | |||
87 | mario79 | 545 | ;******************************************************* |
546 | |||
75 | diamond | 547 | fs_HasRamdisk: |
548 | mov al, 1 ; we always have ramdisk |
||
549 | ret |
||
550 | |||
551 | fs_HasFloppy: |
||
552 | cmp byte [0x40000], 0 |
||
553 | setnz al |
||
554 | ret |
||
555 | |||
556 | fs_HasHd0: |
||
557 | mov al, [0x40001] |
||
558 | and al, 11000000b |
||
559 | cmp al, 01000000b |
||
560 | setz al |
||
561 | ret |
||
562 | fs_HasHd1: |
||
563 | mov al, [0x40001] |
||
564 | and al, 00110000b |
||
565 | cmp al, 00010000b |
||
566 | setz al |
||
567 | ret |
||
568 | fs_HasHd2: |
||
569 | mov al, [0x40001] |
||
570 | and al, 00001100b |
||
571 | cmp al, 00000100b |
||
572 | setz al |
||
573 | ret |
||
574 | fs_HasHd3: |
||
575 | mov al, [0x40001] |
||
576 | and al, 00000011b |
||
577 | cmp al, 00000001b |
||
578 | setz al |
||
579 | ret |
||
580 | |||
87 | mario79 | 581 | ;******************************************************* |
582 | fs_HasCd0: |
||
583 | mov al, [0x40001] |
||
584 | and al, 11000000b |
||
585 | cmp al, 10000000b |
||
586 | setz al |
||
587 | ret |
||
588 | fs_HasCd1: |
||
589 | mov al, [0x40001] |
||
590 | and al, 00110000b |
||
591 | cmp al, 00100000b |
||
592 | setz al |
||
593 | ret |
||
594 | fs_HasCd2: |
||
595 | mov al, [0x40001] |
||
596 | and al, 00001100b |
||
597 | cmp al, 00001000b |
||
598 | setz al |
||
599 | ret |
||
600 | fs_HasCd3: |
||
601 | mov al, [0x40001] |
||
602 | and al, 00000011b |
||
603 | cmp al, 00000010b |
||
604 | setz al |
||
605 | ret |
||
237 | serge | 606 | ;******************************************************* |
87 | mario79 | 607 | |
75 | diamond | 608 | ; fs_NextXXX functions: |
609 | ; in: eax = partition number, from which start to scan |
||
610 | ; out: CF=1 => no more partitions |
||
611 | ; CF=0 => eax=next partition number |
||
612 | |||
613 | fs_NextRamdisk: |
||
614 | ; we always have /rd/1 |
||
615 | test eax, eax |
||
616 | stc |
||
617 | jnz @f |
||
618 | mov al, 1 |
||
619 | clc |
||
620 | @@: |
||
621 | ret |
||
622 | |||
623 | fs_NextFloppy: |
||
624 | ; we have /fd/1 iff (([0x40000] and 0xF0) != 0) and /fd/2 iff (([0x40000] and 0x0F) != 0) |
||
625 | test byte [0x40000], 0xF0 |
||
626 | jz .no1 |
||
627 | test eax, eax |
||
628 | jnz .no1 |
||
629 | inc eax |
||
630 | ret ; CF cleared |
||
631 | .no1: |
||
632 | test byte [0x40000], 0x0F |
||
633 | jz .no2 |
||
634 | cmp al, 2 |
||
635 | jae .no2 |
||
636 | mov al, 2 |
||
637 | clc |
||
638 | ret |
||
639 | .no2: |
||
640 | stc |
||
641 | ret |
||
642 | |||
643 | ; on hdx, we have partitions from 1 to [0x40002+x] |
||
644 | fs_NextHd0: |
||
645 | push 0 |
||
646 | jmp fs_NextHd |
||
647 | fs_NextHd1: |
||
648 | push 1 |
||
649 | jmp fs_NextHd |
||
650 | fs_NextHd2: |
||
651 | push 2 |
||
652 | jmp fs_NextHd |
||
653 | fs_NextHd3: |
||
654 | push 3 |
||
655 | fs_NextHd: |
||
656 | pop ecx |
||
657 | movzx ecx, byte [0x40002+ecx] |
||
658 | cmp eax, ecx |
||
659 | jae fs_NextFloppy.no2 |
||
660 | inc eax |
||
661 | clc |
||
662 | ret |
||
237 | serge | 663 | |
87 | mario79 | 664 | ;******************************************************* |
665 | fs_NextCd: |
||
666 | ; we always have /cdX/1 |
||
667 | test eax, eax |
||
668 | stc |
||
669 | jnz @f |
||
670 | mov al, 1 |
||
671 | clc |
||
672 | @@: |
||
673 | ret |
||
674 | ;******************************************************* |
||
675 |