LDDR

Operation

{(DE) <- (HL), DE <- DE-1, HL <- HL-1, BC <- BC-1} while (BC != 0)

Mnemonic

LDIR

Operands

None

b7b6b5b4b3b2b1b0
1 1 1 0 1 1 0 1$ED
1 0 1 1 1 0 0 0$B8

Description

This 2-byte instruction transfers a byte of data from the memory location addressed by the contents of the HL register pair to the memory location addressed by the DE register pair. Both these register pairs and the BC (Byte Counter) are decremented If decrementing causes BC to go to 0, the instruction is terminated. If BC is not 0, the program counter is decremented by two and the instruction is repeated. Interrupts are recognized and two refresh cycles are executed after each data transfer. When the BC is set to 0 prior to instruction execution, the instruction loops through 64 KB.

Condition Bits Affected

Sis not affected.
Zis not affected.
His reset.
P/Vis set if BC-1 != 0; otherwise, it is reset.
Nis reset.

Example

The HL register pair contains $1114, the DE register pair contains $2225, the BC register pair contains $0003, and memory locations contain the following data.

($1114)contains$A5($2225)contains$C5
($1113)contains$36($2224)contains$59
($1112)contains$88($2223)contains$66

Upon the execution of

	LDDR

the contents of register pairs and memory locations now contain:

HLcontains$1111
DEcontains$2222
BCcontains$0000
($1114)contains$A5($2225)contains$A5
($1113)contains$36($2224)contains$36
($1112)contains$88($2223)contains$88