Shop OBEX P1 Docs P2 Docs Learn Events
Best practice for parameter passing between SPIN objects? — Parallax Forums

Best practice for parameter passing between SPIN objects?

potatoheadpotatohead Posts: 10,260
edited 2006-11-02 19:18 in Propeller 1
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?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-11-02 18:01
    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 SchwabeBeau Schwabe Posts: 6,559
    edited 2006-11-02 18:38
    potatohead·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

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 11/2/2006 7:40:56 PM GMT
  • potatoheadpotatohead Posts: 10,260
    edited 2006-11-02 19:18
    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
Sign In or Register to comment.