lddr

Load, decrement and repeat

Copies bytes from (HL) to (DE), decrementing HL, DE and BC, until BC is zero.

2 bytes · 21/16 cycles21 cycles for a pass that repeats, 16 for the last

SZHP/VNC ––000–
  • 0 always 0
  • – not changed

Forms

  • lddr

    Transfers a byte of data from the memory location pointed to by HL to the memory location pointed to by DE. Then HL, DE, and BC are decremented. If BC is not zero, this operation is repeated. Interrupts can trigger while this instruction is processing.

        .org 0x8000
        ld hl, source + 3
        ld de, 0x9000 + 3
        ld bc, 4
        lddr
        halt
source: .byte 1, 2, 3, 4