Count My SPIN
Humanoido
Posts: 5,770
How to make a tiny spin program (at the top of the code) count the number of spin instructions automatically between two points in the middle of the code?
Comments
1) Put some "special" markers at the beginning and end of the Spin code sequence you want to measure the length of.
2) Then put a loop at the top of your Spin that searches all of HUB RAM for those special markers.
3) Take the difference between the found addresses of the markers and you have your Spin byte code sequence length.
No time to make a working example for you but here is how the markers might look:
When compiled this looks like:
In the BST listing. You can see how those "marker" vlues are siting the code waiting to be found.
Of course this might fail if your code uses the marker values as well.
No, I did not put five starts on this thread. I don't consider my byte code counting technique that clever.
I doubt anyone else has voted on this thread yet either.
There is a bug in the star rating system that apparently is known about and will be fixed at some point. See the support forum.
That's what my sugestion does, it finds the tokens and counts them.
However, if you want to count actual instructions (spin or pasm) used, you can use my zero-footprint debugger. It does not have breakpoints but it does count both.