Ron Kneusel wrote: > > Greetings! > > I looking for a quick summary of the rules for using Merlin local (":" > prefixed) and bracket ("]") labels. > > I know the locals are only local between the nearest globals, but are > there any other restrictions? > > What about the bracket labels? How many can you use? Ie, is ]1234 > legal? What about their scope, is it the same as the locals? > .... Here's some info from Merlin manuals ... Variables Labels beginning with "]" are regarded as VARIABLES. They can be redefined as often as you wish. The de- signed purpose of variables is for use in MACROS, but they are not confined to that use. Forward reference to a variable is impossible (with correct results) but the assembler will assign some value to it. That is, a variable should be defined before it is used. It is possible to use variables for backwards branching, using the same label at numerous places in the source. This simplifies label naming for large programs and uses much less space than the equivalent once-used labels. For example: 1 LDY #0 2 ]JLOOP LDA TABLE,Y 3 BEQ NOGOOD 4 JSR DOlt 5 lNY 6 BNE ]JLOOP ;BRANCH TO LINE 2 7 NOGOOD LDX #-l 8 ]JLOOP lNX 9 STA DATA,X 10 LDA TBL2,X 11 BNE ]JLOOP ;BRANCH TO LINE 8 Local Variables A local label is any label beginning with a colon (:). A local label is attached to the last global label and can be referred to by any line from that global label to the next global label. You can then use the same local label in other segments governed by other global labels. You can choose to use a meaningless type of local label such as: 1, :2, etc., or you can use meaningful names such as :LOOP, :EXIT, and so on. Some restrictions on use of local labels are ... 1) Local labels cannot be used inside macros. 2) You cannot label a MAC, ENT or EXT with a local label and you cannot EQUate a local label. 3) The first label in a program cannot be a local label. Local Labels, Global Labels and Variables There are three distinct types of labels used by the assembler. Each of these are identified and treated differently by Merlin: Global Labels -labels not starting with "]" or ":" Local labels -labels beginning with ":" Variables -labels beginning with "]" Note that local labels do not save space in the symbol table, while variables do. Local labels can be used for forward and backward branching, while variables cannot. Good programming practice dictates the use of local labels as branch points, variables for passing data, etc.. Rubywand