# `ccf`

[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/ccf

**Complement carry flag**

Category: System

Inverts C, copying its old value into H and clearing N.

1 byte · 4 cycles

## Flags

| Flag | Effect |
| --- | --- |
| S | not changed |
| Z | not changed |
| H | changed as the description says |
| P/V | not changed |
| N | always 0 |
| C | changed as the description says |

## Forms

- `ccf` · Inverts the carry flag. The half-carry flag receives the previous value of the carry flag.

## Example

```z80
        .org 0x8000
        ccf
        halt
```
