XTHL
Chapter
3.
Instruction
Set
EXCHANGE
H&L
WITH
TOP OF STACK
XTHL exchanges two bytes from the top
of
the stack with the two bytes stored
in
the H dnd L registers. Thus,
XTHL both saves the current
contents
of
the
Hand
L registers and loads new values into
Hand
L.
Opcode Operand
XTHL
Operands are
not
allowed with the XTHL instruction.
XTHL exchanges the
contents
of
the L register with the
contents
of
the memory location specified
by
the
SP
(Stack Pointer) register. The
contents
of
the H register are exchanged with the
contents
of
SP+1.
Cycles:
States:
Addressing:
Flags:
Example:
o 0 0 I I
5
18 (16 on 8085)
register indirect
none
Assume
that
the
~tdck
pointer register contains 1 OADH; register H contains
OBH
dnd L contains 3CH; and
memory
locations 10ADH and 10AEH contain
FOH
and ODH, respectively. The following
i';
dn
illustrdtion
of
the effect
of
the XTHL instruction:
Before XTHL
After XTHL
10AC
FF
FF
MEMORY ADDRESS
lOAD
10AE
FO
00
3C
08
H L
lOAF
FF
OB
3C
FF
00
Fe
The stack pointer register remains unchanged following execution
of
the XTHL instruction.
Hi9