03-14-2021, 11:39 AM
(03-13-2021, 02:10 PM)RandomiserUsr Wrote: I wonder if there is a way to print the available memory your compile ZX Basic program has used whilst running it?
One more question on memory usage, which would be better in terms of reducing memory overhead?
1) IF WORD$ = "SAVE WORLD" THEN
or
2) IF WORD = 99 and WORD=98 THEN
thanks in advance
Ken
Using numbers will be always faster and shorter. A string is an array of bytes. A number will take 1-2 bytes. This is called "tokenization", and it's used in many text adventures, for example.
To compress text you can also use digraph and trigraph or other compression techniques (search in this forum). ZX Basic will also try to map repeated strings into a single memory region, whenever possible (there's still work to be done on this).