<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


DATA Search:

In Miscellaneous in TurboForth Kernal

Word Name: DATA
Type: Immediate compiling word
Data Stack Signature: -- address count
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Defines a list of numeric data. At runtime, the address of the data, and the number of items in the data list are pushed to the stack.

Example:

: TEST ( -- address count) DATA 5 100 200 300 400 500 ;

The above causes 6 cells to be compiled into the word (the length (5) and the five data items).

When TEST is subsequently executed two values are pushed to the stack. The topmost stack item (count) is the number of data items in the list. The next item on the stack (address) is the address in CPU memory of the first item of data.

Comment:

At compile time, compiles the numeric data following it into the colon definition. At run-time, DATA pushes the address of the data, and item count (in cells) to the stack, and continues execution with the word immediately following the data list.

The first data parameter should be the number of data items in the list. At run-time, DATA will push the address of the first data item (100) and the count (5) to the stack and continue execution from the first word following the data list. DATA should only be used inside a colon definition.

Note: Care should be taken when used on the command line. When used on the command line, a line of data should be no longer than 80 characters. This limitation does apply when compiling from blocks.

Note: a considerably enhanced version of DATA is available on the tools disk. Usage Information and source code is given here. It is suggested that where possible, this new enhanced version is used.

See Also: DCHAR 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>