dasm-assembler / dasm-assembler/dasm
MACRO/subroutine scope
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 257
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
As macros are effectively a text substitution 'engine', I would expect to be able to take any block of code, put it inside a macro, instantiate the macro, and it should work as before.
jmp there
there
Replace with
MAC gogo
jmp there
ENDM
gogo
there
That should all work fine.
The problem is, if 'there' is a local label. Then it doesn't work.
It's because, I think, macros have this local 'SUBROUTINE' scope.
The reason it's super inconvenient is that you can't include a local branch as a destination in a macro, for example...
CHECK_TIMER .exit
.exit
That will fail, of course, because of the local label. I don't think this is ideal, or correct, behaviour.
And it's super-inconvenient, as it makes it impossible to use locals inside macros.
I don't know if/what this might break if 'fixed', but I thought I'd post the issue for discussion.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two examples in the issue and tracing how MAC/ENDM handles local labels and SUBROUTINE scope. Done means a branch to a local label inside a macro, such as CHECK_TIMER .exit followed by .exit, works without breaking existing macro behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100