The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: fonolite on September 07, 2010, 08:18:11 AM

Title: Conditional assembly in FORC macro
Post by: fonolite on September 07, 2010, 08:18:11 AM
FORC X , <08>

IF X EQ 0
ECHO Hey X
ENDIF

ENDM

=>
Hey 0



But,

FORC X , <0A8>

IF X EQ 0
ECHO Hey X
ENDIF

ENDM

=> Error A2116: Symbol not defined : A
X has 0 , A, 8 charaters in string.

I can't find a macro function like @strcmp(X,0)
to do boolean operaions.

What should I do conditional assembly inside FORC macro?
Title: Re: Conditional assembly in FORC macro
Post by: dedndave on September 07, 2010, 10:44:08 AM
try this...
FORC X , <0A8h>
Title: Re: Conditional assembly in FORC macro
Post by: japheth on September 07, 2010, 11:26:09 AM
Quote from: dedndave on September 07, 2010, 10:44:08 AM
try this...
FORC X , <0A8h>

This isn't much better.
During expansion of the macro, these lines (among others) will be created:

IF 0 EQ 0
IF A EQ 0
IF 8 EQ 0
IF h EQ 0

To make it work, one has to compare literals:


FORC X , <08>

IFIDN <X>, <0>
ECHO Hey X
ENDIF

ENDM