【发布时间】:2017-12-11 15:00:04
【问题描述】:
我需要编写很多推送不同字符的push 指令。我想为此使用宏。这是我到目前为止所做的:
%macro push_multi 1-* ; Accept between 1 and ∞ arguments
%assign i 1
%rep %0 ; %0 is number of arguments
push %{i}
%assign i i+1
%endrep
%endmacro
push_multi 'a', 'b', 'c' ; push 'a' then push 'b' then push 'c'
但是nasm -E 的结果是:
push %i
push %i
push %i
我想要这个:
push 'a'
push 'b'
push 'c'
如何使用assign 创建的变量来处理宏的第 n 个参数?
【问题讨论】:
标签: assembly macros x86 nasm preprocessor