Mnemonics

OTIR

Input and Output Group
Expansion:
OuTput Increment Repeat
Usage:
dec {r}

Outputs to the port address found in memory at pointer C register i.e. (C) and sends the data stored in address pointer (HL). It then increments HL and decrementsB register. This then repeats until B is zero.

Z80.CPU instructions
Instruction Description Opcode
INI OuTput Increment Repeat EDB3

Example

; Example ld bc, $00FE ; load BC with the address of port 254 ($FE) and the counter in B ld hl, $4FFF ; load HL with the ending address of the memory block ld b, $10 ; load B with the number of bytes to send (16 bytes in this example) otir ; output a byte from (HL) to port C ($FE), increment HL, decrement B ; after the loop, HL will be incremented by the number of bytes sent, ; and the data block starting at $4FFF will be sent to the I/O port in reverse order

See also