CW6.3 Assembler - Problem with conditional assembly directives

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CW6.3 Assembler - Problem with conditional assembly directives

1,121 次查看
bigmac
Specialist III

Hello all,

 

CW assembler has a rich set of conditional assembly directives.  I typically would utilize something like the following construct to prevent the multiple definition of a particular label -

 

  ifndef  LABEL_NAME

LABEL_NAME  equ  <expression>

  endif

 

  ifndef  LABEL_NAME

LABEL_NAME:

  [<assembly instructions, macros, data, etc>]   ; Optional

  endif

 

These examples seem to work just fine.  However, the problem seems to be when the label refers to a macro definition.  The label name remains undefined, resulting in error messages about duplicate macro definitions.

 

  include "908_macros.inc"    ifndef  ILOP ILOP:     MACRO     ; Reset MCU using illegal opcode          DC.B  $8D          ENDM  endif

 

 The above does not work if the macro is also defined with the file "908_macros.inc".  The only work-around that I so far have been able to find, is to create a dummy label, in addition to the macro name.

 

  include "908_macros.inc"    ifndef  _ILOP _ILOP:    ; Reset MCU using illegal opcodeILOP:     MACRO          DC.B  $8D          ENDM  endif

 

However, in addition to being unwieldy, this method becomes problematic should the include be not modifiable to provide the dummy variable, e.g. such as "derivative.inc".

 

I wonder if others, who make extensive use of assembly macros, have previously encountered this problem, and perhaps have an alternative "fix".  Maybe this is a bug in the assembler, that has never been fixed, or perhaps this was intentional in the design of the assembler.

 

Regards,

Mac

标签 (1)
标记 (1)
0 项奖励
回复
1 回复

848 次查看
sebasira
Senior Contributor I

As you, I'm facing the same problem since many years ago... I always need to create a label for every macro definition. That's in CW 3.1, 4.6 and also 6.1

 

Maybe a solution or fix can help us both!

 

regards

0 项奖励
回复