Jeremy Leach
Senior Member
This is just an idea about the Simulator and how it displays the variables ...
As the code is stepped through, could the simulator keep track of the current name that's assigned to the variable?
For instance, sometimes - because there aren't enough underlying variables - a variable such as b0 is used for different reasons, with multiple symbols pointing to it. Say we had symbols 'Brightness' and 'Speed' both assigned to b0. When the code gets to something like 'Brightness = 6' or 'Peek address, Brightness', it knows that the current meaning of b0 is 'Brightness' - so the Sim could display 'Brightness (b0)' in the variable dialog.
In theory the Sim could also be a bit clever here - if for instance the current meaning of b0 was 'Brightness' and then the code said 'Let X = 5 * Speed' the Sim could flag an error (warning) saying that 'Speed' isn't one of the currently used symbol names.
In the Sim it would just be a case of holding a running table of currently used symbol names. A current 'context' is perhaps the way to describe it.
One issue is that this 'context' would only work sequentially - and so if you start the Sim at a random point in the code then it would have to start from not knowing the context - but as long as that's made clear then I don't see it would be a problem.
It might not be too hard to implement and I think it might help a lot when using overlapping symbol definitions.
As the code is stepped through, could the simulator keep track of the current name that's assigned to the variable?
For instance, sometimes - because there aren't enough underlying variables - a variable such as b0 is used for different reasons, with multiple symbols pointing to it. Say we had symbols 'Brightness' and 'Speed' both assigned to b0. When the code gets to something like 'Brightness = 6' or 'Peek address, Brightness', it knows that the current meaning of b0 is 'Brightness' - so the Sim could display 'Brightness (b0)' in the variable dialog.
In theory the Sim could also be a bit clever here - if for instance the current meaning of b0 was 'Brightness' and then the code said 'Let X = 5 * Speed' the Sim could flag an error (warning) saying that 'Speed' isn't one of the currently used symbol names.
In the Sim it would just be a case of holding a running table of currently used symbol names. A current 'context' is perhaps the way to describe it.
One issue is that this 'context' would only work sequentially - and so if you start the Sim at a random point in the code then it would have to start from not knowing the context - but as long as that's made clear then I don't see it would be a problem.
It might not be too hard to implement and I think it might help a lot when using overlapping symbol definitions.