otir

Output, increment and repeat

Repeats OUTI, writing bytes from memory upward from HL to the port at BC until B is zero.

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

SZHP/VNC ?1????
  • 1 always 1
  • ? undefined (do not rely on it)

Forms

  • otir

    Decrements B and writes the value pointed to by HL to the port whose 16-bit address is in BC. Then increments HL. Repeats this operation until B is zero. Interrupts can trigger while this instruction is processing.

        .org 0x8000
        ld hl, source
        ld b, 2
        ld c, 1
        otir
        halt
source: .byte 42, 7