Go to floating point words.

Non-Floating Point Words

! " # $ & ' ( * + , - . / 0123456789 : < = > ? @ a b c d e f g h i j k l m n o p q r s t u v w x y z [ \ ] ^ {

!

! ( n adr -- ) Stores a number at adr !csp ( -- ) Remembers the stack pointer

"

" ( -- adr len ) ccc" Collects a string from the input stream "" ( -- adr ) ccc Collects a word from the input stream ", ( adr len -- ) Places a string at the top of the dictionary ". ( adr -- ) Displays a packed string. Equivalent to COUNT TYPE "chdir ( string -- ) Changes to the directory whose name is the packed string "string" "command ( string -- ) Executes the system command line contained in the packed string "string" "compile ( string -- ) Compiles or interprets a word "copy ( fromadr toadr -- ) Copies a packed string from fromadr to toadr "create ( str -- ) Defines a word from a string on the stack "load ( filename -- ) Interprets the file whose name is the packed string on the stack "temp ( -- str ) Converts a digit in pictured numeric output

#

#> ( l -- adr +n ) Ends pictured numeric output #align ( -- n ) The alignment granularity for the cpu; 2 for 68000 #line ( -- adr ) User variable containing the line number on the output device #out ( -- adr ) User variable containing the column number on the output device #s ( +l -- 0 ) Converts the rest of the digits in pictured numeric output #threads ( -- n ) The number of threads used by the dictionary hashing scheme #tib ( -- adr ) Size of Terminal Input Buffer #user ( -- n ) The first unused USER area offset #vocs ( -- n ) The number of vocabularies that can be in the search order at one time

$


&


'

' ( -- acf ) name Finds a word in the dictionary 'user# ( -- user# ) name Finds the user number associated with the word if there is one 'word ( -- adr ) The address where WORD puts its string

(

( ( -- ) Begins a comment (") ( -- adr len ) Run-time word compiled by " ("s) ( -- adr ) Run-time word compiled by [""] (') ( -- acf ) Run-time word compiled by ['] (+loop) ( n -- ) Run-time word compiled by +LOOP (.") ( -- ) Run-time word compiled by ." (.) ( n -- adr len ) Converts a signed number to a character string (.s ( -- ) Displays the contents of the data stack (;code) ( -- ) Run-time word compiled by ;CODE and DOES> (?do) ( end start -- ) Run-time word compiled by ?DO (abort") ( flag -- ) Run-time word compiled by ABORT" (compile) ( acf -- ) Compiles a compilation address into the dictionary (do) ( end start -- ) Run-time word compiled by DO (does) ( -- ) Run-time word compiled by DOES> (interpret ( -- ) The Default implementation of INTERPRET (is) ( action-acf -- ) Run-time word compiled by IS (lit) ( -- n ) Run-time word compiled by DO-LITERAL (llit) ( -- l ) Run-time word compiled by DO-LITERAL (loop) ( -- ) Run-time word compiled by LOOP (s ( -- ) stack-comment Alternate form of stack comment (see) ( acf -- ) Decompiles the word (u.) ( u -- adr len ) Converts an unsigned number to a character string (where ( -- ) The Default implementation of WHERE

*

* ( n1 n2 -- n3 ) Multiplies n1 times n2

+

+ ( n1 n2 -- n3 ) Adds n1+n2 +! ( n adr -- ) Adds n to the number stored at adr +loop ( n -- ) Ends DO .. +LOOP construct; adds n to loop index +str ( adr1 -- adr2 ) Finds the end of the packed string at adr1

,

, ( n -- ) Places a number in the dictionary ," ( -- ) ccc" Places a string at the top of the dictionary

-

- ( n1 n2 -- n3 ) Subtracts n1-n2 -rot ( n1 n2 n3 --- n3 n1 n2 ) Shuffles top 3 stack items -trailing ( adr +n1 -- adr +n2 ) Removes trailing spaces

.

. ( n -- ) Displays a number ." ( -- ) ccc" Compiles a string for later display .( ( -- ) ccc) Displays a string immediately .id ( anf -- ) Displays the name of a word from its name field address .name ( acf -- ) Displays the name of a word from its compilation address .r ( n +n -- ) Displays a number in a fixed width field .s ( -- ) Displays the contents of the data stack

/

/ ( n1 n2 -- n3 ) Divides n1/n2 /c ( -- n ) The number of bytes in a byte; 1 /c* ( n1 -- n2 ) Multiplies by the size of a byte /l ( -- n ) The number of bytes in a longword; 4 on a 32-bit system /l* ( n1 -- n2 ) Multiply by the size of a longword /link ( -- n ) The number of bytes in a dictionary link; 4 on a 32-bit system /mod ( n1 n2 -- n3 n4 ) n3 is remainder, n4 is quotient of n1/n2 /n ( -- n ) The number of bytes in a normal; 4 on a 32-bit system /n* ( n1 -- n2 ) Multiplies by the size of a stack item /token ( -- n ) The number of bytes in a compiled address; 4 on a 32-bit system /w ( -- n ) The number of bytes in a 16-bit word; 2 /w* ( n1 -- n2 ) Multiply by the size of a word

0123456789

0< ( n -- flag ) Is n < 0 ? 0= ( n -- flag ) Is n = 0 ? 0> ( n -- flag ) Is n > 0 ? 1+ ( n1 -- n2 ) Add 1 1- ( n1 -- n2 ) Subtracts 1 16-bit ( -- ) Noop on a 16-bit system, aborts on a 32-bit system 16\ ( -- ) Ignores rest of line if not a 16-bit system 2! ( n1 n2 adr -- ) Stores 2 numbers at adr 2* ( n1 -- n2 ) Multiplies by 2 2+ ( n1 -- n2 ) Adds 2 2- ( n1 -- n2 ) Subtracts 2 2/ ( n1 -- n2 ) Divides by 2 2@ ( adr -- n1 n2 ) Fetchs 2 numbers from adr 2drop ( n1 n2 -- ) Removes 2 numbers from stack 2dup ( n1 n2 -- n1 n2 n1 n2 ) Duplicates 2 numbers 32-bit ( -- ) Aborts if the Forth system is a 16-bit implementation 32\ ( -- ) Ignores rest of line in a 16-bit system; no-op on a 32-bit system

:

: ( -- sys ) name Starts the compilation of a new colon definition ; ( -- ) Finishes the compilation of a colon definition ;s ( -- ) Terminates the loading of the current input file

<

< ( n1 n2 -- flag ) Is n1 < n2 ? <# ( -- ) Initializes pictured numeric output << ( n1 cnt -- n2 ) Left shifts n1 by count places <= ( n1 n2 -- flag ) True if n1 is less than or equal to n2 <> ( n1 n2 -- flag ) True if n1 is not equal to n2 <mark ( -- adr ) Remembers target of backward branch <resolve ( adr -- ) Finishes a backward branch <w@ ( adr -- n ) Fetchs the signed 16-bit word at addr

=

= ( n1 n2 -- flag ) Is n1 = n2 ?
> > ( n1 n2 -- flag ) Is n1 > n2 ? >= ( n1 n2 -- flag ) True if n1 is greater than or equal to n2 >> ( n1 cnt -- n2 ) Rights shift n1 by "cnt" places >>a ( n1 cnt -- n2 ) Arithmetic rights shift n1 by "cnt" places (sign bit copied to high bits) >body ( acf -- apf ) Finds the parameter field address from the compilation address >data ( acf -- adr ) Finds the data storage address for the word at acf >in ( -- adr ) Variable containing input stream offset; Implemented in BLOCK.FTH >link ( acf -- alf ) Finds link field address from compilation address >mark ( -- adr ) Remembers the location of forward branch >name ( acf -- anf ) Finds name field address from compilation address >r ( n -- ) Moves a number to the return stack >relbit ( adr -- byte-adr bitmask ) Returns byte address and mask of the relocation bit for the addess "adr" >resolve ( adr -- ) Finishes a forward branch >type ( adr +n -- ) Displays characters and stores them at PAD >user ( apf -- user-var-adr ) Finds a user number that is in the parameter field >user# ( acf -- user# ) Finds the user number associated with the word if there is one

?

? ( adr -- ) Displays the contents of a variable ?branch ( flag -- ) High-level conditional branch ?comp ( -- ) Aborts if not compiling ?cr ( -- ) New line if fewer than no space left on this one ?csp ( -- ) Checks stack pointer against value saved by !CSP ?do ( w1 w2 -- ) Begins a ?DO .. LOOP to be executed 0 or more times ?dup ( n -- n n ) Duplicates n if it is non-zero ?exec ( -- ) Aborts if not interpreting ?leave ( flag -- ) Exits from a DO .. LOOP if flag is nonzero ?line ( n -- ) New line if fewer than n spaces left on this one ?pairs ( n1 n2 -- ) Aborts if n1 is not equal to n2 ?stack ( -- ) Aborts if the stack pointer is out of range

@

@ ( adr -- n ) Fetches a number from adr

a

abort ( -- ) Aborts current execution and interprets keyboard commands abort" ( flag -- ) ccc" Conditional abort with message abs ( n -- u ) Absolute value alias ( -- ) new-name existing-name Creates a new name for an existing word align ( -- ) Makes sure the dictionary pointer is on a machine word boundary aligned ( adr1 -- adr2 ) Adjusts an address to a machine word boundary allot ( n -- ) Allocates space in the dictionary and ( n1 n2 -- n3 ) Logical and another? ( -- [ anf ] more? ) Selects next word in vocabulary ascii ( -- char ) ccc Numerical value of first ascii character of next word

b

base ( -- adr ) Variable containing number base begin ( -- ) Begins a BEGIN .. WHILE .. REPEAT loop between ( n min max -- f ) True if min <= n <= max bl ( -- n ) The ascii code for the space character; decimal 32 blk ( -- adr ) Variable containing input block number; Implemented in BLOCK.FTH body> ( apf -- acf ) Finds compilation address from parameter field address bounds ( adr1 len -- adr2 adr1 ) Converts address and length to endadr startadr branch ( -- ) High-level unconditional branch bwjoin ( b.low b.high -- w ) Joins two bytes to form a 16-bit number bye ( -- ) Exits from Forth

c

c! ( n -- adr ) Stores a byte at adr c@ ( adr -- n ) Fetches a byte from adr ca+ ( adr1 index -- adr2 ) Increments adr1 by index times the size of a byte ca1+ ( adr1 -- adr2 ) Increments adr1 by the size of a byte canonical ( adr -- adr ) Converts a string to lower case caps ( -- adr ) USER variable controlling upper case/lower case sensitivity case ( selector -- selector ) Begins a CASE ... ENDCASE conditional catch ( acf -- 0|error ) Executes 'acf'. Returns 0 if no THROW occurred, else returns error code. ccall ( args ... format call# -- [ result ] ) Executes user C function "call#", passing args according to "format" string ccall: ( table-entry# -- ) name { arg-spec arg-spec ... -- result-spec } Creates a forth word to execute a user-supplied C function cmove ( adr1 adr2 u -- ) Copies u bytes from adr1 to adr2 cmove> ( adr1 adr2 u -- ) Copies u bytes from adr1 to adr2 code ( -- sys ) name Starts the definition of an assembly language word compile ( -- ) Compiles next word at run time constant ( n -- ) name Defines a constant context ( -- adr ) Array of vocabularies to search control ( -- char ) ccc Control character number of first character of next word convert ( +l1 adr1 -- +l2 adr2 ) Converts a string to a number count ( adr1 -- adr2 +n ) Unpacks a packed string cr ( -- ) Terminates a line on the display and goes to the next line crash ( -- ) Initial action for words defined by DEFER create ( -- ) name Generic defining word current ( -- adr ) Variable containing compilation vocabulary

d

decimal ( -- ) Set number base to 10 defer ( -- ) name Defining word for forward references or execution vectors definer ( acf -- definer-acf ) Finds the word which defined the word at acf definitions ( -- ) Sets compilation vocabulary delimiter ( -- adr ) USER variable containing the actual delimiter found by WORD depth ( -- +n ) How many numbers on stack? digit ( char base -- digit true | char false ) Converts a character to a digit do ( n1 n2 -- ) Begins a DO .. LOOP do-defined ( cfa immediate? -- ?? ) Called to handle a predefined word during interpreting or compilation do-literal ( l -- ?? ) Called to handle number during interpreting or compilation do-undefined ( str -- ) Called to handle an undefined word during interpreting or compilation does> ( -- adr ) Starts the run-time clause for defining words dpl ( -- adr ) Variable containing the position of the decimal point in last number input drop ( n -- ) Removes n from the stack du ( adr -- adr+64 ) Displays 64 bytes of memory starting at adr dump ( adr len -- ) Displays len bytes of memory starting at adr dup ( n -- n n ) Duplicates n.

e

else ( -- ) Executes the following code if IF failed emit ( char -- ) Displays the character end-string-array ( -- ) Finishes the definition of a string array endcase ( selector -- ) Terminates a CASE ... ENDCASE conditional endof ( -- ) Terminates an OF ... ENDOF clause within a CASE ... ENDCASE conditional entry ( -- adr ) USER variable used to implement multitasking erase ( adr u -- ) Sets u bytes of memory to 0 errno ( -- adr ) USER variable containing the last system error code error-output ( -- ) Selects the error output stream execute ( acf -- ) Executes the word whose compilation address is on the stack exit ( -- ) Returns from the current word expect ( adr +n -- ) Gets a line of input from the keyboard and stores it at adr

f

false ( -- 0 ) The value FALSE, which is 0 fclose ( fd -- ) Closes the file whose descriptor is "fd" fcr ( fd -- ) Writes the end-of-line sequence to the file "fd" fexit ( -- ) Ignores the rest of the current input file fflush ( fd -- ) Forces file buffers to be written to the file. fgetc ( fd -- char ) Returns next character from file whose descriptor is "fd", or -1 at end. fgetline ( adr fd -- #bytes ) Reads next line from file "fd" into buf at "adr" as packed string. fgets ( adr maxlen fd -- #bytes-read ) Reads up to "maxlen" characters from file "fd" into buffer at "adr". fill ( adr u byte -- ) Sets u bytes of memory to byte find ( adr1 -- adr2 n ) Finds a word in the dictionary fload ( -- ) filename Interprets a file follow ( threads -- ) Prepares to scan a vocabulary; see ANOTHER? fopen ( string mode -- fd ) Opens the file "string" in mode "mode" (READ, WRITE, MODIFY). forth ( -- ) The main vocabulary forth-83 ( -- ) Asserts the dialect fputc ( char fd -- ) Writes the character "char" to the file whose descriptor is "fd" fputs ( adr len fd -- ) Writes "len" characters from the buffer at "adr" to the file "fd" fseek ( l.position fd -- ) Sets position of file "fd" to the 32-bit number "l.position" fsize ( fd -- l.size ) Returns 32-bit size of the file "fd" ftell ( fd -- l.position ) Returns 32-bit current position within the file "fd" fungetc ( char fd -- ) Puts "char" back on file "fd"; undoes "fgetc"

g


h

here ( -- adr ) Address of top of dictionary hex ( -- ) Sets the number base to 16 hidden ( -- ) Vocabulary containing words used only to implement other words hide ( -- ) Makes the most recent word invisible hold ( char -- ) Inserts the char in the pictured numeric output string

i

i ( -- n ) Loop index if ( flag -- ) Executes following code if flag is true immediate ( -- ) Marks the last word as immediate immediate? ( acf -- flag ) True if word is immediate input-file-name ( -- str ) The name of the file being interpreted. interpret ( -- ) Interprets the input stream is ( action-acf -- ) name Installs a new action in a DEFER word

j

j ( -- n ) Loop index for next enclosing loop

k

key ( -- char ) Explicit 32-bit addition

l

l+! ( l adr -- ) Adds l to the 32-bit number at adr l, ( l -- ) Places a longword in the dictionary l->n ( l -- n ) Converts a longword to a stack item; noop on this system l. ( l -- ) Displays a 32-bit signed number l0= ( l -- flag ) True if l is zero l< ( l1 l2 -- flag ) True if l1 is less than l2 l= ( l1 l2 -- flag ) True if l1 is equal to l2 l>= ( l1 l2 -- flag ) True if l1 is less than l2; explicitly 32-bit l>name ( alf -- anf ) Finds the name field address from link field address l>r ( l -- ) Moves a longword to the return stack l@ ( adr -- l ) Fetchs the 32-bit longword at adr la+ ( adr1 index -- adr2 ) Increments adr1 by index times the size of a longword la1+ ( adr1 -- adr2 ) Increments adr1 by the size of a longword land ( l1 l2 -- l3 ) Explicit 32-bit logical and last ( -- adr ) USER variable containing the name field address of the last word created lastacf ( -- acf ) The compilation address of the last word created lbetween ( l1 lmin lmax -- flag ) True if lmin <= l1 <= lmax; explicitly 32-bit lbsplit ( l -- b.low b.mlow b.mhigh b.high ) Splits a longword into four bytes lconstant ( l -- ) name Defines a 32-bit constant ldrop ( l -- ) Removes a longword from the stack ldup ( l -- l l ) Duplicates l leave ( -- ) Exit from DO .. LOOP link! ( link adr -- ) Stores a dictionary link link@ ( lfa -- link ) Fetches a dictionary link literal ( -- n ) Compiles a number literal? ( str -- str false | n true ) Checks to see if a string is a number during interpreting or compilation lliteral ( -- l ) Compiles an explicit 32-bit number lmargin ( -- adr ) Variable containg left margin for output formatting lnegate ( l1 -- l2 ) Explicit 32-bit negation lnover ( l1 n -- l1 n l2 ) Copies a longword over a normal lnswap ( l n -- n l ) Swaps a longword and a normal long? ( -- flag ) True if the number that was just input contained a decimal point loop ( -- ) End of DO .. LOOP lose ( -- ) Compiled in place of an undefined word; aborts lr> ( -- l ) Moves a longword from the return stack lswap ( l1 l2 -- l2 l1 ) Swap 2 longwords lvariable ( -- ) name Define a 32-bit variable lwithin ( l1 lmin lmax -- flag ) True if lmin <= l1 < lmax; explicitly 32-bit lwsplit ( l -- w.low w.high ) Split a longword into two words

m

max ( n1 n2 -- n3 ) n3 is maximum of n1 and n2 maxdp ( -- adr ) The highest address that the dictionary can grow to maxprimitive ( -- n ) The maximum number of Forth words implemented directly in C min ( n1 n2 -- n3 ) n3 is minimum of n1 and n2 mod ( n1 n2 -- n3 ) Remainder of n1/n2 move ( adr1 adr2 u -- ) Copies u bytes from adr1 to adr2 mu/mod ( ul n -- n.rem ul.quot ) Divides longword by normal giving normal remainder and long quotient

n

n->l ( u -- l ) Converts a stack item to a longword; noop on this system n->w ( n -- w ) Converts a stack item to a word n>link ( anf -- alf ) Finds link field from name field na+ ( adr1 index -- adr2 ) Increments adr1 by index times the size of a stack item na1+ ( adr1 -- adr2 ) Increments adr1 by the size of a stack item name->string ( anf -- str ) Converts the name of a Forth word to a packed string name> ( anf -- acf ) Finds compilation address from name field negate ( n1 -- n2 ) Changes the sign of n1 newline ( -- char ) The character which ends a line in a text file. nip ( n1 n2 -- n2 ) Discards the second element from the data stack nlover ( n1 l -- n1 l n2 ) Copies a normal over a longword nlswap ( n l -- l n ) Swaps a normal and a longword noop ( -- ) Does nothing not ( n1 -- n2 ) One's complement number? ( adr -- l flag ) Converts a character string to a 32-bit number nuser ( -- ) name Defines and allocates space for a User variable

o

of ( selector test-value -- ) Begins an OF ... ENDOF clause within a CASE ... ENDCASE conditional off ( adr -- ) Stores false at adr on ( adr -- ) Stores true at adr or ( n1 n2 -- n3 ) Logical or origin ( -- adr ) The address of the start of the Forth system over ( n1 n2 -- n1 n2 n3 ) n3 is a copy of n1.

p

pack ( adr1 len adr2 -- adr2 ) Makes a packed string from adr1 len, placing it at adr2 pad ( -- adr ) The address of a scratch area used to temporary storage pick ( n1 -- n2 ) Copies n-th number place ( adr1 len adr2 -- ) Makes a packed string from adr1 len, placing it at adr2 primitive? ( acf -- flag ) True if acf is a reference to a Forth word implemented directly in C printable? ( char -- flag ) True if character is printable

q

quit ( -- ) Interprets keyboard commands

r

r> ( -- n ) Moves a number from the return stack to the data stack r@ ( -- n ) Copies the top of the return stack to the data stack repeat ( -- ) Ends a BEGIN .. WHILE .. REPEAT loop restore-output ( -- ) Goes back to the old output stream after ERROR-OUTPUT reveal ( -- ) Makes the most recent word visible rmargin ( -- adr ) Variable containg right margin for output formatting root ( -- ) The vocabulary selected by ONLY rot ( n1 n2 n3 --- n2 n3 n1 ) Rotates 3 numbers rp! ( adr -- ) Changes the return stack pointer rp0 ( -- adr ) A variable containing the address of the bottom of the return stack rp@ ( -- adr ) The address of the top of the return stack

s

s->l ( n -- l ) Converts a signed stack item to a longword; noop on this system s. ( n -- ) Displays n as a signed number save-forth ( filename -- ) Writes the Forth dictionary to a file. see ( -- ) name Decompiles the named word shift ( n1 n2 -- n3 ) Sets sign of pictured output skipstr ( -- adr len ) Used to implement words with in-line strings sp! ( adr -- ) Changes the data stack pointer sp0 ( -- ADDR ) Variable containing the address of the bottom of the Data Stack sp@ ( -- adr ) The address of the top of the data stack space ( -- ) Displays a space character spaces ( +n -- ) Displays n spaces span ( -- adr ) Variable containing the number of characters read by EXPECT state ( -- adr ) Variable that is nonzero in compile state string-array ( -- ) name Begins the definition of a string array swap ( n1 n2 -- n2 n1 ) Exchanges the top 2 stack entries. syscall ( args ... format sycall# -- error? ) Executes system call "syscall#", passing args according to "format" string

t

ta+ ( adr1 index -- adr2 ) Increments adr1 by index times the size of a compiled address ta1+ ( adr1 -- adr2 ) Increments adr1 by the size of a compiled address td ( -- ? ) Interprets the next word or number in DECIMAL mode th ( -- ? ) Interprets the next word or number in HEX mode then ( -- ) Terminates an IF ... ELSE ... THEN throw ( error -- ) Aborts back to most recent CATCH point. See CATCH. tib ( -- adr ) The address of the Text Input Buffer to-column ( column -- ) Advances the output to the indicated column token! ( adr2 adr1 -- ) Stores a relocatable address at adr1 token, ( adr -- ) Places a relocatable address in the dictionary token@ ( adr1 -- adr2 ) Fetches a relocatable address true ( -- -1 ) The value TRUE , which is -1 tuck ( n1 n2 -- n2 n1 n2 ) Copies the top of the stack underneath the second item type ( adr +n -- ) Displays n characters

u

u. ( u -- ) Displays an unsigned number u.r ( u +n -- ) Prints an unsigned number in fixed width field u< ( u1 u2 -- flag ) Unsigned version of < . u<= ( u1 n2 -- flag ) True if u1 is less than or equal to u2 u> ( u1 n2 -- flag ) True if u1 is greater than u2 u>= ( u1 n2 -- flag ) True if u1 is greater than or equal to u2 ualloc ( size -- new-user-number ) Allocates space in the user area ul* ( ul1 ul2 -- lproduct ) Unsigned 32x32 -> 32 multiply um* ( uw1 uw2 -- ul ) 16 bits times 16 bits unsigned multiply um/mod ( ul un -- un.rem un.quot ) Divide unsigned 32-bit number by unsigned number unnest ( -- ) Returns from a colon definition until ( flag -- ) Continues executing a BEGIN .. UNTIL loop until flag is true up! ( adr -- ) Changes the starting address of the user area up0 ( -- adr ) User variable containing the starting address of the USER area up@ ( -- adr ) The starting address of the aser area user ( offset -- ) name Defines a variable at the given offset in the User area user-size ( -- n ) The size in bytes of the USER area.

v

variable ( -- ) name Defines a variable vfind ( str voc-ptr -- cfa 1 ) Searches for a word in a single vocabulary voc-link ( -- adr ) USER variable containing the address of the last vocabulary created vocabulary ( -- ) name Defines a new vocabulary

w

w! ( w adr -- ) Stores a 16-bit word at adr w, ( w -- ) Places a word in the dictionary w->l ( uw -- l ) Converts an unsigned 16-bit number to a 32-bit number w@ ( adr -- w ) Fetches the unsigned word at adr wa+ ( adr1 index -- adr2 ) Increments adr1 by index times the size of a word wa1+ ( adr1 -- adr2 ) Increments adr1 by the size of a word warning ( -- adr ) USER variable controlling "isn't Unique" messages wbsplit ( w -- b.low b.high ) Split a 16-bit number into two bytes where ( -- ) Prints a message telling where in the input stream you are while ( flag -- ) Continues execution of BEGIN .. WHILE .. REPEAT loop while flag is true why ( -- ) Tells why the last failing system command failed within ( n min max -- f ) True if n <= x < max wljoin ( w.low w.high -- l ) Joins two words to form a longword word ( char -- adr ) Collects a char-delimited string from the input stream words ( -- ) Displays the words in the context vocabulary

x

xor ( n1 n2 -- n3 ) Exclusive or

y


z


[

[ ( -- ) Begins interpreting [""] ( -- ) ccc Collects a word from the input stream and compiles it as a string ['] ( -- adr ) Compiles the compilation address of a word [compile] ( -- ) Compiles the next word even if it's immediate

\

\ ( -- ) rest-of-line Skips the rest of the line \c ( -- ) rest-of-line Skips the rest of the line \dtc ( -- ) Does nothing \itc ( -- ) Ignores the rest of the line \needs ( -- ) name rest-of-line Interprets the rest of the line if needed-word is not already defined \t16 ( -- ) Ignores the rest of the line \t32 ( -- ) Does nothing
] ] ( -- ) Begins compilation

^


{


Floating Point Words

C Forth 83 Floating Point

The C Forth 83 Floating Point interface is intended to conform to the Forth Vendors Group proposed Forth Floating Point Standard. This implementation has the following characteristics: * Floating point numbers are kept on a separate floating point stack. * The floating point format is whatever the C floating point implementation uses for double precision floating point. Floating point numeric input: Floating point numbers are of the form, for example: +1234.5678E-6 The "E" is mandatory; it allows the Forth number parser to distinguish this as a floating point number. Examples: 1E0 -1.3E-4 The presence of a decimal point is not in itself sufficient to distinguish a number as being floating point. The "E" must be present. Floating point numbers are only recognized if BASE is decimal. Floating point numbers may be both interpreted and compiled in the usual way. Glossary: Words marked "FVG" are specified by the Forth Vendors Group proposed floating point standard. F+ fp1 fp2 -- fp3 FVG Floating-point addition. fp3 is the sum of fp1 and fp2. F- fp1 fp2 -- fp3 FVG Floating-point subtraction. fp3 is the difference fp1 minus fp2. F* fp1 fp2 -- fp3 FVG Floating-point multiplication. fp3 is the product of fp1 and fp2. F/ fp1 fp2 -- fp3 FVG Floating-point division. fp3 is the quotient of fp1 divided by fp2. F** fp1 fp2 -- fp3 FVG Floating-point exponentiation. fp3 is the value of fp1 raised to the power fp2. FCOS fp1 -- fp2 FVG fp2 is the cosine of fp1. Input argument is in radians. FSIN fp1 -- fp2 FVG fp2 is the sine of fp1. Input argument is in radians. FSINCOS fp1 -- fp2 fp3 FVG fp2 is the sine of fp1 and fp3 is the cosine of fp3. Input argument is in radians. FTAN fp1 -- fp2 FVG fp2 is the tangent of r1. The tangent of pi/2 or 3pi/2 radians returns the largest floating point number representable in the implementation's binary format. FALN fp1 -- fp2 FVG The exponential function. fp2 is the value of e raised to the power of fp1. FLN fp1 -- fp2 FVG fp2 is the natural logarithm of fp1. FSQRT fp1 -- fp2 FVG fp2 is the square root of fp1. FLOG fp1 -- fp2 FVG fp2 is the base 10 logarithm of fp1. FATAN fp1 -- fp2 FVG fp2 is the arctangent of fp1. This operator is valid for all floating point numbers. The result is in the range -pi/2 to pi/2 radians. FASIN fp1 -- fp2 FVG fp2 is the arcsine of fp1. Valid for -1 <= fp1 <= 1. The result is in the range -pi/2 to pi/2 radians. FACOS fp1 -- fp2 FVG fp2 is the arccosine of fp1. Valid for -1 <= fp1 <= 1. The result is in the range -pi/2 to pi/2 radians. FSINH fp1 -- fp2 FVG fp2 is the hyperbolic sine of fp1. FCOSH fp1 -- fp2 FVG fp2 is the hyperbolic cosine of fp1. FTANH fp1 -- fp2 FVG fp2 is the hyperbolic tangent of fp1. FVARIABLE -- (compilation) FVG -- addr (execution) A defining word used in the form: FVARIABLE cccc When FVARIABLE executes, it creates the definition cccc with its parameter field uninitialized. When cccc is later executed, the address of the parameter field is left on the stack, so that a F@ or F! operation may access this location. FCONSTANT fp -- (compilation) FVG -- fp (execution) A defining word used in the form: fp FCONSTANT <name> When FCONSTANT executes, it creates the definition so that when <name> is later executed, the floating point number fp is left on the stack. FALOG fp1 -- fp2 FVG fp2 is the result of raising 10 to the fp1 power. F. fp -- FVG Display fp on the currently selected output device in fixed-point form; i.e., the location of the decimal point is adjusted as necessary so that no exponent need be displayed. The number of digits specified by the most recent execution of the word PLACES are printed to the right of the decimal point. A trailing blank follows. For example, 4 PLACES 1.2345E02 F. will display as 123.4500b (where the character "b" denotes an ASCII blank). F.R fp n1 n2 -- FVG Display fp on the currently selected output device in fixed-point form with n1 digits to the right of the decimal place, right justified in a field of width n. Numbers that cannot be represented within the given field width are printed in exponential form. If the current system base is not decimal, an error condition exists. For example, 1.2345E2 4 12 F.R will display as bbbb123.4500 (where the character "b" denotes an ASCII blank). ** Not implemented ** F.S -- Print the contents of the floating point stack without affecting its contents. The number on the top of the stack appears on the right-hand side of the line. E. fp -- FVG Display fp in exponential form. The significand contains the maximum number of significant digits allowed by the floating-point data format, and the exponent is explicitly displayed even if it is zero. A trailing blank follows. If the current system base is not decimal, an error condition exists. E.R fp n1 n2 -- FVG Display fp on the currently selected output device in exponential form with n1 digits to the right of the decimal place, right justified in a field of width n. If the current system base is not decimal, an error condition exists. For example, 1.234E0 5 12 E.R will display as bb.12340E-01 (where the character "b" denotes an ASCII blank). ** Not implemented ** FLOAT l -- fp FVG Convert a signed long integer into its floating-point equivalent, removing the long integer from the Forth parameter stack and leaving the result on the floating-point stack. INT fp -- l FVG Truncate a floating-point number to a signed long integer (round it toward zero), removing the fp number from the floating-point stack and leaving the result on the Forth parameter stack. Underflow gives a zero result, overflow is an error condition. FIX fp -- l FVG Convert a floating-point number to a signed long integer, rounding towards the nearest integer, removing the fp number from the floating-point stack, and leaving the result on the Forth parameter stack. Underflow gives a zero result, overflow is an error condition. FABS fp1 --fp2 FVG fp2 is the absolute value of the floating-point number fp1 . FNEGATE fp1 -- fp2 FVG fp2 is the negative of the floating-point number fp1 . F! f addr -- FVG Store a floating-point number from the floating-point stack into the address that is on top of the Forth parameter stack. F@ addr -- f FVG Fetch a floating-point number to the top of the floating-point stack from the address that is on top of the Forth parameter stack. FDROP fp -- FVG Discard floating-point number on top of the stack. FSWAP fp1 fp2 -- fp2 fp1 FVG Interchange the two floating-point numbers on top of the stack. FOVER fp1 fp2 -- fp1 fp2 fp1 FVG Copy the second floating-point number on the stack to the top of the stack. FDUP fp -- fp fp FVG Duplicate the floating-point number on top of the stack. FROT fp1 fp2 fp3 -- fp2 fp3 fp1 FVG Rotate the third floating-point number to the top of the stack. FPOP f -- l l Move the fp number on top of the floating-point stack to the top two cells of the parameter stack, without converting it to an integer. fpop just moves the bits, without any sort of format conversion. FPUSH l l -- f Push the top two numbers on the parameter stack to the top cell of the floating-point stack, without converting them to fp. fpop just moves the bits, without any sort of format conversion. F0= fp -- f FVG True if the floating-point number on top of the stack is equal to zero. The fp number is removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F0<> fp -- f True if the floating-point number on top of the stack is not equal to zero. The fp number is removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F0< fp -- f FVG True if the floating-point number on top of the fp stack is less than zero. The fp number is removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F0>= fp -- f True if the floating-point number on top of the fp stack is greater than or equal to zero. The fp number is removed from the floating- point stack, and the flag is left on top of the Forth parameter stack. F0<= fp -- f True if the floating-point number on top of the fp stack is less than or equal to zero. The fp number is removed from the floating- point stack, and the flag is left on top of the Forth parameter stack. F0> fp -- f FVG True if the floating-point number on top of the fp stack is greater than zero. The fp number is removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F< fp1 fp2 -- f FVG True if fp1 is less than fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F> fp1 fp2 -- f FVG True if fp1 is greater than fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F<= fp1 fp2 -- f True if fp1 is less than or equal to fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F>= fp1 fp2 -- f True if fp1 is greater than or equal to fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F= fp1 fp2 -- f FVG True if fp1 is equal to fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. F<> fp1 fp2 -- f True if fp1 is not equal to fp2 . The two floating-point numbers are removed from the floating-point stack, and the flag is left on top of the Forth parameter stack. FMAX fp1 fp2 -- fp3 fp3 is the larger of the 2 floating point numbers fp1 and fp2 FMIN fp1 fp2 -- fp3 fp3 is the smaller of the 2 floating point numbers fp1 and fp2 FCEIL fp1 -- l l is the smallest integer which is as least as large as the floating point number fp1. fp1 is removed from the floating point stack and the result is left on the parameter stack. FFLOOR fp1 -- l l is the largest integer which is not larger than the floating point number fp1. fp1 is removed from the floating point stack and the result is left on the parameter stack. FP! n -- Store the integer on the parameter stack into the floating-point stack pointer. Used for initialization. FP@ -- addr Fetch the current contents of the floating-point stack pointer to the parameter stack. FDEPTH -- n n is the number of floating point numbers currently on the floating point stack. FP0 -- addr addr is the address of a USER variable which contains the 32-bit address of the of the top of the floating point stack area. The stack grows towards low memory from there. FP0 L@ FP! would empty the floating point stack, but see INITF . FCLEAR -- Clears the floating point stack. /F -- n Leaves the size, in bytes, of a floating point number in storage format. In this system, the value is 8. (FLITERAL) -- fp The run-time work compiled by fliteral which takes a floating point number from the executing code stream and leaves it on the floating point stack. FLITERAL fp -- C,I The floating point number is removed from the floating point stack and compiled into the current definition so that when the definition is later executed, that floating point number will be left on the floating point stack. Floating point example: This example prints a table of the values of the sine function at 1/10 radian intervals between 0 and two-pi. 3.1415926535E0 2E0 f* fconstant 2pi : sine-table ( -- ) 0E0 ( angle ) begin fdup 2pi f< ( angle end? ) while fdup f. fdup fsin f. cr .1E0 f+ ( angle' ) repeat ;