Chapter
2.
Assembly
Language
Concepts
SYMBOLS
AND
SYMBOL
TABLES
Symbolic Addressing
If you have never done symbolic programming before, the following analogy may help clarify the distinction
between a symbolic and an
ab,olute
address.
The locations
in
program memory can
be
compared to a cluster
of
post office boxes. Suppose Richard Roe
rents box
500 for two months.
He
can then ask for his letters by saying 'Give
me
the mail
in
box 500,' or
'Give
me
the mail for Roe.' If Donald Smith late( rents box 500, he too can ask for his mail by either box
number
500 or by his name. The
content
of
the post office box can
be
accessed by a fixed, absolute address
(500) or by a symbolic, variable name. The postal clerk correlates the symbolic names and their absolute values
in
his
log
book. The assembler performs the same function, keeping track
of
symbols and their values
in
a
symbol
table. Note
that
you do not have
to
assign values to symbolic addresses. The assembler references its
location counter during the assembly
proce5S to calculate these addresses for you. (The location counter does
for the
as~embler
what the program counter does for the microcomputer.
It
tells the assembler where the next
instruction
or
operand
is
to be placed
in
memory.)
Symhol Characteristics
A symbol
can contain one to six alphabetic (A-Z) or numeric (0-9) characters (with the first character alphabetic)
or the
'>pecial
character
'?'
or
'@'.
A dollar
';ign
can be used
as
a symbol to denote the value currently
in
the
location counter. For
eXample, the command
JMP
$+6
forces
a jump to the
imtruction
residing six memory locations higher than the
JMP
instruction. Symbols
of
the
form
'??nnn'
are generated by the as>;embler to uniquely name symbols local to macros.
The
a'>sembler regdrds symbols
as
having the following attribute>;:
re'>erved
or user-defined; global or limited;
permanent
or
reddinable;
<lnd
absolute or rclocatable.
Reserved, User-Defined, and Assembler-Generafed Symbols
Reserved symbol<, are those
that
already have special meaning to the assembler and therefore
cannot
appear
as
user-defined '>ymbols. The mnemonic names for machine instructions and
the
assembler directives are
all
reserved
symbol.,.
2-9