Excellent! Thank you.
%macro mymacro 2
2 %defstr cat 'cat'
3
4 %ifstr %1 = cat
5 mov ah,%2
6 %else
7 mov al,%2
8 %endif
9
10 %endmacro
11
12 section .text
13 global _start
14 _start:
15 mymacro cat,16
16 <1> %defstr cat 'cat'
17 <1>
18 <1> %ifstr %1 = cat
19 00000000 B410 <1> mov ah,%2
20 <1> %else
21 <1> mov al,%2
22 <1> %endif
23 <1>
24
25 00000002 90 nop
26
27 mymacro dog,32
28 <1> %defstr cat 'cat'
29 <1>
30 <1> %ifstr %1 = cat
31 <1> mov ah,%2
32 <1> %else
33 00000003 B020 <1> mov al,%2
34 <1> %endif
35 <1>
%ifidn seems even better for my case because you don't have to define a string to test against. And %ifidni is best of all because it's case insensitive:
1 %macro mymacro 2
2
3 %ifidni %1,cat
4 mov ah,%2
5 %else
6 mov al,%2
7 %endif
8
9 %endmacro
10
11 section .text
12 global _start
13 _start:
14 mymacro cat,16
15 <1>
16 <1> %ifidni %1,cat
17 00000000 B410 <1> mov ah,%2
18 <1> %else
19 <1> mov al,%2
20 <1> %endif
21 <1>
22
23 00000002 90 nop
24
25 mymacro CAT,32
26 <1>
27 <1> %ifidni %1,cat
28 00000003 B420 <1> mov ah,%2
29 <1> %else
30 <1> mov al,%2
31 <1> %endif
32 <1>
33
34 00000005 90 nop
35
36 mymacro dog,62
37 <1>
38 <1> %ifidni %1,cat
39 <1> mov ah,%2
40 <1> %else
41 00000006 B03E <1> mov al,%2
42 <1> %endif
43 <1>
It works! Sorry for my trivial example. I actually have a good reason for asking this question but I didn't want to post my real code because I am still working out other details and trying to figure out the best way to do what I am trying to do and am not ready for that discussion yet.