Non-trivial example showing use of dynamic labels

e.g.

; this macro uses a bit ID to write to a port.
; note that the three ports are not contiguous
; in the address space

PORTA		19
PORTB		23
PORTC		31

write_bit	.macro	bit_id

port_name	.set	LABEL("PORT" + CHAR(INT('A') + (bit_id >> 3)))

		bsf	port_name, (bit_id & 7)

		.endm

another example would be
e.g.

; This macro defines a string with a label derived from
; the string ID in the section reserved for strings.
; It also prefixes the string with its length in bytes

def_str		.macro	str_id, str

cur_sect	.set	SECT_NAME($)

		.sect	string_sect

dlab		.set	LABEL("str_%d":str_id)
dlab2		.set	LABEL("str_%d":str_id + "_end")

dlab		.db	dlab2 - (dlab + 1)	; length of string
		.db	str
dlab2		

		.sect	cur_sect

		.endm