BleuLlama / TinyBasicPlus

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

Spagetti code #46

Open ercanersoy opened 6 years ago

ercanersoy commented 6 years ago

I examined TinyBasicPlus.ino file. But, I saw much goto statements.

May functions be applied in this file instead of goto statements?

hamsternz commented 6 years ago

Hi! This is a topic worth of discussion - I would really like to hear from others who are more active in this project.

This started out as a re-implementation of TinyBasic, which was aimed at very, very limited memory environments (e.g. 1k or less of RAM).

Because of this, avoiding using the stack was a very high priority. I tried to get away with as few bytes as possible, making it authentic to the feel of the original 68k ASM source, and leaving as much memory as possible for user code.

I haven't been following development lately, but I suspect things have moved along a lot since then. and the target environment is no longer targeted to just the smallest of microcontrollers. I am not sure that anybody is counting bytes on he stack any longer.

Should you wish to use functions instead, feel free to make a fork and do so, but do not be surprised if any request to merge back into the main project rejected unless you can convince the current maintainers that the additional memory used for stack space, (and that of any local variables you might declare in those functions) is worthy of the reduction in BASIC program space for memory constrained devices.

Perhaps using some inline functions could be an attractive halfway point?

BleuLlama commented 6 years ago

I'd be willing to review an update like that if you wanted it to be mainline TBP... or if you want to make a new project, or whatever, that's cool. :) (or i can add you to this one, and we can make a new mainline fork... I honestly haven't done much TBP dev work in a while, and suddenly picked back up into it this past week for some reason. heh.

So yeah, I was trying to make it useful on the '168 micros, but you had less than 100 bytes for your program. 328p gave you a more usable amount of space. I would thinking making the program space and command line memory relocatable would be the most advantageous... then you could use I2C or SPI RAM/Flash for programs, vastly improving your program sizes. ;) but i'm babbling now..