scotws / TaliForth2

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

fragmented or limited zero page space #243

Open cstrotm opened 5 years ago

cstrotm commented 5 years ago

I'm currently porting TaliForth2 to the Western Design Center w65c134sxb development board.

This board, but also future platforms that I want to target, have a very fragmented zero-page space, and sometimes less than 30 continuous zero page locations available.

The current zero page configuration in TaliForth2 requires a continuous zero page space for variables and data stack.

A possible solution would be to move the "definitions.asm" to be included from the platform file and that "definitions.asm" will define zero page location non-continuous. Are there other (better) solutions?

Ideally the "definitions.asm" would define the "defaults" with the possibility to override the defaults in the platform file, but I'm not sure if that is possible from the Ophis assembler.

Some zero page locations are reserved for temporary space used by optional modules (e.g. Editor). Could these definitions moved into the source file for the module, to make them free in case the module is not used?

scotws commented 5 years ago

Sorry for the late response -- and yikes, I'd never even considered a fragmented zero-page space. I'm slightly at a loss at the moment (uh, what have you done in the meantime?) and also wonder if Ophis is able to do something like this.

One question that has been popping around in my head is if it would be worth the effort to port Tali to a different, more common assembler. Any suggestions?

scotws commented 4 years ago

@cstrotm Fear not, a solution is on the way. We've decided on 64tass as the new assembler for Tali Forth 2, and though it might take a little bit to switch everything and slightly longer than that to make full use of the functions, this should take care of the problem. To see how it will probably work, take a look at Cthulhu Scheme, which I started from scratch to force myself to use 64tass on its own terms. In the file https://github.com/scotws/Cthulhu-Scheme/blob/master/definitions.asm you'll see that Zero Page definitions all just to into a section definition. Then, the platform-specific file https://github.com/scotws/Cthulhu-Scheme/blob/master/platforms/platform-py65mon.asm tells you where that can be.

If I understand 64tass correctly, Zero Page and other parts can be fragmented. You'd just have to do some work with your own platform file.