Storing an array of longs in main memory
csae8126
Posts: 14
in Propeller 1
Hello,
Im quite new to Propeller, so please excuse my stupid question:
How can i store a array of 48 longs in main memory? I want to calculate some values in Spin, afterwards the should be red in a assembly function.
Thanks for any help!
Im quite new to Propeller, so please excuse my stupid question:
How can i store a array of 48 longs in main memory? I want to calculate some values in Spin, afterwards the should be red in a assembly function.
Thanks for any help!
Comments
-Phil
Short answer is yes.
All of your code data and variables you define in your source will end up in hub memory after loading or starting your program.
The difference is that in DAT you can define a initial value at startup (like for strings or PASM code or predefined 'vars') and in VAR blocks you just define a later on used memory location, but the initial value will be 0 at load/start time.
VARs take less space in the saved binary on the disk file. (Not so really impotent nowadays)
After your main program is loaded into HUB memory often the main program code will start other COGS with code out of some DAT Sections (even of SUB-Objects)
It will copy the code from the HUB DAT Section into the COG Memory and start the COG.
At that time the COG is running with his own copy of the code in the DAT Section in HUB Ram.
And the original code in the DAT Section is mostly not needed until reboot, so often re-used as Buffer or something else. Usually COGs get loaded at Program start and again at reboot so the valuable HUB Memory space can (and often is by Objects) be reused...
much fun with the propeller.
Mike
I think i got it now, and after watching the memory contents in gear for a while i see how it works.
So, for example, if I create a thermometer object, and internally it maintains a "temperature" VAR value, that value would be unique to each thermometer object I create. If I created a "FarenheitOrCelsius" value in the DAT section, it would apply to all instances of the thermometer object.
Welcome to the forums!