home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / bbl / doc / bbl.doc < prev    next >
Encoding:
Text File  |  1986-10-25  |  261.9 KB  |  6,667 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.      BBL FORTH REFERENCE
  8.  
  9.  
  10.  
  11.      General
  12.  
  13.      BBL (Big Business Language or Big Black Lady) is a public domain 32-
  14.      bit Forth Compiler for MS-DOS machines.  It is written in Microsoft
  15.      Assembler version 4.  You are free to use, sell, modify or cannibalize
  16.      any parts of BBL without credit.  All source, object code and
  17.      documentation can be used for any purpose, except military.
  18.  
  19.      This documentation covers the BBL Forth compiler.  It is a reference
  20.      document -- not too much use for learning.  To learn how to write BBL
  21.      Forth you should read Leo Brodie's Starting Forth and practice with a
  22.      16-bit Forth-79 compiler.  BBL is usually used as the underpinnings of
  23.      the Abundance language, but it can stand on its own as a very fast 32-
  24.      bit Forth-83 compiler.  The most common BBL verbs are also documented
  25.      in ABUN.DOC, but all the BBL verbs described here can also be used in
  26.      Abundance programs.
  27.  
  28.  
  29.      Learning BBL Forth
  30.  
  31.      To get an overview of the internal workings of Forth you might read
  32.      the Forth article by Mahlon G. Kelly and Nicholas Spies in the 1986
  33.      September PC Tech Journal.  You cannot truly understand, appreciate or
  34.      milk the full power of Forth until you have an understanding of how it
  35.      works under the hood.  Unlike most other languages, the applications
  36.      programmer is expected to tinker with the innards to take command of
  37.      the compiling process.
  38.  
  39.      There is a wealth of documentation embedded in the BBL compiler
  40.      listings in either BBL.LST or BBL*.ASM.  Looking at the assembler
  41.      source code for a word can often be far more informative than reams of
  42.      documentation.  I personally learned Forth without any documentation
  43.      at all;  I just studied John James PDP-11 FIG-Forth compiler listings.
  44.      The other way to learn about a word is to use the editor to search for
  45.      uses of the word in the source code examples.  I also strongly
  46.      recommend reading BBLDOC.ASM which gives an overview of how the BBL
  47.      Forth compiler works internally.
  48.  
  49.      There are lots of beginning Forth books, but they just tell you the
  50.      easy stuff you can figure out with no trouble on your own.  Brodie
  51.      goes a little further than most with his Under the Hood chapter. I
  52.      have never seen a decent description of how to create your own
  53.      IMMEDIATE words like IF THEN and .".  I have never seen a really
  54.      decent explanation of CREATE DOES> and ;CODE.  They are handled in
  55.      advanced magazine articles, but by the time you are knowledgeable
  56.      enough to understand them, you have figured out it out on your own
  57.      already.  One of the best intermediate books is Kevin McCabe's Forth
  58.      Fundamentals Volume 2 - The Language Glossary.  It shows some of the
  59.  
  60.  
  61.  
  62.            \BBL\BBL.DOC  -1-  last updated 1986 October 14 21:30
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. BBL Forth Reference
  71.  
  72.  
  73.      source listings of a heavily-commented simple-minded Forth-79
  74.      compiler, written for clarity rather than speed.
  75.  
  76.      Later you might subscribe to Forth Dimensions, PO Box 2786, Rochester
  77.      New York, 14627, USA.  It is an advanced magazine.  Someday I might be
  78.      smart enough to understand it.  They use thermometers on the articles
  79.      to warn you of the degree of difficulty, and there is some material
  80.      for beginners, but if you are a rank amateur, reading it may prove
  81.      discouraging.
  82.  
  83.      The problem with Forth is that once you understand it, it is so simple
  84.      and elegant no explanation seems necessary.  Yet as soon as you try to
  85.      explain it, it sounds like Greek.  Some day I may have the time to
  86.      write some real documentation that does not presume you already know
  87.      Forth.  In the meantime, all I can say is Forth is the most deeply
  88.      satisfying language I have ever encountered -- and I have used dozens
  89.      of them.  Learning it is well worth the considerable initial effort.
  90.  
  91.      However, the document you will keep coming back to is this one -- the
  92.      BBL reference document.  Think of Forth as a secret code you have to
  93.      crack.  The way you find out 80% of your knowledge will be by
  94.      performing experiments.  Do not feel discouraged;  experiments are
  95.      easier to perform in Forth than in any other language you are likely
  96.      to have tried.  When I teach Forth, I tell the kids,  "Here are some
  97.      words DUP SWAP ROT PICK.  See if you can figure out what they do."
  98.      Even my Mom figured them out eventually.
  99.  
  100.  
  101.      BBL and Forth-83
  102.  
  103.      Roughly speaking, BBL is just like a standard 16-bit Forth-83, except
  104.      instead of working on 16-bit quantities on the stacks it works with
  105.      32-bit quantities.  All the standard operators work on 32-bit
  106.      quantities instead of 16-bit ones.
  107.  
  108.      Another difference is that, instead of being simple 16-bit offsets
  109.      relative to the start of the program, addresses are 32-bit absolute
  110.      machine addresses formed of a 16-bit segment and 16-bit offset
  111.      portion.  To get the true 20-bit linear address, the 8088 addressing
  112.      hardware adds the segment (shifted four bits left -- i.e. multiplied
  113.      by 16) to the offset.  Thus the same 20-bit physical address can be
  114.      gotten at with a number of different segment and offset combinations.
  115.      A given segment register can be used to cover 64K  -- in other words
  116.      with a given segment you can get at the following 64K worth of
  117.      addresses without having to change the segment register.  All the
  118.      string handling instructions are limited to strings of 64K where the
  119.      beginning and end of the string are covered by the same segment.  To
  120.      learn more about segments and offsets you will have to read The 8086
  121.      Book by Russell Rector and George Alexy.  Before that makes much
  122.      sense, you will probably need a fair understanding of 8086 assembler
  123.      programming.  I have bad news.  The 8086 has the most complex machine
  124.      language of anything short of a Burroughs 6700.
  125.  
  126.  
  127.  
  128.            \BBL\BBL.DOC  -2-  last updated 1986 October 14 21:30
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. BBL Forth Reference
  137.  
  138.  
  139.      16-bit Forth-83 programs are limited to 64K.  BBL 32-bit Forth
  140.      programs are limited to 1,000K -- a full megabyte.  BBL has a much
  141.      more complex dictionary structure than the FIG Forth model.  The
  142.      complexity allows much faster compilation, much more compact code, and
  143.      execution speeds that rival the best 16-bit Forth compilers.
  144.  
  145.  
  146.      Errors
  147.  
  148.      Parts of this document may sound like it was written by a lawyer.
  149.      That is because was derived from the Forth-83 standard document.  The
  150.      original document was typed by volunteers with no computer experience.
  151.      Thus many strange errors crept in.  If you doubt your eyes, perform
  152.      experiments, consult the Forth-83 standard, and examine the compiler
  153.      listings.
  154.  
  155.      There are still numerous errors in this document, so take anything you
  156.      read with a grain of salt.  Please report even minor errors so I can
  157.      clean them up and save future generations of programmers the
  158.      frustration.
  159.  
  160.  
  161.      Stack Parameters
  162.  
  163.      There are two stacks in Forth the Data stack where intermediate
  164.      calculation are stored and the Return stack where BBL keeps track of
  165.      what routine called what routine.  Numbers and addresses can be pushed
  166.      to either stack.  The format is the same for both stacks.  Unless
  167.      otherwise stated, all references to the stack refer to the data stack
  168.      not the return stack.  Unless otherwise stated, all references to
  169.      numbers apply to 32-bit signed integers.
  170.  
  171.      The following are the stack parameter abbreviations and types of
  172.      numbers used throughout the glossary.  These abbreviations may be
  173.      suffixed with a digit to differentiate multiple parameters of the same
  174.      type.
  175.  
  176.      flag           Boolean value.  0 represents false.  Any non-zero value
  177.                     represents true.  Most commonly -1 is used for true.
  178.                     Note that in Forth-79 (Leo Brodie's book) 1 is most
  179.                     commonly used for true.  Flags are always 32-bits.  A
  180.                     flag is called canonical if it is normalized to either
  181.                     0 or -1.
  182.  
  183.      true           Boolean value.  As a result it is always a canonical -
  184.                     1.  As an operand it is any non-zero value.  Always 32-
  185.                     bits.
  186.  
  187.      false          Boolean value.  0.  Always 32-bits.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.            \BBL\BBL.DOC  -3-  last updated 1986 October 14 21:30
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. BBL Forth Reference
  203.  
  204.  
  205.      c              Unsigned 8-bit integer or IBM-extended ASCII character
  206.                     {0 .. 255}
  207.                     {0 .. FF}
  208.                     {0 .. 28-1}
  209.                     Takes 8 bits in RAM, 32 bits 0-extended on the stack.
  210.  
  211.      w              Signed 16-bit integer
  212.                     {-32,768 .. 32,767}
  213.                     {8000 .. 7FFF}
  214.                     {-215 .. 215-1}
  215.                     Takes 16 bits in RAM, 32 bits sign-extended on the
  216.                     stack.
  217.  
  218.      +w             Positive signed 16-bit integer
  219.                     {0 .. 32,767}
  220.                     {0 .. 7FFF}
  221.                     {0 .. 215-1}
  222.                     Takes 16 bits in RAM, 32 bits 0-extended on the stack.
  223.  
  224.      uw             Unsigned 16-bit integer
  225.                     {0 .. 65,535}
  226.                     {0 .. FFFF}
  227.                     {0 .. 216-1}
  228.                     Takes 16 bits in RAM, 32 bits 0-extended on the stack.
  229.  
  230.      t              signed 24-bit integer
  231.                     {-8,388,608 .. 8,388,607}
  232.                     {800000 .. 7FFFFF}
  233.                     {-223 .. 223-1}
  234.                     Takes 24 bits in RAM, 32 bits sign-extended on the
  235.                     stack.
  236.  
  237.      +t             Positive signed 24-bit integer
  238.                     {0 .. 8,388,607}
  239.                     {0  .. 7FFFFF}
  240.                     {0 .. 223-1}
  241.                     Takes 24 bits in RAM, 32 bits 0-extended on the stack.
  242.  
  243.      ut             Unsigned 24-bit integer
  244.                     {0 .. 16,777,215}
  245.                     {0 .. FFFFFF}
  246.                     {0 .. 224-1}
  247.                     Takes 24 bits in RAM, 32 bits 0-extended on the stack.
  248.  
  249.      n              Signed 32-bit integer
  250.                     {-2,147,483,648 .. 2,147,483,647}
  251.                     {80000000 .. 7FFFFFFF}
  252.                     {-231 .. 231-1}
  253.                     Always 32 bits.
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.            \BBL\BBL.DOC  -4-  last updated 1986 October 14 21:30
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. BBL Forth Reference
  269.  
  270.  
  271.      +n             Positive signed 32-bit integer
  272.                     {0 .. 2,147,483,647}
  273.                     {0 .. 7FFFFFFF}
  274.                     {0 .. 231-1}
  275.                     Always 32 bits.
  276.  
  277.      u              Unsigned 32-bit integer
  278.                     {0 .. 4,294,967,295}
  279.                     {0 .. FFFFFFFF}
  280.                     {0 .. 232-1}
  281.                     Always 32 bits.
  282.  
  283.      d              Signed double precision 64-bit integer.
  284.                     {-9,223,372,036,854,775,808 ..
  285.                     9,223,372,036,854,775,807}
  286.                     {8000000000000000 .. 7FFFFFFFFFFFFFFF}
  287.                     {-263 .. 263-1}
  288.                     Always 64 bits.
  289.  
  290.      +d             Positive signed double precision 64-bit integer.
  291.                     {0 .. 9,223,372,036,854,775,807}
  292.                     {0 .. 7FFFFFFFFFFFFFFF}
  293.                     {0 .. 263-1}
  294.                     Always 64 bits.
  295.  
  296.      ud             Unsigned double precision 64-bit integer
  297.                     {0 .. 18,446,744,073,709,551,615}
  298.                     {0 .. FFFFFFFFFFFFFFFF}
  299.                     {0 .. 264-1}
  300.                     Always 64 bits.
  301.  
  302.      addr           An absolute segment:offset machine address.
  303.                     {0000:0000 .. FFFF:FFFF} Always 32 bits.  The offset
  304.                     can have any value {0 .. FFFF}, but it is usually kept
  305.                     small enough so that the same segment can cover any
  306.                     useful data following this address.  The offset is kept
  307.                     in the LSW (low order 16 bits) and the segment is kept
  308.                     in the MSW (high order 16 bits).  For most practical
  309.                     purposes this address can be treated as if it were a
  310.                     plain 32-bit integer offset from the beginning of RAM.
  311.                     For example, you can add 1 to an address to get the
  312.                     segment:offset of the following address.  Before you
  313.                     can compare two addresses, they must both have the same
  314.                     segment or they both must be converted to relative
  315.                     addresses.  Compare absolute addresses using unsigned
  316.                     compares and relative addresses using signed compares.
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.            \BBL\BBL.DOC  -5-  last updated 1986 October 14 21:30
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. BBL Forth Reference
  335.  
  336.  
  337.      caddr          A canonical absolute segment:offset machine address.
  338.                     The offset is always in the range 0 .. 15.  Always 32
  339.                     bits.  pronounced "canonical address".  When addresses
  340.                     are in this form, they cover the most territory after
  341.                     them.  In other words addresses up to 64K past the
  342.                     address can be got at by simple addition to the offset
  343.                     portion without adjusting the segment portion of the
  344.                     address.
  345.  
  346.      LSW            Least significant word - low order 16 bits of a 32-bit
  347.                     quantity.
  348.  
  349.      MSW            Most significant word - high order 16 bits of a 32-bit
  350.                     quantity.
  351.  
  352.      saddr          A screen address in the REGEN buffer.  {0 .. 3999} { 0
  353.                     .. (25*80*2)-1 }.  The offset of a character or
  354.                     attribute byte being displayed on the screen.  Note
  355.                     this is not the segment:offset address of the
  356.                     character.  At the even byte e.g. saddr 0, 2, 4 ... in
  357.                     the REGEN buffer is the character currently displayed
  358.                     in the upper-left corner of the screen.  At the
  359.                     following odd byte e.g. saddr 1, 3, 5 ... is the
  360.                     attribute byte for that character that determines if it
  361.                     is blinking, bright, dim, red, green, yellow, etc.
  362.                     pronounced "sadder"
  363.  
  364.      raddr          A relative address.  The offset from the beginning of
  365.                     the program as a 32-bit signed integer.  Note this is
  366.                     not in segment:offset form.  Before you can compare two
  367.                     absolute addresses, they must both have the same
  368.                     segment or they both must be converted to relative
  369.                     addresses.  Compare absolute addresses using unsigned
  370.                     compares and relative addresses using signed compares.
  371.                     pronounced "relative address"
  372.  
  373.  
  374.      Addition
  375.  
  376.      There is no word "addition" in BBL,  however all addition operators
  377.      work the same way.  All addition operators work on either signed or
  378.      unsigned quantities.  Overflow is ignored; only the least significant
  379.      bits of the sum are kept.
  380.       12  2 + --  14
  381.      -12  2 + -- -10
  382.       12 -2 + --  10
  383.      -12 -2 + -- -14
  384.      c.f. + D+ 1+ 2+ 4+ +!
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.            \BBL\BBL.DOC  -6-  last updated 1986 October 14 21:30
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. BBL Forth Reference
  401.  
  402.  
  403.      Subtraction
  404.  
  405.      There is no word "subtraction" in BBL,  however all subtraction
  406.      operators work the same way.  All subtraction operators work on either
  407.      signed or unsigned quantities.  Overflow is ignored; only the least
  408.      significant bits of the difference are kept.  Subtraction is done by
  409.      taking the two's complement of the subtrahend and adding it to the
  410.      minuend.
  411.       12  2 - --  10
  412.      -12  2 - -- -14
  413.       12 -2 - --  14
  414.      -12 -2 - -- -10
  415.      c.f. - D- SWAP- 1- 2- 4- -! NEGATE ?NEGATE DNEGATE ?DNEGATE NOT
  416.  
  417.  
  418.      Multiplication
  419.  
  420.      There is no word "multiplication" in BBL,  however all multiplication
  421.      operators work the same way.  All multiplication operators work on
  422.      either signed or unsigned quantities.  Overflow is ignored; only the
  423.      least significant bits of the product are kept.  Multiplication by
  424.      powers of two is done with shifts.  Use of the NEC V20 PD 70108-5
  425.      microprocessor greatly speeds multiplication.  The new processor chip
  426.      costs under $20 and simply replaces the 8088 chip.  If you have an
  427.      8MHz accelerated clock machine you will need the faster 70108-8.
  428.       12  2 * --  24
  429.      -12  2 * -- -24
  430.       12 -2 * -- -24
  431.      -12 -2 * --  24
  432.      c.f. * M* UM* Q* */ */MOD 2* 4* 8* 10* 16* 64* 256* SHIFT
  433.  
  434.  
  435.      Division
  436.  
  437.      There is no word "division" in BBL,  however all division and MOD
  438.      operators work the same way using integer floored division.  BBL takes
  439.      the next lowest integer if the quotient is fractional.  The remainder
  440.      has same sign as divisor.  The result of division by zero is 0
  441.      remainder 0.
  442.  
  443.      The absolute value of the remainder is always less than the divisor.
  444.      Division is so defined that if you take the quotient and multiply it
  445.      by the divisor and add back the remainder you will get the dividend.
  446.      Surprisingly some other languages (including earlier versions of
  447.      Forth) do not have these obvious Euclidean properties for division
  448.      when negative numbers are involved.
  449.  
  450.      Even though it is possibly contrary to the Forth 83 standard, BBL
  451.      recovers from division by 0 by giving a 0 quotient and 0 remainder
  452.      without any error message.  It also recovers from overflow of the
  453.      quotient by giving the least significant part of the quotient without
  454.      issuing any error message.
  455.  
  456.  
  457.  
  458.            \BBL\BBL.DOC  -7-  last updated 1986 October 14 21:30
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. BBL Forth Reference
  467.  
  468.  
  469.      Use of the NEC V20 microprocessor greatly speeds division.  When this
  470.      processor is not used, BBL checks for numerous special cases to
  471.      optimize division.  Even in the worst case, BBL handles a 64 by 32-bit
  472.      divide in 2 DIV and 2 MUL instructions -- a substantial improvement
  473.      over Knuth's standard multiprecision algorithm used in most other
  474.      Forth compilers.  If all goes well, other compilers will soon
  475.      cannibalize BBL's algorithm.
  476.  
  477.       12  2 /MOD  --   rem  0  quot  6
  478.      -12  2 /MOD  --   rem  0  quot -6
  479.       12 -2 /MOD  --   rem  0  quot -6
  480.      -12 -2 /MOD  --   rem  0  quot  6
  481.       10  4 /MOD  --   rem  2  quot  2
  482.      -10  4 /MOD  --   rem  2  quot -3
  483.       10 -4 /MOD  --   rem -2  quot -3
  484.      -10 -4 /MOD  --   rem -2  quot  2
  485.       10  0 /MOD  --   rem  0  quot  0
  486.      -10  0 /MOD  --   rem  0  quot  0
  487.  
  488.      Here is a complete list of division operators:
  489.  
  490.      Unsigned division
  491.      MU/MOD     ( num-64 denom-32 -- rem-32 quot-64 )
  492.      Q/         ( num-32 denom-32 --        quot-32 )
  493.      Q/MOD      ( num-32 denom-32 -- rem-32 quot-32 )
  494.      QMOD       ( num-32 denom-32 -- rem-32 )
  495.      SHIFT......( num-32 -n       --        quot-32 )
  496.      UM/MOD-OVL ( num-64 denom-32 -- rem-32 quot-32 )
  497.      UM/MOD     ( num-64 denom-32 -- rem-32 quot-32 )
  498.      UMMOD      ( num-64 denom-32 -- rem-32 )
  499.      UM/        ( num-64 denom-32 --        quot-32 )
  500.      U/MOD      ( num-32 denom-32 -- rem-32 quot-32 )
  501.      UMOD       ( num-32 denom-32 -- rem-32 )
  502.      U/         ( num-32 denom-32 --        quot-32 )
  503.      
  504.  
  505.      Signed division
  506.      M/MOD      ( num-64 denom-32 -- rem-32 quot-32 )
  507.      MMOD       ( num-64 denom-32 -- rem-32 )
  508.      M/         ( num-64 denom-32 --        quot-32 )
  509.      /MOD       ( num-32 denom-32 -- rem-32 quot-32 )
  510.      MOD        ( num-32 denom-32 -- rem-32 )
  511.      Q/         ( num-32 denom-32 --        quot-32 )
  512.      Q/MOD      ( num-32 denom-32 -- rem-32 quot-32 )
  513.      QMOD       ( num-32 denom-32 -- rem-32 )
  514.      /          ( num-32 denom-32 --        quot-32)
  515.      2/         ( num-32          --        quot-32)
  516.      D2/        ( num-64          __        quot-64)
  517.      */MOD      ( n1*n2/n3        -- rem-32 quot-32 )
  518.      */         ( n1*n2/n3        --        quot-32 )
  519.      
  520.  
  521.  
  522.  
  523.  
  524.            \BBL\BBL.DOC  -8-  last updated 1986 October 14 21:30
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. BBL Forth Reference
  533.  
  534.  
  535.      The Data_Stack
  536.  
  537.      Unless otherwise stated, all references to the stack refer to the data
  538.      stack not the return stack.
  539.  
  540.      The Data stack is always maintained in 32-bit (4-byte) chunks.  All
  541.      values are stored with the most significant 16 bits on the top of the
  542.      stack i.e. in lower memory because the stack grows down.  Within each
  543.      16 bits the least significant byte is stored first in lower memory.
  544.      For 64-bit quantities, the most significant 32 bits are stored on the
  545.      top of the stack, i.e. in lower memory.  Note this is NOT the same
  546.      format used to store data in RAM.  For further clarification see the
  547.      notes in the BBL compiler listings or perform some experiments with
  548.      DUMP C@ W@ UW@ T@ UT@ @ 2@ SP@ and .S.
  549.  
  550.      When values are fetched to the stack that are not even multiples of 32
  551.      bits, they can be padded out to 32 bits in one of two ways: pad on the
  552.      left with zeros, or pad on the left with either zeros or ones
  553.      depending on the sign bit.  The first style is called 0-extension and
  554.      is used for unsigned positive quantities.  The second style is called
  555.      sign-extension and is used for signed quantities.
  556.  
  557.      C@ UT@ UW@ do not sign extend, whereas W@ and T@ do.  In other words
  558.      C@ UT@ UW@ are for unsigned quantities, W@ and T@ are for signed
  559.      quantities, and @ and 2@ are for both signed and unsigned.  For
  560.      further clarification see the notes in the BBL compiler listings.
  561.  
  562.  
  563.      The Return_Stack
  564.  
  565.      Unless otherwise stated, all references to the stack refer to the data
  566.      stack not the return stack.
  567.  
  568.      The Return stack is always maintained in 32-bit (4-byte) chunks.  All
  569.      values are stored with the most significant 16 bits (the segment) on
  570.      the top of the stack i.e. in lower memory because the stack grows
  571.      down.  Within each 16 bits the least significant byte is stored first
  572.      in lower memory.  The most common things to find in the Return stack
  573.      are the return addresses pushed there by : so that after each routine
  574.      ends, BBL knows where to carry on in the calling routine.
  575.  
  576.      The addresses are always absolute segment:offset.  Because CREATE
  577.      canonizes HERE, the offset portion of a return address is usually a
  578.      number under 100, but the address is not necessarily canonical (offset
  579.      under 15).  The return address points to the 16-bit token in the
  580.      calling routine after the one currently being executed.
  581.  
  582.      Using the words >R R@ and R> you can use the Return stack as a helping
  583.      hand when the Data stack is getting too complex.  However you must be
  584.      VERY careful to balance your >Rs and R>s within a routine.  When you
  585.      use the Return stack as a helping hand, you you had better get it put
  586.      back the way it was before you exit, unless you really know what you
  587.  
  588.  
  589.  
  590.            \BBL\BBL.DOC  -9-  last updated 1986 October 14 21:30
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. BBL Forth Reference
  599.  
  600.  
  601.      are doing.  Most system crashes are caused by not pairing >R and R>
  602.      properly.  The symptoms of a unpaired >R R> are ghastly things like
  603.      returning to DOS or rebooting or hanging.  RANK NOVICES SHOULD AVOID
  604.      USING THE RETURN STACK AS A HELPING HAND.
  605.  
  606.      DO loops use the return stack to save three quantities -- the current
  607.      loop index, the limit, and the LEAVE address.  For this reason you
  608.      must be careful with words like >R R@ R> and EXIT where loops are
  609.      involved.
  610.  
  611.  
  612.      Internal RAM formats
  613.  
  614.      When numbers are stored in RAM with C! W! T! ! or 2! then 8-bit, 16-
  615.      bit, 32-bit, 24-bit or 64-bit data are stored least significant byte
  616.      first in low memory taking up 1, 2, 3, 4 or 8 bytes respectively.
  617.      Note that storing operators such as W! and T! work equally well on
  618.      signed or unsigned quantities whereas fetching operators such as W@
  619.      and T@ have unsigned versions such as UW@ and UT@.  The format used
  620.      for storing numbers in RAM is different from the format used on the
  621.      stack where numbers always occupy either 4 or 8 bytes.  ON is
  622.      equivalent to -1 SWAP ! and OFF is equivalent to 0 SWAP !.
  623.  
  624.  
  625.      Vocabularies and Search Order
  626.  
  627.      The main differences between FIG Forth, Forth-79 and Forth-83 are the
  628.      way they handle vocabularies.  BBL follows the Forth-83 ONLY ALSO
  629.      format which is quite different from FIG Forth.
  630.  
  631.      What are vocabularies used for?  When you are working with the
  632.      ASSEMBLER vocabulary the word BL refers to the low 8 bits of the BX
  633.      register.  When you are using the FORTH vocabulary BL refers to the
  634.      hex constant 20 -- the ASCII code for blank.  Vocabularies allow the
  635.      same word to have different meaning s in different contexts.
  636.  
  637.      Vocabularies can effectively hide definitions from the users of your
  638.      programs.  You can place intermediate definitions you don't want
  639.      anyone to use in one vocabulary and ones you do want them to use in
  640.      another.
  641.  
  642.      There are two vocabularies of importance.  The first is the CONTEXT
  643.      vocabulary where BBL first goes to look up the meaning of a word.  The
  644.      second is the CURRENT vocabulary where BBL places new definitions.  To
  645.      set the CONTEXT vocabulary you simply mention the name of the
  646.      vocabulary e.g. MY-VOC.  To set the CURRENT vocabulary you use the
  647.      word DEFINITIONS e.g. MY-VOC DEFINITIONS.  Note that MY-VOC also set
  648.      the CONTEXT vocabulary.  If you want to set the current and context
  649.      vocabularies to different things, you must do something like this: MY-
  650.      VOC DEFINITIONS FORTH.
  651.  
  652.  
  653.  
  654.  
  655.  
  656.           \BBL\BBL.DOC  -10-  last updated 1986 October 14 21:30
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. BBL Forth Reference
  665.  
  666.  
  667.      This seems simple enough, but most of the time you want BBL to search
  668.      2 or 3 different vocabularies -- e.g. HIDDEN EDITOR and FORTH.  You
  669.      also want to control the order in which the vocabularies are searched.
  670.      For speed you want to look in the most likely vocabulary first.  If a
  671.      word appears in two different vocabularies with two different
  672.      meanings, the search order becomes very important.  There is never any
  673.      need for more than one CURRENT vocabulary at a time, simply because
  674.      you cannot dither about which vocabulary you want new definitions
  675.      placed in.
  676.  
  677.      The usual case is that you have one transient CONTEXT vocabulary --
  678.      the first in the search order which you change all the time -- maybe
  679.      several times within a single definition.  You also have 1 to 5
  680.      resident CONTEXT vocabularies to search as a backup if the word cannot
  681.      be found in the transient vocabulary.  Usually you don't change these
  682.      resident vocabularies very often.  The transient vocabulary may even
  683.      be a duplicate of one of the resident vocabularies.
  684.  
  685.      We have already discussed how you change the transient vocabulary --
  686.      all you do is mention its name.  How then do you add a resident
  687.      vocabulary?  You simply make a vocabulary the transient vocabulary
  688.      then use the word ALSO which makes the transient vocabulary also one
  689.      of the resident ones.  Then you are free to change the transient
  690.      vocabulary again.  e.g..  This means search FORTH first then search
  691.      MY-VOC.  The word ALSO is misleading.  You might think it is operating
  692.      on the following word,  but it is not, but you can read it as if it
  693.      were.  You can add further resident vocabularies in the same way
  694.      because the old resident vocabularies slide over to make room for the
  695.      new one.  e.g.:
  696.      MY-VOC ALSO FORTH ALSO EDITOR
  697.      This means first search EDITOR as the transient vocabulary, then
  698.      search the first resident library FORTH, then search the second
  699.      resident vocabulary MY-VOC.
  700.  
  701.      You can keep this process up adding resident vocabularies.  BBL
  702.      maintains one transient and four resident vocabularies and one special
  703.      sticky one called ONLY.  If you keep adding more resident libraries
  704.      the oldest ones fall off the end without comment.  Thus you can never
  705.      have more than four resident vocabularies.
  706.  
  707.      How then do you get rid of resident vocabularies?  There is a special
  708.      vocabulary called ONLY.  When you execute it, in addition to the
  709.      normal action of installing itself as the transient CONTEXT
  710.      vocabulary, it erases the resident vocabulary list and installs itself
  711.      as both the first and fifth resident vocabulary.  Then you can only
  712.      use words defined in the ONLY vocabulary.  Thus you had better have
  713.      words like FORTH defined in ONLY or you would be stuck in ONLY
  714.      forever.
  715.  
  716.      To set up a new list of resident vocabularies you do something like
  717.      this:
  718.      ONLY MY-VOC ALSO FORTH ALSO EDITOR
  719.  
  720.  
  721.  
  722.           \BBL\BBL.DOC  -11-  last updated 1986 October 14 21:30
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. BBL Forth Reference
  731.  
  732.  
  733.      This means first search EDITOR as the transient vocabulary, then
  734.      search the first resident library FORTH, then search the second
  735.      resident vocabulary MY-VOC, then search the third resident vocabulary
  736.      ONLY.
  737.  
  738.      You need not worry about ONLY sliding off the end of the resident
  739.      vocabulary list and then losing the ability to change vocabularies
  740.      because ONLY is special in that it installs itself also in a special
  741.      fifth slot in the list of resident vocabularies.  It sticks there and
  742.      is never shoved out by adding new resident vocabularies with ALSO.
  743.  
  744.      Note that having duplicates in the list of resident libraries may slow
  745.      the search process down slightly, but it will never hurt.  I
  746.      considered teaching BBL to scan the resident list to prune out
  747.      duplicates, but this would confuse programs that expect resident
  748.      libraries to fall off the end in a simple-minded way.
  749.  
  750.      The Forth-83 standard recommends having only three resident
  751.      vocabularies.  BBL has four.
  752.  
  753.      You can find out the names of all possible vocabularies with VOC-LIST
  754.      and the names of all vocabularies currently being searched with ORDER.
  755.      To get a list of all the words in the transient CONTEXT vocabulary use
  756.      WORDS.
  757.  
  758.      Finally you can use the verb SEAL to lock your users into some subset
  759.      of the vocabularies.  SEAL will go through your list of resident
  760.      libraries and remove all references to ONLY -- even the fifth special
  761.      sticky one.  This effectively locks the user into the current set of
  762.      vocabularies by turning off the words ALSO and ONLY.
  763.  
  764.      Before you create a new vocabulary make sure the variable VOC-SIZE
  765.      contains a reasonable number of bytes to allocate to hold all the nfas
  766.      that will ever be placed into that dictionary.  Instead of driving
  767.      yourself crazy trying to compute how big it should be, make it too
  768.      big, then compile, then see how much room is left by setting the
  769.      CURRENT vocabulary with MY-VOC DEFINITIONS then comparing HEREV and
  770.      BIGGEST-HEREV.  Then the next time you compile you can shrink VOC-SIZE
  771.      just prior to defining the vocabulary.
  772.  
  773.      Be careful with a newly created vocabulary.  If you have no resident
  774.      vocabularies set up and then use the name of your newly created
  775.      vocabulary to make it the CONTEXT, you will get an error because no
  776.      words at all exist yet in the new vocabulary.  ABORT does a built-in
  777.      FORTH, so your system will not hang permanently.
  778.  
  779.      Newly created vocabularies are not usually immediate, unless of course
  780.      you make them immediate.  The builtin vocabularies FORTH and ONLY are
  781.      not immediate.  In Forth-83 vocabularies are usually not immediate.
  782.      Thus you must say things like : X [ FORTH ] I ; where you would have
  783.      said : X FORTH I ; in Forth-79.
  784.  
  785.  
  786.  
  787.  
  788.           \BBL\BBL.DOC  -12-  last updated 1986 October 14 21:30
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. BBL Forth Reference
  797.  
  798.  
  799.      c.f. VOCABULARY CURRENT CONTEXT ONLY ALSO DEFINITIONS SEAL ORDER WORDS
  800.      VOC-LIST VOC-SIZE REBUILD-VOC FOR-EACH-VOC VOC-LINK
  801.  
  802.  
  803.      Dictionary Structure
  804.  
  805.      BBL's dictionary structure is very complex.  The best way to fully
  806.      understand it is to read the source listings and in particular the
  807.      documentation in BBLDOC.ASM.  It bares almost no resemblance to the
  808.      simple FIG Forth dictionary implementation described in the text
  809.      books.  However you might do well to understand the FIG Forth model
  810.      before leaping into the intricacies of BBL.
  811.  
  812.      The Forth-83 standard says the applications programmer is not allowed
  813.      to examine or modify the dictionary except through standard words such
  814.      as CREATE and ALLOT.  In theory you are not supposed to have any
  815.      understanding of how the dictionary is organized.  However I cannot
  816.      imagine anyone using CREATE and ALLOT correctly without having some
  817.      model in his or her mind about how the dictionary is organized -- even
  818.      if the model were incorrect in minor details.
  819.  
  820.      A definition has four parts: the cfa, nfa, pfa and lfa.  These are
  821.      abbreviations for code field address, name field address, parameter
  822.      field address and link field address.  In Forth-83 there are no verbs
  823.      named CFA PFA NFA and LFA as there used to be in Forth-79.  You can
  824.      use the words  >BODY >NAME >LINK BODY> NAME> LINK> N>LINK L>NAME and
  825.      LINK@ to convert between the different addresses.  In addition you can
  826.      use LATEST-NFA and PREV-NFA or EARLIEST-NFA and NEXT-NFA to get at the
  827.      previously compiled nfa in the same vocabulary as some other word --
  828.      regardless of hashing thread.
  829.  
  830.      Note that the cfa nfa and pfa are not stored contiguously as they are
  831.      in the FIG Forth model.  There are four separate blocks of memory.
  832.      All the cfas go in the first cfa or CODE block.  The cfa block is
  833.      always under 64K.  All the pfas in the second pfa or TOKENS block.
  834.      There is no limit on the size of the pfa block, though you need to
  835.      configure BBL to control the actual size.  All the nfas and lfas go in
  836.      the third nfa or VOCREG block.  The nfa block is broken into sub-
  837.      blocks of under 64K -- one per vocabulary.  The fourth block is called
  838.      the stack segment where the data and return stacks are kept along with
  839.      the screen buffers for cached disk i/o.  This stack segment is also
  840.      limited to 64K.
  841.  
  842.      The most important of the four dictionary addresses is the CFA.  [']
  843.      and ' provide the cfa.  EXECUTE wants the CFA.  The CFA is the address
  844.      in the cfa segment (lowest 64K of the program) where a tiny piece of
  845.      assembler code is to kick off the execution of a word.  Even high
  846.      level words have a tiny piece of assembler to kick them off.  All
  847.      words have a CFA.  Because all cfas are in the low 64K, the segment
  848.      portion of the address is always equal the the CS: register -- the
  849.      paragraph base address where the program is loaded.  CFAs are NOT
  850.      canonical.  Most Forth implementations are set up so that the cfa
  851.  
  852.  
  853.  
  854.           \BBL\BBL.DOC  -13-  last updated 1986 October 14 21:30
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. BBL Forth Reference
  863.  
  864.  
  865.      points to a word containing the address of a tiny piece of assembler
  866.      code to kick off the execution of a word.  BBL is more direct.  The
  867.      cfa points directly to the assembler code.  This is 50% of the secret
  868.      of BBL's speed.
  869.  
  870.      The next most important is the NFA.  The name of the word spelled out
  871.      in ASCII is stored in a separate vocabulary segment preceded by a
  872.      special byte that packs into it the length and some bit flags to
  873.      control the IMMEDIATE and SMUDGE features.  Because BBL has separable
  874.      headers, the nfa is needed only at compile time.  It may or may not be
  875.      thrown away at execute time.
  876.  
  877.      The next most important is the PFA.  For high level definitions, the
  878.      compiled code consists of a list of 16-bit tokens.  The first of these
  879.      is stored at the pfa.  The 16-bit tokens represent the offsets of the
  880.      cfas of the words that make up the definition.  For Variables, the
  881.      value of the variable is stored in some bytes Allotted at the pfa.
  882.      The bulk of the dictionary (typically about 200K) forms the pfa part
  883.      of the dictionary.  Primitive words (written in assembler) and
  884.      CONSTANTs do NOT have pfas.  This is an unusual feature of BBL.  If
  885.      for example you were to were to attempt:
  886.      4 CONSTANT FOUR
  887.      ' FOUR >BODY @
  888.      you would just get junk.
  889.  
  890.      The next most important is the LFA.  The words in the dictionary are
  891.      kept on threads so that the dictionary can be rapidly searched.  The
  892.      lfa points to the nfa of the previous word on the same thread.  BBL
  893.      used a hashed dictionary with multiple threads.  Because of this, in
  894.      practice the threads are very short -- usually containing only one
  895.      word.  In the general case there is no predecessor -- and to save
  896.      space there is no lfa either.  The presence of the lfa is controlled
  897.      by a bit in the lead byte at the nfa.  Thus most of the time the lfa
  898.      does not even exist so words such as N>LINK >LINK will just return
  899.      junk.  Even when the link field exists it is only 16-bits long giving
  900.      only a relative offset within the nfa segment.  This you must
  901.      manipulate it with LINK@ instead of @.
  902.  
  903.  
  904.      WARNING about Comparing Addresses
  905.  
  906.      WATCH OUT -- COMPARING ADDRESSES IS THE MOST COMMON PLACE ELUSIVE BUGS
  907.      CREEP INTO BBL PROGRAMS.
  908.  
  909.      There are two types of addresses absolute machine Segment:offset and
  910.      relative -- signed 32 bit offsets from the place where the program is
  911.      loaded.  To compare absolute addresses you must arrange that both
  912.      addresses have the same segment portion, then use unsigned compares
  913.      such as U< or U<=.  If you erroneously use signed compares, your
  914.      program will fail if the addresses are above the 512K mark.  Cfas and
  915.      Nfas can be compared without converting to relative, but in general
  916.      pfas cannot.  Addresses within a control block compiled under a single
  917.  
  918.  
  919.  
  920.           \BBL\BBL.DOC  -14-  last updated 1986 October 14 21:30
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. BBL Forth Reference
  929.  
  930.  
  931.      CREATE will all have the same segment because the segment part of HERE
  932.      is usually changed only by CREATE.  ALLOT does not change the segment
  933.      part of HERE unless it absolutely has to i.e. when more than 64K worth
  934.      of ALLOTs are done between CREATEs.
  935.  
  936.      If the addresses do not have the same segment portion, you must
  937.      convert them both to relative addresses with >REL.  Then the relative
  938.      addresses must be compared with signed compares e.g. < or <=.  If you
  939.      erroneously use unsigned compares, your program will fail for negative
  940.      relative addresses below the point where your program is loaded.  Pfas
  941.      nearly always must be converted to relative before comparing.
  942.  
  943.      c.f. addr caddr raddr
  944.  
  945.  
  946.      BBL Forth Words
  947.  
  948.  
  949.      **!**          words that begin with !
  950.  
  951.      !              ( 32b-value address -- )
  952.                     store value at address.  Stores 4 bytes signed or
  953.                     unsigned value.  Value has the MSW on the top of the
  954.                     stack, but the value is stored with the LSW first in
  955.                     memory.  The address is seg:offset -- not necessarily
  956.                     canonical.  The address must cover all four bytes.
  957.                     There are no alignment restrictions, but if the address
  958.                     is even, the code will run faster.  Forth programmers
  959.                     pronounce this "Store".  Abundance programmers
  960.                     pronounce it "Bang", but they rarely use it, preferring
  961.                     "TO" instead.
  962.                     c.f. 0! ON OFF C! W! T! 2!
  963.  
  964.      !CSP           ( -- )
  965.                     Not normally used by programmers.  Save the data stack
  966.                     depth at the start of a colon definition.  This is used
  967.                     by Colon to make sure Colon-SemiColons are properly
  968.                     paired.  Forth programmers pronounce it "Store c s p"
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.           \BBL\BBL.DOC  -15-  last updated 1986 October 14 21:30
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. BBL Forth Reference
  995.  
  996.  
  997.      **"**          words that begin with "
  998.  
  999.  
  1000.      **#**          words that begin with #
  1001.  
  1002.      #              ( +d1 -- +d2 )
  1003.                     Used to convert numbers from internal form to
  1004.                     displayable ASCII.  The remainder of +d1 divided by the
  1005.                     value of BASE is converted to an ASCII character and
  1006.                     appended to the output string toward lower memory
  1007.                     addresses.  Pictured numeric output conversion works
  1008.                     from right to left -- which means formatting characters
  1009.                     such as # must be written in reverse order from the way
  1010.                     the final result looks.  +d2 is the quotient and is
  1011.                     maintained for further processing.  Note that there is
  1012.                     no equivalent for # that works on single precision
  1013.                     numbers.  You must convert to double precision before
  1014.                     using the output formatting features.  Typically used
  1015.                     between <# and #>
  1016.                     c.f. <# #S HOLD SIGN #>
  1017.                     pronounced "sharp"
  1018.  
  1019.      #>             ( +d -- addr +len )
  1020.                     Pictured numeric output conversion is ended.  addr is
  1021.                     the address of the resulting output string -- just
  1022.                     below PAD where the string has been built.  +len is the
  1023.                     number of characters in the output string.  addr and
  1024.                     +len together are suitable for TYPE.
  1025.                     c.f. <# # #S HOLD SIGN
  1026.                     pronounced "sharp-greater"
  1027.  
  1028.      #S             ( +d -- 0.0 )
  1029.                     +d is converted appending each resultant character onto
  1030.                     the pictured numeric output string until the quotient
  1031.                     (see: # ) is zero.  A single zero is added to the
  1032.                     output string if the number was initially zero.
  1033.                     Typically used between <# and #> .
  1034.                     c.f. <# # HOLD SIGN #>
  1035.                     pronounced "sharp-s"
  1036.  
  1037.      #TIB           ( -- addr )
  1038.                     A variable containing the number of bytes {0..132} in
  1039.                     the TIB (text input buffer) right now -- not the
  1040.                     maximum capacity of the TIB, not the bytes remaining in
  1041.                     the TIB to be interpreted, not the address of the TIB.
  1042.                     The text in the TIB is parsed by WORD when BLK is zero.
  1043.                     Typically used #TIB @ to get number of chars in the
  1044.                     TIB.  Because a null hex 00 character marks the current
  1045.                     end of the TIB, #TIB is not needed by the BBL internals
  1046.                     to ensure parsing does not run off the end of the TIB.
  1047.                     c.f. TIB STREAM WORD
  1048.                     pronounced "number t i b"
  1049.  
  1050.  
  1051.  
  1052.           \BBL\BBL.DOC  -16-  last updated 1986 October 14 21:30
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. BBL Forth Reference
  1061.  
  1062.  
  1063.      **$**          words that begin with $
  1064.  
  1065.  
  1066.      **%**          words that begin with %
  1067.  
  1068.  
  1069.      **&**          words that begin with &
  1070.  
  1071.  
  1072.      **'**          words that begin with '
  1073.  
  1074.      '              ( -- cfa-addr )
  1075.                     Used in the form: ' <name>
  1076.                     addr is the compilation address (cfa) of <name>.  An
  1077.                     error condition exists if <name> is not found in the
  1078.                     currently active search order.  Nearly always you
  1079.                     should use ['] instead.  The only times you use ' are
  1080.                     if you are outside a colon definition, or if you are
  1081.                     writing your own variant of ['] where the name of the
  1082.                     word to be looked up will be parsed later.  The segment
  1083.                     portion of the address returned is always equal to CS:.
  1084.                     Warning! in Forth79 tick was STATE-smart and returned
  1085.                     the pfa instead of the cfa.
  1086.                     c.f. ['] EXECUTE
  1087.                     pronounced "tick"
  1088.  
  1089.      'EMIT          ( -- addr )
  1090.                     a variable used to hold the cfa of the current EMIT
  1091.                     routine.  CONSOLE vectors in SEMIT to emit to the
  1092.                     screen and PRINTER vectors in PEMIT to emit to the
  1093.                     printer.  CONSOLE does ['] SEMIT 'EMIT ! to redirect
  1094.                     EMIT to the screen.  EMIT does 'EMIT @ EXECUTE to emit
  1095.                     a character with the currently vectored EMIT routine.
  1096.                     If you change the value of 'EMIT you will usually also
  1097.                     want to change 'TYPE.  If you write your own EMIT
  1098.                     routine, you may find GTYPE useful as the corresponding
  1099.                     TYPE routine to use for 'EMIT.
  1100.                     c.f. EMIT CONSOLE PRINTER SEMIT PEMIT TYPE 'TYPE GTYPE
  1101.                     STYPE PTYPE
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.           \BBL\BBL.DOC  -17-  last updated 1986 October 14 21:30
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. BBL Forth Reference
  1127.  
  1128.  
  1129.      'TYPE          ( -- addr )
  1130.                     a variable used to hold the cfa of the current TYPE
  1131.                     routine.  CONSOLE vectors in STYPE to emit to the
  1132.                     screen and PRINTER vectors in PTYPE to emit to the
  1133.                     printer.  CONSOLE does ['] STYPE 'TYPE ! to redirect
  1134.                     TYPE to the screen.  TYPE does 'TYPE @ EXECUTE to
  1135.                     display a string with the currently vectored TYPE
  1136.                     routine.  If you change the value of 'TYPE you will
  1137.                     usually also want to change 'EMIT.  If you write your
  1138.                     own EMIT routine, you may find GTYPE useful as the
  1139.                     corresponding TYPE routine to use for 'TYPE.
  1140.                     c.f. TYPE CONSOLE PRINTER GTYPE STYPE PTYPE EMIT SEMIT
  1141.                     PEMIT
  1142.  
  1143.  
  1144.      **(**          words that begin with (
  1145.  
  1146.      (              ( -- )
  1147.                     ( -- ) (compiling) IMMEDIATE
  1148.                     Comment initiator used in the form: ( Just Stuff)
  1149.                     ( .. ) are comment delimiters.  The characters Just
  1150.                     Stuff, delimited by ) (closing parenthesis), are
  1151.                     considered comments.  Comments are not otherwise
  1152.                     processed.  The blank following ( is necessary, and not
  1153.                     part of Just Stuff.  ( may be freely used while
  1154.                     interpreting or compiling.  The number of characters in
  1155.                     Just Stuff may be from zero to the number of characters
  1156.                     remaining in the input stream up to the closing
  1157.                     parenthesis.  By convention, ) is usually preceded by a
  1158.                     space, however this is not necessary. Does NOT ensure
  1159.                     there is a pair, and cannot handle any paired () inside
  1160.                     the comment.
  1161.                     c.f. \ ;S
  1162.  
  1163.      (ABORT")       ( -- : issue message and abort )
  1164.                     Not normally used by programmers.  DOES NOT EXPECT A
  1165.                     FLAG. Used, but NOT compiled by, (?ABORT).  ABORT"
  1166.                     compiles as token-("?ABORT) 1-byte-length string poss-
  1167.                     even-pad-byte.
  1168.                     cf. ABORT" (?ABORT")
  1169.  
  1170.      (AS)           (   ' YYY    ' XXX AS -- ) executing
  1171.                     ( ['] YYY  ['] XXX AS -- ) compiling
  1172.                     (AS) patches the cfa XXX to jump to the cfa at YYY.
  1173.                     This effectively turns XXX into an ALIAS for YYY.
  1174.                     Usually XXX is defined with DEFER XXX, but XXX can be
  1175.                     any existing word.  Watch out if XXX is an ALIAS
  1176.                     already, since the cfa is patched, both the ALIAS and
  1177.                     the orginal word will be effectively turned into
  1178.                     ALIASes for YYY.  See the discussion under DEFER.
  1179.                     c.f. AS DEFER PERFORM EXECUTE ' ['] LOGO
  1180.  
  1181.  
  1182.  
  1183.  
  1184.           \BBL\BBL.DOC  -18-  last updated 1986 October 14 21:30
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. BBL Forth Reference
  1193.  
  1194.  
  1195.      (+LOOP)        ( increment -- )
  1196.                     Not normally used by programmers.  Adds DO loop
  1197.                     increment to I and loops back if I < N, but if the
  1198.                     increment is negative, loops back if I >= N.  +LOOP
  1199.                     compiles as token-(LOOP) followed by a 16-bit BRANCH-
  1200.                     style byte offset back to the start of the loop after
  1201.                     the leave-offset following the (DO) or (?DO).
  1202.                     c.f. DO ?DO LEAVE LOOP +LOOP (DO) (?DO) (LOOP) (LEAVE)
  1203.  
  1204.      (.")           ( -- : types the inline string )
  1205.                     Not normally used by programmers.  ." compiles as (.")-
  1206.                     token 1-byte-count the-string even-pad-byte.
  1207.                     c.f. ." .(
  1208.  
  1209.      (;CODE)        ( -- )
  1210.                     Not normally used by programmers.  Makes cfa of LATEST
  1211.                     word point to asm code pointed to by token after
  1212.                     (;CODE) )  ;CODE compiles as token-(;CODE) token-start-
  1213.                     asm-code.  (;CODE) is quite unlike the usual FORTH
  1214.                     (;CODE) that redirects LATEST to the code following
  1215.                     (;CODE).  There is no code following (;CODE).  The code
  1216.                     is in an entirely different segment at HEREC. ;CODE
  1217.                     executes when a defining word is defined.  (;CODE)
  1218.                     executes later when a word is defined using the
  1219.                     defining word.  DOES> also compiles as (;CODE).
  1220.                     c.f. ;CODE DOES>
  1221.  
  1222.      (?ABORT")      ( flag-- )
  1223.                     Not normally used by programmers.  If the flag is true,
  1224.                     issue message and abort.  The flag convention is
  1225.                     opposite to Abundance.  True means BAD here.  ABORT"
  1226.                     xxx" compiles as token-("?ABORT) 1-byte-length string
  1227.                     poss-even-pad-byte.
  1228.                     cf. ABORT" (ABORT") ABORT
  1229.  
  1230.      (?DO)          ( n1 n2 -- )
  1231.                     Not normally used by programmers.  Compiled by ?DO to
  1232.                     start a loop.  If n1 = n2 bypass the loop entirely.
  1233.                     Watch out! if n2 > n1 the loop will run for a long long
  1234.                     time unless you are using -n +LOOP.  ?DO compiles as
  1235.                     token-(?DO) followed by a BRANCH style leave-offset to
  1236.                     just past (LOOP)'s offset.  (?DO) pushes 3 values onto
  1237.                     the return stack.  Note that most Forth 79
  1238.                     implementations push 2 values.  The deepest value is an
  1239.                     address for Leave, the next deepest is a modified value
  1240.                     for N and the top of the return stack has a modified
  1241.                     value for I.  If you wish to understand how or why "I"
  1242.                     is modified, examine the BBL compiler listings.
  1243.                     c.f. DO ?DO LEAVE LOOP +LOOP (DO) (LOOP) (+LOOP)
  1244.                     (LEAVE)
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.           \BBL\BBL.DOC  -19-  last updated 1986 October 14 21:30
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. BBL Forth Reference
  1259.  
  1260.  
  1261.      (A")           ( -- addr len : inline string literals )
  1262.                     Not normally used by programmers.  A" xxxx" inline
  1263.                     string literal compiles as token-(A") 1-byte-len the-
  1264.                     string poss-pad-byte.  At execution time pushes the
  1265.                     address and length of the string to the data stack
  1266.  
  1267.      (CREATE)       ( -- : does most of the work of creating a header for
  1268.                     CREATE )  Not normally used by programmers.
  1269.  
  1270.      (DO)           ( N I -- : starts a loop)
  1271.                     Not normally used by programmers. Watch out! I must be
  1272.                     <= N or this will loop for a very very long time.  DO
  1273.                     compiles as token-(DO) followed by BRANCH style leave-
  1274.                     offset to just past (LOOP)'s offset.  Pushes 3 values
  1275.                     onto the return stack.  Note that most Forth 79
  1276.                     implementations push 2 values.  The deepest value is an
  1277.                     address for Leave, the next deepest is a modified value
  1278.                     for N and the top of the return stack has a modified
  1279.                     value for I.  c.f. DO ?DO LEAVE LOOP +LOOP (LOOP)
  1280.                     (+LOOP) (LEAVE)
  1281.  
  1282.      (FIND)         ( counted-string-to-find hash# vocab-region -- )
  1283.                     Not normally used by programmers. Used by FIND to look
  1284.                     up a word in a given vocabulary.  (FIND) presumes
  1285.                     counted-string-to-find is counted string with no excess
  1286.                     bits in the count field e.g. Immediate, HasLink, or
  1287.                     Smudged bits.  (FIND) presumes all dictionary entries
  1288.                     and the counted string have length 1..31. hash# is from
  1289.                     HASH -- not the result after masking to thread #. NOTE
  1290.                     (FIND) is NOT the same as (FIND) or -FIND of Forth 79.
  1291.                     The counted string to find will usually be at HEREB,
  1292.                     but  (FIND) does not insist on it.
  1293.                     c.f. FIND ' [']
  1294.  
  1295.      (LEAVE)        ( - : leaves loop immediately )
  1296.                     Not normally used by programmers.  LEAVE compiles as
  1297.                     token-(LEAVE).  It is not followed by an offset.
  1298.                     (LEAVE) finds out where the end of the loop is by
  1299.                     looking deep in the return stack for an address pushed
  1300.                     there by (DO) or (?DO)
  1301.                     c.f. DO ?DO LEAVE LOOP +LOOP (DO) (?DO) (LOOP)
  1302.  
  1303.      (LINE)         ( line# scr# --- addr len : line 0..15 of given screen
  1304.                     )
  1305.                     Used by words such as LIST to consider a screen as 16
  1306.                     lines numbered 0..15 of 64-character lines.  Uses
  1307.                     BLOCK.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.           \BBL\BBL.DOC  -20-  last updated 1986 October 14 21:30
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. BBL Forth Reference
  1325.  
  1326.  
  1327.      (LOOP)         ( -- )
  1328.                     Not normally used by programmers.  adds 1 to I and
  1329.                     loops back if I < N.  LOOP compiles as token-(LOOP)
  1330.                     followed by a 16-bit BRANCH style byte offset back to
  1331.                     the start of the loop after the offset following the
  1332.                     (DO) or (?DO).  c.f. DO ?DO LEAVE LOOP +LOOP (DO) (?DO)
  1333.                     (+LOOP) (LEAVE)
  1334.  
  1335.  
  1336.      **)**          words that begin with )
  1337.  
  1338.      )              FORTH comment terminator.
  1339.  
  1340.  
  1341.      *****          words that begin with *
  1342.  
  1343.      *              ( n1 * n2 -- n3 )
  1344.                     32- bit multiply
  1345.                     multiplies n1 by n2 leaving the result n3.  Works with
  1346.                     either signed or unsigned quantities.
  1347.                      12  2 * --  24
  1348.                     -12  2 * -- -24
  1349.                      12 -2 * -- -24
  1350.                     -12 -2 * --  24
  1351.                     Overflow is ignored; only the least significant 32 bits
  1352.                     of the result are kept.
  1353.                     c.f. multiplication Q* */ */MOD 2* 4* 8* 10* 16* 64*
  1354.                     256* SHIFT
  1355.                     pronounced "times" in Forth "star" in Abundance.
  1356.  
  1357.      */             ( n1 n2 n3 -- n4 : all signed )
  1358.                     ( n1*n2 / n3 -- quot-n4  )
  1359.                     n1 is first multiplied by n2 producing an intermediate
  1360.                     64-bit result.  n4 is the floor of the quotient of the
  1361.                     intermediate 64-bit result divided by the divisor n3.
  1362.                     The product of n1 times n2 is maintained as an
  1363.                     intermediate 64-bit result for greater precision than
  1364.                     the otherwise equivalent sequence:  n1 n2 * n3 /.  */
  1365.                     is very similar to */MOD except */ throws away the
  1366.                     remainder.  There is no unsigned version of this
  1367.                     operator.
  1368.                     c.f. division, */MOD
  1369.                     pronounced "times-divide"in Forth "star-slash" in
  1370.                     Abundance.
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.           \BBL\BBL.DOC  -21-  last updated 1986 October 14 21:30
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. BBL Forth Reference
  1391.  
  1392.  
  1393.      */MOD          ( n1 n2 n3 -- n4 n5 : all signed )
  1394.                     ( n1*n2 / n3 -- rem-n4 quot-n5 )
  1395.                     Uses signed floored division.  Remainder has same sign
  1396.                     as n3
  1397.                     n1 is first multiplied by n2 producing an intermediate
  1398.                     64-bit result.  n4 is the remainder and n5 is the floor
  1399.                     of the quotient of the intermediate 64-bit result
  1400.                     divided by the divisor n3.  A 64-bit intermediate
  1401.                     product is used for */.  n4 has the same sign as n3 or
  1402.                     is zero. Very similar to */ except */MOD provides the
  1403.                     remainder as well as the quotient.
  1404.                     c.f. division, */
  1405.                     pronounced "star-slash-mod"
  1406.  
  1407.  
  1408.      **+**          words that begin with +
  1409.  
  1410.      +              ( n1 n2 -- n3 )
  1411.                     Adds n1 and n2 leaving the result n3.  Works with
  1412.                     either signed or unsigned quantities.
  1413.                      12  2 + --  14
  1414.                     -12  2 + -- -10
  1415.                      12 -2 + --  10
  1416.                     -12 -2 + -- -14
  1417.                     Overflow is ignored; only the least significant 32 bits
  1418.                     of the result are kept.
  1419.                     c.f. +! 1+ 2+ 4+ D+ +LOOP
  1420.  
  1421.      +!             ( N ADDR -- : adds n to memory )
  1422.                     add value to contents of address.  Value is MSW on top
  1423.                     of data stack, LSW first in memory.  Address is
  1424.                     seg:offset -- not necessarily canonical
  1425.                     c.f. + 1+ 2+ 4+ D+ +LOOP
  1426.                     pronounced "plus-bang"
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.           \BBL\BBL.DOC  -22-  last updated 1986 October 14 21:30
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. BBL Forth Reference
  1457.  
  1458.  
  1459.      +LOOP          ( increment -- ) executing
  1460.                     ( backaddr-1 backaddr-2 3 -- ) (compiling)
  1461.                     Used in the form:
  1462.                     10 0 DO ...  2 +LOOP  I = 0 2 4 6 8
  1463.                     0 10 DO ... -2 +LOOP  I = 10 8 6 4 2 0
  1464.                     Used in loops that run down instead of up, or which run
  1465.                     up by increments other than one.  The increment
  1466.                     (positive or negative) is added to the loop index.  If
  1467.                     the new index was incremented across the boundary
  1468.                     between limit-1 and limit then the loop is terminated
  1469.                     and loop control parameters are discarded.  In other
  1470.                     words loops back if I < N if the increment is positive
  1471.                     and loops back if I >= N if the increment is negative.
  1472.                     When the loop is not terminated, execution continues to
  1473.                     just after the corresponding DO .  +LOOP compiles as
  1474.                     (+LOOP) token followed by a BRANCH style offset back to
  1475.                     the token after the offset after the (DO).
  1476.                     c.f. DO ?DO (DO) (?DO) LOOP (LOOP) (+LOOP)
  1477.                     pronounced "plus-loop"
  1478.  
  1479.      +WLIT          ( -- value )
  1480.                     Not normally used by programmers.  LITERAL compiles as
  1481.                     +WLIT token followed by a 16-bit unsigned positive
  1482.                     literal.to handle in-line literals in the range 0 ..
  1483.                     0FFFF.
  1484.  
  1485.  
  1486.      **,**          words that begin with ,
  1487.  
  1488.      ,              ( 32b -- )
  1489.                     ALLOT space for 32b then store 32b at HERE 4- .
  1490.                     pronounced "comma".  This is used to compile numbers
  1491.                     into the PFA part of the dictionary.  This is the most
  1492.                     commonly used part of the dictionary.
  1493.  
  1494.  
  1495.      **-**          words that begin with -
  1496.  
  1497.      -              ( n1 n2 -- n3 )
  1498.                     Subtracts n2 from n1 leaving the result n3.  Works with
  1499.                     either signed or unsigned quantities.
  1500.                      12  2 - --  10
  1501.                     -12  2 - -- -14
  1502.                      12 -2 - --  14
  1503.                     -12 -2 - -- -10
  1504.                     Overflow is ignored; only the least significant 32 bits
  1505.                     of the result are kept.  Do not confuse with unary
  1506.                     NEGATE.  Note that SWAP- works faster than -.
  1507.                     c.f. 1- 2- D- NEGATE ?NEGATE SWAP- DNEGATE ?DNEGATE
  1508.                     pronounced "minus"
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.           \BBL\BBL.DOC  -23-  last updated 1986 October 14 21:30
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. BBL Forth Reference
  1523.  
  1524.  
  1525.      -1             ( -- -1 )
  1526.                     c.f. ON
  1527.  
  1528.      -LEADING       ( addr1 +n1 -- addr2 +n2)
  1529.                     Trims off any leading blanks from a string.  The length
  1530.                     length may also be 0 or 1, but not negative.  The
  1531.                     address and character count +n1 of a text string
  1532.                     beginning at addr1 is adjusted to exclude trailing
  1533.                     spaces. If +n1 is zero, then +n2 is also zero.
  1534.                     If the entire string consists of spaces, then +n2 is
  1535.                     zero. The length n1 must be under 64K and the last
  1536.                     character of the string must be covered by Seg of addr.
  1537.                     Addr need not be canonical.
  1538.                     pronounced "dash-leading or minus-leading"
  1539.  
  1540.      -ROT           ( a b c -- c a b )
  1541.                     Reveres rotate.  Equivalent to but faster than ROT ROT.
  1542.                     rotates the top number on the stack to the third stack
  1543.                     position.  Constructions of the form >R ... R> can
  1544.                     often be handled more efficienly with -ROT.
  1545.                     c.f. ROT TUCK 2ROT
  1546.  
  1547.      -TRAILING      ( addr +n1 -- addr +n2)
  1548.                     Trims off any trailing blanks from a string.  The
  1549.                     length length may also be 0 or 1, but not negative.
  1550.                     The character count +n1 of a text string beginning at
  1551.                     addr is adjusted to exclude trailing spaces. If +n1 is
  1552.                     zero, then +n2 is also zero.
  1553.                     If the entire string consists of spaces, then +n2 is
  1554.                     zero. The length n1 must be under 64K and the last
  1555.                     character of the string must be covered by Seg of addr.
  1556.                     Addr need not be canonical.
  1557.                     pronounced "dash-trailing or minus-trailing"
  1558.  
  1559.      -WLIT          ( -- value : inline negative constants 0FFFF0000 ..
  1560.                     0FFFFFFFFh )
  1561.                     Not normally used by programmers.  LITERAL compiles as
  1562.                     WLIT-token followed by a 16-bit unsigned negative
  1563.                     literal to handle negative in-line constants in the
  1564.                     range -10000h .. -1.  Note that the sign bit of the 16b
  1565.                     literal may be on or off, but it is always sign
  1566.                     extended as a negative quantity.
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.           \BBL\BBL.DOC  -24-  last updated 1986 October 14 21:30
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. BBL Forth Reference
  1589.  
  1590.  
  1591.      **.**          words that begin with .
  1592.  
  1593.      .              ( n -- )
  1594.                     Destructively types the value of the signed number on
  1595.                     the top of the data stack.  The absolute value of n is
  1596.                     displayed in a free field format with a leading minus
  1597.                     sign if n is negative followed by a space.  Uses the
  1598.                     current BASE.  If you always want a decimal result use
  1599.                     .D
  1600.                     c.f.  .S U. .R .D .D .B
  1601.                     pronounced "dot"
  1602.  
  1603.      ."             ( -- )
  1604.                     ( -- ) (compiling)
  1605.                     Used to TYPE string literals.  Used in the form: ." My
  1606.                     message"
  1607.                     Only used inside colon definitions.  Outside them, use
  1608.                     .( My message) instead.  Later execution will display
  1609.                     the characters My message up to but not including the
  1610.                     delimiting (close-quote).  The blank following ." is
  1611.                     necessary and not part of My message.  A blank space
  1612.                     before the closing " will be considered a part of the
  1613.                     string.  Compiles as (.")-token 1-byte-count the-string
  1614.                     even-pad-byte
  1615.                     Watch out in Forth 79 ." was STATE-smart.
  1616.                     c.f. .(  pronounced "dot-quote"
  1617.  
  1618.      .(             ( -- )
  1619.                     ( -- ) (compiling)
  1620.                     Used to type string literals.
  1621.                     Used in the form: .( My message)  Normally used only
  1622.                     used outside colon definitions.  Inside them, use ." My
  1623.                     message" instead.  The characters My message up to but
  1624.                     not including the delimiting (closing parenthesis) are
  1625.                     displayed.  The blank following .( is necessary and not
  1626.                     a part of My Message.  A blank space before the closing
  1627.                     ) will be considered a part of the string.  The BBL
  1628.                     implementation temporarily builds the string at HEREB.
  1629.                     c.f. ."
  1630.                     pronounced "dot-paren"
  1631.  
  1632.      .B             ( u -- )
  1633.                     types top of data stack in unsigned binary
  1634.                     This format is useful for debugging because the binary
  1635.                     digits are broken into groups like this
  1636.                     1111_1111_1111_1111:1111_1111_1111_1111.  Does not
  1637.                     examine or change the BASE.  Followed by a space.
  1638.                     c.f. .D .D .
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.           \BBL\BBL.DOC  -25-  last updated 1986 October 14 21:30
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. BBL Forth Reference
  1655.  
  1656.  
  1657.      .BASE          ( -- )
  1658.                     Displays the BASE in English.  Useful in debugging to
  1659.                     find out what the value of BASE is.  Prints out the
  1660.                     word Hex or Binary or Decimal or Base 12.  If you
  1661.                     simply did BASE @ . you would always just see 10 no
  1662.                     matter what the base was because the conversion is
  1663.                     always done in the current base  -- not too
  1664.                     informative.  .S uses .BASE.
  1665.                     c.f. BASE .S
  1666.  
  1667.      .D             ( n -- )
  1668.                     type value in signed DECIMAL.  Does not examine or
  1669.                     change the BASE.  Followed by a space;
  1670.                     c.f. .B .H .
  1671.  
  1672.      .H             ( u -- )
  1673.                     type value in unsigned HEX with colon separator between
  1674.                     the MSW and LSW.  Useful in debugging to display
  1675.                     addresses.  Does not examine or change the BASE.
  1676.                     Followed by a space.
  1677.                     c.f. .D .B .
  1678.  
  1679.      .ID            ( NFA -- )
  1680.                     types name of word at the given cfa.  ALIAS for .NAME
  1681.                     c.f. .INFO .NAME
  1682.  
  1683.      .INFO          ( nfa -- )
  1684.                     displays the cfa pfa nfa and name of a word whose nfa
  1685.                     is given.  There is no builtin CR.
  1686.                     c.f. .INFO-HEAD .NAME
  1687.  
  1688.      .INFO-HEAD     ( nfa -- )
  1689.                     displays the heading suitable for labelling the results
  1690.                     of .INFO. There is no builtin CR.
  1691.                     c.f. .INFO .NAME
  1692.  
  1693.      .LINE          ( LINE SCR -- )
  1694.                     types line 0..15 of given screen.  Useful in writing
  1695.                     screen editors or generating error messages.
  1696.  
  1697.      .NAME          ( NFA -- )
  1698.                     types name of word at the given cfa.  In older Forths
  1699.                     was sometimes called .ID
  1700.                     c.f. .INFO
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.           \BBL\BBL.DOC  -26-  last updated 1986 October 14 21:30
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. BBL Forth Reference
  1721.  
  1722.  
  1723.      .R             ( n1 +n2 -- )
  1724.                     Print a signed number n in a fixed width field +n2
  1725.                     wide.  n1 is converted using BASE and then displayed
  1726.                     right aligned in a field +n2 characters wide.  A
  1727.                     leading minus sign is displayed if n1 is negative.  If
  1728.                     the number of characters required to display n1 is
  1729.                     greater than +n2, the field is simply widened without
  1730.                     comment.  The Forth 83 standard considers this an error
  1731.                     condition.
  1732.                     c.f. . .S
  1733.                     pronounced "dot r"
  1734.  
  1735.      .S             ( -- )
  1736.                     dumps the data stack non destructively.  Used in
  1737.                     debugging.  Displays the stack in both Hex and Decimal.
  1738.                     Synonym for .s
  1739.  
  1740.      .s             ( -- )
  1741.                     dumps the data stack non destructively.  Used in
  1742.                     debugging.  Displays the stack in both Hex and Decimal.
  1743.                     ALIAS for .S
  1744.  
  1745.      .WORD          ( -- : types word at HEREB )
  1746.                     This displays the most most recently parsed word.  This
  1747.                     is useful in error messages to pinpoint what word was
  1748.                     being parsed at the time of the error.  The word is
  1749.                     enclosed in quotes to make it clearer if any embedded
  1750.                     control characters are part of the word.
  1751.  
  1752.  
  1753.      **/**          words that begin with /
  1754.  
  1755.      /              ( num-32 denom-32 -- quot-32 : signed floored division
  1756.                     )
  1757.                     divides n1 by n2 leaving n3 using signed integer
  1758.                     division with a floored result  Use /MOD if you want
  1759.                     both the remainder and quotient..  MOD gets just the
  1760.                     remainder. 2/ divided rapidly by 2 by using an
  1761.                     arithmetic shift.  Note that the unsigned version U/ is
  1762.                     faster than /.
  1763.                     c.f. division 2/ Q/ /MOD MOD U/.
  1764.                     pronounced "slash"
  1765.  
  1766.      /MOD           ( num-32 denom-32 -- rem-32 quot-32 : signed floored
  1767.                     division )
  1768.                     Remainder has same sign as divisor.  MOD gets just the
  1769.                     remainder.  / gets just the quotient.  The unsigned
  1770.                     version U/MOD is faster than /MOD.
  1771.                     c.f. division, / MOD U/MOD Q/MOD
  1772.                     pronounced "slash-mod"
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.           \BBL\BBL.DOC  -27-  last updated 1986 October 14 21:30
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. BBL Forth Reference
  1787.  
  1788.  
  1789.      **0**          words that begin with 0
  1790.  
  1791.      0              ( -- 0 )
  1792.  
  1793.      0!             ( ADDR -- )
  1794.                     Stores 32 bit zero at addr.  This is equivalent to 0
  1795.                     SWAP !, but it executes much more quickly.  Also called
  1796.                     OFF.
  1797.                     c.f. OFF ON ! ERASE
  1798.  
  1799.      0.             ( -- 0. : 64b double precision )
  1800.  
  1801.      0<             ( n -- flag )
  1802.                     flag is true if n is less than zero (negative) using
  1803.                     signed compares.  Note that 0< NOT is equivalent to but
  1804.                     slower than 0>=.
  1805.                     c.f. 0<= 0> 0>= 0= D0= 0<> NOT
  1806.                     pronounced "zero-less"
  1807.  
  1808.      0<=            ( n -- flag )
  1809.                     true if n is less than or equal to 0.  Note that 0<=
  1810.                     NOT is equivalent to but slower than 0>.
  1811.                     c.f. 0< 0> 0>= 0= D0= 0<> NOT
  1812.  
  1813.      0<>            ( n -- flag : true if n not equal 0 )
  1814.                     Normally there is no need to use this verb since any
  1815.                     non-zero value is considered TRUE anyway. "X @ IF" is a
  1816.                     better way to express to "X @ 0<> IF".  0<> is needed
  1817.                     if you wish to combine flags with AND e.g. X @ 0<> Y @
  1818.                     0<> AND, but it in not usually needed if you wish to
  1819.                     combine flags with OR because "X @ Y @ OR IF" is
  1820.                     equivalent to "X @ 0<> Y @ 0<> OR IF".  0<> NOT is
  1821.                     equivalent to but slower than 0=.
  1822.                     c.f. 0< 0<= 0> 0>= 0= D0= NOT
  1823.  
  1824.      0=             ( n -- flag )
  1825.                     flag is true if n is zero.
  1826.                     This is not quite the same as "NOT".  0= always leaves
  1827.                     0 or -1 or the data stack.  "NOT" will leave 0 or -1 if
  1828.                     it operates on a canonical flag, but it will leave the
  1829.                     one's complement of the value if it is anything else.
  1830.                     c.f. 0< 0<= 0> 0>= D0= 0<> NOT
  1831.                     pronounced "zero-equals"
  1832.  
  1833.      0>             ( n -- flag )
  1834.                     flag is true if n is greater than zero using signed
  1835.                     compares.  Note that 0> NOT is equivalent but slower
  1836.                     than 0<=.
  1837.                     c.f. 0< 0<= 0>= 0= D0= 0<> NOT
  1838.                     pronounced "zero-greater"
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.           \BBL\BBL.DOC  -28-  last updated 1986 October 14 21:30
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. BBL Forth Reference
  1853.  
  1854.  
  1855.      0>=            ( n -- flag )
  1856.                     flag true if n is greater than or equal to 0 using
  1857.                     signed compares.  Note that 0>= NOT is equivalent to
  1858.                     but slower than 0<.
  1859.                     c.f. 0< 0<= 0> 0= D0= 0<> NOT
  1860.  
  1861.  
  1862.      **1**          words that begin with 1
  1863.  
  1864.      1              ( -- 1 )
  1865.  
  1866.      1+             ( n1 -- n2 )
  1867.                     Increment by 1.  n2 is the result of adding one to n1
  1868.                     according to the operation of +.  Do not confuse with
  1869.                     1+! which adds one to memory.  1+ is equivalent to 1 +,
  1870.                     but executes more quickly
  1871.                     pronounced "one-plus"
  1872.  
  1873.      1-             ( n1 -- n2 )
  1874.                     Decrement by 1.  n2 is the result of subtracting one to
  1875.                     from according to the operation of -.  Do not confuse
  1876.                     with -1 which simply puts a -1 on the data stack. 1- is
  1877.                     equivalent to 1 -, but executes more quickly
  1878.                     pronounced "one-minus"
  1879.  
  1880.      10             ( -- 10 in decimal mode )
  1881.                     ( -- 16 in hex mode )
  1882.                     this is an in-line literal word not a built-in word
  1883.                     c.f. TEN SIXTEEN
  1884.  
  1885.      10*            ( n1 -- n2 )
  1886.                     10* multiplies by decimal 10.  n2 is the result of 2* +
  1887.                     8* .  This works on both signed and unsigned numbers.
  1888.                     10* is equivalent to 10 *
  1889.                     c.f. * */ */MOD 2* 4* 8* 10* 16* 64* 256* SHIFT
  1890.                     pronounced "ten-star" in Abundance.
  1891.  
  1892.      16*            ( n1 -- n2 )
  1893.                     16* multiplies by decimal 16 = 2**4 = LEFT SHIFT 4.
  1894.                     Works on both signed and unsigned numbers.
  1895.                     c.f. multiplication * 2* 4* 8* 10* 64* 256* SHIFT
  1896.  
  1897.  
  1898.      **2**          words that begin with 2
  1899.  
  1900.      2              ( -- 2 )
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.           \BBL\BBL.DOC  -29-  last updated 1986 October 14 21:30
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. BBL Forth Reference
  1919.  
  1920.  
  1921.      2!             ( D-value address -- : store value at address )
  1922.                     Stores 8 bytes = 64b
  1923.                     Value is MSW on top of data stack, LSW first in memory.
  1924.                     Address is seg:offset -- not necessarily canonical
  1925.                     Does NOT mean 2 !,  pronounced " two-bang"
  1926.                     c.f. C! W! T! !
  1927.  
  1928.      2*             ( n1 -- n2 )
  1929.                     n2 is the result of shifting n1 left one bit.  This
  1930.                     works on both signed and unsigned numbers.  2* is
  1931.                     equivalent to 2 * .  A zero is shifted into the vacated
  1932.                     bit position.  Note that 2* is NOT double precision
  1933.                     multiplication.
  1934.                     c.f. multiplication * */ */MOD 4* 8* 10* 16* 64* 256*
  1935.                     SHIFT
  1936.                     pronounced "two-star" in Abundance.
  1937.  
  1938.      2+             ( n1 -- n2 )
  1939.                     n2 is the result of adding two to n1 according to the
  1940.                     operation of + .  2+ is equivalent to 2 + .  Note that
  1941.                     2+ is NOT double precision addition.
  1942.                     c.f. + 1+ 4+ D+
  1943.                     pronounced "two-plus"
  1944.  
  1945.      2-             ( n1 -- n2 )
  1946.                     n2 is the result of subtracting two from n1 according
  1947.                     to the operation of - .  2- is equivalent to 2 - .
  1948.                     Note that 2- is NOT double precision subtraction.
  1949.                     c.f. - 1- D- NEGATE
  1950.                     pronounced "two-minus"
  1951.  
  1952.      2/             ( n -- n/2 )
  1953.                     Very quick signed divide by 2 using a shift.  n2 is the
  1954.                     result of arithmetically shifting n1 right one bit.
  1955.                     The sign is included in the shift and remains
  1956.                     unchanged.  Equivalent to 2/  Note that 2/ is NOT
  1957.                     double precision division.  -1 SHIFT would handle
  1958.                     unsigned division by 2.
  1959.                     c.f. division / SHIFT D2/
  1960.                     pronounced "two-slash"
  1961.  
  1962.      256*           ( n1 -- n2 )
  1963.                     256* multiplies by decimal 256 = 2**8 = LEFT SHIFT 8.
  1964.                     Works on both signed and unsigned numbers.
  1965.                     c.f. multiplication * 2* 4* 8* 10* 16* 64* SHIFT
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.           \BBL\BBL.DOC  -30-  last updated 1986 October 14 21:30
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. BBL Forth Reference
  1985.  
  1986.  
  1987.      2@             ( addr -- 64b )
  1988.                     fetches the 64-bit value stored at addr.  The 8-byte
  1989.                     value is stored in ram LSB first, but with the most
  1990.                     significant 32 bits on the top of the data stack.  The
  1991.                     address need not be canonical.
  1992.                     c.f. 2! C@ W@ UW@ T@ UT@ @
  1993.                     pronounced "two-fetch"
  1994.  
  1995.      2CONSTANT      ( 64b -- )
  1996.                     A defining word executed in the form:
  1997.                          64b 2CONSTANT <name>
  1998.                     Creates a dictionary entry for <name> so that when
  1999.                     <name> is later executed, 64b will be left on the data
  2000.                     stack.
  2001.                     pronounced "two-constant"
  2002.  
  2003.      2DROP          ( 64b -- )
  2004.                     64b is removed from the data stack -- i.e. two stack
  2005.                     entries -- equivalent to DROP DROP but executes more
  2006.                     quickly.
  2007.                     c.f. DROP R2DROP
  2008.                     pronounced "two-drop"
  2009.  
  2010.      2DUP           ( 64b -- 64b 64b )
  2011.                     Duplicate 64b.  An alternative way of looking at it is
  2012.                     that it duplicates the top pair on the data stack, ( n1
  2013.                     n2 -- n1 n2 n1 n2 )
  2014.                     pronounced "two-dupe"
  2015.  
  2016.      2OVER          ( 64b1 642 -- 64b1 64b2 64b3 )
  2017.                     64b3 is a copy of 64b1.  This is OVER for doublewords.
  2018.                     pronounced "two-over"
  2019.  
  2020.      2ROT           ( 64b1 64b2 64b3 -- 64b2 64b3 64b1 )
  2021.                     The top three double numbers on the data stack are
  2022.                     rotated, bringing the third double number to the top of
  2023.                     the stack.
  2024.                     c.f. ROT -ROT
  2025.                     pronounced "two-rote"
  2026.  
  2027.      2SWAP          ( 64b1 642 -- 64b2 64b1 )
  2028.                     The top two double numbers are exchanged.  Another way
  2029.                     of looking at this is ( n1 n2 n3 n4 -- n3 n4 n1 n2 )
  2030.                     pronounced "two-swap"
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.           \BBL\BBL.DOC  -31-  last updated 1986 October 14 21:30
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. BBL Forth Reference
  2051.  
  2052.  
  2053.      2VARIABLE      ( -- )
  2054.                     A defining word executed in the form:
  2055.                          2VARIABLE <name>
  2056.                     A dictionary entry for <name> is created and eight
  2057.                     bytes (64 bits) are ALLOTted in its parameter field.
  2058.                     This parameter field is to be used for contents of the
  2059.                     variable.  The application is responsible for
  2060.                     initializing the contents of the variable which it
  2061.                     creates if a value other than 0 is needed..  When
  2062.                     <name> is later executed, the address of its parameter
  2063.                     field is placed on the data stack.
  2064.                     c.f. VARIABLE
  2065.                     pronounced "two-variable"
  2066.  
  2067.  
  2068.      **3**          words that begin with 3
  2069.  
  2070.      3              ( -- 3 )
  2071.  
  2072.      3DROP          ( N1 N2 N3 -- )
  2073.                     DROP top 3 elements on the data stack.  Equivalent to
  2074.                     DROP DROP DROP but it executes more quickly.
  2075.                     c.f. DROP R3DROP
  2076.  
  2077.      3DUP           ( a b c --- a b c a b c )
  2078.                     duplicates top three items on data stack
  2079.  
  2080.  
  2081.      **4**          words that begin with 4
  2082.  
  2083.      4              ( -- 4 )
  2084.  
  2085.      4*             ( n1 -- n2 )
  2086.                     n2 is the result of shifting n1 left two bits.  This
  2087.                     works on both signed and unsigned numbers.  4* is
  2088.                     equivalent to 4 * .
  2089.                     c.f. multiplication * */ */MOD 2* 8* 10* 16* 64* 256*
  2090.                     SHIFT
  2091.                     pronounced "four-star" in Abundance.
  2092.  
  2093.      4+             ( n1 -- n2 )
  2094.                     n2 is the result of adding four to n1 according to the
  2095.                     operation of + .  4+ is equivalent to 4 + .
  2096.                     c.f. + 1+ 2+ D+
  2097.                     pronounced "four-plus"
  2098.  
  2099.      4-             ( n -- n-4 )
  2100.                     quick subtract of 4.  Equivalent to 4-.
  2101.                     c.f. - 1- 2- D-
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.           \BBL\BBL.DOC  -32-  last updated 1986 October 14 21:30
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. BBL Forth Reference
  2117.  
  2118.  
  2119.      4DROP          ( N1 N2 N3 N4 -- )
  2120.                     DROP top 4 elements on the data stack.  Equivalent of
  2121.                     DROP DROP DROP DROP.  Another way of looking at it is (
  2122.                     D1 D2 -- )
  2123.                     c.f. DROP R4DROP
  2124.  
  2125.  
  2126.      **5**          words that begin with 5
  2127.  
  2128.      5              ( -- 5 )
  2129.  
  2130.  
  2131.      **6**          words that begin with 6
  2132.  
  2133.      6              ( -- 6 )
  2134.  
  2135.      64*            ( n1 -- n2 )
  2136.                     64* multiplies by decimal 64 = 2**6 = LEFT SHIFT 6.
  2137.                     Works on both signed and unsigned numbers.
  2138.                     c.f. multiplication * 2* 4* 8* 10* 16* 256* SHIFT
  2139.  
  2140.  
  2141.      **7**          words that begin with 7
  2142.  
  2143.      7              ( -- 7 )
  2144.  
  2145.  
  2146.      **8**          words that begin with 8
  2147.  
  2148.      8              ( -- 8 )
  2149.  
  2150.      8*             ( n1 -- n2 )
  2151.                     8* multiplies by decimal 8 = 2**3 = LEFT SHIFT 3.
  2152.                     Works on both signed and unsigned numbers.
  2153.                     c.f. multiplication * 2* 4* 10* 16* 64* 256* SHIFT
  2154.  
  2155.  
  2156.      **9**          words that begin with 9
  2157.  
  2158.      9              ( -- 9 )
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.           \BBL\BBL.DOC  -33-  last updated 1986 October 14 21:30
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. BBL Forth Reference
  2183.  
  2184.  
  2185.      **:**          words that begin with :
  2186.  
  2187.      :              ( -- )
  2188.                     A defining word executed in the form:
  2189.                          : <name> ... ;
  2190.                     This creates a word definition for a new <name> and
  2191.                     compiles it into the dictionary .  The newly created
  2192.                     word definition for <name> cannot be found in the
  2193.                     dictionary until the corresponding ; or ;CODE is
  2194.                     successfully processed.  The : must always be followed
  2195.                     by a space.   When the name is later used, it must be
  2196.                     spelled exactly the same way including capitalization.
  2197.                     Abundance programmers use a word very similar to :
  2198.                     called <<<.  Everything that applies to : also applies
  2199.                     to <<<.
  2200.                     c.f. ;
  2201.  
  2202.  
  2203.      **;**          words that begin with ;
  2204.  
  2205.      ;              ( -- )
  2206.                     Stops compilation of a colon definition, UNSMUDGEs to
  2207.                     allow the <name> of this colon definition to be found
  2208.                     in the dictionary, sets interpret state and compiles as
  2209.                     EXIT.  Abundance programmers use a word very similar to
  2210.                     ; called >>>.  Everything that applies to ; also
  2211.                     applies to >>>.
  2212.                     c.f. ;CODE (;CODE)
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.           \BBL\BBL.DOC  -34-  last updated 1986 October 14 21:30
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. BBL Forth Reference
  2249.  
  2250.  
  2251.      ;CODE          ( -- )
  2252.                     Used in the form:
  2253.                          : <namex> ... CREATE ... ;CODE ... END-CODE
  2254.                     Stops compilation, terminates the defining word <namex>
  2255.                     and executes ASSEMBLER.  When <namex> is executed in
  2256.                     the form:
  2257.                          <namex> <name>
  2258.                     to define the new <name>, the execution address of
  2259.                     <name> will contain the address of the code sequence
  2260.                     following the ;CODE in <namex>.  Execution of any
  2261.                     <name> will cause this machine code sequence to be
  2262.                     executed.  The only way you will ever understand this
  2263.                     is to examine the source code in the BBL compiler.  See
  2264.                     BBLDOC.ASM for an overview.  Once you understand this
  2265.                     you may consider yourself one of the blessed ones who
  2266.                     truly grok Forth.  There is a Forth tradition of not
  2267.                     explaining this deep mystery.  Perhaps people who have
  2268.                     slogged to figure it out don't want it to be too easy
  2269.                     for those following to join the select club.  More
  2270.                     likely, it is just too difficult to explain.  It is a
  2271.                     slippery concept.  Even after writing this compiler, I
  2272.                     cannot easily remember how it works myself.
  2273.                     c.f. CODE (;CODE) DOES>
  2274.                     pronounced "semi-colon-code"
  2275.  
  2276.      ;S             ( -- )
  2277.                     Exit current procedure, synonym for EXIT. ;S is
  2278.                     compiled by ; to make it a little easier to disassemble
  2279.                     code.  Internal EXITS compile to EXIT, but the final
  2280.                     one compiles implied by ; compiles to ;S.  ;S is also
  2281.                     used to mean ignore the rest of this screen.  It turns
  2282.                     the rest of the screen into a comment.  Forth purists
  2283.                     seem to think ;S is a rude word.  I am not sure why.
  2284.                     c.f. \ ( ) EXIT
  2285.  
  2286.  
  2287.      **<**          words that begin with <
  2288.  
  2289.      <              ( n1 n2 -- flag )
  2290.                     Flag is true if n1 is less than n2 using signed
  2291.                     compares.  Note that < NOT is equivalent to but slower
  2292.                     than >=.  See the warning about comparing addresses.
  2293.                     c.f. U< D< <= > U> D> >= = D= <> MIN MAX NOT 0< 0<= 0>
  2294.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  2295.                     pronounced "less-than"
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.           \BBL\BBL.DOC  -35-  last updated 1986 October 14 21:30
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. BBL Forth Reference
  2315.  
  2316.  
  2317.      <#             ( D1 -- D1 )
  2318.                     Initialize pictured numeric output conversion of
  2319.                     internal binary to displayable ASCII.  The ASCII text
  2320.                     string result is stored in right-to left order just
  2321.                     under the PAD with the rightmost char at PAD-1.  Note
  2322.                     that <# works on double precision numbers.  There is no
  2323.                     single precision equivalent.
  2324.                     c.f. # #S HOLD SIGN #>
  2325.                     pronounced "less-sharp"
  2326.  
  2327.      <=             ( n1 n2 -- flag )
  2328.                     true if n1 is less than or equal to n2 using signed
  2329.                     compares.  Note that <= NOT is equivalent to but slower
  2330.                     than >.  See the warning about comparing addresses.
  2331.                     c.f. < U<= D< > U> D> >= = D= <> MIN MAX NOT 0< 0<= 0>
  2332.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  2333.                     pronounced "less-or-equal"
  2334.  
  2335.      <MARK          ( -- addr )
  2336.                     Only used by clever programmers.  Marks a back branch.
  2337.                     Used at the destination of a backward branch.  addr is
  2338.                     typically only used by <RESOLVE to compile a branch
  2339.                     address.  For example the code for DO would contain a
  2340.                     <MARK to arrange for LOOP to use <RESOLVE to build a
  2341.                     (LOOP) branch back just after the DO.
  2342.                     c.f. <RESOLVE >MARK >RESOLVE
  2343.                     pronounced "backward-mark"
  2344.  
  2345.      <RESOLVE       ( addr -- )
  2346.                     Only used by clever programmers.  Resolves a back
  2347.                     branch.  Used at the source of a backward branch after
  2348.                     either  BRANCH or ?BRANCH .  Compiles a branch address
  2349.                     using addr as the destination address.  For example the
  2350.                     code for DO would contain a <MARK to arrange for LOOP
  2351.                     to use <RESOLVE to build a (LOOP) branch back just
  2352.                     after the DO.
  2353.                     pronounced "backward-resolve"
  2354.  
  2355.      <SCAN          ( addr len char -- index of found char, true: if found
  2356.                     )
  2357.                     ( addr len char -- false : if not found )
  2358.                     scan string right to left searching for char.  The left
  2359.                     most char is index 0.  If the string is 0 length, the
  2360.                     result is always false.  The length must be 16 bits
  2361.                     unsigned.  <SCAN is somewhat like PL/I index function.
  2362.                     Returns index = 0 for first and = 1 for 2nd position.
  2363.                     Note: 0-based.
  2364.                     c.f. SCAN WSCAN SCAN<>
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.           \BBL\BBL.DOC  -36-  last updated 1986 October 14 21:30
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. BBL Forth Reference
  2381.  
  2382.  
  2383.      **=**          words that begin with =
  2384.  
  2385.      =              ( n1 n2 -- flag )
  2386.                     flag is true if n1 is equal to n2.
  2387.                     works for signed and unsigned.  For a logical bit-wise
  2388.                     equal compare use XOR NOT.  Note than = NOT is
  2389.                     equivalent to but slower than <>.  See the warning
  2390.                     about comparing addresses.
  2391.                     c.f. < U< D< <= > U> D> >= = D= <> MIN MAX NOT 0< 0<=
  2392.                     0> 0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  2393.                     pronounced "equals"
  2394.  
  2395.  
  2396.      **>**          words that begin with >
  2397.  
  2398.      >              ( n1 n2 -- flag )
  2399.                     Flag is true if n1 is greater than n2 using signed
  2400.                     compares.  > NOT is equivalent to but slower than <=.
  2401.                     See the warning about comparing addresses.
  2402.                     c.f. U> < U< D< <= > D> >= = D= <> MIN MAX NOT 0< 0<=
  2403.                     0> 0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  2404.                     pronounced "greater than"
  2405.  
  2406.      ><             ( n1 -- n2 );
  2407.                     n2 is n1 with low 2 bytes swapped, high 2 bytes are
  2408.                     undisturbed.  Do not >< confuse with <> which means not
  2409.                     equal.
  2410.                     c.f. W>< <>
  2411.  
  2412.      >=             ( n1 n2 -- flag)
  2413.                     true if n1 is greater or equal to n2 using signed
  2414.                     compares.  Note that >= NOT is equivalent to but slower
  2415.                     than <.  See the warning about comparing addresses.
  2416.                     c.f. U>= < D< <= > U> D> >= = D= <> MIN MAX NOT 0< 0<=
  2417.                     0> 0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  2418.  
  2419.      >BODY          ( cfa -- pfa )
  2420.                     converts cfa (code field address) to pfa (parameter
  2421.                     field address).  Note that primitive words (those
  2422.                     written in assembler) do not have a pfa.  CONSTANTs do
  2423.                     not have pfa's either.
  2424.                     c.f. >NAME >LINK BODY> NAME> LINK> N>LINK L>NAME PREV-
  2425.                     NFA
  2426.                     pronounced "to-body"
  2427.  
  2428.      >DIGIT         ( Char base -- N2 true : if valid conversion )
  2429.                     ( Char base -- false : if invalid )
  2430.                     Only least significant 8 bits of C and base are
  2431.                     examined.  Converts ^ 0 i.e. decimal 48 to binary 0.
  2432.                     Converts ^ F to 15.  Used by CONVERT and NUMBER.
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.           \BBL\BBL.DOC  -37-  last updated 1986 October 14 21:30
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. BBL Forth Reference
  2447.  
  2448.  
  2449.      >IN            ( -- addr )
  2450.                     A variable which contains the present character offset
  2451.                     within the input stream {0..the number of characters in
  2452.                     the input stream}.  The offset may be either in the TIB
  2453.                     or in the screen being interpreted.
  2454.                     c.f. WORD
  2455.                     pronounced "to-in"
  2456.  
  2457.      >LINK          ( cfa -- lfa )
  2458.                     converts cfa (code field address) to the lfa (link
  2459.                     field address.  The link field must be accessed with
  2460.                     LINK@ to get the nfa of the predecessor on the
  2461.                     dictionary thread.
  2462.                     c.f. >BODY >NAME BODY> NAME> LINK> N>LINK L>NAME PREV-
  2463.                     NFA
  2464.  
  2465.      >MARK          ( -- addr )
  2466.                     Only used by clever programmers.  Marks a forward
  2467.                     branch.  Used at the source of a forward branch.
  2468.                     Typically used after either BRANCH or ?BRANCH .
  2469.                     Compiles space in the dictionary for a branch address
  2470.                     which will later be resolved by >RESOLVE.  For example
  2471.                     IF would use >MARK to half build the ?BRANCH address to
  2472.                     jump over the code between IF and THEN.  THEN would use
  2473.                     >RESOLVE to finish building the address to jump just
  2474.                     past the THEN.
  2475.                     pronounced "forward-mark"
  2476.  
  2477.      >NAME          ( cfa -- nfa )
  2478.                     converts cfa (code field address) to nfa (name field
  2479.                     address).  Use this word sparingly.  WARNING THIS WORD
  2480.                     IS EXTREMELY SLOW!  It works by scanning all nfas in
  2481.                     all vocabularies to find a match.  If you really need
  2482.                     this feature,  I suggest capturing the nfa at compile
  2483.                     time with LATEST and storing it somewhere near the pfa.
  2484.                     c.f. >BODY >LINK BODY> NAME> LINK> N>LINK L>NAME PREV-
  2485.                     NFA
  2486.                     pronounced "to-name"
  2487.  
  2488.      >R             ( 32b -- )
  2489.                     Removes 32b from the data stack and transfers it to the
  2490.                     return stack.  Must always be paired with R>.  This is
  2491.                     a very useful word but see the dire warnings on its use
  2492.                     under Return Stack.
  2493.                     c.f. R> R@ RDROP EXIT
  2494.                     pronounced "to-r"
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.           \BBL\BBL.DOC  -38-  last updated 1986 October 14 21:30
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. BBL Forth Reference
  2513.  
  2514.  
  2515.      >REL           ( absolute addr -- relative addr )
  2516.                     converts an absolute Seg:offset address to a relative
  2517.                     32 bit signed number -- the offset of the address from
  2518.                     the start of the program.  It can be used an any
  2519.                     machine address in any segment.  However if you use
  2520.                     REL> to convert it back, you won't necessarily get the
  2521.                     same representation of that address.
  2522.                     c.f. >REL >REL>
  2523.                     pronounced "to-relative"
  2524.  
  2525.      >REL>          ( absolute addr -- canonical addr )
  2526.                     converts an absolute Seg:offset address to a canonical
  2527.                     one with the offset in the range 0..15.  It really only
  2528.                     useful on addresses in the pfa part of the dictionary
  2529.                     or on addresses outside the program.  It does not
  2530.                     cleverly handle addresses in the code segment to make
  2531.                     them have a segment equal to CS:.  Neither does it
  2532.                     handles addresses in the stack segment to make them
  2533.                     have a segment equal to SS:.  Neither does it handle
  2534.                     addresses in the vocabulary segments to make them have
  2535.                     segments equal to the start of the vocabulary region.
  2536.                     See the warning about comparing addresses.
  2537.                     c.f. >REL REL>
  2538.                     pronounced "canonize"
  2539.  
  2540.      >RESOLVE       ( addr -- )
  2541.                     Only used by clever programmers.  Resolves a forward
  2542.                     branch.  Used at the destination of a forward branch.
  2543.                     Calculates the branch address (to the current location
  2544.                     in the dictionary) using addr and places this branch
  2545.                     address into the space left by >MARK.  For example IF
  2546.                     would use >MARK to half build the ?BRANCH address to
  2547.                     jump over the code between IF and THEN.  THEN would use
  2548.                     >RESOLVE to finish building the address to jump just
  2549.                     past the THEN.
  2550.                     pronounced "forward-resolve"
  2551.  
  2552.  
  2553.      **?**          words that begin with ?
  2554.  
  2555.      ?BRANCH        ( flag -- : compiled by immediate words to
  2556.                     conditionally jump)
  2557.                     When used in the form: COMPILE ?BRANCH  a conditional
  2558.                     branch operation is compiled.  See BRANCH for further
  2559.                     details.  When executed, if flag is false the branch is
  2560.                     performed as with BRANCH .  When flag is true execution
  2561.                     continues at the compilation address immediately
  2562.                     following the branch address. Followed in dictionary by
  2563.                     a signed relative byte offset.  It is optimized for the
  2564.                     case where the branch is usually not taken.  Alias
  2565.                     0BRANCH in older FORTH implementations.
  2566.                     pronounced "question-branch"
  2567.  
  2568.  
  2569.  
  2570.           \BBL\BBL.DOC  -39-  last updated 1986 October 14 21:30
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. BBL Forth Reference
  2579.  
  2580.  
  2581.      ?BRANCH-USUALLY     ( flag -- : compiled by immediate words to
  2582.                     conditionally jump)
  2583.                     Followed in dictionary by a signed relative byte
  2584.                     offset.  It is an optimized form of ?BRANCH for the
  2585.                     case where the branch is usually taken.  Alias 0BRANCH
  2586.                     in older FORTH implementations.
  2587.  
  2588.      ?COMP          ( -- : ensures compiling )
  2589.                     If you are not compiling (in the middle of a colon
  2590.                     definition) BBL aborts with an error message.  Used by
  2591.                     words such as IF to ensure they are not used outside
  2592.                     colon definitions.
  2593.  
  2594.      ?CSP           ( -- )
  2595.                     ensures a colon definition starts and ends with same
  2596.                     data stack depth by comparing the current stack depth
  2597.                     with the one recorded with !CSP.  Colon does a !CSP and
  2598.                     semicolon does a ?CSP.
  2599.                     c.f. !CSP
  2600.  
  2601.      ?DNEGATE       ( D1 n2 --  D1 if n2 >=0)
  2602.                     ( D1 n2 -- -D1 if n2 < 0)
  2603.                     ?DNEGATE is usually used to transfer the sign of n2 to
  2604.                     a usually unsigned D1.  Note n2 is not normally a
  2605.                     canonical flag, but if it is, it means negate D1 if the
  2606.                     flag is true, otherwise leave it alone.
  2607.                     c.f. NEGATE ?NEGATE DNEGATE
  2608.  
  2609.      ?DO            ( n1 n2 -- )
  2610.                     ( -- back-addr1 back-addr2 3 ) (compiling)
  2611.                     used in the form  ?DO .. LOOP or ?DO .. 2 +LOOP
  2612.                     Starts a loop.  Like DO except that it has an extra
  2613.                     check in it to see if n1 = n2.  If they are equal the
  2614.                     entire loop is bypassed.  Note that if n1 < n2 the loop
  2615.                     still attempts to carry on with usually disastrous
  2616.                     results!  In Abundance the <<<FOR and <<<RUN style
  2617.                     loops are used in preference to ?DO.  ?DO compiles as a
  2618.                     (?DO) token followed by a BRANCH style offset for
  2619.                     leave.
  2620.  
  2621.      ?DUP           ( 32b -- 32b 32b ) or
  2622.                     ( 0 -- 0 )
  2623.                     duplicate 32b if it is non-zero
  2624.                     Normally used in the form  ?DUP IF ... THEN
  2625.                     c.f. DUP 2DUP
  2626.                     pronounced "question-dupe"
  2627.  
  2628.      ?EXEC          ( -- )
  2629.                     ensures executing.  If you are in the middle of
  2630.                     compiling a colon definition, it will abort with an
  2631.                     error message.  Used to ensure words like colon are
  2632.                     only used outside colon definitions.
  2633.  
  2634.  
  2635.  
  2636.           \BBL\BBL.DOC  -40-  last updated 1986 October 14 21:30
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. BBL Forth Reference
  2645.  
  2646.  
  2647.      ?FOUND         ( 0/1/-1 found flag -- )
  2648.                     ensure FIND worked.  If the found flag, usually created
  2649.                     as a result of FIND, is 0 ?FOUND aborts with an error
  2650.                     message.
  2651.  
  2652.      ?LOADING       ( -- )
  2653.                     ensure loading.  If interpreting the input from the TIB
  2654.                     instead of a screen, ?LOADING will abort with an error
  2655.                     message.  Used by words such as ( to ensure they are
  2656.                     only used on screens, not typed in directly.
  2657.  
  2658.      ?NEGATE        ( n1 n2 --  n1 if n2 >=0)
  2659.                     ( n1 n2 -- -n1 if n2 < 0)
  2660.                     ?NEGATE is usually used to transfer the sign of n2 to a
  2661.                     usually unsigned n1.  Note n2 is not normally a
  2662.                     canonical flag, but if it is, it means negate n1 if the
  2663.                     flag is true, otherwise leave it alone.
  2664.                     c.f. NEGATE DNEGATE ?DNEGATE
  2665.  
  2666.      ?PAIRS         ( N1 N2 --- )
  2667.                     ensures conditionals paired by aborting with an error
  2668.                     message if n1 is not equal n2.  At compile time
  2669.                     structured conditionals such as IF put a unique code
  2670.                     number on the data stack that is checked for by the
  2671.                     matching ending e.g. THEN.  Here is a list of the code
  2672.                     numbers used by the various structures:
  2673.                     BEGIN 1 ... AGAIN
  2674.                     BEGIN 1 ... END
  2675.                     BEGIN 1 ... flag WHILE 4 ... REPEAT
  2676.                     BEGIN 1 ... flag UNTIL
  2677.                     flag IF 2 ... THEN
  2678.                     flag IF 2 ... ELSE 2 ... THEN
  2679.                     n1 n2 DO 3 ... LOOP
  2680.                     n1 n2 DO 3 ... +LOOP
  2681.                     n1 n2 ?DO 3 ... LOOP
  2682.                     n1 n2 ?DO 3 ... +LOOP
  2683.                     Note that  : ... ; uses !CSP and ?CSP instead of
  2684.                     ?PAIRS.
  2685.  
  2686.      ?STACK         ( -- )
  2687.                     ensure both stacks are in bounds.  ABORTs with a
  2688.                     message if the either the data or return stack has
  2689.                     underflowed or overflowed.
  2690.  
  2691.      ?TERMINAL      ( -- flag )
  2692.                     true if char waiting in keystroke buffer.  Does not
  2693.                     read or lose the character.  Use KEY to get the
  2694.                     character.
  2695.                     c.f. KEY
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.           \BBL\BBL.DOC  -41-  last updated 1986 October 14 21:30
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. BBL Forth Reference
  2711.  
  2712.  
  2713.      **@**           words that begin with @
  2714.  
  2715.      @              ( addr -- 32b )
  2716.                     fetches the 32-bit value stored at addr.  The 4-byte
  2717.                     value is stored in ram LSB first.  The address need not
  2718.                     be canonical.
  2719.                     c.f. ! C@ W@ UW@ T@ UT@ 2@ TOKEN@ PC@ P@ COUNT
  2720.                     pronounced "fetch"
  2721.  
  2722.  
  2723.      **A**           words that begin with A
  2724.  
  2725.      A"             ( A" xxxx" -- addr len )
  2726.                     inline string literal.  STATE-smart -- can be used
  2727.                     either while compiling or executing.  Compiles as (A")-
  2728.                     token 1-byte-length the-string poss-pad-byte.
  2729.  
  2730.      ABORT          ( -- )
  2731.                     Clears the data stack and performs the function of
  2732.                     QUIT.  No message is displayed.  ABORT clears both the
  2733.                     return and data stacks where QUIT just clears the
  2734.                     return stack.  ABORT also sets FORTH as the CONTEXT
  2735.                     vocabulary.  This will help you recover from errors
  2736.                     where you screw up the transient or resident context
  2737.                     search order vocabularies.
  2738.                     c.f. ABORT" QUIT
  2739.  
  2740.      ABORT"         ( flag -- ) executing
  2741.                     ( -- ) compiling
  2742.                     Used in the form: flag ABORT" my error message"
  2743.                     When later executed, if the flag is true the characters
  2744.                     my error message delimited by " (close-quote), are
  2745.                     displayed along with the name of the most recently
  2746.                     parsed word.  Then an ABORT,is performed.  If flag is
  2747.                     false, the flag is dropped and execution continues.
  2748.                     The blank following ABORT" is necessary and not a part
  2749.                     of the error message. The flag being true means bad -
  2750.                     the opposite of the usual Abundance convention.
  2751.                     Compiles as token-("?ABORT) 1-byte-length string poss-
  2752.                     even-pad-byte
  2753.  
  2754.      ABS            ( n -- u )
  2755.                     u is the absolute value of n.  In other words ABS makes
  2756.                     n positive.  If n is < 0 then the result is -n.  If n
  2757.                     is greater than 0 then the result is simply n.   If n
  2758.                     is -232 then ABS cannot work properly as there is no
  2759.                     positive equivalent that can be expressed in 32 bits,
  2760.                     so in that case the result is unchanged at -232.
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.           \BBL\BBL.DOC  -42-  last updated 1986 October 14 21:30
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. BBL Forth Reference
  2777.  
  2778.  
  2779.      ADCON          ( 32b -- )
  2780.                     A defining word executed in the form:
  2781.                          32b ADCON <name>
  2782.                     Creates a dictionary entry for <name> so that when
  2783.                     <name> is later executed, 32b will be left on the data
  2784.                     stack.  The value must be a relocatable absolute
  2785.                     address.  The names defined with ADCONs have cfas but
  2786.                     no pfas as ADCON generates primitive assembler code to
  2787.                     push the value of the constant to the data stack.
  2788.                     ADCON is just a quick form of CONSTANT used if you are
  2789.                     willing to live with the restriction that the value
  2790.                     represent an absolute address in the program, rather
  2791.                     than outside the program e.g. somewhere in ROM BIOS or
  2792.                     DOS.  The value may NOT be a relative address.
  2793.                     c.f. CONSTANT, QCONSTANT
  2794.  
  2795.      AGAIN          Used in the form BEGIN ... AGAIN
  2796.                     ( BEGIN back-addr 1 ... AGAIN ) compiling
  2797.                     ( BEGIN ... AGAIN ) executing
  2798.                     Generates an endless loop.  The only way out of it is
  2799.                     to use an EXIT inside the loop.  Note that in this
  2800.                     implementation LEAVE is NOT allowed inside a BEGIN
  2801.                     AGAIN loop.
  2802.  
  2803.      ALIAS          ( ' X ALIAS Y )
  2804.                     ( ' X ALIAS Y IMMEDIATE)
  2805.                     Makes Y a ALIAS for X.  No cfa or pfa is created.  The
  2806.                     nfa of Y points directly to X.  If X is IMMEDIATE then
  2807.                     normally you would manually make Y immediate as well.
  2808.                     This would not happen automatically.  X and Y need not
  2809.                     be in the same vocabularies.  X must be in the CONTEXT
  2810.                     search order, and Y will be placed in the CURRENT
  2811.                     DEFINITIONS vocabulary.  When LOGO mode is used, if X
  2812.                     is redefined Y will be also.  If you FORGET Y, this
  2813.                     will not necessarily FORGET X as well.  Note that ALIAS
  2814.                     is not immediate.  It is normally used outside colon
  2815.                     definitions.
  2816.                     ' + ALIAS PLUS is faster than : PLUS + ;
  2817.                     ' THEN ALIAS ENDIF IMMEDIATE is faster than
  2818.                     : ENDIF [COMPILE] THEN ; IMMEDIATE
  2819.                     c.f. DEFER AS EXECUTE PERFORM
  2820.  
  2821.      ALLOT          ( +w -- )
  2822.                     Allocates w bytes in the pfa dictionary.  HERE -- the
  2823.                     address of the next available dictionary location is
  2824.                     updated accordingly.  ALLOT sometimes canonizes HERE.
  2825.                     c.f. HERE HEREB , C, ALLOTC ALLOTR ALLOTV
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.           \BBL\BBL.DOC  -43-  last updated 1986 October 14 21:30
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. BBL Forth Reference
  2843.  
  2844.  
  2845.      ALLOTC         ( +w -- )
  2846.                     Not normally used by programmers.  Allocates w bytes in
  2847.                     the cfa dictionary.  HEREC -- the address of the next
  2848.                     available dictionary location is updated accordingly.
  2849.                     Normally the programmer uses ALLOT instead of ALLOTC.
  2850.                     c.f. ALLOT HEREC
  2851.  
  2852.      ALLOTR         ( +w -- )
  2853.                     Not normally used by programmers.  Allocates w bytes
  2854.                     from the region reserved for new vocabulary storage
  2855.                     regions.  +W must be a multiple of 16 or there will be
  2856.                     dire consequences later.  HERER -- the address of the
  2857.                     next available dictionary location is updated
  2858.                     accordingly.  Normally the programmer uses ALLOT
  2859.                     instead of ALLOTV.  When new vocabularies are defined
  2860.                     the system automatically uses ALLOTR to reserve a
  2861.                     vocabulary storage region of VOC-SIZE @ bytes to hold
  2862.                     the nfas of the words to be defined later in the new
  2863.                     vocabulary.
  2864.                     c.f. ALLOTV HEREV VOC-SIZE
  2865.  
  2866.      ALLOTV         ( +w -- )
  2867.                     Not normally used by programmers.  Allocates w bytes in
  2868.                     the nfa dictionary.  HEREV -- the address of the next
  2869.                     available dictionary location is updated accordingly.
  2870.                     Normally the programmer uses ALLOT instead of ALLOTV
  2871.                     c.f. ALLOTV HEREV
  2872.  
  2873.      ALSO           ( -- )
  2874.                     Allows you to set up more than one VOCABULARY to be
  2875.                     searched.  Used in the form:
  2876.                     ONLY FORTH ALSO EDITOR ALSO HIDDEN DEFINITIONS
  2877.                     This would set up the search to first look in HIDDEN,
  2878.                     then in EDITOR then in FORTH, then in ONLY.  New
  2879.                     definitions would be added to the HIDDEN vocabulary.
  2880.                     The transient vocabulary becomes the first vocabulary
  2881.                     in the resident portion of the search order.  Up to the
  2882.                     last three resident vocabularies will also be
  2883.                     preserved, in order, forming the resident search order.
  2884.                     Note that ALSO need not be immediately preceded or
  2885.                     followed by the name of a vocabulary.
  2886.                     c.f. ONLY FORTH ORDER WORDS FORGET DEFINITIONS SEAL
  2887.                     VOCABULARY
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.           \BBL\BBL.DOC  -44-  last updated 1986 October 14 21:30
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. BBL Forth Reference
  2909.  
  2910.  
  2911.      AND            ( n1 n2 -- n3 )
  2912.                     n3 is the logical-and on all 32 bits.  Thus BINARY 0101
  2913.                     0011 AND is equal to 0001 -- if both bits are 1 the
  2914.                     result is 1.  If either bit is a 0 the result is a 0.
  2915.                     Note that b1 NOT b2 NOT AND is better expressed as b1
  2916.                     b2 NOR and b1 NOT b2 NOT OR is better expressed as b1
  2917.                     b2 NAND.  If you use canonical flags, then this bit-
  2918.                     wise AND has the same meaning as the word "and" in
  2919.                     English.   In particular if n1 and n2 are canonical
  2920.                     flags (0 or -1) then:
  2921.                     true  true  -- true
  2922.                     false true  -- false
  2923.                     true  false -- false
  2924.                     false false -- false
  2925.                     c.f. OR NAND XOR NOT NOR
  2926.  
  2927.      AS             ( ' YYY AS XXX ) executing
  2928.                     ( ['] YYY AS XXX ) compiling
  2929.                     STATE-smart word that patches the cfa XXX to jump to
  2930.                     the cfa at YYY.  This effectively turns XXX into an
  2931.                     ALIAS for YYY.  Usually XXX is defined with DEFER XXX,
  2932.                     but XXX can be any existing word.  Watch out if XXX is
  2933.                     an ALIAS already, since the cfa is patched, both the
  2934.                     ALIAS and the orginal word will be effectively turned
  2935.                     into ALIASes for YYY.  See the discussion under DEFER.
  2936.                     c.f. (AS) DEFER PERFORM EXECUTE ' ['] LOGO
  2937.  
  2938.      ASCII          ( -- ) at compile time
  2939.                     ( -- c ) at run time.
  2940.                     Used to create character literals.  ASCII A compiles
  2941.                     the constant 65. At run time, the literal is placed on
  2942.                     the stack. ASCII is a synonym for _. A state-smart
  2943.                     literal that can be used inside or outside colon
  2944.                     definitions.
  2945.                     c.f. _ the underscore
  2946.  
  2947.      ASSEMBLER      ( -- )
  2948.                     Execution replaces the first vocabulary in the search
  2949.                     order with the ASSEMBLER vocabulary.
  2950.                     c.f. VOCABULARY
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.           \BBL\BBL.DOC  -45-  last updated 1986 October 14 21:30
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. BBL Forth Reference
  2975.  
  2976.  
  2977.       **B**         words that begin with B
  2978.  
  2979.      BASE           ( -- addr )
  2980.                     The address of a variable containing the current
  2981.                     numeric conversion radix.  {2..72}.  For example BINARY
  2982.                     is defined as 2 BASE !.  When BASE = 16 all numbers
  2983.                     will be printed in HEX and all numbers typed in or
  2984.                     compiled will be interpreted as HEX.  Be very careful
  2985.                     to distinguish the between the value of the BASE when a
  2986.                     definition is compiled and the value of the BASE when
  2987.                     the definition is executed.  Words like HEX control the
  2988.                     execution time BASE where words like [ HEX ] control
  2989.                     the compile time BASE.  There is only one variable BASE
  2990.                     that is used to control both compile-time and execution
  2991.                     time conversions.
  2992.                     c.f. .BASE CONVERT <# # #> . .S
  2993.  
  2994.      BEEP           ( freq time -- )
  2995.                     Sounds a tone.  The frequency is measured in Hertz.
  2996.                     The time is measured in hundreds of seconds.  e.g. 440
  2997.                     500 BEEP plays middle A for 5 seconds.
  2998.  
  2999.      BEGIN          ( -- )
  3000.                     ( -- back-addr 1 ) (compiling)
  3001.                     Used in the form
  3002.                     BEGIN ... flag UNTIL
  3003.                     BEGIN ... flag WHILE ... REPEAT
  3004.                     BEGIN ... AGAIN
  3005.                     BEGIN marks the start of a word sequence for repetitive
  3006.                     execution.  A BEGIN-UNTIL loop will be repeated until
  3007.                     flag is true.  A BEGIN-WHILE-REPEAT loop will be
  3008.                     repeated until flag is false.  The words after UNTIL or
  3009.                     REPEAT will be executed when either loop is finished.
  3010.                     The BEGIN ... AGAIN loop runs forever.  The only way
  3011.                     out would be an EXIT in the loop.  Note that in the
  3012.                     current implementation, LEAVE cannot be used to
  3013.                     terminate a BEGIN style loop.
  3014.  
  3015.      BIGGEST-HERE   ( -- ADDR )
  3016.                     last allowed slot in pfa region region.  When HERE gets
  3017.                     bigger than this we are in deep trouble.  The problem
  3018.                     may be rectified by configuring a version of BBL with a
  3019.                     bigger pfa region with more or bigger segments.
  3020.                     c.f. HERE ALLOT
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.           \BBL\BBL.DOC  -46-  last updated 1986 October 14 21:30
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040. BBL Forth Reference
  3041.  
  3042.  
  3043.      BIGGEST-HEREC  ( -- ADDR )
  3044.                     last allowed slot in cfa region.  When HEREC gets
  3045.                     bigger than this we are in deep trouble.  The problem
  3046.                     may be rectified by configuring a version of BBL with a
  3047.                     bigger cfa region.  However if the region is already at
  3048.                     64K, all you can do it get rid of assembler code which
  3049.                     always goes in the cfa segment by converting it to high
  3050.                     level code which always goes in the expandable pfa
  3051.                     segment.
  3052.                     c.f. HEREC ALLOTC
  3053.  
  3054.      BIGGEST-HEREV  ( -- ADDR )
  3055.                     last allowed slot in CURRENT (DEFINITIONS) vocabulary.
  3056.                     When HEREV gets bigger than this we are in deep
  3057.                     trouble.  The problem may be rectified by configuring a
  3058.                     version of BBL with a bigger nfa region.  In a grossly
  3059.                     pathological situations where a single vocabulary takes
  3060.                     more than 64K for the names, you may need to split it
  3061.                     into two vocabularies.  This should never happen.
  3062.                     c.f. HEREV
  3063.  
  3064.      BIGGEST-RP@    ( -- addr )
  3065.                     Not normally used by programmers.  Used by ?STACK to
  3066.                     detect Return stack overflow.  Value for RP@ when
  3067.                     return stack is full.
  3068.  
  3069.      BIGGEST-SP@    ( -- addr )
  3070.                     Not normally used by programmers.  Used by ?STACK to
  3071.                     detect data stack overflow.  Value for SP@ when data
  3072.                     stack is full.
  3073.  
  3074.      BIGGESTHEREV   ( -- ADDR )
  3075.                     Not normally used by programmers.   Used by CREATE to
  3076.                     determine if the nfa vocabulary region has overflowed.
  3077.                     Last allowed slot in CURRENT vocabulary region.  Result
  3078.                     is not canonical  the segment is set to the start of
  3079.                     the vocab region.
  3080.  
  3081.      BINARY         ( -- )
  3082.                     causes conversions to be done in radix 2.  Defined as 2
  3083.                     BASE !
  3084.  
  3085.      BL             ( -- 32 )
  3086.                     20h the constant blank.  Leave the ASCII character
  3087.                     value for space pronounced "b-l"
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.           \BBL\BBL.DOC  -47-  last updated 1986 October 14 21:30
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106. BBL Forth Reference
  3107.  
  3108.  
  3109.      BLANK          ( addr uw -- )
  3110.                     uw bytes of memory beginning at addr are set to the
  3111.                     ASCII character value for space.  No action is taken if
  3112.                     u is zero.  addr +u must be in the same segment as
  3113.                     addr.  For canonical addresses, u must be less than
  3114.                     65,519.
  3115.                     pronounced "blank"
  3116.  
  3117.      BLK            ( -- addr )
  3118.                     A variable containing the number of the mass storage
  3119.                     block being interpreted as the input stream is taken
  3120.                     from the text input buffer.  If this variable contains
  3121.                     0 the input stream is taken from the TIB.  The variable
  3122.                     has values  {0..the number of blocks available-1}
  3123.                     pronounced "b-l-k"
  3124.  
  3125.      BLOCK          ( uw -- addr )
  3126.                     addr is the address of the assigned buffer of the first
  3127.                     byte of block uw.  If the block occupying that buffer
  3128.                     is not block u, and has been Updated it is transferred
  3129.                     to mass storage before assigning the buffer.  If block
  3130.                     u is not already in memory, it is transferred from mass
  3131.                     storage into an assigned block buffer.  A block may not
  3132.                     be assigned to more than one buffer.  If u is not an
  3133.                     available block number an error condition exists.  Only
  3134.                     data within the last buffer referenced by BLOCK or
  3135.                     BUFFER is valid.  The contents of a block buffer must
  3136.                     not be changed unless the change may be transferred to
  3137.                     mass storage.
  3138.  
  3139.      BODY>          ( pfa -- cfa )
  3140.                     Converts pfa (parameter field address) to cfa (code
  3141.                     field address).  Use this word sparingly.  WARNING THIS
  3142.                     WORD IS EXTREMELY SLOW!  It works by scanning all nfas
  3143.                     in all vocabularies to find a match.  You cannot use
  3144.                     this word if the nfa header has been thrown away.  If
  3145.                     you need to do this, I suggest capturing the cfa at
  3146.                     compile time when it can be gotten quickly with LATEST
  3147.                     NAME> and storing it somewhere near the pfa.
  3148.                     c.f. >BODY >NAME >LINK NAME> LINK> N>LINK L>NAME PREV-
  3149.                     NFA
  3150.                     pronounced "from-body"
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.           \BBL\BBL.DOC  -48-  last updated 1986 October 14 21:30
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172. BBL Forth Reference
  3173.  
  3174.  
  3175.      BRANCH         ( -- )
  3176.                     compiled by immediate words such as ELSE to
  3177.                     unconditionally jump.  When used in the form: COMPILE
  3178.                     BRANCH an unconditional branch operation is compiled.
  3179.                     A branch address must be compiled immediately following
  3180.                     this compilation address.  The branch address is
  3181.                     typically generated by following BRANCH with <RESOLVE
  3182.                     or >MARK.  Followed in dictionary by a signed relative
  3183.                     byte offset.  BRANCH +2 is a NOOP branch.  -2 is an
  3184.                     endless loop.
  3185.  
  3186.      BUFFER         ( uw -- addr )
  3187.                     like BLOCK except need not read the block because it is
  3188.                     new or we no longer need the data in it.  Assigns a
  3189.                     block buffer to block uw.  addr is the address of the
  3190.                     first byte of the block within its buffer.  This
  3191.                     function is fully specified by the definition for BLOCK
  3192.                     except that if the block is not already in memory it
  3193.                     might not be transferred from mass storage.  The
  3194.                     contents of the block buffer assigned to block uw by
  3195.                     BUFFER are unspecified.
  3196.  
  3197.      build-adcon    ( value -- )
  3198.                     Internal word to generate asm code for an ADCON.
  3199.  
  3200.      build-constant ( value -- )
  3201.                     Internal word to generate asm code for a CONSTANT.
  3202.  
  3203.      build-jmp      ( jumpaddr pfa -- )
  3204.                     internal word to build assembler JMP commands.
  3205.  
  3206.      build-model    ( pfa patch-offset model-addr model-len -- )
  3207.                     internal word used to build code to go at the cfa from
  3208.                     a model template.
  3209.  
  3210.      build-qconstant     ( value -- )
  3211.                     Internal word to generate asm code for a QCONSTANT.
  3212.  
  3213.      BYE            ( -- )
  3214.                     terminates BBL and returns to DOS.  Closes all files.
  3215.  
  3216.  
  3217.      **C**          words that begin with C
  3218.  
  3219.      C!             ( value address -- )
  3220.                     Stores low order 1 byte at address.  Works on both
  3221.                     signed and unsigned quantities.  Value is MSW on top of
  3222.                     data stack, LSW first in memory .  Address is
  3223.                     seg:offset -- not necessarily canonical
  3224.                     c.f. W! T! ! 2! ON OFF
  3225.                     pronounced "c-bang"
  3226.  
  3227.  
  3228.  
  3229.  
  3230.           \BBL\BBL.DOC  -49-  last updated 1986 October 14 21:30
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238. BBL Forth Reference
  3239.  
  3240.  
  3241.      C,             ( c -- )
  3242.                     ALLOT one byte then store the least-significant 8 bits
  3243.                     of 32b at HERE 1- in the pfa dictionary.
  3244.                     pronounced "c-comma"
  3245.  
  3246.      C,C            ( c -- )
  3247.                     Not normally used by programmers.  ALLOT one byte then
  3248.                     store the least-significant 8 bits of 32b at HEREC 1-
  3249.                     in the cfa dictionary.
  3250.                     pronounced "c-comma"
  3251.  
  3252.      C@             ( addr -- c )
  3253.                     c is the 8-bit contents of the byte at addr.  The high
  3254.                     order 3 bytes are zero filled -- not sign extended.
  3255.                     There is no 1-byte fetch with sign extend
  3256.                     c.f. C! W@ UW@ T@ UT@ @ 2@
  3257.                     pronounced "c-fetch"
  3258.  
  3259.      CACHE-HANDLE   ( -- addr )
  3260.                     Variable containing the DOS file handle for the
  3261.                     currently open cache file of screens.  It will be 0 if
  3262.                     the cache file is not open.
  3263.                     c.f. CACHE-NAME USING OPEN-CACHE CLOSE-CACHE LAST-SCR
  3264.  
  3265.      CACHE-NAME     ( -- addr )
  3266.                     an area of memory usually 40 bytes long that contains
  3267.                     the external dos filename of the cache file where Forth
  3268.                     screens are kept e.g. C:\ABS\FORTH.BLK.  The name must
  3269.                     be followed by an ascii null or enough blanks so that
  3270.                     the builtin ascii null following CACHE-NAME acts as the
  3271.                     terminator.  To change the CACHE-NAME, first CLOSE-
  3272.                     CACHE then change CACHE-NAME and then reopen with OPEN-
  3273.                     CACHE.
  3274.                     c.f. USING BLOCK CACHE-HANDLE OPEN-CACHE CLOSE-CACHE
  3275.                     LAST-SCR
  3276.  
  3277.      CLEARSCREEN    ( -- )
  3278.                     Clears the screen.  If the video mode is 7 it will
  3279.                     clear the monochrome screen.  If the video mode is 2
  3280.                     for Black and White or 3 for colour it will clear the
  3281.                     colour screen.
  3282.  
  3283.      CLOSE-CACHE    ( -- )
  3284.                     close the CACHE file of Forth screens. DISK-ERROR @ is
  3285.                     0 if ok, 8 if could not close.  BYE does this
  3286.                     automatically.  If you use the verbs BLOCK and BUFFER
  3287.                     while the CACHE file is closed, the behaviour mimics
  3288.                     being attached to the NULL device.  You normally would
  3289.                     do a FLUSH or SAVE-BUFFERS before calling CLOSE-CACHE.
  3290.                     c.f. USING OPEN-CACHE DISK-ERROR FLUSH SAVE-BUFFERS
  3291.                     EMPTY-BUFFERS CACHE-NAME LAST-SCR
  3292.  
  3293.  
  3294.  
  3295.  
  3296.           \BBL\BBL.DOC  -50-  last updated 1986 October 14 21:30
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304. BBL Forth Reference
  3305.  
  3306.  
  3307.      CMOVE          ( from-addr1 to-addr2 length-uw -- )
  3308.                     Move u bytes beginning at address addr1 to addr2.  The
  3309.                     byte at addr1 is moved first, proceeding toward high
  3310.                     memory.  If u is zero nothing is moved.  CMOVE works
  3311.                     from left to right thus you can slide a string on top
  3312.                     of itself to lower memory.  The length must be under
  3313.                     64K and must be covered by Segs of both addrs.  The
  3314.                     length may also be 0 or 1, but not negative.  The
  3315.                     addresses need not be canonical but addr-1 must cover
  3316.                     both ends of string-1 and addr-2 must cover both ends
  3317.                     of string-2.
  3318.                     c.f. CMOVE>
  3319.  
  3320.      CMOVE>         ( from-addr1 to-addr2 length-uw -- )
  3321.                     Move u bytes beginning at address addr1 to addr2.  The
  3322.                     move begins by moving the byte at (addr1 plus u minus
  3323.                     1) to (addr2 plus u minus 1) and proceeds to
  3324.                     successively lower addresses for u bytes. If u is zero
  3325.                     nothing is moved.  CMOVE> works from right to left thus
  3326.                     you can slide a string on top of itself to higher
  3327.                     memory.  The length must be under 64K.  The length may
  3328.                     also be 0 or 1, but not negative.  The addresses need
  3329.                     not be canonical but addr-1 must cover both ends of
  3330.                     string-1 and addr-2 must cover both ends of string-2.
  3331.                     c.f. CMOVE
  3332.  
  3333.      CODE           ( --  )
  3334.                     A defining word executed in the form:
  3335.                          CODE <name> ... END-CODE
  3336.                     Creates a dictionary entry for <name> to be defined by
  3337.                     a following sequence of assembly language words.  Words
  3338.                     thus defined are called code definitions.  This newly
  3339.                     created word definition for <name> cannot be found in
  3340.                     the dictionary until the corresponding END-CODE is
  3341.                     successfully processed.  Executes ASSEMBLER to invoke
  3342.                     the words in the ASSEMBLER vocabulary.
  3343.                     c.f. END-CODE
  3344.  
  3345.      COMPILE        ( -- )
  3346.                     Typically used in the form:
  3347.                        : <name> ... COMPILE <namex> ... ;
  3348.                     When <name> is executed, the compilation address
  3349.                     compiled for <namex> is compiled and not executed.
  3350.                     <name> is typically immediate and <namex> is not
  3351.                     immediate.  COMPILE compiles the next inline token into
  3352.                     the pfa dictionary e.g. ?DO would have a COMPILE (?DO)
  3353.                     in its definition.
  3354.                     See; "compilation"
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.           \BBL\BBL.DOC  -51-  last updated 1986 October 14 21:30
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370. BBL Forth Reference
  3371.  
  3372.  
  3373.      COMPILE-NUM    ( d -- )
  3374.                     Not normally used by programmers.  Used by INTERPRET
  3375.                     after NUMBER to compile either a 32-bit or 64-bit
  3376.                     inline literal depending on the value of DPL.  Numbers
  3377.                     with decimal points get compiled as double precision
  3378.                     64-bit literals and numbers without decimal points get
  3379.                     compiled as 32-bit literals.   DLITERAL is an immediate
  3380.                     word that compiles as DLIT-token followed by a 64-bit
  3381.                     literal.  LITERAL is an immediate word that optimizes
  3382.                     the building of 32-bit literals by compiling +WLIT -
  3383.                     WLIT or LIT as needed.
  3384.                     c.f. LITERAL DLITERAL
  3385.  
  3386.      COMPILE-STRING ( -- )
  3387.                     Not normally used by programmers.  Used by words such
  3388.                     as ." to build "-delimited counted strings into
  3389.                     dictionary.
  3390.  
  3391.      CONSOLE        ( -- )
  3392.                     redirects EMIT and TYPE output to screen by setting up
  3393.                     the 'EMIT and 'TYPE vectors.  CONSOLE is defined as
  3394.                     : CONSOLE ['] SEMIT 'EMIT ! ['] STYPE 'TYPE ! ;
  3395.                     c.f. PRINTER TYPE EMIT 'TYPE 'EMIT SEMIT STYPE
  3396.  
  3397.      CONSTANT       ( 32b -- )
  3398.                     A defining word executed in the form:
  3399.                          32b CONSTANT <name>
  3400.                     Creates a dictionary entry for <name> so that when
  3401.                     <name> is later executed, 32b will be left on the data
  3402.                     stack.
  3403.                     c.f. QCONSTANT, ADCON
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.           \BBL\BBL.DOC  -52-  last updated 1986 October 14 21:30
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436. BBL Forth Reference
  3437.  
  3438.  
  3439.      CONSTANT!      ( value cfa -- )
  3440.                     In normal Forth you can actually change the value of a
  3441.                     CONSTANT by saying
  3442.                     4 CONSTANT FOUR
  3443.                     5 ' FOUR >BODY !
  3444.                     This cheat will not work in BBL because CONSTANTS are
  3445.                     generated as primitives -- directly as assembler code
  3446.                     to push the value to the stack.  To change a CONSTANT
  3447.                     you must do the following
  3448.                     4 CONSTANT FOUR
  3449.                     5 ' FOUR CONSTANT!
  3450.                     CONSTANT! will not work reliably on ADCONs or
  3451.                     QCONSTANTS.  This whole discussion may sound like
  3452.                     something out of Alice in Wonderland.  Why would anyone
  3453.                     in their right mind try to change the value of a
  3454.                     CONSTANT?  They might to implement read-mostly
  3455.                     variables.  CONSTANTS don't need a @ so they work much
  3456.                     faster than VARIABLEs to examine their contents.
  3457.                     However VARIABLES are must faster to set.  You just use
  3458.                     !.  To change a CONSTANT you use CONSTANT! which
  3459.                     actually ends up re-assembling a tiny routine to
  3460.                     generate the new value.
  3461.                     c.f. CONSTANT.
  3462.  
  3463.      CONTEXT        ( -- addr )
  3464.                     The address of a variable which determines the
  3465.                     dictionary search order.
  3466.  
  3467.      CONVERT        ( +d1 addr1 -- +d2 addr2 )
  3468.                     +d2 is the result of converting the characters within
  3469.                     the text beginning at addr1+1 into digits, using the
  3470.                     value of BASE , and accumulating each into +d1 after
  3471.                     multiplying +d1 by the value of BASE .  Conversion
  3472.                     continues until an unconvertible character is
  3473.                     encountered.  addr2 is the location of the first
  3474.                     unconvertible character.
  3475.                     c.f. BASE NUMBER >DIGIT
  3476.  
  3477.      CORRAL         ( value lowest highest -- safe-value) traps a value
  3478.                     between two bounds. If too small it set to the low
  3479.                     bound, if too high it is set to the high bound.
  3480.                     Roughly equivalent to Value Lowest MAX Highest MIN.
  3481.                     For it to work lowest must be less than or equal to
  3482.                     highest.  Uses signed compares. e.g.
  3483.                     4 5 8 CORRAL -- 5
  3484.                     7 5 8 CORRAL -- 7
  3485.                     9 5 8 CORRAL -- 8
  3486.                     c.f. MIN MAX
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.           \BBL\BBL.DOC  -53-  last updated 1986 October 14 21:30
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502. BBL Forth Reference
  3503.  
  3504.  
  3505.      COUNT          ( addr1 -- addr2 +n )
  3506.                     Used to prepare counted string for TYPE.  addr2 is
  3507.                     addr1+1 and +n is the length of the counted string at
  3508.                     addr1.  The byte at addr1 contains the byte count +n
  3509.                     followed by the string.  Range of +n is {0..255}
  3510.  
  3511.      CR             ( -- )
  3512.                     Displays a carriage-return (ASCII char 13) and line-
  3513.                     feed (ASCII char 10).  Also does OUT 0! to reset the
  3514.                     count of characters in a line.
  3515.                     pronounced "c-r"
  3516.  
  3517.      CREATE         ( -- )
  3518.                     ( -- pfa : when <name> is executed )
  3519.                     A defining word executed in the form:
  3520.                          CREATE <name>
  3521.                     Creates a dictionary entry for <name>.  After <name> is
  3522.                     created, the next available dictionary location HERE is
  3523.                     the first byte of <name>'s pfa (parameter field
  3524.                     address).  When <name> is subsequently executed, the
  3525.                     address of the first byte of <name>'s parameter field
  3526.                     is left on the data stack.  CREATE does not allocate
  3527.                     any space at all in <name>'s parameter field.  However
  3528.                     it does generate 11 bytes of assembler code at <name>'s
  3529.                     cfa whose duty is to push the pfa when <name> is
  3530.                     executed.  Most often used : KIND CREATE n ALLOT DOES>
  3531.                     ... ;  or CREATE XXX n1 , n2 , ... outside a colon
  3532.                     definition.  If the word being CREATEd already exists
  3533.                     in the CURRENT DEFINITIONS vocabulary, normally you
  3534.                     will get a Redefined warning message.  Whether the word
  3535.                     is defined in some other vocabulary other than the
  3536.                     CURRENT one is immaterial e.g.  No message is given if
  3537.                     the word is in one of the CONTEXT resident
  3538.                     vocabularies.  However if you are in LOGO mode set by
  3539.                     LOGO ON, the old version will be patched to jump to the
  3540.                     new one.  This has the effect of redirecting all the
  3541.                     users of the old version to the new.  Words like :
  3542.                     VARIABLE CONSTANT and ALIAS all use CREATE to set up
  3543.                     the nfa of the newly defined word in the CURRENT
  3544.                     DEFINITIONS vocabulary.
  3545.                     c.f. LOGO CURRENT DEFINITIONS
  3546.  
  3547.      create-model   ( -- )
  3548.                     used internally as the model assembler code that CREATE
  3549.                     generates at the cfa of a newly defined word.
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.           \BBL\BBL.DOC  -54-  last updated 1986 October 14 21:30
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568. BBL Forth Reference
  3569.  
  3570.  
  3571.      CURRENT        ( -- addr )
  3572.                     The address of a variable specifying the vocabulary in
  3573.                     which new word definitions are appended.  It is
  3574.                     sometimes called the compilation vocabulary or the
  3575.                     DEFINITIONS vocabulary.  CURRENT @ gets you the address
  3576.                     of the base of the vocabulary storage region.  CURRENT
  3577.                     @ @ gets you the latest definition added to the current
  3578.                     vocabulary.
  3579.                     c.f. CONTEXT DEFINITIONS FORGET LATEST
  3580.  
  3581.  
  3582.      **D**          words that begin with D
  3583.  
  3584.      D+             ( wd1 wd2 -- wd3 )
  3585.                     wd3 is the arithmetic sum of wd1 plus wd2.  Adds two
  3586.                     signed 64b numbers
  3587.                     pronounced "d-plus"
  3588.  
  3589.      D,             ( D --- )
  3590.                     Compiles a 64-bit value into the pfa part of the
  3591.                     dictionary.
  3592.                     c.f. ,
  3593.  
  3594.      D-             ( wd1 wd2 -- wd3 )
  3595.                     wd3 is the result of subtracting wd2 from wd1.
  3596.                     pronounced "d-minus"
  3597.  
  3598.      D.             ( d -- )
  3599.                     Prints a 64-bit signed number followed by a space.  The
  3600.                     absolute value of d is displayed in a free field
  3601.                     format.  A leading negative sign is displayed if d is
  3602.                     negative.
  3603.                     pronounced "d-dot"
  3604.  
  3605.      D.R            ( d +n -- )
  3606.                     d is converted to ASCII using the value of BASE and
  3607.                     then displayed right aligned in a field +n characters
  3608.                     wide.  A leading minus sign is displayed if d is
  3609.                     negative.  If the number of characters required to
  3610.                     display d is greater than +n the field is simply
  3611.                     widened to accommodate it.
  3612.                     pronounced "d-dot-r"
  3613.  
  3614.      D0=            ( d -- flag )
  3615.                     flag is true if d is zero
  3616.                     c.f. 0< 0<= 0> 0>= 0= 0<> NOT
  3617.                     pronounced "d-zero-equals"
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.           \BBL\BBL.DOC  -55-  last updated 1986 October 14 21:30
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634. BBL Forth Reference
  3635.  
  3636.  
  3637.      D2/            ( d1 -- d2 )
  3638.                     quick 64-bit divide by 2.  d2 is the result of d1
  3639.                     arithmetically shifted right one bit.  The sign is
  3640.                     included in the shift and remains unchanged.
  3641.                     c.f. SHIFT division 2/ /
  3642.                     pronounced "d-two-slash"
  3643.  
  3644.      D<             ( d1 d2 -- flag )
  3645.                     flag is true if d1 is less than d2 using signed 64-bit
  3646.                     compare.
  3647.                     c.f. < U< <= > U> D> >= = D= <> MIN MAX NOT 0< 0<= 0>
  3648.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  3649.                     pronounced "d-less-than"
  3650.  
  3651.      D=             ( d1 d2 -- flag )
  3652.                     flag is true if d1 equals d2.  Can also be used to
  3653.                     compare the two sets of pairs of 32-bit numbers for
  3654.                     equality.
  3655.                     c.f. < U< D< <= > U> D> >= = <> MIN MAX NOT 0< 0<= 0>
  3656.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  3657.                     pronounced "d-equal"
  3658.  
  3659.      DABS           ( d -- ud )
  3660.                     ud is the absolute value of d.  In other words DABS
  3661.                     makes d positive.  If d is < 0 then the result is -d.
  3662.                     If d is greater than 0 then the result is simply d.
  3663.                     If d is -264 then ABS cannot work properly as there is
  3664.                     no positive equivalent that can be expressed in 64
  3665.                     bits, so in that case the result is unchanged at -264.
  3666.  
  3667.      DECIMAL        ( -- )
  3668.                     Set the input-output numeric conversion base to ten.
  3669.  
  3670.      DEFER          ( used in form DEFER XXX )
  3671.                     creates a new word that does nothing.  Later you use
  3672.                     ['] YYY AS XXX to give XXX a new meaning.  Thereafter
  3673.                     XXX acts as an alias for YYY.  Use ALIAS for static
  3674.                     aliases.  Use DEFER as for dynamic ALIASes.  You can
  3675.                     also use ['] and EXECUTE to get similar effects.  The
  3676.                     DEFER AS method is faster and cleaner but non-standard.
  3677.                     e.g.  VARIABLE 'XXX   : XXX 'XXX @ EXECUTE ;  ' YYY
  3678.                     'XXX ! is equivalent to: DEFER XXX  ' YYY AS XXX is
  3679.                     also equivalent to: ' YYY ALIAS XXX
  3680.                     c.f. AS (AS) EXECUTE PEFORM ['] '
  3681.  
  3682.      DEFINITIONS    ( -- )
  3683.                     The compilation vocabulary is changed to be the same as
  3684.                     the first vocabulary in the search order.  Makes the
  3685.                     CURRENT vocabulary same as CONTEXT.
  3686.                     c.f. CURRENT CONTEXT LATEST
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.           \BBL\BBL.DOC  -56-  last updated 1986 October 14 21:30
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700. BBL Forth Reference
  3701.  
  3702.  
  3703.      DEPTH          ( -- n )
  3704.                     n is the number of 32-bit values contained in the data
  3705.                     stack before n was placed on the data stack.  If the
  3706.                     data stack has underflowed, the result could be
  3707.                     negative.  Note that DEPTH is measured in 4-byte chunks
  3708.                     -- not bytes.
  3709.  
  3710.      DIGIT>         ( digit 0..36 --- ascii char )
  3711.                     Used by # to convert a single digit to ASCII  e.g.. 0 -
  3712.                     - ^ 0 decimal 48, 10 -- ^ A decimal 65, 15 -- ^ F
  3713.                     decimal 70
  3714.  
  3715.      DISK-ERROR     ( -- addr )
  3716.                     variable that contains the status of the most recent
  3717.                     BLOCK BUFFER SAVE-BUFFERS OPEN-CACHE or CLOSE-CACHE.
  3718.                     The contents of the variable are 0 if all is ok, 1 if
  3719.                     there was a read error, and 2 if there was a write
  3720.                     error, 4 if there was an open error and 8 if there was
  3721.                     a close error.  Note that for a disk full write error
  3722.                     you will not get an error on UPDATE.  It will not show
  3723.                     up until SAVE-BUFFERS or possibly a subsequent BLOCK.
  3724.                     c.f. USING BLOCK BUFFER SAVE-BUFFERS CLOSE-CACHE OPEN-
  3725.                     CACHE FLUSH LAST-SCR
  3726.  
  3727.      DLIT           ( -- Dvalue )
  3728.                     Not normally used by programmers.  DLITERAL compiles as
  3729.                     DLIT-Token followed by a 64-bit constant stored LSW
  3730.                     first to handle 64-bit inline constants.  The constant
  3731.                     may be signed or unsigned.  This is a not a word that
  3732.                     used directly.  It is generated by DLITERAL or in-line
  3733.                     constants containing decimal points.  e.g. 3.414.
  3734.                     c.f. DLITERAL
  3735.  
  3736.      DMAX           ( d1 d2 -- d3 )
  3737.                     d3 is the greater of d1 and d2.
  3738.                     pronounced "d-max"
  3739.  
  3740.      DMIN           ( d1 d2 -- d3 )
  3741.                     d3 is the lesser of d1 and d2.
  3742.                     c.f. MIN MAX CORRAL
  3743.                     pronounced "d-min"
  3744.  
  3745.      DNEGATE        ( d1 -- d2 )
  3746.                     d2 is the two's complement of d1 i.e. -d1
  3747.                     pronounced "d-negate"
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.           \BBL\BBL.DOC  -57-  last updated 1986 October 14 21:30
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766. BBL Forth Reference
  3767.  
  3768.  
  3769.      DO             ( n1 n2 -- )
  3770.                     ( -- back-addr-1 back-addr-2 3 ) (compiling)
  3771.                     Used in the form:
  3772.                               DO ... LOOP
  3773.                     or        DO ... n  +LOOP
  3774.                     Begins a loop which terminates based on control
  3775.                     parameters.  The loop index begins at n2, and
  3776.                     terminates based on the limit n.   See LOOP and +LOOP
  3777.                     for details on how the loop is terminated.  The loop is
  3778.                     always executed at least once.  DO compiles as (DO)-
  3779.                     token.  The most common type of loop to execute n times
  3780.                     is of the form n 0 DO.  I will then have the values 0,
  3781.                     1 .. n-1 each time through the loop.
  3782.                     c.f. ?DO LOOP +LOOP LEAVE (DO) (?DO) (LOOP) (+LOOP)
  3783.                     (LEAVE)
  3784.  
  3785.      docol          ( -- )
  3786.                     Not normally used by programmers.  This little piece of
  3787.                     assembler code is used to kick off the execution of all
  3788.                     colon definitions.
  3789.  
  3790.      dodoes         ( -- )
  3791.                     Not normally used by programmers.  This little piece of
  3792.                     assembler code is used to kick off the execution of all
  3793.                     DOES> code.
  3794.  
  3795.      does-model     ( -- )
  3796.                     Not normally used by programmers.  This little piece of
  3797.                     assembler code is used as a model to create the cfa
  3798.                     code needed to kick off DOES> code.
  3799.  
  3800.      DOES>          ( -- addr )
  3801.                     ( --) (compiling)
  3802.                     Defines the execution-time action of a word created by
  3803.                     a high-level defining word.  Used in the form:
  3804.                     : <namex> ... <create> ... DOES> ... ;
  3805.                     and then
  3806.                     <namex> <name>
  3807.                     where <create> is CREATE or any user defined word which
  3808.                     executes CREATE.
  3809.                     CREATE DOES> is the most powerful feature of Forth.  It
  3810.                     is almost impossible to understand without examining
  3811.                     lots of examples.  For example if you wished to create
  3812.                     your own slow running version of CONSTANT using CREATE
  3813.                     DOES> you could code it like this:
  3814.                     : MY-CONSTANT CREATE ,
  3815.                       ( compile time behaviour to store value at pfa )
  3816.                       DOES> @
  3817.                       ( run time behaviour to fetch value from pfa ) ;
  3818.                     6 MY-CONSTANT Six
  3819.                     Six .
  3820.  
  3821.  
  3822.  
  3823.  
  3824.           \BBL\BBL.DOC  -58-  last updated 1986 October 14 21:30
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832. BBL Forth Reference
  3833.  
  3834.  
  3835.      dovoc
  3836.  
  3837.      DP             ( -- addr )
  3838.                     Variable containing the address of of the next
  3839.                     available dictionary location in the pfa (parameter
  3840.                     field address) part of the dictionary.  There is only
  3841.                     one DP -- not one per VOCABULARY.  HERE acts like DP @.
  3842.                     Because of the delicate segment:offset forms required
  3843.                     you should not meddle directly with DP.  Use HERE and
  3844.                     ALLOT instead.  Existing programs written in Forth-83
  3845.                     will need to have every use of DP or HERE examined to
  3846.                     see if it should read HERE, HEREB, HEREC HEREV or
  3847.                     HERER.  Most of the time HERE or HEREB is what is
  3848.                     wanted.
  3849.                     c.f. HERE DPB DPC DPR DPV
  3850.  
  3851.      DPB            ( -- ADDR )
  3852.                     Not normally used by programmers.  Variable containing
  3853.                     the address where WORD leave the counted string it has
  3854.                     parsed.  It is usually set to HEREV+2, but sometimes
  3855.                     points to the nfa of the most recently added word in
  3856.                     the CURRENT DEFINITIONS vocabulary.  HEREB behaves like
  3857.                     DPB @.  Because of the delicate segment:offset forms
  3858.                     required you should not meddle directly with DPB  Use
  3859.                     HEREB instead.
  3860.                     c.f. HEREB DP DPC DPR DPV
  3861.  
  3862.      DPC            ( -- ADDR )
  3863.                     Not normally used by programmers.  Variable containing
  3864.                     next free location the the cfa (code field address)
  3865.                     part of the dictionary.  HEREC acts like DPC @.
  3866.                     Because of the delicate segment:offset forms required
  3867.                     you should not meddle directly with DPC.  Use HEREC or
  3868.                     ALLOTC instead.
  3869.                     c.f. HEREC DP DPB DPR DPV
  3870.  
  3871.      DPR            ( -- ADDR )
  3872.                     Not normally used by programmers.  Variable containing
  3873.                     next free slot in area of memory from which new
  3874.                     vocabulary storage regions are carved.  HERER behaves
  3875.                     like DPR @.  Because of the delicate segment:offset
  3876.                     forms required you should not meddle directly with DPR.
  3877.                     Use HERER or ALLOTR instead.
  3878.                     c.f. HERER DP DPC DPB DPV
  3879.  
  3880.      DPV            ( -- ADDR )
  3881.                     Not normally used by programmers.  Variable containing
  3882.                     the next free slot in CURRENT vocabulary region HEREV
  3883.                     behaves like DPV @.  Because of the delicate
  3884.                     segment:offset forms required you should not meddle
  3885.                     directly with DPV.  Use HEREV instead.
  3886.                     c.f.  HEREV DP DPC DPB DPR
  3887.  
  3888.  
  3889.  
  3890.           \BBL\BBL.DOC  -59-  last updated 1986 October 14 21:30
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898. BBL Forth Reference
  3899.  
  3900.  
  3901.      DROP           ( 32b -- )
  3902.                     32b is removed from the data stack.
  3903.                     c.f. 2DROP 3DROP 4DROP RDROP
  3904.  
  3905.      DU<            ( ud1 ud2 -- flag )
  3906.                     flag is true if ud1 is less than ud2.  Both numbers are
  3907.                     unsigned.
  3908.                     pronounced "d-u-less"
  3909.  
  3910.      DUMP           ( addr len -- )
  3911.                     Debugging tool to examine an area of memory in both HEX
  3912.                     and ASCII.  The display can be paused by hitting Ctrl-
  3913.                     Numlock.  The display can be interrupted by hitting any
  3914.                     other key.
  3915.  
  3916.      DUP            ( 32b -- 32b 32b )
  3917.                     Duplicate 32b.
  3918.                     pronounced "dupe"
  3919.  
  3920.  
  3921.      **E**          words that begin with E
  3922.  
  3923.      EARLIEST-NFA   ( ' My-Voc >BODY --- nfa )
  3924.                     From the pfa of an arbitrary vocabulary EARLIEST-NFA
  3925.                     calculates the NFA of the oldest word added first at
  3926.                     the beginning of that vocabulary.  If the vocabulary is
  3927.                     empty the result is 0.  It is used in conjunction with
  3928.                     NEXT-NFA to chase through all the words in a
  3929.                     vocabulary.  It does NOT use the hash threads.
  3930.                     c.f. LATEST-NFA PREV-NFA NEXT-NFA LATEST
  3931.  
  3932.      EDIT           ( -- )
  3933.                     invokes the NED screen editor.  Note that you do NOT
  3934.                     place the number of the screen you wish to edit on the
  3935.                     data stack as you do with most Forth screen editors.
  3936.                     See NED.DOC for a further description of the editor.
  3937.                     Once you are in NED use F1 for Help.
  3938.  
  3939.      EDITOR         ( -- )
  3940.                     The name of the VOCABULARY where the words that make up
  3941.                     the NED screen editor are kept.  EDITOR makes this
  3942.                     vocabulary the CONTEXT vocabulary -- the one first in
  3943.                     the search order.
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.           \BBL\BBL.DOC  -60-  last updated 1986 October 14 21:30
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. BBL Forth Reference
  3965.  
  3966.  
  3967.      ELSE           ( -- : executing )
  3968.                     ( backaddr 2 -- backaddr 2 : compiling )
  3969.                     Used in the form:
  3970.                               flag IF ... ELSE ... THEN
  3971.                     ELSE executes after the true part following IF .  ELSE
  3972.                     forces execution to continue at just after THEN .  sys1
  3973.                     is balanced with its corresponding IF . sys2 is
  3974.                     balanced with its corresponding THEN .
  3975.                     c.f. IF THEN
  3976.  
  3977.      EMIT           ( c -- )
  3978.                     The least-significant 8-bit ASCII character is
  3979.                     displayed.  EMIT can be redirected to the screen with
  3980.                     CONSOLE or to the printer with PRINTER.  TYPE is
  3981.                     defined as an optimized version of : EMIT 'EMIT @
  3982.                     EXECUTE ;  Thus you can redirect EMIT by providing your
  3983.                     own type routine and vectoring it in with ['] MY-EMIT
  3984.                     'EMIT !.  Normally when you redirect EMIT you also
  3985.                     redirect TYPE.
  3986.                     c.f. CONSOLE PRINTER 'EMIT SEMIT PEMIT GTYPE TYPE 'TYPE
  3987.                     STYPE PTYPE.
  3988.  
  3989.      EMPTY-BUFFERS  ( -- )
  3990.                     Unassign all block buffers.  Updated blocks are not
  3991.                     written to mass storage.
  3992.                     c.f. BLOCK
  3993.                     pronounced "empty-buffers"
  3994.  
  3995.      ENCLOSE        ( addr1 delim -- addr1 n1 n2 n3 )
  3996.                     Used by WORD to parse the input stream.  Can be used to
  3997.                     parse any string terminated by a null.  Addr1 is where
  3998.                     to start parsing.  The delimiter is usually 020h =
  3999.                     blank.  n1 = byte offset first non delimiter i.e. start
  4000.                     word.  n2 = byte offset of the trailing delimiter - end
  4001.                     word +1.  n3 = byte offset first char not included =
  4002.                     n2+1 normally.  Null Hex 00 is also treated as
  4003.                     delimiter.  If no work at all can be found -- just
  4004.                     delimiters then n1=offset of null n2=n1+1 n3=n2.  If
  4005.                     the word is followed by null, n1=offset start word,
  4006.                     n2=offset null and n3=n2.
  4007.  
  4008.      END-CODE       (  -- )
  4009.                     Terminates a code definition and allows the <name> of
  4010.                     the corresponding code definition to be found in the
  4011.                     dictionary. END-CODE is balanced with its corresponding
  4012.                     CODE or ;CODE .
  4013.                     c.f. CODE ;CODE
  4014.                     pronounced "end-code"
  4015.  
  4016.      ENTRY          ( -- )
  4017.                     Not normally used by programmers.  Used as part of the
  4018.                     cold start.
  4019.  
  4020.  
  4021.  
  4022.           \BBL\BBL.DOC  -61-  last updated 1986 October 14 21:30
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030. BBL Forth Reference
  4031.  
  4032.  
  4033.      EVENUP         ( N1 -- N2 )
  4034.                     Rounds up to next even number.  N2=N1 if N1 is even
  4035.                     N2=N1+1 if N2 is odd.
  4036.  
  4037.      EXECUTE        ( cfa-addr -- )
  4038.                     Allows you to execute a routine passed as a parameter
  4039.                     via its cfa address.  Similar to Pascal's Procedure
  4040.                     parameters.  The word definition indicated by addr is
  4041.                     executed.  An error condition exists if addr is not a
  4042.                     compilation address.  The address is nearly always
  4043.                     provided by ['] or '.  EXECUTE ignores the segment part
  4044.                     of the address, presuming it is CS:.  For this reason
  4045.                     EXECUTE will work on either relative addresses or CS:
  4046.                     based segment addresses.  It will not work if the
  4047.                     address is based on any other value.  As long as the
  4048.                     address is created with ['] or ' this will not cause a
  4049.                     problem.  ['] X EXECUTE is equivalent to X.  The DEFER
  4050.                     AS method solves a similar problem to the one EXECUTE
  4051.                     does but it executes more quickly.
  4052.                     c.f. ' ['] PERFORM DEFER AS
  4053.  
  4054.      EXIT           ( -- )
  4055.                     Exit current procedure, synonym for ;S  EXIT is
  4056.                     preferred for premature exit from a high level
  4057.                     definition.
  4058.                     Compiled within a colon definition such that when
  4059.                     executed, that colon definition returns control to the
  4060.                     definition that passed control to it by returning
  4061.                     control to the return point on the top of the return
  4062.                     stack.  An error condition exists if the top of the
  4063.                     return stack does not contain a valid return point.
  4064.                     In this implementation it may not be used within a do-
  4065.                     loop.
  4066.                     c.f. ;S
  4067.  
  4068.      EXPECT         ( addr +n -- )
  4069.                     Receive characters from the keyboard and store each
  4070.                     into memory.  The transfer begins at addr proceeding
  4071.                     towards higher addresses one byte per character until
  4072.                     either a "return" is received or until +n characters
  4073.                     have been transferred.  No more than +n characters will
  4074.                     be stored.  The "return" is not stored into memory.  No
  4075.                     characters are received or transferred if +n is zero.
  4076.                     All characters actually received and stored into memory
  4077.                     will be displayed, with the "return" displaying as a
  4078.                     space.  The string will be delimited by a Hex 00 null
  4079.                     character.  The variable SPAN is set to the length of
  4080.                     the string not counting the return or null.
  4081.                     c.f. SPAN
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.           \BBL\BBL.DOC  -62-  last updated 1986 October 14 21:30
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096. BBL Forth Reference
  4097.  
  4098.  
  4099.      **F**          words that begin with F
  4100.  
  4101.      FILL           ( addr uw c -- )
  4102.                     uw bytes of memory beginning at addr are set to c.  No
  4103.                     action is taken if uw is zero.  Uw may also be 0 or 1,
  4104.                     but not negative.   Uw must be under 64K.  The address
  4105.                     need not be canonical, but it must cover both ends of
  4106.                     the area in memory to be filled.
  4107.                     c.f. BLANK ERASE CMOVE CMOVE>
  4108.  
  4109.      FIND           ( addr1 -- addr2 n )
  4110.                     addr1 is the address of a counted string (usually but
  4111.                     not necessarily at HEREB).  The string contains a word
  4112.                     name to be located in the currently active search
  4113.                     order.  If the word is not found, addr2 is the string
  4114.                     address addr1,  and n is zero.  If the word is found,
  4115.                     addr2 is the cfa compilation address and n is set to
  4116.                     one of two non-zero values.  If the word found has the
  4117.                     immediate attribute, n is set to one.  If the word is
  4118.                     non-immediate, n is set to minus one (true).
  4119.                     c.f. (FIND) ?FOUND ['] '
  4120.  
  4121.      FIRST          ( -- addr )
  4122.                     Not normally used by programmers.  Address of the first
  4123.                     screen buffer.  The segment portion of this address is
  4124.                     SS:  Watch out!  Fig Forth programs sometimes make
  4125.                     unwarranted assumptions about the relative position of
  4126.                     FIRST and other system areas.
  4127.  
  4128.      FLUSH          ( -- )
  4129.                     Performs the function of SAVE-BUFFERS then unassigns
  4130.                     all block buffers.  (This may be useful for mounting or
  4131.                     changing mass storage media).  In the good old days
  4132.                     FLUSH was a synonym for SAVE-BUFFERS.  Now they have a
  4133.                     different meaning.
  4134.                     c.f. EMPTY-BUFFERS SAVE-BUFFERS
  4135.  
  4136.      FOR-EACH-VOC   ( ' Routine -- )
  4137.                     : Routine ( pfa -- ) ... ;
  4138.                     If you write a routine that expects the pfa of a
  4139.                     vocabulary on the stack, then FOR-EACH-VOC will chase
  4140.                     the VOC-LINK chain for you and call your routine once
  4141.                     for each vocabulary in the VOC-LINK chain starting with
  4142.                     the newest vocabulary.  Note that pfa @ will get you
  4143.                     the address of the start of the vocabulary storage
  4144.                     region.  pfa @ @ will get you the nfa of the latest
  4145.                     word in the vocabulary.
  4146.                     c.f. VOC-LINK VOCABULARY ORDER
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.           \BBL\BBL.DOC  -63-  last updated 1986 October 14 21:30
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162. BBL Forth Reference
  4163.  
  4164.  
  4165.      FORGET         ( -- )
  4166.                     Used in the form:
  4167.                          FORGET <name>
  4168.                     If <name> is found in the compilation CURRENT
  4169.                     DEFINITIONS vocabulary, delete <name> from the
  4170.                     dictionary and all words added to the dictionary after
  4171.                     <name> regardless of their vocabulary.  Failure to find
  4172.                     <name> is an error condition.  An error condition also
  4173.                     exists if any CURRENT or CONTEXT vocabulary is deleted.
  4174.                     If new vocabularies were defined after <name> they too
  4175.                     will be forgotten, along with all the words in them.
  4176.                     The word you FORGET must have a cfa and pfa e.g. a
  4177.                     colon definition.  Thus you cannot use a CONSTANT as
  4178.                     the object of a FORGET.  Typically a dummy colon
  4179.                     routine such as : TASK ; is used as the object.  Forget
  4180.                     presumes the dictionaries have not been snaked.  I.e.
  4181.                     If B were compiled after A, then the cfa of B is
  4182.                     greater or equal to the cfa of A, the pfa of B is
  4183.                     greater or equal to the pfa of A.  Furthermore if A and
  4184.                     B are in the same vocabulary then, the nfa of B is
  4185.                     greater or equal to the nfa of A.  If A and B are both
  4186.                     vocabularies then B's vocabulary storage region must be
  4187.                     higher in memory than A's.  The cfa rule can be broken
  4188.                     in the case of ALIASes.  LOGO mode has potentially
  4189.                     dangerous effects when used with FORGET.  See
  4190.                     information in BBLVOCS.ASM on how FORGET is implemented
  4191.                     to get a deeper understanding.
  4192.                     c.f. ALIAS LOGO
  4193.  
  4194.      FORTH          ( -- )
  4195.                     The name of the primary vocabulary.  Execution replaces
  4196.                     the first vocabulary in the search order with FORTH .
  4197.                     FORTH is initially the compilation vocabulary and the
  4198.                     first vocabulary in the search order.  New definitions
  4199.                     become part of the FORTH vocabulary until a different
  4200.                     compilation vocabulary is established.  FORTH is not
  4201.                     immediate.  This follows the Forth-83 rather than
  4202.                     Forth-79 convention.
  4203.                     c.f. VOCABULARY
  4204.  
  4205.      FORTH-83       ( -- )
  4206.                     Assures that a FORTH-83 Standard System is available,
  4207.                     otherwise an error condition exists.  THIS WORD IS NOT
  4208.                     PRESENT.  BBL does not conform strictly to the Forth-83
  4209.                     standard  because BBL is 32-bit and because it has non-
  4210.                     linear addresses.  The confusing multiplicity of HERE
  4211.                     HEREC HEREV HEREB HERER would I am sure give the Forth
  4212.                     83 standards team just reason to pull their hair.
  4213.                     However I have attempted to follow the Forth-83
  4214.                     standard as closely as possible even when I thought it
  4215.                     was off-base.
  4216.  
  4217.  
  4218.  
  4219.  
  4220.           \BBL\BBL.DOC  -64-  last updated 1986 October 14 21:30
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228. BBL Forth Reference
  4229.  
  4230.  
  4231.      **G**          words that begin with G
  4232.  
  4233.      GOTOXY         ( col row -- )
  4234.                     Move the DOS screen cursor to row and column.  Upper
  4235.                     left corner is 0 0.  Lower right corner is 79 24.
  4236.  
  4237.      GTYPE          ( addr len -- )
  4238.                     types string to printer or screen using the current
  4239.                     EMIT routine.  It is almost never used directly as the
  4240.                     TYPE routine is usually faster than repeated uses of
  4241.                     the EMIT routine.  However it can be useful if you have
  4242.                     written your own EMIT routine and are too lazy to write
  4243.                     your own TYPE routine.  To vector in your new EMIT
  4244.                     routine for both EMIT and TYPE you would do ['] MY-EMIT
  4245.                     'EMIT ! ['] GTYPE 'TYPE !.
  4246.                     c.f. TYPE EMIT 'TYPE 'EMIT STYPE SEMIT PTYPE PEMIT
  4247.                     PRINTER CONSOLE.
  4248.  
  4249.  
  4250.      **H**          words that begin with H
  4251.  
  4252.      HASH           ( nfa -- hash# )
  4253.                     Not normally used by programmers.  Used by FIND to
  4254.                     speed dictionary searches.  Expects counted string at
  4255.                     nfa 0..31 bytes.  Returns 16-bit randomized (but not
  4256.                     random) number.  This hash# number needs to be masked
  4257.                     to get the thread number in the dictionary where this
  4258.                     word could be found.
  4259.  
  4260.      HERE           ( -- addr )
  4261.                     The address of the next available dictionary location
  4262.                     in the pfa (parameter field address) part of the
  4263.                     dictionary.  There is only one HERE -- not one per
  4264.                     VOCABULARY.  HERE is usually not canonical.  The
  4265.                     segment part of HERE is as it was canonized at the last
  4266.                     CREATE -- pointing at or just before the pfa.  HERE
  4267.                     acts like DP @. This is the normal pfa style HERE in
  4268.                     the token segment where variable and the colon
  4269.                     definitions are kept. IT IS NOT where WORD builds the
  4270.                     parsed word.  Existing programs written in Forth-83
  4271.                     will need to have every use of HERE examined to see if
  4272.                     it should read HERE, HEREB, HEREC HEREV or HERER.  Most
  4273.                     of the time HERE or HEREB is what is wanted.
  4274.                     c.f. DP HEREB HEREV HEREC HERER
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.           \BBL\BBL.DOC  -65-  last updated 1986 October 14 21:30
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294. BBL Forth Reference
  4295.  
  4296.  
  4297.      HEREB          ( -- ADDR )
  4298.                     Not normally used by programmers.  Where WORD leave the
  4299.                     counted string it has parsed.  It is usually set to
  4300.                     HEREV+2, but sometimes points to the nfa of the most
  4301.                     recently added word in the CURRENT DEFINITIONS
  4302.                     vocabulary.  The address is result is not canonical --
  4303.                     the segment part of the address is the start of the
  4304.                     vocab region.  The only time you would use HEREB is if
  4305.                     you were writing code like .WORD that produced error
  4306.                     messages about the most recently parsed word. HEREB
  4307.                     behaves like DPB @.
  4308.                     c.f. DPB HERE HEREC HEREV HERER
  4309.  
  4310.      HEREC          ( -- ADDR )
  4311.                     Not normally used by programmers.  Next free location
  4312.                     the the cfa (code field address) part of the
  4313.                     dictionary.  There is only one HEREC -- not one per
  4314.                     VOCABULARY.  HEREC is not canonical. The segment part
  4315.                     of the address part is always CS:.  HEREC acts like DPC
  4316.                     @.  The only time you would ever touch HEREC is if you
  4317.                     were writing words that generate assembler code.
  4318.                     c.f. DPC HERE HEREB HEREV HERER
  4319.  
  4320.      HERER          ( -- ADDR )
  4321.                     Not normally used by programmers.  Next free slot in
  4322.                     area of memory from which new vocabulary storage
  4323.                     regions are carved.  Each time a new vocabulary is
  4324.                     defined, a chunk of memory for its vocabulary storage
  4325.                     region is allocated.  The size of this chunk is
  4326.                     determined by VOC-SIZE.  This region is used to store
  4327.                     the hash threads and the nfa's of words that will be
  4328.                     later defined in this vocabulary.  This is in addition
  4329.                     to the small amount of space allocated for the cfa and
  4330.                     pfa.  Because vocabulary storage regions always start
  4331.                     and end on paragraph boundaries, the offset part of
  4332.                     HERER will always be 0.  Note that each VOCABULARY has
  4333.                     its own separate HEREV, but there is one HERER from
  4334.                     which the vocabulary regions are allocated.  The only
  4335.                     time you would use HERER is if you were writing code
  4336.                     that built new vocabularies.  HERER behaves like DPR @.
  4337.                     c.f. DPR HERE HEREB HEREC HEREV VOCABULARY VOC-SIZE
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.           \BBL\BBL.DOC  -66-  last updated 1986 October 14 21:30
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360. BBL Forth Reference
  4361.  
  4362.  
  4363.      HEREV          ( -- ADDR )
  4364.                     Not normally used by programmers.  Next free slot in
  4365.                     CURRENT vocabulary region i.e. the DEFINITIONS
  4366.                     vocabulary where new definitions are compiled.  The
  4367.                     address is result is not canonical -- the segment part
  4368.                     of the address is the start of the vocab region.  Note
  4369.                     that each VOCABULARY has its own separate HEREV.  The
  4370.                     only time you would use HEREV is if you were writing
  4371.                     code that built the nfa headers in the vocabulary
  4372.                     region.  HEREV behaves like DPV @.
  4373.                     c.f. DPV HERE HEREB HEREC HERER
  4374.  
  4375.      HEX            ( - )
  4376.                     Set the numeric input-output conversion base to
  4377.                     sixteen.
  4378.                     pronounced "hex";
  4379.                     c.f. BINARY DECIMAL BASE .BASE
  4380.  
  4381.      HIDDEN         ( -- )
  4382.                     The name of a vocabulary used to hold definitions you
  4383.                     do not want users to see or experiment with.
  4384.  
  4385.      HOLD           ( char -- )
  4386.                     char is inserted into a pictured numeric output string.
  4387.                     Typically used between <# and #>  It can be used to
  4388.                     insert decorative commas, decimal points, currency
  4389.                     characters etc.
  4390.                     c.f. <# # #>
  4391.  
  4392.  
  4393.      **I**          words that begin with I
  4394.  
  4395.      I              ( -- n )
  4396.                     n is a copy of the loop index.  May only be used in the
  4397.                     form:
  4398.                               DO ... I ... LOOP
  4399.                     or        DO ... I ... +LOOP;
  4400.                     The most common loop has the form n 0 DO I LOOP.  In
  4401.                     that case the loop is executed n times, and the loop
  4402.                     index has the values 0, 1 , 2, ... n-1.  The loop index
  4403.                     never equals n.  Because the loop index is stored on
  4404.                     the return stack in a modified form, I is NOT
  4405.                     synonymous with R@ as it is in many Forth-79
  4406.                     implementations.  Watch Out!
  4407.                     c.f. J R@ DO LOOP
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.           \BBL\BBL.DOC  -67-  last updated 1986 October 14 21:30
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. BBL Forth Reference
  4427.  
  4428.  
  4429.      IF             ( flag --  )
  4430.                     ( -- backaddr 2 ) (compiling)
  4431.                     Used in the form:
  4432.                          flag IF ... ELSE ... THEN
  4433.                     or   flag IF ... THEN
  4434.                     If flag is true, the words following IF are executed
  4435.                     and the words following ELSE until just after THEN are
  4436.                     skipped.  The ELSE part is optional.
  4437.                     If flag is false, words from IF through ELSE  , or from
  4438.                     IF through THEN (when no ELSE is used), are skipped.
  4439.                     IF can only be used inside colon definitions.
  4440.  
  4441.      IMMEDIATE      ( -- )
  4442.                     Marks the most recently created dictionary entry as a
  4443.                     word which will be executed when encountered during
  4444.                     compilation rather than compiled.  Sets the IMMED bit
  4445.                     in the LATEST nfa.  Words such as IF and DO are
  4446.                     IMMEDIATE because they execute at compile time,
  4447.                     ensuring balanced pairs and computing offsets, and
  4448.                     leave behind non-immediate words such as ?BRANCH and
  4449.                     (DO) that perform the actual work at execution time.
  4450.                     Note that VOCABULARIES such as FORTH and ONLY are NOT
  4451.                     immediate.  This is the Forth-83 convention.  In Fig-
  4452.                     Forth and Forth-79 vocabularies were immediate as God
  4453.                     intended.
  4454.  
  4455.      INDEX          ( n1 n2 -- )
  4456.                     displays the first lines of disk screens n1 through n2.
  4457.                     The first line us usually a comment to summarize the
  4458.                     contents of the screen.  The display can be paused by
  4459.                     hitting Ctrl-Numlock.  The display can be interrupted
  4460.                     by hitting any other key.  If n1 must be less than or
  4461.                     equal to n2.  If n2 is out past the current end of the
  4462.                     cache file, the index listing will stop early when it
  4463.                     hits the end of file.
  4464.  
  4465.      INIT-BUFFERS   ( -- )
  4466.                     Not normally used by programmers.  Part of cold boot to
  4467.                     initialize the BUF-OFF pointers to point to the first
  4468.                     byte of each buffer.
  4469.  
  4470.      INTERPRET      ( -- )
  4471.                     Begin text interpretation at the character indexed by
  4472.                     the contents of >IN relative to the block number
  4473.                     contained in BLK, continuing until the input stream is
  4474.                     exhausted.  If BLK contains zero, interpret characters
  4475.                     from the TIB text input buffer.  INTERPRET keeps going
  4476.                     until it hits a Null Hex 00, or it until it executes a
  4477.                     QUIT or ABORT.  Normally INTERPRET will interpret one
  4478.                     line of keyed commands or one screen of text.
  4479.                     pronounced "interpret"
  4480.  
  4481.  
  4482.  
  4483.  
  4484.           \BBL\BBL.DOC  -68-  last updated 1986 October 14 21:30
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492. BBL Forth Reference
  4493.  
  4494.  
  4495.      **J**          words that begin with J
  4496.  
  4497.      J              ( -- n )
  4498.                     n is a copy of the index of the next outer loop.  May
  4499.                     only be used within a nested DO-LOOP or DO-+LOOP in the
  4500.                     form, for example:
  4501.                          DO...DO...J ... LOOP ... +LOOP
  4502.                     Because this implementation stores modified values of
  4503.                     the loop index on the return stack, J cannot be used to
  4504.                     get at elements buried in return stack.
  4505.                     c.f. I K R@ DO ?DO
  4506.  
  4507.  
  4508.      **K**          words that begin with K
  4509.  
  4510.      KEY            ( -- c )
  4511.                     The least-significant 8 bits is the next ASCII
  4512.                     character received from the keyboard.  All valid ASCII
  4513.                     characters and the IBM extended 8-bit set can be
  4514.                     received.  In addition the standard 0-lead in sequences
  4515.                     for function keys can be received.  Control characters
  4516.                     are not processed by the system for any editing
  4517.                     purpose.  Characters received by KEY will not be
  4518.                     displayed
  4519.  
  4520.  
  4521.      **L**          words that begin with L
  4522.  
  4523.      L>NAME         ( lfa -- nfa )
  4524.                     Not normally used by programmers.  Converts lfa (link
  4525.                     field address) to nfa (name field address).  This gets
  4526.                     the nfa of the corresponding name, not the predecessor.
  4527.                     This word uses the hash threads.
  4528.                     c.f. >BODY >NAME >LINK BODY> NAME> LINK> LINK@ N>LINK
  4529.                     LINK@ PREV-NFA
  4530.                     pronounced "link-to-name"
  4531.  
  4532.      LAST-SCR       ( -- addr )
  4533.                     a variable that contains the screen number of the last
  4534.                     screen in the cache file.  It is maintained by OPEN-
  4535.                     CACHE, UPDATE and SAVE-BUFFERS.  It is not changed by
  4536.                     BLOCK.  If the cache file is not open LAST-SCR will
  4537.                     contain a 0.
  4538.                     c.f. OPEN-CACHE UPDATE SAVE-BUFFERS BLOCK DISK-ERROR
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.           \BBL\BBL.DOC  -69-  last updated 1986 October 14 21:30
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558. BBL Forth Reference
  4559.  
  4560.  
  4561.      LATEST         ( -- NFA )
  4562.                     The name field address of most recently added word in
  4563.                     CURRENT DEFINITIONS compilation vocabulary.  The result
  4564.                     is not canonical - the segment part of the address is
  4565.                     the start of the vocab region.  To get the equivalent
  4566.                     for an arbitrary vocabulary use LATEST-NFA.
  4567.                     EARLIEST-NFA LATEST-NFA PREV-NFA NEXT-NFA CURRENT
  4568.                     DEFINITIONS CONTEXT.
  4569.  
  4570.      LATEST-NFA     ( ' My-Voc >BODY --- nfa )
  4571.                     From the pfa of an arbitrary vocabulary LATEST-NFA
  4572.                     calculates the NFA of the most recently added word at
  4573.                     the end of that vocabulary.  If the vocabulary is empty
  4574.                     the result is 0.  If you which this for the CURRENT
  4575.                     DEFINITIONS compilation vocabulary, use can use LATEST
  4576.                     instead.  LATEST-NFA is used in conjunction with PREV-
  4577.                     NFA to chase through all the words in a vocabulary.
  4578.                     c.f. EARLIEST-NFA PREV-NFA NEXT-NFA LATEST
  4579.  
  4580.      LEAVE          ( -- )
  4581.                     ( -- ) (compiling)
  4582.                     Transfers execution to just beyond the next LOOP or
  4583.                     +LOOP . The loop is terminated and loop control
  4584.                     parameters are discarded.  May only be used in the
  4585.                     form:
  4586.                               DO ... LEAVE ... LOOP
  4587.                     or        DO ... LEAVE ... +LOOP
  4588.                     LEAVE may appear within other control structures which
  4589.                     are nested within the do-loop structure.  More than one
  4590.                     LEAVE may appear within a do-loop.  LEAVE compiles as a
  4591.                     (LEAVE) token.  LEAVE does not mess with pairs placed
  4592.                     on the data stack at compile time by DO.
  4593.  
  4594.      LINK>          ( lfa -- cfa )
  4595.                     Not normally used by programmers.  Converts lfa (link
  4596.                     field address) to cfa (code field address)
  4597.                     c.f. >BODY >NAME >LINK BODY> NAME> LINK@ N>LINK L>NAME
  4598.                     LINK@ PREV-NFA
  4599.                     pronounced "from-link"
  4600.  
  4601.      LINK@          ( lfa -- nfa of predecessor )
  4602.                     Not normally used by programmers.  Used to fetch the
  4603.                     16-bit backward pointer at the link field address to
  4604.                     get the name field address of the predecessor word on
  4605.                     the same thread.  Watch out. In PCForth Plus LINK@ was
  4606.                     used for UT@ to fetch an unsigned 3-byte quantity
  4607.                     c.f. >BODY >NAME >LINK BODY> NAME> LINK> N>LINK L>NAME
  4608.                     PREV-NFA
  4609.                     pronounced "link-fetch"
  4610.  
  4611.      LIST           ( SCR --- )
  4612.                     types whole screen
  4613.  
  4614.  
  4615.  
  4616.           \BBL\BBL.DOC  -70-  last updated 1986 October 14 21:30
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624. BBL Forth Reference
  4625.  
  4626.  
  4627.      LIT            ( -- value )
  4628.                     Not normally used by programmers.  LITERAL compiles as
  4629.                     LIT-token followed by a 32-bit constant stored LSW
  4630.                     first to handle 32-bit inline constants.  The constant
  4631.                     may be signed or unsigned.
  4632.  
  4633.      LITERAL        ( -- 32b )
  4634.                     ( 32b -- ) (compiling)
  4635.                     Handles creation inline literals.
  4636.                     Typically used in the form:
  4637.                          [ 32b ]  LITERAL
  4638.                     Compiles as +WLIT-token, -WLIT-token, LIT-token or one
  4639.                     of the primitive constant tokens 0..9, or TEN so that
  4640.                     when later executed, 32b will be left on the data
  4641.                     stack.  Handles -1 .. 10d as single tokens.  Handles
  4642.                     11d .. ffffh AS +WLIT 16-BIT.  Handles ffff0000h ...
  4643.                     fffffffeh as -WLIT 16-BIT.  Handles the rest as LIT 32-
  4644.                     bit.  The popular CLIT of Forth-83 has been
  4645.                     discontinued because BBL likes to start tokens on an
  4646.                     even byte boundary so there is no advantage in 1-byte
  4647.                     literals over 2-byte ones.  Most commonly used to
  4648.                     compute expressions at compile time into inline
  4649.                     constants: e.g.
  4650.                     [ x y + ] LITERAL
  4651.                     c.f. LITERAL DLITERAL COMPILE-NUM LIT +WLIT -WLIT LIT.
  4652.  
  4653.      LOAD           ( U -- )
  4654.                     Effectively executes the commands on disk screen u as
  4655.                     though they were being rapidly keyed in by temporarily
  4656.                     redirecting the keyboard input to screen u.  Most
  4657.                     commonly used to compile colon definitions created with
  4658.                     the editor.  The contents of >IN and BLK, which locate
  4659.                     the current input stream, are saved.  The input stream
  4660.                     is then redirected to the beginning of screen u by
  4661.                     setting >IN to zero and BLK to u.  The screen is then
  4662.                     interpreted.  If interpretation from screen u is not
  4663.                     terminated explicitly (e.g. by ;S or QUIT) it will be
  4664.                     terminated when the input stream is exhausted and then
  4665.                     the contents of >IN and BLK will be restored.  An error
  4666.                     condition exists if u is zero.
  4667.                     c.f. >IN  BLK  BLOCK
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.           \BBL\BBL.DOC  -71-  last updated 1986 October 14 21:30
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690. BBL Forth Reference
  4691.  
  4692.  
  4693.      LOGO           ( -- addr )
  4694.                     The Logo language behaves differently from Forth when
  4695.                     you recompile a new version of an existing word.  The
  4696.                     LOGO logical variable lets you persuade BBL Forth to
  4697.                     behave the wonderful way Logo does.  Normally LOGO
  4698.                     contains a 0.  However if you do LOGO ON then BBL uses
  4699.                     Logo's way of handling what happens when you recompile
  4700.                     a word with the same name as one already in the
  4701.                     dictionary.  LOGO contains -1 = TRUE if previous
  4702.                     incarnations of a word are to be patched to use the new
  4703.                     version.  With this mode a full recompile is not
  4704.                     necessary if a word deep down is recompiled, because
  4705.                     all the code that used the old version will go to the
  4706.                     old version, but then be redirected to the new one.
  4707.                     LOGO contains 0 = FALSE if old code uses the old
  4708.                     version of a word.  The default is false. -- per normal
  4709.                     FORTH.  If you use LOGO mode be careful after a FORGET.
  4710.                     The old version which pops to the fore is patched to
  4711.                     the deleted new version.  If you were to use the old
  4712.                     version (even indirectly) without recompiling a new
  4713.                     version, you would have a dangerous dangling pointer
  4714.                     most likely leading to a system crash.  In Forth mode
  4715.                     with LOGO 0, the old version comes to the fore
  4716.                     undamaged the way it used to be.  With LOGO mode you
  4717.                     can recompile the same word over and over and every
  4718.                     incarnation gets indirectly re-routed in several steps
  4719.                     to the newest one.  If you redefine a Forth system word
  4720.                     while in LOGO mode, the Forth nucleus will also start
  4721.                     using your new definition.  Unless your new version is
  4722.                     very similar to the original meaning, the system will
  4723.                     almost certainly crash.  LOGO mode can be used to give
  4724.                     you forward references without having to build
  4725.                     vectoring routines.  Just define a dummy routine such
  4726.                     as : DOIT ;  Then use DOIT.  Then later define the real
  4727.                     DOIT and the old version will be patched to use the new
  4728.                     version effectively giving you the ability to use a
  4729.                     routine that isn't written yet.  When you are in LOGO
  4730.                     mode if you redefine a word with a name that already
  4731.                     exists in the current definitions vocabulary you will
  4732.                     get a "recompiled" warning message.  When you are in
  4733.                     Forth mode mode you will get a "redefined" warning
  4734.                     message instead.
  4735.                     c.f. FORGET
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.           \BBL\BBL.DOC  -72-  last updated 1986 October 14 21:30
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756. BBL Forth Reference
  4757.  
  4758.  
  4759.      LOOP           ( -- )
  4760.                     ( backaddr-1 backaddr-2 -- )  (compiling)
  4761.                     Increments the DO-LOOP index by one.  If the new index
  4762.                     was incremented across the boundary between limit-1 and
  4763.                     limit the loop is terminated and loop control
  4764.                     parameters are discarded.  When the loop is not
  4765.                     terminated, execution continues to just after the
  4766.                     corresponding DO.  The most common form of LOOP use is
  4767.                     10 0 DO ... LOOP.  The loop is executed 10 times with
  4768.                     the loop index taking the values 0, 1, 2 ... 9.  LOOP
  4769.                     compiles as (LOOP)-token followed by a BRANCH style
  4770.                     offset back to; the token after the offset after the
  4771.                     (DO)
  4772.                     c.f. DO ?DO +LOOP
  4773.  
  4774.      LSW            ( n1 -- n2 )
  4775.                     Least Significant Word.  n2 is the least significant 16
  4776.                     bits of n1 padded on the left with zeros.  Note that
  4777.                     both n1 and n2 are values on the data stack -- not
  4778.                     addresses in RAM.
  4779.                     c.f. MSW
  4780.  
  4781.  
  4782.      **M**          words that begin with M
  4783.  
  4784.      M*             ( n1-32 n2-32 -- d3-64 )
  4785.                     Mixed mode multiply of a signed 32-bit * 32-bit giving
  4786.                     a 64-bit product.
  4787.                     c.f. multiplication UM*
  4788.  
  4789.      M/             ( num-64 denom-32 -- quot-32 )
  4790.                     signed floored division with no remainder.  To get both
  4791.                     the remainder and quotient, use M/MOD.  To get just the
  4792.                     remainder use MMOD.  Note that the unsigned version UM/
  4793.                     is faster than M/.
  4794.                     c.f. division, M/MOD MMOD UM/.
  4795.  
  4796.      M/MOD          ( num-64 denom-32 -- rem-32 quot-32 )
  4797.                     Signed floored division with both remainder and
  4798.                     quotient.  The remainder has same sign as divisor. To
  4799.                     get just the remainder use MMOD.  To get just the
  4800.                     quotient use M/.  Note that the unsigned version UM/MOD
  4801.                     is faster than M/MOD.
  4802.                     c.f. division MMOD M/ UM/MOD
  4803.                     pronounced "m-mod"
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.           \BBL\BBL.DOC  -73-  last updated 1986 October 14 21:30
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822. BBL Forth Reference
  4823.  
  4824.  
  4825.      MAX            ( n1 n2 -- n3 )
  4826.                     n3 larger of signed n1 n2.  Code is faster if n1 >= n2.
  4827.                     Watch out! 0 MAX is used to corral an expression so
  4828.                     that it never gets below 0.  In other words 0 MAX sets
  4829.                     the LOWER bound on an expression.  A very common bug is
  4830.                     to get MIN and MAX confused when used in this way.
  4831.                     c.f. MIN DMIN DMAX CORRAL
  4832.                     pronounced "max"
  4833.  
  4834.      MIN            ( n1 n2 -- n3 )
  4835.                     n3 is smaller of signed n1 n2.  Code is faster if n1 <=
  4836.                     n2   Watch out! 999 MIN is used to corral an expression
  4837.                     so that it never gets above 999.  In other words 999
  4838.                     MIN sets the UPPER bound on an expression.  A very
  4839.                     common bug is to get MIN and MAX confused when used in
  4840.                     this way.
  4841.                     c.f. MAX DMIN DMAX CORRAL
  4842.                     pronounced "min"
  4843.  
  4844.      MMOD           ( num-64 denom-32 -- rem-32 )
  4845.                     Signed floored division giving just the quotient.  In
  4846.                     contrast M/MOD gets remainder and quotient.  M/ gets
  4847.                     just the quotient.  Note that the unsigned version
  4848.                     UMMOD is faster than MMOD.
  4849.                     c.f. division M/MOD M/ UMMOD
  4850.  
  4851.      MOD            ( num-32 denom-32 -- rem-32 )
  4852.                     Signed floored division to get the remainder In
  4853.                     contrast /MOD gets remainder and quotient.  / gets just
  4854.                     the quotient.  Note that the unsigned version UMOD is
  4855.                     faster than MOD.
  4856.                     c.f.  division /MOD / UMOD QMOD
  4857.  
  4858.      MS             ( n -- )
  4859.                     delays n milliseconds (thousandths of a second).  This
  4860.                     is implemented by a cpu delay loop.  BBL wastes n
  4861.                     milliseconds of CPU time.  For MS to work correctly you
  4862.                     must have configured BBL with the correct processor
  4863.                     speed.  If you wish to do time delays that are
  4864.                     independent of processor speed, consider the Abundance
  4865.                     verb TICKS which uses the 1/18 second resolution timer
  4866.                     interrupts.
  4867.  
  4868.      MSW            ( n1 -- n2 )
  4869.                     Most Significant Word.  n2 is the most significant 16
  4870.                     bits word of n1 padded on the left with zeros.  Note
  4871.                     that both n1 and n2 are values on the data stack -- not
  4872.                     addresses in RAM.
  4873.                     c.f. LSW
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.           \BBL\BBL.DOC  -74-  last updated 1986 October 14 21:30
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888. BBL Forth Reference
  4889.  
  4890.  
  4891.      MU/MOD         ( num-64 denom-32 -- rem-32 quot-64 )
  4892.                     Unsigned floored division with a 32-bit remainder and
  4893.                     64-bit quotient.  DON'T CONFUSE THIS WITH UM/MOD.
  4894.                     UM/MOD gives a 32-bit quotient.  UMMOD will get just
  4895.                     the remainder, but there is no operator to get just the
  4896.                     quotient.  There is no signed version of this operator.
  4897.                     c.f. division UMMOD UM/MOD
  4898.  
  4899.  
  4900.      **N**          words that begin with N
  4901.  
  4902.      N>LINK         ( nfa -- lfa )
  4903.                     Not normally used by programmers.  Converts nfa (name
  4904.                     field address) to lfa (link field address). Once you
  4905.                     have the lfa, you must do a LINK@ to get the
  4906.                     predecessor's nfa.  This link uses the hash threads.
  4907.                     c.f. >BODY >NAME >LINK BODY> NAME> LINK> L>NAME PREV-
  4908.                     NFA
  4909.                     pronounced "name-to-link"
  4910.  
  4911.      NAME>          ( nfa -- cfa )
  4912.                     Not normally used by programmers.  Converts nfa (name
  4913.                     field address) to cfa (code field address).
  4914.                     c.f. >BODY >NAME >LINK BODY> LINK> N>LINK L>NAME PREV-
  4915.                     NFA
  4916.                     pronounced "from-name"
  4917.  
  4918.      NAND           ( 32b1 32b2 -- 32b3 )
  4919.                     Logical NAND.  b3 is the one's complement of the
  4920.                     logical AND of b1 and b2.  For example BINARY 0101 1100
  4921.                     NAND is 1011 -- if both bits are 1 the result is 0,  If
  4922.                     either of the bits is a 0, the result is a 1.
  4923.                     Equivalent to but faster than AND NOT.  Note that b1
  4924.                     NOT b2 NOT AND is better expressed as b1 b2 NOR and b1
  4925.                     NOT b2 NOT OR is better expressed as b1 b2 NAND.
  4926.                     c.f. AND OR NOR XOR NEGATE NOT
  4927.  
  4928.      NAME>          ( nfa -- cfa )
  4929.                     converts a name field address to the code field address
  4930.  
  4931.      NEGATE         ( n1 -- n2 )
  4932.                     Changes the sign of a value.  n2 is the two's
  4933.                     complement of n1, i.e. -n1 or difference of zero less
  4934.                     n1.  The value -231 cannot be properly negated because
  4935.                     it +231 cannot be expressed in 32 bits.  Thus this
  4936.                     value is left unchanged.  Note SWAP- is much faster
  4937.                     than - NEGATE or SWAP -.  In contrast NOT calculates
  4938.                     the one's complement.
  4939.                     c.f. subtraction, SWAP- ?NEGATE ABS
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.           \BBL\BBL.DOC  -75-  last updated 1986 October 14 21:30
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954. BBL Forth Reference
  4955.  
  4956.  
  4957.      NEXT-NFA       ( nfa1 -- nfa2 )
  4958.                     Used to find the word in the compiled into the same
  4959.                     vocabulary immediately after the given word.  If there
  4960.                     is no successor, the result is 0.  NEXT-NFA is used in
  4961.                     conjunction with EARLIEST-NFA to chase through all the
  4962.                     words in a vocabulary.  NEXT-NFA does NOT use the hash
  4963.                     threads.
  4964.                     c.f. EARLIEST-NFA LATEST-NFA PREV-NFA LATEST
  4965.  
  4966.      NIL            ( -- )
  4967.                     Does nothing very quickly.  It can be used as a do-
  4968.                     nothing routine in a CASE or JUMP.  Can also be used as
  4969.                     ['] NIL to pass a do-nothing routine as a parameter.
  4970.                     Do not confuse with NULL X whose real name is a HEX 00
  4971.                     used to terminate interpretation of a screen or the
  4972.                     TIB.
  4973.                     c.f. NULL X
  4974.  
  4975.      NIP            ( n1 n2 -- n2 )
  4976.                     Drops second from top of data stack.  Equivalent to but
  4977.                     faster than SWAP DROP
  4978.                     c.f DROP TUCK SWAP
  4979.  
  4980.      NOR            ( 32b1 32b2 -- 32b3 )
  4981.                     Logical NOR.  b3 is the one's complement of the logical
  4982.                     inclusive OR of b1 and b2.  For example BINARY 0101
  4983.                     1100 NAND is 0010.  Equivalent to but faster than OR
  4984.                     NOT.  Note that b1 NOT b2 NOT AND is better expressed
  4985.                     as b1 b2 NOR and b1 NOT b2 NOT OR is better expressed
  4986.                     as b1 b2 NAND.
  4987.                     c.f. OR XOR AND NAND NOT
  4988.  
  4989.      NOT            ( 32b1 -- 32b2 )
  4990.                     32b2 is the one's complement of 32b1.  For example
  4991.                     BINARY 1010 is 0101 -- every 1 turns into a zero and
  4992.                     every 0 turns into a one..  NOT is similar but not
  4993.                     identical to 0=.  Watch out!  In Forth-79 NOT and 0=
  4994.                     were synonymous. In Forth-83, only for canonical flags
  4995.                     are NOT and 0= synonymous.  If you use canonical flags,
  4996.                     NOT behaves just like the word "not" in English.  Use
  4997.                     NEGATE to get the two's complement.
  4998.                     c.f. 0= NEGATE NAND NOR
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.           \BBL\BBL.DOC  -76-  last updated 1986 October 14 21:30
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020. BBL Forth Reference
  5021.  
  5022.  
  5023.      NUMBER         ( Addr -- d )
  5024.                     converts ascii to binary using the current BASE.  At
  5025.                     addr there is a counted string (usually at HEREB) that
  5026.                     must be followed by a SPACE or HEX 00.  NUMBER aborts
  5027.                     with an "Undefined" message if invalid characters are
  5028.                     found in the string.  The string may have a leading
  5029.                     minus sign, but not a trailing one.  The string may not
  5030.                     have any plus signs.  NUMBER leaves DPL=-1 if there are
  5031.                     no decimals otherwise DPL is the number of digits to
  5032.                     the right of the decimal.  Nutty as it sounds, though
  5033.                     the string must begin with a count, the count byte
  5034.                     itself is ignored.  This is a tradition from PC Forth
  5035.                     Plus.  It allow arbitrarily long strings with many lead
  5036.                     zeros to be handled properly.  Note that the result is
  5037.                     always signed double precision.  There is no word to
  5038.                     give you single precision directly.  NUMBER was
  5039.                     designed to parse inline literals, and is probably of
  5040.                     not too much use generally.
  5041.                     c.f. CONVERT
  5042.  
  5043.      NULL           ( -- )
  5044.                     real name is hex 0 length 1 alias X.  It terminates
  5045.                     interpretation of the input stream.  this word gets
  5046.                     executed at the end of interpreting the TIB or a block.
  5047.                     It acts like EXIT terminating INTERPRET.  IT DOES NOT
  5048.                     PUSH OR EMIT A NULL CHAR!
  5049.                     c.f. ;S NIL
  5050.  
  5051.  
  5052.      **O**          words that begin with O
  5053.  
  5054.      OFF            ( addr -- )
  5055.                     Stores a 32-bit 0 at addr.  Equivalent to but faster
  5056.                     than 0 SWAP !
  5057.                     c.f. ON 0! ! ERASE
  5058.  
  5059.      ON             ( addr -- )
  5060.                     Stores a 32-bit -1 at addr.  Equivalent to but faster
  5061.                     than -1 SWAP !
  5062.                     c.f. OFF 0! !
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.           \BBL\BBL.DOC  -77-  last updated 1986 October 14 21:30
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086. BBL Forth Reference
  5087.  
  5088.  
  5089.      ONLY           ( -- )
  5090.                     Select the ONLY vocabulary as both the transient
  5091.                     vocabulary and the resident vocabulary in the search
  5092.                     order.  All other vocabularies -- even FORTH are no
  5093.                     longer searched.  It does not change the CURRENT
  5094.                     (DEFINITIONS) vocabulary.  When you want to set up a
  5095.                     new set of multiple vocabularies to search you would
  5096.                     use ONLY like this:
  5097.                     ONLY FORTH ALSO EDITOR ALSO HIDDEN DEFINITIONS
  5098.                     This would set up the search to first look in HIDDEN,
  5099.                     then in EDITOR then in FORTH, then in ONLY.  New
  5100.                     definitions would be added to the HIDDEN vocabulary.
  5101.                     c.f. ALSO FORTH ORDER WORDS FORGET DEFINITIONS SEAL
  5102.                     VOCABULARY
  5103.  
  5104.      OPEN-CACHE     ( -- )
  5105.                     opens the CACHE file with current CACHE-NAME.  DISK-
  5106.                     ERROR @ is 0 if ok, 4 if could not open.
  5107.                     c.f. USING CLOSE-CACHE CACHE-NAME SAVE-BUFFERS FLUSH
  5108.                     EMPTY-BUFFERS DISK-ERROR LAST-SCR
  5109.  
  5110.      OR             ( 32b1 32b2 -- 32b3 )
  5111.                     Inclusive logical-or on all 32 bits.  b3 is the logical
  5112.                     or of b1 and b2.  For example BINARY 0101 0011 OR is
  5113.                     0111.  In other words, if either bit is is one, the
  5114.                     result is a 1.  If both bits are 0, the result is a 0.
  5115.                     Note that b1 NOT b2 NOT AND is better expressed as b1
  5116.                     b2 NOR and b1 NOT b2 NOT OR is better expressed as b1
  5117.                     b2 NAND.  If you use canonical flags, this bit-wise OR
  5118.                     behaves just like "and/or" in English.  In particular
  5119.                     if n1 and n2 are canonical flags (0 or -1) then:
  5120.                     true  true  -- true
  5121.                     false true  -- true
  5122.                     true  false -- true
  5123.                     false false -- false
  5124.                     c.f. XOR NOR AND NAND NOT XOR
  5125.  
  5126.      ORDER          ( -- )
  5127.                     Display the vocabulary names forming the search order
  5128.                     in their present search order sequence.  Then show the
  5129.                     vocabulary into which the new definitions will be
  5130.                     placed CURRENT (DEFINITIONS).  Note this does not show
  5131.                     all vocabularies -- just the ones being searched now.
  5132.                     c.f. VOCABULARY VOC-LIST CURRENT CONTEXT WORDS FOR-
  5133.                     EACH-VOC
  5134.  
  5135.      OVER           (32b1 32b2 -- 32b1 32b2 32b3 )
  5136.                     32b3 is a copy of 32b1.  Duplicate 2nd from top of data
  5137.                     stack.
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.           \BBL\BBL.DOC  -78-  last updated 1986 October 14 21:30
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152. BBL Forth Reference
  5153.  
  5154.  
  5155.      **P**          words that begin with P
  5156.  
  5157.      PW!            ( uw port# -- )
  5158.                     writes least significant 2 bytes to an i/o port.  I/O
  5159.                     ports are numbered 0 .. FFFF.  This bypasses DOS and
  5160.                     goes directly to the hardware.  The address need not be
  5161.                     canonical.
  5162.                     c.f. PUW@ PC@ PC!
  5163.  
  5164.      PUW@           ( port# -- uw )
  5165.                     reads 2 bytes from an i/o port.  I/O ports are numbered
  5166.                     0 .. FFFF.  This bypasses DOS and goes directly to the
  5167.                     hardware.
  5168.                     c.f. PW! PC@ PC!
  5169.  
  5170.      PAD            ( -- addr )
  5171.                     The lower address of a scratch area used to hold data
  5172.                     for intermediate processing.  The address or contents
  5173.                     of PAD may change and the data lost if the address of
  5174.                     the next available dictionary location is changed.  The
  5175.                     minimum capacity of PAD is 84 characters.  Equivalent
  5176.                     to HERE 256 +.  Every time you ALLOT the PAD moves.
  5177.                     When you use words like <# # and #> the string is built
  5178.                     just under the PAD.
  5179.  
  5180.      PC!            ( c port# -- )
  5181.                     writes last significant 1 byte to i/o port.  I/O ports
  5182.                     are numbered 0 .. FFFF.  This bypasses DOS and goes
  5183.                     directly to the hardware.  The address need not be
  5184.                     canonical.
  5185.                     c.f. PC@ PW! PC!
  5186.  
  5187.      PC@            ( port# -- c )
  5188.                     reads a byte from an i/o port.  I/O ports are numbered
  5189.                     0 .. FFFF.  This bypasses DOS and goes directly to the
  5190.                     hardware.
  5191.                     c.f. PC! PUW@ PW!
  5192.  
  5193.      PEMIT          ( c -- )
  5194.                     The least-significant 8-bit ASCII character is emitted
  5195.                     to the printer printer.  PEMIT can be used directly,
  5196.                     but more often it is vectored into EMIT via PRINTER.
  5197.                     c.f. PRINTER EMIT 'EMIT PTYPE 'TYPE SEMIT STYPE
  5198.  
  5199.      PICK           ( +n -- 32b )
  5200.                     32b is a copy of the +nth data stack value, not
  5201.                     counting +n itself.  {0  the number of elements on
  5202.                     stack-1}
  5203.                               0 PICK is equivalent to DUP
  5204.                               1 PICK is equivalent to OVER
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.           \BBL\BBL.DOC  -79-  last updated 1986 October 14 21:30
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218. BBL Forth Reference
  5219.  
  5220.  
  5221.      PREV-NFA       ( nfa1 -- nfa2 )
  5222.                     If nfa1 is the name field address of a word in any
  5223.                     vocabulary, then nfa2 will be the name field address of
  5224.                     the word compiled just previously in the dictionary.
  5225.                     IF nfa2 is 0, this means there is no predecessor.
  5226.                     WORDS uses LATEST-NFA and PREV-NFA to chase through all
  5227.                     the words in a vocabulary in reverse order, regardless
  5228.                     of hash thread.  In contrast the lfas refer to the hash
  5229.                     threads.  Nfa1 must be expressed in such a fashion that
  5230.                     the segment portion covers the predecessor nfa2.  This
  5231.                     requirement should usually come out in the wash without
  5232.                     special consideration.
  5233.                     c.f. NEXT-NFA LATEST-NFA EARLIEST-NFA WORDS N>LINK
  5234.                     LINK@ >LINK LINK>
  5235.  
  5236.      PRINTER        ( -- )
  5237.                     redirects EMIT and TYPE output to printer, by setting
  5238.                     up the 'EMIT and 'TYPE vectors.  PRINTER is defined as:
  5239.                     : PRINTER ['] PEMIT 'EMIT ! ['] PTYPE 'TYPE ! ;
  5240.                     c.f. CONSOLE EMIT TYPE 'EMIT 'TYPE PEMIT PTYPE
  5241.  
  5242.      PTYPE          ( addr len -- )
  5243.                     TYPEs string to printer. w characters are printed from
  5244.                     memory beginning with the character at addr and
  5245.                     continuing through consecutive addresses.  Addr must
  5246.                     cover the string and +w must be under 64K.  It can be
  5247.                     used directly, but normally it is vectored into the
  5248.                     TYPE routine via the word PRINTER.
  5249.                     c.f. PRINTER TYPE 'TYPE PEMIT
  5250.  
  5251.  
  5252.      **Q**          words that begin with Q
  5253.  
  5254.      Q*             ( n1-32 n2-32 -- n3-32 )
  5255.                     fast form of * multiplication that works if you can
  5256.                     guarantee that n1 and n2 are all in the range 0 ..
  5257.                     65535.  Works slightly faster if n1 > n2.
  5258.                     c.f. *
  5259.                     pronounced "quick-star" or "queue-star"
  5260.  
  5261.      Q/             ( n1-num-32 n2-denom-32 -- n3-quot-32 )
  5262.                     Quick form of / or U/ division that works if you can
  5263.                     guarantee that n1 is greater than or equal to 0, that
  5264.                     n2 is in the range 1 .. 65535, and n3 is in the range
  5265.                     0..65535.  WARNING: Overflow of the quotient over 65535
  5266.                     or division by 0 is a error and will result in an INT 0
  5267.                     divide by zero program crash.
  5268.                     c.f. Q/MOD QMOD / U/
  5269.                     pronounced "quick-divide" or "queue-slash"
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.           \BBL\BBL.DOC  -80-  last updated 1986 October 14 21:30
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284. BBL Forth Reference
  5285.  
  5286.  
  5287.      Q/MOD          ( n1-num-32 n2-denom-32 -- n3-rem-32 n4-quot-32 )
  5288.                     Quick form of /MOD or U/MOD that works if you can
  5289.                     guarantee that n1 is greater than or equal to 0, that
  5290.                     n2 is in the range 1 .. 65535, and n3 and n4 are in the
  5291.                     range 0..65535.  WARNING: Overflow of the quotient over
  5292.                     65535 or division by 0 is a error and will result in an
  5293.                     INT 0 divide by zero program crash.
  5294.                     c.f. Q/ QMOD /MOD U/MOD
  5295.                     pronounced "quick-slash-mod" or "queue-slash-mod"
  5296.  
  5297.      QMOD           ( n1-num-32 n2-denom-32 -- n3-rem-32 )
  5298.                     Quick form of MOD or UMOD that works if you can
  5299.                     guarantee that n1 is greater than or equal to 0, that
  5300.                     n2 is in the range 1 .. 65535, and n3 and n4 are in the
  5301.                     range 0..65535.  WARNING: Overflow of the implied
  5302.                     quotient over 65535 or division by 0 is a error and
  5303.                     will result in an INT 0 divide by zero program crash.
  5304.                     pronounced "quick-mod" or "queue-mod"
  5305.  
  5306.      QCONSTANT      ( 32b -- )
  5307.                     A defining word executed in the form:
  5308.                          32b QCONSTANT <name>
  5309.                     Creates a dictionary entry for <name> so that when
  5310.                     <name> is later executed, 32b will be left on the data
  5311.                     stack.  The value must not be a relocatable address.
  5312.                     QCONSTANT is used as a quick version of CONSTANT when
  5313.                     you can live with the restriction that the value is NOT
  5314.                     an absolute address in the program.  It can be a
  5315.                     number, a relative address, or an absolute address
  5316.                     outside the program e.g. in ROM BIOS or DOS.
  5317.                     c.f. CONSTANT, ADCON
  5318.  
  5319.      QUERY          ( -- )
  5320.                     Gets one line of keyboard input into the TIB.  Always
  5321.                     goes to the keyboard -- not BLOCK.  Characters are
  5322.                     received and transferred into the memory area addressed
  5323.                     by TIB .  The transfer terminates when either a
  5324.                     "return" is received or the number of characters
  5325.                     transferred reaches the size of the area addressed by
  5326.                     TIB .  The values of >IN and BLK are set to zero and
  5327.                     the value of #TIB is set to the value of SPAN .  WORD
  5328.                     may be used to accept text from this buffer.
  5329.                     c.f. EXPECT input stream
  5330.                     pronounced "query"
  5331.  
  5332.      QUIT           ( -- )
  5333.                     Clears the return stack, sets interpret state ( [ i.e.
  5334.                     STATE OFF), accepts new input from the current input
  5335.                     device, and begins text interpretation.  No message is
  5336.                     displayed.  In contrast ABORT also clears the data
  5337.                     stack and sets the context vocabulary to FORTH.
  5338.                     c.f. ABORT ABORT" RP! SP!
  5339.  
  5340.  
  5341.  
  5342.           \BBL\BBL.DOC  -81-  last updated 1986 October 14 21:30
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350. BBL Forth Reference
  5351.  
  5352.  
  5353.      QVARIABLE      ( -- ) compiling
  5354.                     ( -- addr ) exectuting
  5355.                     A defining word executed in the form:
  5356.                          QVARIABLE <name>
  5357.                     This is almost identical to VARIABLE except that the
  5358.                     PFA is alloctated in the root segment right after the
  5359.                     PFA.  This means its pfa has the form CS:offset which
  5360.                     can be easily accessed by code words using a simple CS:
  5361.                     override rather than having to set up ES for an ES:
  5362.                     override.  In addition the code at the cfa is inline
  5363.                     taking up more space but executing more rapidly than
  5364.                     the usual VARIABLE cfa code.  If you wish to allocate
  5365.                     more space after the pfa you must use ALLOCTC instead
  5366.                     of ALLOT.  A dictionary entry for <name> is created and
  5367.                     four bytes (32 bits) are allotted in its parameter
  5368.                     field.  This parameter field is to be used for contents
  5369.                     of the variable.  The application is responsible for
  5370.                     initializing the contents of the variable which it
  5371.                     creates if it is other than 0.  When <name> is later
  5372.                     executed, the address of its parameter field is placed
  5373.                     on the data stack.  Watch out the FORTH-79 used to be 0
  5374.                     VARIABLE X, rather than VARIABLE X.
  5375.                     c.f. VARIABLE
  5376.  
  5377.  
  5378.      **R**          words that begin with R
  5379.  
  5380.      R0@            ( -- addr )
  5381.                     Gets the address of the base of the return stack.  The
  5382.                     segment part of his address will always be SS:.
  5383.                     Roughly equivalent to R0 @.  however for speed and
  5384.                     safety we ignore R0.  R0 is maintained for reference
  5385.                     only )
  5386.  
  5387.      R>             ( -- 32b )
  5388.                     32b is removed from the return stack and transferred to
  5389.                     the data stack.  You must always pair >R and R> within
  5390.                     a routine.  See the dire warnings on its use under the
  5391.                     heading Return Stack.
  5392.                     c.f. >R R@ RDROP EXIT
  5393.                     pronounced "r-from"
  5394.  
  5395.      R@             ( -- 32b )
  5396.                     32b is a copy of the top of the return stack.  It does
  5397.                     not disturb the return stack.
  5398.                     c.f. >R R> RDROP EXIT
  5399.                     pronounced "r-fetch"
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.           \BBL\BBL.DOC  -82-  last updated 1986 October 14 21:30
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416. BBL Forth Reference
  5417.  
  5418.  
  5419.      RDROP          ( -- )
  5420.                     drops top element of return stack.
  5421.                     See dire warnings under the heading Return Stack.  DO
  5422.                     NOT PLAY WITH THIS WORD UNLESS YOU ARE PREPARED FOR A
  5423.                     SYSTEM CRASH.
  5424.                     c.f. >R R> R@ EXIT
  5425.  
  5426.      R2DROP         ( -- )
  5427.                     drops top two elements of return stack.
  5428.                     See dire warnings under the heading Return Stack.  DO
  5429.                     NOT PLAY WITH THIS WORD UNLESS YOU ARE PREPARED FOR A
  5430.                     SYSTEM CRASH.
  5431.                     c.f. RDROP 2DROP
  5432.  
  5433.      R3DROP         ( -- )
  5434.                     drops top three elements of return stack.
  5435.                     See dire warnings under the heading Return Stack.  DO
  5436.                     NOT PLAY WITH THIS WORD UNLESS YOU ARE PREPARED FOR A
  5437.                     SYSTEM CRASH.
  5438.                     c.f. RDROP 3DROP
  5439.  
  5440.      R4DROP         ( -- )
  5441.                     drops top four elements of return stack.
  5442.                     See dire warnings under the heading Return Stack.  DO
  5443.                     NOT PLAY WITH THIS WORD UNLESS YOU ARE PREPARED FOR A
  5444.                     SYSTEM CRASH.
  5445.                     c.f. RDROP 4DROP
  5446.  
  5447.      REBUILD-VOC    ( -- )
  5448.                     rebuilds the CURRENT (DEFINITIONS) vocabulary
  5449.                     dictionary region.  It first allocates a chunk of space
  5450.                     equal to the contents of the VOC-SIZE variable for the
  5451.                     new vocabulary region.  Then it decides on the optimal
  5452.                     number of hashing threads for a dictionary of that
  5453.                     size, then in rebuilds the vocabulary headers.  You do
  5454.                     this if one of your vocabularies is getting full or is
  5455.                     getting sluggish at searching.  Normally you increase
  5456.                     VOC-SIZE before using REBUILD-VOC.  Once you find he
  5457.                     optimal sizes of your vocabularies, you can set VOC-
  5458.                     SIZE just prior to defining the vocabulary in the first
  5459.                     place.  This is much more efficient because the old
  5460.                     dictionary space is not reclaimed unless you do it
  5461.                     yourself through some heroic effort.  REBUILD-VOC is
  5462.                     also used to rebuild the FORTH vocabulary at startup.
  5463.                     This is done because Microsoft assembler is not smart
  5464.                     enough to directly generate the code for a multi-thread
  5465.                     dictionary.  If you closely examine the BBL source
  5466.                     listings you will see that FORTH is built as a
  5467.                     multithread dictionary, but there is only one thread!
  5468.                     c.f. VOCABULARY VOC-SIZE
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.           \BBL\BBL.DOC  -83-  last updated 1986 October 14 21:30
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482. BBL Forth Reference
  5483.  
  5484.  
  5485.      RECURSE        ( -- )
  5486.                     If you want to recursively call the routine you are
  5487.                     defining you use the word RECURSE instead of the true
  5488.                     name of the routine.  If you used the true name of the
  5489.                     routine you would get the OLD version (if any) of the
  5490.                     same routine.  In older Forth versions this was called
  5491.                     MYSELF. e.g.
  5492.                     : FACTORIAL ( n -- : computes N factorial )
  5493.                         DUP 1 > IF DUP 1- RECURSE * ELSE DROP 1 THEN ;
  5494.                     c.f. SMUDGE UNSMUDGE
  5495.  
  5496.      REL>           ( 32-bit relative address -- absolute SEG:OFF)
  5497.                     convert a relative address to address to an absolute
  5498.                     canonical one with the offset in the range 0..15.  It
  5499.                     really only useful on addresses in the pfa part of the
  5500.                     dictionary or on addresses outside the program.  It
  5501.                     does not cleverly handle addresses in the code segment
  5502.                     to make them have a segment equal to CS:.  Neither does
  5503.                     it handles addresses in the stack segment to make them
  5504.                     have a segment equal to SS:.  Neither does it handle
  5505.                     addresses in the vocabulary segments to make them have
  5506.                     segments equal to the start of the vocabulary region.
  5507.                     See the warning about comparing addresses.
  5508.                     c.f. >REL >REL>
  5509.                     pronounced "from-relative
  5510.  
  5511.      REPEAT         ( -- )
  5512.                     ( back-addr 1 -- )  (compiling)
  5513.                     Used in the form:
  5514.                          BEGIN ... flag WHILE ... REPEAT
  5515.                     At execution time, REPEAT continue.
  5516.                     c.f. BEGIN WHILE UNTIL
  5517.  
  5518.      ROLL           ( +n -- )
  5519.                     The +nth data stack value, not counting +n itself is
  5520.                     first removed and then transferred to the top of the
  5521.                     data stack, moving the remaining values into the
  5522.                     vacated position.  {0..the number of elements on the
  5523.                     data stack-1)
  5524.                          2 ROLL is equivalent to ROT
  5525.                          1 ROLL is equivalent to SWAP
  5526.                          0 ROLL is a null operation
  5527.  
  5528.      ROT            ( 32b1 32b2 32b3 -- 32b2 32b3 32b1 )
  5529.                     The top three data stack entries are rotated, bringing
  5530.                     the deepest to the top.
  5531.                     c.f. -ROT 2ROT
  5532.                     pronounced "rote"
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.           \BBL\BBL.DOC  -84-  last updated 1986 October 14 21:30
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548. BBL Forth Reference
  5549.  
  5550.  
  5551.      RP!            ( -- )
  5552.                     DO NOT USE THIS WORD UNLESS YOU REALLY KNOW WHAT YOU
  5553.                     ARE DOING.  Clears the return stack.  Unlike PC Forth
  5554.                     Plus RP! does not expect R0 on the data stack.  For
  5555.                     safety and speed we ignore R0.
  5556.                     c.f. QUIT ABORT
  5557.  
  5558.      RP@            ( -- addr )
  5559.                     address of the current top of the return stack.  Note
  5560.                     address returned is not canonical because the segment
  5561.                     portion is always equal to SS:.
  5562.  
  5563.  
  5564.      **S**          words that begin with S
  5565.  
  5566.      S0@            ( -- addr )
  5567.                     The address of the RAM base of the data stack.  This is
  5568.                     roughly equivalent to S0 @   However, for speed and
  5569.                     safety we ignore S0.  S0 is maintained for reference
  5570.                     only.   Note address returned is not canonical because
  5571.                     the segment portion is always SS:
  5572.  
  5573.      S=             ( addr1 addr2 length -- FLAG )
  5574.                     Compares two strings.  The flag is true if strings
  5575.                     equal.  Length is under 64K.  The addresses need not be
  5576.                     canonical but they must cover both ends of the strings.
  5577.                     The length may also be 0 or 1, but not negative.  The
  5578.                     addresses need not be canonical. Two zero length
  5579.                     strings will always compare as equal.
  5580.  
  5581.      S>D            ( n -- d )
  5582.                     converts single to double precision by sign extending.
  5583.                     If n is known to be positive a faster way of doing this
  5584.                     is to push a 0 to the data stack.  By convention, when
  5585.                     you use this short form write
  5586.                     0 ( S>D ).
  5587.                     c.f. 0 D>S
  5588.  
  5589.      SAVE-BUFFERS   ( -- )
  5590.                     The contents of all block buffers marked as Updated are
  5591.                     written to their corresponding mass storage blocks.
  5592.                     All buffers are marked as no longer being modified, but
  5593.                     remain assigned.  BBL remembers the contents of the
  5594.                     buffers in contrast to FLUSH which does not.
  5595.                     c.f. EMPTY-BUFFERS FLUSH
  5596.                     pronounced "save-buffers"
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.           \BBL\BBL.DOC  -85-  last updated 1986 October 14 21:30
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614. BBL Forth Reference
  5615.  
  5616.  
  5617.      SCAN           ( addr len char -- index, true: if found.)
  5618.                     ( addr len char -- false : if not found)
  5619.                     scan string left to right searching for char.  The left
  5620.                     most character is index 0.  If the length of the string
  5621.                     is 0, SCAN will always return false.  The len may be
  5622.                     0..64K but not negative.  Addr need not be canonical
  5623.                     but it must cover both ends of the string.
  5624.                     c.f. <SCAN WSCAN SEARCH <SEARCH
  5625.  
  5626.      SEAL           ( -- )
  5627.                     Delete all occurrences of ONLY from the search order.
  5628.                     The effect is that only specified application
  5629.                     dictionaries will be searched.  You can use it to keep
  5630.                     users out of your private vocabularies, but give them
  5631.                     free reign to use others.  The tiny ONLY vocabulary
  5632.                     contains the keys to the general vocabulary switching
  5633.                     mechanism.  You use it like this:
  5634.                     ONLY PUBLIC ALSO PUBLIC2 SEAL
  5635.                     to lock the user forever into using just the PUBLIC and
  5636.                     PUBLIC2 vocabularies.
  5637.  
  5638.      SEARCH         ( addr1 len1 addr2 len2 -- offset true if found)
  5639.                     ( addr1 len1 addr2 len2 -- false if not found )
  5640.                     Searches string-1 for the first occurrence of string2.
  5641.                     Searches left to right.  Addr1 need not be canonical
  5642.                     but is must cover both ends of string-1.  Addr2 need
  5643.                     not be canonical but is must cover both ends of string-
  5644.                     2.  Either or both of len1 and len2 may be 0.
  5645.                     ??? Later documentation will be inserted to define
  5646.                     results for zero length strings.
  5647.                     c.f. <SEARCH SCAN <SCAN WSCAN
  5648.  
  5649.      SEMIT          ( char -- )
  5650.                     emits char to screen.  Usually EMIT is vectored to
  5651.                     SEMIT via CONSOLE which does ['] SEMIT 'EMIT !.  If
  5652.                     EMIT is vectored to PEMIT the printer, you can still
  5653.                     get at the screen with SEMIT.  SEMIT does not bypass
  5654.                     DOS.  Thus it is slow, but it can be redirected with
  5655.                     DOS C:> commands on the command line.  If you want high
  5656.                     speed screen painting you must use the S! verbs in the
  5657.                     Abundance compiler than bypass DOS and get at the
  5658.                     hardware directly
  5659.                     c.f. EMIT PEMIT 'EMIT CONSOLE STYPE PTYPE 'TYPE
  5660.  
  5661.      SHIFT          ( n1 p -- n2 )
  5662.                     Shift n1 by p bits.  Multiplies n1 by 2**p with a
  5663.                     logical unsigned shift.  p>0 shifts left, p<0 shifts
  5664.                     right logically.
  5665.                     c.f. multiplication division * 2* 4* 8* 10* 16* 64*
  5666.                     256* 2/ D2/ D2*
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.           \BBL\BBL.DOC  -86-  last updated 1986 October 14 21:30
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680. BBL Forth Reference
  5681.  
  5682.  
  5683.      SIGN           ( n -- )
  5684.                     If n is negative, an ASCII "-" (minus sign) is appended
  5685.                     to the pictured numeric output string, otherwise does
  5686.                     nothing.  Typically used between <# and #>.  Typically
  5687.                     the sign is hidden on the return stack during
  5688.                     conversion then popped out at the last moment for SIGN.
  5689.                     c.f. <# # SIGN #>
  5690.  
  5691.      SIXTEEN        ( -- 16 )
  5692.                     no matter what BASE is, you always get a decimal 16.
  5693.                     c.f. 10 TEN
  5694.  
  5695.      SMUDGE         ( -- )
  5696.                     Not normally used by programmers.  Makes LATEST
  5697.                     definition invisible in the search order by setting the
  5698.                     smudge bit in the nfa.  Done by Colon to temporarily
  5699.                     hide a definition until it is finished.  Watch out in
  5700.                     Forth-79 SMUDGE toggled the smudge bit instead of
  5701.                     setting it.
  5702.                     c.f. UNSMUDGE
  5703.  
  5704.      SP!            ( -- )
  5705.                     clears data stack.  Unlike SP!in PC Forth Plus, SP!
  5706.                     does not expect S0 on the data stack!!!.  For safety
  5707.                     and speed we ignore S0.  Changing the value of S0 will
  5708.                     have no effect on the next SP!.
  5709.  
  5710.      SP@            ( -- addr )
  5711.                     addr is the address of the current top of the RAM-based
  5712.                     data stack just before SP@ was executed.    NOTE this
  5713.                     points actually to second from top of logical stack as
  5714.                     actual.  The top of data stack is kept in a register
  5715.                     pair CX:BX. See notes under DATA STACK in BBLDOC.ASM.
  5716.                     Note address returned is NOT canonical because the
  5717.                     segment portion is always SS:
  5718.  
  5719.      SPACE          ( -- )
  5720.                     Displays an ASCII space.  Equivalent to BL EMIT.
  5721.  
  5722.      SPACES         ( +n -- )
  5723.                     Displays +n ASCII spaces.  Nothing is displayed if +n
  5724.                     is zero.  N cannot be negative.
  5725.  
  5726.      SPAN           ( -- addr )
  5727.                     A variable containing the count of characters actually
  5728.                     received and stored by the last execution of EXPECT not
  5729.                     counting the return or hex 00 null.  SPAN is not used
  5730.                     internally by BBL.
  5731.                     c.f. EXPECT
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.           \BBL\BBL.DOC  -87-  last updated 1986 October 14 21:30
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746. BBL Forth Reference
  5747.  
  5748.  
  5749.      STATE          ( -- addr )
  5750.                     A variable that keeps track of whether BBL should
  5751.                     compile or execute the next word. True if compiling
  5752.                     (i.e. in middle of a colon definition).  More precisely
  5753.                     STATE is a variable containing the compilation state.
  5754.                     A -1 content indicates compilation is occurring  (we
  5755.                     are in the middle of compiling a colon definition), a 0
  5756.                     content indicates that execution (sometimes called
  5757.                     "interpreting") is occurring.  A standard program may
  5758.                     not directly modify this variable.
  5759.  
  5760.      STREAM         ( -- addr )
  5761.                     Not normally used by programmers.  Get the next char in
  5762.                     either input stream (BLK or TIB).  Does NOT increment
  5763.                     >IN.  Just uses >IN to offset into the block.  We
  5764.                     cannot simply set BLOCK up once at LOAD time because
  5765.                     there might be LIST commands in the block that could
  5766.                     ruin the buffer..  We thus must call STREAM before each
  5767.                     word is parsed.  The main user of STREAM is WORD.
  5768.  
  5769.      STYPE          ( addr len -- )
  5770.                     TYPEs string to screen. +len characters are displayed
  5771.                     from memory beginning with the character at addr and
  5772.                     continuing through consecutive addresses.  Nothing is
  5773.                     displayed if +n is zero.  Addr must cover the string
  5774.                     and +w must be under 64K.  STYPE can be used on its
  5775.                     own, but normally TYPE is vectored to STYPE via CONSOLE
  5776.                     which does ['] STYPE 'TYPE !.  Note that STYPE does not
  5777.                     bypass DOS in any way.  Thus is is slow as molasses,
  5778.                     but can be redirected via DOS C:> command line prompts.
  5779.                     If you are serious about quick screen I/O you must use
  5780.                     the SCMOVE SVCMOVE etc verbs in the Abundance compiler
  5781.                     than get at the video hardware directly bypassing DOS.
  5782.  
  5783.      SWAP           ( 32b1 32b2 -- 32b2 32b1 )
  5784.                     The top two data  entries are exchanged.
  5785.  
  5786.      SWAP-          ( a b -- b-a )
  5787.                     does SWAP then subtract.  Surprisingly SWAP- is faster
  5788.                     than plain -.
  5789.                     c.f. NEGATE - SWAP
  5790.                     pronounced "swap-minus"
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.           \BBL\BBL.DOC  -88-  last updated 1986 October 14 21:30
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812. BBL Forth Reference
  5813.  
  5814.  
  5815.      SWEEP          ( -- addr )
  5816.                     variable that controls the optimization algorithm used
  5817.                     by BLOCK and BUFFER.  If SWEEP=0 a standard round robin
  5818.                     algorithm will be used that works well for random
  5819.                     accesses all over the screens.  If SWEEP=1 then the
  5820.                     algorithm will be modified for passing the screens
  5821.                     sequentially.  If SWEEP=-1 then the algorithm will be
  5822.                     modified for passing the screens sequentially but in
  5823.                     reverse order.  Note that DOS passes screens in reverse
  5824.                     order very slowly because of its internal FAT tables.
  5825.                     To find the 500th cluster of a file, DOS will chase
  5826.                     down a chain in the FAT table 500 links long.  However
  5827.                     if you have just accessed the 500th cluster, DOS
  5828.                     remembers its place in the chain, so if you then ask
  5829.                     for the 501st cluster it can find it in one jump.  But
  5830.                     if you ask for the 499th cluster, it has to start at
  5831.                     the top and chase down all 499 links.  For this reason
  5832.                     DOS has reasonably good performance if files are
  5833.                     processed sequentially but utterly abysmal performance
  5834.                     if you ask it to process large files in reverse.  SWEEP
  5835.                     cannot do a thing about this.  All it can do is manage
  5836.                     the internal FORTH buffers more efficiently.  When
  5837.                     sweep is 1, and you access screen N with BLOCK, it will
  5838.                     preferentially steal the buffer with screen N-1 in it -
  5839.                     - even though it way very recently used.  DOS is still
  5840.                     far from optimal on handling sequential i/o.  It should
  5841.                     read several screen ahead while your program continues
  5842.                     to process.  If you update a screen, the write should
  5843.                     be done right away before you have moved the disk heads
  5844.                     away.  Again there is nothing I can do about these DOS
  5845.                     internal problems.
  5846.                     c.f. BLOCK BUFFER OPEN-CACHE CLOSE-CACHE CACHE-HANDLE
  5847.                     CACHE-NAME SAVE-BUFFERS FLUSH EMPTY-BUFFERS LAST-SCR
  5848.  
  5849.  
  5850.      **T**          words that begin with T
  5851.  
  5852.      T!             ( value address --  )
  5853.                     Stores low order 3 bytes of value at address.  Works on
  5854.                     both signed and unsigned quantities.  Value is MSW on
  5855.                     top of the data stack, LSW first in memory.  Address is
  5856.                     seg:offset -- not necessarily canonical
  5857.                     c.f. T@ UT@ !
  5858.                     pronounced "t-bang"
  5859.  
  5860.      T@             ( addr -- value )
  5861.                     fetches 3 bytes - with sign extend.  Value is MSW on
  5862.                     top of the data stack, LSW first in memory.
  5863.                     c.f. UT@ T! @
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.           \BBL\BBL.DOC  -89-  last updated 1986 October 14 21:30
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878. BBL Forth Reference
  5879.  
  5880.  
  5881.      TASK           ( -- )
  5882.                     does nothing -- last word in dictionary.  Often used in
  5883.                     form : TASK ;  ... FORGET TASK
  5884.  
  5885.      TEN            ( -- 10 )
  5886.                     no matter what BASE is, you always get a decimal 10.
  5887.                     c.f. 10 SIXTEEN
  5888.  
  5889.      THEN           ( -- : executing )
  5890.                     ( backaddr 2 : compiling )
  5891.                     Used in the form:
  5892.                                  flag IF ... ELSE ... THEN
  5893.                               or
  5894.                                  flag IF ... THEN
  5895.                     THEN is the point where execution continues after ELSE,
  5896.                     or IF when no ELSE is present.  In earlier versions of
  5897.                     Forth THEN was sometimes called ENDIF.  For a long
  5898.                     while there was a battle between the logicians who
  5899.                     thought ENDIF more closely described this function, and
  5900.                     the people who hate typing who like the nice short
  5901.                     THEN.  The THEN folks finally prevailed.  If you want
  5902.                     old ENDIF back:
  5903.                     ' THEN ALIAS ENDIF IMMEDIATE
  5904.                     c.f. IF  ELSE
  5905.  
  5906.      THRU           ( n1 n2 -- )
  5907.                     Load multiple screens.  Loads screen n1 then n1+1 then
  5908.                     ... up to n2.  You have to decide on a method --> which
  5909.                     are embedded on the screens or using THRU.  You cannot
  5910.                     mix them.
  5911.                     c.f. LOAD
  5912.  
  5913.      TIB            ( -- addr )
  5914.                     The address of the text input buffer.  This buffer is
  5915.                     used to hold characters when the input stream is coming
  5916.                     from the current input device.  The capacity of TIB is
  5917.                     132 characters.
  5918.                     pronounced "t-i-b"
  5919.  
  5920.      TOGGLE         ( addr 8-bit-mask -- )
  5921.                     Toggles the bits in the byte at addr using the mask.
  5922.                     Only the bits corresponding to ones in the mask get
  5923.                     toggled.  Toggling means changing all ones to zeros and
  5924.                     all zeros to ones.  Effectively does a C@ of the addr,
  5925.                     then XOR with the mask then C!.  Most commonly used to
  5926.                     turn or or off the IMMEDIATE bit in the nfa.
  5927.                     c.f. XOR SMUDGE UNSMUDGE
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.           \BBL\BBL.DOC  -90-  last updated 1986 October 14 21:30
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944. BBL Forth Reference
  5945.  
  5946.  
  5947.      TOKEN!         ( cfa addr2 -- )
  5948.                     store the cfa as a 16-bit token at addr2.  .  The cfa
  5949.                     must either me a standard cfa with the segment portion
  5950.                     equal to CS: or a relative address.  Addr2 is not
  5951.                     necessarily canonical, but is usually at an even
  5952.                     address.  The actual code for TOKEN! is the same as the
  5953.                     code for W!, but we use TOKEN! in preference to make it
  5954.                     clear we are storing a token.  This will make it easier
  5955.                     to modify the code later if ever the tokenizing scheme
  5956.                     is changed.
  5957.                     c.f. TOKEN@ TOKEN, W! @
  5958.                     pronounced "token-bang"
  5959.  
  5960.      TOKEN,         ( cfa --- )
  5961.                     Compiles the cfa as a 16-bit token into the pfa portion
  5962.                     of the dictionary. .  The cfa must either me a standard
  5963.                     cfa with the segment portion equal to CS: or a relative
  5964.                     address.  Addr2 is not necessarily canonical, but is
  5965.                     usually at an even address.  The actual code for TOKEN,
  5966.                     is the same as the code for W, but we use TOKEN, in
  5967.                     preference to make it clear we are compiling a token.
  5968.                     This will make it easier to modify the code later if
  5969.                     ever the tokenizing scheme is changed.
  5970.                     c.f. TOKEN! TOKEN@ W,
  5971.                     pronounced "token-comma"
  5972.  
  5973.      TOKEN@         ( addr1 -- cfa )
  5974.                     fetches 16-bit token and fluffs it up to an absolute
  5975.                     address by prefixing the offset with a segment equal to
  5976.                     CS:.  Note this is not synonymous with W@.
  5977.                     c.f. TOKEN! TOKEN,
  5978.  
  5979.      TRIM-NUM       ( D -- D or n )
  5980.                     trims double to single if DPL=-1.  Used by INTERPRET
  5981.                     after NUMBER to handle literals.
  5982.  
  5983.      TUCK           ( n1 n2 -- n2 n1 n2 )
  5984.                     duplicates the top of the data stack and squirrels it
  5985.                     away deep in the data stack.  Equivalent to but faster
  5986.                     than DUP ROT ROT
  5987.                     c.f. NIP DUP ROT TUCK
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.           \BBL\BBL.DOC  -91-  last updated 1986 October 14 21:30
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010. BBL Forth Reference
  6011.  
  6012.  
  6013.      TYPE           ( addr +w -- )
  6014.                     +w characters are displayed from memory beginning with
  6015.                     the character at addr and continuing through
  6016.                     consecutive addresses.  Nothing is displayed if +n is
  6017.                     zero.  Addr must cover the string and +w must be under
  6018.                     64K.  TYPE can be redirected to the screen with CONSOLE
  6019.                     or to the printer with PRINTER.  TYPE is defined as an
  6020.                     optimized version of : TYPE 'TYPE @ EXECUTE ;  Thus you
  6021.                     can redirect TYPE by providing your own type routine
  6022.                     and vectoring it in with ['] MY-TYPE 'TYPE !.  Normally
  6023.                     when you redirect TYPE you also redirect EMIT.
  6024.                     c.f. 'TYPE CONSOLE PRINTER STYPE PTYPE EMIT 'EMIT SEMIT
  6025.                     PEMIT GTYPE.
  6026.  
  6027.  
  6028.      **U**          words that begin with U
  6029.  
  6030.      U.             ( u -- )
  6031.                     u is displayed as an unsigned number in a free-field
  6032.                     format.
  6033.                     pronounced "u-dot"
  6034.  
  6035.      U.             ( u --- : prints a 32-bit unsigned number followed by a
  6036.                     space )
  6037.  
  6038.      U.R            ( u +n -- )
  6039.                     u is converted using the value of BASE and then
  6040.                     displayed as an unsigned number right aligned in a
  6041.                     field +n characters wide.  If the number of characters
  6042.                     required to display u is greater than +n, an error
  6043.                     condition exists.
  6044.                     c.f. number conversion
  6045.                     pronounced "u-dot-r"
  6046.  
  6047.      U/             ( num-32 denom-32 -- quot-32 )
  6048.                     Unsigned floored division giving just the quotient.  To
  6049.                     get the remainder as well use U/MOD.  To get just the
  6050.                     remainder use UMOD.  The slower signed version is
  6051.                     called /.
  6052.                     c.f. division U/MOD UMOD /
  6053.                     pronounced "u-slash"
  6054.  
  6055.      U/MOD          ( num-32 denom-32 -- rem-32 quot-32 )
  6056.                     Unsigned floored division.  To get just the remainder
  6057.                     use UMOD.  To get just the quotient use U/.  The slower
  6058.                     running signed version is called /MOD.
  6059.                     c.f. division Q/MOD UMOD U/ /MOD
  6060.                     pronounced "u-slash-mod"
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.           \BBL\BBL.DOC  -92-  last updated 1986 October 14 21:30
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076. BBL Forth Reference
  6077.  
  6078.  
  6079.      U<             ( u1 u2 -- flag )
  6080.                     flag is true is u1 is less than u2 using unsigned
  6081.                     compares.  See the warning about comparing addresses.
  6082.                     c.f. <  U<= D< <= > U> D> >= = D= <> MIN MAX NOT 0< 0<=
  6083.                     0> 0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  6084.                     pronounced "u-less-than"
  6085.  
  6086.      U<=            ( u1 u2 -- flag )
  6087.                     flag is true is u1 is less or equal to u2 using
  6088.                     unsigned compares.  See the warning about comparing
  6089.                     addresses.
  6090.                     c.f. <=  U<= D< < > U> D> >= = D= <> MIN MAX NOT 0< 0<=
  6091.                     0> 0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  6092.                     pronounced "u-less-or-equal"
  6093.  
  6094.      U>             ( u1 u2 -- flag )
  6095.                     true if u1 is greater than n2 using unsigned compares.
  6096.                     See the warning about comparing addresses.
  6097.                     c.f. < U< D< <= > D> >= = D= <> MIN MAX NOT 0< 0<= 0>
  6098.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  6099.                     pronounced "u-greater"
  6100.  
  6101.      U>=            ( u1 u2 -- flag )
  6102.                     true if u1 is greater than or equal to n2 using
  6103.                     unsigned compares.  See the warning about comparing
  6104.                     addresses.
  6105.                     c.f. >= < U< D< <= > D> = D= <> MIN MAX NOT 0< 0<= 0>
  6106.                     0>= 0= D0= 0<> AND NAND OR NOR XOR NEGATE
  6107.                     pronounced "u-greater-or-equal"
  6108.  
  6109.      UM*            ( u1 u2 -- ud : 32-bit * 32-bit = 64-bit unsigned )
  6110.                     ud is the unsigned product of u1 times u2.  All values
  6111.                     and arithmetic are unsigned.
  6112.                     pronounced "u-m-star"
  6113.  
  6114.      UM/            ( num-64 denom-32 -- quotient-32 : unsigned floored
  6115.                     division )  To get both the remainder and quotient use
  6116.                     UM/MOD.  To get just the remainder use UMMOD.  The
  6117.                     slower-running signed version is called M/.
  6118.                     c.f. division UM/MOD UMMOD M/
  6119.                     pronounced "u-m-slash"
  6120.  
  6121.      UM/MOD         ( num-64 denom-32 -- rem-32 quot-32 unsigned floored
  6122.                     division )
  6123.                     DON'T CONFUSE THIS WITH MU/MOD which gives 64-bit
  6124.                     quotient.  To get just the remainder use UMMOD.  To get
  6125.                     just the quotient, use UM/.  The slower-running signed
  6126.                     version is called M/MOD.
  6127.                     c.f. division UMMOD UM/ M/MOD
  6128.                     pronounced "u-m-divide-mod"
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.           \BBL\BBL.DOC  -93-  last updated 1986 October 14 21:30
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142. BBL Forth Reference
  6143.  
  6144.  
  6145.      UM/MOD-OVL     ( num-64 denom-32 -- rem-32 quot-32 unsigned floored
  6146.                     division ) Handles overflow case for UM/MOD.  Not
  6147.                     normally called directly but will work faster than
  6148.                     UM/MOD if you know there will be overflow.  To get just
  6149.                     the remainder use UMMOD.  To get just the quotient, use
  6150.                     UM/.  The slower-running signed version is called
  6151.                     M/MOD.
  6152.                     c.f. division UMMOD UM/ M/MOD
  6153.                     pronounced "u-m-slash-mod-oval"
  6154.  
  6155.      UMOD           ( num-32 denom-32 -- rem-32)
  6156.                     uses unsigned floored division to get the remainder.
  6157.                     To get both the remainder and quotient use U/MOD.  To
  6158.                     get just the quotient use U/.  Note that UMOD is faster
  6159.                     than the signed version called MOD.
  6160.                     c.f. division MOD QMOD U/MOD U/ MOD.
  6161.  
  6162.      uncreate       ( -- )
  6163.                     Not normally used by programmers.  Unallots the code at
  6164.                     the cfa put there by CREATE so that some other code can
  6165.                     be put there instead.  CREATE places an 11-byte inline
  6166.                     cfa.
  6167.  
  6168.      UNSMUDGE       ( -- )
  6169.                     makes the latest definition visible by clearing the
  6170.                     smudge bit in the nfa.  CREATE does a built-in
  6171.                     UNSMUDGE.  Colon SMUDGEs the current definition name
  6172.                     and semicolon UNSMUDGEs it.
  6173.  
  6174.      UNTIL          ( flag -- )
  6175.                     ( BEGIN addr 1 UNTIL --) ( compiling )
  6176.                     Used in the form:
  6177.                               BEGIN ... flag UNTIL
  6178.                     Marks the end of a BEGIN-UNTIL loop which will
  6179.                     terminate based on flag.  If flag is true, the loop is
  6180.                     terminated.  If flag is false, execution continues to
  6181.                     just after the corresponding BEGIN.  A BEGIN-UNTIL loop
  6182.                     runs at least once.  In contrast a BEGIN WHILE REPEAT
  6183.                     loop may execute the loop zero times.
  6184.                     c.f. BEGIN WHILE REPEAT.
  6185.  
  6186.      UPDATE         ( -- : marks most recently BLOCKed buffer as
  6187.                     changed/dirty)
  6188.                     The currently valid block buffer is marked as modified.
  6189.                     Blocks marked as modified will subsequently be
  6190.                     automatically transferred to mass storage should its
  6191.                     memory buffer be needed for storage of a different
  6192.                     block or upon execution of FLUSH or SAVE-BUFFERS.
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.           \BBL\BBL.DOC  -94-  last updated 1986 October 14 21:30
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208. BBL Forth Reference
  6209.  
  6210.  
  6211.      USING          ( used in form USING C:\BBL\FORTH.BLK )
  6212.                     FLUSHes the current cache buffers and closes the cache
  6213.                     file.  Then it reopens it with the given external DOS
  6214.                     file name.
  6215.                     c.f. CACHE-NAME OPEN-CACHE CLOSE-CACHE BLOCK BUFFER
  6216.                     EMPTY-BUFFERS FLUSH SAVE-BUFFERS LAST-SCR
  6217.  
  6218.      UT@            ( addr -- ut )
  6219.                     fetches 3-byte 24-bit unsigned value stored it RAM at
  6220.                     addr with no sign extension.  The value stored least
  6221.                     significant byte first in memory. T! is used to store
  6222.                     both signed and unsigned 24-bit quantities.
  6223.                     c.f.  T@ T! @
  6224.  
  6225.      UW@            ( addr -- uw )
  6226.                     fetches 2-byte 16-bit unsigned value stored in RAM at
  6227.                     addr with no sign extension.  The value stored least
  6228.                     significant byte first in memory.   W! is used to store
  6229.                     both signed and unsigned 16-bit quantities.
  6230.                     c.f.  W@ W! @
  6231.  
  6232.  
  6233.      **V**          words that begin with V
  6234.  
  6235.      VARIABLE       ( -- )
  6236.                     A defining word executed in the form:
  6237.                          VARIABLE <name>
  6238.                     A dictionary entry for <name> is created and four bytes
  6239.                     (32 bits) are allotted in its parameter field.  This
  6240.                     parameter field is to be used for contents of the
  6241.                     variable.  The application is responsible for
  6242.                     initializing the contents of the variable which it
  6243.                     creates if it is other than 0.  When <name> is later
  6244.                     executed, the address of its parameter field is placed
  6245.                     on the data stack.  Watch out the FORTH-79 used to be 0
  6246.                     VARIABLE X, rather than VARIABLE X.
  6247.                     c.f. QVARIABLE
  6248.  
  6249.      VOC-LINK       ( --- addr )
  6250.                     a variable that contains the head of the VOC-LINK
  6251.                     chain.  This chain threads all the vocabularies
  6252.                     together independently of the current search order.
  6253.                     VOC-LINK @ points to the back pointer in the newest
  6254.                     vocabulary.  VOC-LINK @ 4- points to the pfa of the
  6255.                     newest vocabulary.
  6256.                     c.f. FOR-EACH-VOC VOCABULARY
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.           \BBL\BBL.DOC  -95-  last updated 1986 October 14 21:30
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274. BBL Forth Reference
  6275.  
  6276.  
  6277.      VOC-LIST       ( -- )
  6278.                     lists all possible vocabularies along with a few facts
  6279.                     about them.  This list includes vocabularies not
  6280.                     currently being searched.  In contrast ORDER shows only
  6281.                     those vocabularies currently being searched.
  6282.                     c.f. VOCABULARY ORDER FOR-EACH-VOC
  6283.  
  6284.      VOC-SIZE       ( -- addr )
  6285.                     The name of a variable that contains the size in bytes
  6286.                     to allocate to newly created vocabulary regions.  You
  6287.                     must set the VOC-SIZE before you define the new
  6288.                     vocabulary e.g.
  6289.                     2048 VOC-SIZE !  VOCABULARY MY-VOC
  6290.                     VOC-SIZE is also used by REBUILD-VOC to determine the
  6291.                     new size of a rebuilt existing vocabulary.  The maximum
  6292.                     size a vocabulary can have is 65520 bytes, and the
  6293.                     minimum size is 96 bytes.  VOC-SIZE must be a multiple
  6294.                     of 16.  If for any reason you violate these
  6295.                     constraints, VOC-SIZE will be automatically adjusted to
  6296.                     a reasonable value just prior to creating a new
  6297.                     vocabulary.  Note that the vocabulary region contains
  6298.                     only the names of words, -- not their definitions.  The
  6299.                     vocabulary region contains the nfas (name field
  6300.                     addresses) and lfas (link field addresses) and hashing
  6301.                     threads.  The pfas (parameter field addresses) forming
  6302.                     the body of the definition goes in a different segment.
  6303.                     The cfas (code field addresses) go in yet another
  6304.                     segment.  In practice then the 65520 byte limit per
  6305.                     vocabulary should never cause a problem.  As well as
  6306.                     determining the size of the area reserved for the
  6307.                     vocabulary storage region, VOC-SIZE indirectly
  6308.                     determines the number of hashing threads.  The more
  6309.                     hashing threads the faster the compilation because
  6310.                     there are fewer words on each thread to search during a
  6311.                     FIND.  The number of hashing threads is calculated by
  6312.                     dividing the VOC-SIZE by 10 then rounding up to the
  6313.                     next power of 2 e.g. 16, 32, 64, ... 4096.  Finally the
  6314.                     number of threads in corralled to a value between 16
  6315.                     and 4096.
  6316.                     c.f. VOCABULARY REBUILD-VOC HERER
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.           \BBL\BBL.DOC  -96-  last updated 1986 October 14 21:30
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340. BBL Forth Reference
  6341.  
  6342.  
  6343.      VOCABULARY     ( -- )
  6344.                     ( VOCABULARY XX -- : create a new vocabulary )
  6345.                     Run time code when the new vocabulary e.g. EDITOR
  6346.                     executes it makes this vocabulary the first context
  6347.                     vocabulary searched for words.  It does not effect the
  6348.                     resident context or the CURRENT vocabulary where new
  6349.                     definitions are placed.  New vocabularies are not
  6350.                     usually IMMEDIATE, unless you append the word
  6351.                     IMMEDIATE. New vocabularies are usually placed in the
  6352.                     ONLY vocabulary e.g. ONLY DEFINITIONS  VOCABULARY MY-
  6353.                     VOC.  If you want a legalistic definition, VOCABULARY
  6354.                     is a defining word executed in the form:
  6355.                          VOCABULARY <name>
  6356.                     A dictionary entry for <name> is created which
  6357.                     specifies a new ordered list of word definitions.
  6358.                     Subsequent execution of <name> replaces the first
  6359.                     vocabulary in the search order with <name>.  When
  6360.                     <name> becomes the compilation vocabulary new
  6361.                     definitions will be appended to <name>'s list.
  6362.                     c.f. DEFINITIONS  CURRENT CONTEXT ONLY ALSO FOR-EACH-
  6363.                     VOC VOC-LINK
  6364.  
  6365.  
  6366.      **W**          words that begin with W
  6367.  
  6368.      W!             ( 16b address -- )
  6369.                     Stores low order 16 bits at address.  Value is MSW on
  6370.                     top of the data stack, LSW first in memory.  Address is
  6371.                     seg:offset -- not necessarily canonical.  Works on both
  6372.                     signed and unsigned quantities.
  6373.                     c.f. W@ UW@ !
  6374.                     pronounced "w-bang"
  6375.  
  6376.      W,             ( w --- )
  6377.                     Compiles a 16-bit value into pfa dictionary.
  6378.                     c.f. , W,C
  6379.  
  6380.      W,C            ( w --- )
  6381.                     Not normally used by programmers.  Compiles a 16-bit
  6382.                     value into cfa dictionary.  The only time you would use
  6383.                     this word is if you were generating assembler code.
  6384.  
  6385.      W><            ( n1 -- n2)
  6386.                     n2 is n1 with high and low 16-bit words swapped.
  6387.                     c.f. ><
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.           \BBL\BBL.DOC  -97-  last updated 1986 October 14 21:30
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406. BBL Forth Reference
  6407.  
  6408.  
  6409.      W@             ( addr -- value-16bits )
  6410.                     fetches 2 bytes - sign extended.  Value is MSW on top
  6411.                     of the data stack, LSW first in memory.  UW@ does not
  6412.                     sign extend.  Thus W@ is used for signed quantities and
  6413.                     UW@ for unsigned ones.  W! is used to store both signed
  6414.                     and unsigned 16-bit quantities.
  6415.                     c.f. UW@ W! @
  6416.  
  6417.      WHILE          ( flag -- )
  6418.                     ( BEGIN addr 1 WHILE addr 4 REPEAT) (compiling)
  6419.                     used in the form:
  6420.                          BEGIN ... flag WHILE ...REPEAT
  6421.                     Selects conditional execution based on flag.  When flag
  6422.                     is true, execution continues to just after the WHILE
  6423.                     through to the REPEAT which then continues execution
  6424.                     back to just after the BEGIN.  When flag is false,
  6425.                     execution continues to just after the REPEAT, exiting
  6426.                     the control structure.  In this implementation LEAVE
  6427.                     cannot be used to EXIT a BEGIN WHILE REPEAT loop.
  6428.                     c.f. BEGIN REPEAT UNTIL.
  6429.  
  6430.      WORD           ( char -- addr )
  6431.                     Parses next word in the input stream.  Generates a
  6432.                     counted string by non-destructively accepting
  6433.                     characters from the input stream until the delimiting
  6434.                     character char is encountered or the input stream is
  6435.                     exhausted.  Leading delimiters are ignored.  The entire
  6436.                     character string is stored in memory beginning at addr
  6437.                     (built at HEREB not HERE) as a sequence of bytes.  The
  6438.                     string is followed by a blank which is not included in
  6439.                     the count.  The first byte of the string is the number
  6440.                     of characters {0..255}.  If the string is longer than
  6441.                     255 characters, the count is unspecified.  If the input
  6442.                     stream is already exhausted as WORD is called, then a
  6443.                     zero length character string will result.  If the
  6444.                     delimiter is not found the value of >IN is the size of
  6445.                     the input stream.  If the delimiter is found >IN is
  6446.                     adjusted to indicate the offset to the character
  6447.                     following the delimiter.  #TIB is unmodified.  The
  6448.                     counted string returned by WORD resides at HEREB in the
  6449.                     vocabulary region not at HERE -- all ready to be
  6450.                     converted to an NFA, but it is not ready to be
  6451.                     converted to an inline literal until it is moved to
  6452.                     HERE.
  6453.                     c.f. ENCLOSE BLK >IN
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.           \BBL\BBL.DOC  -98-  last updated 1986 October 14 21:30
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472. BBL Forth Reference
  6473.  
  6474.  
  6475.      WORDS          ( -- )
  6476.                     Display the word names in the CONTEXT transient
  6477.                     vocabulary, starting with the most recent definition.
  6478.                     It prints out the words in just one vocabulary -- not
  6479.                     all the vocabularies in the current search order.  The
  6480.                     display can be paused by hitting Ctrl-Numlock.  The
  6481.                     display can be interrupted by hitting any other key.
  6482.                     Usually used in the form: MY-VOC WORDS
  6483.                     c.f. ORDER VOC-LIST VOCABULARY FOR-EACH-VOC
  6484.  
  6485.      WSCAN          ( addr len w -- index of found WORD, true: if found )
  6486.                     ( addr len w -- false : if not found )
  6487.                     Scans string left to right searching for 16-bit w. Left
  6488.                     most WORD is index 0, next is 1. i.e. offsets and
  6489.                     counts in words not bytes.
  6490.                     c.f. SCAN SCAN<>
  6491.  
  6492.  
  6493.      **X**          words that begin with X
  6494.  
  6495.      XOR            ( n1 n2 -- exclusive-or on all 32 bits )
  6496.                     b3 is the exclusive logical or of b1 and b2.  For
  6497.                     example BINARY 1100 0101 XOR is 1001 i.e. the result is
  6498.                     0 where the bits match and 1 where they differ.  If you
  6499.                     use canonical flags, this bit-wise XOR behaves just
  6500.                     like "or ... but not both" in English.  In particular
  6501.                     if n1 and n2 are canonical flags (0 or -1) then:
  6502.                     true  true  -- false
  6503.                     false true  -- true
  6504.                     true  false -- true
  6505.                     false false -- false
  6506.                     If you are comparing canonical flags, XOR is a faster
  6507.                     equivalent to <>.
  6508.                     XOR has a magical property useful in encryption.  If K
  6509.                     is a secret key, and M is a message then M K XOR is a
  6510.                     scrambled version of that message.  To descramble the
  6511.                     message you simply K XOR again and out pops M.
  6512.                     For doubly linked lists you need to store both forward
  6513.                     and backward pointers.  But if you are short of space,
  6514.                     you can store  both pointers in the same slot by
  6515.                     storing the XOR of the forward and back pointers.  You
  6516.                     can then reconstruct the forward pointer by XORing with
  6517.                     the known back pointer and visa versa.
  6518.                     Xor has the following properties:
  6519.                     A xor A = 0
  6520.                     A xor B = B xor A
  6521.                     A xor -1 = not A
  6522.                     A xor 0 = A
  6523.                     c.f. <> OR NOR AND NAND NOT
  6524.                     pronounced "x-or"
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.           \BBL\BBL.DOC  -99-  last updated 1986 October 14 21:30
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538. BBL Forth Reference
  6539.  
  6540.  
  6541.      **Y**          words that begin with Y
  6542.  
  6543.  
  6544.      **Z**          words that begin with Z
  6545.  
  6546.  
  6547.      **[**          words that begin with [
  6548.  
  6549.      [              ( -- : suspend compilation )
  6550.                     Sets interpret state.  The text from the input stream
  6551.                     is subsequently interpreted  i.e. we are effectively
  6552.                     executing  not compiling a colon definition.
  6553.                     Implemented as STATE OFF
  6554.                     Most often used in the form
  6555.                     [ x y + ] LITERAL to evaluate expressions at compile
  6556.                     time to literals.
  6557.                     c.f. ] STATE
  6558.                     pronounced "left-bracket"
  6559.  
  6560.      [']            ( -- cfa )
  6561.                     ( -- ) (compiling)
  6562.                     Used in the form:
  6563.                          ['] <name>
  6564.                     Compiles the compilation address addr of <name> as a
  6565.                     literal.  When the colon definition is later executed
  6566.                     the cfa is left on the data stack.  An error condition
  6567.                     exists if <name> is not found in the currently active
  6568.                     search order.  When you are outside a colon definition
  6569.                     you have to use ' <name> instead.  I.e. Use : X ['] Y
  6570.                     EXECUTE ; and ' Y EXECUTE outside colon definitions.
  6571.                     Warning! in Forth79 ' was STATE-smart and returned the
  6572.                     pfa instead of the cfa.
  6573.                     c.f. LITERAL ' EXECUTE PERFORM
  6574.                     pronounced "bracket-tick"
  6575.  
  6576.      [COMPILE]      ( -- )
  6577.                     ( -- ) (compiling)
  6578.                     Used in the form:
  6579.                          [COMPILE] <name>
  6580.                     Forces compilation of the following word <name>.  This
  6581.                     allows immediate compilation of an immediate word when
  6582.                     it would otherwise have been executed.  Usually found
  6583.                     in the definition of a new immediate word that is a
  6584.                     variant of some existing immediate word -- e.g. a new
  6585.                     kind of IF that does the same thing as the old IF but a
  6586.                     little bit extra.
  6587.                     c.f. COMPILE [ ] IMMEDIATE
  6588.                     pronounced "bracket-compile"
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.           \BBL\BBL.DOC  -100-  last updated 1986 October 14 21:30
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604. BBL Forth Reference
  6605.  
  6606.  
  6607.      \              ( -- )
  6608.                     The rest of line is treated as a comment.  Must be
  6609.                     followed by at least one blank.   Can only be used on
  6610.                     screens, not when keying directly.
  6611.                     c.f. ( )
  6612.  
  6613.  
  6614.      **]**          words that begin with ]
  6615.  
  6616.      ]              ( - : resume compilation )
  6617.                     Sets compilation state.  The text from the input stream
  6618.                     is subsequently compiled.  I.e. we are effectively back
  6619.                     inside a colon definition.  Implemented as STATE ON.
  6620.                     Most often used in the form
  6621.                     [ x y + ] LITERAL to evaluate expressions at compile
  6622.                     time to literals.
  6623.                     c.f. [ STATE
  6624.                     pronounced "right-bracket"
  6625.  
  6626.  
  6627.      **^**          words that begin with ^
  6628.  
  6629.  
  6630.      **_**          words that begin with _
  6631.  
  6632.      _              ( -- ) at compile time
  6633.                     ( -- c ) at run time.
  6634.                     Used to create character literals.  _ A compiles the
  6635.                     constant 65. At run time, the literal is placed on the
  6636.                     stack. _ is a synonym for ASCII. A state-smart literal
  6637.                     that can be used inside or outside colon definitions.
  6638.                     c.f. ASCII
  6639.  
  6640.  
  6641.      **`**          words that begin with `
  6642.  
  6643.  
  6644.      **{**          words that begin with {
  6645.  
  6646.  
  6647.      **|**          words that begin with |
  6648.  
  6649.  
  6650.      **}**          words that begin with }
  6651.  
  6652.  
  6653.      **~**          words that begin with ~
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.           \BBL\BBL.DOC  -101-  last updated 1986 October 14 21:30
  6663.  
  6664.  
  6665.  
  6666.  
  6667.