Forum
Maximal size for a compiled program - 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: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: Maximal size for a compiled program (/showthread.php?tid=905)

Pages: 1 2


Maximal size for a compiled program - Week of the agents - 11-09-2019

Hi, I am developing game with ZX Basic for a Spectrum 48k and when total size of compiled code approach up to 35-36K shit happens. Program can hang on or some pixels on screen are highlighted or INKEY stops to working.
Is there some limit?

I load code at address 24576 (24K) so I thought I have 40K room for free.


RE: Maximal size for a compiled program - boriel - 11-10-2019

(11-09-2019, 04:27 PM)Week of the agents Wrote: Hi, I am developing game with ZX Basic for a Spectrum 48k and when total size of compiled code approach up to 35-36K shit happens. Program can hang on or some pixels on screen are highlighted or INKEY stops to working.
Is there some limit?

I load code at address 24576 (24K) so I thought I have 40K room for free.
Theoretically it should work ok. If you don't use strings or do little usage of them, try reducing the heap (4k by default) compiling with the flag:
--heap-size=1024 for example (1k for heap). I recommend not to reduce heap size below 512.

Try please, and tell me.
Rolleyes


RE: Maximal size for a compiled program - Week of the agents - 11-10-2019

TY for answer. I'm not using PRINT, RANDOMIZE even DO LOOP for minimize heap (GOTO everywhere). I already kill half of graphics cos of this ))) Will try your tip.

OK, I've set heap to 1k and continue to develop. Will report any result.


RE: Maximal size for a compiled program - Week of the agents - 11-10-2019

[Image: bug.png?raw=1]

Nope, heap did not help  Sad
After several rooms I got this and later program stops react on keyboard events
Code size 36253
Compiler params
--tap --org=24576 --autorun --BASIC --optimize 2 --heap-size=512


RE: Maximal size for a compiled program - LCD - 11-11-2019

(11-10-2019, 08:34 PM)Week of the agents Wrote: [Image: bug.png?raw=1]

Nope, heap did not help  Sad
After several rooms I got this and later program stops react on keyboard events
Code size 36253
Compiler params
--tap --org=24576 --autorun --BASIC --optimize 2 --heap-size=512
Maybe if you compress the graphics and data and uncompress it when needed, can reduce the size of your programm? I used this in "Yumiko". Everytime the player changed move direction, a complete animation set was replaced. Also level data was compressed.


RE: Maximal size for a compiled program - Week of the agents - 11-11-2019

I have my own compress method, but mb can find another. I'd tried to reverse direction with procedure but lost FPS.


RE: Maximal size for a compiled program - boriel - 11-14-2019

(11-10-2019, 08:34 PM)Week of the agents Wrote: Nope, heap did not help  Sad
After several rooms I got this and later program stops react on keyboard events
Code size 36253
Compiler params
--tap --org=24576 --autorun --BASIC --optimize 2 --heap-size=512

First, congrats, the screen looks impressive.
It could be also stack corruption. Can you try --org=25000?
The screen might be corrupted due to a crash.


RE: Maximal size for a compiled program - Week of the agents - 11-14-2019

I'd tried. But got same shit.
Now, I've rebuilded data structures and tomorrow would continue programming. Will see.


RE: Maximal size for a compiled program - boriel - 11-15-2019

Also, I've detected a memory leak bug that fix yesterday. It happens when you use something like:
Code:
LET myString$(1) = "A"

If so, you should download this beta version that has the bug fixed:
http://www.boriel.com/.../zxb/zxbasic-1.9.8-beta1-win32.zip
http://www.boriel.com/files/zxb/zxbasic-1.9.8-beta1.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.9.8-beta1.zip


RE: Maximal size for a compiled program - Week of the agents - 11-15-2019

TY for the upgrade. But I'm not using any strings (only for debug).

I'm developing this game for Yandex Retro Games contest 2019.
After it (Dec 12th) I will share links with bas, graphics and additional programs for converting graphics and text data.


RE: Maximal size for a compiled program - Week of the agents - 11-19-2019

Just have finished my game and everything is working (on emulators). Dec 4th will start contest (hope for streams) and 12th I will share .tap and code.

[Image: screenshot1.png?raw=1]


RE: Maximal size for a compiled program - boriel - 11-19-2019

(11-19-2019, 02:32 PM)Week of the agents Wrote: Just have finished my game and everything is working (on emulators). Dec 4th will start contest (hope for streams) and 12th I will share .tap and code.

Congrats!!! How did you fix it??? Shy


RE: Maximal size for a compiled program - Week of the agents - 11-20-2019

Reworked data structures + heap 256b


RE: Maximal size for a compiled program - mauvedeity - 07-06-2020

I'm having a similar problem - I'm using v 1.11.1, and I've already moved the origin down from 32768 to 32000. That helped with the one issue I'm having. The problem is that I'm trying to do a text-based adventure, and I'm only on location 32 of about 90, so I'm clearly going to run out of space completely. I've tried "--optimize 2" and "--heap-size=512" and neither works. I've also tried switching Fuse to emulate a Spectrum 128, but that also didn't work.

Is there a way I can target a Spectrum 128 or Spectrum Next instead, and get extra memory that way? Or is there something else I could do? Thanks in advance.


RE: Maximal size for a compiled program - boriel - 07-06-2020

Not yet, sorry. I'm working on 128K memory pagination to see how can I get easy access to that memory, but it's not that easy for a compiled program Sad