Assembly 使用标签时出错';等等';在NASM宏中

Assembly 使用标签时出错';等等';在NASM宏中,assembly,macros,nasm,Assembly,Macros,Nasm,我使用NASM中的宏来定义一些重复的函数。我使用以下代码: ; System call numbers %define SYS_fork 1 %define SYS_exit 2 %define SYS_wait 3 ; define the macro %macro SYSCALL 1 global %1 %1: mov eax, SYS_%1 int 64 ; 64 is system call ret %endmacro ; call the macro

我使用NASM中的宏来定义一些重复的函数。我使用以下代码:

; System call numbers
%define SYS_fork    1
%define SYS_exit    2
%define SYS_wait    3

; define the macro
%macro SYSCALL 1
global %1
%1:
  mov eax, SYS_%1
  int 64 ; 64 is system call
  ret
%endmacro

; call the macro to setup the functions
SYSCALL fork
SYSCALL exit
SYSCALL wait
这工作正常,除了上次调用创建名为
wait
的宏之外。它给了我一个错误:

error: parser: instruction expected

wait
是nasm中的保留字吗?如果是这样的话,还有没有办法定义一个名为
wait
的函数?

是的,
wait
FWAIT
是x86_64指令集的一部分。我确信您已尝试更改代码中的名称(Block?HoldUp?),错误已被删除,这样也可以解决问题。

两个问题都是“是”。所述标识符还可以以$作为前缀,以指示其打算作为标识符而不是保留字来读取。因此,在宏中写着
%1:
的行中,将其更改为
$%1:
@MichaelPetch Thx alot,这就是我要找的。