Need another pair of eyes on passing parameters...
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
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
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