Okay, I see the problem. But first, I think this:
Code:
000000r 1 .macro var name,address
000000r 1 .local tmp_star
000000r 1 tmp_star=*
000000r 1 *=address
000000r 1 .res 1 ;reserve one byte
000000r 1 .export name:=*
000000r 1 ; *=tmp_star
000000r 1 .endmacro
should be this:
Code:
000000r 1 .macro var name,address
000000r 1 .local tmp_star
000000r 1 tmp_star=*
000000r 1 *=address
000000r 1 .export name:=*
000000r 1 .res 1 ;reserve one byte
000000r 1 ; *=tmp_star
000000r 1 .endmacro
in order to match the original macro. As written these values seem one higher than they ought:
Code:
002000 1 start:
002000 1 EA nop
002001 1 AD 01 30 lda foo
002004 1 8D 02 30 sta bar
002007 1 60 rts
I note that this (non-macro) code shows exactly the behavior I suggested, as far as addresses go:
Code:
003002 1 tmp_star=*
003002 1 *=$3002
003002 1 xx .res 1
003003 1 .export baz:=*
003003 1 *=tmp_star
003002 1
Presumably the macro invocations are doing the same thing internally, but the only address that gets shown is the value at the start of the macro invocation. Which is a reasonable choice; the program counter can have multiple values during the expansion, but on one line the listing can only show one in any case.
So I amend my suggestion to include displaying all the lines of the macro expansion, not just the one that invoked it. I don't see any obvious way to do that with ca65, but I don't know it intimately so there may be one.