在 MASM 的宏中使用本地标签的问题 [英] Issues using a local label in a macro in MASM

查看:11
本文介绍了在 MASM 的宏中使用本地标签的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要编写一个宏,它以 E,NE,A,B... 作为参数和单个命令,即 mov eax,ebx如果前面的 cmp 操作设置的条件为真,则执行.

I'm to write a macro that takes E,NE,A,B... as a parameter and a single command i.e mov eax,ebx which would execute if the condition set by a preceding cmp operation is true.

示例调用如下所示.

cmp bx,20
mDoIf E,<call Dumpregs>

我遇到的问题是,当我尝试使用以下定义进行编译时,我得到了两个错误之一.通过 LOCAL 定义,我得到一个 Undefined Symbol Error: ??0000.当我删除 LOCAL 定义时出现错误:jump destination must specify a label.

The issue I'm running into is that when I attempt to compile with the below definition I get one of two errors. With the LOCAL definition I get an Undefined Symbol Error: ??0000. When I remove the LOCAL definition I get an error: jump destination must specify a label.

mDoIf MACRO op, command
    LOCAL true
    J&op true
    exitm
    true: 
        command
        exitm

endm

任何帮助将不胜感激.谢谢你.

Any help would be appreciated. Thank you.

推荐答案

试试这个:

mDoIf MACRO op, command
    LOCAL L1, L2

    J&op    short L1
    jmp     short L2

L1: 
    call command
L2:
    exitm
endm

.code
start:
    mov     eax, 1
    cmp     eax, 2
    mDoIf l, DumpRegs

    invoke  ExitProcess, 0
end start

这篇关于在 MASM 的宏中使用本地标签的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆