Using Immediate-Addressing Mode in HLI Assembler Macros

An ambiguity exists when using the immediate addressing mode within a macro.

For the ANSI-C preprocessor, the symbol # inside a macro specifically indicates a string constructor. Using #pragma NO_STRING_CONSTR: No String Concatenation during Preprocessing instructs the Compiler that in all subsequent macros, the instructions remain unchanged whenever the symbol # is specified. This macro is valid for the rest of the file in which it is specified.

Listing: Definition of the Clear2 Macro
/* This macro initializes the specified variable to 0.*/
#pragma NO_STRING_CONSTR

#define Clear2(var){__asm LOAD #0,Reg0;__asm STORE Reg0,var;}

Invoking the Clear2 macro in the source code:

Clear2(var1);

The preprocessor expands the Clear2 macro:

{ __asm LOAD #0,Reg0;__asm STORE Reg0,var1; };