And if you want to print out the size of the cog program at run time you could do something like this: ...
That includes the long taken up by cog_size (after applying Duane's correction). In my example above, only the actual code is measured. end is just a hub variable in that case.
The "@" notation refers only to hub addresses. res variables do not exist in the hub. In my example, the computation is done on cog addresses, which include the res variables.
Don't you need a "long" between "cog_size" and "last_label"?
Yes the existing Spin compilers require a "long". My example was based on a hypothetical compiler that understands what I meant to write instead of what I wrote.
Hello Phil, I cannot get this to work. I am seeing an unchanging value of "-2134281013" printed to the pst. My code is commented everywhere and a mess, but if you'd like I will post the entire object. Otherwise I have included a trimmed version with what I believe is the pertinent information below.
Is this psuedocode or actual code?
Here is what I have
DAT
org 0
camsim
[i][lots and lots of pasm code here][/i]
end
wrlong exit, pstPtr15
jmp #restart
[i][lots and lots of pasm variables here][/i]
fit 492
exit long exit-camsim
I know my code is mediocre at best, so I'm just going to generally apologize for it ahead of time. In the pasm section, the camsim is at the beginning, the end/wrlong is at line 1408 and the fit/exit portion is at line 1700
Also, am I taking up needless space below with cog ram for rpmPtr (for example) since it is commented out. Is the long it used to occupy used or is that static and the more 'dynamic' cog ram occurring after the static/par related variables?
pinPtr long 84
pinAddrPtr long 88
'rpmPtr long 92
rpmAddrPtr long 96
'rotationalRatioPtr long 100
rotationalRatioAddrPtr long 104
And that is why I didn't want to post all of the code, it's too overwhelming
Comments
Don't you need a "long" between "cog_size" and "last_label"?
-Phil
-Phil
Is this psuedocode or actual code?
Here is what I have
-Phil
I know my code is mediocre at best, so I'm just going to generally apologize for it ahead of time. In the pasm section, the camsim is at the beginning, the end/wrlong is at line 1408 and the fit/exit portion is at line 1700
Also, am I taking up needless space below with cog ram for rpmPtr (for example) since it is commented out. Is the long it used to occupy used or is that static and the more 'dynamic' cog ram occurring after the static/par related variables?
And that is why I didn't want to post all of the code, it's too overwhelming