Shop OBEX P1 Docs P2 Docs Learn Events
Need another pair of eyes on passing parameters... — Parallax Forums

Need another pair of eyes on passing parameters...

SteelSteel Posts: 313
edited 2010-09-08 21:00 in Propeller 1
I hate to ask this, but my brain is really starting to hurt and Im confusing myself...Could somebody help me figure out what number I am sending, and how I can send the right number?

I have a variable "X" in my main spin code. I have a second object. I want to pass the address of this variable to the second object. The second object opens up code in PASM. In this PASM code, I want to be able to read/write to this variable in my main code.

It is hurting my brain. Could somebody tell me where I went wrong with the "@"s and the "#"s?

Object_1
     VAR 
       Byte X
     PUB Main
         Object2.Main(@X)
Object 2
   PUB Main(MemoryPointer)
         cognew(@entry,MemoryPointer)

DAT

Entry
        mov Pointer, PAR
        rdlong  A, Pointer


     Pointer  res  1
     A          res  1

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-09-08 21:00
    What exactly is the problem, i.e. why do you think it might be wrong?

    1. You are reading a long from a byte variable.
    2. As it's a byte it may not be long aligned and par will reflect the wrong location.
    3. Your PASM code will show undefined behaviour unless you stop processing somehow, or loop etc.

    Apart from that the address passing is fine :)
Sign In or Register to comment.