A large program is difficult to implement even if an algorithm is available, hence it should be split into number of independent tasks which can be easily designed and implemented. The process of splitting a large program into small tasks and designing them independently is known as modular programming.
Large program are more prone to errors and it is difficult to locate and isolate errors. A repeated group of instruction in a program can be organized as subprograms. These subprograms are called as subroutine or procedure in assembly language programming which allows reuse of program code. A procedure is a set of the program statements that can be processed independently.
Advantage of procedures:
- Simple modular programming.
- Reduced work load and development time.
- Debugging of the program and procedure becomes easy.
- Reduction in the size of the main program.
- Reuse of the procedure many times in the same program or in another program.
- Library of the procedures can be implemented by combining well designed, tested and proven procedures.
Disadvantages of procedures:
- Extra code is required to integrate procedures, like CALL and RET instructions.
- Required extra overhead while establishing a linkage between the calling program and the called procedure or vice versa, hence execution takes more time.
- As the run time overhead required for communication between small procedures is more than the execution time of the procedure and hence the use of small procedures are not preferable, instead, macro can be used.