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

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

119

 

 

Memory Initialization

The memory initialization directives are used to initialize code or constant space in either word, double-word, or byte units. The memory image starts at the point indicated by the current value of the location counter in the currently active segment.

DB

The DB directive initializes code memory with 8-bit byte values. The DB directive has the following format:

label:

DB expression

, expression

 

where

 

 

4

label

is the symbol that is given the address of the initialized

 

memory.

 

expression is a byte value. Each expression may be a symbol, a character string, or an expression.

The DB directive can only be specified within a code or const segment. If the DB directive is used in a different segment, Ax51 will generate an error message.

Example

REQUEST:

DB

'PRESS ANY KEY TO CONTINUE', 0

TABLE:

DB

0,1,8,'A','0', LOW(TABLE),';'

ZERO:

DB

0, ''''

CASE_TAB:

DB

LOW(REQUEST), LOW(TABLE), LOW(ZERO)

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

120

Chapter 4. Assembler Directives

 

 

DW

The DW directive initializes code memory with 16-bit word values. The DW directive has the following format:

 

 

label:

DW

expression , expression

 

 

where

 

 

 

 

label

 

is the symbol that is given the address of the initialized

 

 

 

 

memory.

 

 

expression

is the initialization data. Each expression may contain a

 

 

 

 

symbol, a character string, or an expression.

 

 

The DW directive can only be specified within a code or const segment. If the

 

 

DW directive is used in a different segment, Ax51 will generate an error

 

4

 

Examplemessage.

 

 

 

 

 

 

 

 

 

TABLE:

DW

TABLE, TABLE + 10, ZERO

 

 

 

ZERO:

DW

0

 

 

CASE_TAB:

DW

CASE0, CASE1, CASE2, CASE3, CASE4

 

 

 

DW

$

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

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

121

 

 

DD (AX51 & A251 only)

The DD directive initializes code memory with 32–bit double word values. The DD directive has the following format:

label: DD

expression , expression

where

 

label

is the symbol that is given the address of the initialized

 

memory and

expression

is the initialization data. Each expression may contain a

 

symbol, a character string, or an expression.

The DD directive can only be specified within a code or const segment. If the DD directive is used in a different segment, Ax51 will generate an error message.

Example

 

4

TABLE:

DD

TABLE, TABLE + 10, ZERO

 

 

DD

$

 

ZERO:

DD

0

 

LONG_VAL:

DD

12345678H, 0FFFFFFFFH, 1

 

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

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