Modular Programming in 8086 Microprocessor

Modular Programming in 8086 Microprocessor:

Many programs are too large to be developed by one programmer. Such programs are developed by team of programmers. They divide a large program into smaller modules. Then each Modular Programming is individually written, tested and debugged. When all modules are tested ‘OK’, they are linked together to form a large functioning program.

1.Assembling Process:

As mentioned earlier, assembler translates a source file that was created using the editor into machine language such as binary or object code. The assembler reads the source file of our program from the disk where we saved it after editing. An assembler usually reads our source file more than once.

The assembler generates two files on the floppy or hard during these two passes. The first file is called the object file. The object file contains the binary codes for the instructions and information about the addresses of the instructions. The second file generated by the assembler is called assembler list file. This file contains the assembly language statements, the binary code for each instruction, and the offset for each instruction.

In the first pass, the assembler performs the following operations

  1. Reading the source program instructions.

  2. Creating a symbol table in which all symbols used in the program, together with their attributes, are stored.

  3. Replacing all mnemonic codes by their binary codes.

  4. Detecting any syntax errors in the source program.

  5. Assigning relative addresses to instructions and data.

On a second pass through the source program, the assembler extracts the symbol from the operand field and searches for it in the symbol table. If the symbol does not appear in the table, the corresponding statement is obviously erroneous. If the symbol does appear in the table, the symbol is replaced by its address or value.

2.Linking Process:

A linker is a program used to join together several object files into one large object file. When writing large programs, it is usually much more efficient to divide the large program into smaller modules. Each Modular Programming can be individually written, tested and debugged. When all the Modular Programming work, they can be linked together to form a large functioning program.

The linker produces a link file which contains the binary codes for all the combined modules. The linker also produces a link map which contains the address information about the link files. The linker, however, does not assign absolute addresses to the program, it only assigns relative addresses starting from zero. This form of the program is said to be relocatable, because it can be put anywhere in memory to be run.

3.Debugging Process:

A debugger is a program which allows us to load our object code program into system memory, execute the program, and debug it.

How does a debugger help in debugging a program ?

  1. The debugger allows us to look at the contents of registers and memory locations after our program runs.

  2. It allows us to change the contents of register and memory locations and rerun the program.

  3. Some debugger allows us to stop execution after each instruction so we can check or alter memory and register contents.

  4. A debugger also allows us to set a breakout at any point in our program. When we run a program, the system will execute instructions up to this break point and stop. We can then examine register and memory contents to see if the results are correct at that point. If the results are correct, we can move the break point to a later point in our program. If results are not correct, we can check the program up to that point to find out why they are not correct.

In short, debugger tools can help us to isolate problems in our program.

Updated: August 13, 2018 — 10:45 pm