PDA

View Full Version : Best practice for parameter passing between SPIN objects?



potatohead
11-03-2006, 01:43 AM
Greets all,

I'm working with my prop, writing small objects with SPIN and some assembly. I'm at the point where I want to pass parameters back and forth and see ways to do it, but am wondering about the best way in general.

Actually what I would like to do is modify the graphics.spin object to include a readpixel method and I don't want to just hack something in.

Suggestions pointers to where this has been covered?

Mike Green
11-03-2006, 02:01 AM
There really are not good guidelines for this yet. Best thing is to look at existing methods that do something like what you want, then modify them for your purposes. In this case, you would probably write the routine in SPIN because there's not much advantage in writing it in assembler (for just reading one pixel). You'd pass x and y as parameters, compute the location in the bitmap of the point, and extract it (the two bit color code). Your routine would return the color code as its value.

Beau Schwabe
11-03-2006, 02:38 AM
potatohead (http://forums.parallax.com/member.php?u=47292)·Doug,

See this link... http://forums.parallax.com/showthread.php?p=608996
This is for the VGA, but the main 'dispatcher core' was copied from the graphics.spin object that
you mention.· The main modification that I made to the 'core' allows for data to be passed back
into Spin by preserving the Address value before it gets re-written.· There is also a 'point' command
for the VGA graphics set that allows you to read a pixel on the screen.






▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 11/2/2006 7:40:56 PM GMT

potatohead
11-03-2006, 03:18 AM
Thanks!

Oh, my real name is Doug Dingus actually. I use potatohead in a lot of places. (Another story another time....)

That looks like it's gonna advance my learning a lot. I'll check it out.

Appreciated!

Edit: Saw the change Beau! Funny.... I don't mind either moniker.

Post Edited (potatohead) : 11/2/2006 7:42:48 PM GMT