dasm-assembler / dasm

Macro assembler with support for several 8-bit microprocessors

Home Page:https://dasm-assembler.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic labels are not working in an expression

Settis opened this issue · comments

I can construct dynamic label when I define it:

    processor 6502
    org $200

BAR SET 1
FOO_,BAR
    JMP FOO_1

But I can't construct it for using in jump:

    processor 6502
    org $200

BAR SET 1
FOO_1
    JMP FOO_,BAR

It fails with error:

--- Unresolved Symbol List
FOO_                     0000 ????         (R )
--- 1 Unresolved Symbol 

I see that the comma is already used as an argument separator. So I can't do it because of the dasm syntaxis.
Is it still possible to add dynamic label assembling for arguments? The label parts could be separated by the other separator.

The documentation reads:

The concat-eval “,” operator also works on the expression side of EQU/SET directives, so dynamic labels can be used with opcodes.

However, the following code returns a weird result for me, or I'm misunderstanding something.

  PROCESSOR 6502

  ORG $1000
lab_1
  nop

num   SET 1
addr  SET "lab_",num

  jmp addr

I'm expecting addr to be assigned $1000, but in fact it takes a seemingly random value:

  1  0000					      PROCESSOR	6502
  2  0000 ????
  3  1000					      ORG	$1000
  4  1000				   lab_1
  5  1000		       ea		      nop
  6  1001
  7  1001				   num	      SET	1
  8  1001				   addr       SET	"lab_",num
  9  1001
 10  1001		       4c 5f 62 	      jmp	addr

It seems that you can use:

addr  SET lab_,num

Good for me.