Keil Logo

A166: RET Is Replaced with RETI or RETS

Information in this article applies to:

  • A166


I have written a procedure in assembler and I used a RET instruction to return from it. When I assemble my code, the RET instruction is replaced with RETI or RETS. What is going on?


You are using the PROC and ENDP statements to define your procedure. For that reason, when your file is assembled, the RET instruction is automatically converted to the appropriate form of the return instruction. The form of the return instruction is determined by the type of procedure (near, far or interrupt).

  • RETS Returns from far procedures.
  • RETI Returns from interrupt procedures.
  • RET Returns from near procedures.


  • Refer to PROC in the A166 User's Guide.
  • Refer to ENDP in the A166 User's Guide.

Last Reviewed: Thursday, February 25, 2021

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.