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

Error (?) with dynamic labels #119

Closed neilsf closed 3 years ago

neilsf commented 3 years ago

BIG THANKS for maintaining DASM, my favourite assembler!

I'm trying to use dynamic labels as they would be extremely useful in my project. However I might be misunderstanding something. Here's my code:

    PROCESSOR 6502

    ORG $c000

    MAC import
"IMPORT_",{1} SET 1
    ENDM

    import "IROUTINE"
    jsr ROUTINE_NAME
    rts

    IFCONST IMPORT_IROUTINE
ROUTINE_NAME SUBROUTINE
    lda #$00    
    sta $d020   
    rts 
    ENDIF

I would expect the label IMPORT_IROUTINE to be dynamically created, however I get this error:

char = '{' 123 (-1: 0)
char = '}' 125 (-1: 49)
char = '{' 123 (-1: 0)
char = '}' 125 (-1: 49)
--- Unresolved Symbol List
ROUTINE_NAME             0000 ????         (R )
IMPORT_IROUTINE          0000 ????         (R )
SET                      0000 ????         (R )
--- 3 Unresolved Symbols

/tmp/x.asm (6): error: Illegal character '{1} SET 1'.
/tmp/x.asm (6): error: Illegal character '} SET 1'.
/tmp/x.asm (6): error: Syntax Error '{1} SET 1'.

Fatal assembly error: Source is not resolvable.

Can you please help finding out why it fails. Many thanks.

thrust26 commented 3 years ago

You simply have to write IMPORT_{1} SET 1

neilsf commented 3 years ago

That works, thanks. I thought the comma syntax was the preferred way. Thanks again.