Assembly Conditions and Error
bpiper
Posts: 3
The conditional statements for this code have not worked, and I have been getting an error: "Expected a constant, unary operator, or "("." on the line "mov clicks,ina". Is there a specific set up I must do to code this in assembly?
Comments
I'll also note that you can't access Spin variables declared in the VAR block from PASM code (at least not directly by name).
To acces Spin variables from PASM, your Spin code need to pass the cog pointers to the variables, which it can then access with rdlong/wrlong/etc. The easiest way to do this is by defining LONGs at the bottom of your DAT block and having the Spin code set those longs to pointers to variables before starting the PASM cog. You can also use the PAR register discussed in the Propeller manual, but I've generally found that to be more trouble than just poking pointers into the cog image before loading it.
Like a rube, I've been using PAR all these years.
Clearly I've been missing the meetings where cool things are discussed.
I've used both approaches but you might get into trouble poking values into the image if you're going to load more than one COG with the same image consecutively because the first COG may not have finished booting before you start patching the image for the second COG.
Just have the cog set a flag passed through PAR to tell you it's done booting. Make the flag one of the values you poked parameters into to save a long.
I've never really needed to start the same cog image with different parameters multiple times. The only homogeneous parallel Propeller program I've ever written, a PASM Mandelbrot set renderer, starts all worker cogs with the same parameters, and they then use a lock to arbitrate the allocation of 16-pixel columns among themselves.
I've also done that for large Spin programs that loaded cog images off of an SD card to save space.