"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2022-04-17 Sun 18:14 -->
+<!-- 2023-09-18 Mon 01:47 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Fifth - virtual machine, operating system, programming language</title>
-<meta name="generator" content="Org mode" />
<meta name="author" content="Svjatoslav Agejenko" />
-<style type="text/css">
- <!--/*--><![CDATA[/*><!--*/
+<meta name="generator" content="Org Mode" />
+<style>
+ #content { max-width: 60em; margin: auto; }
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
- border: 1px solid #ccc;
- box-shadow: 3px 3px 3px #eee;
+ border: 1px solid #e6e6e6;
+ border-radius: 3px;
+ background-color: #f2f2f2;
padding: 8pt;
font-family: monospace;
overflow: auto;
}
pre.src {
position: relative;
- overflow: visible;
- padding-top: 1.2em;
+ overflow: auto;
}
pre.src:before {
display: none;
position: absolute;
- background-color: white;
- top: -10px;
- right: 10px;
+ top: -8px;
+ right: 12px;
padding: 3px;
- border: 1px solid black;
+ color: #555;
+ background-color: #f2f2f299;
}
- pre.src:hover:before { display: inline;}
+ pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
+ pre.src-authinfo::before { content: 'Authinfo'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
- .org-svg { width: 90%; }
- /*]]>*/-->
+ .org-svg { }
</style>
<link rel="stylesheet" type="text/css" href="https://thomasf.github.io/solarized-css/solarized-dark.min.css" />
-<script type="text/javascript">
-/*
-@licstart The following is the entire license notice for the
-JavaScript code in this tag.
-
-Copyright (C) 2012-2020 Free Software Foundation, Inc.
-
-The JavaScript code in this tag is free software: you can
-redistribute it and/or modify it under the terms of the GNU
-General Public License (GNU GPL) as published by the Free Software
-Foundation, either version 3 of the License, or (at your option)
-any later version. The code is distributed WITHOUT ANY WARRANTY;
-without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
-
-As additional permission under GNU GPL version 3 section 7, you
-may distribute non-source (e.g., minimized or compacted) forms of
-that code without the copy of the GNU GPL normally required by
-section 4, provided you include this license notice and a URL
-through which recipients can access the Corresponding Source.
-
-
-@licend The above is the entire license notice
-for the JavaScript code in this tag.
-*/
-<!--/*--><![CDATA[/*><!--*/
- function CodeHighlightOn(elem, id)
- {
- var target = document.getElementById(id);
- if(null != target) {
- elem.cacheClassElem = elem.className;
- elem.cacheClassTarget = target.className;
- target.className = "code-highlighted";
- elem.className = "code-highlighted";
- }
- }
- function CodeHighlightOff(elem, id)
- {
- var target = document.getElementById(id);
- if(elem.cacheClassElem)
- elem.className = elem.cacheClassElem;
- if(elem.cacheClassTarget)
- target.className = elem.cacheClassTarget;
- }
-/*]]>*///-->
-</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
}
});
</script>
-<script type="text/javascript"
- src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
-<div id="content">
+<div id="content" class="content">
<h1 class="title">Fifth - virtual machine, operating system, programming language</h1>
-<div id="table-of-contents">
+<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
-<div id="text-table-of-contents">
-<ul>
-<li><a href="#org53aa659">1. General</a>
-<ul>
-<li><a href="#org0222a82">1.1. Source code</a></li>
-</ul>
-</li>
-<li><a href="#org1ba4dab">2. !Project deprecated!</a></li>
-<li><a href="#org27a9291">3. Introduction</a>
-<ul>
-<li><a href="#org7b05666">3.1. screenshots</a></li>
-</ul>
-</li>
-<li><a href="#org5c0e3c1">4. Installation</a></li>
-<li><a href="#org064502d">5. Fifth distribution directory tree description</a></li>
-<li><a href="#orge5e54fa">6. Requirements</a>
+<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#org6f95f4b">6.1. Software</a></li>
-<li><a href="#org51eb820">6.2. Hardware</a></li>
-<li><a href="#org5d390fa">6.3. Human</a></li>
-</ul>
-</li>
-<li><a href="#org05c7be5">7. Numbers representation within Fifth</a></li>
-<li><a href="#org06c8993">8. Disk file map, and it's data structures</a>
+<li><a href="#org48b7220">1. General</a>
<ul>
-<li><a href="#org84aa87e">8.1. Disk allocation</a></li>
-<li><a href="#org524c276">8.2. FAT entry format:</a></li>
-<li><a href="#org21c233b">8.3. File entry format</a></li>
+<li><a href="#org22b59dd">1.1. Source code</a></li>
</ul>
</li>
-<li><a href="#orga899cc5">9. Core architecture</a>
+<li><a href="#org20b6805">2. !Project deprecated!</a></li>
+<li><a href="#orgc67a478">3. Introduction</a>
<ul>
-<li><a href="#org4df227c">9.1. Dictionary entry format</a></li>
-<li><a href="#org3ba785a">9.2. Possible module types</a></li>
-<li><a href="#org787b6e1">9.3. Memory map</a></li>
+<li><a href="#org8504a11">3.1. screenshots</a></li>
</ul>
</li>
-<li><a href="#org3debeac">10. Virtual machine</a>
-<ul>
-<li><a href="#org85776a5">10.1. instruction set</a>
+<li><a href="#org0e56472">4. Installation</a></li>
+<li><a href="#orgf9fdcb5">5. Fifth distribution directory tree description</a></li>
+<li><a href="#org415759c">6. Requirements</a>
<ul>
-<li><a href="#org10947e1">10.1.1. overview table</a></li>
-<li><a href="#org42eed2a">10.1.2. kbd@ - read scancode of pressed or released key</a></li>
-<li><a href="#org3c170f3">10.1.3. vidput - put image1 into image2, at location x, y</a></li>
-<li><a href="#org4c1b71f">10.1.4. cmove - copy memory array</a></li>
-<li><a href="#org050fd93">10.1.5. tvidput - put image with transparency support</a></li>
-<li><a href="#orgfcf732b">10.1.6. charput - draw text character</a></li>
+<li><a href="#org44f8cdd">6.1. Software</a></li>
+<li><a href="#orgf4e46f6">6.2. Hardware</a></li>
+<li><a href="#org00ed0b8">6.3. Human</a></li>
</ul>
</li>
-</ul>
-</li>
-<li><a href="#org3b7244d">11. Fifth source format</a>
+<li><a href="#orgc60d938">7. Numbers representation within Fifth</a></li>
+<li><a href="#orgd7d6a8e">8. Disk file map, and it's data structures</a>
<ul>
-<li><a href="#org3078f68">11.1. FSCII</a></li>
+<li><a href="#org2db1035">8.1. Disk allocation</a></li>
+<li><a href="#org776d15e">8.2. FAT entry format:</a></li>
+<li><a href="#org03a8280">8.3. File entry format</a></li>
</ul>
</li>
-<li><a href="#org7ab9dd0">12. Fifth commands</a>
+<li><a href="#orgbfdae7b">9. Core architecture</a>
<ul>
-<li><a href="#orgc19ed00">12.1. Compilation & miscellaneous</a></li>
-<li><a href="#org52d6182">12.2. Conditionals & control flow</a></li>
-<li><a href="#org9a1c44e">12.3. Disk & file access</a></li>
-<li><a href="#orgb7a0ec7">12.4. Dynamic memory</a></li>
-<li><a href="#orgc2cfe7c">12.5. Graphics and text</a></li>
-<li><a href="#org0644b6a">12.6. Math, memory & stack manipulation</a></li>
-<li><a href="#org6965f88">12.7. Dynamic & static strings</a></li>
+<li><a href="#org77ca4ba">9.1. Dictionary entry format</a></li>
+<li><a href="#orga2a22a5">9.2. Possible module types</a></li>
+<li><a href="#org6b34748">9.3. Memory map</a></li>
</ul>
</li>
-<li><a href="#orge322491">13. Dynamically loadable modules</a>
+<li><a href="#org835c31e">10. Dynamically loadable modules</a>
<ul>
-<li><a href="#orgc575c29">13.1. Keyboard driver</a></li>
-<li><a href="#org7c5c975">13.2. Mouse driver</a></li>
-<li><a href="#org7e9e6e4">13.3. 2D graphic library</a></li>
-<li><a href="#org53b108e">13.4. Trigonometry functions</a>
+<li><a href="#orgd31a968">10.1. Keyboard driver</a></li>
+<li><a href="#orgc5f8a76">10.2. Mouse driver</a></li>
+<li><a href="#org64da03a">10.3. 2D graphic library</a></li>
+<li><a href="#org203890d">10.4. Trigonometry functions</a>
<ul>
-<li><a href="#orga868964">13.4.1. sin ( a – result )</a></li>
-<li><a href="#org7e217b7">13.4.2. cos ( a – result )</a></li>
+<li><a href="#org618a2c2">10.4.1. sin ( a – result )</a></li>
+<li><a href="#org0f995cf">10.4.2. cos ( a – result )</a></li>
</ul>
</li>
</ul>
</div>
</div>
-<div id="outline-container-org53aa659" class="outline-2">
-<h2 id="org53aa659"><span class="section-number-2">1</span> General</h2>
+<div id="outline-container-org48b7220" class="outline-2">
+<h2 id="org48b7220"><span class="section-number-2">1.</span> General</h2>
<div class="outline-text-2" id="text-1">
<ul class="org-ul">
<li>This program is free software: released under Creative Commons Zero
<li><a href="https://www.svjatoslav.eu/projects/">Other software projects hosted at svjatoslav.eu</a></li>
</ul>
</div>
-<div id="outline-container-org0222a82" class="outline-3">
-<h3 id="org0222a82"><span class="section-number-3">1.1</span> Source code</h3>
+
+<div id="outline-container-org22b59dd" class="outline-3">
+<h3 id="org22b59dd"><span class="section-number-3">1.1.</span> Source code</h3>
<div class="outline-text-3" id="text-1-1">
<ul class="org-ul">
<li><a href="https://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=snapshot;h=HEAD;sf=tgz">Download latest snapshot in TAR GZ format</a></li>
</div>
</div>
-<div id="outline-container-org1ba4dab" class="outline-2">
-<h2 id="org1ba4dab"><span class="section-number-2">2</span> !Project deprecated!</h2>
+<div id="outline-container-org20b6805" class="outline-2">
+<h2 id="org20b6805"><span class="section-number-2">2.</span> !Project deprecated!</h2>
<div class="outline-text-2" id="text-2">
<p>
Current implementation does not support object oriented
</p>
</div>
</div>
-<div id="outline-container-org27a9291" class="outline-2">
-<h2 id="org27a9291"><span class="section-number-2">3</span> Introduction</h2>
+<div id="outline-container-orgc67a478" class="outline-2">
+<h2 id="orgc67a478"><span class="section-number-2">3.</span> Introduction</h2>
<div class="outline-text-2" id="text-3">
<p>
-Fifth is programming lanquage & operating system, running on <a href="#org3debeac">virtual
-machine</a>, with custom instruction set. It is much like Charles Chunk
-Moore's Forth, it also uses stack architecture, and many commands are
-similar. Basically I got familiar with concepts of Forth, and being
-inspired created my own system.
+Fifth is a combination of:
</p>
-
<ul class="org-ul">
+<li><a href="language.html#ID-da7fff9b-0b67-4843-828a-52a404d7f401">Programming language</a> (inspired by Forth).</li>
+<li>Operating system.</li>
+<li><a href="virtual machine.html#ID-9b251eb9-aff6-4025-94bf-25e89e26d54a">Virtual machine</a> with custom instruction set.</li>
<li><a href="5TH_ET.txt">Example Fifth source file - text editor</a></li>
</ul>
</div>
-<div id="outline-container-org7b05666" class="outline-3">
-<h3 id="org7b05666"><span class="section-number-3">3.1</span> screenshots</h3>
+<div id="outline-container-org8504a11" class="outline-3">
+<h3 id="org8504a11"><span class="section-number-3">3.1.</span> screenshots</h3>
<div class="outline-text-3" id="text-3-1">
-<div class="figure">
+<div id="org9178e56" class="figure">
<p><img src="screenshots/start.png" alt="start.png" />
</p>
</div>
</p>
-<div class="figure">
+<div id="orgf022552" class="figure">
<p><img src="screenshots/dictionary.png" alt="dictionary.png" />
</p>
</div>
-<div class="figure">
+<div id="org415fab1" class="figure">
<p><img src="screenshots/text editor.png" alt="text editor.png" />
</p>
</div>
</div>
</div>
-<div id="outline-container-org5c0e3c1" class="outline-2">
-<h2 id="org5c0e3c1"><span class="section-number-2">4</span> Installation</h2>
+<div id="outline-container-org0e56472" class="outline-2">
+<h2 id="org0e56472"><span class="section-number-2">4.</span> Installation</h2>
<div class="outline-text-2" id="text-4">
<p>
Just unpack all files, witout altering original directory structure,
</p>
<p>
-Read more about <a href="#org064502d">Fifth distribution directory tree description</a>.
+Read more about <a href="#orgf9fdcb5">Fifth distribution directory tree description</a>.
</p>
</div>
</div>
-<div id="outline-container-org064502d" class="outline-2">
-<h2 id="org064502d"><span class="section-number-2">5</span> Fifth distribution directory tree description</h2>
+<div id="outline-container-orgf9fdcb5" class="outline-2">
+<h2 id="orgf9fdcb5"><span class="section-number-2">5.</span> Fifth distribution directory tree description</h2>
<div class="outline-text-2" id="text-5">
<p>
After downloading and unpacking the ZIP file you shoud get directory
</div>
</div>
-<div id="outline-container-orge5e54fa" class="outline-2">
-<h2 id="orge5e54fa"><span class="section-number-2">6</span> Requirements</h2>
+<div id="outline-container-org415759c" class="outline-2">
+<h2 id="org415759c"><span class="section-number-2">6.</span> Requirements</h2>
<div class="outline-text-2" id="text-6">
</div>
-<div id="outline-container-org6f95f4b" class="outline-3">
-<h3 id="org6f95f4b"><span class="section-number-3">6.1</span> Software</h3>
+<div id="outline-container-org44f8cdd" class="outline-3">
+<h3 id="org44f8cdd"><span class="section-number-3">6.1.</span> Software</h3>
<div class="outline-text-3" id="text-6-1">
<ul class="org-ul">
<li>MS-DOS 6.22, with HIMEM.SYS loaded.</li>
</ul>
</div>
</div>
-<div id="outline-container-org51eb820" class="outline-3">
-<h3 id="org51eb820"><span class="section-number-3">6.2</span> Hardware</h3>
+<div id="outline-container-orgf4e46f6" class="outline-3">
+<h3 id="orgf4e46f6"><span class="section-number-3">6.2.</span> Hardware</h3>
<div class="outline-text-3" id="text-6-2">
<ul class="org-ul">
<li>Minimum CPU 386.</li>
</ul>
</div>
</div>
-<div id="outline-container-org5d390fa" class="outline-3">
-<h3 id="org5d390fa"><span class="section-number-3">6.3</span> Human</h3>
+<div id="outline-container-org00ed0b8" class="outline-3">
+<h3 id="org00ed0b8"><span class="section-number-3">6.3.</span> Human</h3>
<div class="outline-text-3" id="text-6-3">
<ul class="org-ul">
<li>Beginner level Forth knowledge is recommended.</li>
</div>
</div>
</div>
-<div id="outline-container-org05c7be5" class="outline-2">
-<h2 id="org05c7be5"><span class="section-number-2">7</span> Numbers representation within Fifth</h2>
+<div id="outline-container-orgc60d938" class="outline-2">
+<h2 id="orgc60d938"><span class="section-number-2">7.</span> Numbers representation within Fifth</h2>
<div class="outline-text-2" id="text-7">
<p>
Because we are in full experimentation mode here (no regard for
</p>
-<div class="figure">
+<div id="org806c6d6" class="figure">
<p><a href="numbers.png"><img src="numbers.png" alt="numbers.png" /></a>
</p>
</div>
</div>
</div>
-<div id="outline-container-org06c8993" class="outline-2">
-<h2 id="org06c8993"><span class="section-number-2">8</span> Disk file map, and it's data structures</h2>
+<div id="outline-container-orgd7d6a8e" class="outline-2">
+<h2 id="orgd7d6a8e"><span class="section-number-2">8.</span> Disk file map, and it's data structures</h2>
<div class="outline-text-2" id="text-8">
<p>
Core and high-level boot code is stored outside of the filesystem to
yet initialized.
</p>
</div>
-<div id="outline-container-org84aa87e" class="outline-3">
-<h3 id="org84aa87e"><span class="section-number-3">8.1</span> Disk allocation</h3>
+<div id="outline-container-org2db1035" class="outline-3">
+<h3 id="org2db1035"><span class="section-number-3">8.1.</span> Disk allocation</h3>
<div class="outline-text-3" id="text-8-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</table>
</div>
</div>
-<div id="outline-container-org524c276" class="outline-3">
-<h3 id="org524c276"><span class="section-number-3">8.2</span> FAT entry format:</h3>
+<div id="outline-container-org776d15e" class="outline-3">
+<h3 id="org776d15e"><span class="section-number-3">8.2.</span> FAT entry format:</h3>
<div class="outline-text-3" id="text-8-2">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</table>
</div>
</div>
-<div id="outline-container-org21c233b" class="outline-3">
-<h3 id="org21c233b"><span class="section-number-3">8.3</span> File entry format</h3>
+<div id="outline-container-org03a8280" class="outline-3">
+<h3 id="org03a8280"><span class="section-number-3">8.3.</span> File entry format</h3>
<div class="outline-text-3" id="text-8-3">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</div>
</div>
</div>
-<div id="outline-container-orga899cc5" class="outline-2">
-<h2 id="orga899cc5"><span class="section-number-2">9</span> Core architecture</h2>
+<div id="outline-container-orgbfdae7b" class="outline-2">
+<h2 id="orgbfdae7b"><span class="section-number-2">9.</span> Core architecture</h2>
<div class="outline-text-2" id="text-9">
<p>
Fifth core is simply some amount of already compiled into machine code
any time. Currently dictionary can contain at most 1000 entries.
</p>
</div>
-<div id="outline-container-org4df227c" class="outline-3">
-<h3 id="org4df227c"><span class="section-number-3">9.1</span> Dictionary entry format</h3>
+<div id="outline-container-org77ca4ba" class="outline-3">
+<h3 id="org77ca4ba"><span class="section-number-3">9.1.</span> Dictionary entry format</h3>
<div class="outline-text-3" id="text-9-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</p>
</div>
</div>
-<div id="outline-container-org3ba785a" class="outline-3">
-<h3 id="org3ba785a"><span class="section-number-3">9.2</span> Possible module types</h3>
+<div id="outline-container-orga2a22a5" class="outline-3">
+<h3 id="orga2a22a5"><span class="section-number-3">9.2.</span> Possible module types</h3>
<div class="outline-text-3" id="text-9-2">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</table>
</div>
</div>
-<div id="outline-container-org787b6e1" class="outline-3">
-<h3 id="org787b6e1"><span class="section-number-3">9.3</span> Memory map</h3>
+<div id="outline-container-org6b34748" class="outline-3">
+<h3 id="org6b34748"><span class="section-number-3">9.3.</span> Memory map</h3>
<div class="outline-text-3" id="text-9-3">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</div>
</div>
</div>
-<div id="outline-container-org3debeac" class="outline-2">
-<h2 id="org3debeac"><span class="section-number-2">10</span> Virtual machine</h2>
+<div id="outline-container-org835c31e" class="outline-2">
+<h2 id="org835c31e"><span class="section-number-2">10.</span> Dynamically loadable modules</h2>
<div class="outline-text-2" id="text-10">
-<p>
-Using CPU emulator slows it down but I shouldn't now think too mutch
-about, and waste my time on batteling with problems whitch results on
-complex design of PC hardware. Also it allows me to use existing DOS
-and resident drivers services in real mode. So I don't need to deal
-with hardware too mutch. It also allows me to use all free XMS for
-flat code & data storage.
-</p>
-
-<p>
-Current emulator emulates 1 CPU. It has 2 stacks, ~50 instructions,
-and 4GB flat address space (theoretically). I'm not sure that DOS
-6.22 that I currently prefer can handle more than 64 MB of RAM. While
-I tried to keep instructionset simple, I was forced to put in lot of
-complex instructions to make it's performance acceptable on
-emulator. On actual silicon ~20 instructions is enaugh (I think).
-</p>
-
-<p>
-Maybe one day similar system will run directly on custom silicon chip :)
-</p>
-
-
-<p>
-CPU has following registers:
-</p>
-<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
-
-
-<colgroup>
-<col class="org-left" />
-
-<col class="org-left" />
-</colgroup>
-<tbody>
-<tr>
-<td class="org-left">IP</td>
-<td class="org-left">instruction pointer</td>
-</tr>
-
-<tr>
-<td class="org-left">DSP</td>
-<td class="org-left">data stack pointer</td>
-</tr>
-
-<tr>
-<td class="org-left">RSP</td>
-<td class="org-left">return stack pointer</td>
-</tr>
-</tbody>
-</table>
</div>
-<div id="outline-container-org85776a5" class="outline-3">
-<h3 id="org85776a5"><span class="section-number-3">10.1</span> instruction set</h3>
+<div id="outline-container-orgd31a968" class="outline-3">
+<h3 id="orgd31a968"><span class="section-number-3">10.1.</span> Keyboard driver</h3>
<div class="outline-text-3" id="text-10-1">
-</div>
-<div id="outline-container-org10947e1" class="outline-4">
-<h4 id="org10947e1"><span class="section-number-4">10.1.1</span> overview table</h4>
-<div class="outline-text-4" id="text-10-1-1">
-<p>
-Virtual CPU, commands (most of them are avaiable as ordinary commands
-in programming language):
-</p>
-
-
-<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
-
-
-<colgroup>
-<col class="org-right" />
-
-<col class="org-left" />
-
-<col class="org-left" />
-
-<col class="org-left" />
-</colgroup>
-<thead>
-<tr>
-<th scope="col" class="org-right">#</th>
-<th scope="col" class="org-left">name</th>
-<th scope="col" class="org-left">stack footprint</th>
-<th scope="col" class="org-left">description</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td class="org-right">0</td>
-<td class="org-left">nop</td>
-<td class="org-left">--</td>
-<td class="org-left">does nothing</td>
-</tr>
-
-<tr>
-<td class="org-right">1</td>
-<td class="org-left">halt</td>
-<td class="org-left">--</td>
-<td class="org-left">halt CPU ( return to DOS on emulator )</td>
-</tr>
-
-<tr>
-<td class="org-right">2</td>
-<td class="org-left"><a href="#org42eed2a">kbd@</a></td>
-<td class="org-left">– c</td>
-<td class="org-left">read scancode of pressed or released key</td>
-</tr>
-
-<tr>
-<td class="org-right">3</td>
-<td class="org-left">num <dword></td>
-<td class="org-left">– n</td>
-<td class="org-left">put immidiate number into datastack</td>
-</tr>
-
-<tr>
-<td class="org-right">4</td>
-<td class="org-left">jmp <dword></td>
-<td class="org-left">--</td>
-<td class="org-left">jump to specified code</td>
-</tr>
-
-<tr>
-<td class="org-right">5</td>
-<td class="org-left">call <dword></td>
-<td class="org-left"> </td>
-<td class="org-left">jump to specified code, save return address to return stack</td>
-</tr>
-
-<tr>
-<td class="org-right">6</td>
-<td class="org-left">1+</td>
-<td class="org-left">n – n+1</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">7</td>
-<td class="org-left">1-</td>
-<td class="org-left">n – n-1</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">8</td>
-<td class="org-left">dup</td>
-<td class="org-left">n – n n</td>
-<td class="org-left">duplicate top of data stack</td>
-</tr>
-
-<tr>
-<td class="org-right">9</td>
-<td class="org-left">drop</td>
-<td class="org-left">n --</td>
-<td class="org-left">drop last element in data stack</td>
-</tr>
-
-<tr>
-<td class="org-right">10</td>
-<td class="org-left">if <dword></td>
-<td class="org-left">n --</td>
-<td class="org-left">jump to addr if top element was 0</td>
-</tr>
-
-<tr>
-<td class="org-right">11</td>
-<td class="org-left">ret</td>
-<td class="org-left"> </td>
-<td class="org-left">jump to code, specified in return stack.</td>
-</tr>
-
-<tr>
-<td class="org-right">12</td>
-<td class="org-left">c@</td>
-<td class="org-left">addr – n</td>
-<td class="org-left">read byte from memory at specified address</td>
-</tr>
-
-<tr>
-<td class="org-right">13</td>
-<td class="org-left">c!</td>
-<td class="org-left">n addr --</td>
-<td class="org-left">store byte to specified memory</td>
-</tr>
-
-<tr>
-<td class="org-right">14</td>
-<td class="org-left">push</td>
-<td class="org-left">DSTK -> RSTK</td>
-<td class="org-left">move top of datastack to returnstack</td>
-</tr>
-
-<tr>
-<td class="org-right">15</td>
-<td class="org-left">pop</td>
-<td class="org-left">RSTK -> DSTK</td>
-<td class="org-left">move top of returnstack to datastack</td>
-</tr>
-
-<tr>
-<td class="org-right">16</td>
-<td class="org-left"><unused></td>
-<td class="org-left"> </td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">17</td>
-<td class="org-left">rot</td>
-<td class="org-left">n1 n2 n3 – n2 n3 n1</td>
-<td class="org-left">rotate stack elements</td>
-</tr>
-
-<tr>
-<td class="org-right">18</td>
-<td class="org-left">disk@</td>
-<td class="org-left">FromDiskSect ToMem --</td>
-<td class="org-left">read 1KB from disk into RAM</td>
-</tr>
-
-<tr>
-<td class="org-right">19</td>
-<td class="org-left">disk!</td>
-<td class="org-left">FromMem ToDiskSect --</td>
-<td class="org-left">write 1KB to disk</td>
-</tr>
-
-<tr>
-<td class="org-right">20</td>
-<td class="org-left">@</td>
-<td class="org-left">addr – n</td>
-<td class="org-left">read 32 bit number from memory</td>
-</tr>
-
-<tr>
-<td class="org-right">21</td>
-<td class="org-left">!</td>
-<td class="org-left">n addr --</td>
-<td class="org-left">store 32 bit number to memory</td>
-</tr>
-
-<tr>
-<td class="org-right">22</td>
-<td class="org-left">over</td>
-<td class="org-left">n1 n2 – n1 n2 n1</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">23</td>
-<td class="org-left">swap</td>
-<td class="org-left">n1 n2 – n2 n1</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">24</td>
-<td class="org-left">+</td>
-<td class="org-left">n1 n2 – n1+n2</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">25</td>
-<td class="org-left">-</td>
-<td class="org-left">n1 n2 – n1-n2</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">26</td>
-<td class="org-left">*</td>
-<td class="org-left">n1 n2 – n1*n2</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">27</td>
-<td class="org-left">/</td>
-<td class="org-left">n1 n2 – n1/n2</td>
-<td class="org-left"> </td>
-</tr>
-
-<tr>
-<td class="org-right">28</td>
-<td class="org-left">></td>
-<td class="org-left">n1 n2 – result</td>
-<td class="org-left">is true when n1 > n2</td>
-</tr>
-
-<tr>
-<td class="org-right">29</td>
-<td class="org-left"><</td>
-<td class="org-left">n1 n2 – result</td>
-<td class="org-left">is true when n1 < n2</td>
-</tr>
-
-<tr>
-<td class="org-right">30</td>
-<td class="org-left">not</td>
-<td class="org-left">n1 – not_n1</td>
-<td class="org-left">logical not</td>
-</tr>
-
-<tr>
-<td class="org-right">31</td>
-<td class="org-left">i</td>
-<td class="org-left">– n</td>
-<td class="org-left">copies top of return stack into datastack</td>
-</tr>
-
-<tr>
-<td class="org-right">32</td>
-<td class="org-left">cprt@</td>
-<td class="org-left">addr – n</td>
-<td class="org-left">read one byte from hardware port</td>
-</tr>
-
-<tr>
-<td class="org-right">33</td>
-<td class="org-left">cprt!</td>
-<td class="org-left">n addr --</td>
-<td class="org-left">store one byte to hardware port</td>
-</tr>
-
-<tr>
-<td class="org-right">34</td>
-<td class="org-left">i2</td>
-<td class="org-left">– n</td>
-<td class="org-left">like "i" but takes second top stack element</td>
-</tr>
-
-<tr>
-<td class="org-right">35</td>
-<td class="org-left">i3</td>
-<td class="org-left">– n</td>
-<td class="org-left">like "i" but takes third top stack element.</td>
-</tr>
-
-<tr>
-<td class="org-right">36</td>
-<td class="org-left">shl</td>
-<td class="org-left">n amount – n</td>
-<td class="org-left">left bit shift</td>
-</tr>
-
-<tr>
-<td class="org-right">37</td>
-<td class="org-left">shr</td>
-<td class="org-left">n amount – n</td>
-<td class="org-left">right bit shift</td>
-</tr>
-
-<tr>
-<td class="org-right">38</td>
-<td class="org-left">or</td>
-<td class="org-left">n1 n2 – n</td>
-<td class="org-left">logical or</td>
-</tr>
-
-<tr>
-<td class="org-right">39</td>
-<td class="org-left">xor</td>
-<td class="org-left">n1 n2 – n</td>
-<td class="org-left">exclusive logical or</td>
-</tr>
-
-<tr>
-<td class="org-right">40</td>
-<td class="org-left">vidmap</td>
-<td class="org-left">addr --</td>
-<td class="org-left">copy memory from "addr" to video memory.</td>
-</tr>
-
-<tr>
-<td class="org-right">41</td>
-<td class="org-left">mouse@</td>
-<td class="org-left">– x y button</td>
-<td class="org-left">read mouse coordinates & buttons</td>
-</tr>
-
-<tr>
-<td class="org-right">42</td>
-<td class="org-left"><a href="#org3c170f3">vidput</a></td>
-<td class="org-left">addr1 addr2 x y --</td>
-<td class="org-left">put image1 into image2, at location x, y</td>
-</tr>
-
-<tr>
-<td class="org-right">43</td>
-<td class="org-left"><a href="#org4c1b71f">cmove</a></td>
-<td class="org-left">addr1 addr2 amount</td>
-<td class="org-left">move memory from addr1 to addr2</td>
-</tr>
-
-<tr>
-<td class="org-right">44</td>
-<td class="org-left">cfill</td>
-<td class="org-left">c addr amount --</td>
-<td class="org-left">fill memory starting at "addr" with "c" bytes.</td>
-</tr>
-
-<tr>
-<td class="org-right">45</td>
-<td class="org-left"><a href="#org050fd93">tvidput</a></td>
-<td class="org-left">addr1 addr2 x y --</td>
-<td class="org-left">put image with transparency support</td>
-</tr>
-
-<tr>
-<td class="org-right">46</td>
-<td class="org-left">depth</td>
-<td class="org-left">– depth</td>
-<td class="org-left">returns current depth of data stack.</td>
-</tr>
-
-<tr>
-<td class="org-right">47</td>
-<td class="org-left"><a href="#orgfcf732b">charput</a></td>
-<td class="org-left">colorfg colorbg addrsrc addrdest x y</td>
-<td class="org-left">draw text character</td>
-</tr>
-</tbody>
-</table>
-</div>
-</div>
-
-<div id="outline-container-org42eed2a" class="outline-4">
-<h4 id="org42eed2a"><span class="section-number-4">10.1.2</span> kbd@ - read scancode of pressed or released key</h4>
-<div class="outline-text-4" id="text-10-1-2">
-<p>
-Returns 0 if no data available.
-</p>
-</div>
-</div>
-<div id="outline-container-org3c170f3" class="outline-4">
-<h4 id="org3c170f3"><span class="section-number-4">10.1.3</span> vidput - put image1 into image2, at location x, y</h4>
-<div class="outline-text-4" id="text-10-1-3">
-<p>
-Does clipping, so part of a big image can be mapped into smaller one.
-</p>
-</div>
-</div>
-<div id="outline-container-org4c1b71f" class="outline-4">
-<h4 id="org4c1b71f"><span class="section-number-4">10.1.4</span> cmove - copy memory array</h4>
-<div class="outline-text-4" id="text-10-1-4">
-<p>
-Move memory from addr1 to addr2. If addr1 is greater than addr2 then
-count address foward while moving, elseway starts from end and counts
-backwards, so no data loss occurs when memory regions partially
-overlap.
-</p>
-</div>
-</div>
-<div id="outline-container-org050fd93" class="outline-4">
-<h4 id="org050fd93"><span class="section-number-4">10.1.5</span> tvidput - put image with transparency support</h4>
-<div class="outline-text-4" id="text-10-1-5">
-<p>
-Stack footprint
-</p>
-<pre class="example">
-addr1 addr2 x y --
-</pre>
-
-
-<p>
-Put image1 into image2, at location x, y with transparency support
-</p>
-
-<p>
-Color 255 in source image is treated as transparent.
-</p>
-</div>
-</div>
-<div id="outline-container-orgfcf732b" class="outline-4">
-<h4 id="orgfcf732b"><span class="section-number-4">10.1.6</span> charput - draw text character</h4>
-<div class="outline-text-4" id="text-10-1-6">
-<p>
-Draw character to image buffer located at "addrdest" to specified x &
-y location. Decodes 8 bytes from source to bits, used to draw
-character.
-</p>
-</div>
-</div>
-</div>
-</div>
-
-<div id="outline-container-org3b7244d" class="outline-2">
-<h2 id="org3b7244d"><span class="section-number-2">11</span> Fifth source format</h2>
-<div class="outline-text-2" id="text-11">
-<p>
-Fifth uses a different character table and codes than ASCII (still
-almost similar). I call it FSCII (Fifth Standard Code for Information
-Interchange) for example space character is not 32 but 255 instead. I
-plan to use mainly HEX numbers, and create new characters to represent
-numeric values. So typical nemric characters "0123…" is treated
-like ordinary letters.
-</p>
-</div>
-<div id="outline-container-org3078f68" class="outline-3">
-<h3 id="org3078f68"><span class="section-number-3">11.1</span> FSCII</h3>
-<div class="outline-text-3" id="text-11-1">
-<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
-
-
-<colgroup>
-<col class="org-right" />
-
-<col class="org-left" />
-
-<col class="org-left" />
-</colgroup>
-<thead>
-<tr>
-<th scope="col" class="org-right">DEC</th>
-<th scope="col" class="org-left">HEX</th>
-<th scope="col" class="org-left">function</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td class="org-right">0 - 15</td>
-<td class="org-left">0 - F</td>
-<td class="org-left">HEX numbers</td>
-</tr>
-
-<tr>
-<td class="org-right">252</td>
-<td class="org-left">FC</td>
-<td class="org-left">backspace</td>
-</tr>
-
-<tr>
-<td class="org-right">253</td>
-<td class="org-left">FD</td>
-<td class="org-left">tabulator (TAB)</td>
-</tr>
-
-<tr>
-<td class="org-right">254</td>
-<td class="org-left">FE</td>
-<td class="org-left">carriage return (CR)</td>
-</tr>
-
-<tr>
-<td class="org-right">255</td>
-<td class="org-left">FF</td>
-<td class="org-left">space</td>
-</tr>
-
-<tr>
-<td class="org-right">else</td>
-<td class="org-left"> </td>
-<td class="org-left">ordinary characters, same as in ASCII.</td>
-</tr>
-</tbody>
-</table>
-</div>
-</div>
-</div>
-<div id="outline-container-org7ab9dd0" class="outline-2">
-<h2 id="org7ab9dd0"><span class="section-number-2">12</span> Fifth commands</h2>
-<div class="outline-text-2" id="text-12">
-</div>
-<div id="outline-container-orgc19ed00" class="outline-3">
-<h3 id="orgc19ed00"><span class="section-number-3">12.1</span> Compilation & miscellaneous</h3>
-<div class="outline-text-3" id="text-12-1">
-<p class="verse">
-init module ( – )<br />
-                First module, control is passed to on startup. Contains<br />
-                initialization routines. Also it is the last core module.<br />
-                All new modules on top of it comes as result of executing<br />
-                external source files.<br />
-<br />
-head <name> ( – ) compiles new dictionary entry without specifying<br />
-                new module type.<br />
-                ex: head myentry<br />
-<br />
-: <name> ( – ) creates new code module<br />
-; ( – ) ends module (immideate)<br />
-                ex: : hello ." hi there" ;<br />
-<br />
-const <name> ( n – ) defines new constant.<br />
-                ex: 2147483647 const max<br />
-<br />
-:i <name> ( – ) same as ":" but this module will be executed<br />
-                immideately even in compile mode.<br />
-                ex: :i ( 41 scan ;<br />
-<br />
-create <name> ( – ) same as "head" , but specify module type as data.<br />
-                ex: create LotoResults 5 , 13 , 52 , 12 , 11 , 3 ,<br />
-<br />
-allot ( n – ) allocate n bytes in dictionary.<br />
-                ex: create MyArray 100 allot<br />
-<br />
-" <string>" ( – ) compile string and its size into core.<br />
-                ex: create Mystring " This is it's contects"<br />
-<br />
-str <name> <string>" ( – ) just shorter way for defining strings.<br />
-                ex: str Mystring This is it's contenc"<br />
-<br />
-var <name> ( – ) define new 32 bit variable.<br />
-                ex: var result<br />
-<br />
-' <module> ( – n ) return memory address of given entry.<br />
-                ex: ' init<br />
-<br />
-forget <name> ( – ) erases from RAM given entry and all entries what was<br />
-                defined after it.<br />
-                ex: forget myprog<br />
-<br />
-[ ( – ) set interpret mode (immideate)<br />
-] ( n – ) set compile mode and compile top stack element<br />
-                in as literal. Together [ …. ] cobination provides good<br />
-                way to compute some values only once, at compile time,<br />
-                rather than every time while program is running.<br />
-                ex: : calculate - [ 4 MyConst1 + MyConst2 * ] ;<br />
-<br />
-defer <name> ( – ) creates new module, with jump instruction.<br />
-                Later address where to jump can be modified by "is" command.<br />
-                This provides method of foward referencing. So you can use<br />
-                modules what not jet exist.<br />
-is ( address1 address2 – ) address1 - where to jump, address2 -<br />
-                address of module created by defer command.<br />
-                ex: defer dispver<br />
-                        : run dispver ." running …" ;<br />
-                               … whatever …<br />
-                        : (dispver ." Version 9.99 " ;<br />
-                        ' (dispver ' dispver is<br />
-<br />
-                Now if I type "run" on the screen appears:<br />
-                        Version 9.99 running …<br />
-<br />
-asc <char> ( – ) reads char ascii code and treats it as literal.<br />
-                (immideate)<br />
-                ex: : BreakLine 30 do asc - emit loop ;<br />
-                                 same as:<br />
-                    : BreakLine 30 do 45 emit loop ;<br />
-<br />
-dyninc ( handle – ) execute code in dynamic memory handle.<br />
-                automatically deallocates it when done.<br />
-<br />
-include ( filenumber – ) execute code in specified file.<br />
-<br />
-words ( – ) display existing blocks in core.<br />
-<br />
-bye ( – ) exit from Fifth<br />
-<br />
-fkey ( – c )<br />
-                Read one byte from input stream.<br />
-<br />
-sadd ( c addr – )<br />
-                Add one byte "c" to string located at "addr" and updates<br />
-                string length.<br />
-<br />
-scan ( c – )<br />
-                Read input stream and store it to pad until it finds c .<br />
-                It ignores all "c" bytes until it finds any non "c" byte.<br />
-                in other words:<br />
-                                c is: "<br />
-                         input stream: """"This is test !"aoeu idh<br />
-                               result: This is test !<br />
-<br />
-                Is useful for breaking text lines into words.<br />
-<br />
-skey ( – c )<br />
-                So called safe "fkey". Reads data from input stream<br />
-                but converts characters with ASCII codes: 9 13 10<br />
-                to spaces.<br />
-<br />
-str=str? ( adr1 adr2 – result )<br />
-                Compares string at "adr1" with string at "adr2", returns<br />
-                true flag if they are equal or false if they are not.<br />
-                true = -1<br />
-                false = 0<br />
-<br />
-find ( – addr )<br />
-                Searches whole dictionary for word in "pad". If found,<br />
-                returns it address, if not, returns 0.<br />
-<br />
-execute ( – )<br />
-                Execute word located in "pad". Depending on "mode".<br />
-<br />
-dta ( addr – DataAddr )<br />
-                Calculates address of dictionary entry data area, from<br />
-                entry point.<br />
-<br />
-2num ( – num result )<br />
-                Attempt to convert string located in "pad" into numeric<br />
-                value. If succeed returns number and true as result.<br />
-                If not, returns whatever and false as result.<br />
-<br />
-dadd ( addr length – )<br />
-                Add to dictionary data located at "addr", with specified<br />
-                length.<br />
-<br />
-lit ( n – )<br />
-                Act with number depending on "mode". When interpreting,<br />
-                leaves it in stack.<br />
-<br />
-<br />
-incmod ( addr – )<br />
-                Add to dictionary data located at "addr"+1 , length is taken<br />
-                from "addr".<br />
-<br />
-here ( – n )<br />
-                return "h" contents.<br />
-<br />
-mode var 8 bit<br />
-                Holds input stream parser operation mode.<br />
-                0 = interpreting<br />
-                1 = compiling<br />
-<br />
-pad var 128 bytes<br />
-                Holds temprorary strings.<br />
-<br />
-h var 32 bit<br />
-                Pointer to free byte in memory, always at the end of the<br />
-                dictionary. Each time when something is stored<br />
-                by "c," command, pointer is incareased.<br />
-<br />
-lp var 32 bit<br />
-                Pointer to last dictionary word. Each time when new word is<br />
-                compiled or erased by "forget", this pointer is updated.<br />
-<br />
-modulechk ( Dstr<filename> – ) check if module is loaded, if not<br />
-                immideately load it.<br />
-<br />
-ne ( entrydata entrytype – ) Compile new dictionary entry.<br />
-                It's name must be in "pad".<br />
-</p>
-</div>
-</div>
-<div id="outline-container-org52d6182" class="outline-3">
-<h3 id="org52d6182"><span class="section-number-3">12.2</span> Conditionals & control flow</h3>
-<div class="outline-text-3" id="text-12-2">
-<p class="verse">
-if ( flag – ) (immideate)<br />
-                "if 1.. else 2.. then" or<br />
-                "if 1.. then" construction. Conditional execution.<br />
-                Performs "1.." if "flag" was true,<br />
-                elseway performs "2.." if exist. Execution continues after<br />
-                word "then".<br />
-                ex: 1 if ." nonzero" else ." zero" then<br />
-<br />
->= ( n1 n2 – result ) true if (n1 = n2) or (n1 > n2)<br />
-                ex: 5 3 >= if ." first number is greater or equal" then<br />
-<br />
-<= ( n1 n2 – result ) true if (n1 = n2) or (n1 < n2)<br />
-= ( n1 n2 – result ) true if n1 = n2<br />
-<br />
-do ( count – ) (immideate)<br />
-                "do .. loop" construction. Performs ".." "count" times.<br />
-                In every step "count" is decareased until it is 0.<br />
-                ex: : test 5 do i .d loop ;<br />
-                result: 4 3 2 1 0<br />
-<br />
-doexit ( – ) exit from "do .. loop"<br />
-<br />
-for ( count top – ) (immideate)<br />
-                "for .. loop" construction. Performs ".." (top - count) times.<br />
-                In every step "count" is incareased until it reaches "top" .<br />
-                ex: : test 4 10 for i .d loop ;<br />
-                result: 4 5 6 7 8 9<br />
-<br />
-forexit ( – ) exit from "for .. loop"<br />
-<br />
-until ( – ) (immideate)<br />
-                "until .. loop" construction. Performs ".." until flag become<br />
-                true. False by default. Top of return stack holds flag.<br />
-<br />
-done ( – ) exit from "until .. loop"<br />
-<br />
-</p>
-</div>
-</div>
-<div id="outline-container-org9a1c44e" class="outline-3">
-<h3 id="org9a1c44e"><span class="section-number-3">12.3</span> Disk & file access</h3>
-<div class="outline-text-3" id="text-12-3">
-<p class="verse">
-diskload ( FromDisk ToMem amount – )<br />
-                Load specified abount of bytes from disk into memory.<br />
-<br />
-disksave ( FromMem ToDisk amount – )<br />
-                save specified abount of bytes from memory into disk.<br />
-<br />
-format ( – ) Erase all files.<br />
-<br />
-fsDfilesize@ ( handle – size )<br />
-                Return size of opened file.<br />
-<br />
-fsDcurloc@ ( handle – location )<br />
-                Return current location in file.<br />
-<br />
-fsDupdated@ ( handle – updated? )<br />
-                Return true if file was updated,<br />
-                ie. write operations occured.<br />
-<br />
-fssave ( FromMem DestFileHandle amount – )<br />
-                Save data to file.<br />
-<br />
-fsload ( SrcFileHandle ToMem amount – )<br />
-                Load data from file.<br />
-<br />
-fseof ( handle – bytesLeft )<br />
-                Return amount of bytes left till end of file.<br />
-                Useful before read operation.<br />
-<br />
-fsls ( – ) List all files and lists (directories,folders)<br />
-                in current path.<br />
-<br />
-fslsr ( – ) Same as "fsls" but recursively scans also sub lists.<br />
-<br />
-fscl ( DynStrHand – )<br />
-                Change list (path)<br />
-<br />
-fscreate ( DynStrHand – DescPnt )<br />
-                Create new file or list. Can create multiple lists at once.<br />
-                ex: when creating:<br />
-                    "\listGAMES\listSTRATEGY\listSIMWORLD\5th-runme"<br />
-                and only "\listGAMES\" already exist, then<br />
-                "listSTRATEGY" and "listSIMWORLD" lists will be created,<br />
-                and empty file "5th-runme" placed in there.<br />
-<br />
-fsDsave ( DynHand<data> DynStrHand<filename> – )<br />
-                Create new file and save all data from dynamic memory<br />
-                block to it.<br />
-<br />
-fsDload ( DynStr<SrcFileName> DynHand<DataDest> – )<br />
-                Load whole file into dynamic memory block.<br />
-<br />
-fsDloadnew ( DynStr<SrcFileName> – DynHand<DataDest> )<br />
-                Load whole file into new dynamic memory block.<br />
-</p>
-</div>
-</div>
-<div id="outline-container-orgb7a0ec7" class="outline-3">
-<h3 id="orgb7a0ec7"><span class="section-number-3">12.4</span> Dynamic memory</h3>
-<div class="outline-text-3" id="text-12-4">
-<p class="verse">
-dynal ( size – handle )<br />
-                Allocate dynamic memory block and return it's handle.<br />
-<br />
-dynde ( handle – )<br />
-                Deallocate dynamic memory block.<br />
-<br />
-dynp ( handle – addr )<br />
-                Returns pointer to memory where dynamic block<br />
-                data begins.<br />
-<br />
-dyns ( handle – size )<br />
-                Returns size of dynamic block.<br />
-<br />
-dynresize ( NewSize handle – )<br />
-                Nondestructively resize dynamic block.<br />
-<br />
-dync@ ( addr handle )<br />
-                Read one byte from dynamic block.<br />
-<br />
-dync! ( byte addr dynhandle )<br />
-                Write one byte to dynamic block.<br />
-<br />
-dyn@ ( addr handle )<br />
-                Read 32 bit number from dynamic block.<br />
-                Address will spacify, whitch number, not byte.<br />
-<br />
-dyn! ( 32BitNum addr dynhandle )<br />
-                Write 32 bit number to dynamic block.<br />
-                Address will spacify, whitch number, not byte.<br />
-<br />
-dyncon ( size "name" – )<br />
-                Allocate dynamic block with specified size, and<br />
-                create constant honding its handle.<br />
-                ex: 100 dyncon MyNewBlock<br />
-<br />
-dyn. ( handle – )<br />
-                Write contenc of dynamic memory block to screen.<br />
-</p>
-</div>
-</div>
-<div id="outline-container-orgc2cfe7c" class="outline-3">
-<h3 id="orgc2cfe7c"><span class="section-number-3">12.5</span> Graphics and text</h3>
-<div class="outline-text-3" id="text-12-5">
-<p class="verse">
-. ( n – ) print number on screen<br />
-<br />
-d. ( n – ) print number on screen in decimal<br />
-<br />
-? ( addr – ) print 32 bit value located at addr.<br />
-<br />
-." <string>" ( – ) print string into screen. Immideately<br />
-                compiles.<br />
-                ex: : greeting ." Hello, World" ;<br />
-<br />
-tab. ( – ) print tabulator<br />
-<br />
-calccol ( b g r – c ) calculate color what best matches given<br />
-                Blue Green & Red values. Values must be in range 0 - 255.<br />
-<br />
-imgalloc ( xsize ysize – imgbuf ) allocate image buffer for<br />
-                specified size.<br />
-<br />
-imgsize ( imgbuf – ) print on the screen X & Y size of image<br />
-                buffer.<br />
-<br />
-point ( x y imgbuf – addr ) returns memory address for specified<br />
-                pixel.<br />
-<br />
-pset ( color x y imgbuf – ) set graphic point<br />
-<br />
-boxf ( x1 x2 y1 y2 imgbuf color – ) draw filled box<br />
-<br />
-cls ( imgbuf – ) clear image buffer<br />
-<br />
-setpal ( b g r color – ) set palette value for specified color.<br />
-                values bust be in size 0 - 63.<br />
-<br />
-putchar ( char color x y imgbuf – ) put graphic character in<br />
-                imagebuffer to specified (x & y) location.<br />
-<br />
-scroll ( x y imgbuf – ) scroll in imgbuf.<br />
-<br />
-scrollf ( color x y screen – ) scroll and fill empty space with<br />
-                given color.<br />
-<br />
-at! ( x y – ) set cursor location<br />
-curc! ( color – ) set text color<br />
-curb! ( solor – ) set backround color<br />
-<br />
-colnorm ( – ) set text color to normal<br />
-colneg ( – ) set text color to negative (selected)<br />
-<br />
-dyntype ( dynhandle – ) display contenc of dynamic memory on screen<br />
-fsdisp ( file – ) clear screen, display file, and wait for key<br />
-<br />
-type ( addr length – )<br />
-                Types on the screen string, from memory at addr and<br />
-                specified length.<br />
-<br />
-write ( addr – )<br />
-                Types on the screen string, from memory at "addr"+1<br />
-                length is taken from "addr" .<br />
-<br />
-screen const 32 bit<br />
-                Holds handle of screen buffer.<br />
-<br />
-copyscreen ( SrcImgHandle DestImgHandle – ) copy contenc of source<br />
-                image to destination image. Source and destination images<br />
-                must have same size.<br />
-</p>
-</div>
-</div>
-<div id="outline-container-org0644b6a" class="outline-3">
-<h3 id="org0644b6a"><span class="section-number-3">12.6</span> Math, memory & stack manipulation</h3>
-<div class="outline-text-3" id="text-12-6">
-<p class="verse">
-off ( n – ) writes 0 to given address, good for zeroing variable.<br />
-                ex: MyVariable off<br />
-on ( n – ) writes -1 (true flag) to given address.<br />
-                ex: MyVariable on<br />
-<br />
-2dup ( n1 n2 – n1 n2 n1 n2 )<br />
-2drop ( n1 n2 – )<br />
-nip ( n1 n2 – n2 )<br />
-neg ( n1 – -n1 ) negotiate<br />
-bit@ ( n bit – result ) return specified bit from n.<br />
-                ex: 38 2 bit@ (result will be 1)<br />
-to32bit ( n1 n2 n3 n4 – n32 ) treat 4 last stack elements as bytes<br />
-                and unite them into 32 bit dword. Most significant byte<br />
-                on top.<br />
-                ex: 12 76 23 11 to32bit result: 186076172<br />
-<br />
-to8bit ( n32 – n1 n2 n3 n4 ) break 32 bit number into 4 bytes.<br />
-                Useful if you need to send 32 bit numbers thru 8 bit COM<br />
-                port.<br />
-                ex: 186076172 to8bit result: 12 76 23 11<br />
-<br />
-mod ( n1 n2 – reminder ) divide n1 by n2 and returns reminder.<br />
-                ex: 12 5 mod result: 2<br />
-<br />
-bound ( low n high – n ) check if n is in given bounds,<br />
-                if not then incarease/decarease it to match bounds.<br />
-                ex: 5 80 15 bound result: 15<br />
-                    5 10 15 bound result: 10<br />
-                    5 -10 15 bound result: 5<br />
-<br />
-bound? ( low n high – result ) returns true if n is in the<br />
-                given bounds.<br />
-<br />
-tab ( col – spaces) calculate amount of spaces to add<br />
-                ta reach next tabulation from given column.<br />
-<br />
-count ( addr – addr+1 n )<br />
-                Useful for returning bytes from constantly incareasing<br />
-                address. Module "type" is nice example.<br />
-<br />
-c, ( n – )<br />
-                store one byte at memory specified by "h". And incarease<br />
-                "h" by 1.<br />
-<br />
-, ( n – )<br />
-                store 32 bit number at memory specified by "h". And<br />
-                incarease "h" by 4.<br />
-<br />
-cmove ( addr1 addr2 n – )<br />
-                copy "n" amount of bytes from memory at "addr1" to memory<br />
-                at "addr2".<br />
-<br />
-rnd ( limit – result )<br />
-                generates random number in range 0 to "limit"-1.<br />
-<br />
-abs ( n – |n| )<br />
-                returns absolute value of "n"<br />
-</p>
-</div>
-</div>
-<div id="outline-container-org6965f88" class="outline-3">
-<h3 id="org6965f88"><span class="section-number-3">12.7</span> Dynamic & static strings</h3>
-<div class="outline-text-3" id="text-12-7">
-<p>
-Fifth supports both static and dynamic strings. Static strings must
-have predefined space reserved, and string mustn't exceed this
-length. They manipulation is faster. But they use more memory. Static
-string memory address is used to refer to the string.
-</p>
-
-<p>
-Dynamic strings can have at any time length form 0 to 0FFh, They take
-up only memory they currently need. They are held in dynamic memory
-blocks, so dynamic block handle is used to refer to this string.
-</p>
-
-<p>
-Both types of strings are stored in the way, where first (0th) byte
-holds current string length, following bytes are string itself.
-</p>
-
-
-<p class="verse">
-Dynamic:<br />
-<br />
-Dstral ( – handle )<br />
-                Allocate new string.<br />
-<br />
-Dstrlen ( handle – length )<br />
-                Return string length.<br />
-<br />
-c+Dstr ( chr handle – )<br />
-                Add one byte to end of the string.<br />
-<br />
-c+lDstr ( chr handle – )<br />
-                Add one byte to left side (beginning) of the string.<br />
-<br />
-Dstr. ( handle – )<br />
-                Write contec of string into screen.<br />
-<br />
-Dstrsure ( size Dstr – )<br />
-                Makes sure that at least rquested<br />
-                "size" (amount of characters) is allocated for given<br />
-                dynamic string.<br />
-<br />
-Dstr2str ( handle address – )<br />
-                Copy dyamic string into static memory space.<br />
-<br />
-str2Dstr ( address handle – )<br />
-                Copy static string into dyamic string.<br />
-<br />
-Dstr+str ( Dstr addr – )<br />
-                Add contenc of dynamic string to static string.<br />
-<br />
-D" any string" ( – Dstr )<br />
-                Moves specified string into dynamic string called "defDstr".<br />
-<br />
-D> any_string ( – Dstr )<br />
-                Moves specified string into dynamic string called "defDstr".<br />
-                Space marks end of string!<br />
-<br />
-D>2 any_string ( – Dstr )<br />
-                Moves specified string into dynamic string called "defDstr2".<br />
-                Space marks end of string!<br />
-<br />
-Dstr+Dstr ( Dstr1 Dstr2 – )<br />
-                Adds "Dstr1" to "Dstr2" and places result into "Dstr2".<br />
-<br />
-Dstrclear ( Dstr – )<br />
-                Clears contenc of dynamic string.<br />
-<br />
-Dstr2Dstr ( Dstr1 Dstr2 – )<br />
-                Moves "Dstr1" to "Dstr2".<br />
-Dstr ( data" name – )<br />
-                Creates new dynamic string and moves specified data into it.<br />
-                Then creates new constant with given "name" holding created<br />
-                dynamic string handle.<br />
-<br />
-                ex: Dstr Hello, my name is Sven!" message \ creates it<br />
-                    message Dstr. \ tests it<br />
-<br />
-Dstrlscan ( char Dstr – loc )<br />
-                Searches dynamic string for "char", from left to right,<br />
-                returns first found "char" location in string, or 0,<br />
-                if not found.<br />
-<br />
-Dstrrscan ( char Dstr – loc )<br />
-                Searches dynamic string for "char", from right to left,<br />
-                returns first found "char" location in string, or 0,<br />
-                if not found.<br />
-<br />
-Dstrlscane ( char Dstr – loc )<br />
-                Same as "Dstrlscan" buf returns string length+1 as location.<br />
-ÿ<br />
-Dstrleft ( amo Dstr – )<br />
-                Only specified amount of characters from left remains<br />
-                in dynamic string. ie. cut right part out.<br />
-<br />
-Dstrright ( amo Dstr – )<br />
-                Only specified amount of characters from right remains<br />
-                in dynamic string. ie. cut left part out.<br />
-<br />
-Dstrcutl ( amo Dstr – )<br />
-                Cut specified amount of characters from left of dynamic<br />
-                string out.<br />
-<br />
-Dstrsp ( char Dstr1 Dstr2 – )<br />
-                Separate dynamic string in Dstr1 into two parts,<br />
-                using "char" as separator. First part will be stored in<br />
-                "Dstr2", second part in "Dstr1".<br />
-                ex: asc \ \ ..separator<br />
-                    D> listF\listLIB\5TH_DRVMOUSE \ ..separate from<br />
-                    defDstr2 \ ..place result in<br />
-                    Dstrsp \ separation command<br />
-                    defDstr Dstr. \ will be: listLIB\5TH_DRVMOUSE<br />
-                    defDstr2 Dstr. \ will be: listF<br />
-<br />
-Dv ( addr – )<br />
-                Allocates empty dynamic string, and places it's handle<br />
-                into given address.<br />
-<br />
-Df ( addr – )<br />
-                Reads dynamic string handle from given address and<br />
-                deallocates (frees) it.<br />
-<br />
-ex: var mystring1<br />
-        : testmodule<br />
-        mystring1 Dv \ allocates string<br />
-<br />
-                <whatever><br />
-<br />
-        mystring1 Df ; \ deallocates it again when no longer needed.<br />
-</p>
-</div>
-</div>
-</div>
-<div id="outline-container-orge322491" class="outline-2">
-<h2 id="orge322491"><span class="section-number-2">13</span> Dynamically loadable modules</h2>
-<div class="outline-text-2" id="text-13">
-</div>
-<div id="outline-container-orgc575c29" class="outline-3">
-<h3 id="orgc575c29"><span class="section-number-3">13.1</span> Keyboard driver</h3>
-<div class="outline-text-3" id="text-13-1">
<p class="verse">
<br />
KBD_@ ( – code ) get scancodes for pressed keys from keyboard.<br />
</p>
</div>
</div>
-<div id="outline-container-org7c5c975" class="outline-3">
-<h3 id="org7c5c975"><span class="section-number-3">13.2</span> Mouse driver</h3>
-<div class="outline-text-3" id="text-13-2">
+<div id="outline-container-orgc5f8a76" class="outline-3">
+<h3 id="orgc5f8a76"><span class="section-number-3">10.2.</span> Mouse driver</h3>
+<div class="outline-text-3" id="text-10-2">
<p class="verse">
mousex var Mouse x coordinate.<br />
mousey var Mouse y coordinate.<br />
</p>
</div>
</div>
-<div id="outline-container-org7e9e6e4" class="outline-3">
-<h3 id="org7e9e6e4"><span class="section-number-3">13.3</span> 2D graphic library</h3>
-<div class="outline-text-3" id="text-13-3">
+<div id="outline-container-org64da03a" class="outline-3">
+<h3 id="org64da03a"><span class="section-number-3">10.3.</span> 2D graphic library</h3>
+<div class="outline-text-3" id="text-10-3">
<dl class="org-dl">
<dt>lineh ( color len x y imgbuf – )</dt><dd>draws horisontal line from X,Y
coordinates to right, with specified length.</dd>
bust be >= x1, y2 must be >= y1.
</p>
-<pre class="example">
+<pre class="example" id="org0225660">
x1,y1-----------+
| |
| |
</div>
</div>
-
-<div id="outline-container-org53b108e" class="outline-3">
-<h3 id="org53b108e"><span class="section-number-3">13.4</span> Trigonometry functions</h3>
-<div class="outline-text-3" id="text-13-4">
+<div id="outline-container-org203890d" class="outline-3">
+<h3 id="org203890d"><span class="section-number-3">10.4.</span> Trigonometry functions</h3>
+<div class="outline-text-3" id="text-10-4">
</div>
-<div id="outline-container-orga868964" class="outline-4">
-<h4 id="orga868964"><span class="section-number-4">13.4.1</span> sin ( a – result )</h4>
-<div class="outline-text-4" id="text-13-4-1">
+<div id="outline-container-org618a2c2" class="outline-4">
+<h4 id="org618a2c2"><span class="section-number-4">10.4.1.</span> sin ( a – result )</h4>
+<div class="outline-text-4" id="text-10-4-1">
<p>
Return sinus from given angle "a", 360ø is 2000. So 1000 represents
180ø angle. Result will be in range -10'000 to 10'000, instead of ñ1.
</p>
</div>
</div>
-<div id="outline-container-org7e217b7" class="outline-4">
-<h4 id="org7e217b7"><span class="section-number-4">13.4.2</span> cos ( a – result )</h4>
-<div class="outline-text-4" id="text-13-4-2">
+<div id="outline-container-org0f995cf" class="outline-4">
+<h4 id="org0f995cf"><span class="section-number-4">10.4.2.</span> cos ( a – result )</h4>
+<div class="outline-text-4" id="text-10-4-2">
<p>
-Return cosinus from given angle. Parameters are like in <a href="#orga868964">sin</a> function.
+Return cosinus from given angle. Parameters are like in <a href="#org618a2c2">sin</a> function.
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Svjatoslav Agejenko</p>
-<p class="date">Created: 2022-04-17 Sun 18:14</p>
-<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
+<p class="date">Created: 2023-09-18 Mon 01:47</p>
+<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>