Another day, another 10k (changeset #524):
* made ubasic eat up to 100 labels or REMs in one call to ubasic_run, rather than taking 10ms each
- from testing, 100 is very safe. We could probably raise it a lot, but how often do you have 100 rems and labels with no code ? See attached for my REM and label benchmarks
* made script buffer dynamic, allocated when script is loaded
- This cuts 8k from CHDK size, and reduces memory usage by up to this much if you have a smaller script loaded. To load the default script (=maximum memory saving) make a zero byte file and load that.
- This also removes the 8k script size limit. remtst.bas demonstrates this. It's not clear what the next ubasic limit would be (aside from available memory), but 32k or 64k lines will probably break, since shorts are used for line numbers in some places.
- We could change things so the script only loads when you actually run it, rather than when selected. This would reduce average memory usage, but make script startup slower.
- in the case of lua, we can pre-compile the script and free the text. (you can in fact build lua without the compiler, and then compile on your PC and run on the target... might be worth looking into if people want maximum free memory with lua. would need some work.)
- ubasic scripts could be made more compact at load time in a number of ways, such as discarding rems and extra whitespace.
* made some other script related memory dynamic
- saves another 2k
Note there are some oddities in script parameter set saving. I'm not sure if it is broken, or I just don't understand the logic of when they are supposed to be saved or not. I have not changed this. Running the script appears to cause them to be saved every time.
I've encountered a crash while deleting highlighted files in the file browser. This is not related to the above commit, as it also happens in the prior build.
Another unrelated bug. If you run a non-md script after running an MD script, the grid is still shown.