Issues using a local label in a macro in MASM

人走茶凉 提交于 2019-12-02 02:12:28

问题


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.

An example call would look like.

cmp bx,20
mDoIf E,<call Dumpregs>

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.


回答1:


Try this:

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


来源:https://stackoverflow.com/questions/20534589/issues-using-a-local-label-in-a-macro-in-masm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!