Issues using a local label in a macro in MASM
assembly, macros, masm, x86
Solution
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
Problem
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.