ASM2 - Documentation
  • 📚ASM2 - Documentation
  • Registers
  • Address Registers
  • Instructions
    • DISP
    • END
    • MOV
    • RET
  • Operators
    • ADD
    • SUB
    • MUL
    • DIV
  • Functions
  • Subroutines
  • Jump
    • Conditional Jump
      • Jump Equal (JE)
      • Jump Not Equal (JNE)
      • Jump Greater (JG)
      • Jump Greater or Equal (JGE)
      • Jump Less (JL)
      • Jump Less or Equal (JLE)
    • Unconditional Jump
Powered by GitBook
On this page
  • Definition
  • Usage
  1. Instructions

END

END (End of Function) Instruction

Definition

The "END" instruction is employed in assembly language to mark the conclusion of a function. It serves as a signal to indicate the end of a function's code block, allowing the program to seamlessly transition to the main program or other functions. When the assembler encounters the "END" instruction within a function, it interprets this as the termination point of the function's code execution, and control is transferred back to the calling point in the main program.

Usage

The usage of the "END" instruction is crucial in assembly language programming for the proper termination of functions and the correct flow of control within the program. Here are key points highlighting the usage of the "END" instruction:

  • Termination of Function:

    END

    The simple "END" statement alone is used to signify the conclusion of the function. When this instruction is encountered during program execution, it marks the end of the function, and control is returned to the main program.

  • Return to Main Program: The primary purpose of the "END" instruction is to facilitate a smooth return to the main program or the point in the program where the function was originally called. This ensures that the program continues its execution seamlessly.

  • Function Call Handling:

    CALL .functionName
    ...
    END

    In the context of a function, the "END" instruction is typically encountered after the function's code block. This sequence is commonly seen in function definitions, where the function is called using the "CALL" instruction, and the "END" marks its conclusion.

PreviousDISPNextMOV

Last updated 1 year ago