ret

Return

Pops the top stack entry into PC, either always or only when a flag condition is met.

1 byte11/5 cycles: 11 when it returns, 5 when it does not

SZHP/VNC ––––––
  • Leaves every flag unchanged

Forms

  • ret 10 cycles

    Pops the top stack entry into PC.

  • If the condition cc is true, pops the top stack entry into PC.

Pseudo-instructions

The assembler also accepts these forms, which are other ways to write Z80 instructions. Open a row to see what each form becomes.

  • If the condition cc is true, pops the top stack entry into PC.

Operands

cc
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. More
        .org 0x8000
        ret nz
        halt