dasm-assembler / dasm

Macro assembler with support for several 8-bit microprocessors
https://dasm-assembler.github.io/
GNU General Public License v2.0
215 stars 40 forks source link

Macros detects parameters in the false portion of #if/#else/#endif and IF/ELSE/ENDIF directives #123

Open pizzatari opened 3 years ago

pizzatari commented 3 years ago

The assembler detects a parameter inside #if blocks when it's the false portion and issues an error if a parameter is not passed. I think it should ignore {n} parameters in the false block.

dasm test.asm -otest.bin
test.asm (12): error: Not enough args passed to Macro.

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

Samples:

    processor 6502

    ORG $1000

    MAC MAC_TEST
#if 0
label{1}label
#endif
    ENDM

    MAC_TEST

And

    processor 6502

    ORG $1000

    MAC MAC_TEST
    IF 1
    ELSE
label{1}label
    ENDIF
    ENDM

    MAC_TEST