Execute Code in String
If I have a string containing a chunk of code, is it possible to tell the Propeller to execute the string? I'm sure that this would be impossible if the string contained SPIN, as the Prop itelf cannot compile SPIN to bytecode. However, if it was ASM, I think this would possible. Any Ideas? Do I have to wait for the PropII?
Thank,
Craig
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen
I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.
"Failure is not an option -- it comes bundled with Windows."
Use The Best...
Linux for Servers
Mac for Graphics
Palm for Mobility
Windows for Solitaire
Thank,
Craig
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen
I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.
"Failure is not an option -- it comes bundled with Windows."
Use The Best...
Linux for Servers
Mac for Graphics
Palm for Mobility
Windows for Solitaire
Comments
So the answer is Yes, it is possible but hard to do.
It's easier to use some kind of preprocessor on the computer to translate the string into bytes, words or longs.
But maybe you can't use such thing...
if you already have the longvalues of the ASM-commands you could store them into COG-RAM, set the target-value of a jump-command to that adress and then
the cog is executing this code
But i would like to ask one of my favorite questions: i'm curious about the backround why you want to do so.
Maybe there is an alternative solution to the REAL problem
best regards
Stefan
The Prop II won't initially have any kind of on-chip development system.
There are several FORTH systems available for on-chip Propeller development. None of them are actively supported, but they're far enough along to be quite useful and FORTH does include an assembler. There's also FemtoBasic in various versions which can be used much as you describe. You simply hand a string to a routine that replaces keywords with special codes, then hand that processed string to the interpreter to execute.
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 5/26/2008 8:29:36 PM GMT
The OS will also have an interpreter for a Python-like language (called Cobra), but I wanted to give the option to run Prop native commands. So, the Cobra interpreter could be interpreting/running a Cobra file, but then immediately switch to running a few Spin or ASM commands and then back to Cobra. This should function something like the ASM command in SX-B.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen
I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.
"Failure is not an option -- it comes bundled with Windows."
Use The Best...
Linux for Servers
Mac for Graphics
Palm for Mobility
Windows for Solitaire