Rev 171 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 171 | Rev 321 | ||
---|---|---|---|
Line 1548... | Line 1548... | ||
1548 | fsfrfe: |
1548 | fsfrfe: |
1549 | mov eax, 11 |
1549 | mov eax, 11 |
1550 | xor ebx, ebx |
1550 | xor ebx, ebx |
1551 | ret |
1551 | ret |
Line -... | Line 1552... | ||
- | 1552 | ||
- | 1553 | fs_FloppyCreateFolder: |
|
- | 1554 | mov al, 1 |
|
- | 1555 | jmp fs_FloppyRewrite.common |
|
1552 | 1556 | ||
- | 1557 | fs_FloppyRewrite: |
|
- | 1558 | xor eax, eax |
|
1553 | fs_FloppyRewrite: |
1559 | .common: |
1554 | cmp byte [esi], 0 |
1560 | cmp byte [esi], 0 |
1555 | jz @b |
1561 | jz @b |
1556 | call read_flp_fat |
1562 | call read_flp_fat |
1557 | cmp [FDC_Status], 0 |
1563 | cmp [FDC_Status], 0 |
Line 1614... | Line 1620... | ||
1614 | push flp_notroot_first |
1620 | push flp_notroot_first |
1615 | push flp_notroot_next |
1621 | push flp_notroot_next |
1616 | .common1: |
1622 | .common1: |
1617 | call fat_find_lfn |
1623 | call fat_find_lfn |
1618 | jc .notfound |
1624 | jc .notfound |
1619 | ; found; must not be directory |
1625 | ; found |
1620 | test byte [edi+11], 10h |
1626 | test byte [edi+11], 10h |
- | 1627 | jz .exists_file |
|
- | 1628 | ; found directory; if we are creating directory, return OK, |
|
- | 1629 | ; if we are creating file, say "access denied" |
|
- | 1630 | add esp, 28 |
|
- | 1631 | popad |
|
- | 1632 | test al, al |
|
- | 1633 | mov eax, ERROR_ACCESS_DENIED |
|
- | 1634 | jz @f |
|
- | 1635 | mov al, 0 |
|
- | 1636 | @@: |
|
- | 1637 | xor ebx, ebx |
|
- | 1638 | ret |
|
- | 1639 | .exists_file: |
|
- | 1640 | ; found file; if we are creating directory, return "access denied", |
|
- | 1641 | ; if we are creating file, delete existing file and continue |
|
- | 1642 | cmp byte [esp+28+28], 0 |
|
1621 | jz @f |
1643 | jz @f |
1622 | add esp, 28 |
1644 | add esp, 28 |
1623 | popad |
1645 | popad |
1624 | mov eax, ERROR_ACCESS_DENIED |
1646 | mov eax, ERROR_ACCESS_DENIED |
1625 | xor ebx, ebx |
1647 | xor ebx, ebx |
Line 1633... | Line 1655... | ||
1633 | test eax, eax |
1655 | test eax, eax |
1634 | jz .done1 |
1656 | jz .done1 |
1635 | @@: |
1657 | @@: |
1636 | cmp eax, 0xFF8 |
1658 | cmp eax, 0xFF8 |
1637 | jae .done1 |
1659 | jae .done1 |
1638 | lea edi, [0x282000 + eax*2] ; position in FAT |
1660 | lea edi, [FLOPPY_FAT + eax*2] ; position in FAT |
1639 | xor eax, eax |
1661 | xor eax, eax |
1640 | xchg ax, [edi] |
1662 | xchg ax, [edi] |
1641 | jmp @b |
1663 | jmp @b |
1642 | .done1: |
1664 | .done1: |
1643 | pop edi |
1665 | pop edi |
Line 1838... | Line 1860... | ||
1838 | mov [edi+24], ax ; last write date |
1860 | mov [edi+24], ax ; last write date |
1839 | mov [edi+18], ax ; last access date |
1861 | mov [edi+18], ax ; last access date |
1840 | and word [edi+20], 0 ; high word of cluster |
1862 | and word [edi+20], 0 ; high word of cluster |
1841 | and word [edi+26], 0 ; low word of cluster - to be filled |
1863 | and word [edi+26], 0 ; low word of cluster - to be filled |
1842 | and dword [edi+28], 0 ; file size - to be filled |
1864 | and dword [edi+28], 0 ; file size - to be filled |
- | 1865 | cmp byte [esp+28+28], 0 |
|
- | 1866 | jz .doit |
|
- | 1867 | ; create directory |
|
- | 1868 | mov byte [edi+11], 10h ; attributes: folder |
|
- | 1869 | mov ecx, 32*2 |
|
- | 1870 | mov edx, edi |
|
1843 | .doit: |
1871 | .doit: |
1844 | lea eax, [esp+8] |
1872 | lea eax, [esp+8] |
1845 | call dword [eax+12] ; flush directory |
1873 | call dword [eax+12] ; flush directory |
1846 | push ecx |
1874 | push ecx |
1847 | push edi |
1875 | push edi |
1848 | push 0 |
1876 | push 0 |
1849 | mov esi, edx |
1877 | mov esi, edx |
- | 1878 | test ecx, ecx |
|
1850 | jecxz .done |
1879 | jz .done |
1851 | mov ecx, 2849 |
1880 | mov ecx, 2849 |
1852 | mov edi, 0x282000 |
1881 | mov edi, FLOPPY_FAT |
1853 | push 0 ; first cluster |
1882 | push 0 ; first cluster |
1854 | .write_loop: |
1883 | .write_loop: |
1855 | ; allocate new cluster |
1884 | ; allocate new cluster |
1856 | xor eax, eax |
1885 | xor eax, eax |
1857 | repnz scasw |
1886 | repnz scasw |
1858 | mov al, ERROR_DISK_FULL |
1887 | mov al, ERROR_DISK_FULL |
1859 | jnz .ret |
1888 | jnz .ret |
1860 | dec edi |
1889 | dec edi |
1861 | dec edi |
1890 | dec edi |
1862 | lea eax, [edi-0x282000] |
1891 | lea eax, [edi-(FLOPPY_FAT)] |
1863 | shr eax, 1 ; eax = cluster |
1892 | shr eax, 1 ; eax = cluster |
1864 | mov word [edi], 0xFFF ; mark as last cluster |
1893 | mov word [edi], 0xFFF ; mark as last cluster |
1865 | xchg edi, [esp+4] |
1894 | xchg edi, [esp+4] |
1866 | cmp dword [esp], 0 |
1895 | cmp dword [esp], 0 |
1867 | jz .first |
1896 | jz .first |
Line 1877... | Line 1906... | ||
1877 | mov ecx, 512 |
1906 | mov ecx, 512 |
1878 | cmp dword [esp+20], ecx |
1907 | cmp dword [esp+20], ecx |
1879 | jae @f |
1908 | jae @f |
1880 | mov ecx, [esp+20] |
1909 | mov ecx, [esp+20] |
1881 | @@: |
1910 | @@: |
1882 | push ecx |
- | |
1883 | mov edi, 0xD000 |
1911 | mov edi, 0xD000 |
- | 1912 | cmp byte [esp+24+28+28], 0 |
|
- | 1913 | jnz .writedir |
|
- | 1914 | push ecx |
|
1884 | rep movsb |
1915 | rep movsb |
1885 | pop ecx |
1916 | pop ecx |
- | 1917 | .writedircont: |
|
1886 | push ecx |
1918 | push ecx |
1887 | sub ecx, 512 |
1919 | sub ecx, 512 |
1888 | neg ecx |
1920 | neg ecx |
1889 | push eax |
1921 | push eax |
1890 | xor eax, eax |
1922 | xor eax, eax |
Line 1933... | Line 1965... | ||
1933 | .diskerr: |
1965 | .diskerr: |
1934 | sub esi, ecx |
1966 | sub esi, ecx |
1935 | mov eax, 11 |
1967 | mov eax, 11 |
1936 | pop edi ecx |
1968 | pop edi ecx |
1937 | jmp .ret |
1969 | jmp .ret |
- | 1970 | .writedir: |
|
- | 1971 | push ecx |
|
- | 1972 | mov ecx, 32/4 |
|
- | 1973 | push ecx esi |
|
- | 1974 | rep movsd |
|
- | 1975 | pop esi ecx |
|
- | 1976 | mov dword [edi-32], '. ' |
|
- | 1977 | mov dword [edi-32+4], ' ' |
|
- | 1978 | mov dword [edi-32+8], ' ' |
|
- | 1979 | mov byte [edi-32+11], 10h |
|
- | 1980 | mov word [edi-32+26], ax |
|
- | 1981 | push esi |
|
- | 1982 | rep movsd |
|
- | 1983 | pop esi |
|
- | 1984 | mov dword [edi-32], '.. ' |
|
- | 1985 | mov dword [edi-32+4], ' ' |
|
- | 1986 | mov dword [edi-32+8], ' ' |
|
- | 1987 | mov byte [edi-32+11], 10h |
|
- | 1988 | mov ecx, [esp+28+8] |
|
- | 1989 | mov word [edi-32+26], cx |
|
- | 1990 | pop ecx |
|
- | 1991 | jmp .writedircont |
|
Line 1938... | Line 1992... | ||
1938 | 1992 | ||
1939 | ;---------------------------------------------------------------- |
1993 | ;---------------------------------------------------------------- |
1940 | ; |
1994 | ; |
1941 | ; fs_FloppyWrite - LFN variant for writing to floppy |
1995 | ; fs_FloppyWrite - LFN variant for writing to floppy |
Line 2057... | Line 2111... | ||
2057 | ; now ebx=start pos, ecx=end pos, both lie inside file |
2111 | ; now ebx=start pos, ecx=end pos, both lie inside file |
2058 | sub ecx, ebx |
2112 | sub ecx, ebx |
2059 | jz .ret |
2113 | jz .ret |
2060 | call SetUserInterrupts |
2114 | call SetUserInterrupts |
2061 | .write_loop: |
2115 | .write_loop: |
- | 2116 | ; skip unmodified sectors |
|
- | 2117 | cmp dword [esp], 0x200 |
|
- | 2118 | jb .modify |
|
- | 2119 | sub ebx, 0x200 |
|
- | 2120 | jae .skip |
|
- | 2121 | add ebx, 0x200 |
|
- | 2122 | .modify: |
|
2062 | lea eax, [edi+31] ; current sector |
2123 | lea eax, [edi+31] ; current sector |
2063 | ; get length of data in current sector |
2124 | ; get length of data in current sector |
2064 | push ecx |
2125 | push ecx |
2065 | sub ebx, 0x200 |
2126 | sub ebx, 0x200 |
2066 | jb .hasdata |
2127 | jb .hasdata |
Line 2127... | Line 2188... | ||
2127 | jnz .device_err2 |
2188 | jnz .device_err2 |
2128 | add edx, ecx |
2189 | add edx, ecx |
2129 | sub [esp], ecx |
2190 | sub [esp], ecx |
2130 | pop ecx |
2191 | pop ecx |
2131 | jz .done |
2192 | jz .done |
- | 2193 | .skip: |
|
2132 | .next_cluster: |
2194 | .next_cluster: |
2133 | movzx edi, word [edi*2+0x282000] |
2195 | movzx edi, word [edi*2+0x282000] |
2134 | sub esi, 0x200 |
2196 | sub esi, 0x200 |
2135 | jae @f |
2197 | jae @f |
2136 | xor esi, esi |
2198 | xor esi, esi |
Line 2486... | Line 2548... | ||
2486 | jz @f |
2548 | jz @f |
2487 | mov al, 11 |
2549 | mov al, 11 |
2488 | @@: |
2550 | @@: |
2489 | ret |
2551 | ret |
Line -... | Line 2552... | ||
- | 2552 | ||
2490 | 2553 | if 0 |
|
2491 | ;---------------------------------------------------------------- |
2554 | ;---------------------------------------------------------------- |
2492 | ; |
2555 | ; |
2493 | ; fs_FloppyExecute - LFN variant for executing from floppy |
2556 | ; fs_FloppyExecute - LFN variant for executing from floppy |
2494 | ; |
2557 | ; |
Line 2587... | Line 2650... | ||
2587 | ret |
2650 | ret |
2588 | .err: |
2651 | .err: |
2589 | popad |
2652 | popad |
2590 | mov eax, 11 |
2653 | mov eax, 11 |
2591 | ret |
2654 | ret |
- | 2655 | end if |
|
Line 2592... | Line 2656... | ||
2592 | 2656 | ||
2593 | ;---------------------------------------------------------------- |
2657 | ;---------------------------------------------------------------- |
2594 | ; |
2658 | ; |
2595 | ; fs_FloppyDelete - delete file or empty folder from floppy |
2659 | ; fs_FloppyDelete - delete file or empty folder from floppy |