Count up in compile and link time

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

Count up in compile and link time

1,556 次查看
Leojunin
Contributor IV

Hello to all the community. I wish to make a counter in assembler visible to all files .asm, and any .asm file can continue the count up.

 

I've done something, assigning a value to the SET directive but is only visible within the same file. I mean, I have a macro that runs and is incremented a counter (label) that use. The structure is as follows:

 

 

MY_MACRO   MACRO

              MLIST OFF

              IFNDEF Label

Label            SET 0

              ENDIF

\1            EQU    Label

Label         SET    Label + 1

           ENDM

 

If I compile gives this result:

 

           MY_MACRO Value1     ;Value1 equal to 0

           MY_MACRO Value2     ;Value2 equal to 1

 

           lda #Value1          ACCA loaded with 0

           sta xx              ;somewhere in memory

           lda #Value2          ACCA loaded with 1

 

 

Desire "Label" in the macro out public and to increase it from another .asm file by holding the carrying value at the time and not redefine it.

 

 

Is there any way?

 

 

Thanks to all.

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

1,428 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

What chip and version of CW do you work with?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,428 次查看
Leojunin
Contributor IV

I'm using HCS08 and CW 6.3, but I have too the CW 10.... I don't remember...

0 项奖励
回复

1,428 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

thanks, can you please upload your demo project to showcase the problem? thanks!
Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,428 次查看
Leojunin
Contributor IV

there you have a working sample. I was not clear with the idea? My project is big for publication

0 项奖励
回复

1,428 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

under CW6.3 install folder, there is assembly demos:

{CW_MCU_6_3 install folder}\(CodeWarrior_Examples)\HCS08\Assembly Examples

can this help you?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复