I'm trying for hours to access main memory and become more and more confused.
I try to access the main memory like shown in the following code:
test mov :addr, #mainmem
movd :addr, #mainmem >> 9
rdlong :data, :addr
:addr res 1
:data res 1
This kind of code sometimes works, sometimes not. It depends on the position of the instructions. So I think I'm accessing memory, but not the one I want. I guess I overwrite some instructions.
Now I figured out that the addresses of #mainmem does not make much sense.
I declared the #mainmem as follows:
' … more cogs started …
DAT mainmem long 0 ' For testing
DAT other long 0 ' For testing
Looking at the addresses now tells me, that #mainmem is 0x00000000 and #other is 0x00000001.
Why is the distance between the two longs only 1?
And why starts the address as 0?
Is this the right way to declare "global" variables? In spin I've to use VAR, but then the symbols are not available to the assembler.
ps.: I use OpenSpin as assembler