Count up in compile and link time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Count up in compile and link time

644 Views
Leojunin
Contributor III

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.

Labels (1)
Tags (3)
0 Kudos
5 Replies

516 Views
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 Kudos

516 Views
Leojunin
Contributor III

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

0 Kudos

516 Views
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 Kudos

516 Views
Leojunin
Contributor III

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

0 Kudos

516 Views
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 Kudos