ldir

Load, increment and repeat

Copies BC bytes from (HL) to (DE), incrementing both, until BC is zero.

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

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

Forms

  • ldir

    Transfers a byte of data from the memory location pointed to by HL to the memory location pointed to by DE. Then increments HL and DE and decrements BC. Repeats this operation until BC is zero. Interrupts can trigger while this instruction is processing.

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