z80:Opcodes:RET

From Learn @ Cemetech
Revision as of 22:43, 5 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Pops the top of the stack into the program counter. Note that RET can be either conditional or unconditional.

Syntax

   ret		;no conditions
   ret cond.	;conditional

Allowed Instructions

   ret z     ; Z flag is set
   ret nz      ; Z flag is reset
   ret c    ; Carry flag is set
   ret nc    ; Carry flag is reset
   ret m    ; S flag is set
   ret p    ; S flag is reset
   ret pe    ; P/V is set
   ret po    ; P/V is reset

Effects

Preserves all flags.

Uses

RET is used mostly for exiting an assembly program or returning from a routine.

T-States

cc is condition: NZ, Z, NC, C, PO, PE, P, M

ret 10
condition true condition false
ret cc 11 5

See Also

BIT,CALL,CP,CPD,CPDR,CPI,CPIR,RETI,RETN