beautypg.com

Ldiw load and increment (word) – Zilog Z80380 User Manual

Page 135

background image

5-101

Z380

U

SER

'

S

M

ANUAL

Z

ILOG

DC-8297-03

LDIW

LOAD AND INCREMENT (WORD)

LDIW

Operation:

if (LW) then begin

(DE)

(HL)

(DE+1)

(HL+1)

(DE+2)

(HL+2)

(DE+3)

(HL+3)

DE

DE + 4

HL

HL + 4

BC(15-0)

BC(15-0) – 4

end

else begin

(DE)

(HL)

(DE+1)

(HL+1)

DE

DE + 2

HL

HL + 2

BC(15-0)

BC(15-0) – 2

end

This instruction is used for block transfers of words of data. The word of data at the location
addressed by the HL register is loaded into the location addressed by the DE register. Both
the DE and HL registers are then incremented by two or four, thus moving the pointers to
the succeeding words in the array. The BC register, used as a byte counter, is then
decremented by two or four.

Both DE and HL should be even, to allow word transfers on the bus. BC must be even,
transferring an even number of bytes, or the operation is undefined.

Flags:

S:

Unaffected

Z:

Unaffected

H:

Cleared

V:

Set if the result of decrementing BC is not equal to zero; cleared otherwise

N:

Cleared

C:

Unaffected

Addressing

Execute

Mode

Syntax

Instruction Format

Time

Note

LDIW

11101101 11100000

3+r+w

L