PDA

View Full Version : Need little help in Spin coding

Sapieha
09-16-2007, 01:22 AM
Hi All
·
Help my.
·
I portar my C code to Propeler spin and can’t convert it to Spin.
·
while(*the_string !="\0")
·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

deSilva
09-16-2007, 01:44 AM
Not too obvious..
And I assume you mean '\0' rather than "\0"...

REPEAT WHILE BYTE[the_string]

or

REPEAT WHILE BYTE[the_string]<> 0

or

REPEAT UNTL BYTE[the_string] == 0

"the_string" is a pointer; don't forget to increment it (++)

Sapieha
09-16-2007, 02:07 AM
Hi deSilva
Thanks

It is corect ????

repeat i from i to i < yme|i++
' for (i=0|i < yme|i++) ' // 10 bytes per char 15
'{ //
j := x
repeat j from j to j < (x + xme)|j++
'for (j=x|j < (x + xme)|j++)
'{ //
z := y + i
' //
'{ //
LCD_PixelPut (j,z,fcolor)
'} ' //
if not (@Data & Mask) ' else
'{ //
LCD_PixelPut (j,z,bcolor)
'} ' //
'} //
Data++
x+=xme
the_string++
'}

REPEAT WHILE BYTE[@the_string] == 0 ' //· while(@the_string !="\0") keep spitting chars until end
' //
SendLcd(LCDCommand,nNOP) '· //· Recomended to send now and then

Prppeller Tools compile it ! but I still not run it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Post Edited (Sapieha) : 9/15/2007 7:21:32 PM GMT

deSilva
09-16-2007, 02:33 AM
Sapieha said...
Hi deSilva
Thanks

It is corect ????

Sorry, no - most of it is simply poppycock.

repeat i from i to i < yme|i++ ' for (i=0|i < yme|i++) ' // 10 bytes per char 15

C has no nice for loops; SPIN has - please look into the manual
correct would be: REPEAT i FROM 0 TO yme-1

j := x
repeat j from j to j < (x + xme)|j++ 'for (j=x|j < (x + xme)|j++)

correct would be: REPEAT j FROM x TO x+yme-1

What do you want to say with "@Data" ???

if not (@Data & Mask) ' else

Use ELSE by all means

REPEAT WHILE BYTE[@the_string] == 0 ' // while(@the_string !="\0") keep spitting chars until end

This makes hardly any sense! Where is "the_string" incremented? You must use a pointer, to be de-referenced by BYTE[..]

Sapieha
09-16-2007, 02:46 AM
Hi deSilva

Sorry I have not manual till Propeller spin Programing.
It is my first attemp to port my C code to spin.

I only learn mig from code on forum and I know att it looks bad.

Ps. Has not problem understand ASM coding but in ·spin I have little problem

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Post Edited (Sapieha) : 9/15/2007 7:56:16 PM GMT

deSilva
09-16-2007, 03:06 AM
Sapieha said...
Sorry I have not manual till Propeller spin Programing.

Propeller IDE -> Help -> Propeller Manual
Chapter 3 is extraordinary good!

Sapieha
09-16-2007, 03:08 AM
Hi deSilva

What do you want to say with "@Data" ???

It is Variable to hold temporary address to pixel table on every character

Where is "the_string" incremented?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Sapieha
09-16-2007, 03:27 AM
Hi deSilva

If I use else Propeler tools talking it

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

deSilva
09-16-2007, 03:28 AM
Sapieha said...
>>What do you want to say with "@Data" ???
> It is Variable to hold temporary address to pixel table on every character

Maybe, but "@" makes no sense at all..

said...
>>Where is "the_string" incremented?

This also makes no sense - it has do be done inside the repeat-loop.

Please post your code again; when you sorround it by "[ code ]" and "[ /code]" it will also look nice.

Sapieha
09-16-2007, 03:46 AM
Hi deSilva

Thanks for help.
It is entire code of my PUB routin.

Look on picture

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Sapieha
09-16-2007, 03:53 AM
Ps. I most programing in ASM on IBM PC next language is C.
Need little time to think Spin

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Post Edited (Sapieha) : 9/15/2007 8:58:03 PM GMT

deSilva
09-16-2007, 04:07 AM

Sapieha
09-16-2007, 04:17 AM
Hi deSilva

I think about it but for it I most understand Spin programing.
And it take up little time

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Sapieha
09-16-2007, 04:24 AM
Ps. I most find similar program on forum for study it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha

Sapieha
09-16-2007, 06:12 AM
Hi deSilva

Look on attach code and give my acceptable solution if You wish.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sapieha