beautypg.com

Anonymous labels, Local labels, Importing and exporting labels – Zilog ZUSBOPTS User Manual

Page 279: Label spaces, Table 22

background image

UM017105-0511

Labels

Zilog Developer Studio II – ZNEO™

User Manual

251

Anonymous Labels

The ZDS II assembler supports anonymous labels. Table 22 lists the reserved symbols pro-
vided for this purpose.

Local Labels

Any label beginning with a dollar sign (

$

) or ending with a question mark (

?

) is consid-

ered to be a local label. The scope of a local label ends when a SCOPE directive is encoun-
tered, thus allowing the label name to be reused. A local label cannot be imported or
exported.

Example

$LOOP:

JP $LOOP ; Infinite branch to $LOOP

LAB?: JP LAB? ; Infinite branch to LAB?

SCOPE ; New local label scope

$LOOP:

JP $LOOP ; Reuse $LOOP

LAB?: JP LAB? ; Reuse LAB?

Importing and Exporting Labels

Labels can be imported from other modules using the

EXTERN

or

XREF

directive. A space

can be provided in the directive to indicate the label’s location. Otherwise, the space of the
current segment is used as the location of the label.

Labels can be exported to other modules by use of the

PUBLIC

or

XDEF

directive.

Label Spaces

The assembler makes use of a label’s space when checking the validity of instruction oper-
ands. Certain instruction operands require that a label be located in a specific space
because that instruction can only operate on data located in that space. A label is assigned
to a space by one of the following methods:

Table 22. Anonymous Labels

Symbol

Description

$$

Anonymous label. This symbol can be used as a label an arbitrary number of times.

$B

Anonymous label backward reference. This symbol references the most recent anonymous
label defined before the reference.

$F

Anonymous label forward reference. This symbol references the most recent anonymous
label defined after the reference.

This manual is related to the following products: