Keil Logo


Symbols representing numeric values or addresses make a program easier to read and understand. Symbols have the following attributes:

TYPE: Each symbol has a type, such as bit, byte, word, or data3. The assembler uses the symbol type to determine the access type and generate the appropriate instruction; for example, MOVB versus MOVW. Type checking enables the assembler to catch incorrect functions; for example, a call to a data label instead of a code address.
SECTION: Most user-defined symbols belong to some section, which is a memory segment containing executable code, constants, or variables.
SCOPE: Visibility level: local, to module, global, public, external constants, or to relocatable symbols.
VALUE: Numeric value or offset the symbol represents.
CHANGEABLE: Symbols defined using the SET directive can be changed. Symbols not defined cannot be redefined.

Once a symbol's attributes are defined, the symbol can be used as a numeric operand in expressions.

After a symbol is defined, it is named. Symbol names must follow the style conventions listed below.

  • Maximum character length is 31
  • First character must be one of 'A'-'Z', 'a'-'z', '_', or '?'
  • Subsequent characters must be one of 'A'-'Z', 'a'-'z', '_', '?', or '0'-'9'

The assembler contains predefined symbols for mnemonics, operands, and C16x/ST10 specific data and bit-addresses. These names are reserved words and cannot be used by the programmer to define symbols or labels.


Because a label is a symbol, the rules for symbols also apply to labels. A label is the first field in a line, but it can be preceded by tabs or spaces and followed by a colon. Only one label is permitted per line. When defined, a label receives the current numerical value of the address counter of the currently active section. A label may not be defined more than once or have the name of a reserved word. The following box shows label use:

LABEL2:                              ; a comment line with a label
COPY:     MOVB  [R1],RL4

Special Assembly Symbols

Some symbols are predefined as reserved words and usually refer to names of the processor registers. For example, R0 through R15 refer to names of general-purpose registers (GPRs). The dollar sign ($) represents the current offset in the active section. Each section has a separate address counter and the length increases after each instruction. If needed, the ORG directive can change the address counter's value. Otherwise, the address counter automatically changes to the new section if the current section is changed.


  • $ is incremented with every translated instruction. The address counter is advanced on each element of the list on DB (define byte) and DW (define word) statements.

The following examples show the use of the $ address counter:

LEN      EQU   $ - MSG - 1

HALT:    JMP   $:                ; jump to 'HALT'
TABLE:   DW    $, $, $, $        ;

Expressions containing variables or labels defined in relocatable sections cannot be evaluated at assembly time because the final address is unknown. The L166 evaluates the address later.

Relocatable symbols are listed below.

  • Section name (base-relocatable)—specifies section address.
  • Group name (base-relocatable)—specifies group address.
  • Variables and labels (offset-relocatable)—are defined inside of relocatable sections.
  • External constants (somewhat relocatable)—are relocatable to the extent L166 supplies the constant value that must be defined in some other source module.


The following examples show how the previously mentioned relocatable symbols are generated:

Example 1—Section names:

D100       SECTION DATA ; relocatable data section
  V1       DSW 1        ; reserve one word
  V2       DSB 1        ; reserve one byte
D100       ENDS         ; end of data section

  SBASE    DW  D100     ; init word with base of sect. D100
  GBASE    DW  DGR      ; init word with base of group 'DGR'
D200       ENDS

MOV        R5,#DGR      ; DGR is relocatable
MOV        R4,#V2-V1    ; V2-V2 is absolute (2)
MOV        R1,#XVAL     ; use external constant (data4 short form)
MOV        R3,#4 * 8    ; absolute expression

Example 2—Group name using sections from example 1:

DGR   DGROUP  D100, D200        ; group consists of section D100 and D200

Example 3—External constants:

EXTRN  XVAL : DATA4:    ; an external 4-bit constant
EXTRN  YVAL : DATA8:    ; an external 8-bit constant
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.