NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: gammac on November 23, 2014, 07:07:05 PM

Title: macro processing seems to be inconsistent
Post by: gammac on November 23, 2014, 07:07:05 PM
Hi!

Why are %1 and %2 resolved at declaration of the inner macro and %?? and %00 at declaration of the outer macro? Is there a work around that %?? and %00 are even resolved at declaration of the inner macro?

Code: [Select]
%macro mkmacro 1
%define str 12
%macro %1 2
%warning '%??' = %??
%warning '%00' = %00
%warning 'str' = str
%warning '%1' = %1
%warning '%2' = %2
%endmacro
%endmacro

lbl_1 mkmacro mymac

lbl_2 mymac 42, 66

output:

Code: [Select]
warning: (mymac:2) '%??' = mkmacro
warning: (mymac:3) '%00' = lbl_1
warning: (mymac:4) 'str' = 12
warning: (mymac:5) '%1' = 42
warning: (mymac:6) '%2' = 66