This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Ax51 attempt to define an already defined label

I'm trying to use the ax51 standard macro assembler to find a way to determine if a symbol or label is already defined. Something like the following pseudo code:

if label "table_abc" is defined, do nothing, else do the following:
table_abc: DB 1 DB 2 DB 3
endif

I somehow thought the following could work but alas it does not:
IF NOT :DEF:table_abc
table_abc: DB 1 DB 2 DB 3
ENDIF

-> LABEL NOT PERMITTED, SYNTAX ERROR

My code is 100 percent assembler code so I try to not use the C preprocessor. But if there is no other way, a C preprocessor code example would help as well.

EFM8BB31, Silicon Labs Simplicity Studio v3, Keil 8051 v9.53 debug

Parents
  • macro assembler to find a way to determine if a symbol or label is already defined

    It really should have been totally obvious to you why that cannot work: neither symbols nor labels are in any way related to macro processing. They simply don't exist yet at the time macros are handled. It says so right at the start of the documentation's chapter on assembler macros, too!

    And no, switching to C macro preprocessing will not change that in any way.

Reply
  • macro assembler to find a way to determine if a symbol or label is already defined

    It really should have been totally obvious to you why that cannot work: neither symbols nor labels are in any way related to macro processing. They simply don't exist yet at the time macros are handled. It says so right at the start of the documentation's chapter on assembler macros, too!

    And no, switching to C macro preprocessing will not change that in any way.

Children