I wrote this instead of a 'case select' block, to speed up execution.
These labels will also be called at other points in the code, from 'on goto' lines identical to the one above.
I was expecting that having completed the code in, for instance, label cL1, it would return focus to the for/next loop, but of course it just continues down the page to cL2, etc; which defeats the object of using 'on goto.' I tried putting a 'return' line at the end of each label's code, but I get a 'stack underflow' message.
As the 'on goto' command also occurs at other points in the code, (at which point I only want it to execute 1 line) I don't want to give it a label to return to.
How do I get this to return to whatever line is just after the specific 'on goto' line that called it?
Code:
For b5 = 1 to 8
on b5 goto cL0, cL1, cL2, cL3, cL4, cL5, cL6, cL7, cL8 'cL0 is dummy
next b5
b5 = 0 'reset b5 for use in main
cL0:
cL1: w1 = $0100 : gosub sendToLedsW1
cL2: w1 = $0200 : gosub sendToLedsW1
cL3: w1 = $0300 : gosub sendToLedsW1
cL4: w1 = $0400 : gosub sendToLedsW1
cL5: w1 = $0500 : gosub sendToLedsW1
cL6: w1 = $0600 : gosub sendToLedsW1
cL7: w1 = $0700 : gosub sendToLedsW1
cL8: w1 = $0800 : gosub sendToLedsW1
sendToLedsW1: return
I was expecting that having completed the code in, for instance, label cL1, it would return focus to the for/next loop, but of course it just continues down the page to cL2, etc; which defeats the object of using 'on goto.' I tried putting a 'return' line at the end of each label's code, but I get a 'stack underflow' message.
As the 'on goto' command also occurs at other points in the code, (at which point I only want it to execute 1 line) I don't want to give it a label to return to.
How do I get this to return to whatever line is just after the specific 'on goto' line that called it?