Advantages and Disadvantages of using Procedures in the 8086 Microprocessor

In this tutorial, we will learn about the pros (advantages) and cons (disadvantages) that the procedures offer while being implemented. Here, the implementation of the procedures is concerning the 8086 Microprocessor. By Monika Sharma Last updated : May 16, 2023

A procedure is a set of instructions that is written separately and can be used in any part of the entire code that too any number of times just by making a call to it from the mainline program. It has certain advantages and disadvantages.

Advantages of using procedures

  • Reusability of code:
    The procedures provide us an ease in our code by making the set of instructions reusable. So, we need not write the same set of instructions again and again when required.
  • Less usage of memory:
    The procedure is a subprogram which is stored in the memory only one. But it can used as many times as required. So, this occupies less memory space.
  • Development becomes easier:
    By using procedures in a code, the modular programming can be well implemented and so, each part of the code is written in a different module which can be developed by a separate developer. So, this reduces the burden on one developer and the programming becomes simple for each of them.
  • Reduced development time:
    As separate developers can work on different modules of programs separately, multiple developers can work on the project simultaneously which reduces the total development time of the project.
  • Debugging and error fixing becomes easier:
    It becomes easier to detect and fix errors if the program is present in different modules rather than the entire program being present in a single code fragment.

Disadvantages of using procedures

  • Extra code is required to integrate the procedures:
    Every time a procedure is to be implemented in the program, we require CALL and RET instructions to integrate the procedures with the calling program.
  • Extra time required to link the procedures:
    Whenever a call to procedure is made, the control of the processor goes to the procedure code, and then returns to the calling program code. This takes a lot of extra time.
  • Not efficient way to use for a small set of instructions:
    When the number of instructions is much less, then the calling and returning from the procedures itself takes a lot more time than executing the instructions itself. So, it is better to use procedures in cases where the set of instructions to be included in the procedure is large.
  • Extra load on the processor:
    The processor needs to do extra work to save the status of the current procedure and load status of the called procedure. Also, the instruction queue must be emptied so that the instructions of the procedure can be filled in the queue.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.