Chapter 4 Assembly Language and Cross Assembler
Syntax
[name]
[name]
[name]
[name]
[name]
DB
value1
[,value2 [, ...]]
DW
value1
[,value2 [, ...]]
DBIT
DB
repeated-count
DUP(?)
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
tbuf
chksum
flag1
sbuf
cflag
.SECTION
DB ?
DW ?
DBIT
DB ?
DBIT
¢DATA¢
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
d1
d2
LABEL
DB ?
DB ?
WORD
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
bmove EQU
5
mov
In this example, the variable
accreg
is equal to 5, and
bmove
is equal to the instruction
mov.
145
Home Index Bookmark Pages Text
Previous Next
Pages: Home Index