1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
\r
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
\r
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
\r
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
\r
7 <meta name="generator" content="AsciiDoc 8.6.10" />
\r
8 <title>RRQFORTH Reference Documentation</title>
\r
9 <style type="text/css">
\r
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
\r
14 font-family: Georgia,serif;
\r
18 h1, h2, h3, h4, h5, h6,
\r
19 div.title, caption.title,
\r
20 thead, p.table.header,
\r
22 #author, #revnumber, #revdate, #revremark,
\r
24 font-family: Arial,Helvetica,sans-serif;
\r
28 margin: 1em 5% 1em 5%;
\r
33 text-decoration: underline;
\r
49 h1, h2, h3, h4, h5, h6 {
\r
52 margin-bottom: 0.5em;
\r
57 border-bottom: 2px solid silver;
\r
77 border: 1px solid silver;
\r
82 margin-bottom: 0.5em;
\r
88 ul > li { color: #aaa; }
\r
89 ul > li > * { color: black; }
\r
91 .monospaced, code, pre {
\r
92 font-family: "Courier New", Courier, monospace;
\r
99 white-space: pre-wrap;
\r
109 #revnumber, #revdate, #revremark {
\r
114 border-top: 2px solid silver;
\r
115 padding-top: 0.5em;
\r
120 padding-bottom: 0.5em;
\r
124 padding-bottom: 0.5em;
\r
129 margin-bottom: 1.5em;
\r
131 div.imageblock, div.exampleblock, div.verseblock,
\r
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
\r
133 div.admonitionblock {
\r
135 margin-bottom: 1.5em;
\r
137 div.admonitionblock {
\r
139 margin-bottom: 2.0em;
\r
144 div.content { /* Block element content. */
\r
148 /* Block element titles. */
\r
149 div.title, caption.title {
\r
154 margin-bottom: 0.5em;
\r
160 td div.title:first-child {
\r
163 div.content div.title:first-child {
\r
166 div.content + div.title {
\r
170 div.sidebarblock > div.content {
\r
171 background: #ffffee;
\r
172 border: 1px solid #dddddd;
\r
173 border-left: 4px solid #f0f0f0;
\r
177 div.listingblock > div.content {
\r
178 border: 1px solid #dddddd;
\r
179 border-left: 5px solid #f0f0f0;
\r
180 background: #f8f8f8;
\r
184 div.quoteblock, div.verseblock {
\r
185 padding-left: 1.0em;
\r
186 margin-left: 1.0em;
\r
188 border-left: 5px solid #f0f0f0;
\r
192 div.quoteblock > div.attribution {
\r
193 padding-top: 0.5em;
\r
197 div.verseblock > pre.content {
\r
198 font-family: inherit;
\r
199 font-size: inherit;
\r
201 div.verseblock > div.attribution {
\r
202 padding-top: 0.75em;
\r
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
\r
206 div.verseblock + div.attribution {
\r
210 div.admonitionblock .icon {
\r
211 vertical-align: top;
\r
214 text-decoration: underline;
\r
216 padding-right: 0.5em;
\r
218 div.admonitionblock td.content {
\r
219 padding-left: 0.5em;
\r
220 border-left: 3px solid #dddddd;
\r
223 div.exampleblock > div.content {
\r
224 border-left: 3px solid #dddddd;
\r
225 padding-left: 0.5em;
\r
228 div.imageblock div.content { padding-left: 0; }
\r
229 span.image img { border-style: none; vertical-align: text-bottom; }
\r
230 a.image:visited { color: white; }
\r
234 margin-bottom: 0.8em;
\r
239 font-style: normal;
\r
242 dd > *:first-child {
\r
247 list-style-position: outside;
\r
250 list-style-type: decimal;
\r
253 list-style-type: lower-alpha;
\r
256 list-style-type: upper-alpha;
\r
259 list-style-type: lower-roman;
\r
262 list-style-type: upper-roman;
\r
265 div.compact ul, div.compact ol,
\r
266 div.compact p, div.compact p,
\r
267 div.compact div, div.compact div {
\r
269 margin-bottom: 0.1em;
\r
281 margin-bottom: 0.8em;
\r
284 padding-bottom: 15px;
\r
286 dt.hdlist1.strong, td.hdlist1.strong {
\r
290 vertical-align: top;
\r
291 font-style: normal;
\r
292 padding-right: 0.8em;
\r
296 vertical-align: top;
\r
298 div.hdlist.compact tr {
\r
304 background: yellow;
\r
307 .footnote, .footnoteref {
\r
311 span.footnote, span.footnoteref {
\r
312 vertical-align: super;
\r
316 margin: 20px 0 20px 0;
\r
317 padding: 7px 0 0 0;
\r
320 #footnotes div.footnote {
\r
326 border-top: 1px solid silver;
\r
335 padding-right: 0.5em;
\r
336 padding-bottom: 0.3em;
\r
337 vertical-align: top;
\r
339 div.colist td img {
\r
344 #footer-badges { display: none; }
\r
348 margin-bottom: 2.5em;
\r
356 margin-bottom: 0.1em;
\r
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
\r
376 span.aqua { color: aqua; }
\r
377 span.black { color: black; }
\r
378 span.blue { color: blue; }
\r
379 span.fuchsia { color: fuchsia; }
\r
380 span.gray { color: gray; }
\r
381 span.green { color: green; }
\r
382 span.lime { color: lime; }
\r
383 span.maroon { color: maroon; }
\r
384 span.navy { color: navy; }
\r
385 span.olive { color: olive; }
\r
386 span.purple { color: purple; }
\r
387 span.red { color: red; }
\r
388 span.silver { color: silver; }
\r
389 span.teal { color: teal; }
\r
390 span.white { color: white; }
\r
391 span.yellow { color: yellow; }
\r
393 span.aqua-background { background: aqua; }
\r
394 span.black-background { background: black; }
\r
395 span.blue-background { background: blue; }
\r
396 span.fuchsia-background { background: fuchsia; }
\r
397 span.gray-background { background: gray; }
\r
398 span.green-background { background: green; }
\r
399 span.lime-background { background: lime; }
\r
400 span.maroon-background { background: maroon; }
\r
401 span.navy-background { background: navy; }
\r
402 span.olive-background { background: olive; }
\r
403 span.purple-background { background: purple; }
\r
404 span.red-background { background: red; }
\r
405 span.silver-background { background: silver; }
\r
406 span.teal-background { background: teal; }
\r
407 span.white-background { background: white; }
\r
408 span.yellow-background { background: yellow; }
\r
410 span.big { font-size: 2em; }
\r
411 span.small { font-size: 0.6em; }
\r
413 span.underline { text-decoration: underline; }
\r
414 span.overline { text-decoration: overline; }
\r
415 span.line-through { text-decoration: line-through; }
\r
417 div.unbreakable { page-break-inside: avoid; }
\r
427 margin-bottom: 1.5em;
\r
429 div.tableblock > table {
\r
430 border: 3px solid #527bbd;
\r
432 thead, p.table.header {
\r
439 /* Because the table frame attribute is overriden by CSS in most browsers. */
\r
440 div.tableblock > table[frame="void"] {
\r
441 border-style: none;
\r
443 div.tableblock > table[frame="hsides"] {
\r
444 border-left-style: none;
\r
445 border-right-style: none;
\r
447 div.tableblock > table[frame="vsides"] {
\r
448 border-top-style: none;
\r
449 border-bottom-style: none;
\r
460 margin-bottom: 1.5em;
\r
462 thead, p.tableblock.header {
\r
471 border-spacing: 0px;
\r
472 border-style: solid;
\r
473 border-color: #527bbd;
\r
474 border-collapse: collapse;
\r
476 th.tableblock, td.tableblock {
\r
479 border-style: solid;
\r
480 border-color: #527bbd;
\r
483 table.tableblock.frame-topbot {
\r
484 border-left-style: hidden;
\r
485 border-right-style: hidden;
\r
487 table.tableblock.frame-sides {
\r
488 border-top-style: hidden;
\r
489 border-bottom-style: hidden;
\r
491 table.tableblock.frame-none {
\r
492 border-style: hidden;
\r
495 th.tableblock.halign-left, td.tableblock.halign-left {
\r
498 th.tableblock.halign-center, td.tableblock.halign-center {
\r
499 text-align: center;
\r
501 th.tableblock.halign-right, td.tableblock.halign-right {
\r
505 th.tableblock.valign-top, td.tableblock.valign-top {
\r
506 vertical-align: top;
\r
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
\r
509 vertical-align: middle;
\r
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
\r
512 vertical-align: bottom;
\r
522 padding-top: 0.5em;
\r
523 padding-bottom: 0.5em;
\r
524 border-top: 2px solid silver;
\r
525 border-bottom: 2px solid silver;
\r
528 border-style: none;
\r
530 body.manpage div.sectionbody {
\r
535 body.manpage div#toc { display: none; }
\r
540 <script type="text/javascript">
\r
542 var asciidoc = { // Namespace.
\r
544 /////////////////////////////////////////////////////////////////////
\r
545 // Table Of Contents generator
\r
546 /////////////////////////////////////////////////////////////////////
\r
548 /* Author: Mihai Bazon, September 2002
\r
549 * http://students.infoiasi.ro/~mishoo
\r
551 * Table Of Content generator
\r
554 * Feel free to use this script under the terms of the GNU General Public
\r
555 * License, as long as you do not remove or alter this notice.
\r
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
\r
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
\r
561 // toclevels = 1..4.
\r
562 toc: function (toclevels) {
\r
564 function getText(el) {
\r
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
\r
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
\r
569 else if (i.firstChild != null)
\r
570 text += getText(i);
\r
575 function TocEntry(el, text, toclevel) {
\r
578 this.toclevel = toclevel;
\r
581 function tocEntries(el, toclevels) {
\r
582 var result = new Array;
\r
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
\r
584 // Function that scans the DOM tree for header elements (the DOM2
\r
585 // nodeIterator API would be a better technique but not supported by all
\r
587 var iterate = function (el) {
\r
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
\r
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
\r
590 var mo = re.exec(i.tagName);
\r
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
\r
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
\r
602 var toc = document.getElementById("toc");
\r
607 // Delete existing TOC entries in case we're reloading the TOC.
\r
608 var tocEntriesToRemove = [];
\r
610 for (i = 0; i < toc.childNodes.length; i++) {
\r
611 var entry = toc.childNodes[i];
\r
612 if (entry.nodeName.toLowerCase() == 'div'
\r
613 && entry.getAttribute("class")
\r
614 && entry.getAttribute("class").match(/^toclevel/))
\r
615 tocEntriesToRemove.push(entry);
\r
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
\r
618 toc.removeChild(tocEntriesToRemove[i]);
\r
621 // Rebuild TOC entries.
\r
622 var entries = tocEntries(document.getElementById("content"), toclevels);
\r
623 for (var i = 0; i < entries.length; ++i) {
\r
624 var entry = entries[i];
\r
625 if (entry.element.id == "")
\r
626 entry.element.id = "_toc_" + i;
\r
627 var a = document.createElement("a");
\r
628 a.href = "#" + entry.element.id;
\r
629 a.appendChild(document.createTextNode(entry.text));
\r
630 var div = document.createElement("div");
\r
631 div.appendChild(a);
\r
632 div.className = "toclevel" + entry.toclevel;
\r
633 toc.appendChild(div);
\r
635 if (entries.length == 0)
\r
636 toc.parentNode.removeChild(toc);
\r
640 /////////////////////////////////////////////////////////////////////
\r
641 // Footnotes generator
\r
642 /////////////////////////////////////////////////////////////////////
\r
644 /* Based on footnote generation code from:
\r
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
\r
648 footnotes: function () {
\r
649 // Delete existing footnote entries in case we're reloading the footnodes.
\r
651 var noteholder = document.getElementById("footnotes");
\r
655 var entriesToRemove = [];
\r
656 for (i = 0; i < noteholder.childNodes.length; i++) {
\r
657 var entry = noteholder.childNodes[i];
\r
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
\r
659 entriesToRemove.push(entry);
\r
661 for (i = 0; i < entriesToRemove.length; i++) {
\r
662 noteholder.removeChild(entriesToRemove[i]);
\r
665 // Rebuild footnote entries.
\r
666 var cont = document.getElementById("content");
\r
667 var spans = cont.getElementsByTagName("span");
\r
670 for (i=0; i<spans.length; i++) {
\r
671 if (spans[i].className == "footnote") {
\r
673 var note = spans[i].getAttribute("data-note");
\r
675 // Use [\s\S] in place of . so multi-line matches work.
\r
676 // Because JavaScript has no s (dotall) regex flag.
\r
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
\r
678 spans[i].innerHTML =
\r
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
\r
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
\r
681 spans[i].setAttribute("data-note", note);
\r
683 noteholder.innerHTML +=
\r
684 "<div class='footnote' id='_footnote_" + n + "'>" +
\r
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
\r
686 n + "</a>. " + note + "</div>";
\r
687 var id =spans[i].getAttribute("id");
\r
688 if (id != null) refs["#"+id] = n;
\r
692 noteholder.parentNode.removeChild(noteholder);
\r
694 // Process footnoterefs.
\r
695 for (i=0; i<spans.length; i++) {
\r
696 if (spans[i].className == "footnoteref") {
\r
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
\r
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
\r
700 spans[i].innerHTML =
\r
701 "[<a href='#_footnote_" + n +
\r
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
\r
708 install: function(toclevels) {
\r
711 function reinstall() {
\r
712 asciidoc.footnotes();
\r
714 asciidoc.toc(toclevels);
\r
718 function reinstallAndRemoveTimer() {
\r
719 clearInterval(timerId);
\r
723 timerId = setInterval(reinstall, 500);
\r
724 if (document.addEventListener)
\r
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
\r
727 window.onload = reinstallAndRemoveTimer;
\r
731 asciidoc.install();
\r
735 <body class="article">
\r
737 <h1>RRQFORTH Reference Documentation</h1>
\r
738 <span id="author">Ralph Ronnquist <ralph.ronnquist@gmail.com></span><br />
\r
741 <div class="sect1">
\r
742 <h2 id="_word_index">Word Index</h2>
\r
743 <div class="sectionbody">
\r
744 <div class="paragraph"><p><a href="#p_lparen">( (left parenthesis)</a>  
\r
745 <a href="#p_colon">: (colon)</a>  
\r
746 <a href="#p_semicolon">: (semi-colon)</a>  
\r
747 <a href="#p_comma">, (comma)</a>  
\r
748 <a href="#p_dot">. (dot)</a>  
\r
749 <a href="#p_double_quote">" (double-quote)</a>  
\r
750 <a href="#p_quote">' (single-quote)</a>  
\r
751 <a href="#p_left_bracket">[ (left bracket)</a>  
\r
752 <a href="#p_right_bracket">] (right bracket)</a>  </p></div>
\r
753 <div class="paragraph"><p><a href="#p_lessthan"><</a>  
\r
754 <a href="#p_lessequal"><=</a>  
\r
755 <a href="#p_equal">=</a>  
\r
756 <a href="#p_unequal">!=</a>  
\r
757 <a href="#p_greaterthan">></a>  
\r
758 <a href="#p_greaterequal">>= </a>  
\r
759 <a href="#p_0equal">0=</a>  
\r
760 <a href="#p_0less">0<</a>  
\r
761 <a href="#p_minus">-</a>  
\r
762 <a href="#p_mult">*</a>  
\r
763 <a href="#p_plus">+</a>  
\r
764 <a href="#p_div">/</a>  
\r
765 <a href="#p_shift_left"><<</a>  
\r
766 <a href="#p_shift_right">>></a>  
\r
767 <a href="#p_shift_signed_right">s>></a>  
\r
768 <a href="#p_bracketed_quote">[']</a>  </p></div>
\r
769 <div class="paragraph"><p><a href="#p_get">@</a>  
\r
770 <a href="#p_put">!</a>  
\r
771 <a href="#p_Cget">C@</a>  
\r
772 <a href="#p_Cput">C!</a>  
\r
773 <a href="#p_2get">2@</a>  
\r
774 <a href="#p_2put">2!</a>  
\r
775 <a href="#p_put_plus">!+</a>  
\r
776 <a href="#p_get_n_increment">@n++</a>  
\r
777 <a href="#p_get_n_decrement">@n--</a>  
\r
778 <a href="#p_Ccomma">C,</a>  
\r
779 <a href="#p_literal_string">S"</a>  
\r
780 <a href="#p_gtR">>R</a>  
\r
781 <a href="#p_Rget">R@</a>  
\r
782 <a href="#p_Rgt">R></a>  
\r
783 <a href="#p_rsp">R[n]</a>  </p></div>
\r
784 <div class="paragraph"><p><a href="#data_stack">DATA-STACK</a>  
\r
785 <a href="#return_stack">RETURN-STACK</a>  
\r
787 <a href="#p_branch">BRANCH</a>  
\r
788 <a href="#p_0branch">0BRANCH</a>  
\r
789 <a href="#p_1branch">1BRANCH</a>  
\r
791 <a href="#p_2drop">2DROP</a>  
\r
792 <a href="#p_2dup">2DUP</a>  
\r
793 <a href="#p_2over">2OVER</a>  
\r
794 <a href="#p_2swap">2SWAP</a>  </p></div>
\r
795 <div class="paragraph"><p><a href="#p_abs">ABS</a>  
\r
796 <a href="#p_again">AGAIN</a>  
\r
797 <a href="#p_allot">ALLOT</a>  
\r
798 <a href="#p_and">AND</a>  
\r
799 <a href="#inline_code">[ASM]</a>  </p></div>
\r
800 <div class="paragraph"><p><a href="#p_base">BASE</a>  
\r
801 <a href="#p_begin">BEGIN</a>  
\r
802 <a href="#p_break">BREAK</a>  </p></div>
\r
803 <div class="paragraph"><p><a href="#p_cfa2flags_get">CFA>FLAGS@</a>  
\r
804 <a href="#p_clear_stream">CLEAR-STREAM</a>  
\r
805 <a href="#p_create">CREATE</a>  
\r
806 <a href="#p_current_wordlist">CURRENT-WORDLIST</a>  </p></div>
\r
807 <div class="paragraph"><p><a href="#p_decimal">DECIMAL</a>  
\r
808 <a href="#p_depth">DEPTH</a>  
\r
809 <a href="#p_digits">DIGITS</a>  
\r
810 <a href="#p_divmod">/MOD</a>  
\r
811 <a href="#p_dfa2tfa">DFA>TFA</a>  
\r
812 <a href="#p_dodoes">doDOES</a>  
\r
813 <a href="#p_does">DOES></a>  
\r
814 <a href="#p_dofasm">doFASM</a>  
\r
815 <a href="#p_doforth">doFORTH</a>  
\r
816 <a href="#p_dostring">doSTRING</a>  
\r
817 <a href="#p_dovalue">doVALUE</a>  
\r
818 <a href="#p_dovariable">doVARIABLE</a>  
\r
819 <a href="#p_drop">DROP</a>  
\r
820 <a href="#p_dup">DUP</a>  </p></div>
\r
821 <div class="paragraph"><p><a href="#p_else">ELSE</a>  
\r
822 <a href="#p_emit">EMIT</a>  
\r
823 <a href="#p_end">END</a>  
\r
824 <a href="#p_erase">ERASE</a>  
\r
825 <a href="#p_evaluate_stream">EVALUATE-STREAM</a>  
\r
826 <a href="#p_execute">EXECUTE</a>  
\r
827 <a href="#p_exit">EXIT</a>  </p></div>
\r
828 <div class="paragraph"><p><a href="#p_false">FALSE</a>  
\r
829 <a href="#p_find">FIND</a>  
\r
830 <a href="#p_forth">FORTH</a>  </p></div>
\r
831 <div class="paragraph"><p><a href="#p_here">HERE</a>  
\r
832 <a href="#p_hex">HEX</a>  </p></div>
\r
833 <div class="paragraph"><p><a href="#p_if">IF</a>  
\r
834 <a href="#p_ifagain">IFAGAIN</a>  
\r
835 <a href="#p_ifbreak">IFBREAK</a>  
\r
836 <a href="#p_immediate">IMMEDIATE</a>  
\r
837 <a href="#p_input">INPUT</a>  </p></div>
\r
838 <div class="paragraph"><p><a href="#p_literal">LIT</a>  
\r
839 <a href="#p_load_file_quote">LOAD-FILE"</a>  </p></div>
\r
840 <div class="paragraph"><p><a href="#p_args">MAIN-ARGS</a>  
\r
841 <a href="#p_malloc">MALLOC</a>  </p></div>
\r
842 <div class="paragraph"><p><a href="#p_negate">NEGATE</a>  
\r
843 <a href="#p_nip">NIP</a>  
\r
844 <a href="#p_nl">NL</a>  
\r
845 <a href="#p_not">NOT</a>  
\r
846 <a href="#p_number">NUMBER</a>  </p></div>
\r
847 <div class="paragraph"><p><a href="#p_open_file_quote">OPEN-FILE"</a>  
\r
848 <a href="#p_or">OR</a>  
\r
849 <a href="#p_over">OVER</a>  </p></div>
\r
850 <div class="paragraph"><p><a href="#p_pad">PAD</a>  
\r
851 <a href="#p_pick">PICK</a>  
\r
852 <a href="#p_program_version">PROGRAM_VERSION</a>  </p></div>
\r
853 <div class="paragraph"><p><a href="#p_quit">QUIT</a>  </p></div>
\r
854 <div class="paragraph"><p><a href="#p_read_stream_char">READ-STREAM-CHAR</a>  
\r
855 <a href="#p_read_word">READ-WORD</a>  
\r
856 <a href="#p_realloc">REALLOC</a>  
\r
857 <a href="#p_roll">ROLL</a>  
\r
858 <a href="#p_rot">ROT</a>  </p></div>
\r
859 <div class="paragraph"><p><a href="#p_sp">SP</a>  
\r
860 <a href="#p_state">STATE</a>  
\r
861 <a href="#p_stdin">STDIN</a>  
\r
862 <a href="#p_stream">STREAM</a>  
\r
863 <a href="#p_stream_nchars">STREAM-NCHARS</a>  
\r
864 <a href="#p_strlen">STRLEN</a>  
\r
865 <a href="#p_strncmp">STRNCMP</a>  
\r
866 <a href="#p_strncpy">STRNCPY</a>  
\r
867 <a href="#p_swap">SWAP</a>  
\r
868 <a href="#p_system">SYSTEM</a>  </p></div>
\r
869 <div class="paragraph"><p><a href="#p_tell">TELL</a>  
\r
870 <a href="#p_terminate0">TERMINATE0</a>  
\r
871 <a href="#p_tfa2cfa">TFA>CFA</a>  
\r
872 <a href="#p_tfa2dfa">TFA>DFA</a>  
\r
873 <a href="#p_tfa2flags_get">TFA>FLAGS@</a>  
\r
874 <a href="#p_tfa2namez">TFA>NAMEZ</a>  
\r
875 <a href="#p_then">THEN</a>  
\r
876 <a href="#p_this_word">THIS-WORD</a>  
\r
877 <a href="#p_true">TRUE</a>  
\r
878 <a href="#p_tuck">TUCK</a>  </p></div>
\r
879 <div class="paragraph"><p><a href="#p_verboseQ">VERBOSE?</a>  </p></div>
\r
880 <div class="paragraph"><p><a href="#p_within">WITHIN</a>  
\r
881 <a href="#p_words">WORDS</a>  </p></div>
\r
882 <div class="paragraph"><p><a href="#p_xor">XOR</a>  </p></div>
\r
883 <div class="paragraph"><p><a href="#p_calltrace">[calltrace]</a>  
\r
884 <a href="#p_setup_signals">[setup_signals]</a>  </p></div>
\r
887 <div class="sect1">
\r
888 <h2 id="_word_descriptions">Word Descriptions</h2>
\r
889 <div class="sectionbody">
\r
890 <div class="paragraph"><p><a id="inline_code"></a></p></div>
\r
891 <div class="sect2">
\r
892 <h3 id="_word_asm">Word: [ASM]</h3>
\r
893 <div class="literalblock">
\r
894 <div class="content">
\r
895 <pre><code>data stack: ( -- )</code></pre>
\r
897 <div class="paragraph"><p>"[ASM]" is a function word that introduces inline assembly in an
\r
898 RRQFORTH definition. Such assembly code may return to subsequence
\r
899 RRQFORTH executon by means of the following instruction sequence:</p></div>
\r
900 <div class="exampleblock">
\r
901 <div class="content">
\r
902 <div class="listingblock">
\r
903 <div class="content">
\r
904 <pre><code> mov rsi,forthcode
\r
907 forthcode:</code></pre>
\r
910 <div class="paragraph"><p>Note that the FORTH compiler does not invoke an assembler so any
\r
911 inline assembly code must be provided in its binary form.</p></div>
\r
912 <div style="text-align:center">
\r
913 _______________________________________________________
\r
915 <div class="paragraph"><p><a id="p_0branch"></a></p></div>
\r
917 <div class="sect2">
\r
918 <h3 id="_word_0branch">Word: 0BRANCH</h3>
\r
919 <div class="literalblock">
\r
920 <div class="content">
\r
921 <pre><code>Data stack: ( v -- )</code></pre>
\r
923 <div class="paragraph"><p>"0BRANCH" is a function word that implements execution conditional by
\r
924 means of optionally adding the subsequent branch offset, or not, to
\r
925 the point of execution. If the value, v, is 0 then the branch offset
\r
926 is added, and otherwise execution continues with the cell following
\r
927 the branch offset in the definition.</p></div>
\r
928 <div class="paragraph"><p>Note that the branch offset is a byte count and each FORTH word of a
\r
929 definition take up a cell of 8 bytes. The offset is relative to the
\r
930 cell address immediately subsequent to the offset cell. In other
\r
931 words, offset 0 is not branching anywhere and an offset of -16 would
\r
932 make a tight loop back to the branch instruction itself. The latter
\r
933 would pull data stack values until and including the first non-zero
\r
935 <div class="paragraph"><p>See also <a href="#p_1branch">1BRANCH</a>, <a href="#p_branch">BRANCH</a>, <a href="#p_if">IF</a>,
\r
936 <a href="#p_else">ELSE</a>, <a href="#p_ifbreak">IFBREAK</a> and <a href="#p_ifagain">IFAGAIN</a>.</p></div>
\r
937 <div style="text-align:center">
\r
938 _______________________________________________________
\r
940 <div class="paragraph"><p><a id="p_0equal"></a></p></div>
\r
942 <div class="sect2">
\r
943 <h3 id="_word_0">Word: 0=</h3>
\r
944 <div class="literalblock">
\r
945 <div class="content">
\r
946 <pre><code>Data stack: ( v -- 0/-1 )</code></pre>
\r
948 <div class="paragraph"><p>"0=" is a function word that replaces a value with its logical
\r
949 complement; the result is zero if the value non-zero, and the result
\r
950 is non-zero if the value is zero.</p></div>
\r
951 <div class="paragraph"><p>This is the same function as <a href="#p_not">NOT</a>.</p></div>
\r
952 <div style="text-align:center">
\r
953 _______________________________________________________
\r
955 <div class="paragraph"><p><a id="p_0less"></a></p></div>
\r
957 <div class="sect2">
\r
958 <h3 id="_word_0_lt">Word: 0<</h3>
\r
959 <div class="literalblock">
\r
960 <div class="content">
\r
961 <pre><code>Data stack: ( v -- 0/-1 )</code></pre>
\r
963 <div class="paragraph"><p>"0<" is a function word that replaces a value with -1 if the value is
\r
964 less than 0, and 0 otherwise.</p></div>
\r
965 <div class="exampleblock">
\r
966 <div class="content">
\r
967 <div class="sidebarblock">
\r
968 <div class="content">
\r
969 <div class="title">Definition concept for 0<</div>
\r
970 <div class="paragraph"><p>( v — 0/1 ) : 0= 0 SWAP < ;</p></div>
\r
973 <div class="paragraph"><p>See also <a href="#p_swap">SWAP</a> and <a href="#p_lessthan"><</a>.</p></div>
\r
974 <div style="text-align:center">
\r
975 _______________________________________________________
\r
977 <div class="paragraph"><p><a id="p_1branch"></a></p></div>
\r
979 <div class="sect2">
\r
980 <h3 id="_word_1branch">Word: 1BRANCH</h3>
\r
981 <div class="literalblock">
\r
982 <div class="content">
\r
983 <pre><code>Data stack: ( v -- )</code></pre>
\r
985 <div class="paragraph"><p>"1BRANCH" is a function word that implements execution conditional by
\r
986 means of optionally adding the subsequent branch offset, or not, to
\r
987 the point of execution. If the value, v, is non-zero then the branch
\r
988 offset is added, and otherwise execution continues with the cell
\r
989 following the branch offset in the definition.</p></div>
\r
990 <div class="paragraph"><p>Note that the branch offset is a byte count and each FORTH word of a
\r
991 definition take up a cell of 8 bytes. The offset is relative to the
\r
992 cell address immediately subsequent to the offset cell. In other
\r
993 words, offset 0 is not branching anywhere and an offset of -16 would
\r
994 make a tight loop back to the branch instruction itself. The latter
\r
995 would pull data stack values until and including the first zero value.</p></div>
\r
996 <div class="paragraph"><p>See also <a href="#p_0branch">0BRANCH</a>, <a href="#p_branch">BRANCH</a>, <a href="#p_if">IF</a>,
\r
997 <a href="#p_else">ELSE</a>, <a href="#p_ifbreak">IFBREAK</a> and <a href="#p_ifagain">IFAGAIN</a>.</p></div>
\r
998 <div style="text-align:center">
\r
999 _______________________________________________________
\r
1001 <div class="paragraph"><p><a id="p_2drop"></a></p></div>
\r
1003 <div class="sect2">
\r
1004 <h3 id="_word_2drop">Word: 2DROP</h3>
\r
1005 <div class="literalblock">
\r
1006 <div class="content">
\r
1007 <pre><code>Data stack: ( v1 v2 -- )</code></pre>
\r
1009 <div class="paragraph"><p>"2DROP" is a function word that plainly discards the top 2 cells from
\r
1010 the data stack.</p></div>
\r
1011 <div style="text-align:center">
\r
1012 _______________________________________________________
\r
1014 <div class="paragraph"><p><a id="p_2dup"></a></p></div>
\r
1016 <div class="sect2">
\r
1017 <h3 id="_word_2dup">Word: 2DUP</h3>
\r
1018 <div class="literalblock">
\r
1019 <div class="content">
\r
1020 <pre><code>Data stack: ( v1 v2 -- v1 v2 v1 v2 )</code></pre>
\r
1022 <div class="paragraph"><p>"2DUP" is a function word that duplicates the top 2 cells on the data
\r
1024 <div class="exampleblock">
\r
1025 <div class="content">
\r
1026 <div class="sidebarblock">
\r
1027 <div class="content">
\r
1028 <div class="title">Definition concept for 2DUP</div>
\r
1029 <div class="paragraph"><p>( v1 v2 — v1 v2 v1 v2 ) : 2DUP OVER OVER ;</p></div>
\r
1032 <div style="text-align:center">
\r
1033 _______________________________________________________
\r
1035 <div class="paragraph"><p><a id="p_2get"></a></p></div>
\r
1037 <div class="sect2">
\r
1038 <h3 id="_word_2">Word: 2@</h3>
\r
1039 <div class="literalblock">
\r
1040 <div class="content">
\r
1041 <pre><code>Data stack: ( a -- v2 v1 )</code></pre>
\r
1043 <div class="paragraph"><p>"2@" is a function word that pushes the two concecutive values v1 and
\r
1044 v2 from the address a onto the data stack. Value v1 is from address a
\r
1045 and value v2 is from address a + 8.</p></div>
\r
1046 <div style="text-align:center">
\r
1047 _______________________________________________________
\r
1049 <div class="paragraph"><p><a id="p_2over"></a></p></div>
\r
1051 <div class="sect2">
\r
1052 <h3 id="_word_2over">Word: 2OVER</h3>
\r
1053 <div class="literalblock">
\r
1054 <div class="content">
\r
1055 <pre><code>Data stack: ( v1 v2 v3 v4 -- v1 v2 v3 v4 v1 v2 )</code></pre>
\r
1057 <div class="paragraph"><p>"2OVER" is a function word that replicates the second duble-cell pair
\r
1058 onto the top of the data stack. This is similar to <a href="#p_over">OVER</a> but
\r
1059 working with cell pairs rather than single cells.</p></div>
\r
1060 <div class="exampleblock">
\r
1061 <div class="content">
\r
1062 <div class="sidebarblock">
\r
1063 <div class="content">
\r
1064 <div class="title">Definition concept for 2OVER</div>
\r
1065 <div class="paragraph"><p>( v1 v2 v3 v4 — v1 v2 v3 v4 v1 v2 ) : 2OVER 3 PICK 3 PICK ;</p></div>
\r
1068 <div style="text-align:center">
\r
1069 _______________________________________________________
\r
1071 <div class="paragraph"><p><a id="p_2put"></a></p></div>
\r
1073 <div class="sect2">
\r
1074 <h3 id="_word_2_2">Word: 2!</h3>
\r
1075 <div class="literalblock">
\r
1076 <div class="content">
\r
1077 <pre><code>Data stack: ( v2 v1 a -- )</code></pre>
\r
1079 <div class="paragraph"><p>"2!" is a function word that stors two concecutive values v1 and v2 to
\r
1080 the address a from the data stack. Value v1 is stored at address a and
\r
1081 value v2 is stored at address a + 8.</p></div>
\r
1082 <div style="text-align:center">
\r
1083 _______________________________________________________
\r
1085 <div class="paragraph"><p><a id="p_2swap"></a></p></div>
\r
1087 <div class="sect2">
\r
1088 <h3 id="_word_2swap">Word: 2SWAP</h3>
\r
1089 <div class="literalblock">
\r
1090 <div class="content">
\r
1091 <pre><code>Data stack: ( v1 v2 v3 v4 -- v3 v4 v1 v2 )</code></pre>
\r
1093 <div class="paragraph"><p>"2SWAP" is a function word the reorgnizes the top 4 cells swappping
\r
1094 the upper and lower pair. This is similar to <a href="#p_swap">SWAP</a> but
\r
1095 working with cell pairs rather than single cells.</p></div>
\r
1096 <div class="exampleblock">
\r
1097 <div class="content">
\r
1098 <div class="sidebarblock">
\r
1099 <div class="content">
\r
1100 <div class="title">Definition concept for 2SWAP</div>
\r
1101 <div class="paragraph"><p>( v1 v2 v3 v4 — v3 v4 v1 v2 ) : 2SWAP 3 ROLL 3 ROLL ;</p></div>
\r
1104 <div style="text-align:center">
\r
1105 _______________________________________________________
\r
1107 <div class="paragraph"><p><a id="p_Ccomma"></a></p></div>
\r
1109 <div class="sect2">
\r
1110 <h3 id="_word_c">Word: C,</h3>
\r
1111 <div class="literalblock">
\r
1112 <div class="content">
\r
1113 <pre><code>Data stack: ( v -- )</code></pre>
\r
1115 <div class="paragraph"><p>"C," (C-comma) is a function word that puts a byte on the
\r
1116 <a href="#p_here">HERE</a> heap. The least significant byte of the value is put
\r
1117 at the current free head address, which also is incremented.</p></div>
\r
1118 <div class="exampleblock">
\r
1119 <div class="content">
\r
1120 <div class="sidebarblock">
\r
1121 <div class="content">
\r
1122 <div class="title">Definition concept for C,</div>
\r
1123 <div class="paragraph"><p>: C, HERE @ 1 ALLOT C! ; ( v — ; Claim 1 byte and put lsb value there )</p></div>
\r
1126 <div class="paragraph"><p>See also <a href="#p_colon">:</a>, <a href="#p_comma">[p_comma]</a>. <a href="#p_here">HERE</a>, <a href="#p_get">@</a>,
\r
1127 <a href="#p_allot">ALLOT</a>, <a href="#p_Cput">C!</a> and <a href="#p_semicolon">;</a>.</p></div>
\r
1128 <div style="text-align:center">
\r
1129 _______________________________________________________
\r
1131 <div class="paragraph"><p><a id="p_Cget"></a></p></div>
\r
1133 <div class="sect2">
\r
1134 <h3 id="_word_c_2">Word: C@</h3>
\r
1135 <div class="literalblock">
\r
1136 <div class="content">
\r
1137 <pre><code>Data stack: ( a -- v )</code></pre>
\r
1139 <div class="paragraph"><p>"C@" is a function word that pushes the byte value v from the address a.</p></div>
\r
1140 <div style="text-align:center">
\r
1141 _______________________________________________________
\r
1143 <div class="paragraph"><p><a id="p_Cput"></a></p></div>
\r
1145 <div class="sect2">
\r
1146 <h3 id="_word_c_3">Word: C!</h3>
\r
1147 <div class="literalblock">
\r
1148 <div class="content">
\r
1149 <pre><code>Data stack: ( v a -- )</code></pre>
\r
1151 <div class="paragraph"><p>"C!" is a function word that stores the byte value v (the least
\r
1152 significant byte of the cell) at the address a.</p></div>
\r
1153 <div style="text-align:center">
\r
1154 _______________________________________________________
\r
1156 <div class="paragraph"><p><a id="p_Rget"></a></p></div>
\r
1158 <div class="sect2">
\r
1159 <h3 id="_word_r">Word: R@</h3>
\r
1160 <div class="literalblock">
\r
1161 <div class="content">
\r
1162 <pre><code>Data stack: ( -- v ) Return stack: ( v -- v )</code></pre>
\r
1164 <div class="paragraph"><p>"R@" is a function word that "copies" the top return stack value onto
\r
1165 the data stack.</p></div>
\r
1166 <div style="text-align:center">
\r
1167 _______________________________________________________
\r
1169 <div class="paragraph"><p><a id="p_Rgt"></a></p></div>
\r
1171 <div class="sect2">
\r
1172 <h3 id="_word_r_gt">Word: R></h3>
\r
1173 <div class="literalblock">
\r
1174 <div class="content">
\r
1175 <pre><code>Data stack: ( -- v ) Return stack: ( v -- )</code></pre>
\r
1177 <div class="paragraph"><p>"R>" is a function word that "moves" the top return stack value onto
\r
1178 the data stack.</p></div>
\r
1179 <div style="text-align:center">
\r
1180 _______________________________________________________
\r
1182 <div class="paragraph"><p><a id="p_abs"></a></p></div>
\r
1184 <div class="sect2">
\r
1185 <h3 id="_word_abs">Word: ABS</h3>
\r
1186 <div class="literalblock">
\r
1187 <div class="content">
\r
1188 <pre><code>Data stack: ( v1 -- v2 )</code></pre>
\r
1190 <div class="paragraph"><p>"ABS" is a function word that replaces a value with its absolute
\r
1191 value. To that end, the values are 64-bit signed integers.</p></div>
\r
1192 <div style="text-align:center">
\r
1193 _______________________________________________________
\r
1195 <div class="paragraph"><p><a id="p_again"></a></p></div>
\r
1197 <div class="sect2">
\r
1198 <h3 id="_word_again">Word: AGAIN</h3>
\r
1199 <div class="literalblock">
\r
1200 <div class="content">
\r
1201 <pre><code>Data stack: Compiling: ( -- a )</code></pre>
\r
1203 <div class="paragraph"><p>"AGAIN" is an immediate function word that is used together with
\r
1204 <a href="#p_begin">BEGIN</a> and instead of <a href="#p_end">END</a> to implement structured
\r
1205 execution control. AGAIN scans the datastack for the nearest preceding
\r
1206 BEGIN marker and lays out an unconditional branch from this point the
\r
1207 beginning of the block during execution. It thereafter performs the
\r
1208 <a href="#p_end">END</a> compile action to end the block.</p></div>
\r
1209 <div style="text-align:center">
\r
1210 _______________________________________________________
\r
1212 <div class="paragraph"><p><a id="p_allot"></a></p></div>
\r
1214 <div class="sect2">
\r
1215 <h3 id="_word_allot">Word: ALLOT</h3>
\r
1216 <div class="literalblock">
\r
1217 <div class="content">
\r
1218 <pre><code>Data stack: ( n -- )</code></pre>
\r
1220 <div class="paragraph"><p>"ALLOT" is a function word that merely increments the <a href="#p_here">HERE</a>
\r
1221 variable with <code>n</code> so as to claim that amount of the heap.</p></div>
\r
1222 <div class="exampleblock">
\r
1223 <div class="content">
\r
1224 <div class="sidebarblock">
\r
1225 <div class="content">
\r
1226 <div class="title">Defintion concept for ALLOT</div>
\r
1227 <div class="paragraph"><p>( n — ) : ALLOT HERE @ + HERE ! ;</p></div>
\r
1230 <div class="exampleblock">
\r
1231 <div class="content">
\r
1232 <div class="paragraph"><div class="title">Usage example 1: claim 16 bytes for variable FOO</div><p>CREATE FOO DROP HERE @ 16 ALLOT</p></div>
\r
1234 <div style="text-align:center">
\r
1235 _______________________________________________________
\r
1237 <div class="paragraph"><p><a id="p_and"></a></p></div>
\r
1239 <div class="sect2">
\r
1240 <h3 id="_word_and">Word: AND</h3>
\r
1241 <div class="literalblock">
\r
1242 <div class="content">
\r
1243 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
1245 <div class="paragraph"><p>"AND" is a function word that replaces a value pair with their bitwise
\r
1246 conjunction; each bit is 1 if the corresponding bits of both operands
\r
1247 are 1 and 0 if not.</p></div>
\r
1248 <div style="text-align:center">
\r
1249 _______________________________________________________
\r
1251 <div class="paragraph"><p><a id="p_args"></a></p></div>
\r
1253 <div class="sect2">
\r
1254 <h3 id="_word_main_args">Word: MAIN-ARGS</h3>
\r
1255 <div class="literalblock">
\r
1256 <div class="content">
\r
1257 <pre><code>Data stack: ( -- p[argv** argc] )</code></pre>
\r
1259 <div class="paragraph"><p>"ARGS" is a value word that holds a pointer to the command line data
\r
1260 block which consists of a count cell followed by that many asciiz
\r
1261 pointers and then a 0 cell.</p></div>
\r
1262 <div class="exampleblock">
\r
1263 <div class="content">
\r
1264 <div class="listingblock">
\r
1265 <div class="title">Usage example 2: the command line argument block</div>
\r
1266 <div class="content">
\r
1267 <pre><code>ARGS -> 8 bytes: count of non-zero asciiz pointers following
\r
1268 8 bytes: command name string
\r
1269 8 bytes: first argument string
\r
1271 8 zero</code></pre>
\r
1274 <div style="text-align:center">
\r
1275 _______________________________________________________
\r
1277 <div class="paragraph"><p><a id="p_base"></a></p></div>
\r
1279 <div class="sect2">
\r
1280 <h3 id="_word_base">Word: BASE</h3>
\r
1281 <div class="literalblock">
\r
1282 <div class="content">
\r
1283 <pre><code>Data stack: ( -- a )</code></pre>
\r
1285 <div class="paragraph"><p>"BASE" is a variable word for the numerical base used by input and
\r
1286 output functions, <a href="#p_number">NUMBER</a> and <a href="#p_dot">[p_dot]</a>, when
\r
1287 translating numbers between cell value form and text form. The
\r
1288 numerical base is set to 10 or 16 by <a href="#p_decimal">DECIMAL</a> and
\r
1289 <a href="#p_hex">HEX</a> respectively, and those are the only two bases currently
\r
1290 supported.</p></div>
\r
1291 <div class="paragraph"><p>See also <a href="#p_digits">DIGITS</a>, which holds the mapping table from
\r
1292 digits to text.</p></div>
\r
1293 <div style="text-align:center">
\r
1294 _______________________________________________________
\r
1296 <div class="paragraph"><p><a id="p_begin"></a></p></div>
\r
1298 <div class="sect2">
\r
1299 <h3 id="_word_begin">Word: BEGIN</h3>
\r
1300 <div class="literalblock">
\r
1301 <div class="content">
\r
1302 <pre><code>Data stack: Compiling: ( -- a 0 )</code></pre>
\r
1304 <div class="paragraph"><p>"BEGIN" is an immediate function word that is used together with
\r
1305 <a href="#p_ifbreak">IFBREAK</a>, <a href="#p_ifagain">IFAGAIN</a> and <a href="#p_end">END</a> to
\r
1306 implement structured execution control. BEGIN simply places the
\r
1307 address for resolving branches back to this point during execution,
\r
1308 and then a 0 as a marker so as to allow for an unknown number of block
\r
1309 exit points.</p></div>
\r
1310 <div class="exampleblock">
\r
1311 <div class="content">
\r
1312 <div class="listingblock">
\r
1313 <div class="title">Usage example 3:</div>
\r
1314 <div class="content">
\r
1315 <pre><code>: WTELL ( tfa -- ; Print word pname )
\r
1316 24 + DUP 8 + SWAP @ TELL SP EMIT
\r
1319 : WORDS ( wordlist -- ; Print all words of word list )
\r
1329 <div style="text-align:center">
\r
1330 _______________________________________________________
\r
1332 <div class="paragraph"><p><a id="p_bracketed_quote"></a></p></div>
\r
1334 <div class="sect2">
\r
1335 <h3 id="_word">Word: [']</h3>
\r
1336 <div class="literalblock">
\r
1337 <div class="content">
\r
1338 <pre><code>Data stack: ( -- cfa ) Input stream: word</code></pre>
\r
1340 <div class="paragraph"><p>"[']" is an immediate function word that reads the next word on the
\r
1341 input stream and pushes its cfa.</p></div>
\r
1342 <div class="exampleblock">
\r
1343 <div class="content">
\r
1344 <div class="sidebarblock">
\r
1345 <div class="content">
\r
1346 <div class="title">Definition concept for [']</div>
\r
1347 <div class="paragraph"><p>: ['] IMMEDIATE ' ;</p></div>
\r
1350 <div style="text-align:center">
\r
1351 _______________________________________________________
\r
1353 <div class="paragraph"><p><a id="p_branch"></a></p></div>
\r
1355 <div class="sect2">
\r
1356 <h3 id="_word_branch">Word: BRANCH</h3>
\r
1357 <div class="literalblock">
\r
1358 <div class="content">
\r
1359 <pre><code>Data stack: ( -- )</code></pre>
\r
1361 <div class="paragraph"><p>"BRANCH" is a function word that implements execution transfer by
\r
1362 means of adding the subsequent branch offset to the point of
\r
1363 execution.</p></div>
\r
1364 <div class="paragraph"><p>Note that the branch offset is a byte count and each FORTH word of a
\r
1365 definition take up a cell of 8 bytes. The offset is relative to the
\r
1366 cell address immediately subsequent to the offset cell. In other
\r
1367 words, offset 0 is not branching anywhere and an offset of -16 would
\r
1368 make a tight loop back to the branch instruction itself. The latter
\r
1369 would pull data stack values until and including the first zero value.</p></div>
\r
1370 <div class="paragraph"><p>See also <a href="#p_0branch">0BRANCH</a>, <a href="#p_1branch">1BRANCH</a>, <a href="#p_if">IF</a>,
\r
1371 <a href="#p_else">ELSE</a>, <a href="#p_ifbreak">IFBREAK</a> and <a href="#p_ifagain">IFAGAIN</a>.</p></div>
\r
1372 <div style="text-align:center">
\r
1373 _______________________________________________________
\r
1375 <div class="paragraph"><p><a id="p_break"></a></p></div>
\r
1377 <div class="sect2">
\r
1378 <h3 id="_word_break">Word: BREAK</h3>
\r
1379 <div class="paragraph"><p>"BREAK" is an immediate function word that lays out an unconditional
\r
1380 branch out of an enclosing xef:p_begin[BEGIN]-<a href="#p_end">END</a> block.
\r
1381 Similar to <a href="#p_ifbreak">IFBREAK</a> it lays out the branch cell
\r
1382 followed by a reserved cell for the branch offset, and inserts the
\r
1383 resolution address just above the required 0 on the data stack.</p></div>
\r
1384 <div class="exampleblock">
\r
1385 <div class="content">
\r
1386 <div class="listingblock">
\r
1387 <div class="title">Usage example 4: unconditional break with a condition.</div>
\r
1388 <div class="content">
\r
1389 <pre><code>: WTELL ( tfa -- ; Print word pname )
\r
1390 24 + DUP 8 + SWAP @ TELL SP EMIT
\r
1393 : WORDS ( wordlist -- ; Print all words of word list )
\r
1395 @ DUP IF DUP WTELL ELSE BREAK THEN
\r
1403 <div class="paragraph"><p>See also <a href="#p_branch">BRANCH</a>, <a href="#p_0branch">0BRANCH</a>,
\r
1404 <a href="#p_1branch">1BRANCH</a>, <a href="#p_if">IF</a>, <a href="#p_else">ELSE</a>,
\r
1405 <a href="#p_ifbreak">IFBREAK</a> and <a href="#p_ifagain">IFAGAIN</a>.</p></div>
\r
1406 <div style="text-align:center">
\r
1407 _______________________________________________________
\r
1409 <div class="paragraph"><p><a id="p_calltrace"></a></p></div>
\r
1411 <div class="sect2">
\r
1412 <h3 id="_word_calltrace">Word: [calltrace]</h3>
\r
1413 <div class="paragraph"><p>"[calltrace]" is a variable word that ccontains a small assembly
\r
1414 snippet that may be used for debugging when running under <code>gdb</code>.</p></div>
\r
1415 <div style="text-align:center">
\r
1416 _______________________________________________________
\r
1418 <div class="paragraph"><p><a id="p_cfa2flags_get"></a></p></div>
\r
1420 <div class="sect2">
\r
1421 <h3 id="_word_cfa_gt_flags">Word: CFA>FLAGS@</h3>
\r
1422 <div class="literalblock">
\r
1423 <div class="content">
\r
1424 <pre><code>Data stack: ( cfa -- flags )</code></pre>
\r
1426 <div class="paragraph"><p>"CFA>FLAGS@" is a function word that pushes word flags of the given cfa.</p></div>
\r
1427 <div class="exampleblock">
\r
1428 <div class="content">
\r
1429 <div class="sidebarblock">
\r
1430 <div class="content">
\r
1431 <div class="title">Defintion concept for CFA>FLAGS@</div>
\r
1432 <div class="paragraph"><p>: CFA>FLAGS@ 16 - @ 16 + ;</p></div>
\r
1435 <div style="text-align:center">
\r
1436 _______________________________________________________
\r
1438 <div class="paragraph"><p><a id="p_clear_stream"></a></p></div>
\r
1440 <div class="sect2">
\r
1441 <h3 id="_word_clear_stream">Word: CLEAR-STREAM</h3>
\r
1442 <div class="literalblock">
\r
1443 <div class="content">
\r
1444 <pre><code>Data stack: ( stream -- )</code></pre>
\r
1446 <div class="paragraph"><p>"CLEAR-STREAM" is a function word that discards whatever is currently
\r
1447 remaining in the buffer for the stream, so that a subsequent read will
\r
1448 pull in more data from its source.</p></div>
\r
1449 <div class="paragraph"><p>See also <a href="#p_read_stream_char">READ-STREAM-CHAR</a>.</p></div>
\r
1450 <div style="text-align:center">
\r
1451 _______________________________________________________
\r
1453 <div class="paragraph"><p><a id="p_colon"></a></p></div>
\r
1455 <div class="sect2">
\r
1456 <h3 id="_word_3">Word: :</h3>
\r
1457 <div class="literalblock">
\r
1458 <div class="content">
\r
1459 <pre><code>Data stack: ( -- ) Input stream: word</code></pre>
\r
1461 <div class="paragraph"><p>":" (colon) is a function word that starts a new forth definition.
\r
1462 This includes reading the next word for making a new dictionary entry
\r
1463 and setting evaluation state to compiling mode.</p></div>
\r
1464 <div class="exampleblock">
\r
1465 <div class="content">
\r
1466 <div class="sidebarblock">
\r
1467 <div class="content">
\r
1468 <div class="title">Definition concept for :</div>
\r
1469 <div class="paragraph"><p>: : doFORTH READ-WORD CREATE TFA>CFA ! ] ;</p></div>
\r
1472 <div class="paragraph"><p>See also <a href="#p_doforth">doFORTH</a>, <a href="#p_read_word">READ-WORD</a>,
\r
1473 <a href="#p_create">CREATE</a>, <a href="#p_tfa2cfa">TFA>CFA</a>, <a href="#p_put">!</a>,
\r
1474 <a href="#p_left_bracket">]</a> and <a href="#p_semicolon">;</a>.</p></div>
\r
1475 <div style="text-align:center">
\r
1476 _______________________________________________________
\r
1478 <div class="paragraph"><p><a id="p_comma"></a></p></div>
\r
1480 <div class="sect2">
\r
1481 <h3 id="_word_4">Word: ,</h3>
\r
1482 <div class="literalblock">
\r
1483 <div class="content">
\r
1484 <pre><code>Data stack: ( v -- )</code></pre>
\r
1486 <div class="paragraph"><p>"," (comma) is a function word that puts a cell value on the
\r
1487 <a href="#p_here">HERE</a> heap.</p></div>
\r
1488 <div class="exampleblock">
\r
1489 <div class="content">
\r
1490 <div class="sidebarblock">
\r
1491 <div class="content">
\r
1492 <div class="title">Definition concept for ,</div>
\r
1493 <div class="paragraph"><p>: , HERE @ 8 ALLOT ! ; ( v — ; Claim 8 bytes and put value there )</p></div>
\r
1496 <div class="paragraph"><p>See also <a href="#p_colon">:</a>, <a href="#p_Ccomma">[p_Ccomma]</a>. <a href="#p_here">HERE</a>, <a href="#p_get">@</a>,
\r
1497 <a href="#p_allot">ALLOT</a>, <a href="#p_put">!</a> and <a href="#p_semicolon">;</a>.</p></div>
\r
1498 <div style="text-align:center">
\r
1499 _______________________________________________________
\r
1501 <div class="paragraph"><p><a id="p_create"></a></p></div>
\r
1503 <div class="sect2">
\r
1504 <h3 id="_word_create">Word: CREATE</h3>
\r
1505 <div class="literalblock">
\r
1506 <div class="content">
\r
1507 <pre><code>Data stack: ( char* n -- tfa )</code></pre>
\r
1509 <div class="paragraph"><p>"CREATE" is a function word that allocates a "word header" with the
\r
1510 indicated [n:char*] print name, and returns the "TFA" (Token Field
\r
1511 Address) of the word. The header memory layout is as follows:</p></div>
\r
1512 <div class="exampleblock">
\r
1513 <div class="content">
\r
1514 <div class="listingblock">
\r
1515 <div class="title">Layout 1: rrqforth word structure</div>
\r
1516 <div class="content">
\r
1517 <pre><code>struct WORD
\r
1518 TFA 8 link ; tfa of previous word
\r
1519 pCFA 8 cfap ; CFA = Code Field Address of this word
\r
1521 PFA 8 length ; length of pname representation
\r
1522 ? pname ; the pname bytes
\r
1523 1 nul ; a forced nul byte following the pname
\r
1524 pTFA 8 tfap ; TFA = Token Field Address of this word
\r
1525 OFF 8 doff ; entry offset for FORTH level execution
\r
1526 CFA 8 doer ; word execution semantics
\r
1527 DFA 0 content ; DFA = Data Field Address
\r
1528 end_struct</code></pre>
\r
1531 <div class="paragraph"><p>A "word" is generally understod as a marker in memory for some content
\r
1532 as held in the memory space following the DFA (Data Field Address).</p></div>
\r
1533 <div class="paragraph"><p>The words CFA (Code Field Address) is the most important field for
\r
1534 RRQFORTH execution, as holding a jump address to the assembly code
\r
1535 that implements the particular execution semantics for the word.
\r
1536 "CREATE" will assign this as "dovariable", which makes the word push
\r
1537 its DFA when executed. This is changed to "doforth" for RRQFORTH
\r
1538 function words initiated by ":" (aka "COLON") or changed to "dovalue"
\r
1539 for RRQFORTH constants created by "CONSTANT".</p></div>
\r
1540 <div class="exampleblock">
\r
1541 <div class="content">
\r
1542 <div class="sidebarblock">
\r
1543 <div class="content">
\r
1544 <div class="title">Definition concept for CREATE</div>
\r
1545 <div class="paragraph"><p>HERE @ R> ( save tfa on RS )
\r
1546 R@ CURRENT-WORD @ DUP @ , ! ( link in a new word )
\r
1547 DUP 49 + R@ + , ( pCFA )
\r
1550 HERE @ ROT ROT MEMCPY 0 C, ( pname + NUL )
\r
1553 doVARIABLE ( CFA, default semantics )</p></div>
\r
1556 <div class="exampleblock">
\r
1557 <div class="content">
\r
1558 <div class="listingblock">
\r
1559 <div class="title">Usage example 5: a possible definition of CONSTANT</div>
\r
1560 <div class="content">
\r
1561 <pre><code>: CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ;</code></pre>
\r
1564 <div class="paragraph"><p>See also <a href="#p_put">!</a>, <a href="#p_plus">+</a>, <a href="#p_comma">[p_comma]</a>, <a href="#p_get">@</a>,
\r
1565 <a href="#p_Ccomma">[p_Ccomma]</a>, <a href="#p_current_word">CURRENT-WORD</a>, <a href="#p_dup">DUP</a>,
\r
1566 <a href="#p_here">HERE</a>, <a href="#p_herememcpy">HERE</a>, <a href="#p_Rget">R@</a>, <a href="#p_rot">ROT</a>,
\r
1567 and <a href="#p_dovariable">doVARIABLE</a>,
\r
1568 as well as <a href="#p_execute">EXECUTE</a>
\r
1569 about the range of "doer" assignments and their meanings.</p></div>
\r
1570 <div style="text-align:center">
\r
1571 _______________________________________________________
\r
1573 <div class="paragraph"><p><a id="p_current_wordlist"></a></p></div>
\r
1575 <div class="sect2">
\r
1576 <h3 id="_word_current_wordlist">Word: CURRENT-WORDLIST</h3>
\r
1577 <div class="literalblock">
\r
1578 <div class="content">
\r
1579 <pre><code>Data stack: ( -- a )</code></pre>
\r
1581 <div class="paragraph"><p>"CURRENT-WORDLIST" is a variable word that points out the DFA of the
\r
1582 current word list word for <a href="#p_find">FIND</a> to use finding words. The
\r
1583 word list word content is as follows:</p></div>
\r
1584 <div class="exampleblock">
\r
1585 <div class="content">
\r
1586 <div class="listingblock">
\r
1587 <div class="title">Layout 2: word list word content</div>
\r
1588 <div class="content">
\r
1589 <pre><code> 8 TFA of latest word in the word list
\r
1590 8 DFA of the/a subsequent word list to search through</code></pre>
\r
1593 <div class="paragraph"><p>Note that word lists are chained by "extension" and in general it ends
\r
1594 with the <a href="#p_forth">FORTH</a> word list. Initially the
\r
1595 <a href="#p_system">SYSTEM</a> word list is the only other word list.</p></div>
\r
1596 <div style="text-align:center">
\r
1597 _______________________________________________________
\r
1599 <div class="paragraph"><p><a id="data_stack"></a></p></div>
\r
1601 <div class="sect2">
\r
1602 <h3 id="_word_data_stack">Word: DATA-STACK</h3>
\r
1603 <div class="literalblock">
\r
1604 <div class="content">
\r
1605 <pre><code>Data stack: ( -- a )</code></pre>
\r
1607 <div class="paragraph"><p>"DATA-STACK" is a variable word that harbours the data stack.</p></div>
\r
1608 <div style="text-align:center">
\r
1609 _______________________________________________________
\r
1611 <div class="paragraph"><p><a id="p_decimal"></a></p></div>
\r
1613 <div class="sect2">
\r
1614 <h3 id="_word_decimal">Word: DECIMAL</h3>
\r
1615 <div class="literalblock">
\r
1616 <div class="content">
\r
1617 <pre><code>Data stack: ( -- )</code></pre>
\r
1619 <div class="paragraph"><p>"DECIMAL" is a function word that sets <a href="#p_base">BASE</a> to 10.</p></div>
\r
1620 <div class="exampleblock">
\r
1621 <div class="content">
\r
1622 <div class="sidebarblock">
\r
1623 <div class="content">
\r
1624 <div class="title">Definition concept for DECIMAL</div>
\r
1625 <div class="paragraph"><p>: DECIMAL 10 BASE ! ;</p></div>
\r
1628 <div style="text-align:center">
\r
1629 _______________________________________________________
\r
1631 <div class="paragraph"><p><a id="p_depth"></a></p></div>
\r
1633 <div class="sect2">
\r
1634 <h3 id="_word_depth">Word: DEPTH</h3>
\r
1635 <div class="literalblock">
\r
1636 <div class="content">
\r
1637 <pre><code>Data stack: ( -- v )</code></pre>
\r
1639 <div class="paragraph"><p>"DEPTH" is a function word that pushes the count of data stack cells
\r
1640 onto the data stack.</p></div>
\r
1641 <div style="text-align:center">
\r
1642 _______________________________________________________
\r
1644 <div class="paragraph"><p><a id="p_dfa2tfa"></a></p></div>
\r
1646 <div class="sect2">
\r
1647 <h3 id="_word_dfa_gt_tfa">Word: DFA>TFA</h3>
\r
1648 <div class="literalblock">
\r
1649 <div class="content">
\r
1650 <pre><code>Data stack: ( dfa -- tfa )</code></pre>
\r
1652 <div class="paragraph"><p>"DFA>TFA" is a function word that pushes word tfa of the given dfa.</p></div>
\r
1653 <div class="exampleblock">
\r
1654 <div class="content">
\r
1655 <div class="sidebarblock">
\r
1656 <div class="content">
\r
1657 <div class="title">Definition concept for DFA>TFA</div>
\r
1658 <div class="paragraph"><p>: DFA>TFA 24 - @ ;</p></div>
\r
1661 <div style="text-align:center">
\r
1662 _______________________________________________________
\r
1664 <div class="paragraph"><p><a id="p_digits"></a></p></div>
\r
1666 <div class="sect2">
\r
1667 <h3 id="_word_digits">Word: DIGITS</h3>
\r
1668 <div class="literalblock">
\r
1669 <div class="content">
\r
1670 <pre><code>Data stack: ( -- a )</code></pre>
\r
1672 <div class="paragraph"><p>"DIGITS" is a variable word that holds the character array for mapping
\r
1673 digit values to characters. It contains the 16 characters 0-9 and a-f.</p></div>
\r
1674 <div style="text-align:center">
\r
1675 _______________________________________________________
\r
1677 <div class="paragraph"><p><a id="p_div"></a></p></div>
\r
1679 <div class="sect2">
\r
1680 <h3 id="_word_5">Word: /</h3>
\r
1681 <div class="literalblock">
\r
1682 <div class="content">
\r
1683 <pre><code>Data stack: ( v1 v2 -- q )</code></pre>
\r
1685 <div class="paragraph"><p>"/" (div) is a function word that replaces a pair of values with the
\r
1686 results of signed integer division of the first, v1, divided by the
\r
1687 second, v2. To that end, the values are 64-bit signed integers. The
\r
1688 result is the integer quotient, q, and the discarded remainder, r,
\r
1689 where q and r are the respectively largest and smallest integers to
\r
1690 satisfy the formula:</p></div>
\r
1691 <div class="literalblock">
\r
1692 <div class="content">
\r
1693 <pre><code> v1 = q * v2 + r</code></pre>
\r
1695 <div style="text-align:center">
\r
1696 _______________________________________________________
\r
1698 <div class="paragraph"><p><a id="p_divmod"></a></p></div>
\r
1700 <div class="sect2">
\r
1701 <h3 id="_word_mod">Word: /MOD</h3>
\r
1702 <div class="literalblock">
\r
1703 <div class="content">
\r
1704 <pre><code>Data stack: ( v1 v2 -- q r )</code></pre>
\r
1706 <div class="paragraph"><p>"/MOD" (div-mod) is a function word that replaces a pair of values
\r
1707 with the results of signed integer division of the first, v1, divided
\r
1708 by the second, v2. To that end, the values are 64-bit signed integers.
\r
1709 The result is the integer quotient, q, and the remainder, r, where q
\r
1710 and r are the respectively largest and smallest integers to satisfy
\r
1711 the formula:</p></div>
\r
1712 <div class="literalblock">
\r
1713 <div class="content">
\r
1714 <pre><code> v1 = q * v2 + r</code></pre>
\r
1716 <div style="text-align:center">
\r
1717 _______________________________________________________
\r
1719 <div class="paragraph"><p><a id="p_dodoes"></a></p></div>
\r
1721 <div class="sect2">
\r
1722 <h3 id="_word_dodoes">Word: doDOES</h3>
\r
1723 <div class="literalblock">
\r
1724 <div class="content">
\r
1725 <pre><code>Data stack: ( -- a )</code></pre>
\r
1727 <div class="paragraph"><p>"doDOES" is a variable word whose value is the implementation of the
\r
1728 <a href="#p_does">[p_does]</a> execution semantics. This is the same as
\r
1729 <a href="#p_doforth">doFORTH</a> but it starts at an offset into the word
\r
1730 concerned.</p></div>
\r
1731 <div style="text-align:center">
\r
1732 _______________________________________________________
\r
1734 <div class="paragraph"><p><a id="p_does"></a></p></div>
\r
1736 <div class="sect2">
\r
1737 <h3 id="_word_does_gt">WORD: DOES></h3>
\r
1738 <div class="literalblock">
\r
1739 <div class="content">
\r
1740 <pre><code>Data stack: ( -- )</code></pre>
\r
1742 <div class="paragraph"><p>"DOES>" is a function that in execution mode does nothing but in
\r
1743 compilation mode it changes the execution semantics assignments for
\r
1744 the most recent word to use the <code>dodoes</code> sematics with adjustment
\r
1745 offset to the current heap address. I.e., the word being defined will
\r
1746 have its execution start at whatever comes after "DOES>".</p></div>
\r
1747 <div class="exampleblock">
\r
1748 <div class="content">
\r
1749 <div class="sidebarblock">
\r
1750 <div class="content">
\r
1751 <div class="title">Defintion concept for DOES></div>
\r
1752 <div class="paragraph"><p>: DOES> IMMEDIATE
\r
1753 STATE @ != IF ( only for compilation mode )
\r
1754 CURRENT-WORDLIST @ @ TFA>CFA ( cfa of current word )
\r
1755 doDOES OVER ! ( set up doer )
\r
1756 HERE @ OVER 8 + - SWAP 8 - ! ( set up offset
\r
1761 <div class="paragraph"><p>See also
\r
1762 <a href="#p_put">!</a>,
\r
1763 <a href="#p_unequal">!⇒></a>,
\r
1764 <a href="#p_minus">→></a>,
\r
1765 <a href="#p_get">@</a>,
\r
1766 <a href="#p_current_wordlist">CURRENT-WORDLIST</a>,
\r
1767 <a href="#p_here">HERE</a>,
\r
1768 <a href="#p_if">IF</a>,
\r
1769 <a href="#p_immediate">IMMEDIATE</a>,
\r
1770 <a href="#p_over">OVER</a>,
\r
1771 <a href="#p_state">STATE</a>,
\r
1772 <a href="#p_swap">SWAP</a>,
\r
1773 <a href="#p_tfa2cfa">TFA>CFA</a>,
\r
1774 <a href="#p_then">THEN</a>,
\r
1775 <a href="#p_dodoes">doDOES</a>,
\r
1776 as well as <a href="#p_execute">EXECUTE</a>
\r
1777 about the range of "doer" assignments and their meanings.</p></div>
\r
1778 <div style="text-align:center">
\r
1779 _______________________________________________________
\r
1781 <div class="paragraph"><p><a id="p_dofasm"></a></p></div>
\r
1783 <div class="sect2">
\r
1784 <h3 id="_word_dofasm">Word: doFASM</h3>
\r
1785 <div class="literalblock">
\r
1786 <div class="content">
\r
1787 <pre><code>Data stack: ( -- a )</code></pre>
\r
1789 <div class="paragraph"><p>"doFASM" is a variable word whose value is the implementation of the
\r
1790 execution semantics for assembly code content.</p></div>
\r
1791 <div style="text-align:center">
\r
1792 _______________________________________________________
\r
1794 <div class="paragraph"><p><a id="p_doforth"></a></p></div>
\r
1796 <div class="sect2">
\r
1797 <h3 id="_word_doforth">Word: doFORTH</h3>
\r
1798 <div class="literalblock">
\r
1799 <div class="content">
\r
1800 <pre><code>Data stack: ( -- a )</code></pre>
\r
1802 <div class="paragraph"><p>"doFORTH" is a variable word whose value is the implementation of the
\r
1803 RRQFORTH execution semantics.</p></div>
\r
1804 <div style="text-align:center">
\r
1805 _______________________________________________________
\r
1807 <div class="paragraph"><p><a id="p_dostring"></a></p></div>
\r
1809 <div class="sect2">
\r
1810 <h3 id="_word_dostring">Word: doSTRING</h3>
\r
1811 <div class="literalblock">
\r
1812 <div class="content">
\r
1813 <pre><code>Data stack: ( -- a )</code></pre>
\r
1815 <div class="paragraph"><p>"doFASM" is a variable word whose value is the implementation of the
\r
1816 execution semantics for assembly code implemented words. In those
\r
1817 cases the execution leads to the word content.</p></div>
\r
1818 <div class="paragraph"><p>The register context at entry to an assembly code implemented word is
\r
1819 as follows:</p></div>
\r
1820 <div class="listingblock">
\r
1821 <div class="content">
\r
1822 <pre><code> rax = cfa* of word to execute
\r
1823 rsi = cell* in the calling definition, after calling cell
\r
1824 rsp = data stack pointer
\r
1825 rbp = return stack pointer</code></pre>
\r
1827 <div class="paragraph"><p>The assembly code must ensure that <code>rsi</code> is preserved and that <code>rsp</code>
\r
1828 and <code>rbp</code> are used according to their roles.</p></div>
\r
1829 <div style="text-align:center">
\r
1830 _______________________________________________________
\r
1832 <div class="paragraph"><p><a id="p_dot"></a></p></div>
\r
1834 <div class="sect2">
\r
1835 <h3 id="_word_6">Word: .</h3>
\r
1836 <div class="literalblock">
\r
1837 <div class="content">
\r
1838 <pre><code>Data stack: ( v -- )</code></pre>
\r
1840 <div class="paragraph"><p>"." is a function word that prints the top stack value to stdout using
\r
1841 the current <a href="#p_base">BASE</a> (either <a href="#p_decimal">DECIMAL</a> or
\r
1842 <a href="#p_hex">HEX</a>).</p></div>
\r
1843 <div style="text-align:center">
\r
1844 _______________________________________________________
\r
1846 <div class="paragraph"><p><a id="p_double_quote"></a></p></div>
\r
1848 <div class="sect2">
\r
1849 <h3 id="_word_7">Word: "</h3>
\r
1850 <div class="literalblock">
\r
1851 <div class="content">
\r
1852 <pre><code>data stack: ( -- char n ) Input stream: ...."</code></pre>
\r
1854 <div class="paragraph"><p>""" (double quote) is a function word that copies the input stream
\r
1855 text up to next double quote to <a href="#p_pad">PAD</a>, and returns the
\r
1856 [n:char*] cell pair for that string.</p></div>
\r
1857 <div style="text-align:center">
\r
1858 _______________________________________________________
\r
1860 <div class="paragraph"><p><a id="p_dovalue"></a></p></div>
\r
1862 <div class="sect2">
\r
1863 <h3 id="_word_dovalue">Word: doVALUE</h3>
\r
1864 <div class="literalblock">
\r
1865 <div class="content">
\r
1866 <pre><code>Data stack: ( -- a )</code></pre>
\r
1868 <div class="paragraph"><p>"doVALUE" is a variable word whose value is the implementation of the
\r
1869 execution semantics for cell values, which are variables with a single
\r
1870 64-bit cell holding the value.</p></div>
\r
1871 <div class="paragraph"><p>The execution of this result in pushing the value:</p></div>
\r
1872 <div class="literalblock">
\r
1873 <div class="content">
\r
1874 <pre><code>Resulting data stack: ( -- v )</code></pre>
\r
1876 <div style="text-align:center">
\r
1877 _______________________________________________________
\r
1879 <div class="paragraph"><p><a id="p_dovariable"></a></p></div>
\r
1881 <div class="sect2">
\r
1882 <h3 id="_word_dovariable">Word: doVARIABLE</h3>
\r
1883 <div class="literalblock">
\r
1884 <div class="content">
\r
1885 <pre><code>Data stack: ( -- a )</code></pre>
\r
1887 <div class="paragraph"><p>"doVARIABLE" is a variable word whose value is the implementation of
\r
1888 the execution semantics for "variables", which basically are markers
\r
1889 into the heap for some number block of memory.</p></div>
\r
1890 <div class="paragraph"><p>The execution of a variable results in pushing its content address:</p></div>
\r
1891 <div class="literalblock">
\r
1892 <div class="content">
\r
1893 <pre><code>Resulting data stack: ( -- a )</code></pre>
\r
1895 <div style="text-align:center">
\r
1896 _______________________________________________________
\r
1898 <div class="paragraph"><p><a id="p_drop"></a></p></div>
\r
1900 <div class="sect2">
\r
1901 <h3 id="_word_drop">Word: DROP</h3>
\r
1902 <div class="literalblock">
\r
1903 <div class="content">
\r
1904 <pre><code>Data stack: ( v -- )</code></pre>
\r
1906 <div class="paragraph"><p>"DROP" is a function word that discards the top stack cell.</p></div>
\r
1907 <div style="text-align:center">
\r
1908 _______________________________________________________
\r
1910 <div class="paragraph"><p><a id="p_dup"></a></p></div>
\r
1912 <div class="sect2">
\r
1913 <h3 id="_word_dup">Word: DUP</h3>
\r
1914 <div class="literalblock">
\r
1915 <div class="content">
\r
1916 <pre><code>Data stack: ( v -- v v )</code></pre>
\r
1918 <div class="paragraph"><p>"DUP" is a function word that duplicates the top stack cell.</p></div>
\r
1919 <div style="text-align:center">
\r
1920 _______________________________________________________
\r
1922 <div class="paragraph"><p><a id="p_else"></a></p></div>
\r
1924 <div class="sect2">
\r
1925 <h3 id="_word_else">Word: ELSE</h3>
\r
1926 <div class="literalblock">
\r
1927 <div class="content">
\r
1928 <pre><code>Data stack: Compiling: ( a -- a )</code></pre>
\r
1930 <div class="paragraph"><p>"ELSE" is an immediate function word that is used together with
\r
1931 <a href="#p_if">IF</a> and <a href="#p_then">THEN</a> to implement structured execution
\r
1932 control. ELSE lays out an unresolved unconditional branch as an ending
\r
1933 for the "then-part" of the structured statement, and it then performs
\r
1934 the branch resolution for the "else-part". To that end it replaces the
\r
1935 stacked address which pin-points the foot address the branch offset to
\r
1936 resolve, so that at execution time there is an appropriate conditional
\r
1937 branch past the "then-part" and the "else-part" of the "structured
\r
1938 statement".</p></div>
\r
1939 <div style="text-align:center">
\r
1940 _______________________________________________________
\r
1942 <div class="paragraph"><p><a id="p_emit"></a></p></div>
\r
1944 <div class="sect2">
\r
1945 <h3 id="_word_emit">Word: EMIT</h3>
\r
1946 <div class="literalblock">
\r
1947 <div class="content">
\r
1948 <pre><code>Data stack: ( c -- )</code></pre>
\r
1950 <div class="paragraph"><p>"EMIT" is a function word that puts the given character code to
\r
1951 standard output (file descriptor 1). The character is the least
\r
1952 significant byte of the top cell.</p></div>
\r
1953 <div style="text-align:center">
\r
1954 _______________________________________________________
\r
1956 <div class="paragraph"><p><a id="p_end"></a></p></div>
\r
1958 <div class="sect2">
\r
1959 <h3 id="_word_end">Word: END</h3>
\r
1960 <div class="literalblock">
\r
1961 <div class="content">
\r
1962 <pre><code>Data stack: Compiling: ( a 0 * -- )</code></pre>
\r
1964 <div class="paragraph"><p>"END" is an immediate function word that is used together with
\r
1965 <a href="#p_begin">BEGIN</a>, <a href="#p_ifbreak">IFBREAK</a> and <a href="#p_ifagain">IFAGAIN</a> to
\r
1966 implement structured execution control. END processes the data stack
\r
1967 to resolve any dangling <a href="#p_ifbreak">IFBREAK</a> branch offset for the
\r
1968 block of the matching <a href="#p_begin">BEGIN</a>.</p></div>
\r
1969 <div style="text-align:center">
\r
1970 _______________________________________________________
\r
1972 <div class="paragraph"><p><a id="p_equal"></a></p></div>
\r
1974 <div class="sect2">
\r
1975 <h3 id="_word_8">Word: =</h3>
\r
1976 <div class="literalblock">
\r
1977 <div class="content">
\r
1978 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
1980 <div class="paragraph"><p>"=" is a function word that replaces a pair of values with -1 of the
\r
1981 values are equal, and 0 otherwise.</p></div>
\r
1982 <div style="text-align:center">
\r
1983 _______________________________________________________
\r
1985 <div class="paragraph"><p><a id="p_erase"></a></p></div>
\r
1987 <div class="sect2">
\r
1988 <h3 id="_word_erase">Word: ERASE</h3>
\r
1989 <div class="literalblock">
\r
1990 <div class="content">
\r
1991 <pre><code>Data stack: ( a n -- )</code></pre>
\r
1993 <div class="paragraph"><p>"ERASE" is a function word that stores n NUL bytes at address a an up.</p></div>
\r
1994 <div style="text-align:center">
\r
1995 _______________________________________________________
\r
1997 <div class="paragraph"><p><a id="p_evaluate_stream"></a></p></div>
\r
1999 <div class="sect2">
\r
2000 <h3 id="_word_evaluate_stream">Word: EVALUATE-STREAM</h3>
\r
2001 <div class="literalblock">
\r
2002 <div class="content">
\r
2003 <pre><code>Data stack: ( stream -- ??? 0/1 ) Input stream: ......</code></pre>
\r
2005 <div class="paragraph"><p>"EVALUATE-STREAM" is a function word that reads words separated by
\r
2006 whitespace from the stream until it discovers an unknown word, or the
\r
2007 stream is exhausted. Depending on <a href="#p_state">STATE</a>, the words are
\r
2008 either executed or compiled, and all ther stack and heap effects are
\r
2009 preserved. "EVALUATE-STREAM" returns with an additional 0 or 1 on the
\r
2010 stack to respectively indicate that the last word was unkown, i.e. not
\r
2011 found (<a href="#p_find">FIND</a>) in the current word list
\r
2012 (<a href="#p_current_wordlist">CURRENT-WORDLIST</a>) and not a
\r
2013 <a href="#p_number">NUMBER</a> of the current <a href="#p_base">BASE</a>.</p></div>
\r
2014 <div class="paragraph"><p>Note that numbers in the current <a href="#p_base">BASE</a> are treated as known
\r
2015 words that are parsed into cell values. If interpreting, then the
\r
2016 value is left on the stack. If compiling, then the value is added to
\r
2017 the heap subsequent to first adding <a href="#p_literal">LIT</a>, which is done
\r
2018 so as to make that value be push to the data stack upon a later
\r
2019 execution.</p></div>
\r
2020 <div class="paragraph"><p>In the <a href="#p_decimal">DECIMAL</a> base, the number word may begin with a
\r
2021 minus sign.</p></div>
\r
2022 <div class="paragraph"><p>The words are read and executed one by one, accounting for whether its
\r
2023 a number word or not, whether it is an <a href="#p_immediate">IMMEDIATE</a> word
\r
2024 or not, and whether the state at the time of execution indicates
\r
2025 "compiling" of "interpreting". Immediate words are executed in both
\r
2026 interpreting and compiling state, while other words have their CFA get
\r
2027 added to the heap so as to gain their execution effect upon a later
\r
2028 execution.</p></div>
\r
2029 <div class="paragraph"><p>Note that "EVALUATE-STREAM" keeps the stream (pointer) on the return
\r
2030 stack while reading, parsing and executing.</p></div>
\r
2031 <div class="paragraph"><p>If "EVALUATE-STREAM" ends with 0, then <a href="#p_this_word">THIS-WORD</a> holds
\r
2032 the [n:chars] reference of the offending word in the stream buffer.</p></div>
\r
2033 <div style="text-align:center">
\r
2034 _______________________________________________________
\r
2036 <div class="paragraph"><p><a id="p_execute"></a></p></div>
\r
2038 <div class="sect2">
\r
2039 <h3 id="_word_execute">Word: EXECUTE</h3>
\r
2040 <div class="literalblock">
\r
2041 <div class="content">
\r
2042 <pre><code>Data stack: ( cfa -- )</code></pre>
\r
2044 <div class="paragraph"><p>"EXECUTE" is a function word that transfers the execution to the
\r
2045 indicated "Code Field Address", which typically is the CFA of an
\r
2046 RRQFORTH word with the CFA cell containing a jump address for the code
\r
2047 that implements the execution semnatics of the word.</p></div>
\r
2048 <div class="paragraph"><p>The following execution semantics are predefined:</p></div>
\r
2049 <div class="ulist"><ul>
\r
2052 assembler implemented words constitute their own execution
\r
2058 <a href="#p_doforth">[p_doforth]</a> implements the FORTH machine. This treats the word
\r
2059 content as a succession of cells that hold the cfa pointers for the
\r
2060 words that make of the definition. As is customary in FORTH
\r
2061 machines, the advance through that succession is provided by each
\r
2062 word code ending making an explicit jump to its successor. The
\r
2063 <a href="#p_return_stack">RETURN-STACK</a> serves as a call stack for tracking
\r
2064 the nesting of FORTH executions by saving the "addresses" of the
\r
2070 <a href="#p_dodoes">[p_dodoes]</a> implements the variation of starting the FORTH
\r
2071 execution somewhere within a definition rather than at the
\r
2077 <a href="#p_dostring">[p_dostring]</a>, <a href="#p_dovalue">[p_dovalue]</a> and <a href="#p_dovariable">[p_dovariable]</a> implement
\r
2078 different common ways of using word content other the as FORTH
\r
2083 <div style="text-align:center">
\r
2084 _______________________________________________________
\r
2086 <div class="paragraph"><p><a id="p_exit"></a></p></div>
\r
2088 <div class="sect2">
\r
2089 <h3 id="_word_exit">Word: EXIT</h3>
\r
2090 <div class="literalblock">
\r
2091 <div class="content">
\r
2092 <pre><code>Data stack: ( -- )</code></pre>
\r
2094 <div class="paragraph"><p>"EXIT" is a function word that implements the ending of a FORTH
\r
2095 definition and its threading to the subsequent step of the calling
\r
2096 definition.</p></div>
\r
2097 <div style="text-align:center">
\r
2098 _______________________________________________________
\r
2100 <div class="paragraph"><p><a id="p_false"></a></p></div>
\r
2102 <div class="sect2">
\r
2103 <h3 id="_word_false">Word: FALSE</h3>
\r
2104 <div class="literalblock">
\r
2105 <div class="content">
\r
2106 <pre><code>Data stack: ( -- 0 )</code></pre>
\r
2108 <div class="paragraph"><p>"FALSE" is a value word representing logical false.</p></div>
\r
2109 <div style="text-align:center">
\r
2110 _______________________________________________________
\r
2112 <div class="paragraph"><p><a id="p_find"></a></p></div>
\r
2114 <div class="sect2">
\r
2115 <h3 id="_word_find">Word: FIND</h3>
\r
2116 <div class="literalblock">
\r
2117 <div class="content">
\r
2118 <pre><code>Data stack: ( char* n -- [ char* n 0 ]/[ tfa ] )</code></pre>
\r
2120 <div class="paragraph"><p>"FIND" is a function word that searches the current word list search
\r
2121 path for the given [n:char*] word, and returns the TFA of the matching
\r
2122 word if any. Otherwise FIND preserves the initial data stack but adds
\r
2123 0 to it.</p></div>
\r
2124 <div class="paragraph"><p>The word is sought starting with the
\r
2125 <a href="#p_current_wordlist">CURRENT-WORDLIST</a> word list, for the first
\r
2126 occurence of a match. If not found, the search continues with the
\r
2127 subsequent word list, and so on.</p></div>
\r
2128 <div class="paragraph"><p>When a word is found, then the data stack is changed by discarding the
\r
2129 [n:char*] double cell string pointer and pushing (only) the TFA of the
\r
2130 matching word instead.</p></div>
\r
2131 <div style="text-align:center">
\r
2132 _______________________________________________________
\r
2134 <div class="paragraph"><p><a id="p_forth"></a></p></div>
\r
2136 <div class="sect2">
\r
2137 <h3 id="_word_forth">Word: FORTH</h3>
\r
2138 <div class="literalblock">
\r
2139 <div class="content">
\r
2140 <pre><code>data stack: ( -- a )</code></pre>
\r
2142 <div class="paragraph"><p>"FORTH" is a variable word for the FORTH word list, which does not
\r
2143 have any subsequent word list.</p></div>
\r
2144 <div style="text-align:center">
\r
2145 _______________________________________________________
\r
2147 <div class="paragraph"><p><a id="p_get"></a></p></div>
\r
2149 <div class="sect2">
\r
2150 <h3 id="_word_9">Word: @</h3>
\r
2151 <div class="literalblock">
\r
2152 <div class="content">
\r
2153 <pre><code>Data stack: ( a -- v )</code></pre>
\r
2155 <div class="paragraph"><p>"@" is a function word that pushes the value v from the address a.</p></div>
\r
2156 <div style="text-align:center">
\r
2157 _______________________________________________________
\r
2159 <div class="paragraph"><p><a id="p_get_n_decrement"></a></p></div>
\r
2161 <div class="sect2">
\r
2162 <h3 id="_word_n">Word: @n--</h3>
\r
2163 <div class="literalblock">
\r
2164 <div class="content">
\r
2165 <pre><code>Data stack: ( a n -- v )</code></pre>
\r
2167 <div class="paragraph"><p>"@n--" is a function word that pushes the value from the address, a,
\r
2168 then decrements the cell at that address by n.</p></div>
\r
2169 <div class="exampleblock">
\r
2170 <div class="content">
\r
2171 <div class="sidebarblock">
\r
2172 <div class="content">
\r
2173 <div class="title">Defintion concept for @n++</div>
\r
2174 <div class="paragraph"><p>: @n++ OVER @ DUP ROT - ROT ! ;</p></div>
\r
2177 <div style="text-align:center">
\r
2178 _______________________________________________________
\r
2180 <div class="paragraph"><p><a id="p_get_n_increment"></a></p></div>
\r
2182 <div class="sect2">
\r
2183 <h3 id="_word_n_2">Word: @n++</h3>
\r
2184 <div class="literalblock">
\r
2185 <div class="content">
\r
2186 <pre><code>Data stack: ( a n -- v )</code></pre>
\r
2188 <div class="paragraph"><p>"@n++" is a function word that pushes the value from the address, a,
\r
2189 then increments the cell at that address by n.</p></div>
\r
2190 <div class="exampleblock">
\r
2191 <div class="content">
\r
2192 <div class="sidebarblock">
\r
2193 <div class="content">
\r
2194 <div class="title">Defintion concept for @n++</div>
\r
2195 <div class="paragraph"><p>( a n — v ) : @n++ OVER @ DUP ROT + ROT ! ;</p></div>
\r
2198 <div style="text-align:center">
\r
2199 _______________________________________________________
\r
2201 <div class="paragraph"><p><a id="p_greaterequal"></a></p></div>
\r
2203 <div class="sect2">
\r
2204 <h3 id="_word_gt">Word: >=</h3>
\r
2205 <div class="literalblock">
\r
2206 <div class="content">
\r
2207 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
2209 <div class="paragraph"><p>">=" is a function word that replaces a pair of values with -1 if the
\r
2210 first, v1, is greater than or equal to the second, v1, otherwise 0. To
\r
2211 that end, the values are 64-bit signed integers.</p></div>
\r
2212 <div style="text-align:center">
\r
2213 _______________________________________________________
\r
2215 <div class="paragraph"><p><a id="p_greaterthan"></a></p></div>
\r
2217 <div class="sect2">
\r
2218 <h3 id="_word_gt_2">Word: ></h3>
\r
2219 <div class="literalblock">
\r
2220 <div class="content">
\r
2221 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
2223 <div class="paragraph"><p>">" is a function word that replaces a pair of values with -1 if the
\r
2224 first, v1, is greater than the second, v1, otherwise 0. To that end,
\r
2225 the values are 64-bit signed integers.</p></div>
\r
2226 <div style="text-align:center">
\r
2227 _______________________________________________________
\r
2229 <div class="paragraph"><p><a id="p_gtR"></a></p></div>
\r
2231 <div class="sect2">
\r
2232 <h3 id="_word_gt_r">Word: >R</h3>
\r
2233 <div class="literalblock">
\r
2234 <div class="content">
\r
2235 <pre><code>Data stack: ( v -- ) Return stack: ( -- v )</code></pre>
\r
2237 <div class="paragraph"><p>">R" is a function word that "moves" the top data stack value onto the
\r
2238 return stack.</p></div>
\r
2239 <div style="text-align:center">
\r
2240 _______________________________________________________
\r
2242 <div class="paragraph"><p><a id="p_here"></a></p></div>
\r
2244 <div class="sect2">
\r
2245 <h3 id="_word_here">Word: HERE</h3>
\r
2246 <div class="literalblock">
\r
2247 <div class="content">
\r
2248 <pre><code>Data stack: ( -- a )</code></pre>
\r
2250 <div class="paragraph"><p>"HERE" is a variable word that keeps the lowest address of the free
\r
2251 allocation space. It get updated by all words that allocate memory.</p></div>
\r
2252 <div class="exampleblock">
\r
2253 <div class="content">
\r
2254 <div class="sidebarblock">
\r
2255 <div class="content">
\r
2256 <div class="title">allocate 1024 bytes on the heap</div>
\r
2257 <div class="paragraph"><p>1024 HEAP @ + HEAP !</p></div>
\r
2260 <div class="paragraph"><p>See also <a href="#p_allot">ALLOT</a>.</p></div>
\r
2261 <div style="text-align:center">
\r
2262 _______________________________________________________
\r
2264 <div class="paragraph"><p><a id="p_hex"></a></p></div>
\r
2266 <div class="sect2">
\r
2267 <h3 id="_word_hex">Word: HEX</h3>
\r
2268 <div class="literalblock">
\r
2269 <div class="content">
\r
2270 <pre><code>Data stack: ( -- )</code></pre>
\r
2272 <div class="paragraph"><p>"HEX" is a function word that sets <a href="#p_base">BASE</a> to 16, which uses
\r
2273 letters a-f as additional digits. (Uppercase letter are also accepted
\r
2274 on input).</p></div>
\r
2275 <div class="exampleblock">
\r
2276 <div class="content">
\r
2277 <div class="sidebarblock">
\r
2278 <div class="content">
\r
2279 <div class="title">Definition concept for HEX</div>
\r
2280 <div class="paragraph"><p>: HEX 16 BASE ! ;</p></div>
\r
2283 <div style="text-align:center">
\r
2284 _______________________________________________________
\r
2286 <div class="paragraph"><p><a id="p_if"></a></p></div>
\r
2288 <div class="sect2">
\r
2289 <h3 id="_word_if">Word: IF</h3>
\r
2290 <div class="literalblock">
\r
2291 <div class="content">
\r
2292 <pre><code>Data stack: Compiling: ( -- a )</code></pre>
\r
2294 <div class="paragraph"><p>"IF" is an immediate function word that is used together with
\r
2295 <a href="#p_else">ELSE</a> and <a href="#p_then">THEN</a> to implement structured execution
\r
2296 control. IF results in layout of a <a href="#p_0branch">0BRANCH</a> instruction
\r
2297 with an unresolved branch offset, and places the address for resolving
\r
2298 this instruction on the datastack. This address will then be resolved
\r
2299 and asssigned by a subsequent <a href="#p_else">ELSE</a> or <a href="#p_then">THEN</a> so
\r
2300 that at execution time there is an appropriate conditional branch past
\r
2301 the "then-part" of the "structured statement".</p></div>
\r
2302 <div style="text-align:center">
\r
2303 _______________________________________________________
\r
2305 <div class="paragraph"><p><a id="p_ifagain"></a></p></div>
\r
2307 <div class="sect2">
\r
2308 <h3 id="_word_ifagain">Word: IFAGAIN</h3>
\r
2309 <div class="literalblock">
\r
2310 <div class="content">
\r
2311 <pre><code>Data stack: Compiling: ( -- a )</code></pre>
\r
2313 <div class="paragraph"><p>"IFAGAIN" is an immediate function word that is used together with
\r
2314 <a href="#p_begin">BEGIN</a>, <a href="#p_ifbreak">BREAK</a> and <a href="#p_end">END</a> to implement
\r
2315 structured execution control. IFAGAIN scans the datastack for the
\r
2316 nearest preceding BEGIN marker and lays out a branch from this point
\r
2317 the beginning of the block during execution.</p></div>
\r
2318 <div style="text-align:center">
\r
2319 _______________________________________________________
\r
2321 <div class="paragraph"><p><a id="p_ifbreak"></a></p></div>
\r
2323 <div class="sect2">
\r
2324 <h3 id="_word_ifbreak">Word: IFBREAK</h3>
\r
2325 <div class="literalblock">
\r
2326 <div class="content">
\r
2327 <pre><code>Data stack: Compiling: ( -- a )</code></pre>
\r
2329 <div class="paragraph"><p>"IFBREAK" is an immediate function word that is used together with
\r
2330 <a href="#p_begin">BEGIN</a>, <a href="#p_ifagain">IFAGAIN</a> and <a href="#p_end">END</a> to
\r
2331 implement structured execution control. IFBREAK simply places the
\r
2332 address for resolving branches from this point the end of the block
\r
2333 during execution.</p></div>
\r
2334 <div style="text-align:center">
\r
2335 _______________________________________________________
\r
2337 <div class="paragraph"><p><a id="p_immediate"></a></p></div>
\r
2339 <div class="sect2">
\r
2340 <h3 id="_word_immediate">Word: IMMEDIATE</h3>
\r
2341 <div class="literalblock">
\r
2342 <div class="content">
\r
2343 <pre><code>Data stack: ( -- )</code></pre>
\r
2345 <div class="paragraph"><p>"IMMEDIATE" is an immediate function word that sets the flags field of
\r
2346 the most recent word to 1, thereby making that word an immediate word.</p></div>
\r
2347 <div class="exampleblock">
\r
2348 <div class="content">
\r
2349 <div class="sidebarblock">
\r
2350 <div class="content">
\r
2351 <div class="title">Definition concept for IMMEDIATE</div>
\r
2352 <div class="paragraph"><p>: IMMEDIATE IMMEDIATE 1 CURRENT-WORDLIST @ @ 16 + ! ;</p></div>
\r
2355 <div class="paragraph"><p>See also <a href="#p_colon">:</a>, <a href="#p_current_wordlist">CURRENT-WORDLIST</a>,
\r
2356 <a href="#p_get">@</a>, <a href="#p_plus">+</a>, <a href="#p_put">!</a>, and <a href="#p_semicolon;">[p_semicolon;]</a>.</p></div>
\r
2357 <div style="text-align:center">
\r
2358 _______________________________________________________
\r
2360 <div class="paragraph"><p><a id="p_input"></a></p></div>
\r
2362 <div class="sect2">
\r
2363 <h3 id="_word_input">Word: INPUT</h3>
\r
2364 <div class="literalblock">
\r
2365 <div class="content">
\r
2366 <pre><code>Data stack: ( -- a )</code></pre>
\r
2368 <div class="paragraph"><p>"INPUT" is a variable word for the input stream buffer used by
\r
2369 <a href="#p_evaluate_stream">EVALUATE-STREAM</a>.</p></div>
\r
2370 <div style="text-align:center">
\r
2371 _______________________________________________________
\r
2373 <div class="paragraph"><p><a id="p_left_bracket"></a></p></div>
\r
2375 <div class="sect2">
\r
2376 <h3 id="_word_10">Word: [</h3>
\r
2377 <div class="literalblock">
\r
2378 <div class="content">
\r
2379 <pre><code>Data stack: ( -- )</code></pre>
\r
2381 <div class="paragraph"><p>"[" (left bracket) is a function word that sets the stream evaluation
\r
2382 mode to be intepreting. In this mode, words are executed immediately
\r
2383 after parsing, by invoking their "doer".</p></div>
\r
2384 <div class="exampleblock">
\r
2385 <div class="content">
\r
2386 <div class="sidebarblock">
\r
2387 <div class="content">
\r
2388 <div class="title">Definition concept for [</div>
\r
2389 <div class="paragraph"><p>: [ IMMEDIATE 0 STATE ! ;</p></div>
\r
2392 <div style="text-align:center">
\r
2393 _______________________________________________________
\r
2395 <div class="paragraph"><p><a id="p_lessequal"></a></p></div>
\r
2397 <div class="sect2">
\r
2398 <h3 id="_word_lt">Word: <=</h3>
\r
2399 <div class="literalblock">
\r
2400 <div class="content">
\r
2401 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
2403 <div class="paragraph"><p>"<=" is a function word that replaces a pair of values with -1 if the
\r
2404 first, v1, is less than or equal to the second, v1, otherwise 0. To
\r
2405 that end, the values are 64-bit signed integers.</p></div>
\r
2406 <div style="text-align:center">
\r
2407 _______________________________________________________
\r
2409 <div class="paragraph"><p><a id="p_lessthan"></a></p></div>
\r
2411 <div class="sect2">
\r
2412 <h3 id="_word_lt_2">Word: <</h3>
\r
2413 <div class="literalblock">
\r
2414 <div class="content">
\r
2415 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
2417 <div class="paragraph"><p>"<" is a function word that replaces a pair of values with -1 if the
\r
2418 first, v1, is less than the second, v1, otherwise 0. To that end, the
\r
2419 values are 64-bit signed integers.</p></div>
\r
2420 <div style="text-align:center">
\r
2421 _______________________________________________________
\r
2423 <div class="paragraph"><p><a id="p_literal"></a></p></div>
\r
2425 <div class="sect2">
\r
2426 <h3 id="_word_lit">Word: LIT</h3>
\r
2427 <div class="literalblock">
\r
2428 <div class="content">
\r
2429 <pre><code>Data stack: ( -- v )</code></pre>
\r
2431 <div class="paragraph"><p>"LIT" is a function word that pushes the cell subsequent and moves
\r
2432 excution past that. The literal value is thus layed out as if a
\r
2433 subsequent CFA pointer in the containing definition, and the LIT
\r
2434 execution will make the execution skip past that and instead contine
\r
2435 with the CFA pointer following the value.</p></div>
\r
2436 <div class="paragraph"><p>It’s not a good idea to use "LIT" interactively.</p></div>
\r
2437 <div class="exampleblock">
\r
2438 <div class="content">
\r
2439 <div class="sidebarblock">
\r
2440 <div class="content">
\r
2441 <div class="title">Definition concept for LIT</div>
\r
2442 <div class="paragraph"><p>: LIT R> DUP 8 + >R @ ;</p></div>
\r
2445 <div style="text-align:center">
\r
2446 _______________________________________________________
\r
2448 <div class="paragraph"><p><a id="p_literal_string"></a></p></div>
\r
2450 <div class="sect2">
\r
2451 <h3 id="_word_s">Word: S"</h3>
\r
2452 <div class="literalblock">
\r
2453 <div class="content">
\r
2454 <pre><code>Data stack: ( -- chars* n )</code></pre>
\r
2456 <div class="paragraph"><p>"S"" is a function word that pushes the [n:char] pointer for a string
\r
2457 inlined subsequently to it in the containing definition. This is
\r
2458 similar to <a href="#p_lit">LIT</a> but for a string literal.</p></div>
\r
2459 <div class="exampleblock">
\r
2460 <div class="content">
\r
2461 <div class="sidebarblock">
\r
2462 <div class="content">
\r
2463 <div class="title">Definition concept for LIT</div>
\r
2464 <div class="paragraph"><p>: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ;</p></div>
\r
2467 <div style="text-align:center">
\r
2468 _______________________________________________________
\r
2470 <div class="paragraph"><p><a id="p_load_file_quote"></a></p></div>
\r
2472 <div class="sect2">
\r
2473 <h3 id="_word_load_file">Word: LOAD-FILE"</h3>
\r
2474 <div class="literalblock">
\r
2475 <div class="content">
\r
2476 <pre><code>data stack: ( "name" -- )</code></pre>
\r
2478 <div class="paragraph"><p>"LOAD-FILE"" is a function word that opens a file via
\r
2479 <a href="#p_open_file_quote">OPEN-FILE"</a>, allocates a stream buffer of 15000
\r
2480 bytes for reading it, saves the stream pointer as value for the newly
\r
2481 created filename variable, and then it invokes
\r
2482 <a href="#p_evaluate_stream">EVALUATE-STREAM</a> for processing the file.</p></div>
\r
2483 <div style="text-align:center">
\r
2484 _______________________________________________________
\r
2486 <div class="paragraph"><p><a id="p_lparen"></a></p></div>
\r
2488 <div class="sect2">
\r
2489 <h3 id="_word_11">Word: (</h3>
\r
2490 <div class="literalblock">
\r
2491 <div class="content">
\r
2492 <pre><code>Data stack: ( -- )</code></pre>
\r
2494 <div class="paragraph"><p>"(" (left parenthesis) is a function word that scans and ignores words
\r
2495 until the next right parenthesis, or the end of the stream. This is
\r
2496 used for comments in RRQFORTH code.</p></div>
\r
2497 <div class="paragraph"><p>Note that the terminating right parenthesis is a word, i.e. must have
\r
2498 whitespace before and after it.</p></div>
\r
2499 <div style="text-align:center">
\r
2500 _______________________________________________________
\r
2502 <div class="paragraph"><p><a id="p_malloc"></a></p></div>
\r
2504 <div class="sect2">
\r
2505 <h3 id="_word_malloc">Word: MALLOC</h3>
\r
2506 <div class="literalblock">
\r
2507 <div class="content">
\r
2508 <pre><code>Data stack: ( n -- a )</code></pre>
\r
2510 <div class="paragraph"><p>"MALLOC" is a word that allocates memory using mmap of at least n
\r
2511 bytes and returns the lowest address of the allocated block.</p></div>
\r
2512 <div class="paragraph"><p>Note that this makes new page allocations for the process from the
\r
2513 kernel, and the granularity is in pages, i.e. a multiple of 4 kb.</p></div>
\r
2514 <div class="paragraph"><p>The memory is allocated with READ and WRITE access but not EXEC
\r
2515 access, and flagged as PRIVATE, ANONYMOUS and LOCKED. See the "man
\r
2516 page" of mmap for details.</p></div>
\r
2517 <div class="paragraph"><p>See also <a href="#p_stream">STREAM</a></p></div>
\r
2518 <div style="text-align:center">
\r
2519 _______________________________________________________
\r
2521 <div class="paragraph"><p><a id="p_minus"></a></p></div>
\r
2523 <div class="sect2">
\r
2524 <h3 id="_word_12">Word: -</h3>
\r
2525 <div class="literalblock">
\r
2526 <div class="content">
\r
2527 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
2529 <div class="paragraph"><p>"-" (minus) is a function word that replaces a pair of values with the
\r
2530 result of reducing the first, v1, with the second, v2. To that end,
\r
2531 the values are 64-bit signed integers.</p></div>
\r
2532 <div style="text-align:center">
\r
2533 _______________________________________________________
\r
2535 <div class="paragraph"><p><a id="p_mult"></a></p></div>
\r
2537 <div class="sect2">
\r
2538 <h3 id="_word_13">Word: *</h3>
\r
2539 <div class="literalblock">
\r
2540 <div class="content">
\r
2541 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
2543 <div class="paragraph"><p>"*" is a function word that replaces a pair of values with the result
\r
2544 of multiplying them. To that end, the values are 64-bit signed
\r
2545 integers, and clipping the result to the least signifcant 64 bits.</p></div>
\r
2546 <div style="text-align:center">
\r
2547 _______________________________________________________
\r
2549 <div class="paragraph"><p><a id="p_negate"></a></p></div>
\r
2551 <div class="sect2">
\r
2552 <h3 id="_word_negate">Word: NEGATE</h3>
\r
2553 <div class="literalblock">
\r
2554 <div class="content">
\r
2555 <pre><code>Data stack: ( v1 -- v2 )</code></pre>
\r
2557 <div class="paragraph"><p>"NEGATE" is a function word that replaces a value with its
\r
2558 2’s-complement negation. To that end, the values are 64-bit signed
\r
2559 integers.</p></div>
\r
2560 <div style="text-align:center">
\r
2561 _______________________________________________________
\r
2563 <div class="paragraph"><p><a id="p_nip"></a></p></div>
\r
2565 <div class="sect2">
\r
2566 <h3 id="_word_nip">Word: NIP</h3>
\r
2567 <div class="literalblock">
\r
2568 <div class="content">
\r
2569 <pre><code>Data stack: ( v1 v2 -- v2 )</code></pre>
\r
2571 <div class="paragraph"><p>"NIP" is a function word that discards the second of the top two cells
\r
2572 on the data stack.</p></div>
\r
2573 <div class="exampleblock">
\r
2574 <div class="content">
\r
2575 <div class="sidebarblock">
\r
2576 <div class="content">
\r
2577 <div class="title">Definition concept for NIP</div>
\r
2578 <div class="paragraph"><p>: NIP SWAP DROP ;</p></div>
\r
2581 <div style="text-align:center">
\r
2582 _______________________________________________________
\r
2584 <div class="paragraph"><p><a id="p_nl"></a></p></div>
\r
2586 <div class="sect2">
\r
2587 <h3 id="_word_nl">Word: NL</h3>
\r
2588 <div class="literalblock">
\r
2589 <div class="content">
\r
2590 <pre><code>Data stack: ( -- v )</code></pre>
\r
2592 <div class="paragraph"><p>"NL" is a value word pushing a newline character onto the data stack.</p></div>
\r
2593 <div style="text-align:center">
\r
2594 _______________________________________________________
\r
2596 <div class="paragraph"><p><a id="p_not"></a></p></div>
\r
2598 <div class="sect2">
\r
2599 <h3 id="_word_not">Word: NOT</h3>
\r
2600 <div class="literalblock">
\r
2601 <div class="content">
\r
2602 <pre><code>Data stack: ( v1 -- v2 )</code></pre>
\r
2604 <div class="paragraph"><p>"NOT" is a function word that replaces a value with its bitwise
\r
2605 complement; each bit is zero if non-zero, and non-zero if zero.</p></div>
\r
2606 <div class="paragraph"><p>Compare with <<p_0equal,0⇒>.</p></div>
\r
2607 <div style="text-align:center">
\r
2608 _______________________________________________________
\r
2610 <div class="paragraph"><p><a id="p_number"></a></p></div>
\r
2612 <div class="sect2">
\r
2613 <h3 id="_word_number">Word: NUMBER</h3>
\r
2614 <div class="literalblock">
\r
2615 <div class="content">
\r
2616 <pre><code>Data stack: ( char n -- [ 0 ]/[ v 1 ] )</code></pre>
\r
2618 <div class="paragraph"><p>"NUMBER" is a function word that parses a text number using
\r
2619 <a href="#p_base">BASE</a> as numerical base, then returns the result number and
\r
2620 a 1 on top, or just a 0 if the word didn’t parse.</p></div>
\r
2621 <div class="paragraph"><p>A number consists of, first an optional minus sign, if in
\r
2622 <a href="#p_decimal">DECIMAL</a> base, then digits 0-9 and, if in <a href="#p_hex">HEX</a>
\r
2623 base, letters a-f or A-F for values 10-15. I.e. the normal positive or
\r
2624 negative decimal integers or normal (positive only) hexadecimal
\r
2625 integers.</p></div>
\r
2626 <div style="text-align:center">
\r
2627 _______________________________________________________
\r
2629 <div class="paragraph"><p><a id="p_open_file_quote"></a></p></div>
\r
2631 <div class="sect2">
\r
2632 <h3 id="_word_open_file">Word: OPEN-FILE"</h3>
\r
2633 <div class="literalblock">
\r
2634 <div class="content">
\r
2635 <pre><code>Data stack: ( "name" -- fd )</code></pre>
\r
2637 <div class="paragraph"><p>"OPEN-FILE"" is a function word that reads the intputstream for a
\r
2638 filename, adds that to the dictionary as a no-content variable, opens
\r
2639 that file and returns the input file descriptor.</p></div>
\r
2640 <div style="text-align:center">
\r
2641 _______________________________________________________
\r
2643 <div class="paragraph"><p><a id="p_or"></a></p></div>
\r
2645 <div class="sect2">
\r
2646 <h3 id="_word_or">Word: OR</h3>
\r
2647 <div class="literalblock">
\r
2648 <div class="content">
\r
2649 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
2651 <div class="paragraph"><p>"OR" is a function word that replaces a value pair with their bitwise
\r
2652 disjunction; each bit is 1 if the corresponding bits of any operand
\r
2653 is 1 and 0 if not.</p></div>
\r
2654 <div style="text-align:center">
\r
2655 _______________________________________________________
\r
2657 <div class="paragraph"><p><a id="p_over"></a></p></div>
\r
2659 <div class="sect2">
\r
2660 <h3 id="_word_over">Word: OVER</h3>
\r
2661 <div class="literalblock">
\r
2662 <div class="content">
\r
2663 <pre><code>Data stack: ( v1 v2 -- v1 v2 v1 )</code></pre>
\r
2665 <div class="paragraph"><p>"OVER" is a function word that duplicates the second top stack cell on
\r
2666 the data stack.</p></div>
\r
2667 <div style="text-align:center">
\r
2668 _______________________________________________________
\r
2670 <div class="paragraph"><p><a id="p_pad"></a></p></div>
\r
2672 <div class="sect2">
\r
2673 <h3 id="_word_pad">Word: PAD</h3>
\r
2674 <div class="literalblock">
\r
2675 <div class="content">
\r
2676 <pre><code>Data stack: ( -- a )</code></pre>
\r
2678 <div class="paragraph"><p>"PAD" is a variable word for a 1 kb data space that is used by
\r
2679 <a href="#p_double_quote">[p_double_quote]</a> (only), and otherwise free for temporary use.</p></div>
\r
2680 <div style="text-align:center">
\r
2681 _______________________________________________________
\r
2683 <div class="paragraph"><p><a id="p_pick"></a></p></div>
\r
2685 <div class="sect2">
\r
2686 <h3 id="_word_pick">Word: PICK</h3>
\r
2687 <div class="literalblock">
\r
2688 <div class="content">
\r
2689 <pre><code>Data stack: ( vu...v1 v0 u -- vu...v1 v0 vu )</code></pre>
\r
2691 <div class="paragraph"><p>"PICK" is a function word that pushes the u:th data stack cell down
\r
2692 from top onto the data stack. 0 indicates the top cell making it the
\r
2693 same as <a href="#p_dup">DUP</a>, and 1 indicates the second top cell making it
\r
2694 the same as <a href="#p_over">OVER</a>.</p></div>
\r
2695 <div style="text-align:center">
\r
2696 _______________________________________________________
\r
2698 <div class="paragraph"><p><a id="p_plus"></a></p></div>
\r
2700 <div class="sect2">
\r
2701 <h3 id="_word_43">Word: +</h3>
\r
2702 <div class="literalblock">
\r
2703 <div class="content">
\r
2704 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
2706 <div class="paragraph"><p>"+" (plus) is a function word that replaces a pair of values with the
\r
2707 result of adding them. To that end, the values are 64-bit signed
\r
2708 integers.</p></div>
\r
2709 <div style="text-align:center">
\r
2710 _______________________________________________________
\r
2712 <div class="paragraph"><p><a id="p_program_version"></a></p></div>
\r
2714 <div class="sect2">
\r
2715 <h3 id="_word_program_version">Word: PROGRAM_VERSION</h3>
\r
2716 <div class="literalblock">
\r
2717 <div class="content">
\r
2718 <pre><code>Data stack: ( -- char* length )</code></pre>
\r
2720 <div class="paragraph"><p>"PROGRAM_VERSION" is a string variable hilding the version string.</p></div>
\r
2721 <div style="text-align:center">
\r
2722 _______________________________________________________
\r
2724 <div class="paragraph"><p><a id="p_put"></a></p></div>
\r
2726 <div class="sect2">
\r
2727 <h3 id="_word_14">Word: !</h3>
\r
2728 <div class="literalblock">
\r
2729 <div class="content">
\r
2730 <pre><code>Data stack: ( v a -- )</code></pre>
\r
2732 <div class="paragraph"><p>"!" is a function word that stores the cell value v at the address a.</p></div>
\r
2733 <div style="text-align:center">
\r
2734 _______________________________________________________
\r
2736 <div class="paragraph"><p><a id="p_put_plus"></a></p></div>
\r
2738 <div class="sect2">
\r
2739 <h3 id="_word_15">Word: !+</h3>
\r
2740 <div class="literalblock">
\r
2741 <div class="content">
\r
2742 <pre><code>Data stack: ( a n -- )</code></pre>
\r
2744 <div class="paragraph"><p>"!+" is a function word that adds n to the cell value at a.</p></div>
\r
2745 <div class="exampleblock">
\r
2746 <div class="content">
\r
2747 <div class="sidebarblock">
\r
2748 <div class="content">
\r
2749 <div class="title">definition concept for !+</div>
\r
2750 <div class="paragraph"><p>( a n — ) : !+ OVER @ + SWAP ! ;</p></div>
\r
2753 <div style="text-align:center">
\r
2754 _______________________________________________________
\r
2756 <div class="paragraph"><p><a id="p_quit"></a></p></div>
\r
2758 <div class="sect2">
\r
2759 <h3 id="_word_quit">Word: QUIT</h3>
\r
2760 <div class="literalblock">
\r
2761 <div class="content">
\r
2762 <pre><code>Data stack: ??</code></pre>
\r
2764 <div class="paragraph"><p>"QUIT" is a function word that implements the root execution loop of
\r
2765 RRQFORTH. First it resets the stacks to their original settings, and
\r
2766 thereafter it enters loop of reading words from <a href="#p_stdin">STDIN</a> and
\r
2767 executing them.</p></div>
\r
2768 <div style="text-align:center">
\r
2769 _______________________________________________________
\r
2771 <div class="paragraph"><p><a id="p_quote"></a></p></div>
\r
2773 <div class="sect2">
\r
2774 <h3 id="_word_16">Word: '</h3>
\r
2775 <div class="literalblock">
\r
2776 <div class="content">
\r
2777 <pre><code>data stack: ( -- cfa ) Input stream: word</code></pre>
\r
2779 <div class="paragraph"><p>"'" (single quote) is a function word that reads and find the next
\r
2780 word on the input stream and pushes its cfa.</p></div>
\r
2781 <div style="text-align:center">
\r
2782 _______________________________________________________
\r
2784 <div class="paragraph"><p><a id="p_read_stream_char"></a></p></div>
\r
2786 <div class="sect2">
\r
2787 <h3 id="_word_read_stream_char">Word: READ-STREAM-CHAR</h3>
\r
2788 <div class="literalblock">
\r
2789 <div class="content">
\r
2790 <pre><code>Data stack: ( stream -- c )</code></pre>
\r
2792 <div class="paragraph"><p>"READ-STREAM-CHAR" is a function word that gets the next character
\r
2793 from the given stream buffer, possibly refilling the buffer if it is
\r
2794 backed by a file descriptor. The refill is done by a SYS_READ call
\r
2795 when more characters are needed. The next character is pushed on the
\r
2796 stack, unless the stream is exhausted in which case the -1 is pushed
\r
2797 instead.</p></div>
\r
2798 <div class="paragraph"><p>See also <a href="#p_stream">STREAM</a>.</p></div>
\r
2799 <div style="text-align:center">
\r
2800 _______________________________________________________
\r
2802 <div class="paragraph"><p><a id="p_read_word"></a></p></div>
\r
2804 <div class="sect2">
\r
2805 <h3 id="_word_read_word">Word: READ-WORD</h3>
\r
2806 <div class="literalblock">
\r
2807 <div class="content">
\r
2808 <pre><code>Data stack: ( stream -- char* n )</code></pre>
\r
2810 <div class="paragraph"><p>"READ-WORD" is a function word that "reads" the next whitespace
\r
2811 separated word from the given stream and returns the [n:char*] duoble
\r
2812 cell pointer for it. The characters of the word are copied to
\r
2813 <a href="#p_pad">PAD</a>, and there is a limit of 1024 characters.</p></div>
\r
2814 <div class="paragraph"><p>At the end of the stream READ-WORD returns 0 length.</p></div>
\r
2815 <div style="text-align:center">
\r
2816 _______________________________________________________
\r
2818 <div class="paragraph"><p><a id="p_realloc"></a></p></div>
\r
2820 <div class="sect2">
\r
2821 <h3 id="_word_realloc">Word: REALLOC</h3>
\r
2822 <div class="literalblock">
\r
2823 <div class="content">
\r
2824 <pre><code>Data stack: ( a m n -- a )</code></pre>
\r
2826 <div class="paragraph"><p>"REALLOC" is a word that reallocates memory using mremap of address a
\r
2827 of size m to be size n bytes and returns the lowest address of the
\r
2828 allocated block.</p></div>
\r
2829 <div class="paragraph"><p>Note that this makes new page allocations for the process from the
\r
2830 kernel, and the granularity is in pages, i.e. a multiple of 4 kb.</p></div>
\r
2831 <div class="paragraph"><p>The memory is reampped using the MREMAP_MAYMOVE flag,</p></div>
\r
2832 <div class="paragraph"><p>See also <a href="#p_malloc">MALLOC</a></p></div>
\r
2833 <div style="text-align:center">
\r
2834 _______________________________________________________
\r
2836 <div class="paragraph"><p>compile.asm: WORD p_right_bracket,<em>]</em>,fasm</p></div>
\r
2837 <div class="paragraph"><p><a id="p_right_bracket"></a></p></div>
\r
2839 <div class="sect2">
\r
2840 <h3 id="_word_17">Word: ]</h3>
\r
2841 <div class="literalblock">
\r
2842 <div class="content">
\r
2843 <pre><code>Data stack: ( -- )</code></pre>
\r
2845 <div class="paragraph"><p>"]" (right bracket) is a function word that sets the stream evaluation
\r
2846 mode to be compiling. In this mode words parsed into CFA pointers
\r
2847 which are placed on the heap in the given order, unless the word is
\r
2848 flagged as <a href="#p_immediate">IMMEDIATE</a> or a <a href="#p_number">NUMBER</a>. An
\r
2849 immediate word is executed immediately, and a number is parsed and
\r
2850 left on the stack.</p></div>
\r
2851 <div class="paragraph"><p>Note that a word is parsed as a number only if it is not found in the
\r
2852 wordlist; i.e., the word list may contain definitions for numbers.</p></div>
\r
2853 <div class="exampleblock">
\r
2854 <div class="content">
\r
2855 <div class="sidebarblock">
\r
2856 <div class="content">
\r
2857 <div class="title">Definition concept for ]</div>
\r
2858 <div class="paragraph"><p>: ] 1 STATE ! ;</p></div>
\r
2861 <div style="text-align:center">
\r
2862 _______________________________________________________
\r
2864 <div class="paragraph"><p><a id="p_roll"></a></p></div>
\r
2866 <div class="sect2">
\r
2867 <h3 id="_word_roll">Word: ROLL</h3>
\r
2868 <div class="literalblock">
\r
2869 <div class="content">
\r
2870 <pre><code>Data stack: ( vu...v1 v0 u -- ...v1 v0 vu )</code></pre>
\r
2872 <div class="paragraph"><p>"ROLL" is a function word that "moves" the u:th data stack cell down
\r
2873 from top onto the data stack while discarding it. 0 indicates the top
\r
2874 cell; 1 indicates the second top cell making it the same as
\r
2875 <a href="#p_swap">SWAP</a>; 2 indicates the third top cell making it the same as
\r
2876 <a href="#p_rot">ROT</a>.</p></div>
\r
2877 <div style="text-align:center">
\r
2878 _______________________________________________________
\r
2880 <div class="paragraph"><p><a id="p_rot"></a></p></div>
\r
2882 <div class="sect2">
\r
2883 <h3 id="_word_rot">Word: ROT</h3>
\r
2884 <div class="literalblock">
\r
2885 <div class="content">
\r
2886 <pre><code>Data stack: ( v1 v2 v3 -- v2 v3 v1 )</code></pre>
\r
2888 <div class="paragraph"><p>"ROT" is a function word that "rotates" the top three data stack cells
\r
2889 such that the third becomes the first while the second becomes third
\r
2890 and the first becomes the second.</p></div>
\r
2891 <div class="paragraph"><p>See also <a href="#p_roll">ROLL</a>.</p></div>
\r
2892 <div style="text-align:center">
\r
2893 _______________________________________________________
\r
2895 <div class="paragraph"><p><a id="p_rsp"></a></p></div>
\r
2897 <div class="sect2">
\r
2898 <h3 id="_word_r_n">Word: R[n]</h3>
\r
2899 <div class="literalblock">
\r
2900 <div class="content">
\r
2901 <pre><code>Data stack: ( n -- a )</code></pre>
\r
2903 <div class="paragraph"><p>"R[n]" is a function word that pushes the address for the n:th cell on
\r
2904 the top return stack value onto the data stack.</p></div>
\r
2905 <div style="text-align:center">
\r
2906 _______________________________________________________
\r
2908 <div class="paragraph"><p><a id="p_semicolon"></a></p></div>
\r
2910 <div class="sect2">
\r
2911 <h3 id="_word_18">Word: ;</h3>
\r
2912 <div class="literalblock">
\r
2913 <div class="content">
\r
2914 <pre><code>Data stack: ( -- )</code></pre>
\r
2916 <div class="paragraph"><p>";" (semi-colon) is a function word that ends a new forth definition
\r
2917 by means of adding an <a href="#p_exit">EXIT</a></p></div>
\r
2918 <div class="exampleblock">
\r
2919 <div class="content">
\r
2920 <div class="sidebarblock">
\r
2921 <div class="content">
\r
2922 <div class="title">Definition concept for ;</div>
\r
2923 <div class="paragraph"><p>: ; IMMEDIATE ' EXIT , ;</p></div>
\r
2926 <div style="text-align:center">
\r
2927 _______________________________________________________
\r
2929 <div class="paragraph"><p><a id="p_setup_signals"></a></p></div>
\r
2931 <div class="sect2">
\r
2932 <h3 id="_word_p_setup_signals">Word: [p_setup_signals]</h3>
\r
2933 <div class="literalblock">
\r
2934 <div class="content">
\r
2935 <pre><code>Data stack: ( -- a )</code></pre>
\r
2937 <div class="paragraph"><p>"[p_setup_signals]" is a variable word that contains the assembly code
\r
2938 sniippet for setting up the signal handling. rrqforth handles SEGV by
\r
2939 restarting the interpreter loop on <a href="#p_stdin">STDIN</a>.</p></div>
\r
2940 <div style="text-align:center">
\r
2941 _______________________________________________________
\r
2943 <div class="paragraph"><p><a id="p_shift_left"></a></p></div>
\r
2945 <div class="sect2">
\r
2946 <h3 id="_word_lt_lt">Word: <<</h3>
\r
2947 <div class="literalblock">
\r
2948 <div class="content">
\r
2949 <pre><code>Data stack: ( v1 n -- v2 )</code></pre>
\r
2951 <div class="paragraph"><p>"<<" is a function word that shifts value v1 n steps left (i.e.
\r
2952 "moving" bits towards more significant bits) to form value v2.</p></div>
\r
2953 <div style="text-align:center">
\r
2954 _______________________________________________________
\r
2956 <div class="paragraph"><p><a id="p_shift_right"></a></p></div>
\r
2958 <div class="sect2">
\r
2959 <h3 id="_word_gt_gt">Word: >></h3>
\r
2960 <div class="literalblock">
\r
2961 <div class="content">
\r
2962 <pre><code>Data stack: ( v1 n -- v2 )</code></pre>
\r
2964 <div class="paragraph"><p>">>" is a function word that shifts value v1 n steps right (i.e.
\r
2965 "moving" bits towards less significant bits) to form value v2.</p></div>
\r
2966 <div style="text-align:center">
\r
2967 _______________________________________________________
\r
2969 <div class="paragraph"><p><a id="p_shift_signed_right"></a></p></div>
\r
2971 <div class="sect2">
\r
2972 <h3 id="_word_s_gt_gt">Word: s>></h3>
\r
2973 <div class="literalblock">
\r
2974 <div class="content">
\r
2975 <pre><code>Data stack: ( v1 n -- v2 )</code></pre>
\r
2977 <div class="paragraph"><p>"s>>" is a function word that shifts value v1 n steps right (i.e.
\r
2978 "moving" bits towards less significant bits) to form value v2, but
\r
2979 preserving (and copying) the sign bit.</p></div>
\r
2980 <div style="text-align:center">
\r
2981 _______________________________________________________
\r
2983 <div class="paragraph"><p><a id="p_sp"></a></p></div>
\r
2985 <div class="sect2">
\r
2986 <h3 id="_word_sp">Word: SP</h3>
\r
2987 <div class="literalblock">
\r
2988 <div class="content">
\r
2989 <pre><code>Data stack: ( -- v )</code></pre>
\r
2991 <div class="paragraph"><p>"SP" is a value word pushing a space character onto the data stack.</p></div>
\r
2992 <div style="text-align:center">
\r
2993 _______________________________________________________
\r
2995 <div class="paragraph"><p><a id="p_state"></a></p></div>
\r
2997 <div class="sect2">
\r
2998 <h3 id="_word_state">Word: STATE</h3>
\r
2999 <div class="literalblock">
\r
3000 <div class="content">
\r
3001 <pre><code>Data stack: ( -- a )</code></pre>
\r
3003 <div class="paragraph"><p>"STATE" is a variable word marking whether the stream evaluator is in
\r
3004 compiling mode (1) or interpreting (0) mode.</p></div>
\r
3005 <div style="text-align:center">
\r
3006 _______________________________________________________
\r
3008 <div class="paragraph"><p><a id="p_stdin"></a></p></div>
\r
3010 <div class="sect2">
\r
3011 <h3 id="_word_stdin">Word: STDIN</h3>
\r
3012 <div class="literalblock">
\r
3013 <div class="content">
\r
3014 <pre><code>Data stack: ( -- stream )</code></pre>
\r
3016 <div class="paragraph"><p>"STDIN" is a value word referring to the stream buffer for the
\r
3017 standard input file descriptor.</p></div>
\r
3018 <div style="text-align:center">
\r
3019 _______________________________________________________
\r
3021 <div class="paragraph"><p><a id="p_stream"></a></p></div>
\r
3023 <div class="sect2">
\r
3024 <h3 id="_word_stream">Word: STREAM</h3>
\r
3025 <div class="literalblock">
\r
3026 <div class="content">
\r
3027 <pre><code>Data stack: ( fd size -- addr ) or ( block -1 -- addr )</code></pre>
\r
3029 <div class="paragraph"><p>"STREAM" is a function word that sets up a buffer for an input file
\r
3030 descriptor or for a memory block (of size+data).</p></div>
\r
3031 <div class="sect3">
\r
3032 <h4 id="_file_descriptor_backed_stream">File descriptor backed STREAM</h4>
\r
3033 <div class="paragraph"><p>A file descriptor backed STREAM gains a buffer of the given size
\r
3034 prefixed by a 32 byte STREAM header of the following layout:</p></div>
\r
3035 <div class="exampleblock">
\r
3036 <div class="content">
\r
3037 <div class="listingblock">
\r
3038 <div class="title">Layout 3: file descriptor stream</div>
\r
3039 <div class="content">
\r
3040 <pre><code> 8 bytes = size of buffer (excluding the 32 byte header)
\r
3041 8 bytes source file descriptor
\r
3042 8 bytes current fill
\r
3043 8 current read position</code></pre>
\r
3047 <div class="sect3">
\r
3048 <h4 id="_memory_block_backed_stream">Memory block backed STREAM</h4>
\r
3049 <div class="paragraph"><p>A memory block stream is only the header (though allocated via
\r
3050 <a href="#p_malloc">MALLOC</a> which reserves a full kernel page) with the
\r
3051 following layout:</p></div>
\r
3052 <div class="exampleblock">
\r
3053 <div class="content">
\r
3054 <div class="listingblock">
\r
3055 <div class="title">Layout 4: memory block stream</div>
\r
3056 <div class="content">
\r
3057 <pre><code> 8 bytes = block address
\r
3058 8 -1 (indicates memory block)
\r
3059 8 size of block (taken from the block's first 8 bytes)
\r
3060 8 current read position</code></pre>
\r
3063 <div style="text-align:center">
\r
3064 _______________________________________________________
\r
3066 <div class="paragraph"><p><a id="p_stream_nchars"></a></p></div>
\r
3069 <div class="sect2">
\r
3070 <h3 id="_word_stream_nchars">Word: STREAM-NCHARS</h3>
\r
3071 <div class="literalblock">
\r
3072 <div class="content">
\r
3073 <pre><code>Data stack: ( stream -- n )</code></pre>
\r
3075 <div class="paragraph"><p>"STREAM-NCHARS" is a function word that scans ahead in the stream
\r
3076 buffer for the next non-whitespace character, and returns its position
\r
3077 relative to the end of the buffer. This is done without changing the
\r
3078 stream (or filling it by reading the backing file).</p></div>
\r
3079 <div style="text-align:center">
\r
3080 _______________________________________________________
\r
3082 <div class="paragraph"><p><a id="p_strlen"></a></p></div>
\r
3084 <div class="sect2">
\r
3085 <h3 id="_word_strlen">Word: STRLEN</h3>
\r
3086 <div class="literalblock">
\r
3087 <div class="content">
\r
3088 <pre><code>Data stack: ( s -- n )</code></pre>
\r
3090 <div class="paragraph"><p>"STRLEN" is a function words that counts how many bytes there are from
\r
3091 s to the first NUL byte and returns that count, n, not including the
\r
3092 NUL byte.</p></div>
\r
3093 <div style="text-align:center">
\r
3094 _______________________________________________________
\r
3096 <div class="paragraph"><p><a id="p_strncmp"></a></p></div>
\r
3098 <div class="sect2">
\r
3099 <h3 id="_word_strncmp">Word: STRNCMP</h3>
\r
3100 <div class="literalblock">
\r
3101 <div class="content">
\r
3102 <pre><code>Data stack: ( s1 s2 n -- v )</code></pre>
\r
3104 <div class="paragraph"><p>"STRNCMP" is a function words that compares up to n characters of
\r
3105 character sequences s1 and s2, and returns the difference of the first
\r
3106 differing characters, as in <code>s2[i] - s1[i]</code>, or 0 if all n characters
\r
3107 are the same.</p></div>
\r
3108 <div class="paragraph"><p>I.e., the value v is less than 0 if string [n:s1] is alpha-numerically
\r
3110 v is greater than 0 if [n:s1] is greater than [n:s2],
\r
3111 and v is 0 if [n:s1] and [n:s2] are equal.</p></div>
\r
3112 <div style="text-align:center">
\r
3113 _______________________________________________________
\r
3115 <div class="paragraph"><p><a id="p_strncpy"></a></p></div>
\r
3117 <div class="sect2">
\r
3118 <h3 id="_word_strncpy">Word: STRNCPY</h3>
\r
3119 <div class="literalblock">
\r
3120 <div class="content">
\r
3121 <pre><code>Data stack: ( s1 s2 n -- )</code></pre>
\r
3123 <div class="paragraph"><p>"STRNCPY" is a function words that copies n bytes of byte sequence s1
\r
3125 <div style="text-align:center">
\r
3126 _______________________________________________________
\r
3128 <div class="paragraph"><p><a id="p_swap"></a></p></div>
\r
3130 <div class="sect2">
\r
3131 <h3 id="_word_swap">Word: SWAP</h3>
\r
3132 <div class="literalblock">
\r
3133 <div class="content">
\r
3134 <pre><code>Data stack: ( v1 v2 -- v2 v1 )</code></pre>
\r
3136 <div class="paragraph"><p>"SWAP" is a function word the swaps the top two data stack cells.</p></div>
\r
3137 <div style="text-align:center">
\r
3138 _______________________________________________________
\r
3140 <div class="paragraph"><p><a id="p_system"></a></p></div>
\r
3142 <div class="sect2">
\r
3143 <h3 id="_word_system">Word: SYSTEM</h3>
\r
3144 <div class="literalblock">
\r
3145 <div class="content">
\r
3146 <pre><code>Data value: ( -- a )</code></pre>
\r
3148 <div class="paragraph"><p>"SYSTEM" is a variable that holds the word list data for the system
\r
3149 calls. This is set up as separate word list from <a href="#p_forth">FORTH</a>
\r
3150 merely as a matter of segregation.</p></div>
\r
3151 <div style="text-align:center">
\r
3152 _______________________________________________________
\r
3154 <div class="paragraph"><p><a id="p_tell"></a></p></div>
\r
3156 <div class="sect2">
\r
3157 <h3 id="_word_tell">Word: TELL</h3>
\r
3158 <div class="literalblock">
\r
3159 <div class="content">
\r
3160 <pre><code>Data stack: ( char* n -- )</code></pre>
\r
3162 <div class="paragraph"><p>"TELL" is a function word that prints a string to stdout (file
\r
3163 descriptor 1).</p></div>
\r
3164 <div style="text-align:center">
\r
3165 _______________________________________________________
\r
3167 <div class="paragraph"><p><a id="p_terminate0"></a></p></div>
\r
3169 <div class="sect2">
\r
3170 <h3 id="_word_terminate0">Word: TERMINATE0</h3>
\r
3171 <div class="literalblock">
\r
3172 <div class="content">
\r
3173 <pre><code>Data stack: ( -- )</code></pre>
\r
3175 <div class="paragraph"><p>"TERMINATE0" is a function word that terminates the program with exit
\r
3177 <div style="text-align:center">
\r
3178 _______________________________________________________
\r
3180 <div class="paragraph"><p><a id="p_tfa2cfa"></a></p></div>
\r
3182 <div class="sect2">
\r
3183 <h3 id="_word_tfa_gt_cfa">Word: TFA>CFA</h3>
\r
3184 <div class="literalblock">
\r
3185 <div class="content">
\r
3186 <pre><code>Data stack: ( tfa -- cfa )</code></pre>
\r
3188 <div class="paragraph"><p>"TFA>CFA" is a function word that pushes word cfa of the given tfa.</p></div>
\r
3189 <div class="exampleblock">
\r
3190 <div class="content">
\r
3191 <div class="sidebarblock">
\r
3192 <div class="content">
\r
3193 <div class="title">Definition concept for TFA>CFA</div>
\r
3194 <div class="paragraph"><p>: TFA>CFA 8 + @ ;</p></div>
\r
3197 <div style="text-align:center">
\r
3198 _______________________________________________________
\r
3200 <div class="paragraph"><p><a id="p_tfa2dfa"></a></p></div>
\r
3202 <div class="sect2">
\r
3203 <h3 id="_word_tfa_gt_dfa">Word: TFA>DFA</h3>
\r
3204 <div class="literalblock">
\r
3205 <div class="content">
\r
3206 <pre><code>Data stack: ( tfa -- dfa )</code></pre>
\r
3208 <div class="paragraph"><p>"TFA>DFA" is a function word that pushes word dfa of the given tfa.</p></div>
\r
3209 <div class="exampleblock">
\r
3210 <div class="content">
\r
3211 <div class="sidebarblock">
\r
3212 <div class="content">
\r
3213 <div class="title">Definition concept for TFA>DFA</div>
\r
3214 <div class="paragraph"><p>: TFA>DFA TFA>CFA 8 + ;</p></div>
\r
3217 <div style="text-align:center">
\r
3218 _______________________________________________________
\r
3220 <div class="paragraph"><p><a id="p_tfa2flags_get"></a></p></div>
\r
3222 <div class="sect2">
\r
3223 <h3 id="_word_tfa_gt_flags">Word: TFA>FLAGS@</h3>
\r
3224 <div class="literalblock">
\r
3225 <div class="content">
\r
3226 <pre><code>Data stack: ( tfa -- flags )</code></pre>
\r
3228 <div class="paragraph"><p>"TFA>FLAGS@" is a function word that pushes word flags of the given tfa.</p></div>
\r
3229 <div class="exampleblock">
\r
3230 <div class="content">
\r
3231 <div class="sidebarblock">
\r
3232 <div class="content">
\r
3233 <div class="title">Defintion concept for TFA>FLAGS@</div>
\r
3234 <div class="paragraph"><p>: TFA>FLAGS@ 16 + @ ;</p></div>
\r
3237 <div style="text-align:center">
\r
3238 _______________________________________________________
\r
3240 <div class="paragraph"><p><a id="p_tfa2namez"></a></p></div>
\r
3242 <div class="sect2">
\r
3243 <h3 id="_word_tfa_gt_namez">Word: TFA>NAMEZ</h3>
\r
3244 <div class="literalblock">
\r
3245 <div class="content">
\r
3246 <pre><code>Data stack: ( tfa -- char* )</code></pre>
\r
3248 <div class="paragraph"><p>"TFA>NAMEZ" is a function word that pushes changes a tfa pointer to a
\r
3249 pointer to the word pname’s character sequence, which is zero
\r
3250 terminated as well as preceded by a length cell.</p></div>
\r
3251 <div class="exampleblock">
\r
3252 <div class="content">
\r
3253 <div class="sidebarblock">
\r
3254 <div class="content">
\r
3255 <div class="title">Defintion concept for TFA>NAMEZ</div>
\r
3256 <div class="paragraph"><p>: TFA>NAMEZ 32 + ;</p></div>
\r
3259 <div style="text-align:center">
\r
3260 _______________________________________________________
\r
3262 <div class="paragraph"><p><a id="p_then"></a></p></div>
\r
3264 <div class="sect2">
\r
3265 <h3 id="_word_then">Word: THEN</h3>
\r
3266 <div class="literalblock">
\r
3267 <div class="content">
\r
3268 <pre><code>Data stack: Compiling: ( a -- )</code></pre>
\r
3270 <div class="paragraph"><p>"THEN" is an immediate function word that is used together with
\r
3271 <a href="#p_if">IF</a> and <a href="#p_else">ELSE</a> to implement structured execution
\r
3272 control. THEN performs the branch resolution for the stacked address
\r
3273 which pinpoints the foot address the branch offset to resolve, so that
\r
3274 at execution time there is an appropriate conditional branch past the
\r
3275 "then-part" or the "else-part" of the "structured statement".</p></div>
\r
3276 <div style="text-align:center">
\r
3277 _______________________________________________________
\r
3279 <div class="paragraph"><p><a id="p_this_word"></a></p></div>
\r
3281 <div class="sect2">
\r
3282 <h3 id="_word_this_word">Word: THIS-WORD</h3>
\r
3283 <div class="literalblock">
\r
3284 <div class="content">
\r
3285 <pre><code>Data stack: ( -- a )</code></pre>
\r
3287 <div class="paragraph"><p>"THIS-WORD" is a variable word used in
\r
3288 <a href="#p_evaluate_stream:EVALUATE-STREAM">[p_evaluate_stream:EVALUATE-STREAM]</a> as cache for the [n:char*]
\r
3289 values of the successive words being evaluated. This typically points
\r
3290 into the input stream buffer and remain valid until further stream
\r
3291 buffering functions are used.</p></div>
\r
3292 <div style="text-align:center">
\r
3293 _______________________________________________________
\r
3295 <div class="paragraph"><p><a id="p_true"></a></p></div>
\r
3297 <div class="sect2">
\r
3298 <h3 id="_word_true">Word: TRUE</h3>
\r
3299 <div class="literalblock">
\r
3300 <div class="content">
\r
3301 <pre><code>Data stack: ( -- -1 )</code></pre>
\r
3303 <div class="paragraph"><p>"TRUE" is a value word representing logical true.</p></div>
\r
3304 <div style="text-align:center">
\r
3305 _______________________________________________________
\r
3307 <div class="paragraph"><p><a id="p_tuck"></a></p></div>
\r
3309 <div class="sect2">
\r
3310 <h3 id="_word_tuck">Word: TUCK</h3>
\r
3311 <div class="literalblock">
\r
3312 <div class="content">
\r
3313 <pre><code>Data stack ( v1 v2 -- v2 v1 v2 )</code></pre>
\r
3315 <div class="paragraph"><p>"TUCK" is a function word that "inserts" the top cell below the second
\r
3316 cell on the data stack.</p></div>
\r
3317 <div class="exampleblock">
\r
3318 <div class="content">
\r
3319 <div class="sidebarblock">
\r
3320 <div class="content">
\r
3321 <div class="title">Definition concept for TUCK</div>
\r
3322 <div class="paragraph"><p>: TUCK SWAP OVER ;</p></div>
\r
3325 <div style="text-align:center">
\r
3326 _______________________________________________________
\r
3328 <div class="paragraph"><p><a id="p_unequal"></a></p></div>
\r
3330 <div class="sect2">
\r
3331 <h3 id="_word_19">Word: !=</h3>
\r
3332 <div class="literalblock">
\r
3333 <div class="content">
\r
3334 <pre><code>Data stack: ( v1 v2 -- 0/-1 )</code></pre>
\r
3336 <div class="paragraph"><p>"!=" is a function word that replaces a pair of values with -1 of the
\r
3337 values are unequal, and 0 otherwise.</p></div>
\r
3338 <div style="text-align:center">
\r
3339 _______________________________________________________
\r
3341 <div class="paragraph"><p><a id="p_verboseQ"></a></p></div>
\r
3343 <div class="sect2">
\r
3344 <h3 id="_word_verbose">Word: VERBOSE?</h3>
\r
3345 <div class="literalblock">
\r
3346 <div class="content">
\r
3347 <pre><code>Data stack: ( -- a )</code></pre>
\r
3349 <div class="paragraph"><p>"VERBOSE?" is a variable word that is assigned at start up to -1 or 0
\r
3350 signify whether or not the command line arguments includes "-v". When
\r
3351 non-zero (i.e. running rrqforth with "-v") the evaluation loop is more
\r
3352 verbose.</p></div>
\r
3353 <div style="text-align:center">
\r
3354 _______________________________________________________
\r
3356 <div class="paragraph"><p><a id="p_within"></a></p></div>
\r
3358 <div class="sect2">
\r
3359 <h3 id="_word_within">Word: WITHIN</h3>
\r
3360 <div class="literalblock">
\r
3361 <div class="content">
\r
3362 <pre><code>Data stack: ( v lo hi -- 0/-1</code></pre>
\r
3364 <div class="paragraph"><p>"WITHIN" is a function word that replaces a triple of values with -1
\r
3365 of the the first, v, is within the value range spanned by the second,
\r
3366 lo, inclusive and third, hi, exclusive.</p></div>
\r
3367 <div class="exampleblock">
\r
3368 <div class="content">
\r
3369 <div class="sidebarblock">
\r
3370 <div class="content">
\r
3371 <div class="title">Definition concept for WITHIN</div>
\r
3372 <div class="paragraph"><p>: WITHIN 2 PICK > ROT ROT ⇐ AND ;</p></div>
\r
3375 <div style="text-align:center">
\r
3376 _______________________________________________________
\r
3378 <div class="paragraph"><p><a id="p_words"></a></p></div>
\r
3380 <div class="sect2">
\r
3381 <h3 id="_word_words">Word: WORDS</h3>
\r
3382 <div class="literalblock">
\r
3383 <div class="content">
\r
3384 <pre><code>Data stack: ( wl -- )</code></pre>
\r
3386 <div class="paragraph"><p>"WORDS" is a function word that prints all words of teh given word
\r
3387 list to stdout (file descriptor 1).</p></div>
\r
3388 <div style="text-align:center">
\r
3389 _______________________________________________________
\r
3391 <div class="paragraph"><p><a id="p_xor"></a></p></div>
\r
3393 <div class="sect2">
\r
3394 <h3 id="_word_xor">Word: XOR</h3>
\r
3395 <div class="literalblock">
\r
3396 <div class="content">
\r
3397 <pre><code>Data stack: ( v1 v2 -- v3 )</code></pre>
\r
3399 <div class="paragraph"><p>"XOR" is a function word that replaces a value pair with their bitwise
\r
3400 exclusion; each bit is 1 if the corresponding bits of the two operands
\r
3401 differ and 0 if not.</p></div>
\r
3402 <div style="text-align:center">
\r
3403 _______________________________________________________
\r
3405 <div class="paragraph"><p><a id="return_stack"></a></p></div>
\r
3407 <div class="sect2">
\r
3408 <h3 id="_word_return_stack">Word: RETURN-STACK</h3>
\r
3409 <div class="literalblock">
\r
3410 <div class="content">
\r
3411 <pre><code>Data stack: ( -- a )</code></pre>
\r
3413 <div class="paragraph"><p>"RETURN-STACK" is a variable word harbouring the return stack.</p></div>
\r
3417 <div class="sect1">
\r
3418 <h2 id="_system_calls">System calls</h2>
\r
3419 <div class="sectionbody">
\r
3420 <div class="paragraph"><p>RRQFORTH includes function wrapping for all "Linux syscalls", which
\r
3421 generally are described in their "man pages. This wrapping takes the
\r
3422 arguments fro the data stack in reverse order, i.e. the first argument
\r
3423 is deepest.</p></div>
\r
3424 <div class="paragraph"><p>Use <code>SYSTEM WORDS</code> to get a list of all (321) available syscalls.</p></div>
\r
3428 <div id="footnotes"><hr /></div>
\r
3430 <div id="footer-text">
\r
3432 2021-06-04 18:26:45 AEST
\r