RET

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

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.