I need to write a macro which needs to inline assembly
#define create_me(name) \
__asm\
mov name,#0x1021\
__endasm\
The # however isn't compiling. I have tried passing it in as a parameter however that doesn't work too. It says invalid preprocessor token . I can try to use an inline function but I can't dynamically create the register name. That is I don't have access to the name variable. Does anyone have any suggestions on how to use the # operation inside a macro.
I have looked at Escaping a # symbol in a #define macro?, but I have clearly explained why I need the macro here. My usecase is different.
Using an indirection through another macro should do the trick:
#define HASH_LIT #
#define HASH() HASH_LIT
#define create_me(name) \
__asm\
mov name,HASH()0x1021\
__endasm