Chapter 2. Assembly Language Concepts
Permanent and Redefl'nable Symbols
Most
symbol~
drc
permanent
since their vdlue
cannot
chdnge during the
a~sembly
operation.
Only symbols
defined with the
SET and MACRO assembler directives arc redefinable.
Absolute
and Relocatable Symbols
An
important
attribute
of
symbols with this dssembler
is
that
of
relocatability. Relocatable programs arc
assembled relative
to
memory location zero. These progrdms arc Idter relocated to some
other
set
of
memory
locations. Symbols with addresses
that
change during relocation arc relocatdble symbols. Symbols with
addres,e,
that
do
not
change durillg
relocltion
are absolute symbols.
Thi,>
distinction becomes
important
when
the symbols
arc used within expressions,
a'>
will
be explained Idter.
External and public
symbol,
arc
'>pecial
types
of
relocatdble ,ymbols. These
,ymbols
<Ire
required
to
establish
program lillkdge when
sever,iI relocatdble program
module,
arc boulld together
to
form a single application
program. ExternJI symbols
arc those used
in
the
current
program module, but defined
in
,lIlother module.
Such symbols must
appear
in
dn
EXTRN ';tatelTlellt, or the assembler will
fidg
them
as
undefined.
Conversely,
PUBLIC <,ymbols arc defined
in
thc current progr·am module,
but
mdY
be dccessed by
other
module,>. The dCldresses for
the,c
,>ymbols dre resolved·when the
module,
Me
boulld together.
Absolute
and r·clocatable
,ymbols
mdY
both
appear
in
d relocatable module. References to any
of
the assembler-
defined register) A through E, H dnd
L,
PSW,
SP, and M arc absolute since they refer to hardware locations.
But
these refercllccs arc valid
in
allY
module.
ASSEMBLY-TIME
EXPRESSION
EVALUATION
An
expression i, d
combination
of
numbers, symbols, and operators. Each clement
of
an expression
is
a term.
Expressions, likc
,ymbols,
may be
db,olute
or relocatable. For the sake
of
readers who do
not
require the
relocation fedture,
absolute expre,sions are described first. However, users
of
relocation should read
all
the
following.
Operators
The dssembler include, five groups
of
opcr
ators
which per·mit the following assembly·time operations: arithmetic
operations, shift operations,
logical operations, comp<lre operations, and
byte
isolation operations. It
is
important
to
keep
in
mind thdt these arc
all
assembly·tillle operations. Once the assembler has evaluated an expression, it
becomes a
permanent
part
of
your
prograill. Assume, for example,
that
your
program defines a list
of
ten con-
stants starting at the label LIST; the following instruction loads the address
of
the seventh item
in
the list into
the
Hand
L registers:
LXI
H,LlST+6
Notice
that
LIST addresses the first item, LlST+ 1 the second, and so on.
2·11