Download Print this page

ZiLOG Z80380 User Manual page 32

Advertisement

Z
ILOG
4.2.7 Stack Pointer Relative Mode (SR)
For Stack Pointer Relative addressing mode, the data
processed is at the location whose address is the contents
of the Stack Pointer, offset by an 8-bit displacement in the
instruction.
The Stack Pointer Relative address is computed by adding
the 8-bit two's complement signed displacement speci-
fied in the instruction to the contents of the SP, also
specified by the instruction. Stack Pointer Relative ad-
dressing mode is used to specify data items to be found in
the stack, such as parameters passed to procedures.
Offset portion can be expanded to 16 or 24 bits by using
DDIR immediate instructions (DDIR IB for a 16-bit offset,
DDIR IW for a 24-bit offset).
Instruction
OPERATION
DISPLACEMENT
Example of SR mode:
1. Load HL from location (SP – 4) in Native mode, Word mode
LD HL, (SP–4)
;Load into the HL from the
;contents of the memory location
;whose address is four less than
;the contents of SP.
;Assume it is in Native/Word mode.
Before instruction execution
After instruction execution
Memory location
Address calculation: In Native mode, FCH (–4 in Decimal)
encoding in the instruction is sign extended to a 16-bit
value before the address calculation. Calculation is done
in modulo 2
16
and does not take into account the Stack
Pointer's extended portion.
DC-8297-03
SP
ADDRESS
——|
——+
HLz
HL
1234
5678
EFCD AB89
07FF7EFC
07FF7EFD
Note that computation of the effective address is affected
by the operation mode (Native or Extended). In Native
mode, address computation is done in modulo 2
ing computation is done in 16-bit and does not affect upper
half of the SP portion for calculation (wrap around within the
16-bit). In Extended mode, address computation is done
32
in modulo 2
.
Also, the size of the data transfer is affected by the LW
mode bit. In Word mode, transfer is done in 16 bits, and in
Long Word mode, transfer is done in 32 bits.
MEMORY
OPERAND
SPz
SP
07FF
7F00
07FF
7F00
89
AB
7F00
+
FFFC
7EFC
Z380
U
'
M
SER
S
ANUAL
16
, mean-
4-7

Advertisement

loading
Need help?

Need help?

Do you have a question about the Z80380 and is the answer not in the manual?