Pointers in SharpForth are not the usual lineair adresses but a aggregate of:
  • 2 bits memory type,
  • 14 bits Dictionary index into the List<DictionaryEntry>,
  • 16 bits Definition index into a DictionaryEntry.Definition, a List<Int32>.

The layout looks like:

|              |                        |                  |
+- (2 bits) ---+--- (14 bits) ----------+- (16 bits) ------+

Memory types are:
  • MEM_DEF: Dictionary/Definition Memory,
  • MEM_RSP: Return Stack,
  • MEM_PRM: Parameter Stack,
  • MEM_STR: Word/String Buffer.

Note: their is some overlap between the String buffer and Dictionary Memory addresses (for word #0 only, the reason why this is a reserved word/placeholder called XYYZ).

PAD is also present as a pure Forth allot'ed space, the buffer for Pictured Numbers is a C# String so outside direct reach of SharpForth.

The Word/String Buffer is a List<Char> and can be used with care (some words that are temporary are automatically removed after use (like FIND using the result of WORD). This Word/String buffer however will continue to expand as it's not always possible to discard the string stored in it.

Last edited Sep 17, 2013 at 1:41 PM by wvd_vegt, version 3


No comments yet.