Forum
String Arrays and memory - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: String Arrays and memory (/showthread.php?tid=1031)



String Arrays and memory - RandomiserUsr - 02-27-2021

Hi,

I wonder if someone could help me?

I have started writing a game but it uses a lot of String arrays.
The problem is I am compiling okay but on the screen things are missing where text should be.

I have compiled it using :-

Code:
zxbc MainEngine.bas --tzx --BASIC --autorun  --heap=6000 --optimize 2  --org=25000 --mmap=memory_map.txt
I am not sure where the issue but let me know if you need more information

Thanks
Ken


RE: String Arrays and memory - boriel - 02-28-2021

(02-27-2021, 10:51 PM)RandomiserUsr Wrote: Hi,

I wonder if someone could help me?

I have started writing a game but it uses a lot of String arrays.
The problem is I am compiling okay but on the screen things are missing where text should be.

I have compiled it using :-

Code:
zxbc MainEngine.bas --tzx --BASIC --autorun  --heap=6000 --optimize 2  --org=25000 --mmap=memory_map.txt
I am not sure where the issue but let me know if you need more information

Thanks
Ken

Sure. Please send me the code (or a small code snippet) to debug it.
You can also compile with:
--debug-memory        to enable out-of-memory check
--debug-array            to enable array boundary checking


RE: String Arrays and memory - RandomiserUsr - 02-28-2021

Thank you Boriel for you response.

I have actually just now progressed further.
Seems there is a limit on DIM A$(100) character width  i.e.

Code:
A$(1) =" 160(about) Characters" 

one string had 205 characters so I thought just cut it down bit by bit to see if it was an issue and it was.
I have a print routine which has a print to a "window" which has a word wrap so I expect it was the word wrap that is causing the pain.

I have a work around but interested to know if my thoughts were correct or not?


Regards
Ken


RE: String Arrays and memory - boriel - 03-01-2021

(02-28-2021, 05:43 PM)RandomiserUsr Wrote: Thank you Boriel for you response.

I have actually just now progressed further.
Seems there is a limit on DIM A$(100) character width  i.e.

Code:
A$(1) =" 160(about) Characters" 

one string had 205 characters so I thought just cut it down bit by bit to see if it was an issue and it was.
I have a print routine which has a print to a "window" which has a word wrap so I expect it was the word wrap that is causing the pain.

I have a work around but interested to know if my thoughts were correct or not?


Regards
Ken
There should be no limit in character length. Strings are limited to 65535 (64K) length. This is either a bug on the compiler or a problem with the heap.

Can you please send me a code snippet which reproduces de issue, plz?


RE: String Arrays and memory - RandomiserUsr - 03-06-2021

(03-01-2021, 07:59 AM)boriel Wrote:
(02-28-2021, 05:43 PM)RandomiserUsr Wrote: Thank you Boriel for you response.

I have actually just now progressed further.
Seems there is a limit on DIM A$(100) character width  i.e.

Code:
A$(1) =" 160(about) Characters" 

one string had 205 characters so I thought just cut it down bit by bit to see if it was an issue and it was.
I have a print routine which has a print to a "window" which has a word wrap so I expect it was the word wrap that is causing the pain.

I have a work around but interested to know if my thoughts were correct or not?


Regards
Ken
There should be no limit in character length. Strings are limited to 65535 (64K) length. This is either a bug on the compiler or a problem with the heap.

Can you please send me a code snippet which reproduces de issue, plz?
Hi boriel thanks for this and sorry I've not been on *health issues* 

I have not been able reproduce this again so perhaps it was a glitch ?

Thank you for this :-)