Rev 2785 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2785 | Rev 4299 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | jmp @f |
8 | jmp @f |
9 | nop |
9 | nop |
10 | times 57h db 0 |
10 | times 57h db 0 |
11 | ; file 'bt2.dat':3,57h |
11 | ; file 'bt2.dat':3,57h |
12 | @@: |
12 | @@: |
- | 13 | cmp byte [si], 80h |
|
- | 14 | jnz @f |
|
- | 15 | mov eax, [si+8] |
|
- | 16 | mov [cs:7C1Ch], eax |
|
- | 17 | @@: |
|
13 | xor eax, eax |
18 | xor eax, eax |
14 | mov ds, ax |
19 | mov ds, ax |
15 | mov ss, ax |
20 | mov ss, ax |
16 | mov sp, 7C00h |
21 | mov sp, 7C00h |
- | 22 | mov bp, sp |
|
17 | mov [boot_drive], dl |
23 | mov [boot_drive], dl |
18 | cld |
24 | cld |
19 | sti |
25 | sti |
20 | push 800h |
26 | push 800h |
21 | pop es |
27 | pop es |
22 | movzx ebx, word [7C0Eh] ; reserved_sect |
28 | movzx ebx, word [bp+0Eh] ; reserved_sect |
23 | mov [fat_start], ebx |
29 | mov [fat_start], ebx |
24 | mov al, byte [7C10h] ; num_fats |
30 | mov al, byte [bp+10h] ; num_fats |
25 | mul dword [7C24h] ; sect_fat |
31 | mul dword [bp+24h] ; sect_fat |
26 | add eax, ebx |
32 | add eax, ebx |
27 | ; cluster 2 begins from sector eax |
33 | ; cluster 2 begins from sector eax |
28 | movzx ebx, byte [7C0Dh] ; sects_per_clust |
34 | movzx ebx, byte [bp+0Dh] ; sects_per_clust |
29 | add bx, bx |
35 | add bx, bx |
30 | sub eax, ebx |
36 | sub eax, ebx |
31 | mov [data_start], eax |
37 | mov [data_start], eax |
32 | mov eax, [7C2Ch] ; root_cluster |
38 | mov eax, [bp+2Ch] ; root_cluster |
33 | and eax, 0FFFFFFFh |
39 | and eax, 0FFFFFFFh |
34 | fat32_parse_dir: |
40 | fat32_parse_dir: |
35 | xor bx, bx |
41 | xor bx, bx |
36 | mov di, bx |
42 | mov di, bx |
37 | push eax |
43 | push eax |
38 | call read_cluster |
44 | call read_cluster |
39 | movzx cx, byte [7C0Dh] ; sects_per_clust |
45 | movzx cx, byte [bp+0Dh] ; sects_per_clust |
40 | shl cx, 4 ; *0x200/0x20 |
46 | shl cx, 4 ; *0x200/0x20 |
41 | scan_cluster: |
47 | scan_cluster: |
42 | cmp byte [es:di], 0 |
48 | cmp byte [es:di], 0 |
43 | jz file_not_found |
49 | jz file_not_found |
44 | push cx di |
50 | push cx di |
Line 63... | Line 69... | ||
63 | @@: |
69 | @@: |
64 | xor bx, bx |
70 | xor bx, bx |
65 | push eax |
71 | push eax |
66 | call read_cluster |
72 | call read_cluster |
67 | mov ax, es |
73 | mov ax, es |
68 | movzx cx, byte [7C0Dh] |
74 | movzx cx, byte [bp+0Dh] |
69 | shl cx, 5 |
75 | shl cx, 5 |
70 | add ax, cx |
76 | add ax, cx |
71 | mov es, ax |
77 | mov es, ax |
72 | pop eax |
78 | pop eax |
73 | call next_cluster |
79 | call next_cluster |
Line 80... | Line 86... | ||
80 | call out_string |
86 | call out_string |
81 | jmp $ |
87 | jmp $ |
Line 82... | Line 88... | ||
82 | 88 | ||
83 | read_cluster: |
89 | read_cluster: |
84 | ; in: eax = cluster, bx->buffer |
90 | ; in: eax = cluster, bx->buffer |
85 | movzx ecx, byte [7C0Dh] |
91 | movzx ecx, byte [bp+0Dh] |
86 | mul ecx |
92 | mul ecx |
Line 87... | Line 93... | ||
87 | add eax, [data_start] |
93 | add eax, [data_start] |
88 | 94 | ||
89 | ; read procedure |
95 | ; read procedure |
90 | ; in: eax = absolute sector |
96 | ; in: eax = absolute sector |
91 | ; cx = number of sectors |
97 | ; cx = number of sectors |
92 | ; es:bx -> buffer |
98 | ; es:bx -> buffer |
93 | read: |
99 | read: |
94 | add eax, [7C1Ch] ; hidden sectors |
100 | add eax, [bp+1Ch] ; hidden sectors |
95 | push es |
101 | push es |
96 | read_loop: |
102 | read_loop: |
97 | pushad |
103 | pushad |