My memory is full !!
BTX
Posts: 674
Hi all.
I'm in a development process of application, and I've a problem.
Since I'll use a lot of objects, I need to declare them in the OBJ section, then in the main program, I'll call only one at a time.
But some of this objects declare some variables each as: obj1_some_var1[noparse][[/noparse]32_000]; obj2_some_var2[noparse][[/noparse]32_000]; obj3_some_var3[noparse][[/noparse]32_000].
So memory is not enough for all of them.
Question:
Is there anyway, to declare that 'vectors', into the main program, selecting only one of them with a "case" or similar. ??
Hope you understand my question... it is like a 'VAR' declare, on the fly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
I'm in a development process of application, and I've a problem.
Since I'll use a lot of objects, I need to declare them in the OBJ section, then in the main program, I'll call only one at a time.
But some of this objects declare some variables each as: obj1_some_var1[noparse][[/noparse]32_000]; obj2_some_var2[noparse][[/noparse]32_000]; obj3_some_var3[noparse][[/noparse]32_000].
So memory is not enough for all of them.
Question:
Is there anyway, to declare that 'vectors', into the main program, selecting only one of them with a "case" or similar. ??
Hope you understand my question... it is like a 'VAR' declare, on the fly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
Comments
Why redeclare your Var's on the fly? There is a physical limit to what you can have stored, either you lower your data,or ... ? if you were to redeclare your var data you wipe out your old data, so why not use the same 32_000 data block again instead of redeclaring it. I think this is how your describe your goal.
What you may need to do would be increase your ram, if you were to add additional ram to your project, you could have a working block of 32000, data points in the Prop Ram. Then when you are done with them shift them out to your external ram. and shift new data into the 32_000 piece declared block in the prop. Pretty tricky to pull off in the end.
I guess to really help you, I think we need know more about how/what you are trying to place with 32_000 data points, even as bytes you will have trouble loading that into a cog, exceeding the 2k limit.
Just to confirm you are exceeding the ram limit in your variable for data points? Not in the cognew/ Coginit stack you are allocating for your new cogs? You might be allocating to much space for your new cogs, and this might allow you to free up some ram.
Hope this helps,
TJ
use this at the beginning of the object
varPtrLong1 = @stack
varPtrLong2 = @stack+4
varPtrLongArray [noparse][[/noparse] 2 ] = @stack+8,@stack+12, 'give it room for 2 longs
varPtrByte1 = @stack+16
varPtrByte2 = @stack+17
varPtrByte3 = @stack+18
varPtrByte4 = @stack+19
then use the following in your code
LONG[noparse][[/noparse]varPtrLong1]
BYTE[noparse][[/noparse]varPtrByte2]
LONG[noparse][[/noparse]varPtrLongArray [noparse][[/noparse] 2 ] ]
I'll try to do a more simple example.
First of all, I can't use an external RAM, so I need to do all with the pchip. (That's a limitation for my design).
Suppose I've the following:
Here clearly, is too much space reserved for variables, so it is not possible.
But in my speacial case, I will choose for use either vga, OR vag2, not both at the same time, although they will should be have a different space for variables, so it is not possible for me to use the same "pixels" variable for both cases. (obviously, in that case, I could use the same 'pixels' vector for both, without any problem).
So I need something that let's me to choose wich "VAR block to use" depending if an external jumper is attached to some pin or not.
In that case: something like this "BAD" code.
Hope it is more clear now, take care, that it is NOT my real code, neither what I want to do, but it is the "same" example problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
One simple solution would be to do what Jimmy suggested using a enlarged stack and change the multiplier for what you are reading out it.
Are you using a Proto Bord or just a raw prop chip? Depending on the life of product you could store the 2nd set of "Tiles" to the Upper 32k of the eprom and load back and forth there is a limited number of read writes... and some speed penalty, but with some slick coding you could be constantly loading and unloading 4-6 sets of tiles so that when the 1st is unloaded two more would be in the process of unloading, and per say the pixels 2 would be loaded.
Honestly the simplest would be to break it into smaller stacks, compute 1/2 the screen then dump, then back again.
If your pin would only be changed on start up and you want to make your code use a different set of data based on your jumper, maybe this just rename it.
So you would just be placing the location of your data stack, into the pixels var.
Then to access it
If you are reading from one cog to another be aware to use the @@ to get the true address not just the internal cog address.
You both give me some ideas about how to do it... I'll have many days of programming in front of me, so I will try your suggests, se what happend, and then I'll return to this thread.
Thanks again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
Alberto, try to use a pointer (defined as constant) and the ptr[noparse][[/noparse]idx] notation and for all of them to reside in the same place (or a variable). But they told you that .
Saludos
But now I'm stoped again.
I'm playing with the VGA_HiRes_Text driver, in the beggining of the code you can comment or uncomment some constants to change the final resolutions.
I need to use the three posibilities, (1024x768),(800x600),(640x480), but I've no room to use three of this objects in my code.
So, is there any way to choose differents 'CON values' from an external object ??? (like a auto comment-uncomment )
Thanks in advance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
Instead of constants, set up a variable that·replaces the constant and change it when needed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
@Ken.
Iti is exactly what I'm trying to do... but when I replace the constants with variables I get a lots of errors in the code....
That code seems to be very well adapted for use the constants...I'm fried my brain.
Remember that Chip wrote that code, such a programming guy !!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.