I'm using Visual Studio version 17.2.5 (the latest as of this moment). I'm trying to create a simple macro to delete a leading blank, if any, off of one of the arguments to the macro, and I'm having trouble getting it to even assemble (let alone work). I'm pretty new to writing macros. Here's the relevant fragment of my test program:
; ==================================================
.model flat, stdcall
.DATA
.CODE
MyProc proc near
mTest MACRO mystr
char SUBSTR <mystr>,1,1 ; Get first char.
IFIDN char,< > ; If first char is blank ...
%mystr% SUBSTR <mystr>,2 ; ... delete leading blank.
ENDIF
xor eax,eax ; (Any instruction before - irrelevant what)
mystr ; This line in the assembled code should be cmp eax,123 with NO leading blank.
xor eax,eax ; (Any instruction after - irrelevant what)
ENDM
mTest < cmp eax,123> ; Argument has a leading blank.
ret
MyProc endp
end MyProc
; ==================================================
When I attempt to assemble it, I get "syntax error: SUBSTR". Here's what the macro expanded to when I invoked it:
% cmp eax,123% SUBSTR < cmp eax,123>,2
Which is obviously wrong. What am I doing wrong? And is there a better way to do what I'm trying to do? Thanks / Rav