Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
70
Добавлен:
14.04.2015
Размер:
2.03 Mб
Скачать

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

73

 

 

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 examples,

LABEL1, LABEL2, NUMBER, and

COPY are all labels.

3

 

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

You can 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 can 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 can also 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.

Shaded directives and options are available only in AX51 and A251.

Соседние файлы в папке HLP