Program Counter with Spin
CassLan
Posts: 586
Hello,
Is there a way to provide a label or memory address to have the program jump too with spin?
I'd like to provide such a label or address in a DAT block then stored in a·variable. I'm gettig the feeling this is easily attainable in asm but I'd like to stick with spin for this if its possible.
I guess I'm looking for a GOTO <variable> command, does one exist?
Or could I use _label and JMP right in my spin code?
Thanks,
Rick
Post Edited (CassLan) : 3/6/2009 1:40:18 AM GMT
Is there a way to provide a label or memory address to have the program jump too with spin?
I'd like to provide such a label or address in a DAT block then stored in a·variable. I'm gettig the feeling this is easily attainable in asm but I'd like to stick with spin for this if its possible.
I guess I'm looking for a GOTO <variable> command, does one exist?
Or could I use _label and JMP right in my spin code?
Thanks,
Rick
Post Edited (CassLan) : 3/6/2009 1:40:18 AM GMT
Comments
If you want to provide some kind of action table, you could use a CASE statement and store the indices for the CASE statement in your DAT block.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
Thanks,
Rick
Does that make you a Luddite? Seriously, the whole discussion of GOTOs vs. no GOTOs was talked to death many many years ago. There are major advantages in code clarity in avoiding or at least minimizing the use of explicit GOTOs (as opposed to the implicit ones that are used to construct the various control structures like IF/THEN, REPEAT, CASE, etc.). A friend challenged me once to write a multi-tasking operating system without GOTOs. It wasn't as difficult as I thought and the discipline forced me to code much better than I might have otherwise.
After that you let the old cog stop. Of course your local variables will be lost, but you don't have to use local variables, do you?
Would be an expensive goto in terms of runtime ... but should be possible.·