Re: gtBASIC
Posted: 07 Sep 2021, 15:09
That means you have run out of RAM.
If you un-comment line 5616 at the end of compiler.cpp and re-compile, it will give you a free RAM report at the end of the compile:
What ROM version are you building for? You will save a substantial amount of memory if you build for ROMv5a like this:
This leverages the CALLI instruction from ROMv5a/DEVROM to reduce the thunk that stitches code chunks together from 8 bytes per thunk to 3 bytes per thunk and reduces the GOSUB/GOTO overhead from 5 bytes to 3 bytes.
If you do this you should rename your file to include _ROMv5a in the filename, (and the same for 64k RAM, _64k), so a 64k RAM and ROMv5a specific .gt1 file would be named 'Something_ROMv5a_64k.gt1'; this allows users to know if it will run on their hardware.
Arrays by default are defined as signed 16bit, use % in the var name to declare arrays as byte only, (if you only need bytes).
Constant strings and constant arrays of strings should use the const statement, otherwise each individual string will allocate 96 bytes per string, (to allow it to grow in size, max string size is 94, 1 byte for length and 1 byte for delimiter):
P.S. If all else fails, then you will have to start looking at the & and && optimisation modifiers, (start with & and work your way up to &&).
If you un-comment line 5616 at the end of compiler.cpp and re-compile, it will give you a free RAM report at the end of the compile:
Code: Select all
//Memory::printFreeRamList(Memory::SizeDescending);
Code: Select all
'use this at the top of your source code
_codeRomType_ ROMv5a
If you do this you should rename your file to include _ROMv5a in the filename, (and the same for 64k RAM, _64k), so a 64k RAM and ROMv5a specific .gt1 file would be named 'Something_ROMv5a_64k.gt1'; this allows users to know if it will run on their hardware.
Arrays by default are defined as signed 16bit, use % in the var name to declare arrays as byte only, (if you only need bytes).
Constant strings and constant arrays of strings should use the const statement, otherwise each individual string will allocate 96 bytes per string, (to allow it to grow in size, max string size is 94, 1 byte for length and 1 byte for delimiter):
Code: Select all
'uses 5x96 = 480 bytes and the strings are modifiable
dim strings$(4) = "one", "two", "three", "four", "five"
Code: Select all
'uses 3+3+5+4+4 + 5*2 = 29 bytes and the strings are not modifiable
const dim strings$(4) = "one", "two", "three", "four", "five"