Syntax
[name] DB value1 [,value2 [, ...]]
[name] DW value1 [,value2 [, ...]]
[name] DBIT
[name] DB repeated-count DUP(?)
[name] DW repeated-count DUP(?)
·
Description
These directives reserve the number of bytes/words specified by the repeated-count or reserve
bytes/words only. value1 and value2 should be ? due to the microcontroller RAM. The Cross
Assembler will not initialize the RAM data. DBIT reserves a bit. The content ? denotes
uninitialized data, i.e., reserves the space of the data. The Cross Assembler will gather every 8
DBIT together and reserve a byte for these 8 DBIT variables.
·
Example
DATA .SECTION ¢DATA¢
tbuf DB ?
chksum DW ?
flag1 DBIT
sbuf DB ?
cflag DBIT
In this example, the Cross Assembler reserves byte location 0 for tbuf, location 1 and 2 for
chksum, bit 0 of location 3 for flag1, location 4 for sbuf and bit 1 of location 3 for cflag.
Syntax
name LABEL {BIT|BYTE|WORD}
·
Description
The name with the data type has the same address as the following data variable
· Example
lab1 LABEL WORD
d1 DB ?
d2 DB ?
In this example, d1 is the low byte of lab1 and d2 is the high byte of lab1.
Syntax
name EQU expression
· Description
The EQU directive creates absolute symbols, aliases, or text symbols by assigning an expres
-
sion to name. An absolute symbol is a name standing for a 16-bit value; an alias is a name rep
-
resenting another symbol; a text symbol is a name for another combination of characters. The
name must be unique, i.e. not having been defined previously. The expression can be an inte
-
ger, a string constant, an instruction mnemonic, a constant expression, or an address expres
-
sion.
·
Example
accreg EQU 5
bmove EQU mov
In this example, the variable accreg is equal to 5, and bmove is equal to the instruction mov.
Chapter 4 Assembly Language and Cross Assembler
73