Keil Logo

Labels

A label defines a "place" (an address) in your program or data space. All rules that apply to symbol names also apply to labels. When defined, a label must be the first text field in a line. It may be preceded by tabs or spaces. A colon character (:) must immediately follow the symbol name to identify it as a label. Only one label may be defined on a line. For example:

LABEL1:        DS     2
LABEL2:                                       ;label by itself
NUMBER:        DB     27, 33, 'STRING', 0     ;label at a message
COPY:          MOV    R6, #12H                ;label in a program

In the above example, LABEL1, LABEL2, NUMBER, and COPY are all labels.

When a label is defined, it receives the current value of the location counter of the currently selected segment. Refer to Location Counter for more information about the location counter.

You may use a label just like you would use a program offset within an instruction. Labels can refer to program code, to variable space in internal or external data memory, or can refer to constant data stored in the program or code space.

You may use a label to transfer program execution to a different location. The instruction immediately following a label can be referenced by using the label. Your program can jump to or make a call to the label. The code immediately following the label will be executed.

You may use labels to provide information to simulators and debuggers. A simulator or debugger can provide the label symbols while debugging. This can help to simplify the debugging process.

Labels may only be defined once. They may not be redefined.

  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.