LanBox/ForthHelp

From NURDspace
Revision as of 02:57, 11 April 2015 by Zmatt (talk | contribs) (Dump of lcxforth built-in help, with some styling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
<<< ( -- ) Hans Ext
Add information to the help system.
The keyword to describe is the first word on the line following the <<< word.
Help text is stored in the linked list with help information until a text-line
that contains only the string >>> is encountered. The linked list with help-
information can be searched with HELP.

HELP <key> ( -- ) Hans Ext
Give some useful information about a forth word. The linked list with help
information (build with <<<) is searched for a match with the key.  All help
information on keywords that contain the key is displayed.

HELPALL ( -- ) Hans Ext
Display all availabe help information.

ABA? ( -- ) Hans Ext
Display the status of the Application Binding Active flag.
When this flag is true, it is not allowed to alter the current forth program
without a cold-start of the system software.

ABA ( -- ) Hans Ext
Set the ABA flag.

[ELSE] ( *<spaces>name...* -- ) Tools Ext
Skipping leading spaces, parse and discard words from the parse area, including
nested [IF] ... [THEN] and [IF] ...  [ELSE] ... [THEN], until the word [THEN]
has been parsed and discared.

[IF] ( flag | flag *<spaces>name...* -- ) Tools Ext
If flag is true, do nothing. Otherwise, Skipping leading spaces, parse and
discard words from the parse area, including nested [IF] ... [THEN] and [IF]
... [ELSE] ...  [THEN], until either the word [ELSE] or [THEN] has been parsed
and discared.

[THEN] ( -- ) Tools Ext
Do nothing.

SET-CURRENT ( wid -- ) Search
Set the compilation wordlist to the wordlist identified by wid.

DEFINITIONS ( -- ) Search
Make the compilation wordlist the same as the first wordlist in the search
order.

GET-ORDER ( -- widn .. wid1 n ) Search
Return the number of wordlist in the search order and the wordlist identifiers
widn ... wid1 .

SET-ORDER ( widn .. wid1 n -- ) Search
Set the search order to the wordlist identified by widn ...  wid1. Later
wordlist wid1 will be searched first, with wordlist widn searched last. If n is
0, empty the search order. If n is -1, set the search order to the
implementation-defined minimum search order.

WORDLIST ( -- wid ) Search
Create a new empty wordlist and return its identifier wid.
structure of a wordlist:
//lastWord/next_wordlist/wordlist_name//

ALSO ( -- ) Search Ext
Transform the search order widn ... wid2, wid1 into widn ...  wid2, wid1, wid1.

FORTH ( -- )
Transform the search order widn ... wid2, wid1 into widn ...  wid2,
wid_FORTH-WORDLIST.

ONLY ( -- )
Set the search order to the implementation-defined minimum search order.

PREVIOUS ( -- )
Transform the search order widn ... wid2, wid1 into widn ... wid2.

.name ( c-addr -- )
Display name of a word.

WORDLIST-NAME <name> ( wid -- )
Name a wordlist. Used to attach a name to a new wordlist returned by WORDLIST
to be displayed by ORDER.

.wordlist ( c-addr -- )
Display name of a wordlist.

ORDER ( -- ) Search Ext
Display the wordlists in the search order from the first to the last. Also
display the wordlist into which new definitions will be placed.

.( <string>) ( -- ) Core Ext
Output following string up to next ).

D.R ( d n -- ) Double
Display d right-justified in field of width n.

.R ( n1 n2 -- ) Core Ext
Display n right-justified in field of width n2.

FALSE ( -- false ) Core Ext
Return a false flag.

HEX ( -- ) Core Ext
Set contents of BASE to sixteen.

U> ( u1 u2 -- flag ) Core Ext
flag is true if and only if u1 is greater than u2.

MARKER <name> ( -- ) Core Ext
Create a definition with name. The new definition will restore on execution all
dictionary allocations and search order pointers to the state they had just
prior to the definition of name.

PAD ( -- a-addr ) Core Ext
Return the address of a temporary buffer. See REFILL
|PAD|TIB|RAMTop

TRUE ( -- true ) Core Ext
Return a true flag.

U.R ( u n -- ) Core Ext
Display u right-justified in field of width n.

CASE ( C: -- case-sys ) Run-time: ( -- ) Core Ext
Mark the start of CASE ... OF ... ENDOF ... ENDCASE structure.
On run-time, continue execution.

ENDCASE ( C: case-sys -- ) Run-time: ( x -- ) Core Ext
Mark the end of CASE ... OF ... ENDOF ... ENDCASE structure.
On run-time, discard the case selector x and continue execution.

OF ( C: -- of-sys ) Run-time: ( x1 x2 -- |x1 ) Core Ext
Mark the start of OF ... ENDOF part of CASE structure.
On run-time if two values on the stack are not equal, discard
the top value and continue execution following the next ENDOF.
Otherwise discard both values and continue execution in line.

ENDOF ( C: case-sys1 of-sys -- case-sys2 ) Run-time: ( -- ) Core Ext
Mark the end of OF ... ENDOF part of CASE structre.
On run-time, continue execution following ENDCASE .

UNUSED ( -- u ) Core Ext
Return available data space in address units.

.S ( -- ) Tools
Display the values on the data stack.

? ( a-addr -- ) Tools
Display the contents at a-addr.

enough? ( -- flag )
Return false if no input, else pause and if CR return true.

DUMP ( addr u -- ) Tools
Display the contents of u consecutive address units starting at addr.

.dec ( n -- )
Display a decimal number.

.hex ( n -- )
Display a hex number.

WORDLIST-WORDS ( wid -- )
List the definition names in wordlist identified by wid.

NONSTANDARD-WORDS ( -- )
List the definition names in NONSTANDARD-WORDLIST.

WORDS ( -- ) Tools
List the definition names in the first wordlist of the search order.

WhereAmI? ( addr -- c-addr ) Hans Ext
Finds the definition that the instruction on addr is part of.
Returns the address of the definitions name string.

<> ( x1 x2 -- flag ) Core Ext
Return false if x1 is the same as x2.

0<> ( x -- flag ) Core Ext
flag is true if and only if x is not equal to zero.

0> ( n -- flag ) Core Ext
flag is true if and only if n is greater than zero.

2>R ( x1 x2 -- ) ( R: -- x1 x2 ) Core Ext
Transfer cell pair to the return stack.

2R> ( -- x1 x2 ) ( R: x1 x2 -- ) Core Ext
Transfer cell pair from the return stack.

2R@ ( -- x1 x2 ) ( R: x1 x2 -- x1 x2 ) Core Ext
Copy cell pair from the return stack.

C" <string>" ( -- ) Run-time: ( -- c-addr )
Parse ccc delimetered by " . Return the counted string, c-addr.

ROLL ( xu xu-1 ... x0 u -- xu-1 ... x0 xu ) Core Ext
Remove u.  Rotate u+1 items on the top of the stack.  An
ambiguous condition exists if there are less than u+2 items
on the stack before ROLL is executed.

TUCK ( x1 x2 -- x2 x1 x2 ) Core Ext
Copy the first (top) stack item below the second stack item.

U> ( u1 u2 -- flag ) Core Ext
flag is true if and only if u1 is greater than u2.

CSTRING" <string>" ( -- ) Run-time: ( -- c-addr ) Hans Ext
Compile a C-string.

DEF-PB <string> ( bytesize -- ) Run-time: ( -- a-addr ) Hans Ext
define a Parameter Block, only used for synchronious system calls.

DEF-CPB <string> ( bytesize -- ) Run-time: ( -- a-addr ) Hans Ext
define a Complex Parameter Block. A CPB is used only once when it
is used, ABA is set true.

PBCALL ( -- result ) Hans Ext
Execute a system trap. The used Parameter Block is selected with WITH.
An error is returned when a CPB is used for the second time.

RESET-CPB ( -- ) Hans Ext
Reset the used & enabled flags in all CPB's. This is only allowed after a cold
system startup.

BYE ( -- ) Hans Ext
Leave Forth and activate the system command prompt.

DISABLE ( -- ) Hans Ext
Disable all processor interrupts.

ENABLE ( -- ) Hans Ext
Enable all processor interrupts.

! ( x a-addr -- ) Core
Store x in the cell at a-addr. "store"

+ ( n1 n2 -- n3 ) Core
Add n1 to n2, leaving the sum n3. "plus"

+! ( n a-addr -- ) Core
Add n to the contents of the cell at a-addr.  "plus-store"

- ( n1 n2 -- n3 ) Core
Subtract n2 from n1, leaving the difference n3. "minus"

0< ( n -- flag ) Core
Return true if n is less than zero.  "zero-less-than"

0= ( n -- flag ) Core
Return true if n is equal to zero.  "zero-equal"

1+ ( n1 -- n2 ) Core
Add one to n1, leaving n2. "one-plus"

1- ( n1 -- n2 ) Core
Subtract one from n1, leaving n2. "one-minus"

2* ( x1 -- x2 ) Core
Return x2, the result of shifting x1 one bit toward the most-significant bit,
filling the least-significant bit with zero (same as 1 LSHIFT). "two-star"

2/ ( x1 -- x2 ) Core
Return x2, the result of shifting x1 one bit towards the least-significant bit,
leav-ing the most-significant bit unchanged. "two-slash"

>R ( x -- ) ( R: -- x ) Core
Remove the item on top of the data stack and put it onto the return stack.
"to-R"

@ ( a-addr -- x ) Core
Replace a-addr with the contents of the cell at a-addr. "fetch"

AND ( x1 x2 -- x3 ) Core
Return x3, the bit-by-bit logical and of x1 with x2.

BIT! ( flag bitmask c-addr -- )
If flag is true, the bitpositions that are set in bitmask are set in the byte
at c-addr. else they are cleared.

BIT@ ( bitmask c-addr -- flag )
If one or more of the bitpositions that are set in bitmask are set in the byte
at c-addr, flag is true.

C! ( b c-addr -- ) Core
Store the low-order byte of the second stack
item at c-addr. "C-store"

C@ ( c-addr -- b ) Core
Replace c-addr with the contents of the byte
at c-addr. The byte fetched is stored in the low-order byte of the top
stack item, with the remaining bits cleared to zero. "C-fetch"

CELLS ( n1 -- n2 ) Core
Return n2, the size in bytes of n1 cells.

CHARS ( n1 -- n2 ) Core
Return n2, the size in bytes of n1 characters. On many systems, this word is a
no-op.

DROP ( x -- ) Core
Discard top stack item.

DUP ( x -- x x ) Core
Duplicate the top stack item.

EXECUTE ( i*x xt -- j*x ) Core
Remove execution token xt from the stack and perform the execution behavior it
identifies. Other stack effects are due to the word that is EXECUTEd.

EXIT ( -- ) ( R: nest-sys -- ) Core
Return control immediately to the calling definition specified by nest-sys.
Before executing EXIT, a program must remove any items explicitly stored on the
return stack. If EXIT is called within a DO ... LOOP, UNLOOP must be executed
first to discard the loop-control parameters.

MOVE ( addr1 addr2 u -- ) Core
Copy u bytes from a source starting at addr1 to the destination starting at
addr2. After the transfer, the destination area at addr2 contains exactly what
the source area addr1 did before the transfer. If the data areas overlap, the
original will not be preserved!

OR ( x1 x2 -- x3 ) Core
Return x 3 , the bit-by-bit inclusive or of x1 with x2.

OVER ( x1 x2 -- x1 x2 x1 ) Core
Copy second stack item to top of the stack.

R> ( -- x ) ( R: x -- ) Core
Remove the item on the top of the return stack and put it onto the data stack.
"R-from"

R@ ( -- x ) ( R: x -- x ) Core
Place a copy of the item on top of the return stack onto the data stack.
"R-fetch"

ROT ( x1 x2 x 3 -- x2 x3 x1 ) Core
Rotate the top three items on the stack.

SWAP ( x1 x2 -- x2 x1 ) Core
Exchange the top two items on the stack.

XOR ( x1 x2 -- x3 ) Core
Return x3, the bit-by-bit exclusive or of x1 with x2. The phrase -1 XOR is
equiv-alent to INVERT (one's complement of the input value).

# ( ud1 -- ud2 ) Core
Divide ud1 by BASE, giving the quotient ud2 and the remainder n. Convert n to
an ASCII character and append it to the beginning of the existing output
string. Must be used after <# and before #>. The first digit added is the
lowest-order digit (units), the next digit is the BASE digit, etc. Each time #
is used, a charac-ter is generated, even if the number to be converted is zero.
"number-sign"

#> ( ud -- c-addr u ) Core
Complete the conversion process after all digits have been converted. Discard
the (presumably) exhausted double-precision number, and push onto the stack the
address of the output string, with the count of bytes in this string above it.
"number-bracket"

#S ( ud1 -- ud2 ) Core
Convert digits from ud1 repetitively until all significant digits in the source
item have been converted, at which point conversion is completed, leaving ud2
(which is zero). Must be used after <# and before #>. #S always results in at
least one output character, even if the number to be converted is zero.
"number-sign-S"

' <name> ( -- xt ) Core
Search dictionary for name and leave its execution token on the stack. Abort if
name cannot be found. "tick"

( ( -- ) Core
Begin a comment. Stop compilation or interpretation and parse the characters
that follow, looking for a right parenthesis ) which closes the comment.

* ( n1 n2 -- n3 ) Core
Multiply n1 by n2 leaving the product n3.  "star"

*/ ( n1 n2 n3 -- n4 ) Core
Multiply n1 by n2, producing an intermediate double-cell result d. Divide d by
n3, giving the single-cell quotient n4. "star-slash"

*/MOD ( n1 n2 n3 -- n4 n5 ) Core
Multiply n1 by n2, producing intermediate double-cell result d. Divide d by n3,
giving single-cell remainder n4 and single-cell quotient n5. "star-slash-mod"

+LOOP ( n -- ) Core
Like LOOP, but increment the index by the specified signed value n. After
incrementing, if the index crossed the boundary between the loop limit minus
one and the loop limit, the loop is terminated as with LOOP. "plus-loop"

, ( x -- ) Core
Reserve one cell of data space and store x in the cell. If the data-space
pointer is initially aligned, it will remain aligned after , has executed.
"comma"

. ( n -- ) Core
Remove the top of stack item and display it as a signed single-precision
integer followed by one space. "dot"

." <string>" ( -- ) Core
Compile string, which will be typed when the word that contains it is
exe-cuted. "dot-quote"

/ ( n1 n2 -- n3 ) Core
Divide n1 by n2, leaving the quotient n3.  "slash"

/MOD ( n1 n2 -- n3 n4 ) Core
Divide n1 by n2, leaving the remainder n3 and the quotient n4. "slash-mod"

2! ( x1 x2 a-addr -- ) Core
Store the cell pair x1 x2 into the two cells beginning at a-addr, removing
three cells from the stack.  "two-store"

2@ ( a-addr -- x1 x2 ) Core
Push the cell pair x1 x2 at a-addr onto the top of the stack. "two-fetch"

2DROP ( x1 x2 -- ) Core
Remove the top pair of cells from the stack.  The cell values may or may not be
related. "two-drop"

: <name> ( -- ) Core
Create a definition for name, called a colon definition. Enter compilation
state and start compiling the definition.  The execution behavior of name will
be determined by the previously defined words that follow, which are compiled
into the body of the definition. name cannot be found in the dictionary until
the definition is ended. At execution time, the stack effects of name depend on
its behavior. "colon"

2OVER ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 ) Core
Copy cell pair x1 x2 to the top of the stack. "two-over"

; ( -- ) Core
End the current definition and enter interpretation state. If the data-space
pointer is not aligned, reserve enough space to align it. "semi-colon"

< ( n1 n2 -- flag ) Core
Return true if n1 is less than n2.  "less-than"

<# ( ud -- ud ) Core
Initialize pictured output of an unsigned double-precision integer. If the
out-put is to be signed, a signed value n must be preserved somewhere,
typically immediately beneath this integer, where it may later be passed to
SIGN.  "bracket-number"

= ( n1 n2 -- flag ) Core
Return true if n1 is equal to n2. "equal"

> ( n1 n2 -- flag ) Core
Return true if n1 is greater than n2.  "greater-than"

>BODY ( xt -- a-addr ) Core
Given a word's execution token, return the address of the start of the
parame-ter field in that word. "to-body"

>IN ( -- a-addr ) Core
Return the address of a cell containing the offset (in characters) from the
start of the input buffer to the start of the parse area. "to-in"

>NUMBER ( ud1 c-addr1 u1 -- ud2 c-addr2 u2 ) Core
Convert the characters in the string at c-addr1, whose length is u1, into
digits, using the radix in BASE. The first digit is added to ud1. Subsequent
digits are added to ud1 after multiplying ud1 by the number in BASE.
Conversion contin-ues until a non-convertible character (including an algebraic
sign) is encoun-tered or the string is entirely converted; the result is ud2.
c-addr2 is the location of the first unconverted character or, if the entire
string was converted, of the first character beyond the string. u2 is the
number of unconverted characters in the string. "to-number"

?DUP ( x -- 0 | x x ) Core
Conditionally duplicate the top item on the stack, if its value is non-zero.
"question-dup"

ABORT ( i*x -- ) ( R: j*x -- ) Core
Unconditionally terminate execution, empty both stacks, and return to the
task's idle behavior (QUIT). No message is issued.

ABORT" <text>" ( i*x flag -- ) ( R: j*x -- ) Core
If flag is true (non-zero), type the specified text at the user's terminal,
clear both stacks, and return to the task's idle behavior.  Must be used inside
a definition. "abort-quote"

ABS ( n -- +n ) Core
Replace the top stack item with its absolute value.

ACCEPT ( c-addr +n1 -- +n2 ) Core
Get, at most, +n1 characters from the current input device, echo each, and
place them in memory beginning at c-addr. The process continues until ACCEPT
encounters a carriage return (line terminator). If the line terminator is not
received before a count of +n1 is reached, any excess characters are discarded.
Return +n2, the actual count of characters received.

ALIGN ( -- ) Core
If the data-space pointer is not aligned, reserve enough space to align it.

ALIGNED ( addr -- a-addr ) Core
Return a-addr, the first aligned address greater than or equal to addr.

ALLOT ( n -- ) Core
If n is greater than zero, reserve n bytes of data space. If n is less than
zero, release |n| bytes of data space.

BASE ( -- a-addr ) Core
Return a-addr, the address of a cell containing the current number conversion
radix. The radix is a value between 2 and 36, inclusively. It is used for both
input and output conversion.

BEGIN ( -- ) Core
At compile time, save the next available dictionary location on the
control-flow stack. This action marks the destination of a backward branch for
use by other compiler directives.  At run time, simply continue execution.

BL ( -- char ) Core
Return char, the ASCII character value for a space (20H ). "B-L"

C, ( char -- ) Core
Reserve one byte of data space and store char in the byte. "C-comma"

CELL+ ( a-addr1 -- a-addr2 ) Core
Add the size in bytes of a cell to a-addr1, giving a-addr2. "cell-plus"

CHAR ( -- char ) Core
Parse the word following CHAR in the input stream. Put the ASCII value of the
first character of this word on the stack. CHAR is normally used
interpretively; see [CHAR] for the equivalent function inside a definition.

CHAR+ ( c-addr1 -- c-addr2 ) Core
Add the size in bytes of a character to c-addr1, giving c-addr2. "char-plus"

COMPARE ( c-addr1 u1 c-addr2 u2 -- -1|0|1 ) String
Compare the two strings. Return 0 if two strings are identical; -1 if ca1 u1 is
smaller than ca2 u2; 1 otherwise.

CONSTANT <name> ( x -- ) Core
Define a single-precision constant name whose value is x.

COUNT ( c-addr1 -- c-addr2 n ) Core
Return the length n and address c-addr2 of the text portion of a counted string
beginning at c-addr1.

CR ( -- ) Core
Cause subsequent output to appear at the beginning of the next line on the
current output device. "C-R"

CREATE <name> ( -- ) Core
Construct a dictionary entry for name.  Execution of name will return the
address of its data space. No data space is allocated for name, however; this
must be done by subsequent actions such as ALLOT.

DECIMAL ( -- ) Core
Sets BASE such that numbers will be converted using a radix of 10.

DEPTH ( -- +n ) Core
Return the number of single-cell values that were on the stack before this word
executed. DEPTH will return 2 for each double-precision integer on the stack.

DO ( n1 n2 -- ) Core
Establish the loop parameters. This word expects the initial loop index n2 on
top of the stack, with the limit value n1 beneath it. These values are removed
from the stack and stored on the return stack, when DO is executed.

DOES> ( -- ) Core
Begin run-time behavior, specified in high-level Forth. At run time, the
address of the parameter field of the particular instance of the defining word
is pushed onto the stack before the run-time words are executed. "does"

ELSE ( C: orig1 -- orig2 ) Run-time: ( -- ) Core
Start the false clause in an IF-ELSE-THEN structure.

EMIT ( b -- ) Core
Output one character from the least-significant byte of the top item on the
stack, then pop the stack.

ENVIRONMENT? ( c-addr u -- false | i*x true ) Core
This word is used to inquire about the values of system parameters and the
existence of options. "environment-query"

EVALUATE ( i*x c-addr u -- j*x ) Core
Save the current input source specification. Set SOURCE-ID to -1. Make the
string at c-addr, length u, the input source and input buffer, set >IN to zero,
and interpret. When the parse area is empty, restore the prior input source
specification.  Other stack effects are due to the word(s) that were EVALUATEd.

FILL ( c-addr u b -- ) Core
Fill a region of memory, at address c-addr and of length u, with the
least-significant byte of the top-of-stack item.

FIND ( c-addr -- c-addr 0 | xt 1 | xt -1 ) Core
Attempt to find a definition whose name is in a counted string at c-addr. If
the definition is not found, return the address and zero; if the definition is
found, return its execution token. If the definition is immediate, also return
+1; otherwise, return -1.

FM/MOD ( d n1 -- n2 n3 ) Core
Divide d by n1, using floored division, giving quotient n3 and remainder n2.
All arguments are signed.  This word and SM/REM will produce different results
on the same data when exactly one argument is negative and there is a
remainder.  "F-M-slash-mod"

HERE ( -- addr ) Core
Push the address of the next available memory location onto the stack.

HOLD ( char -- ) Core
Append char to the current beginning of the pictured numeric output string.
HOLD must occur only inside a <# ... #> number conversion sequence.

I ( -- n ) Core
Push a copy of the innnermost loop index onto the data stack.

IF ( C: -- orig ) Run-time: ( x -- ) Core
Put the location of a new unresolved forward reference orig onto the control
flow stack. On execution jump to location specified by the resolution of orig
if x is zero.

IMMEDIATE ( -- ) Core
Make the most recent definition an immediate word. When the compiler encounters
an immediate word it causes it to execute at that time rather than compiling a
reference to it.

INVERT ( x1 -- x2 ) Core
Invert all bits of x1, giving its logical inverse x2.

J ( -- n ) Core
Push a copy of the next-outer loop index onto the data stack. When two DO ...
LOOPs are nested, this obtains the value of the outer index from inside the
inner loop.

KEY ( -- b ) Core
Accept exactly one byte of data from the input device and place its value on
the stack. KEY does not echo.

LEAVE ( -- ) Core
Discard loop parameters and continue execution immediately following the
innermost LOOP or +LOOP containing this LEAVE.

LITERAL ( C: x -- ) Run-time: ( -- x ) Core
At compile time, remove the number that is on top of the stack and compile it
into the current definition. At run time, return the number to the stack.

LOOP ( C: do-sys -- ) Run-time: ( -- ) ( R: loop-sys1 -- loop-sys2 ) Core
Increment the index value by one and compare it with the limit value. If the
index value is equal to the limit value, the loop is terminated, the parameters
are discarded, and execution resumes with the next word. Otherwise, control
returns to the word that follows the DO that opened the loop.

LSHIFT ( x1 u -- x2 ) Core
Perform a logical left shift of u places on x1, giving x2. Fill the vacated
least-significant bits with zeroes.  "L-shift"

M* ( n1 n2 -- d ) Core
Multiply n1 by n2, leaving the double-precision result d. "M-star"

MAX ( n1 n2 -- n3 ) Core
Return n 3 , the greater of n1 and n2.

MIN ( n1 n2 -- n3 ) Core
Return n3, the lesser of n1 and n2.

MOD ( n1 n2 -- n3 ) Core
Divide n1 by n2, giving the remainder n3.

NEGATE ( n -- -n ) Core
Change the sign of the top stack value; if the value was negative, it becomes
positive. The phrase NEGATE 1- is equivalent to INVERT (one's complement of the
input value).

POSTPONE <name> ( -- ) Core
At compile time, add the compilation behavior of name, rather than its
execution behavior, to the current definition. Usually used in IMMEDIATE
definitions.

QUIT ( i*x -- ) ( R: j*x -- ) Core
Terminate execution of the current word (and all words that called it). Clear
the return and data stacks. No indication is given to the terminal that a QUIT
has occurred.  Enter interpretation state and begin an infinite loop of
awaiting a line of text from the input source and interpreting it.

RECURSE ( -- ) Core
Append the execution behavior of the current definition to the current
definition, so that it calls itself recursively. For more help, see RECURSE.

REPEAT ( C: orig dest -- ) Core
Terminate a BEGIN-WHILE-REPEAT
indefinite loop. Resolve backward reference dest and forward reference
orig.

RSHIFT ( x1 u -- x2 ) Core
Perform a logical right shift of u places on x1, giving x2. Fill the vacated
most-significant bits with zeroes.  "R-shift"

S" <string>" ( -- c-addr u ) Core
This word compiles a string in a definition, returning its address and count
when executed. "S-quote"

S>D ( n -- d ) Core
Convert a single-precision number n to its double-precision equivalent d with
the same numerical value. "S-to-D"

SIGN ( n -- ) Core
Insert a minus sign at the current position in the string being converted if
the signed value n is negative.

SM/REM ( d n1 -- n2 n3 ) Core
Divide d by n1 , using symmetric division, giving quotient n3 and remainder n2.
"S-M-slash-rem"

SOURCE ( -- c-addr u ) Core
Return the address and length of the input buffer.

SPACE ( -- ) Core
Display one space on the current output device.

SPACES ( u -- ) Core
Display u spaces on the current output device.

STATE ( -- a-addr ) Core
Return a-addr, the address of a cell containing the compilation-state flag: a
non-zero value (interpreted as true) when in compilation state, false (zero)
otherwise.

THEN ( C: orig -- ) Run-time: ( -- ) Core
Resolve the forward reference orig.

TYPE ( c-addr u -- ) Core
Output the character string at c-addr, length u.

U. ( u -- ) Core
Display the top stack item as an unsigned single-precision integer followed by
one space. "U-dot"

U< ( u1 u2 -- flag ) Core
Return flag, which is true if and only if u1 is less than u2. "U-less-than"

UM* ( u1 u2 -- ud ) Core
Unsigned multiply u1 by u2, leaving the double-precision result ud. "U-M-star"

UM/MOD ( ud u1 -- u2 u3 ) Core
Unsigned divide ud by u1, leaving remainder u2 and quotient u3. "U-M-slash-mod"

UNLOOP ( -- ) Core
Discard the loop parameters for the current nesting level. This word is not
needed when a DO ... LOOP completes normally, but it is required before leaving
a definition by calling EXIT. One UNLOOP call for each level of loop nest-ing
is required before leaving a definition.

UNTIL ( x -- ) Core
At compile time, compile a conditional backward branch to the location on the
control-flow stack (usually left there by BEGIN). At run time, if x is zero,
take the backwards branch; otherwise, continue execution beyond the UNTIL.

VARIABLE <name> ( -- ) Core
Define a single-cell variable. Execution of name will return the address of its
data space.

WHILE ( x -- ) Core
At compile time, place a new unresolved forward reference origin on the control
stack, under the topmost item (which is usually a destination left by BEGIN).
At run time, if x is zero, take the forward branch to the destination that will
have been supplied (e.g., by REPEAT) to resolve WHILE's origin; otherwise,
continue execution beyond the WHILE.

WORD <text> ( char -- c-addr ) Core
Skip any leading occurrences of the delimiter char. Parse text delimited by
char. Return c-addr, the address of a temporary location containing the parsed
text as a counted string. If the parse area was empty or contained only
delimiter(s), the resulting string length is zero.

[ ( -- ) Core
Enter interpretation state. [ is an immediate word.  "left-bracket"

['] <name> ( -- ) Core
Like ' but must be used in a colon definition. ['] finds the next word in the
dictionary and compiles its execution token as a literal. "bracket-tick"

[CHAR] ( -- char ) Core
At compile time, parse the word following [CHAR] in the input stream. At run
time, put the ASCII value of the first character of this word on the stack.
"bracket-care"

] ( -- ) Core
Enter compilation state. ] is an immediate word.  "right-bracket"

PBTRAP ( -- result ) Hans Ext
Activate software interrupt to call the OS. "P-B-trap"

PB ( index -- address )
Compute absolute address in current parameter block.

STARTLOAD ( -- ) Hans Ext
Start downloading a sourcefile. Echo is disabled and all text is flushed when
an error is encountered.

STOPLOAD ( -- ) Hans Ext
Stop downloading a sourcefile. Echo is enabled and the error flush process is
ended and disabled.

FLUSH ( -- ) Hans Ext
Discard all incomming text until the word STOPLOAD is encountered. To stop the
flushing, STOPLOAD should be the only word in a textline.

UPPER ( c -- C ) Hans Ext
Change c to upper case when it's a valid letter.

W! ( w a-addr -- ) Hans Ext
Store 16 bit word at an aligned address.

W@ ( a-addr -- w ) Hans Ext
Push the word contents at a-addr on the data stack.

SW@ ( a-addr -- n ) Hans Ext
Push the word contents at a-addr on the data stack. sing-extend the value to 32
bit.

WSWAP ( x1 -- x2 ) Hans Ext
Exchange the upper and lower 16 bits of TOS.

BSWAP ( w1 -- w2 ) Hans Ext
Exchange the upper and lower 8 bits of TOS.

:HANDLER <name> ( -- saved-sys ) Hans Ext
Create an interrupt handler. Works like ":" but with additional saving of
various used processor resources. Definition must be terminated with
";HANDLER".

;HANDLER ( saved-sys -- ) Hans Ext
Terminate the compilation of an interrupt handler.

COMPILE-ONLY ( -- )
Make the most recent definition an compile-only word.

SOURCE-ID ( -- n ) Core Ext
Return a value indicating the current input source. The value is 0 if the
source is the user input device, -1 if the source is a character string.

:NONAME ( -- xt ) Core Ext
Create an execution token xt. Enter compilation state and start compiling the
definition. This definition may be executed later by the phrase xt EXECUTE.
"colon-no-name"

AGAIN ( C: dest -- ) Core Ext
Resolve backward reference dest.  Typically used as BEGIN ... AGAIN. Move
control to the location specified by dest on execution.

COMPILE, ( xt -- ) Core Ext
Compile the execution token on data stack into current colon definition.
"compile-comma"

NIP ( x1 x2 -- x2 ) Core Ext
Drop the second item on the stack, leaving the top unchanged.

PARSE ( char -- c-addr u ) Core Ext
Parse the input buffer until the delimiter char is encountered. Return the
address and length of the parsed string. If the parse area was empty, u is zero
and c-addr is undefined.

PICK ( +n -- x ) Core Ext
Place a copy of the nth stack entry on top of the stack. The zeroth item is the
top of the stack; i.e., 0 PICK is equivalent to DUP and 1 PICK is equivalent to
OVER.

REFILL ( -- flag ) Core Ext
Attempt to read the next line from the current input device. If successful,
make the result the current input buffer, set >IN to zero, and return true;
otherwise, return false.

TO <name> ( x -- ) Core Ext
Store x in the data object name. An error will occur if name was not defined by
VALUE.

VALUE <name> ( x -- ) Core Ext
Define a data object name whose initial value is x.

WITHIN ( x1 x2 x3 -- flag ) Core
Return true if x1 is greater than or equal to x2 and less than x3. The values
may all be either unsigned integers or signed integers, but must all be the
same type.

\ ( -- ) Core Ext
Begin a comment which includes the entire remainder of the current line of
source code. No closing delimiter is needed.

D+ ( d1 d2 -- d3 ) Double
Add d1 to d2, leaving the sum d3. "D-plus"

D. ( d -- ) Double
Display the top cell pair on the stack as a signed double-precision integer.
"D-dot"

DNEGATE ( d -- -d ) Double
Change the sign of a double-precision stack value.

CATCH ( i*x xt -- j*x 0 | i*x n ) Exception
Save information about the depth of the data and return stacks in an exception
frame and push the frame on the exception stack. Execute the execution token xt
(as with EXECUTE). If the execution of xt completes normally (i.e., a non-zero
THROW is not executed), pop the exception frame and return zero on top of the
data stack, above whatever stack items were returned by xt EXECUTE, and delete
the stack-depth information. Otherwise, see the definition of THROW for
completion of the exception-processing behavior.

THROW ( k*x n -- k*x | i*x n ) Exception
If n is zero, simply remove n from the data stack. If n is non-zero, pop the
top-most frame from the exception stack, restore the input source specification
that was in use before the corresponding CATCH, and adjust the depths of all
stacks so they are the same as the depths saved in the exception frame (the
value of i in THROW's stack comments is the same as the value of i in CATCH's
comments). Place n on top of the data stack and transfer control to a point
just beyond the corresponding CATCH that pushed the exception frame.

EKEY ( -- u ) Facility Ext
Receive one keyboard event and place the result on the stack. "E-key"

EKEY? ( -- flag ) Facility Ext
Check whether a valid keyboard event has been received on the task's serial
device since the last call to ACCEPT, KEY, or EKEY. If so, return true,
otherwise return false. The value of the event may be obtained by the next
execution of EKEY. After EKEY? returns with a value of true, subsequent
executions of EKEY?  before executing KEY, KEY?, or EKEY will also return true,
because they refer to the same event. "E-key-question"

FORTH-WORDLIST ( -- wid ) Search
Return wid of Forth wordlist.

GET-CURRENT ( -- wid ) Search
Return the indentifier of the compilation wordlist.

SEARCH-WORDLIST ( c-addr u wid -- 0 | xt 1 | xt -1 ) Search
Search word list for a match with the given name. Return execution token and -1
or 1 ( IMMEDIATE) if found. Return 0 if not found.

/STRING ( c-addr1 u1 +n -- c-addr2 u2 ) String
Return parameters for a string with the first +n characters removed. The
original string is at address c-addr1 and is of length u1. The returned string
parameters are address c-addr2 = c-addr1 + n, and length u2 = u1 - n.
"slash-string"

SLITERAL ( -- c-addr u ) String
Compile into a definition a string that is characterized by the starting
address and length on the stack at compile time. At run time, return the
string's address and length to the stack. In general, the run-time address will
not be the same as the compile-time address. "S-literal"

AHEAD ( -- orig ) Tools Ext
At compile time, begin an unconditional forward branch by placing orig on the
control-flow stack. The behavior is incomplete until the orig is resolved,
e.g., by THEN. At run time, resume execution at the location provided by the
resolution of this orig.

RAMSTART ( -- addr ) Hans Ext
Constant that contains the first RAM location occupied by Forth.

SETCOLDHERE ( -- ) Hans Ext
Saves the current HERE value. When the current RAM image is saved and reloaded
lateron, this HERE value will be restored.

CODE <name> ( -- )
Start defining an assembly-language coded word.

INLINE-CODE <name> ( -- ) COMPILE-ONLY IMMEDIATE
Start a section of inline assembly code within a definition.

W, ( w -- )
Reserve one word of data space and store w in the cell.  "W-comma"

L: ( labelnumber -- ) ASSEMBLER
Define a local label. Valid range for n = 0..9.

END-CODE ( -- )
End the definition of an assembly-language coded word.

INLINE-END-CODE ( -- )
End the definition of an inline assembly-language segment within the definition
of a high-level word.

.VALUE-NAME ( value -- ) Hans Ext
Find the VALUE that contains x and print it's name

invert_on ( -- )
select inverse video

invert_off ( -- )
select normal video

disinstruction ( xt codebyte -- xt+2 | xt+4 )
disassemble one instruction

.byte ( b -- )
Print a hex byte

.sbyte ( c -- )
Print a 8 bit signed offset hex value

.word ( n -- )
Print a 16 bit hex value

.address ( addr -- )
Print a hex address

traceback ( -- ) Hans Ext
Print the tree of all words involved in the execution of this word.

itraceback ( -- ) Hans Ext
Print the tree of all words involved in the execution of this interrupt handler.
Use only from an interrupt handler before messing up the return stack!

removebreak ( -- )
If a breakpoint is set, remove it.

saveregs ( save-sys -- )
In an interrupt handler, move all saved information from the data stack
to a temp location. Used in debug handler to access the data stack of
the debugged application.

restoreregs ( -- save-sys )
Reverse the action of saveregs.

breakserver ( -- )
Sample breakpointer interrupt handler.

settrapvector ( xt trap# -- )
Set cpu trap <trap#> interrupt vector to jump to xt.

break ( break_xt -- )
Set software breakpoint on instruction.

xtsee ( xt -- )
Decompile code starting from xt until an RETS or RETI is encountered.

see <name> ( -- )
Decompile a forth word.

gb ( -- )
Resume application after a break occured. Application will stop when
the next break location is encountered.

gi ( -- )
When in debug mode, start debugging the word that is about to be called.

go ( -- )
Resume application after a break occured. A new breakpoint is not set.

.regs ( -- )
Print the contents of all processor registers.

debug <name> ( -- )
Start debugging a forth word. When started, the software breakpoint is set
on the first instruction of the word. When the appication executes the word,
a software break is performed and the debug mode is entered.
In the debug mode, the word is decompiled and two parts of the decompiled
information is printed in reverse video. The first part of an instruction-
line is in reverse video when the software breakpoint is on this instruction.
The second part of a line (the mnemonic) is in reverse video when this is the
next instruction to execute.
In the debug mode it is possible to alter and examine memory and data stack.
Execution of the word is resumed by "gb" or "go".
The location of the software breakpoint can be altered by "bsee".

bsee ( xt -- )
Change the breakpoint location to xt and decompile the word that is
currently under test.

hwtrap  ( -- ) Debugger
Enable the capture of a hardware trap interrupt.

savecode ( -- )
Save the current compiled forth code as an memory image to flash.

STATE-SELECTOR <selectorname> ( -- ) Hans Ext
Define a state machine selector.
This selector is updated by: <stateobject> TO <selectorname>
The selected state is executed by: <selectorname> EXECUTE
See also help on STATE-OBJECT and STATE-METHODE:
Sample code:
     STATE-SELECTOR testmachine         \ define state machine selector

     STATE-OBJECT state1                \ define machine states
     STATE-OBJECT state2
     STATE-OBJECT state3
     STATE-OBJECT state4

     STATE-METHODE: state1              \ define code for state1
       ." state1 " CR
       state3 TO testsm                 \ switch to state3
     ;

     STATE-METHODE: state2              \ define code for state2
       ." state2 " CR
       state1 TO testsm                 \ switch to state1
     ;

     STATE-METHODE: state3              \ define code for state3
       ." dit is state3 " CR
       state2 TO testsm                 \ switch to state2
     ;

     state1 TO testmachine              \ init stateselector
     testmachine EXECUTE                \ execute the current state

STATE-OBJECT <name> ( -- ) Hans Ext
Define a state object. This value contains the xt defined by METHODE:
See also help on STATE-SELECTOR and STATE-METHODE:

STATE-METHODE: <objectname> ( -- ) Hans Ext
Define the methode that belongs to a state object.
The xt of this methode code is saved in the previous defined
state object named <objectname>.
Se also help on STATE-SELECTOR and STATE-METHODE:

VECTOR-TABLE <tablename> ( defaultvector -- tablebase -1 ) Hans Ext
Start the definition of a vector (jump) table.
Add vectors with: <vectornr> VECTOR <handlername>.
All vector must be added in increasing vectornumber order.
Undefined vectors are filled with <defaultvector>
End the definition with END-TABLE.
Execute a handler with: <vectornr> <tablename>.
Example code:
    VECTOR-TABLE jumptest  \ define jumptable
      18 VECTOR test1
      19 VECTOR test2
      24 VECTOR test3
    END-TABLE
    19 jumptest            \ execute test2
Note:
The size of the table is in the order of: (highest vectornumber - lowest vectornumber) * CELLSIZE
so be careful with a large numberrange!

VECTOR <handlername> ( tablebase lastvector vectornr -- tablebase vectornr ) Hans Ext
Add a vector to the vactor table.
See help on VECTOR-TABLE.

END-TABLE ( tablebase lastvectornr -- ) Hans Ext
End the definition of a vector table.
See help on VECTOR-TABLE.

CRC ( crctable crcinit c-addr count -- crc )
Calculate the 16 bit CRC over the selected memory area.

SIZE-ALIGNED ( addr size -- aligned-addr ) Hans Ext
Align <addr> to the next <size> boundary.
<size> must be a power of two.

SAME-SEGMENT? ( addr1 addr2 -- ) Hans Ext
Check if the two addresses are in the same 64k segment.
Abort if not.

SEGMENT-FIT ( addr size -- addr ) Hans Ext
Check if <size> fits into the current 64k segment of <addr>.
If it doesn't fit, align <addr> to the next segment.

PAGE-FIT ( addr size -- addr ) Hans Ext
Check if <size> fits into the current 16k page of <addr>.
If it doesn't fit, align <addr> to the next page.

SOCK-INIT ( c-addr | 0 -- ) TCP Ext
Init ethernet with IP settings difined in a config string.
When 0, default IP configuration is used

SOCK-LISTEN ( timeout mode port type sock PB -- ) TCP Ext
Enable the establishment of a TCP or UDP connection by an external HOST.
timeout = inactive time-out in seconds
mode = 0 for binary mode or 1 for ASCII mode.
port = local port to listen on.
type = 17 to select UDP or 6 to select TCP connection.
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-WAITOPENED ( sock PB -- ) TCP Ext
Start waiting until a TCP or UDP connection is established.
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-OPENED? ( PB -- flag ) TCP Ext
Check if a connection is established.
PB = the parameterblock used in SOCK-WAITOPENED.

SOCK-READ ( buffer maxlength sock PB -- length status ) TCP Ext
Read data from an opened TCP or UDP connection if available.
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-WRITE ( buffer length sock PB -- status ) TCP Ext
Write data to an opened TCP or UDP connection.
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-EOF ( EOFchar sock -- ) TCP Ext
When the socket is used in the ASCII mode, receive data is only passed
when a End Of Frame character is received. This EOF character is default
a CR, but can be changed with this word.
Note: When this EOF character is changed, the input buffer is flushed.

SOCK-CLOSE ( sock PB -- ) TCP Ext
Close a TCP or UDP connection.
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-WAITCLOSED ( timeout sock PB -- ) TCP Ext
Start closing a TCP or UDP connection.
timeout = max. wait time in seconds
sock = pointer to socket datastructure.
PB = parameter block to use.

SOCK-CLOSED? ( PB -- flag ) TCP Ext
Check if a connection is closed.
PB = the parameterblock used in SOCK-WAITCLOSED.

SETHOOK ( xt trapnr -- )
Set a trapvector to an application handler.

MON" <string>" ( -- )
Execute <string> as a system prompt command.

DefPagedStructure <name> ( bytesize -- )
Compile time allocation of a table in the Paged datastructure area.

MixerOut ( -- c-addr )
Byte oriented mixer output table:
  +0: 0
  +1: Output value for light channel 1
  +n: Output value for light channel n

16BitTable ( -- a-addr )
word oriented 16 bit channel definition table
  +0: not used
  +2: 16 bit setup for light channel 1
  +2*n: 16 bit setup for light channel n
setup for entry n:
  bit15..13: 0
  bit12..1: lightchannelnr * 2 of 16 bit partner channel
  bit0: is set when n is the LSB part of a 16 bit combination

ElementPool ( -- a-addr )
This fixed size table contains a pool of light elements. these elements
are allocated for an engine upon request.
Each element contains the following items:
  +0/1:   LcNext  - link to the next element in this layer ( 0 = end of link )
  +2/3:   LcValue ( = LcCounter MSW)
  +4/5:   LcChannel - channelnumber of the corresponding light channel
  +6:     LcFlags
  +7:     LcLsbOffset - offset to LSB channel ( 0 = no LSB channel)
  +8/9:   LcDelta - fader delta (signed 32bit) lsw
  +10/11: LcCounter - fader counter (unsigned 32bit)lsw
  +12/13: fader delta msw
  +14/15: LcEnd - fader endvalue (unsigned 16bit)
  +16/17: LcPrev  - link to the previous element in this layer ( 0 = start of layer)
The bits in LcFlag have the following function:
  0: LcOutput
  1: -
  2: LcSolo
  3: LcFaderActive
  4: LcUpdated
  5: LcSustained
  6: -
  7: -
The words "Lc..." return the value of an item of the current element.
The words "ToLc..." sets the value of an item of the current element.

PatchTable ( -- a-addr )
Word oriented patch table:
  +0: not used
  +2: address of light channel value in mixer output table mapped to DMX channel 1
  +2*n: DMX channel n

DigOutPatchTable ( -- a-addr )
Word oriented patch table:
  +0: not used
  +2: address of light channel value in mixer output table mapped to Digital Output 1
  +2*n: Digital Output n

GainTable ( -- a-addr )
Word oriented gain table:
  +0: not used
  +2: DMX channel 1 gain ( 0= x0, 256= x1, 512= x2)
  +2*n: DMX channel n

CurveTable ( -- a-addr )
Word oriented curve table:
  +0: not used
  +2: base address of curve to use on DMX channel 1
  +2*n: DMX channel n

CurveData ( -- c-addr )
8 tables, 256 bytes each, containing curve lookup data.

LimitTable ( -- c-addr )
Byte oriented limit table:
  +0: not used
  +1: max. delta on DMX channel 1
  +n: DMX channel n

DmxTable ( -- c-addr )
Byte oriented DMX output table:
  +0..+512: not used
  +513: output value of DMX channel 1
  +512+n: DMX channel n

LayerId>EngineNr ( -- c-addr )
Byte oriented table mapping LayerID's to EngineNumber:
  +0: Special: Used to refer to the current engine
  +1: EngineNumber mapped to LayerID 1
  +n: EngineNumber mapped to LayerID n
  +63: EngineNumber mapped to LayerID 63
  +64: Special: Used to create a new layer on top
  +65: Fixed mapping to engine 1
  +m: Fixed mapping to engine (LayerID-64)
  +95: Fixed mapping to engine 31

EngineNr>LayerId ( -- c-addr )
Byte oriented table mapping engine numbers to LayerID's:
  +0: not used
  +1: LayerID mapped to engine 1 ( 0 = no ID)
  +n: LayerID mapped to engine n
  +31: LayerID mapped to engine 31

FreeEngineStack ( -- c-addr )
Byte oriented table indicating the unused engines:
  +0: number of free engines ( 0 .. 31). acts as pointer in this stack to
      pop the number of a free engine or to push the number of an engine to free
  +1..31: free engines

EngineMixOrder ( -- a-addr )
Word oriented table containing the mix order information:
  +0:     EngineNumber of first engine in the current mixorder (has the lowest priority)
          32 indicates an empty mix order.
  +1:     0
  +2:     EngineNumber of the engine above engine 1
  +3:     EngineNumber of the engine below engine 1
  +2*n:   EngineNumber of the engine above engine n
  +2*n+1: EngineNumber of the engine below engine n
  +62:    EngineNumber of the engine above engine 31
  +63:    EngineNumber of the engine below engine 31
  +64:    FF
  +65:    EngineNumber of last engine in the current mixorder (has the highest priority)
          0 indicates an empty mix order

EIB ( -- a-addr )
This Engine Info Block contains global information for each engine:
  +0: EnActive                  \ flag: Engine is used
  +1: EnOutput                  \ flag: Engine data is send to the mixer
  +2: EnAutoOutput              \ flag: Output of channels are enabled when set.
  +3: EnSequence
  +4: EnFade                    \ flag: Faders are used.
  +5: EnSolo                    \ flag: Only channels with solo bits set are mixed.
  +6: EnMixMode
  +7: EnHalt                    \ flag: the engine is not fetching instruction
  +8: EnLocked                  \ flag: this layer is locked
  +9: EnCleanupRequest          \ flag: leanup layer and delete when the linked list becomes empty
  +10/11: EnUsesCueList         \ used for editing commands
  +12: EnStepDataType
  +13: EnStepData1
  +14: EnStepData2
  +15: EnStepData3
  +16: EnStepData4
  +17: EnStepData5
  +18: EnStepData6
  +19: EnManFadeMode            \ Manual fade mode: 0=nofade, 1=fade-in, 2=fade-out, 3=cross-fade
  +20: EnManFadeTime            \ Fade time used in manual mode (in timecode)
  +21: Not used
  +22: EnPause
  +23: EnWaiting
  +24: EnSceneRel
  +25: EnDurationTime
  +26/27: EnRemDurationTime
  +28/29: EnCueList
  +30: EnCueStep
  +31: EnChaseMode
  +32: EnChaseFadeMode
  +33: EnRemFade
  +34/35: EnRemFadeTime
  +36: Not used
  +37: EnDeviceId
  +38: EnSustain                \ flag: Sustain mode is active
  +39: EnIgnoreUnset            \ flag: Ignore unset commands
  +40: EnRandomStepCount        \ number of steps left in random mode
  +41: EnSteppingUp             \ flag: indicates that we're stepping in upward direction
  +42: EnIgnoreWait             \ flag: indicates we should not wait next instruction
  +43: EnJumped                 \ flag: indicates the last instruction in this engine was a jump
  +44..59: EnLoopTable          \ used for loop instructions
  +60..63: EnState                      \ state of the sequencer statemachine
  +64..67: EnChaseSpeedDelta
  +68..71: EnChaseSpeedCounter
  +71: EnChaseSpeed             \ overlap with counter! (MSB)
  +72: EnChaseSpeedEnd
  +73: EnTransFadeMode
  +74..77: EnTransDelta
  +78..81: EnTransCounter
  +81: EnTransparency           \ overlap with counter! (MSB)
  +82: EnTransEnd
  +83..89: Not used             \ to extend EIB without changing the structure


  The words "En..." return the value of an element of the current engine.
  The words "ToEn..." sets the value of an element of the current engine.

ColdInitCueLists ( -- )
Reset all allocated data and pointers for CueLists and CueScenes.

CalcCRC ( Start size -- CRC )
Calculate a 16 bit CRC over a memory range.

SaveDataStructure ( -- okresult )
Save the complete LCX non-volatile datastructure into flash.

LoadDataStructure ( -- okresult )
Load the complete LCX non-volatile datastructure from flash.

EraseDataStructure ( -- )
Reset the complete LCX/LCM datastructure to 0
Used *before* the various cold init routines

AllocSpace ( size -- pointer TRUE | FALSE )
Try to allocate a chunk of memory of the requested size.
When successful, the header is filled and a pointer to the header is returned.

DeAllocSpace ( pointer -- )
Add a chuck of memory to the free memory linked list

MIXCOPY ( fade solo output FirstElementPointer -- )
Mix one engine in copy mode.

MIXMAX ( fade solo output FirstElementPointer -- )
Mix one engine in max (mix-up) mode.

MIXMIN ( fade solo output FirstElementPointer -- )
Mix one engine in max (mix-down) mode.

MIXMIX ( fade solo output transparency FirstElementPointer -- )
Mix one engine in mix (transparency) mode.

MIXADD ( fade solo output FirstElementPointer -- )
Mix one engine in add (mix-add) mode.

SETCHANNELS ( 16bittable settingtable count relative? 16bitchannelnr? startlink freelink -- )
Set multiple lightchannels in the current engine.
<16bittable> points to the channel grouping definition table.
<settingtable> points to an array of <count> channelnumber/value combinations.
<relative?> is true when the values should be handled as signed offsets (-128 .. 127)
in stead of absolutes (0 .. 255) values.
<16bitchannelnr?> is true when a word is used for channelnumbers.
<startlink> points to the page offset of the first element in an engine.
<freelink> points to the page offset of the first free element.

REMOVESUSTAINED ( startlink -- )
Remove sustain status of all sustained channels.
All sustained channels are set to 0.
<startlink> points to the page offset of the first element in an engine.

UPDATEENGINELIST ( fadetime fademode output? add? startlink freelink -- )
Remove unused elements from the linked list and update the values or start the faders
of the  elements updated by the SETCHANNELS command.
<fadetime> is the number of 50 msec ticks the fade should take.
<fademode> indicates how to fade: 0=nofade, 1=fade-in, 2=fade-out, 3=cross-fade
<output?> is true when the outputs of the updated channels should be activated.
<add?> is true when channels that are not updated should not be removed from the list.
<startlink> points to the page offset of the first element in an engine.
<freelink> points to the page offset of the first free element.
NB. an element that is not updated is not removed when a fader is active.

REMOVEFADERS ( startlink -- )
Force all currently fading channels to their end value.
<startlink> points to the page offset of the first element in an engine.

FILLDATABUFFER ( startlink buffer -- )
Copy datavalues of the selected engine to a temporary buffer.
<startlink> points to the page offset of the first element in an engine.
<buffer> points to the buffer to store the datavalues.

FILLFLAGSBUFFER ( startlink buffer -- )
Copy element flags of the selected engine to a temporary buffer.
<startlink> points to the page offset of the first element in an engine.
<buffer> points to the buffer to store the flags.

COPYDMXDATA ( startlink dmxbufferptr firstchannelnr endchannelnr -- )
Copy datavalues from a dmx input buffer to the selected engine.
<startlink> points to the page offset of the first element in an engine.
<dmxbufferoffset> offset to add to channelnr to get pointer to dmx in data.
<firstchannelnr> is the number of the first channel to use (if the channel is active)
<endchannelnr> is the number of the last channel to use + 1 .

REMELEMENT ( currptr freelink -- nextptr )
Remove an element from a linked list.
<currptr> points to the element to remove.
<freelink> points to the page offset of the first free element.
<nextptr> points to first element after the removed one.

FINDCHANNEL ( currptr channelnr -- nextptr found? )
Try to find a channelnr in a linked list.
<currptr> points to an element in the linked list.
<channelnr> is the channel we are looking for.
<nextptr> points to the found element or to another one.
<found?> flag indicating we've found an element with the target channelnr.

CW! ( w c-addr -- )
Store word on byte aligned address, low byte first

WC! ( w c-addr -- )
Store word on byte aligned address, high byte first

CW@ ( c-addr -- w )
Read word from byte aligned address, low byte first

WC@ ( c-addr -- w )
Read word from byte aligned address, high byte first

Code>Ticks ( timecode -- ticks )
Convert a Lanbox timecode into a number of 50 msec timerticks.

SetCurrentEngine ( enginenr -- )
Select the engine to operate on by setting the pointer CurrentEngine

ResetEngine ( -- )
Init the current engine to the default state, but keep layer ID and mix order.

DefaultEngine ( enginenr -- )
Select the engine and init it to the default state.

WarmInitEngine ( -- )
Reset all enigine data that should be volatile.

ColdInitEngine ( -- )
Init all enigine data and tables (volatile and non-volatile) to a defined state.

\dcc ( -- )
Dump info of current element.

\dac ( -- )
Dump info of all channels in the current engine.

\dc ( -- )
Dump all channels in the current engine.

\deib ( -- )
Dump the Engine Info Block of the current engine.

\ce ( enginenr -- )
Set the current engine number.

\d16b ( -- )
Dump non-zero entries from the 16 bit table.

\s16b ( LSBchannel MSBchannel -- )
Set a 16bit combination.

\free ( -- )
Dump the number of free elements.

\init ( -- )
Perform a cold init.

POSTPROCESS (  mixertable patchtable gaintable curvetable limittable outputtable channelcount -- )
perform patch, gain, curve and limit operation.

limit512 ( n -- n )
Limit a value to range 1..512.

Patch ( lightchannel dmxchannel -- )
Fill an entry of the patch table.

DigOutPatch ( lightchannel digitaloutputchannel -- )
Fill an entry of the digital output patch table.

Gain ( gain dmxchannel -- )
Set the gain to use on a DMX channel.
The gain varies from 0 (setting=0) via 1 (setting=256) to 2 (setting=512).

curve ( curvenumber dmxchannel -- )
Select curve to use on this DMX channel.

limit ( steplimit dmxchannel -- )
Set the max. step on this DMX channel.

WarmInitPostProcess ( -- )
Reset all postprocess data that should be volatile.

ColdInitPostProcess ( -- )
Init all post processing data and tables (volatile and non-volatile) to a defined state.

RunPostProcessor ( -- )
Execute the postprocessor

\sga ( gain -- )
Set all entries in the gain table.

\sac ( n -- )
Set the number of active DMX channels.

\dbt ( addr -- )
Dump a byte table with <activedmxchannels> elements

\dwt ( a-addr -- )
Dump a word table with <activedmxchannels> elements

\dc ( -- )
Dump the curve table with <activedmxchannels> elements

\dcd ( curvenr -- )
Dump all elements of a curve lookup table.

\dp ( -- )
Dump the patch table.

\dg ( -- )
Dump the gain table.

\dl ( -- )
Dump the limit table.

\dd ( -- )
Dump the dmx table.

\da ( -- )
Dump all postprocess related tables.

PollMidi ( -- ptr length TRUE | FALSE )
Check whether a complete command is received over the midi steam.
Returns a pointer to th received command and the number of
command bytes  if a complete command is received.

ParserInit ( -- )
Init the serial/midi parser process.

PollStreamInput ( -- flag )
Poll the current stream and check whether a command is received.
Returns false is no command available.
Returns true if a complete command is received.
If true, the command is loaded into the StreamCommandBuffer and
has a size of StreamCommandLength bytes.

SendResult (  flag -- )
Transmit the response from the global StreamResultBuffer to the current stream.
If false, transmit a ?

ParserInit ( -- )
Init the TCP parser process.

PollStreamInput ( -- flag )
Poll the current stream and check whether a command is received.
Returns false is no command available.
Returns true if a complete command is received.
If true, the command is loaded into the StreamCommandBuffer and
has a size of StreamCommandLength bytes.

SendResult (  flag -- )
Transmit the response from the global StreamResultBuffer to the current stream.
If false, transmit a ?

3DUP ( n1 n2 n3 -- n1 n2 n3 n1 n2 n3 )
Duplicate the top 3 stack items

ProcessStreamCommand ( -- result-flag )
Process the received command.
Result data is stored in the global StreamResultBuffer.

DigitTable ( -- a-addr ) LCM
The digit table contains te information currently displayed on the 4 x 7 segment
display on the LCM.
Each digit has 6 bytes info:
+0 - Digit (0..15 = normal data, >32 = ascii data)
+1 - DotFlag
+2 - AltDigit (data displayed in B-phase when blinking)
+3 - AltDotFlag
+4 - DigitBlinkFlag
+5 - DotBlinkFlag

MIXCOPY ( fade solo output FirstElementPointer -- )
Mix one engine in copy mode.

MIXMAX ( fade solo output FirstElementPointer -- )
Mix one engine in max (mix-up) mode.

MIXMIN ( fade solo output FirstElementPointer -- )
Mix one engine in max (mix-down) mode.

MIXMIX ( fade solo output transparency FirstElementPointer -- )
Mix one engine in mix (transparency) mode.

MIXADD ( fade solo output FirstElementPointer -- )
Mix one engine in add (mix-add) mode.

MixCurrentEngine ( -- )
Execute the mixer process for the current engine.

\smo ( lightvalue lightchannel -- )
Set one value in the mixer output table.

\smoi ( value -- )
Init the mixer output table with <value>.

\dmo ( -- )
Dump the mixer output table.

\dmp ( -- )
Dump the mixer output table. only first 512 channels

HandleStream ( StreamNumber -- )
Select the stream and process all command that are available in the input buffer.

SequenceCurrentEngine  ( -- )
Handle the sequencer for the current selected engine.