6.7.7 Memory Blocks

Memory blocks often represent character strings; For ways of storing character strings in memory see String representations. For other string-processing words see Displaying characters and strings.

In case you want to write a program that is portable to systems with 1 chars>1 (not recommended), you have to note the difference between words that take a number of aus (e.g., erase) and words that take a number of chars (e.g., blank), and insert chars as appropriate.

When copying characters between overlapping memory regions, use move. Cmove and cmove> tend to be slower than a well-implemented move.

move ( c-from c-to ucount – ) core “move”

Copy the contents of ucount aus at c-from to c-to. move works correctly even if the two areas overlap.

cmove ( c-from c-to u – ) string “c-move”

Copy the contents of ucount characters from data space at c-from to c-to. The copy proceeds char-by-char from low address to high address; i.e., for overlapping areas it is safe if c-to<=c-from.

cmove> ( c-from c-to u – ) string “c-move-up”

Copy the contents of ucount characters from data space at c-from to c-to. The copy proceeds char-by-char from high address to low address; i.e., for overlapping areas it is safe if c-to>=c-from.

fill ( c-addr u c – ) core “fill”

Store c in u chars starting at c-addr.

erase ( addr u –  ) core-ext “erase”

Clear all bits in u aus starting at addr.

blank ( c-addr u –  ) string “blank”

Store the space character into u chars starting at c-addr.

pad ( – c-addr  ) core-ext “pad”

c-addr is the address of a transient region that can be used as temporary data storage. At least 84 characters of space is available.