BleuLlama / TinyBasicPlus

A C implementation of Tiny Basic, with a focus on support for Arduino
406 stars 118 forks source link

Minimizing SRAM usage #27

Closed Geddd closed 6 years ago

Geddd commented 6 years ago

My goal is to be able to run slightly larger programs.

I'm still learning this code (though I've read the original Palo Alto Tiny BASIC code, version 1 and 2!). I'm considering tokenizing keywords to save RAM. Would you be interested in that or should I fork the project?

I'm confused as to what else is using RAM besides the 26 variables and the call stack. What other opportunities would there be to minimize RAM usage?

Geddd commented 6 years ago

I could reduce it from three bytes to one in overhead per line by limiting line numbers to 0 to 255 and by terminating lines with a high bit (would preclude any lowercase in lines; will be slower but Tom Pittman used that approach and later added a binary search to speed it up).