Re: Compiling TaliForth2 on Windows
Posted: Mon Jan 27, 2020 8:00 pm
Here are some extra tools for your toolbox (not sure if they are applicable to your particular problem).
There is :NONAME, used in place of : and without a name after it, for making unnamed words. It leaves the address of the new word on the stack. The address can be stored in an array if you have a bunch of them, and then you just index the array to get to the one you want. The words can be executed by placing the address on the stack and using EXECUTE. This might work well if you have several different things that are "YELLOW" and you can arrange for the word YELLOW to just be the same offset into each array and therefore reusable.
Tali is a native compiling Forth, meaning that if a word being used in a definition is small, it will copy the opcodes for that word directly into the new word rather than using a JSR. This increases speed, but at the expense of memory. Because you are running into memory limits, you may want to set the variable NC-LIMIT to a low value like 5 (or even 0 to prevent native compiling and everything will be compiled as a JSR). The NC-LIMIT variable sets the size limit (in bytes) where a word will be natively compiled. It default to 20 bytes. Set this before compiling any code. You can also set the variable STRIP-UNDERFLOW (a flag) to true to save a few bytes by removing the check for stack underflow (for words that remove things from the stack) when native-compiling a word. If you've set NC-LIMIT to 0, this won't have any effect because native compiling will be completely disabled.
There is :NONAME, used in place of : and without a name after it, for making unnamed words. It leaves the address of the new word on the stack. The address can be stored in an array if you have a bunch of them, and then you just index the array to get to the one you want. The words can be executed by placing the address on the stack and using EXECUTE. This might work well if you have several different things that are "YELLOW" and you can arrange for the word YELLOW to just be the same offset into each array and therefore reusable.
Tali is a native compiling Forth, meaning that if a word being used in a definition is small, it will copy the opcodes for that word directly into the new word rather than using a JSR. This increases speed, but at the expense of memory. Because you are running into memory limits, you may want to set the variable NC-LIMIT to a low value like 5 (or even 0 to prevent native compiling and everything will be compiled as a JSR). The NC-LIMIT variable sets the size limit (in bytes) where a word will be natively compiled. It default to 20 bytes.
Code: Select all
5 nc-limit !