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


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


Preserves all flags.


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


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

ret 10
condition true condition false
ret cc 11 5

See Also


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