Rev 247 | Rev 335 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 247 | Rev 321 | ||
---|---|---|---|
Line 1464... | Line 1464... | ||
1464 | popad |
1464 | popad |
1465 | ret |
1465 | ret |
Line 1466... | Line 1466... | ||
1466 | 1466 | ||
1467 | ;---------------------------------------------------------------- |
1467 | ;---------------------------------------------------------------- |
1468 | ; |
1468 | ; |
- | 1469 | ; fs_RamdiskRewrite - LFN variant for writing ramdisk |
|
1469 | ; fs_RamdiskRewrite - LFN variant for writing sys floppy |
1470 | ; fs_RamdiskCreateFolder - create folder on ramdisk |
1470 | ; |
1471 | ; |
1471 | ; esi points to filename |
1472 | ; esi points to file/folder name |
1472 | ; ebx ignored (reserved) |
1473 | ; ebx ignored (reserved) |
1473 | ; ecx number of bytes to write, 0+ |
1474 | ; ecx number of bytes to write, 0+ (ignored for folders) |
1474 | ; edx mem location to data |
1475 | ; edx mem location to data (ignored for folders) |
1475 | ; |
1476 | ; |
1476 | ; ret ebx = number of written bytes |
1477 | ; ret ebx = number of written bytes |
1477 | ; eax = 0 ok read or other = errormsg |
1478 | ; eax = 0 ok read or other = errormsg |
1478 | ; |
1479 | ; |
1479 | ;-------------------------------------------------------------- |
1480 | ;-------------------------------------------------------------- |
1480 | @@: |
1481 | @@: |
1481 | mov eax, ERROR_ACCESS_DENIED |
1482 | mov eax, ERROR_ACCESS_DENIED |
1482 | xor ebx, ebx |
1483 | xor ebx, ebx |
Line -... | Line 1484... | ||
- | 1484 | ret |
|
- | 1485 | ||
- | 1486 | fs_RamdiskCreateFolder: |
|
- | 1487 | mov al, 1 ; create folder |
|
1483 | ret |
1488 | jmp fs_RamdiskRewrite.common |
- | 1489 | ||
- | 1490 | fs_RamdiskRewrite: |
|
1484 | 1491 | xor eax, eax ; create file |
|
1485 | fs_RamdiskRewrite: |
1492 | .common: |
1486 | cmp byte [esi], 0 |
1493 | cmp byte [esi], 0 |
1487 | jz @b |
1494 | jz @b |
1488 | pushad |
1495 | pushad |
Line 1535... | Line 1542... | ||
1535 | push ramdisk_notroot_first |
1542 | push ramdisk_notroot_first |
1536 | push ramdisk_notroot_next |
1543 | push ramdisk_notroot_next |
1537 | .common1: |
1544 | .common1: |
1538 | call fat_find_lfn |
1545 | call fat_find_lfn |
1539 | jc .notfound |
1546 | jc .notfound |
1540 | ; found; must not be directory |
1547 | ; found |
1541 | test byte [edi+11], 10h |
1548 | test byte [edi+11], 10h |
- | 1549 | jz .exists_file |
|
- | 1550 | ; found directory; if we are creating directory, return OK, |
|
- | 1551 | ; if we are creating file, say "access denied" |
|
- | 1552 | add esp, 20 |
|
- | 1553 | popad |
|
- | 1554 | test al, al |
|
- | 1555 | mov eax, ERROR_ACCESS_DENIED |
|
- | 1556 | jz @f |
|
- | 1557 | mov al, 0 |
|
- | 1558 | @@: |
|
- | 1559 | xor ebx, ebx |
|
- | 1560 | ret |
|
- | 1561 | .exists_file: |
|
- | 1562 | ; found file; if we are creating directory, return "access denied", |
|
- | 1563 | ; if we are creating file, delete existing file and continue |
|
- | 1564 | cmp byte [esp+20+28], 0 |
|
1542 | jz @f |
1565 | jz @f |
1543 | add esp, 20 |
1566 | add esp, 20 |
1544 | popad |
1567 | popad |
1545 | mov eax, ERROR_ACCESS_DENIED |
1568 | mov eax, ERROR_ACCESS_DENIED |
1546 | xor ebx, ebx |
1569 | xor ebx, ebx |
Line 1554... | Line 1577... | ||
1554 | test eax, eax |
1577 | test eax, eax |
1555 | jz .done1 |
1578 | jz .done1 |
1556 | @@: |
1579 | @@: |
1557 | cmp eax, 0xFF8 |
1580 | cmp eax, 0xFF8 |
1558 | jae .done1 |
1581 | jae .done1 |
1559 | lea edi, [0x280000 + eax*2] ; position in FAT |
1582 | lea edi, [RAMDISK_FAT + eax*2] ; position in FAT |
1560 | xor eax, eax |
1583 | xor eax, eax |
1561 | xchg ax, [edi] |
1584 | xchg ax, [edi] |
1562 | jmp @b |
1585 | jmp @b |
1563 | .done1: |
1586 | .done1: |
1564 | pop edi |
1587 | pop edi |
Line 1746... | Line 1769... | ||
1746 | mov [edi+24], ax ; last write date |
1769 | mov [edi+24], ax ; last write date |
1747 | mov [edi+18], ax ; last access date |
1770 | mov [edi+18], ax ; last access date |
1748 | and word [edi+20], 0 ; high word of cluster |
1771 | and word [edi+20], 0 ; high word of cluster |
1749 | and word [edi+26], 0 ; low word of cluster - to be filled |
1772 | and word [edi+26], 0 ; low word of cluster - to be filled |
1750 | and dword [edi+28], 0 ; file size - to be filled |
1773 | and dword [edi+28], 0 ; file size - to be filled |
- | 1774 | cmp byte [esp+20+28], 0 |
|
- | 1775 | jz .doit |
|
- | 1776 | ; create directory |
|
- | 1777 | mov byte [edi+11], 10h ; attributes: folder |
|
- | 1778 | mov ecx, 32*2 |
|
- | 1779 | mov edx, edi |
|
1751 | .doit: |
1780 | .doit: |
1752 | push edx |
1781 | push edx |
1753 | push ecx |
1782 | push ecx |
1754 | push edi |
1783 | push edi |
1755 | add edi, 26 ; edi points to low word of cluster |
1784 | add edi, 26 ; edi points to low word of cluster |
1756 | push edi |
1785 | push edi |
1757 | jecxz .done |
1786 | jecxz .done |
1758 | mov ecx, 2849 |
1787 | mov ecx, 2849 |
1759 | mov edi, 0x280000 |
1788 | mov edi, RAMDISK_FAT |
1760 | .write_loop: |
1789 | .write_loop: |
1761 | ; allocate new cluster |
1790 | ; allocate new cluster |
1762 | xor eax, eax |
1791 | xor eax, eax |
1763 | repnz scasw |
1792 | repnz scasw |
1764 | jnz .disk_full2 |
1793 | jnz .disk_full2 |
1765 | dec edi |
1794 | dec edi |
1766 | dec edi |
1795 | dec edi |
1767 | lea eax, [edi-0x280000] |
1796 | lea eax, [edi-(RAMDISK_FAT)] |
1768 | shr eax, 1 ; eax = cluster |
1797 | shr eax, 1 ; eax = cluster |
1769 | mov word [edi], 0xFFF ; mark as last cluster |
1798 | mov word [edi], 0xFFF ; mark as last cluster |
1770 | xchg edi, [esp] |
1799 | xchg edi, [esp] |
1771 | stosw |
1800 | stosw |
1772 | pop edi |
1801 | pop edi |
1773 | push edi |
1802 | push edi |
1774 | inc ecx |
1803 | inc ecx |
1775 | ; write data |
1804 | ; write data |
- | 1805 | cmp byte [esp+16+20+28], 0 |
|
- | 1806 | jnz .writedir |
|
1776 | shl eax, 9 |
1807 | shl eax, 9 |
1777 | add eax, 0x100000+31*512 |
1808 | add eax, RAMDISK+31*512 |
- | 1809 | .writefile: |
|
1778 | mov ebx, edx |
1810 | mov ebx, edx |
1779 | xchg eax, ebx |
1811 | xchg eax, ebx |
1780 | push ecx |
1812 | push ecx |
1781 | mov ecx, 512 |
1813 | mov ecx, 512 |
1782 | cmp dword [esp+12], ecx |
1814 | cmp dword [esp+12], ecx |
Line 1807... | Line 1839... | ||
1807 | mov [esp+16], ebx |
1839 | mov [esp+16], ebx |
1808 | popad |
1840 | popad |
1809 | push ERROR_DISK_FULL |
1841 | push ERROR_DISK_FULL |
1810 | pop eax |
1842 | pop eax |
1811 | ret |
1843 | ret |
- | 1844 | .writedir: |
|
- | 1845 | mov edi, eax |
|
- | 1846 | shl edi, 9 |
|
- | 1847 | add edi, RAMDISK+31*512 |
|
- | 1848 | mov esi, edx |
|
- | 1849 | mov ecx, 32/4 |
|
- | 1850 | push ecx |
|
- | 1851 | rep movsd |
|
- | 1852 | mov dword [edi-32], '. ' |
|
- | 1853 | mov dword [edi-32+4], ' ' |
|
- | 1854 | mov dword [edi-32+8], ' ' |
|
- | 1855 | mov byte [edi-32+11], 10h |
|
- | 1856 | mov word [edi-32+26], ax |
|
- | 1857 | mov esi, edx |
|
- | 1858 | pop ecx |
|
- | 1859 | rep movsd |
|
- | 1860 | mov dword [edi-32], '.. ' |
|
- | 1861 | mov dword [edi-32+4], ' ' |
|
- | 1862 | mov dword [edi-32+8], ' ' |
|
- | 1863 | mov byte [edi-32+11], 10h |
|
- | 1864 | mov eax, [esp+16+8] |
|
- | 1865 | mov word [edi-32+26], ax |
|
- | 1866 | pop edi edi ecx edx |
|
- | 1867 | add esp, 20 |
|
- | 1868 | popad |
|
- | 1869 | xor eax, eax |
|
- | 1870 | xor ebx, ebx |
|
- | 1871 | ret |
|
Line 1812... | Line 1872... | ||
1812 | 1872 | ||
1813 | .read_symbol: |
1873 | .read_symbol: |
1814 | or ax, -1 |
1874 | or ax, -1 |
1815 | test esi, esi |
1875 | test esi, esi |