AnsweredAssumed Answered

Count up in compile and link time

Question asked by Leojunin on Oct 5, 2015
Latest reply on Oct 20, 2015 by ZhangJennie

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.

Outcomes