Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macros can't redefine instructions #110

Open
andrew-davie opened this issue Feb 17, 2021 · 1 comment
Open

Macros can't redefine instructions #110

andrew-davie opened this issue Feb 17, 2021 · 1 comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Comments

@andrew-davie
Copy link
Member

I wanted to block out a particular instruction from use in my program.
I thought to define the instruction as a macro, and ERR inside the macro.
However, to my surprise, you don't appear to be able to redefine an instruction.

 MAC LDA ; redefine as an error!
  ECHO 'Don't use LDA!'
  ECHO {0}
  ERR
 ENDM

In my tests, the macro is never instantiated.
Perhaps the documentation needs updating to indicate - or is it possible to 'fix' this issue?

@thrust26 thrust26 added bug Something isn't working enhancement New feature or request documentation Improvements or additions to documentation labels Apr 13, 2021
@thomas374b
Copy link
Contributor

Yes, this is a "feature" of dasm. Macros and Instructions don't share the same "namespace". Therefore there will be no clash. The macro will be silently ignored because the processor mnemonic is matched earlier.

A fix would need to introduce some extra "cross-checking" and proper aborting. Dasm could not decide by itself what is better to choose (macro or processor mnemonic).

A solution to this problem could be to have another processor definition (subset, like with the 68705 and 68908) or to implement a special UNDEFINE keyword that kicks out a special mnemonic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants