ZealOS/docs/Doc/BlkChain.DD.html
2021-10-27 03:28:16 -04:00

62 lines
5.4 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.04">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF5> Block Chain</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a>There was a technique on the Commodore 64 where disk blocks were chained together with a block pointer at the end of each
<a name="l4"></a>block. This is far inferior to having a file allocation table, as in FAT32.
<a name="l5"></a>
<a name="l6"></a>The </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/RedSea.DD.html#l1"><span class=cF4>RedSea</span></a><span class=cF0> file system does not allow files to grow because it only has an allocation bitmap and not a FAT table. This
<a name="l7"></a>&quot;flaw&quot; is by design. Terry intentionally crippled the operating system, making it a toy with the wisdom that this will
<a name="l8"></a>prevent commercialization and corruption. The toy spirit of the operating system will be preserved going into the future. Th
<a name="l9"></a>e vision for this operating system was a modern Commodore 64, which was a fun toy.
<a name="l10"></a>
<a name="l11"></a>Doing whole file operations is the ZealOS way of doing things. It is the simplest and, ironically, the fastest. It is
<a name="l12"></a>obnoxious in the characteristic way that ZealOS is obnoxious, flaunting massive modern resources in a way that makes old
<a name="l13"></a>programmers protest.
<a name="l14"></a>
<a name="l15"></a>When doing large, whole-file operations, immediately memory fragmentation is a serious problem, but not so for allocations in
<a name="l16"></a>the range under a Meg (with occasional larger ones).
<a name="l17"></a>
<a name="l18"></a>The </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/DolDoc.DD.html#l1"><span class=cF4>DolDoc</span></a><span class=cF0> format cannot have text tacked onto the end, since binary data is at the end.
<a name="l19"></a>
<a name="l20"></a>Terry didn't want to spoil fun, so of course offered a way to get awesome performance that is, ironically, superior. </span><span class=cF4>
<a name="l21"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskCFile.CC.html#l151"><span class=cF4>FBlkRead</span></a><span class=cF0>() and </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskCFile.CC.html#l214"><span class=cF4>FBlkWrite</span></a><span class=cF0>() allow you to read a block offset from the start of a file. Since files are all contiguous, this is
<a name="l22"></a>incredibly efficient. You just have to declare the desired file size when you create it with </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskCFile.CC.html#l9"><span class=cF4>FOpen</span></a><span class=cF0>() and cannot change it.
<a name="l23"></a>See </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Disk/DataBase.CC.html#l1"><span class=cF4>::/Demo/Disk/DataBase.CC</span></a><span class=cF0>.
<a name="l24"></a>
<a name="l25"></a>If you like, you are encouraged to to do raw </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskBlk.CC.html#l37"><span class=cF4>BlkRead</span></a><span class=cF0>() and </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskBlk.CC.html#l87"><span class=cF4>BlkWrite</span></a><span class=cF0>() directly on a drive. Just get a pointer to a </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3379"><span class=cF4>CDrive</span></a><span class=cF0>
<a name="l26"></a>with </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskDrive.CC.html#l211"><span class=cF4>Letter2Drive</span></a><span class=cF0>() and you are on your way! Your computer is supposed to be a fun toy! You can make an entire partition
<a name="l27"></a>used for a database, or invent a file system.
<a name="l28"></a>
<a name="l29"></a>On the whole, the </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/RedSea.DD.html#l1"><span class=cF4>RedSea</span></a><span class=cF0> file system with its whole-file-only limitation bring beautiful harmony. It beautifully captures
<a name="l30"></a>the spirit of ZealOS with simplicity and, ironic speed, since contiguous is fastest.
<a name="l31"></a>
<a name="l32"></a></span><span class=cF8>
<a name="l33"></a>* &quot;Commodore 64&quot; is a trademark owned by Polabe Holding NV.
</span></pre></body>
</html>