I use a lot of textequ in macro. I have some question about
A symbol in the CATSTR INSTR SUBSTR was evaluated or not?
I was confused.
Posted on 2003-05-08 10:35:41 by taowen2002
taowen2002, don't forget the ECHO keyword to test your ideas at assemble time.

If not in <> and MASM expects a string/number then symbol is evaluated.
To further force evaluation use %.

Here are some examples to see:
Pizza EQU 55

Diner EQU <Pizza>

Mickey_Mouse EQU <Diner>

House EQU <Mickey_Mouse>

ECHO House

; expects string, does not resolve Pizza to number!
% ECHO House

; expects string again
temp CATSTR House, %Pizza
% ECHO temp

; number expected, resolves Pizza to 55!
IF House EQ 55
ECHO yes

Note: MASM can not selectively resolve text equates in layers (House always resolves when evaluated to Pizza for expected string, and 55 for an expected number).
Posted on 2003-05-08 21:18:11 by bitRAKE
So impressive!
Thank you!:alright:
Posted on 2003-05-08 22:35:30 by taowen2002
Another important note is that ECHO can not resolve a number. :( I test some macro code and always have to do it this way:

temp CATSTR <Number1 = >, %Num1, < Number2 = >, %Num2

% ECHO temp
I don't know if that was clear above - the % before a number turns it into a string. Even a literal number becomes a string (ie %55). There are many other bits on the board and I will be glad to help.
Posted on 2003-05-08 23:27:28 by bitRAKE