# `outd`

[Z80 Documentation](https://asm-editor.specy.app/documentation/z80.md) › [Instructions](https://asm-editor.specy.app/documentation/z80/instruction.md)

Web page: https://asm-editor.specy.app/documentation/z80/instruction/outd

**Output and decrement**

Category: Input/output

Decrements B, writes the byte at (HL) to the port addressed by BC, then decrements HL.

2 bytes · 16 cycles

## Flags

| Flag | Effect |
| --- | --- |
| S | undefined afterwards |
| Z | changed in a way of its own, as the form says |
| H | undefined afterwards |
| P/V | undefined afterwards |
| N | always 1 |
| C | undefined afterwards |

## Forms

- `outd` · B is decremented. A byte from the memory location pointed to by HL is written to the port at the 16-bit address contained in the BC register pair. Then HL is decremented. Note that the carry flag may be affected, contrary to documentation. [Read More](http://z80.info/z80undoc3.txt)

## Example

```z80
        .org 0x8000
        ld hl, source + 1
        ld b, 2
        ld c, 1
        outd
        halt
source: .byte 42, 7
```
