lddr

Load, decrement and repeat

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

2 bytes21/16 cycles21 cycles each time it repeats, 16 the last time

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 decrements HL, DE, and BC. Repeats this operation until BC is zero. 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