Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Maximal size for a compiled program
#1
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.
Reply
#2
(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
Reply
#3
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.
Reply
#4
Shocked 
[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
Reply
#5
(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.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#6
I have my own compress method, but mb can find another. I'd tried to reverse direction with procedure but lost FPS.
Reply
#7
(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.
Reply
#8
I'd tried. But got same shit.
Now, I've rebuilded data structures and tomorrow would continue programming. Will see.
Reply
#9
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....-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...ta1.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.9.8-beta1.zip
Reply
#10
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.
Reply
#11
Tongue 
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]
Reply
#12
(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
Reply
#13
Reworked data structures + heap 256b
Reply
#14
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.
Reply
#15
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)