scotws / TaliForth2

A Subroutine Threaded Code (STC) ANS-like Forth for the 65c02
Other
86 stars 23 forks source link

Make user-words.fs platform specific #256

Open twoinke opened 4 years ago

twoinke commented 4 years ago

Making user-words.fs platform specific or adding a supplemental -user-words to the platform folder would be nice. This way, platform/hardware specific words like device drivers could be added per platform.

SamCoVT commented 4 years ago

That sounds like a reasonable idea. Does it make sense to leave the forth/user-words.fs file (for stuff users might want on all platforms) and add a platform/myplatform-user-words.fs file for the platform specific stuff?

On the other hand, there isn't a ton of room for the extra words. The existing user-words and forth-words.fs files are stripped of all comments and line endings and stuffed into a string in the ROM with exactly 1 space between words. At startup, the string is EVALUATEd (note that the more stuff you put in the xxx-words.fs files, the slower Tali is to boot because of this). It takes up a lot of ROM space because it's stored as the original ASCII text, minus the comments and extra whitespace. Tali currently takes up around 22Kish, and we tried to leave 8K for the user's use, so there's not a ton of room left.

I ended up running out of room in my SBC's EEPROM to use just the forth-words method, so I added storage to my system (first an EEPROM over I2C and later a Compact Flash interface) and used the block words to get more extensive code loaded. I just use user-words.fs for my I2C routines to access the external EEPROM, and then I load various screens off of that to get the FAT32 support for the Compact Flash card off of that or support for other hardware I have, like an LCD screen.

If this is something you are really interested in, would you be willing to code the changes needed? I'd be happy to help you out, and you can check the Makefile to see how the platform files are currently handled using wildcards and how the xxx-words.fs files are currently handled using the python script that strips the comments/whitespace out.

scotws commented 4 years ago

From my 64tass tests with Cthulhu Scheme I think there is a lot of space we can save if we we are willing to implement a system of configuration options for conditional assembly. For instance, I really hate octal, think it is a complete waste of space. However, some people may have not yet seen the light. So as a test, I've included a OCTAL = false flag in the Cthulhu platforms file so it won't assemble OCTAL support (which I haven't coded yet, but you get the idea).

I'm not sure how fine-grained we want to be, and we'll have to make sure that all combinations work, but this might be a way to make room for more user-specific stuff. I'm really getting to like conditional assembly :-)