DB006 - GreenArrays


Add to my manuals
50 Pages

advertisement

DB006 - GreenArrays | Manualzz

DB006 G144A12 polyFORTH Supplement

The assignment of letters for stack effect comments has been changed to reflect the coexistence of cell and byte addressing:

c

a

b now denotes any octet sized value... a byte, or a character that may fit into a byte. now denotes a 16-bit cell address. now denotes a 16-bit byte address.

See Source Code Management below for the consolidated and updated tools provided with this system.

3.2 Chapter 2: Basic Forth Vocabulary

This implementation uses 16-bit cells, twos complement arithmetic, and by default all addressing is in cell units.

Double cells are stored with most significant cell first in memory. Big-endian byte addressing is simulated as described later. Enhancements are documented later on.

3.2.1 Stack Operations

Parameter stack operations are conventional; note that 'S returns a cell address so offsets into the stack are half what the examples show. PICK and ROLL are deprecated since both are apocryphal and ROLL is abysmally inefficient.

Memory operations are conventional except for the cell addressing and the hierarchy of available memory, as described later. Half-cells do not exist so the half-cell vocabulary does not exist.

Return stack operators are conventional except that R@ is apocryphal and is deprecated.

Conveniences are conventional except that ' (tick) yields an interpretable execution token (executable versions for primitives) and that the execution token is not a parameter field address.

3.2.2 Arithmetic and Logical Operations

Some operations may be available only in compiling forms and may not be interpreted.

Deprecated functions: M-

The division operators will be changed soon. Not all have been tested for full range. Relationals such as < MAX MIN are implemented using the circular model, so are not full range; for full range use U< or WITHIN .

Truth values are conventional for late polyFORTH systems. Any word that consumes a flag will interpret zero as false and any nonzero value as true. Any word that produces a flag will produce "clean" values (0 for false, -1 for true) unless the word is documented to produce a "dirty" value (any nonzero for true.) NOT is equivalent to 0= and therefore will invert the interpretation of any flag, dirty or clean.

3.2.3 Character and String Operations

In general character oriented words produce and consume byte addresses and counts in the manner most natural for their intended uses. For example, WORD places counted strings at HERE 1+ and returns a cell address. COUNT takes a cell address, returning a byte address and byte count. Those words dealing in byte addresses and/or counts are listed in later sections. " is not presently implemented.

3.2.4 Program Structures

FORTH, Inc. systems have always supported flexible program structuring. During compilation, the parameter stack holds cell addresses and is what ANS Forth calls the "control flow stack." These addresses may be manipulated freely to build useful structures, such as multi-exit loops, that are more efficient of code and of execution time than the less flexible alternatives. Please see ANS Forth for examples of what may be accomplished.

18

Copyright© 2010-2011 GreenArrays, Inc. 9/23/12

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents