Does anyone know a way to define C preprocessor comments at the command line for A51? For example, in C I would do something like: C51 foo.c DEFINE(SOME_CONST) but the "DEFINE" directive does not work in A51. In addition, the C preprocessor in A51 does not recognize constants declared with the "SET" directive as C defined constants. In other words, if I do: A51 foo.a51 SET(SOME_CONST=1) and then I have the following line in my assembly file: #ifdef SOME_CONST the expression will be interpreted as being false. Thanks!
I just tried the following and it worked perfectly.
#define TEST 1 #if TEST == 1 cseg at 1000h nop nop nop #else cseg at 2000h ljmp $ #endif end
Does anyone know a way to define C preprocessor comments at the command line for A51? For example, in C I would do something like:<br> <br> C51 foo.c DEFINE(SOME_CONST)<br> <br> but the "DEFINE" directive does not work in A51. In addition, the C preprocessor in A51 does not recognize constants declared with the "SET" directive as C defined constants. In other words, if I do:<br> <br> A51 foo.a51 SET(SOME_CONST=1)<br> <br> and then I have the following line in my assembly file:<br> <br> #ifdef SOME_CONST<br> <br> the expression will be interpreted as being false.<br> <br> Thanks!
I can't get it to work either, but I found a couple workarounds that may help: A51 foo.a51 SET(SOME_CONST=1) $IF (SOME_CONST = 1) SOME_CONST SET 1 ;;...more code $ELSE SOME_CONST SET 0 ;;...more code $ENDIF The $IF tests use the command-line SET variables, so you might just use them instead of #ifdef. Also, if you want to use the variables in other assembler expressions, then the assembler "SET" statements get you a named variable you can use, e.g.: TABLE db SOME_CONST