gtiani
06-06-05, 06:16 PM
How can I define a word to make a counted string?
I'm currently using this rather crude method:
: MSG1 ." HELLO WORLD" ; \ make the string but never call this word
: ^STR_MSG1 \ extract the address and count of the string
['] MSG1 4 + \ address of string
['] MSG1 3 + P@ ; \ count
It works but I would like it to look like this:
: ^STR_MSG1
S" HELLO WORLD" ;
I am using this to send a string to an LCD display.
Thank you
Gary
I'm currently using this rather crude method:
: MSG1 ." HELLO WORLD" ; \ make the string but never call this word
: ^STR_MSG1 \ extract the address and count of the string
['] MSG1 4 + \ address of string
['] MSG1 3 + P@ ; \ count
It works but I would like it to look like this:
: ^STR_MSG1
S" HELLO WORLD" ;
I am using this to send a string to an LCD display.
Thank you
Gary