upgrade
[rrq/rrqforth.git] / reference.html
index 04da3738999684d452c0701a1335e93ede9ccd18..c690537f14c9cb1de13f3e3e4554c2c242729f05 100644 (file)
@@ -770,17 +770,24 @@ asciidoc.install();
 <a href="#p_put">!</a> &#160;\r
 <a href="#p_Cget">C@</a> &#160;\r
 <a href="#p_Cput">C!</a> &#160;\r
+<a href="#p_Wget">W@</a> &#160;\r
+<a href="#p_Wput">W!</a> &#160;\r
+<a href="#p_Dget">D@</a> &#160;\r
+<a href="#p_Dput">D!</a> &#160;\r
 <a href="#p_2get">2@</a> &#160;\r
 <a href="#p_2put">2!</a> &#160;\r
 <a href="#p_put_plus">!&#43;</a> &#160;\r
 <a href="#p_get_n_increment">@n&#43;&#43;</a> &#160;\r
 <a href="#p_get_n_decrement">@n--</a> &#160;\r
 <a href="#p_Ccomma">C,</a> &#160;\r
+<a href="#p_Wcomma">W,</a> &#160;\r
+<a href="#p_Dcomma">D,</a> &#160;\r
 <a href="#p_literal_string_compile">S"</a> &#160;\r
 <a href="#p_gtR">&gt;R</a> &#160;\r
 <a href="#p_Rget">R@</a> &#160;\r
 <a href="#p_Rgt">R&gt;</a> &#160;\r
-<a href="#p_rbpn">R[n]</a> &#160;</p></div>\r
+<a href="#p_rbpn">R[n]</a> &#160;\r
+<a href="#p_dsp">D[n]</a> &#160;</p></div>\r
 <div class="paragraph"><p><a href="#data_stack">DATA-STACK</a> &#160;\r
 <a href="#return_stack">RETURN-STACK</a> &#160;\r
 &#160;\r
@@ -858,6 +865,7 @@ asciidoc.install();
 <a href="#p_program_version">PROGRAM_VERSION</a> &#160;</p></div>\r
 <div class="paragraph"><p><a href="#p_quit">QUIT</a> &#160;</p></div>\r
 <div class="paragraph"><p><a href="#p_read_stream_char">READ-STREAM-CHAR</a> &#160;\r
+<a href="#p_read_stream_char">READ-STREAM-LINE</a> &#160;\r
 <a href="#p_read_word">READ-WORD</a> &#160;\r
 <a href="#p_realloc">REALLOC</a> &#160;\r
 <a href="#p_return">RETURN</a> &#160;\r
@@ -878,7 +886,9 @@ asciidoc.install();
 <div class="paragraph"><p><a href="#p_tell">TELL</a> &#160;\r
 <a href="#p_dot_temp">.TEMP</a> &#160;\r
 <a href="#p_temp.adoc">TEMP</a> &#160;\r
+<a href="#p_tempheld.adoc">TEMPHELD</a> &#160;\r
 <a href="#p_tempspace">TEMPSPACE</a> &#160;\r
+<a href="#p_tempused.adoc">TEMPUSED</a> &#160;\r
 <a href="#p_terminate0">TERMINATE0</a> &#160;\r
 <a href="#p_tfa2cfa">TFA&gt;CFA</a> &#160;\r
 <a href="#p_tfa2dfa">TFA&gt;DFA</a> &#160;\r
@@ -1142,6 +1152,65 @@ at the current free head address, which also is incremented.</p></div>
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_Wcomma"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_w">Word: W,</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( v -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"W," (W-comma) is a function word that puts a "word" (double-byte) on\r
+the <a href="#p_here">HERE</a> heap. The two least significant bytes of the value\r
+are put at the current free head address, which also is incremented\r
+accordingly.</p></div>\r
+<div class="exampleblock">\r
+<div class="content">\r
+<div class="sidebarblock">\r
+<div class="content">\r
+<div class="title">Definition concept for W,</div>\r
+<div class="paragraph"><p>: W, HERE @ 2 ALLOT W! ;</p></div>\r
+</div></div>\r
+</div></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_Dcomma"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_d">Word: D,</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( v -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"D," (D-comma) is a function word that puts a "double word"\r
+(double-byte) on the <a href="#p_here">HERE</a> heap. The four least significant\r
+bytes of the value are put at the current free head address, which\r
+also is incremented accordingly.</p></div>\r
+<div class="exampleblock">\r
+<div class="content">\r
+<div class="sidebarblock">\r
+<div class="content">\r
+<div class="title">Definition concept for D,</div>\r
+<div class="paragraph"><p>: D, HERE @ 4 ALLOT D! ;</p></div>\r
+</div></div>\r
+</div></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_dsp"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_d_n">Word: D[n]</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( n -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"D[n]" is a function word that pushes the address for the n:th cell of\r
+the data stack onto the data stack.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_cfa2tfa"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -1174,6 +1243,32 @@ _______________________________________________________
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_Wget"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_w_2">Word: W@</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( a -- v )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"W@" is a function word that pushes the "word" (double-byte) value v\r
+from the address a.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_Rget"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_r">Word: R@</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( -- v )   Return stack: ( v -- v )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"R@" is a function word that "copies" the top return stack value onto\r
+the data stack.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_Cput"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -1187,10 +1282,36 @@ significant byte of the cell) at the address a.</p></div>
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_Wput"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_w_3">Word: W!</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( v a -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"W!" is a function word that stores the "word" (2-byte) value v (the\r
+two least significant bytes of the cell) at the address a.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
+<div class="paragraph"><p><a id="p_Dput"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_d_2">Word: D!</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( v a -- )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"D!" is a function word that stores the "doublw word" (4-byte) value v\r
+(the four least significant bytes of the cell) at the address a.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_Rget"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
-<h3 id="_word_r">Word: R@</h3>\r
+<h3 id="_word_r_2">Word: R@</h3>\r
 <div class="literalblock">\r
 <div class="content">\r
 <pre><code>Data stack: ( -- v )   Return stack: ( v -- v )</code></pre>\r
@@ -1292,7 +1413,8 @@ _______________________________________________________
 </div></div>\r
 <div class="paragraph"><p>"ARGS" is a value word that holds a pointer to the command line data\r
 block which consists of a count cell followed by that many asciiz\r
-pointers and then a 0 cell.</p></div>\r
+pointers and then a 0 cell. That is next followed by the environment\r
+as a number of asciiz pointers and a 0 cell.</p></div>\r
 <div class="exampleblock">\r
 <div class="content">\r
 <div class="listingblock">\r
@@ -1300,9 +1422,10 @@ pointers and then a 0 cell.</p></div>
 <div class="content">\r
 <pre><code>ARGS -&gt; 8 bytes: count of non-zero asciiz pointers following\r
         8 bytes: command name string\r
-        8 bytes: first argument string\r
-        8* ...\r
-        8 zero</code></pre>\r
+        8* bytes: argument strings\r
+        8 bytes: zero cell\r
+        8* bytes: envirnment strings\r
+        8 bytes: zero cell</code></pre>\r
 </div></div>\r
 </div></div>\r
 <div style="text-align:center">\r
@@ -2934,8 +3057,8 @@ _______________________________________________________
 <div class="content">\r
 <pre><code>Data stack: ( n -- a )</code></pre>\r
 </div></div>\r
-<div class="paragraph"><p>"R[n]" is a function word that pushes the address for the n:th cell on\r
-the top return stack value onto the data stack.</p></div>\r
+<div class="paragraph"><p>"R[n]" is a function word that pushes the address for the n:th cell of\r
+the return stack onto the data stack.</p></div>\r
 <div class="exampleblock">\r
 <div class="content">\r
 <div class="sidebarblock">\r
@@ -2965,6 +3088,22 @@ instead.</p></div>
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_read_stream_line"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_read_stream_line">Word: READ-STREAM-LINE</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( stream -- n )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"READ-STREAM-LINE" is a function word that gets the next line from the\r
+given stream buffer into PAD and returns number of characters. If the\r
+stream is backed by a file descriptor, the stream buffer is refilled\r
+from there as needed, by a SYS_READ call when more characters are\r
+needed.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_read_word"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -3386,6 +3525,22 @@ small and short-lived data areas.</p></div>
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_tempheld"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_tempheld">Word: TEMPHELD</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"TEMPHELD" is a variable word that keeps the lowest offset of the\r
+<a href="#p__tempspace">TEMPSPACE</a> space to reuse upon cycling. The space\r
+below TEMPHELD is "held" in the sense of not being reused upon\r
+cycling. An application may change the TEMPSPACE offset as needed to\r
+dynamically preserve memory longer term.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_tempspace"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -3419,6 +3574,22 @@ overlapping a prior request.</p></div>
 <div style="text-align:center">\r
 _______________________________________________________\r
 </div>\r
+<div class="paragraph"><p><a id="p_tempused"></a></p></div>\r
+</div>\r
+<div class="sect2">\r
+<h3 id="_word_tempused">Word: TEMPUSED</h3>\r
+<div class="literalblock">\r
+<div class="content">\r
+<pre><code>Data stack: ( -- a )</code></pre>\r
+</div></div>\r
+<div class="paragraph"><p>"TEMPUSED" is a variable word that keeps the lowest offset of the\r
+<a href="#p__tempspace">TEMPSPACE</a> space to use next as temporary space. This\r
+is advance upon each allocation via <a href="#p_temp">TEMP</a>, and recycled back\r
+to <a href="#p_tempheld">TEMPHELD</a> when next allocation otherwise would exceed\r
+the space size.</p></div>\r
+<div style="text-align:center">\r
+_______________________________________________________\r
+</div>\r
 <div class="paragraph"><p><a id="p_terminate0"></a></p></div>\r
 </div>\r
 <div class="sect2">\r
@@ -3726,7 +3897,7 @@ is deepest.</p></div>
 <div id="footer">\r
 <div id="footer-text">\r
 Last updated\r
- 2021-06-11 19:04:48 AEST\r
+ 2021-06-15 15:44:03 AEST\r
 </div>\r
 </div>\r
 </body>\r