!  "store"  CORE

( x a-addr -- )
Store x at a-addr.



!@  "store-fetch"  KERNEL

( x1 a-addr -- x2 )
Fetch x2, x2 is the value stored at a-addr. Store x1 at a-addr.



!CSP  "store-c-s-p"  KERNEL

( -- )
Store the depth of the control flow stack for checking by ?CSP.



!DEA  "store-d-e-a"  KERNEL

( dea wid -- )
Store the dictionary entry address dea in the word list described by the word list identifier wid.



!X  "store-x"  KERNEL

( x x-addr -- )
Store x at extended address x-addr.



""  "null-string"  KERNEL

( -- c-addr u )
c-addr u specify the empty string, u is zero.

See also: NIL



#  "number-sign"  CORE

( ud1 -- ud2 )
Divide ud1 by the number in BASE giving the quotient ud2 and the remainder n. (n is the least-significant digit of ud1). Convert n to external form and add the resulting character to the beginning of the pictured numeric output string. Exception -17 is issued if # executes outside of a <# #> delimited number conversion.

See also: #S



#>  "number-sign-greater"  CORE

( xd -- c-addr u )
Drop xd. Make the pictured numeric output string available as a character string. c-addr and u specify the resulting character string. A program may replace characters within the string.

See also: # #S



#EXCEPTION  "number-exception"  KERNEL

( -- a-addr )
a-addr is the address of a cell containg the value of the current EXCEPTION.

See also: NEWEST



#LINES  "number-lines"  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the number of the current line of the input text file. Only valid if SOURCE-ID contains the fileid of the current open file. A program shall not directly alter the contents of #LINES.

See also: FILE-NAME



#S  "number-sign-s"  CORE

( ud1 -- ud2 )
Convert one digit of ud1 according to the rule for #. Continue conversion until the quotient is zero. Exception -17 is issued if #S executes outside of a <# #> delimited number conversion.



'  "tick"  CORE

( "<spaces>name" -- xt )
Skip leading space delimiters. Parse name delimited by a space. Find name and return xt, the execution token for name. Exception -13 is issued if name is not found.

When interpreting ' xyz EXECUTE is equivalent to xyz.

See also: POSTPONE [']



(  "paren"  CORE

Compilation: Perform the execution semantics given below.

Execution: ( "ccc<paren>" -- )
Parse ccc delimited by ) (right parenthesis). ( is an immediate word.

The number of characters in ccc may be zero to the number of characters in the parse area.

When parsing from a text file, if the end of the parse area is reached before a right parenthesis is found, refill the input buffer from the next line of the file, set >IN to zero, and resume parsing, repeating this process until either a right parenthesis is found or the end of the file is reached.

See also: ." .(



(.)  "paren-dot"  KERNEL

( n -- c-addr u )
Convert n to a numeric output string with a leading minus sign if n is negative.



(D.)  "paren-d-dot"  KERNEL

( d -- c-addr u )
Convert d to a numeric output string with a leading minus sign if d is negative.



(H.)  "paren-h-dot"  KERNEL

( u1 -- c-addr u2 )
c-addr u2 specify a string representing the value u1 as four hexadecimal digits.

See also: H.



(LOCAL)  "paren-local-paren"  LOCAL

Interpretation: Perform the function of -14 THROW.

Execution: ( c-addr u -- )
When executed during compilation, (LOCAL) passes a message to the system that has one of two meanings. If u is non-zero, the message identifies a new local whose definition name is given by the string of characters identified by c-addr u. If u is zero, the message is "last local" and c-addr has no significance.

The result of executing (LOCAL) during compilation of a definition is to create a set of named local identifiers, each of which is a definition name, that only have execution semantics within the scope of that definition's source.

local Execution: ( -- x )
Push the local's value, x, onto the stack. The local's value is initialized by removing x from the stack and storing into the local. The value may changed by preceding the local's name by TO or other prefixes defined by the CHForth system. A local cannot be found when in interpret state and therefore not be executed.

Note: This word is not intended for direct use in a definition to declare that definition's locals. It is instead used by system or user compiling words. These compiling words in turn define their own syntax, and may be used directly in definitions to declare locals.

See also: LOCALS| {:



*  "star"  CORE

( n1|u1 n2|u2 -- n3|u3 )
Multiply n1|u1 by n2|u2 giving product n3|u3.



*/  "star-slash"  CORE

( n1 n2 n3 -- n4 )
Multiply n1 by n2 producing the double-cell intermediate result d. Divide d by n3, giving the single-cell quotient n4. Exception -10 is issued if n3 is zero or if the quotient n4 lies outside the range of a single-cell signed integer. If d and n3 differ in sign the result returned will be the same as returned by the phrase >R M* R> FM/MOD SWAP DROP. Note that other implementations of the ANSI standard may return the result of the phrase >R M* R> SM/REM SWAP DROP.



*/MOD  "star-slash-mod"  CORE

( n1 n2 n3 -- n4 n5 )
Multiply n1 by n2 producing the double-cell intermediate result d. Divide d by n3, giving the single-cell remainder n4 and the single-cell quotient n5. Exception -10 is issued if n3 is zero or if the quotient n5 lies outside the range of a single-cell signed integer. If d and n3 differ in sign the result returned will be the same as returned by the phrase >R M* R>FM/MOD. Note that other implementations of the ANSI standard may return the result of the phrase >R M* R> SM/REM.



+  "plus"  CORE

( n1|u1 n2|u2 -- n3|u3 )
Add n2|u2 to n1|u1, giving the sum n3|u3.



+!  "plus-store"  CORE

( n|u a-addr -- )
Add n|u to the single-cell number at a-addr.



+LOOP  "plus-loop"  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: do-sys -- )
Append the run-time semantics given below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE between the location given by do-sys and the next location for a transfer of control, to execute the words following +LOOP.

Run-time: ( n -- ) ( R: loop-sys1 -- | loop-sys2 )
The loop control parameters must be available. Add n to the loop index. If the loop index did not cross the boundary between the loop limit minus one and the loop limit, continue execution at beginning of the loop. Otherwise, discard the current loop control parameters and continue execution immediately following the loop.

See also: DO I



+PLACE  "plus-place"  KERNEL

( c-addr1 u c-addr2 -- )
Place the characters of the string specified by c-addr1 u at the end of the counted string at c-addr2 and add u to the count at c-addr2. An exception is issued if the length of the resulting string would be greater than the implementation defined maximum length of a counted string.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: PLACE



+TO  "plus-to"  KERNEL

Interpretation: ( i*x "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Perform the "+TO name run-time" semantic given in the definition for the defining word of name.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Append the "+TO name run-time" semantics given in the definition for the defining word of name to the current definition.

Implementation: Exception -32 is issued if name was not defined by a word with "+TO name run-time" semantics.

See also: VALUE 2VALUE (LOCAL) TO



,  "comma"  CORE

( x -- )
Reserve one cell of data space and store x in the cell. If the data-space pointer is aligned when , begins execution, it will remain aligned when , finishes execution.



-  "minus"  CORE

( n1|u1 n2|u2 -- n3|u3 )
Subtract n2|u2 from n1|u1, giving the difference n3|u3.



-CR  "minus-c-r"  KERNEL

( -- )
If there is output on the current line, perform CR.



-ROT  "minus-rote"  KERNEL

( x1 x2 x3 -- x3 x1 x2 )
Rotate the top three stack items. Equivalent to ROT ROT.



-TRAILING  "dash-trailing"  STRING

( c-addr u1 -- c-addr u2 )
If u1 is greater than zero, u2 is equal to u1 less the number of spaces at the end of the character string specified by c-addr u1. If u1 is zero or the entire string consists of spaces, u2 is zero.



.  "dot"  CORE

( n -- )
Display n in free field format.



.(  "dot-paren"  CORE-EXT

Compilation: Perform the execution semantics given below.

Execution: ( "ccc<paren>" -- )
Parse and display ccc delimited by ) (right parenthesis). ( is an immediate word.

See also: ( ."



.?DEC  "dot-question-decimal"  KERNEL

( n -- )
If BASE is outside the range {2..36}, BASE is set to DECIMAL. If BASE is DECIMAL, or n is less than BASE or 10, display n as a signed number. Otherwise display n as an unsigned number followed by the word 'decimal' and the number as a decimal signed number, both in parentheses.



.COPYRIGHT  "dot-copyright"  KERNEL

( -- )
Display the copyright message and e-mail address of the author.



.DEC  "dot-decimal"  KERNEL

( n -- )
Display n as a signed decimal number.

See also: .HEX



.EMIT  "dot-emit"  KERNEL

( char -- )
If char is a printable ASCII character in the range {32 .. 126}, use EMIT to display char. Otherwise use EMIT to display a . (dot).



.FREE  "dot-free"  KERNEL

( -- )
Display the amount of free memory and the beginning and end of free memory in the data, list, name, and string space. Display the size of the stacks and the amount of memory available for ALLOCand SEGMENT. Values are displayed in decimal with D.K or in hexadecimal with .HEX

See also: UNUSED.



.HEX  "dot-hex"  KERNEL

( u -- )
Display u as a four digit hexadecimal number with a leading $ (dollar sign) and a trailing space.

See also: .DEC H.



.MESS  "dot-message"  KERNEL

( n -- )
Display the message that is assigned to exception number n. If the message is not found, display the exception number and the name of the word where the exception occurred. If n is -1 nothing is displayed. If n is -2, display the message of the last invoked ABORT".



.R  "dot-r"  CORE-EXT

( n1 n2 -- )
Display n1 right aligned in a field n2 characters wide. If the number of characters required to display n1 is greater than n2, all digits are displayed with no leading spaces in a field as wide as necessary.



.S  "dot-s"  TOOLS

( -- )
Copy and display the values currently on the data stack. Display delimited by a ( (left parenthesis) and a ) (right parenthesis), the values on the stack. If BASE is DECIMAL, as signed numbers, unsigned otherwise. The rightmost number represents the value on the top of the stack. At most .SDEPTH values are displayed. A c-addr u pair may be displayed as a single string between a pair of " (double quote).

.S is implemented using pictured numeric output words. Its use will corrupt the transient region identified by #>.



.SDEPTH  KERNEL

( -- n )
A value. n is the maximum number of values displayed by .S.



.SEG  "dot-segment"  KERNEL

( u -- )
Display u as a four character string if it corresponds to a base paragraph address in CHForth else as a four digit hexadecimal string. Display a trailing : (colon).



.SIGNON  "dot-signon"  KERNEL

( -- )
Display the signon message. It contains the name of the program, the version and the name of the author.



.STACK  KERNEL

( -- )
When .RS is present, any THROW will display the annotated return stack.

See also: .RS



.TYPE  "dot-type"  KERNEL

( c-addr u -- )
If u is greater than zero, display the character string specified by c-addr and u. The characters are displayed as with .EMIT.



/  "slash"  CORE

( n1 n2 -- n3 )
Divide n1 by n2, giving the single-cell quotient n3. Exception -10 is issued if n2 is zero. If n1 and n2 differ in sign the result returned will be the same as returned by the phrase >RS>D R> FM/MOD SWAP DROP. Note that other implementations of the ANSI standard may return the result of the phrase >R S>D R> SM/REM SWAP DROP.



/LINE  "per-line"  KERNEL

( -- n )
n is the maximum number of characters in an input line.



/MOD  "slash-mod"  CORE

( x1 x2 -- x3 x4 )
Divide n1 by n2, giving the single-cell remainder n3 and the single-cell quotient n4. Exception -10 is issued if n2 is zero. If n1 and n2 differ in sign the result returned will be the same as returned by the phrase >R S>D R> FM/MOD. Note that other implementations of the ANSI standard may return the result of the phrase >R S>D R> SM/REM.



/NAME  "per-name"  KERNEL

( -- n )
n is the maximum number of characters in a definition name.



/STRING  "slash-string"  STRING

( c-addr1 u1 n -- c-addr2 u2 )
STRADJ the character string at c-addr1 by n characters. The resulting character string, specified by c-addr2 u2, begins at c-addr1 plus n characters and is u1 minus n characters long.



0  KERNEL

( -- 0 )
Return the value zero.



0<  "zero-less"  CORE

( n -- flag )
flag is true if and only if n is less than zero.



0<>  "zero-not-equals"  CORE-EXT

( x -- flag )
flag is true if and only if x is not equal to zero.



0=  "zero-equals"  CORE

( x -- flag )
flag is true if and only if x is equal to zero.



0>  "zero-greater"  CORE-EXT

( n -- flag )
flag is true if and only if n is greater than zero.



1  KERNEL

( -- 1 )
Return the value one.



1+  "one-plus"  CORE

( n1|u1 -- n2|u2 )
Add 1 to n1|u1 giving the sum n2|u2.



1-  "one-minus"  CORE

( n1|u1 -- n2|u2 )
Subtract 1 from n1|u1 giving the difference n2|u2.



2  KERNEL

( -- 2 )
Return the value two.



2!  "two-store"  CORE

( x1 x2 a-addr -- )
Store the cell pair x1 x2 at a-addr with x2 at a-addr and x1 at the next consecutive cell. It is equivalent to the sequence SWAP OVER ! CELL+ !.

See also: 2@



2*  "two-star"  CORE

( x1 -- x2 )
x2 is the result by shifting x1 one bit toward the most-significant bit, filling the vacated least-significant bit with zero.



2/  "two-slash"  CORE

( x1 -- x2 )
x2 is the result of shifting x1 one bit toward the least-significant bit, leaving the most-significant bit unchanged.



2>R  "two-to-r"  CORE-EXT

Interpretation: Perform the execution semantics given below.

Execution: ( x1 x2 -- ) ( R: -- x1 x2 )
Transfer cell pair x1 x2 to the return stack. Semantically equivalent to SWAP >R >R

See also: 2R> 2R@ R> R@



2@  "two-fetch"  CORE

( a-addr -- x1 x2 )
Fetch the cell pair x1 x2 stored at a-addr. x2 is stored at a-addr and x1 at the next consecutive cell. It is equivalent to the sequence DUP CELL+ @ SWAP @.

See also: 2!



2DROP  "two-drop"  CORE

( x1 x2 -- )
Drop cell pair x1 x2 from the stack.



2DUP  "two-dupe"  CORE

( x1 x2 -- x1 x2 x1 x2 )
Duplicate cell pair x1 x2.



2LITERAL  "two-literal"  DOUBLE

Interpretation: Perform the function of -14 THROW.

Compilation: ( x1 x2 -- )
Append the run-time semantics defined below to the current definition.

Run-time: ( -- x1 x2 )
Place cell pair x1 x2 on the stack.



2NIP  "two-nip"  KERNEL

( x1 x2 x3 x4 -- x3 x4 )
Drop the first cell pair below the top cell pair of the stack.



2NUMBER?  "two-number-question"  KERNEL

( c-addr u -- false | d|ud true )
Convert the string specified by c-addr u1 to a double-cell number in the current BASE and return the number and a true flag. A terminating . (dot) is required. If the number can not be converted, return false. To separate digit groups visually, any embedded , (comma) is permitted. The number is negative if it is prefixed by - (minus sign).

BASE can be ignored, numbers that are prefixed by

  # (number sign) are interpreted as decimal,
  $ (dollar sign) are interpreted as hexadecimal,
  % (percentage sign) are interpreted as binary.
These prefixes must be placed before an optional - for negative numbers. When BASE is sixteen or $ is used as prefix, lower case characters are considered equal to their upper case equivalents.



See also: NUMBER?


2OVER  "two-over"  CORE

( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 )
Copy cell pair x1 x2 to the top of the stack.



2R>  "two-r-from"  CORE-EXT

Interpretation: Perform the execution semantics given below.

Execution: ( -- x1 x2 ) ( R: x1 x2 -- )
Transfer the cell pair x1 x2 from the return stack. Semantically equivalent to R> R> SWAP

See also: >R 2>R 2R@ R@



2R@  "two-r-fetch"  CORE-EXT

Interpretation: Perform the execution semantics given below.

Execution: ( -- x1 x2 ) ( R: x1 x2 -- x1 x2 )
Copy cell pair x1 x2 from the returnstack. Semantically equivalent to R> R> 2DUP >R >R SWAP

See also: 2>R 2R> R@



2RDROP  "two-r-drop"  KERNEL

( -- } { R: x1 x2 -- )
Remove cell pair x1 x2 from the return stack. Semantically equivalent to RDROP RDROP.



2SWAP  "two-swap"  CORE

( x1 x2 x3 x4 -- x3 x4 x1 x2 )
Exchange the two top cell pairs.



:  "colon"  CORE

( C: "<spaces>name" -- colon-sys )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name called a "colon definition". Enter compilation state and start the current definition, producing colon-sys. Append the initiation semantics given below to the current definition.

The execution semantics of name will be determined by the words compiled into the body of the definition. The current definition definition for name is not findable in the dictionary until it is ended.

Initiation: ( i*x -- i*x ) ( R: -- nest-sys )
Save information nest-sys about the calling definition. The stack effects i*x represent arguments to name.

name Execution: ( i*x -- j*x )
Execute the definition name. The stack effects i*x and j*x represent arguments to and results from name, respectively.

See also: DOES> [ ] ;CODE



:NONAME  "colon-no-name"  CORE-EXT

( C: -- colon-sys ) ( S: -- xt )
Create an execution token xt, enter compilation state and start the current definition, producing colon-sys. Append the initiation semantics given below to the current definition.

The execution semantics of xt will be determined by the words compiled into the body of the definition. The definition can be executed later by xt EXECUTE.

Initiation: ( i*x -- i*x ) ( R: -- nest-sys )
Save implementation-dependent information nest-sys about the calling definition. The stack effects i*x represent arguments to xt.

xt Execution: ( i*x -- j*x )
Execute the definition specified by xt. The stack effects i*x and j*x represent arguments to and results from xt, respectively.



:REM  "colon-remember"  KERNEL

( C: -- colon-sys )
Create a nameless word that is executed when this part of the dictionary is removed.



;  "semicolon"  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: colon-sys -- )
Append the run-time semantics defined below to the current definition. End the current definition, allow it to be found in the dictionary and enter interpretation state, consuming colon-sys. The data-space pointer is left aligned.

Run-time: ( -- ) ( R: nest-sys -- )
Return to the calling definition specified by nest-sys.

See also: : :NONAME EXIT



<  "less-than"  CORE

( n1 n2 -- flag )
flag is true if and only if n1 is less than n2.

See also: U<



<#  "less-number-sign"  CORE

( -- )
Initialize the pictured numeric output conversion process.

See also: # #> #S



<>  "not-equals"  CORE-EXT

( x1 x2 -- flag )
flag is true if and only if x1 is not bit-for-bit the same as x2.



=  "equals"  CORE

( x1 x2 -- flag )
flag is true if and only if x1 is bit-for-bit the same as x2.



>  "greater-than"  CORE

( n1 n2 -- flag )
flag is true if and only if n1 is greater than n2.

See also: U>



>BODY  "to-body"  CORE

( xt -- a-addr )
a-addr is the data-field address corresponding to xt. This is only valid for words defined via CREATE.



>CALL  "to-call"  KERNEL

( xt1 -- xt2 | 0 )
xt2 is the execution token of the DOES> part of the defining word with execution token xt1. If xt1 is not created by such a defining word, return zero.



>FLAGS  "to-flags"  KERNEL

( dea -- n-addr )
n-addr is the flag field address of the dictionary entry dea.



>FORGET  "to-forget"  KERNEL

( dea -- n-addr )
n-addr is the forget field address of the dictionary entry dea.



>IN  "to-in"  CORE

( -- a-addr )
a-addr is the address of a cell containing the offset in characters from the start of the input buffer to the start of the parse area.



>INFO  "to-info"  KERNEL

( dea -- xt x )
Return the execution token xt and the contents of the flags field x of the definition identified by the dictionary entry address dea.

See also: FIND-NAME



>LWC  "to-l-w-c"  KERNEL

( char1 -- char2 )
If char1 is an upper case character, char2 is its lower case equivalent. Otherwise char2 is char1.

See also: >UPC



>NAME  "to-name"  KERNEL

( xt -- dea | 0 )
dea is the dictionary entry address that is associated with execution token xt. If xt is not a valid execution token, return zero.



>NUMBER  "to-number"  CORE

( ud1 c-addr1 u1 -- ud2 c-addr2 u2 )
ud2 is the unsigned result of converting the characters within the string specified by c-addr1 u1 into digits, using the number in BASE, and adding each into ud1 after multiplying ud1 by the number in BASE. Conversion continues left-to-right until a character that is not convertible, including any + or -, is encountered or the string is entirely converted. c-addr2 is the location of the first unconverted character or the first character past the end of the string if the string was entirely converted. u2 is the number of unconverted characters in the string.

Implementation: Overflow of ud2 during the conversion is ignored.



>ORDER  "to-order"  KERNEL

( wid -- )
Transform the search order consisting of widn .. wid1 (where wid1 is searched first) into widn .. wid1 wid. Exception -49 is issued if there are too many word lists in the search order.



>PARAGRAPHS  "to-paragraphs"  KERNEL

( u1 -- u2 )
u2 is the minimum number of paragraphs needed to store u1 characters.



>R  "to-r"  CORE

Interpretation: Perform the execution semantics given below.

Execution: ( x -- ) ( R: -- x )
Move x to the return stack.

See also: R> R@ 2>R 2R> 2R@



>SEG  "to-seg"  KERNEL

Interpretation: Perform the function of -14 THROW.

Execution: ( u -- )
u is the paragraph address of the data at the next execution of BLANK, CHARS,, ERASE, FILL, READ-FILE, SCAN, SKIP, SPLIT, STRING,, WRITE-FILE, WRITE-LINE, or ZCOUNT. After execution of these words, the paragraph address is reset to the default, CSEG.

See also: >SEG1 >SEG2



>SEG1  "to-seg-one"  KERNEL

Interpretation: Perform the function of -14 THROW.

Execution: ( u -- )
u is the paragraph address of the first data block at the next execution of +PLACE, CMOVE, CMOVE>, COMPARE, ICOMPARE, ISTR=, MEMCOPY, MOVE, PLACE, SEARCH, STR=, SPLIT-TEXT, STRDUP, or ISEARCH. After execution of these words, the paragraph address is reset to the default, CSEG.

See also: >SEG >SEG2



>SEG2  "to-seg-two"  KERNEL

Interpretation: Perform the function of -14 THROW.

Execution: ( u -- )
u is the paragraph address of the second data block at the next execution of +PLACE, CMOVE, CMOVE>, COMPARE, ICOMPARE, ISTR=, MOVE, PLACE, SEARCH, ISEARCH, STR=, or SPLIT-TEXT. After execution of these words, the paragraph address is reset to the default, CSEG.

See also: >SEG1



>UPC  "to-u-p-c"  KERNEL

( char1 -- char2 )
If char1 is a lower case character, char2 is its upper case equivalent. Otherwise char2 is char1.

See also: >LWC



>XT  "to-x-t"  KERNEL

( dea -- xt )
xt is the execution token that is associated with the dictionary entry address dea.



?  "question"  TOOLS

( a-addr -- )
Display the value stored at a-addr.

? is implemented using pictured numeric output words. Its use will corrupt the transient region identified by #>.



?CSP  "question-c-s-p"  KERNEL

( -- )
Issue exception -29 if the depth of the control flow stack differs from the value stored by !CSP. Issue exception -22 if the depth of the locals stack differs from the value stored by !CSP.



?DO  "question-do"  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- do-sys )
Place do-sys on the control flow stack. Append the run-time semantics given below the current definition. The semantics are incomplete until resolved by a consumer of do-sys such as LOOP.

Run-time: ( n1|u1 n2|u2 -- ) ( R: -- loop-sys )
If n1|u1 is equal to n2|u2, continue execution at the location given by the consumer of do-sys. Otherwise set up loop control parameters with index n2|u2 and limit n1|u1 and continue executing immediately following ?DO. Anything already on the return stack becomes unavailable until the loop control parameters are discarded.

Implementation: The condition of n1|u1 and n2|u2 being not both of the same type is ignored.

See also: +LOOP DO I LEAVE UNLOOP



?DUP  "question-dupe"  CORE

( x -- 0 | x x )
Duplicate x if it is non-zero.



?ERROR  "question-error"  KERNEL

( k*x x1 n -- k*x | i*x n )
If any bits of x1 are non-zero, perform the function of n THROW. Otherwise remove x1 and n from the stack and continue.



?LEAVE  "question-leave"  KERNEL

Interpretation: Perform the function of -14 THROW.

Execution: ( flag -- ) ( R: loop-sys -- | loop-sys )
If flag is true, discard the current loop control parameters. An ambiguous condition exists if they are unavailable. Continue execution immediately following the innermost syntactically enclosing DO ... LOOP or DO ... +LOOP. Otherwise continue.

See also: LEAVE



?PAIRS  "question-pairs"  KERNEL

( x1 x2 -- )
Compare x1 and x2. Exception -22 is issued if they are not equal.



?STACK  "question-stack"  KERNEL

( -- )
Check the stack pointers and issue an exception if one of them over- or underflows.



@  "fetch"  CORE

( a-addr -- x )
Fetch x, x is the value stored at a-addr.



@+  "fetch-plus"  KERNEL

( a-addr1 -- a-addr2 x )
Fetch x, x is the value stored at a-addr1. Add the size in address units of a cell to a-addr1 giving a-addr2.



@DEA  "fetch-d-e-a"  KERNEL

( wid -- dea )
Fetch the dictionary entry address dea of the last definition from the word list described by the word list identifier wid.



@X  "fetch-x"  KERNEL

( x-addr -- x )
Fetch x, x is the value stored at extended address x-addr.



ABORT  CORE

( i*x -- ) ( R: j*x -- )
If there is no exception frame on the exception stack (except the one built by QUIT, empty the data stack and perform QUIT, otherwise perform the function of -1 THROW.

Implementation: If ABORT was called during interpretation of a file or block, display some information about the file and the line where ABORT was called.



ABS  "abs"  CORE

( n -- u )
u is the absolute value of n.



ACCEPT  CORE

( c-addr +n1 -- +n2 )
Receive a string of at most +n1 characters. If +n1 is zero or greater than 32767, no characters will be received and +n2 will be zero. Display graphic characters as they are received. A program that depends on the presence or absence of non-graphic characters has an environmental dependency.

Input terminates when "return" is received. When input terminates, nothing is appended to the string, and the display is maintained in an implementation defined way.

+n2 is the length of the string stored at c-addr.



ACTION-OF  CORE-EXT

Interpretation: ( "<spaces>name" -- xt )
Skip leading spaces and parse name delimited by a space. xt is the xt assigned to name. An exception is issued if name was not defined by DEFER.

Compilation: ( "<spaces>name" -- )
Skip leading spaces and parse name delimited by a space. Append the run-time semantics given below to the current definition. An exception is issued if name was not defined by DEFER.

Run-time: ( -- xt )
xt is the execution token assigned to name when the run-time semantics is performed.

See also: DEFER! DEFER@ IS



ADD-LIST  KERNEL

( x2 x1 listid -- )
Append the cell pair x2 and x1 to the list identified by listid. x1 may be looked up in the list by IN-LIST and if successful, x2 will be returned.

See also: ADD-2LIST IN-2LIST NEW-LIST



AGAIN  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: dest -- )
Append the run-time semantics given below to the current definition, resolving the backward reference dest.

Run-time: ( -- )
Continue execution at the location specified by dest. If no other control flow words are used, any program code after AGAIN will not be executed.

See also: BEGIN



AHEAD  TOOLS-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- orig )
Put the location of a new unresolved forward reference orig onto the control flow stack. Append the run-time semantics given below to the current definition. The semantics are incomplete until orig is resolved (e.g., by THEN).

Run-time: ( -- )
Continue execution at the location specified by the resolution of orig.



ALIAS  KERNEL

( xt "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the semantics defined for the execution token xt. name inherits the flags from xt.

See also: SYNONYM



ALIGN  CORE

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



ALIGNED  CORE

( addr -- a-addr )
a-addr is the first aligned address greater than or equal to addr.



ALLOC  KERNEL

( u1 -- u2 ior )
Allocate u1 contiguous paragraphs of free memory available to the operating system. The data-space pointer is unaffected by this operation. The initial contents of the allocated space is undefined.

If the allocation succeeds, u2 is the starting paragraph address of the allocated space and ior is zero.

If the operation fails, u2 is the number of paragraphs of the largest contiguous available memory block and ior is the I/O result code.

See also: DEALLOC REALLOC



ALLOC-H  KERNEL

( +n -- a-addr )
Reserve +n address units of contiguous data space. The data space pointer is unaffected by this operation. The initial content of the allocated space is undefined. a-addr is the aligned starting address of the allocated space.

Note: This space does not survive SAVE-SYSTEM.

See also: ALLOC-S ALLOT



ALLOC-S  KERNEL

( +n -- c-addr )
Reserve +n characters of temporary contiguous data space. The data-space pointer is unaffected by this operation. The initial content of the allocated space is undefined. c-addr is the starting address of the allocated space.

See also: ALLOC-H



ALLOT  CORE

( n -- )
If n is greater than zero, reserve n address units of data space. If n is less than zero, release |n| address units of data space. If n is zero, leave the data-space pointer unchanged.

If the data-space pointer is aligned and n is a multiple of the size of a cell when ALLOT begins execution, it will remain aligned when ALLOT finishes execution.

If the data-space pointer is character aligned and n is a multiple of the size of a character when ALLOT begins execution, it will remain character aligned when ALLOT finishes execution.



ALSO  SEARCH-EXT

( -- )
Transform the search order consisting of widn .. wid2 wid1 (where wid1 is searched first) into widn .. widn2 wid1 wid1. Exception -49 is issued if there are too many word lists in the search order.



AND  CORE

( x1 x2 -- x3 )
x3 is the bit-by-bit logical "and" of x1 with x2.



APPEND-FILE  KERNEL

( fileid -- ior )
Reposition the file identified by fileid to the end of the file. ior is the I/O result code.

At the conclusion of the operation, FILE-POSITION returns the length of the file as a double number.



ARGS  "arguments"  KERNEL

( -- c-addr u )
c-addr u describe a character string containing a copy of the string following the program name on the command line that invoked the program.

See also: COLD



ASSIGN-KEY  KERNEL

( xt char | xt x -- )
Assign execution token xt to control character char or extended key x. An exception is issued if char is not a control character or an extended key.

See also: MATCH-KEY



AT-XY  "at-x-y"  FACILITY

( u1 u2 -- )
Perform steps so that the next character displayed will appear in column u1, row u2 of the current output device, the upper left corner of which is row zero, column zero. It is a no-op if the operation cannot be performed on the current output device with the specified parameters. Note that for other implementations the result in that case is an ambiguous condition.



ATEXIT  "at-exit"  KERNEL

( -- )
A word that is executed when the program is terminated or when special actions like SAVE-SYSTEM or EMPTY are performed.

See also: STARTUP



B.  "b-dot"  KERNEL

( u -- )
Display u as a two digit hexadecimal number with a trailing space.

See also: H.



B/BUF  "bytes-per-buffer"  KERNEL

( -- n )
n is the number of characters in a block buffer.



BASE  CORE

( -- a-addr )
a-addr is the address of a cell containing the current number conversion radix {{2..36}}.



BASENAME  KERNEL

( c-addr1 u1 -- c-addr2 u2 )
If the character string c-addr u1 contains one or more occurrences of / (slash), c-addr2 is the address of the first character after the rightmost occurrence of the slash and u2 is the number of characters to the right of the slash. If no slash is present, or u1 is zero, c-addr2 is c-addr1 and u2 is u1.

See also: DIRNAME NO-EXT



BEEP  KERNEL

( -- )
Make an alarm sound on the speaker.

See also: CLICK.



BEEPH  "beep-height"  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the frequency in Hertz of BEEP.



BEEPL  "beep-length"  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the duration in milliseconds of BEEP.



BEGIN  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- dest )
Put the next location for a transfer of control, dest, onto the control flow stack. Append the run-time semantics given below to the current definition.

Run-time: ( -- )
Continue execution.

See also: REPEAT UNTIL WHILE



BIN  FILE

( fam1 -- fam2 )
Modify the file access method fam1 to additionally select a "binary", i.e. not line oriented, file access method, giving access method fam2.

See also: DENYALL R/O R/W W/O



BL  "b-l"  CORE

( -- char )
char is the character value for a space.



BLANK  STRING

( c-addr u -- )
If u is greater than zero, store the character value for space in u consecutive character positions beginning at c-addr.

Implementation: The paragraph address of c-addr may be modified by >SEG.



BLINK  KERNEL

( -- )
Invert the blink character attribute.

See also: BRIGHT NORMAL INVERSE



BLK  "b-l-k"  BLOCK

( -- a-addr )
a-addr is the address of a cell containing zero or the number of the mass-storage block being interpreted. If BLK contains zero, the input source is not a block and can be identified by SOURCE-ID. A program may not directly alter the contents of BLK.



BLOCK  BLOCK

( u -- a-addr )
a-addr is the address of the first character of the block buffer assigned to mass-storage block u. Exception -33, -34 or -35 is issued if u is not an available block number.

If block u is already in a block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there is an unassigned block buffer, transfer block u from mass-storage to an usassigned block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there are no unassigned block buffers, unassign a block buffer. If the block in that buffer has been UPDATEd, transfer the block to mass-storage and transfer block u from mass storage into the buffer. a-addr is the address of that block buffer.

At the conclusion of the operation the block buffer pointed to by a-addr is the current block buffer and is assigned to u.



BLOCK-CURSOR  KERNEL

( -- )
Set the cursor form to a block.



BODY>  "body-from"  KERNEL

( a-addr -- xt )
xt is execution token corresponding to the data field address a-addr. This is only valid for a word defined via CREATE.



BOUNDS  KERNEL

( n1|u1 n2|u2 -- n3|u3 n1|u1 )
Add n1|u1 to n2|u2 giving n3|u3. Used for setting up DOLOOPs. Semantically equivalent to OVER + SWAP.



BRIGHT  KERNEL

( -- )
Invert the bright character attribute.

See also: BLINK NORMAL INVERSE



BUFFER  BLOCK

( u -- a-addr )
a-addr is the address of the first character of the block buffer assigned to block u. The contents of the block are unspecified. Exception -34 or -35 is issued if u is not an available block number.

If block u is already in a block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there is an unassigned block buffer, a-addr is the address of that block buffer.

If block u is not already in memory and there are no unassigned block buffers, unassign a block buffer. If the block in that buffer has been UPDATEd, transfer the block to mass-storage. a-addr is the address of that block buffer.

At the conclusion of the operation the block buffer pointed to by a-addr is the current block buffer and is assigned to u.

See also: BLOCK



BUFFER-FILE  KERNEL

( fileid -- ior )
Allocate a buffer outside the data space for the file identified by fileid for subsequent use by READ-CHAR, READ-CHAR3 or WRITE-CHAR. If the operation is successful, ior is zero. Otherwise ior is the I/O result code. Freeing the buffer is done by CLOSE-FILE.

See also: FLUSH-FILE



BYE  TOOLS-EXT

( -- )
Return control to the host operating system with return code zero.

See also: HALT



C!  "c-store"  CORE

( char c-addr -- )
Store char at c-addr.



C!X  "c-store-x"  KERNEL

( char x-addr -- )
Store char at extended address x-addr.



C,  "c-comma"  CORE

( char -- )
Reserve space for one character in the data space and store char in the space. The data-space pointer is always character-aligned.



C>S  "c-to-s"  KERNEL

( char -- c-addr u )
c-addr u represent a temporary string containing character char.



C@  "c-fetch"  CORE

( c-addr -- char )
Fetch the character stored at c-addr.



C@X  "c-fetch-x"  KERNEL

( x-addr -- char )
Fetch the character stored at extend address x-addr.



CALIBRATE  KERNEL

( -- )
Calculate the approximate values for MS/T for this processor.



CALL,  "call-comma"  KERNEL

( a-addr -- )
Compile an assembly language call in the dictionary at the data-space pointer to the address on the stack and increment the data-space pointer to an aligned address after the instruction.



CAPACITY  KERNEL

( -- u )
u is the total number of mass-storage blocks of the current block file or disk being used.



CASE  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- case-sys )
Mark the start of the CASE ... OF ... ENDOF ... ENDCASE structure. Append the run-time semantics given below to the current definition.

Run-time: ( -- )
Continue execution.



CASESENSITIVE  KERNEL

( -- a-addr )
a-addr is the address of a cell containing a non zero value when case of characters is significant, zero otherwise.

See also: FIND-NAME-IN SEARCH-WORDLIST



CATCH  EXCEPTION

( i*x xt -- j*x 0 | i*x n )
Push an exception frame on the exception stack and then execute the execution token xt (as with EXECUTE) in such a way that control can be transferred to a point just after CATCH if THROW is executed during the execution of xt.

If the execution of xt completes normally (i.e. the exception frame pushed by this CATCH is not popped by an execution of THROW) pop the execution frame and return zero on top of the data stack, above whatever stack items would have been returned by xt EXECUTE. Otherwise, the remainder of the execution semantics are given by THROW.

Implementation: No input source specification is saved by CATCH.



CCAT  "c-cat"  KERNEL

( c-addr1 u1 char -- c-addr2 u2 )
c-addr2 u2 describe a temporary location containing the characters of the string specified by c-addr1 u1 followed by character char. u2 is u1+1. c-addr2 may differ from c-addr1.

See also: STRCAT



CELL+  "cell-plus"  CORE

( a-addr1 -- a-addr2 )
Add the size in address units of a cell to a-addr1 giving a-addr2.



CELL-  "cell-minus"  KERNEL

( a-addr1 -- a-addr2 )
Subtract the size in address units of a cell from a-addr1 giving a-addr2.



CELL/  KERNEL

( u1 -- u2 )
u2 is the number of cells in u1 characters.



CELLS  CORE

( n1 -- n2 )
n2 is the size in address units of n1 cells.



CHAR+  "char-plus"  CORE

( c-addr1 -- c-addr2 )
Add the size in address units of a character to c-addr1 giving c-addr2.



CHAR-  "char-minus"  KERNEL

( c-addr1 -- c-addr2 )
Subtract the size in address units of a character from c-addr1 giving c-addr2.



CHARS  "chars"  CORE

( n1 -- n2 )
n2 is the size in address units of n1 characters.



CHARS,  "chars-comma"  KERNEL

( c-addr u -- )
Allocate space for u characters at the data-space pointer and copy u characters beginning at c-addr into the allocated space.

Implementation: The paragraph address of c-addr may be modified by >SEG.

See also: STRING,



CHFORTH  KERNEL

( -- c-addr u )
c-addr u represent a string containing the name, the processor type, and version of the CHForth program.

CHFORTH is implemented using pictured numeric output words. Its use will corrupt the transient region identified by #>.



CHOOSE  KERNEL

( u1 -- u2 )
u2 is a random number less than u1.



CLEAR  KERNEL

Interpretation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Perform the "CLEAR name run-time" semantic given in the definition for the defining word of name.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Append the "CLEAR name run-time" semantics given in the definition for the defining word of name to the current definition.

Implementation: Exception -32 is issued if name was not defined by a word with "CLEAR name run-time" semantics.

See also: VALUE 2VALUE (LOCAL) TO



CLICK  KERNEL

( -- )
Make a more pleasant sort of BEEP.



CLOSE-FILE  FILE

( fileid -- ior )
Close the file identified by fileid, ior is the I/O result code.

Implementation: If fileid is equal to STDIN, STDOUT, or STDERR, the file is not closed and ior is zero.



CLS  

( -- )
Clear the stacks, except the return stack.



CMOVE  "c-move"  STRING

( c-addr1 c-addr2 u -- )
If u is greater than zero, copy u consecutive characters, character-by-character and left-to-right, from c-addr1 to c-addr2. If c-addr2 lies within the source region, memory propagation occurs. (c-addr2 lies within the source region if c-addr2 is not less than c-addr1 and c-addr2 is less than the quantity c-addr1 u CHARS +).

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: CMOVE> MOVE



CMOVE>  "c-move-up"  STRING

( c-addr1 c-addr2 u -- )
If u is greater than zero, copy u consecutive characters, character-by-character and right-to-left, from c-addr1 to c-addr2. If c-addr1 lies within the destination region, memory propagation occurs. (c-addr1 lies within the destination region if c-addr1 is greater than or equal to c-addr2 and if c-addr2 is less than the quantity c-addr1 u CHARS +).

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: CMOVE MOVE



CO  "coroutine"  KERNEL

Interpretation: Perform the function of -14 THROW.

Execution: ( -- ) ( R: nest-sys1 -- nest-sys2 )
Save information nest-sys2 about the current definition. Return control to the calling definition specified by nest-sys1.



COLD  KERNEL

( -- )
Start or restart the Forth system. When the program starts, interpret the string given by ARGS. If u is not zero, ignore the first space delimited word if it begins with -. Otherwise it represents the name of a text file. INCLUDE the file. Interpret the remainder of the ARGS. If the length of ARGS is zero, display the .SIGNON message. If ARGS is exhausted or when COLD is executed, perform QUIT.



COLS  KERNEL

( -- n )
Return the number of characters on an output line.

See also: ROWS



COMPARE  STRING

( c-addr1 u1 c-addr2 u2 -- n )
Compare the string specified by c-addr1 u1 to the string specified by c-addr2 u2. The strings are compared, beginning at the given addresses, character by character, up to the length of the shorter string or until a difference is found. If the two strings are identical, n is zero. If the two strings are identical up to the length of the shorter string, n is minus-one (-1) if u1 is less than u2, and one (1) otherwise. If the two strings are not identical up to the length of the shorter string, n is minus-one (-1) if the first non-matching character in the string specified by c-addr1 u1 has a lesser numerical value than the corresponding character in the string specified by c-addr2 u2 and one (1) otherwise.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: ICOMPARE SEARCH STR=



COMPILE,  "compile-comma"  CORE-EXT

( xt -- )
Append the execution semantics of the definition represented by xt to the execution semantics of the current word definition.



COMPILING?  "compiling-question"  KERNEL

( -- flag )
flag is true in compilation state, false otherwise.

See also: STATE



CONSOLE?  "console-question"  KERNEL

( -- flag )
A value containing true if output to the screen is enabled.



CONSTANT  CORE

( x "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below.

name is referred to as a "constant".

name Execution: ( -- x )
Place x on the stack.



COUNT  CORE

( c-addr1 -- c-addr2 u )
Return the character string specification for the counted string stored at c-addr1. c-addr2 is the address of the first character after c-addr1. u is the contents of the character at c-addr1, which is the length in characters of the string at c-addr2.



COUNTX  "count-x"  KERNEL

( x-addr1 -- x-addr2 char )
Fetch the character char stored at extended address x-addr1 and add the size in address units of a character to x-addr1 giving x-addr2.



CPU  "c-p-u"  KERNEL

( -- n )
n identifies the processor type. Allowed values are 86, 186, 286, 386, 486, 586 and 686.



CR  "c-r"  CORE

( -- )
Cause subsequent output to appear at the beginning of the next line.



CREATE  CORE

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below. If the data-space pointer is not aligned, reserve enough data space to align it. The new data-space pointer defines name's data field. CREATE does not allocate data space in name's data field.

name Execution: ( -- a-addr )
a-addr is the address of name's data field. The execution semantics of name may be extended by using DOES> or ;CODE.



CREATE-FILE  FILE

( c-addr u fam -- fileid ior )
Create the file named in the character string specified by c-addr and u, and open it with file access method fam. If a file with the same name already exists, recreate it as an empty file.

If the file was successfully created and opened, ior is zero, fileid is its identifier, and the file has been positioned at the start of the file.

Otherwise ior is the I/O result code and fileid is undefined.

Implementation: If the file name begins with ~ (tilde), it is expanded by EXPAND-PATH.



CSEG  "c-seg"  KERNEL

( -- u )
u is the paragraph address of the code and data space. This space holds the stacks if SSEG is missing.



D+  "d-plus"  DOUBLE

( d1|ud1 d2|ud2 -- d3|ud3 )
Add d2|ud2 to d1|ud1, giving the sum d3|ud3.



D-  "d-minus"  DOUBLE

( d1|ud1 d2|ud2 -- d3|ud3 )
Subtract d2|ud2 from d1|ud1, giving the difference d3|ud3.



D.  "d-dot"  DOUBLE

( d -- )
Display d in free field format.



D.K  "d-dot-k"  KERNEL

( ud -- )
Divide ud by 1024 and display the result in a field of at least 5 characters wide with one decimal and a space.



D.R  "d-dot-r"  DOUBLE

( d n -- )
Display d right aligned in a field n characters wide. If the number of characters required to display d is greater than n, all digits are displayed with no leading spaces in a field as wide as necessary.



D0<  "d-zero-less"  DOUBLE

( d -- flag )
flag is true if and only if d is less than zero.



D<  "d-less-than"  DOUBLE

( d1 d2 -- flag )
flag is true if and only if d1 is less than d2.



D=  "d-equals"  DOUBLE

( xd1 xd2 -- flag )
flag is true if and only if xd1 is equal to xd2.



D>  "d-greater-than"  KERNEL

( d1 d2 -- flag )
flag is true if and only if d1 is greater than d2.



D>S  "d-to-s"  DOUBLE

( d -- n )
n is the equivalent of d. An overflow occurs if d lies outside the range of a signed single-cell number.



DABS  "d-abs"  DOUBLE

( d -- ud )
ud is the absolute value of d.



DATE  KERNEL

( -- +n1 +n2 +n3 )
Return the current date. +n1 is the day {1..31}, +n2 is the month {1..12}, and +n3 is the year (e.g. 1991).



DEALLOC  KERNEL

( u -- ior )
Return the contiguous region of memory outside the data space indicated by the paragraph address u to the operating system for later allocation. u shall indicate a region of memory outside the data space that was previously obtained by ALLOC or REALLOC. The data-space pointer is unaffected by this operation.

If the operation succeeds, or u is zero, ior is zero. If the operation fails, ior is the I/O result code.



DECIMAL  CORE

( -- )
Set the numeric conversion radix to ten (decimal).



DEFER  CORE-EXT

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below.

name Execution: ( i*x -- j*x )
Execute the xt assigned to name. Exception -60 is issued if no execution token is assigned to name.

See also: ACTION-OF DEFER! DEFER@ DEFERSIS



DEFERS  KERNEL

Interpretation: Perform the function of -14 THROW.

Compilation: ( "<spaces>name" -- )
Skip leading spaces and parse name delimited by a space. Append the xt assigned to name to the current definition. An exception is issued if name was not defined by DEFER.

See also: ACTION-OF DEFER@



DEFINITIONS  SEARCH

( -- )
Make the compilation word list the same as the first word list in the search order. Specifies that the names of subsequent definitions will be placed in the compilation word list. Subsequent changes in the search order will not effect the compilation word list.



DELETE-FILE  FILE

( c-addr u -- ior )
Delete the file named in the character string specified by c-addr u.

Implementation: If the file name begins with ~ (tilde), it is expanded by EXPAND-PATH.



DENYALL  KERNEL

( fam1 -- fam2 )
Modify the file access method fam1 to additionally select a file mode which denies access of other processes for reading and writing, giving access method fam2.

See also: BIN R/O R/W W/O



DEPTH  CORE

( -- +n )
+n is the number of single-cell values on the data stack before +n was placed on the stack.



DIAGNOSE  KERNEL

( -- )
Display information over the compiled number of bytes, number of lines and the elapsed time since the start of the program.



DIGIT  KERNEL

( char +n1 -- +n2 true | char false )
+n2 is the result of the conversion of char into a single-digit number using base +n1. Return also a true flag. If the conversion fails return char and a false flag. If +n1 is sixteen, a lower case char is considered equal to its upper case equivalent.



DIRNAME  KERNEL

( c-addr u1 -- c-addr u2 )
If the character string c-addr u1 contains one or more occurrences of / (slash), u2 is the number of characters to the left of the rightmost occurrence of the slash. If no slash is present or if the string consists of a single slash, or u1 is zero, u2 is zero.

See also: BASENAME



DNEGATE  "d-negate"  DOUBLE

( d1 -- d2 )
d1 is the negation of d1.



DO  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- do-sys )
Place do-sys on the control flow stack. Append the run-time semantics given below the current definition. The semantics are incomplete until resolved by a consumer of do-sys such as LOOP.

Run-time: ( n1|u1 n2|u2 -- ) ( R: -- loop-sys )
Set up loop control parameters with index n2|u2 and limit n1|u1. Anything already on the return stack becomes unavailable until the loop control parameters are discarded.

Implementation: The condition of n1|u1 and n2|u2 being not both of the same type is ignored.

See also: +LOOP



DROP  CORE

( x -- )
Remove x from the stack.



DTA  "d-t-a"  KERNEL

( -- a-addr )
a-addr is the address of the disk transfer area, used by FIND-FIRST-FILE and FIND-NEXT-FILE. Nesting of these procedures is done by changing this value. The size of the disk transfer area is 128 address units.



DUP  "dupe"  CORE

( x -- x x )
Duplicate x.



DUP>R  "dupe-to-r"  KERNEL

( x -- x } { R: -- x )
Copy x to the return stack. Semantically equivalent to DUP >R.

See also: RDROP



EDIT-LINE  "edit-line"  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the line number of the file where an exception occurred or of the file returned by LOCATE or WHICH.



EKEY  "e-key"  FACILITY-EXT

( -- u )
Receive one keyboard event u. ASCII keys have bits 7 to 15 set to zero; other keys have the scan code in bits 8 to 15 and the lower bits set to zero. Key codes made by holding the ALT-key down and using the numeric pad give a 8 bit code.



EKEY>CHAR  "e-key-to-char"  FACILITY-EXT

( u -- u false | char true )
If the keyboard event u corresponds to a valid 8 bit character, return that character and true, otherwise return u and false.



EKEY?  "e-key-question"  FACILITY-EXT

( -- flag )
If a keyboard event is available, return true. Otherwise return false. The event shall be returned by the next execution of EKEY.

After EKEY? returns with a value of true, subseqent executions of EKEY? prior to the execution of KEY, KEY? or EKEY also return true, referring to the same event.



ELAPSED  KERNEL

( -- c-addr u )
c-addr u specify the time elapsed in seconds since the last execution of TIMER-RESET, in the format of a numeric string with three digits after the decimal point.

ELAPSED is implemented using pictured numeric output words. Its use will corrupt the transient region identified by #>.

See also: .ELAPSED



ELSE  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: orig1 -- orig2 )
Put the location of a new unresolved forward reference orig2 onto the control flow stack. Append the run-time semantics given below to the current definition. The semantics will be incomplete until orig2 is resolved (e.g. by THEN). Resolve the forward reference orig1 using the location following the appended run-time semantics.

Run-time: ( -- )
Continue execution at the location given by the resolution of orig2.

See also: IF



EMIT  CORE

( x -- )
If x is a graphic character in the implementation-defined character set, display x. The effect of EMIT for all other values of x is implementation-defined.

Programs that use control characters to perform specific functions have an environmental dependency. Each EMIT deals with one character.

See also: TYPE



EMIT?  "emit-question"  FACILITY-EXT

( -- flag )
flag is true if the user output device is ready to accept data and the execution of EMIT in place of EMIT? would not have suffered an indefinite delay. If the device status is indeterminate, flag is true.



EMPTY  KERNEL

( -- )
Perform the function of FORGET on all definitions that were compiled after the last execution of EMPTY.



EMPTY-BUFFERS  BLOCK-EXT

( -- )
Unassign all block buffers. Do not transfer the contents of any UPDATEd block buffer to mass storage.

See also: BLOCK



END-METHODS  KERNEL

( method-sys -- )
Terminate defining methods. Remove method-sys from the stack.

See also: METHODS.



ENDCASE  "end-case"  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: case-sys -- )
Mark the end of the CASE ... OF ... ENDOF ... ENDCASE structure. Use case-sys to resolve the entire structure. Append the run-time semantics given below to the current definition.

Run-time: ( x -- )
Discard the case selector x and continue execution.



ENDOF  "end-of"  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: case-sys1 of-sys -- case-sys2 )
Mark the end of the ... OF ... ENDOF ... part of the CASEstructure. The next location for a transfer of control resolves the reference given by of-sys. Append the run-time semantics given below to the current definition. Replace case-sys1 with case-sys2 on the control flow stack, to be resolved by ENDCASE.

Run-time: ( -- )
Continue execution at the location specified by the consumer of case-sys2.

See also: ENDCASE



ENVSIZE  KERNEL

( -- +n )
+n is the number of characters occupied by the environment strings of the operation system.

See also: ESEG



ERASE  CORE-EXT

( c-addr u -- )
If u is greater than zero, clear all bits in each of u consecutive address units of memory beginning at c-addr.

Implementation: The paragraph address of c-addr may be modified by >SEG.



ERROR  KERNEL

( n -- )
Display the exception message and information where the exception with number n occurred and the type of the exception and display the source line with the exception word marked out.



ERROR-ID  "error-i-d"  KERNEL

( -- n )
n identifies the source of the last exception occurring when

   0  interpreting text entered at the terminal;
  +n  loading a textfile;
  -2  loading a block;
  -1  evaluating a string.


ERRSTR,  "error-string-comma"  KERNEL

( c-addr u n -- )
Compile the string described by c-addr u and exception number n into the dictionary. When passed n, MESSAGE returns the string.

See also: EXCEPTION



ERRTEXT  "error-text"  KERNEL

( -- a-addr )
a-addr contains two cells, the length and temporary address respectively, of the string representing the source line where an exception occurred.



ESEG  "e-seg"  KERNEL

( -- u )
u is the paragraph address of the environment strings of the operating system.

See also: ENVSIZE



ETX?  "end-of-text-question"  KERNEL

( -- flag )
If the parse area is empty, attempt to REFILL the current input stream, returning false if succesful. Otherwise return true.



EVALUATE  CORE

( i*x c-addr u -- j*x )
Save the current input source specification. Store zero in BLK. Store minus one (-1) in SOURCE-ID. Make the string described by c-addr and u both 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 words EVALUATEd.



EXCEPTION  KERNEL

( c-addr u -- n )
Compile the string described by c-addr u into the dictionary. Decrement the value of #EXCEPTION. n is the current value of #EXCEPTION. When passed n, MESSAGE returns the string.

See also: NEWEST



EXECUTE  CORE

( i*x xt -- j*x )
Remove xt from the stack and perform the semantics identified by it. Other stack effects are due to the word EXECUTEd.

See also: ' [']



EXPAND-PATH  KERNEL

( c-addr1 u1 -- c-addr2 u2 )
If the string c-addr1 u1 begins with ~ (tilde), c-addr2 u2 describe a temporary region containing the string returned by FORTH-ROOT followed by c-addr1 u1 without the leading ~. If a leading ~ is present, it must be followed by / (slash). Otherwise, if a leading ~ is not present, the string c-addr1 u1 is copied and u2 is u1. A NUL character is present after the string but is not included in the count u2.

The result of a string starting with / will be the letter of the current drive followed by : and the given string.



FAIL  KERNEL

( -- xt )
xt is returned by PARSER if no matching execution routine is found.



FALSE  CORE-EXT

( -- false )
Return a false flag.



FASTKEY?  "fastkey-question"  KERNEL

( -- flag )
If a key was pressed, return true. Otherwise return false. This word looks directly to the keyboard buffer of the BIOS so it is not directly compatible with EKEY? and KEY? and is much faster.



FILE-NAME  KERNEL

( -- c-addr )
c-addr is the address of a counted character string representing the name of the current input file. Only valid if SOURCE-ID contains the fileid of the current open file. A program shall not directly alter the contents of FILE-NAME.

See also: #LINES



FILE-POSITION  FILE

( fileid -- ud ior )
ud is the current file position for the file identified by fileid. ior is the I/O result code. ud is undefined if ior is non-zero.



FILE-SIZE  FILE

( fileid -- ud ior )
ud is the size, in characters, of the file identified by fileid. ior is the I/O result code. This operation does not effect the value returned by FILE-POSITION. ud is undefined if ior is non-zero.



FILE-STATUS  FILE-EXT

( c-addr u -- x ior )
Return the status of the file identified by the character string c-addr u. If the file exists, ior is zero and x is the file attribute; otherwise ior is the I/O result code and x is undefined.

Implementation: If the file name begins with ~ (tilde), it is expanded by EXPAND-PATH.

See also: SET-FILE-ATTRIBUTE



FILL  CORE

( c-addr u char -- )
If u is greater than zero, store char in each of u consecutive characters of memory beginning at c-addr.

Implementation: The paragraph address of c-addr may be modified by >SEG.



FIND-NAME  KERNEL

( c-addr u -- 0 | dea )
Find the definition identified by the string c-addr u. If the definition is not found after searching all word lists in the search-order, return zero. If the definition is found, return its dictionary entry address dea. Case of characters is significant if the value of CASESENSITIVE is not zero.

See also: FIND FIND-NAME-IN SEARCH-CONTEXTSEARCH-WORDLIST



FIND-NAME-IN  KERNEL

( c-addr u wid -- 0 | dea )
Find the definition identified by the string c-addr u in the word list identified by wid. If the definition is not found, return zero. If the definition is found, return its dictionary entry address dea. Case of characters is significant if the value of CASESENSITIVE is not zero.

See also: FIND-NAME SEARCH-WORDLIST >INFO



FLUSH  BLOCK

( -- )
Perform the function of SAVE-BUFFERS, then unassign all block buffers.



FLUSH-FILE  FILE-EXT

( fileid -- ior )
Attempt to force any buffered information written to the file referred to by fileid to be written to mass storage, and the size information for the file to be recorded in the storage directory if changed. If the operation is successful, ior is zero. Otherwise ior is the I/O result code.

See also: BUFFER-FILE



FM/MOD  "f-m-slash-mod"  CORE

( d n1 -- n2 n3 )
Divide d by n1, giving the floored quotient n3 and the remainder n3. Input and output stack arguments are signed. Exception -10 is issued if n1 is zero or the quotient lies outside the range of a single-cell signed integer.

See also: SM/REM UM/MOD



FORTH  SEARCH-EXT

( -- )
Transform the search order consisting of widn .. wid2 wid1 (where wid1 is searched first) into widn .. wid2 wid(FORTH-WORDLIST).



FORTH-ROOT  KERNEL

( -- c-addr u )
c-addr u describe a string representing the name of the base directory where the Forth source text files reside. The directory name is defined by the environment variable ForthRoot or, when not present, the path to the CHForth program. Path names starting with ~ (tilde) are relative to this directory.

See also: EXPAND-PATH INFO ~



FORTH-WORDLIST  SEARCH

( -- wid )
Return wid, the identifier of the word list that includes all standard words provided by the implementation. This word list is initially the compilation word list and is part of the initial search order.



GET-CURRENT  SEARCH

( -- wid )
Return wid, the identifier of the compilation word list.



GET-DIRECTORY  KERNEL

( -- c-addr u ior )
c-addr u describe a temporary location containing the name of the current directory. The name is preceded by the drive letter and a colon. If no exception occurs, ior is zero. Otherwise c-addr and u are unspecified and ior is the I/O result code. Characters are converted to lower case and \ (backslash) to / (slash). c-addr u is not terminated by a slash.

See also: MAKE-DIRECTORY PWD SET-DIRECTORY



GET-FILE-TIME  KERNEL

( fileid -- u1 u2 ior )
u1 and u2 are the packed modification time and date respectively of the file identified by fileid. If no exception occurs, ior is zero. Otherwise u1 and u2 are unspecified and ior is the I/O result code.

See also: FOUND-DATE SET-FILE-TIME UNPACK-DATE UNPACK-TIME



GET-INTERRUPT  KERNEL

( n -- x-addr )
Return the extended address x-addr of the interrupt vector n.



GET-ORDER  SEARCH

( -- widn .. wid1 n )
Returns the number of word lists n in the search order and the word list identifiers widn .. wid1 identifying these word lists. wid1 identifies the word list searched first, and widn the word list that is searched last. The search order is unaffected.



GET-XY  "get-x-y"  KERNEL

( -- u1 u2 )
Return the column u1 and row u2 of the cursor on the screen.



GETENV  "get-environment"  KERNEL

( c-addr1 u1 -- c-addr2 u2 )
Search the operating system environment for the character string specified by c-addr1 u1, given without a terminating = (equals). The case of the characters is significant. c-addr2 u2 describe a temporary location containing a character string representing the characters in the matching environment string following =. If c-addr1 u1 is not found, u2 is zero and c-addr2 is a temporary location.

See also: ENVIRONMENT? IDENT SEARCH-ENVIRONMENT



H.  "h-dot"  KERNEL

( u -- )
Display u as a four digit hexadecimal number with a trailing space.

See also: .HEX (H.) B.



HALT  KERNEL

( n -- )
Return control to the host operating system with return code n.

See also: BYE TURNKEY



HEADER  KERNEL

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a dictionary entry for name. The entry is not known to the Forth system until REVEAL is executed. The data-space pointer need not be aligned. If WARNING does not contain zero, give a warning if the name is not unique.



HERE  CORE

( -- addr )
addr is the data-space pointer.



HEX  CORE-EXT

( -- )
Set the contents of BASE to sixteen.



HIDE-CURSOR  KERNEL

( -- )
Hide the cursor.



HOLD  CORE

( char -- )
Add char to the beginning of the pictured numeric output string. Exception -17 is issued if HOLD executes outside of a <##> delimited number conversion.



HOLDS  CORE-EXT

( c-addr u -- )
Adds the string represented by c-addr u to the pictured numeric output string. Exception -17 is issued if HOLDS executes outside of a <# #> delimited number conversion.

See also: HOLD



HOME  KERNEL

( -- )
Set the cursor on the top left of the screen.



I  CORE

Interpretation: ( -- x ) ( R: x -- x )
Copy x from the return stack to the data stack.

See also: I' J R@

Execution: ( -- n|u ) ( R: loop-sys -- loop-sys )
n|u is a copy of the current (innermost) loop index.

Implementation: I is equivalent to R@.



I'  KERNEL

Interpretation: ( -- x1 ) ( R: x1 x2 -- x1 x2 )
Copy x1 from the return stack to the data stack.

See also: I J

Execution: ( -- n|u ) ( R: loop-sys -- loop-sys )
n|u is a copy of the current (innermost) loop limit.



ICOMPARE  "i-compare"  KERNEL

( c-addr1 u1 c-addr2 u2 -- n )
Compare the string specified by c-addr1 u1 to the string specified by c-addr2 u2. The strings are compared, beginning at the given addresses, character by character, up to the length of the shorter string or until a difference is found. If the two strings are identical, where lower case characters are considered equal to their upper case equivalents, n is zero. If the two strings are identical up to the length of the shorter string, n is minus-one (-1) if u1 is less than u2, and one (1) otherwise. If the two strings are not identical up to the length of the shorter string, n is minus-one (-1) if the first non-matching character in the string specified by c-addr1 u1 has a lesser numerical value than the corresponding character in the string specified by c-addr2 u2, where lower case characters are considered equal to their upper case equivalents, and one (1)
otherwise.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: COMPARE ISEARCH ISTR=



IDENT  KERNEL

( -- c-addr u )
c-addr u describe a temporary location containing a character string representing the full path and name of the currently running CHForth program.

See also: GETENV



IF  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- orig )
Put the location of a new unresolved forward reference orig onto the control flow stack. Append the run-time semantics given below to the current definition. The semantics are incomplete until orig is resolved, e.g., by THEN or ELSE.

Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by the resolution of orig.



IMMEDIATE  CORE

( -- )
Make the most recent definition an immediate word.



IN-LIST  KERNEL

( x1 listid -- x1 false | x2 true )
Search for x1 in the list identified by listid. If x1 is found, return the associated value x2 and a true flag. Otherwise return x1 and a false flag.

See also: ADD-2LIST ADD-LIST IN-2LIST NEW-LIST



INBUF  KERNEL

( -- c-addr )
c-addr is the address of the input buffer of the current input file. Only valid if SOURCE-ID contains the fileid of the current open file.

See also: FILE-NAME



INCLUDE-FILE  FILE

( i*x fileid -- j*x )
Remove fileid from the stack. Save the current input source specification, including the current value of SOURCE-ID. Store fileid in SOURCE-ID. Make the file specified by fileid the input source. Store zero in BLK. Other stack effects are due to the words included.

Repeat until end of file: read a line from the file, fill the input buffer from the contents of that line, set >IN to zero, and interpret.

Text interpretation begins at the file position where the next file read would occur.

When the end of the file is reached, close the file and restore the input source specification to its saved value.

An ambiguous condition exists if fileid is invalid, if an I/O exception occurs reading fileid, or an I/O exception occurs while closing fileid.

Implementation: When an ambiguous condition exists, the files that were being interpreted will be closed and the appropriate ior will be THROWn.



INCLUDED  FILE

( i*x c-addr u -- j*x )
Remove c-addr u from the stack. Save the current input source specification, including the current value of SOURCE-ID. Open the file specified by c-addr u, store the resulting fileid in SOURCE-ID and make it the input source. Store zero in BLK. Other stack effects are due to the words included.

Repeat until end of file: read a line from the file, fill the input buffer from the contents of that line, set >IN to zero, and interpret.

Text interpretation begins at the file position where the next file read would occur.

When the end of the file is reached, close the file and restore the input source specification to its saved value.

An ambiguous condition exists if the named file cannot be opened, if an I/O exception occurs reading the file, or an I/O exception occurs closing the file.

Implementation: If the file name begins with ~ (tilde), it is expanded by EXPAND-PATH. When an ambiguous condition exists, the files that were being interpreted will be closed and the appropriate ior will be THROWn.

See also: INCLUDE-FILE



INI  KERNEL

( -- c-addr )
c-addr is the address of a counted string representing the name of the configuration file.



INTERPRET  KERNEL

( -- )
Interpret the current input buffer.

See also: PARSER



INTERPRET/COMPILE:  KERNEL

( xt1 xt2 "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the interpretation and compilation semantics given below.

name Interpretation: ( i*x "name1" -- j*x )
Skip leading space delimiters. Parse name1 delimited by a space. Execute the semantics of xt1. Exception -32 is issued if this method is not valid for this word or datatype.

name Compilation: ( i*x "name2" -- j*x )
Skip leading space delimiters. Parse name2 delimited by a space. Execute the semantics of xt2. Exception -32 is issued if this method is not valid for this word or datatype.



INVERSE  KERNEL

( -- )
Exchange the character foreground and background colors.

See also: BLINK BRIGHT NORMAL



INVERT  CORE

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

See also: 0= NEGATE



IS  CORE-EXT

Interpretation: ( xt "<spaces>name" -- )
Skip leading spaces and parse name delimited by a space. Set name to execute xt. An exception is issued if name was not defined by DEFER.

Compilation: ( "<spaces>name" -- )
Skip leading spaces and parse name delimited by a space. Append the run-time semantics given below to the current definition. An exception is issued if name was not defined by DEFER.

Run-time: ( xt -- )
Set name to execute xt.

See also: ACTION-OF DEFER! DEFER@



ISEARCH  "i-search"  KERNEL

( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 flag )
Search the string specified by c-addr1 u1 for the string specified by c-addr2 u2, where lower case characters are considered equal to their upper case equivalents. If flag is true, a match was found at c-addr3 with u3 characters remaining. If flag is false there was no match and c-addr3 is c-addr1 and u3 is u1.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: ICOMPARE SEARCH



ISTR=  "i-s-t-r-equals"  KERNEL

( c-addr1 u1 c-addr2 u2 -- flag )
Compare the string specified by c-addr1 u1 to the string specified by c-addr2 u2. If u1 and u2 differ, return false. The strings are compared, beginning at the given addresses, character by character, where lower case characters are considered equal to their upper case equivalents, until a difference is found or the end of the strings is reached. If the two strings are identical, flag is true, otherwise false.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: ICOMPARE STR=



J  CORE

Interpretation: ( -- x1 ) ( R: x1 x2 x3 -- x1 x2 x3 )
Copy x1 from the return stack to the data stack.

See also: I K

Execution: ( -- n|u ) ( R: loop-sys1 loop-sys2 -- loop-sys1 loop-sys2 )
n|u is a copy of the index of the next outer loop.

See also: I K



KEEP  KERNEL

( c-addr u -- a-addr )
Reserve u+1 address units of contiguous data space. The data space pointer is unaffected by this operation. a-addr is the aligned starting address of the allocated space. Store the string described by c-addr u as a counted string at a-addr.

Note: This space does not survive SAVE-SYSTEM.

See also: ALLOC-H



KEY  CORE

( -- char )
Receive one character char, a member of the implementation defined character set. Keyboard events that do not correspond to such characters are discarded until a valid character is received, and those events are subsequently unavailable.

All standard characters can be received. Characters received by KEY are not displayed.

Programs that require the ability to receive control characters have an environmental dependency.

See also: EKEY KEY?



KEY?  "key-question"  FACILITY

( -- flag )
If a character is available, return true. Otherwise return false. If non keyboard events are available before the first valid character, they are discarded and subsequently unavailable. The character shall be returned by the next execution of KEY.

After KEY? returns with a value of true, subseqent executions of KEY? prior to the execution of KEY or EKEY also return true, without discarding keyboard events.



L!  "l-store"  KERNEL

( x l-addr -- )
Store x at l-addr.



L,  "l-comma"  KERNEL

( x -- )
Reserve one cell of list space and store x in the cell.



L@  "l-fetch"  KERNEL

( l-addr -- x )
Fetch x, x is the value stored at l-addr.



L@+  "l-fetch-plus"  KERNEL

( l-addr1 -- l-addr2 x )
Fetch x, x is the value stored at l-addr1. Add the size in address units of a cell to l-addr1 giving l-addr2.



LAST  KERNEL

( -- a-addr )
a-addr is the address of a double cell containing the last dictionary entry address and its word list identifier.



LATESTXT  "lastest-x-t"  KERNEL

( -- xt )
A value that contains the last defined execution token.



LEAVE  CORE

Interpretation: Perform the function of -14 THROW.

Execution: ( -- ) ( R: loop-sys -- )
Discard the current loop control parameters. An ambiguous condition exists if they are unavailable. Continue execution immediately following the innermost syntactically enclosing DO ... LOOP or DO ... +LOOP.



LHERE  "l-here"  KERNEL

( -- l-addr )
l-addr is the list-space pointer.



LIMIT  KERNEL

( -- a-addr )
addr is one address unit past the last usable address in the code and data space.



LINE-CURSOR  KERNEL

( -- )
Set the cursor form to a line.



LINESREAD  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the number of lines read from text files since the start of the program, not counting lines read by interpreting the configuration file.

See also: INI



LINKED  KERNEL

( a-addr -- )
Make a link from HERE to a-addr. Link in normal order. Current item is found earlier than previous linked items.

See also: -LINKED



LITERAL  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( x -- )
Append the run-time semantics given below to the current definition.

Run-time: ( -- x )
Place x on the stack.



LLIMIT  "l-limit"  KERNEL

( -- l-addr )
l-addr is one address unit past the last usable address in the list space.



LMEMTOP  "l-memtop"  KERNEL

( -- l-addr )
l-addr is one address unit past the last physical address in the list space.



LOAD  BLOCK

( i*x u -- j*x )
Save the current input source specification. Store u in BLK, (thus making block u the input source and setting the input buffer to encompass its contents), set >IN to zero, and interpret. When the parse area is exhausted, restore the prior input source specification. Other stack effects are due to the words LOADed.

Exception -33, -34, or -35 is issued if u is zero, or not a valid block number.



LOGFILE-ID  "logfile-i-d"  KERNEL

( -- fileid )
A value containing the file identifier fileid of the log file, zero if the file is not open.



LOGGING?  "logging-question"  KERNEL

( -- flag )
A value containing true if output is logged to the logfile.

See also: CONSOLE? LOGFILE-ID



LONG-LINES  KERNEL

( -- flag )
A value containing true if READ-LINE is allowed to read the first u2 characters of lines that are longer, the remainder of the line after u2 is than still to be read. Otherwise ior is -18.



LOOP  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: do-sys -- )
Append the run-time semantics given below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE between the location given by do-sys and the next location for a transfer of control, to execute the words following LOOP.

Run-time: ( -- ) ( R: loop-sys1 -- | loop-sys2 )
The loop control parameters must be available. Add one to the loop index. If the loop index is then equal to the loop limit, discard the loop parameters and continue execution immediately following the loop. Otherwise continue execution at the beginning of the loop.

See also: DO I



LRESERVE  KERNEL

( u -- )
Reserve u address units above LHERE in the list space to be used by the compiler in a saved program. When u is zero, no compiling of colon definitions is possible in the new program.



LSEG  "l-seg"  KERNEL

( -- u )
u is the paragraph address of the list space.



LSHIFT  "l-shift"  CORE

( x1 u -- x2 )
Perform a logical left shift of u bit-places on x1, giving x2. Put zeroes in the least significant bits vacated by the shift.



M*  "m-star"  CORE

( n1 n2 -- d )
d is the signed product of n1 times n2.



M*/  "m-star-slash"  DOUBLE

( d1 n1 n2 -- d2 )
Multiply d1 by n1 producing the triple-cell intermediate result t. Divide t by n2, giving the double-cell quotient n3. Exception -10 is issued if n2 is zero or if the quotient lies outside the range of a double-cell signed integer.

See also: */ */MOD M*/MOD



M+  "m-plus"  DOUBLE

( d1|ud1 n -- d2|ud2 )
Add n to d1|ud1, giving the sum d1|ud2.



MATCH-KEY  KERNEL

( char | x -- xt true | false )
If an execution token is assigned to control character char or extended key x, return xt and a true flag. Otherwise return a false flag.

See also: ASSIGN-KEY



MAX  CORE

( n1 n2 -- n3 )
n3 is the greater if n1 and n2



MEMCOPY  KERNEL

( c-addr1 u c-addr2 -- c-addr2 u )
Copy the contents of the area specified by c-addr1 u to the area specified by c-addr2 u.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1.

See also: STRDUP



MEMTOP  KERNEL

( -- a-addr )
addr is one address unit past the last physical address in the code and data space.



MESSAGE  KERNEL

( n -- c-addr u | n 0 )
c-addr u describe a temporary location containing the characters of the message that is displayed if exception n is issued. If no associated message is present, n is returned and zero.

See also: EXCEPTION



METHOD  KERNEL

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the interpretation and compilation semantics defined below. name is referred to as a "method".

name Interpretation: ( i*x "name1" -- j*x )
Skip leading space delimiters. Parse name1 delimited by a space. Execute the method action of name1. Exception -32 is issued if this method is not valid for this word or datatype.

name Compilation: ( "name2" -- )
Skip leading space delimiters. Parse name2 delimited by a space. Compile the method action of name1. Exception -32 is issued if this method is not valid for this word or datatype.



METHODS  KERNEL

( "<spaces>name" -- method-sys )
Skip leading space delimiters. Parse name delimited by a space. Find name. Start defining methods for name. An exception is issued if name is not found or name is no defining word. Leave method-sys on the stack.

See also: END-METHODS.



MIN  CORE

( n1 n2 -- n3 )
n3 is the lesser if n1 and n2



MOD  "mod"  CORE

( n1 n2 -- n3 )
Divide n1 by n2, giving the single-cell remainder n3. Exception -10 is issued if n2 is zero. If n1 and n2 differ in sign the result returned will be the same as returned by the phrase >R S>D R> FM/MOD DROP. Note that other implementations of the ANSI standard may return the result of the phrase >R S>D R> SM/REM DROP.



MOVE  CORE

( addr1 addr2 u -- )
If u is greater than zero, copy the contents of u consecutive address units at addr1 to the u consecutive address units at addr2. After MOVE completes, the u consecutive address units at addr2 contain exactly what the u consecutive address units at addr1 contained before the move.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: CMOVE CMOVE>



MS  FACILITY-EXT

( u -- )
Wait u milliseconds.



MS/T  "ms-per-t"  KERNEL

( -- n1 n2 )
n1/n2 is a factor to convert clock ticks to milliseconds.

See also: MS TICKS



MS@  KERNEL

( -- d )
d is the number of milliseconds elapsed since the last TIMER-RESET.



MYFILE  KERNEL

( -- c-addr )
c-addr is the address of a counted string representing the name of the last opened file, or the name of the file where an exception occurred, or the name of the file returned by LOCATE or WHICH.



N!  "n-store"  KERNEL

( x n-addr -- )
Store x at n-addr.



N,  "n-comma"  KERNEL

( x -- )
Reserve one cell of name space and store x in the cell.



N>R  "n-to-r"  TOOLS-EXT

( n*x n -- } { R: -- n*x n )
Remove n+1 items from the data stack and store them for later retrieval by NR>. In this implementation, the return stack is used to store the data. Until this data has been retrieved by NR>: - this data will not be overwritten by a subsequent invocation of NR> and - a program may not access data placed on the return stack before the invocation of N>R.



N@  "n-fetch"  KERNEL

( n-addr -- x )
Fetch x, x is the value stored at n-addr.



NAME  KERNEL

( "<spaces>name" -- c-addr u )
Skip leading space delimiters. Parse name delimited by a space.

c-addr is the address of the selected string within the input buffer and u is its length in characters. If the parse area is empty or contains only white space, the resulting string has length zero.

See also: PARSE PARSE-NAME PARSED WORD



NAME$  "name-string"  KERNEL

( dea -- c-addr u )
If dea is a valid dictionary entry address, c-addr u describe a transient region containing the name of the definition associated with dea. Otherwise c-addr u contains "{NoName}". u is limited to /NAME.

See also: .NAME



NEGATE  CORE

( n1 -- n2 )
Negate n1, giving its aritmetic inverse n2.

See also: 0= INVERT



NEW-LIST  KERNEL

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below. name is referred to as a "list". This list is initially empty.

name Execution: ( -- listid )
listid is the list identifier of name.

See also: ADD-2LIST ADD-LIST IN-2LIST IN-LIST



NEWEST  KERNEL

Interpretation: Perform the function of -14 THROW.

Compilation: ( -- )
Append the run-time semantics given below to the current definition.

Run-time: ( -- n )
Place n on the stack. n is the value of #EXCEPTION at the moment NEWEST was compiled.



NEXT-NAME  KERNEL

( dea1 -- dea2 | 0 )
If dictionary entry dea1 exists and has a precursor, dea2 is the dictionary entry of the precursor. Otherwise dea2 is zero.

See also: WORDS



NHERE  "n-here"  KERNEL

( -- n-addr )
n-addr is the name-space pointer.



NIL  KERNEL

( -- c-addr )
c-addr is the address of a counted string of length zero.

See also: ""



NIP  CORE-EXT

( x1 x2 -- x2 )
Drop the first item below the top of the stack.



NLIMIT  "n-limit"  KERNEL

( -- n-addr )
n-addr is one address unit past the last usable address in the name space.



NO-EXT  KERNEL

( c-addr u1 -- c-addr u2 )
If the character string c-addr u1 contains one of more occurrences of . (dot), u2 is the number of characters to the left of the rightmost occurrence of . . Otherwise or if . is followed by one or more occurrences of / (slash), or u1 is zero, u2 is u1.

See also: BASENAME



NOISE  KERNEL

( -- a-addr )
a-addr is the address of a cell containing true when the source during loading of text files is displayed, otherwise false.



NOOP  "no-op"  KERNEL

( -- )
Does nothing.



NORMAL  KERNEL

( -- )
Set the attribute of the characters on the screen to the default value.

See also: BLINK BRIGHT INVERSE



NOT-IMPLEMENTED  KERNEL

( -- )
Abort with exception message: not implemented, used in some definitions.



NR>  "n-r-from"  TOOLS-EXT

( -- n*x n } { R: n*x n -- )
Retrieve the items previously stored by an invocation of N>R. n is the number of items placed on the data stack. It is an ambiguous condition if NR> is used with data not stored by N>R.



NRESERVE  KERNEL

( u -- )
Reserve u address units above NHERE in the name space to be used by the compiler in a saved program. When u is zero, no new definition names can be added to the new program.



NSEG  "n-seg"  KERNEL

( -- u )
u is the paragraph address of the name space.



NUMBER?  "number-question"  KERNEL

( c-addr u -- false | n|u true )
Convert the string specified by c-addr u1 to a single-cell number in the current BASE and return the number and a true flag. If the number can not be converted, return false. To separate digit groups visually, any embedded , (comma) is permitted. The number is negative if it is prefixed by - (minus sign).

BASE can be ignored, numbers that are prefixed by

  # (number sign) are interpreted as decimal,
  $ (dollar sign) are interpreted as hexadecimal,
  % (percentage sign) are interpreted as binary.
These prefixes must be placed before an optional - for negative numbers. When BASE is sixteen or $ is used as prefix, lower case characters are considered equal to their upper case equivalents.

A name prefixed with ' (tick) is returned as its excution token.

Single characters are converted to their numeric equivalent if enclosed in a pair of ' (quote).

Uppercase letters can be converted to the corresponding control characters if prefixed by ^ (caret).

See also: 2NUMBER?


OF  CORE-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: -- of-sys )
Put of-sys on the compilation stack. Append the run-time semantics given below to the current definition. The semantics are incomplete until resolved by a consumer of of-sys such as ENDOF.

Run-time: ( x1 x2 -- | x1 )
If the two values on the stack are not equal, discard the top value and continue execution at the location specified by the consumer of of-sys (e.g., following the next ENDOF). Otherwise, discard both values and continue execution in line.

See also: CASE ENDCASE



OFF  KERNEL

( a-addr -- )
Clear all bits of the single-cell value at a-addr.



OFFSET  KERNEL

( -- u )
u is the number assigned to the first mass-storage block of the current block file or disk being used.



ON  KERNEL

( a-addr -- )
Set all bits of the single-cell value at a-addr.



ONLY  SEARCH-EXT

( -- )
Set the search order to the minimum search order. The minimum search order includes the words FORTH-WORDLIST and SET-ORDER.

See also: ROOT.



OPEN-FILE  FILE

( c-addr u fam -- fileid ior )
Open the file named in the character string specified by c-addr u, with file access method indicated by fam.

If the file was successfully opened, ior is zero, fileid is its identifier, and the file has been positioned at the start of the file.

Otherwise ior is the I/O result code and fileid is undefined.

Implementation: If the file name begins with ~ (tilde), it is expanded by EXPAND-PATH.



OR  CORE

( x1 x2 -- x3 )
x3 is the bit-by-bit logical inclusive-or of x1 with x2.



OTHER  KERNEL

( -- )
Transform the search order consisting of widn .. wid2 wid1 (where wid1 is searched first) into widn .. wid2 wid(OTHER). This VOCABULARY contains CHForth specific extensions that are not documented and can be changed by the author by name or action without prior consent. Note that these words are non-standard.



OUT  KERNEL

( -- a-addr )
a-addr is the address of a cell containing the number of characters printed on the current output line.



OUTFILE-ID  "outfile-i-d"  KERNEL

( -- fileid )
A value containing the file identifier fileid of the output stream; otherwise, e.g. with graphics, zero.



OVER  CORE

( x1 x2 -- x1 x2 x1 )
Place a copy of x1 on top of the stack.



PAD  CORE-EXT

( -- c-addr )
c-addr is the address of a transient region that can be used to hold data for intermediate processing.



PAGE  FACILITY

( -- )
Move to another page for output. Actual function depends on the output device. On a terminal, PAGE clears the screen and resets the cursor position to the upper left corner. On a printer, PAGE performs a form feed.



PARAGRAPH-ALIGNED  KERNEL

( addr -- a-addr )
a-addr is the first paragraph-aligned address greater than or equal to addr.



PARAGRAPHS  KERNEL

( u1 -- u2 )
u2 is the size in address units of u1 paragraphs.



PARSE  CORE-EXT

( char "ccc<char>" -- c-addr u )
Parse ccc delimited by the delimiter char.

c-addr is the address (within the input buffer) and u is the length of the parsed string. If the parse area was empty, the resulting string has zero length.

See also: PARSE-NAME WORD



PARSE-NAME  CORE-EXT

( "<spaces>name<space>" -- c-addr u )
Skip leading space delimiters. Parse name delimited by a space.

c-addr is the address of the selected string within the input buffer and u is its length in characters. If the parse area is empty or contains only white space, the resulting string has length zero.

See also: NAME PARSE PARSED WORD



PARSED  KERNEL

( -- c-addr u )
c-addr u describe the most recent parsed character string within the input buffer by words like NAME PARSE-NAME WORD.



PARSER  KERNEL

( c-addr u -- i*x xt )
Find the definition named in the string c-addr u, searching all word lists in the search order. If the definition is found, return xt and optional values i*x. If the definition is not found (when compiling starting with locals), return FAIL.



PAUSE  KERNEL

( -- )
A word that normally contains NOOP. Used in EKEY and MS.



PICK  CORE-EXT

( xu .. x1 x0 u -- xu .. x1 x0 xu )
Remove u. Copy the xu to the top of the stack. An ambiguous condition exists if there are less than u+2 items on the stack before PICK is executed.



PLACE  KERNEL

( c-addr1 u c-addr2 -- )
Place the characters of the string specified by c-addr1 u as a counted string at c-addr2. An exception is issued if u is greater than the implementation defined maximum length of a counted string.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2. c-addr2 must not lay between c-addr1 and c-addr1 + u.

See also: +PLACE COUNT



POSTPONE  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Find name. Append the compilation semantics of name to the current definition. Exception -13 is issued if name is not found.



PREVIOUS  SEARCH-EXT

( -- )
Transform the search order consisting of widn .. wid2 wid1 (where wid1 is searched first) into widn .. wid2. Exception -50 will be issued if the search order would be empty after PREVIOUS was executed.



PRINTING?  "printing-question"  KERNEL

( -- flag )
A value containing true if output to the printer is enabled.

See also: CONSOLE?



PRNFILE-ID  "p-r-n-file-i-d"  KERNEL

( -- fileid )
A value containing the file identifier fileid of the print file; otherwise zero.



PROMPT  KERNEL

( -- )
Display the 'ok' message in interpretation state if there were no exceptions issued.

See also: STATUS



PSEG  "p-seg"  KERNEL

( -- u )
u is the paragraph address of the program segment prefix.



Q!  "q-store"  KERNEL

( x q-addr -- )
Store x at q-addr.



Q,  "q-comma"  KERNEL

( x -- )
Reserve one cell of string space and store x in the cell.



Q@  "q-fetch"  KERNEL

( q-addr -- x )
Fetch x, x is the value stored at q-addr.



QHERE  "q-here"  KERNEL

( -- q-addr )
q-addr is the string-space pointer.



QLIMIT  "q-limit"  KERNEL

( -- q-addr )
q-addr is one address unit past the last usable address in the strings space.



QRESERVE  KERNEL

( u -- )
Reserve u address units above QHERE in the string space to be used by the compiler in a saved program. When u is zero, no new strings in definitions can be added to the new program.



QSEG  "q-seg"  KERNEL

( -- u )
u is the paragraph address of the string space.



QUIT  CORE

( -- ) ( R: i*x -- )
Empty the return stack, store zero in SOURCE-ID, make the user input device the input source, and enter interpretation state. Do not display a message. Repeat the following:

 - Accept a line from the input source into the input buffer,
   set >IN to zero and interpret.
 - Display the implementation defined system prompt if in
   interpretation state, all processing has been completed,
   and no ambiguous condition exists.


R/O  "r-o"  FILE

( -- fam )
fam is the value for selecting the "read only" file access method.

See also: CREATE-FILE OPEN-FILE



R/W  "r-w"  FILE

( -- fam )
fam is the value for selecting the "read/write" file access method.

See also: CREATE-FILE OPEN-FILE



R>  "r-from"  CORE

Interpretation: Perform the execution semantics given below.

Execution: ( -- x ) ( R: x -- )
Move x from the return stack to the data stack.

See also: >R 2>R 2R> 2R@ R@



R@  "r-fetch"  CORE

Interpretation: Perform the execution semantics given below.

Execution: ( -- x ) ( R: x -- x )
Copy x from the return stack to the data stack.

See also: >R 2>R 2R> 2R@ R>



RANDOM  KERNEL

( -- u )
Return a random number.



RANDOMIZE  KERNEL

( ud -- )
Initialize the random number generator.



RDROP  "r-drop"  KERNEL

( -- } { R: x -- )
Remove x from the return stack. Semantically equivalent to R> DROP.

See also: 2RDROP DUP>R R>DROP



READ-FILE  FILE

( c-addr u1 fileid -- u2 ior )
Read u1 consecutive characters to c-addr from the current position of the file identified by fileid.

If u1 characters are read without an exception, ior is zero and u2 is equal to u1.

If the end of the file is reached before u1 characters are read, ior is zero and u2 is the number of characters actually read.

If the operation is initiated when the value of FILE-POSITIONis equal to the value returned by FILE-SIZE for the file identified by fileid, ior is zero and u2 is zero.

If an exception occurs, ior is the I/O result code and u2 is the number of characters transferred to c-addr without an exception.

If the operation is initiated when the value returned by FILE-POSITION is greater than the value returned by FILE-SIZE for the file identified by fileid, or if the requested operation attempts to read portions of the file not written, ior is zero and u2 is zero.

At the conclusion of the operation, FILE-POSITION returns the next file position after the last character read.

Implementation: The paragraph address of c-addr may be modified by >SEG.

See also: READ-LINE WRITE-FILE



READ-LINE  FILE

( c-addr u1 fileid -- u2 flag ior )
Read the next line from the file specified by fileid into memory at the address c-addr. At most u1 characters are read. Up to two line terminating characters may be read into memory at the end of the line, but are not included in the count u2. The line buffer provided by c-addr should be at least u1+2 characters long.

If the operation succeeded, flag is true and ior is zero. If a line terminator was received before u1 characters were read, then u2 is the number of characters, not including the line terminator, actually read (0 <= u2 <= u1). When u1 = u2 the line terminator has yet to be reached.

If the operation is initiated when the value returned by FILE-POSITION is equal to the value returned by FILE-SIZEfor the file identified by fileid, flag is false, ior is zero, and u2 is zero. If ior is non-zero, an exception occurred during the operation and ior is the I/O result code.

If the operation is initiated when the value returned by FILE-POSITION is greater than the value returned by FILE-SIZE for the file identified by fileid, or the requested operation attempts to read portions of the file not yet written ior is zero, flag is zero and u2 is zero.

At the conclusion of the operation, FILE-POSITION returns the next file position after the last character read.

Implementation: The paragraph address of c-addr may not be modified by >SEG.



REALLOC  KERNEL

( u1 u2 -- ior )
Change the allocation of the contiguous region of memory outside the data space starting at the paragraph address u1, previously allocated by ALLOC or REALLOC, to u2 paragraphs. u2 may be either larger or smaller than the current size of the region. The data-space pointer is unaffected by this operation.

The starting paragraph address u1 is not changed. If the operation succeeds, ior is zero. If the operation fails, the region of memory at u1 is unaffected and ior is the I/O result code.



RECURSE  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( -- )
Append the execution semantics of the current definition to the current definition.



REFILL  CORE-EXT

( -- flag )
Attempt to fill the current input stream, returning a true flag if successful.

When the input source is a block, make the next block the input source and current input buffer by adding one to the value of BLK and setting >IN to zero. Return true if the new value of BLK is a valid block number, otherwise false.

When the input source is a text file, attempt to read the next line from the text-input file. If successful, make the result the current input buffer, set >IN to zero and return true. Otherwise return false.

When the input source is the user input device, attempt to receive input into the terminal input buffer. If successful, make the result the input buffer, set >IN to zero, and return true. Receipt of a line containing no characters is considered successful. If there is no input available from the current input source, return false.

When the input source is a string from EVALUATE, return false and perform no other action.



RENAME-FILE  FILE-EXT

( c-addr1 u1 c-addr2 u2 -- ior )
Rename the file named by the character string c-addr1 u1 to the name in the character string c-addr2 u2. ior is the I/O result code.

Implementation: If one or both of the file names begins with ~ (tilde), it is expanded by EXPAND-PATH.



REPEAT  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: orig dest -- )
Append the run-time semantics given below to the current definition, resolving the backward reference dest. Resolve the forward reference orig using the location following the appended run-time semantics.

Run-time: ( -- )
Continue execution at the location given by dest.

See also: BEGIN WHILE



REPOSITION-FILE  FILE

( ud fileid -- ior )
Reposition the file identified by fileid to ud. ior is the I/O result code. If the file is positioned outside the file boundaries, ior will be zero, as the operating system does not consider that an error.

At the conclusion of the operation, FILE-POSITION returns the value ud.



RESERVE  KERNEL

( u -- )
Reserve u address units above HERE to be used by ALLOT in a saved program. As some space is always available in PAD, interpreting remains possible if u is zero.



RESERVED  KERNEL

( -- u )
u is the number of address units to be reserved in the data space in a TURNKEY program in addition to the number reserved by RESERVE. u is reset to zero when a non-turnkey program starts. The user can increment this value in files that are loaded to build the program. RESERVED is a VALUE.



RESTORE-INPUT  CORE-EXT

( xn .. x1 n -- flag )
Attempt to restore the input source specification to the state described by x1 through xn, flag is true if the input source specification cannot be so restored.

An ambiguous condition exists if the input source represented by the arguments is not the same as the current input source.

Implementation: undeterminate action.

See also: SAVE-INPUT



RESTRICT  

( -- )
Make the most recent definition a compile-only word. The default interpreter performs the function of -14 THROW when the definition is encountered in interpret state.



REVEAL  KERNEL

( -- )
Make the current definition findable.



ROOT  KERNEL

( -- )
Transform the search order consisting of widn .. wid2 wid1 (where wid1 is searched first) into widn .. wid2 wid(ROOT). This VOCABULARY contains a minimal set of words.

See also: ONLY



ROT  "rote"  CORE

( x1 x2 x3 -- x2 x3 x1 )
Rotate the top three stack items.



ROWS  KERNEL

( -- n )
Return the number of lines on an output page.

See also: COLS



RSHIFT  "r-shift"  CORE

( x1 u -- x2 )
Perform a logical right shift of u bit-places on x1, giving x2. Put zeroes in the most significant bits vacated by the shift.



S>D  "s-to-d"  CORE

( n -- d )
Convert the number n to the double-cell number d with the same numerical value.



SAVE-BUFFERS  BLOCK

( -- )
Transfer the contents of each UPDATEd block buffer to mass storage. Mark all buffers as unmodified.



SAVE-INPUT  CORE-EXT

( -- xn .. x1 n )
x1 through xn describe the current state of the input source specification for later use by RESTORE-INPUT.



SAVE-SYSTEM  KERNEL

( c-addr u -- )
Write the CHForth program with the name specified by c-addr u as an executable file. name may have a preceding path. Any extension is replaced by ".exe".

See also: LRESERVE MRESERVE NRESERVE QRESERVE RESERVE RESERVED TURNKEY



SBASE  "s-base"  KERNEL

( -- u )
u is the paragraph address of the text screen.



SCAN  KERNEL

( c-addr1 u1 char -- c-addr2 u2 )
Scan the string specified by c-addr1 u1 for character char. c-addr2 u2 describe the part of the string starting with the first character equal to char. If the string c-addr1 u1 does not contain char or u1 is zero, c-addr2 the location of the first character past the end of the string and u2 is zero.

Implementation: The paragraph address of c-addr1 may be modified by >SEG.

See also: SKIP SPLIT



SCREENSIZE  KERNEL

( -- n )
n is the total count of characters plus attributes on the screen.



SEARCH  STRING

( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 flag )
Search the string specified by c-addr1 u1 for the string specified by c-addr2 u2. If flag is true, a match was found at c-addr3 with u3 characters remaining. If flag is false there was no match and c-addr3 is c-addr1 and u3 is u1.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: COMPARE ISEARCH



SECONDS  KERNEL

( -- d )
d is the number of seconds elapsed since startup of this program.



SEGMENT  KERNEL

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the initiation and execution semantics defined below. Reserve 5 cells of data space and leave the data-space pointer at an aligned address.

Initiation: ( u1 -- u2 )
Allocate u1 contiguous paragraphs of free memory available to the operating system. The data-space pointer is unaffected by this operation. The initial contents of the allocated space is undefined. Store the paragraph address u2 in the first cell of the data space reserved, u1 in the second cell and zero in the third cell. The fourth and fifth cell are for internal administration.

name Execution: ( -- u2 )
u2 is the paragraph address of the allocated memory.

Note: The user may change the value of the third cell to a value between zero and u1 in order to save the allocated area with the program.



SET  KERNEL

Interpretation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Perform the "SET name run-time" semantic given in the definition for the defining word of name.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Append the "SET name run-time" semantics given in the definition for the defining word of name to the current definition.

Implementation: Exception -32 is issued if name was not defined by a word with "SET name run-time" semantics.

See also: VALUE 2VALUE (LOCAL) TO



SET-CURRENT  SEARCH

( wid -- )
Set the compilation word list to the word list identified by wid.



SET-DIRECTORY  KERNEL

( c-addr u -- ior )
Set the current directory to the character string specified by c-addr u. If the string begins with ~ (tilde), the string is expanded by EXPAND-PATH. The default drive may be changed if a drive letter and a colon are present at the beginning of the string. If no exception occurs, or u is zero, ior is zero. Otherwise ior is the I/O result code.

See also: CD GET-DIRECTORY MAKE-DIRECTORY



SET-FILE-TIME  KERNEL

( u1 u2 fileid -- ior )
Set the packed modification time and date of the file identified by fileid to u1 and u2 respectively. If no exception occurs, ior is zero. Otherwise ior is the I/O result code.

See also: GET-FILE-TIME PACK-DATE PACK-TIME



SET-FREQUENCY  KERNEL

( u -- )
Set the frequency of the speaker to u.



SET-INTERRUPT  KERNEL

( x-addr n -- )
Set interrupt vector n to extended address x-addr.



SET-ORDER  SEARCH

( widn .. wid1 n -- )
Set the search order to the word lists identified by widn .. wid1. Subsequently, word list wid1 will be searched first, and word list widn searched last. If n is zero, empty the search order. If n is minus one, set the search order to the minimum search order ROOT ROOT.

Implementation: The maximum of n is sixteen. If n is -2, set the search order to FORTH ROOT. If n is -3, set the search order to FORTH OTHER ROOT.



SET-SOURCE  KERNEL

( c-addr u -- )
Set the address of the input buffer to c-addr and the number of characters in the buffer to u. Set >IN to zero.



SHOW-CURSOR  KERNEL

( -- )
Display the cursor.



SIGN  CORE

( n -- )
If n is negative, add a minus sign to the beginning of the pictured numeric output string. Exception -17 is issued if SIGN executes outside of a <# #> delimited number conversion.



SIGNON  KERNEL

( -- a-addr )
a-addr is the address of a cell containing true to display the signon message at startup and false otherwise.



SILENT  KERNEL

( -- )
Suppress character output to the screen.

See also: VIDEO



SKIP  KERNEL

( c-addr1 u1 char -- c-addr2 u2 )
Scan the string specified by c-addr1 u1 for character char. c-addr2 u2 describe the part of the string starting with the first character different from char. If the string c-addr1 u1 consists entirely of characters char or u1 is zero, c-addr2 the location of the first character past the end of the string and u2 is zero.

Implementation: The paragraph address of c-addr1 may be modified by >SEG.

See also: SCAN SPLIT



SLITERAL  STRING

Interpretation: Perform the function of -14 THROW.

Compilation: ( c-addr1 u -- )
Append the run-time semantics given below to the current definition.

Run-time: ( -- c-addr2 u )
Return c-addr2 u describing a string consisting of the characters specified by c-addr1 u during compilation. A program shall not alter the returned string.



SM/REM  "s-m-slash-rem"  CORE

( d n1 -- n2 n3 )
Divide d by n1, giving the symmetric quotient n3 and the remainder n2. Input and output stack arguments are signed. Exception -10 is issued if n1 is zero or the quotient lies outside the range of a single-cell signed integer.

See also: FM/MOD UM/MOD



SOURCE  CORE

( -- c-addr u )
c-addr is the address of, and u is the number of characters in, the input buffer.



SOURCE-ID  "source-i-d"  CORE-EXT

( -- 0 | -1 | fileid )
Identifies the source of the non-block input stream (i.e., when BLK is zero) as follows:

           SOURCE-ID       Input stream source
           -----------     -------------------
              0            User input device.
             -1            String (via EVALUATE).
           fileid          Text file "fileid".
Implementation: If BLK contains a non-zero value, SOURCE-ID is ignored.


SPACE  CORE

( -- )
Display one space.



SPACES  CORE

( n -- )
If n is greater than zero, display n spaces.



SPEAKER-OFF  KERNEL

( -- )
Turn the speaker off.



SPEAKER-ON  KERNEL

( -- )
Turn the speaker on.



SPLIT  KERNEL

( c-addr1 u1 char -- c-addr2 u2 c-addr1 u3 )
Scan the string specified by c-addr1 u1 for character char. c-addr2 u2 describe the part of the string after the first character equal to char. c-addr1 u3 describe the part of the string before this character. If the string does not contain char or u1 is zero, c-addr2 is the location of the first character past the end of the string, u2 is zero and u3 is u1.

Implementation: The paragraph address of c-addr1 may be modified by >SEG.

See also: SCAN SKIP SPLIT-TEXT



SSEG  "s-seg"  KERNEL

( -- u )
u is the paragraph address of the stack space. If missing, the stacks reside in CSEG.



STARTUP  KERNEL

( -- )
A word that is executed at the start of the program before executing COLD.

See also: ATEXIT



STATUS  KERNEL

( -- )
Display an optional message before asking input.

See also: PROMPT



STDERR  KERNEL

( -- fileid )
Return the fileid of the standard error file. This file is initially unbuffered.



STDIN  KERNEL

( -- fileid )
Return the fileid of the standard input file. This file is buffered, use READ-LINE, READ-CHAR or READ-CHAR3 for accessing the contents but not READ-FILE.



STDOUT  KERNEL

( -- fileid )
Return the fileid of the standard output file. This file is initially unbuffered.



STDPRN  KERNEL

( -- fileid )
Return the fileid of the standard printer file. This file is initially unbuffered.



STR=  "s-t-r-equals"  KERNEL

( c-addr1 u1 c-addr2 u2 -- flag )
Compare the string specified by c-addr1 u1 to the string specified by c-addr2 u2. If u1 and u2 differ, return false. The strings are compared, beginning at the given addresses, character by character, until a difference is found or the end of the strings is reached. If the two strings are identical, flag is true, otherwise false.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1. The paragraph address of c-addr2 may be modified by >SEG2.

See also: COMPARE ISTR=



STRCAT  "string-concatenate"  KERNEL

( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 )
c-addr3 u3 describe a temporary location containing the characters of the string specified by c-addr1 u1 followed by the characters of the string specified by c-addr2 u2. u3 is the sum of u1 and u2. c-addr3 may differ from c-addr1.

See also: CCAT STRDUP



STRDUP  "string-dup"  KERNEL

( c-addr1 u -- c-addr2 u )
c-addr2 u describe a temporary location containing a copy of the character string specified by c-addr1 u.

Implementation: The paragraph address of c-addr1 may be modified by >SEG1.

See also: STRCAT



STRING,  "string-comma"  KERNEL

( c-addr u -- )
Place the string specified by c-addr u as a counted string in the dictionary at the data-space pointer and increment the data-space pointer to the address past the string.

Implementation: The paragraph address of c-addr may be modified by >SEG.

See also: CHARS,



STRING?  "string-question"  KERNEL

( c-addr1 u1 -- false | c-addr2 u2 true )
If the string specified by c-addr1 u1 begins with " (double-quote), and ends with " or at the end of the parse area, c-addr2 u2 represent the string without the leading and trailing quotes and return true. Otherwise return false. A pair of " represent a single " in the resulting string.

Note: use only in INTERPRET as >IN may change due to embedded spaces. Parsing will not exceed the length of the input buffer.



SWAP  CORE

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



TERMINAL  KERNEL

( -- )
Reset the input and output to the terminal. Store zero in BLK. Store zero in SOURCE-ID.



THEN  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: orig -- )
Append the run-time semantics given below to the current definition. Resolve the forward reference orig using the location of the appended run-time semantics.

Run-time: ( -- )
Continue execution.

See also: ELSE IF



THROW  EXCEPTION

( k*x n -- k*x | i*x n )
If any bits of n are non-zero, pop the topmost exception frame from the exception stack, along with everything on the return stack above that frame. Then restore the input source specification in use before the corresponding CATCH and adjust the depths of all stacks so that they are the same as the depth saved in the exception frame (i is the same number as i in the input arguments to the corresponding CATCH), put n on top of the data stack, and transfer control to a point just after the CATCH that pushed that exception frame.

If the top of the stack is non zero and there is no exception frame on the exception stack the behavior is as follows:

If n is minus-one (-1), perform the function of ABORT, displaying no message.

If n is minus-two (-2), perform the function of ABORT", displaying the characters ccc associated with the ABORT" that generated the THROW.

Otherwise display information about the exception, the exception number and a message associated with the exception number.

Implementation: The stacks involved are the data, return and locals stacks. No input source specification is restored by THROW.

See also: EXCEPTION



TICKS  KERNEL

( -- ud )
ud is the current number of clock ticks.

See also: ELAPSED MS MS/T



TIME  KERNEL

( -- +n1 +n2 +n3 )
Return the current time. +n1 is the second {0..59}, +n2 is the minute {0..59}, and +n3 is the hour {0..23}.



TIME&DATE  "time-and-date"  FACILITY-EXT

( -- +n1 +n2 +n3 +n4 +n5 +n6 )
Return the current time and date. +n1 is the second {0..59}, +n2 is the minute {0..59}, +n3 is the hour {0..23}, +n4 is the day {1..31}, +n5 is the month {1..12}, and +n6 is the year (e.g. 1991).



TIMER-RESET  KERNEL

( -- )
Reset the timer for use by ELAPSED or .ELAPSED.



TMP  KERNEL

( -- a-addr )
a-addr is the address of variable that is free for use.



TO  CORE-EXT

Interpretation: ( i*x "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Perform the "TO name run-time" semantic given in the definition for the defining word of name.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters and parse name delimited by a space. Append the "TO name run-time" semantics given in the definition for the defining word of name to the current definition.

Implementation: Exception -32 is issued if name was not defined by a word with "TO name run-time" semantics.

See also: VALUE 2VALUE (LOCAL)



TONE  KERNEL

( u1 u2 -- )
Make a sound for the duration of u1 milliseconds with a frequency of u2.



TRACE  KERNEL

( -- a-addr )
A variable used in the tracer. If different from zero and the tracer is present, trace information will be compiled in future definitions.

See also: ;; DEBUG



TRAP  KERNEL

( -- )
Callback to the debugger program, used for stepping through Forth.



TRUE  CORE-EXT

( -- true )
Return a true flag, a single-cell value with all bits set.



TUCK  CORE-EXT

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



TWAIT  "t-wait"  KERNEL

( -- a-addr )
a-addr contains the number of milliseconds to wait between successive executions of CR.

See also: FAST SLOW



TYPE  CORE

( c-addr u -- )
If u is greater than zero, display the character string specified by c-addr and u.

See also: EMIT



U.  "u-dot"  CORE

( u -- )
Display u in free field format.

See also: U.R UD.



U.R  "u-dot-r"  CORE-EXT

( u n -- )
Display u right aligned in a field n characters wide. If the number of characters required to display u is greater than n, all digits are displayed with no leading spaces in a field as wide as necessary.



U<  "u-less-than"  CORE

( u1 u2 -- flag )
flag is true if and only if u1 is less than u2.

See also: <



U>  "u-greater-than"  CORE-EXT

( u1 u2 -- flag )
flag is true if and only if u1 is greater than u2.

See also: >



U>D  "u-to-d"  KERNEL

( u -- ud )
ud is the equivalent of u.



UD.  "u-d-dot"  KERNEL

( ud -- )
Display ud in free field format.

See also: U. UD.R



UD.R  "u-d-dot-r"  KERNEL

( ud n -- )
Display ud right aligned in a field n characters wide. If the number of characters required to display ud is greater than n, all digits are displayed with no leading spaces in a field as wide as necessary.

See also: UD.



UM*  "u-m-star"  CORE

( u1 u2 -- ud )
Multiply u1 by u2 giving the unsigned double-cell product ud. All values and arithmetic are unsigned.



UM/MOD  "u-m-slash-mod"  CORE

( ud u1 -- u2 u3 )
Divide ud by u1, giving the quotient u3 and the remainder u2. All values and arithmetic are unsigned. Exception -10 is issued if u1 is zero or if the quotient lies outside the range of a single-cell unsigned integer.

See also: FM/MOD SM/REM



UNLOOP  CORE

Interpretation: Perform the function of -14 THROW.

Execution: ( -- ) ( R: loop-sys )
Discard the loop-control parameters for the current nesting level. An UNLOOP is required for each nesting level before the definition may be EXITed. An ambiguous condition exists if the loop-control parameters are not available.



UNTIL  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: dest -- )
Append the run-time semantics given below to the current definition, resolving the backward reference dest.

Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by dest.

See also: BEGIN



UPDATE  BLOCK

( -- )
Mark the current block buffer as modified.

UPDATE does not immediate cause I/O.

See also: BLOCK BUFFER FLUSH SAVE-BUFFERS



VALUE  CORE-EXT

( x "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below with an initial value equal to x.

name is referred to as a "value".

name Execution: ( -- x )
Place x on the stack. The value of x is that given when name was is created, until the phrase x TO name is executed, causing a new value of x to be associated with name.

Methods for name:

+TO      ( n|u -- )      Add n|u to name
CLEAR    ( -- )          Store zero in name
SET      ( -- )          Store true in name
TO       ( x -- )        Store x in name


VARIABLE  CORE

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below. Reserve one cell of data space at an aligned address.

name is referred to as a "variable".

name Execution: ( -- a-addr )
a-addr is the address of the reserved cell. A program is responsible for initializing the contents of the reserved cell.



VERSION  KERNEL

( -- n )
n is the three decimal digit version number of this CHForth system.



VIDEO  KERNEL

( -- )
Direct character output to the screen.

See also: SILENT



VOC-LINK  KERNEL

( -- a-addr )
a-addr is the address of a cell containg a link to the word lists and vocabularies.



VOCABULARY  KERNEL

( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Create a definition for name with the execution semantics defined below. Create a new word list and store the word list identifier with the definition for name. name is referred to as a "vocabulary".

name Execution: ( -- )
Set the word list identifier as the first in the search order.

See also: VOCS WORDLIST



W/O  "w-o"  FILE

( -- fam )
fam is the value for selecting the "write only" file access method.

See also: CREATE-FILE OPEN-FILE



WANTED  KERNEL

( c-addr u -- )
Find name described by the string c-addr u in FORTH-WORDLIST. If name exists, continue. Look up name in the library file wanted.frt in the second or higher columns. If found, apply REQUIRED to the file name on the same line in the first column. If not found, display a message to that effect.

See also: WANT



WARNING  KERNEL

( -- a-addr )
a-addr is the address of a cell containing a non zero value when the program will warn the user if redefinitions are encountered and zero otherwise.



WHERE  KERNEL

( n -- )
Display the type of the exception n, the name of the text file or blocks file if exception n occurred during loading of such a file and the line number where the exception occurred. Display the source line where the exception occurred and markers under the word that caused the exception. Any control characters in the source line (notably tabs) are changed to spaces to keep the line and the markers aligned.



WHILE  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( C: dest -- orig dest )
Put the location of a new unresolved forward reference orig onto the control flow stack, under the existing dest. Append the run-time semantics given below to the current definition. The semantics are incomplete until orig and dest are resolved (e.g., by REPEAT).

Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by the resolution of orig.



WITHIN  CORE-EXT

( n1|u1 n2|u2 n3|u3 -- flag )
Perform a comparison of a test value n1|u1 with a lower limit n2|u2 and an upper limit n3|u3, returning true if either (n2|u2<n3|u3 and (n2|u2<=n1|u1 and n1|u1<n3|u3)) or (n2|u2>n3|u3 and (n2|u2<=n1|u1 or n1|u1<n3|u3)) are true, returning false otherwise.

Implementation: The condition of n1|u1, n2|u2, and n3|u3 being not all of the same type is ignored.



WORDLIST  SEARCH

( -- wid )
Create a new empty word list, returning its word list identifier wid. The new word list is allocated in data space. The system allows the creation of any number of new word lists in addition of those already provided.

See also: VOCABULARY



WRITE-FILE  FILE

( c-addr u fileid -- ior )
Write u characters from c-addr to the file identified by fileid starting at its current position. ior is the I/O result code.

At the conclusion of the operation, FILE-POSITION returns the next file position after the last character written to the file and FILE-SIZE returns a value greater than or equal to the value returned by FILE-POSITION .

Implementation: The paragraph address of c-addr may be modified by >SEG.

See also: READ-FILE WRITE-LINE



WRITE-LINE  FILE

( c-addr u fileid -- ior )
Write u characters from c-addr followed by the line terminator to the file identified by fileid starting at its current position. ior is the I/O result code.

At the conclusion of the operation, FILE-POSITION returns the next file position after the last character written to the file and FILE-SIZE returns a value greater then or equal to the value returned by FILE-POSITION.

Implementation: The paragraph address of c-addr may be modified by >SEG.

See also: READ-FILE READ-LINE



X.  "x-dot"  KERNEL

( x-addr -- )
Display extended address x-addr as a four character string as with .SEG, a colon, a four digit hexadecimal number and a space. If x-addr is an address in CSEG, 5 spaces are printed followed by the offset.



XOR  "x-or"  CORE

( x1 x2 -- x3 )
x3 is the bit-by-bit logical exclusive-or of x1 with x2.



ZCOUNT  "z-count"  KERNEL

( c-addr -- c-addr n )
Scan the character string at c-addr for character NUL. n is the number of characters before the first occurence.

Implementation: The paragraph address of c-addr may be modified by >SEG.



[  "left-bracket"  CORE

Interpretation: Perform the execution semantics defined below.

Compilation: Perform the execution semantics defined below.

Execution: ( -- )
Enter interpretation state. [ is an immediate word.

See also: ]



[']  "bracket-tick"  CORE

Interpretation: Perform the function of -14 THROW.

Compilation: ( "<spaces>name" -- )
Skip leading space delimiters. Parse name delimited by a space. Find name. Append the run-time semantics below to the current definition. Exception -13 is issued if name is not found.

Run-time: ( -- xt )
Place name's execution token xt on the stack. The execution token compiled by the phrase " ['] X " is the same value returned by " ' X " outside of compilation state.

See also: ' POSTPONE



\  "backslash"  CORE-EXT

Compilation: Perform the execution semantics given below.

Execution: ( "ccc<eol>" -- )
If BLK contains zero, parse and discard the remainder of the parse area; otherwise parse and discard the portion of the parse area corresponding to the remainder of the current line. \ is an immediate word.



\G  "backslash-g"  KERNEL

Compilation: Perform the execution semantics given below.

Execution: ( "ccc<eol>" -- )
If BLK contains zero, parse and discard the remainder of the parse area; otherwise parse and discard the portion of the parse area corresponding to the remainder of the current line. \G is an immediate word. Used in generating glossaries.



\S  "backslash-s"  KERNEL

( "ccc<eol>" -- )
Parse and discard the remainder of the parse area. If the input source is a block, stop interpreting the block. If the input source is a text file, stop interpreting the file.



]  "right-bracket"  CORE

( -- )
Enter compilation state.

See also: [



{:  "brace-colon"  LOCAL-EXT

Interpretation: Perform the function of -14 THROW.

Compilation: ( i*x "<spaces>ccc" :}" -- )
Parse ccc according to the following syntax: {: <arg>* [| <val>* ][-- <out>*] :} where <arg>, <val> and <out> are local names, and i is the number of <arg> names given. The following ambiguous conditions exist when:

  -- a local name ends in ":", "[", "^"
  -- a local name is a single non-alphabetic character;
  -- the text between {: and :} extends over more than one line;
  -- {: ... :} is used more than once in a word.
Run-time: ( x1 ... xi -- )
Create locals for <arg>s and <val>s. <out>s are ignored. <arg> names are initialized from the data stack, with the top of the stack being assigned to the right most <arg> name. <val> names are uninitialized. <val> and <arg> names have the execution semantics given below.

name Execution: ( -- x )
Place the value currently assigned to name on the stack. TO name Run-time: ( x -- )
Set name to the value x.

Methods for name:
+TO      ( n|u -- )      Add n|u to name
CLEAR    ( -- )          Store zero in name
SET      ( -- )          Store true in name
Implementation: The definition of local identifiers may occur more than once in a definition.

See also: LOCALS| {D