# `call`

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

Category: Control flow

Pushes the return address onto the stack and jumps to a 16-bit address, either always or only when a flag condition is met.

17/10 cycles: 17 when it calls, 10 when it does not

Used in: [call, ret and passing values](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/call-ret-and-passing-values.md) (Z80 assembly), [Ports: in and out](https://asm-editor.specy.app/learn/courses/z80/talking-to-the-outside-world/ports-in-and-out.md) (Z80 assembly), [Interrupts: im, ei, di and halt](https://asm-editor.specy.app/learn/courses/z80/talking-to-the-outside-world/interrupts-im-ei-di-and-halt.md) (Z80 assembly), [A subroutine with its arguments in registers](https://asm-editor.specy.app/learn/courses/z80/examples/subroutine-with-register-arguments.md) (Z80 assembly), [Stack arguments and a stack frame](https://asm-editor.specy.app/learn/courses/z80/examples/subroutine-with-stack-arguments.md) (Z80 assembly), [Recursion: factorial and Fibonacci](https://asm-editor.specy.app/learn/courses/z80/examples/factorial-and-fibonacci.md) (Z80 assembly), [Print a string](https://asm-editor.specy.app/learn/courses/z80/examples/hello-world.md) (Z80 assembly), [Read two numbers and print their sum](https://asm-editor.specy.app/learn/courses/z80/examples/sum-of-two-numbers.md) (Z80 assembly), [Print a number in any base without help](https://asm-editor.specy.app/learn/courses/z80/examples/number-to-string.md) (Z80 assembly), [The snake game](https://asm-editor.specy.app/learn/courses/z80/examples/snake.md) (Z80 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| S | not changed |
| Z | not changed |
| H | not changed |
| P/V | not changed |
| N | not changed |
| C | not changed |

## Forms

- `call nnnn` · 3 bytes · 17 cycles · The current PC value plus three is pushed onto the stack, then is loaded with `nnnn`.

- `call cc, nnnn` · 3 bytes · 17/10 cycles · If the condition `cc` is true, the current PC value plus three is pushed onto the stack, then is loaded with `nnnn`.
  - `call nz, nnnn`
  - `call z, nnnn`
  - `call nc, nnnn`
  - `call c, nnnn`
  - `call po, nnnn`
  - `call pe, nnnn`
  - `call p, nnnn`
  - `call m, nnnn`

## Pseudo-instructions

Other spellings the assembler accepts; each form shows the instruction it becomes.

- `call cc, nnnn` · 3 bytes · 17/10 cycles · cc: nv v · If the condition `cc` is true, the current PC value plus three is pushed onto the stack, then is loaded with `nnnn`.
  - `call nv, nnnn` → `call po, nnnn`
  - `call v, nnnn` → `call pe, nnnn`

## Operands

- [`nnnn`](https://asm-editor.specy.app/documentation/z80/registers/operand-nnnn.md): A 16-bit value or address, `0` to `65535`, written as a number or label. `(nnnn)` accesses memory at that address.
- [`cc`](https://asm-editor.specy.app/documentation/z80/registers/operand-cc.md): A flag condition: `nz` (zero flag clear, `Z = 0`), `z` (zero flag set, `Z = 1`), `nc` (carry flag clear, `C = 0`), `c` (carry flag set, `C = 1`), `po` (parity/overflow flag clear, `P/V = 0`), `pe` (parity/overflow flag set, `P/V = 1`), `p` (sign flag clear, `S = 0`), `m` (sign flag set, `S = 1`), `nv` (alias for `po`, `P/V = 0`) or `v` (alias for `pe`, `P/V = 1`). Here `c` tests the carry flag; it does not name the `c` register.

## Example

```z80
        .org 0x8000
        call nz, target
        halt
target: ret
```
