On 4/21/17 11:48 AM, Alex wrote:
> On 4/21/2017 21:46, Rudy Velthuis wrote:
>> I can't really find where it is stated, but I have the impression that
>> Forth is, more or less, big-endian.
>>
>> For instance, I have seen code like:
>>
>> : U. 0 D. ;
>>
>> This means that, at least for that Forth, the TOS is the high order
>> cell of a double word. Is this true for all Forth implementations, or
>> is this just implementation defined?
>
> True for all.
Per Forth2012 (and Forth94) under Usage Requirements/Cell Pair Types:
3.1.4.1 Double-cell integers
On the stack, the cell containing the most significant part of a
double-cell integer shall be above the cell containing the least
significant part.
>> If this is the case, is this true for bytes in a cell too, or is that
>> implementation defined?
>
> Endianess is to do with byte order. Undefined.
Correct. Byte order is unspecified (generally the property of the
processor).
>> Is it also true, or implementation defined, that the data stack
>> generally grows downward?
>>
>
> Undefined.
Also correct, but downward is the most common implementation.
Traditionally, the dictionary grows up from low memory and the data
stack grows down from high memory, and the space in between is
undefined. The standards do not specify implementation, however.
Cheers,
Elizabeth
--
Elizabeth D. Rather
FORTH, Inc.
6080 Center Drive, Suite 600
Los Angeles, CA 90045
USA