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