REGISTER INDIRECT ADDRESSING
Instructions in this group include the original 8008 instructions
that utilized the H and L register pair (High and Low) as a mem-
ory address pointer. In the 8008, data in memory could only be ad-
dressed by the HL pointer. The 8080 added the capability to use
register pairs B,C and D,E as pointers and also added the capabil-
ity of Extended Addressing, where each memory location could be
individually addressed. Register Indirect Addressing is a detriment
where data must be addressed in random (noncontiguous) memory
locations. When data is grouped in contiguous blocks, such as tables
or strings, however, accessing data by the pointer method is some-
what more efficient. The reason for the inefficiency in accessing
random memory locations is that the pointer register must be loaded
with the address of the new byte of data to be accessed before each
instruction of this kind is executed. Access of contiguous data is
made simpler by instructions that automatically increment and dec-
rement by one the register pairs used as pointers. The two proce-
dures for accessing blocks of random and contiguous data are shown
in Table 4-1, along with the relative times. Note that the examples
are for illustrative purposes only to point out the deficiencies in
register indirect addressing; the Z-80 has more eff
icient ways to ac-
cess data and they will be described later in this chapter.
Table 4
-
1. Data Access Using Register Indirect Addressing Charts
THIRD DATA BYTE
FIRST DATA BYTE
SECOND DATA BYTE
FOURTH DATA BYTE
RANDOM ACCESS
1. LOAD DATA POINTER WITH ADDRESS OF
NEXT DATA BYTE
(
5 UNITS).
2. LOAD BYTE USING REGISTER INDIRECT
ADDRESSING (3.5).
3. PROCESS DATA BYTE (X).
4. DONE? IF NOT
. GO TO 1(7).
5. DONE.
X + 15.5 UNITSIBYTE
CALL & RTN
FIRST DATA BYTE
SECOND DATA BYTE
THIRD DATA BYTE
FOURTH DATA BYTE
LAST DATA BYTE
SEQUENTIAL
(
CONTIGUOUS
)
ACCESS
1. LOAD DATA POINTER WITH START OF DATA.
2. LOAD BYTE USING REGISTER INDIRECT
ADDRESSING (3.5).
3. PROCESS DATA BYTE (X).
4. BUMP REGISTER POINTER BY 1(2.5).
5. DONE? IF NOT, GO TO 2 )7).
6. DONE.
X + 13 UNITSIBYTE
46