Hi guys....
because i am too lazy (well, too busy) to read the docs, can we have conditional compilation in our asm files (using MASM)? I would like to surround my debug macro calls with some #IFDEF type lines so that they don't get compiled into a release build.

Cheers :grin:
Posted on 2002-01-15 22:12:02 by sluggy
Oh ya most definitely!



IFNDEF __My_Include__
__MY_Include__ equ 1 ; <== then define it!

[ Protected code to occoure only once ]

ENDIF


It works the same as the "dot-if's" but with out the dot, meaning pre-compiler if's and elses.

Your choices off the top of my head are: IFDEF, IFNDEF, ELSE, ENDIF. Could be others, havent looked it up or anything :)

Enjoy..
:alright:
NaN
Posted on 2002-01-15 22:24:08 by NaN
Oh ya, so for your debug topic:



AllowDebug equ 1 ; comment this out to not allow Debug Code

...

IFDEF AllowDebug
[ your code ]
ELSE
[ optional code for when not compiling debug code ]
[ just to show you can, normally this is not here ]
ENDIF


I think you get the idea :)
NaN
Posted on 2002-01-15 22:28:15 by NaN
You can also use 'em inside macros, to alter what the macro generates, based on a certain parameter for example:


GETPRM MACRO FIELD,TYPE
MOV EAX,FIELD
IFIDN <TYPE>,<A>
OR FLAGS,GETPADR
ENDIF
CALL GETPARM
ENDM

:cool:
Posted on 2002-01-15 23:56:27 by S/390
Sweet, thanks guys :grin:
Posted on 2002-01-16 03:56:38 by sluggy