[SOLVED] How to pass address of string to another cog
Mark Swann
Posts: 124
I thought I knew how to do this.
I am simply trying to pass the address of a string, as returned by STRING(), to an assembly language routine in a separate·cog.
The cog routine should be getting a series of characters to display, but is getting garbage.
The following SPIN routine·is called with something like "Graphics.plotText(x,3,0, color, string(" Testing"))", and is attempting to pass the address of the string (named _str) to the cog routine by storing it in a variable named parm3. The cog routine·will retrieve the contents of parm3, along with parm1 and parm2. I can tell that the cog routine is clearly getting parm1 and parm2, but not parm3, or maybe it is getting parm3 but I am not passing the string address properly.
I cannot see what I am doing wrong. Any suggestions?
Mark
Post Edited (Mark Swann) : 8/29/2008 2:57:41 AM GMT
I am simply trying to pass the address of a string, as returned by STRING(), to an assembly language routine in a separate·cog.
The cog routine should be getting a series of characters to display, but is getting garbage.
The following SPIN routine·is called with something like "Graphics.plotText(x,3,0, color, string(" Testing"))", and is attempting to pass the address of the string (named _str) to the cog routine by storing it in a variable named parm3. The cog routine·will retrieve the contents of parm3, along with parm1 and parm2. I can tell that the cog routine is clearly getting parm1 and parm2, but not parm3, or maybe it is getting parm3 but I am not passing the string address properly.
PUB plotText(_xC, _yC, _font, _color, _str) | t, x, y '' Plot a string of characters into the video memory. '' '' _xC - Text column (0-11 for 8x8 font, 0-15 for 5x7 font) '' _yC - Text row (0-7 for 8x8 and 5x7 font) '' _font - The font, if 1 then 8x8, else 5x7 '' _color - 8-bit color value (RRRGGGBB) '' _str - String of characters '' SetFont(_font) SetColor(_color) repeat while command parm1 := _xC parm2 := _yC parm3 := _str command := cmdPlotText
I cannot see what I am doing wrong. Any suggestions?
Mark
Post Edited (Mark Swann) : 8/29/2008 2:57:41 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
Thanks for responding.
Mark
I'm embarrased to admit that, in my assembly code, I did not "de-reference" the pointer to parm3 in main memory. I used the address of parm3 as tha data to display. Silly me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.