nasm/test/map.asm
H. Peter Anvin 34eefd3803 preproc: add %map() function and radix specifiers
Add the %map() function which can apply arguments to a macro from a
list.

Allow the user to specify the desired radix for an evaluated
parameter. It doesn't make any direct difference, but can be nice for
debugging or turning into strings.

As part of this, split expand_one_smacro() into two parts: parameter
parsing and macro expansion. This is a very straightforward splitting
of two mostly unrelated pieces of functionality.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-15 22:43:28 -07:00

8 lines
153 B
NASM

%define foo(x) (x+1)
%define bar(=x,y) (x*y)
%define baz(x+) %(x)
dw %map(foo,1,2,3,4)
dw %map(bar:2,1+2,3+4,5+6,7+8)
dw %map(baz:2,1+2,3+4,5+6,7+8)