Experiment No. 10 MP
Experiment No. 10 MP
:06
Objective: To understand how to provide us an ease in our code by making the set
of instructions reusable
Theory: Procedure is a part of code that can be called from your program in order to
make some specific task.
A procedure is group of instructions that usually performs one task. It is a reusable
section of a software program which is stored in memory once but can be used as
often as necessary.
Directives used for procedure : PROC directive: The PROC directive is used to identify
the start of a procedure. The PROC directive follows a name given to the
procedure.After that the term FAR and NEAR is used to specify the type of the
procedure.
ENDP Directive: This directive is used along with the name of the procedure to
indicate the end of a procedure to the assembler. The PROC and ENDP directive are
used to bracket a procedure.
CALL instruction and RET instruction : CALL instruction : The CALL instruction is used
to transfer execution to a procedure.It performs two operation.When it executes,first
it stores the address of instruction after the CALL instruction on the stack.Second it
changes the content of IP register in case of Near call and changes the content of IP
register and cs register in case of FAR call.
There are two types of calls.
1)Near Call or Intra segment call.
2) Far call or Inter Segment call