View Full Version : Does anyone have a spin absolutes document?

10-14-2011, 07:31 PM
I'm looking to compile a document with absolutes about spin, for example, methods only return longs.

Does anyone have a list of absolutes like that for spin?

10-15-2011, 12:24 AM
Not a list, but the specs and absolutes are all in the manual.

Mike G
10-15-2011, 12:33 AM
Parallax Propeller Manual?

10-15-2011, 02:24 AM
Your qestion, Does anyone have a spin absolutes document? I think the info you are looking for would be in the Parallax Propeller Manual.

10-15-2011, 04:33 AM
I've read the manual, does it say in the manual that methods always return longs? I do not remember reading that and was hoping to compile a cliff notes version of the absolutes.

Phil Pilgrim (PhiPi)
10-15-2011, 04:44 AM
I suppose you could say the return type is defined by default. IOW, there simply isn't a mechanism in the language to return anything but a long.


10-15-2011, 05:19 AM
I've read the manual, does it say in the manual that methods always return longs? ...
Depends on what you mean with longs. A methode returns a 32bit value, because the Propeller is a 32bit processor. This value is typeless, so how this 32 bits are interpreted depends on the function of the methode and the destinaton variable. This can be a byte, a word, a long, a pointer to a string, a float value or something else.
I.E: mybyte := serial.rx
returns the serially received byte. The byte is passed in the the lower 8 bits of a 32bit return value, but only this 8 lower bits gets written to the mybyte variable, so it does not really matter that there is a 32bit value in between.

Phil Pilgrim (PhiPi)
10-15-2011, 05:43 AM
Ariba stated it well. In addition, all expressions and operations are computed with signed 32-bit math. A method call is just a special instance of an expression element. It's only when the result of an expression gets assigned to a shorter variable that a conversion is made to a different type. And that's done by chopping off the top 16 bits (for words) or 24 bits (for bytes).


10-16-2011, 02:29 AM
Thanks everyone, that was a good explanation and makes sense now that it has been phrased that way.

Are there other things similar to that, that would be helpful in committing to memory?

10-16-2011, 02:43 AM
True = -1

(it appears that message was too short)