PASM and label scoping
Phil Pilgrim (PhiPi)
Posts: 23,514
One of PASM's annoyances is the fact that it permits only limited local label scoping (via the colon prefix, e.g. :local_label). For simple programs, this is somewhat effective; but for larger programs with multiple PASM cogs, its limitations are a real nuisance. In these situations, it would be nice to be able to limit the scope of all labels to the org section to which they belong. In my case, I have a need (for clarity) to have variables of the same name in multiple org sections. I can give them colon-prefix names. But that entails naming everything but the leading label in the section with colon-prefixed names, since an intervening non-prefixed name would block access to the variables at the end. While this is a solution of sorts, albeit cumbersome, what makes it even more cumbersome is that you cannot call a subroutine with a colon-prefixed name. So, instead of a convenient one-argument call you have to use the two-parameter jmpret.
What would be nice is a way to push and pop symbol dictionaries, such that the top dictionary is searched first before descending into the dictionary stack to search for a symbol. I've seen this done in other assemblers with CSEG and DSEG pseudo-ops. Something similar could be done in PASM.
I hope that Parallax has not become so distracted with GCC stuff that further Spin/PASM development gets relegated to the back burner (where it has languished for years, sadly, with the back burner turned off).
-Phil
What would be nice is a way to push and pop symbol dictionaries, such that the top dictionary is searched first before descending into the dictionary stack to search for a symbol. I've seen this done in other assemblers with CSEG and DSEG pseudo-ops. Something similar could be done in PASM.
I hope that Parallax has not become so distracted with GCC stuff that further Spin/PASM development gets relegated to the back burner (where it has languished for years, sadly, with the back burner turned off).
-Phil
Comments
Here's how it could be better:
Here, labels defined within a code segment are local to that segment.
-Phil
-Phil