OTDR
Input and Output Group
Expansion:
OuTput Decrement Repeat
Usage:
otdr
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 decrements HL and decrementsB register. This then repeats until B is zero.
| Instruction | Description | Opcode |
|---|---|---|
| INI | OuTput Decrement Repeat | EDBB |
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)
otdr ; output a byte from (HL) to port C ($FE), decrement HL, decrement B
; after the loop, HL will be decremented by the number of bytes sent,
; and the data block starting at $4FFF will be sent to the I/O port in reverse order