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