beautypg.com

Zilog Z80380 User Manual

Page 27

background image

4-2

Z380

U

SER

'

S

M

ANUAL

DC-8297-03

Z

ILOG

4.2.2 Immediate (IM)

(Continued)

Instruction
OPERATION
OPERAND

The operand value is in the instruction

Immediate mode is often used to initialize registers. Also,
this addressing mode is affected by the DDIR Immediate
Data Directives to expand the immediate value to 24 bits
or 32 bits.

Example of IM mode:

1.

Load immediate value into accumulator

LD A,55H ;Load hex 55 into the accumulator.

A

Before instruction execution

12

After instruction execution

55

4.2.3 Indirect Register (IR)

In Indirect Register addressing mode, the register speci-
fied in the instruction holds the address of the operand.

The data to be processed is in the location specified by the
BC, DE, or HL register (depending on the instruction) for
memory accesses, or C register for I/O.

Memory or
Instruction

Register

I/O Port

OPERATION

REGISTER

Address

OPERAND

The operand value is the contents of the location whose address is in the register.

Depending on the instruction, the operand specified by IR
mode is located in either the I/O address space (I/O
instruction) or memory address space (all other instruc-
tions).

Indirect Register mode can save space and reduce ex-
ecution time when consecutive locations are referenced or
one location is repeatedly accessed. This mode can also
be used to simulate more complex addressing modes,
since addresses can be computed before data is ac-
cessed.

The address in this mode is always treated as a 32-bit
mode. After reset, the contents of the extend registers
(registers with “z” suffix) are initialized as 0's; hence, these
instructions will be executed just as for the Z80/Z180.

Example of IR mode:
1.

Load accumulator from the contents of memory
pointed by (HL)

LD A, (HL) ;Load the accumulator with the data

;addressed by the contents of HL

A

HLz,HL

Before instruction
execution

0F

12345678

After instruction
execution

0B

12345678

Memory location

12345678

0B

2.

Load 24-bit immediate value into HL
register

DDIR IB, LW

;next instruction is in Long Word
mode, with ;an additional
immediate data

LD HL, 123456H

;load HLz, and HL with constant
123456H

This case, the Z380 CPU appends 00H as a MSB byte.

HLz

HL

Before instruction execution

0987

6543

After instruction execution

0012

3456