LDD
Exchange, Block Transfer and Search Group
Expansion:
LoaD Decrement
Usage:
ldd
The LDD (Load and Decrement) instruction in the Z80 microprocessor is used to copy a byte from the address pointed to by the HL register pair to the address pointed to by the DE register pair, then decrement both HL and DE, and also decrement BC.
| Instruction | Description | Opcode |
|---|---|---|
| LDD | LoaD Decrement | EDA8 |
Example
; Example
ld hl, $4000 ; source address (start of screen memory)
ld de, $6000 ; destination address (anywhere in RAM)
ld bc, $1800 ; number of bytes to copy (size of screen memory)
; loop to copy bytes
copy_loop:
ldd ; perform LDD operation
ld a, b ; check if BC is zero
or c
jp nz, copy_loop ; repeat until BC is zero
; end of program
halt ; halt the processor