I write a macro and want to determine whether the parameter is integer type. Could anyone help me how to do the checking code? My first thought is to use OPATTR but i don't quite familiar with this macro and some terms in masm help. For example: "immediate expression", "direct memory addressing", "SS-relative memory expression" etc.
Thanks
Thanks
I think you need bit 2 to be set in the OPATTR flag, which indicates the argument is an immediate value.
Thomas
Thomas
i write a sample macro with bit 2 set in OPATTR:
Both
abcabc eax
abcabc 2
will print out a i character. Obviously the eax is not an integer type. Any ideas?
abcabc MACRO a:REQ
IF (OPATTR(a)) AND 00100000y
echo i
ENDIF
ENDM
Both
abcabc eax
abcabc 2
will print out a i character. Obviously the eax is not an integer type. Any ideas?
You can use the "TYPE" operator. Ths should work for any arg.
mymac macro arg
if (TYPE arg) eq (TYPE dword)
...
endif
endm
Thanks gfalen . It works great.
Originally posted by yoursguideline
00100000y
00100000y
That isn't bit 2 :)
This is bit 2:
00000100b
Thomas
What's the difference between "y" and "b" after a sequence of bits?
Regards.
Regards.
To determine whether param is immediate or not i use this macro.
"Binary: y. e.g. 1010y, or b if the radix is not hexadecimal. e.g. .radix 10 1010b.
The default Radix is decimal."
$IsImm MACRO Operand:REQ
IF (OPATTR (Operand)) AND 00000100y
;; Is an immediate value
EXITM <-1>
ELSE
EXITM <0>
ENDIF
ENDM
But there is no way to determine whether the parameter is integer type or not.
What's the difference between "y" and "b" after a sequence of bits?
"Binary: y. e.g. 1010y, or b if the radix is not hexadecimal. e.g. .radix 10 1010b.
The default Radix is decimal."