I'm trying to write a macro to create "headers" in a linked list fashion.
In each header the first 2 bytes should be the address of the previous header starting address (0000 in the first header).
I managed to create the header label (h_label) using .ident(). At this point I try to "save" the current header start address using:
h_label .set .ident (.concat ("h_", label))
but I get this error Error: Constant expression expected
.
I get the same error if I try using the '*' (PC) like this:
h_label .set 0+*
Any idea what I am doing wrong? Any way I could achieve this?
My code for now looks like this:
latest .set 0
h_label .set 0
.macro defword label, strname, immflag
; h_LABEL:
.ident (.concat ("h_", label)):
h_label .set .ident (.concat ("h_", label))
.ADDR latest
.byte ( .strlen(strname) + immflag*128)
.byte strname
latest .set h_label
; do_LABEL:
.ident (.concat ("do_", label)):
.endmacro
.CODE
defword "DUP", "DUP", 0
LDA #$12 ; dummy code
LDA #$34 ; dummy code
defword "SWAP", "SWAP", 1
LDA #$56 ; dummy code
LDA #$78 ; dummy code