cr1901 wrote:
Something I just realized (Brad or someone else, correct me if I'm wrong): Forth primitives which are coded in ASM can use W as they wish, as NEXT will reload it based on the current Forth IP.
Correct. Actually, W is not a required part of the Forth virtual machine. It's just that a temporary address register turns out to be necessary in many Forth threading implementations, and it has become common to call this register W. (DTC NEXT on the 6809, for example, does not require a W register.)
Quote:
The only primitive snippet of code that actually relies on W being a certain value on input (pointing to the address of the Code Field of the currently entered word) is DOCOL.
Well, no. Many "defined word" actions, such as DOVAR and DOCON, may also make use of W to find the address of the Parameter Field. (Take heed - this becomes important when implementing the primitive EXECUTE; it must leave W in the "expected" state.)
_________________
Because there are never enough Forth implementations:
http://www.camelforth.com