![]() |
Forum Index : Microcontroller and PC projects : PicoMiteVGA: out of memory problem
Author | Message | ||||
Amnesie Guru ![]() Joined: 30/06/2020 Location: GermanyPosts: 625 |
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: SwedenPosts: 59 |
print mm.info(heap), is only 137984 using 848 /peter63 |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10226 |
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: GermanyPosts: 625 |
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 ![]() ![]() 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: GermanyPosts: 625 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |