Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:03 10 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMiteVGA: out of memory problem

Author Message
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 02:42pm 09 Jul 2025
Copy link to clipboard 
Print this post

Hello,

working on my gui editor I encountered the problem that I ran out of memory.

Do I interpret the manual wrong?!

Manual Page: 83
PicoMiteVGA RP2350 184Kb

My program size is: 132 KB (135.168 Bytes)

It runs on resolution 640, 720 but not on 848 & 800

there is a "trick" I can get it to work:

set the resolution to 640, then:

load "gui_editor_b23c"


load it in the flash and then change the resolution to 848 and press F2.. this will work... hm...

Here is my file:
gui_editor_b23c.zip

Greetings
Daniel
 
Peter63
Regular Member

Joined: 28/07/2017
Location: Sweden
Posts: 59
Posted: 04:23pm 09 Jul 2025
Copy link to clipboard 
Print this post

print mm.info(heap), is only 137984 using 848

/peter63
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10226
Posted: 04:37pm 09 Jul 2025
Copy link to clipboard 
Print this post

What you are seeing is correct. You can only load a program as big as the heap available as the heap is used to buffer the ascii program ready for tokenising and 848 and 800 modes pinch heap for the framebuffer.

if(Option.CPU_Speed==Freq848){ //adjust the size of the heap
   framebuffersize=424*240*2;
   heap_memory_size=HEAP_MEMORY_SIZE-framebuffersize+320*240*2;
   FRAMEBUFFER=AllMemory+heap_memory_size+256;
   MODE1SIZE=MODE1SIZE_8;
   MODE2SIZE=MODE2SIZE_8;
   MODE2SIZE=MODE2SIZE_8;
   MODE2SIZE=MODE2SIZE_8;
   MODE2SIZE=MODE2SIZE_8;
   HRes=848;
}
if(Option.CPU_Speed==FreqSVGA){ //adjust the size of the heap
   framebuffersize=400*300*2;
   heap_memory_size=HEAP_MEMORY_SIZE-framebuffersize+320*240*2;
   FRAMEBUFFER=AllMemory+heap_memory_size+256;
   MODE1SIZE=MODE1SIZE_V;
   MODE2SIZE=MODE2SIZE_V;
   MODE3SIZE=MODE3SIZE_V;
   MODE5SIZE=MODE5SIZE_V;
   HRes=800;
   VRes=600;
}


By loading in a "standard" mode you have the normal VGA heap available (184Kb) so you can load/edit and save the program. Assuming the running program then doesn't exceed the reduced heap when you switch mode all is OK. I'm afraid you will have to live with your "trick" if you want to run in 800 or 848 modes.
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 05:20pm 09 Jul 2025
Copy link to clipboard 
Print this post

Peter,

thank you for this good explanation, I didn't knew that! Ok, then I have to do some "shrinking" and code optimization. I have already ideas, the most space is taken by the PRINT (save) routine of the final GUI, If I can outsource this to a second *.bas file but preserve the variables, I could solve the problem   I don't know how to do this right now, but I am sure I find a way for this  

EDIT: Isn't the Library function exactly for that purpose? I could put all my "save routine" into the library. Good time to look further into the manual! But I have a "feeling" that this could be a solution.
Greetings
Daniel
Edited 2025-07-10 03:42 by Amnesie
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 625
Posted: 05:59pm 09 Jul 2025
Copy link to clipboard 
Print this post

What the?

How cool is that? I thought.. well this will be complicated with all those Library stuff, but I tried it a few minutes ago and it works. What a wonderful feature!

I excluded what takes the most space, and this is the save routine the whole sub in the library and now everything works.



MMBASIC is full of features! This was the first time I used the Library.
But not only this, I think this GUI editor wouldn't be possible with the features:

Option Escape and OPTION CONTINUATION LINES as well.


Greetings
Daniel
Edited 2025-07-10 04:17 by Amnesie
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025