I know basic and need the 'MID', 'LEFT', 'RIGHT' and 'LEN'How to do the same in spin?
seconika
Posts: 18
Hi,
Im a Basic stamp, VB, and all the other basic dialect person.
I got a Propeller board some weeks ago and now I'm trying to learn the SPIN programing.
Can anyone help me find help how to do the same in SPIN as the LEN, MID, LEFT, RIGHT command in standard basic.
I would like to read the second and sometime the first "Letter", "Data" in a string that holds the HEX data from a PS2 controller.
Regards,
Niklas
Im a Basic stamp, VB, and all the other basic dialect person.
I got a Propeller board some weeks ago and now I'm trying to learn the SPIN programing.
Can anyone help me find help how to do the same in SPIN as the LEN, MID, LEFT, RIGHT command in standard basic.
I would like to read the second and sometime the first "Letter", "Data" in a string that holds the HEX data from a PS2 controller.
Regards,
Niklas
Comments
Take a look at PropBasic.Its about as close as you can get to basic with the propeller.
Its different then what your use to but its Ballistic in speed.
http://www.fnarfbargle.com/bst/Latest/
http://www.fnarfbargle.com/PropBasic/
'
Heres a link to the post to help get started
'
http://forums.parallax.com/showthread.php?107051-Mac-Linux-Windows-IDE-Ver-0.19.3-quot-Now-with-new-improved-PropBasic-quot-release
a := LEFT$(b, size)
would be
BYTEMOVE(@a, @b, size)
BYTE[ @a+size ]~
and
a := RIGHT$(b, size)
would be
BYTEMOVE( @a, @b+STRSIZE( @b )-size, size+1)
a := MID$(b, theStart, theEnd)
would be
BYTEMOVE( @a, @b+theStart-1, theEnd-theStart+1 )
BYTE[ @a+theEnd-theStart+1 ]~
I'm assuming that theStart and theEnd begin at 1.
I have some code that does the functions you want - I'll see if I can find it when I get home.
Your byte sizes may vary, but this works for me.
OBC
At the beginning of your 'main' code, reserve some memory for string space
This is some of the code I used to test out these functions
Attached is Kye's string engine with the above Left Mid added at the end.
This really is, a amazing forum!
I will mark this as "Solved".
Best regards.
Niklas