whartung wrote:
The only real problem with pushing the elements on the stack is that it's not really a viable option on the 6502, not on the system stack at least, and especially not string values. You can push them on A stack (Forth uses the top of Zero page and indexes with X), but that's using X as your stack pointer, vs the systems. You also still have the problem with stack scarcity for something large like a string.
You could still use the stack if you just push addresses (address of the pattern string, address of the list of arguments (which can be 2 byte integers, or pointers), and the address of the destination buffer).
I see that being a problem when I try this on the 6502 as I'm having to juggle registers on x86.
What I've done on my x86 project is push the address of the pattern string and all string arguments onto the stack. Value arguments are just passed as such.