ZiLOG Z80-CPU Technical Manual page 27

Table of Contents

Advertisement

Modified Page Zero Addressing. The Z-80 has a special single byte CALL instruction to any of 8 locations
in page zero of memory. This instruction (which is referred to as a restart) sets the PC to an effective
address in page zero. The value of this instruction.is that it allows a single byte to specify a complete
16-bit address where commonly called subroutines are located, thus saving memory space.
I
OP Code lone byte
b 7
b O
Effective address is (b S b 4 b 3 000)2
Relative Addressing.
Relative addressing uses one byte of data following the OP code to specify a
displacement from the existing program to which a program jump can occur. This displacement is
a signed two's complement number that is added to the address of the OP code of the following instruction.
OP Code }
Jump relative (one byte OP code)
Operand
8-bit two's complement displacement added to Address (A+2)
The value of relative addressing is that it allows jumps to nearby locations while only requiring two
bytes of memory space. For most programs, relative jumps are by far the most prevalent type of
jump due to the proximity of related program segments. Thus, these instructions can significantly
reduce memory space requirements. The signed displacement can range between +127 and
-128
from A + 2. This allows for a total displacement of + 129 to -126 from the jump relative OP code address.
Another major advantage is that it allows for relocatable code.
Extended Addressing. Extended Addressing provides for two bytes (16 bits) of address to be included
in the instruction. This data can be an address to which a program can jump or it can be an address
where an operand is located.
t-0_P_C_o_d_e _ _ _ _ _ _ _ _ _ _ _ _
-j}
one or two bytes
Low Order Address
or
Low order operand
High Order Address or high order operand
Extended addressing is required for a program to jump from any location in memory to any other location,
or load and store data in any memory location.
When extended addressing is used to specify the source or destination address of an operand,
the notation (nn) will be used to indicate the content of memory at nn, where nn is the 16-bit address
specified in the instruction. This means that the two bytes of address nn are used
as
a pointer to a memory
location. The use of the parentheses always means that the value enclosed within them is used as a
pointer to a memory location. For example, (1200) refers to the contents of memory at location 1200.
Indexed Addressing.
In this type of addressing, the byte of data following the OP code contains
a displacement which is added to oneofthe two index registers (the OP code specifies which index
register is used) to form a pointer to memory. The contents of the index register are not altered by this
operation.
OP Code
}
1 - - - - - - - - 1
two byte OP code
OP Code
Displacement
Operand added to index register to form a pointer to memory.
21

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Z80-CPU and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Z80a-cpu

Table of Contents