Thanks Greg,
in fact I am already using a method very similar to this one, but more elaborate, which allows to:
- Execute step by step, highlight blocks and even to stop execution at any time.
- Make the "wait seconds" blocks work and be able to stop them in the middle without having to wait for them to expire if they are very long (and it was difficult).
- Execute also step by step, showing the block being executed and the values of the variables at each step.
- Achieve decent execution speeds (about 10,000 instructions per second), and at the same time be able to stop at any time, to be able to control motors and PIDs in real time, almost with the same convenience and speed as our other automation applications.
What's still missing is the ability to start execution from a block of your choice (probably based on the block ID)
And also the ability to interrupt the execution without reinitializing the interpreter as I am doing.
And have the ID of the block (or maybe the micro-instruction) that was last executed in order to be able to save it to a stack.
It is true that the myInterpreter.step() function saves the return address but does so internally and does not provide it.
And also this function cannot restart from that point after executing another function because to execute other code you always use myInterpreter.step() and then that address is lost.
In other words, myInterpreter.step() can only stop and restart where it left off, it cannot perform any other functions and thus "go back" to where it left off.
I really think I'll have to replace this feature with a more elaborate one.
It will take me ten times longer than Neil because I will have to learn a lot but in the end I will succeed.
Thanks again very much for your attention, your suggestions are of great help to me.