EightBall icon indicating copy to clipboard operation
EightBall copied to clipboard

Way to pass string literals as argument

Open bobbimanners opened this issue 7 years ago • 0 comments

This would be nice:

call foo("Hello")
end
sub foo(byte s[])
 pr.str s; pr.nl
endsub

One fairly easy way to implement this:

  • New VM instruction to store string in program space. The string follows the instruction. The VM just skips until the NULL. (This is similar to the trick I do with PRSTR today.)
  • The compiler will put the address of the start of the string on the eval stack.

If we implement this, we can probably get rid of the PRMSG VM instruction and the pr.msg statement, since pr.str "xxxx" should work.

bobbimanners avatar May 05 '18 18:05 bobbimanners