Author Topic: Macros: Identify registers  (Read 8547 times)

nobody

  • Guest
Macros: Identify registers
« on: May 26, 2007, 04:25:52 PM »
Hi,

I'm trying to write a macro that produces different output depending on the register used as operand.
It looks something like this:

%macro isereg 1

%if (%1 = eax)
int 10h
%else
int 11h
%endif

%endmacro

but when I write eg.
isereg eax
in my source file I get the error message "error: (isereg:2) symbol `eax' not defined before use".

Is there a way to make this work at all?

greetings,
BTM

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Macros: Identify registers
« Reply #1 on: May 26, 2007, 04:58:19 PM »
I think "%ifidni %1, eax" will do what you want.

Best,
Frank

nobody

  • Guest
Re: Macros: Identify registers
« Reply #2 on: May 26, 2007, 06:05:54 PM »
See SF #1582125.

nobody

  • Guest
Re: Macros: Identify registers
« Reply #3 on: May 27, 2007, 12:15:47 AM »
Frank:
Works great. Thanks a bunch. :]

nobody:
???