Andy Beat me to it, but below I've put in a little program I wrote to demonstrate how duplicated labels can be used in MPASM. Note that doing this can make your program pretty difficult to understand when looking at the listing. myke title "MACROTST - Simple Program to Test Macro Invocation." ; ; This is a simple Program to test local labels in a Macro. ; ; ; Hardware Notes: ; This is program will not be loaded into a PIC. ; ; Myke Predko ; 97.08.14 ; LIST P=16F84, R=DEC errorlevel 0,-305 INCLUDE "d:\mplab\p16f84.inc" ; Register Usage CBLOCK 0x00C ; Put in Some Variables Test ENDC ; Macro Declares Repeat Macro A Local Loop Loop decfsz A goto Loop endm PAGE __CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF ; Code for MACROTST org 0 Loop ; Global Label Repeat Test Repeat Test goto Loop end >Paul B. Webster > wrote: > >> > The macro works beatifully the first time I use it. However, when I >> > try to use it a second time, the .... labels are duplicated. >> >> Indeed they are. In general you cannot use labels in macros unless >> you make the LABEL an argument to the macro and ensure that it is >> unique to each call of the macro. An easy way to do this is to >> produce a set of labels consisting of a "stem" supplied in the >> macro call plus .... >> >> [snip] >> >> I am sure the "Local" directive is of no relevance here. > > Wrong, Paul... The "local" directive is EXACTLY the right way to > make labels local to a macro. > > For example: > > TEST MACRO > LOCAL LABEL1 > > NOP > NOP > GOTO LABEL1 > NOP > LABEL1: NOP > NOP > > ENDM > >-Andy > >=== Andrew Warren - fastfwd@ix.netcom.com >=== Fast Forward Engineering - Vista, California >=== http://www.geocities.com/SiliconValley/2499 > >=== For PICLIST help (including "unsubscribe" instructions), >=== put the single word "help" in the body of a message and >=== send it to: listserv@mitvma.mit.edu > > "One must invoke enough raw truth to punch a hole in the world" - Darl Af