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

Macro parameters ignore conditionals #34

Open
thrust26 opened this issue Mar 8, 2020 · 2 comments
Open

Macro parameters ignore conditionals #34

thrust26 opened this issue Mar 8, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@thrust26
Copy link
Member

thrust26 commented Mar 8, 2020

The following code does not assemble:

CHECK = 0

  MAC TEST
      .byte {1}
    IF CHECK > 0
      .byte {2}
    ENDIF
  ENDM

  ORG $f000

  TEST 1
testmac.asm (12): error: Not enough args passed to Macro.

Unrecoverable error(s) in pass, aborting assembly!
Complete.

It seems like the CHECK condition is not evaluated before checking the number of parameters required by the macro.

@thrust26 thrust26 added the bug Something isn't working label Mar 8, 2020
@andrew-davie
Copy link
Member

I have found that my understanding of macros in DASM seems closest to reality when I think of macros as purely a text-substitution engine. It does not know of or understand the values of things. This is why it seems impossible to use values of variables inside macros, in any form. You get the text label of things, and only that. In other words, the macro first plonks down the text according to various substitution rules ({1} etc) and only after the macro is completed, then the resultant code is assembled. That is my current understanding of how to work with macros, anyway.

@Rhialto
Copy link

Rhialto commented Mar 9, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants