SPHL
STA
Chapter
3.
Instruction
Set
Example 2: Assume
that
the accumulator contains the bit pdttern
11001111.
The
SI
M instruction masks
out
the
RST5.5, RST6.5, dnd RST7.S
level interrupts and latches a 1 bit into the SOD input.
By
contrast, the bit
pattern
10000111 has no effect since the enable bits 3 and 6 are not set to ones.
MOVE
H&
L
TO
SP
SPHL
10dds
the
contents
of
li1C
Hand
L registers into the SP (Stack Pointer) register.
Operand
SPHL
Operands are
not
permitted with the SPHL instruction.
SP
is
a special purpose 16-bit register used to address the stack; the stack must
be
in
random access memory
(RAM). Because different
applications use different memory configurations, the user program must load the SP
register with the
suck'.,
beginning address. The stack
is
usually
a'>signed
to the highest dvailable location
in
RAM.
The hardware decrements the stack pointer
as
items are ddded to the stdck and increments
the
pointer as items
are removed.
The stdck pointer must
be
initialized before dny instruction
attempts
to access the
<,tack.
Typically, stack
initialization occurs very
early
in
the program. Once estdbli,hed, the stack pointer should
be
altered with
caution.
Arbitrary use
of
SPHL can cause the loss
of
stdck ddtd.
Example:
[_1
____
0_03
Cycles:
Sta tes:
Addressing:
Flags:
5
(6
on
8085)
register
none
A'>sume
that
the H dnd L registers contain 50H and OFFH, respectively. SPHL
IOdds
the stack pointer with the
vdlue
50FFH.
STORE
ACCUMULATOR
DIRECT
STA stores d copy of the
current
dccumuldtor
contents
intu the memory location srecified
in
bytes two and
three of the STA instruction.
Ope
ode
Operand
ST},
address
The address may
be
stated as d number, a previously defined label, or
<in
expression. The
ds~embler
inverts the
high dnd low dddress bytes when
it
builds the instruction.
3-61