Assembly 如何跳转到“英特尔汇编”中保存在寄存器中的地址?

Assembly 如何跳转到“英特尔汇编”中保存在寄存器中的地址?,assembly,x86,Assembly,X86,如果我计算标签的地址并将其存储在eax寄存器中,如何使用JE有条件地跳转到eax 编译,但我没有检查它是否有效 je eax 不编译操作码和操作数的无效组合。 为什么不同?如果等于eax,我怎么能跳呢?根本没有这种形式的je。您可以做的是基于相反的条件放置相对条件跳转,然后是无条件寄存器间接跳转: jne skip jmp eax skip: 你可以用它做一个宏来避免重复写同样的东西。例如,在NASM语法中,该宏可能如下所示: %macro je_reg 1 jne %%skip

如果我计算标签的地址并将其存储在eax寄存器中,如何使用JE有条件地跳转到eax

编译,但我没有检查它是否有效

je eax
不编译操作码和操作数的无效组合。
为什么不同?如果等于eax,我怎么能跳呢?

根本没有这种形式的je。您可以做的是基于相反的条件放置相对条件跳转,然后是无条件寄存器间接跳转:

jne skip
jmp eax
skip:
你可以用它做一个宏来避免重复写同样的东西。例如,在NASM语法中,该宏可能如下所示:

%macro je_reg 1 
    jne %%skip 
    jmp %1 
    %%skip: 
%endmacro
je_reg eax
je_reg ebx
可以这样使用:

%macro je_reg 1 
    jne %%skip 
    jmp %1 
    %%skip: 
%endmacro
je_reg eax
je_reg ebx
可以将宏推广到使用任何条件代码:

%macro jcc_reg 2 
    j%-1 %%skip   ; %-1 expands to the inverse of the condition in the first macro argument
    jmp %2 
    %%skip: 
%endmacro

; Example usage
jcc_reg e,eax
jcc_reg no,ebx

根本没有这种形式的日本脑炎。您可以做的是基于相反的条件放置相对条件跳转,然后是无条件寄存器间接跳转:

jne skip
jmp eax
skip:
你可以用它做一个宏来避免重复写同样的东西。例如,在NASM语法中,该宏可能如下所示:

%macro je_reg 1 
    jne %%skip 
    jmp %1 
    %%skip: 
%endmacro
je_reg eax
je_reg ebx
可以这样使用:

%macro je_reg 1 
    jne %%skip 
    jmp %1 
    %%skip: 
%endmacro
je_reg eax
je_reg ebx
可以将宏推广到使用任何条件代码:

%macro jcc_reg 2 
    j%-1 %%skip   ; %-1 expands to the inverse of the condition in the first macro argument
    jmp %2 
    %%skip: 
%endmacro

; Example usage
jcc_reg e,eax
jcc_reg no,ebx

谢谢,回答得很好。谢谢,回答得很好。