{(DE) <- (HL), DE <- DE-1, HL <- HL-1, BC <- BC-1} while (BC != 0)
LDIR
None
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | $ED |
1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | $B8 |
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.
S | is not affected. |
Z | is not affected. |
H | is reset. |
P/V | is set if BC-1 != 0; otherwise, it is reset. |
N | is reset. |
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:
HL | contains | $1111 | |||
DE | contains | $2222 | |||
BC | contains | $0000 | |||
($1114) | contains | $A5 | ($2225) | contains | $A5 |
($1113) | contains | $36 | ($2224) | contains | $36 |
($1112) | contains | $88 | ($2223) | contains | $88 |